diff --git a/swaggerci/recoveryservicessiterecovery/.gitattributes b/swaggerci/recoveryservicessiterecovery/.gitattributes new file mode 100644 index 000000000000..2125666142eb --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/.gitattributes @@ -0,0 +1 @@ +* text=auto \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/.gitignore b/swaggerci/recoveryservicessiterecovery/.gitignore new file mode 100644 index 000000000000..7998f37e1e47 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/.gitignore @@ -0,0 +1,5 @@ +bin +obj +.vs +tools +test/*-TestResults.xml \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/Az.SiteRecovery.csproj b/swaggerci/recoveryservicessiterecovery/Az.SiteRecovery.csproj new file mode 100644 index 000000000000..6466d3351ab4 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/Az.SiteRecovery.csproj @@ -0,0 +1,44 @@ + + + + 0.1.0 + 7.1 + netstandard2.0 + Library + Az.SiteRecovery.private + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery + true + false + ./bin + $(OutputPath) + Az.SiteRecovery.nuspec + true + + + 1998, 1591 + true + + + + + false + TRACE;DEBUG;NETSTANDARD + + + + true + true + MSSharedLibKey.snk + TRACE;RELEASE;NETSTANDARD;SIGN + + + + + + + + + $(DefaultItemExcludes);resources/** + + + \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/Az.SiteRecovery.format.ps1xml b/swaggerci/recoveryservicessiterecovery/Az.SiteRecovery.format.ps1xml new file mode 100644 index 000000000000..beaa638c1172 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/Az.SiteRecovery.format.ps1xml @@ -0,0 +1,21657 @@ + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ReplicationProtectedItemsUpdateMobilityServiceAcceptedResponseHeaders + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ReplicationProtectedItemsUpdateMobilityServiceAcceptedResponseHeaders + + + + + + + + + + + + Location + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.SiteRecoveryIdentity + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.SiteRecoveryIdentity + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AlertSettingName + + + EventName + + + FabricName + + + Id + + + IntentObjectName + + + JobName + + + LogicalNetworkName + + + MappingName + + + MigrationItemName + + + MigrationRecoveryPointName + + + NetworkMappingName + + + NetworkName + + + PolicyName + + + ProtectableItemName + + + ProtectionContainerName + + + ProviderName + + + RecoveryPlanName + + + RecoveryPointName + + + ReplicatedProtectedItemName + + + ResourceGroupName + + + ResourceName + + + StorageClassificationMappingName + + + StorageClassificationName + + + SubscriptionId + + + VaultSettingName + + + VcenterName + + + VirtualMachineName + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2AAddDisksInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2AAddDisksInput + + + + + + + + + + + + InstanceType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2AApplyRecoveryPointInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2AApplyRecoveryPointInput + + + + + + + + + + + + InstanceType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2AContainerCreationInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2AContainerCreationInput + + + + + + + + + + + + InstanceType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2AContainerMappingInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2AContainerMappingInput + + + + + + + + + + + + + + + + + + + + + InstanceType + + + AgentAutoUpdateStatus + + + AutomationAccountArmId + + + AutomationAccountAuthenticationType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2ACreateProtectionIntentInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2ACreateProtectionIntentInput + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + InstanceType + + + AgentAutoUpdateStatus + + + AutoProtectionOfDataDisk + + + AutomationAccountArmId + + + AutomationAccountAuthenticationType + + + FabricObjectId + + + MultiVMGroupId + + + MultiVMGroupName + + + PrimaryLocation + + + RecoveryAvailabilityType + + + RecoveryAvailabilityZone + + + RecoveryLocation + + + RecoveryResourceGroupId + + + RecoverySubscriptionId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2ACrossClusterMigrationApplyRecoveryPointInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2ACrossClusterMigrationApplyRecoveryPointInput + + + + + + + + + + + + InstanceType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2ACrossClusterMigrationContainerCreationInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2ACrossClusterMigrationContainerCreationInput + + + + + + + + + + + + InstanceType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2ACrossClusterMigrationEnableProtectionInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2ACrossClusterMigrationEnableProtectionInput + + + + + + + + + + + + + + + + + + InstanceType + + + FabricObjectId + + + RecoveryContainerId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2ACrossClusterMigrationPolicyCreationInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2ACrossClusterMigrationPolicyCreationInput + + + + + + + + + + + + InstanceType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2ACrossClusterMigrationReplicationDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2ACrossClusterMigrationReplicationDetails + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + InstanceType + + + FabricObjectId + + + LifecycleId + + + OSType + + + PrimaryFabricLocation + + + VMProtectionState + + + VMProtectionStateDescription + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2AEnableProtectionInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2AEnableProtectionInput + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + InstanceType + + + FabricObjectId + + + MultiVMGroupId + + + MultiVMGroupName + + + RecoveryAvailabilitySetId + + + RecoveryAvailabilityZone + + + RecoveryAzureNetworkId + + + RecoveryBootDiagStorageAccountId + + + RecoveryCapacityReservationGroupId + + + RecoveryCloudServiceId + + + RecoveryContainerId + + + RecoveryProximityPlacementGroupId + + + RecoveryResourceGroupId + + + RecoverySubnetName + + + RecoveryVirtualMachineScaleSetId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2AEventDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2AEventDetails + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + InstanceType + + + FabricLocation + + + FabricName + + + FabricObjectId + + + ProtectedItemName + + + RemoteFabricLocation + + + RemoteFabricName + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2APolicyCreationInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2APolicyCreationInput + + + + + + + + + + + + + + + + + + + + + + + + InstanceType + + + AppConsistentFrequencyInMinute + + + CrashConsistentFrequencyInMinute + + + MultiVMSyncStatus + + + RecoveryPointHistory + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2APolicyDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2APolicyDetails + + + + + + + + + + + + + + + + + + + + + + + + + + + InstanceType + + + AppConsistentFrequencyInMinute + + + CrashConsistentFrequencyInMinute + + + MultiVMSyncStatus + + + RecoveryPointHistory + + + RecoveryPointThresholdInMinute + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2AProtectedDiskDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2AProtectedDiskDetails + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AllowedDiskLevelOperation + + + DataPendingAtSourceAgentInMb + + + DataPendingInStagingStorageAccountInMb + + + DekKeyVaultArmId + + + DiskCapacityInByte + + + DiskName + + + DiskState + + + DiskType + + + DiskUri + + + FailoverDiskName + + + IsDiskEncrypted + + + IsDiskKeyEncrypted + + + KekKeyVaultArmId + + + KeyIdentifier + + + MonitoringJobType + + + MonitoringPercentageCompletion + + + PrimaryDiskAzureStorageAccountId + + + PrimaryStagingAzureStorageAccountId + + + RecoveryAzureStorageAccountId + + + RecoveryDiskUri + + + ResyncRequired + + + SecretIdentifier + + + TfoDiskName + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2AProtectedManagedDiskDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2AProtectedManagedDiskDetails + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AllowedDiskLevelOperation + + + DataPendingAtSourceAgentInMb + + + DataPendingInStagingStorageAccountInMb + + + DekKeyVaultArmId + + + DiskCapacityInByte + + + DiskId + + + DiskName + + + DiskState + + + DiskType + + + FailoverDiskName + + + IsDiskEncrypted + + + IsDiskKeyEncrypted + + + KekKeyVaultArmId + + + KeyIdentifier + + + MonitoringJobType + + + MonitoringPercentageCompletion + + + PrimaryDiskEncryptionSetId + + + PrimaryStagingAzureStorageAccountId + + + RecoveryDiskEncryptionSetId + + + RecoveryOrignalTargetDiskId + + + RecoveryReplicaDiskAccountType + + + RecoveryReplicaDiskId + + + RecoveryResourceGroupId + + + RecoveryTargetDiskAccountType + + + RecoveryTargetDiskId + + + ResyncRequired + + + SecretIdentifier + + + TfoDiskName + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2AProtectionContainerMappingDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2AProtectionContainerMappingDetails + + + + + + + + + + + + + + + + + + + + + + + + + + + InstanceType + + + AgentAutoUpdateStatus + + + AutomationAccountArmId + + + AutomationAccountAuthenticationType + + + JobScheduleName + + + ScheduleName + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2AProtectionIntentDiskInputDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2AProtectionIntentDiskInputDetails + + + + + + + + + + + + DiskUri + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2AProtectionIntentManagedDiskInputDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2AProtectionIntentManagedDiskInputDetails + + + + + + + + + + + + + + + + + + + + + DiskId + + + RecoveryDiskEncryptionSetId + + + RecoveryReplicaDiskAccountType + + + RecoveryTargetDiskAccountType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2ARecoveryPointDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2ARecoveryPointDetails + + + + + + + + + + + + + + + + + + InstanceType + + + Disk + + + RecoveryPointSyncType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2ARemoveDisksInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2ARemoveDisksInput + + + + + + + + + + + + + + + + + + InstanceType + + + VMDisksUri + + + VMManagedDisksId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2AReplicationDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2AReplicationDetails + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + InstanceType + + + AgentCertificateExpiryDate + + + AgentExpiryDate + + + AgentVersion + + + AutoProtectionOfDataDisk + + + FabricObjectId + + + InitialPrimaryFabricLocation + + + InitialPrimaryZone + + + InitialRecoveryFabricLocation + + + InitialRecoveryZone + + + IsReplicationAgentCertificateUpdateRequired + + + IsReplicationAgentUpdateRequired + + + LastHeartbeat + + + LastRpoCalculatedTime + + + LifecycleId + + + ManagementId + + + MonitoringJobType + + + MonitoringPercentageCompletion + + + MultiVMGroupCreateOption + + + MultiVMGroupId + + + MultiVMGroupName + + + OSType + + + PrimaryAvailabilityZone + + + PrimaryFabricLocation + + + RecoveryAvailabilitySet + + + RecoveryAvailabilityZone + + + RecoveryAzureGeneration + + + RecoveryAzureResourceGroupId + + + RecoveryAzureVMName + + + RecoveryAzureVMSize + + + RecoveryBootDiagStorageAccountId + + + RecoveryCapacityReservationGroupId + + + RecoveryCloudService + + + RecoveryFabricLocation + + + RecoveryFabricObjectId + + + RecoveryProximityPlacementGroupId + + + RecoveryVirtualMachineScaleSetId + + + RpoInSecond + + + SelectedRecoveryAzureNetworkId + + + SelectedTfoAzureNetworkId + + + TestFailoverRecoveryFabricObjectId + + + TfoAzureVMName + + + VMEncryptionType + + + VMProtectionState + + + VMProtectionStateDescription + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2AReplicationIntentDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2AReplicationIntentDetails + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + InstanceType + + + AgentAutoUpdateStatus + + + AutoProtectionOfDataDisk + + + AutomationAccountArmId + + + AutomationAccountAuthenticationType + + + FabricObjectId + + + MultiVMGroupId + + + MultiVMGroupName + + + PrimaryLocation + + + RecoveryAvailabilityType + + + RecoveryAvailabilityZone + + + RecoveryLocation + + + RecoveryResourceGroupId + + + RecoverySubscriptionId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2AReprotectInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2AReprotectInput + + + + + + + + + + + + + + + + + + + + + + + + + + + InstanceType + + + PolicyId + + + RecoveryAvailabilitySetId + + + RecoveryCloudServiceId + + + RecoveryContainerId + + + RecoveryResourceGroupId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2ASwitchProtectionInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2ASwitchProtectionInput + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + InstanceType + + + PolicyId + + + RecoveryAvailabilitySetId + + + RecoveryAvailabilityZone + + + RecoveryBootDiagStorageAccountId + + + RecoveryCapacityReservationGroupId + + + RecoveryCloudServiceId + + + RecoveryContainerId + + + RecoveryProximityPlacementGroupId + + + RecoveryResourceGroupId + + + RecoveryVirtualMachineScaleSetId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2ATestFailoverInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2ATestFailoverInput + + + + + + + + + + + + + + + + + + InstanceType + + + CloudServiceCreationOption + + + RecoveryPointId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2AUnplannedFailoverInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2AUnplannedFailoverInput + + + + + + + + + + + + + + + + + + InstanceType + + + CloudServiceCreationOption + + + RecoveryPointId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2AUnprotectedDiskDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2AUnprotectedDiskDetails + + + + + + + + + + + + + + + DiskAutoProtectionStatus + + + DiskLunId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2AUpdateContainerMappingInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2AUpdateContainerMappingInput + + + + + + + + + + + + + + + + + + + + + InstanceType + + + AgentAutoUpdateStatus + + + AutomationAccountArmId + + + AutomationAccountAuthenticationType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2AUpdateReplicationProtectedItemInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2AUpdateReplicationProtectedItemInput + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + InstanceType + + + RecoveryBootDiagStorageAccountId + + + RecoveryCapacityReservationGroupId + + + RecoveryCloudServiceId + + + RecoveryProximityPlacementGroupId + + + RecoveryResourceGroupId + + + RecoveryVirtualMachineScaleSetId + + + TfoAzureVMName + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2AvmDiskInputDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2AvmDiskInputDetails + + + + + + + + + + + + + + + + + + DiskUri + + + PrimaryStagingAzureStorageAccountId + + + RecoveryAzureStorageAccountId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2AvmManagedDiskInputDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2AvmManagedDiskInputDetails + + + + + + + + + + + + + + + + + + + + + + + + + + + DiskId + + + PrimaryStagingAzureStorageAccountId + + + RecoveryDiskEncryptionSetId + + + RecoveryReplicaDiskAccountType + + + RecoveryResourceGroupId + + + RecoveryTargetDiskAccountType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2AvmManagedDiskUpdateDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2AvmManagedDiskUpdateDetails + + + + + + + + + + + + + + + + + + + + + + + + DiskId + + + FailoverDiskName + + + RecoveryReplicaDiskAccountType + + + RecoveryTargetDiskAccountType + + + TfoDiskName + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2AZoneDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2AZoneDetails + + + + + + + + + + + + + + + Source + + + Target + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AddDisksProviderSpecificInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AddDisksProviderSpecificInput + + + + + + + + + + + + InstanceType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AddRecoveryServicesProviderInputProperties + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AddRecoveryServicesProviderInputProperties + + + + + + + + + + + + + + + + + + BiosId + + + MachineId + + + MachineName + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AddVCenterRequestProperties + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AddVCenterRequestProperties + + + + + + + + + + + + + + + + + + + + + + + + FriendlyName + + + IPAddress + + + Port + + + ProcessServerId + + + RunAsAccountId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AgentDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AgentDetails + + + + + + + + + + + + + + + + + + + + + AgentId + + + BiosId + + + Fqdn + + + MachineId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AgentDiskDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AgentDiskDetails + + + + + + + + + + + + + + + + + + + + + + + + CapacityInByte + + + DiskId + + + DiskName + + + IsOSDisk + + + LunId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.Alert + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.Alert + + + + + + + + + + + + + + + + + + + + + Id + + + Location + + + Name + + + Type + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AlertCollection + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AlertCollection + + + + + + + + + + + + NextLink + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AlertProperties + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AlertProperties + + + + + + + + + + + + + + + + + + CustomEmailAddress + + + Locale + + + SendToOwner + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ApplianceCollection + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ApplianceCollection + + + + + + + + + + + + NextLink + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ApplianceQueryParameter + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ApplianceQueryParameter + + + + + + + + + + + + ProviderType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ApplianceSpecificDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ApplianceSpecificDetails + + + + + + + + + + + + InstanceType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ApplyRecoveryPointInputProperties + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ApplyRecoveryPointInputProperties + + + + + + + + + + + + RecoveryPointId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ApplyRecoveryPointProviderSpecificInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ApplyRecoveryPointProviderSpecificInput + + + + + + + + + + + + InstanceType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AsrJobDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AsrJobDetails + + + + + + + + + + + + InstanceType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AsrTask + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AsrTask + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AllowedAction + + + EndTime + + + FriendlyName + + + Name + + + StartTime + + + State + + + StateDescription + + + TaskId + + + TaskType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AutomationRunbookTaskDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AutomationRunbookTaskDetails + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + InstanceType + + + AccountName + + + CloudServiceName + + + IsPrimarySideScript + + + JobId + + + JobOutput + + + Name + + + RunbookId + + + RunbookName + + + SubscriptionId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AzureFabricCreationInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AzureFabricCreationInput + + + + + + + + + + + + + + + InstanceType + + + Location + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AzureFabricSpecificDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AzureFabricSpecificDetails + + + + + + + + + + + + + + + + + + InstanceType + + + ContainerId + + + Location + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AzureToAzureCreateNetworkMappingInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AzureToAzureCreateNetworkMappingInput + + + + + + + + + + + + + + + InstanceType + + + PrimaryNetworkId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AzureToAzureNetworkMappingSettings + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AzureToAzureNetworkMappingSettings + + + + + + + + + + + + + + + + + + InstanceType + + + PrimaryFabricLocation + + + RecoveryFabricLocation + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AzureToAzureUpdateNetworkMappingInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AzureToAzureUpdateNetworkMappingInput + + + + + + + + + + + + + + + InstanceType + + + PrimaryNetworkId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AzureToAzureVMSyncedConfigDetailsTags + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AzureToAzureVMSyncedConfigDetailsTags + + + + + + + + + + + + Item + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AzureVMDiskDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AzureVMDiskDetails + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CustomTargetDiskName + + + DiskEncryptionSetId + + + DiskId + + + LunId + + + MaxSizeMb + + + TargetDiskLocation + + + TargetDiskName + + + VhdId + + + VhdName + + + VhdType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ComputeSizeErrorDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ComputeSizeErrorDetails + + + + + + + + + + + + + + + Message + + + Severity + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ConfigurationSettings + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ConfigurationSettings + + + + + + + + + + + + InstanceType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ConfigureAlertRequestProperties + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ConfigureAlertRequestProperties + + + + + + + + + + + + + + + + + + CustomEmailAddress + + + Locale + + + SendToOwner + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ConsistencyCheckTaskDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ConsistencyCheckTaskDetails + + + + + + + + + + + + InstanceType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.CreateNetworkMappingInputProperties + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.CreateNetworkMappingInputProperties + + + + + + + + + + + + + + + RecoveryFabricName + + + RecoveryNetworkId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.CreateProtectionContainerMappingInputProperties + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.CreateProtectionContainerMappingInputProperties + + + + + + + + + + + + + + + PolicyId + + + TargetProtectionContainerId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.CreateProtectionIntentProviderSpecificDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.CreateProtectionIntentProviderSpecificDetails + + + + + + + + + + + + InstanceType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.CreateRecoveryPlanInputProperties + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.CreateRecoveryPlanInputProperties + + + + + + + + + + + + + + + + + + FailoverDeploymentModel + + + PrimaryFabricId + + + RecoveryFabricId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.CriticalJobHistoryDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.CriticalJobHistoryDetails + + + + + + + + + + + + + + + + + + + + + JobId + + + JobName + + + JobStatus + + + StartTime + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.CurrentJobDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.CurrentJobDetails + + + + + + + + + + + + + + + + + + JobId + + + JobName + + + StartTime + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.CurrentScenarioDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.CurrentScenarioDetails + + + + + + + + + + + + + + + + + + JobId + + + ScenarioName + + + StartTime + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DataStore + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DataStore + + + + + + + + + + + + + + + + + + + + + + + + Capacity + + + FreeSpace + + + SymbolicName + + + Type + + + Uuid + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DisableProtectionInputProperties + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DisableProtectionInputProperties + + + + + + + + + + + + DisableProtectionReason + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DisableProtectionProviderSpecificInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DisableProtectionProviderSpecificInput + + + + + + + + + + + + InstanceType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DiscoverProtectableItemRequestProperties + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DiscoverProtectableItemRequestProperties + + + + + + + + + + + + + + + + + + FriendlyName + + + IPAddress + + + OSType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DiskDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DiskDetails + + + + + + + + + + + + + + + + + + + + + MaxSizeMb + + + VhdId + + + VhdName + + + VhdType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DiskEncryptionKeyInfo + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DiskEncryptionKeyInfo + + + + + + + + + + + + + + + KeyVaultResourceArmId + + + SecretIdentifier + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DiskVolumeDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DiskVolumeDetails + + + + + + + + + + + + + + + Label + + + Name + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.Display + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.Display + + + + + + + + + + + + + + + + + + + + + Description + + + Operation + + + Provider + + + Resource + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DraDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DraDetails + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + BiosId + + + ForwardProtectedItemCount + + + Health + + + Id + + + LastHeartbeatUtc + + + Name + + + ReverseProtectedItemCount + + + Version + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EnableMigrationInputProperties + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EnableMigrationInputProperties + + + + + + + + + + + + PolicyId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EnableMigrationProviderSpecificInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EnableMigrationProviderSpecificInput + + + + + + + + + + + + InstanceType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EnableProtectionInputProperties + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EnableProtectionInputProperties + + + + + + + + + + + + + + + PolicyId + + + ProtectableItemId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EnableProtectionProviderSpecificInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EnableProtectionProviderSpecificInput + + + + + + + + + + + + InstanceType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EncryptionDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EncryptionDetails + + + + + + + + + + + + + + + + + + KekCertExpiryDate + + + KekCertThumbprint + + + KekState + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.Event + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.Event + + + + + + + + + + + + + + + + + + + + + Id + + + Location + + + Name + + + Type + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EventCollection + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EventCollection + + + + + + + + + + + + NextLink + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EventProperties + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EventProperties + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AffectedObjectCorrelationId + + + AffectedObjectFriendlyName + + + Description + + + EventCode + + + EventType + + + FabricId + + + Severity + + + TimeOfOccurrence + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EventProviderSpecificDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EventProviderSpecificDetails + + + + + + + + + + + + InstanceType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EventQueryParameter + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EventQueryParameter + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AffectedObjectCorrelationId + + + AffectedObjectFriendlyName + + + EndTime + + + EventCode + + + EventType + + + FabricName + + + Severity + + + StartTime + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EventSpecificDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EventSpecificDetails + + + + + + + + + + + + InstanceType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ExistingProtectionProfile + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ExistingProtectionProfile + + + + + + + + + + + + + + + ResourceType + + + ProtectionProfileId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ExistingRecoveryAvailabilitySet + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ExistingRecoveryAvailabilitySet + + + + + + + + + + + + + + + ResourceType + + + RecoveryAvailabilitySetId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ExistingRecoveryProximityPlacementGroup + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ExistingRecoveryProximityPlacementGroup + + + + + + + + + + + + + + + ResourceType + + + RecoveryProximityPlacementGroupId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ExistingRecoveryResourceGroup + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ExistingRecoveryResourceGroup + + + + + + + + + + + + + + + ResourceType + + + RecoveryResourceGroupId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ExistingRecoveryVirtualNetwork + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ExistingRecoveryVirtualNetwork + + + + + + + + + + + + + + + + + + ResourceType + + + RecoverySubnetName + + + RecoveryVirtualNetworkId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ExistingStorageAccount + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ExistingStorageAccount + + + + + + + + + + + + + + + ResourceType + + + AzureStorageAccountId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ExportJobDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ExportJobDetails + + + + + + + + + + + + + + + + + + InstanceType + + + BlobUri + + + SasToken + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ExtendedLocation + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ExtendedLocation + + + + + + + + + + + + + + + Name + + + Type + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.Fabric + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.Fabric + + + + + + + + + + + + + + + + + + + + + Id + + + Location + + + Name + + + Type + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FabricCollection + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FabricCollection + + + + + + + + + + + + NextLink + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FabricProperties + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FabricProperties + + + + + + + + + + + + + + + + + + + + + BcdrState + + + FriendlyName + + + Health + + + InternalIdentifier + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FabricQueryParameter + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FabricQueryParameter + + + + + + + + + + + + + + + + + + + + + + + + + + + BiosId + + + DiscoveryType + + + FetchAgentDetail + + + Fqdn + + + OSType + + + ZoneToZoneMapping + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FabricReplicationGroupTaskDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FabricReplicationGroupTaskDetails + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + InstanceType + + + JobTaskJobFriendlyName + + + JobTaskJobId + + + JobTaskJobScenarioName + + + JobTaskTargetInstanceType + + + JobTaskTargetObjectId + + + JobTaskTargetObjectName + + + SkippedReason + + + SkippedReasonString + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FabricSpecificCreateNetworkMappingInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FabricSpecificCreateNetworkMappingInput + + + + + + + + + + + + InstanceType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FabricSpecificCreationInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FabricSpecificCreationInput + + + + + + + + + + + + InstanceType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FabricSpecificDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FabricSpecificDetails + + + + + + + + + + + + InstanceType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FabricSpecificUpdateNetworkMappingInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FabricSpecificUpdateNetworkMappingInput + + + + + + + + + + + + InstanceType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FailoverJobDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FailoverJobDetails + + + + + + + + + + + + InstanceType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FailoverProcessServerRequestProperties + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FailoverProcessServerRequestProperties + + + + + + + + + + + + + + + + + + + + + + + + ContainerName + + + SourceProcessServerId + + + TargetProcessServerId + + + UpdateType + + + VmsToMigrate + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FailoverReplicationProtectedItemDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FailoverReplicationProtectedItemDetails + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + FriendlyName + + + Name + + + NetworkConnectionStatus + + + NetworkFriendlyName + + + RecoveryPointId + + + RecoveryPointTime + + + Subnet + + + TestVMFriendlyName + + + TestVMName + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.GroupTaskDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.GroupTaskDetails + + + + + + + + + + + + InstanceType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthError + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthError + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CreationTimeUtc + + + CustomerResolvability + + + EntityId + + + ErrorCategory + + + ErrorCode + + + ErrorId + + + ErrorLevel + + + ErrorMessage + + + ErrorSource + + + ErrorType + + + PossibleCaus + + + RecommendedAction + + + RecoveryProviderErrorMessage + + + SummaryMessage + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthErrorSummary + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthErrorSummary + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AffectedResourceCorrelationId + + + AffectedResourceSubtype + + + AffectedResourceType + + + Category + + + Severity + + + SummaryCode + + + SummaryMessage + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVHostDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVHostDetails + + + + + + + + + + + + + + + + + + Id + + + MarsAgentVersion + + + Name + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplica2012EventDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplica2012EventDetails + + + + + + + + + + + + + + + + + + + + + + + + InstanceType + + + ContainerName + + + FabricName + + + RemoteContainerName + + + RemoteFabricName + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplica2012R2EventDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplica2012R2EventDetails + + + + + + + + + + + + + + + + + + + + + + + + InstanceType + + + ContainerName + + + FabricName + + + RemoteContainerName + + + RemoteFabricName + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureApplyRecoveryPointInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureApplyRecoveryPointInput + + + + + + + + + + + + + + + + + + InstanceType + + + PrimaryKekCertificatePfx + + + SecondaryKekCertificatePfx + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureDiskInputDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureDiskInputDetails + + + + + + + + + + + + + + + + + + + + + DiskEncryptionSetId + + + DiskId + + + DiskType + + + LogStorageAccountId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureEnableProtectionInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureEnableProtectionInput + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + InstanceType + + + DiskEncryptionSetId + + + DiskType + + + DisksToInclude + + + EnableRdpOnTargetOption + + + HvHostVMId + + + LicenseType + + + LogStorageAccountId + + + OSType + + + SqlServerLicenseType + + + TargetAvailabilitySetId + + + TargetAvailabilityZone + + + TargetAzureNetworkId + + + TargetAzureSubnetId + + + TargetAzureV1ResourceGroupId + + + TargetAzureV2ResourceGroupId + + + TargetAzureVMName + + + TargetProximityPlacementGroupId + + + TargetStorageAccountId + + + TargetVMSize + + + UseManagedDisk + + + UseManagedDisksForReplication + + + VMName + + + VhdId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureEnableProtectionInputSeedManagedDiskTags + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureEnableProtectionInputSeedManagedDiskTags + + + + + + + + + + + + Item + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureEnableProtectionInputTargetManagedDiskTags + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureEnableProtectionInputTargetManagedDiskTags + + + + + + + + + + + + Item + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureEnableProtectionInputTargetNicTags + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureEnableProtectionInputTargetNicTags + + + + + + + + + + + + Item + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureEnableProtectionInputTargetVmtags + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureEnableProtectionInputTargetVmtags + + + + + + + + + + + + Item + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureEventDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureEventDetails + + + + + + + + + + + + + + + + + + + + + InstanceType + + + ContainerName + + + FabricName + + + RemoteContainerName + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureFailbackProviderInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureFailbackProviderInput + + + + + + + + + + + + + + + + + + + + + InstanceType + + + DataSyncOption + + + ProviderIdForAlternateRecovery + + + RecoveryVMCreationOption + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureManagedDiskDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureManagedDiskDetails + + + + + + + + + + + + + + + + + + + + + DiskEncryptionSetId + + + DiskId + + + ReplicaDiskType + + + SeedManagedDiskId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzurePlannedFailoverProviderInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzurePlannedFailoverProviderInput + + + + + + + + + + + + + + + + + + + + + InstanceType + + + PrimaryKekCertificatePfx + + + RecoveryPointId + + + SecondaryKekCertificatePfx + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzurePolicyDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzurePolicyDetails + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + InstanceType + + + ActiveStorageAccountId + + + ApplicationConsistentSnapshotFrequencyInHour + + + Encryption + + + OnlineReplicationStartTime + + + RecoveryPointHistoryDurationInHour + + + ReplicationInterval + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzurePolicyInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzurePolicyInput + + + + + + + + + + + + + + + + + + + + + + + + + + + InstanceType + + + ApplicationConsistentSnapshotFrequencyInHour + + + OnlineReplicationStartTime + + + RecoveryPointHistoryDuration + + + ReplicationInterval + + + StorageAccount + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureReplicationDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureReplicationDetails + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + InstanceType + + + EnableRdpOnTargetOption + + + Encryption + + + LastRecoveryPointReceived + + + LastReplicatedTime + + + LastRpoCalculatedTime + + + LicenseType + + + RecoveryAvailabilitySetId + + + RecoveryAzureLogStorageAccountId + + + RecoveryAzureResourceGroupId + + + RecoveryAzureStorageAccount + + + RecoveryAzureVMName + + + RecoveryAzureVMSize + + + RpoInSecond + + + SelectedRecoveryAzureNetworkId + + + SelectedSourceNicId + + + SourceVMCpuCount + + + SourceVMRamSizeInMb + + + SqlServerLicenseType + + + TargetAvailabilityZone + + + TargetProximityPlacementGroupId + + + UseManagedDisk + + + VMId + + + VMProtectionState + + + VMProtectionStateDescription + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureReplicationDetailsSeedManagedDiskTags + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureReplicationDetailsSeedManagedDiskTags + + + + + + + + + + + + Item + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureReplicationDetailsTargetManagedDiskTags + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureReplicationDetailsTargetManagedDiskTags + + + + + + + + + + + + Item + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureReplicationDetailsTargetNicTags + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureReplicationDetailsTargetNicTags + + + + + + + + + + + + Item + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureReplicationDetailsTargetVmtags + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureReplicationDetailsTargetVmtags + + + + + + + + + + + + Item + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureReprotectInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureReprotectInput + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + InstanceType + + + HvHostVMId + + + LogStorageAccountId + + + OSType + + + StorageAccountId + + + VHdId + + + VMName + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureTestFailoverInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureTestFailoverInput + + + + + + + + + + + + + + + + + + + + + InstanceType + + + PrimaryKekCertificatePfx + + + RecoveryPointId + + + SecondaryKekCertificatePfx + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureUnplannedFailoverInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureUnplannedFailoverInput + + + + + + + + + + + + + + + + + + + + + InstanceType + + + PrimaryKekCertificatePfx + + + RecoveryPointId + + + SecondaryKekCertificatePfx + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureUpdateReplicationProtectedItemInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureUpdateReplicationProtectedItemInput + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + InstanceType + + + RecoveryAzureV1ResourceGroupId + + + RecoveryAzureV2ResourceGroupId + + + SqlServerLicenseType + + + TargetAvailabilityZone + + + TargetProximityPlacementGroupId + + + UseManagedDisk + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureUpdateReplicationProtectedItemInputDiskIdToDiskEncryptionMap + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureUpdateReplicationProtectedItemInputDiskIdToDiskEncryptionMap + + + + + + + + + + + + Item + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetManagedDiskTags + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetManagedDiskTags + + + + + + + + + + + + Item + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetNicTags + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetNicTags + + + + + + + + + + + + Item + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetVmtags + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetVmtags + + + + + + + + + + + + Item + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaBaseEventDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaBaseEventDetails + + + + + + + + + + + + + + + + + + + + + + + + InstanceType + + + ContainerName + + + FabricName + + + RemoteContainerName + + + RemoteFabricName + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaBasePolicyDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaBasePolicyDetails + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + InstanceType + + + AllowedAuthenticationType + + + ApplicationConsistentSnapshotFrequencyInHour + + + Compression + + + InitialReplicationMethod + + + OfflineReplicationExportPath + + + OfflineReplicationImportPath + + + OnlineReplicationStartTime + + + RecoveryPoint + + + ReplicaDeletionOption + + + ReplicationPort + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaBaseReplicationDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaBaseReplicationDetails + + + + + + + + + + + + + + + + + + + + + + + + InstanceType + + + LastReplicatedTime + + + VMId + + + VMProtectionState + + + VMProtectionStateDescription + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaBluePolicyDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaBluePolicyDetails + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + InstanceType + + + AllowedAuthenticationType + + + ApplicationConsistentSnapshotFrequencyInHour + + + Compression + + + InitialReplicationMethod + + + OfflineReplicationExportPath + + + OfflineReplicationImportPath + + + OnlineReplicationStartTime + + + RecoveryPoint + + + ReplicaDeletionOption + + + ReplicationFrequencyInSecond + + + ReplicationPort + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaBluePolicyInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaBluePolicyInput + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AllowedAuthenticationType + + + ApplicationConsistentSnapshotFrequencyInHour + + + Compression + + + InitialReplicationMethod + + + InstanceType + + + OfflineReplicationExportPath + + + OfflineReplicationImportPath + + + OnlineReplicationStartTime + + + RecoveryPoint + + + ReplicaDeletion + + + ReplicationPort + + + ReplicationFrequencyInSecond + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaBlueReplicationDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaBlueReplicationDetails + + + + + + + + + + + + + + + + + + + + + + + + InstanceType + + + LastReplicatedTime + + + VMId + + + VMProtectionState + + + VMProtectionStateDescription + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaPolicyDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaPolicyDetails + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + InstanceType + + + AllowedAuthenticationType + + + ApplicationConsistentSnapshotFrequencyInHour + + + Compression + + + InitialReplicationMethod + + + OfflineReplicationExportPath + + + OfflineReplicationImportPath + + + OnlineReplicationStartTime + + + RecoveryPoint + + + ReplicaDeletionOption + + + ReplicationPort + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaPolicyInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaPolicyInput + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + InstanceType + + + AllowedAuthenticationType + + + ApplicationConsistentSnapshotFrequencyInHour + + + Compression + + + InitialReplicationMethod + + + OfflineReplicationExportPath + + + OfflineReplicationImportPath + + + OnlineReplicationStartTime + + + RecoveryPoint + + + ReplicaDeletion + + + ReplicationPort + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaReplicationDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaReplicationDetails + + + + + + + + + + + + + + + + + + + + + + + + InstanceType + + + LastReplicatedTime + + + VMId + + + VMProtectionState + + + VMProtectionStateDescription + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVSiteDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVSiteDetails + + + + + + + + + + + + InstanceType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVVirtualMachineDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVVirtualMachineDetails + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + InstanceType + + + Generation + + + HasFibreChannelAdapter + + + HasPhysicalDisk + + + HasSharedVhd + + + HyperVHostId + + + SourceItemId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IdentityProviderDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IdentityProviderDetails + + + + + + + + + + + + + + + + + + + + + + + + AadAuthority + + + ApplicationId + + + Audience + + + ObjectId + + + TenantId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IdentityProviderInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IdentityProviderInput + + + + + + + + + + + + + + + + + + + + + + + + AadAuthority + + + ApplicationId + + + Audience + + + ObjectId + + + TenantId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InconsistentVMDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InconsistentVMDetails + + + + + + + + + + + + + + + + + + + + + CloudName + + + Detail + + + ErrorId + + + VMName + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InitialReplicationDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InitialReplicationDetails + + + + + + + + + + + + + + + InitialReplicationProgressPercentage + + + InitialReplicationType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InlineWorkflowTaskDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InlineWorkflowTaskDetails + + + + + + + + + + + + + + + InstanceType + + + WorkflowId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAgentDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAgentDetails + + + + + + + + + + + + + + + + + + + + + AgentExpiryDate + + + AgentUpdateStatus + + + AgentVersion + + + PostUpdateRebootStatus + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2ApplyRecoveryPointInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2ApplyRecoveryPointInput + + + + + + + + + + + + InstanceType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2DiskInputDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2DiskInputDetails + + + + + + + + + + + + + + + + + + + + + DiskEncryptionSetId + + + DiskId + + + DiskType + + + LogStorageAccountId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2EnableProtectionInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2EnableProtectionInput + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + InstanceType + + + DiskEncryptionSetId + + + DiskType + + + EnableRdpOnTargetOption + + + LicenseType + + + LogStorageAccountId + + + MasterTargetId + + + MultiVMGroupId + + + MultiVMGroupName + + + ProcessServerId + + + RunAsAccountId + + + SqlServerLicenseType + + + StorageAccountId + + + TargetAvailabilitySetId + + + TargetAvailabilityZone + + + TargetAzureNetworkId + + + TargetAzureSubnetId + + + TargetAzureV1ResourceGroupId + + + TargetAzureV2ResourceGroupId + + + TargetAzureVMName + + + TargetProximityPlacementGroupId + + + TargetVMSize + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2EnableProtectionInputSeedManagedDiskTags + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2EnableProtectionInputSeedManagedDiskTags + + + + + + + + + + + + Item + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2EnableProtectionInputTargetManagedDiskTags + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2EnableProtectionInputTargetManagedDiskTags + + + + + + + + + + + + Item + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2EnableProtectionInputTargetNicTags + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2EnableProtectionInputTargetNicTags + + + + + + + + + + + + Item + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2EnableProtectionInputTargetVMTags + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2EnableProtectionInputTargetVMTags + + + + + + + + + + + + Item + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2EventDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2EventDetails + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + InstanceType + + + Category + + + Component + + + CorrectiveAction + + + Detail + + + EventType + + + SiteName + + + Summary + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2ManagedDiskDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2ManagedDiskDetails + + + + + + + + + + + + + + + + + + + + + + + + DiskEncryptionSetId + + + DiskId + + + ReplicaDiskType + + + SeedManagedDiskId + + + TargetDiskName + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2PolicyDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2PolicyDetails + + + + + + + + + + + + + + + + + + + + + + + + + + + InstanceType + + + AppConsistentFrequencyInMinute + + + CrashConsistentFrequencyInMinute + + + MultiVMSyncStatus + + + RecoveryPointHistory + + + RecoveryPointThresholdInMinute + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2PolicyInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2PolicyInput + + + + + + + + + + + + + + + + + + + + + + + + + + + InstanceType + + + AppConsistentFrequencyInMinute + + + CrashConsistentFrequencyInMinute + + + MultiVMSyncStatus + + + RecoveryPointHistory + + + RecoveryPointThresholdInMinute + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2ProtectedDiskDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2ProtectedDiskDetails + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + DiskCapacityInByte + + + DiskId + + + DiskName + + + DiskResized + + + FileSystemCapacityInByte + + + HealthErrorCode + + + LastRpoCalculatedTime + + + ProgressHealth + + + ProgressStatus + + + ProtectionStage + + + PsDataInMegaByte + + + ResyncDurationInSecond + + + ResyncLast15MinutesTransferredByte + + + ResyncLastDataTransferTimeUtc + + + ResyncProcessedByte + + + ResyncProgressPercentage + + + ResyncRequired + + + ResyncStartTime + + + ResyncTotalTransferredByte + + + RpoInSecond + + + SecondsToTakeSwitchProvider + + + SourceDataInMegaByte + + + TargetDataInMegaByte + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2RecoveryPointDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2RecoveryPointDetails + + + + + + + + + + + + + + + InstanceType + + + IsMultiVMSyncPoint + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2ReplicationDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2ReplicationDetails + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + InstanceType + + + AgentExpiryDate + + + AgentVersion + + + AzureVMGeneration + + + CompressedDataRateInMb + + + Datastore + + + DiscoveryType + + + DiskResized + + + EnableRdpOnTargetOption + + + FirmwareType + + + IPAddress + + + InfrastructureVMId + + + IsAdditionalStatsAvailable + + + IsAgentUpdateRequired + + + IsRebootAfterUpdateRequired + + + LastHeartbeat + + + LastRecoveryPointReceived + + + LastRpoCalculatedTime + + + LastUpdateReceivedTime + + + LicenseType + + + MasterTargetId + + + MultiVMGroupId + + + MultiVMGroupName + + + MultiVMSyncStatus + + + OSDiskId + + + OSType + + + OSVersion + + + ProcessServerId + + + ProcessServerName + + + ProtectionStage + + + RecoveryAvailabilitySetId + + + RecoveryAzureLogStorageAccountId + + + RecoveryAzureResourceGroupId + + + RecoveryAzureStorageAccount + + + RecoveryAzureVMName + + + RecoveryAzureVMSize + + + ReplicaId + + + ResyncProgressPercentage + + + RpoInSecond + + + SelectedRecoveryAzureNetworkId + + + SelectedSourceNicId + + + SelectedTfoAzureNetworkId + + + SourceVMCpuCount + + + SourceVMRamSizeInMb + + + SqlServerLicenseType + + + TargetAvailabilityZone + + + TargetProximityPlacementGroupId + + + TargetVMId + + + TotalDataTransferred + + + TotalProgressHealth + + + UncompressedDataRateInMb + + + UseManagedDisk + + + VCenterInfrastructureId + + + VMId + + + VMProtectionState + + + VMProtectionStateDescription + + + VhdName + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2ReplicationDetailsSeedManagedDiskTags + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2ReplicationDetailsSeedManagedDiskTags + + + + + + + + + + + + Item + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2ReplicationDetailsTargetManagedDiskTags + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2ReplicationDetailsTargetManagedDiskTags + + + + + + + + + + + + Item + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2ReplicationDetailsTargetNicTags + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2ReplicationDetailsTargetNicTags + + + + + + + + + + + + Item + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2ReplicationDetailsTargetVMTags + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2ReplicationDetailsTargetVMTags + + + + + + + + + + + + Item + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2ReprotectInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2ReprotectInput + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + InstanceType + + + DisksToInclude + + + LogStorageAccountId + + + MasterTargetId + + + PolicyId + + + ProcessServerId + + + RunAsAccountId + + + StorageAccountId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2SwitchProviderBlockingErrorDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2SwitchProviderBlockingErrorDetails + + + + + + + + + + + + + + + + + + + + + ErrorCode + + + ErrorMessage + + + PossibleCaus + + + RecommendedAction + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2SwitchProviderBlockingErrorDetailsErrorMessageParameters + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2SwitchProviderBlockingErrorDetailsErrorMessageParameters + + + + + + + + + + + + Item + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2SwitchProviderBlockingErrorDetailsErrorTags + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2SwitchProviderBlockingErrorDetailsErrorTags + + + + + + + + + + + + Item + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2SwitchProviderDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2SwitchProviderDetails + + + + + + + + + + + + + + + + + + + + + TargetApplianceId + + + TargetFabricId + + + TargetResourceId + + + TargetVaultId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2SwitchProviderInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2SwitchProviderInput + + + + + + + + + + + + + + + + + + + + + InstanceType + + + TargetApplianceId + + + TargetFabricId + + + TargetVaultId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2TestFailoverInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2TestFailoverInput + + + + + + + + + + + + + + + InstanceType + + + RecoveryPointId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2UnplannedFailoverInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2UnplannedFailoverInput + + + + + + + + + + + + + + + InstanceType + + + RecoveryPointId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2UpdateReplicationProtectedItemInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2UpdateReplicationProtectedItemInput + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + InstanceType + + + RecoveryAzureV1ResourceGroupId + + + RecoveryAzureV2ResourceGroupId + + + SqlServerLicenseType + + + TargetAvailabilityZone + + + TargetProximityPlacementGroupId + + + UseManagedDisk + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2UpdateReplicationProtectedItemInputTargetManagedDiskTags + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2UpdateReplicationProtectedItemInputTargetManagedDiskTags + + + + + + + + + + + + Item + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2UpdateReplicationProtectedItemInputTargetNicTags + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2UpdateReplicationProtectedItemInputTargetNicTags + + + + + + + + + + + + Item + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2UpdateReplicationProtectedItemInputTargetVMTags + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2UpdateReplicationProtectedItemInputTargetVMTags + + + + + + + + + + + + Item + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageBasePolicyDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageBasePolicyDetails + + + + + + + + + + + + + + + + + + + + + + + + InstanceType + + + AppConsistentFrequencyInMinute + + + MultiVMSyncStatus + + + RecoveryPointHistory + + + RecoveryPointThresholdInMinute + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageDisableProtectionProviderSpecificInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageDisableProtectionProviderSpecificInput + + + + + + + + + + + + + + + InstanceType + + + ReplicaVMDeletionStatus + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageDiskDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageDiskDetails + + + + + + + + + + + + + + + + + + + + + + + + DiskConfiguration + + + DiskId + + + DiskName + + + DiskSizeInMb + + + DiskType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageDiskSignatureExclusionOptions + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageDiskSignatureExclusionOptions + + + + + + + + + + + + DiskSignature + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageEnableProtectionInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageEnableProtectionInput + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + InstanceType + + + DatastoreName + + + DisksToInclude + + + MasterTargetId + + + MultiVMGroupId + + + MultiVMGroupName + + + ProcessServerId + + + RetentionDrive + + + RunAsAccountId + + + VMFriendlyName + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageFabricSwitchProviderBlockingErrorDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageFabricSwitchProviderBlockingErrorDetails + + + + + + + + + + + + + + + + + + + + + ErrorCode + + + ErrorMessage + + + PossibleCaus + + + RecommendedAction + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters + + + + + + + + + + + + Item + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageFabricSwitchProviderBlockingErrorDetailsErrorTags + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageFabricSwitchProviderBlockingErrorDetailsErrorTags + + + + + + + + + + + + Item + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMagePolicyDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMagePolicyDetails + + + + + + + + + + + + + + + + + + + + + + + + InstanceType + + + AppConsistentFrequencyInMinute + + + MultiVMSyncStatus + + + RecoveryPointHistory + + + RecoveryPointThresholdInMinute + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMagePolicyInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMagePolicyInput + + + + + + + + + + + + + + + + + + + + + + + + InstanceType + + + AppConsistentFrequencyInMinute + + + MultiVMSyncStatus + + + RecoveryPointHistory + + + RecoveryPointThresholdInMinute + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageProtectedDiskDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageProtectedDiskDetails + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + DiskCapacityInByte + + + DiskId + + + DiskName + + + DiskResized + + + FileSystemCapacityInByte + + + HealthErrorCode + + + LastRpoCalculatedTime + + + ProgressHealth + + + ProgressStatus + + + ProtectionStage + + + PsDataInMb + + + ResyncDurationInSecond + + + ResyncLast15MinutesTransferredByte + + + ResyncLastDataTransferTimeUtc + + + ResyncProcessedByte + + + ResyncProgressPercentage + + + ResyncRequired + + + ResyncStartTime + + + ResyncTotalTransferredByte + + + RpoInSecond + + + SourceDataInMb + + + TargetDataInMb + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmAgentUpgradeBlockingErrorDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmAgentUpgradeBlockingErrorDetails + + + + + + + + + + + + + + + + + + + + + ErrorCode + + + ErrorMessage + + + PossibleCaus + + + RecommendedAction + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmAgentUpgradeBlockingErrorDetailsErrorMessageParameters + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmAgentUpgradeBlockingErrorDetailsErrorMessageParameters + + + + + + + + + + + + Item + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmAgentUpgradeBlockingErrorDetailsErrorTags + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmAgentUpgradeBlockingErrorDetailsErrorTags + + + + + + + + + + + + Item + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmApplianceDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmApplianceDetails + + + + + + + + + + + + + + + + + + FabricArmId + + + Id + + + Name + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmApplianceSpecificDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmApplianceSpecificDetails + + + + + + + + + + + + InstanceType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmApplyRecoveryPointInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmApplyRecoveryPointInput + + + + + + + + + + + + + + + InstanceType + + + RecoveryPointId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmDiscoveredProtectedVMDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmDiscoveredProtectedVMDetails + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CreatedTimestamp + + + Datastore + + + IPAddress + + + IsDeleted + + + LastDiscoveryTimeInUtc + + + OSName + + + PowerStatus + + + UpdatedTimestamp + + + VCenterFqdn + + + VCenterId + + + VMFqdn + + + VmwareToolsStatus + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmDiskInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmDiskInput + + + + + + + + + + + + + + + + + + + + + DiskEncryptionSetId + + + DiskId + + + DiskType + + + LogStorageAccountId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmDisksDefaultInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmDisksDefaultInput + + + + + + + + + + + + + + + + + + DiskEncryptionSetId + + + DiskType + + + LogStorageAccountId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmEnableProtectionInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmEnableProtectionInput + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + InstanceType + + + FabricDiscoveryMachineId + + + LicenseType + + + MultiVMGroupName + + + ProcessServerId + + + RunAsAccountId + + + TargetAvailabilitySetId + + + TargetAvailabilityZone + + + TargetBootDiagnosticsStorageAccountId + + + TargetNetworkId + + + TargetProximityPlacementGroupId + + + TargetResourceGroupId + + + TargetSubnetName + + + TargetVMName + + + TargetVMSize + + + TestNetworkId + + + TestSubnetName + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmEventDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmEventDetails + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + InstanceType + + + ApplianceName + + + ComponentDisplayName + + + FabricName + + + JobId + + + LatestAgentVersion + + + ProtectedItemName + + + ServerType + + + VMName + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmFabricCreationInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmFabricCreationInput + + + + + + + + + + + + + + + + + + InstanceType + + + PhysicalSiteId + + + VmwareSiteId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmFabricSpecificDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmFabricSpecificDetails + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + InstanceType + + + ControlPlaneUri + + + DataPlaneUri + + + PhysicalSiteId + + + ServiceContainerId + + + ServiceEndpoint + + + ServiceResourceId + + + VmwareSiteId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmFabricSwitchProviderBlockingErrorDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmFabricSwitchProviderBlockingErrorDetails + + + + + + + + + + + + + + + + + + + + + ErrorCode + + + ErrorMessage + + + PossibleCaus + + + RecommendedAction + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters + + + + + + + + + + + + Item + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmFabricSwitchProviderBlockingErrorDetailsErrorTags + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmFabricSwitchProviderBlockingErrorDetailsErrorTags + + + + + + + + + + + + Item + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmFailbackDiscoveredProtectedVMDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmFailbackDiscoveredProtectedVMDetails + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CreatedTimestamp + + + Datastore + + + IPAddress + + + IsDeleted + + + LastDiscoveryTimeInUtc + + + OSName + + + PowerStatus + + + UpdatedTimestamp + + + VCenterFqdn + + + VCenterId + + + VMFqdn + + + VmwareToolsStatus + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmFailbackEventDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmFailbackEventDetails + + + + + + + + + + + + + + + + + + + + + + + + + + + InstanceType + + + ApplianceName + + + ComponentDisplayName + + + ProtectedItemName + + + ServerType + + + VMName + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmFailbackMobilityAgentDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmFailbackMobilityAgentDetails + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AgentVersionExpiryDate + + + DriverVersion + + + DriverVersionExpiryDate + + + IsUpgradeable + + + LastHeartbeatUtc + + + LatestUpgradableVersionWithoutReboot + + + LatestVersion + + + ReasonsBlockingUpgrade + + + Version + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmFailbackNicDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmFailbackNicDetails + + + + + + + + + + + + + + + + + + + + + AdapterType + + + MacAddress + + + NetworkName + + + SourceIPAddress + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmFailbackPlannedFailoverProviderInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmFailbackPlannedFailoverProviderInput + + + + + + + + + + + + + + + InstanceType + + + RecoveryPointType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmFailbackPolicyCreationInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmFailbackPolicyCreationInput + + + + + + + + + + + + + + + + + + InstanceType + + + AppConsistentFrequencyInMinute + + + CrashConsistentFrequencyInMinute + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmFailbackPolicyDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmFailbackPolicyDetails + + + + + + + + + + + + + + + + + + InstanceType + + + AppConsistentFrequencyInMinute + + + CrashConsistentFrequencyInMinute + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmFailbackProtectedDiskDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmFailbackProtectedDiskDetails + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CapacityInByte + + + DataPendingAtSourceAgentInMb + + + DataPendingInLogDataStoreInMb + + + DiskId + + + DiskName + + + DiskUuid + + + IsInitialReplicationComplete + + + IsOSDisk + + + LastSyncTime + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmFailbackReplicationDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmFailbackReplicationDetails + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + InstanceType + + + AzureVirtualMachineId + + + InitialReplicationProcessedByte + + + InitialReplicationProgressHealth + + + InitialReplicationProgressPercentage + + + InitialReplicationTransferredByte + + + InternalIdentifier + + + IsAgentRegistrationSuccessfulAfterFailover + + + LastPlannedFailoverStartTime + + + LastPlannedFailoverStatus + + + LastUsedPolicyFriendlyName + + + LastUsedPolicyId + + + LogStorageAccountId + + + MultiVMGroupName + + + OSType + + + ReprotectAgentId + + + ReprotectAgentName + + + ResyncProcessedByte + + + ResyncProgressHealth + + + ResyncProgressPercentage + + + ResyncRequired + + + ResyncState + + + ResyncTransferredByte + + + TargetDataStoreName + + + TargetVMName + + + TargetvCenterId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmFailbackReprotectInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmFailbackReprotectInput + + + + + + + + + + + + + + + + + + + + + InstanceType + + + PolicyId + + + ProcessServerId + + + RunAsAccountId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmFailbackSyncDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmFailbackSyncDetails + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Last15MinutesTransferredByte + + + LastDataTransferTimeUtc + + + LastRefreshTime + + + ProcessedByte + + + ProgressHealth + + + ProgressPercentage + + + StartTime + + + TransferredByte + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmLastAgentUpgradeErrorDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmLastAgentUpgradeErrorDetails + + + + + + + + + + + + + + + + + + + + + ErrorCode + + + ErrorMessage + + + PossibleCaus + + + RecommendedAction + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmLastAgentUpgradeErrorDetailsErrorMessageParameters + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmLastAgentUpgradeErrorDetailsErrorMessageParameters + + + + + + + + + + + + Item + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmLastAgentUpgradeErrorDetailsErrorTags + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmLastAgentUpgradeErrorDetailsErrorTags + + + + + + + + + + + + Item + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmMobilityAgentDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmMobilityAgentDetails + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AgentVersionExpiryDate + + + DriverVersion + + + DriverVersionExpiryDate + + + IsUpgradeable + + + LastHeartbeatUtc + + + LatestAgentReleaseDate + + + LatestUpgradableVersionWithoutReboot + + + LatestVersion + + + ReasonsBlockingUpgrade + + + Version + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmNicDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmNicDetails + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + IsPrimaryNic + + + IsSelectedForFailover + + + NicId + + + SourceIPAddress + + + SourceIPAddressType + + + SourceNetworkId + + + SourceSubnetName + + + TargetIPAddress + + + TargetIPAddressType + + + TargetSubnetName + + + TestIPAddress + + + TestIPAddressType + + + TestSubnetName + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmNicInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmNicInput + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + IsPrimaryNic + + + IsSelectedForFailover + + + NicId + + + TargetStaticIPAddress + + + TargetSubnetName + + + TestStaticIPAddress + + + TestSubnetName + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmPolicyCreationInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmPolicyCreationInput + + + + + + + + + + + + + + + + + + + + + + + + InstanceType + + + AppConsistentFrequencyInMinute + + + CrashConsistentFrequencyInMinute + + + EnableMultiVMSync + + + RecoveryPointHistoryInMinute + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmPolicyDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmPolicyDetails + + + + + + + + + + + + + + + + + + + + + + + + InstanceType + + + AppConsistentFrequencyInMinute + + + CrashConsistentFrequencyInMinute + + + EnableMultiVMSync + + + RecoveryPointHistoryInMinute + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmProtectedDiskDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmProtectedDiskDetails + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CapacityInByte + + + DataPendingAtSourceAgentInMb + + + DataPendingInLogDataStoreInMb + + + DiskEncryptionSetId + + + DiskId + + + DiskName + + + DiskType + + + IsInitialReplicationComplete + + + IsOSDisk + + + LogStorageAccountId + + + SeedBlobUri + + + SeedManagedDiskId + + + TargetManagedDiskId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmProtectionContainerMappingDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmProtectionContainerMappingDetails + + + + + + + + + + + + + + + InstanceType + + + EnableAgentAutoUpgrade + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmRecoveryPointDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmRecoveryPointDetails + + + + + + + + + + + + + + + InstanceType + + + IsMultiVMSyncPoint + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmReplicationDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmReplicationDetails + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + InstanceType + + + AgentUpgradeAttemptToVersion + + + AgentUpgradeJobId + + + AgentUpgradeState + + + AllocatedMemoryInMb + + + DiscoveryType + + + FabricDiscoveryMachineId + + + FailoverRecoveryPointId + + + FirmwareType + + + InitialReplicationProcessedByte + + + InitialReplicationProgressHealth + + + InitialReplicationProgressPercentage + + + InitialReplicationTransferredByte + + + InternalIdentifier + + + IsAgentRegistrationSuccessfulAfterFailover + + + IsLastUpgradeSuccessful + + + LastAgentUpgradeType + + + LastRecoveryPointId + + + LastRecoveryPointReceived + + + LastRpoCalculatedTime + + + LastRpoInSecond + + + LicenseType + + + MultiVMGroupName + + + OSType + + + PrimaryNicIPAddress + + + ProcessServerId + + + ProcessServerName + + + ProcessorCoreCount + + + ResyncProcessedByte + + + ResyncProgressHealth + + + ResyncProgressPercentage + + + ResyncRequired + + + ResyncState + + + ResyncTransferredByte + + + RunAsAccountId + + + StorageAccountId + + + TargetAvailabilitySetId + + + TargetAvailabilityZone + + + TargetBootDiagnosticsStorageAccountId + + + TargetGeneration + + + TargetLocation + + + TargetNetworkId + + + TargetProximityPlacementGroupId + + + TargetResourceGroupId + + + TargetVMName + + + TargetVMSize + + + TestNetworkId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmReprotectInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmReprotectInput + + + + + + + + + + + + + + + + + + + + + + + + InstanceType + + + DatastoreName + + + LogStorageAccountId + + + PolicyId + + + ReprotectAgentId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmSyncDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmSyncDetails + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Last15MinutesTransferredByte + + + LastDataTransferTimeUtc + + + LastRefreshTime + + + ProcessedByte + + + ProgressHealth + + + ProgressPercentage + + + StartTime + + + TransferredByte + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmTestFailoverInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmTestFailoverInput + + + + + + + + + + + + + + + + + + InstanceType + + + NetworkId + + + RecoveryPointId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmUnplannedFailoverInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmUnplannedFailoverInput + + + + + + + + + + + + + + + + + + InstanceType + + + PerformShutdown + + + RecoveryPointId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmUpdateApplianceForReplicationProtectedItemInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmUpdateApplianceForReplicationProtectedItemInput + + + + + + + + + + + + + + + InstanceType + + + RunAsAccountId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmUpdateContainerMappingInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmUpdateContainerMappingInput + + + + + + + + + + + + + + + InstanceType + + + EnableAgentAutoUpgrade + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmUpdateReplicationProtectedItemInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmUpdateReplicationProtectedItemInput + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + InstanceType + + + LicenseType + + + TargetAvailabilitySetId + + + TargetAvailabilityZone + + + TargetBootDiagnosticsStorageAccountId + + + TargetNetworkId + + + TargetProximityPlacementGroupId + + + TargetResourceGroupId + + + TargetVMName + + + TargetVMSize + + + TestNetworkId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageReplicationDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageReplicationDetails + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + InstanceType + + + ActiveSiteType + + + AzureStorageAccountId + + + CompressedDataRateInMb + + + Datastore + + + DiscoveryType + + + DiskResized + + + IPAddress + + + InfrastructureVMId + + + IsAdditionalStatsAvailable + + + LastHeartbeat + + + LastRpoCalculatedTime + + + LastUpdateReceivedTime + + + MasterTargetId + + + MultiVMGroupId + + + MultiVMGroupName + + + MultiVMSyncStatus + + + OSVersion + + + ProcessServerId + + + ProtectionStage + + + RebootAfterUpdateStatus + + + ReplicaId + + + RetentionWindowEnd + + + RetentionWindowStart + + + RpoInSecond + + + SourceVMCpuCount + + + SourceVMRamSizeInMb + + + TotalDataTransferred + + + TotalProgressHealth + + + UncompressedDataRateInMb + + + VCenterInfrastructureId + + + VMId + + + VMProtectionState + + + VMProtectionStateDescription + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageReplicationDetailsConsistencyPoints + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageReplicationDetailsConsistencyPoints + + + + + + + + + + + + Item + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageReprotectInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageReprotectInput + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + InstanceType + + + DatastoreName + + + DisksToInclude + + + MasterTargetId + + + ProcessServerId + + + ProfileId + + + RetentionDrive + + + RunAsAccountId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageTestFailoverInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageTestFailoverInput + + + + + + + + + + + + + + + + + + InstanceType + + + RecoveryPointId + + + RecoveryPointType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageUnplannedFailoverInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageUnplannedFailoverInput + + + + + + + + + + + + + + + + + + InstanceType + + + RecoveryPointId + + + RecoveryPointType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageVolumeExclusionOptions + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageVolumeExclusionOptions + + + + + + + + + + + + + + + OnlyExcludeIfSingleVolume + + + VolumeLabel + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InnerHealthError + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InnerHealthError + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CreationTimeUtc + + + CustomerResolvability + + + EntityId + + + ErrorCategory + + + ErrorCode + + + ErrorId + + + ErrorLevel + + + ErrorMessage + + + ErrorSource + + + ErrorType + + + PossibleCaus + + + RecommendedAction + + + RecoveryProviderErrorMessage + + + SummaryMessage + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InputEndpoint + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InputEndpoint + + + + + + + + + + + + + + + + + + + + + EndpointName + + + PrivatePort + + + Protocol + + + PublicPort + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPConfigDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPConfigDetails + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + IPAddressType + + + IsPrimary + + + IsSeletedForFailover + + + Name + + + RecoveryIPAddressType + + + RecoveryLbBackendAddressPoolId + + + RecoveryPublicIPAddressId + + + RecoveryStaticIPAddress + + + RecoverySubnetName + + + StaticIPAddress + + + SubnetName + + + TfoLbBackendAddressPoolId + + + TfoPublicIPAddressId + + + TfoStaticIPAddress + + + TfoSubnetName + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPConfigInputDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPConfigInputDetails + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + IPConfigName + + + IsPrimary + + + IsSeletedForFailover + + + RecoveryLbBackendAddressPoolId + + + RecoveryPublicIPAddressId + + + RecoveryStaticIPAddress + + + RecoverySubnetName + + + TfoLbBackendAddressPoolId + + + TfoPublicIPAddressId + + + TfoStaticIPAddress + + + TfoSubnetName + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.Job + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.Job + + + + + + + + + + + + + + + + + + + + + Id + + + Location + + + Name + + + Type + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.JobCollection + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.JobCollection + + + + + + + + + + + + NextLink + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.JobDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.JobDetails + + + + + + + + + + + + InstanceType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.JobDetailsAffectedObjectDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.JobDetailsAffectedObjectDetails + + + + + + + + + + + + Item + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.JobEntity + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.JobEntity + + + + + + + + + + + + + + + + + + + + + + + + + + + JobFriendlyName + + + JobId + + + JobScenarioName + + + TargetInstanceType + + + TargetObjectId + + + TargetObjectName + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.JobErrorDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.JobErrorDetails + + + + + + + + + + + + + + + + + + CreationTime + + + ErrorLevel + + + TaskId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.JobProperties + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.JobProperties + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ActivityId + + + AllowedAction + + + EndTime + + + FriendlyName + + + ScenarioName + + + StartTime + + + State + + + StateDescription + + + TargetInstanceType + + + TargetObjectId + + + TargetObjectName + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.JobQueryParameter + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.JobQueryParameter + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AffectedObjectType + + + EndTime + + + FabricId + + + JobName + + + JobOutputType + + + JobStatus + + + StartTime + + + TimezoneOffset + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.JobStatusEventDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.JobStatusEventDetails + + + + + + + + + + + + + + + + + + + + + + + + InstanceType + + + AffectedObjectType + + + JobFriendlyName + + + JobId + + + JobStatus + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.JobTaskDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.JobTaskDetails + + + + + + + + + + + + InstanceType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.KeyEncryptionKeyInfo + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.KeyEncryptionKeyInfo + + + + + + + + + + + + + + + KeyIdentifier + + + KeyVaultResourceArmId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.LogicalNetwork + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.LogicalNetwork + + + + + + + + + + + + + + + + + + + + + Id + + + Location + + + Name + + + Type + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.LogicalNetworkCollection + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.LogicalNetworkCollection + + + + + + + + + + + + NextLink + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.LogicalNetworkProperties + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.LogicalNetworkProperties + + + + + + + + + + + + + + + + + + + + + FriendlyName + + + LogicalNetworkDefinitionsStatus + + + LogicalNetworkUsage + + + NetworkVirtualizationStatus + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ManualActionTaskDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ManualActionTaskDetails + + + + + + + + + + + + + + + + + + + + + InstanceType + + + Instruction + + + Name + + + Observation + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.MarsAgentDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.MarsAgentDetails + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + BiosId + + + FabricObjectId + + + Fqdn + + + Health + + + Id + + + LastHeartbeatUtc + + + Name + + + Version + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.MasterTargetServer + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.MasterTargetServer + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AgentExpiryDate + + + AgentVersion + + + DiskCount + + + IPAddress + + + Id + + + LastHeartbeat + + + MarsAgentExpiryDate + + + MarsAgentVersion + + + Name + + + OSType + + + OSVersion + + + VersionStatus + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.MigrateProviderSpecificInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.MigrateProviderSpecificInput + + + + + + + + + + + + InstanceType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.MigrationItem + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.MigrationItem + + + + + + + + + + + + + + + + + + + + + Id + + + Location + + + Name + + + Type + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.MigrationItemCollection + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.MigrationItemCollection + + + + + + + + + + + + NextLink + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.MigrationItemProperties + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.MigrationItemProperties + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AllowedOperation + + + EventCorrelationId + + + Health + + + LastMigrationStatus + + + LastMigrationTime + + + LastTestMigrationStatus + + + LastTestMigrationTime + + + MachineName + + + MigrationState + + + MigrationStateDescription + + + PolicyFriendlyName + + + PolicyId + + + RecoveryServicesProviderId + + + ReplicationStatus + + + TestMigrateState + + + TestMigrateStateDescription + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.MigrationItemsQueryParameter + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.MigrationItemsQueryParameter + + + + + + + + + + + + + + + + + + InstanceType + + + SourceContainerName + + + SourceFabricName + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.MigrationProviderSpecificSettings + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.MigrationProviderSpecificSettings + + + + + + + + + + + + InstanceType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.MigrationRecoveryPoint + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.MigrationRecoveryPoint + + + + + + + + + + + + + + + + + + + + + Id + + + Location + + + Name + + + Type + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.MigrationRecoveryPointCollection + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.MigrationRecoveryPointCollection + + + + + + + + + + + + NextLink + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.MigrationRecoveryPointProperties + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.MigrationRecoveryPointProperties + + + + + + + + + + + + + + + RecoveryPointTime + + + RecoveryPointType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.MobilityServiceUpdate + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.MobilityServiceUpdate + + + + + + + + + + + + + + + + + + OSType + + + RebootStatus + + + Version + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.Network + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.Network + + + + + + + + + + + + + + + + + + + + + Id + + + Location + + + Name + + + Type + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.NetworkCollection + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.NetworkCollection + + + + + + + + + + + + NextLink + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.NetworkMapping + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.NetworkMapping + + + + + + + + + + + + + + + + + + + + + Id + + + Location + + + Name + + + Type + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.NetworkMappingCollection + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.NetworkMappingCollection + + + + + + + + + + + + NextLink + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.NetworkMappingFabricSpecificSettings + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.NetworkMappingFabricSpecificSettings + + + + + + + + + + + + InstanceType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.NetworkMappingProperties + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.NetworkMappingProperties + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + PrimaryFabricFriendlyName + + + PrimaryNetworkFriendlyName + + + PrimaryNetworkId + + + RecoveryFabricArmId + + + RecoveryFabricFriendlyName + + + RecoveryNetworkFriendlyName + + + RecoveryNetworkId + + + State + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.NetworkProperties + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.NetworkProperties + + + + + + + + + + + + + + + + + + FabricType + + + FriendlyName + + + NetworkType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.NewProtectionProfile + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.NewProtectionProfile + + + + + + + + + + + + + + + + + + + + + + + + + + + ResourceType + + + AppConsistentFrequencyInMinute + + + CrashConsistentFrequencyInMinute + + + MultiVMSyncStatus + + + PolicyName + + + RecoveryPointHistory + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.NewRecoveryVirtualNetwork + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.NewRecoveryVirtualNetwork + + + + + + + + + + + + + + + + + + ResourceType + + + RecoveryVirtualNetworkName + + + RecoveryVirtualNetworkResourceGroupName + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.OperationsDiscovery + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.OperationsDiscovery + + + + + + + + + + + + + + + Name + + + Origin + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.OperationsDiscoveryCollection + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.OperationsDiscoveryCollection + + + + + + + + + + + + NextLink + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.OSDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.OSDetails + + + + + + + + + + + + + + + + + + + + + + + + + + + OSEdition + + + OSMajorVersion + + + OSMinorVersion + + + OSType + + + OSVersion + + + ProductType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.OSDiskDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.OSDiskDetails + + + + + + + + + + + + + + + + + + OSType + + + OSVhdId + + + VhdName + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.OSVersionWrapper + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.OSVersionWrapper + + + + + + + + + + + + + + + ServicePack + + + Version + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PauseReplicationInputProperties + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PauseReplicationInputProperties + + + + + + + + + + + + InstanceType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PlannedFailoverInputProperties + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PlannedFailoverInputProperties + + + + + + + + + + + + FailoverDirection + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PlannedFailoverProviderSpecificFailoverInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PlannedFailoverProviderSpecificFailoverInput + + + + + + + + + + + + InstanceType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.Policy + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.Policy + + + + + + + + + + + + + + + + + + + + + Id + + + Location + + + Name + + + Type + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PolicyCollection + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PolicyCollection + + + + + + + + + + + + NextLink + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PolicyProperties + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PolicyProperties + + + + + + + + + + + + FriendlyName + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PolicyProviderSpecificDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PolicyProviderSpecificDetails + + + + + + + + + + + + InstanceType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PolicyProviderSpecificInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PolicyProviderSpecificInput + + + + + + + + + + + + InstanceType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProcessServer + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProcessServer + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AgentExpiryDate + + + AgentVersion + + + AvailableMemoryInByte + + + AvailableSpaceInByte + + + CpuLoad + + + CpuLoadStatus + + + FriendlyName + + + Health + + + HostId + + + IPAddress + + + Id + + + LastHeartbeat + + + MachineCount + + + MarsCommunicationStatus + + + MarsRegistrationStatus + + + MemoryUsageStatus + + + OSType + + + OSVersion + + + PsServiceStatus + + + PsStatsRefreshTime + + + ReplicationPairCount + + + SpaceUsageStatus + + + SslCertExpiryDate + + + SslCertExpiryRemainingDay + + + SystemLoad + + + SystemLoadStatus + + + ThroughputInByte + + + ThroughputInMBps + + + ThroughputStatus + + + ThroughputUploadPendingDataInByte + + + TotalMemoryInByte + + + TotalSpaceInByte + + + VersionStatus + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProcessServerDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProcessServerDetails + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AvailableMemoryInByte + + + AvailableSpaceInByte + + + BiosId + + + DiskUsageStatus + + + FabricObjectId + + + Fqdn + + + FreeSpacePercentage + + + Health + + + HistoricHealth + + + IPAddress + + + Id + + + LastHeartbeatUtc + + + MemoryUsagePercentage + + + MemoryUsageStatus + + + Name + + + ProcessorUsagePercentage + + + ProcessorUsageStatus + + + ProtectedItemCount + + + SystemLoad + + + SystemLoadStatus + + + ThroughputInByte + + + ThroughputStatus + + + ThroughputUploadPendingDataInByte + + + TotalMemoryInByte + + + TotalSpaceInByte + + + UsedMemoryInByte + + + UsedSpaceInByte + + + Version + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProtectableItem + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProtectableItem + + + + + + + + + + + + + + + + + + + + + Id + + + Location + + + Name + + + Type + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProtectableItemCollection + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProtectableItemCollection + + + + + + + + + + + + NextLink + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProtectableItemProperties + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProtectableItemProperties + + + + + + + + + + + + + + + + + + + + + + + + + + + FriendlyName + + + ProtectionReadinessError + + + ProtectionStatus + + + RecoveryServicesProviderId + + + ReplicationProtectedItemId + + + SupportedReplicationProvider + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProtectableItemQueryParameter + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProtectableItemQueryParameter + + + + + + + + + + + + State + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProtectedItemsQueryParameter + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProtectedItemsQueryParameter + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + FabricObjectId + + + InstanceType + + + MultiVMGroupCreateOption + + + ProcessServerId + + + RecoveryPlanName + + + SourceFabricLocation + + + SourceFabricName + + + VCenterName + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProtectionContainer + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProtectionContainer + + + + + + + + + + + + + + + + + + + + + Id + + + Location + + + Name + + + Type + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProtectionContainerCollection + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProtectionContainerCollection + + + + + + + + + + + + NextLink + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProtectionContainerFabricSpecificDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProtectionContainerFabricSpecificDetails + + + + + + + + + + + + InstanceType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProtectionContainerMapping + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProtectionContainerMapping + + + + + + + + + + + + + + + + + + + + + Id + + + Location + + + Name + + + Type + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProtectionContainerMappingCollection + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProtectionContainerMappingCollection + + + + + + + + + + + + NextLink + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProtectionContainerMappingProperties + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProtectionContainerMappingProperties + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Health + + + PolicyFriendlyName + + + PolicyId + + + SourceFabricFriendlyName + + + SourceProtectionContainerFriendlyName + + + State + + + TargetFabricFriendlyName + + + TargetProtectionContainerFriendlyName + + + TargetProtectionContainerId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProtectionContainerMappingProviderSpecificDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProtectionContainerMappingProviderSpecificDetails + + + + + + + + + + + + InstanceType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProtectionContainerProperties + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProtectionContainerProperties + + + + + + + + + + + + + + + + + + + + + + + + + + + FabricFriendlyName + + + FabricType + + + FriendlyName + + + PairingStatus + + + ProtectedItemCount + + + Role + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProtectionProfileCustomDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProtectionProfileCustomDetails + + + + + + + + + + + + ResourceType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProviderError + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProviderError + + + + + + + + + + + + + + + + + + + + + + + + ErrorCode + + + ErrorId + + + ErrorMessage + + + PossibleCaus + + + RecommendedAction + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProviderSpecificRecoveryPointDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProviderSpecificRecoveryPointDetails + + + + + + + + + + + + InstanceType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PushInstallerDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PushInstallerDetails + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + BiosId + + + FabricObjectId + + + Fqdn + + + Health + + + Id + + + LastHeartbeatUtc + + + Name + + + Version + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RcmProxyDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RcmProxyDetails + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + BiosId + + + ClientAuthenticationType + + + FabricObjectId + + + Fqdn + + + Health + + + Id + + + LastHeartbeatUtc + + + Name + + + Version + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryAvailabilitySetCustomDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryAvailabilitySetCustomDetails + + + + + + + + + + + + ResourceType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlan + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlan + + + + + + + + + + + + + + + + + + + + + Id + + + Location + + + Name + + + Type + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanA2ADetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanA2ADetails + + + + + + + + + + + + + + + + + + InstanceType + + + PrimaryZone + + + RecoveryZone + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanA2AFailoverInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanA2AFailoverInput + + + + + + + + + + + + + + + + + + + + + InstanceType + + + CloudServiceCreationOption + + + MultiVMSyncPointOption + + + RecoveryPointType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanA2AInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanA2AInput + + + + + + + + + + + + + + + + + + InstanceType + + + PrimaryZone + + + RecoveryZone + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanAction + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanAction + + + + + + + + + + + + + + + + + + ActionName + + + FailoverDirection + + + FailoverType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanActionDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanActionDetails + + + + + + + + + + + + InstanceType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanAutomationRunbookActionDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanAutomationRunbookActionDetails + + + + + + + + + + + + + + + + + + + + + InstanceType + + + FabricLocation + + + RunbookId + + + Timeout + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanCollection + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanCollection + + + + + + + + + + + + NextLink + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanGroup + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanGroup + + + + + + + + + + + + GroupType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanGroupTaskDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanGroupTaskDetails + + + + + + + + + + + + + + + + + + + + + InstanceType + + + GroupId + + + Name + + + RpGroupType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanHyperVReplicaAzureFailbackInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanHyperVReplicaAzureFailbackInput + + + + + + + + + + + + + + + + + + InstanceType + + + DataSyncOption + + + RecoveryVMCreationOption + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanHyperVReplicaAzureFailoverInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanHyperVReplicaAzureFailoverInput + + + + + + + + + + + + + + + + + + + + + InstanceType + + + PrimaryKekCertificatePfx + + + RecoveryPointType + + + SecondaryKekCertificatePfx + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanInMageAzureV2FailoverInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanInMageAzureV2FailoverInput + + + + + + + + + + + + + + + + + + InstanceType + + + RecoveryPointType + + + UseMultiVMSyncPoint + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanInMageFailoverInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanInMageFailoverInput + + + + + + + + + + + + + + + InstanceType + + + RecoveryPointType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanInMageRcmFailbackFailoverInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanInMageRcmFailbackFailoverInput + + + + + + + + + + + + + + + + + + InstanceType + + + RecoveryPointType + + + UseMultiVMSyncPoint + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanInMageRcmFailoverInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanInMageRcmFailoverInput + + + + + + + + + + + + + + + + + + InstanceType + + + RecoveryPointType + + + UseMultiVMSyncPoint + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanManualActionDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanManualActionDetails + + + + + + + + + + + + + + + InstanceType + + + Description + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanPlannedFailoverInputProperties + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanPlannedFailoverInputProperties + + + + + + + + + + + + FailoverDirection + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanProperties + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanProperties + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AllowedOperation + + + CurrentScenarioStatus + + + CurrentScenarioStatusDescription + + + FailoverDeploymentModel + + + FriendlyName + + + LastPlannedFailoverTime + + + LastTestFailoverTime + + + LastUnplannedFailoverTime + + + PrimaryFabricFriendlyName + + + PrimaryFabricId + + + RecoveryFabricFriendlyName + + + RecoveryFabricId + + + ReplicationProvider + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanProtectedItem + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanProtectedItem + + + + + + + + + + + + + + + Id + + + VirtualMachineId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanProviderSpecificDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanProviderSpecificDetails + + + + + + + + + + + + InstanceType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanProviderSpecificFailoverInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanProviderSpecificFailoverInput + + + + + + + + + + + + InstanceType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanProviderSpecificInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanProviderSpecificInput + + + + + + + + + + + + InstanceType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanScriptActionDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanScriptActionDetails + + + + + + + + + + + + + + + + + + + + + InstanceType + + + FabricLocation + + + Path + + + Timeout + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanShutdownGroupTaskDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanShutdownGroupTaskDetails + + + + + + + + + + + + + + + + + + + + + GroupId + + + InstanceType + + + Name + + + RpGroupType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanTestFailoverCleanupInputProperties + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanTestFailoverCleanupInputProperties + + + + + + + + + + + + Comment + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanTestFailoverInputProperties + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanTestFailoverInputProperties + + + + + + + + + + + + + + + + + + FailoverDirection + + + NetworkId + + + NetworkType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanUnplannedFailoverInputProperties + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanUnplannedFailoverInputProperties + + + + + + + + + + + + + + + FailoverDirection + + + SourceSiteOperation + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPoint + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPoint + + + + + + + + + + + + + + + + + + + + + Id + + + Location + + + Name + + + Type + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPointCollection + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPointCollection + + + + + + + + + + + + NextLink + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPointProperties + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPointProperties + + + + + + + + + + + + + + + RecoveryPointTime + + + RecoveryPointType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryProximityPlacementGroupCustomDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryProximityPlacementGroupCustomDetails + + + + + + + + + + + + ResourceType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryResourceGroupCustomDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryResourceGroupCustomDetails + + + + + + + + + + + + ResourceType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryServicesProvider + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryServicesProvider + + + + + + + + + + + + + + + + + + + + + Id + + + Location + + + Name + + + Type + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryServicesProviderCollection + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryServicesProviderCollection + + + + + + + + + + + + NextLink + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryServicesProviderProperties + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryServicesProviderProperties + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AllowedScenario + + + BiosId + + + ConnectionStatus + + + DraIdentifier + + + FabricFriendlyName + + + FabricType + + + FriendlyName + + + LastHeartBeat + + + MachineId + + + MachineName + + + ProtectedItemCount + + + ProviderVersion + + + ProviderVersionExpiryDate + + + ProviderVersionState + + + ServerVersion + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryVirtualNetworkCustomDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryVirtualNetworkCustomDetails + + + + + + + + + + + + ResourceType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RemoveDisksProviderSpecificInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RemoveDisksProviderSpecificInput + + + + + + + + + + + + InstanceType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RenewCertificateInputProperties + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RenewCertificateInputProperties + + + + + + + + + + + + RenewCertificateType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationAgentDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationAgentDetails + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + BiosId + + + FabricObjectId + + + Fqdn + + + Health + + + Id + + + LastHeartbeatUtc + + + Name + + + Version + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationEligibilityResults + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationEligibilityResults + + + + + + + + + + + + + + + + + + Id + + + Name + + + Type + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationEligibilityResultsErrorInfo + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationEligibilityResultsErrorInfo + + + + + + + + + + + + + + + + + + + + + + + + Code + + + Message + + + PossibleCaus + + + RecommendedAction + + + Status + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationEligibilityResultsProperties + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationEligibilityResultsProperties + + + + + + + + + + + + ClientRequestId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationGroupDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationGroupDetails + + + + + + + + + + + + InstanceType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProtectedItem + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProtectedItem + + + + + + + + + + + + + + + + + + + + + Id + + + Location + + + Name + + + Type + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProtectedItemCollection + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProtectedItemCollection + + + + + + + + + + + + NextLink + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProtectedItemProperties + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProtectedItemProperties + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ActiveLocation + + + AllowedOperation + + + EventCorrelationId + + + FailoverHealth + + + FailoverRecoveryPointId + + + FriendlyName + + + LastSuccessfulFailoverTime + + + LastSuccessfulTestFailoverTime + + + PolicyFriendlyName + + + PolicyId + + + PrimaryFabricFriendlyName + + + PrimaryFabricProvider + + + PrimaryProtectionContainerFriendlyName + + + ProtectableItemId + + + ProtectedItemType + + + ProtectionState + + + ProtectionStateDescription + + + RecoveryContainerId + + + RecoveryFabricFriendlyName + + + RecoveryFabricId + + + RecoveryProtectionContainerFriendlyName + + + RecoveryServicesProviderId + + + ReplicationHealth + + + SwitchProviderState + + + SwitchProviderStateDescription + + + TestFailoverState + + + TestFailoverStateDescription + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProtectionIntent + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProtectionIntent + + + + + + + + + + + + + + + + + + + + + Id + + + Location + + + Name + + + Type + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProtectionIntentCollection + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProtectionIntentCollection + + + + + + + + + + + + NextLink + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProtectionIntentProperties + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProtectionIntentProperties + + + + + + + + + + + + + + + + + + + + + + + + CreationTimeUtc + + + FriendlyName + + + IsActive + + + JobId + + + JobState + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProtectionIntentProviderSpecificSettings + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProtectionIntentProviderSpecificSettings + + + + + + + + + + + + InstanceType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProviderContainerUnmappingInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProviderContainerUnmappingInput + + + + + + + + + + + + InstanceType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProviderSpecificContainerCreationInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProviderSpecificContainerCreationInput + + + + + + + + + + + + InstanceType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProviderSpecificContainerMappingInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProviderSpecificContainerMappingInput + + + + + + + + + + + + InstanceType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProviderSpecificSettings + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProviderSpecificSettings + + + + + + + + + + + + InstanceType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProviderSpecificUpdateContainerMappingInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProviderSpecificUpdateContainerMappingInput + + + + + + + + + + + + InstanceType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReprotectAgentDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReprotectAgentDetails + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AccessibleDatastore + + + BiosId + + + FabricObjectId + + + Fqdn + + + Health + + + Id + + + LastDiscoveryInUtc + + + LastHeartbeatUtc + + + Name + + + ProtectedItemCount + + + VcenterId + + + Version + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ResolveHealthError + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ResolveHealthError + + + + + + + + + + + + HealthErrorId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.Resource + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.Resource + + + + + + + + + + + + + + + + + + + + + Id + + + Location + + + Name + + + Type + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ResourceHealthSummary + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ResourceHealthSummary + + + + + + + + + + + + ResourceCount + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ResourceHealthSummaryCategorizedResourceCounts + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ResourceHealthSummaryCategorizedResourceCounts + + + + + + + + + + + + Item + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ResumeJobParamsProperties + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ResumeJobParamsProperties + + + + + + + + + + + + Comment + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ResumeReplicationProviderSpecificInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ResumeReplicationProviderSpecificInput + + + + + + + + + + + + InstanceType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ResyncProviderSpecificInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ResyncProviderSpecificInput + + + + + + + + + + + + InstanceType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RetentionVolume + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RetentionVolume + + + + + + + + + + + + + + + + + + + + + CapacityInByte + + + FreeSpaceInByte + + + ThresholdPercentage + + + VolumeName + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReverseReplicationInputProperties + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReverseReplicationInputProperties + + + + + + + + + + + + FailoverDirection + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReverseReplicationProviderSpecificInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReverseReplicationProviderSpecificInput + + + + + + + + + + + + InstanceType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RoleAssignment + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RoleAssignment + + + + + + + + + + + + + + + + + + + + + + + + Id + + + Name + + + PrincipalId + + + RoleDefinitionId + + + Scope + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RunAsAccount + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RunAsAccount + + + + + + + + + + + + + + + AccountId + + + AccountName + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ScriptActionTaskDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ScriptActionTaskDetails + + + + + + + + + + + + + + + + + + + + + + + + InstanceType + + + IsPrimarySideScript + + + Name + + + Output + + + Path + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ServiceError + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ServiceError + + + + + + + + + + + + + + + + + + + + + + + + ActivityId + + + Code + + + Message + + + PossibleCaus + + + RecommendedAction + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.StorageAccountCustomDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.StorageAccountCustomDetails + + + + + + + + + + + + ResourceType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.StorageClassification + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.StorageClassification + + + + + + + + + + + + + + + + + + + + + Id + + + Location + + + Name + + + Type + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.StorageClassificationCollection + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.StorageClassificationCollection + + + + + + + + + + + + NextLink + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.StorageClassificationMapping + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.StorageClassificationMapping + + + + + + + + + + + + + + + + + + + + + Id + + + Location + + + Name + + + Type + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.StorageClassificationMappingCollection + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.StorageClassificationMappingCollection + + + + + + + + + + + + NextLink + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.StorageClassificationMappingProperties + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.StorageClassificationMappingProperties + + + + + + + + + + + + TargetStorageClassificationId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.StorageClassificationProperties + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.StorageClassificationProperties + + + + + + + + + + + + FriendlyName + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.StorageMappingInputProperties + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.StorageMappingInputProperties + + + + + + + + + + + + TargetStorageClassificationId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.Subnet + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.Subnet + + + + + + + + + + + + + + + + + + AddressList + + + FriendlyName + + + Name + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.SupportedOperatingSystems + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.SupportedOperatingSystems + + + + + + + + + + + + + + + + + + + + + Id + + + Location + + + Name + + + Type + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.SupportedOSDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.SupportedOSDetails + + + + + + + + + + + + + + + OSName + + + OSType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.SupportedOSProperty + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.SupportedOSProperty + + + + + + + + + + + + InstanceType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.SwitchProtectionInputProperties + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.SwitchProtectionInputProperties + + + + + + + + + + + + ReplicationProtectedItemName + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.SwitchProtectionJobDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.SwitchProtectionJobDetails + + + + + + + + + + + + + + + InstanceType + + + NewReplicationProtectedItemId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.SwitchProtectionProviderSpecificInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.SwitchProtectionProviderSpecificInput + + + + + + + + + + + + InstanceType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.SwitchProviderInputProperties + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.SwitchProviderInputProperties + + + + + + + + + + + + TargetInstanceType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.SwitchProviderSpecificInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.SwitchProviderSpecificInput + + + + + + + + + + + + InstanceType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.TargetComputeSize + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.TargetComputeSize + + + + + + + + + + + + + + + + + + Id + + + Name + + + Type + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.TargetComputeSizeCollection + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.TargetComputeSizeCollection + + + + + + + + + + + + NextLink + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.TargetComputeSizeProperties + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.TargetComputeSizeProperties + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CpuCoresCount + + + FriendlyName + + + HighIopsSupported + + + HyperVGeneration + + + MaxDataDiskCount + + + MaxNicsCount + + + MemoryInGb + + + Name + + + VCpUsAvailable + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.TaskTypeDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.TaskTypeDetails + + + + + + + + + + + + InstanceType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.TestFailoverCleanupInputProperties + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.TestFailoverCleanupInputProperties + + + + + + + + + + + + Comment + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.TestFailoverInputProperties + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.TestFailoverInputProperties + + + + + + + + + + + + + + + + + + FailoverDirection + + + NetworkId + + + NetworkType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.TestFailoverJobDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.TestFailoverJobDetails + + + + + + + + + + + + + + + + + + + + + + + + + + + InstanceType + + + Comment + + + NetworkFriendlyName + + + NetworkName + + + NetworkType + + + TestFailoverStatus + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.TestFailoverProviderSpecificInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.TestFailoverProviderSpecificInput + + + + + + + + + + + + InstanceType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.TestMigrateCleanupInputProperties + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.TestMigrateCleanupInputProperties + + + + + + + + + + + + Comment + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.TestMigrateProviderSpecificInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.TestMigrateProviderSpecificInput + + + + + + + + + + + + InstanceType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UnplannedFailoverInputProperties + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UnplannedFailoverInputProperties + + + + + + + + + + + + + + + FailoverDirection + + + SourceSiteOperation + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UnplannedFailoverProviderSpecificInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UnplannedFailoverProviderSpecificInput + + + + + + + + + + + + InstanceType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateApplianceForReplicationProtectedItemInputProperties + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateApplianceForReplicationProtectedItemInputProperties + + + + + + + + + + + + TargetApplianceId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateApplianceForReplicationProtectedItemProviderSpecificInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateApplianceForReplicationProtectedItemProviderSpecificInput + + + + + + + + + + + + InstanceType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateDiskInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateDiskInput + + + + + + + + + + + + + + + DiskId + + + TargetDiskName + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateMigrationItemProviderSpecificInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateMigrationItemProviderSpecificInput + + + + + + + + + + + + InstanceType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateMobilityServiceRequestProperties + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateMobilityServiceRequestProperties + + + + + + + + + + + + RunAsAccountId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateNetworkMappingInputProperties + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateNetworkMappingInputProperties + + + + + + + + + + + + + + + RecoveryFabricName + + + RecoveryNetworkId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateReplicationProtectedItemInputProperties + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateReplicationProtectedItemInputProperties + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + EnableRdpOnTargetOption + + + LicenseType + + + RecoveryAvailabilitySetId + + + RecoveryAzureVMName + + + RecoveryAzureVMSize + + + SelectedRecoveryAzureNetworkId + + + SelectedSourceNicId + + + SelectedTfoAzureNetworkId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateReplicationProtectedItemProviderInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateReplicationProtectedItemProviderInput + + + + + + + + + + + + InstanceType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateVCenterRequestProperties + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateVCenterRequestProperties + + + + + + + + + + + + + + + + + + + + + + + + FriendlyName + + + IPAddress + + + Port + + + ProcessServerId + + + RunAsAccountId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VaultHealthDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VaultHealthDetails + + + + + + + + + + + + + + + + + + + + + Id + + + Location + + + Name + + + Type + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VaultSetting + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VaultSetting + + + + + + + + + + + + + + + + + + + + + Id + + + Location + + + Name + + + Type + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VaultSettingCollection + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VaultSettingCollection + + + + + + + + + + + + NextLink + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VaultSettingCreationInputProperties + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VaultSettingCreationInputProperties + + + + + + + + + + + + + + + MigrationSolutionId + + + VmwareToAzureProviderType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VaultSettingProperties + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VaultSettingProperties + + + + + + + + + + + + + + + MigrationSolutionId + + + VmwareToAzureProviderType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VCenter + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VCenter + + + + + + + + + + + + + + + + + + + + + Id + + + Location + + + Name + + + Type + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VCenterCollection + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VCenterCollection + + + + + + + + + + + + NextLink + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VCenterProperties + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VCenterProperties + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + DiscoveryStatus + + + FabricArmResourceName + + + FriendlyName + + + IPAddress + + + InfrastructureId + + + InternalId + + + LastHeartbeat + + + Port + + + ProcessServerId + + + RunAsAccountId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VersionDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VersionDetails + + + + + + + + + + + + + + + + + + ExpiryDate + + + Status + + + Version + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VirtualMachineTaskDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VirtualMachineTaskDetails + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + InstanceType + + + JobTaskJobFriendlyName + + + JobTaskJobId + + + JobTaskJobScenarioName + + + JobTaskTargetInstanceType + + + JobTaskTargetObjectId + + + JobTaskTargetObjectName + + + SkippedReason + + + SkippedReasonString + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VmmDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VmmDetails + + + + + + + + + + + + InstanceType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VmmToAzureCreateNetworkMappingInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VmmToAzureCreateNetworkMappingInput + + + + + + + + + + + + InstanceType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VmmToAzureNetworkMappingSettings + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VmmToAzureNetworkMappingSettings + + + + + + + + + + + + InstanceType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VmmToAzureUpdateNetworkMappingInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VmmToAzureUpdateNetworkMappingInput + + + + + + + + + + + + InstanceType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VmmToVmmCreateNetworkMappingInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VmmToVmmCreateNetworkMappingInput + + + + + + + + + + + + InstanceType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VmmToVmmNetworkMappingSettings + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VmmToVmmNetworkMappingSettings + + + + + + + + + + + + InstanceType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VmmToVmmUpdateNetworkMappingInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VmmToVmmUpdateNetworkMappingInput + + + + + + + + + + + + InstanceType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VmmVirtualMachineDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VmmVirtualMachineDetails + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Generation + + + HasFibreChannelAdapter + + + HasPhysicalDisk + + + HasSharedVhd + + + HyperVHostId + + + InstanceType + + + OSDetailOsedition + + + OSDetailOsmajorVersion + + + OSDetailOsminorVersion + + + OSDetailOstype + + + OSDetailOsversion + + + OSDetailProductType + + + SourceItemId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMNicDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMNicDetails + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + EnableAcceleratedNetworkingOnRecovery + + + EnableAcceleratedNetworkingOnTfo + + + NicId + + + RecoveryNetworkSecurityGroupId + + + RecoveryNicName + + + RecoveryNicResourceGroupName + + + RecoveryVMNetworkId + + + ReplicaNicId + + + ReuseExistingNic + + + SelectionType + + + SourceNicArmId + + + TargetNicName + + + TfoNetworkSecurityGroupId + + + TfoRecoveryNicName + + + TfoRecoveryNicResourceGroupName + + + TfoReuseExistingNic + + + TfoVMNetworkId + + + VMNetworkName + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMNicInputDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMNicInputDetails + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + EnableAcceleratedNetworkingOnRecovery + + + EnableAcceleratedNetworkingOnTfo + + + NicId + + + RecoveryNetworkSecurityGroupId + + + RecoveryNicName + + + RecoveryNicResourceGroupName + + + ReuseExistingNic + + + SelectionType + + + TargetNicName + + + TfoNetworkSecurityGroupId + + + TfoNicName + + + TfoNicResourceGroupName + + + TfoReuseExistingNic + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMNicUpdatesTaskDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMNicUpdatesTaskDetails + + + + + + + + + + + + + + + + + + + + + InstanceType + + + Name + + + NicId + + + VMId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtContainerCreationInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtContainerCreationInput + + + + + + + + + + + + InstanceType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtContainerMappingInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtContainerMappingInput + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + InstanceType + + + KeyVaultId + + + KeyVaultUri + + + ServiceBusConnectionStringSecretName + + + StorageAccountId + + + StorageAccountSasSecretName + + + TargetLocation + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtDiskInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtDiskInput + + + + + + + + + + + + + + + + + + + + + + + + + + + DiskEncryptionSetId + + + DiskId + + + DiskType + + + IsOSDisk + + + LogStorageAccountId + + + LogStorageAccountSasSecretName + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtEnableMigrationInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtEnableMigrationInput + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + InstanceType + + + DataMoverRunAsAccountId + + + LicenseType + + + PerformAutoResync + + + PerformSqlBulkRegistration + + + SnapshotRunAsAccountId + + + SqlServerLicenseType + + + TargetAvailabilitySetId + + + TargetAvailabilityZone + + + TargetBootDiagnosticsStorageAccountId + + + TargetNetworkId + + + TargetProximityPlacementGroupId + + + TargetResourceGroupId + + + TargetSubnetName + + + TargetVMName + + + TargetVMSize + + + TestNetworkId + + + TestSubnetName + + + VmwareMachineId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtEnableMigrationInputSeedDiskTags + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtEnableMigrationInputSeedDiskTags + + + + + + + + + + + + Item + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtEnableMigrationInputTargetDiskTags + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtEnableMigrationInputTargetDiskTags + + + + + + + + + + + + Item + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtEnableMigrationInputTargetNicTags + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtEnableMigrationInputTargetNicTags + + + + + + + + + + + + Item + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtEnableMigrationInputTargetVmtags + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtEnableMigrationInputTargetVmtags + + + + + + + + + + + + Item + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtEventDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtEventDetails + + + + + + + + + + + + + + + InstanceType + + + MigrationItemName + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtMigrateInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtMigrateInput + + + + + + + + + + + + + + + InstanceType + + + PerformShutdown + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtMigrationDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtMigrationDetails + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + InstanceType + + + DataMoverRunAsAccountId + + + FirmwareType + + + InitialSeedingProgressPercentage + + + InitialSeedingRetryCount + + + LastRecoveryPointId + + + LastRecoveryPointReceived + + + LicenseType + + + MigrationProgressPercentage + + + MigrationRecoveryPointId + + + OSType + + + PerformAutoResync + + + ResumeProgressPercentage + + + ResumeRetryCount + + + ResyncProgressPercentage + + + ResyncRequired + + + ResyncRetryCount + + + ResyncState + + + SnapshotRunAsAccountId + + + SqlServerLicenseType + + + StorageAccountId + + + TargetAvailabilitySetId + + + TargetAvailabilityZone + + + TargetBootDiagnosticsStorageAccountId + + + TargetGeneration + + + TargetLocation + + + TargetNetworkId + + + TargetProximityPlacementGroupId + + + TargetResourceGroupId + + + TargetVMName + + + TargetVMSize + + + TestNetworkId + + + VmwareMachineId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtMigrationDetailsSeedDiskTags + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtMigrationDetailsSeedDiskTags + + + + + + + + + + + + Item + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtMigrationDetailsTargetDiskTags + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtMigrationDetailsTargetDiskTags + + + + + + + + + + + + Item + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtMigrationDetailsTargetNicTags + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtMigrationDetailsTargetNicTags + + + + + + + + + + + + Item + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtMigrationDetailsTargetVmtags + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtMigrationDetailsTargetVmtags + + + + + + + + + + + + Item + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtNicDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtNicDetails + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + IsPrimaryNic + + + IsSelectedForMigration + + + NicId + + + SourceIPAddress + + + SourceIPAddressType + + + SourceNetworkId + + + TargetIPAddress + + + TargetIPAddressType + + + TargetNicName + + + TargetSubnetName + + + TestIPAddress + + + TestIPAddressType + + + TestNetworkId + + + TestSubnetName + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtNicInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtNicInput + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + IsPrimaryNic + + + IsSelectedForMigration + + + NicId + + + TargetNicName + + + TargetStaticIPAddress + + + TargetSubnetName + + + TestStaticIPAddress + + + TestSubnetName + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtPolicyCreationInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtPolicyCreationInput + + + + + + + + + + + + + + + + + + + + + InstanceType + + + AppConsistentFrequencyInMinute + + + CrashConsistentFrequencyInMinute + + + RecoveryPointHistoryInMinute + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VmwareCbtPolicyDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VmwareCbtPolicyDetails + + + + + + + + + + + + + + + + + + + + + InstanceType + + + AppConsistentFrequencyInMinute + + + CrashConsistentFrequencyInMinute + + + RecoveryPointHistoryInMinute + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtProtectedDiskDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtProtectedDiskDetails + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CapacityInByte + + + DiskEncryptionSetId + + + DiskId + + + DiskName + + + DiskPath + + + DiskType + + + IsOSDisk + + + LogStorageAccountId + + + LogStorageAccountSasSecretName + + + SeedBlobUri + + + SeedManagedDiskId + + + TargetBlobUri + + + TargetDiskName + + + TargetManagedDiskId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtProtectionContainerMappingDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtProtectionContainerMappingDetails + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + InstanceType + + + KeyVaultId + + + KeyVaultUri + + + ServiceBusConnectionStringSecretName + + + StorageAccountId + + + StorageAccountSasSecretName + + + TargetLocation + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtProtectionContainerMappingDetailsRoleSizeToNicCountMap + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtProtectionContainerMappingDetailsRoleSizeToNicCountMap + + + + + + + + + + + + Item + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtResumeReplicationInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtResumeReplicationInput + + + + + + + + + + + + + + + InstanceType + + + DeleteMigrationResource + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtResyncInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtResyncInput + + + + + + + + + + + + + + + InstanceType + + + SkipCbtReset + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtTestMigrateInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtTestMigrateInput + + + + + + + + + + + + + + + + + + InstanceType + + + NetworkId + + + RecoveryPointId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtUpdateDiskInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtUpdateDiskInput + + + + + + + + + + + + + + + + + + DiskId + + + IsOSDisk + + + TargetDiskName + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtUpdateMigrationItemInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtUpdateMigrationItemInput + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + InstanceType + + + LicenseType + + + PerformAutoResync + + + SqlServerLicenseType + + + TargetAvailabilitySetId + + + TargetAvailabilityZone + + + TargetBootDiagnosticsStorageAccountId + + + TargetNetworkId + + + TargetProximityPlacementGroupId + + + TargetResourceGroupId + + + TargetVMName + + + TargetVMSize + + + TestNetworkId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtUpdateMigrationItemInputTargetDiskTags + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtUpdateMigrationItemInputTargetDiskTags + + + + + + + + + + + + Item + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtUpdateMigrationItemInputTargetNicTags + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtUpdateMigrationItemInputTargetNicTags + + + + + + + + + + + + Item + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtUpdateMigrationItemInputTargetVmtags + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtUpdateMigrationItemInputTargetVmtags + + + + + + + + + + + + Item + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareDetails + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + InstanceType + + + AgentCount + + + AgentExpiryDate + + + AgentVersion + + + AvailableMemoryInByte + + + AvailableSpaceInByte + + + CpuLoad + + + CpuLoadStatus + + + CsServiceStatus + + + DatabaseServerLoad + + + DatabaseServerLoadStatus + + + HostName + + + IPAddress + + + LastHeartbeat + + + MemoryUsageStatus + + + ProcessServerCount + + + ProtectedServer + + + PsTemplateVersion + + + ReplicationPairCount + + + SpaceUsageStatus + + + SslCertExpiryDate + + + SslCertExpiryRemainingDay + + + SystemLoad + + + SystemLoadStatus + + + TotalMemoryInByte + + + TotalSpaceInByte + + + VersionStatus + + + WebLoad + + + WebLoadStatus + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareV2FabricCreationInput + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareV2FabricCreationInput + + + + + + + + + + + + + + + + + + + + + InstanceType + + + MigrationSolutionId + + + PhysicalSiteId + + + VmwareSiteId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareV2FabricSpecificDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareV2FabricSpecificDetails + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + InstanceType + + + MigrationSolutionId + + + PhysicalSiteId + + + ServiceContainerId + + + ServiceEndpoint + + + ServiceResourceId + + + VmwareSiteId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareVirtualMachineDetails + + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareVirtualMachineDetails + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + InstanceType + + + AgentGeneratedId + + + AgentInstalled + + + AgentVersion + + + DiscoveryType + + + IPAddress + + + OSType + + + PoweredOn + + + VCenterInfrastructureId + + + + + + + + \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/Az.SiteRecovery.nuspec b/swaggerci/recoveryservicessiterecovery/Az.SiteRecovery.nuspec new file mode 100644 index 000000000000..0076a7f20f10 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/Az.SiteRecovery.nuspec @@ -0,0 +1,32 @@ + + + + Az.SiteRecovery + 0.1.0 + Microsoft Corporation + Microsoft Corporation + true + https://aka.ms/azps-license + https://github.com/Azure/azure-powershell + Microsoft Azure PowerShell: $(service-name) cmdlets + + Microsoft Corporation. All rights reserved. + Azure ResourceManager ARM PSModule $(service-name) + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/Az.SiteRecovery.psd1 b/swaggerci/recoveryservicessiterecovery/Az.SiteRecovery.psd1 new file mode 100644 index 000000000000..c129b169ff9a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/Az.SiteRecovery.psd1 @@ -0,0 +1,24 @@ +@{ + GUID = 'c90fb24e-08e3-4a75-9dd2-4d4b9d35f458' + RootModule = './Az.SiteRecovery.psm1' + ModuleVersion = '0.1.0' + CompatiblePSEditions = 'Core', 'Desktop' + Author = 'Microsoft Corporation' + CompanyName = 'Microsoft Corporation' + Copyright = 'Microsoft Corporation. All rights reserved.' + Description = 'Microsoft Azure PowerShell: SiteRecovery cmdlets' + PowerShellVersion = '5.1' + DotNetFrameworkVersion = '4.7.2' + RequiredAssemblies = './bin/Az.SiteRecovery.private.dll' + FormatsToProcess = './Az.SiteRecovery.format.ps1xml' + FunctionsToExport = 'Add-AzSiteRecoveryReplicationProtectedItemDisk', 'Add-AzSiteRecoveryReplicationProtectedItemRecoveryPoint', 'Clear-AzSiteRecoveryReplicationFabric', 'Clear-AzSiteRecoveryReplicationProtectedItem', 'Clear-AzSiteRecoveryReplicationProtectionContainerMapping', 'Clear-AzSiteRecoveryReplicationRecoveryServicesProvider', 'Export-AzSiteRecoveryReplicationJob', 'Find-AzSiteRecoveryReplicationProtectionContainerProtectableItem', 'Get-AzSiteRecoveryMigrationRecoveryPoint', 'Get-AzSiteRecoveryPoint', 'Get-AzSiteRecoveryReplicationAlertSetting', 'Get-AzSiteRecoveryReplicationAppliance', 'Get-AzSiteRecoveryReplicationEligibilityResult', 'Get-AzSiteRecoveryReplicationEvent', 'Get-AzSiteRecoveryReplicationFabric', 'Get-AzSiteRecoveryReplicationJob', 'Get-AzSiteRecoveryReplicationLogicalNetwork', 'Get-AzSiteRecoveryReplicationMigrationItem', 'Get-AzSiteRecoveryReplicationNetwork', 'Get-AzSiteRecoveryReplicationNetworkMapping', 'Get-AzSiteRecoveryReplicationPolicy', 'Get-AzSiteRecoveryReplicationProtectableItem', 'Get-AzSiteRecoveryReplicationProtectedItem', 'Get-AzSiteRecoveryReplicationProtectionContainer', 'Get-AzSiteRecoveryReplicationProtectionContainerMapping', 'Get-AzSiteRecoveryReplicationProtectionIntent', 'Get-AzSiteRecoveryReplicationRecoveryPlan', 'Get-AzSiteRecoveryReplicationRecoveryServiceProvider', 'Get-AzSiteRecoveryReplicationRecoveryServicesProvider', 'Get-AzSiteRecoveryReplicationStorageClassification', 'Get-AzSiteRecoveryReplicationStorageClassificationMapping', 'Get-AzSiteRecoveryReplicationVaultHealth', 'Get-AzSiteRecoveryReplicationVaultSetting', 'Get-AzSiteRecoveryReplicationvCenter', 'Get-AzSiteRecoverySupportedOperatingSystem', 'Get-AzSiteRecoveryTargetComputeSize', 'Invoke-AzSiteRecoveryCommitReplicationProtectedItemFailover', 'Invoke-AzSiteRecoveryCommitReplicationRecoveryPlanFailover', 'Invoke-AzSiteRecoveryPlannedReplicationProtectedItemFailover', 'Invoke-AzSiteRecoveryPlannedReplicationRecoveryPlanFailover', 'Invoke-AzSiteRecoveryRenewReplicationFabricCertificate', 'Invoke-AzSiteRecoveryReprotectReplicationProtectedItem', 'Invoke-AzSiteRecoveryReprotectReplicationRecoveryPlan', 'Invoke-AzSiteRecoveryResyncReplicationMigrationItem', 'Invoke-AzSiteRecoveryUnplannedReplicationProtectedItemFailover', 'Invoke-AzSiteRecoveryUnplannedReplicationRecoveryPlanFailover', 'Move-AzSiteRecoveryReplicationFabricGateway', 'Move-AzSiteRecoveryReplicationFabricToAad', 'Move-AzSiteRecoveryReplicationMigrationItem', 'New-AzSiteRecoveryReplicationAlertSetting', 'New-AzSiteRecoveryReplicationFabric', 'New-AzSiteRecoveryReplicationMigrationItem', 'New-AzSiteRecoveryReplicationNetworkMapping', 'New-AzSiteRecoveryReplicationPolicy', 'New-AzSiteRecoveryReplicationProtectedItem', 'New-AzSiteRecoveryReplicationProtectionContainer', 'New-AzSiteRecoveryReplicationProtectionContainerMapping', 'New-AzSiteRecoveryReplicationProtectionIntent', 'New-AzSiteRecoveryReplicationRecoveryPlan', 'New-AzSiteRecoveryReplicationRecoveryServicesProvider', 'New-AzSiteRecoveryReplicationStorageClassificationMapping', 'New-AzSiteRecoveryReplicationVaultSetting', 'New-AzSiteRecoveryReplicationvCenter', 'Remove-AzSiteRecoveryReplicationFabric', 'Remove-AzSiteRecoveryReplicationMigrationItem', 'Remove-AzSiteRecoveryReplicationNetworkMapping', 'Remove-AzSiteRecoveryReplicationPolicy', 'Remove-AzSiteRecoveryReplicationProtectedItem', 'Remove-AzSiteRecoveryReplicationProtectedItemDisk', 'Remove-AzSiteRecoveryReplicationProtectionContainer', 'Remove-AzSiteRecoveryReplicationProtectionContainerMapping', 'Remove-AzSiteRecoveryReplicationRecoveryPlan', 'Remove-AzSiteRecoveryReplicationRecoveryServicesProvider', 'Remove-AzSiteRecoveryReplicationStorageClassificationMapping', 'Remove-AzSiteRecoveryReplicationvCenter', 'Repair-AzSiteRecoveryReplicationProtectedItemReplication', 'Resolve-AzSiteRecoveryReplicationProtectedItemHealthError', 'Restart-AzSiteRecoveryReplicationJob', 'Resume-AzSiteRecoveryReplicationJob', 'Resume-AzSiteRecoveryReplicationMigrationItemReplication', 'Stop-AzSiteRecoveryReplicationJob', 'Stop-AzSiteRecoveryReplicationProtectedItemFailover', 'Stop-AzSiteRecoveryReplicationRecoveryPlanFailover', 'Suspend-AzSiteRecoveryReplicationMigrationItemReplication', 'Switch-AzSiteRecoveryReplicationProtectedItemProvider', 'Switch-AzSiteRecoveryReplicationProtectionContainerProtection', 'Test-AzSiteRecoveryReplicationFabricConsistency', 'Test-AzSiteRecoveryReplicationMigrationItemMigrate', 'Test-AzSiteRecoveryReplicationMigrationItemMigrateCleanup', 'Test-AzSiteRecoveryReplicationProtectedItemFailover', 'Test-AzSiteRecoveryReplicationProtectedItemFailoverCleanup', 'Test-AzSiteRecoveryReplicationRecoveryPlanFailover', 'Test-AzSiteRecoveryReplicationRecoveryPlanFailoverCleanup', 'Update-AzSiteRecoveryReplicationMigrationItem', 'Update-AzSiteRecoveryReplicationNetworkMapping', 'Update-AzSiteRecoveryReplicationPolicy', 'Update-AzSiteRecoveryReplicationProtectedItem', 'Update-AzSiteRecoveryReplicationProtectedItemAppliance', 'Update-AzSiteRecoveryReplicationProtectedItemMobilityService', 'Update-AzSiteRecoveryReplicationProtectionContainerMapping', 'Update-AzSiteRecoveryReplicationRecoveryPlan', 'Update-AzSiteRecoveryReplicationRecoveryServiceProvider', 'Update-AzSiteRecoveryReplicationVaultHealth', 'Update-AzSiteRecoveryReplicationvCenter', '*' + AliasesToExport = '*' + PrivateData = @{ + PSData = @{ + Tags = 'Azure', 'ResourceManager', 'ARM', 'PSModule', 'SiteRecovery' + LicenseUri = 'https://aka.ms/azps-license' + ProjectUri = 'https://github.com/Azure/azure-powershell' + ReleaseNotes = '' + } + } +} diff --git a/swaggerci/recoveryservicessiterecovery/Az.SiteRecovery.psm1 b/swaggerci/recoveryservicessiterecovery/Az.SiteRecovery.psm1 new file mode 100644 index 000000000000..b6038e261a8e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/Az.SiteRecovery.psm1 @@ -0,0 +1,107 @@ +# region Generated + # ---------------------------------------------------------------------------------- + # Copyright (c) Microsoft Corporation. All rights 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. + # ---------------------------------------------------------------------------------- + # Load required Az.Accounts module + $accountsName = 'Az.Accounts' + $accountsModule = Get-Module -Name $accountsName + if(-not $accountsModule) { + $localAccountsPath = Join-Path $PSScriptRoot 'generated/modules' + if(Test-Path -Path $localAccountsPath) { + $localAccounts = Get-ChildItem -Path $localAccountsPath -Recurse -Include 'Az.Accounts.psd1' | Select-Object -Last 1 + if($localAccounts) { + $accountsModule = Import-Module -Name ($localAccounts.FullName) -Scope Global -PassThru + } + } + if(-not $accountsModule) { + $hasAdequateVersion = (Get-Module -Name $accountsName -ListAvailable | Where-Object { $_.Version -ge [System.Version]'2.7.5' } | Measure-Object).Count -gt 0 + if($hasAdequateVersion) { + $accountsModule = Import-Module -Name $accountsName -MinimumVersion 2.7.5 -Scope Global -PassThru + } + } + } + + if(-not $accountsModule) { + Write-Error "`nThis module requires $accountsName version 2.7.5 or greater. For installation instructions, please see: https://learn.microsoft.com/powershell/azure/install-az-ps" -ErrorAction Stop + } elseif (($accountsModule.Version -lt [System.Version]'2.7.5') -and (-not $localAccounts)) { + Write-Error "`nThis module requires $accountsName version 2.7.5 or greater. An earlier version of Az.Accounts is imported in the current PowerShell session. If you are running test, please try to add the switch '-RegenerateSupportModule' when executing 'test-module.ps1'. Otherwise please open a new PowerShell session and import this module again.`nAdditionally, this error could indicate that multiple incompatible versions of Azure PowerShell modules are installed on your system. For troubleshooting information, please see: https://aka.ms/azps-version-error" -ErrorAction Stop + } + Write-Information "Loaded Module '$($accountsModule.Name)'" + + # Load the private module dll + $null = Import-Module -Name (Join-Path $PSScriptRoot './bin/Az.SiteRecovery.private.dll') + + # Get the private module's instance + $instance = [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module]::Instance + + # Ask for the shared functionality table + $VTable = Register-AzModule + + # Tweaks the pipeline on module load + $instance.OnModuleLoad = $VTable.OnModuleLoad + + # Following two delegates are added for telemetry + $instance.GetTelemetryId = $VTable.GetTelemetryId + $instance.Telemetry = $VTable.Telemetry + + + # Tweaks the pipeline per call + $instance.OnNewRequest = $VTable.OnNewRequest + + # Gets shared parameter values + $instance.GetParameterValue = $VTable.GetParameterValue + + # Allows shared module to listen to events from this module + $instance.EventListener = $VTable.EventListener + + # Gets shared argument completers + $instance.ArgumentCompleter = $VTable.ArgumentCompleter + + # The name of the currently selected Azure profile + $instance.ProfileName = $VTable.ProfileName + + + # Load the custom module + $customModulePath = Join-Path $PSScriptRoot './custom/Az.SiteRecovery.custom.psm1' + if(Test-Path $customModulePath) { + $null = Import-Module -Name $customModulePath + } + + # Export nothing to clear implicit exports + Export-ModuleMember + + # Export proxy cmdlet scripts + $exportsPath = Join-Path $PSScriptRoot './exports' + $directories = Get-ChildItem -Directory -Path $exportsPath + $profileDirectory = $null + if($instance.ProfileName) { + if(($directories | ForEach-Object { $_.Name }) -contains $instance.ProfileName) { + $profileDirectory = $directories | Where-Object { $_.Name -eq $instance.ProfileName } + } else { + # Don't export anything if the profile doesn't exist for the module + $exportsPath = $null + Write-Warning "Selected Azure profile '$($instance.ProfileName)' does not exist for module '$($instance.Name)'. No cmdlets were loaded." + } + } elseif(($directories | Measure-Object).Count -gt 0) { + # Load the last folder if no profile is selected + $profileDirectory = $directories | Select-Object -Last 1 + } + + if($profileDirectory) { + Write-Information "Loaded Azure profile '$($profileDirectory.Name)' for module '$($instance.Name)'" + $exportsPath = $profileDirectory.FullName + } + + if($exportsPath) { + Get-ChildItem -Path $exportsPath -Recurse -Include '*.ps1' -File | ForEach-Object { . $_.FullName } + $cmdletNames = Get-ScriptCmdlet -ScriptFolder $exportsPath + Export-ModuleMember -Function $cmdletNames -Alias (Get-ScriptCmdlet -ScriptFolder $exportsPath -AsAlias) + } + + # Finalize initialization of this module + $instance.Init(); + Write-Information "Loaded Module '$($instance.Name)'" +# endregion diff --git a/swaggerci/recoveryservicessiterecovery/MSSharedLibKey.snk b/swaggerci/recoveryservicessiterecovery/MSSharedLibKey.snk new file mode 100644 index 000000000000..695f1b38774e Binary files /dev/null and b/swaggerci/recoveryservicessiterecovery/MSSharedLibKey.snk differ diff --git a/swaggerci/recoveryservicessiterecovery/README.md b/swaggerci/recoveryservicessiterecovery/README.md new file mode 100644 index 000000000000..340afb2c2b8a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/README.md @@ -0,0 +1,27 @@ + +# Az.SiteRecovery +This directory contains the PowerShell module for the SiteRecovery service. + +--- +## Status +[![Az.SiteRecovery](https://img.shields.io/powershellgallery/v/Az.SiteRecovery.svg?style=flat-square&label=Az.SiteRecovery "Az.SiteRecovery")](https://www.powershellgallery.com/packages/Az.SiteRecovery/) + +## Info +- Modifiable: yes +- Generated: all +- Committed: yes +- Packaged: yes + +--- +## Detail +This module was primarily generated via [AutoRest](https://github.com/Azure/autorest) using the [PowerShell](https://github.com/Azure/autorest.powershell) extension. + +## Module Requirements +- [Az.Accounts module](https://www.powershellgallery.com/packages/Az.Accounts/), version 2.7.5 or greater + +## Authentication +AutoRest does not generate authentication code for the module. Authentication is handled via Az.Accounts by altering the HTTP payload before it is sent. + +## Development +For information on how to develop for `Az.SiteRecovery`, see [how-to.md](how-to.md). + diff --git a/swaggerci/recoveryservicessiterecovery/build-module.ps1 b/swaggerci/recoveryservicessiterecovery/build-module.ps1 new file mode 100644 index 000000000000..3ff22dd9c145 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/build-module.ps1 @@ -0,0 +1,153 @@ +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- +param([switch]$Isolated, [switch]$Run, [switch]$Test, [switch]$Docs, [switch]$Pack, [switch]$Code, [switch]$Release, [switch]$Debugger, [switch]$NoDocs) +$ErrorActionPreference = 'Stop' + +if($PSEdition -ne 'Core') { + Write-Error 'This script requires PowerShell Core to execute. [Note] Generated cmdlets will work in both PowerShell Core or Windows PowerShell.' +} + +if(-not $Isolated -and -not $Debugger) { + Write-Host -ForegroundColor Green 'Creating isolated process...' + $pwsh = [System.Diagnostics.Process]::GetCurrentProcess().Path + & "$pwsh" -NonInteractive -NoLogo -NoProfile -File $MyInvocation.MyCommand.Path @PSBoundParameters -Isolated + + if($LastExitCode -ne 0) { + # Build failed. Don't attempt to run the module. + return + } + + if($Test) { + . (Join-Path $PSScriptRoot 'test-module.ps1') + if($LastExitCode -ne 0) { + # Tests failed. Don't attempt to run the module. + return + } + } + + if($Docs) { + . (Join-Path $PSScriptRoot 'generate-help.ps1') + if($LastExitCode -ne 0) { + # Docs generation failed. Don't attempt to run the module. + return + } + } + + if($Pack) { + . (Join-Path $PSScriptRoot 'pack-module.ps1') + if($LastExitCode -ne 0) { + # Packing failed. Don't attempt to run the module. + return + } + } + + $runModulePath = Join-Path $PSScriptRoot 'run-module.ps1' + if($Code) { + . $runModulePath -Code + } elseif($Run) { + . $runModulePath + } else { + Write-Host -ForegroundColor Cyan "To run this module in an isolated PowerShell session, run the 'run-module.ps1' script or provide the '-Run' parameter to this script." + } + return +} + +$binFolder = Join-Path $PSScriptRoot 'bin' +$objFolder = Join-Path $PSScriptRoot 'obj' + +if(-not $Debugger) { + Write-Host -ForegroundColor Green 'Cleaning build folders...' + $null = Remove-Item -Recurse -ErrorAction SilentlyContinue -Path $binFolder, $objFolder + + if((Test-Path $binFolder) -or (Test-Path $objFolder)) { + Write-Host -ForegroundColor Cyan 'Did you forget to exit your isolated module session before rebuilding?' + Write-Error 'Unable to clean ''bin'' or ''obj'' folder. A process may have an open handle.' + } + + Write-Host -ForegroundColor Green 'Compiling module...' + $buildConfig = 'Debug' + if($Release) { + $buildConfig = 'Release' + } + dotnet publish $PSScriptRoot --verbosity quiet --configuration $buildConfig /nologo + if($LastExitCode -ne 0) { + Write-Error 'Compilation failed.' + } + + $null = Remove-Item -Recurse -ErrorAction SilentlyContinue -Path (Join-Path $binFolder 'Debug'), (Join-Path $binFolder 'Release') +} + +$dll = Join-Path $PSScriptRoot 'bin/Az.SiteRecovery.private.dll' +if(-not (Test-Path $dll)) { + Write-Error "Unable to find output assembly in '$binFolder'." +} + +# Load DLL to use build-time cmdlets +$null = Import-Module -Name $dll + +$modulePaths = $dll +$customPsm1 = Join-Path $PSScriptRoot 'custom/Az.SiteRecovery.custom.psm1' +if(Test-Path $customPsm1) { + $modulePaths = @($dll, $customPsm1) +} + +$exportsFolder = Join-Path $PSScriptRoot 'exports' +if(Test-Path $exportsFolder) { + $null = Get-ChildItem -Path $exportsFolder -Recurse -Exclude 'README.md' | Remove-Item -Recurse -ErrorAction SilentlyContinue +} +$null = New-Item -ItemType Directory -Force -Path $exportsFolder + +$internalFolder = Join-Path $PSScriptRoot 'internal' +if(Test-Path $internalFolder) { + $null = Get-ChildItem -Path $internalFolder -Recurse -Exclude '*.psm1', 'README.md' | Remove-Item -Recurse -ErrorAction SilentlyContinue +} +$null = New-Item -ItemType Directory -Force -Path $internalFolder + +$psd1 = Join-Path $PSScriptRoot './Az.SiteRecovery.psd1' +$guid = Get-ModuleGuid -Psd1Path $psd1 +$moduleName = 'Az.SiteRecovery' +$examplesFolder = Join-Path $PSScriptRoot 'examples' +$null = New-Item -ItemType Directory -Force -Path $examplesFolder + +Write-Host -ForegroundColor Green 'Creating cmdlets for specified models...' +$modelCmdlets = @() +if ($modelCmdlets.Count -gt 0) { + . (Join-Path $PSScriptRoot 'create-model-cmdlets.ps1') + CreateModelCmdlet($modelCmdlets) +} + +if($NoDocs) { + Write-Host -ForegroundColor Green 'Creating exports...' + Export-ProxyCmdlet -ModuleName $moduleName -ModulePath $modulePaths -ExportsFolder $exportsFolder -InternalFolder $internalFolder -ExcludeDocs -ExamplesFolder $examplesFolder +} else { + Write-Host -ForegroundColor Green 'Creating exports and docs...' + $moduleDescription = 'Microsoft Azure PowerShell: SiteRecovery cmdlets' + $docsFolder = Join-Path $PSScriptRoot 'docs' + if(Test-Path $docsFolder) { + $null = Get-ChildItem -Path $docsFolder -Recurse -Exclude 'README.md' | Remove-Item -Recurse -ErrorAction SilentlyContinue + } + $null = New-Item -ItemType Directory -Force -Path $docsFolder + Export-ProxyCmdlet -ModuleName $moduleName -ModulePath $modulePaths -ExportsFolder $exportsFolder -InternalFolder $internalFolder -ModuleDescription $moduleDescription -DocsFolder $docsFolder -ExamplesFolder $examplesFolder -ModuleGuid $guid +} + +Write-Host -ForegroundColor Green 'Creating format.ps1xml...' +$formatPs1xml = Join-Path $PSScriptRoot './Az.SiteRecovery.format.ps1xml' +Export-FormatPs1xml -FilePath $formatPs1xml + +Write-Host -ForegroundColor Green 'Creating psd1...' +$customFolder = Join-Path $PSScriptRoot 'custom' +Export-Psd1 -ExportsFolder $exportsFolder -CustomFolder $customFolder -Psd1Path $psd1 -ModuleGuid $guid + +Write-Host -ForegroundColor Green 'Creating test stubs...' +$testFolder = Join-Path $PSScriptRoot 'test' +$null = New-Item -ItemType Directory -Force -Path $testFolder +Export-TestStub -ModuleName $moduleName -ExportsFolder $exportsFolder -OutputFolder $testFolder + +Write-Host -ForegroundColor Green 'Creating example stubs...' +Export-ExampleStub -ExportsFolder $exportsFolder -OutputFolder $examplesFolder + +Write-Host -ForegroundColor Green '-------------Done-------------' diff --git a/swaggerci/recoveryservicessiterecovery/check-dependencies.ps1 b/swaggerci/recoveryservicessiterecovery/check-dependencies.ps1 new file mode 100644 index 000000000000..ec3055201a71 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/check-dependencies.ps1 @@ -0,0 +1,57 @@ +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- +param([switch]$Isolated, [switch]$Accounts, [switch]$Pester, [switch]$Resources) +$ErrorActionPreference = 'Stop' + +if(-not $Isolated) { + Write-Host -ForegroundColor Green 'Creating isolated process...' + $pwsh = [System.Diagnostics.Process]::GetCurrentProcess().Path + & "$pwsh" -NoExit -NoLogo -NoProfile -File $MyInvocation.MyCommand.Path @PSBoundParameters -Isolated + return +} + +function DownloadModule ([bool]$predicate, [string]$path, [string]$moduleName, [string]$versionMinimum, [string]$requiredVersion) { + if($predicate) { + $module = Get-Module -ListAvailable -Name $moduleName + if((-not $module) -or ($versionMinimum -and ($module | ForEach-Object { $_.Version } | Where-Object { $_ -ge [System.Version]$versionMinimum } | Measure-Object).Count -eq 0) -or ($requiredVersion -and ($module | ForEach-Object { $_.Version } | Where-Object { $_ -eq [System.Version]$requiredVersion } | Measure-Object).Count -eq 0)) { + $null = New-Item -ItemType Directory -Force -Path $path + Write-Host -ForegroundColor Green "Installing local $moduleName module into '$path'..." + if ($requiredVersion) { + Find-Module -Name $moduleName -RequiredVersion $requiredVersion -Repository PSGallery | Save-Module -Path $path + }elseif($versionMinimum) { + Find-Module -Name $moduleName -MinimumVersion $versionMinimum -Repository PSGallery | Save-Module -Path $path + } else { + Find-Module -Name $moduleName -Repository PSGallery | Save-Module -Path $path + } + } + } +} + +$ProgressPreference = 'SilentlyContinue' +$all = (@($Accounts.IsPresent, $Pester.IsPresent) | Select-Object -Unique | Measure-Object).Count -eq 1 + +$localModulesPath = Join-Path $PSScriptRoot 'generated/modules' +if(Test-Path -Path $localModulesPath) { + $env:PSModulePath = "$localModulesPath$([IO.Path]::PathSeparator)$env:PSModulePath" +} + +DownloadModule -predicate ($all -or $Accounts) -path $localModulesPath -moduleName 'Az.Accounts' -versionMinimum '2.7.5' +DownloadModule -predicate ($all -or $Pester) -path $localModulesPath -moduleName 'Pester' -requiredVersion '4.10.1' + +$tools = Join-Path $PSScriptRoot 'tools' +$resourceDir = Join-Path $tools 'Resources' +$resourceModule = Join-Path $HOME '.PSSharedModules\Resources\Az.Resources.TestSupport.psm1' + +if ($Resources.IsPresent -and ((-not (Test-Path -Path $resourceModule)) -or $RegenerateSupportModule.IsPresent)) { + Write-Host -ForegroundColor Green "Building local Resource module used for test..." + Set-Location $resourceDir + $null = autorest .\README.md --use:@autorest/powershell@3.0.414 --output-folder=$HOME/.PSSharedModules/Resources + $null = Copy-Item custom/* $HOME/.PSSharedModules/Resources/custom/ + Set-Location $HOME/.PSSharedModules/Resources + $null = .\build-module.ps1 + Set-Location $PSScriptRoot +} diff --git a/swaggerci/recoveryservicessiterecovery/create-model-cmdlets.ps1 b/swaggerci/recoveryservicessiterecovery/create-model-cmdlets.ps1 new file mode 100644 index 000000000000..46f3e8a3c356 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/create-model-cmdlets.ps1 @@ -0,0 +1,163 @@ +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +function CreateModelCmdlet { + + param([string[]]$Models) + + if ($Models.Count -eq 0) + { + return + } + + $ModelCsPath = Join-Path (Join-Path $PSScriptRoot 'generated/api') 'Models' + $ModuleName = 'SiteRecovery' + $OutputDir = Join-Path $PSScriptRoot 'custom/autogen-model-cmdlets' + $null = New-Item -ItemType Directory -Force -Path $OutputDir + + $CsFiles = Get-ChildItem -Path $ModelCsPath -Recurse -Filter *.cs + $Content = '' + $null = $CsFiles | ForEach-Object -Process { if ($_.Name.Split('.').count -eq 2 ) + { $Content += get-content $_.fullname -raw + } } + + $Tree = [Microsoft.CodeAnalysis.CSharp.SyntaxFactory]::ParseCompilationUnit($Content) + $Nodes = $Tree.ChildNodes().ChildNodes() + foreach ($Model in $Models) + { + $InterfaceNode = $Nodes | Where-Object { ($_.Keyword.value -eq 'interface') -and ($_.Identifier.value -eq "I$Model") } + if ($InterfaceNode.count -eq 0) { + continue + } + # through a queue, we iterate all the parent models. + $Queue = @($InterfaceNode) + $visited = @("I$Model") + $AllInterfaceNodes = @() + while ($Queue.count -ne 0) + { + $AllInterfaceNodes += $Queue[0] + # Baselist contains the direct parent models. + foreach ($parent in $Queue[0].BaseList.Types) + { + if (($parent.Type.Right.Identifier.Value -ne 'IJsonSerializable') -and (-not $visited.Contains($parent.Type.Right.Identifier.Value))) + { + $Queue = [Array]$Queue + ($Nodes | Where-Object { ($_.Keyword.value -eq 'interface') -and ($_.Identifier.value -eq $parent.Type.Right.Identifier.Value) }) + $visited = [Array]$visited + $parent.Type.Right.Identifier.Value + } + } + $first, $Queue = $Queue + } + + $Namespace = $InterfaceNode.Parent.Name + $ObjectType = $Model + $ObjectTypeWithNamespace = "${Namespace}.${ObjectType}" + # remove duplicated module name + if ($ObjectType.StartsWith($ModuleName)) { + $ModulePrefix = '' + } else { + $ModulePrefix = $ModuleName + } + $OutputPath = Join-Path -ChildPath "New-Az${ModulePrefix}${ObjectType}Object.ps1" -Path $OutputDir + + $ParameterDefineScriptList = New-Object System.Collections.Generic.List[string] + $ParameterAssignScriptList = New-Object System.Collections.Generic.List[string] + foreach ($Node in $AllInterfaceNodes) + { + foreach ($Member in $Node.Members) + { + $Arguments = $Member.AttributeLists.Attributes.ArgumentList.Arguments + $Required = $false + $Description = "" + $Readonly = $False + foreach ($Argument in $Arguments) + { + if ($Argument.NameEquals.Name.Identifier.Value -eq "Required") + { + $Required = $Argument.Expression.Token.Value + } + if ($Argument.NameEquals.Name.Identifier.Value -eq "Description") + { + $Description = $Argument.Expression.Token.Value.Trim('.').replace('"', '`"') + } + if ($Argument.NameEquals.Name.Identifier.Value -eq "Readonly") + { + $Readonly = $Argument.Expression.Token.Value + } + } + if ($Readonly) + { + continue + } + $Identifier = $Member.Identifier.Value + $Type = $Member.Type.ToString().replace('?', '').Split("::")[-1] + $ParameterDefinePropertyList = New-Object System.Collections.Generic.List[string] + if ($Required) + { + $ParameterDefinePropertyList.Add("Mandatory") + } + if ($Description -ne "") + { + $ParameterDefinePropertyList.Add("HelpMessage=`"${Description}.`"") + } + $ParameterDefineProperty = [System.String]::Join(", ", $ParameterDefinePropertyList) + # check whether completer is needed + $completer = ''; + if($Type.Split('.').Split('.')[-2] -eq 'Support') { + # If Type is an array, need to strip [] + $strippedType = $Type.Replace('[]', '') + $completer += "`n [ArgumentCompleter([${strippedType}])]" + } + $ParameterDefineScript = " + [Parameter($ParameterDefineProperty)]${completer} + [${Type}] + `$${Identifier}" + $ParameterDefineScriptList.Add($ParameterDefineScript) + $ParameterAssignScriptList.Add(" + if (`$PSBoundParameters.ContainsKey('${Identifier}')) { + `$Object.${Identifier} = `$${Identifier} + }") + } + } + $ParameterDefineScript = $ParameterDefineScriptList | Join-String -Separator "," + $ParameterAssignScript = $ParameterAssignScriptList | Join-String -Separator "" + + $Script = " +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Create an in-memory object for ${ObjectType}. +.Description +Create an in-memory object for ${ObjectType}. + +.Outputs +${ObjectTypeWithNamespace} +.Link +https://learn.microsoft.com/powershell/module/az.${ModuleName}/new-Az${ModulePrefix}${ObjectType}Object +#> +function New-Az${ModulePrefix}${ObjectType}Object { + [OutputType('${ObjectTypeWithNamespace}')] + [CmdletBinding(PositionalBinding=`$false)] + Param( +${ParameterDefineScript} + ) + + process { + `$Object = [${ObjectTypeWithNamespace}]::New() +${ParameterAssignScript} + return `$Object + } +} +" + Set-Content -Path $OutputPath -Value $Script + } +} diff --git a/swaggerci/recoveryservicessiterecovery/custom/Az.SiteRecovery.custom.psm1 b/swaggerci/recoveryservicessiterecovery/custom/Az.SiteRecovery.custom.psm1 new file mode 100644 index 000000000000..7d1e7a94ab9c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/custom/Az.SiteRecovery.custom.psm1 @@ -0,0 +1,17 @@ +# region Generated + # Load the private module dll + $null = Import-Module -PassThru -Name (Join-Path $PSScriptRoot '../bin/Az.SiteRecovery.private.dll') + + # Load the internal module + $internalModulePath = Join-Path $PSScriptRoot '../internal/Az.SiteRecovery.internal.psm1' + if(Test-Path $internalModulePath) { + $null = Import-Module -Name $internalModulePath + } + + # Export nothing to clear implicit exports + Export-ModuleMember + + # Export script cmdlets + Get-ChildItem -Path $PSScriptRoot -Recurse -Include '*.ps1' -File | ForEach-Object { . $_.FullName } + Export-ModuleMember -Function (Get-ScriptCmdlet -ScriptFolder $PSScriptRoot) -Alias (Get-ScriptCmdlet -ScriptFolder $PSScriptRoot -AsAlias) +# endregion diff --git a/swaggerci/recoveryservicessiterecovery/custom/README.md b/swaggerci/recoveryservicessiterecovery/custom/README.md new file mode 100644 index 000000000000..e0974fb6ecdf --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/custom/README.md @@ -0,0 +1,41 @@ +# Custom +This directory contains custom implementation for non-generated cmdlets for the `Az.SiteRecovery` module. Both scripts (`.ps1`) and C# files (`.cs`) can be implemented here. They will be used during the build process in `build-module.ps1`, and create cmdlets into the `../exports` folder. The only generated file into this folder is the `Az.SiteRecovery.custom.psm1`. This file should not be modified. + +## Info +- Modifiable: yes +- Generated: partial +- Committed: yes +- Packaged: yes + +## Details +For `Az.SiteRecovery` to use custom cmdlets, it does this two different ways. We **highly recommend** creating script cmdlets, as they are easier to write and allow access to the other exported cmdlets. C# cmdlets *cannot access exported cmdlets*. + +For C# cmdlets, they are compiled with the rest of the generated low-level cmdlets into the `./bin/Az.SiteRecovery.private.dll`. The names of the cmdlets (methods) and files must follow the `[cmdletName]_[variantName]` syntax used for generated cmdlets. The `variantName` is used as the `ParameterSetName`, so use something appropriate that doesn't clash with already created variant or parameter set names. You cannot use the `ParameterSetName` property in the `Parameter` attribute on C# cmdlets. Each cmdlet must be separated into variants using the same pattern as seen in the `generated/cmdlets` folder. + +For script cmdlets, these are loaded via the `Az.SiteRecovery.custom.psm1`. Then, during the build process, this module is loaded and processed in the same manner as the C# cmdlets. The fundamental difference is the script cmdlets use the `ParameterSetName` attribute and C# cmdlets do not. To create a script cmdlet variant of a generated cmdlet, simply decorate all parameters in the script with the new `ParameterSetName` in the `Parameter` attribute. This will appropriately treat each parameter set as a separate variant when processed to be exported during the build. + +## Purpose +This allows the modules to have cmdlets that were not defined in the REST specification. It also allows combining logic using generated cmdlets. This is a level of customization beyond what can be done using the [readme configuration options](https://github.com/Azure/autorest/blob/master/docs/powershell/options.md) that are currently available. These custom cmdlets are then referenced by the cmdlets created at build-time in the `../exports` folder. + +## Usage +The easiest way currently to start developing custom cmdlets is to copy an existing cmdlet. For C# cmdlets, copy one from the `generated/cmdlets` folder. For script cmdlets, build the project using `build-module.ps1` and copy one of the scripts from the `../exports` folder. After that, if you want to add new parameter sets, follow the guidelines in the `Details` section above. For implementing a new cmdlets, at minimum, please keep these parameters: +- Break +- DefaultProfile +- HttpPipelineAppend +- HttpPipelinePrepend +- Proxy +- ProxyCredential +- ProxyUseDefaultCredentials + +These provide functionality to our HTTP pipeline and other useful features. In script, you can forward these parameters using `$PSBoundParameters` to the other cmdlets you're calling within `Az.SiteRecovery`. For C#, follow the usage seen in the `ProcessRecordAsync` method. + +### Attributes +For processing the cmdlets, we've created some additional attributes: +- `Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.DescriptionAttribute` + - Used in C# cmdlets to provide a high-level description of the cmdlet. This is propagated to reference documentation via [help comments](https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_comment_based_help) in the exported scripts. +- `Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.DoNotExportAttribute` + - Used in C# and script cmdlets to suppress creating an exported cmdlet at build-time. These cmdlets will *not be exposed* by `Az.SiteRecovery`. +- `Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.InternalExportAttribute` + - Used in C# cmdlets to route exported cmdlets to the `../internal`, which are *not exposed* by `Az.SiteRecovery`. For more information, see [README.md](../internal/README.md) in the `../internal` folder. +- `Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ProfileAttribute` + - Used in C# and script cmdlets to define which Azure profiles the cmdlet supports. This is only supported for Azure (`--azure`) modules. \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/docs/Add-AzSiteRecoveryReplicationProtectedItemDisk.md b/swaggerci/recoveryservicessiterecovery/docs/Add-AzSiteRecoveryReplicationProtectedItemDisk.md new file mode 100644 index 000000000000..32399b5eb83e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/Add-AzSiteRecoveryReplicationProtectedItemDisk.md @@ -0,0 +1,342 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/add-azsiterecoveryreplicationprotecteditemdisk +schema: 2.0.0 +--- + +# Add-AzSiteRecoveryReplicationProtectedItemDisk + +## SYNOPSIS +Operation to add disks(s) to the replication protected item. + +## SYNTAX + +### AddExpanded (Default) +``` +Add-AzSiteRecoveryReplicationProtectedItemDisk -FabricName -ProtectionContainerName + -ReplicatedProtectedItemName -ResourceGroupName -ResourceName + [-SubscriptionId ] [-ProviderSpecificDetailInstanceType ] [-DefaultProfile ] + [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +### Add +``` +Add-AzSiteRecoveryReplicationProtectedItemDisk -FabricName -ProtectionContainerName + -ReplicatedProtectedItemName -ResourceGroupName -ResourceName + -AddDisksInput [-SubscriptionId ] [-DefaultProfile ] [-AsJob] [-NoWait] + [-Confirm] [-WhatIf] [] +``` + +### AddViaIdentity +``` +Add-AzSiteRecoveryReplicationProtectedItemDisk -InputObject + -AddDisksInput [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] + [] +``` + +### AddViaIdentityExpanded +``` +Add-AzSiteRecoveryReplicationProtectedItemDisk -InputObject + [-ProviderSpecificDetailInstanceType ] [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] + [-WhatIf] [] +``` + +## DESCRIPTION +Operation to add disks(s) to the replication protected item. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -AddDisksInput +Input for add disk(s) operation. +To construct, see NOTES section for ADDDISKSINPUT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksInput +Parameter Sets: Add, AddViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FabricName +Unique fabric name. + +```yaml +Type: System.String +Parameter Sets: Add, AddExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +Parameter Sets: AddViaIdentity, AddViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProtectionContainerName +Protection container name. + +```yaml +Type: System.String +Parameter Sets: Add, AddExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProviderSpecificDetailInstanceType +The class type. + +```yaml +Type: System.String +Parameter Sets: AddExpanded, AddViaIdentityExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ReplicatedProtectedItemName +Replication protected item name. + +```yaml +Type: System.String +Parameter Sets: Add, AddExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: Add, AddExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: Add, AddExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String +Parameter Sets: Add, AddExpanded +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksInput + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`ADDDISKSINPUT `: Input for add disk(s) operation. + - `[ProviderSpecificDetailInstanceType ]`: The class type. + +`INPUTOBJECT `: Identity Parameter + - `[AlertSettingName ]`: The name of the email notification configuration. + - `[EventName ]`: The name of the Azure Site Recovery event. + - `[FabricName ]`: Fabric name. + - `[Id ]`: Resource identity path + - `[IntentObjectName ]`: Replication protection intent name. + - `[JobName ]`: Job identifier. + - `[LogicalNetworkName ]`: Logical network name. + - `[MappingName ]`: Protection Container mapping name. + - `[MigrationItemName ]`: Migration item name. + - `[MigrationRecoveryPointName ]`: The migration recovery point name. + - `[NetworkMappingName ]`: Network mapping name. + - `[NetworkName ]`: Primary network name. + - `[PolicyName ]`: Replication policy name. + - `[ProtectableItemName ]`: Protectable item name. + - `[ProtectionContainerName ]`: Protection container name. + - `[ProviderName ]`: Recovery services provider name. + - `[RecoveryPlanName ]`: Name of the recovery plan. + - `[RecoveryPointName ]`: The recovery point name. + - `[ReplicatedProtectedItemName ]`: Replication protected item name. + - `[ResourceGroupName ]`: The name of the resource group where the recovery services vault is present. + - `[ResourceName ]`: The name of the recovery services vault. + - `[StorageClassificationMappingName ]`: Storage classification mapping name. + - `[StorageClassificationName ]`: Storage classification name. + - `[SubscriptionId ]`: The subscription Id. + - `[VaultSettingName ]`: Vault setting name. + - `[VcenterName ]`: vcenter name. + - `[VirtualMachineName ]`: Virtual Machine name. + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/Add-AzSiteRecoveryReplicationProtectedItemRecoveryPoint.md b/swaggerci/recoveryservicessiterecovery/docs/Add-AzSiteRecoveryReplicationProtectedItemRecoveryPoint.md new file mode 100644 index 000000000000..a194e24390ba --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/Add-AzSiteRecoveryReplicationProtectedItemRecoveryPoint.md @@ -0,0 +1,358 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/add-azsiterecoveryreplicationprotecteditemrecoverypoint +schema: 2.0.0 +--- + +# Add-AzSiteRecoveryReplicationProtectedItemRecoveryPoint + +## SYNOPSIS +The operation to change the recovery point of a failed over replication protected item. + +## SYNTAX + +### ApplyExpanded (Default) +``` +Add-AzSiteRecoveryReplicationProtectedItemRecoveryPoint -FabricName -ProtectionContainerName + -ReplicatedProtectedItemName -ResourceGroupName -ResourceName + -ProviderSpecificDetailInstanceType [-SubscriptionId ] [-RecoveryPointId ] + [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +### Apply +``` +Add-AzSiteRecoveryReplicationProtectedItemRecoveryPoint -FabricName -ProtectionContainerName + -ReplicatedProtectedItemName -ResourceGroupName -ResourceName + -ApplyRecoveryPointInput [-SubscriptionId ] [-DefaultProfile ] + [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +### ApplyViaIdentity +``` +Add-AzSiteRecoveryReplicationProtectedItemRecoveryPoint -InputObject + -ApplyRecoveryPointInput [-DefaultProfile ] [-AsJob] [-NoWait] + [-Confirm] [-WhatIf] [] +``` + +### ApplyViaIdentityExpanded +``` +Add-AzSiteRecoveryReplicationProtectedItemRecoveryPoint -InputObject + -ProviderSpecificDetailInstanceType [-RecoveryPointId ] [-DefaultProfile ] + [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +The operation to change the recovery point of a failed over replication protected item. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -ApplyRecoveryPointInput +Input to apply recovery point. +To construct, see NOTES section for APPLYRECOVERYPOINTINPUT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointInput +Parameter Sets: Apply, ApplyViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FabricName +The ARM fabric name. + +```yaml +Type: System.String +Parameter Sets: Apply, ApplyExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +Parameter Sets: ApplyViaIdentity, ApplyViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProtectionContainerName +The protection container name. + +```yaml +Type: System.String +Parameter Sets: Apply, ApplyExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProviderSpecificDetailInstanceType +The class type. + +```yaml +Type: System.String +Parameter Sets: ApplyExpanded, ApplyViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -RecoveryPointId +The recovery point Id. + +```yaml +Type: System.String +Parameter Sets: ApplyExpanded, ApplyViaIdentityExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ReplicatedProtectedItemName +The replicated protected item name. + +```yaml +Type: System.String +Parameter Sets: Apply, ApplyExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: Apply, ApplyExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: Apply, ApplyExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String +Parameter Sets: Apply, ApplyExpanded +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointInput + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`APPLYRECOVERYPOINTINPUT `: Input to apply recovery point. + - `ProviderSpecificDetailInstanceType `: The class type. + - `[RecoveryPointId ]`: The recovery point Id. + +`INPUTOBJECT `: Identity Parameter + - `[AlertSettingName ]`: The name of the email notification configuration. + - `[EventName ]`: The name of the Azure Site Recovery event. + - `[FabricName ]`: Fabric name. + - `[Id ]`: Resource identity path + - `[IntentObjectName ]`: Replication protection intent name. + - `[JobName ]`: Job identifier. + - `[LogicalNetworkName ]`: Logical network name. + - `[MappingName ]`: Protection Container mapping name. + - `[MigrationItemName ]`: Migration item name. + - `[MigrationRecoveryPointName ]`: The migration recovery point name. + - `[NetworkMappingName ]`: Network mapping name. + - `[NetworkName ]`: Primary network name. + - `[PolicyName ]`: Replication policy name. + - `[ProtectableItemName ]`: Protectable item name. + - `[ProtectionContainerName ]`: Protection container name. + - `[ProviderName ]`: Recovery services provider name. + - `[RecoveryPlanName ]`: Name of the recovery plan. + - `[RecoveryPointName ]`: The recovery point name. + - `[ReplicatedProtectedItemName ]`: Replication protected item name. + - `[ResourceGroupName ]`: The name of the resource group where the recovery services vault is present. + - `[ResourceName ]`: The name of the recovery services vault. + - `[StorageClassificationMappingName ]`: Storage classification mapping name. + - `[StorageClassificationName ]`: Storage classification name. + - `[SubscriptionId ]`: The subscription Id. + - `[VaultSettingName ]`: Vault setting name. + - `[VcenterName ]`: vcenter name. + - `[VirtualMachineName ]`: Virtual Machine name. + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/Az.SiteRecovery.md b/swaggerci/recoveryservicessiterecovery/docs/Az.SiteRecovery.md new file mode 100644 index 000000000000..ac3eac8267ce --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/Az.SiteRecovery.md @@ -0,0 +1,330 @@ +--- +Module Name: Az.SiteRecovery +Module Guid: c90fb24e-08e3-4a75-9dd2-4d4b9d35f458 +Download Help Link: https://learn.microsoft.com/powershell/module/az.siterecovery +Help Version: 1.0.0.0 +Locale: en-US +--- + +# Az.SiteRecovery Module +## Description +Microsoft Azure PowerShell: SiteRecovery cmdlets + +## Az.SiteRecovery Cmdlets +### [Add-AzSiteRecoveryReplicationProtectedItemDisk](Add-AzSiteRecoveryReplicationProtectedItemDisk.md) +Operation to add disks(s) to the replication protected item. + +### [Add-AzSiteRecoveryReplicationProtectedItemRecoveryPoint](Add-AzSiteRecoveryReplicationProtectedItemRecoveryPoint.md) +The operation to change the recovery point of a failed over replication protected item. + +### [Clear-AzSiteRecoveryReplicationFabric](Clear-AzSiteRecoveryReplicationFabric.md) +The operation to purge(force delete) an Azure Site Recovery fabric. + +### [Clear-AzSiteRecoveryReplicationProtectedItem](Clear-AzSiteRecoveryReplicationProtectedItem.md) +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. + +### [Clear-AzSiteRecoveryReplicationProtectionContainerMapping](Clear-AzSiteRecoveryReplicationProtectionContainerMapping.md) +The operation to purge(force delete) a protection container mapping. + +### [Clear-AzSiteRecoveryReplicationRecoveryServicesProvider](Clear-AzSiteRecoveryReplicationRecoveryServicesProvider.md) +The operation to purge(force delete) a recovery services provider from the vault. + +### [Export-AzSiteRecoveryReplicationJob](Export-AzSiteRecoveryReplicationJob.md) +The operation to export the details of the Azure Site Recovery jobs of the vault. + +### [Find-AzSiteRecoveryReplicationProtectionContainerProtectableItem](Find-AzSiteRecoveryReplicationProtectionContainerProtectableItem.md) +The operation to a add a protectable item to a protection container(Add physical server). + +### [Get-AzSiteRecoveryMigrationRecoveryPoint](Get-AzSiteRecoveryMigrationRecoveryPoint.md) +Gets a recovery point for a migration item. + +### [Get-AzSiteRecoveryPoint](Get-AzSiteRecoveryPoint.md) +Get the details of specified recovery point. + +### [Get-AzSiteRecoveryReplicationAlertSetting](Get-AzSiteRecoveryReplicationAlertSetting.md) +Gets the details of the specified email notification(alert) configuration. + +### [Get-AzSiteRecoveryReplicationAppliance](Get-AzSiteRecoveryReplicationAppliance.md) +Gets the list of Azure Site Recovery appliances for the vault. + +### [Get-AzSiteRecoveryReplicationEligibilityResult](Get-AzSiteRecoveryReplicationEligibilityResult.md) +Validates whether a given VM can be protected or not in which case returns list of errors. + +### [Get-AzSiteRecoveryReplicationEvent](Get-AzSiteRecoveryReplicationEvent.md) +The operation to get the details of an Azure Site recovery event. + +### [Get-AzSiteRecoveryReplicationFabric](Get-AzSiteRecoveryReplicationFabric.md) +Gets the details of an Azure Site Recovery fabric. + +### [Get-AzSiteRecoveryReplicationJob](Get-AzSiteRecoveryReplicationJob.md) +Get the details of an Azure Site Recovery job. + +### [Get-AzSiteRecoveryReplicationLogicalNetwork](Get-AzSiteRecoveryReplicationLogicalNetwork.md) +Gets the details of a logical network. + +### [Get-AzSiteRecoveryReplicationMigrationItem](Get-AzSiteRecoveryReplicationMigrationItem.md) +Gets the details of a migration item. + +### [Get-AzSiteRecoveryReplicationNetwork](Get-AzSiteRecoveryReplicationNetwork.md) +Gets the details of a network. + +### [Get-AzSiteRecoveryReplicationNetworkMapping](Get-AzSiteRecoveryReplicationNetworkMapping.md) +Gets the details of an ASR network mapping. + +### [Get-AzSiteRecoveryReplicationPolicy](Get-AzSiteRecoveryReplicationPolicy.md) +Gets the details of a replication policy. + +### [Get-AzSiteRecoveryReplicationProtectableItem](Get-AzSiteRecoveryReplicationProtectableItem.md) +The operation to get the details of a protectable item. + +### [Get-AzSiteRecoveryReplicationProtectedItem](Get-AzSiteRecoveryReplicationProtectedItem.md) +Gets the details of an ASR replication protected item. + +### [Get-AzSiteRecoveryReplicationProtectionContainer](Get-AzSiteRecoveryReplicationProtectionContainer.md) +Gets the details of a protection container. + +### [Get-AzSiteRecoveryReplicationProtectionContainerMapping](Get-AzSiteRecoveryReplicationProtectionContainerMapping.md) +Gets the details of a protection container mapping. + +### [Get-AzSiteRecoveryReplicationProtectionIntent](Get-AzSiteRecoveryReplicationProtectionIntent.md) +Gets the details of an ASR replication protection intent. + +### [Get-AzSiteRecoveryReplicationRecoveryPlan](Get-AzSiteRecoveryReplicationRecoveryPlan.md) +Gets the details of the recovery plan. + +### [Get-AzSiteRecoveryReplicationRecoveryServiceProvider](Get-AzSiteRecoveryReplicationRecoveryServiceProvider.md) +Lists the registered recovery services providers for the specified fabric. + +### [Get-AzSiteRecoveryReplicationRecoveryServicesProvider](Get-AzSiteRecoveryReplicationRecoveryServicesProvider.md) +Gets the details of registered recovery services provider. + +### [Get-AzSiteRecoveryReplicationStorageClassification](Get-AzSiteRecoveryReplicationStorageClassification.md) +Gets the details of the specified storage classification. + +### [Get-AzSiteRecoveryReplicationStorageClassificationMapping](Get-AzSiteRecoveryReplicationStorageClassificationMapping.md) +Gets the details of the specified storage classification mapping. + +### [Get-AzSiteRecoveryReplicationVaultHealth](Get-AzSiteRecoveryReplicationVaultHealth.md) +Gets the health details of the vault. + +### [Get-AzSiteRecoveryReplicationVaultSetting](Get-AzSiteRecoveryReplicationVaultSetting.md) +Gets the vault setting. +This includes the Migration Hub connection settings. + +### [Get-AzSiteRecoveryReplicationvCenter](Get-AzSiteRecoveryReplicationvCenter.md) +Gets the details of a registered vCenter server(Add vCenter server). + +### [Get-AzSiteRecoverySupportedOperatingSystem](Get-AzSiteRecoverySupportedOperatingSystem.md) +Gets the data of supported operating systems by SRS. + +### [Get-AzSiteRecoveryTargetComputeSize](Get-AzSiteRecoveryTargetComputeSize.md) +Lists the available target compute sizes for a replication protected item. + +### [Invoke-AzSiteRecoveryCommitReplicationProtectedItemFailover](Invoke-AzSiteRecoveryCommitReplicationProtectedItemFailover.md) +Operation to commit the failover of the replication protected item. + +### [Invoke-AzSiteRecoveryCommitReplicationRecoveryPlanFailover](Invoke-AzSiteRecoveryCommitReplicationRecoveryPlanFailover.md) +The operation to commit the failover of a recovery plan. + +### [Invoke-AzSiteRecoveryPlannedReplicationProtectedItemFailover](Invoke-AzSiteRecoveryPlannedReplicationProtectedItemFailover.md) +Operation to initiate a planned failover of the replication protected item. + +### [Invoke-AzSiteRecoveryPlannedReplicationRecoveryPlanFailover](Invoke-AzSiteRecoveryPlannedReplicationRecoveryPlanFailover.md) +The operation to start the planned failover of a recovery plan. + +### [Invoke-AzSiteRecoveryRenewReplicationFabricCertificate](Invoke-AzSiteRecoveryRenewReplicationFabricCertificate.md) +Renews the connection certificate for the ASR replication fabric. + +### [Invoke-AzSiteRecoveryReprotectReplicationProtectedItem](Invoke-AzSiteRecoveryReprotectReplicationProtectedItem.md) +Operation to reprotect or reverse replicate a failed over replication protected item. + +### [Invoke-AzSiteRecoveryReprotectReplicationRecoveryPlan](Invoke-AzSiteRecoveryReprotectReplicationRecoveryPlan.md) +The operation to reprotect(reverse replicate) a recovery plan. + +### [Invoke-AzSiteRecoveryResyncReplicationMigrationItem](Invoke-AzSiteRecoveryResyncReplicationMigrationItem.md) +The operation to resynchronize replication of an ASR migration item. + +### [Invoke-AzSiteRecoveryUnplannedReplicationProtectedItemFailover](Invoke-AzSiteRecoveryUnplannedReplicationProtectedItemFailover.md) +Operation to initiate a failover of the replication protected item. + +### [Invoke-AzSiteRecoveryUnplannedReplicationRecoveryPlanFailover](Invoke-AzSiteRecoveryUnplannedReplicationRecoveryPlanFailover.md) +The operation to start the unplanned failover of a recovery plan. + +### [Move-AzSiteRecoveryReplicationFabricGateway](Move-AzSiteRecoveryReplicationFabricGateway.md) +The operation to move replications from a process server to another process server. + +### [Move-AzSiteRecoveryReplicationFabricToAad](Move-AzSiteRecoveryReplicationFabricToAad.md) +The operation to migrate an Azure Site Recovery fabric to AAD. + +### [Move-AzSiteRecoveryReplicationMigrationItem](Move-AzSiteRecoveryReplicationMigrationItem.md) +The operation to initiate migration of the item. + +### [New-AzSiteRecoveryReplicationAlertSetting](New-AzSiteRecoveryReplicationAlertSetting.md) +Create or update an email notification(alert) configuration. + +### [New-AzSiteRecoveryReplicationFabric](New-AzSiteRecoveryReplicationFabric.md) +The operation to create an Azure Site Recovery fabric (for e.g. +Hyper-V site). + +### [New-AzSiteRecoveryReplicationMigrationItem](New-AzSiteRecoveryReplicationMigrationItem.md) +The operation to create an ASR migration item (enable migration). + +### [New-AzSiteRecoveryReplicationNetworkMapping](New-AzSiteRecoveryReplicationNetworkMapping.md) +The operation to create an ASR network mapping. + +### [New-AzSiteRecoveryReplicationPolicy](New-AzSiteRecoveryReplicationPolicy.md) +The operation to create a replication policy. + +### [New-AzSiteRecoveryReplicationProtectedItem](New-AzSiteRecoveryReplicationProtectedItem.md) +The operation to create an ASR replication protected item (Enable replication). + +### [New-AzSiteRecoveryReplicationProtectionContainer](New-AzSiteRecoveryReplicationProtectionContainer.md) +Operation to create a protection container. + +### [New-AzSiteRecoveryReplicationProtectionContainerMapping](New-AzSiteRecoveryReplicationProtectionContainerMapping.md) +The operation to create a protection container mapping. + +### [New-AzSiteRecoveryReplicationProtectionIntent](New-AzSiteRecoveryReplicationProtectionIntent.md) +The operation to create an ASR replication protection intent item. + +### [New-AzSiteRecoveryReplicationRecoveryPlan](New-AzSiteRecoveryReplicationRecoveryPlan.md) +The operation to create a recovery plan. + +### [New-AzSiteRecoveryReplicationRecoveryServicesProvider](New-AzSiteRecoveryReplicationRecoveryServicesProvider.md) +The operation to add a recovery services provider. + +### [New-AzSiteRecoveryReplicationStorageClassificationMapping](New-AzSiteRecoveryReplicationStorageClassificationMapping.md) +The operation to create a storage classification mapping. + +### [New-AzSiteRecoveryReplicationVaultSetting](New-AzSiteRecoveryReplicationVaultSetting.md) +The operation to configure vault setting. + +### [New-AzSiteRecoveryReplicationvCenter](New-AzSiteRecoveryReplicationvCenter.md) +The operation to create a vCenter object.. + +### [Remove-AzSiteRecoveryReplicationFabric](Remove-AzSiteRecoveryReplicationFabric.md) +The operation to delete or remove an Azure Site Recovery fabric. + +### [Remove-AzSiteRecoveryReplicationMigrationItem](Remove-AzSiteRecoveryReplicationMigrationItem.md) +The operation to delete an ASR migration item. + +### [Remove-AzSiteRecoveryReplicationNetworkMapping](Remove-AzSiteRecoveryReplicationNetworkMapping.md) +The operation to delete a network mapping. + +### [Remove-AzSiteRecoveryReplicationPolicy](Remove-AzSiteRecoveryReplicationPolicy.md) +The operation to delete a replication policy. + +### [Remove-AzSiteRecoveryReplicationProtectedItem](Remove-AzSiteRecoveryReplicationProtectedItem.md) +The operation to disable replication on a replication protected item. +This will also remove the item. + +### [Remove-AzSiteRecoveryReplicationProtectedItemDisk](Remove-AzSiteRecoveryReplicationProtectedItemDisk.md) +Operation to remove disk(s) from the replication protected item. + +### [Remove-AzSiteRecoveryReplicationProtectionContainer](Remove-AzSiteRecoveryReplicationProtectionContainer.md) +Operation to remove a protection container. + +### [Remove-AzSiteRecoveryReplicationProtectionContainerMapping](Remove-AzSiteRecoveryReplicationProtectionContainerMapping.md) +The operation to delete or remove a protection container mapping. + +### [Remove-AzSiteRecoveryReplicationRecoveryPlan](Remove-AzSiteRecoveryReplicationRecoveryPlan.md) +Delete a recovery plan. + +### [Remove-AzSiteRecoveryReplicationRecoveryServicesProvider](Remove-AzSiteRecoveryReplicationRecoveryServicesProvider.md) +The operation to removes/delete(unregister) a recovery services provider from the vault. + +### [Remove-AzSiteRecoveryReplicationStorageClassificationMapping](Remove-AzSiteRecoveryReplicationStorageClassificationMapping.md) +The operation to delete a storage classification mapping. + +### [Remove-AzSiteRecoveryReplicationvCenter](Remove-AzSiteRecoveryReplicationvCenter.md) +The operation to remove(unregister) a registered vCenter server from the vault. + +### [Repair-AzSiteRecoveryReplicationProtectedItemReplication](Repair-AzSiteRecoveryReplicationProtectedItemReplication.md) +The operation to start resynchronize/repair replication for a replication protected item requiring resynchronization. + +### [Resolve-AzSiteRecoveryReplicationProtectedItemHealthError](Resolve-AzSiteRecoveryReplicationProtectedItemHealthError.md) +Operation to resolve health issues of the replication protected item. + +### [Restart-AzSiteRecoveryReplicationJob](Restart-AzSiteRecoveryReplicationJob.md) +The operation to restart an Azure Site Recovery job. + +### [Resume-AzSiteRecoveryReplicationJob](Resume-AzSiteRecoveryReplicationJob.md) +The operation to resume an Azure Site Recovery job. + +### [Resume-AzSiteRecoveryReplicationMigrationItemReplication](Resume-AzSiteRecoveryReplicationMigrationItemReplication.md) +The operation to initiate resume replication of the item. + +### [Stop-AzSiteRecoveryReplicationJob](Stop-AzSiteRecoveryReplicationJob.md) +The operation to cancel an Azure Site Recovery job. + +### [Stop-AzSiteRecoveryReplicationProtectedItemFailover](Stop-AzSiteRecoveryReplicationProtectedItemFailover.md) +Operation to cancel the failover of the replication protected item. + +### [Stop-AzSiteRecoveryReplicationRecoveryPlanFailover](Stop-AzSiteRecoveryReplicationRecoveryPlanFailover.md) +The operation to cancel the failover of a recovery plan. + +### [Suspend-AzSiteRecoveryReplicationMigrationItemReplication](Suspend-AzSiteRecoveryReplicationMigrationItemReplication.md) +The operation to initiate pause replication of the item. + +### [Switch-AzSiteRecoveryReplicationProtectedItemProvider](Switch-AzSiteRecoveryReplicationProtectedItemProvider.md) +Operation to initiate a switch provider of the replication protected item. + +### [Switch-AzSiteRecoveryReplicationProtectionContainerProtection](Switch-AzSiteRecoveryReplicationProtectionContainerProtection.md) +Operation to switch protection from one container to another or one replication provider to another. + +### [Test-AzSiteRecoveryReplicationFabricConsistency](Test-AzSiteRecoveryReplicationFabricConsistency.md) +The operation to perform a consistency check on the fabric. + +### [Test-AzSiteRecoveryReplicationMigrationItemMigrate](Test-AzSiteRecoveryReplicationMigrationItemMigrate.md) +The operation to initiate test migration of the item. + +### [Test-AzSiteRecoveryReplicationMigrationItemMigrateCleanup](Test-AzSiteRecoveryReplicationMigrationItemMigrateCleanup.md) +The operation to initiate test migrate cleanup. + +### [Test-AzSiteRecoveryReplicationProtectedItemFailover](Test-AzSiteRecoveryReplicationProtectedItemFailover.md) +Operation to perform a test failover of the replication protected item. + +### [Test-AzSiteRecoveryReplicationProtectedItemFailoverCleanup](Test-AzSiteRecoveryReplicationProtectedItemFailoverCleanup.md) +Operation to clean up the test failover of a replication protected item. + +### [Test-AzSiteRecoveryReplicationRecoveryPlanFailover](Test-AzSiteRecoveryReplicationRecoveryPlanFailover.md) +The operation to start the test failover of a recovery plan. + +### [Test-AzSiteRecoveryReplicationRecoveryPlanFailoverCleanup](Test-AzSiteRecoveryReplicationRecoveryPlanFailoverCleanup.md) +The operation to cleanup test failover of a recovery plan. + +### [Update-AzSiteRecoveryReplicationMigrationItem](Update-AzSiteRecoveryReplicationMigrationItem.md) +The operation to update the recovery settings of an ASR migration item. + +### [Update-AzSiteRecoveryReplicationNetworkMapping](Update-AzSiteRecoveryReplicationNetworkMapping.md) +The operation to update an ASR network mapping. + +### [Update-AzSiteRecoveryReplicationPolicy](Update-AzSiteRecoveryReplicationPolicy.md) +The operation to update a replication policy. + +### [Update-AzSiteRecoveryReplicationProtectedItem](Update-AzSiteRecoveryReplicationProtectedItem.md) +The operation to update the recovery settings of an ASR replication protected item. + +### [Update-AzSiteRecoveryReplicationProtectedItemAppliance](Update-AzSiteRecoveryReplicationProtectedItemAppliance.md) +The operation to update appliance of an ASR replication protected item. + +### [Update-AzSiteRecoveryReplicationProtectedItemMobilityService](Update-AzSiteRecoveryReplicationProtectedItemMobilityService.md) +The operation to update(push update) the installed mobility service software on a replication protected item to the latest available version. + +### [Update-AzSiteRecoveryReplicationProtectionContainerMapping](Update-AzSiteRecoveryReplicationProtectionContainerMapping.md) +The operation to update protection container mapping. + +### [Update-AzSiteRecoveryReplicationRecoveryPlan](Update-AzSiteRecoveryReplicationRecoveryPlan.md) +The operation to update a recovery plan. + +### [Update-AzSiteRecoveryReplicationRecoveryServiceProvider](Update-AzSiteRecoveryReplicationRecoveryServiceProvider.md) +The operation to refresh the information from the recovery services provider. + +### [Update-AzSiteRecoveryReplicationVaultHealth](Update-AzSiteRecoveryReplicationVaultHealth.md) +Refreshes health summary of the vault. + +### [Update-AzSiteRecoveryReplicationvCenter](Update-AzSiteRecoveryReplicationvCenter.md) +The operation to update a registered vCenter. + diff --git a/swaggerci/recoveryservicessiterecovery/docs/Clear-AzSiteRecoveryReplicationFabric.md b/swaggerci/recoveryservicessiterecovery/docs/Clear-AzSiteRecoveryReplicationFabric.md new file mode 100644 index 000000000000..0662fa3444ea --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/Clear-AzSiteRecoveryReplicationFabric.md @@ -0,0 +1,274 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/clear-azsiterecoveryreplicationfabric +schema: 2.0.0 +--- + +# Clear-AzSiteRecoveryReplicationFabric + +## SYNOPSIS +The operation to purge(force delete) an Azure Site Recovery fabric. + +## SYNTAX + +### Purge (Default) +``` +Clear-AzSiteRecoveryReplicationFabric -FabricName -ResourceGroupName -ResourceName + [-SubscriptionId ] [-DefaultProfile ] [-AsJob] [-NoWait] [-PassThru] [-Confirm] [-WhatIf] + [] +``` + +### PurgeViaIdentity +``` +Clear-AzSiteRecoveryReplicationFabric -InputObject [-DefaultProfile ] + [-AsJob] [-NoWait] [-PassThru] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +The operation to purge(force delete) an Azure Site Recovery fabric. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FabricName +ASR fabric to purge. + +```yaml +Type: System.String +Parameter Sets: Purge +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +Parameter Sets: PurgeViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PassThru +Returns true when the command succeeds + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: Purge +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: Purge +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String +Parameter Sets: Purge +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity + +## OUTPUTS + +### System.Boolean + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`INPUTOBJECT `: Identity Parameter + - `[AlertSettingName ]`: The name of the email notification configuration. + - `[EventName ]`: The name of the Azure Site Recovery event. + - `[FabricName ]`: Fabric name. + - `[Id ]`: Resource identity path + - `[IntentObjectName ]`: Replication protection intent name. + - `[JobName ]`: Job identifier. + - `[LogicalNetworkName ]`: Logical network name. + - `[MappingName ]`: Protection Container mapping name. + - `[MigrationItemName ]`: Migration item name. + - `[MigrationRecoveryPointName ]`: The migration recovery point name. + - `[NetworkMappingName ]`: Network mapping name. + - `[NetworkName ]`: Primary network name. + - `[PolicyName ]`: Replication policy name. + - `[ProtectableItemName ]`: Protectable item name. + - `[ProtectionContainerName ]`: Protection container name. + - `[ProviderName ]`: Recovery services provider name. + - `[RecoveryPlanName ]`: Name of the recovery plan. + - `[RecoveryPointName ]`: The recovery point name. + - `[ReplicatedProtectedItemName ]`: Replication protected item name. + - `[ResourceGroupName ]`: The name of the resource group where the recovery services vault is present. + - `[ResourceName ]`: The name of the recovery services vault. + - `[StorageClassificationMappingName ]`: Storage classification mapping name. + - `[StorageClassificationName ]`: Storage classification name. + - `[SubscriptionId ]`: The subscription Id. + - `[VaultSettingName ]`: Vault setting name. + - `[VcenterName ]`: vcenter name. + - `[VirtualMachineName ]`: Virtual Machine name. + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/Clear-AzSiteRecoveryReplicationProtectedItem.md b/swaggerci/recoveryservicessiterecovery/docs/Clear-AzSiteRecoveryReplicationProtectedItem.md new file mode 100644 index 000000000000..136c686429eb --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/Clear-AzSiteRecoveryReplicationProtectedItem.md @@ -0,0 +1,309 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/clear-azsiterecoveryreplicationprotecteditem +schema: 2.0.0 +--- + +# Clear-AzSiteRecoveryReplicationProtectedItem + +## SYNOPSIS +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. + +## SYNTAX + +### Purge (Default) +``` +Clear-AzSiteRecoveryReplicationProtectedItem -FabricName -ProtectionContainerName + -ReplicatedProtectedItemName -ResourceGroupName -ResourceName + [-SubscriptionId ] [-DefaultProfile ] [-AsJob] [-NoWait] [-PassThru] [-Confirm] [-WhatIf] + [] +``` + +### PurgeViaIdentity +``` +Clear-AzSiteRecoveryReplicationProtectedItem -InputObject [-DefaultProfile ] + [-AsJob] [-NoWait] [-PassThru] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +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. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FabricName +Fabric name. + +```yaml +Type: System.String +Parameter Sets: Purge +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +Parameter Sets: PurgeViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PassThru +Returns true when the command succeeds + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProtectionContainerName +Protection container name. + +```yaml +Type: System.String +Parameter Sets: Purge +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ReplicatedProtectedItemName +Replication protected item name. + +```yaml +Type: System.String +Parameter Sets: Purge +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: Purge +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: Purge +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String +Parameter Sets: Purge +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity + +## OUTPUTS + +### System.Boolean + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`INPUTOBJECT `: Identity Parameter + - `[AlertSettingName ]`: The name of the email notification configuration. + - `[EventName ]`: The name of the Azure Site Recovery event. + - `[FabricName ]`: Fabric name. + - `[Id ]`: Resource identity path + - `[IntentObjectName ]`: Replication protection intent name. + - `[JobName ]`: Job identifier. + - `[LogicalNetworkName ]`: Logical network name. + - `[MappingName ]`: Protection Container mapping name. + - `[MigrationItemName ]`: Migration item name. + - `[MigrationRecoveryPointName ]`: The migration recovery point name. + - `[NetworkMappingName ]`: Network mapping name. + - `[NetworkName ]`: Primary network name. + - `[PolicyName ]`: Replication policy name. + - `[ProtectableItemName ]`: Protectable item name. + - `[ProtectionContainerName ]`: Protection container name. + - `[ProviderName ]`: Recovery services provider name. + - `[RecoveryPlanName ]`: Name of the recovery plan. + - `[RecoveryPointName ]`: The recovery point name. + - `[ReplicatedProtectedItemName ]`: Replication protected item name. + - `[ResourceGroupName ]`: The name of the resource group where the recovery services vault is present. + - `[ResourceName ]`: The name of the recovery services vault. + - `[StorageClassificationMappingName ]`: Storage classification mapping name. + - `[StorageClassificationName ]`: Storage classification name. + - `[SubscriptionId ]`: The subscription Id. + - `[VaultSettingName ]`: Vault setting name. + - `[VcenterName ]`: vcenter name. + - `[VirtualMachineName ]`: Virtual Machine name. + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/Clear-AzSiteRecoveryReplicationProtectionContainerMapping.md b/swaggerci/recoveryservicessiterecovery/docs/Clear-AzSiteRecoveryReplicationProtectionContainerMapping.md new file mode 100644 index 000000000000..3ac149808f7b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/Clear-AzSiteRecoveryReplicationProtectionContainerMapping.md @@ -0,0 +1,305 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/clear-azsiterecoveryreplicationprotectioncontainermapping +schema: 2.0.0 +--- + +# Clear-AzSiteRecoveryReplicationProtectionContainerMapping + +## SYNOPSIS +The operation to purge(force delete) a protection container mapping. + +## SYNTAX + +### Purge (Default) +``` +Clear-AzSiteRecoveryReplicationProtectionContainerMapping -FabricName -MappingName + -ProtectionContainerName -ResourceGroupName -ResourceName + [-SubscriptionId ] [-DefaultProfile ] [-AsJob] [-NoWait] [-PassThru] [-Confirm] [-WhatIf] + [] +``` + +### PurgeViaIdentity +``` +Clear-AzSiteRecoveryReplicationProtectionContainerMapping -InputObject + [-DefaultProfile ] [-AsJob] [-NoWait] [-PassThru] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +The operation to purge(force delete) a protection container mapping. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FabricName +Fabric name. + +```yaml +Type: System.String +Parameter Sets: Purge +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +Parameter Sets: PurgeViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -MappingName +Protection container mapping name. + +```yaml +Type: System.String +Parameter Sets: Purge +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PassThru +Returns true when the command succeeds + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProtectionContainerName +Protection container name. + +```yaml +Type: System.String +Parameter Sets: Purge +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: Purge +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: Purge +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String +Parameter Sets: Purge +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity + +## OUTPUTS + +### System.Boolean + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`INPUTOBJECT `: Identity Parameter + - `[AlertSettingName ]`: The name of the email notification configuration. + - `[EventName ]`: The name of the Azure Site Recovery event. + - `[FabricName ]`: Fabric name. + - `[Id ]`: Resource identity path + - `[IntentObjectName ]`: Replication protection intent name. + - `[JobName ]`: Job identifier. + - `[LogicalNetworkName ]`: Logical network name. + - `[MappingName ]`: Protection Container mapping name. + - `[MigrationItemName ]`: Migration item name. + - `[MigrationRecoveryPointName ]`: The migration recovery point name. + - `[NetworkMappingName ]`: Network mapping name. + - `[NetworkName ]`: Primary network name. + - `[PolicyName ]`: Replication policy name. + - `[ProtectableItemName ]`: Protectable item name. + - `[ProtectionContainerName ]`: Protection container name. + - `[ProviderName ]`: Recovery services provider name. + - `[RecoveryPlanName ]`: Name of the recovery plan. + - `[RecoveryPointName ]`: The recovery point name. + - `[ReplicatedProtectedItemName ]`: Replication protected item name. + - `[ResourceGroupName ]`: The name of the resource group where the recovery services vault is present. + - `[ResourceName ]`: The name of the recovery services vault. + - `[StorageClassificationMappingName ]`: Storage classification mapping name. + - `[StorageClassificationName ]`: Storage classification name. + - `[SubscriptionId ]`: The subscription Id. + - `[VaultSettingName ]`: Vault setting name. + - `[VcenterName ]`: vcenter name. + - `[VirtualMachineName ]`: Virtual Machine name. + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/Clear-AzSiteRecoveryReplicationRecoveryServicesProvider.md b/swaggerci/recoveryservicessiterecovery/docs/Clear-AzSiteRecoveryReplicationRecoveryServicesProvider.md new file mode 100644 index 000000000000..f89043009fdd --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/Clear-AzSiteRecoveryReplicationRecoveryServicesProvider.md @@ -0,0 +1,289 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/clear-azsiterecoveryreplicationrecoveryservicesprovider +schema: 2.0.0 +--- + +# Clear-AzSiteRecoveryReplicationRecoveryServicesProvider + +## SYNOPSIS +The operation to purge(force delete) a recovery services provider from the vault. + +## SYNTAX + +### Purge (Default) +``` +Clear-AzSiteRecoveryReplicationRecoveryServicesProvider -FabricName -ProviderName + -ResourceGroupName -ResourceName [-SubscriptionId ] [-DefaultProfile ] + [-AsJob] [-NoWait] [-PassThru] [-Confirm] [-WhatIf] [] +``` + +### PurgeViaIdentity +``` +Clear-AzSiteRecoveryReplicationRecoveryServicesProvider -InputObject + [-DefaultProfile ] [-AsJob] [-NoWait] [-PassThru] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +The operation to purge(force delete) a recovery services provider from the vault. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FabricName +Fabric name. + +```yaml +Type: System.String +Parameter Sets: Purge +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +Parameter Sets: PurgeViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PassThru +Returns true when the command succeeds + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProviderName +Recovery services provider name. + +```yaml +Type: System.String +Parameter Sets: Purge +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: Purge +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: Purge +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String +Parameter Sets: Purge +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity + +## OUTPUTS + +### System.Boolean + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`INPUTOBJECT `: Identity Parameter + - `[AlertSettingName ]`: The name of the email notification configuration. + - `[EventName ]`: The name of the Azure Site Recovery event. + - `[FabricName ]`: Fabric name. + - `[Id ]`: Resource identity path + - `[IntentObjectName ]`: Replication protection intent name. + - `[JobName ]`: Job identifier. + - `[LogicalNetworkName ]`: Logical network name. + - `[MappingName ]`: Protection Container mapping name. + - `[MigrationItemName ]`: Migration item name. + - `[MigrationRecoveryPointName ]`: The migration recovery point name. + - `[NetworkMappingName ]`: Network mapping name. + - `[NetworkName ]`: Primary network name. + - `[PolicyName ]`: Replication policy name. + - `[ProtectableItemName ]`: Protectable item name. + - `[ProtectionContainerName ]`: Protection container name. + - `[ProviderName ]`: Recovery services provider name. + - `[RecoveryPlanName ]`: Name of the recovery plan. + - `[RecoveryPointName ]`: The recovery point name. + - `[ReplicatedProtectedItemName ]`: Replication protected item name. + - `[ResourceGroupName ]`: The name of the resource group where the recovery services vault is present. + - `[ResourceName ]`: The name of the recovery services vault. + - `[StorageClassificationMappingName ]`: Storage classification mapping name. + - `[StorageClassificationName ]`: Storage classification name. + - `[SubscriptionId ]`: The subscription Id. + - `[VaultSettingName ]`: Vault setting name. + - `[VcenterName ]`: vcenter name. + - `[VirtualMachineName ]`: Virtual Machine name. + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/Export-AzSiteRecoveryReplicationJob.md b/swaggerci/recoveryservicessiterecovery/docs/Export-AzSiteRecoveryReplicationJob.md new file mode 100644 index 000000000000..8c9256a46f3e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/Export-AzSiteRecoveryReplicationJob.md @@ -0,0 +1,411 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/export-azsiterecoveryreplicationjob +schema: 2.0.0 +--- + +# Export-AzSiteRecoveryReplicationJob + +## SYNOPSIS +The operation to export the details of the Azure Site Recovery jobs of the vault. + +## SYNTAX + +### ExportExpanded (Default) +``` +Export-AzSiteRecoveryReplicationJob -ResourceGroupName -ResourceName + [-SubscriptionId ] [-AffectedObjectType ] [-EndTime ] [-FabricId ] + [-JobName ] [-JobOutputType ] [-JobStatus ] + [-StartTime ] [-TimezoneOffset ] [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] + [-WhatIf] [] +``` + +### Export +``` +Export-AzSiteRecoveryReplicationJob -ResourceGroupName -ResourceName + -JobQueryParameter [-SubscriptionId ] [-DefaultProfile ] [-AsJob] + [-NoWait] [-Confirm] [-WhatIf] [] +``` + +### ExportViaIdentity +``` +Export-AzSiteRecoveryReplicationJob -InputObject + -JobQueryParameter [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] + [] +``` + +### ExportViaIdentityExpanded +``` +Export-AzSiteRecoveryReplicationJob -InputObject [-AffectedObjectType ] + [-EndTime ] [-FabricId ] [-JobName ] + [-JobOutputType ] [-JobStatus ] [-StartTime ] + [-TimezoneOffset ] [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] + [] +``` + +## DESCRIPTION +The operation to export the details of the Azure Site Recovery jobs of the vault. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -AffectedObjectType +The type of objects. + +```yaml +Type: System.String +Parameter Sets: ExportExpanded, ExportViaIdentityExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -EndTime +Date time to get jobs upto. + +```yaml +Type: System.String +Parameter Sets: ExportExpanded, ExportViaIdentityExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FabricId +The Id of the fabric to search jobs under. + +```yaml +Type: System.String +Parameter Sets: ExportExpanded, ExportViaIdentityExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +Parameter Sets: ExportViaIdentity, ExportViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -JobName +The job Name. + +```yaml +Type: System.String +Parameter Sets: ExportExpanded, ExportViaIdentityExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -JobOutputType +The output type of the jobs. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ExportJobOutputSerializationType +Parameter Sets: ExportExpanded, ExportViaIdentityExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -JobQueryParameter +Query parameter to enumerate jobs. +To construct, see NOTES section for JOBQUERYPARAMETER properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobQueryParameter +Parameter Sets: Export, ExportViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -JobStatus +The states of the job to be filtered can be in. + +```yaml +Type: System.String +Parameter Sets: ExportExpanded, ExportViaIdentityExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: Export, ExportExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: Export, ExportExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -StartTime +Date time to get jobs from. + +```yaml +Type: System.String +Parameter Sets: ExportExpanded, ExportViaIdentityExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String +Parameter Sets: Export, ExportExpanded +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TimezoneOffset +The timezone offset for the location of the request (in minutes). + +```yaml +Type: System.Double +Parameter Sets: ExportExpanded, ExportViaIdentityExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobQueryParameter + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJob + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`INPUTOBJECT `: Identity Parameter + - `[AlertSettingName ]`: The name of the email notification configuration. + - `[EventName ]`: The name of the Azure Site Recovery event. + - `[FabricName ]`: Fabric name. + - `[Id ]`: Resource identity path + - `[IntentObjectName ]`: Replication protection intent name. + - `[JobName ]`: Job identifier. + - `[LogicalNetworkName ]`: Logical network name. + - `[MappingName ]`: Protection Container mapping name. + - `[MigrationItemName ]`: Migration item name. + - `[MigrationRecoveryPointName ]`: The migration recovery point name. + - `[NetworkMappingName ]`: Network mapping name. + - `[NetworkName ]`: Primary network name. + - `[PolicyName ]`: Replication policy name. + - `[ProtectableItemName ]`: Protectable item name. + - `[ProtectionContainerName ]`: Protection container name. + - `[ProviderName ]`: Recovery services provider name. + - `[RecoveryPlanName ]`: Name of the recovery plan. + - `[RecoveryPointName ]`: The recovery point name. + - `[ReplicatedProtectedItemName ]`: Replication protected item name. + - `[ResourceGroupName ]`: The name of the resource group where the recovery services vault is present. + - `[ResourceName ]`: The name of the recovery services vault. + - `[StorageClassificationMappingName ]`: Storage classification mapping name. + - `[StorageClassificationName ]`: Storage classification name. + - `[SubscriptionId ]`: The subscription Id. + - `[VaultSettingName ]`: Vault setting name. + - `[VcenterName ]`: vcenter name. + - `[VirtualMachineName ]`: Virtual Machine name. + +`JOBQUERYPARAMETER `: Query parameter to enumerate jobs. + - `[AffectedObjectType ]`: The type of objects. + - `[EndTime ]`: Date time to get jobs upto. + - `[FabricId ]`: The Id of the fabric to search jobs under. + - `[JobName ]`: The job Name. + - `[JobOutputType ]`: The output type of the jobs. + - `[JobStatus ]`: The states of the job to be filtered can be in. + - `[StartTime ]`: Date time to get jobs from. + - `[TimezoneOffset ]`: The timezone offset for the location of the request (in minutes). + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/Find-AzSiteRecoveryReplicationProtectionContainerProtectableItem.md b/swaggerci/recoveryservicessiterecovery/docs/Find-AzSiteRecoveryReplicationProtectionContainerProtectableItem.md new file mode 100644 index 000000000000..1ff1cfbd363a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/Find-AzSiteRecoveryReplicationProtectionContainerProtectableItem.md @@ -0,0 +1,359 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/find-azsiterecoveryreplicationprotectioncontainerprotectableitem +schema: 2.0.0 +--- + +# Find-AzSiteRecoveryReplicationProtectionContainerProtectableItem + +## SYNOPSIS +The operation to a add a protectable item to a protection container(Add physical server). + +## SYNTAX + +### DiscoverExpanded (Default) +``` +Find-AzSiteRecoveryReplicationProtectionContainerProtectableItem -FabricName + -ProtectionContainerName -ResourceGroupName -ResourceName + [-SubscriptionId ] [-FriendlyName ] [-IPAddress ] [-OSType ] + [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +### Discover +``` +Find-AzSiteRecoveryReplicationProtectionContainerProtectableItem -FabricName + -ProtectionContainerName -ResourceGroupName -ResourceName + -DiscoverProtectableItemRequest [-SubscriptionId ] + [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +### DiscoverViaIdentity +``` +Find-AzSiteRecoveryReplicationProtectionContainerProtectableItem -InputObject + -DiscoverProtectableItemRequest [-DefaultProfile ] [-AsJob] + [-NoWait] [-Confirm] [-WhatIf] [] +``` + +### DiscoverViaIdentityExpanded +``` +Find-AzSiteRecoveryReplicationProtectionContainerProtectableItem -InputObject + [-FriendlyName ] [-IPAddress ] [-OSType ] [-DefaultProfile ] [-AsJob] + [-NoWait] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +The operation to a add a protectable item to a protection container(Add physical server). + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DiscoverProtectableItemRequest +Request to add a physical machine as a protectable item in a container. +To construct, see NOTES section for DISCOVERPROTECTABLEITEMREQUEST properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiscoverProtectableItemRequest +Parameter Sets: Discover, DiscoverViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -FabricName +The name of the fabric. + +```yaml +Type: System.String +Parameter Sets: Discover, DiscoverExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FriendlyName +The friendly name of the physical machine. + +```yaml +Type: System.String +Parameter Sets: DiscoverExpanded, DiscoverViaIdentityExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +Parameter Sets: DiscoverViaIdentity, DiscoverViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -IPAddress +The IP address of the physical machine to be discovered. + +```yaml +Type: System.String +Parameter Sets: DiscoverExpanded, DiscoverViaIdentityExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -OSType +The OS type on the physical machine. + +```yaml +Type: System.String +Parameter Sets: DiscoverExpanded, DiscoverViaIdentityExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProtectionContainerName +The name of the protection container. + +```yaml +Type: System.String +Parameter Sets: Discover, DiscoverExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: Discover, DiscoverExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: Discover, DiscoverExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String +Parameter Sets: Discover, DiscoverExpanded +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiscoverProtectableItemRequest + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainer + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`DISCOVERPROTECTABLEITEMREQUEST `: Request to add a physical machine as a protectable item in a container. + - `[FriendlyName ]`: The friendly name of the physical machine. + - `[IPAddress ]`: The IP address of the physical machine to be discovered. + - `[OSType ]`: The OS type on the physical machine. + +`INPUTOBJECT `: Identity Parameter + - `[AlertSettingName ]`: The name of the email notification configuration. + - `[EventName ]`: The name of the Azure Site Recovery event. + - `[FabricName ]`: Fabric name. + - `[Id ]`: Resource identity path + - `[IntentObjectName ]`: Replication protection intent name. + - `[JobName ]`: Job identifier. + - `[LogicalNetworkName ]`: Logical network name. + - `[MappingName ]`: Protection Container mapping name. + - `[MigrationItemName ]`: Migration item name. + - `[MigrationRecoveryPointName ]`: The migration recovery point name. + - `[NetworkMappingName ]`: Network mapping name. + - `[NetworkName ]`: Primary network name. + - `[PolicyName ]`: Replication policy name. + - `[ProtectableItemName ]`: Protectable item name. + - `[ProtectionContainerName ]`: Protection container name. + - `[ProviderName ]`: Recovery services provider name. + - `[RecoveryPlanName ]`: Name of the recovery plan. + - `[RecoveryPointName ]`: The recovery point name. + - `[ReplicatedProtectedItemName ]`: Replication protected item name. + - `[ResourceGroupName ]`: The name of the resource group where the recovery services vault is present. + - `[ResourceName ]`: The name of the recovery services vault. + - `[StorageClassificationMappingName ]`: Storage classification mapping name. + - `[StorageClassificationName ]`: Storage classification name. + - `[SubscriptionId ]`: The subscription Id. + - `[VaultSettingName ]`: Vault setting name. + - `[VcenterName ]`: vcenter name. + - `[VirtualMachineName ]`: Virtual Machine name. + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/Get-AzSiteRecoveryMigrationRecoveryPoint.md b/swaggerci/recoveryservicessiterecovery/docs/Get-AzSiteRecoveryMigrationRecoveryPoint.md new file mode 100644 index 000000000000..30576875bcfa --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/Get-AzSiteRecoveryMigrationRecoveryPoint.md @@ -0,0 +1,250 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/get-azsiterecoverymigrationrecoverypoint +schema: 2.0.0 +--- + +# Get-AzSiteRecoveryMigrationRecoveryPoint + +## SYNOPSIS +Gets a recovery point for a migration item. + +## SYNTAX + +### List (Default) +``` +Get-AzSiteRecoveryMigrationRecoveryPoint -FabricName -MigrationItemName + -ProtectionContainerName -ResourceGroupName -ResourceName + [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### Get +``` +Get-AzSiteRecoveryMigrationRecoveryPoint -FabricName -MigrationItemName -Name + -ProtectionContainerName -ResourceGroupName -ResourceName + [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### GetViaIdentity +``` +Get-AzSiteRecoveryMigrationRecoveryPoint -InputObject [-DefaultProfile ] + [] +``` + +## DESCRIPTION +Gets a recovery point for a migration item. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FabricName +Fabric unique name. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +Parameter Sets: GetViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -MigrationItemName +Migration item name. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Name +The migration recovery point name. + +```yaml +Type: System.String +Parameter Sets: Get +Aliases: MigrationRecoveryPointName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProtectionContainerName +Protection container name. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String[] +Parameter Sets: Get, List +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationRecoveryPoint + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`INPUTOBJECT `: Identity Parameter + - `[AlertSettingName ]`: The name of the email notification configuration. + - `[EventName ]`: The name of the Azure Site Recovery event. + - `[FabricName ]`: Fabric name. + - `[Id ]`: Resource identity path + - `[IntentObjectName ]`: Replication protection intent name. + - `[JobName ]`: Job identifier. + - `[LogicalNetworkName ]`: Logical network name. + - `[MappingName ]`: Protection Container mapping name. + - `[MigrationItemName ]`: Migration item name. + - `[MigrationRecoveryPointName ]`: The migration recovery point name. + - `[NetworkMappingName ]`: Network mapping name. + - `[NetworkName ]`: Primary network name. + - `[PolicyName ]`: Replication policy name. + - `[ProtectableItemName ]`: Protectable item name. + - `[ProtectionContainerName ]`: Protection container name. + - `[ProviderName ]`: Recovery services provider name. + - `[RecoveryPlanName ]`: Name of the recovery plan. + - `[RecoveryPointName ]`: The recovery point name. + - `[ReplicatedProtectedItemName ]`: Replication protected item name. + - `[ResourceGroupName ]`: The name of the resource group where the recovery services vault is present. + - `[ResourceName ]`: The name of the recovery services vault. + - `[StorageClassificationMappingName ]`: Storage classification mapping name. + - `[StorageClassificationName ]`: Storage classification name. + - `[SubscriptionId ]`: The subscription Id. + - `[VaultSettingName ]`: Vault setting name. + - `[VcenterName ]`: vcenter name. + - `[VirtualMachineName ]`: Virtual Machine name. + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/Get-AzSiteRecoveryPoint.md b/swaggerci/recoveryservicessiterecovery/docs/Get-AzSiteRecoveryPoint.md new file mode 100644 index 000000000000..b0a4c20aa087 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/Get-AzSiteRecoveryPoint.md @@ -0,0 +1,249 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/get-azsiterecoverypoint +schema: 2.0.0 +--- + +# Get-AzSiteRecoveryPoint + +## SYNOPSIS +Get the details of specified recovery point. + +## SYNTAX + +### List (Default) +``` +Get-AzSiteRecoveryPoint -FabricName -ProtectionContainerName + -ReplicatedProtectedItemName -ResourceGroupName -ResourceName + [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### Get +``` +Get-AzSiteRecoveryPoint -FabricName -Name -ProtectionContainerName + -ReplicatedProtectedItemName -ResourceGroupName -ResourceName + [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### GetViaIdentity +``` +Get-AzSiteRecoveryPoint -InputObject [-DefaultProfile ] [] +``` + +## DESCRIPTION +Get the details of specified recovery point. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FabricName +The fabric name. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +Parameter Sets: GetViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -Name +The recovery point name. + +```yaml +Type: System.String +Parameter Sets: Get +Aliases: RecoveryPointName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProtectionContainerName +The protection container name. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ReplicatedProtectedItemName +The replication protected item name. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String[] +Parameter Sets: Get, List +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPoint + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`INPUTOBJECT `: Identity Parameter + - `[AlertSettingName ]`: The name of the email notification configuration. + - `[EventName ]`: The name of the Azure Site Recovery event. + - `[FabricName ]`: Fabric name. + - `[Id ]`: Resource identity path + - `[IntentObjectName ]`: Replication protection intent name. + - `[JobName ]`: Job identifier. + - `[LogicalNetworkName ]`: Logical network name. + - `[MappingName ]`: Protection Container mapping name. + - `[MigrationItemName ]`: Migration item name. + - `[MigrationRecoveryPointName ]`: The migration recovery point name. + - `[NetworkMappingName ]`: Network mapping name. + - `[NetworkName ]`: Primary network name. + - `[PolicyName ]`: Replication policy name. + - `[ProtectableItemName ]`: Protectable item name. + - `[ProtectionContainerName ]`: Protection container name. + - `[ProviderName ]`: Recovery services provider name. + - `[RecoveryPlanName ]`: Name of the recovery plan. + - `[RecoveryPointName ]`: The recovery point name. + - `[ReplicatedProtectedItemName ]`: Replication protected item name. + - `[ResourceGroupName ]`: The name of the resource group where the recovery services vault is present. + - `[ResourceName ]`: The name of the recovery services vault. + - `[StorageClassificationMappingName ]`: Storage classification mapping name. + - `[StorageClassificationName ]`: Storage classification name. + - `[SubscriptionId ]`: The subscription Id. + - `[VaultSettingName ]`: Vault setting name. + - `[VcenterName ]`: vcenter name. + - `[VirtualMachineName ]`: Virtual Machine name. + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/Get-AzSiteRecoveryReplicationAlertSetting.md b/swaggerci/recoveryservicessiterecovery/docs/Get-AzSiteRecoveryReplicationAlertSetting.md new file mode 100644 index 000000000000..907d4d10274a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/Get-AzSiteRecoveryReplicationAlertSetting.md @@ -0,0 +1,203 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/get-azsiterecoveryreplicationalertsetting +schema: 2.0.0 +--- + +# Get-AzSiteRecoveryReplicationAlertSetting + +## SYNOPSIS +Gets the details of the specified email notification(alert) configuration. + +## SYNTAX + +### List (Default) +``` +Get-AzSiteRecoveryReplicationAlertSetting -ResourceGroupName -ResourceName + [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### Get +``` +Get-AzSiteRecoveryReplicationAlertSetting -AlertSettingName -ResourceGroupName + -ResourceName [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### GetViaIdentity +``` +Get-AzSiteRecoveryReplicationAlertSetting -InputObject [-DefaultProfile ] + [] +``` + +## DESCRIPTION +Gets the details of the specified email notification(alert) configuration. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -AlertSettingName +The name of the email notification configuration. + +```yaml +Type: System.String +Parameter Sets: Get +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +Parameter Sets: GetViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String[] +Parameter Sets: Get, List +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlert + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`INPUTOBJECT `: Identity Parameter + - `[AlertSettingName ]`: The name of the email notification configuration. + - `[EventName ]`: The name of the Azure Site Recovery event. + - `[FabricName ]`: Fabric name. + - `[Id ]`: Resource identity path + - `[IntentObjectName ]`: Replication protection intent name. + - `[JobName ]`: Job identifier. + - `[LogicalNetworkName ]`: Logical network name. + - `[MappingName ]`: Protection Container mapping name. + - `[MigrationItemName ]`: Migration item name. + - `[MigrationRecoveryPointName ]`: The migration recovery point name. + - `[NetworkMappingName ]`: Network mapping name. + - `[NetworkName ]`: Primary network name. + - `[PolicyName ]`: Replication policy name. + - `[ProtectableItemName ]`: Protectable item name. + - `[ProtectionContainerName ]`: Protection container name. + - `[ProviderName ]`: Recovery services provider name. + - `[RecoveryPlanName ]`: Name of the recovery plan. + - `[RecoveryPointName ]`: The recovery point name. + - `[ReplicatedProtectedItemName ]`: Replication protected item name. + - `[ResourceGroupName ]`: The name of the resource group where the recovery services vault is present. + - `[ResourceName ]`: The name of the recovery services vault. + - `[StorageClassificationMappingName ]`: Storage classification mapping name. + - `[StorageClassificationName ]`: Storage classification name. + - `[SubscriptionId ]`: The subscription Id. + - `[VaultSettingName ]`: Vault setting name. + - `[VcenterName ]`: vcenter name. + - `[VirtualMachineName ]`: Virtual Machine name. + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/Get-AzSiteRecoveryReplicationAppliance.md b/swaggerci/recoveryservicessiterecovery/docs/Get-AzSiteRecoveryReplicationAppliance.md new file mode 100644 index 000000000000..7a18a333603c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/Get-AzSiteRecoveryReplicationAppliance.md @@ -0,0 +1,138 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/get-azsiterecoveryreplicationappliance +schema: 2.0.0 +--- + +# Get-AzSiteRecoveryReplicationAppliance + +## SYNOPSIS +Gets the list of Azure Site Recovery appliances for the vault. + +## SYNTAX + +``` +Get-AzSiteRecoveryReplicationAppliance -ResourceGroupName -ResourceName + [-SubscriptionId ] [-Filter ] [-DefaultProfile ] [] +``` + +## DESCRIPTION +Gets the list of Azure Site Recovery appliances for the vault. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Filter +OData filter options. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAppliance + +## NOTES + +ALIASES + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/Get-AzSiteRecoveryReplicationEligibilityResult.md b/swaggerci/recoveryservicessiterecovery/docs/Get-AzSiteRecoveryReplicationEligibilityResult.md new file mode 100644 index 000000000000..90e973932d46 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/Get-AzSiteRecoveryReplicationEligibilityResult.md @@ -0,0 +1,188 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/get-azsiterecoveryreplicationeligibilityresult +schema: 2.0.0 +--- + +# Get-AzSiteRecoveryReplicationEligibilityResult + +## SYNOPSIS +Validates whether a given VM can be protected or not in which case returns list of errors. + +## SYNTAX + +### Get (Default) +``` +Get-AzSiteRecoveryReplicationEligibilityResult -ResourceGroupName -VirtualMachineName + [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### GetViaIdentity +``` +Get-AzSiteRecoveryReplicationEligibilityResult -InputObject + [-DefaultProfile ] [] +``` + +### List +``` +Get-AzSiteRecoveryReplicationEligibilityResult -ResourceGroupName -VirtualMachineName + [-SubscriptionId ] [-DefaultProfile ] [] +``` + +## DESCRIPTION +Validates whether a given VM can be protected or not in which case returns list of errors. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +Parameter Sets: GetViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String[] +Parameter Sets: Get, List +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -VirtualMachineName +Virtual Machine name. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResults + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`INPUTOBJECT `: Identity Parameter + - `[AlertSettingName ]`: The name of the email notification configuration. + - `[EventName ]`: The name of the Azure Site Recovery event. + - `[FabricName ]`: Fabric name. + - `[Id ]`: Resource identity path + - `[IntentObjectName ]`: Replication protection intent name. + - `[JobName ]`: Job identifier. + - `[LogicalNetworkName ]`: Logical network name. + - `[MappingName ]`: Protection Container mapping name. + - `[MigrationItemName ]`: Migration item name. + - `[MigrationRecoveryPointName ]`: The migration recovery point name. + - `[NetworkMappingName ]`: Network mapping name. + - `[NetworkName ]`: Primary network name. + - `[PolicyName ]`: Replication policy name. + - `[ProtectableItemName ]`: Protectable item name. + - `[ProtectionContainerName ]`: Protection container name. + - `[ProviderName ]`: Recovery services provider name. + - `[RecoveryPlanName ]`: Name of the recovery plan. + - `[RecoveryPointName ]`: The recovery point name. + - `[ReplicatedProtectedItemName ]`: Replication protected item name. + - `[ResourceGroupName ]`: The name of the resource group where the recovery services vault is present. + - `[ResourceName ]`: The name of the recovery services vault. + - `[StorageClassificationMappingName ]`: Storage classification mapping name. + - `[StorageClassificationName ]`: Storage classification name. + - `[SubscriptionId ]`: The subscription Id. + - `[VaultSettingName ]`: Vault setting name. + - `[VcenterName ]`: vcenter name. + - `[VirtualMachineName ]`: Virtual Machine name. + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/Get-AzSiteRecoveryReplicationEvent.md b/swaggerci/recoveryservicessiterecovery/docs/Get-AzSiteRecoveryReplicationEvent.md new file mode 100644 index 000000000000..1042111e5903 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/Get-AzSiteRecoveryReplicationEvent.md @@ -0,0 +1,218 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/get-azsiterecoveryreplicationevent +schema: 2.0.0 +--- + +# Get-AzSiteRecoveryReplicationEvent + +## SYNOPSIS +The operation to get the details of an Azure Site recovery event. + +## SYNTAX + +### List (Default) +``` +Get-AzSiteRecoveryReplicationEvent -ResourceGroupName -ResourceName + [-SubscriptionId ] [-Filter ] [-DefaultProfile ] [] +``` + +### Get +``` +Get-AzSiteRecoveryReplicationEvent -EventName -ResourceGroupName -ResourceName + [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### GetViaIdentity +``` +Get-AzSiteRecoveryReplicationEvent -InputObject [-DefaultProfile ] + [] +``` + +## DESCRIPTION +The operation to get the details of an Azure Site recovery event. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -EventName +The name of the Azure Site Recovery event. + +```yaml +Type: System.String +Parameter Sets: Get +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Filter +OData filter options. + +```yaml +Type: System.String +Parameter Sets: List +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +Parameter Sets: GetViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String[] +Parameter Sets: Get, List +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEvent + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`INPUTOBJECT `: Identity Parameter + - `[AlertSettingName ]`: The name of the email notification configuration. + - `[EventName ]`: The name of the Azure Site Recovery event. + - `[FabricName ]`: Fabric name. + - `[Id ]`: Resource identity path + - `[IntentObjectName ]`: Replication protection intent name. + - `[JobName ]`: Job identifier. + - `[LogicalNetworkName ]`: Logical network name. + - `[MappingName ]`: Protection Container mapping name. + - `[MigrationItemName ]`: Migration item name. + - `[MigrationRecoveryPointName ]`: The migration recovery point name. + - `[NetworkMappingName ]`: Network mapping name. + - `[NetworkName ]`: Primary network name. + - `[PolicyName ]`: Replication policy name. + - `[ProtectableItemName ]`: Protectable item name. + - `[ProtectionContainerName ]`: Protection container name. + - `[ProviderName ]`: Recovery services provider name. + - `[RecoveryPlanName ]`: Name of the recovery plan. + - `[RecoveryPointName ]`: The recovery point name. + - `[ReplicatedProtectedItemName ]`: Replication protected item name. + - `[ResourceGroupName ]`: The name of the resource group where the recovery services vault is present. + - `[ResourceName ]`: The name of the recovery services vault. + - `[StorageClassificationMappingName ]`: Storage classification mapping name. + - `[StorageClassificationName ]`: Storage classification name. + - `[SubscriptionId ]`: The subscription Id. + - `[VaultSettingName ]`: Vault setting name. + - `[VcenterName ]`: vcenter name. + - `[VirtualMachineName ]`: Virtual Machine name. + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/Get-AzSiteRecoveryReplicationFabric.md b/swaggerci/recoveryservicessiterecovery/docs/Get-AzSiteRecoveryReplicationFabric.md new file mode 100644 index 000000000000..f2ec018ea1b8 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/Get-AzSiteRecoveryReplicationFabric.md @@ -0,0 +1,218 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/get-azsiterecoveryreplicationfabric +schema: 2.0.0 +--- + +# Get-AzSiteRecoveryReplicationFabric + +## SYNOPSIS +Gets the details of an Azure Site Recovery fabric. + +## SYNTAX + +### List (Default) +``` +Get-AzSiteRecoveryReplicationFabric -ResourceGroupName -ResourceName + [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### Get +``` +Get-AzSiteRecoveryReplicationFabric -FabricName -ResourceGroupName -ResourceName + [-SubscriptionId ] [-Filter ] [-DefaultProfile ] [] +``` + +### GetViaIdentity +``` +Get-AzSiteRecoveryReplicationFabric -InputObject [-Filter ] + [-DefaultProfile ] [] +``` + +## DESCRIPTION +Gets the details of an Azure Site Recovery fabric. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FabricName +Fabric name. + +```yaml +Type: System.String +Parameter Sets: Get +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Filter +OData filter options. + +```yaml +Type: System.String +Parameter Sets: Get, GetViaIdentity +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +Parameter Sets: GetViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String[] +Parameter Sets: Get, List +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabric + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`INPUTOBJECT `: Identity Parameter + - `[AlertSettingName ]`: The name of the email notification configuration. + - `[EventName ]`: The name of the Azure Site Recovery event. + - `[FabricName ]`: Fabric name. + - `[Id ]`: Resource identity path + - `[IntentObjectName ]`: Replication protection intent name. + - `[JobName ]`: Job identifier. + - `[LogicalNetworkName ]`: Logical network name. + - `[MappingName ]`: Protection Container mapping name. + - `[MigrationItemName ]`: Migration item name. + - `[MigrationRecoveryPointName ]`: The migration recovery point name. + - `[NetworkMappingName ]`: Network mapping name. + - `[NetworkName ]`: Primary network name. + - `[PolicyName ]`: Replication policy name. + - `[ProtectableItemName ]`: Protectable item name. + - `[ProtectionContainerName ]`: Protection container name. + - `[ProviderName ]`: Recovery services provider name. + - `[RecoveryPlanName ]`: Name of the recovery plan. + - `[RecoveryPointName ]`: The recovery point name. + - `[ReplicatedProtectedItemName ]`: Replication protected item name. + - `[ResourceGroupName ]`: The name of the resource group where the recovery services vault is present. + - `[ResourceName ]`: The name of the recovery services vault. + - `[StorageClassificationMappingName ]`: Storage classification mapping name. + - `[StorageClassificationName ]`: Storage classification name. + - `[SubscriptionId ]`: The subscription Id. + - `[VaultSettingName ]`: Vault setting name. + - `[VcenterName ]`: vcenter name. + - `[VirtualMachineName ]`: Virtual Machine name. + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/Get-AzSiteRecoveryReplicationJob.md b/swaggerci/recoveryservicessiterecovery/docs/Get-AzSiteRecoveryReplicationJob.md new file mode 100644 index 000000000000..e32d79ad3ba0 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/Get-AzSiteRecoveryReplicationJob.md @@ -0,0 +1,218 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/get-azsiterecoveryreplicationjob +schema: 2.0.0 +--- + +# Get-AzSiteRecoveryReplicationJob + +## SYNOPSIS +Get the details of an Azure Site Recovery job. + +## SYNTAX + +### List (Default) +``` +Get-AzSiteRecoveryReplicationJob -ResourceGroupName -ResourceName + [-SubscriptionId ] [-Filter ] [-DefaultProfile ] [] +``` + +### Get +``` +Get-AzSiteRecoveryReplicationJob -JobName -ResourceGroupName -ResourceName + [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### GetViaIdentity +``` +Get-AzSiteRecoveryReplicationJob -InputObject [-DefaultProfile ] + [] +``` + +## DESCRIPTION +Get the details of an Azure Site Recovery job. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Filter +OData filter options. + +```yaml +Type: System.String +Parameter Sets: List +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +Parameter Sets: GetViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -JobName +Job identifier. + +```yaml +Type: System.String +Parameter Sets: Get +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String[] +Parameter Sets: Get, List +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJob + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`INPUTOBJECT `: Identity Parameter + - `[AlertSettingName ]`: The name of the email notification configuration. + - `[EventName ]`: The name of the Azure Site Recovery event. + - `[FabricName ]`: Fabric name. + - `[Id ]`: Resource identity path + - `[IntentObjectName ]`: Replication protection intent name. + - `[JobName ]`: Job identifier. + - `[LogicalNetworkName ]`: Logical network name. + - `[MappingName ]`: Protection Container mapping name. + - `[MigrationItemName ]`: Migration item name. + - `[MigrationRecoveryPointName ]`: The migration recovery point name. + - `[NetworkMappingName ]`: Network mapping name. + - `[NetworkName ]`: Primary network name. + - `[PolicyName ]`: Replication policy name. + - `[ProtectableItemName ]`: Protectable item name. + - `[ProtectionContainerName ]`: Protection container name. + - `[ProviderName ]`: Recovery services provider name. + - `[RecoveryPlanName ]`: Name of the recovery plan. + - `[RecoveryPointName ]`: The recovery point name. + - `[ReplicatedProtectedItemName ]`: Replication protected item name. + - `[ResourceGroupName ]`: The name of the resource group where the recovery services vault is present. + - `[ResourceName ]`: The name of the recovery services vault. + - `[StorageClassificationMappingName ]`: Storage classification mapping name. + - `[StorageClassificationName ]`: Storage classification name. + - `[SubscriptionId ]`: The subscription Id. + - `[VaultSettingName ]`: Vault setting name. + - `[VcenterName ]`: vcenter name. + - `[VirtualMachineName ]`: Virtual Machine name. + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/Get-AzSiteRecoveryReplicationLogicalNetwork.md b/swaggerci/recoveryservicessiterecovery/docs/Get-AzSiteRecoveryReplicationLogicalNetwork.md new file mode 100644 index 000000000000..0230b8ee3144 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/Get-AzSiteRecoveryReplicationLogicalNetwork.md @@ -0,0 +1,219 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/get-azsiterecoveryreplicationlogicalnetwork +schema: 2.0.0 +--- + +# Get-AzSiteRecoveryReplicationLogicalNetwork + +## SYNOPSIS +Gets the details of a logical network. + +## SYNTAX + +### List (Default) +``` +Get-AzSiteRecoveryReplicationLogicalNetwork -FabricName -ResourceGroupName + -ResourceName [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### Get +``` +Get-AzSiteRecoveryReplicationLogicalNetwork -FabricName -LogicalNetworkName + -ResourceGroupName -ResourceName [-SubscriptionId ] [-DefaultProfile ] + [] +``` + +### GetViaIdentity +``` +Get-AzSiteRecoveryReplicationLogicalNetwork -InputObject [-DefaultProfile ] + [] +``` + +## DESCRIPTION +Gets the details of a logical network. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FabricName +Server Id. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +Parameter Sets: GetViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -LogicalNetworkName +Logical network name. + +```yaml +Type: System.String +Parameter Sets: Get +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String[] +Parameter Sets: Get, List +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetwork + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`INPUTOBJECT `: Identity Parameter + - `[AlertSettingName ]`: The name of the email notification configuration. + - `[EventName ]`: The name of the Azure Site Recovery event. + - `[FabricName ]`: Fabric name. + - `[Id ]`: Resource identity path + - `[IntentObjectName ]`: Replication protection intent name. + - `[JobName ]`: Job identifier. + - `[LogicalNetworkName ]`: Logical network name. + - `[MappingName ]`: Protection Container mapping name. + - `[MigrationItemName ]`: Migration item name. + - `[MigrationRecoveryPointName ]`: The migration recovery point name. + - `[NetworkMappingName ]`: Network mapping name. + - `[NetworkName ]`: Primary network name. + - `[PolicyName ]`: Replication policy name. + - `[ProtectableItemName ]`: Protectable item name. + - `[ProtectionContainerName ]`: Protection container name. + - `[ProviderName ]`: Recovery services provider name. + - `[RecoveryPlanName ]`: Name of the recovery plan. + - `[RecoveryPointName ]`: The recovery point name. + - `[ReplicatedProtectedItemName ]`: Replication protected item name. + - `[ResourceGroupName ]`: The name of the resource group where the recovery services vault is present. + - `[ResourceName ]`: The name of the recovery services vault. + - `[StorageClassificationMappingName ]`: Storage classification mapping name. + - `[StorageClassificationName ]`: Storage classification name. + - `[SubscriptionId ]`: The subscription Id. + - `[VaultSettingName ]`: Vault setting name. + - `[VcenterName ]`: vcenter name. + - `[VirtualMachineName ]`: Virtual Machine name. + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/Get-AzSiteRecoveryReplicationMigrationItem.md b/swaggerci/recoveryservicessiterecovery/docs/Get-AzSiteRecoveryReplicationMigrationItem.md new file mode 100644 index 000000000000..6a96f9332f4f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/Get-AzSiteRecoveryReplicationMigrationItem.md @@ -0,0 +1,287 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/get-azsiterecoveryreplicationmigrationitem +schema: 2.0.0 +--- + +# Get-AzSiteRecoveryReplicationMigrationItem + +## SYNOPSIS +Gets the details of a migration item. + +## SYNTAX + +### List1 (Default) +``` +Get-AzSiteRecoveryReplicationMigrationItem -ResourceGroupName -ResourceName + [-SubscriptionId ] [-Filter ] [-SkipToken ] [-TakeToken ] + [-DefaultProfile ] [] +``` + +### Get +``` +Get-AzSiteRecoveryReplicationMigrationItem -FabricName -MigrationItemName + -ProtectionContainerName -ResourceGroupName -ResourceName + [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### GetViaIdentity +``` +Get-AzSiteRecoveryReplicationMigrationItem -InputObject [-DefaultProfile ] + [] +``` + +### List +``` +Get-AzSiteRecoveryReplicationMigrationItem -FabricName -ProtectionContainerName + -ResourceGroupName -ResourceName [-SubscriptionId ] [-Filter ] + [-SkipToken ] [-TakeToken ] [-DefaultProfile ] [] +``` + +## DESCRIPTION +Gets the details of a migration item. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FabricName +Fabric unique name. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Filter +OData filter options. + +```yaml +Type: System.String +Parameter Sets: List, List1 +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +Parameter Sets: GetViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -MigrationItemName +Migration item name. + +```yaml +Type: System.String +Parameter Sets: Get +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProtectionContainerName +Protection container name. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: Get, List, List1 +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: Get, List, List1 +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SkipToken +The pagination token. + +```yaml +Type: System.String +Parameter Sets: List, List1 +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String[] +Parameter Sets: Get, List, List1 +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TakeToken +The page size. + +```yaml +Type: System.String +Parameter Sets: List, List1 +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`INPUTOBJECT `: Identity Parameter + - `[AlertSettingName ]`: The name of the email notification configuration. + - `[EventName ]`: The name of the Azure Site Recovery event. + - `[FabricName ]`: Fabric name. + - `[Id ]`: Resource identity path + - `[IntentObjectName ]`: Replication protection intent name. + - `[JobName ]`: Job identifier. + - `[LogicalNetworkName ]`: Logical network name. + - `[MappingName ]`: Protection Container mapping name. + - `[MigrationItemName ]`: Migration item name. + - `[MigrationRecoveryPointName ]`: The migration recovery point name. + - `[NetworkMappingName ]`: Network mapping name. + - `[NetworkName ]`: Primary network name. + - `[PolicyName ]`: Replication policy name. + - `[ProtectableItemName ]`: Protectable item name. + - `[ProtectionContainerName ]`: Protection container name. + - `[ProviderName ]`: Recovery services provider name. + - `[RecoveryPlanName ]`: Name of the recovery plan. + - `[RecoveryPointName ]`: The recovery point name. + - `[ReplicatedProtectedItemName ]`: Replication protected item name. + - `[ResourceGroupName ]`: The name of the resource group where the recovery services vault is present. + - `[ResourceName ]`: The name of the recovery services vault. + - `[StorageClassificationMappingName ]`: Storage classification mapping name. + - `[StorageClassificationName ]`: Storage classification name. + - `[SubscriptionId ]`: The subscription Id. + - `[VaultSettingName ]`: Vault setting name. + - `[VcenterName ]`: vcenter name. + - `[VirtualMachineName ]`: Virtual Machine name. + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/Get-AzSiteRecoveryReplicationNetwork.md b/swaggerci/recoveryservicessiterecovery/docs/Get-AzSiteRecoveryReplicationNetwork.md new file mode 100644 index 000000000000..c57cb4d2fd71 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/Get-AzSiteRecoveryReplicationNetwork.md @@ -0,0 +1,224 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/get-azsiterecoveryreplicationnetwork +schema: 2.0.0 +--- + +# Get-AzSiteRecoveryReplicationNetwork + +## SYNOPSIS +Gets the details of a network. + +## SYNTAX + +### List1 (Default) +``` +Get-AzSiteRecoveryReplicationNetwork -ResourceGroupName -ResourceName + [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### Get +``` +Get-AzSiteRecoveryReplicationNetwork -FabricName -NetworkName -ResourceGroupName + -ResourceName [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### GetViaIdentity +``` +Get-AzSiteRecoveryReplicationNetwork -InputObject [-DefaultProfile ] + [] +``` + +### List +``` +Get-AzSiteRecoveryReplicationNetwork -FabricName -ResourceGroupName -ResourceName + [-SubscriptionId ] [-DefaultProfile ] [] +``` + +## DESCRIPTION +Gets the details of a network. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FabricName +Server Id. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +Parameter Sets: GetViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -NetworkName +Primary network name. + +```yaml +Type: System.String +Parameter Sets: Get +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: Get, List, List1 +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: Get, List, List1 +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String[] +Parameter Sets: Get, List, List1 +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetwork + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`INPUTOBJECT `: Identity Parameter + - `[AlertSettingName ]`: The name of the email notification configuration. + - `[EventName ]`: The name of the Azure Site Recovery event. + - `[FabricName ]`: Fabric name. + - `[Id ]`: Resource identity path + - `[IntentObjectName ]`: Replication protection intent name. + - `[JobName ]`: Job identifier. + - `[LogicalNetworkName ]`: Logical network name. + - `[MappingName ]`: Protection Container mapping name. + - `[MigrationItemName ]`: Migration item name. + - `[MigrationRecoveryPointName ]`: The migration recovery point name. + - `[NetworkMappingName ]`: Network mapping name. + - `[NetworkName ]`: Primary network name. + - `[PolicyName ]`: Replication policy name. + - `[ProtectableItemName ]`: Protectable item name. + - `[ProtectionContainerName ]`: Protection container name. + - `[ProviderName ]`: Recovery services provider name. + - `[RecoveryPlanName ]`: Name of the recovery plan. + - `[RecoveryPointName ]`: The recovery point name. + - `[ReplicatedProtectedItemName ]`: Replication protected item name. + - `[ResourceGroupName ]`: The name of the resource group where the recovery services vault is present. + - `[ResourceName ]`: The name of the recovery services vault. + - `[StorageClassificationMappingName ]`: Storage classification mapping name. + - `[StorageClassificationName ]`: Storage classification name. + - `[SubscriptionId ]`: The subscription Id. + - `[VaultSettingName ]`: Vault setting name. + - `[VcenterName ]`: vcenter name. + - `[VirtualMachineName ]`: Virtual Machine name. + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/Get-AzSiteRecoveryReplicationNetworkMapping.md b/swaggerci/recoveryservicessiterecovery/docs/Get-AzSiteRecoveryReplicationNetworkMapping.md new file mode 100644 index 000000000000..28ec11f81949 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/Get-AzSiteRecoveryReplicationNetworkMapping.md @@ -0,0 +1,241 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/get-azsiterecoveryreplicationnetworkmapping +schema: 2.0.0 +--- + +# Get-AzSiteRecoveryReplicationNetworkMapping + +## SYNOPSIS +Gets the details of an ASR network mapping. + +## SYNTAX + +### List1 (Default) +``` +Get-AzSiteRecoveryReplicationNetworkMapping -ResourceGroupName -ResourceName + [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### Get +``` +Get-AzSiteRecoveryReplicationNetworkMapping -FabricName -NetworkMappingName + -NetworkName -ResourceGroupName -ResourceName [-SubscriptionId ] + [-DefaultProfile ] [] +``` + +### GetViaIdentity +``` +Get-AzSiteRecoveryReplicationNetworkMapping -InputObject [-DefaultProfile ] + [] +``` + +### List +``` +Get-AzSiteRecoveryReplicationNetworkMapping -FabricName -NetworkName + -ResourceGroupName -ResourceName [-SubscriptionId ] [-DefaultProfile ] + [] +``` + +## DESCRIPTION +Gets the details of an ASR network mapping. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FabricName +Primary fabric name. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +Parameter Sets: GetViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -NetworkMappingName +Network mapping name. + +```yaml +Type: System.String +Parameter Sets: Get +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NetworkName +Primary network name. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: Get, List, List1 +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: Get, List, List1 +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String[] +Parameter Sets: Get, List, List1 +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMapping + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`INPUTOBJECT `: Identity Parameter + - `[AlertSettingName ]`: The name of the email notification configuration. + - `[EventName ]`: The name of the Azure Site Recovery event. + - `[FabricName ]`: Fabric name. + - `[Id ]`: Resource identity path + - `[IntentObjectName ]`: Replication protection intent name. + - `[JobName ]`: Job identifier. + - `[LogicalNetworkName ]`: Logical network name. + - `[MappingName ]`: Protection Container mapping name. + - `[MigrationItemName ]`: Migration item name. + - `[MigrationRecoveryPointName ]`: The migration recovery point name. + - `[NetworkMappingName ]`: Network mapping name. + - `[NetworkName ]`: Primary network name. + - `[PolicyName ]`: Replication policy name. + - `[ProtectableItemName ]`: Protectable item name. + - `[ProtectionContainerName ]`: Protection container name. + - `[ProviderName ]`: Recovery services provider name. + - `[RecoveryPlanName ]`: Name of the recovery plan. + - `[RecoveryPointName ]`: The recovery point name. + - `[ReplicatedProtectedItemName ]`: Replication protected item name. + - `[ResourceGroupName ]`: The name of the resource group where the recovery services vault is present. + - `[ResourceName ]`: The name of the recovery services vault. + - `[StorageClassificationMappingName ]`: Storage classification mapping name. + - `[StorageClassificationName ]`: Storage classification name. + - `[SubscriptionId ]`: The subscription Id. + - `[VaultSettingName ]`: Vault setting name. + - `[VcenterName ]`: vcenter name. + - `[VirtualMachineName ]`: Virtual Machine name. + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/Get-AzSiteRecoveryReplicationPolicy.md b/swaggerci/recoveryservicessiterecovery/docs/Get-AzSiteRecoveryReplicationPolicy.md new file mode 100644 index 000000000000..ecd986809fae --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/Get-AzSiteRecoveryReplicationPolicy.md @@ -0,0 +1,203 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/get-azsiterecoveryreplicationpolicy +schema: 2.0.0 +--- + +# Get-AzSiteRecoveryReplicationPolicy + +## SYNOPSIS +Gets the details of a replication policy. + +## SYNTAX + +### List (Default) +``` +Get-AzSiteRecoveryReplicationPolicy -ResourceGroupName -ResourceName + [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### Get +``` +Get-AzSiteRecoveryReplicationPolicy -PolicyName -ResourceGroupName -ResourceName + [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### GetViaIdentity +``` +Get-AzSiteRecoveryReplicationPolicy -InputObject [-DefaultProfile ] + [] +``` + +## DESCRIPTION +Gets the details of a replication policy. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +Parameter Sets: GetViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -PolicyName +Replication policy name. + +```yaml +Type: System.String +Parameter Sets: Get +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String[] +Parameter Sets: Get, List +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicy + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`INPUTOBJECT `: Identity Parameter + - `[AlertSettingName ]`: The name of the email notification configuration. + - `[EventName ]`: The name of the Azure Site Recovery event. + - `[FabricName ]`: Fabric name. + - `[Id ]`: Resource identity path + - `[IntentObjectName ]`: Replication protection intent name. + - `[JobName ]`: Job identifier. + - `[LogicalNetworkName ]`: Logical network name. + - `[MappingName ]`: Protection Container mapping name. + - `[MigrationItemName ]`: Migration item name. + - `[MigrationRecoveryPointName ]`: The migration recovery point name. + - `[NetworkMappingName ]`: Network mapping name. + - `[NetworkName ]`: Primary network name. + - `[PolicyName ]`: Replication policy name. + - `[ProtectableItemName ]`: Protectable item name. + - `[ProtectionContainerName ]`: Protection container name. + - `[ProviderName ]`: Recovery services provider name. + - `[RecoveryPlanName ]`: Name of the recovery plan. + - `[RecoveryPointName ]`: The recovery point name. + - `[ReplicatedProtectedItemName ]`: Replication protected item name. + - `[ResourceGroupName ]`: The name of the resource group where the recovery services vault is present. + - `[ResourceName ]`: The name of the recovery services vault. + - `[StorageClassificationMappingName ]`: Storage classification mapping name. + - `[StorageClassificationName ]`: Storage classification name. + - `[SubscriptionId ]`: The subscription Id. + - `[VaultSettingName ]`: Vault setting name. + - `[VcenterName ]`: vcenter name. + - `[VirtualMachineName ]`: Virtual Machine name. + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/Get-AzSiteRecoveryReplicationProtectableItem.md b/swaggerci/recoveryservicessiterecovery/docs/Get-AzSiteRecoveryReplicationProtectableItem.md new file mode 100644 index 000000000000..1203638b272b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/Get-AzSiteRecoveryReplicationProtectableItem.md @@ -0,0 +1,280 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/get-azsiterecoveryreplicationprotectableitem +schema: 2.0.0 +--- + +# Get-AzSiteRecoveryReplicationProtectableItem + +## SYNOPSIS +The operation to get the details of a protectable item. + +## SYNTAX + +### List (Default) +``` +Get-AzSiteRecoveryReplicationProtectableItem -FabricName -ProtectionContainerName + -ResourceGroupName -ResourceName [-SubscriptionId ] [-Filter ] + [-SkipToken ] [-Take ] [-DefaultProfile ] [] +``` + +### Get +``` +Get-AzSiteRecoveryReplicationProtectableItem -FabricName -ProtectableItemName + -ProtectionContainerName -ResourceGroupName -ResourceName + [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### GetViaIdentity +``` +Get-AzSiteRecoveryReplicationProtectableItem -InputObject [-DefaultProfile ] + [] +``` + +## DESCRIPTION +The operation to get the details of a protectable item. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FabricName +Fabric name. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Filter +OData filter options. + +```yaml +Type: System.String +Parameter Sets: List +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +Parameter Sets: GetViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -ProtectableItemName +Protectable item name. + +```yaml +Type: System.String +Parameter Sets: Get +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProtectionContainerName +Protection container name. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SkipToken +skipToken OData query parameter. + +```yaml +Type: System.String +Parameter Sets: List +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String[] +Parameter Sets: Get, List +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Take +take OData query parameter. + +```yaml +Type: System.String +Parameter Sets: List +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItem + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`INPUTOBJECT `: Identity Parameter + - `[AlertSettingName ]`: The name of the email notification configuration. + - `[EventName ]`: The name of the Azure Site Recovery event. + - `[FabricName ]`: Fabric name. + - `[Id ]`: Resource identity path + - `[IntentObjectName ]`: Replication protection intent name. + - `[JobName ]`: Job identifier. + - `[LogicalNetworkName ]`: Logical network name. + - `[MappingName ]`: Protection Container mapping name. + - `[MigrationItemName ]`: Migration item name. + - `[MigrationRecoveryPointName ]`: The migration recovery point name. + - `[NetworkMappingName ]`: Network mapping name. + - `[NetworkName ]`: Primary network name. + - `[PolicyName ]`: Replication policy name. + - `[ProtectableItemName ]`: Protectable item name. + - `[ProtectionContainerName ]`: Protection container name. + - `[ProviderName ]`: Recovery services provider name. + - `[RecoveryPlanName ]`: Name of the recovery plan. + - `[RecoveryPointName ]`: The recovery point name. + - `[ReplicatedProtectedItemName ]`: Replication protected item name. + - `[ResourceGroupName ]`: The name of the resource group where the recovery services vault is present. + - `[ResourceName ]`: The name of the recovery services vault. + - `[StorageClassificationMappingName ]`: Storage classification mapping name. + - `[StorageClassificationName ]`: Storage classification name. + - `[SubscriptionId ]`: The subscription Id. + - `[VaultSettingName ]`: Vault setting name. + - `[VcenterName ]`: vcenter name. + - `[VirtualMachineName ]`: Virtual Machine name. + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/Get-AzSiteRecoveryReplicationProtectedItem.md b/swaggerci/recoveryservicessiterecovery/docs/Get-AzSiteRecoveryReplicationProtectedItem.md new file mode 100644 index 000000000000..d1627b90b904 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/Get-AzSiteRecoveryReplicationProtectedItem.md @@ -0,0 +1,273 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/get-azsiterecoveryreplicationprotecteditem +schema: 2.0.0 +--- + +# Get-AzSiteRecoveryReplicationProtectedItem + +## SYNOPSIS +Gets the details of an ASR replication protected item. + +## SYNTAX + +### List1 (Default) +``` +Get-AzSiteRecoveryReplicationProtectedItem -ResourceGroupName -ResourceName + [-SubscriptionId ] [-Filter ] [-SkipToken ] [-DefaultProfile ] + [] +``` + +### Get +``` +Get-AzSiteRecoveryReplicationProtectedItem -FabricName -ProtectionContainerName + -ReplicatedProtectedItemName -ResourceGroupName -ResourceName + [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### GetViaIdentity +``` +Get-AzSiteRecoveryReplicationProtectedItem -InputObject [-DefaultProfile ] + [] +``` + +### List +``` +Get-AzSiteRecoveryReplicationProtectedItem -FabricName -ProtectionContainerName + -ResourceGroupName -ResourceName [-SubscriptionId ] [-DefaultProfile ] + [] +``` + +## DESCRIPTION +Gets the details of an ASR replication protected item. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FabricName +Fabric unique name. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Filter +OData filter options. + +```yaml +Type: System.String +Parameter Sets: List1 +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +Parameter Sets: GetViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -ProtectionContainerName +Protection container name. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ReplicatedProtectedItemName +Replication protected item name. + +```yaml +Type: System.String +Parameter Sets: Get +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: Get, List, List1 +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: Get, List, List1 +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SkipToken +The pagination token. +Possible values: "FabricId" or "FabricId_CloudId" or null. + +```yaml +Type: System.String +Parameter Sets: List1 +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String[] +Parameter Sets: Get, List, List1 +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`INPUTOBJECT `: Identity Parameter + - `[AlertSettingName ]`: The name of the email notification configuration. + - `[EventName ]`: The name of the Azure Site Recovery event. + - `[FabricName ]`: Fabric name. + - `[Id ]`: Resource identity path + - `[IntentObjectName ]`: Replication protection intent name. + - `[JobName ]`: Job identifier. + - `[LogicalNetworkName ]`: Logical network name. + - `[MappingName ]`: Protection Container mapping name. + - `[MigrationItemName ]`: Migration item name. + - `[MigrationRecoveryPointName ]`: The migration recovery point name. + - `[NetworkMappingName ]`: Network mapping name. + - `[NetworkName ]`: Primary network name. + - `[PolicyName ]`: Replication policy name. + - `[ProtectableItemName ]`: Protectable item name. + - `[ProtectionContainerName ]`: Protection container name. + - `[ProviderName ]`: Recovery services provider name. + - `[RecoveryPlanName ]`: Name of the recovery plan. + - `[RecoveryPointName ]`: The recovery point name. + - `[ReplicatedProtectedItemName ]`: Replication protected item name. + - `[ResourceGroupName ]`: The name of the resource group where the recovery services vault is present. + - `[ResourceName ]`: The name of the recovery services vault. + - `[StorageClassificationMappingName ]`: Storage classification mapping name. + - `[StorageClassificationName ]`: Storage classification name. + - `[SubscriptionId ]`: The subscription Id. + - `[VaultSettingName ]`: Vault setting name. + - `[VcenterName ]`: vcenter name. + - `[VirtualMachineName ]`: Virtual Machine name. + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/Get-AzSiteRecoveryReplicationProtectionContainer.md b/swaggerci/recoveryservicessiterecovery/docs/Get-AzSiteRecoveryReplicationProtectionContainer.md new file mode 100644 index 000000000000..3827b6f40f3a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/Get-AzSiteRecoveryReplicationProtectionContainer.md @@ -0,0 +1,225 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/get-azsiterecoveryreplicationprotectioncontainer +schema: 2.0.0 +--- + +# Get-AzSiteRecoveryReplicationProtectionContainer + +## SYNOPSIS +Gets the details of a protection container. + +## SYNTAX + +### List1 (Default) +``` +Get-AzSiteRecoveryReplicationProtectionContainer -ResourceGroupName -ResourceName + [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### Get +``` +Get-AzSiteRecoveryReplicationProtectionContainer -FabricName -ProtectionContainerName + -ResourceGroupName -ResourceName [-SubscriptionId ] [-DefaultProfile ] + [] +``` + +### GetViaIdentity +``` +Get-AzSiteRecoveryReplicationProtectionContainer -InputObject + [-DefaultProfile ] [] +``` + +### List +``` +Get-AzSiteRecoveryReplicationProtectionContainer -FabricName -ResourceGroupName + -ResourceName [-SubscriptionId ] [-DefaultProfile ] [] +``` + +## DESCRIPTION +Gets the details of a protection container. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FabricName +Fabric name. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +Parameter Sets: GetViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -ProtectionContainerName +Protection container name. + +```yaml +Type: System.String +Parameter Sets: Get +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: Get, List, List1 +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: Get, List, List1 +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String[] +Parameter Sets: Get, List, List1 +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainer + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`INPUTOBJECT `: Identity Parameter + - `[AlertSettingName ]`: The name of the email notification configuration. + - `[EventName ]`: The name of the Azure Site Recovery event. + - `[FabricName ]`: Fabric name. + - `[Id ]`: Resource identity path + - `[IntentObjectName ]`: Replication protection intent name. + - `[JobName ]`: Job identifier. + - `[LogicalNetworkName ]`: Logical network name. + - `[MappingName ]`: Protection Container mapping name. + - `[MigrationItemName ]`: Migration item name. + - `[MigrationRecoveryPointName ]`: The migration recovery point name. + - `[NetworkMappingName ]`: Network mapping name. + - `[NetworkName ]`: Primary network name. + - `[PolicyName ]`: Replication policy name. + - `[ProtectableItemName ]`: Protectable item name. + - `[ProtectionContainerName ]`: Protection container name. + - `[ProviderName ]`: Recovery services provider name. + - `[RecoveryPlanName ]`: Name of the recovery plan. + - `[RecoveryPointName ]`: The recovery point name. + - `[ReplicatedProtectedItemName ]`: Replication protected item name. + - `[ResourceGroupName ]`: The name of the resource group where the recovery services vault is present. + - `[ResourceName ]`: The name of the recovery services vault. + - `[StorageClassificationMappingName ]`: Storage classification mapping name. + - `[StorageClassificationName ]`: Storage classification name. + - `[SubscriptionId ]`: The subscription Id. + - `[VaultSettingName ]`: Vault setting name. + - `[VcenterName ]`: vcenter name. + - `[VirtualMachineName ]`: Virtual Machine name. + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/Get-AzSiteRecoveryReplicationProtectionContainerMapping.md b/swaggerci/recoveryservicessiterecovery/docs/Get-AzSiteRecoveryReplicationProtectionContainerMapping.md new file mode 100644 index 000000000000..b6355fed605a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/Get-AzSiteRecoveryReplicationProtectionContainerMapping.md @@ -0,0 +1,241 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/get-azsiterecoveryreplicationprotectioncontainermapping +schema: 2.0.0 +--- + +# Get-AzSiteRecoveryReplicationProtectionContainerMapping + +## SYNOPSIS +Gets the details of a protection container mapping. + +## SYNTAX + +### List1 (Default) +``` +Get-AzSiteRecoveryReplicationProtectionContainerMapping -ResourceGroupName -ResourceName + [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### Get +``` +Get-AzSiteRecoveryReplicationProtectionContainerMapping -FabricName -MappingName + -ProtectionContainerName -ResourceGroupName -ResourceName + [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### GetViaIdentity +``` +Get-AzSiteRecoveryReplicationProtectionContainerMapping -InputObject + [-DefaultProfile ] [] +``` + +### List +``` +Get-AzSiteRecoveryReplicationProtectionContainerMapping -FabricName -ProtectionContainerName + -ResourceGroupName -ResourceName [-SubscriptionId ] [-DefaultProfile ] + [] +``` + +## DESCRIPTION +Gets the details of a protection container mapping. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FabricName +Fabric name. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +Parameter Sets: GetViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -MappingName +Protection Container mapping name. + +```yaml +Type: System.String +Parameter Sets: Get +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProtectionContainerName +Protection container name. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: Get, List, List1 +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: Get, List, List1 +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String[] +Parameter Sets: Get, List, List1 +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMapping + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`INPUTOBJECT `: Identity Parameter + - `[AlertSettingName ]`: The name of the email notification configuration. + - `[EventName ]`: The name of the Azure Site Recovery event. + - `[FabricName ]`: Fabric name. + - `[Id ]`: Resource identity path + - `[IntentObjectName ]`: Replication protection intent name. + - `[JobName ]`: Job identifier. + - `[LogicalNetworkName ]`: Logical network name. + - `[MappingName ]`: Protection Container mapping name. + - `[MigrationItemName ]`: Migration item name. + - `[MigrationRecoveryPointName ]`: The migration recovery point name. + - `[NetworkMappingName ]`: Network mapping name. + - `[NetworkName ]`: Primary network name. + - `[PolicyName ]`: Replication policy name. + - `[ProtectableItemName ]`: Protectable item name. + - `[ProtectionContainerName ]`: Protection container name. + - `[ProviderName ]`: Recovery services provider name. + - `[RecoveryPlanName ]`: Name of the recovery plan. + - `[RecoveryPointName ]`: The recovery point name. + - `[ReplicatedProtectedItemName ]`: Replication protected item name. + - `[ResourceGroupName ]`: The name of the resource group where the recovery services vault is present. + - `[ResourceName ]`: The name of the recovery services vault. + - `[StorageClassificationMappingName ]`: Storage classification mapping name. + - `[StorageClassificationName ]`: Storage classification name. + - `[SubscriptionId ]`: The subscription Id. + - `[VaultSettingName ]`: Vault setting name. + - `[VcenterName ]`: vcenter name. + - `[VirtualMachineName ]`: Virtual Machine name. + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/Get-AzSiteRecoveryReplicationProtectionIntent.md b/swaggerci/recoveryservicessiterecovery/docs/Get-AzSiteRecoveryReplicationProtectionIntent.md new file mode 100644 index 000000000000..93d1cbc7f1d7 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/Get-AzSiteRecoveryReplicationProtectionIntent.md @@ -0,0 +1,234 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/get-azsiterecoveryreplicationprotectionintent +schema: 2.0.0 +--- + +# Get-AzSiteRecoveryReplicationProtectionIntent + +## SYNOPSIS +Gets the details of an ASR replication protection intent. + +## SYNTAX + +### List (Default) +``` +Get-AzSiteRecoveryReplicationProtectionIntent -ResourceGroupName -ResourceName + [-SubscriptionId ] [-SkipToken ] [-TakeToken ] [-DefaultProfile ] + [] +``` + +### Get +``` +Get-AzSiteRecoveryReplicationProtectionIntent -IntentObjectName -ResourceGroupName + -ResourceName [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### GetViaIdentity +``` +Get-AzSiteRecoveryReplicationProtectionIntent -InputObject + [-DefaultProfile ] [] +``` + +## DESCRIPTION +Gets the details of an ASR replication protection intent. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +Parameter Sets: GetViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -IntentObjectName +Replication protection intent name. + +```yaml +Type: System.String +Parameter Sets: Get +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SkipToken +The pagination token. + +```yaml +Type: System.String +Parameter Sets: List +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String[] +Parameter Sets: Get, List +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TakeToken +The page size. + +```yaml +Type: System.String +Parameter Sets: List +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntent + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`INPUTOBJECT `: Identity Parameter + - `[AlertSettingName ]`: The name of the email notification configuration. + - `[EventName ]`: The name of the Azure Site Recovery event. + - `[FabricName ]`: Fabric name. + - `[Id ]`: Resource identity path + - `[IntentObjectName ]`: Replication protection intent name. + - `[JobName ]`: Job identifier. + - `[LogicalNetworkName ]`: Logical network name. + - `[MappingName ]`: Protection Container mapping name. + - `[MigrationItemName ]`: Migration item name. + - `[MigrationRecoveryPointName ]`: The migration recovery point name. + - `[NetworkMappingName ]`: Network mapping name. + - `[NetworkName ]`: Primary network name. + - `[PolicyName ]`: Replication policy name. + - `[ProtectableItemName ]`: Protectable item name. + - `[ProtectionContainerName ]`: Protection container name. + - `[ProviderName ]`: Recovery services provider name. + - `[RecoveryPlanName ]`: Name of the recovery plan. + - `[RecoveryPointName ]`: The recovery point name. + - `[ReplicatedProtectedItemName ]`: Replication protected item name. + - `[ResourceGroupName ]`: The name of the resource group where the recovery services vault is present. + - `[ResourceName ]`: The name of the recovery services vault. + - `[StorageClassificationMappingName ]`: Storage classification mapping name. + - `[StorageClassificationName ]`: Storage classification name. + - `[SubscriptionId ]`: The subscription Id. + - `[VaultSettingName ]`: Vault setting name. + - `[VcenterName ]`: vcenter name. + - `[VirtualMachineName ]`: Virtual Machine name. + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/Get-AzSiteRecoveryReplicationRecoveryPlan.md b/swaggerci/recoveryservicessiterecovery/docs/Get-AzSiteRecoveryReplicationRecoveryPlan.md new file mode 100644 index 000000000000..2a5b591e7748 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/Get-AzSiteRecoveryReplicationRecoveryPlan.md @@ -0,0 +1,203 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/get-azsiterecoveryreplicationrecoveryplan +schema: 2.0.0 +--- + +# Get-AzSiteRecoveryReplicationRecoveryPlan + +## SYNOPSIS +Gets the details of the recovery plan. + +## SYNTAX + +### List (Default) +``` +Get-AzSiteRecoveryReplicationRecoveryPlan -ResourceGroupName -ResourceName + [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### Get +``` +Get-AzSiteRecoveryReplicationRecoveryPlan -RecoveryPlanName -ResourceGroupName + -ResourceName [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### GetViaIdentity +``` +Get-AzSiteRecoveryReplicationRecoveryPlan -InputObject [-DefaultProfile ] + [] +``` + +## DESCRIPTION +Gets the details of the recovery plan. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +Parameter Sets: GetViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -RecoveryPlanName +Name of the recovery plan. + +```yaml +Type: System.String +Parameter Sets: Get +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String[] +Parameter Sets: Get, List +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`INPUTOBJECT `: Identity Parameter + - `[AlertSettingName ]`: The name of the email notification configuration. + - `[EventName ]`: The name of the Azure Site Recovery event. + - `[FabricName ]`: Fabric name. + - `[Id ]`: Resource identity path + - `[IntentObjectName ]`: Replication protection intent name. + - `[JobName ]`: Job identifier. + - `[LogicalNetworkName ]`: Logical network name. + - `[MappingName ]`: Protection Container mapping name. + - `[MigrationItemName ]`: Migration item name. + - `[MigrationRecoveryPointName ]`: The migration recovery point name. + - `[NetworkMappingName ]`: Network mapping name. + - `[NetworkName ]`: Primary network name. + - `[PolicyName ]`: Replication policy name. + - `[ProtectableItemName ]`: Protectable item name. + - `[ProtectionContainerName ]`: Protection container name. + - `[ProviderName ]`: Recovery services provider name. + - `[RecoveryPlanName ]`: Name of the recovery plan. + - `[RecoveryPointName ]`: The recovery point name. + - `[ReplicatedProtectedItemName ]`: Replication protected item name. + - `[ResourceGroupName ]`: The name of the resource group where the recovery services vault is present. + - `[ResourceName ]`: The name of the recovery services vault. + - `[StorageClassificationMappingName ]`: Storage classification mapping name. + - `[StorageClassificationName ]`: Storage classification name. + - `[SubscriptionId ]`: The subscription Id. + - `[VaultSettingName ]`: Vault setting name. + - `[VcenterName ]`: vcenter name. + - `[VirtualMachineName ]`: Virtual Machine name. + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/Get-AzSiteRecoveryReplicationRecoveryServiceProvider.md b/swaggerci/recoveryservicessiterecovery/docs/Get-AzSiteRecoveryReplicationRecoveryServiceProvider.md new file mode 100644 index 000000000000..b65d205e462e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/Get-AzSiteRecoveryReplicationRecoveryServiceProvider.md @@ -0,0 +1,138 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/get-azsiterecoveryreplicationrecoveryserviceprovider +schema: 2.0.0 +--- + +# Get-AzSiteRecoveryReplicationRecoveryServiceProvider + +## SYNOPSIS +Lists the registered recovery services providers for the specified fabric. + +## SYNTAX + +``` +Get-AzSiteRecoveryReplicationRecoveryServiceProvider -FabricName -ResourceGroupName + -ResourceName [-SubscriptionId ] [-DefaultProfile ] [] +``` + +## DESCRIPTION +Lists the registered recovery services providers for the specified fabric. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FabricName +Fabric name. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProvider + +## NOTES + +ALIASES + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/Get-AzSiteRecoveryReplicationRecoveryServicesProvider.md b/swaggerci/recoveryservicessiterecovery/docs/Get-AzSiteRecoveryReplicationRecoveryServicesProvider.md new file mode 100644 index 000000000000..c6db719864f1 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/Get-AzSiteRecoveryReplicationRecoveryServicesProvider.md @@ -0,0 +1,219 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/get-azsiterecoveryreplicationrecoveryservicesprovider +schema: 2.0.0 +--- + +# Get-AzSiteRecoveryReplicationRecoveryServicesProvider + +## SYNOPSIS +Gets the details of registered recovery services provider. + +## SYNTAX + +### List (Default) +``` +Get-AzSiteRecoveryReplicationRecoveryServicesProvider -ResourceGroupName -ResourceName + [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### Get +``` +Get-AzSiteRecoveryReplicationRecoveryServicesProvider -FabricName -ProviderName + -ResourceGroupName -ResourceName [-SubscriptionId ] [-DefaultProfile ] + [] +``` + +### GetViaIdentity +``` +Get-AzSiteRecoveryReplicationRecoveryServicesProvider -InputObject + [-DefaultProfile ] [] +``` + +## DESCRIPTION +Gets the details of registered recovery services provider. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FabricName +Fabric name. + +```yaml +Type: System.String +Parameter Sets: Get +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +Parameter Sets: GetViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -ProviderName +Recovery services provider name. + +```yaml +Type: System.String +Parameter Sets: Get +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String[] +Parameter Sets: Get, List +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProvider + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`INPUTOBJECT `: Identity Parameter + - `[AlertSettingName ]`: The name of the email notification configuration. + - `[EventName ]`: The name of the Azure Site Recovery event. + - `[FabricName ]`: Fabric name. + - `[Id ]`: Resource identity path + - `[IntentObjectName ]`: Replication protection intent name. + - `[JobName ]`: Job identifier. + - `[LogicalNetworkName ]`: Logical network name. + - `[MappingName ]`: Protection Container mapping name. + - `[MigrationItemName ]`: Migration item name. + - `[MigrationRecoveryPointName ]`: The migration recovery point name. + - `[NetworkMappingName ]`: Network mapping name. + - `[NetworkName ]`: Primary network name. + - `[PolicyName ]`: Replication policy name. + - `[ProtectableItemName ]`: Protectable item name. + - `[ProtectionContainerName ]`: Protection container name. + - `[ProviderName ]`: Recovery services provider name. + - `[RecoveryPlanName ]`: Name of the recovery plan. + - `[RecoveryPointName ]`: The recovery point name. + - `[ReplicatedProtectedItemName ]`: Replication protected item name. + - `[ResourceGroupName ]`: The name of the resource group where the recovery services vault is present. + - `[ResourceName ]`: The name of the recovery services vault. + - `[StorageClassificationMappingName ]`: Storage classification mapping name. + - `[StorageClassificationName ]`: Storage classification name. + - `[SubscriptionId ]`: The subscription Id. + - `[VaultSettingName ]`: Vault setting name. + - `[VcenterName ]`: vcenter name. + - `[VirtualMachineName ]`: Virtual Machine name. + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/Get-AzSiteRecoveryReplicationStorageClassification.md b/swaggerci/recoveryservicessiterecovery/docs/Get-AzSiteRecoveryReplicationStorageClassification.md new file mode 100644 index 000000000000..eb2a83a29e67 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/Get-AzSiteRecoveryReplicationStorageClassification.md @@ -0,0 +1,225 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/get-azsiterecoveryreplicationstorageclassification +schema: 2.0.0 +--- + +# Get-AzSiteRecoveryReplicationStorageClassification + +## SYNOPSIS +Gets the details of the specified storage classification. + +## SYNTAX + +### List1 (Default) +``` +Get-AzSiteRecoveryReplicationStorageClassification -ResourceGroupName -ResourceName + [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### Get +``` +Get-AzSiteRecoveryReplicationStorageClassification -FabricName -ResourceGroupName + -ResourceName -StorageClassificationName [-SubscriptionId ] + [-DefaultProfile ] [] +``` + +### GetViaIdentity +``` +Get-AzSiteRecoveryReplicationStorageClassification -InputObject + [-DefaultProfile ] [] +``` + +### List +``` +Get-AzSiteRecoveryReplicationStorageClassification -FabricName -ResourceGroupName + -ResourceName [-SubscriptionId ] [-DefaultProfile ] [] +``` + +## DESCRIPTION +Gets the details of the specified storage classification. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FabricName +Fabric name. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +Parameter Sets: GetViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: Get, List, List1 +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: Get, List, List1 +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -StorageClassificationName +Storage classification name. + +```yaml +Type: System.String +Parameter Sets: Get +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String[] +Parameter Sets: Get, List, List1 +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassification + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`INPUTOBJECT `: Identity Parameter + - `[AlertSettingName ]`: The name of the email notification configuration. + - `[EventName ]`: The name of the Azure Site Recovery event. + - `[FabricName ]`: Fabric name. + - `[Id ]`: Resource identity path + - `[IntentObjectName ]`: Replication protection intent name. + - `[JobName ]`: Job identifier. + - `[LogicalNetworkName ]`: Logical network name. + - `[MappingName ]`: Protection Container mapping name. + - `[MigrationItemName ]`: Migration item name. + - `[MigrationRecoveryPointName ]`: The migration recovery point name. + - `[NetworkMappingName ]`: Network mapping name. + - `[NetworkName ]`: Primary network name. + - `[PolicyName ]`: Replication policy name. + - `[ProtectableItemName ]`: Protectable item name. + - `[ProtectionContainerName ]`: Protection container name. + - `[ProviderName ]`: Recovery services provider name. + - `[RecoveryPlanName ]`: Name of the recovery plan. + - `[RecoveryPointName ]`: The recovery point name. + - `[ReplicatedProtectedItemName ]`: Replication protected item name. + - `[ResourceGroupName ]`: The name of the resource group where the recovery services vault is present. + - `[ResourceName ]`: The name of the recovery services vault. + - `[StorageClassificationMappingName ]`: Storage classification mapping name. + - `[StorageClassificationName ]`: Storage classification name. + - `[SubscriptionId ]`: The subscription Id. + - `[VaultSettingName ]`: Vault setting name. + - `[VcenterName ]`: vcenter name. + - `[VirtualMachineName ]`: Virtual Machine name. + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/Get-AzSiteRecoveryReplicationStorageClassificationMapping.md b/swaggerci/recoveryservicessiterecovery/docs/Get-AzSiteRecoveryReplicationStorageClassificationMapping.md new file mode 100644 index 000000000000..9a71be38a7fe --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/Get-AzSiteRecoveryReplicationStorageClassificationMapping.md @@ -0,0 +1,241 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/get-azsiterecoveryreplicationstorageclassificationmapping +schema: 2.0.0 +--- + +# Get-AzSiteRecoveryReplicationStorageClassificationMapping + +## SYNOPSIS +Gets the details of the specified storage classification mapping. + +## SYNTAX + +### List1 (Default) +``` +Get-AzSiteRecoveryReplicationStorageClassificationMapping -ResourceGroupName -ResourceName + [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### Get +``` +Get-AzSiteRecoveryReplicationStorageClassificationMapping -FabricName -ResourceGroupName + -ResourceName -StorageClassificationMappingName -StorageClassificationName + [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### GetViaIdentity +``` +Get-AzSiteRecoveryReplicationStorageClassificationMapping -InputObject + [-DefaultProfile ] [] +``` + +### List +``` +Get-AzSiteRecoveryReplicationStorageClassificationMapping -FabricName -ResourceGroupName + -ResourceName -StorageClassificationName [-SubscriptionId ] + [-DefaultProfile ] [] +``` + +## DESCRIPTION +Gets the details of the specified storage classification mapping. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FabricName +Fabric name. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +Parameter Sets: GetViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: Get, List, List1 +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: Get, List, List1 +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -StorageClassificationMappingName +Storage classification mapping name. + +```yaml +Type: System.String +Parameter Sets: Get +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -StorageClassificationName +Storage classification name. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String[] +Parameter Sets: Get, List, List1 +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMapping + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`INPUTOBJECT `: Identity Parameter + - `[AlertSettingName ]`: The name of the email notification configuration. + - `[EventName ]`: The name of the Azure Site Recovery event. + - `[FabricName ]`: Fabric name. + - `[Id ]`: Resource identity path + - `[IntentObjectName ]`: Replication protection intent name. + - `[JobName ]`: Job identifier. + - `[LogicalNetworkName ]`: Logical network name. + - `[MappingName ]`: Protection Container mapping name. + - `[MigrationItemName ]`: Migration item name. + - `[MigrationRecoveryPointName ]`: The migration recovery point name. + - `[NetworkMappingName ]`: Network mapping name. + - `[NetworkName ]`: Primary network name. + - `[PolicyName ]`: Replication policy name. + - `[ProtectableItemName ]`: Protectable item name. + - `[ProtectionContainerName ]`: Protection container name. + - `[ProviderName ]`: Recovery services provider name. + - `[RecoveryPlanName ]`: Name of the recovery plan. + - `[RecoveryPointName ]`: The recovery point name. + - `[ReplicatedProtectedItemName ]`: Replication protected item name. + - `[ResourceGroupName ]`: The name of the resource group where the recovery services vault is present. + - `[ResourceName ]`: The name of the recovery services vault. + - `[StorageClassificationMappingName ]`: Storage classification mapping name. + - `[StorageClassificationName ]`: Storage classification name. + - `[SubscriptionId ]`: The subscription Id. + - `[VaultSettingName ]`: Vault setting name. + - `[VcenterName ]`: vcenter name. + - `[VirtualMachineName ]`: Virtual Machine name. + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/Get-AzSiteRecoveryReplicationVaultHealth.md b/swaggerci/recoveryservicessiterecovery/docs/Get-AzSiteRecoveryReplicationVaultHealth.md new file mode 100644 index 000000000000..79743962a8de --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/Get-AzSiteRecoveryReplicationVaultHealth.md @@ -0,0 +1,182 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/get-azsiterecoveryreplicationvaulthealth +schema: 2.0.0 +--- + +# Get-AzSiteRecoveryReplicationVaultHealth + +## SYNOPSIS +Gets the health details of the vault. + +## SYNTAX + +### Get (Default) +``` +Get-AzSiteRecoveryReplicationVaultHealth -ResourceGroupName -ResourceName + [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### GetViaIdentity +``` +Get-AzSiteRecoveryReplicationVaultHealth -InputObject [-DefaultProfile ] + [] +``` + +## DESCRIPTION +Gets the health details of the vault. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +Parameter Sets: GetViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: Get +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: Get +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String[] +Parameter Sets: Get +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthDetails + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`INPUTOBJECT `: Identity Parameter + - `[AlertSettingName ]`: The name of the email notification configuration. + - `[EventName ]`: The name of the Azure Site Recovery event. + - `[FabricName ]`: Fabric name. + - `[Id ]`: Resource identity path + - `[IntentObjectName ]`: Replication protection intent name. + - `[JobName ]`: Job identifier. + - `[LogicalNetworkName ]`: Logical network name. + - `[MappingName ]`: Protection Container mapping name. + - `[MigrationItemName ]`: Migration item name. + - `[MigrationRecoveryPointName ]`: The migration recovery point name. + - `[NetworkMappingName ]`: Network mapping name. + - `[NetworkName ]`: Primary network name. + - `[PolicyName ]`: Replication policy name. + - `[ProtectableItemName ]`: Protectable item name. + - `[ProtectionContainerName ]`: Protection container name. + - `[ProviderName ]`: Recovery services provider name. + - `[RecoveryPlanName ]`: Name of the recovery plan. + - `[RecoveryPointName ]`: The recovery point name. + - `[ReplicatedProtectedItemName ]`: Replication protected item name. + - `[ResourceGroupName ]`: The name of the resource group where the recovery services vault is present. + - `[ResourceName ]`: The name of the recovery services vault. + - `[StorageClassificationMappingName ]`: Storage classification mapping name. + - `[StorageClassificationName ]`: Storage classification name. + - `[SubscriptionId ]`: The subscription Id. + - `[VaultSettingName ]`: Vault setting name. + - `[VcenterName ]`: vcenter name. + - `[VirtualMachineName ]`: Virtual Machine name. + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/Get-AzSiteRecoveryReplicationVaultSetting.md b/swaggerci/recoveryservicessiterecovery/docs/Get-AzSiteRecoveryReplicationVaultSetting.md new file mode 100644 index 000000000000..56317cd869a8 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/Get-AzSiteRecoveryReplicationVaultSetting.md @@ -0,0 +1,205 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/get-azsiterecoveryreplicationvaultsetting +schema: 2.0.0 +--- + +# Get-AzSiteRecoveryReplicationVaultSetting + +## SYNOPSIS +Gets the vault setting. +This includes the Migration Hub connection settings. + +## SYNTAX + +### List (Default) +``` +Get-AzSiteRecoveryReplicationVaultSetting -ResourceGroupName -ResourceName + [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### Get +``` +Get-AzSiteRecoveryReplicationVaultSetting -ResourceGroupName -ResourceName + -VaultSettingName [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### GetViaIdentity +``` +Get-AzSiteRecoveryReplicationVaultSetting -InputObject [-DefaultProfile ] + [] +``` + +## DESCRIPTION +Gets the vault setting. +This includes the Migration Hub connection settings. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +Parameter Sets: GetViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String[] +Parameter Sets: Get, List +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -VaultSettingName +Vault setting name. + +```yaml +Type: System.String +Parameter Sets: Get +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSetting + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`INPUTOBJECT `: Identity Parameter + - `[AlertSettingName ]`: The name of the email notification configuration. + - `[EventName ]`: The name of the Azure Site Recovery event. + - `[FabricName ]`: Fabric name. + - `[Id ]`: Resource identity path + - `[IntentObjectName ]`: Replication protection intent name. + - `[JobName ]`: Job identifier. + - `[LogicalNetworkName ]`: Logical network name. + - `[MappingName ]`: Protection Container mapping name. + - `[MigrationItemName ]`: Migration item name. + - `[MigrationRecoveryPointName ]`: The migration recovery point name. + - `[NetworkMappingName ]`: Network mapping name. + - `[NetworkName ]`: Primary network name. + - `[PolicyName ]`: Replication policy name. + - `[ProtectableItemName ]`: Protectable item name. + - `[ProtectionContainerName ]`: Protection container name. + - `[ProviderName ]`: Recovery services provider name. + - `[RecoveryPlanName ]`: Name of the recovery plan. + - `[RecoveryPointName ]`: The recovery point name. + - `[ReplicatedProtectedItemName ]`: Replication protected item name. + - `[ResourceGroupName ]`: The name of the resource group where the recovery services vault is present. + - `[ResourceName ]`: The name of the recovery services vault. + - `[StorageClassificationMappingName ]`: Storage classification mapping name. + - `[StorageClassificationName ]`: Storage classification name. + - `[SubscriptionId ]`: The subscription Id. + - `[VaultSettingName ]`: Vault setting name. + - `[VcenterName ]`: vcenter name. + - `[VirtualMachineName ]`: Virtual Machine name. + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/Get-AzSiteRecoveryReplicationvCenter.md b/swaggerci/recoveryservicessiterecovery/docs/Get-AzSiteRecoveryReplicationvCenter.md new file mode 100644 index 000000000000..95816a8eb38c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/Get-AzSiteRecoveryReplicationvCenter.md @@ -0,0 +1,224 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/get-azsiterecoveryreplicationvcenter +schema: 2.0.0 +--- + +# Get-AzSiteRecoveryReplicationvCenter + +## SYNOPSIS +Gets the details of a registered vCenter server(Add vCenter server). + +## SYNTAX + +### List1 (Default) +``` +Get-AzSiteRecoveryReplicationvCenter -ResourceGroupName -ResourceName + [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### Get +``` +Get-AzSiteRecoveryReplicationvCenter -FabricName -ResourceGroupName -ResourceName + -VcenterName [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### GetViaIdentity +``` +Get-AzSiteRecoveryReplicationvCenter -InputObject [-DefaultProfile ] + [] +``` + +### List +``` +Get-AzSiteRecoveryReplicationvCenter -FabricName -ResourceGroupName -ResourceName + [-SubscriptionId ] [-DefaultProfile ] [] +``` + +## DESCRIPTION +Gets the details of a registered vCenter server(Add vCenter server). + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FabricName +Fabric name. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +Parameter Sets: GetViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: Get, List, List1 +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: Get, List, List1 +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String[] +Parameter Sets: Get, List, List1 +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -VcenterName +vcenter name. + +```yaml +Type: System.String +Parameter Sets: Get +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenter + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`INPUTOBJECT `: Identity Parameter + - `[AlertSettingName ]`: The name of the email notification configuration. + - `[EventName ]`: The name of the Azure Site Recovery event. + - `[FabricName ]`: Fabric name. + - `[Id ]`: Resource identity path + - `[IntentObjectName ]`: Replication protection intent name. + - `[JobName ]`: Job identifier. + - `[LogicalNetworkName ]`: Logical network name. + - `[MappingName ]`: Protection Container mapping name. + - `[MigrationItemName ]`: Migration item name. + - `[MigrationRecoveryPointName ]`: The migration recovery point name. + - `[NetworkMappingName ]`: Network mapping name. + - `[NetworkName ]`: Primary network name. + - `[PolicyName ]`: Replication policy name. + - `[ProtectableItemName ]`: Protectable item name. + - `[ProtectionContainerName ]`: Protection container name. + - `[ProviderName ]`: Recovery services provider name. + - `[RecoveryPlanName ]`: Name of the recovery plan. + - `[RecoveryPointName ]`: The recovery point name. + - `[ReplicatedProtectedItemName ]`: Replication protected item name. + - `[ResourceGroupName ]`: The name of the resource group where the recovery services vault is present. + - `[ResourceName ]`: The name of the recovery services vault. + - `[StorageClassificationMappingName ]`: Storage classification mapping name. + - `[StorageClassificationName ]`: Storage classification name. + - `[SubscriptionId ]`: The subscription Id. + - `[VaultSettingName ]`: Vault setting name. + - `[VcenterName ]`: vcenter name. + - `[VirtualMachineName ]`: Virtual Machine name. + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/Get-AzSiteRecoverySupportedOperatingSystem.md b/swaggerci/recoveryservicessiterecovery/docs/Get-AzSiteRecoverySupportedOperatingSystem.md new file mode 100644 index 000000000000..9d1ae2eef312 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/Get-AzSiteRecoverySupportedOperatingSystem.md @@ -0,0 +1,197 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/get-azsiterecoverysupportedoperatingsystem +schema: 2.0.0 +--- + +# Get-AzSiteRecoverySupportedOperatingSystem + +## SYNOPSIS +Gets the data of supported operating systems by SRS. + +## SYNTAX + +### Get (Default) +``` +Get-AzSiteRecoverySupportedOperatingSystem -ResourceGroupName -ResourceName + [-SubscriptionId ] [-InstanceType ] [-DefaultProfile ] [] +``` + +### GetViaIdentity +``` +Get-AzSiteRecoverySupportedOperatingSystem -InputObject [-InstanceType ] + [-DefaultProfile ] [] +``` + +## DESCRIPTION +Gets the data of supported operating systems by SRS. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +Parameter Sets: GetViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -InstanceType +The instance type. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: Get +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: Get +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String[] +Parameter Sets: Get +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOperatingSystems + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`INPUTOBJECT `: Identity Parameter + - `[AlertSettingName ]`: The name of the email notification configuration. + - `[EventName ]`: The name of the Azure Site Recovery event. + - `[FabricName ]`: Fabric name. + - `[Id ]`: Resource identity path + - `[IntentObjectName ]`: Replication protection intent name. + - `[JobName ]`: Job identifier. + - `[LogicalNetworkName ]`: Logical network name. + - `[MappingName ]`: Protection Container mapping name. + - `[MigrationItemName ]`: Migration item name. + - `[MigrationRecoveryPointName ]`: The migration recovery point name. + - `[NetworkMappingName ]`: Network mapping name. + - `[NetworkName ]`: Primary network name. + - `[PolicyName ]`: Replication policy name. + - `[ProtectableItemName ]`: Protectable item name. + - `[ProtectionContainerName ]`: Protection container name. + - `[ProviderName ]`: Recovery services provider name. + - `[RecoveryPlanName ]`: Name of the recovery plan. + - `[RecoveryPointName ]`: The recovery point name. + - `[ReplicatedProtectedItemName ]`: Replication protected item name. + - `[ResourceGroupName ]`: The name of the resource group where the recovery services vault is present. + - `[ResourceName ]`: The name of the recovery services vault. + - `[StorageClassificationMappingName ]`: Storage classification mapping name. + - `[StorageClassificationName ]`: Storage classification name. + - `[SubscriptionId ]`: The subscription Id. + - `[VaultSettingName ]`: Vault setting name. + - `[VcenterName ]`: vcenter name. + - `[VirtualMachineName ]`: Virtual Machine name. + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/Get-AzSiteRecoveryTargetComputeSize.md b/swaggerci/recoveryservicessiterecovery/docs/Get-AzSiteRecoveryTargetComputeSize.md new file mode 100644 index 000000000000..283fcf67bec9 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/Get-AzSiteRecoveryTargetComputeSize.md @@ -0,0 +1,169 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/get-azsiterecoverytargetcomputesize +schema: 2.0.0 +--- + +# Get-AzSiteRecoveryTargetComputeSize + +## SYNOPSIS +Lists the available target compute sizes for a replication protected item. + +## SYNTAX + +``` +Get-AzSiteRecoveryTargetComputeSize -FabricName -ProtectionContainerName + -ReplicatedProtectedItemName -ResourceGroupName -ResourceName + [-SubscriptionId ] [-DefaultProfile ] [] +``` + +## DESCRIPTION +Lists the available target compute sizes for a replication protected item. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FabricName +Fabric name. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProtectionContainerName +protection container name. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ReplicatedProtectedItemName +Replication protected item name. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSize + +## NOTES + +ALIASES + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/Invoke-AzSiteRecoveryCommitReplicationProtectedItemFailover.md b/swaggerci/recoveryservicessiterecovery/docs/Invoke-AzSiteRecoveryCommitReplicationProtectedItemFailover.md new file mode 100644 index 000000000000..8815c9744491 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/Invoke-AzSiteRecoveryCommitReplicationProtectedItemFailover.md @@ -0,0 +1,290 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/invoke-azsiterecoverycommitreplicationprotecteditemfailover +schema: 2.0.0 +--- + +# Invoke-AzSiteRecoveryCommitReplicationProtectedItemFailover + +## SYNOPSIS +Operation to commit the failover of the replication protected item. + +## SYNTAX + +### Commit (Default) +``` +Invoke-AzSiteRecoveryCommitReplicationProtectedItemFailover -FabricName + -ProtectionContainerName -ReplicatedProtectedItemName -ResourceGroupName + -ResourceName [-SubscriptionId ] [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] + [-WhatIf] [] +``` + +### CommitViaIdentity +``` +Invoke-AzSiteRecoveryCommitReplicationProtectedItemFailover -InputObject + [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Operation to commit the failover of the replication protected item. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FabricName +Unique fabric name. + +```yaml +Type: System.String +Parameter Sets: Commit +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +Parameter Sets: CommitViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProtectionContainerName +Protection container name. + +```yaml +Type: System.String +Parameter Sets: Commit +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ReplicatedProtectedItemName +Replication protected item name. + +```yaml +Type: System.String +Parameter Sets: Commit +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: Commit +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: Commit +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String +Parameter Sets: Commit +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`INPUTOBJECT `: Identity Parameter + - `[AlertSettingName ]`: The name of the email notification configuration. + - `[EventName ]`: The name of the Azure Site Recovery event. + - `[FabricName ]`: Fabric name. + - `[Id ]`: Resource identity path + - `[IntentObjectName ]`: Replication protection intent name. + - `[JobName ]`: Job identifier. + - `[LogicalNetworkName ]`: Logical network name. + - `[MappingName ]`: Protection Container mapping name. + - `[MigrationItemName ]`: Migration item name. + - `[MigrationRecoveryPointName ]`: The migration recovery point name. + - `[NetworkMappingName ]`: Network mapping name. + - `[NetworkName ]`: Primary network name. + - `[PolicyName ]`: Replication policy name. + - `[ProtectableItemName ]`: Protectable item name. + - `[ProtectionContainerName ]`: Protection container name. + - `[ProviderName ]`: Recovery services provider name. + - `[RecoveryPlanName ]`: Name of the recovery plan. + - `[RecoveryPointName ]`: The recovery point name. + - `[ReplicatedProtectedItemName ]`: Replication protected item name. + - `[ResourceGroupName ]`: The name of the resource group where the recovery services vault is present. + - `[ResourceName ]`: The name of the recovery services vault. + - `[StorageClassificationMappingName ]`: Storage classification mapping name. + - `[StorageClassificationName ]`: Storage classification name. + - `[SubscriptionId ]`: The subscription Id. + - `[VaultSettingName ]`: Vault setting name. + - `[VcenterName ]`: vcenter name. + - `[VirtualMachineName ]`: Virtual Machine name. + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/Invoke-AzSiteRecoveryCommitReplicationRecoveryPlanFailover.md b/swaggerci/recoveryservicessiterecovery/docs/Invoke-AzSiteRecoveryCommitReplicationRecoveryPlanFailover.md new file mode 100644 index 000000000000..12b2f7982370 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/Invoke-AzSiteRecoveryCommitReplicationRecoveryPlanFailover.md @@ -0,0 +1,259 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/invoke-azsiterecoverycommitreplicationrecoveryplanfailover +schema: 2.0.0 +--- + +# Invoke-AzSiteRecoveryCommitReplicationRecoveryPlanFailover + +## SYNOPSIS +The operation to commit the failover of a recovery plan. + +## SYNTAX + +### Commit (Default) +``` +Invoke-AzSiteRecoveryCommitReplicationRecoveryPlanFailover -RecoveryPlanName + -ResourceGroupName -ResourceName [-SubscriptionId ] [-DefaultProfile ] + [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +### CommitViaIdentity +``` +Invoke-AzSiteRecoveryCommitReplicationRecoveryPlanFailover -InputObject + [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +The operation to commit the failover of a recovery plan. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +Parameter Sets: CommitViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -RecoveryPlanName +Recovery plan name. + +```yaml +Type: System.String +Parameter Sets: Commit +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: Commit +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: Commit +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String +Parameter Sets: Commit +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`INPUTOBJECT `: Identity Parameter + - `[AlertSettingName ]`: The name of the email notification configuration. + - `[EventName ]`: The name of the Azure Site Recovery event. + - `[FabricName ]`: Fabric name. + - `[Id ]`: Resource identity path + - `[IntentObjectName ]`: Replication protection intent name. + - `[JobName ]`: Job identifier. + - `[LogicalNetworkName ]`: Logical network name. + - `[MappingName ]`: Protection Container mapping name. + - `[MigrationItemName ]`: Migration item name. + - `[MigrationRecoveryPointName ]`: The migration recovery point name. + - `[NetworkMappingName ]`: Network mapping name. + - `[NetworkName ]`: Primary network name. + - `[PolicyName ]`: Replication policy name. + - `[ProtectableItemName ]`: Protectable item name. + - `[ProtectionContainerName ]`: Protection container name. + - `[ProviderName ]`: Recovery services provider name. + - `[RecoveryPlanName ]`: Name of the recovery plan. + - `[RecoveryPointName ]`: The recovery point name. + - `[ReplicatedProtectedItemName ]`: Replication protected item name. + - `[ResourceGroupName ]`: The name of the resource group where the recovery services vault is present. + - `[ResourceName ]`: The name of the recovery services vault. + - `[StorageClassificationMappingName ]`: Storage classification mapping name. + - `[StorageClassificationName ]`: Storage classification name. + - `[SubscriptionId ]`: The subscription Id. + - `[VaultSettingName ]`: Vault setting name. + - `[VcenterName ]`: vcenter name. + - `[VirtualMachineName ]`: Virtual Machine name. + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/Invoke-AzSiteRecoveryPlannedReplicationProtectedItemFailover.md b/swaggerci/recoveryservicessiterecovery/docs/Invoke-AzSiteRecoveryPlannedReplicationProtectedItemFailover.md new file mode 100644 index 000000000000..468c172e2e38 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/Invoke-AzSiteRecoveryPlannedReplicationProtectedItemFailover.md @@ -0,0 +1,359 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/invoke-azsiterecoveryplannedreplicationprotecteditemfailover +schema: 2.0.0 +--- + +# Invoke-AzSiteRecoveryPlannedReplicationProtectedItemFailover + +## SYNOPSIS +Operation to initiate a planned failover of the replication protected item. + +## SYNTAX + +### PlannedExpanded (Default) +``` +Invoke-AzSiteRecoveryPlannedReplicationProtectedItemFailover -FabricName + -ProtectionContainerName -ReplicatedProtectedItemName -ResourceGroupName + -ResourceName [-SubscriptionId ] [-FailoverDirection ] + [-ProviderSpecificDetailInstanceType ] [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] + [-WhatIf] [] +``` + +### Planned +``` +Invoke-AzSiteRecoveryPlannedReplicationProtectedItemFailover -FabricName + -ProtectionContainerName -ReplicatedProtectedItemName -ResourceGroupName + -ResourceName -FailoverInput [-SubscriptionId ] + [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +### PlannedViaIdentity +``` +Invoke-AzSiteRecoveryPlannedReplicationProtectedItemFailover -InputObject + -FailoverInput [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] + [] +``` + +### PlannedViaIdentityExpanded +``` +Invoke-AzSiteRecoveryPlannedReplicationProtectedItemFailover -InputObject + [-FailoverDirection ] [-ProviderSpecificDetailInstanceType ] [-DefaultProfile ] + [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Operation to initiate a planned failover of the replication protected item. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FabricName +Unique fabric name. + +```yaml +Type: System.String +Parameter Sets: Planned, PlannedExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FailoverDirection +Failover direction. + +```yaml +Type: System.String +Parameter Sets: PlannedExpanded, PlannedViaIdentityExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FailoverInput +Input definition for planned failover. +To construct, see NOTES section for FAILOVERINPUT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverInput +Parameter Sets: Planned, PlannedViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +Parameter Sets: PlannedViaIdentity, PlannedViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProtectionContainerName +Protection container name. + +```yaml +Type: System.String +Parameter Sets: Planned, PlannedExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProviderSpecificDetailInstanceType +The class type. + +```yaml +Type: System.String +Parameter Sets: PlannedExpanded, PlannedViaIdentityExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ReplicatedProtectedItemName +Replication protected item name. + +```yaml +Type: System.String +Parameter Sets: Planned, PlannedExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: Planned, PlannedExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: Planned, PlannedExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String +Parameter Sets: Planned, PlannedExpanded +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverInput + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`FAILOVERINPUT `: Input definition for planned failover. + - `[FailoverDirection ]`: Failover direction. + - `[ProviderSpecificDetailInstanceType ]`: The class type. + +`INPUTOBJECT `: Identity Parameter + - `[AlertSettingName ]`: The name of the email notification configuration. + - `[EventName ]`: The name of the Azure Site Recovery event. + - `[FabricName ]`: Fabric name. + - `[Id ]`: Resource identity path + - `[IntentObjectName ]`: Replication protection intent name. + - `[JobName ]`: Job identifier. + - `[LogicalNetworkName ]`: Logical network name. + - `[MappingName ]`: Protection Container mapping name. + - `[MigrationItemName ]`: Migration item name. + - `[MigrationRecoveryPointName ]`: The migration recovery point name. + - `[NetworkMappingName ]`: Network mapping name. + - `[NetworkName ]`: Primary network name. + - `[PolicyName ]`: Replication policy name. + - `[ProtectableItemName ]`: Protectable item name. + - `[ProtectionContainerName ]`: Protection container name. + - `[ProviderName ]`: Recovery services provider name. + - `[RecoveryPlanName ]`: Name of the recovery plan. + - `[RecoveryPointName ]`: The recovery point name. + - `[ReplicatedProtectedItemName ]`: Replication protected item name. + - `[ResourceGroupName ]`: The name of the resource group where the recovery services vault is present. + - `[ResourceName ]`: The name of the recovery services vault. + - `[StorageClassificationMappingName ]`: Storage classification mapping name. + - `[StorageClassificationName ]`: Storage classification name. + - `[SubscriptionId ]`: The subscription Id. + - `[VaultSettingName ]`: Vault setting name. + - `[VcenterName ]`: vcenter name. + - `[VirtualMachineName ]`: Virtual Machine name. + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/Invoke-AzSiteRecoveryPlannedReplicationRecoveryPlanFailover.md b/swaggerci/recoveryservicessiterecovery/docs/Invoke-AzSiteRecoveryPlannedReplicationRecoveryPlanFailover.md new file mode 100644 index 000000000000..85875069b63c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/Invoke-AzSiteRecoveryPlannedReplicationRecoveryPlanFailover.md @@ -0,0 +1,334 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/invoke-azsiterecoveryplannedreplicationrecoveryplanfailover +schema: 2.0.0 +--- + +# Invoke-AzSiteRecoveryPlannedReplicationRecoveryPlanFailover + +## SYNOPSIS +The operation to start the planned failover of a recovery plan. + +## SYNTAX + +### PlannedExpanded (Default) +``` +Invoke-AzSiteRecoveryPlannedReplicationRecoveryPlanFailover -RecoveryPlanName + -ResourceGroupName -ResourceName -FailoverDirection + [-SubscriptionId ] [-ProviderSpecificDetail ] + [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +### Planned +``` +Invoke-AzSiteRecoveryPlannedReplicationRecoveryPlanFailover -RecoveryPlanName + -ResourceGroupName -ResourceName -Input + [-SubscriptionId ] [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] + [] +``` + +### PlannedViaIdentity +``` +Invoke-AzSiteRecoveryPlannedReplicationRecoveryPlanFailover -InputObject + -Input [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] + [-WhatIf] [] +``` + +### PlannedViaIdentityExpanded +``` +Invoke-AzSiteRecoveryPlannedReplicationRecoveryPlanFailover -InputObject + -FailoverDirection + [-ProviderSpecificDetail ] [-DefaultProfile ] + [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +The operation to start the planned failover of a recovery plan. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FailoverDirection +The failover direction. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections +Parameter Sets: PlannedExpanded, PlannedViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Input +Recovery plan planned failover input. +To construct, see NOTES section for INPUT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPlannedFailoverInput +Parameter Sets: Planned, PlannedViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +Parameter Sets: PlannedViaIdentity, PlannedViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProviderSpecificDetail +The provider specific properties. +To construct, see NOTES section for PROVIDERSPECIFICDETAIL properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInput[] +Parameter Sets: PlannedExpanded, PlannedViaIdentityExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -RecoveryPlanName +Recovery plan name. + +```yaml +Type: System.String +Parameter Sets: Planned, PlannedExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: Planned, PlannedExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: Planned, PlannedExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String +Parameter Sets: Planned, PlannedExpanded +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPlannedFailoverInput + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`INPUT `: Recovery plan planned failover input. + - `FailoverDirection `: The failover direction. + - `[ProviderSpecificDetail ]`: The provider specific properties. + - `InstanceType `: The class type. + +`INPUTOBJECT `: Identity Parameter + - `[AlertSettingName ]`: The name of the email notification configuration. + - `[EventName ]`: The name of the Azure Site Recovery event. + - `[FabricName ]`: Fabric name. + - `[Id ]`: Resource identity path + - `[IntentObjectName ]`: Replication protection intent name. + - `[JobName ]`: Job identifier. + - `[LogicalNetworkName ]`: Logical network name. + - `[MappingName ]`: Protection Container mapping name. + - `[MigrationItemName ]`: Migration item name. + - `[MigrationRecoveryPointName ]`: The migration recovery point name. + - `[NetworkMappingName ]`: Network mapping name. + - `[NetworkName ]`: Primary network name. + - `[PolicyName ]`: Replication policy name. + - `[ProtectableItemName ]`: Protectable item name. + - `[ProtectionContainerName ]`: Protection container name. + - `[ProviderName ]`: Recovery services provider name. + - `[RecoveryPlanName ]`: Name of the recovery plan. + - `[RecoveryPointName ]`: The recovery point name. + - `[ReplicatedProtectedItemName ]`: Replication protected item name. + - `[ResourceGroupName ]`: The name of the resource group where the recovery services vault is present. + - `[ResourceName ]`: The name of the recovery services vault. + - `[StorageClassificationMappingName ]`: Storage classification mapping name. + - `[StorageClassificationName ]`: Storage classification name. + - `[SubscriptionId ]`: The subscription Id. + - `[VaultSettingName ]`: Vault setting name. + - `[VcenterName ]`: vcenter name. + - `[VirtualMachineName ]`: Virtual Machine name. + +`PROVIDERSPECIFICDETAIL `: The provider specific properties. + - `InstanceType `: The class type. + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/Invoke-AzSiteRecoveryRenewReplicationFabricCertificate.md b/swaggerci/recoveryservicessiterecovery/docs/Invoke-AzSiteRecoveryRenewReplicationFabricCertificate.md new file mode 100644 index 000000000000..b15fb6f2a4a1 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/Invoke-AzSiteRecoveryRenewReplicationFabricCertificate.md @@ -0,0 +1,310 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/invoke-azsiterecoveryrenewreplicationfabriccertificate +schema: 2.0.0 +--- + +# Invoke-AzSiteRecoveryRenewReplicationFabricCertificate + +## SYNOPSIS +Renews the connection certificate for the ASR replication fabric. + +## SYNTAX + +### RenewExpanded (Default) +``` +Invoke-AzSiteRecoveryRenewReplicationFabricCertificate -FabricName -ResourceGroupName + -ResourceName [-SubscriptionId ] [-RenewCertificateType ] + [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +### Renew +``` +Invoke-AzSiteRecoveryRenewReplicationFabricCertificate -FabricName -ResourceGroupName + -ResourceName -RenewCertificate [-SubscriptionId ] + [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +### RenewViaIdentity +``` +Invoke-AzSiteRecoveryRenewReplicationFabricCertificate -InputObject + -RenewCertificate [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] + [-WhatIf] [] +``` + +### RenewViaIdentityExpanded +``` +Invoke-AzSiteRecoveryRenewReplicationFabricCertificate -InputObject + [-RenewCertificateType ] [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] + [] +``` + +## DESCRIPTION +Renews the connection certificate for the ASR replication fabric. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FabricName +fabric name to renew certs for. + +```yaml +Type: System.String +Parameter Sets: Renew, RenewExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +Parameter Sets: RenewViaIdentity, RenewViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -RenewCertificate +Certificate renewal input. +To construct, see NOTES section for RENEWCERTIFICATE properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRenewCertificateInput +Parameter Sets: Renew, RenewViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -RenewCertificateType +Renew certificate type. + +```yaml +Type: System.String +Parameter Sets: RenewExpanded, RenewViaIdentityExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: Renew, RenewExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: Renew, RenewExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String +Parameter Sets: Renew, RenewExpanded +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRenewCertificateInput + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabric + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`INPUTOBJECT `: Identity Parameter + - `[AlertSettingName ]`: The name of the email notification configuration. + - `[EventName ]`: The name of the Azure Site Recovery event. + - `[FabricName ]`: Fabric name. + - `[Id ]`: Resource identity path + - `[IntentObjectName ]`: Replication protection intent name. + - `[JobName ]`: Job identifier. + - `[LogicalNetworkName ]`: Logical network name. + - `[MappingName ]`: Protection Container mapping name. + - `[MigrationItemName ]`: Migration item name. + - `[MigrationRecoveryPointName ]`: The migration recovery point name. + - `[NetworkMappingName ]`: Network mapping name. + - `[NetworkName ]`: Primary network name. + - `[PolicyName ]`: Replication policy name. + - `[ProtectableItemName ]`: Protectable item name. + - `[ProtectionContainerName ]`: Protection container name. + - `[ProviderName ]`: Recovery services provider name. + - `[RecoveryPlanName ]`: Name of the recovery plan. + - `[RecoveryPointName ]`: The recovery point name. + - `[ReplicatedProtectedItemName ]`: Replication protected item name. + - `[ResourceGroupName ]`: The name of the resource group where the recovery services vault is present. + - `[ResourceName ]`: The name of the recovery services vault. + - `[StorageClassificationMappingName ]`: Storage classification mapping name. + - `[StorageClassificationName ]`: Storage classification name. + - `[SubscriptionId ]`: The subscription Id. + - `[VaultSettingName ]`: Vault setting name. + - `[VcenterName ]`: vcenter name. + - `[VirtualMachineName ]`: Virtual Machine name. + +`RENEWCERTIFICATE `: Certificate renewal input. + - `[RenewCertificateType ]`: Renew certificate type. + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/Invoke-AzSiteRecoveryReprotectReplicationProtectedItem.md b/swaggerci/recoveryservicessiterecovery/docs/Invoke-AzSiteRecoveryReprotectReplicationProtectedItem.md new file mode 100644 index 000000000000..dc5cf3fb1771 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/Invoke-AzSiteRecoveryReprotectReplicationProtectedItem.md @@ -0,0 +1,358 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/invoke-azsiterecoveryreprotectreplicationprotecteditem +schema: 2.0.0 +--- + +# Invoke-AzSiteRecoveryReprotectReplicationProtectedItem + +## SYNOPSIS +Operation to reprotect or reverse replicate a failed over replication protected item. + +## SYNTAX + +### ReprotectExpanded (Default) +``` +Invoke-AzSiteRecoveryReprotectReplicationProtectedItem -FabricName -ProtectionContainerName + -ReplicatedProtectedItemName -ResourceGroupName -ResourceName + [-SubscriptionId ] [-FailoverDirection ] [-ProviderSpecificDetailInstanceType ] + [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +### Reprotect +``` +Invoke-AzSiteRecoveryReprotectReplicationProtectedItem -FabricName -ProtectionContainerName + -ReplicatedProtectedItemName -ResourceGroupName -ResourceName + -ReprotectInput [-SubscriptionId ] [-DefaultProfile ] [-AsJob] + [-NoWait] [-Confirm] [-WhatIf] [] +``` + +### ReprotectViaIdentity +``` +Invoke-AzSiteRecoveryReprotectReplicationProtectedItem -InputObject + -ReprotectInput [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] + [-WhatIf] [] +``` + +### ReprotectViaIdentityExpanded +``` +Invoke-AzSiteRecoveryReprotectReplicationProtectedItem -InputObject + [-FailoverDirection ] [-ProviderSpecificDetailInstanceType ] [-DefaultProfile ] + [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Operation to reprotect or reverse replicate a failed over replication protected item. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FabricName +Unique fabric name. + +```yaml +Type: System.String +Parameter Sets: Reprotect, ReprotectExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FailoverDirection +Failover direction. + +```yaml +Type: System.String +Parameter Sets: ReprotectExpanded, ReprotectViaIdentityExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +Parameter Sets: ReprotectViaIdentity, ReprotectViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProtectionContainerName +Protection container name. + +```yaml +Type: System.String +Parameter Sets: Reprotect, ReprotectExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProviderSpecificDetailInstanceType +The class type. + +```yaml +Type: System.String +Parameter Sets: ReprotectExpanded, ReprotectViaIdentityExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ReplicatedProtectedItemName +Replication protected item name. + +```yaml +Type: System.String +Parameter Sets: Reprotect, ReprotectExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ReprotectInput +Reverse replication input. +To construct, see NOTES section for REPROTECTINPUT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationInput +Parameter Sets: Reprotect, ReprotectViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: Reprotect, ReprotectExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: Reprotect, ReprotectExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String +Parameter Sets: Reprotect, ReprotectExpanded +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationInput + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`INPUTOBJECT `: Identity Parameter + - `[AlertSettingName ]`: The name of the email notification configuration. + - `[EventName ]`: The name of the Azure Site Recovery event. + - `[FabricName ]`: Fabric name. + - `[Id ]`: Resource identity path + - `[IntentObjectName ]`: Replication protection intent name. + - `[JobName ]`: Job identifier. + - `[LogicalNetworkName ]`: Logical network name. + - `[MappingName ]`: Protection Container mapping name. + - `[MigrationItemName ]`: Migration item name. + - `[MigrationRecoveryPointName ]`: The migration recovery point name. + - `[NetworkMappingName ]`: Network mapping name. + - `[NetworkName ]`: Primary network name. + - `[PolicyName ]`: Replication policy name. + - `[ProtectableItemName ]`: Protectable item name. + - `[ProtectionContainerName ]`: Protection container name. + - `[ProviderName ]`: Recovery services provider name. + - `[RecoveryPlanName ]`: Name of the recovery plan. + - `[RecoveryPointName ]`: The recovery point name. + - `[ReplicatedProtectedItemName ]`: Replication protected item name. + - `[ResourceGroupName ]`: The name of the resource group where the recovery services vault is present. + - `[ResourceName ]`: The name of the recovery services vault. + - `[StorageClassificationMappingName ]`: Storage classification mapping name. + - `[StorageClassificationName ]`: Storage classification name. + - `[SubscriptionId ]`: The subscription Id. + - `[VaultSettingName ]`: Vault setting name. + - `[VcenterName ]`: vcenter name. + - `[VirtualMachineName ]`: Virtual Machine name. + +`REPROTECTINPUT `: Reverse replication input. + - `[FailoverDirection ]`: Failover direction. + - `[ProviderSpecificDetailInstanceType ]`: The class type. + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/Invoke-AzSiteRecoveryReprotectReplicationRecoveryPlan.md b/swaggerci/recoveryservicessiterecovery/docs/Invoke-AzSiteRecoveryReprotectReplicationRecoveryPlan.md new file mode 100644 index 000000000000..c72e4d9b8ee6 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/Invoke-AzSiteRecoveryReprotectReplicationRecoveryPlan.md @@ -0,0 +1,259 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/invoke-azsiterecoveryreprotectreplicationrecoveryplan +schema: 2.0.0 +--- + +# Invoke-AzSiteRecoveryReprotectReplicationRecoveryPlan + +## SYNOPSIS +The operation to reprotect(reverse replicate) a recovery plan. + +## SYNTAX + +### Reprotect (Default) +``` +Invoke-AzSiteRecoveryReprotectReplicationRecoveryPlan -RecoveryPlanName -ResourceGroupName + -ResourceName [-SubscriptionId ] [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] + [-WhatIf] [] +``` + +### ReprotectViaIdentity +``` +Invoke-AzSiteRecoveryReprotectReplicationRecoveryPlan -InputObject + [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +The operation to reprotect(reverse replicate) a recovery plan. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +Parameter Sets: ReprotectViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -RecoveryPlanName +Recovery plan name. + +```yaml +Type: System.String +Parameter Sets: Reprotect +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: Reprotect +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: Reprotect +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String +Parameter Sets: Reprotect +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`INPUTOBJECT `: Identity Parameter + - `[AlertSettingName ]`: The name of the email notification configuration. + - `[EventName ]`: The name of the Azure Site Recovery event. + - `[FabricName ]`: Fabric name. + - `[Id ]`: Resource identity path + - `[IntentObjectName ]`: Replication protection intent name. + - `[JobName ]`: Job identifier. + - `[LogicalNetworkName ]`: Logical network name. + - `[MappingName ]`: Protection Container mapping name. + - `[MigrationItemName ]`: Migration item name. + - `[MigrationRecoveryPointName ]`: The migration recovery point name. + - `[NetworkMappingName ]`: Network mapping name. + - `[NetworkName ]`: Primary network name. + - `[PolicyName ]`: Replication policy name. + - `[ProtectableItemName ]`: Protectable item name. + - `[ProtectionContainerName ]`: Protection container name. + - `[ProviderName ]`: Recovery services provider name. + - `[RecoveryPlanName ]`: Name of the recovery plan. + - `[RecoveryPointName ]`: The recovery point name. + - `[ReplicatedProtectedItemName ]`: Replication protected item name. + - `[ResourceGroupName ]`: The name of the resource group where the recovery services vault is present. + - `[ResourceName ]`: The name of the recovery services vault. + - `[StorageClassificationMappingName ]`: Storage classification mapping name. + - `[StorageClassificationName ]`: Storage classification name. + - `[SubscriptionId ]`: The subscription Id. + - `[VaultSettingName ]`: Vault setting name. + - `[VcenterName ]`: vcenter name. + - `[VirtualMachineName ]`: Virtual Machine name. + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/Invoke-AzSiteRecoveryResyncReplicationMigrationItem.md b/swaggerci/recoveryservicessiterecovery/docs/Invoke-AzSiteRecoveryResyncReplicationMigrationItem.md new file mode 100644 index 000000000000..723008f9b571 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/Invoke-AzSiteRecoveryResyncReplicationMigrationItem.md @@ -0,0 +1,341 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/invoke-azsiterecoveryresyncreplicationmigrationitem +schema: 2.0.0 +--- + +# Invoke-AzSiteRecoveryResyncReplicationMigrationItem + +## SYNOPSIS +The operation to resynchronize replication of an ASR migration item. + +## SYNTAX + +### ResyncExpanded (Default) +``` +Invoke-AzSiteRecoveryResyncReplicationMigrationItem -FabricName -MigrationItemName + -ProtectionContainerName -ResourceGroupName -ResourceName + -ProviderSpecificDetailInstanceType [-SubscriptionId ] [-DefaultProfile ] [-AsJob] + [-NoWait] [-Confirm] [-WhatIf] [] +``` + +### Resync +``` +Invoke-AzSiteRecoveryResyncReplicationMigrationItem -FabricName -MigrationItemName + -ProtectionContainerName -ResourceGroupName -ResourceName -Input + [-SubscriptionId ] [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] + [] +``` + +### ResyncViaIdentity +``` +Invoke-AzSiteRecoveryResyncReplicationMigrationItem -InputObject -Input + [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +### ResyncViaIdentityExpanded +``` +Invoke-AzSiteRecoveryResyncReplicationMigrationItem -InputObject + -ProviderSpecificDetailInstanceType [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] + [-WhatIf] [] +``` + +## DESCRIPTION +The operation to resynchronize replication of an ASR migration item. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FabricName +Fabric name. + +```yaml +Type: System.String +Parameter Sets: Resync, ResyncExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Input +Resync input. +To construct, see NOTES section for INPUT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncInput +Parameter Sets: Resync, ResyncViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +Parameter Sets: ResyncViaIdentity, ResyncViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -MigrationItemName +Migration item name. + +```yaml +Type: System.String +Parameter Sets: Resync, ResyncExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProtectionContainerName +Protection container name. + +```yaml +Type: System.String +Parameter Sets: Resync, ResyncExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProviderSpecificDetailInstanceType +The class type. + +```yaml +Type: System.String +Parameter Sets: ResyncExpanded, ResyncViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: Resync, ResyncExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: Resync, ResyncExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String +Parameter Sets: Resync, ResyncExpanded +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncInput + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`INPUT `: Resync input. + - `ProviderSpecificDetailInstanceType `: The class type. + +`INPUTOBJECT `: Identity Parameter + - `[AlertSettingName ]`: The name of the email notification configuration. + - `[EventName ]`: The name of the Azure Site Recovery event. + - `[FabricName ]`: Fabric name. + - `[Id ]`: Resource identity path + - `[IntentObjectName ]`: Replication protection intent name. + - `[JobName ]`: Job identifier. + - `[LogicalNetworkName ]`: Logical network name. + - `[MappingName ]`: Protection Container mapping name. + - `[MigrationItemName ]`: Migration item name. + - `[MigrationRecoveryPointName ]`: The migration recovery point name. + - `[NetworkMappingName ]`: Network mapping name. + - `[NetworkName ]`: Primary network name. + - `[PolicyName ]`: Replication policy name. + - `[ProtectableItemName ]`: Protectable item name. + - `[ProtectionContainerName ]`: Protection container name. + - `[ProviderName ]`: Recovery services provider name. + - `[RecoveryPlanName ]`: Name of the recovery plan. + - `[RecoveryPointName ]`: The recovery point name. + - `[ReplicatedProtectedItemName ]`: Replication protected item name. + - `[ResourceGroupName ]`: The name of the resource group where the recovery services vault is present. + - `[ResourceName ]`: The name of the recovery services vault. + - `[StorageClassificationMappingName ]`: Storage classification mapping name. + - `[StorageClassificationName ]`: Storage classification name. + - `[SubscriptionId ]`: The subscription Id. + - `[VaultSettingName ]`: Vault setting name. + - `[VcenterName ]`: vcenter name. + - `[VirtualMachineName ]`: Virtual Machine name. + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/Invoke-AzSiteRecoveryUnplannedReplicationProtectedItemFailover.md b/swaggerci/recoveryservicessiterecovery/docs/Invoke-AzSiteRecoveryUnplannedReplicationProtectedItemFailover.md new file mode 100644 index 000000000000..9d7de6ae8995 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/Invoke-AzSiteRecoveryUnplannedReplicationProtectedItemFailover.md @@ -0,0 +1,375 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/invoke-azsiterecoveryunplannedreplicationprotecteditemfailover +schema: 2.0.0 +--- + +# Invoke-AzSiteRecoveryUnplannedReplicationProtectedItemFailover + +## SYNOPSIS +Operation to initiate a failover of the replication protected item. + +## SYNTAX + +### UnplannedExpanded (Default) +``` +Invoke-AzSiteRecoveryUnplannedReplicationProtectedItemFailover -FabricName + -ProtectionContainerName -ReplicatedProtectedItemName -ResourceGroupName + -ResourceName [-SubscriptionId ] [-FailoverDirection ] + [-ProviderSpecificDetailInstanceType ] [-SourceSiteOperation ] [-DefaultProfile ] + [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +### Unplanned +``` +Invoke-AzSiteRecoveryUnplannedReplicationProtectedItemFailover -FabricName + -ProtectionContainerName -ReplicatedProtectedItemName -ResourceGroupName + -ResourceName -FailoverInput [-SubscriptionId ] + [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +### UnplannedViaIdentity +``` +Invoke-AzSiteRecoveryUnplannedReplicationProtectedItemFailover -InputObject + -FailoverInput [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] + [] +``` + +### UnplannedViaIdentityExpanded +``` +Invoke-AzSiteRecoveryUnplannedReplicationProtectedItemFailover -InputObject + [-FailoverDirection ] [-ProviderSpecificDetailInstanceType ] [-SourceSiteOperation ] + [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Operation to initiate a failover of the replication protected item. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FabricName +Unique fabric name. + +```yaml +Type: System.String +Parameter Sets: Unplanned, UnplannedExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FailoverDirection +Failover direction. + +```yaml +Type: System.String +Parameter Sets: UnplannedExpanded, UnplannedViaIdentityExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FailoverInput +Input definition for unplanned failover. +To construct, see NOTES section for FAILOVERINPUT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverInput +Parameter Sets: Unplanned, UnplannedViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +Parameter Sets: UnplannedViaIdentity, UnplannedViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProtectionContainerName +Protection container name. + +```yaml +Type: System.String +Parameter Sets: Unplanned, UnplannedExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProviderSpecificDetailInstanceType +The class type. + +```yaml +Type: System.String +Parameter Sets: UnplannedExpanded, UnplannedViaIdentityExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ReplicatedProtectedItemName +Replication protected item name. + +```yaml +Type: System.String +Parameter Sets: Unplanned, UnplannedExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: Unplanned, UnplannedExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: Unplanned, UnplannedExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SourceSiteOperation +Source site operations status. + +```yaml +Type: System.String +Parameter Sets: UnplannedExpanded, UnplannedViaIdentityExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String +Parameter Sets: Unplanned, UnplannedExpanded +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverInput + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`FAILOVERINPUT `: Input definition for unplanned failover. + - `[FailoverDirection ]`: Failover direction. + - `[ProviderSpecificDetailInstanceType ]`: The class type. + - `[SourceSiteOperation ]`: Source site operations status. + +`INPUTOBJECT `: Identity Parameter + - `[AlertSettingName ]`: The name of the email notification configuration. + - `[EventName ]`: The name of the Azure Site Recovery event. + - `[FabricName ]`: Fabric name. + - `[Id ]`: Resource identity path + - `[IntentObjectName ]`: Replication protection intent name. + - `[JobName ]`: Job identifier. + - `[LogicalNetworkName ]`: Logical network name. + - `[MappingName ]`: Protection Container mapping name. + - `[MigrationItemName ]`: Migration item name. + - `[MigrationRecoveryPointName ]`: The migration recovery point name. + - `[NetworkMappingName ]`: Network mapping name. + - `[NetworkName ]`: Primary network name. + - `[PolicyName ]`: Replication policy name. + - `[ProtectableItemName ]`: Protectable item name. + - `[ProtectionContainerName ]`: Protection container name. + - `[ProviderName ]`: Recovery services provider name. + - `[RecoveryPlanName ]`: Name of the recovery plan. + - `[RecoveryPointName ]`: The recovery point name. + - `[ReplicatedProtectedItemName ]`: Replication protected item name. + - `[ResourceGroupName ]`: The name of the resource group where the recovery services vault is present. + - `[ResourceName ]`: The name of the recovery services vault. + - `[StorageClassificationMappingName ]`: Storage classification mapping name. + - `[StorageClassificationName ]`: Storage classification name. + - `[SubscriptionId ]`: The subscription Id. + - `[VaultSettingName ]`: Vault setting name. + - `[VcenterName ]`: vcenter name. + - `[VirtualMachineName ]`: Virtual Machine name. + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/Invoke-AzSiteRecoveryUnplannedReplicationRecoveryPlanFailover.md b/swaggerci/recoveryservicessiterecovery/docs/Invoke-AzSiteRecoveryUnplannedReplicationRecoveryPlanFailover.md new file mode 100644 index 000000000000..953c016d30fc --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/Invoke-AzSiteRecoveryUnplannedReplicationRecoveryPlanFailover.md @@ -0,0 +1,351 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/invoke-azsiterecoveryunplannedreplicationrecoveryplanfailover +schema: 2.0.0 +--- + +# Invoke-AzSiteRecoveryUnplannedReplicationRecoveryPlanFailover + +## SYNOPSIS +The operation to start the unplanned failover of a recovery plan. + +## SYNTAX + +### UnplannedExpanded (Default) +``` +Invoke-AzSiteRecoveryUnplannedReplicationRecoveryPlanFailover -RecoveryPlanName + -ResourceGroupName -ResourceName -FailoverDirection + -SourceSiteOperation [-SubscriptionId ] + [-ProviderSpecificDetail ] [-DefaultProfile ] + [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +### Unplanned +``` +Invoke-AzSiteRecoveryUnplannedReplicationRecoveryPlanFailover -RecoveryPlanName + -ResourceGroupName -ResourceName -Input + [-SubscriptionId ] [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] + [] +``` + +### UnplannedViaIdentity +``` +Invoke-AzSiteRecoveryUnplannedReplicationRecoveryPlanFailover -InputObject + -Input [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] + [-WhatIf] [] +``` + +### UnplannedViaIdentityExpanded +``` +Invoke-AzSiteRecoveryUnplannedReplicationRecoveryPlanFailover -InputObject + -FailoverDirection -SourceSiteOperation + [-ProviderSpecificDetail ] [-DefaultProfile ] + [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +The operation to start the unplanned failover of a recovery plan. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FailoverDirection +The failover direction. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections +Parameter Sets: UnplannedExpanded, UnplannedViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Input +Recovery plan unplanned failover input. +To construct, see NOTES section for INPUT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanUnplannedFailoverInput +Parameter Sets: Unplanned, UnplannedViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +Parameter Sets: UnplannedViaIdentity, UnplannedViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProviderSpecificDetail +The provider specific properties. +To construct, see NOTES section for PROVIDERSPECIFICDETAIL properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInput[] +Parameter Sets: UnplannedExpanded, UnplannedViaIdentityExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -RecoveryPlanName +Recovery plan name. + +```yaml +Type: System.String +Parameter Sets: Unplanned, UnplannedExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: Unplanned, UnplannedExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: Unplanned, UnplannedExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SourceSiteOperation +A value indicating whether source site operations are required. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SourceSiteOperations +Parameter Sets: UnplannedExpanded, UnplannedViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String +Parameter Sets: Unplanned, UnplannedExpanded +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanUnplannedFailoverInput + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`INPUT `: Recovery plan unplanned failover input. + - `FailoverDirection `: The failover direction. + - `SourceSiteOperation `: A value indicating whether source site operations are required. + - `[ProviderSpecificDetail ]`: The provider specific properties. + - `InstanceType `: The class type. + +`INPUTOBJECT `: Identity Parameter + - `[AlertSettingName ]`: The name of the email notification configuration. + - `[EventName ]`: The name of the Azure Site Recovery event. + - `[FabricName ]`: Fabric name. + - `[Id ]`: Resource identity path + - `[IntentObjectName ]`: Replication protection intent name. + - `[JobName ]`: Job identifier. + - `[LogicalNetworkName ]`: Logical network name. + - `[MappingName ]`: Protection Container mapping name. + - `[MigrationItemName ]`: Migration item name. + - `[MigrationRecoveryPointName ]`: The migration recovery point name. + - `[NetworkMappingName ]`: Network mapping name. + - `[NetworkName ]`: Primary network name. + - `[PolicyName ]`: Replication policy name. + - `[ProtectableItemName ]`: Protectable item name. + - `[ProtectionContainerName ]`: Protection container name. + - `[ProviderName ]`: Recovery services provider name. + - `[RecoveryPlanName ]`: Name of the recovery plan. + - `[RecoveryPointName ]`: The recovery point name. + - `[ReplicatedProtectedItemName ]`: Replication protected item name. + - `[ResourceGroupName ]`: The name of the resource group where the recovery services vault is present. + - `[ResourceName ]`: The name of the recovery services vault. + - `[StorageClassificationMappingName ]`: Storage classification mapping name. + - `[StorageClassificationName ]`: Storage classification name. + - `[SubscriptionId ]`: The subscription Id. + - `[VaultSettingName ]`: Vault setting name. + - `[VcenterName ]`: vcenter name. + - `[VirtualMachineName ]`: Virtual Machine name. + +`PROVIDERSPECIFICDETAIL `: The provider specific properties. + - `InstanceType `: The class type. + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/Move-AzSiteRecoveryReplicationFabricGateway.md b/swaggerci/recoveryservicessiterecovery/docs/Move-AzSiteRecoveryReplicationFabricGateway.md new file mode 100644 index 000000000000..34658e677852 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/Move-AzSiteRecoveryReplicationFabricGateway.md @@ -0,0 +1,378 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/move-azsiterecoveryreplicationfabricgateway +schema: 2.0.0 +--- + +# Move-AzSiteRecoveryReplicationFabricGateway + +## SYNOPSIS +The operation to move replications from a process server to another process server. + +## SYNTAX + +### ReassociateExpanded (Default) +``` +Move-AzSiteRecoveryReplicationFabricGateway -FabricName -ResourceGroupName + -ResourceName [-SubscriptionId ] [-ContainerName ] [-SourceProcessServerId ] + [-TargetProcessServerId ] [-UpdateType ] [-VmsToMigrate ] + [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +### Reassociate +``` +Move-AzSiteRecoveryReplicationFabricGateway -FabricName -ResourceGroupName + -ResourceName -FailoverProcessServerRequest + [-SubscriptionId ] [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] + [] +``` + +### ReassociateViaIdentity +``` +Move-AzSiteRecoveryReplicationFabricGateway -InputObject + -FailoverProcessServerRequest [-DefaultProfile ] [-AsJob] [-NoWait] + [-Confirm] [-WhatIf] [] +``` + +### ReassociateViaIdentityExpanded +``` +Move-AzSiteRecoveryReplicationFabricGateway -InputObject [-ContainerName ] + [-SourceProcessServerId ] [-TargetProcessServerId ] [-UpdateType ] + [-VmsToMigrate ] [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] + [] +``` + +## DESCRIPTION +The operation to move replications from a process server to another process server. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ContainerName +The container identifier. + +```yaml +Type: System.String +Parameter Sets: ReassociateExpanded, ReassociateViaIdentityExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FabricName +The name of the fabric containing the process server. + +```yaml +Type: System.String +Parameter Sets: Reassociate, ReassociateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FailoverProcessServerRequest +Request to failover a process server. +To construct, see NOTES section for FAILOVERPROCESSSERVERREQUEST properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverProcessServerRequest +Parameter Sets: Reassociate, ReassociateViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +Parameter Sets: ReassociateViaIdentity, ReassociateViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: Reassociate, ReassociateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: Reassociate, ReassociateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SourceProcessServerId +The source process server. + +```yaml +Type: System.String +Parameter Sets: ReassociateExpanded, ReassociateViaIdentityExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String +Parameter Sets: Reassociate, ReassociateExpanded +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TargetProcessServerId +The new process server. + +```yaml +Type: System.String +Parameter Sets: ReassociateExpanded, ReassociateViaIdentityExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -UpdateType +A value for failover type. +It can be systemlevel/serverlevel. + +```yaml +Type: System.String +Parameter Sets: ReassociateExpanded, ReassociateViaIdentityExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -VmsToMigrate +The VMS to migrate. + +```yaml +Type: System.String[] +Parameter Sets: ReassociateExpanded, ReassociateViaIdentityExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverProcessServerRequest + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabric + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`FAILOVERPROCESSSERVERREQUEST `: Request to failover a process server. + - `[ContainerName ]`: The container identifier. + - `[SourceProcessServerId ]`: The source process server. + - `[TargetProcessServerId ]`: The new process server. + - `[UpdateType ]`: A value for failover type. It can be systemlevel/serverlevel. + - `[VmsToMigrate ]`: The VMS to migrate. + +`INPUTOBJECT `: Identity Parameter + - `[AlertSettingName ]`: The name of the email notification configuration. + - `[EventName ]`: The name of the Azure Site Recovery event. + - `[FabricName ]`: Fabric name. + - `[Id ]`: Resource identity path + - `[IntentObjectName ]`: Replication protection intent name. + - `[JobName ]`: Job identifier. + - `[LogicalNetworkName ]`: Logical network name. + - `[MappingName ]`: Protection Container mapping name. + - `[MigrationItemName ]`: Migration item name. + - `[MigrationRecoveryPointName ]`: The migration recovery point name. + - `[NetworkMappingName ]`: Network mapping name. + - `[NetworkName ]`: Primary network name. + - `[PolicyName ]`: Replication policy name. + - `[ProtectableItemName ]`: Protectable item name. + - `[ProtectionContainerName ]`: Protection container name. + - `[ProviderName ]`: Recovery services provider name. + - `[RecoveryPlanName ]`: Name of the recovery plan. + - `[RecoveryPointName ]`: The recovery point name. + - `[ReplicatedProtectedItemName ]`: Replication protected item name. + - `[ResourceGroupName ]`: The name of the resource group where the recovery services vault is present. + - `[ResourceName ]`: The name of the recovery services vault. + - `[StorageClassificationMappingName ]`: Storage classification mapping name. + - `[StorageClassificationName ]`: Storage classification name. + - `[SubscriptionId ]`: The subscription Id. + - `[VaultSettingName ]`: Vault setting name. + - `[VcenterName ]`: vcenter name. + - `[VirtualMachineName ]`: Virtual Machine name. + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/Move-AzSiteRecoveryReplicationFabricToAad.md b/swaggerci/recoveryservicessiterecovery/docs/Move-AzSiteRecoveryReplicationFabricToAad.md new file mode 100644 index 000000000000..4062652186c1 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/Move-AzSiteRecoveryReplicationFabricToAad.md @@ -0,0 +1,274 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/move-azsiterecoveryreplicationfabrictoaad +schema: 2.0.0 +--- + +# Move-AzSiteRecoveryReplicationFabricToAad + +## SYNOPSIS +The operation to migrate an Azure Site Recovery fabric to AAD. + +## SYNTAX + +### Migrate (Default) +``` +Move-AzSiteRecoveryReplicationFabricToAad -FabricName -ResourceGroupName + -ResourceName [-SubscriptionId ] [-DefaultProfile ] [-AsJob] [-NoWait] [-PassThru] + [-Confirm] [-WhatIf] [] +``` + +### MigrateViaIdentity +``` +Move-AzSiteRecoveryReplicationFabricToAad -InputObject [-DefaultProfile ] + [-AsJob] [-NoWait] [-PassThru] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +The operation to migrate an Azure Site Recovery fabric to AAD. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FabricName +ASR fabric to migrate. + +```yaml +Type: System.String +Parameter Sets: Migrate +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +Parameter Sets: MigrateViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PassThru +Returns true when the command succeeds + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: Migrate +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: Migrate +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String +Parameter Sets: Migrate +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity + +## OUTPUTS + +### System.Boolean + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`INPUTOBJECT `: Identity Parameter + - `[AlertSettingName ]`: The name of the email notification configuration. + - `[EventName ]`: The name of the Azure Site Recovery event. + - `[FabricName ]`: Fabric name. + - `[Id ]`: Resource identity path + - `[IntentObjectName ]`: Replication protection intent name. + - `[JobName ]`: Job identifier. + - `[LogicalNetworkName ]`: Logical network name. + - `[MappingName ]`: Protection Container mapping name. + - `[MigrationItemName ]`: Migration item name. + - `[MigrationRecoveryPointName ]`: The migration recovery point name. + - `[NetworkMappingName ]`: Network mapping name. + - `[NetworkName ]`: Primary network name. + - `[PolicyName ]`: Replication policy name. + - `[ProtectableItemName ]`: Protectable item name. + - `[ProtectionContainerName ]`: Protection container name. + - `[ProviderName ]`: Recovery services provider name. + - `[RecoveryPlanName ]`: Name of the recovery plan. + - `[RecoveryPointName ]`: The recovery point name. + - `[ReplicatedProtectedItemName ]`: Replication protected item name. + - `[ResourceGroupName ]`: The name of the resource group where the recovery services vault is present. + - `[ResourceName ]`: The name of the recovery services vault. + - `[StorageClassificationMappingName ]`: Storage classification mapping name. + - `[StorageClassificationName ]`: Storage classification name. + - `[SubscriptionId ]`: The subscription Id. + - `[VaultSettingName ]`: Vault setting name. + - `[VcenterName ]`: vcenter name. + - `[VirtualMachineName ]`: Virtual Machine name. + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/Move-AzSiteRecoveryReplicationMigrationItem.md b/swaggerci/recoveryservicessiterecovery/docs/Move-AzSiteRecoveryReplicationMigrationItem.md new file mode 100644 index 000000000000..b5eb7fef9c59 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/Move-AzSiteRecoveryReplicationMigrationItem.md @@ -0,0 +1,341 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/move-azsiterecoveryreplicationmigrationitem +schema: 2.0.0 +--- + +# Move-AzSiteRecoveryReplicationMigrationItem + +## SYNOPSIS +The operation to initiate migration of the item. + +## SYNTAX + +### MigrateExpanded (Default) +``` +Move-AzSiteRecoveryReplicationMigrationItem -FabricName -MigrationItemName + -ProtectionContainerName -ResourceGroupName -ResourceName + -ProviderSpecificDetailInstanceType [-SubscriptionId ] [-DefaultProfile ] [-AsJob] + [-NoWait] [-Confirm] [-WhatIf] [] +``` + +### Migrate +``` +Move-AzSiteRecoveryReplicationMigrationItem -FabricName -MigrationItemName + -ProtectionContainerName -ResourceGroupName -ResourceName + -MigrateInput [-SubscriptionId ] [-DefaultProfile ] [-AsJob] [-NoWait] + [-Confirm] [-WhatIf] [] +``` + +### MigrateViaIdentity +``` +Move-AzSiteRecoveryReplicationMigrationItem -InputObject -MigrateInput + [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +### MigrateViaIdentityExpanded +``` +Move-AzSiteRecoveryReplicationMigrationItem -InputObject + -ProviderSpecificDetailInstanceType [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] + [-WhatIf] [] +``` + +## DESCRIPTION +The operation to initiate migration of the item. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FabricName +Fabric name. + +```yaml +Type: System.String +Parameter Sets: Migrate, MigrateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +Parameter Sets: MigrateViaIdentity, MigrateViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -MigrateInput +Input for migrate. +To construct, see NOTES section for MIGRATEINPUT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateInput +Parameter Sets: Migrate, MigrateViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -MigrationItemName +Migration item name. + +```yaml +Type: System.String +Parameter Sets: Migrate, MigrateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProtectionContainerName +Protection container name. + +```yaml +Type: System.String +Parameter Sets: Migrate, MigrateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProviderSpecificDetailInstanceType +The class type. + +```yaml +Type: System.String +Parameter Sets: MigrateExpanded, MigrateViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: Migrate, MigrateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: Migrate, MigrateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String +Parameter Sets: Migrate, MigrateExpanded +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateInput + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`INPUTOBJECT `: Identity Parameter + - `[AlertSettingName ]`: The name of the email notification configuration. + - `[EventName ]`: The name of the Azure Site Recovery event. + - `[FabricName ]`: Fabric name. + - `[Id ]`: Resource identity path + - `[IntentObjectName ]`: Replication protection intent name. + - `[JobName ]`: Job identifier. + - `[LogicalNetworkName ]`: Logical network name. + - `[MappingName ]`: Protection Container mapping name. + - `[MigrationItemName ]`: Migration item name. + - `[MigrationRecoveryPointName ]`: The migration recovery point name. + - `[NetworkMappingName ]`: Network mapping name. + - `[NetworkName ]`: Primary network name. + - `[PolicyName ]`: Replication policy name. + - `[ProtectableItemName ]`: Protectable item name. + - `[ProtectionContainerName ]`: Protection container name. + - `[ProviderName ]`: Recovery services provider name. + - `[RecoveryPlanName ]`: Name of the recovery plan. + - `[RecoveryPointName ]`: The recovery point name. + - `[ReplicatedProtectedItemName ]`: Replication protected item name. + - `[ResourceGroupName ]`: The name of the resource group where the recovery services vault is present. + - `[ResourceName ]`: The name of the recovery services vault. + - `[StorageClassificationMappingName ]`: Storage classification mapping name. + - `[StorageClassificationName ]`: Storage classification name. + - `[SubscriptionId ]`: The subscription Id. + - `[VaultSettingName ]`: Vault setting name. + - `[VcenterName ]`: vcenter name. + - `[VirtualMachineName ]`: Virtual Machine name. + +`MIGRATEINPUT `: Input for migrate. + - `ProviderSpecificDetailInstanceType `: The class type. + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/New-AzSiteRecoveryReplicationAlertSetting.md b/swaggerci/recoveryservicessiterecovery/docs/New-AzSiteRecoveryReplicationAlertSetting.md new file mode 100644 index 000000000000..f1e866486a7f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/New-AzSiteRecoveryReplicationAlertSetting.md @@ -0,0 +1,215 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/new-azsiterecoveryreplicationalertsetting +schema: 2.0.0 +--- + +# New-AzSiteRecoveryReplicationAlertSetting + +## SYNOPSIS +Create or update an email notification(alert) configuration. + +## SYNTAX + +``` +New-AzSiteRecoveryReplicationAlertSetting -AlertSettingName -ResourceGroupName + -ResourceName [-SubscriptionId ] [-CustomEmailAddress ] [-Locale ] + [-SendToOwner ] [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Create or update an email notification(alert) configuration. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -AlertSettingName +The name of the email notification(alert) configuration. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -CustomEmailAddress +The custom email address for sending emails. + +```yaml +Type: System.String[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Locale +The locale for the email notification. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SendToOwner +A value indicating whether to send email to subscription administrator. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlert + +## NOTES + +ALIASES + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/New-AzSiteRecoveryReplicationFabric.md b/swaggerci/recoveryservicessiterecovery/docs/New-AzSiteRecoveryReplicationFabric.md new file mode 100644 index 000000000000..0ab3ed5d0901 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/New-AzSiteRecoveryReplicationFabric.md @@ -0,0 +1,217 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/new-azsiterecoveryreplicationfabric +schema: 2.0.0 +--- + +# New-AzSiteRecoveryReplicationFabric + +## SYNOPSIS +The operation to create an Azure Site Recovery fabric (for e.g. +Hyper-V site). + +## SYNTAX + +``` +New-AzSiteRecoveryReplicationFabric -FabricName -ResourceGroupName -ResourceName + [-SubscriptionId ] [-CustomDetailInstanceType ] [-DefaultProfile ] [-AsJob] + [-NoWait] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +The operation to create an Azure Site Recovery fabric (for e.g. +Hyper-V site). + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -CustomDetailInstanceType +Gets the class type. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FabricName +Name of the ASR fabric. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabric + +## NOTES + +ALIASES + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/New-AzSiteRecoveryReplicationMigrationItem.md b/swaggerci/recoveryservicessiterecovery/docs/New-AzSiteRecoveryReplicationMigrationItem.md new file mode 100644 index 000000000000..277bbe75ff68 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/New-AzSiteRecoveryReplicationMigrationItem.md @@ -0,0 +1,261 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/new-azsiterecoveryreplicationmigrationitem +schema: 2.0.0 +--- + +# New-AzSiteRecoveryReplicationMigrationItem + +## SYNOPSIS +The operation to create an ASR migration item (enable migration). + +## SYNTAX + +``` +New-AzSiteRecoveryReplicationMigrationItem -FabricName -MigrationItemName + -ProtectionContainerName -ResourceGroupName -ResourceName -PolicyId + -ProviderSpecificDetailInstanceType [-SubscriptionId ] [-DefaultProfile ] [-AsJob] + [-NoWait] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +The operation to create an ASR migration item (enable migration). + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FabricName +Fabric name. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -MigrationItemName +Migration item name. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PolicyId +The policy Id. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProtectionContainerName +Protection container name. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProviderSpecificDetailInstanceType +The class type. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem + +## NOTES + +ALIASES + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/New-AzSiteRecoveryReplicationNetworkMapping.md b/swaggerci/recoveryservicessiterecovery/docs/New-AzSiteRecoveryReplicationNetworkMapping.md new file mode 100644 index 000000000000..68e0f862a703 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/New-AzSiteRecoveryReplicationNetworkMapping.md @@ -0,0 +1,276 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/new-azsiterecoveryreplicationnetworkmapping +schema: 2.0.0 +--- + +# New-AzSiteRecoveryReplicationNetworkMapping + +## SYNOPSIS +The operation to create an ASR network mapping. + +## SYNTAX + +``` +New-AzSiteRecoveryReplicationNetworkMapping -FabricName -NetworkMappingName + -NetworkName -ResourceGroupName -ResourceName -RecoveryNetworkId + [-SubscriptionId ] [-FabricSpecificDetailInstanceType ] [-RecoveryFabricName ] + [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +The operation to create an ASR network mapping. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FabricName +Primary fabric name. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FabricSpecificDetailInstanceType +The instance type. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NetworkMappingName +Network mapping name. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NetworkName +Primary network name. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -RecoveryFabricName +Recovery fabric Name. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -RecoveryNetworkId +Recovery network Id. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMapping + +## NOTES + +ALIASES + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/New-AzSiteRecoveryReplicationPolicy.md b/swaggerci/recoveryservicessiterecovery/docs/New-AzSiteRecoveryReplicationPolicy.md new file mode 100644 index 000000000000..7fe8e3e53c69 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/New-AzSiteRecoveryReplicationPolicy.md @@ -0,0 +1,215 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/new-azsiterecoveryreplicationpolicy +schema: 2.0.0 +--- + +# New-AzSiteRecoveryReplicationPolicy + +## SYNOPSIS +The operation to create a replication policy. + +## SYNTAX + +``` +New-AzSiteRecoveryReplicationPolicy -PolicyName -ResourceGroupName -ResourceName + [-SubscriptionId ] [-ProviderSpecificInputInstanceType ] [-DefaultProfile ] + [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +The operation to create a replication policy. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PolicyName +Replication policy name. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProviderSpecificInputInstanceType +The class type. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicy + +## NOTES + +ALIASES + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/New-AzSiteRecoveryReplicationProtectedItem.md b/swaggerci/recoveryservicessiterecovery/docs/New-AzSiteRecoveryReplicationProtectedItem.md new file mode 100644 index 000000000000..e4aaaf7ef23e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/New-AzSiteRecoveryReplicationProtectedItem.md @@ -0,0 +1,277 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/new-azsiterecoveryreplicationprotecteditem +schema: 2.0.0 +--- + +# New-AzSiteRecoveryReplicationProtectedItem + +## SYNOPSIS +The operation to create an ASR replication protected item (Enable replication). + +## SYNTAX + +``` +New-AzSiteRecoveryReplicationProtectedItem -FabricName -ProtectionContainerName + -ReplicatedProtectedItemName -ResourceGroupName -ResourceName + [-SubscriptionId ] [-PolicyId ] [-ProtectableItemId ] + [-ProviderSpecificDetailInstanceType ] [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] + [-WhatIf] [] +``` + +## DESCRIPTION +The operation to create an ASR replication protected item (Enable replication). + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FabricName +Name of the fabric. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PolicyId +The Policy Id. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProtectableItemId +The protectable item Id. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProtectionContainerName +Protection container name. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProviderSpecificDetailInstanceType +The class type. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ReplicatedProtectedItemName +A name for the replication protected item. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + +## NOTES + +ALIASES + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/New-AzSiteRecoveryReplicationProtectionContainer.md b/swaggerci/recoveryservicessiterecovery/docs/New-AzSiteRecoveryReplicationProtectionContainer.md new file mode 100644 index 000000000000..2e45a7c209fc --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/New-AzSiteRecoveryReplicationProtectionContainer.md @@ -0,0 +1,240 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/new-azsiterecoveryreplicationprotectioncontainer +schema: 2.0.0 +--- + +# New-AzSiteRecoveryReplicationProtectionContainer + +## SYNOPSIS +Operation to create a protection container. + +## SYNTAX + +``` +New-AzSiteRecoveryReplicationProtectionContainer -FabricName -ProtectionContainerName + -ResourceGroupName -ResourceName [-SubscriptionId ] + [-ProviderSpecificInput ] [-DefaultProfile ] + [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Operation to create a protection container. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FabricName +Unique fabric ARM name. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProtectionContainerName +Unique protection container ARM name. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProviderSpecificInput +Provider specific inputs for container creation. +To construct, see NOTES section for PROVIDERSPECIFICINPUT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerCreationInput[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainer + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`PROVIDERSPECIFICINPUT `: Provider specific inputs for container creation. + - `InstanceType `: The class type. + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/New-AzSiteRecoveryReplicationProtectionContainerMapping.md b/swaggerci/recoveryservicessiterecovery/docs/New-AzSiteRecoveryReplicationProtectionContainerMapping.md new file mode 100644 index 000000000000..1c98d32cc488 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/New-AzSiteRecoveryReplicationProtectionContainerMapping.md @@ -0,0 +1,277 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/new-azsiterecoveryreplicationprotectioncontainermapping +schema: 2.0.0 +--- + +# New-AzSiteRecoveryReplicationProtectionContainerMapping + +## SYNOPSIS +The operation to create a protection container mapping. + +## SYNTAX + +``` +New-AzSiteRecoveryReplicationProtectionContainerMapping -FabricName -MappingName + -ProtectionContainerName -ResourceGroupName -ResourceName + [-SubscriptionId ] [-PolicyId ] [-ProviderSpecificInputInstanceType ] + [-TargetProtectionContainerId ] [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] + [] +``` + +## DESCRIPTION +The operation to create a protection container mapping. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FabricName +Fabric name. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -MappingName +Protection container mapping name. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PolicyId +Applicable policy. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProtectionContainerName +Protection container name. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProviderSpecificInputInstanceType +The class type. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TargetProtectionContainerId +The target unique protection container name. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMapping + +## NOTES + +ALIASES + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/New-AzSiteRecoveryReplicationProtectionIntent.md b/swaggerci/recoveryservicessiterecovery/docs/New-AzSiteRecoveryReplicationProtectionIntent.md new file mode 100644 index 000000000000..fb43016ba9fc --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/New-AzSiteRecoveryReplicationProtectionIntent.md @@ -0,0 +1,185 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/new-azsiterecoveryreplicationprotectionintent +schema: 2.0.0 +--- + +# New-AzSiteRecoveryReplicationProtectionIntent + +## SYNOPSIS +The operation to create an ASR replication protection intent item. + +## SYNTAX + +``` +New-AzSiteRecoveryReplicationProtectionIntent -IntentObjectName -ResourceGroupName + -ResourceName [-SubscriptionId ] [-ProviderSpecificDetailInstanceType ] + [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +The operation to create an ASR replication protection intent item. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -IntentObjectName +A name for the replication protection item. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProviderSpecificDetailInstanceType +The class type. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntent + +## NOTES + +ALIASES + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/New-AzSiteRecoveryReplicationRecoveryPlan.md b/swaggerci/recoveryservicessiterecovery/docs/New-AzSiteRecoveryReplicationRecoveryPlan.md new file mode 100644 index 000000000000..1cede57938e2 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/New-AzSiteRecoveryReplicationRecoveryPlan.md @@ -0,0 +1,299 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/new-azsiterecoveryreplicationrecoveryplan +schema: 2.0.0 +--- + +# New-AzSiteRecoveryReplicationRecoveryPlan + +## SYNOPSIS +The operation to create a recovery plan. + +## SYNTAX + +``` +New-AzSiteRecoveryReplicationRecoveryPlan -RecoveryPlanName -ResourceGroupName + -ResourceName -Group -PrimaryFabricId -RecoveryFabricId + [-SubscriptionId ] [-FailoverDeploymentModel ] + [-ProviderSpecificInput ] [-DefaultProfile ] [-AsJob] + [-NoWait] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +The operation to create a recovery plan. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FailoverDeploymentModel +The failover deployment model. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.FailoverDeploymentModel +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Group +The recovery plan groups. +To construct, see NOTES section for GROUP properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroup[] +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PrimaryFabricId +The primary fabric Id. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProviderSpecificInput +The provider specific input. +To construct, see NOTES section for PROVIDERSPECIFICINPUT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificInput[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -RecoveryFabricId +The recovery fabric Id. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -RecoveryPlanName +Recovery plan name. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`GROUP `: The recovery plan groups. + - `GroupType `: The group type. + - `[EndGroupAction ]`: The end group actions. + - `ActionName `: The action name. + - `CustomDetailInstanceType `: Gets the type of action details (see RecoveryPlanActionDetailsTypes enum for possible values). + - `FailoverDirection `: The list of failover directions. + - `FailoverType `: The list of failover types. + - `[ReplicationProtectedItem ]`: The list of protected items. + - `[Id ]`: The ARM Id of the recovery plan protected item. + - `[VirtualMachineId ]`: The virtual machine Id. + - `[StartGroupAction ]`: The start group actions. + +`PROVIDERSPECIFICINPUT `: The provider specific input. + - `InstanceType `: Gets the Instance type. + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/New-AzSiteRecoveryReplicationRecoveryServicesProvider.md b/swaggerci/recoveryservicessiterecovery/docs/New-AzSiteRecoveryReplicationRecoveryServicesProvider.md new file mode 100644 index 000000000000..d13897e3866c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/New-AzSiteRecoveryReplicationRecoveryServicesProvider.md @@ -0,0 +1,495 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/new-azsiterecoveryreplicationrecoveryservicesprovider +schema: 2.0.0 +--- + +# New-AzSiteRecoveryReplicationRecoveryServicesProvider + +## SYNOPSIS +The operation to add a recovery services provider. + +## SYNTAX + +``` +New-AzSiteRecoveryReplicationRecoveryServicesProvider -FabricName -ProviderName + -ResourceGroupName -ResourceName -AuthenticationIdentityInputAadAuthority + -AuthenticationIdentityInputApplicationId -AuthenticationIdentityInputAudience + -AuthenticationIdentityInputObjectId -AuthenticationIdentityInputTenantId + -MachineName -ResourceAccessIdentityInputAadAuthority + -ResourceAccessIdentityInputApplicationId -ResourceAccessIdentityInputAudience + -ResourceAccessIdentityInputObjectId -ResourceAccessIdentityInputTenantId + [-SubscriptionId ] [-BiosId ] [-DataPlaneAuthenticationIdentityInputAadAuthority ] + [-DataPlaneAuthenticationIdentityInputApplicationId ] + [-DataPlaneAuthenticationIdentityInputAudience ] + [-DataPlaneAuthenticationIdentityInputObjectId ] + [-DataPlaneAuthenticationIdentityInputTenantId ] [-MachineId ] [-DefaultProfile ] + [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +The operation to add a recovery services provider. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -AuthenticationIdentityInputAadAuthority +The base authority for Azure Active Directory authentication. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -AuthenticationIdentityInputApplicationId +The application/client Id for the service principal with which the on-premise management/data plane components would communicate with our Azure services. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -AuthenticationIdentityInputAudience +The intended Audience of the service principal with which the on-premise management/data plane components would communicate with our Azure services. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -AuthenticationIdentityInputObjectId +The object Id of the service principal with which the on-premise management/data plane components would communicate with our Azure services. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -AuthenticationIdentityInputTenantId +The tenant Id for the service principal with which the on-premise management/data plane components would communicate with our Azure services. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -BiosId +The Bios Id of the machine. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DataPlaneAuthenticationIdentityInputAadAuthority +The base authority for Azure Active Directory authentication. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DataPlaneAuthenticationIdentityInputApplicationId +The application/client Id for the service principal with which the on-premise management/data plane components would communicate with our Azure services. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DataPlaneAuthenticationIdentityInputAudience +The intended Audience of the service principal with which the on-premise management/data plane components would communicate with our Azure services. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DataPlaneAuthenticationIdentityInputObjectId +The object Id of the service principal with which the on-premise management/data plane components would communicate with our Azure services. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DataPlaneAuthenticationIdentityInputTenantId +The tenant Id for the service principal with which the on-premise management/data plane components would communicate with our Azure services. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FabricName +Fabric name. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -MachineId +The Id of the machine where the provider is getting added. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -MachineName +The name of the machine where the provider is getting added. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProviderName +Recovery services provider name. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceAccessIdentityInputAadAuthority +The base authority for Azure Active Directory authentication. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceAccessIdentityInputApplicationId +The application/client Id for the service principal with which the on-premise management/data plane components would communicate with our Azure services. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceAccessIdentityInputAudience +The intended Audience of the service principal with which the on-premise management/data plane components would communicate with our Azure services. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceAccessIdentityInputObjectId +The object Id of the service principal with which the on-premise management/data plane components would communicate with our Azure services. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceAccessIdentityInputTenantId +The tenant Id for the service principal with which the on-premise management/data plane components would communicate with our Azure services. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProvider + +## NOTES + +ALIASES + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/New-AzSiteRecoveryReplicationStorageClassificationMapping.md b/swaggerci/recoveryservicessiterecovery/docs/New-AzSiteRecoveryReplicationStorageClassificationMapping.md new file mode 100644 index 000000000000..349b536c4d97 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/New-AzSiteRecoveryReplicationStorageClassificationMapping.md @@ -0,0 +1,246 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/new-azsiterecoveryreplicationstorageclassificationmapping +schema: 2.0.0 +--- + +# New-AzSiteRecoveryReplicationStorageClassificationMapping + +## SYNOPSIS +The operation to create a storage classification mapping. + +## SYNTAX + +``` +New-AzSiteRecoveryReplicationStorageClassificationMapping -FabricName -ResourceGroupName + -ResourceName -StorageClassificationMappingName -StorageClassificationName + [-SubscriptionId ] [-TargetStorageClassificationId ] [-DefaultProfile ] [-AsJob] + [-NoWait] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +The operation to create a storage classification mapping. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FabricName +Fabric name. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -StorageClassificationMappingName +Storage classification mapping name. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -StorageClassificationName +Storage classification name. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TargetStorageClassificationId +The ID of the storage object. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMapping + +## NOTES + +ALIASES + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/New-AzSiteRecoveryReplicationVaultSetting.md b/swaggerci/recoveryservicessiterecovery/docs/New-AzSiteRecoveryReplicationVaultSetting.md new file mode 100644 index 000000000000..335b0a7b9387 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/New-AzSiteRecoveryReplicationVaultSetting.md @@ -0,0 +1,231 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/new-azsiterecoveryreplicationvaultsetting +schema: 2.0.0 +--- + +# New-AzSiteRecoveryReplicationVaultSetting + +## SYNOPSIS +The operation to configure vault setting. + +## SYNTAX + +``` +New-AzSiteRecoveryReplicationVaultSetting -ResourceGroupName -ResourceName + -VaultSettingName [-SubscriptionId ] [-MigrationSolutionId ] + [-VmwareToAzureProviderType ] [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] + [] +``` + +## DESCRIPTION +The operation to configure vault setting. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -MigrationSolutionId +The migration solution Id. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -VaultSettingName +Vault setting name. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -VmwareToAzureProviderType +VMware to Azure provider type. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSetting + +## NOTES + +ALIASES + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/New-AzSiteRecoveryReplicationvCenter.md b/swaggerci/recoveryservicessiterecovery/docs/New-AzSiteRecoveryReplicationvCenter.md new file mode 100644 index 000000000000..db40a4be2fe7 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/New-AzSiteRecoveryReplicationvCenter.md @@ -0,0 +1,291 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/new-azsiterecoveryreplicationvcenter +schema: 2.0.0 +--- + +# New-AzSiteRecoveryReplicationvCenter + +## SYNOPSIS +The operation to create a vCenter object.. + +## SYNTAX + +``` +New-AzSiteRecoveryReplicationvCenter -FabricName -ResourceGroupName -ResourceName + -VcenterName [-SubscriptionId ] [-FriendlyName ] [-IPAddress ] + [-Port ] [-ProcessServerId ] [-RunAsAccountId ] [-DefaultProfile ] [-AsJob] + [-NoWait] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +The operation to create a vCenter object.. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FabricName +Fabric name. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FriendlyName +The friendly name of the vCenter. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -IPAddress +The IP address of the vCenter to be discovered. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Port +The port number for discovery. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProcessServerId +The process server Id from where the discovery is orchestrated. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -RunAsAccountId +The account Id which has privileges to discover the vCenter. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -VcenterName +vcenter name. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenter + +## NOTES + +ALIASES + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/README.md b/swaggerci/recoveryservicessiterecovery/docs/README.md new file mode 100644 index 000000000000..086179a784d5 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/README.md @@ -0,0 +1,11 @@ +# Docs +This directory contains the documentation of the cmdlets for the `Az.SiteRecovery` module. To run documentation generation, use the `generate-help.ps1` script at the root module folder. Files in this folder will *always be overridden on regeneration*. To update documentation examples, please use the `../examples` folder. + +## Info +- Modifiable: no +- Generated: all +- Committed: yes +- Packaged: yes + +## Details +The process of documentation generation loads `Az.SiteRecovery` and analyzes the exported cmdlets from the module. It recognizes the [help comments](https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_comment_based_help) that are generated into the scripts in the `../exports` folder. Additionally, when writing custom cmdlets in the `../custom` folder, you can use the help comments syntax, which decorate the exported scripts at build-time. The documentation examples are taken from the `../examples` folder. \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/docs/Remove-AzSiteRecoveryReplicationFabric.md b/swaggerci/recoveryservicessiterecovery/docs/Remove-AzSiteRecoveryReplicationFabric.md new file mode 100644 index 000000000000..5b435966ba8d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/Remove-AzSiteRecoveryReplicationFabric.md @@ -0,0 +1,274 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/remove-azsiterecoveryreplicationfabric +schema: 2.0.0 +--- + +# Remove-AzSiteRecoveryReplicationFabric + +## SYNOPSIS +The operation to delete or remove an Azure Site Recovery fabric. + +## SYNTAX + +### Delete (Default) +``` +Remove-AzSiteRecoveryReplicationFabric -FabricName -ResourceGroupName -ResourceName + [-SubscriptionId ] [-DefaultProfile ] [-AsJob] [-NoWait] [-PassThru] [-Confirm] [-WhatIf] + [] +``` + +### DeleteViaIdentity +``` +Remove-AzSiteRecoveryReplicationFabric -InputObject [-DefaultProfile ] + [-AsJob] [-NoWait] [-PassThru] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +The operation to delete or remove an Azure Site Recovery fabric. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FabricName +ASR fabric to delete. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +Parameter Sets: DeleteViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PassThru +Returns true when the command succeeds + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity + +## OUTPUTS + +### System.Boolean + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`INPUTOBJECT `: Identity Parameter + - `[AlertSettingName ]`: The name of the email notification configuration. + - `[EventName ]`: The name of the Azure Site Recovery event. + - `[FabricName ]`: Fabric name. + - `[Id ]`: Resource identity path + - `[IntentObjectName ]`: Replication protection intent name. + - `[JobName ]`: Job identifier. + - `[LogicalNetworkName ]`: Logical network name. + - `[MappingName ]`: Protection Container mapping name. + - `[MigrationItemName ]`: Migration item name. + - `[MigrationRecoveryPointName ]`: The migration recovery point name. + - `[NetworkMappingName ]`: Network mapping name. + - `[NetworkName ]`: Primary network name. + - `[PolicyName ]`: Replication policy name. + - `[ProtectableItemName ]`: Protectable item name. + - `[ProtectionContainerName ]`: Protection container name. + - `[ProviderName ]`: Recovery services provider name. + - `[RecoveryPlanName ]`: Name of the recovery plan. + - `[RecoveryPointName ]`: The recovery point name. + - `[ReplicatedProtectedItemName ]`: Replication protected item name. + - `[ResourceGroupName ]`: The name of the resource group where the recovery services vault is present. + - `[ResourceName ]`: The name of the recovery services vault. + - `[StorageClassificationMappingName ]`: Storage classification mapping name. + - `[StorageClassificationName ]`: Storage classification name. + - `[SubscriptionId ]`: The subscription Id. + - `[VaultSettingName ]`: Vault setting name. + - `[VcenterName ]`: vcenter name. + - `[VirtualMachineName ]`: Virtual Machine name. + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/Remove-AzSiteRecoveryReplicationMigrationItem.md b/swaggerci/recoveryservicessiterecovery/docs/Remove-AzSiteRecoveryReplicationMigrationItem.md new file mode 100644 index 000000000000..a1a8faa3cee9 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/Remove-AzSiteRecoveryReplicationMigrationItem.md @@ -0,0 +1,320 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/remove-azsiterecoveryreplicationmigrationitem +schema: 2.0.0 +--- + +# Remove-AzSiteRecoveryReplicationMigrationItem + +## SYNOPSIS +The operation to delete an ASR migration item. + +## SYNTAX + +### Delete (Default) +``` +Remove-AzSiteRecoveryReplicationMigrationItem -FabricName -MigrationItemName + -ProtectionContainerName -ResourceGroupName -ResourceName + [-SubscriptionId ] [-DeleteOption ] [-DefaultProfile ] [-AsJob] [-NoWait] + [-PassThru] [-Confirm] [-WhatIf] [] +``` + +### DeleteViaIdentity +``` +Remove-AzSiteRecoveryReplicationMigrationItem -InputObject [-DeleteOption ] + [-DefaultProfile ] [-AsJob] [-NoWait] [-PassThru] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +The operation to delete an ASR migration item. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DeleteOption +The delete option. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FabricName +Fabric name. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +Parameter Sets: DeleteViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -MigrationItemName +Migration item name. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PassThru +Returns true when the command succeeds + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProtectionContainerName +Protection container name. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity + +## OUTPUTS + +### System.Boolean + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`INPUTOBJECT `: Identity Parameter + - `[AlertSettingName ]`: The name of the email notification configuration. + - `[EventName ]`: The name of the Azure Site Recovery event. + - `[FabricName ]`: Fabric name. + - `[Id ]`: Resource identity path + - `[IntentObjectName ]`: Replication protection intent name. + - `[JobName ]`: Job identifier. + - `[LogicalNetworkName ]`: Logical network name. + - `[MappingName ]`: Protection Container mapping name. + - `[MigrationItemName ]`: Migration item name. + - `[MigrationRecoveryPointName ]`: The migration recovery point name. + - `[NetworkMappingName ]`: Network mapping name. + - `[NetworkName ]`: Primary network name. + - `[PolicyName ]`: Replication policy name. + - `[ProtectableItemName ]`: Protectable item name. + - `[ProtectionContainerName ]`: Protection container name. + - `[ProviderName ]`: Recovery services provider name. + - `[RecoveryPlanName ]`: Name of the recovery plan. + - `[RecoveryPointName ]`: The recovery point name. + - `[ReplicatedProtectedItemName ]`: Replication protected item name. + - `[ResourceGroupName ]`: The name of the resource group where the recovery services vault is present. + - `[ResourceName ]`: The name of the recovery services vault. + - `[StorageClassificationMappingName ]`: Storage classification mapping name. + - `[StorageClassificationName ]`: Storage classification name. + - `[SubscriptionId ]`: The subscription Id. + - `[VaultSettingName ]`: Vault setting name. + - `[VcenterName ]`: vcenter name. + - `[VirtualMachineName ]`: Virtual Machine name. + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/Remove-AzSiteRecoveryReplicationNetworkMapping.md b/swaggerci/recoveryservicessiterecovery/docs/Remove-AzSiteRecoveryReplicationNetworkMapping.md new file mode 100644 index 000000000000..af591d86cd86 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/Remove-AzSiteRecoveryReplicationNetworkMapping.md @@ -0,0 +1,304 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/remove-azsiterecoveryreplicationnetworkmapping +schema: 2.0.0 +--- + +# Remove-AzSiteRecoveryReplicationNetworkMapping + +## SYNOPSIS +The operation to delete a network mapping. + +## SYNTAX + +### Delete (Default) +``` +Remove-AzSiteRecoveryReplicationNetworkMapping -FabricName -NetworkMappingName + -NetworkName -ResourceGroupName -ResourceName [-SubscriptionId ] + [-DefaultProfile ] [-AsJob] [-NoWait] [-PassThru] [-Confirm] [-WhatIf] [] +``` + +### DeleteViaIdentity +``` +Remove-AzSiteRecoveryReplicationNetworkMapping -InputObject + [-DefaultProfile ] [-AsJob] [-NoWait] [-PassThru] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +The operation to delete a network mapping. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FabricName +Primary fabric name. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +Parameter Sets: DeleteViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -NetworkMappingName +ARM Resource Name for network mapping. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NetworkName +Primary network name. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PassThru +Returns true when the command succeeds + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity + +## OUTPUTS + +### System.Boolean + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`INPUTOBJECT `: Identity Parameter + - `[AlertSettingName ]`: The name of the email notification configuration. + - `[EventName ]`: The name of the Azure Site Recovery event. + - `[FabricName ]`: Fabric name. + - `[Id ]`: Resource identity path + - `[IntentObjectName ]`: Replication protection intent name. + - `[JobName ]`: Job identifier. + - `[LogicalNetworkName ]`: Logical network name. + - `[MappingName ]`: Protection Container mapping name. + - `[MigrationItemName ]`: Migration item name. + - `[MigrationRecoveryPointName ]`: The migration recovery point name. + - `[NetworkMappingName ]`: Network mapping name. + - `[NetworkName ]`: Primary network name. + - `[PolicyName ]`: Replication policy name. + - `[ProtectableItemName ]`: Protectable item name. + - `[ProtectionContainerName ]`: Protection container name. + - `[ProviderName ]`: Recovery services provider name. + - `[RecoveryPlanName ]`: Name of the recovery plan. + - `[RecoveryPointName ]`: The recovery point name. + - `[ReplicatedProtectedItemName ]`: Replication protected item name. + - `[ResourceGroupName ]`: The name of the resource group where the recovery services vault is present. + - `[ResourceName ]`: The name of the recovery services vault. + - `[StorageClassificationMappingName ]`: Storage classification mapping name. + - `[StorageClassificationName ]`: Storage classification name. + - `[SubscriptionId ]`: The subscription Id. + - `[VaultSettingName ]`: Vault setting name. + - `[VcenterName ]`: vcenter name. + - `[VirtualMachineName ]`: Virtual Machine name. + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/Remove-AzSiteRecoveryReplicationPolicy.md b/swaggerci/recoveryservicessiterecovery/docs/Remove-AzSiteRecoveryReplicationPolicy.md new file mode 100644 index 000000000000..6995722a7da6 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/Remove-AzSiteRecoveryReplicationPolicy.md @@ -0,0 +1,274 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/remove-azsiterecoveryreplicationpolicy +schema: 2.0.0 +--- + +# Remove-AzSiteRecoveryReplicationPolicy + +## SYNOPSIS +The operation to delete a replication policy. + +## SYNTAX + +### Delete (Default) +``` +Remove-AzSiteRecoveryReplicationPolicy -PolicyName -ResourceGroupName -ResourceName + [-SubscriptionId ] [-DefaultProfile ] [-AsJob] [-NoWait] [-PassThru] [-Confirm] [-WhatIf] + [] +``` + +### DeleteViaIdentity +``` +Remove-AzSiteRecoveryReplicationPolicy -InputObject [-DefaultProfile ] + [-AsJob] [-NoWait] [-PassThru] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +The operation to delete a replication policy. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +Parameter Sets: DeleteViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PassThru +Returns true when the command succeeds + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PolicyName +Replication policy name. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity + +## OUTPUTS + +### System.Boolean + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`INPUTOBJECT `: Identity Parameter + - `[AlertSettingName ]`: The name of the email notification configuration. + - `[EventName ]`: The name of the Azure Site Recovery event. + - `[FabricName ]`: Fabric name. + - `[Id ]`: Resource identity path + - `[IntentObjectName ]`: Replication protection intent name. + - `[JobName ]`: Job identifier. + - `[LogicalNetworkName ]`: Logical network name. + - `[MappingName ]`: Protection Container mapping name. + - `[MigrationItemName ]`: Migration item name. + - `[MigrationRecoveryPointName ]`: The migration recovery point name. + - `[NetworkMappingName ]`: Network mapping name. + - `[NetworkName ]`: Primary network name. + - `[PolicyName ]`: Replication policy name. + - `[ProtectableItemName ]`: Protectable item name. + - `[ProtectionContainerName ]`: Protection container name. + - `[ProviderName ]`: Recovery services provider name. + - `[RecoveryPlanName ]`: Name of the recovery plan. + - `[RecoveryPointName ]`: The recovery point name. + - `[ReplicatedProtectedItemName ]`: Replication protected item name. + - `[ResourceGroupName ]`: The name of the resource group where the recovery services vault is present. + - `[ResourceName ]`: The name of the recovery services vault. + - `[StorageClassificationMappingName ]`: Storage classification mapping name. + - `[StorageClassificationName ]`: Storage classification name. + - `[SubscriptionId ]`: The subscription Id. + - `[VaultSettingName ]`: Vault setting name. + - `[VcenterName ]`: vcenter name. + - `[VirtualMachineName ]`: Virtual Machine name. + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/Remove-AzSiteRecoveryReplicationProtectedItem.md b/swaggerci/recoveryservicessiterecovery/docs/Remove-AzSiteRecoveryReplicationProtectedItem.md new file mode 100644 index 000000000000..eba9544838a7 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/Remove-AzSiteRecoveryReplicationProtectedItem.md @@ -0,0 +1,377 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/remove-azsiterecoveryreplicationprotecteditem +schema: 2.0.0 +--- + +# Remove-AzSiteRecoveryReplicationProtectedItem + +## SYNOPSIS +The operation to disable replication on a replication protected item. +This will also remove the item. + +## SYNTAX + +### DeleteExpanded (Default) +``` +Remove-AzSiteRecoveryReplicationProtectedItem -FabricName -ProtectionContainerName + -ReplicatedProtectedItemName -ResourceGroupName -ResourceName + [-SubscriptionId ] [-DisableProtectionReason ] + [-ReplicationProviderInputInstanceType ] [-DefaultProfile ] [-AsJob] [-NoWait] [-PassThru] + [-Confirm] [-WhatIf] [] +``` + +### Delete +``` +Remove-AzSiteRecoveryReplicationProtectedItem -FabricName -ProtectionContainerName + -ReplicatedProtectedItemName -ResourceGroupName -ResourceName + -DisableProtectionInput [-SubscriptionId ] [-DefaultProfile ] + [-AsJob] [-NoWait] [-PassThru] [-Confirm] [-WhatIf] [] +``` + +### DeleteViaIdentity +``` +Remove-AzSiteRecoveryReplicationProtectedItem -InputObject + -DisableProtectionInput [-DefaultProfile ] [-AsJob] [-NoWait] [-PassThru] + [-Confirm] [-WhatIf] [] +``` + +### DeleteViaIdentityExpanded +``` +Remove-AzSiteRecoveryReplicationProtectedItem -InputObject + [-DisableProtectionReason ] [-ReplicationProviderInputInstanceType ] + [-DefaultProfile ] [-AsJob] [-NoWait] [-PassThru] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +The operation to disable replication on a replication protected item. +This will also remove the item. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DisableProtectionInput +Disable protection input. +To construct, see NOTES section for DISABLEPROTECTIONINPUT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionInput +Parameter Sets: Delete, DeleteViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -DisableProtectionReason +Disable protection reason. +It can have values NotSpecified/MigrationComplete. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DisableProtectionReason +Parameter Sets: DeleteExpanded, DeleteViaIdentityExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FabricName +Fabric name. + +```yaml +Type: System.String +Parameter Sets: Delete, DeleteExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +Parameter Sets: DeleteViaIdentity, DeleteViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PassThru +Returns true when the command succeeds + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProtectionContainerName +Protection container name. + +```yaml +Type: System.String +Parameter Sets: Delete, DeleteExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ReplicatedProtectedItemName +Replication protected item name. + +```yaml +Type: System.String +Parameter Sets: Delete, DeleteExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ReplicationProviderInputInstanceType +The class type. + +```yaml +Type: System.String +Parameter Sets: DeleteExpanded, DeleteViaIdentityExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: Delete, DeleteExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: Delete, DeleteExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String +Parameter Sets: Delete, DeleteExpanded +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionInput + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity + +## OUTPUTS + +### System.Boolean + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`DISABLEPROTECTIONINPUT `: Disable protection input. + - `[DisableProtectionReason ]`: Disable protection reason. It can have values NotSpecified/MigrationComplete. + - `[ReplicationProviderInputInstanceType ]`: The class type. + +`INPUTOBJECT `: Identity Parameter + - `[AlertSettingName ]`: The name of the email notification configuration. + - `[EventName ]`: The name of the Azure Site Recovery event. + - `[FabricName ]`: Fabric name. + - `[Id ]`: Resource identity path + - `[IntentObjectName ]`: Replication protection intent name. + - `[JobName ]`: Job identifier. + - `[LogicalNetworkName ]`: Logical network name. + - `[MappingName ]`: Protection Container mapping name. + - `[MigrationItemName ]`: Migration item name. + - `[MigrationRecoveryPointName ]`: The migration recovery point name. + - `[NetworkMappingName ]`: Network mapping name. + - `[NetworkName ]`: Primary network name. + - `[PolicyName ]`: Replication policy name. + - `[ProtectableItemName ]`: Protectable item name. + - `[ProtectionContainerName ]`: Protection container name. + - `[ProviderName ]`: Recovery services provider name. + - `[RecoveryPlanName ]`: Name of the recovery plan. + - `[RecoveryPointName ]`: The recovery point name. + - `[ReplicatedProtectedItemName ]`: Replication protected item name. + - `[ResourceGroupName ]`: The name of the resource group where the recovery services vault is present. + - `[ResourceName ]`: The name of the recovery services vault. + - `[StorageClassificationMappingName ]`: Storage classification mapping name. + - `[StorageClassificationName ]`: Storage classification name. + - `[SubscriptionId ]`: The subscription Id. + - `[VaultSettingName ]`: Vault setting name. + - `[VcenterName ]`: vcenter name. + - `[VirtualMachineName ]`: Virtual Machine name. + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/Remove-AzSiteRecoveryReplicationProtectedItemDisk.md b/swaggerci/recoveryservicessiterecovery/docs/Remove-AzSiteRecoveryReplicationProtectedItemDisk.md new file mode 100644 index 000000000000..c8cbf20ba281 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/Remove-AzSiteRecoveryReplicationProtectedItemDisk.md @@ -0,0 +1,342 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/remove-azsiterecoveryreplicationprotecteditemdisk +schema: 2.0.0 +--- + +# Remove-AzSiteRecoveryReplicationProtectedItemDisk + +## SYNOPSIS +Operation to remove disk(s) from the replication protected item. + +## SYNTAX + +### RemoveExpanded (Default) +``` +Remove-AzSiteRecoveryReplicationProtectedItemDisk -FabricName -ProtectionContainerName + -ReplicatedProtectedItemName -ResourceGroupName -ResourceName + [-SubscriptionId ] [-ProviderSpecificDetailInstanceType ] [-DefaultProfile ] + [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +### Remove +``` +Remove-AzSiteRecoveryReplicationProtectedItemDisk -FabricName -ProtectionContainerName + -ReplicatedProtectedItemName -ResourceGroupName -ResourceName + -RemoveDisksInput [-SubscriptionId ] [-DefaultProfile ] [-AsJob] + [-NoWait] [-Confirm] [-WhatIf] [] +``` + +### RemoveViaIdentity +``` +Remove-AzSiteRecoveryReplicationProtectedItemDisk -InputObject + -RemoveDisksInput [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] + [] +``` + +### RemoveViaIdentityExpanded +``` +Remove-AzSiteRecoveryReplicationProtectedItemDisk -InputObject + [-ProviderSpecificDetailInstanceType ] [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] + [-WhatIf] [] +``` + +## DESCRIPTION +Operation to remove disk(s) from the replication protected item. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FabricName +Unique fabric name. + +```yaml +Type: System.String +Parameter Sets: Remove, RemoveExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +Parameter Sets: RemoveViaIdentity, RemoveViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProtectionContainerName +Protection container name. + +```yaml +Type: System.String +Parameter Sets: Remove, RemoveExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProviderSpecificDetailInstanceType +The class type. + +```yaml +Type: System.String +Parameter Sets: RemoveExpanded, RemoveViaIdentityExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -RemoveDisksInput +Input for remove disk(s) operation. +To construct, see NOTES section for REMOVEDISKSINPUT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksInput +Parameter Sets: Remove, RemoveViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -ReplicatedProtectedItemName +Replication protected item name. + +```yaml +Type: System.String +Parameter Sets: Remove, RemoveExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: Remove, RemoveExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: Remove, RemoveExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String +Parameter Sets: Remove, RemoveExpanded +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksInput + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`INPUTOBJECT `: Identity Parameter + - `[AlertSettingName ]`: The name of the email notification configuration. + - `[EventName ]`: The name of the Azure Site Recovery event. + - `[FabricName ]`: Fabric name. + - `[Id ]`: Resource identity path + - `[IntentObjectName ]`: Replication protection intent name. + - `[JobName ]`: Job identifier. + - `[LogicalNetworkName ]`: Logical network name. + - `[MappingName ]`: Protection Container mapping name. + - `[MigrationItemName ]`: Migration item name. + - `[MigrationRecoveryPointName ]`: The migration recovery point name. + - `[NetworkMappingName ]`: Network mapping name. + - `[NetworkName ]`: Primary network name. + - `[PolicyName ]`: Replication policy name. + - `[ProtectableItemName ]`: Protectable item name. + - `[ProtectionContainerName ]`: Protection container name. + - `[ProviderName ]`: Recovery services provider name. + - `[RecoveryPlanName ]`: Name of the recovery plan. + - `[RecoveryPointName ]`: The recovery point name. + - `[ReplicatedProtectedItemName ]`: Replication protected item name. + - `[ResourceGroupName ]`: The name of the resource group where the recovery services vault is present. + - `[ResourceName ]`: The name of the recovery services vault. + - `[StorageClassificationMappingName ]`: Storage classification mapping name. + - `[StorageClassificationName ]`: Storage classification name. + - `[SubscriptionId ]`: The subscription Id. + - `[VaultSettingName ]`: Vault setting name. + - `[VcenterName ]`: vcenter name. + - `[VirtualMachineName ]`: Virtual Machine name. + +`REMOVEDISKSINPUT `: Input for remove disk(s) operation. + - `[ProviderSpecificDetailInstanceType ]`: The class type. + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/Remove-AzSiteRecoveryReplicationProtectionContainer.md b/swaggerci/recoveryservicessiterecovery/docs/Remove-AzSiteRecoveryReplicationProtectionContainer.md new file mode 100644 index 000000000000..c39044c359b1 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/Remove-AzSiteRecoveryReplicationProtectionContainer.md @@ -0,0 +1,289 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/remove-azsiterecoveryreplicationprotectioncontainer +schema: 2.0.0 +--- + +# Remove-AzSiteRecoveryReplicationProtectionContainer + +## SYNOPSIS +Operation to remove a protection container. + +## SYNTAX + +### Delete (Default) +``` +Remove-AzSiteRecoveryReplicationProtectionContainer -FabricName -ProtectionContainerName + -ResourceGroupName -ResourceName [-SubscriptionId ] [-DefaultProfile ] + [-AsJob] [-NoWait] [-PassThru] [-Confirm] [-WhatIf] [] +``` + +### DeleteViaIdentity +``` +Remove-AzSiteRecoveryReplicationProtectionContainer -InputObject + [-DefaultProfile ] [-AsJob] [-NoWait] [-PassThru] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Operation to remove a protection container. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FabricName +Unique fabric ARM name. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +Parameter Sets: DeleteViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PassThru +Returns true when the command succeeds + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProtectionContainerName +Unique protection container ARM name. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity + +## OUTPUTS + +### System.Boolean + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`INPUTOBJECT `: Identity Parameter + - `[AlertSettingName ]`: The name of the email notification configuration. + - `[EventName ]`: The name of the Azure Site Recovery event. + - `[FabricName ]`: Fabric name. + - `[Id ]`: Resource identity path + - `[IntentObjectName ]`: Replication protection intent name. + - `[JobName ]`: Job identifier. + - `[LogicalNetworkName ]`: Logical network name. + - `[MappingName ]`: Protection Container mapping name. + - `[MigrationItemName ]`: Migration item name. + - `[MigrationRecoveryPointName ]`: The migration recovery point name. + - `[NetworkMappingName ]`: Network mapping name. + - `[NetworkName ]`: Primary network name. + - `[PolicyName ]`: Replication policy name. + - `[ProtectableItemName ]`: Protectable item name. + - `[ProtectionContainerName ]`: Protection container name. + - `[ProviderName ]`: Recovery services provider name. + - `[RecoveryPlanName ]`: Name of the recovery plan. + - `[RecoveryPointName ]`: The recovery point name. + - `[ReplicatedProtectedItemName ]`: Replication protected item name. + - `[ResourceGroupName ]`: The name of the resource group where the recovery services vault is present. + - `[ResourceName ]`: The name of the recovery services vault. + - `[StorageClassificationMappingName ]`: Storage classification mapping name. + - `[StorageClassificationName ]`: Storage classification name. + - `[SubscriptionId ]`: The subscription Id. + - `[VaultSettingName ]`: Vault setting name. + - `[VcenterName ]`: vcenter name. + - `[VirtualMachineName ]`: Virtual Machine name. + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/Remove-AzSiteRecoveryReplicationProtectionContainerMapping.md b/swaggerci/recoveryservicessiterecovery/docs/Remove-AzSiteRecoveryReplicationProtectionContainerMapping.md new file mode 100644 index 000000000000..9f7aadc2fce8 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/Remove-AzSiteRecoveryReplicationProtectionContainerMapping.md @@ -0,0 +1,357 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/remove-azsiterecoveryreplicationprotectioncontainermapping +schema: 2.0.0 +--- + +# Remove-AzSiteRecoveryReplicationProtectionContainerMapping + +## SYNOPSIS +The operation to delete or remove a protection container mapping. + +## SYNTAX + +### DeleteExpanded (Default) +``` +Remove-AzSiteRecoveryReplicationProtectionContainerMapping -FabricName -MappingName + -ProtectionContainerName -ResourceGroupName -ResourceName + [-SubscriptionId ] [-ProviderSpecificInputInstanceType ] [-DefaultProfile ] + [-AsJob] [-NoWait] [-PassThru] [-Confirm] [-WhatIf] [] +``` + +### Delete +``` +Remove-AzSiteRecoveryReplicationProtectionContainerMapping -FabricName -MappingName + -ProtectionContainerName -ResourceGroupName -ResourceName + -RemovalInput [-SubscriptionId ] + [-DefaultProfile ] [-AsJob] [-NoWait] [-PassThru] [-Confirm] [-WhatIf] [] +``` + +### DeleteViaIdentity +``` +Remove-AzSiteRecoveryReplicationProtectionContainerMapping -InputObject + -RemovalInput [-DefaultProfile ] [-AsJob] [-NoWait] + [-PassThru] [-Confirm] [-WhatIf] [] +``` + +### DeleteViaIdentityExpanded +``` +Remove-AzSiteRecoveryReplicationProtectionContainerMapping -InputObject + [-ProviderSpecificInputInstanceType ] [-DefaultProfile ] [-AsJob] [-NoWait] [-PassThru] + [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +The operation to delete or remove a protection container mapping. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FabricName +Fabric name. + +```yaml +Type: System.String +Parameter Sets: Delete, DeleteExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +Parameter Sets: DeleteViaIdentity, DeleteViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -MappingName +Protection container mapping name. + +```yaml +Type: System.String +Parameter Sets: Delete, DeleteExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PassThru +Returns true when the command succeeds + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProtectionContainerName +Protection container name. + +```yaml +Type: System.String +Parameter Sets: Delete, DeleteExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProviderSpecificInputInstanceType +The class type. + +```yaml +Type: System.String +Parameter Sets: DeleteExpanded, DeleteViaIdentityExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -RemovalInput +Container unpairing input. +To construct, see NOTES section for REMOVALINPUT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveProtectionContainerMappingInput +Parameter Sets: Delete, DeleteViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: Delete, DeleteExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: Delete, DeleteExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String +Parameter Sets: Delete, DeleteExpanded +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveProtectionContainerMappingInput + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity + +## OUTPUTS + +### System.Boolean + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`INPUTOBJECT `: Identity Parameter + - `[AlertSettingName ]`: The name of the email notification configuration. + - `[EventName ]`: The name of the Azure Site Recovery event. + - `[FabricName ]`: Fabric name. + - `[Id ]`: Resource identity path + - `[IntentObjectName ]`: Replication protection intent name. + - `[JobName ]`: Job identifier. + - `[LogicalNetworkName ]`: Logical network name. + - `[MappingName ]`: Protection Container mapping name. + - `[MigrationItemName ]`: Migration item name. + - `[MigrationRecoveryPointName ]`: The migration recovery point name. + - `[NetworkMappingName ]`: Network mapping name. + - `[NetworkName ]`: Primary network name. + - `[PolicyName ]`: Replication policy name. + - `[ProtectableItemName ]`: Protectable item name. + - `[ProtectionContainerName ]`: Protection container name. + - `[ProviderName ]`: Recovery services provider name. + - `[RecoveryPlanName ]`: Name of the recovery plan. + - `[RecoveryPointName ]`: The recovery point name. + - `[ReplicatedProtectedItemName ]`: Replication protected item name. + - `[ResourceGroupName ]`: The name of the resource group where the recovery services vault is present. + - `[ResourceName ]`: The name of the recovery services vault. + - `[StorageClassificationMappingName ]`: Storage classification mapping name. + - `[StorageClassificationName ]`: Storage classification name. + - `[SubscriptionId ]`: The subscription Id. + - `[VaultSettingName ]`: Vault setting name. + - `[VcenterName ]`: vcenter name. + - `[VirtualMachineName ]`: Virtual Machine name. + +`REMOVALINPUT `: Container unpairing input. + - `[ProviderSpecificInputInstanceType ]`: The class type. + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/Remove-AzSiteRecoveryReplicationRecoveryPlan.md b/swaggerci/recoveryservicessiterecovery/docs/Remove-AzSiteRecoveryReplicationRecoveryPlan.md new file mode 100644 index 000000000000..f59dc85fadc2 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/Remove-AzSiteRecoveryReplicationRecoveryPlan.md @@ -0,0 +1,274 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/remove-azsiterecoveryreplicationrecoveryplan +schema: 2.0.0 +--- + +# Remove-AzSiteRecoveryReplicationRecoveryPlan + +## SYNOPSIS +Delete a recovery plan. + +## SYNTAX + +### Delete (Default) +``` +Remove-AzSiteRecoveryReplicationRecoveryPlan -RecoveryPlanName -ResourceGroupName + -ResourceName [-SubscriptionId ] [-DefaultProfile ] [-AsJob] [-NoWait] [-PassThru] + [-Confirm] [-WhatIf] [] +``` + +### DeleteViaIdentity +``` +Remove-AzSiteRecoveryReplicationRecoveryPlan -InputObject [-DefaultProfile ] + [-AsJob] [-NoWait] [-PassThru] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Delete a recovery plan. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +Parameter Sets: DeleteViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PassThru +Returns true when the command succeeds + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -RecoveryPlanName +Recovery plan name. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity + +## OUTPUTS + +### System.Boolean + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`INPUTOBJECT `: Identity Parameter + - `[AlertSettingName ]`: The name of the email notification configuration. + - `[EventName ]`: The name of the Azure Site Recovery event. + - `[FabricName ]`: Fabric name. + - `[Id ]`: Resource identity path + - `[IntentObjectName ]`: Replication protection intent name. + - `[JobName ]`: Job identifier. + - `[LogicalNetworkName ]`: Logical network name. + - `[MappingName ]`: Protection Container mapping name. + - `[MigrationItemName ]`: Migration item name. + - `[MigrationRecoveryPointName ]`: The migration recovery point name. + - `[NetworkMappingName ]`: Network mapping name. + - `[NetworkName ]`: Primary network name. + - `[PolicyName ]`: Replication policy name. + - `[ProtectableItemName ]`: Protectable item name. + - `[ProtectionContainerName ]`: Protection container name. + - `[ProviderName ]`: Recovery services provider name. + - `[RecoveryPlanName ]`: Name of the recovery plan. + - `[RecoveryPointName ]`: The recovery point name. + - `[ReplicatedProtectedItemName ]`: Replication protected item name. + - `[ResourceGroupName ]`: The name of the resource group where the recovery services vault is present. + - `[ResourceName ]`: The name of the recovery services vault. + - `[StorageClassificationMappingName ]`: Storage classification mapping name. + - `[StorageClassificationName ]`: Storage classification name. + - `[SubscriptionId ]`: The subscription Id. + - `[VaultSettingName ]`: Vault setting name. + - `[VcenterName ]`: vcenter name. + - `[VirtualMachineName ]`: Virtual Machine name. + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/Remove-AzSiteRecoveryReplicationRecoveryServicesProvider.md b/swaggerci/recoveryservicessiterecovery/docs/Remove-AzSiteRecoveryReplicationRecoveryServicesProvider.md new file mode 100644 index 000000000000..2c542a061179 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/Remove-AzSiteRecoveryReplicationRecoveryServicesProvider.md @@ -0,0 +1,289 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/remove-azsiterecoveryreplicationrecoveryservicesprovider +schema: 2.0.0 +--- + +# Remove-AzSiteRecoveryReplicationRecoveryServicesProvider + +## SYNOPSIS +The operation to removes/delete(unregister) a recovery services provider from the vault. + +## SYNTAX + +### Delete (Default) +``` +Remove-AzSiteRecoveryReplicationRecoveryServicesProvider -FabricName -ProviderName + -ResourceGroupName -ResourceName [-SubscriptionId ] [-DefaultProfile ] + [-AsJob] [-NoWait] [-PassThru] [-Confirm] [-WhatIf] [] +``` + +### DeleteViaIdentity +``` +Remove-AzSiteRecoveryReplicationRecoveryServicesProvider -InputObject + [-DefaultProfile ] [-AsJob] [-NoWait] [-PassThru] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +The operation to removes/delete(unregister) a recovery services provider from the vault. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FabricName +Fabric name. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +Parameter Sets: DeleteViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PassThru +Returns true when the command succeeds + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProviderName +Recovery services provider name. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity + +## OUTPUTS + +### System.Boolean + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`INPUTOBJECT `: Identity Parameter + - `[AlertSettingName ]`: The name of the email notification configuration. + - `[EventName ]`: The name of the Azure Site Recovery event. + - `[FabricName ]`: Fabric name. + - `[Id ]`: Resource identity path + - `[IntentObjectName ]`: Replication protection intent name. + - `[JobName ]`: Job identifier. + - `[LogicalNetworkName ]`: Logical network name. + - `[MappingName ]`: Protection Container mapping name. + - `[MigrationItemName ]`: Migration item name. + - `[MigrationRecoveryPointName ]`: The migration recovery point name. + - `[NetworkMappingName ]`: Network mapping name. + - `[NetworkName ]`: Primary network name. + - `[PolicyName ]`: Replication policy name. + - `[ProtectableItemName ]`: Protectable item name. + - `[ProtectionContainerName ]`: Protection container name. + - `[ProviderName ]`: Recovery services provider name. + - `[RecoveryPlanName ]`: Name of the recovery plan. + - `[RecoveryPointName ]`: The recovery point name. + - `[ReplicatedProtectedItemName ]`: Replication protected item name. + - `[ResourceGroupName ]`: The name of the resource group where the recovery services vault is present. + - `[ResourceName ]`: The name of the recovery services vault. + - `[StorageClassificationMappingName ]`: Storage classification mapping name. + - `[StorageClassificationName ]`: Storage classification name. + - `[SubscriptionId ]`: The subscription Id. + - `[VaultSettingName ]`: Vault setting name. + - `[VcenterName ]`: vcenter name. + - `[VirtualMachineName ]`: Virtual Machine name. + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/Remove-AzSiteRecoveryReplicationStorageClassificationMapping.md b/swaggerci/recoveryservicessiterecovery/docs/Remove-AzSiteRecoveryReplicationStorageClassificationMapping.md new file mode 100644 index 000000000000..a5bfca26e71f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/Remove-AzSiteRecoveryReplicationStorageClassificationMapping.md @@ -0,0 +1,305 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/remove-azsiterecoveryreplicationstorageclassificationmapping +schema: 2.0.0 +--- + +# Remove-AzSiteRecoveryReplicationStorageClassificationMapping + +## SYNOPSIS +The operation to delete a storage classification mapping. + +## SYNTAX + +### Delete (Default) +``` +Remove-AzSiteRecoveryReplicationStorageClassificationMapping -FabricName -ResourceGroupName + -ResourceName -StorageClassificationMappingName -StorageClassificationName + [-SubscriptionId ] [-DefaultProfile ] [-AsJob] [-NoWait] [-PassThru] [-Confirm] [-WhatIf] + [] +``` + +### DeleteViaIdentity +``` +Remove-AzSiteRecoveryReplicationStorageClassificationMapping -InputObject + [-DefaultProfile ] [-AsJob] [-NoWait] [-PassThru] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +The operation to delete a storage classification mapping. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FabricName +Fabric name. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +Parameter Sets: DeleteViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PassThru +Returns true when the command succeeds + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -StorageClassificationMappingName +Storage classification mapping name. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -StorageClassificationName +Storage classification name. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity + +## OUTPUTS + +### System.Boolean + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`INPUTOBJECT `: Identity Parameter + - `[AlertSettingName ]`: The name of the email notification configuration. + - `[EventName ]`: The name of the Azure Site Recovery event. + - `[FabricName ]`: Fabric name. + - `[Id ]`: Resource identity path + - `[IntentObjectName ]`: Replication protection intent name. + - `[JobName ]`: Job identifier. + - `[LogicalNetworkName ]`: Logical network name. + - `[MappingName ]`: Protection Container mapping name. + - `[MigrationItemName ]`: Migration item name. + - `[MigrationRecoveryPointName ]`: The migration recovery point name. + - `[NetworkMappingName ]`: Network mapping name. + - `[NetworkName ]`: Primary network name. + - `[PolicyName ]`: Replication policy name. + - `[ProtectableItemName ]`: Protectable item name. + - `[ProtectionContainerName ]`: Protection container name. + - `[ProviderName ]`: Recovery services provider name. + - `[RecoveryPlanName ]`: Name of the recovery plan. + - `[RecoveryPointName ]`: The recovery point name. + - `[ReplicatedProtectedItemName ]`: Replication protected item name. + - `[ResourceGroupName ]`: The name of the resource group where the recovery services vault is present. + - `[ResourceName ]`: The name of the recovery services vault. + - `[StorageClassificationMappingName ]`: Storage classification mapping name. + - `[StorageClassificationName ]`: Storage classification name. + - `[SubscriptionId ]`: The subscription Id. + - `[VaultSettingName ]`: Vault setting name. + - `[VcenterName ]`: vcenter name. + - `[VirtualMachineName ]`: Virtual Machine name. + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/Remove-AzSiteRecoveryReplicationvCenter.md b/swaggerci/recoveryservicessiterecovery/docs/Remove-AzSiteRecoveryReplicationvCenter.md new file mode 100644 index 000000000000..04fb7dcaee5e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/Remove-AzSiteRecoveryReplicationvCenter.md @@ -0,0 +1,289 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/remove-azsiterecoveryreplicationvcenter +schema: 2.0.0 +--- + +# Remove-AzSiteRecoveryReplicationvCenter + +## SYNOPSIS +The operation to remove(unregister) a registered vCenter server from the vault. + +## SYNTAX + +### Delete (Default) +``` +Remove-AzSiteRecoveryReplicationvCenter -FabricName -ResourceGroupName + -ResourceName -VcenterName [-SubscriptionId ] [-DefaultProfile ] [-AsJob] + [-NoWait] [-PassThru] [-Confirm] [-WhatIf] [] +``` + +### DeleteViaIdentity +``` +Remove-AzSiteRecoveryReplicationvCenter -InputObject [-DefaultProfile ] + [-AsJob] [-NoWait] [-PassThru] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +The operation to remove(unregister) a registered vCenter server from the vault. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FabricName +Fabric name. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +Parameter Sets: DeleteViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PassThru +Returns true when the command succeeds + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -VcenterName +vcenter name. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity + +## OUTPUTS + +### System.Boolean + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`INPUTOBJECT `: Identity Parameter + - `[AlertSettingName ]`: The name of the email notification configuration. + - `[EventName ]`: The name of the Azure Site Recovery event. + - `[FabricName ]`: Fabric name. + - `[Id ]`: Resource identity path + - `[IntentObjectName ]`: Replication protection intent name. + - `[JobName ]`: Job identifier. + - `[LogicalNetworkName ]`: Logical network name. + - `[MappingName ]`: Protection Container mapping name. + - `[MigrationItemName ]`: Migration item name. + - `[MigrationRecoveryPointName ]`: The migration recovery point name. + - `[NetworkMappingName ]`: Network mapping name. + - `[NetworkName ]`: Primary network name. + - `[PolicyName ]`: Replication policy name. + - `[ProtectableItemName ]`: Protectable item name. + - `[ProtectionContainerName ]`: Protection container name. + - `[ProviderName ]`: Recovery services provider name. + - `[RecoveryPlanName ]`: Name of the recovery plan. + - `[RecoveryPointName ]`: The recovery point name. + - `[ReplicatedProtectedItemName ]`: Replication protected item name. + - `[ResourceGroupName ]`: The name of the resource group where the recovery services vault is present. + - `[ResourceName ]`: The name of the recovery services vault. + - `[StorageClassificationMappingName ]`: Storage classification mapping name. + - `[StorageClassificationName ]`: Storage classification name. + - `[SubscriptionId ]`: The subscription Id. + - `[VaultSettingName ]`: Vault setting name. + - `[VcenterName ]`: vcenter name. + - `[VirtualMachineName ]`: Virtual Machine name. + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/Repair-AzSiteRecoveryReplicationProtectedItemReplication.md b/swaggerci/recoveryservicessiterecovery/docs/Repair-AzSiteRecoveryReplicationProtectedItemReplication.md new file mode 100644 index 000000000000..333bf8c3abfd --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/Repair-AzSiteRecoveryReplicationProtectedItemReplication.md @@ -0,0 +1,290 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/repair-azsiterecoveryreplicationprotecteditemreplication +schema: 2.0.0 +--- + +# Repair-AzSiteRecoveryReplicationProtectedItemReplication + +## SYNOPSIS +The operation to start resynchronize/repair replication for a replication protected item requiring resynchronization. + +## SYNTAX + +### Repair (Default) +``` +Repair-AzSiteRecoveryReplicationProtectedItemReplication -FabricName + -ProtectionContainerName -ReplicatedProtectedItemName -ResourceGroupName + -ResourceName [-SubscriptionId ] [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] + [-WhatIf] [] +``` + +### RepairViaIdentity +``` +Repair-AzSiteRecoveryReplicationProtectedItemReplication -InputObject + [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +The operation to start resynchronize/repair replication for a replication protected item requiring resynchronization. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FabricName +The name of the fabric. + +```yaml +Type: System.String +Parameter Sets: Repair +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +Parameter Sets: RepairViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProtectionContainerName +The name of the container. + +```yaml +Type: System.String +Parameter Sets: Repair +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ReplicatedProtectedItemName +The name of the replication protected item. + +```yaml +Type: System.String +Parameter Sets: Repair +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: Repair +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: Repair +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String +Parameter Sets: Repair +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`INPUTOBJECT `: Identity Parameter + - `[AlertSettingName ]`: The name of the email notification configuration. + - `[EventName ]`: The name of the Azure Site Recovery event. + - `[FabricName ]`: Fabric name. + - `[Id ]`: Resource identity path + - `[IntentObjectName ]`: Replication protection intent name. + - `[JobName ]`: Job identifier. + - `[LogicalNetworkName ]`: Logical network name. + - `[MappingName ]`: Protection Container mapping name. + - `[MigrationItemName ]`: Migration item name. + - `[MigrationRecoveryPointName ]`: The migration recovery point name. + - `[NetworkMappingName ]`: Network mapping name. + - `[NetworkName ]`: Primary network name. + - `[PolicyName ]`: Replication policy name. + - `[ProtectableItemName ]`: Protectable item name. + - `[ProtectionContainerName ]`: Protection container name. + - `[ProviderName ]`: Recovery services provider name. + - `[RecoveryPlanName ]`: Name of the recovery plan. + - `[RecoveryPointName ]`: The recovery point name. + - `[ReplicatedProtectedItemName ]`: Replication protected item name. + - `[ResourceGroupName ]`: The name of the resource group where the recovery services vault is present. + - `[ResourceName ]`: The name of the recovery services vault. + - `[StorageClassificationMappingName ]`: Storage classification mapping name. + - `[StorageClassificationName ]`: Storage classification name. + - `[SubscriptionId ]`: The subscription Id. + - `[VaultSettingName ]`: Vault setting name. + - `[VcenterName ]`: vcenter name. + - `[VirtualMachineName ]`: Virtual Machine name. + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/Resolve-AzSiteRecoveryReplicationProtectedItemHealthError.md b/swaggerci/recoveryservicessiterecovery/docs/Resolve-AzSiteRecoveryReplicationProtectedItemHealthError.md new file mode 100644 index 000000000000..a2e90f8ce804 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/Resolve-AzSiteRecoveryReplicationProtectedItemHealthError.md @@ -0,0 +1,347 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/resolve-azsiterecoveryreplicationprotecteditemhealtherror +schema: 2.0.0 +--- + +# Resolve-AzSiteRecoveryReplicationProtectedItemHealthError + +## SYNOPSIS +Operation to resolve health issues of the replication protected item. + +## SYNTAX + +### ResolveExpanded (Default) +``` +Resolve-AzSiteRecoveryReplicationProtectedItemHealthError -FabricName + -ProtectionContainerName -ReplicatedProtectedItemName -ResourceGroupName + -ResourceName [-SubscriptionId ] [-HealthError ] + [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +### Resolve +``` +Resolve-AzSiteRecoveryReplicationProtectedItemHealthError -FabricName + -ProtectionContainerName -ReplicatedProtectedItemName -ResourceGroupName + -ResourceName -ResolveHealthInput [-SubscriptionId ] + [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +### ResolveViaIdentity +``` +Resolve-AzSiteRecoveryReplicationProtectedItemHealthError -InputObject + -ResolveHealthInput [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] + [-WhatIf] [] +``` + +### ResolveViaIdentityExpanded +``` +Resolve-AzSiteRecoveryReplicationProtectedItemHealthError -InputObject + [-HealthError ] [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] + [] +``` + +## DESCRIPTION +Operation to resolve health issues of the replication protected item. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FabricName +Unique fabric name. + +```yaml +Type: System.String +Parameter Sets: Resolve, ResolveExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -HealthError +Health errors. +To construct, see NOTES section for HEALTHERROR properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResolveHealthError[] +Parameter Sets: ResolveExpanded, ResolveViaIdentityExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +Parameter Sets: ResolveViaIdentity, ResolveViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProtectionContainerName +Protection container name. + +```yaml +Type: System.String +Parameter Sets: Resolve, ResolveExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ReplicatedProtectedItemName +Replication protected item name. + +```yaml +Type: System.String +Parameter Sets: Resolve, ResolveExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResolveHealthInput +Resolve health input. +To construct, see NOTES section for RESOLVEHEALTHINPUT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResolveHealthInput +Parameter Sets: Resolve, ResolveViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: Resolve, ResolveExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: Resolve, ResolveExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String +Parameter Sets: Resolve, ResolveExpanded +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResolveHealthInput + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`HEALTHERROR `: Health errors. + - `[HealthErrorId ]`: Health error id. + +`INPUTOBJECT `: Identity Parameter + - `[AlertSettingName ]`: The name of the email notification configuration. + - `[EventName ]`: The name of the Azure Site Recovery event. + - `[FabricName ]`: Fabric name. + - `[Id ]`: Resource identity path + - `[IntentObjectName ]`: Replication protection intent name. + - `[JobName ]`: Job identifier. + - `[LogicalNetworkName ]`: Logical network name. + - `[MappingName ]`: Protection Container mapping name. + - `[MigrationItemName ]`: Migration item name. + - `[MigrationRecoveryPointName ]`: The migration recovery point name. + - `[NetworkMappingName ]`: Network mapping name. + - `[NetworkName ]`: Primary network name. + - `[PolicyName ]`: Replication policy name. + - `[ProtectableItemName ]`: Protectable item name. + - `[ProtectionContainerName ]`: Protection container name. + - `[ProviderName ]`: Recovery services provider name. + - `[RecoveryPlanName ]`: Name of the recovery plan. + - `[RecoveryPointName ]`: The recovery point name. + - `[ReplicatedProtectedItemName ]`: Replication protected item name. + - `[ResourceGroupName ]`: The name of the resource group where the recovery services vault is present. + - `[ResourceName ]`: The name of the recovery services vault. + - `[StorageClassificationMappingName ]`: Storage classification mapping name. + - `[StorageClassificationName ]`: Storage classification name. + - `[SubscriptionId ]`: The subscription Id. + - `[VaultSettingName ]`: Vault setting name. + - `[VcenterName ]`: vcenter name. + - `[VirtualMachineName ]`: Virtual Machine name. + +`RESOLVEHEALTHINPUT `: Resolve health input. + - `[HealthError ]`: Health errors. + - `[HealthErrorId ]`: Health error id. + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/Restart-AzSiteRecoveryReplicationJob.md b/swaggerci/recoveryservicessiterecovery/docs/Restart-AzSiteRecoveryReplicationJob.md new file mode 100644 index 000000000000..d7c1bb4fec61 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/Restart-AzSiteRecoveryReplicationJob.md @@ -0,0 +1,259 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/restart-azsiterecoveryreplicationjob +schema: 2.0.0 +--- + +# Restart-AzSiteRecoveryReplicationJob + +## SYNOPSIS +The operation to restart an Azure Site Recovery job. + +## SYNTAX + +### Restart (Default) +``` +Restart-AzSiteRecoveryReplicationJob -JobName -ResourceGroupName -ResourceName + [-SubscriptionId ] [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] + [] +``` + +### RestartViaIdentity +``` +Restart-AzSiteRecoveryReplicationJob -InputObject [-DefaultProfile ] + [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +The operation to restart an Azure Site Recovery job. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +Parameter Sets: RestartViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -JobName +Job identifier. + +```yaml +Type: System.String +Parameter Sets: Restart +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: Restart +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: Restart +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String +Parameter Sets: Restart +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJob + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`INPUTOBJECT `: Identity Parameter + - `[AlertSettingName ]`: The name of the email notification configuration. + - `[EventName ]`: The name of the Azure Site Recovery event. + - `[FabricName ]`: Fabric name. + - `[Id ]`: Resource identity path + - `[IntentObjectName ]`: Replication protection intent name. + - `[JobName ]`: Job identifier. + - `[LogicalNetworkName ]`: Logical network name. + - `[MappingName ]`: Protection Container mapping name. + - `[MigrationItemName ]`: Migration item name. + - `[MigrationRecoveryPointName ]`: The migration recovery point name. + - `[NetworkMappingName ]`: Network mapping name. + - `[NetworkName ]`: Primary network name. + - `[PolicyName ]`: Replication policy name. + - `[ProtectableItemName ]`: Protectable item name. + - `[ProtectionContainerName ]`: Protection container name. + - `[ProviderName ]`: Recovery services provider name. + - `[RecoveryPlanName ]`: Name of the recovery plan. + - `[RecoveryPointName ]`: The recovery point name. + - `[ReplicatedProtectedItemName ]`: Replication protected item name. + - `[ResourceGroupName ]`: The name of the resource group where the recovery services vault is present. + - `[ResourceName ]`: The name of the recovery services vault. + - `[StorageClassificationMappingName ]`: Storage classification mapping name. + - `[StorageClassificationName ]`: Storage classification name. + - `[SubscriptionId ]`: The subscription Id. + - `[VaultSettingName ]`: Vault setting name. + - `[VcenterName ]`: vcenter name. + - `[VirtualMachineName ]`: Virtual Machine name. + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/Resume-AzSiteRecoveryReplicationJob.md b/swaggerci/recoveryservicessiterecovery/docs/Resume-AzSiteRecoveryReplicationJob.md new file mode 100644 index 000000000000..c4dfbee3c77a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/Resume-AzSiteRecoveryReplicationJob.md @@ -0,0 +1,308 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/resume-azsiterecoveryreplicationjob +schema: 2.0.0 +--- + +# Resume-AzSiteRecoveryReplicationJob + +## SYNOPSIS +The operation to resume an Azure Site Recovery job. + +## SYNTAX + +### ResumeExpanded (Default) +``` +Resume-AzSiteRecoveryReplicationJob -JobName -ResourceGroupName -ResourceName + [-SubscriptionId ] [-Comment ] [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] + [-WhatIf] [] +``` + +### Resume +``` +Resume-AzSiteRecoveryReplicationJob -JobName -ResourceGroupName -ResourceName + -ResumeJobParam [-SubscriptionId ] [-DefaultProfile ] [-AsJob] [-NoWait] + [-Confirm] [-WhatIf] [] +``` + +### ResumeViaIdentity +``` +Resume-AzSiteRecoveryReplicationJob -InputObject -ResumeJobParam + [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +### ResumeViaIdentityExpanded +``` +Resume-AzSiteRecoveryReplicationJob -InputObject [-Comment ] + [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +The operation to resume an Azure Site Recovery job. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Comment +Resume job comments. + +```yaml +Type: System.String +Parameter Sets: ResumeExpanded, ResumeViaIdentityExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +Parameter Sets: ResumeViaIdentity, ResumeViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -JobName +Job identifier. + +```yaml +Type: System.String +Parameter Sets: Resume, ResumeExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: Resume, ResumeExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: Resume, ResumeExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResumeJobParam +Resume job params. +To construct, see NOTES section for RESUMEJOBPARAM properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeJobParams +Parameter Sets: Resume, ResumeViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String +Parameter Sets: Resume, ResumeExpanded +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeJobParams + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJob + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`INPUTOBJECT `: Identity Parameter + - `[AlertSettingName ]`: The name of the email notification configuration. + - `[EventName ]`: The name of the Azure Site Recovery event. + - `[FabricName ]`: Fabric name. + - `[Id ]`: Resource identity path + - `[IntentObjectName ]`: Replication protection intent name. + - `[JobName ]`: Job identifier. + - `[LogicalNetworkName ]`: Logical network name. + - `[MappingName ]`: Protection Container mapping name. + - `[MigrationItemName ]`: Migration item name. + - `[MigrationRecoveryPointName ]`: The migration recovery point name. + - `[NetworkMappingName ]`: Network mapping name. + - `[NetworkName ]`: Primary network name. + - `[PolicyName ]`: Replication policy name. + - `[ProtectableItemName ]`: Protectable item name. + - `[ProtectionContainerName ]`: Protection container name. + - `[ProviderName ]`: Recovery services provider name. + - `[RecoveryPlanName ]`: Name of the recovery plan. + - `[RecoveryPointName ]`: The recovery point name. + - `[ReplicatedProtectedItemName ]`: Replication protected item name. + - `[ResourceGroupName ]`: The name of the resource group where the recovery services vault is present. + - `[ResourceName ]`: The name of the recovery services vault. + - `[StorageClassificationMappingName ]`: Storage classification mapping name. + - `[StorageClassificationName ]`: Storage classification name. + - `[SubscriptionId ]`: The subscription Id. + - `[VaultSettingName ]`: Vault setting name. + - `[VcenterName ]`: vcenter name. + - `[VirtualMachineName ]`: Virtual Machine name. + +`RESUMEJOBPARAM `: Resume job params. + - `[Comment ]`: Resume job comments. + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/Resume-AzSiteRecoveryReplicationMigrationItemReplication.md b/swaggerci/recoveryservicessiterecovery/docs/Resume-AzSiteRecoveryReplicationMigrationItemReplication.md new file mode 100644 index 000000000000..80d80c599126 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/Resume-AzSiteRecoveryReplicationMigrationItemReplication.md @@ -0,0 +1,342 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/resume-azsiterecoveryreplicationmigrationitemreplication +schema: 2.0.0 +--- + +# Resume-AzSiteRecoveryReplicationMigrationItemReplication + +## SYNOPSIS +The operation to initiate resume replication of the item. + +## SYNTAX + +### ResumeExpanded (Default) +``` +Resume-AzSiteRecoveryReplicationMigrationItemReplication -FabricName -MigrationItemName + -ProtectionContainerName -ResourceGroupName -ResourceName + -ProviderSpecificDetailInstanceType [-SubscriptionId ] [-DefaultProfile ] [-AsJob] + [-NoWait] [-Confirm] [-WhatIf] [] +``` + +### Resume +``` +Resume-AzSiteRecoveryReplicationMigrationItemReplication -FabricName -MigrationItemName + -ProtectionContainerName -ResourceGroupName -ResourceName + -ResumeReplicationInput [-SubscriptionId ] [-DefaultProfile ] + [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +### ResumeViaIdentity +``` +Resume-AzSiteRecoveryReplicationMigrationItemReplication -InputObject + -ResumeReplicationInput [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] + [-WhatIf] [] +``` + +### ResumeViaIdentityExpanded +``` +Resume-AzSiteRecoveryReplicationMigrationItemReplication -InputObject + -ProviderSpecificDetailInstanceType [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] + [-WhatIf] [] +``` + +## DESCRIPTION +The operation to initiate resume replication of the item. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FabricName +Fabric name. + +```yaml +Type: System.String +Parameter Sets: Resume, ResumeExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +Parameter Sets: ResumeViaIdentity, ResumeViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -MigrationItemName +Migration item name. + +```yaml +Type: System.String +Parameter Sets: Resume, ResumeExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProtectionContainerName +Protection container name. + +```yaml +Type: System.String +Parameter Sets: Resume, ResumeExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProviderSpecificDetailInstanceType +The class type. + +```yaml +Type: System.String +Parameter Sets: ResumeExpanded, ResumeViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: Resume, ResumeExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: Resume, ResumeExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResumeReplicationInput +Resume replication input. +To construct, see NOTES section for RESUMEREPLICATIONINPUT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationInput +Parameter Sets: Resume, ResumeViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String +Parameter Sets: Resume, ResumeExpanded +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationInput + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`INPUTOBJECT `: Identity Parameter + - `[AlertSettingName ]`: The name of the email notification configuration. + - `[EventName ]`: The name of the Azure Site Recovery event. + - `[FabricName ]`: Fabric name. + - `[Id ]`: Resource identity path + - `[IntentObjectName ]`: Replication protection intent name. + - `[JobName ]`: Job identifier. + - `[LogicalNetworkName ]`: Logical network name. + - `[MappingName ]`: Protection Container mapping name. + - `[MigrationItemName ]`: Migration item name. + - `[MigrationRecoveryPointName ]`: The migration recovery point name. + - `[NetworkMappingName ]`: Network mapping name. + - `[NetworkName ]`: Primary network name. + - `[PolicyName ]`: Replication policy name. + - `[ProtectableItemName ]`: Protectable item name. + - `[ProtectionContainerName ]`: Protection container name. + - `[ProviderName ]`: Recovery services provider name. + - `[RecoveryPlanName ]`: Name of the recovery plan. + - `[RecoveryPointName ]`: The recovery point name. + - `[ReplicatedProtectedItemName ]`: Replication protected item name. + - `[ResourceGroupName ]`: The name of the resource group where the recovery services vault is present. + - `[ResourceName ]`: The name of the recovery services vault. + - `[StorageClassificationMappingName ]`: Storage classification mapping name. + - `[StorageClassificationName ]`: Storage classification name. + - `[SubscriptionId ]`: The subscription Id. + - `[VaultSettingName ]`: Vault setting name. + - `[VcenterName ]`: vcenter name. + - `[VirtualMachineName ]`: Virtual Machine name. + +`RESUMEREPLICATIONINPUT `: Resume replication input. + - `ProviderSpecificDetailInstanceType `: The class type. + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/Stop-AzSiteRecoveryReplicationJob.md b/swaggerci/recoveryservicessiterecovery/docs/Stop-AzSiteRecoveryReplicationJob.md new file mode 100644 index 000000000000..6e76468199b0 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/Stop-AzSiteRecoveryReplicationJob.md @@ -0,0 +1,259 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/stop-azsiterecoveryreplicationjob +schema: 2.0.0 +--- + +# Stop-AzSiteRecoveryReplicationJob + +## SYNOPSIS +The operation to cancel an Azure Site Recovery job. + +## SYNTAX + +### Cancel (Default) +``` +Stop-AzSiteRecoveryReplicationJob -JobName -ResourceGroupName -ResourceName + [-SubscriptionId ] [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] + [] +``` + +### CancelViaIdentity +``` +Stop-AzSiteRecoveryReplicationJob -InputObject [-DefaultProfile ] [-AsJob] + [-NoWait] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +The operation to cancel an Azure Site Recovery job. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +Parameter Sets: CancelViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -JobName +Job identifier. + +```yaml +Type: System.String +Parameter Sets: Cancel +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: Cancel +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: Cancel +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String +Parameter Sets: Cancel +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJob + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`INPUTOBJECT `: Identity Parameter + - `[AlertSettingName ]`: The name of the email notification configuration. + - `[EventName ]`: The name of the Azure Site Recovery event. + - `[FabricName ]`: Fabric name. + - `[Id ]`: Resource identity path + - `[IntentObjectName ]`: Replication protection intent name. + - `[JobName ]`: Job identifier. + - `[LogicalNetworkName ]`: Logical network name. + - `[MappingName ]`: Protection Container mapping name. + - `[MigrationItemName ]`: Migration item name. + - `[MigrationRecoveryPointName ]`: The migration recovery point name. + - `[NetworkMappingName ]`: Network mapping name. + - `[NetworkName ]`: Primary network name. + - `[PolicyName ]`: Replication policy name. + - `[ProtectableItemName ]`: Protectable item name. + - `[ProtectionContainerName ]`: Protection container name. + - `[ProviderName ]`: Recovery services provider name. + - `[RecoveryPlanName ]`: Name of the recovery plan. + - `[RecoveryPointName ]`: The recovery point name. + - `[ReplicatedProtectedItemName ]`: Replication protected item name. + - `[ResourceGroupName ]`: The name of the resource group where the recovery services vault is present. + - `[ResourceName ]`: The name of the recovery services vault. + - `[StorageClassificationMappingName ]`: Storage classification mapping name. + - `[StorageClassificationName ]`: Storage classification name. + - `[SubscriptionId ]`: The subscription Id. + - `[VaultSettingName ]`: Vault setting name. + - `[VcenterName ]`: vcenter name. + - `[VirtualMachineName ]`: Virtual Machine name. + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/Stop-AzSiteRecoveryReplicationProtectedItemFailover.md b/swaggerci/recoveryservicessiterecovery/docs/Stop-AzSiteRecoveryReplicationProtectedItemFailover.md new file mode 100644 index 000000000000..c2e099c014e0 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/Stop-AzSiteRecoveryReplicationProtectedItemFailover.md @@ -0,0 +1,290 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/stop-azsiterecoveryreplicationprotecteditemfailover +schema: 2.0.0 +--- + +# Stop-AzSiteRecoveryReplicationProtectedItemFailover + +## SYNOPSIS +Operation to cancel the failover of the replication protected item. + +## SYNTAX + +### Cancel (Default) +``` +Stop-AzSiteRecoveryReplicationProtectedItemFailover -FabricName -ProtectionContainerName + -ReplicatedProtectedItemName -ResourceGroupName -ResourceName + [-SubscriptionId ] [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] + [] +``` + +### CancelViaIdentity +``` +Stop-AzSiteRecoveryReplicationProtectedItemFailover -InputObject + [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Operation to cancel the failover of the replication protected item. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FabricName +Unique fabric name. + +```yaml +Type: System.String +Parameter Sets: Cancel +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +Parameter Sets: CancelViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProtectionContainerName +Protection container name. + +```yaml +Type: System.String +Parameter Sets: Cancel +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ReplicatedProtectedItemName +Replication protected item name. + +```yaml +Type: System.String +Parameter Sets: Cancel +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: Cancel +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: Cancel +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String +Parameter Sets: Cancel +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`INPUTOBJECT `: Identity Parameter + - `[AlertSettingName ]`: The name of the email notification configuration. + - `[EventName ]`: The name of the Azure Site Recovery event. + - `[FabricName ]`: Fabric name. + - `[Id ]`: Resource identity path + - `[IntentObjectName ]`: Replication protection intent name. + - `[JobName ]`: Job identifier. + - `[LogicalNetworkName ]`: Logical network name. + - `[MappingName ]`: Protection Container mapping name. + - `[MigrationItemName ]`: Migration item name. + - `[MigrationRecoveryPointName ]`: The migration recovery point name. + - `[NetworkMappingName ]`: Network mapping name. + - `[NetworkName ]`: Primary network name. + - `[PolicyName ]`: Replication policy name. + - `[ProtectableItemName ]`: Protectable item name. + - `[ProtectionContainerName ]`: Protection container name. + - `[ProviderName ]`: Recovery services provider name. + - `[RecoveryPlanName ]`: Name of the recovery plan. + - `[RecoveryPointName ]`: The recovery point name. + - `[ReplicatedProtectedItemName ]`: Replication protected item name. + - `[ResourceGroupName ]`: The name of the resource group where the recovery services vault is present. + - `[ResourceName ]`: The name of the recovery services vault. + - `[StorageClassificationMappingName ]`: Storage classification mapping name. + - `[StorageClassificationName ]`: Storage classification name. + - `[SubscriptionId ]`: The subscription Id. + - `[VaultSettingName ]`: Vault setting name. + - `[VcenterName ]`: vcenter name. + - `[VirtualMachineName ]`: Virtual Machine name. + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/Stop-AzSiteRecoveryReplicationRecoveryPlanFailover.md b/swaggerci/recoveryservicessiterecovery/docs/Stop-AzSiteRecoveryReplicationRecoveryPlanFailover.md new file mode 100644 index 000000000000..ca5b3bafacf1 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/Stop-AzSiteRecoveryReplicationRecoveryPlanFailover.md @@ -0,0 +1,259 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/stop-azsiterecoveryreplicationrecoveryplanfailover +schema: 2.0.0 +--- + +# Stop-AzSiteRecoveryReplicationRecoveryPlanFailover + +## SYNOPSIS +The operation to cancel the failover of a recovery plan. + +## SYNTAX + +### Cancel (Default) +``` +Stop-AzSiteRecoveryReplicationRecoveryPlanFailover -RecoveryPlanName -ResourceGroupName + -ResourceName [-SubscriptionId ] [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] + [-WhatIf] [] +``` + +### CancelViaIdentity +``` +Stop-AzSiteRecoveryReplicationRecoveryPlanFailover -InputObject + [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +The operation to cancel the failover of a recovery plan. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +Parameter Sets: CancelViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -RecoveryPlanName +Recovery plan name. + +```yaml +Type: System.String +Parameter Sets: Cancel +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: Cancel +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: Cancel +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String +Parameter Sets: Cancel +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`INPUTOBJECT `: Identity Parameter + - `[AlertSettingName ]`: The name of the email notification configuration. + - `[EventName ]`: The name of the Azure Site Recovery event. + - `[FabricName ]`: Fabric name. + - `[Id ]`: Resource identity path + - `[IntentObjectName ]`: Replication protection intent name. + - `[JobName ]`: Job identifier. + - `[LogicalNetworkName ]`: Logical network name. + - `[MappingName ]`: Protection Container mapping name. + - `[MigrationItemName ]`: Migration item name. + - `[MigrationRecoveryPointName ]`: The migration recovery point name. + - `[NetworkMappingName ]`: Network mapping name. + - `[NetworkName ]`: Primary network name. + - `[PolicyName ]`: Replication policy name. + - `[ProtectableItemName ]`: Protectable item name. + - `[ProtectionContainerName ]`: Protection container name. + - `[ProviderName ]`: Recovery services provider name. + - `[RecoveryPlanName ]`: Name of the recovery plan. + - `[RecoveryPointName ]`: The recovery point name. + - `[ReplicatedProtectedItemName ]`: Replication protected item name. + - `[ResourceGroupName ]`: The name of the resource group where the recovery services vault is present. + - `[ResourceName ]`: The name of the recovery services vault. + - `[StorageClassificationMappingName ]`: Storage classification mapping name. + - `[StorageClassificationName ]`: Storage classification name. + - `[SubscriptionId ]`: The subscription Id. + - `[VaultSettingName ]`: Vault setting name. + - `[VcenterName ]`: vcenter name. + - `[VirtualMachineName ]`: Virtual Machine name. + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/Suspend-AzSiteRecoveryReplicationMigrationItemReplication.md b/swaggerci/recoveryservicessiterecovery/docs/Suspend-AzSiteRecoveryReplicationMigrationItemReplication.md new file mode 100644 index 000000000000..96ee7bc8b491 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/Suspend-AzSiteRecoveryReplicationMigrationItemReplication.md @@ -0,0 +1,342 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/suspend-azsiterecoveryreplicationmigrationitemreplication +schema: 2.0.0 +--- + +# Suspend-AzSiteRecoveryReplicationMigrationItemReplication + +## SYNOPSIS +The operation to initiate pause replication of the item. + +## SYNTAX + +### PauseExpanded (Default) +``` +Suspend-AzSiteRecoveryReplicationMigrationItemReplication -FabricName -MigrationItemName + -ProtectionContainerName -ResourceGroupName -ResourceName -InstanceType + [-SubscriptionId ] [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] + [] +``` + +### Pause +``` +Suspend-AzSiteRecoveryReplicationMigrationItemReplication -FabricName -MigrationItemName + -ProtectionContainerName -ResourceGroupName -ResourceName + -PauseReplicationInput [-SubscriptionId ] [-DefaultProfile ] + [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +### PauseViaIdentity +``` +Suspend-AzSiteRecoveryReplicationMigrationItemReplication -InputObject + -PauseReplicationInput [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] + [-WhatIf] [] +``` + +### PauseViaIdentityExpanded +``` +Suspend-AzSiteRecoveryReplicationMigrationItemReplication -InputObject + -InstanceType [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] + [] +``` + +## DESCRIPTION +The operation to initiate pause replication of the item. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FabricName +Fabric name. + +```yaml +Type: System.String +Parameter Sets: Pause, PauseExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +Parameter Sets: PauseViaIdentity, PauseViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -InstanceType +The class type. + +```yaml +Type: System.String +Parameter Sets: PauseExpanded, PauseViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -MigrationItemName +Migration item name. + +```yaml +Type: System.String +Parameter Sets: Pause, PauseExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PauseReplicationInput +Pause replication input. +To construct, see NOTES section for PAUSEREPLICATIONINPUT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPauseReplicationInput +Parameter Sets: Pause, PauseViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -ProtectionContainerName +Protection container name. + +```yaml +Type: System.String +Parameter Sets: Pause, PauseExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: Pause, PauseExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: Pause, PauseExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String +Parameter Sets: Pause, PauseExpanded +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPauseReplicationInput + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`INPUTOBJECT `: Identity Parameter + - `[AlertSettingName ]`: The name of the email notification configuration. + - `[EventName ]`: The name of the Azure Site Recovery event. + - `[FabricName ]`: Fabric name. + - `[Id ]`: Resource identity path + - `[IntentObjectName ]`: Replication protection intent name. + - `[JobName ]`: Job identifier. + - `[LogicalNetworkName ]`: Logical network name. + - `[MappingName ]`: Protection Container mapping name. + - `[MigrationItemName ]`: Migration item name. + - `[MigrationRecoveryPointName ]`: The migration recovery point name. + - `[NetworkMappingName ]`: Network mapping name. + - `[NetworkName ]`: Primary network name. + - `[PolicyName ]`: Replication policy name. + - `[ProtectableItemName ]`: Protectable item name. + - `[ProtectionContainerName ]`: Protection container name. + - `[ProviderName ]`: Recovery services provider name. + - `[RecoveryPlanName ]`: Name of the recovery plan. + - `[RecoveryPointName ]`: The recovery point name. + - `[ReplicatedProtectedItemName ]`: Replication protected item name. + - `[ResourceGroupName ]`: The name of the resource group where the recovery services vault is present. + - `[ResourceName ]`: The name of the recovery services vault. + - `[StorageClassificationMappingName ]`: Storage classification mapping name. + - `[StorageClassificationName ]`: Storage classification name. + - `[SubscriptionId ]`: The subscription Id. + - `[VaultSettingName ]`: Vault setting name. + - `[VcenterName ]`: vcenter name. + - `[VirtualMachineName ]`: Virtual Machine name. + +`PAUSEREPLICATIONINPUT `: Pause replication input. + - `InstanceType `: The class type. + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/Switch-AzSiteRecoveryReplicationProtectedItemProvider.md b/swaggerci/recoveryservicessiterecovery/docs/Switch-AzSiteRecoveryReplicationProtectedItemProvider.md new file mode 100644 index 000000000000..e3847f4b66ec --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/Switch-AzSiteRecoveryReplicationProtectedItemProvider.md @@ -0,0 +1,358 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/switch-azsiterecoveryreplicationprotecteditemprovider +schema: 2.0.0 +--- + +# Switch-AzSiteRecoveryReplicationProtectedItemProvider + +## SYNOPSIS +Operation to initiate a switch provider of the replication protected item. + +## SYNTAX + +### SwitchExpanded (Default) +``` +Switch-AzSiteRecoveryReplicationProtectedItemProvider -FabricName -ProtectionContainerName + -ReplicatedProtectedItemName -ResourceGroupName -ResourceName + [-SubscriptionId ] [-ProviderSpecificDetailInstanceType ] [-TargetInstanceType ] + [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +### Switch +``` +Switch-AzSiteRecoveryReplicationProtectedItemProvider -FabricName -ProtectionContainerName + -ReplicatedProtectedItemName -ResourceGroupName -ResourceName + -SwitchProviderInput [-SubscriptionId ] [-DefaultProfile ] [-AsJob] + [-NoWait] [-Confirm] [-WhatIf] [] +``` + +### SwitchViaIdentity +``` +Switch-AzSiteRecoveryReplicationProtectedItemProvider -InputObject + -SwitchProviderInput [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] + [-WhatIf] [] +``` + +### SwitchViaIdentityExpanded +``` +Switch-AzSiteRecoveryReplicationProtectedItemProvider -InputObject + [-ProviderSpecificDetailInstanceType ] [-TargetInstanceType ] [-DefaultProfile ] + [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Operation to initiate a switch provider of the replication protected item. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FabricName +Unique fabric name. + +```yaml +Type: System.String +Parameter Sets: Switch, SwitchExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +Parameter Sets: SwitchViaIdentity, SwitchViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProtectionContainerName +Protection container name. + +```yaml +Type: System.String +Parameter Sets: Switch, SwitchExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProviderSpecificDetailInstanceType +The class type. + +```yaml +Type: System.String +Parameter Sets: SwitchExpanded, SwitchViaIdentityExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ReplicatedProtectedItemName +Replication protected item name. + +```yaml +Type: System.String +Parameter Sets: Switch, SwitchExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: Switch, SwitchExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: Switch, SwitchExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String +Parameter Sets: Switch, SwitchExpanded +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SwitchProviderInput +Input definition for switch provider. +To construct, see NOTES section for SWITCHPROVIDERINPUT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderInput +Parameter Sets: Switch, SwitchViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -TargetInstanceType +Target provider type. + +```yaml +Type: System.String +Parameter Sets: SwitchExpanded, SwitchViaIdentityExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderInput + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`INPUTOBJECT `: Identity Parameter + - `[AlertSettingName ]`: The name of the email notification configuration. + - `[EventName ]`: The name of the Azure Site Recovery event. + - `[FabricName ]`: Fabric name. + - `[Id ]`: Resource identity path + - `[IntentObjectName ]`: Replication protection intent name. + - `[JobName ]`: Job identifier. + - `[LogicalNetworkName ]`: Logical network name. + - `[MappingName ]`: Protection Container mapping name. + - `[MigrationItemName ]`: Migration item name. + - `[MigrationRecoveryPointName ]`: The migration recovery point name. + - `[NetworkMappingName ]`: Network mapping name. + - `[NetworkName ]`: Primary network name. + - `[PolicyName ]`: Replication policy name. + - `[ProtectableItemName ]`: Protectable item name. + - `[ProtectionContainerName ]`: Protection container name. + - `[ProviderName ]`: Recovery services provider name. + - `[RecoveryPlanName ]`: Name of the recovery plan. + - `[RecoveryPointName ]`: The recovery point name. + - `[ReplicatedProtectedItemName ]`: Replication protected item name. + - `[ResourceGroupName ]`: The name of the resource group where the recovery services vault is present. + - `[ResourceName ]`: The name of the recovery services vault. + - `[StorageClassificationMappingName ]`: Storage classification mapping name. + - `[StorageClassificationName ]`: Storage classification name. + - `[SubscriptionId ]`: The subscription Id. + - `[VaultSettingName ]`: Vault setting name. + - `[VcenterName ]`: vcenter name. + - `[VirtualMachineName ]`: Virtual Machine name. + +`SWITCHPROVIDERINPUT `: Input definition for switch provider. + - `[ProviderSpecificDetailInstanceType ]`: The class type. + - `[TargetInstanceType ]`: Target provider type. + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/Switch-AzSiteRecoveryReplicationProtectionContainerProtection.md b/swaggerci/recoveryservicessiterecovery/docs/Switch-AzSiteRecoveryReplicationProtectionContainerProtection.md new file mode 100644 index 000000000000..96f713f4194c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/Switch-AzSiteRecoveryReplicationProtectionContainerProtection.md @@ -0,0 +1,344 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/switch-azsiterecoveryreplicationprotectioncontainerprotection +schema: 2.0.0 +--- + +# Switch-AzSiteRecoveryReplicationProtectionContainerProtection + +## SYNOPSIS +Operation to switch protection from one container to another or one replication provider to another. + +## SYNTAX + +### SwitchExpanded (Default) +``` +Switch-AzSiteRecoveryReplicationProtectionContainerProtection -FabricName + -ProtectionContainerName -ResourceGroupName -ResourceName + [-SubscriptionId ] [-ProviderSpecificDetailInstanceType ] + [-ReplicationProtectedItemName ] [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] + [] +``` + +### Switch +``` +Switch-AzSiteRecoveryReplicationProtectionContainerProtection -FabricName + -ProtectionContainerName -ResourceGroupName -ResourceName + -SwitchInput [-SubscriptionId ] [-DefaultProfile ] [-AsJob] + [-NoWait] [-Confirm] [-WhatIf] [] +``` + +### SwitchViaIdentity +``` +Switch-AzSiteRecoveryReplicationProtectionContainerProtection -InputObject + -SwitchInput [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] + [] +``` + +### SwitchViaIdentityExpanded +``` +Switch-AzSiteRecoveryReplicationProtectionContainerProtection -InputObject + [-ProviderSpecificDetailInstanceType ] [-ReplicationProtectedItemName ] + [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Operation to switch protection from one container to another or one replication provider to another. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FabricName +Unique fabric name. + +```yaml +Type: System.String +Parameter Sets: Switch, SwitchExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +Parameter Sets: SwitchViaIdentity, SwitchViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProtectionContainerName +Protection container name. + +```yaml +Type: System.String +Parameter Sets: Switch, SwitchExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProviderSpecificDetailInstanceType +Gets the Instance type. + +```yaml +Type: System.String +Parameter Sets: SwitchExpanded, SwitchViaIdentityExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ReplicationProtectedItemName +The unique replication protected item name. + +```yaml +Type: System.String +Parameter Sets: SwitchExpanded, SwitchViaIdentityExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: Switch, SwitchExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: Switch, SwitchExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String +Parameter Sets: Switch, SwitchExpanded +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SwitchInput +Switch protection input. +To construct, see NOTES section for SWITCHINPUT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionInput +Parameter Sets: Switch, SwitchViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionInput + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainer + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`INPUTOBJECT `: Identity Parameter + - `[AlertSettingName ]`: The name of the email notification configuration. + - `[EventName ]`: The name of the Azure Site Recovery event. + - `[FabricName ]`: Fabric name. + - `[Id ]`: Resource identity path + - `[IntentObjectName ]`: Replication protection intent name. + - `[JobName ]`: Job identifier. + - `[LogicalNetworkName ]`: Logical network name. + - `[MappingName ]`: Protection Container mapping name. + - `[MigrationItemName ]`: Migration item name. + - `[MigrationRecoveryPointName ]`: The migration recovery point name. + - `[NetworkMappingName ]`: Network mapping name. + - `[NetworkName ]`: Primary network name. + - `[PolicyName ]`: Replication policy name. + - `[ProtectableItemName ]`: Protectable item name. + - `[ProtectionContainerName ]`: Protection container name. + - `[ProviderName ]`: Recovery services provider name. + - `[RecoveryPlanName ]`: Name of the recovery plan. + - `[RecoveryPointName ]`: The recovery point name. + - `[ReplicatedProtectedItemName ]`: Replication protected item name. + - `[ResourceGroupName ]`: The name of the resource group where the recovery services vault is present. + - `[ResourceName ]`: The name of the recovery services vault. + - `[StorageClassificationMappingName ]`: Storage classification mapping name. + - `[StorageClassificationName ]`: Storage classification name. + - `[SubscriptionId ]`: The subscription Id. + - `[VaultSettingName ]`: Vault setting name. + - `[VcenterName ]`: vcenter name. + - `[VirtualMachineName ]`: Virtual Machine name. + +`SWITCHINPUT `: Switch protection input. + - `[ProviderSpecificDetailInstanceType ]`: Gets the Instance type. + - `[ReplicationProtectedItemName ]`: The unique replication protected item name. + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/Test-AzSiteRecoveryReplicationFabricConsistency.md b/swaggerci/recoveryservicessiterecovery/docs/Test-AzSiteRecoveryReplicationFabricConsistency.md new file mode 100644 index 000000000000..4a3a77998aed --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/Test-AzSiteRecoveryReplicationFabricConsistency.md @@ -0,0 +1,259 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/test-azsiterecoveryreplicationfabricconsistency +schema: 2.0.0 +--- + +# Test-AzSiteRecoveryReplicationFabricConsistency + +## SYNOPSIS +The operation to perform a consistency check on the fabric. + +## SYNTAX + +### Check (Default) +``` +Test-AzSiteRecoveryReplicationFabricConsistency -FabricName -ResourceGroupName + -ResourceName [-SubscriptionId ] [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] + [-WhatIf] [] +``` + +### CheckViaIdentity +``` +Test-AzSiteRecoveryReplicationFabricConsistency -InputObject + [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +The operation to perform a consistency check on the fabric. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FabricName +Fabric name. + +```yaml +Type: System.String +Parameter Sets: Check +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +Parameter Sets: CheckViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: Check +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: Check +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String +Parameter Sets: Check +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabric + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`INPUTOBJECT `: Identity Parameter + - `[AlertSettingName ]`: The name of the email notification configuration. + - `[EventName ]`: The name of the Azure Site Recovery event. + - `[FabricName ]`: Fabric name. + - `[Id ]`: Resource identity path + - `[IntentObjectName ]`: Replication protection intent name. + - `[JobName ]`: Job identifier. + - `[LogicalNetworkName ]`: Logical network name. + - `[MappingName ]`: Protection Container mapping name. + - `[MigrationItemName ]`: Migration item name. + - `[MigrationRecoveryPointName ]`: The migration recovery point name. + - `[NetworkMappingName ]`: Network mapping name. + - `[NetworkName ]`: Primary network name. + - `[PolicyName ]`: Replication policy name. + - `[ProtectableItemName ]`: Protectable item name. + - `[ProtectionContainerName ]`: Protection container name. + - `[ProviderName ]`: Recovery services provider name. + - `[RecoveryPlanName ]`: Name of the recovery plan. + - `[RecoveryPointName ]`: The recovery point name. + - `[ReplicatedProtectedItemName ]`: Replication protected item name. + - `[ResourceGroupName ]`: The name of the resource group where the recovery services vault is present. + - `[ResourceName ]`: The name of the recovery services vault. + - `[StorageClassificationMappingName ]`: Storage classification mapping name. + - `[StorageClassificationName ]`: Storage classification name. + - `[SubscriptionId ]`: The subscription Id. + - `[VaultSettingName ]`: Vault setting name. + - `[VcenterName ]`: vcenter name. + - `[VirtualMachineName ]`: Virtual Machine name. + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/Test-AzSiteRecoveryReplicationMigrationItemMigrate.md b/swaggerci/recoveryservicessiterecovery/docs/Test-AzSiteRecoveryReplicationMigrationItemMigrate.md new file mode 100644 index 000000000000..631ea79d26b9 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/Test-AzSiteRecoveryReplicationMigrationItemMigrate.md @@ -0,0 +1,342 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/test-azsiterecoveryreplicationmigrationitemmigrate +schema: 2.0.0 +--- + +# Test-AzSiteRecoveryReplicationMigrationItemMigrate + +## SYNOPSIS +The operation to initiate test migration of the item. + +## SYNTAX + +### TestExpanded (Default) +``` +Test-AzSiteRecoveryReplicationMigrationItemMigrate -FabricName -MigrationItemName + -ProtectionContainerName -ResourceGroupName -ResourceName + -ProviderSpecificDetailInstanceType [-SubscriptionId ] [-DefaultProfile ] [-AsJob] + [-NoWait] [-Confirm] [-WhatIf] [] +``` + +### Test +``` +Test-AzSiteRecoveryReplicationMigrationItemMigrate -FabricName -MigrationItemName + -ProtectionContainerName -ResourceGroupName -ResourceName + -TestMigrateInput [-SubscriptionId ] [-DefaultProfile ] [-AsJob] + [-NoWait] [-Confirm] [-WhatIf] [] +``` + +### TestViaIdentity +``` +Test-AzSiteRecoveryReplicationMigrationItemMigrate -InputObject + -TestMigrateInput [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] + [] +``` + +### TestViaIdentityExpanded +``` +Test-AzSiteRecoveryReplicationMigrationItemMigrate -InputObject + -ProviderSpecificDetailInstanceType [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] + [-WhatIf] [] +``` + +## DESCRIPTION +The operation to initiate test migration of the item. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FabricName +Fabric name. + +```yaml +Type: System.String +Parameter Sets: Test, TestExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +Parameter Sets: TestViaIdentity, TestViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -MigrationItemName +Migration item name. + +```yaml +Type: System.String +Parameter Sets: Test, TestExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProtectionContainerName +Protection container name. + +```yaml +Type: System.String +Parameter Sets: Test, TestExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProviderSpecificDetailInstanceType +The class type. + +```yaml +Type: System.String +Parameter Sets: TestExpanded, TestViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: Test, TestExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: Test, TestExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String +Parameter Sets: Test, TestExpanded +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TestMigrateInput +Input for test migrate. +To construct, see NOTES section for TESTMIGRATEINPUT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateInput +Parameter Sets: Test, TestViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateInput + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`INPUTOBJECT `: Identity Parameter + - `[AlertSettingName ]`: The name of the email notification configuration. + - `[EventName ]`: The name of the Azure Site Recovery event. + - `[FabricName ]`: Fabric name. + - `[Id ]`: Resource identity path + - `[IntentObjectName ]`: Replication protection intent name. + - `[JobName ]`: Job identifier. + - `[LogicalNetworkName ]`: Logical network name. + - `[MappingName ]`: Protection Container mapping name. + - `[MigrationItemName ]`: Migration item name. + - `[MigrationRecoveryPointName ]`: The migration recovery point name. + - `[NetworkMappingName ]`: Network mapping name. + - `[NetworkName ]`: Primary network name. + - `[PolicyName ]`: Replication policy name. + - `[ProtectableItemName ]`: Protectable item name. + - `[ProtectionContainerName ]`: Protection container name. + - `[ProviderName ]`: Recovery services provider name. + - `[RecoveryPlanName ]`: Name of the recovery plan. + - `[RecoveryPointName ]`: The recovery point name. + - `[ReplicatedProtectedItemName ]`: Replication protected item name. + - `[ResourceGroupName ]`: The name of the resource group where the recovery services vault is present. + - `[ResourceName ]`: The name of the recovery services vault. + - `[StorageClassificationMappingName ]`: Storage classification mapping name. + - `[StorageClassificationName ]`: Storage classification name. + - `[SubscriptionId ]`: The subscription Id. + - `[VaultSettingName ]`: Vault setting name. + - `[VcenterName ]`: vcenter name. + - `[VirtualMachineName ]`: Virtual Machine name. + +`TESTMIGRATEINPUT `: Input for test migrate. + - `ProviderSpecificDetailInstanceType `: The class type. + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/Test-AzSiteRecoveryReplicationMigrationItemMigrateCleanup.md b/swaggerci/recoveryservicessiterecovery/docs/Test-AzSiteRecoveryReplicationMigrationItemMigrateCleanup.md new file mode 100644 index 000000000000..f83f799636d6 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/Test-AzSiteRecoveryReplicationMigrationItemMigrateCleanup.md @@ -0,0 +1,341 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/test-azsiterecoveryreplicationmigrationitemmigratecleanup +schema: 2.0.0 +--- + +# Test-AzSiteRecoveryReplicationMigrationItemMigrateCleanup + +## SYNOPSIS +The operation to initiate test migrate cleanup. + +## SYNTAX + +### TestExpanded (Default) +``` +Test-AzSiteRecoveryReplicationMigrationItemMigrateCleanup -FabricName -MigrationItemName + -ProtectionContainerName -ResourceGroupName -ResourceName + [-SubscriptionId ] [-Comment ] [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] + [-WhatIf] [] +``` + +### Test +``` +Test-AzSiteRecoveryReplicationMigrationItemMigrateCleanup -FabricName -MigrationItemName + -ProtectionContainerName -ResourceGroupName -ResourceName + -TestMigrateCleanupInput [-SubscriptionId ] [-DefaultProfile ] + [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +### TestViaIdentity +``` +Test-AzSiteRecoveryReplicationMigrationItemMigrateCleanup -InputObject + -TestMigrateCleanupInput [-DefaultProfile ] [-AsJob] [-NoWait] + [-Confirm] [-WhatIf] [] +``` + +### TestViaIdentityExpanded +``` +Test-AzSiteRecoveryReplicationMigrationItemMigrateCleanup -InputObject + [-Comment ] [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +The operation to initiate test migrate cleanup. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Comment +Test migrate cleanup comments. + +```yaml +Type: System.String +Parameter Sets: TestExpanded, TestViaIdentityExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FabricName +Fabric name. + +```yaml +Type: System.String +Parameter Sets: Test, TestExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +Parameter Sets: TestViaIdentity, TestViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -MigrationItemName +Migration item name. + +```yaml +Type: System.String +Parameter Sets: Test, TestExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProtectionContainerName +Protection container name. + +```yaml +Type: System.String +Parameter Sets: Test, TestExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: Test, TestExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: Test, TestExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String +Parameter Sets: Test, TestExpanded +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TestMigrateCleanupInput +Input for test migrate cleanup. +To construct, see NOTES section for TESTMIGRATECLEANUPINPUT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateCleanupInput +Parameter Sets: Test, TestViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateCleanupInput + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`INPUTOBJECT `: Identity Parameter + - `[AlertSettingName ]`: The name of the email notification configuration. + - `[EventName ]`: The name of the Azure Site Recovery event. + - `[FabricName ]`: Fabric name. + - `[Id ]`: Resource identity path + - `[IntentObjectName ]`: Replication protection intent name. + - `[JobName ]`: Job identifier. + - `[LogicalNetworkName ]`: Logical network name. + - `[MappingName ]`: Protection Container mapping name. + - `[MigrationItemName ]`: Migration item name. + - `[MigrationRecoveryPointName ]`: The migration recovery point name. + - `[NetworkMappingName ]`: Network mapping name. + - `[NetworkName ]`: Primary network name. + - `[PolicyName ]`: Replication policy name. + - `[ProtectableItemName ]`: Protectable item name. + - `[ProtectionContainerName ]`: Protection container name. + - `[ProviderName ]`: Recovery services provider name. + - `[RecoveryPlanName ]`: Name of the recovery plan. + - `[RecoveryPointName ]`: The recovery point name. + - `[ReplicatedProtectedItemName ]`: Replication protected item name. + - `[ResourceGroupName ]`: The name of the resource group where the recovery services vault is present. + - `[ResourceName ]`: The name of the recovery services vault. + - `[StorageClassificationMappingName ]`: Storage classification mapping name. + - `[StorageClassificationName ]`: Storage classification name. + - `[SubscriptionId ]`: The subscription Id. + - `[VaultSettingName ]`: Vault setting name. + - `[VcenterName ]`: vcenter name. + - `[VirtualMachineName ]`: Virtual Machine name. + +`TESTMIGRATECLEANUPINPUT `: Input for test migrate cleanup. + - `[Comment ]`: Test migrate cleanup comments. + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/Test-AzSiteRecoveryReplicationProtectedItemFailover.md b/swaggerci/recoveryservicessiterecovery/docs/Test-AzSiteRecoveryReplicationProtectedItemFailover.md new file mode 100644 index 000000000000..497fc98575d4 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/Test-AzSiteRecoveryReplicationProtectedItemFailover.md @@ -0,0 +1,392 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/test-azsiterecoveryreplicationprotecteditemfailover +schema: 2.0.0 +--- + +# Test-AzSiteRecoveryReplicationProtectedItemFailover + +## SYNOPSIS +Operation to perform a test failover of the replication protected item. + +## SYNTAX + +### TestExpanded (Default) +``` +Test-AzSiteRecoveryReplicationProtectedItemFailover -FabricName -ProtectionContainerName + -ReplicatedProtectedItemName -ResourceGroupName -ResourceName + [-SubscriptionId ] [-FailoverDirection ] [-NetworkId ] [-NetworkType ] + [-ProviderSpecificDetailInstanceType ] [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] + [-WhatIf] [] +``` + +### Test +``` +Test-AzSiteRecoveryReplicationProtectedItemFailover -FabricName -ProtectionContainerName + -ReplicatedProtectedItemName -ResourceGroupName -ResourceName + -TestfailoverInput [-SubscriptionId ] [-DefaultProfile ] [-AsJob] + [-NoWait] [-Confirm] [-WhatIf] [] +``` + +### TestViaIdentity +``` +Test-AzSiteRecoveryReplicationProtectedItemFailover -InputObject + -TestfailoverInput [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] + [] +``` + +### TestViaIdentityExpanded +``` +Test-AzSiteRecoveryReplicationProtectedItemFailover -InputObject + [-FailoverDirection ] [-NetworkId ] [-NetworkType ] + [-ProviderSpecificDetailInstanceType ] [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] + [-WhatIf] [] +``` + +## DESCRIPTION +Operation to perform a test failover of the replication protected item. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FabricName +Unique fabric name. + +```yaml +Type: System.String +Parameter Sets: Test, TestExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FailoverDirection +Test failover direction. + +```yaml +Type: System.String +Parameter Sets: TestExpanded, TestViaIdentityExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +Parameter Sets: TestViaIdentity, TestViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -NetworkId +The id of the network to be used for test failover. + +```yaml +Type: System.String +Parameter Sets: TestExpanded, TestViaIdentityExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NetworkType +Network type to be used for test failover. + +```yaml +Type: System.String +Parameter Sets: TestExpanded, TestViaIdentityExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProtectionContainerName +Protection container name. + +```yaml +Type: System.String +Parameter Sets: Test, TestExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProviderSpecificDetailInstanceType +The class type. + +```yaml +Type: System.String +Parameter Sets: TestExpanded, TestViaIdentityExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ReplicatedProtectedItemName +Replication protected item name. + +```yaml +Type: System.String +Parameter Sets: Test, TestExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: Test, TestExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: Test, TestExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String +Parameter Sets: Test, TestExpanded +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TestfailoverInput +Input definition for test failover. +To construct, see NOTES section for TESTFAILOVERINPUT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverInput +Parameter Sets: Test, TestViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverInput + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`INPUTOBJECT `: Identity Parameter + - `[AlertSettingName ]`: The name of the email notification configuration. + - `[EventName ]`: The name of the Azure Site Recovery event. + - `[FabricName ]`: Fabric name. + - `[Id ]`: Resource identity path + - `[IntentObjectName ]`: Replication protection intent name. + - `[JobName ]`: Job identifier. + - `[LogicalNetworkName ]`: Logical network name. + - `[MappingName ]`: Protection Container mapping name. + - `[MigrationItemName ]`: Migration item name. + - `[MigrationRecoveryPointName ]`: The migration recovery point name. + - `[NetworkMappingName ]`: Network mapping name. + - `[NetworkName ]`: Primary network name. + - `[PolicyName ]`: Replication policy name. + - `[ProtectableItemName ]`: Protectable item name. + - `[ProtectionContainerName ]`: Protection container name. + - `[ProviderName ]`: Recovery services provider name. + - `[RecoveryPlanName ]`: Name of the recovery plan. + - `[RecoveryPointName ]`: The recovery point name. + - `[ReplicatedProtectedItemName ]`: Replication protected item name. + - `[ResourceGroupName ]`: The name of the resource group where the recovery services vault is present. + - `[ResourceName ]`: The name of the recovery services vault. + - `[StorageClassificationMappingName ]`: Storage classification mapping name. + - `[StorageClassificationName ]`: Storage classification name. + - `[SubscriptionId ]`: The subscription Id. + - `[VaultSettingName ]`: Vault setting name. + - `[VcenterName ]`: vcenter name. + - `[VirtualMachineName ]`: Virtual Machine name. + +`TESTFAILOVERINPUT `: Input definition for test failover. + - `[FailoverDirection ]`: Test failover direction. + - `[NetworkId ]`: The id of the network to be used for test failover. + - `[NetworkType ]`: Network type to be used for test failover. + - `[ProviderSpecificDetailInstanceType ]`: The class type. + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/Test-AzSiteRecoveryReplicationProtectedItemFailoverCleanup.md b/swaggerci/recoveryservicessiterecovery/docs/Test-AzSiteRecoveryReplicationProtectedItemFailoverCleanup.md new file mode 100644 index 000000000000..088ad07e7af4 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/Test-AzSiteRecoveryReplicationProtectedItemFailoverCleanup.md @@ -0,0 +1,341 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/test-azsiterecoveryreplicationprotecteditemfailovercleanup +schema: 2.0.0 +--- + +# Test-AzSiteRecoveryReplicationProtectedItemFailoverCleanup + +## SYNOPSIS +Operation to clean up the test failover of a replication protected item. + +## SYNTAX + +### TestExpanded (Default) +``` +Test-AzSiteRecoveryReplicationProtectedItemFailoverCleanup -FabricName + -ProtectionContainerName -ReplicatedProtectedItemName -ResourceGroupName + -ResourceName [-SubscriptionId ] [-Comment ] [-DefaultProfile ] [-AsJob] + [-NoWait] [-Confirm] [-WhatIf] [] +``` + +### Test +``` +Test-AzSiteRecoveryReplicationProtectedItemFailoverCleanup -FabricName + -ProtectionContainerName -ReplicatedProtectedItemName -ResourceGroupName + -ResourceName -CleanupInput [-SubscriptionId ] + [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +### TestViaIdentity +``` +Test-AzSiteRecoveryReplicationProtectedItemFailoverCleanup -InputObject + -CleanupInput [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] + [-WhatIf] [] +``` + +### TestViaIdentityExpanded +``` +Test-AzSiteRecoveryReplicationProtectedItemFailoverCleanup -InputObject + [-Comment ] [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Operation to clean up the test failover of a replication protected item. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -CleanupInput +Input definition for test failover cleanup. +To construct, see NOTES section for CLEANUPINPUT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverCleanupInput +Parameter Sets: Test, TestViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -Comment +Test failover cleanup comments. + +```yaml +Type: System.String +Parameter Sets: TestExpanded, TestViaIdentityExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FabricName +Unique fabric name. + +```yaml +Type: System.String +Parameter Sets: Test, TestExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +Parameter Sets: TestViaIdentity, TestViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProtectionContainerName +Protection container name. + +```yaml +Type: System.String +Parameter Sets: Test, TestExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ReplicatedProtectedItemName +Replication protected item name. + +```yaml +Type: System.String +Parameter Sets: Test, TestExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: Test, TestExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: Test, TestExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String +Parameter Sets: Test, TestExpanded +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverCleanupInput + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`CLEANUPINPUT `: Input definition for test failover cleanup. + - `[Comment ]`: Test failover cleanup comments. + +`INPUTOBJECT `: Identity Parameter + - `[AlertSettingName ]`: The name of the email notification configuration. + - `[EventName ]`: The name of the Azure Site Recovery event. + - `[FabricName ]`: Fabric name. + - `[Id ]`: Resource identity path + - `[IntentObjectName ]`: Replication protection intent name. + - `[JobName ]`: Job identifier. + - `[LogicalNetworkName ]`: Logical network name. + - `[MappingName ]`: Protection Container mapping name. + - `[MigrationItemName ]`: Migration item name. + - `[MigrationRecoveryPointName ]`: The migration recovery point name. + - `[NetworkMappingName ]`: Network mapping name. + - `[NetworkName ]`: Primary network name. + - `[PolicyName ]`: Replication policy name. + - `[ProtectableItemName ]`: Protectable item name. + - `[ProtectionContainerName ]`: Protection container name. + - `[ProviderName ]`: Recovery services provider name. + - `[RecoveryPlanName ]`: Name of the recovery plan. + - `[RecoveryPointName ]`: The recovery point name. + - `[ReplicatedProtectedItemName ]`: Replication protected item name. + - `[ResourceGroupName ]`: The name of the resource group where the recovery services vault is present. + - `[ResourceName ]`: The name of the recovery services vault. + - `[StorageClassificationMappingName ]`: Storage classification mapping name. + - `[StorageClassificationName ]`: Storage classification name. + - `[SubscriptionId ]`: The subscription Id. + - `[VaultSettingName ]`: Vault setting name. + - `[VcenterName ]`: vcenter name. + - `[VirtualMachineName ]`: Virtual Machine name. + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/Test-AzSiteRecoveryReplicationRecoveryPlanFailover.md b/swaggerci/recoveryservicessiterecovery/docs/Test-AzSiteRecoveryReplicationRecoveryPlanFailover.md new file mode 100644 index 000000000000..2902bacb7d31 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/Test-AzSiteRecoveryReplicationRecoveryPlanFailover.md @@ -0,0 +1,366 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/test-azsiterecoveryreplicationrecoveryplanfailover +schema: 2.0.0 +--- + +# Test-AzSiteRecoveryReplicationRecoveryPlanFailover + +## SYNOPSIS +The operation to start the test failover of a recovery plan. + +## SYNTAX + +### TestExpanded (Default) +``` +Test-AzSiteRecoveryReplicationRecoveryPlanFailover -RecoveryPlanName -ResourceGroupName + -ResourceName -FailoverDirection -NetworkType + [-SubscriptionId ] [-NetworkId ] + [-ProviderSpecificDetail ] [-DefaultProfile ] + [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +### Test +``` +Test-AzSiteRecoveryReplicationRecoveryPlanFailover -RecoveryPlanName -ResourceGroupName + -ResourceName -Input [-SubscriptionId ] + [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +### TestViaIdentity +``` +Test-AzSiteRecoveryReplicationRecoveryPlanFailover -InputObject + -Input [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] + [] +``` + +### TestViaIdentityExpanded +``` +Test-AzSiteRecoveryReplicationRecoveryPlanFailover -InputObject + -FailoverDirection -NetworkType [-NetworkId ] + [-ProviderSpecificDetail ] [-DefaultProfile ] + [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +The operation to start the test failover of a recovery plan. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FailoverDirection +The failover direction. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections +Parameter Sets: TestExpanded, TestViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Input +Recovery plan test failover input. +To construct, see NOTES section for INPUT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverInput +Parameter Sets: Test, TestViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +Parameter Sets: TestViaIdentity, TestViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -NetworkId +The Id of the network to be used for test failover. + +```yaml +Type: System.String +Parameter Sets: TestExpanded, TestViaIdentityExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NetworkType +The network type to be used for test failover. + +```yaml +Type: System.String +Parameter Sets: TestExpanded, TestViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProviderSpecificDetail +The provider specific properties. +To construct, see NOTES section for PROVIDERSPECIFICDETAIL properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInput[] +Parameter Sets: TestExpanded, TestViaIdentityExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -RecoveryPlanName +Recovery plan name. + +```yaml +Type: System.String +Parameter Sets: Test, TestExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: Test, TestExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: Test, TestExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String +Parameter Sets: Test, TestExpanded +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverInput + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`INPUT `: Recovery plan test failover input. + - `FailoverDirection `: The failover direction. + - `NetworkType `: The network type to be used for test failover. + - `[NetworkId ]`: The Id of the network to be used for test failover. + - `[ProviderSpecificDetail ]`: The provider specific properties. + - `InstanceType `: The class type. + +`INPUTOBJECT `: Identity Parameter + - `[AlertSettingName ]`: The name of the email notification configuration. + - `[EventName ]`: The name of the Azure Site Recovery event. + - `[FabricName ]`: Fabric name. + - `[Id ]`: Resource identity path + - `[IntentObjectName ]`: Replication protection intent name. + - `[JobName ]`: Job identifier. + - `[LogicalNetworkName ]`: Logical network name. + - `[MappingName ]`: Protection Container mapping name. + - `[MigrationItemName ]`: Migration item name. + - `[MigrationRecoveryPointName ]`: The migration recovery point name. + - `[NetworkMappingName ]`: Network mapping name. + - `[NetworkName ]`: Primary network name. + - `[PolicyName ]`: Replication policy name. + - `[ProtectableItemName ]`: Protectable item name. + - `[ProtectionContainerName ]`: Protection container name. + - `[ProviderName ]`: Recovery services provider name. + - `[RecoveryPlanName ]`: Name of the recovery plan. + - `[RecoveryPointName ]`: The recovery point name. + - `[ReplicatedProtectedItemName ]`: Replication protected item name. + - `[ResourceGroupName ]`: The name of the resource group where the recovery services vault is present. + - `[ResourceName ]`: The name of the recovery services vault. + - `[StorageClassificationMappingName ]`: Storage classification mapping name. + - `[StorageClassificationName ]`: Storage classification name. + - `[SubscriptionId ]`: The subscription Id. + - `[VaultSettingName ]`: Vault setting name. + - `[VcenterName ]`: vcenter name. + - `[VirtualMachineName ]`: Virtual Machine name. + +`PROVIDERSPECIFICDETAIL `: The provider specific properties. + - `InstanceType `: The class type. + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/Test-AzSiteRecoveryReplicationRecoveryPlanFailoverCleanup.md b/swaggerci/recoveryservicessiterecovery/docs/Test-AzSiteRecoveryReplicationRecoveryPlanFailoverCleanup.md new file mode 100644 index 000000000000..b2657ff53f74 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/Test-AzSiteRecoveryReplicationRecoveryPlanFailoverCleanup.md @@ -0,0 +1,310 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/test-azsiterecoveryreplicationrecoveryplanfailovercleanup +schema: 2.0.0 +--- + +# Test-AzSiteRecoveryReplicationRecoveryPlanFailoverCleanup + +## SYNOPSIS +The operation to cleanup test failover of a recovery plan. + +## SYNTAX + +### TestExpanded (Default) +``` +Test-AzSiteRecoveryReplicationRecoveryPlanFailoverCleanup -RecoveryPlanName + -ResourceGroupName -ResourceName [-SubscriptionId ] [-Comment ] + [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +### Test +``` +Test-AzSiteRecoveryReplicationRecoveryPlanFailoverCleanup -RecoveryPlanName + -ResourceGroupName -ResourceName -Input + [-SubscriptionId ] [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] + [] +``` + +### TestViaIdentity +``` +Test-AzSiteRecoveryReplicationRecoveryPlanFailoverCleanup -InputObject + -Input [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] + [-WhatIf] [] +``` + +### TestViaIdentityExpanded +``` +Test-AzSiteRecoveryReplicationRecoveryPlanFailoverCleanup -InputObject + [-Comment ] [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +The operation to cleanup test failover of a recovery plan. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Comment +The test failover cleanup comments. + +```yaml +Type: System.String +Parameter Sets: TestExpanded, TestViaIdentityExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Input +Recovery plan test failover cleanup input. +To construct, see NOTES section for INPUT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverCleanupInput +Parameter Sets: Test, TestViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +Parameter Sets: TestViaIdentity, TestViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -RecoveryPlanName +Recovery plan name. + +```yaml +Type: System.String +Parameter Sets: Test, TestExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: Test, TestExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: Test, TestExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String +Parameter Sets: Test, TestExpanded +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverCleanupInput + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`INPUT `: Recovery plan test failover cleanup input. + - `[Comment ]`: The test failover cleanup comments. + +`INPUTOBJECT `: Identity Parameter + - `[AlertSettingName ]`: The name of the email notification configuration. + - `[EventName ]`: The name of the Azure Site Recovery event. + - `[FabricName ]`: Fabric name. + - `[Id ]`: Resource identity path + - `[IntentObjectName ]`: Replication protection intent name. + - `[JobName ]`: Job identifier. + - `[LogicalNetworkName ]`: Logical network name. + - `[MappingName ]`: Protection Container mapping name. + - `[MigrationItemName ]`: Migration item name. + - `[MigrationRecoveryPointName ]`: The migration recovery point name. + - `[NetworkMappingName ]`: Network mapping name. + - `[NetworkName ]`: Primary network name. + - `[PolicyName ]`: Replication policy name. + - `[ProtectableItemName ]`: Protectable item name. + - `[ProtectionContainerName ]`: Protection container name. + - `[ProviderName ]`: Recovery services provider name. + - `[RecoveryPlanName ]`: Name of the recovery plan. + - `[RecoveryPointName ]`: The recovery point name. + - `[ReplicatedProtectedItemName ]`: Replication protected item name. + - `[ResourceGroupName ]`: The name of the resource group where the recovery services vault is present. + - `[ResourceName ]`: The name of the recovery services vault. + - `[StorageClassificationMappingName ]`: Storage classification mapping name. + - `[StorageClassificationName ]`: Storage classification name. + - `[SubscriptionId ]`: The subscription Id. + - `[VaultSettingName ]`: Vault setting name. + - `[VcenterName ]`: vcenter name. + - `[VirtualMachineName ]`: Virtual Machine name. + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/Update-AzSiteRecoveryReplicationMigrationItem.md b/swaggerci/recoveryservicessiterecovery/docs/Update-AzSiteRecoveryReplicationMigrationItem.md new file mode 100644 index 000000000000..b203c5335244 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/Update-AzSiteRecoveryReplicationMigrationItem.md @@ -0,0 +1,306 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/update-azsiterecoveryreplicationmigrationitem +schema: 2.0.0 +--- + +# Update-AzSiteRecoveryReplicationMigrationItem + +## SYNOPSIS +The operation to update the recovery settings of an ASR migration item. + +## SYNTAX + +### UpdateExpanded (Default) +``` +Update-AzSiteRecoveryReplicationMigrationItem -FabricName -MigrationItemName + -ProtectionContainerName -ResourceGroupName -ResourceName + [-SubscriptionId ] [-ProviderSpecificDetailInstanceType ] [-DefaultProfile ] + [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +### UpdateViaIdentityExpanded +``` +Update-AzSiteRecoveryReplicationMigrationItem -InputObject + [-ProviderSpecificDetailInstanceType ] [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] + [-WhatIf] [] +``` + +## DESCRIPTION +The operation to update the recovery settings of an ASR migration item. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FabricName +Fabric name. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +Parameter Sets: UpdateViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -MigrationItemName +Migration item name. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProtectionContainerName +Protection container name. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProviderSpecificDetailInstanceType +The class type. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`INPUTOBJECT `: Identity Parameter + - `[AlertSettingName ]`: The name of the email notification configuration. + - `[EventName ]`: The name of the Azure Site Recovery event. + - `[FabricName ]`: Fabric name. + - `[Id ]`: Resource identity path + - `[IntentObjectName ]`: Replication protection intent name. + - `[JobName ]`: Job identifier. + - `[LogicalNetworkName ]`: Logical network name. + - `[MappingName ]`: Protection Container mapping name. + - `[MigrationItemName ]`: Migration item name. + - `[MigrationRecoveryPointName ]`: The migration recovery point name. + - `[NetworkMappingName ]`: Network mapping name. + - `[NetworkName ]`: Primary network name. + - `[PolicyName ]`: Replication policy name. + - `[ProtectableItemName ]`: Protectable item name. + - `[ProtectionContainerName ]`: Protection container name. + - `[ProviderName ]`: Recovery services provider name. + - `[RecoveryPlanName ]`: Name of the recovery plan. + - `[RecoveryPointName ]`: The recovery point name. + - `[ReplicatedProtectedItemName ]`: Replication protected item name. + - `[ResourceGroupName ]`: The name of the resource group where the recovery services vault is present. + - `[ResourceName ]`: The name of the recovery services vault. + - `[StorageClassificationMappingName ]`: Storage classification mapping name. + - `[StorageClassificationName ]`: Storage classification name. + - `[SubscriptionId ]`: The subscription Id. + - `[VaultSettingName ]`: Vault setting name. + - `[VcenterName ]`: vcenter name. + - `[VirtualMachineName ]`: Virtual Machine name. + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/Update-AzSiteRecoveryReplicationNetworkMapping.md b/swaggerci/recoveryservicessiterecovery/docs/Update-AzSiteRecoveryReplicationNetworkMapping.md new file mode 100644 index 000000000000..675c6d87f5ab --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/Update-AzSiteRecoveryReplicationNetworkMapping.md @@ -0,0 +1,336 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/update-azsiterecoveryreplicationnetworkmapping +schema: 2.0.0 +--- + +# Update-AzSiteRecoveryReplicationNetworkMapping + +## SYNOPSIS +The operation to update an ASR network mapping. + +## SYNTAX + +### UpdateExpanded (Default) +``` +Update-AzSiteRecoveryReplicationNetworkMapping -FabricName -NetworkMappingName + -NetworkName -ResourceGroupName -ResourceName [-SubscriptionId ] + [-FabricSpecificDetailInstanceType ] [-RecoveryFabricName ] [-RecoveryNetworkId ] + [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +### UpdateViaIdentityExpanded +``` +Update-AzSiteRecoveryReplicationNetworkMapping -InputObject + [-FabricSpecificDetailInstanceType ] [-RecoveryFabricName ] [-RecoveryNetworkId ] + [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +The operation to update an ASR network mapping. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FabricName +Primary fabric name. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FabricSpecificDetailInstanceType +The instance type. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +Parameter Sets: UpdateViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -NetworkMappingName +Network mapping name. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NetworkName +Primary network name. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -RecoveryFabricName +Recovery fabric name. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -RecoveryNetworkId +Recovery network Id. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMapping + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`INPUTOBJECT `: Identity Parameter + - `[AlertSettingName ]`: The name of the email notification configuration. + - `[EventName ]`: The name of the Azure Site Recovery event. + - `[FabricName ]`: Fabric name. + - `[Id ]`: Resource identity path + - `[IntentObjectName ]`: Replication protection intent name. + - `[JobName ]`: Job identifier. + - `[LogicalNetworkName ]`: Logical network name. + - `[MappingName ]`: Protection Container mapping name. + - `[MigrationItemName ]`: Migration item name. + - `[MigrationRecoveryPointName ]`: The migration recovery point name. + - `[NetworkMappingName ]`: Network mapping name. + - `[NetworkName ]`: Primary network name. + - `[PolicyName ]`: Replication policy name. + - `[ProtectableItemName ]`: Protectable item name. + - `[ProtectionContainerName ]`: Protection container name. + - `[ProviderName ]`: Recovery services provider name. + - `[RecoveryPlanName ]`: Name of the recovery plan. + - `[RecoveryPointName ]`: The recovery point name. + - `[ReplicatedProtectedItemName ]`: Replication protected item name. + - `[ResourceGroupName ]`: The name of the resource group where the recovery services vault is present. + - `[ResourceName ]`: The name of the recovery services vault. + - `[StorageClassificationMappingName ]`: Storage classification mapping name. + - `[StorageClassificationName ]`: Storage classification name. + - `[SubscriptionId ]`: The subscription Id. + - `[VaultSettingName ]`: Vault setting name. + - `[VcenterName ]`: vcenter name. + - `[VirtualMachineName ]`: Virtual Machine name. + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/Update-AzSiteRecoveryReplicationPolicy.md b/swaggerci/recoveryservicessiterecovery/docs/Update-AzSiteRecoveryReplicationPolicy.md new file mode 100644 index 000000000000..34d0882009ee --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/Update-AzSiteRecoveryReplicationPolicy.md @@ -0,0 +1,275 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/update-azsiterecoveryreplicationpolicy +schema: 2.0.0 +--- + +# Update-AzSiteRecoveryReplicationPolicy + +## SYNOPSIS +The operation to update a replication policy. + +## SYNTAX + +### UpdateExpanded (Default) +``` +Update-AzSiteRecoveryReplicationPolicy -PolicyName -ResourceGroupName -ResourceName + [-SubscriptionId ] [-ReplicationProviderSettingInstanceType ] [-DefaultProfile ] + [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +### UpdateViaIdentityExpanded +``` +Update-AzSiteRecoveryReplicationPolicy -InputObject + [-ReplicationProviderSettingInstanceType ] [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] + [-WhatIf] [] +``` + +## DESCRIPTION +The operation to update a replication policy. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +Parameter Sets: UpdateViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PolicyName +Policy Id. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ReplicationProviderSettingInstanceType +The class type. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicy + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`INPUTOBJECT `: Identity Parameter + - `[AlertSettingName ]`: The name of the email notification configuration. + - `[EventName ]`: The name of the Azure Site Recovery event. + - `[FabricName ]`: Fabric name. + - `[Id ]`: Resource identity path + - `[IntentObjectName ]`: Replication protection intent name. + - `[JobName ]`: Job identifier. + - `[LogicalNetworkName ]`: Logical network name. + - `[MappingName ]`: Protection Container mapping name. + - `[MigrationItemName ]`: Migration item name. + - `[MigrationRecoveryPointName ]`: The migration recovery point name. + - `[NetworkMappingName ]`: Network mapping name. + - `[NetworkName ]`: Primary network name. + - `[PolicyName ]`: Replication policy name. + - `[ProtectableItemName ]`: Protectable item name. + - `[ProtectionContainerName ]`: Protection container name. + - `[ProviderName ]`: Recovery services provider name. + - `[RecoveryPlanName ]`: Name of the recovery plan. + - `[RecoveryPointName ]`: The recovery point name. + - `[ReplicatedProtectedItemName ]`: Replication protected item name. + - `[ResourceGroupName ]`: The name of the resource group where the recovery services vault is present. + - `[ResourceName ]`: The name of the recovery services vault. + - `[StorageClassificationMappingName ]`: Storage classification mapping name. + - `[StorageClassificationName ]`: Storage classification name. + - `[SubscriptionId ]`: The subscription Id. + - `[VaultSettingName ]`: Vault setting name. + - `[VcenterName ]`: vcenter name. + - `[VirtualMachineName ]`: Virtual Machine name. + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/Update-AzSiteRecoveryReplicationProtectedItem.md b/swaggerci/recoveryservicessiterecovery/docs/Update-AzSiteRecoveryReplicationProtectedItem.md new file mode 100644 index 000000000000..648658b85327 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/Update-AzSiteRecoveryReplicationProtectedItem.md @@ -0,0 +1,476 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/update-azsiterecoveryreplicationprotecteditem +schema: 2.0.0 +--- + +# Update-AzSiteRecoveryReplicationProtectedItem + +## SYNOPSIS +The operation to update the recovery settings of an ASR replication protected item. + +## SYNTAX + +### UpdateExpanded (Default) +``` +Update-AzSiteRecoveryReplicationProtectedItem -FabricName -ProtectionContainerName + -ReplicatedProtectedItemName -ResourceGroupName -ResourceName + [-SubscriptionId ] [-EnableRdpOnTargetOption ] [-LicenseType ] + [-ProviderSpecificDetailInstanceType ] [-RecoveryAvailabilitySetId ] + [-RecoveryAzureVMName ] [-RecoveryAzureVMSize ] [-SelectedRecoveryAzureNetworkId ] + [-SelectedSourceNicId ] [-SelectedTfoAzureNetworkId ] [-VMNic ] + [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +### UpdateViaIdentityExpanded +``` +Update-AzSiteRecoveryReplicationProtectedItem -InputObject + [-EnableRdpOnTargetOption ] [-LicenseType ] + [-ProviderSpecificDetailInstanceType ] [-RecoveryAvailabilitySetId ] + [-RecoveryAzureVMName ] [-RecoveryAzureVMSize ] [-SelectedRecoveryAzureNetworkId ] + [-SelectedSourceNicId ] [-SelectedTfoAzureNetworkId ] [-VMNic ] + [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +The operation to update the recovery settings of an ASR replication protected item. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -EnableRdpOnTargetOption +The selected option to enable RDP\SSH on target vm after failover. +String value of SrsDataContract.EnableRDPOnTargetOption enum. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FabricName +Fabric name. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +Parameter Sets: UpdateViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -LicenseType +License type. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.LicenseType +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProtectionContainerName +Protection container name. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProviderSpecificDetailInstanceType +The class type. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -RecoveryAvailabilitySetId +The target availability set Id. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -RecoveryAzureVMName +Target Azure VM name given by the user. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -RecoveryAzureVMSize +Target Azure VM size. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ReplicatedProtectedItemName +Replication protected item name. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SelectedRecoveryAzureNetworkId +Target Azure Network Id. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SelectedSourceNicId +The selected source nic Id which will be used as the primary nic during failover. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SelectedTfoAzureNetworkId +The Azure Network Id for test failover. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -VMNic +The list of VM nic details. +To construct, see NOTES section for VMNIC properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicInputDetails[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`INPUTOBJECT `: Identity Parameter + - `[AlertSettingName ]`: The name of the email notification configuration. + - `[EventName ]`: The name of the Azure Site Recovery event. + - `[FabricName ]`: Fabric name. + - `[Id ]`: Resource identity path + - `[IntentObjectName ]`: Replication protection intent name. + - `[JobName ]`: Job identifier. + - `[LogicalNetworkName ]`: Logical network name. + - `[MappingName ]`: Protection Container mapping name. + - `[MigrationItemName ]`: Migration item name. + - `[MigrationRecoveryPointName ]`: The migration recovery point name. + - `[NetworkMappingName ]`: Network mapping name. + - `[NetworkName ]`: Primary network name. + - `[PolicyName ]`: Replication policy name. + - `[ProtectableItemName ]`: Protectable item name. + - `[ProtectionContainerName ]`: Protection container name. + - `[ProviderName ]`: Recovery services provider name. + - `[RecoveryPlanName ]`: Name of the recovery plan. + - `[RecoveryPointName ]`: The recovery point name. + - `[ReplicatedProtectedItemName ]`: Replication protected item name. + - `[ResourceGroupName ]`: The name of the resource group where the recovery services vault is present. + - `[ResourceName ]`: The name of the recovery services vault. + - `[StorageClassificationMappingName ]`: Storage classification mapping name. + - `[StorageClassificationName ]`: Storage classification name. + - `[SubscriptionId ]`: The subscription Id. + - `[VaultSettingName ]`: Vault setting name. + - `[VcenterName ]`: vcenter name. + - `[VirtualMachineName ]`: Virtual Machine name. + +`VMNIC `: The list of VM nic details. + - `[EnableAcceleratedNetworkingOnRecovery ]`: Whether the NIC has accelerated networking enabled. + - `[EnableAcceleratedNetworkingOnTfo ]`: Whether the test NIC has accelerated networking enabled. + - `[IPConfig ]`: The IP configurations to be used by NIC during test failover and failover. + - `[IPConfigName ]`: + - `[IsPrimary ]`: + - `[IsSeletedForFailover ]`: + - `[RecoveryLbBackendAddressPoolId ]`: + - `[RecoveryPublicIPAddressId ]`: + - `[RecoveryStaticIPAddress ]`: + - `[RecoverySubnetName ]`: + - `[TfoLbBackendAddressPoolId ]`: + - `[TfoPublicIPAddressId ]`: + - `[TfoStaticIPAddress ]`: + - `[TfoSubnetName ]`: + - `[NicId ]`: The nic Id. + - `[RecoveryNetworkSecurityGroupId ]`: The id of the NSG associated with the NIC. + - `[RecoveryNicName ]`: The name of the NIC to be used when creating target NICs. + - `[RecoveryNicResourceGroupName ]`: The resource group of the NIC to be used when creating target NICs. + - `[ReuseExistingNic ]`: A value indicating whether an existing NIC is allowed to be reused during failover subject to availability. + - `[SelectionType ]`: Selection type for failover. + - `[TargetNicName ]`: Target NIC name. + - `[TfoNetworkSecurityGroupId ]`: The NSG to be used by NIC during test failover. + - `[TfoNicName ]`: The name of the NIC to be used when creating target NICs in TFO. + - `[TfoNicResourceGroupName ]`: The resource group of the NIC to be used when creating target NICs in TFO. + - `[TfoReuseExistingNic ]`: A value indicating whether an existing NIC is allowed to be reused during test failover subject to availability. + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/Update-AzSiteRecoveryReplicationProtectedItemAppliance.md b/swaggerci/recoveryservicessiterecovery/docs/Update-AzSiteRecoveryReplicationProtectedItemAppliance.md new file mode 100644 index 000000000000..7231333d0c38 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/Update-AzSiteRecoveryReplicationProtectedItemAppliance.md @@ -0,0 +1,321 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/update-azsiterecoveryreplicationprotecteditemappliance +schema: 2.0.0 +--- + +# Update-AzSiteRecoveryReplicationProtectedItemAppliance + +## SYNOPSIS +The operation to update appliance of an ASR replication protected item. + +## SYNTAX + +### UpdateExpanded (Default) +``` +Update-AzSiteRecoveryReplicationProtectedItemAppliance -FabricName -ProtectionContainerName + -ReplicatedProtectedItemName -ResourceGroupName -ResourceName + -ProviderSpecificDetailInstanceType -TargetApplianceId [-SubscriptionId ] + [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +### UpdateViaIdentityExpanded +``` +Update-AzSiteRecoveryReplicationProtectedItemAppliance -InputObject + -ProviderSpecificDetailInstanceType -TargetApplianceId [-DefaultProfile ] + [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +The operation to update appliance of an ASR replication protected item. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FabricName +Fabric name. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +Parameter Sets: UpdateViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProtectionContainerName +Protection container name. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProviderSpecificDetailInstanceType +The class type. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ReplicatedProtectedItemName +Replication protected item name. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TargetApplianceId +The target appliance Id. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`INPUTOBJECT `: Identity Parameter + - `[AlertSettingName ]`: The name of the email notification configuration. + - `[EventName ]`: The name of the Azure Site Recovery event. + - `[FabricName ]`: Fabric name. + - `[Id ]`: Resource identity path + - `[IntentObjectName ]`: Replication protection intent name. + - `[JobName ]`: Job identifier. + - `[LogicalNetworkName ]`: Logical network name. + - `[MappingName ]`: Protection Container mapping name. + - `[MigrationItemName ]`: Migration item name. + - `[MigrationRecoveryPointName ]`: The migration recovery point name. + - `[NetworkMappingName ]`: Network mapping name. + - `[NetworkName ]`: Primary network name. + - `[PolicyName ]`: Replication policy name. + - `[ProtectableItemName ]`: Protectable item name. + - `[ProtectionContainerName ]`: Protection container name. + - `[ProviderName ]`: Recovery services provider name. + - `[RecoveryPlanName ]`: Name of the recovery plan. + - `[RecoveryPointName ]`: The recovery point name. + - `[ReplicatedProtectedItemName ]`: Replication protected item name. + - `[ResourceGroupName ]`: The name of the resource group where the recovery services vault is present. + - `[ResourceName ]`: The name of the recovery services vault. + - `[StorageClassificationMappingName ]`: Storage classification mapping name. + - `[StorageClassificationName ]`: Storage classification name. + - `[SubscriptionId ]`: The subscription Id. + - `[VaultSettingName ]`: Vault setting name. + - `[VcenterName ]`: vcenter name. + - `[VirtualMachineName ]`: Virtual Machine name. + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/Update-AzSiteRecoveryReplicationProtectedItemMobilityService.md b/swaggerci/recoveryservicessiterecovery/docs/Update-AzSiteRecoveryReplicationProtectedItemMobilityService.md new file mode 100644 index 000000000000..fef2399d62b9 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/Update-AzSiteRecoveryReplicationProtectedItemMobilityService.md @@ -0,0 +1,306 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/update-azsiterecoveryreplicationprotecteditemmobilityservice +schema: 2.0.0 +--- + +# Update-AzSiteRecoveryReplicationProtectedItemMobilityService + +## SYNOPSIS +The operation to update(push update) the installed mobility service software on a replication protected item to the latest available version. + +## SYNTAX + +### UpdateExpanded (Default) +``` +Update-AzSiteRecoveryReplicationProtectedItemMobilityService -FabricName + -ProtectionContainerName -ReplicatedProtectedItemName -ResourceGroupName + -ResourceName [-SubscriptionId ] [-RunAsAccountId ] [-DefaultProfile ] + [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +### UpdateViaIdentityExpanded +``` +Update-AzSiteRecoveryReplicationProtectedItemMobilityService -InputObject + [-RunAsAccountId ] [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] + [] +``` + +## DESCRIPTION +The operation to update(push update) the installed mobility service software on a replication protected item to the latest available version. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FabricName +The name of the fabric containing the protected item. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +Parameter Sets: UpdateViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProtectionContainerName +The name of the container containing the protected item. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ReplicatedProtectedItemName +The name of the protected item on which the agent is to be updated. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -RunAsAccountId +The CS run as account Id. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`INPUTOBJECT `: Identity Parameter + - `[AlertSettingName ]`: The name of the email notification configuration. + - `[EventName ]`: The name of the Azure Site Recovery event. + - `[FabricName ]`: Fabric name. + - `[Id ]`: Resource identity path + - `[IntentObjectName ]`: Replication protection intent name. + - `[JobName ]`: Job identifier. + - `[LogicalNetworkName ]`: Logical network name. + - `[MappingName ]`: Protection Container mapping name. + - `[MigrationItemName ]`: Migration item name. + - `[MigrationRecoveryPointName ]`: The migration recovery point name. + - `[NetworkMappingName ]`: Network mapping name. + - `[NetworkName ]`: Primary network name. + - `[PolicyName ]`: Replication policy name. + - `[ProtectableItemName ]`: Protectable item name. + - `[ProtectionContainerName ]`: Protection container name. + - `[ProviderName ]`: Recovery services provider name. + - `[RecoveryPlanName ]`: Name of the recovery plan. + - `[RecoveryPointName ]`: The recovery point name. + - `[ReplicatedProtectedItemName ]`: Replication protected item name. + - `[ResourceGroupName ]`: The name of the resource group where the recovery services vault is present. + - `[ResourceName ]`: The name of the recovery services vault. + - `[StorageClassificationMappingName ]`: Storage classification mapping name. + - `[StorageClassificationName ]`: Storage classification name. + - `[SubscriptionId ]`: The subscription Id. + - `[VaultSettingName ]`: Vault setting name. + - `[VcenterName ]`: vcenter name. + - `[VirtualMachineName ]`: Virtual Machine name. + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/Update-AzSiteRecoveryReplicationProtectionContainerMapping.md b/swaggerci/recoveryservicessiterecovery/docs/Update-AzSiteRecoveryReplicationProtectionContainerMapping.md new file mode 100644 index 000000000000..4e951340f91f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/Update-AzSiteRecoveryReplicationProtectionContainerMapping.md @@ -0,0 +1,306 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/update-azsiterecoveryreplicationprotectioncontainermapping +schema: 2.0.0 +--- + +# Update-AzSiteRecoveryReplicationProtectionContainerMapping + +## SYNOPSIS +The operation to update protection container mapping. + +## SYNTAX + +### UpdateExpanded (Default) +``` +Update-AzSiteRecoveryReplicationProtectionContainerMapping -FabricName -MappingName + -ProtectionContainerName -ResourceGroupName -ResourceName + [-SubscriptionId ] [-ProviderSpecificInputInstanceType ] [-DefaultProfile ] + [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +### UpdateViaIdentityExpanded +``` +Update-AzSiteRecoveryReplicationProtectionContainerMapping -InputObject + [-ProviderSpecificInputInstanceType ] [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] + [-WhatIf] [] +``` + +## DESCRIPTION +The operation to update protection container mapping. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FabricName +Fabric name. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +Parameter Sets: UpdateViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -MappingName +Protection container mapping name. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProtectionContainerName +Protection container name. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProviderSpecificInputInstanceType +The class type. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMapping + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`INPUTOBJECT `: Identity Parameter + - `[AlertSettingName ]`: The name of the email notification configuration. + - `[EventName ]`: The name of the Azure Site Recovery event. + - `[FabricName ]`: Fabric name. + - `[Id ]`: Resource identity path + - `[IntentObjectName ]`: Replication protection intent name. + - `[JobName ]`: Job identifier. + - `[LogicalNetworkName ]`: Logical network name. + - `[MappingName ]`: Protection Container mapping name. + - `[MigrationItemName ]`: Migration item name. + - `[MigrationRecoveryPointName ]`: The migration recovery point name. + - `[NetworkMappingName ]`: Network mapping name. + - `[NetworkName ]`: Primary network name. + - `[PolicyName ]`: Replication policy name. + - `[ProtectableItemName ]`: Protectable item name. + - `[ProtectionContainerName ]`: Protection container name. + - `[ProviderName ]`: Recovery services provider name. + - `[RecoveryPlanName ]`: Name of the recovery plan. + - `[RecoveryPointName ]`: The recovery point name. + - `[ReplicatedProtectedItemName ]`: Replication protected item name. + - `[ResourceGroupName ]`: The name of the resource group where the recovery services vault is present. + - `[ResourceName ]`: The name of the recovery services vault. + - `[StorageClassificationMappingName ]`: Storage classification mapping name. + - `[StorageClassificationName ]`: Storage classification name. + - `[SubscriptionId ]`: The subscription Id. + - `[VaultSettingName ]`: Vault setting name. + - `[VcenterName ]`: vcenter name. + - `[VirtualMachineName ]`: Virtual Machine name. + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/Update-AzSiteRecoveryReplicationRecoveryPlan.md b/swaggerci/recoveryservicessiterecovery/docs/Update-AzSiteRecoveryReplicationRecoveryPlan.md new file mode 100644 index 000000000000..f1bc3f239c0a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/Update-AzSiteRecoveryReplicationRecoveryPlan.md @@ -0,0 +1,288 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/update-azsiterecoveryreplicationrecoveryplan +schema: 2.0.0 +--- + +# Update-AzSiteRecoveryReplicationRecoveryPlan + +## SYNOPSIS +The operation to update a recovery plan. + +## SYNTAX + +### UpdateExpanded (Default) +``` +Update-AzSiteRecoveryReplicationRecoveryPlan -RecoveryPlanName -ResourceGroupName + -ResourceName [-SubscriptionId ] [-Group ] + [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +### UpdateViaIdentityExpanded +``` +Update-AzSiteRecoveryReplicationRecoveryPlan -InputObject + [-Group ] [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] + [] +``` + +## DESCRIPTION +The operation to update a recovery plan. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Group +The recovery plan groups. +To construct, see NOTES section for GROUP properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroup[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +Parameter Sets: UpdateViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -RecoveryPlanName +Recovery plan name. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`GROUP `: The recovery plan groups. + - `GroupType `: The group type. + - `[EndGroupAction ]`: The end group actions. + - `ActionName `: The action name. + - `CustomDetailInstanceType `: Gets the type of action details (see RecoveryPlanActionDetailsTypes enum for possible values). + - `FailoverDirection `: The list of failover directions. + - `FailoverType `: The list of failover types. + - `[ReplicationProtectedItem ]`: The list of protected items. + - `[Id ]`: The ARM Id of the recovery plan protected item. + - `[VirtualMachineId ]`: The virtual machine Id. + - `[StartGroupAction ]`: The start group actions. + +`INPUTOBJECT `: Identity Parameter + - `[AlertSettingName ]`: The name of the email notification configuration. + - `[EventName ]`: The name of the Azure Site Recovery event. + - `[FabricName ]`: Fabric name. + - `[Id ]`: Resource identity path + - `[IntentObjectName ]`: Replication protection intent name. + - `[JobName ]`: Job identifier. + - `[LogicalNetworkName ]`: Logical network name. + - `[MappingName ]`: Protection Container mapping name. + - `[MigrationItemName ]`: Migration item name. + - `[MigrationRecoveryPointName ]`: The migration recovery point name. + - `[NetworkMappingName ]`: Network mapping name. + - `[NetworkName ]`: Primary network name. + - `[PolicyName ]`: Replication policy name. + - `[ProtectableItemName ]`: Protectable item name. + - `[ProtectionContainerName ]`: Protection container name. + - `[ProviderName ]`: Recovery services provider name. + - `[RecoveryPlanName ]`: Name of the recovery plan. + - `[RecoveryPointName ]`: The recovery point name. + - `[ReplicatedProtectedItemName ]`: Replication protected item name. + - `[ResourceGroupName ]`: The name of the resource group where the recovery services vault is present. + - `[ResourceName ]`: The name of the recovery services vault. + - `[StorageClassificationMappingName ]`: Storage classification mapping name. + - `[StorageClassificationName ]`: Storage classification name. + - `[SubscriptionId ]`: The subscription Id. + - `[VaultSettingName ]`: Vault setting name. + - `[VcenterName ]`: vcenter name. + - `[VirtualMachineName ]`: Virtual Machine name. + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/Update-AzSiteRecoveryReplicationRecoveryServiceProvider.md b/swaggerci/recoveryservicessiterecovery/docs/Update-AzSiteRecoveryReplicationRecoveryServiceProvider.md new file mode 100644 index 000000000000..d9147ce0babe --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/Update-AzSiteRecoveryReplicationRecoveryServiceProvider.md @@ -0,0 +1,274 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/update-azsiterecoveryreplicationrecoveryserviceprovider +schema: 2.0.0 +--- + +# Update-AzSiteRecoveryReplicationRecoveryServiceProvider + +## SYNOPSIS +The operation to refresh the information from the recovery services provider. + +## SYNTAX + +### Refresh (Default) +``` +Update-AzSiteRecoveryReplicationRecoveryServiceProvider -FabricName -ProviderName + -ResourceGroupName -ResourceName [-SubscriptionId ] [-DefaultProfile ] + [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +### RefreshViaIdentity +``` +Update-AzSiteRecoveryReplicationRecoveryServiceProvider -InputObject + [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +The operation to refresh the information from the recovery services provider. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FabricName +Fabric name. + +```yaml +Type: System.String +Parameter Sets: Refresh +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +Parameter Sets: RefreshViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProviderName +Recovery services provider name. + +```yaml +Type: System.String +Parameter Sets: Refresh +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: Refresh +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: Refresh +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String +Parameter Sets: Refresh +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProvider + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`INPUTOBJECT `: Identity Parameter + - `[AlertSettingName ]`: The name of the email notification configuration. + - `[EventName ]`: The name of the Azure Site Recovery event. + - `[FabricName ]`: Fabric name. + - `[Id ]`: Resource identity path + - `[IntentObjectName ]`: Replication protection intent name. + - `[JobName ]`: Job identifier. + - `[LogicalNetworkName ]`: Logical network name. + - `[MappingName ]`: Protection Container mapping name. + - `[MigrationItemName ]`: Migration item name. + - `[MigrationRecoveryPointName ]`: The migration recovery point name. + - `[NetworkMappingName ]`: Network mapping name. + - `[NetworkName ]`: Primary network name. + - `[PolicyName ]`: Replication policy name. + - `[ProtectableItemName ]`: Protectable item name. + - `[ProtectionContainerName ]`: Protection container name. + - `[ProviderName ]`: Recovery services provider name. + - `[RecoveryPlanName ]`: Name of the recovery plan. + - `[RecoveryPointName ]`: The recovery point name. + - `[ReplicatedProtectedItemName ]`: Replication protected item name. + - `[ResourceGroupName ]`: The name of the resource group where the recovery services vault is present. + - `[ResourceName ]`: The name of the recovery services vault. + - `[StorageClassificationMappingName ]`: Storage classification mapping name. + - `[StorageClassificationName ]`: Storage classification name. + - `[SubscriptionId ]`: The subscription Id. + - `[VaultSettingName ]`: Vault setting name. + - `[VcenterName ]`: vcenter name. + - `[VirtualMachineName ]`: Virtual Machine name. + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/Update-AzSiteRecoveryReplicationVaultHealth.md b/swaggerci/recoveryservicessiterecovery/docs/Update-AzSiteRecoveryReplicationVaultHealth.md new file mode 100644 index 000000000000..840943f0c0e8 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/Update-AzSiteRecoveryReplicationVaultHealth.md @@ -0,0 +1,244 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/update-azsiterecoveryreplicationvaulthealth +schema: 2.0.0 +--- + +# Update-AzSiteRecoveryReplicationVaultHealth + +## SYNOPSIS +Refreshes health summary of the vault. + +## SYNTAX + +### Refresh (Default) +``` +Update-AzSiteRecoveryReplicationVaultHealth -ResourceGroupName -ResourceName + [-SubscriptionId ] [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] + [] +``` + +### RefreshViaIdentity +``` +Update-AzSiteRecoveryReplicationVaultHealth -InputObject [-DefaultProfile ] + [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Refreshes health summary of the vault. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +Parameter Sets: RefreshViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: Refresh +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: Refresh +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String +Parameter Sets: Refresh +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthDetails + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`INPUTOBJECT `: Identity Parameter + - `[AlertSettingName ]`: The name of the email notification configuration. + - `[EventName ]`: The name of the Azure Site Recovery event. + - `[FabricName ]`: Fabric name. + - `[Id ]`: Resource identity path + - `[IntentObjectName ]`: Replication protection intent name. + - `[JobName ]`: Job identifier. + - `[LogicalNetworkName ]`: Logical network name. + - `[MappingName ]`: Protection Container mapping name. + - `[MigrationItemName ]`: Migration item name. + - `[MigrationRecoveryPointName ]`: The migration recovery point name. + - `[NetworkMappingName ]`: Network mapping name. + - `[NetworkName ]`: Primary network name. + - `[PolicyName ]`: Replication policy name. + - `[ProtectableItemName ]`: Protectable item name. + - `[ProtectionContainerName ]`: Protection container name. + - `[ProviderName ]`: Recovery services provider name. + - `[RecoveryPlanName ]`: Name of the recovery plan. + - `[RecoveryPointName ]`: The recovery point name. + - `[ReplicatedProtectedItemName ]`: Replication protected item name. + - `[ResourceGroupName ]`: The name of the resource group where the recovery services vault is present. + - `[ResourceName ]`: The name of the recovery services vault. + - `[StorageClassificationMappingName ]`: Storage classification mapping name. + - `[StorageClassificationName ]`: Storage classification name. + - `[SubscriptionId ]`: The subscription Id. + - `[VaultSettingName ]`: Vault setting name. + - `[VcenterName ]`: vcenter name. + - `[VirtualMachineName ]`: Virtual Machine name. + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/docs/Update-AzSiteRecoveryReplicationvCenter.md b/swaggerci/recoveryservicessiterecovery/docs/Update-AzSiteRecoveryReplicationvCenter.md new file mode 100644 index 000000000000..46faccbf1cb8 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/docs/Update-AzSiteRecoveryReplicationvCenter.md @@ -0,0 +1,351 @@ +--- +external help file: +Module Name: Az.SiteRecovery +online version: https://learn.microsoft.com/powershell/module/az.siterecovery/update-azsiterecoveryreplicationvcenter +schema: 2.0.0 +--- + +# Update-AzSiteRecoveryReplicationvCenter + +## SYNOPSIS +The operation to update a registered vCenter. + +## SYNTAX + +### UpdateExpanded (Default) +``` +Update-AzSiteRecoveryReplicationvCenter -FabricName -ResourceGroupName + -ResourceName -VcenterName [-SubscriptionId ] [-FriendlyName ] + [-IPAddress ] [-Port ] [-ProcessServerId ] [-RunAsAccountId ] + [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +### UpdateViaIdentityExpanded +``` +Update-AzSiteRecoveryReplicationvCenter -InputObject [-FriendlyName ] + [-IPAddress ] [-Port ] [-ProcessServerId ] [-RunAsAccountId ] + [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +The operation to update a registered vCenter. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FabricName +Fabric name. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FriendlyName +The friendly name of the vCenter. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +Parameter Sets: UpdateViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -IPAddress +The IP address of the vCenter to be discovered. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Port +The port number for discovery. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProcessServerId +The process server Id from where the update can be orchestrated. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group where the recovery services vault is present. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceName +The name of the recovery services vault. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -RunAsAccountId +The CS account Id which has privileges to update the vCenter. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription Id. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -VcenterName +vcenter name. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenter + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`INPUTOBJECT `: Identity Parameter + - `[AlertSettingName ]`: The name of the email notification configuration. + - `[EventName ]`: The name of the Azure Site Recovery event. + - `[FabricName ]`: Fabric name. + - `[Id ]`: Resource identity path + - `[IntentObjectName ]`: Replication protection intent name. + - `[JobName ]`: Job identifier. + - `[LogicalNetworkName ]`: Logical network name. + - `[MappingName ]`: Protection Container mapping name. + - `[MigrationItemName ]`: Migration item name. + - `[MigrationRecoveryPointName ]`: The migration recovery point name. + - `[NetworkMappingName ]`: Network mapping name. + - `[NetworkName ]`: Primary network name. + - `[PolicyName ]`: Replication policy name. + - `[ProtectableItemName ]`: Protectable item name. + - `[ProtectionContainerName ]`: Protection container name. + - `[ProviderName ]`: Recovery services provider name. + - `[RecoveryPlanName ]`: Name of the recovery plan. + - `[RecoveryPointName ]`: The recovery point name. + - `[ReplicatedProtectedItemName ]`: Replication protected item name. + - `[ResourceGroupName ]`: The name of the resource group where the recovery services vault is present. + - `[ResourceName ]`: The name of the recovery services vault. + - `[StorageClassificationMappingName ]`: Storage classification mapping name. + - `[StorageClassificationName ]`: Storage classification name. + - `[SubscriptionId ]`: The subscription Id. + - `[VaultSettingName ]`: Vault setting name. + - `[VcenterName ]`: vcenter name. + - `[VirtualMachineName ]`: Virtual Machine name. + +## RELATED LINKS + diff --git a/swaggerci/recoveryservicessiterecovery/examples/Add-AzSiteRecoveryReplicationProtectedItemDisk.md b/swaggerci/recoveryservicessiterecovery/examples/Add-AzSiteRecoveryReplicationProtectedItemDisk.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/Add-AzSiteRecoveryReplicationProtectedItemDisk.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/Add-AzSiteRecoveryReplicationProtectedItemRecoveryPoint.md b/swaggerci/recoveryservicessiterecovery/examples/Add-AzSiteRecoveryReplicationProtectedItemRecoveryPoint.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/Add-AzSiteRecoveryReplicationProtectedItemRecoveryPoint.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/Clear-AzSiteRecoveryReplicationFabric.md b/swaggerci/recoveryservicessiterecovery/examples/Clear-AzSiteRecoveryReplicationFabric.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/Clear-AzSiteRecoveryReplicationFabric.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/Clear-AzSiteRecoveryReplicationProtectedItem.md b/swaggerci/recoveryservicessiterecovery/examples/Clear-AzSiteRecoveryReplicationProtectedItem.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/Clear-AzSiteRecoveryReplicationProtectedItem.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/Clear-AzSiteRecoveryReplicationProtectionContainerMapping.md b/swaggerci/recoveryservicessiterecovery/examples/Clear-AzSiteRecoveryReplicationProtectionContainerMapping.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/Clear-AzSiteRecoveryReplicationProtectionContainerMapping.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/Clear-AzSiteRecoveryReplicationRecoveryServicesProvider.md b/swaggerci/recoveryservicessiterecovery/examples/Clear-AzSiteRecoveryReplicationRecoveryServicesProvider.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/Clear-AzSiteRecoveryReplicationRecoveryServicesProvider.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/Export-AzSiteRecoveryReplicationJob.md b/swaggerci/recoveryservicessiterecovery/examples/Export-AzSiteRecoveryReplicationJob.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/Export-AzSiteRecoveryReplicationJob.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/Find-AzSiteRecoveryReplicationProtectionContainerProtectableItem.md b/swaggerci/recoveryservicessiterecovery/examples/Find-AzSiteRecoveryReplicationProtectionContainerProtectableItem.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/Find-AzSiteRecoveryReplicationProtectionContainerProtectableItem.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/Get-AzSiteRecoveryMigrationRecoveryPoint.md b/swaggerci/recoveryservicessiterecovery/examples/Get-AzSiteRecoveryMigrationRecoveryPoint.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/Get-AzSiteRecoveryMigrationRecoveryPoint.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/Get-AzSiteRecoveryPoint.md b/swaggerci/recoveryservicessiterecovery/examples/Get-AzSiteRecoveryPoint.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/Get-AzSiteRecoveryPoint.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/Get-AzSiteRecoveryReplicationAlertSetting.md b/swaggerci/recoveryservicessiterecovery/examples/Get-AzSiteRecoveryReplicationAlertSetting.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/Get-AzSiteRecoveryReplicationAlertSetting.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/Get-AzSiteRecoveryReplicationAppliance.md b/swaggerci/recoveryservicessiterecovery/examples/Get-AzSiteRecoveryReplicationAppliance.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/Get-AzSiteRecoveryReplicationAppliance.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/Get-AzSiteRecoveryReplicationEligibilityResult.md b/swaggerci/recoveryservicessiterecovery/examples/Get-AzSiteRecoveryReplicationEligibilityResult.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/Get-AzSiteRecoveryReplicationEligibilityResult.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/Get-AzSiteRecoveryReplicationEvent.md b/swaggerci/recoveryservicessiterecovery/examples/Get-AzSiteRecoveryReplicationEvent.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/Get-AzSiteRecoveryReplicationEvent.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/Get-AzSiteRecoveryReplicationFabric.md b/swaggerci/recoveryservicessiterecovery/examples/Get-AzSiteRecoveryReplicationFabric.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/Get-AzSiteRecoveryReplicationFabric.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/Get-AzSiteRecoveryReplicationJob.md b/swaggerci/recoveryservicessiterecovery/examples/Get-AzSiteRecoveryReplicationJob.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/Get-AzSiteRecoveryReplicationJob.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/Get-AzSiteRecoveryReplicationLogicalNetwork.md b/swaggerci/recoveryservicessiterecovery/examples/Get-AzSiteRecoveryReplicationLogicalNetwork.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/Get-AzSiteRecoveryReplicationLogicalNetwork.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/Get-AzSiteRecoveryReplicationMigrationItem.md b/swaggerci/recoveryservicessiterecovery/examples/Get-AzSiteRecoveryReplicationMigrationItem.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/Get-AzSiteRecoveryReplicationMigrationItem.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/Get-AzSiteRecoveryReplicationNetwork.md b/swaggerci/recoveryservicessiterecovery/examples/Get-AzSiteRecoveryReplicationNetwork.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/Get-AzSiteRecoveryReplicationNetwork.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/Get-AzSiteRecoveryReplicationNetworkMapping.md b/swaggerci/recoveryservicessiterecovery/examples/Get-AzSiteRecoveryReplicationNetworkMapping.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/Get-AzSiteRecoveryReplicationNetworkMapping.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/Get-AzSiteRecoveryReplicationPolicy.md b/swaggerci/recoveryservicessiterecovery/examples/Get-AzSiteRecoveryReplicationPolicy.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/Get-AzSiteRecoveryReplicationPolicy.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/Get-AzSiteRecoveryReplicationProtectableItem.md b/swaggerci/recoveryservicessiterecovery/examples/Get-AzSiteRecoveryReplicationProtectableItem.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/Get-AzSiteRecoveryReplicationProtectableItem.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/Get-AzSiteRecoveryReplicationProtectedItem.md b/swaggerci/recoveryservicessiterecovery/examples/Get-AzSiteRecoveryReplicationProtectedItem.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/Get-AzSiteRecoveryReplicationProtectedItem.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/Get-AzSiteRecoveryReplicationProtectionContainer.md b/swaggerci/recoveryservicessiterecovery/examples/Get-AzSiteRecoveryReplicationProtectionContainer.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/Get-AzSiteRecoveryReplicationProtectionContainer.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/Get-AzSiteRecoveryReplicationProtectionContainerMapping.md b/swaggerci/recoveryservicessiterecovery/examples/Get-AzSiteRecoveryReplicationProtectionContainerMapping.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/Get-AzSiteRecoveryReplicationProtectionContainerMapping.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/Get-AzSiteRecoveryReplicationProtectionIntent.md b/swaggerci/recoveryservicessiterecovery/examples/Get-AzSiteRecoveryReplicationProtectionIntent.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/Get-AzSiteRecoveryReplicationProtectionIntent.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/Get-AzSiteRecoveryReplicationRecoveryPlan.md b/swaggerci/recoveryservicessiterecovery/examples/Get-AzSiteRecoveryReplicationRecoveryPlan.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/Get-AzSiteRecoveryReplicationRecoveryPlan.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/Get-AzSiteRecoveryReplicationRecoveryServiceProvider.md b/swaggerci/recoveryservicessiterecovery/examples/Get-AzSiteRecoveryReplicationRecoveryServiceProvider.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/Get-AzSiteRecoveryReplicationRecoveryServiceProvider.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/Get-AzSiteRecoveryReplicationRecoveryServicesProvider.md b/swaggerci/recoveryservicessiterecovery/examples/Get-AzSiteRecoveryReplicationRecoveryServicesProvider.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/Get-AzSiteRecoveryReplicationRecoveryServicesProvider.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/Get-AzSiteRecoveryReplicationStorageClassification.md b/swaggerci/recoveryservicessiterecovery/examples/Get-AzSiteRecoveryReplicationStorageClassification.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/Get-AzSiteRecoveryReplicationStorageClassification.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/Get-AzSiteRecoveryReplicationStorageClassificationMapping.md b/swaggerci/recoveryservicessiterecovery/examples/Get-AzSiteRecoveryReplicationStorageClassificationMapping.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/Get-AzSiteRecoveryReplicationStorageClassificationMapping.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/Get-AzSiteRecoveryReplicationVaultHealth.md b/swaggerci/recoveryservicessiterecovery/examples/Get-AzSiteRecoveryReplicationVaultHealth.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/Get-AzSiteRecoveryReplicationVaultHealth.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/Get-AzSiteRecoveryReplicationVaultSetting.md b/swaggerci/recoveryservicessiterecovery/examples/Get-AzSiteRecoveryReplicationVaultSetting.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/Get-AzSiteRecoveryReplicationVaultSetting.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/Get-AzSiteRecoveryReplicationvCenter.md b/swaggerci/recoveryservicessiterecovery/examples/Get-AzSiteRecoveryReplicationvCenter.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/Get-AzSiteRecoveryReplicationvCenter.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/Get-AzSiteRecoverySupportedOperatingSystem.md b/swaggerci/recoveryservicessiterecovery/examples/Get-AzSiteRecoverySupportedOperatingSystem.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/Get-AzSiteRecoverySupportedOperatingSystem.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/Get-AzSiteRecoveryTargetComputeSize.md b/swaggerci/recoveryservicessiterecovery/examples/Get-AzSiteRecoveryTargetComputeSize.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/Get-AzSiteRecoveryTargetComputeSize.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/Invoke-AzSiteRecoveryCommitReplicationProtectedItemFailover.md b/swaggerci/recoveryservicessiterecovery/examples/Invoke-AzSiteRecoveryCommitReplicationProtectedItemFailover.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/Invoke-AzSiteRecoveryCommitReplicationProtectedItemFailover.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/Invoke-AzSiteRecoveryCommitReplicationRecoveryPlanFailover.md b/swaggerci/recoveryservicessiterecovery/examples/Invoke-AzSiteRecoveryCommitReplicationRecoveryPlanFailover.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/Invoke-AzSiteRecoveryCommitReplicationRecoveryPlanFailover.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/Invoke-AzSiteRecoveryPlannedReplicationProtectedItemFailover.md b/swaggerci/recoveryservicessiterecovery/examples/Invoke-AzSiteRecoveryPlannedReplicationProtectedItemFailover.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/Invoke-AzSiteRecoveryPlannedReplicationProtectedItemFailover.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/Invoke-AzSiteRecoveryPlannedReplicationRecoveryPlanFailover.md b/swaggerci/recoveryservicessiterecovery/examples/Invoke-AzSiteRecoveryPlannedReplicationRecoveryPlanFailover.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/Invoke-AzSiteRecoveryPlannedReplicationRecoveryPlanFailover.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/Invoke-AzSiteRecoveryRenewReplicationFabricCertificate.md b/swaggerci/recoveryservicessiterecovery/examples/Invoke-AzSiteRecoveryRenewReplicationFabricCertificate.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/Invoke-AzSiteRecoveryRenewReplicationFabricCertificate.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/Invoke-AzSiteRecoveryReprotectReplicationProtectedItem.md b/swaggerci/recoveryservicessiterecovery/examples/Invoke-AzSiteRecoveryReprotectReplicationProtectedItem.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/Invoke-AzSiteRecoveryReprotectReplicationProtectedItem.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/Invoke-AzSiteRecoveryReprotectReplicationRecoveryPlan.md b/swaggerci/recoveryservicessiterecovery/examples/Invoke-AzSiteRecoveryReprotectReplicationRecoveryPlan.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/Invoke-AzSiteRecoveryReprotectReplicationRecoveryPlan.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/Invoke-AzSiteRecoveryResyncReplicationMigrationItem.md b/swaggerci/recoveryservicessiterecovery/examples/Invoke-AzSiteRecoveryResyncReplicationMigrationItem.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/Invoke-AzSiteRecoveryResyncReplicationMigrationItem.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/Invoke-AzSiteRecoveryUnplannedReplicationProtectedItemFailover.md b/swaggerci/recoveryservicessiterecovery/examples/Invoke-AzSiteRecoveryUnplannedReplicationProtectedItemFailover.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/Invoke-AzSiteRecoveryUnplannedReplicationProtectedItemFailover.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/Invoke-AzSiteRecoveryUnplannedReplicationRecoveryPlanFailover.md b/swaggerci/recoveryservicessiterecovery/examples/Invoke-AzSiteRecoveryUnplannedReplicationRecoveryPlanFailover.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/Invoke-AzSiteRecoveryUnplannedReplicationRecoveryPlanFailover.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/Move-AzSiteRecoveryReplicationFabricGateway.md b/swaggerci/recoveryservicessiterecovery/examples/Move-AzSiteRecoveryReplicationFabricGateway.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/Move-AzSiteRecoveryReplicationFabricGateway.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/Move-AzSiteRecoveryReplicationFabricToAad.md b/swaggerci/recoveryservicessiterecovery/examples/Move-AzSiteRecoveryReplicationFabricToAad.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/Move-AzSiteRecoveryReplicationFabricToAad.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/Move-AzSiteRecoveryReplicationMigrationItem.md b/swaggerci/recoveryservicessiterecovery/examples/Move-AzSiteRecoveryReplicationMigrationItem.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/Move-AzSiteRecoveryReplicationMigrationItem.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/New-AzSiteRecoveryReplicationAlertSetting.md b/swaggerci/recoveryservicessiterecovery/examples/New-AzSiteRecoveryReplicationAlertSetting.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/New-AzSiteRecoveryReplicationAlertSetting.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/New-AzSiteRecoveryReplicationFabric.md b/swaggerci/recoveryservicessiterecovery/examples/New-AzSiteRecoveryReplicationFabric.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/New-AzSiteRecoveryReplicationFabric.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/New-AzSiteRecoveryReplicationMigrationItem.md b/swaggerci/recoveryservicessiterecovery/examples/New-AzSiteRecoveryReplicationMigrationItem.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/New-AzSiteRecoveryReplicationMigrationItem.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/New-AzSiteRecoveryReplicationNetworkMapping.md b/swaggerci/recoveryservicessiterecovery/examples/New-AzSiteRecoveryReplicationNetworkMapping.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/New-AzSiteRecoveryReplicationNetworkMapping.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/New-AzSiteRecoveryReplicationPolicy.md b/swaggerci/recoveryservicessiterecovery/examples/New-AzSiteRecoveryReplicationPolicy.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/New-AzSiteRecoveryReplicationPolicy.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/New-AzSiteRecoveryReplicationProtectedItem.md b/swaggerci/recoveryservicessiterecovery/examples/New-AzSiteRecoveryReplicationProtectedItem.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/New-AzSiteRecoveryReplicationProtectedItem.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/New-AzSiteRecoveryReplicationProtectionContainer.md b/swaggerci/recoveryservicessiterecovery/examples/New-AzSiteRecoveryReplicationProtectionContainer.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/New-AzSiteRecoveryReplicationProtectionContainer.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/New-AzSiteRecoveryReplicationProtectionContainerMapping.md b/swaggerci/recoveryservicessiterecovery/examples/New-AzSiteRecoveryReplicationProtectionContainerMapping.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/New-AzSiteRecoveryReplicationProtectionContainerMapping.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/New-AzSiteRecoveryReplicationProtectionIntent.md b/swaggerci/recoveryservicessiterecovery/examples/New-AzSiteRecoveryReplicationProtectionIntent.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/New-AzSiteRecoveryReplicationProtectionIntent.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/New-AzSiteRecoveryReplicationRecoveryPlan.md b/swaggerci/recoveryservicessiterecovery/examples/New-AzSiteRecoveryReplicationRecoveryPlan.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/New-AzSiteRecoveryReplicationRecoveryPlan.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/New-AzSiteRecoveryReplicationRecoveryServicesProvider.md b/swaggerci/recoveryservicessiterecovery/examples/New-AzSiteRecoveryReplicationRecoveryServicesProvider.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/New-AzSiteRecoveryReplicationRecoveryServicesProvider.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/New-AzSiteRecoveryReplicationStorageClassificationMapping.md b/swaggerci/recoveryservicessiterecovery/examples/New-AzSiteRecoveryReplicationStorageClassificationMapping.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/New-AzSiteRecoveryReplicationStorageClassificationMapping.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/New-AzSiteRecoveryReplicationVaultSetting.md b/swaggerci/recoveryservicessiterecovery/examples/New-AzSiteRecoveryReplicationVaultSetting.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/New-AzSiteRecoveryReplicationVaultSetting.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/New-AzSiteRecoveryReplicationvCenter.md b/swaggerci/recoveryservicessiterecovery/examples/New-AzSiteRecoveryReplicationvCenter.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/New-AzSiteRecoveryReplicationvCenter.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/Remove-AzSiteRecoveryReplicationFabric.md b/swaggerci/recoveryservicessiterecovery/examples/Remove-AzSiteRecoveryReplicationFabric.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/Remove-AzSiteRecoveryReplicationFabric.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/Remove-AzSiteRecoveryReplicationMigrationItem.md b/swaggerci/recoveryservicessiterecovery/examples/Remove-AzSiteRecoveryReplicationMigrationItem.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/Remove-AzSiteRecoveryReplicationMigrationItem.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/Remove-AzSiteRecoveryReplicationNetworkMapping.md b/swaggerci/recoveryservicessiterecovery/examples/Remove-AzSiteRecoveryReplicationNetworkMapping.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/Remove-AzSiteRecoveryReplicationNetworkMapping.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/Remove-AzSiteRecoveryReplicationPolicy.md b/swaggerci/recoveryservicessiterecovery/examples/Remove-AzSiteRecoveryReplicationPolicy.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/Remove-AzSiteRecoveryReplicationPolicy.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/Remove-AzSiteRecoveryReplicationProtectedItem.md b/swaggerci/recoveryservicessiterecovery/examples/Remove-AzSiteRecoveryReplicationProtectedItem.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/Remove-AzSiteRecoveryReplicationProtectedItem.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/Remove-AzSiteRecoveryReplicationProtectedItemDisk.md b/swaggerci/recoveryservicessiterecovery/examples/Remove-AzSiteRecoveryReplicationProtectedItemDisk.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/Remove-AzSiteRecoveryReplicationProtectedItemDisk.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/Remove-AzSiteRecoveryReplicationProtectionContainer.md b/swaggerci/recoveryservicessiterecovery/examples/Remove-AzSiteRecoveryReplicationProtectionContainer.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/Remove-AzSiteRecoveryReplicationProtectionContainer.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/Remove-AzSiteRecoveryReplicationProtectionContainerMapping.md b/swaggerci/recoveryservicessiterecovery/examples/Remove-AzSiteRecoveryReplicationProtectionContainerMapping.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/Remove-AzSiteRecoveryReplicationProtectionContainerMapping.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/Remove-AzSiteRecoveryReplicationRecoveryPlan.md b/swaggerci/recoveryservicessiterecovery/examples/Remove-AzSiteRecoveryReplicationRecoveryPlan.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/Remove-AzSiteRecoveryReplicationRecoveryPlan.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/Remove-AzSiteRecoveryReplicationRecoveryServicesProvider.md b/swaggerci/recoveryservicessiterecovery/examples/Remove-AzSiteRecoveryReplicationRecoveryServicesProvider.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/Remove-AzSiteRecoveryReplicationRecoveryServicesProvider.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/Remove-AzSiteRecoveryReplicationStorageClassificationMapping.md b/swaggerci/recoveryservicessiterecovery/examples/Remove-AzSiteRecoveryReplicationStorageClassificationMapping.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/Remove-AzSiteRecoveryReplicationStorageClassificationMapping.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/Remove-AzSiteRecoveryReplicationvCenter.md b/swaggerci/recoveryservicessiterecovery/examples/Remove-AzSiteRecoveryReplicationvCenter.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/Remove-AzSiteRecoveryReplicationvCenter.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/Repair-AzSiteRecoveryReplicationProtectedItemReplication.md b/swaggerci/recoveryservicessiterecovery/examples/Repair-AzSiteRecoveryReplicationProtectedItemReplication.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/Repair-AzSiteRecoveryReplicationProtectedItemReplication.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/Resolve-AzSiteRecoveryReplicationProtectedItemHealthError.md b/swaggerci/recoveryservicessiterecovery/examples/Resolve-AzSiteRecoveryReplicationProtectedItemHealthError.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/Resolve-AzSiteRecoveryReplicationProtectedItemHealthError.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/Restart-AzSiteRecoveryReplicationJob.md b/swaggerci/recoveryservicessiterecovery/examples/Restart-AzSiteRecoveryReplicationJob.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/Restart-AzSiteRecoveryReplicationJob.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/Resume-AzSiteRecoveryReplicationJob.md b/swaggerci/recoveryservicessiterecovery/examples/Resume-AzSiteRecoveryReplicationJob.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/Resume-AzSiteRecoveryReplicationJob.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/Resume-AzSiteRecoveryReplicationMigrationItemReplication.md b/swaggerci/recoveryservicessiterecovery/examples/Resume-AzSiteRecoveryReplicationMigrationItemReplication.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/Resume-AzSiteRecoveryReplicationMigrationItemReplication.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/Stop-AzSiteRecoveryReplicationJob.md b/swaggerci/recoveryservicessiterecovery/examples/Stop-AzSiteRecoveryReplicationJob.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/Stop-AzSiteRecoveryReplicationJob.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/Stop-AzSiteRecoveryReplicationProtectedItemFailover.md b/swaggerci/recoveryservicessiterecovery/examples/Stop-AzSiteRecoveryReplicationProtectedItemFailover.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/Stop-AzSiteRecoveryReplicationProtectedItemFailover.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/Stop-AzSiteRecoveryReplicationRecoveryPlanFailover.md b/swaggerci/recoveryservicessiterecovery/examples/Stop-AzSiteRecoveryReplicationRecoveryPlanFailover.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/Stop-AzSiteRecoveryReplicationRecoveryPlanFailover.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/Suspend-AzSiteRecoveryReplicationMigrationItemReplication.md b/swaggerci/recoveryservicessiterecovery/examples/Suspend-AzSiteRecoveryReplicationMigrationItemReplication.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/Suspend-AzSiteRecoveryReplicationMigrationItemReplication.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/Switch-AzSiteRecoveryReplicationProtectedItemProvider.md b/swaggerci/recoveryservicessiterecovery/examples/Switch-AzSiteRecoveryReplicationProtectedItemProvider.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/Switch-AzSiteRecoveryReplicationProtectedItemProvider.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/Switch-AzSiteRecoveryReplicationProtectionContainerProtection.md b/swaggerci/recoveryservicessiterecovery/examples/Switch-AzSiteRecoveryReplicationProtectionContainerProtection.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/Switch-AzSiteRecoveryReplicationProtectionContainerProtection.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/Test-AzSiteRecoveryReplicationFabricConsistency.md b/swaggerci/recoveryservicessiterecovery/examples/Test-AzSiteRecoveryReplicationFabricConsistency.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/Test-AzSiteRecoveryReplicationFabricConsistency.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/Test-AzSiteRecoveryReplicationMigrationItemMigrate.md b/swaggerci/recoveryservicessiterecovery/examples/Test-AzSiteRecoveryReplicationMigrationItemMigrate.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/Test-AzSiteRecoveryReplicationMigrationItemMigrate.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/Test-AzSiteRecoveryReplicationMigrationItemMigrateCleanup.md b/swaggerci/recoveryservicessiterecovery/examples/Test-AzSiteRecoveryReplicationMigrationItemMigrateCleanup.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/Test-AzSiteRecoveryReplicationMigrationItemMigrateCleanup.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/Test-AzSiteRecoveryReplicationProtectedItemFailover.md b/swaggerci/recoveryservicessiterecovery/examples/Test-AzSiteRecoveryReplicationProtectedItemFailover.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/Test-AzSiteRecoveryReplicationProtectedItemFailover.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/Test-AzSiteRecoveryReplicationProtectedItemFailoverCleanup.md b/swaggerci/recoveryservicessiterecovery/examples/Test-AzSiteRecoveryReplicationProtectedItemFailoverCleanup.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/Test-AzSiteRecoveryReplicationProtectedItemFailoverCleanup.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/Test-AzSiteRecoveryReplicationRecoveryPlanFailover.md b/swaggerci/recoveryservicessiterecovery/examples/Test-AzSiteRecoveryReplicationRecoveryPlanFailover.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/Test-AzSiteRecoveryReplicationRecoveryPlanFailover.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/Test-AzSiteRecoveryReplicationRecoveryPlanFailoverCleanup.md b/swaggerci/recoveryservicessiterecovery/examples/Test-AzSiteRecoveryReplicationRecoveryPlanFailoverCleanup.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/Test-AzSiteRecoveryReplicationRecoveryPlanFailoverCleanup.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/Update-AzSiteRecoveryReplicationMigrationItem.md b/swaggerci/recoveryservicessiterecovery/examples/Update-AzSiteRecoveryReplicationMigrationItem.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/Update-AzSiteRecoveryReplicationMigrationItem.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/Update-AzSiteRecoveryReplicationNetworkMapping.md b/swaggerci/recoveryservicessiterecovery/examples/Update-AzSiteRecoveryReplicationNetworkMapping.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/Update-AzSiteRecoveryReplicationNetworkMapping.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/Update-AzSiteRecoveryReplicationPolicy.md b/swaggerci/recoveryservicessiterecovery/examples/Update-AzSiteRecoveryReplicationPolicy.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/Update-AzSiteRecoveryReplicationPolicy.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/Update-AzSiteRecoveryReplicationProtectedItem.md b/swaggerci/recoveryservicessiterecovery/examples/Update-AzSiteRecoveryReplicationProtectedItem.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/Update-AzSiteRecoveryReplicationProtectedItem.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/Update-AzSiteRecoveryReplicationProtectedItemAppliance.md b/swaggerci/recoveryservicessiterecovery/examples/Update-AzSiteRecoveryReplicationProtectedItemAppliance.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/Update-AzSiteRecoveryReplicationProtectedItemAppliance.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/Update-AzSiteRecoveryReplicationProtectedItemMobilityService.md b/swaggerci/recoveryservicessiterecovery/examples/Update-AzSiteRecoveryReplicationProtectedItemMobilityService.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/Update-AzSiteRecoveryReplicationProtectedItemMobilityService.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/Update-AzSiteRecoveryReplicationProtectionContainerMapping.md b/swaggerci/recoveryservicessiterecovery/examples/Update-AzSiteRecoveryReplicationProtectionContainerMapping.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/Update-AzSiteRecoveryReplicationProtectionContainerMapping.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/Update-AzSiteRecoveryReplicationRecoveryPlan.md b/swaggerci/recoveryservicessiterecovery/examples/Update-AzSiteRecoveryReplicationRecoveryPlan.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/Update-AzSiteRecoveryReplicationRecoveryPlan.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/Update-AzSiteRecoveryReplicationRecoveryServiceProvider.md b/swaggerci/recoveryservicessiterecovery/examples/Update-AzSiteRecoveryReplicationRecoveryServiceProvider.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/Update-AzSiteRecoveryReplicationRecoveryServiceProvider.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/Update-AzSiteRecoveryReplicationVaultHealth.md b/swaggerci/recoveryservicessiterecovery/examples/Update-AzSiteRecoveryReplicationVaultHealth.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/Update-AzSiteRecoveryReplicationVaultHealth.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/examples/Update-AzSiteRecoveryReplicationvCenter.md b/swaggerci/recoveryservicessiterecovery/examples/Update-AzSiteRecoveryReplicationvCenter.md new file mode 100644 index 000000000000..6ee1a83db970 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/examples/Update-AzSiteRecoveryReplicationvCenter.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here }} +``` + +{{ Add description here }} + diff --git a/swaggerci/recoveryservicessiterecovery/export-surface.ps1 b/swaggerci/recoveryservicessiterecovery/export-surface.ps1 new file mode 100644 index 000000000000..f536f410ed88 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/export-surface.ps1 @@ -0,0 +1,33 @@ +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- +param([switch]$Isolated, [switch]$IncludeGeneralParameters, [switch]$UseExpandedFormat) +$ErrorActionPreference = 'Stop' + +$pwsh = [System.Diagnostics.Process]::GetCurrentProcess().Path +if(-not $Isolated) { + Write-Host -ForegroundColor Green 'Creating isolated process...' + & "$pwsh" -NonInteractive -NoLogo -NoProfile -File $MyInvocation.MyCommand.Path @PSBoundParameters -Isolated + return +} + +$dll = Join-Path $PSScriptRoot 'bin/Az.SiteRecovery.private.dll' +if(-not (Test-Path $dll)) { + Write-Error "Unable to find output assembly in '$binFolder'." +} +$null = Import-Module -Name $dll + +$moduleName = 'Az.SiteRecovery' +$exportsFolder = Join-Path $PSScriptRoot 'exports' +$resourcesFolder = Join-Path $PSScriptRoot 'resources' + +Export-CmdletSurface -ModuleName $moduleName -CmdletFolder $exportsFolder -OutputFolder $resourcesFolder -IncludeGeneralParameters $IncludeGeneralParameters.IsPresent -UseExpandedFormat $UseExpandedFormat.IsPresent +Write-Host -ForegroundColor Green "CmdletSurface file(s) created in '$resourcesFolder'" + +Export-ModelSurface -OutputFolder $resourcesFolder -UseExpandedFormat $UseExpandedFormat.IsPresent +Write-Host -ForegroundColor Green "ModelSurface file created in '$resourcesFolder'" + +Write-Host -ForegroundColor Green '-------------Done-------------' \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/exports/Add-AzSiteRecoveryReplicationProtectedItemDisk.ps1 b/swaggerci/recoveryservicessiterecovery/exports/Add-AzSiteRecoveryReplicationProtectedItemDisk.ps1 new file mode 100644 index 000000000000..1857a8855ddd --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/Add-AzSiteRecoveryReplicationProtectedItemDisk.ps1 @@ -0,0 +1,272 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Operation to add disks(s) to the replication protected item. +.Description +Operation to add disks(s) to the replication protected item. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksInput +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +ADDDISKSINPUT : Input for add disk(s) operation. + [ProviderSpecificDetailInstanceType ]: The class type. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/add-azsiterecoveryreplicationprotecteditemdisk +#> +function Add-AzSiteRecoveryReplicationProtectedItemDisk { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem])] +[CmdletBinding(DefaultParameterSetName='AddExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Add', Mandatory)] + [Parameter(ParameterSetName='AddExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Unique fabric name. + ${FabricName}, + + [Parameter(ParameterSetName='Add', Mandatory)] + [Parameter(ParameterSetName='AddExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Protection container name. + ${ProtectionContainerName}, + + [Parameter(ParameterSetName='Add', Mandatory)] + [Parameter(ParameterSetName='AddExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Replication protected item name. + ${ReplicatedProtectedItemName}, + + [Parameter(ParameterSetName='Add', Mandatory)] + [Parameter(ParameterSetName='AddExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Add', Mandatory)] + [Parameter(ParameterSetName='AddExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Add')] + [Parameter(ParameterSetName='AddExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='AddViaIdentity', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='AddViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='Add', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='AddViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksInput] + # Input for add disk(s) operation. + # To construct, see NOTES section for ADDDISKSINPUT properties and create a hash table. + ${AddDisksInput}, + + [Parameter(ParameterSetName='AddExpanded')] + [Parameter(ParameterSetName='AddViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The class type. + ${ProviderSpecificDetailInstanceType}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Add = 'Az.SiteRecovery.private\Add-AzSiteRecoveryReplicationProtectedItemDisk_Add'; + AddExpanded = 'Az.SiteRecovery.private\Add-AzSiteRecoveryReplicationProtectedItemDisk_AddExpanded'; + AddViaIdentity = 'Az.SiteRecovery.private\Add-AzSiteRecoveryReplicationProtectedItemDisk_AddViaIdentity'; + AddViaIdentityExpanded = 'Az.SiteRecovery.private\Add-AzSiteRecoveryReplicationProtectedItemDisk_AddViaIdentityExpanded'; + } + if (('Add', 'AddExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/Add-AzSiteRecoveryReplicationProtectedItemRecoveryPoint.ps1 b/swaggerci/recoveryservicessiterecovery/exports/Add-AzSiteRecoveryReplicationProtectedItemRecoveryPoint.ps1 new file mode 100644 index 000000000000..4373b09f35e8 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/Add-AzSiteRecoveryReplicationProtectedItemRecoveryPoint.ps1 @@ -0,0 +1,280 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to change the recovery point of a failed over replication protected item. +.Description +The operation to change the recovery point of a failed over replication protected item. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointInput +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +APPLYRECOVERYPOINTINPUT : Input to apply recovery point. + ProviderSpecificDetailInstanceType : The class type. + [RecoveryPointId ]: The recovery point Id. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/add-azsiterecoveryreplicationprotecteditemrecoverypoint +#> +function Add-AzSiteRecoveryReplicationProtectedItemRecoveryPoint { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem])] +[CmdletBinding(DefaultParameterSetName='ApplyExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Apply', Mandatory)] + [Parameter(ParameterSetName='ApplyExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The ARM fabric name. + ${FabricName}, + + [Parameter(ParameterSetName='Apply', Mandatory)] + [Parameter(ParameterSetName='ApplyExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The protection container name. + ${ProtectionContainerName}, + + [Parameter(ParameterSetName='Apply', Mandatory)] + [Parameter(ParameterSetName='ApplyExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The replicated protected item name. + ${ReplicatedProtectedItemName}, + + [Parameter(ParameterSetName='Apply', Mandatory)] + [Parameter(ParameterSetName='ApplyExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Apply', Mandatory)] + [Parameter(ParameterSetName='ApplyExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Apply')] + [Parameter(ParameterSetName='ApplyExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='ApplyViaIdentity', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='ApplyViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='Apply', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='ApplyViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointInput] + # Input to apply recovery point. + # To construct, see NOTES section for APPLYRECOVERYPOINTINPUT properties and create a hash table. + ${ApplyRecoveryPointInput}, + + [Parameter(ParameterSetName='ApplyExpanded', Mandatory)] + [Parameter(ParameterSetName='ApplyViaIdentityExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The class type. + ${ProviderSpecificDetailInstanceType}, + + [Parameter(ParameterSetName='ApplyExpanded')] + [Parameter(ParameterSetName='ApplyViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The recovery point Id. + ${RecoveryPointId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Apply = 'Az.SiteRecovery.private\Add-AzSiteRecoveryReplicationProtectedItemRecoveryPoint_Apply'; + ApplyExpanded = 'Az.SiteRecovery.private\Add-AzSiteRecoveryReplicationProtectedItemRecoveryPoint_ApplyExpanded'; + ApplyViaIdentity = 'Az.SiteRecovery.private\Add-AzSiteRecoveryReplicationProtectedItemRecoveryPoint_ApplyViaIdentity'; + ApplyViaIdentityExpanded = 'Az.SiteRecovery.private\Add-AzSiteRecoveryReplicationProtectedItemRecoveryPoint_ApplyViaIdentityExpanded'; + } + if (('Apply', 'ApplyExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/Clear-AzSiteRecoveryReplicationFabric.ps1 b/swaggerci/recoveryservicessiterecovery/exports/Clear-AzSiteRecoveryReplicationFabric.ps1 new file mode 100644 index 000000000000..9d537c323914 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/Clear-AzSiteRecoveryReplicationFabric.ps1 @@ -0,0 +1,237 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to purge(force delete) an Azure Site Recovery fabric. +.Description +The operation to purge(force delete) an Azure Site Recovery fabric. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +System.Boolean +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/clear-azsiterecoveryreplicationfabric +#> +function Clear-AzSiteRecoveryReplicationFabric { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Purge', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Purge', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # ASR fabric to purge. + ${FabricName}, + + [Parameter(ParameterSetName='Purge', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Purge', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Purge')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='PurgeViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Purge = 'Az.SiteRecovery.private\Clear-AzSiteRecoveryReplicationFabric_Purge'; + PurgeViaIdentity = 'Az.SiteRecovery.private\Clear-AzSiteRecoveryReplicationFabric_PurgeViaIdentity'; + } + if (('Purge') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/Clear-AzSiteRecoveryReplicationProtectedItem.ps1 b/swaggerci/recoveryservicessiterecovery/exports/Clear-AzSiteRecoveryReplicationProtectedItem.ps1 new file mode 100644 index 000000000000..b3bf6d967550 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/Clear-AzSiteRecoveryReplicationProtectedItem.ps1 @@ -0,0 +1,253 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +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. +.Description +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. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +System.Boolean +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/clear-azsiterecoveryreplicationprotecteditem +#> +function Clear-AzSiteRecoveryReplicationProtectedItem { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Purge', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Purge', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Fabric name. + ${FabricName}, + + [Parameter(ParameterSetName='Purge', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Protection container name. + ${ProtectionContainerName}, + + [Parameter(ParameterSetName='Purge', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Replication protected item name. + ${ReplicatedProtectedItemName}, + + [Parameter(ParameterSetName='Purge', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Purge', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Purge')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='PurgeViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Purge = 'Az.SiteRecovery.private\Clear-AzSiteRecoveryReplicationProtectedItem_Purge'; + PurgeViaIdentity = 'Az.SiteRecovery.private\Clear-AzSiteRecoveryReplicationProtectedItem_PurgeViaIdentity'; + } + if (('Purge') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/Clear-AzSiteRecoveryReplicationProtectionContainerMapping.ps1 b/swaggerci/recoveryservicessiterecovery/exports/Clear-AzSiteRecoveryReplicationProtectionContainerMapping.ps1 new file mode 100644 index 000000000000..a1b51c353f64 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/Clear-AzSiteRecoveryReplicationProtectionContainerMapping.ps1 @@ -0,0 +1,249 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to purge(force delete) a protection container mapping. +.Description +The operation to purge(force delete) a protection container mapping. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +System.Boolean +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/clear-azsiterecoveryreplicationprotectioncontainermapping +#> +function Clear-AzSiteRecoveryReplicationProtectionContainerMapping { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Purge', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Purge', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Fabric name. + ${FabricName}, + + [Parameter(ParameterSetName='Purge', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Protection container mapping name. + ${MappingName}, + + [Parameter(ParameterSetName='Purge', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Protection container name. + ${ProtectionContainerName}, + + [Parameter(ParameterSetName='Purge', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Purge', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Purge')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='PurgeViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Purge = 'Az.SiteRecovery.private\Clear-AzSiteRecoveryReplicationProtectionContainerMapping_Purge'; + PurgeViaIdentity = 'Az.SiteRecovery.private\Clear-AzSiteRecoveryReplicationProtectionContainerMapping_PurgeViaIdentity'; + } + if (('Purge') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/Clear-AzSiteRecoveryReplicationRecoveryServicesProvider.ps1 b/swaggerci/recoveryservicessiterecovery/exports/Clear-AzSiteRecoveryReplicationRecoveryServicesProvider.ps1 new file mode 100644 index 000000000000..01a49cc27abb --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/Clear-AzSiteRecoveryReplicationRecoveryServicesProvider.ps1 @@ -0,0 +1,243 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to purge(force delete) a recovery services provider from the vault. +.Description +The operation to purge(force delete) a recovery services provider from the vault. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +System.Boolean +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/clear-azsiterecoveryreplicationrecoveryservicesprovider +#> +function Clear-AzSiteRecoveryReplicationRecoveryServicesProvider { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Purge', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Purge', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Fabric name. + ${FabricName}, + + [Parameter(ParameterSetName='Purge', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Recovery services provider name. + ${ProviderName}, + + [Parameter(ParameterSetName='Purge', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Purge', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Purge')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='PurgeViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Purge = 'Az.SiteRecovery.private\Clear-AzSiteRecoveryReplicationRecoveryServicesProvider_Purge'; + PurgeViaIdentity = 'Az.SiteRecovery.private\Clear-AzSiteRecoveryReplicationRecoveryServicesProvider_PurgeViaIdentity'; + } + if (('Purge') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/Export-AzSiteRecoveryReplicationJob.ps1 b/swaggerci/recoveryservicessiterecovery/exports/Export-AzSiteRecoveryReplicationJob.ps1 new file mode 100644 index 000000000000..a153b63fbfce --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/Export-AzSiteRecoveryReplicationJob.ps1 @@ -0,0 +1,308 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to export the details of the Azure Site Recovery jobs of the vault. +.Description +The operation to export the details of the Azure Site Recovery jobs of the vault. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobQueryParameter +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJob +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. + +JOBQUERYPARAMETER : Query parameter to enumerate jobs. + [AffectedObjectType ]: The type of objects. + [EndTime ]: Date time to get jobs upto. + [FabricId ]: The Id of the fabric to search jobs under. + [JobName ]: The job Name. + [JobOutputType ]: The output type of the jobs. + [JobStatus ]: The states of the job to be filtered can be in. + [StartTime ]: Date time to get jobs from. + [TimezoneOffset ]: The timezone offset for the location of the request (in minutes). +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/export-azsiterecoveryreplicationjob +#> +function Export-AzSiteRecoveryReplicationJob { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJob])] +[CmdletBinding(DefaultParameterSetName='ExportExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Export', Mandatory)] + [Parameter(ParameterSetName='ExportExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Export', Mandatory)] + [Parameter(ParameterSetName='ExportExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Export')] + [Parameter(ParameterSetName='ExportExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='ExportViaIdentity', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='ExportViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='Export', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='ExportViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobQueryParameter] + # Query parameter to enumerate jobs. + # To construct, see NOTES section for JOBQUERYPARAMETER properties and create a hash table. + ${JobQueryParameter}, + + [Parameter(ParameterSetName='ExportExpanded')] + [Parameter(ParameterSetName='ExportViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The type of objects. + ${AffectedObjectType}, + + [Parameter(ParameterSetName='ExportExpanded')] + [Parameter(ParameterSetName='ExportViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # Date time to get jobs upto. + ${EndTime}, + + [Parameter(ParameterSetName='ExportExpanded')] + [Parameter(ParameterSetName='ExportViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The Id of the fabric to search jobs under. + ${FabricId}, + + [Parameter(ParameterSetName='ExportExpanded')] + [Parameter(ParameterSetName='ExportViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The job Name. + ${JobName}, + + [Parameter(ParameterSetName='ExportExpanded')] + [Parameter(ParameterSetName='ExportViaIdentityExpanded')] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ExportJobOutputSerializationType])] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ExportJobOutputSerializationType] + # The output type of the jobs. + ${JobOutputType}, + + [Parameter(ParameterSetName='ExportExpanded')] + [Parameter(ParameterSetName='ExportViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The states of the job to be filtered can be in. + ${JobStatus}, + + [Parameter(ParameterSetName='ExportExpanded')] + [Parameter(ParameterSetName='ExportViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # Date time to get jobs from. + ${StartTime}, + + [Parameter(ParameterSetName='ExportExpanded')] + [Parameter(ParameterSetName='ExportViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.Double] + # The timezone offset for the location of the request (in minutes). + ${TimezoneOffset}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Export = 'Az.SiteRecovery.private\Export-AzSiteRecoveryReplicationJob_Export'; + ExportExpanded = 'Az.SiteRecovery.private\Export-AzSiteRecoveryReplicationJob_ExportExpanded'; + ExportViaIdentity = 'Az.SiteRecovery.private\Export-AzSiteRecoveryReplicationJob_ExportViaIdentity'; + ExportViaIdentityExpanded = 'Az.SiteRecovery.private\Export-AzSiteRecoveryReplicationJob_ExportViaIdentityExpanded'; + } + if (('Export', 'ExportExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/Find-AzSiteRecoveryReplicationProtectionContainerProtectableItem.ps1 b/swaggerci/recoveryservicessiterecovery/exports/Find-AzSiteRecoveryReplicationProtectionContainerProtectableItem.ps1 new file mode 100644 index 000000000000..dd9560c13fcc --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/Find-AzSiteRecoveryReplicationProtectionContainerProtectableItem.ps1 @@ -0,0 +1,281 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to a add a protectable item to a protection container(Add physical server). +.Description +The operation to a add a protectable item to a protection container(Add physical server). +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiscoverProtectableItemRequest +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainer +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +DISCOVERPROTECTABLEITEMREQUEST : Request to add a physical machine as a protectable item in a container. + [FriendlyName ]: The friendly name of the physical machine. + [IPAddress ]: The IP address of the physical machine to be discovered. + [OSType ]: The OS type on the physical machine. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/find-azsiterecoveryreplicationprotectioncontainerprotectableitem +#> +function Find-AzSiteRecoveryReplicationProtectionContainerProtectableItem { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainer])] +[CmdletBinding(DefaultParameterSetName='DiscoverExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Discover', Mandatory)] + [Parameter(ParameterSetName='DiscoverExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the fabric. + ${FabricName}, + + [Parameter(ParameterSetName='Discover', Mandatory)] + [Parameter(ParameterSetName='DiscoverExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the protection container. + ${ProtectionContainerName}, + + [Parameter(ParameterSetName='Discover', Mandatory)] + [Parameter(ParameterSetName='DiscoverExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Discover', Mandatory)] + [Parameter(ParameterSetName='DiscoverExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Discover')] + [Parameter(ParameterSetName='DiscoverExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='DiscoverViaIdentity', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='DiscoverViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='Discover', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='DiscoverViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiscoverProtectableItemRequest] + # Request to add a physical machine as a protectable item in a container. + # To construct, see NOTES section for DISCOVERPROTECTABLEITEMREQUEST properties and create a hash table. + ${DiscoverProtectableItemRequest}, + + [Parameter(ParameterSetName='DiscoverExpanded')] + [Parameter(ParameterSetName='DiscoverViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The friendly name of the physical machine. + ${FriendlyName}, + + [Parameter(ParameterSetName='DiscoverExpanded')] + [Parameter(ParameterSetName='DiscoverViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The IP address of the physical machine to be discovered. + ${IPAddress}, + + [Parameter(ParameterSetName='DiscoverExpanded')] + [Parameter(ParameterSetName='DiscoverViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The OS type on the physical machine. + ${OSType}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Discover = 'Az.SiteRecovery.private\Find-AzSiteRecoveryReplicationProtectionContainerProtectableItem_Discover'; + DiscoverExpanded = 'Az.SiteRecovery.private\Find-AzSiteRecoveryReplicationProtectionContainerProtectableItem_DiscoverExpanded'; + DiscoverViaIdentity = 'Az.SiteRecovery.private\Find-AzSiteRecoveryReplicationProtectionContainerProtectableItem_DiscoverViaIdentity'; + DiscoverViaIdentityExpanded = 'Az.SiteRecovery.private\Find-AzSiteRecoveryReplicationProtectionContainerProtectableItem_DiscoverViaIdentityExpanded'; + } + if (('Discover', 'DiscoverExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/Get-AzSiteRecoveryMigrationRecoveryPoint.ps1 b/swaggerci/recoveryservicessiterecovery/exports/Get-AzSiteRecoveryMigrationRecoveryPoint.ps1 new file mode 100644 index 000000000000..9643e6994459 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/Get-AzSiteRecoveryMigrationRecoveryPoint.ps1 @@ -0,0 +1,245 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Gets a recovery point for a migration item. +.Description +Gets a recovery point for a migration item. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationRecoveryPoint +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/get-azsiterecoverymigrationrecoverypoint +#> +function Get-AzSiteRecoveryMigrationRecoveryPoint { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationRecoveryPoint])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Fabric unique name. + ${FabricName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Migration item name. + ${MigrationItemName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Alias('MigrationRecoveryPointName')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The migration recovery point name. + ${Name}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Protection container name. + ${ProtectionContainerName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Get = 'Az.SiteRecovery.private\Get-AzSiteRecoveryMigrationRecoveryPoint_Get'; + GetViaIdentity = 'Az.SiteRecovery.private\Get-AzSiteRecoveryMigrationRecoveryPoint_GetViaIdentity'; + List = 'Az.SiteRecovery.private\Get-AzSiteRecoveryMigrationRecoveryPoint_List'; + } + if (('Get', 'List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/Get-AzSiteRecoveryPoint.ps1 b/swaggerci/recoveryservicessiterecovery/exports/Get-AzSiteRecoveryPoint.ps1 new file mode 100644 index 000000000000..eee13700b6aa --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/Get-AzSiteRecoveryPoint.ps1 @@ -0,0 +1,245 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Get the details of specified recovery point. +.Description +Get the details of specified recovery point. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPoint +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/get-azsiterecoverypoint +#> +function Get-AzSiteRecoveryPoint { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPoint])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The fabric name. + ${FabricName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Alias('RecoveryPointName')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The recovery point name. + ${Name}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The protection container name. + ${ProtectionContainerName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The replication protected item name. + ${ReplicatedProtectedItemName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Get = 'Az.SiteRecovery.private\Get-AzSiteRecoveryPoint_Get'; + GetViaIdentity = 'Az.SiteRecovery.private\Get-AzSiteRecoveryPoint_GetViaIdentity'; + List = 'Az.SiteRecovery.private\Get-AzSiteRecoveryPoint_List'; + } + if (('Get', 'List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/Get-AzSiteRecoveryReplicationAlertSetting.ps1 b/swaggerci/recoveryservicessiterecovery/exports/Get-AzSiteRecoveryReplicationAlertSetting.ps1 new file mode 100644 index 000000000000..a0ce3f3cbc04 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/Get-AzSiteRecoveryReplicationAlertSetting.ps1 @@ -0,0 +1,223 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Gets the details of the specified email notification(alert) configuration. +.Description +Gets the details of the specified email notification(alert) configuration. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlert +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/get-azsiterecoveryreplicationalertsetting +#> +function Get-AzSiteRecoveryReplicationAlertSetting { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlert])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the email notification configuration. + ${AlertSettingName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Get = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationAlertSetting_Get'; + GetViaIdentity = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationAlertSetting_GetViaIdentity'; + List = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationAlertSetting_List'; + } + if (('Get', 'List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/Get-AzSiteRecoveryReplicationAppliance.ps1 b/swaggerci/recoveryservicessiterecovery/exports/Get-AzSiteRecoveryReplicationAppliance.ps1 new file mode 100644 index 000000000000..40c20d5c82a6 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/Get-AzSiteRecoveryReplicationAppliance.ps1 @@ -0,0 +1,176 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Gets the list of Azure Site Recovery appliances for the vault. +.Description +Gets the list of Azure Site Recovery appliances for the vault. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAppliance +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/get-azsiterecoveryreplicationappliance +#> +function Get-AzSiteRecoveryReplicationAppliance { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAppliance])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The subscription Id. + ${SubscriptionId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Query')] + [System.String] + # OData filter options. + ${Filter}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + List = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationAppliance_List'; + } + if (('List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/Get-AzSiteRecoveryReplicationEligibilityResult.ps1 b/swaggerci/recoveryservicessiterecovery/exports/Get-AzSiteRecoveryReplicationEligibilityResult.ps1 new file mode 100644 index 000000000000..14f554816621 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/Get-AzSiteRecoveryReplicationEligibilityResult.ps1 @@ -0,0 +1,217 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Validates whether a given VM can be protected or not in which case returns list of errors. +.Description +Validates whether a given VM can be protected or not in which case returns list of errors. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResults +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/get-azsiterecoveryreplicationeligibilityresult +#> +function Get-AzSiteRecoveryReplicationEligibilityResult { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResults])] +[CmdletBinding(DefaultParameterSetName='Get', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Virtual Machine name. + ${VirtualMachineName}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Get = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationEligibilityResult_Get'; + GetViaIdentity = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationEligibilityResult_GetViaIdentity'; + List = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationEligibilityResult_List'; + } + if (('Get', 'List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/Get-AzSiteRecoveryReplicationEvent.ps1 b/swaggerci/recoveryservicessiterecovery/exports/Get-AzSiteRecoveryReplicationEvent.ps1 new file mode 100644 index 000000000000..9fe230c54735 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/Get-AzSiteRecoveryReplicationEvent.ps1 @@ -0,0 +1,229 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to get the details of an Azure Site recovery event. +.Description +The operation to get the details of an Azure Site recovery event. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEvent +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/get-azsiterecoveryreplicationevent +#> +function Get-AzSiteRecoveryReplicationEvent { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEvent])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the Azure Site Recovery event. + ${EventName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Query')] + [System.String] + # OData filter options. + ${Filter}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Get = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationEvent_Get'; + GetViaIdentity = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationEvent_GetViaIdentity'; + List = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationEvent_List'; + } + if (('Get', 'List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/Get-AzSiteRecoveryReplicationFabric.ps1 b/swaggerci/recoveryservicessiterecovery/exports/Get-AzSiteRecoveryReplicationFabric.ps1 new file mode 100644 index 000000000000..afa6794ea956 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/Get-AzSiteRecoveryReplicationFabric.ps1 @@ -0,0 +1,230 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Gets the details of an Azure Site Recovery fabric. +.Description +Gets the details of an Azure Site Recovery fabric. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabric +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/get-azsiterecoveryreplicationfabric +#> +function Get-AzSiteRecoveryReplicationFabric { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabric])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Fabric name. + ${FabricName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='GetViaIdentity')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Query')] + [System.String] + # OData filter options. + ${Filter}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Get = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationFabric_Get'; + GetViaIdentity = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationFabric_GetViaIdentity'; + List = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationFabric_List'; + } + if (('Get', 'List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/Get-AzSiteRecoveryReplicationJob.ps1 b/swaggerci/recoveryservicessiterecovery/exports/Get-AzSiteRecoveryReplicationJob.ps1 new file mode 100644 index 000000000000..9254484759d8 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/Get-AzSiteRecoveryReplicationJob.ps1 @@ -0,0 +1,229 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Get the details of an Azure Site Recovery job. +.Description +Get the details of an Azure Site Recovery job. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJob +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/get-azsiterecoveryreplicationjob +#> +function Get-AzSiteRecoveryReplicationJob { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJob])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Job identifier. + ${JobName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Query')] + [System.String] + # OData filter options. + ${Filter}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Get = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationJob_Get'; + GetViaIdentity = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationJob_GetViaIdentity'; + List = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationJob_List'; + } + if (('Get', 'List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/Get-AzSiteRecoveryReplicationLogicalNetwork.ps1 b/swaggerci/recoveryservicessiterecovery/exports/Get-AzSiteRecoveryReplicationLogicalNetwork.ps1 new file mode 100644 index 000000000000..c172ee424fc8 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/Get-AzSiteRecoveryReplicationLogicalNetwork.ps1 @@ -0,0 +1,230 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Gets the details of a logical network. +.Description +Gets the details of a logical network. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetwork +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/get-azsiterecoveryreplicationlogicalnetwork +#> +function Get-AzSiteRecoveryReplicationLogicalNetwork { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetwork])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Server Id. + ${FabricName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Logical network name. + ${LogicalNetworkName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Get = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationLogicalNetwork_Get'; + GetViaIdentity = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationLogicalNetwork_GetViaIdentity'; + List = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationLogicalNetwork_List'; + } + if (('Get', 'List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/Get-AzSiteRecoveryReplicationMigrationItem.ps1 b/swaggerci/recoveryservicessiterecovery/exports/Get-AzSiteRecoveryReplicationMigrationItem.ps1 new file mode 100644 index 000000000000..8ad7d361714d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/Get-AzSiteRecoveryReplicationMigrationItem.ps1 @@ -0,0 +1,262 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Gets the details of a migration item. +.Description +Gets the details of a migration item. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/get-azsiterecoveryreplicationmigrationitem +#> +function Get-AzSiteRecoveryReplicationMigrationItem { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem])] +[CmdletBinding(DefaultParameterSetName='List1', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Fabric unique name. + ${FabricName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Migration item name. + ${MigrationItemName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Protection container name. + ${ProtectionContainerName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Parameter(ParameterSetName='List1', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Parameter(ParameterSetName='List1', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Parameter(ParameterSetName='List1')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='List')] + [Parameter(ParameterSetName='List1')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Query')] + [System.String] + # OData filter options. + ${Filter}, + + [Parameter(ParameterSetName='List')] + [Parameter(ParameterSetName='List1')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Query')] + [System.String] + # The pagination token. + ${SkipToken}, + + [Parameter(ParameterSetName='List')] + [Parameter(ParameterSetName='List1')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Query')] + [System.String] + # The page size. + ${TakeToken}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Get = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationMigrationItem_Get'; + GetViaIdentity = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationMigrationItem_GetViaIdentity'; + List = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationMigrationItem_List'; + List1 = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationMigrationItem_List1'; + } + if (('Get', 'List', 'List1') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/Get-AzSiteRecoveryReplicationNetwork.ps1 b/swaggerci/recoveryservicessiterecovery/exports/Get-AzSiteRecoveryReplicationNetwork.ps1 new file mode 100644 index 000000000000..93f08eaf3c0b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/Get-AzSiteRecoveryReplicationNetwork.ps1 @@ -0,0 +1,234 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Gets the details of a network. +.Description +Gets the details of a network. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetwork +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/get-azsiterecoveryreplicationnetwork +#> +function Get-AzSiteRecoveryReplicationNetwork { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetwork])] +[CmdletBinding(DefaultParameterSetName='List1', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Server Id. + ${FabricName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Primary network name. + ${NetworkName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Parameter(ParameterSetName='List1', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Parameter(ParameterSetName='List1', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Parameter(ParameterSetName='List1')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Get = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationNetwork_Get'; + GetViaIdentity = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationNetwork_GetViaIdentity'; + List = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationNetwork_List'; + List1 = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationNetwork_List1'; + } + if (('Get', 'List', 'List1') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/Get-AzSiteRecoveryReplicationNetworkMapping.ps1 b/swaggerci/recoveryservicessiterecovery/exports/Get-AzSiteRecoveryReplicationNetworkMapping.ps1 new file mode 100644 index 000000000000..31ea802632c6 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/Get-AzSiteRecoveryReplicationNetworkMapping.ps1 @@ -0,0 +1,241 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Gets the details of an ASR network mapping. +.Description +Gets the details of an ASR network mapping. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMapping +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/get-azsiterecoveryreplicationnetworkmapping +#> +function Get-AzSiteRecoveryReplicationNetworkMapping { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMapping])] +[CmdletBinding(DefaultParameterSetName='List1', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Primary fabric name. + ${FabricName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Network mapping name. + ${NetworkMappingName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Primary network name. + ${NetworkName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Parameter(ParameterSetName='List1', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Parameter(ParameterSetName='List1', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Parameter(ParameterSetName='List1')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Get = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationNetworkMapping_Get'; + GetViaIdentity = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationNetworkMapping_GetViaIdentity'; + List = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationNetworkMapping_List'; + List1 = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationNetworkMapping_List1'; + } + if (('Get', 'List', 'List1') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/Get-AzSiteRecoveryReplicationPolicy.ps1 b/swaggerci/recoveryservicessiterecovery/exports/Get-AzSiteRecoveryReplicationPolicy.ps1 new file mode 100644 index 000000000000..7424c35d2ced --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/Get-AzSiteRecoveryReplicationPolicy.ps1 @@ -0,0 +1,223 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Gets the details of a replication policy. +.Description +Gets the details of a replication policy. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicy +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/get-azsiterecoveryreplicationpolicy +#> +function Get-AzSiteRecoveryReplicationPolicy { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicy])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Replication policy name. + ${PolicyName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Get = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationPolicy_Get'; + GetViaIdentity = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationPolicy_GetViaIdentity'; + List = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationPolicy_List'; + } + if (('Get', 'List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/Get-AzSiteRecoveryReplicationProtectableItem.ps1 b/swaggerci/recoveryservicessiterecovery/exports/Get-AzSiteRecoveryReplicationProtectableItem.ps1 new file mode 100644 index 000000000000..11803964fa56 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/Get-AzSiteRecoveryReplicationProtectableItem.ps1 @@ -0,0 +1,255 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to get the details of a protectable item. +.Description +The operation to get the details of a protectable item. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItem +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/get-azsiterecoveryreplicationprotectableitem +#> +function Get-AzSiteRecoveryReplicationProtectableItem { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItem])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Fabric name. + ${FabricName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Protectable item name. + ${ProtectableItemName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Protection container name. + ${ProtectionContainerName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Query')] + [System.String] + # OData filter options. + ${Filter}, + + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Query')] + [System.String] + # skipToken OData query parameter. + ${SkipToken}, + + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Query')] + [System.String] + # take OData query parameter. + ${Take}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Get = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationProtectableItem_Get'; + GetViaIdentity = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationProtectableItem_GetViaIdentity'; + List = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationProtectableItem_List'; + } + if (('Get', 'List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/Get-AzSiteRecoveryReplicationProtectedItem.ps1 b/swaggerci/recoveryservicessiterecovery/exports/Get-AzSiteRecoveryReplicationProtectedItem.ps1 new file mode 100644 index 000000000000..e60daaf404af --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/Get-AzSiteRecoveryReplicationProtectedItem.ps1 @@ -0,0 +1,254 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Gets the details of an ASR replication protected item. +.Description +Gets the details of an ASR replication protected item. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/get-azsiterecoveryreplicationprotecteditem +#> +function Get-AzSiteRecoveryReplicationProtectedItem { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem])] +[CmdletBinding(DefaultParameterSetName='List1', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Fabric unique name. + ${FabricName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Protection container name. + ${ProtectionContainerName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Replication protected item name. + ${ReplicatedProtectedItemName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Parameter(ParameterSetName='List1', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Parameter(ParameterSetName='List1', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Parameter(ParameterSetName='List1')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='List1')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Query')] + [System.String] + # OData filter options. + ${Filter}, + + [Parameter(ParameterSetName='List1')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Query')] + [System.String] + # The pagination token. + # Possible values: "FabricId" or "FabricId_CloudId" or null. + ${SkipToken}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Get = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationProtectedItem_Get'; + GetViaIdentity = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationProtectedItem_GetViaIdentity'; + List = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationProtectedItem_List'; + List1 = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationProtectedItem_List1'; + } + if (('Get', 'List', 'List1') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/Get-AzSiteRecoveryReplicationProtectionContainer.ps1 b/swaggerci/recoveryservicessiterecovery/exports/Get-AzSiteRecoveryReplicationProtectionContainer.ps1 new file mode 100644 index 000000000000..34e16d87e55c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/Get-AzSiteRecoveryReplicationProtectionContainer.ps1 @@ -0,0 +1,234 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Gets the details of a protection container. +.Description +Gets the details of a protection container. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainer +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/get-azsiterecoveryreplicationprotectioncontainer +#> +function Get-AzSiteRecoveryReplicationProtectionContainer { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainer])] +[CmdletBinding(DefaultParameterSetName='List1', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Fabric name. + ${FabricName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Protection container name. + ${ProtectionContainerName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Parameter(ParameterSetName='List1', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Parameter(ParameterSetName='List1', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Parameter(ParameterSetName='List1')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Get = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationProtectionContainer_Get'; + GetViaIdentity = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationProtectionContainer_GetViaIdentity'; + List = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationProtectionContainer_List'; + List1 = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationProtectionContainer_List1'; + } + if (('Get', 'List', 'List1') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/Get-AzSiteRecoveryReplicationProtectionContainerMapping.ps1 b/swaggerci/recoveryservicessiterecovery/exports/Get-AzSiteRecoveryReplicationProtectionContainerMapping.ps1 new file mode 100644 index 000000000000..6676ebc0edb0 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/Get-AzSiteRecoveryReplicationProtectionContainerMapping.ps1 @@ -0,0 +1,241 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Gets the details of a protection container mapping. +.Description +Gets the details of a protection container mapping. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMapping +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/get-azsiterecoveryreplicationprotectioncontainermapping +#> +function Get-AzSiteRecoveryReplicationProtectionContainerMapping { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMapping])] +[CmdletBinding(DefaultParameterSetName='List1', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Fabric name. + ${FabricName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Protection Container mapping name. + ${MappingName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Protection container name. + ${ProtectionContainerName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Parameter(ParameterSetName='List1', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Parameter(ParameterSetName='List1', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Parameter(ParameterSetName='List1')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Get = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationProtectionContainerMapping_Get'; + GetViaIdentity = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationProtectionContainerMapping_GetViaIdentity'; + List = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationProtectionContainerMapping_List'; + List1 = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationProtectionContainerMapping_List1'; + } + if (('Get', 'List', 'List1') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/Get-AzSiteRecoveryReplicationProtectionIntent.ps1 b/swaggerci/recoveryservicessiterecovery/exports/Get-AzSiteRecoveryReplicationProtectionIntent.ps1 new file mode 100644 index 000000000000..a64ece5da6bf --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/Get-AzSiteRecoveryReplicationProtectionIntent.ps1 @@ -0,0 +1,235 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Gets the details of an ASR replication protection intent. +.Description +Gets the details of an ASR replication protection intent. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntent +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/get-azsiterecoveryreplicationprotectionintent +#> +function Get-AzSiteRecoveryReplicationProtectionIntent { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntent])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Replication protection intent name. + ${IntentObjectName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Query')] + [System.String] + # The pagination token. + ${SkipToken}, + + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Query')] + [System.String] + # The page size. + ${TakeToken}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Get = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationProtectionIntent_Get'; + GetViaIdentity = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationProtectionIntent_GetViaIdentity'; + List = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationProtectionIntent_List'; + } + if (('Get', 'List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/Get-AzSiteRecoveryReplicationRecoveryPlan.ps1 b/swaggerci/recoveryservicessiterecovery/exports/Get-AzSiteRecoveryReplicationRecoveryPlan.ps1 new file mode 100644 index 000000000000..66821ba12ef7 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/Get-AzSiteRecoveryReplicationRecoveryPlan.ps1 @@ -0,0 +1,223 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Gets the details of the recovery plan. +.Description +Gets the details of the recovery plan. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/get-azsiterecoveryreplicationrecoveryplan +#> +function Get-AzSiteRecoveryReplicationRecoveryPlan { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Name of the recovery plan. + ${RecoveryPlanName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Get = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationRecoveryPlan_Get'; + GetViaIdentity = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationRecoveryPlan_GetViaIdentity'; + List = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationRecoveryPlan_List'; + } + if (('Get', 'List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/Get-AzSiteRecoveryReplicationRecoveryServiceProvider.ps1 b/swaggerci/recoveryservicessiterecovery/exports/Get-AzSiteRecoveryReplicationRecoveryServiceProvider.ps1 new file mode 100644 index 000000000000..8cb6a90683bf --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/Get-AzSiteRecoveryReplicationRecoveryServiceProvider.ps1 @@ -0,0 +1,176 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Lists the registered recovery services providers for the specified fabric. +.Description +Lists the registered recovery services providers for the specified fabric. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProvider +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/get-azsiterecoveryreplicationrecoveryserviceprovider +#> +function Get-AzSiteRecoveryReplicationRecoveryServiceProvider { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProvider])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Fabric name. + ${FabricName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The subscription Id. + ${SubscriptionId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + List = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationRecoveryServiceProvider_List'; + } + if (('List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/Get-AzSiteRecoveryReplicationRecoveryServicesProvider.ps1 b/swaggerci/recoveryservicessiterecovery/exports/Get-AzSiteRecoveryReplicationRecoveryServicesProvider.ps1 new file mode 100644 index 000000000000..105762c85e5d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/Get-AzSiteRecoveryReplicationRecoveryServicesProvider.ps1 @@ -0,0 +1,229 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Gets the details of registered recovery services provider. +.Description +Gets the details of registered recovery services provider. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProvider +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/get-azsiterecoveryreplicationrecoveryservicesprovider +#> +function Get-AzSiteRecoveryReplicationRecoveryServicesProvider { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProvider])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Fabric name. + ${FabricName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Recovery services provider name. + ${ProviderName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Get = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationRecoveryServicesProvider_Get'; + GetViaIdentity = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationRecoveryServicesProvider_GetViaIdentity'; + List = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationRecoveryServicesProvider_List'; + } + if (('Get', 'List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/Get-AzSiteRecoveryReplicationStorageClassification.ps1 b/swaggerci/recoveryservicessiterecovery/exports/Get-AzSiteRecoveryReplicationStorageClassification.ps1 new file mode 100644 index 000000000000..43ac20ba8bfe --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/Get-AzSiteRecoveryReplicationStorageClassification.ps1 @@ -0,0 +1,234 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Gets the details of the specified storage classification. +.Description +Gets the details of the specified storage classification. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassification +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/get-azsiterecoveryreplicationstorageclassification +#> +function Get-AzSiteRecoveryReplicationStorageClassification { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassification])] +[CmdletBinding(DefaultParameterSetName='List1', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Fabric name. + ${FabricName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Parameter(ParameterSetName='List1', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Parameter(ParameterSetName='List1', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Storage classification name. + ${StorageClassificationName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Parameter(ParameterSetName='List1')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Get = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationStorageClassification_Get'; + GetViaIdentity = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationStorageClassification_GetViaIdentity'; + List = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationStorageClassification_List'; + List1 = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationStorageClassification_List1'; + } + if (('Get', 'List', 'List1') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/Get-AzSiteRecoveryReplicationStorageClassificationMapping.ps1 b/swaggerci/recoveryservicessiterecovery/exports/Get-AzSiteRecoveryReplicationStorageClassificationMapping.ps1 new file mode 100644 index 000000000000..d8f8c8a31405 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/Get-AzSiteRecoveryReplicationStorageClassificationMapping.ps1 @@ -0,0 +1,241 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Gets the details of the specified storage classification mapping. +.Description +Gets the details of the specified storage classification mapping. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMapping +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/get-azsiterecoveryreplicationstorageclassificationmapping +#> +function Get-AzSiteRecoveryReplicationStorageClassificationMapping { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMapping])] +[CmdletBinding(DefaultParameterSetName='List1', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Fabric name. + ${FabricName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Parameter(ParameterSetName='List1', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Parameter(ParameterSetName='List1', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Storage classification mapping name. + ${StorageClassificationMappingName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Storage classification name. + ${StorageClassificationName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Parameter(ParameterSetName='List1')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Get = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationStorageClassificationMapping_Get'; + GetViaIdentity = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationStorageClassificationMapping_GetViaIdentity'; + List = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationStorageClassificationMapping_List'; + List1 = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationStorageClassificationMapping_List1'; + } + if (('Get', 'List', 'List1') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/Get-AzSiteRecoveryReplicationVaultHealth.ps1 b/swaggerci/recoveryservicessiterecovery/exports/Get-AzSiteRecoveryReplicationVaultHealth.ps1 new file mode 100644 index 000000000000..f46e089c6e1d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/Get-AzSiteRecoveryReplicationVaultHealth.ps1 @@ -0,0 +1,213 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Gets the health details of the vault. +.Description +Gets the health details of the vault. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthDetails +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/get-azsiterecoveryreplicationvaulthealth +#> +function Get-AzSiteRecoveryReplicationVaultHealth { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthDetails])] +[CmdletBinding(DefaultParameterSetName='Get', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Get')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Get = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationVaultHealth_Get'; + GetViaIdentity = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationVaultHealth_GetViaIdentity'; + } + if (('Get') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/Get-AzSiteRecoveryReplicationVaultSetting.ps1 b/swaggerci/recoveryservicessiterecovery/exports/Get-AzSiteRecoveryReplicationVaultSetting.ps1 new file mode 100644 index 000000000000..211e9ede674b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/Get-AzSiteRecoveryReplicationVaultSetting.ps1 @@ -0,0 +1,225 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Gets the vault setting. +This includes the Migration Hub connection settings. +.Description +Gets the vault setting. +This includes the Migration Hub connection settings. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSetting +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/get-azsiterecoveryreplicationvaultsetting +#> +function Get-AzSiteRecoveryReplicationVaultSetting { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSetting])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Vault setting name. + ${VaultSettingName}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Get = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationVaultSetting_Get'; + GetViaIdentity = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationVaultSetting_GetViaIdentity'; + List = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationVaultSetting_List'; + } + if (('Get', 'List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/Get-AzSiteRecoveryReplicationvCenter.ps1 b/swaggerci/recoveryservicessiterecovery/exports/Get-AzSiteRecoveryReplicationvCenter.ps1 new file mode 100644 index 000000000000..04a0612b7721 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/Get-AzSiteRecoveryReplicationvCenter.ps1 @@ -0,0 +1,234 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Gets the details of a registered vCenter server(Add vCenter server). +.Description +Gets the details of a registered vCenter server(Add vCenter server). +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenter +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/get-azsiterecoveryreplicationvcenter +#> +function Get-AzSiteRecoveryReplicationvCenter { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenter])] +[CmdletBinding(DefaultParameterSetName='List1', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Fabric name. + ${FabricName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Parameter(ParameterSetName='List1', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Parameter(ParameterSetName='List1', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Parameter(ParameterSetName='List1')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # vcenter name. + ${VcenterName}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Get = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationvCenter_Get'; + GetViaIdentity = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationvCenter_GetViaIdentity'; + List = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationvCenter_List'; + List1 = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationvCenter_List1'; + } + if (('Get', 'List', 'List1') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/Get-AzSiteRecoverySupportedOperatingSystem.ps1 b/swaggerci/recoveryservicessiterecovery/exports/Get-AzSiteRecoverySupportedOperatingSystem.ps1 new file mode 100644 index 000000000000..077a67f15aa8 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/Get-AzSiteRecoverySupportedOperatingSystem.ps1 @@ -0,0 +1,219 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Gets the data of supported operating systems by SRS. +.Description +Gets the data of supported operating systems by SRS. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOperatingSystems +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/get-azsiterecoverysupportedoperatingsystem +#> +function Get-AzSiteRecoverySupportedOperatingSystem { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOperatingSystems])] +[CmdletBinding(DefaultParameterSetName='Get', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Get')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Query')] + [System.String] + # The instance type. + ${InstanceType}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Get = 'Az.SiteRecovery.private\Get-AzSiteRecoverySupportedOperatingSystem_Get'; + GetViaIdentity = 'Az.SiteRecovery.private\Get-AzSiteRecoverySupportedOperatingSystem_GetViaIdentity'; + } + if (('Get') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/Get-AzSiteRecoveryTargetComputeSize.ps1 b/swaggerci/recoveryservicessiterecovery/exports/Get-AzSiteRecoveryTargetComputeSize.ps1 new file mode 100644 index 000000000000..8e4737084fb3 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/Get-AzSiteRecoveryTargetComputeSize.ps1 @@ -0,0 +1,188 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Lists the available target compute sizes for a replication protected item. +.Description +Lists the available target compute sizes for a replication protected item. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSize +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/get-azsiterecoverytargetcomputesize +#> +function Get-AzSiteRecoveryTargetComputeSize { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSize])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Fabric name. + ${FabricName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # protection container name. + ${ProtectionContainerName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Replication protected item name. + ${ReplicatedProtectedItemName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The subscription Id. + ${SubscriptionId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + List = 'Az.SiteRecovery.private\Get-AzSiteRecoveryTargetComputeSize_List'; + } + if (('List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/Invoke-AzSiteRecoveryCommitReplicationProtectedItemFailover.ps1 b/swaggerci/recoveryservicessiterecovery/exports/Invoke-AzSiteRecoveryCommitReplicationProtectedItemFailover.ps1 new file mode 100644 index 000000000000..aa1f90db8a4e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/Invoke-AzSiteRecoveryCommitReplicationProtectedItemFailover.ps1 @@ -0,0 +1,243 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Operation to commit the failover of the replication protected item. +.Description +Operation to commit the failover of the replication protected item. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/invoke-azsiterecoverycommitreplicationprotecteditemfailover +#> +function Invoke-AzSiteRecoveryCommitReplicationProtectedItemFailover { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem])] +[CmdletBinding(DefaultParameterSetName='Commit', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Commit', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Unique fabric name. + ${FabricName}, + + [Parameter(ParameterSetName='Commit', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Protection container name. + ${ProtectionContainerName}, + + [Parameter(ParameterSetName='Commit', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Replication protected item name. + ${ReplicatedProtectedItemName}, + + [Parameter(ParameterSetName='Commit', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Commit', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Commit')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='CommitViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Commit = 'Az.SiteRecovery.private\Invoke-AzSiteRecoveryCommitReplicationProtectedItemFailover_Commit'; + CommitViaIdentity = 'Az.SiteRecovery.private\Invoke-AzSiteRecoveryCommitReplicationProtectedItemFailover_CommitViaIdentity'; + } + if (('Commit') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/Invoke-AzSiteRecoveryCommitReplicationRecoveryPlanFailover.ps1 b/swaggerci/recoveryservicessiterecovery/exports/Invoke-AzSiteRecoveryCommitReplicationRecoveryPlanFailover.ps1 new file mode 100644 index 000000000000..37ae7a71261a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/Invoke-AzSiteRecoveryCommitReplicationRecoveryPlanFailover.ps1 @@ -0,0 +1,231 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to commit the failover of a recovery plan. +.Description +The operation to commit the failover of a recovery plan. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/invoke-azsiterecoverycommitreplicationrecoveryplanfailover +#> +function Invoke-AzSiteRecoveryCommitReplicationRecoveryPlanFailover { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan])] +[CmdletBinding(DefaultParameterSetName='Commit', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Commit', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Recovery plan name. + ${RecoveryPlanName}, + + [Parameter(ParameterSetName='Commit', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Commit', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Commit')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='CommitViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Commit = 'Az.SiteRecovery.private\Invoke-AzSiteRecoveryCommitReplicationRecoveryPlanFailover_Commit'; + CommitViaIdentity = 'Az.SiteRecovery.private\Invoke-AzSiteRecoveryCommitReplicationRecoveryPlanFailover_CommitViaIdentity'; + } + if (('Commit') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/Invoke-AzSiteRecoveryPlannedReplicationProtectedItemFailover.ps1 b/swaggerci/recoveryservicessiterecovery/exports/Invoke-AzSiteRecoveryPlannedReplicationProtectedItemFailover.ps1 new file mode 100644 index 000000000000..35f0f5bb3af9 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/Invoke-AzSiteRecoveryPlannedReplicationProtectedItemFailover.ps1 @@ -0,0 +1,280 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Operation to initiate a planned failover of the replication protected item. +.Description +Operation to initiate a planned failover of the replication protected item. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverInput +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +FAILOVERINPUT : Input definition for planned failover. + [FailoverDirection ]: Failover direction. + [ProviderSpecificDetailInstanceType ]: The class type. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/invoke-azsiterecoveryplannedreplicationprotecteditemfailover +#> +function Invoke-AzSiteRecoveryPlannedReplicationProtectedItemFailover { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem])] +[CmdletBinding(DefaultParameterSetName='PlannedExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Planned', Mandatory)] + [Parameter(ParameterSetName='PlannedExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Unique fabric name. + ${FabricName}, + + [Parameter(ParameterSetName='Planned', Mandatory)] + [Parameter(ParameterSetName='PlannedExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Protection container name. + ${ProtectionContainerName}, + + [Parameter(ParameterSetName='Planned', Mandatory)] + [Parameter(ParameterSetName='PlannedExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Replication protected item name. + ${ReplicatedProtectedItemName}, + + [Parameter(ParameterSetName='Planned', Mandatory)] + [Parameter(ParameterSetName='PlannedExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Planned', Mandatory)] + [Parameter(ParameterSetName='PlannedExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Planned')] + [Parameter(ParameterSetName='PlannedExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='PlannedViaIdentity', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='PlannedViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='Planned', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='PlannedViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverInput] + # Input definition for planned failover. + # To construct, see NOTES section for FAILOVERINPUT properties and create a hash table. + ${FailoverInput}, + + [Parameter(ParameterSetName='PlannedExpanded')] + [Parameter(ParameterSetName='PlannedViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # Failover direction. + ${FailoverDirection}, + + [Parameter(ParameterSetName='PlannedExpanded')] + [Parameter(ParameterSetName='PlannedViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The class type. + ${ProviderSpecificDetailInstanceType}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Planned = 'Az.SiteRecovery.private\Invoke-AzSiteRecoveryPlannedReplicationProtectedItemFailover_Planned'; + PlannedExpanded = 'Az.SiteRecovery.private\Invoke-AzSiteRecoveryPlannedReplicationProtectedItemFailover_PlannedExpanded'; + PlannedViaIdentity = 'Az.SiteRecovery.private\Invoke-AzSiteRecoveryPlannedReplicationProtectedItemFailover_PlannedViaIdentity'; + PlannedViaIdentityExpanded = 'Az.SiteRecovery.private\Invoke-AzSiteRecoveryPlannedReplicationProtectedItemFailover_PlannedViaIdentityExpanded'; + } + if (('Planned', 'PlannedExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/Invoke-AzSiteRecoveryPlannedReplicationRecoveryPlanFailover.ps1 b/swaggerci/recoveryservicessiterecovery/exports/Invoke-AzSiteRecoveryPlannedReplicationRecoveryPlanFailover.ps1 new file mode 100644 index 000000000000..6fedf77241f2 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/Invoke-AzSiteRecoveryPlannedReplicationRecoveryPlanFailover.ps1 @@ -0,0 +1,273 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to start the planned failover of a recovery plan. +.Description +The operation to start the planned failover of a recovery plan. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPlannedFailoverInput +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUT : Recovery plan planned failover input. + FailoverDirection : The failover direction. + [ProviderSpecificDetail ]: The provider specific properties. + InstanceType : The class type. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. + +PROVIDERSPECIFICDETAIL : The provider specific properties. + InstanceType : The class type. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/invoke-azsiterecoveryplannedreplicationrecoveryplanfailover +#> +function Invoke-AzSiteRecoveryPlannedReplicationRecoveryPlanFailover { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan])] +[CmdletBinding(DefaultParameterSetName='PlannedExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Planned', Mandatory)] + [Parameter(ParameterSetName='PlannedExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Recovery plan name. + ${RecoveryPlanName}, + + [Parameter(ParameterSetName='Planned', Mandatory)] + [Parameter(ParameterSetName='PlannedExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Planned', Mandatory)] + [Parameter(ParameterSetName='PlannedExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Planned')] + [Parameter(ParameterSetName='PlannedExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='PlannedViaIdentity', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='PlannedViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='Planned', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='PlannedViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPlannedFailoverInput] + # Recovery plan planned failover input. + # To construct, see NOTES section for INPUT properties and create a hash table. + ${Input}, + + [Parameter(ParameterSetName='PlannedExpanded', Mandatory)] + [Parameter(ParameterSetName='PlannedViaIdentityExpanded', Mandatory)] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections])] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections] + # The failover direction. + ${FailoverDirection}, + + [Parameter(ParameterSetName='PlannedExpanded')] + [Parameter(ParameterSetName='PlannedViaIdentityExpanded')] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInput[]] + # The provider specific properties. + # To construct, see NOTES section for PROVIDERSPECIFICDETAIL properties and create a hash table. + ${ProviderSpecificDetail}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Planned = 'Az.SiteRecovery.private\Invoke-AzSiteRecoveryPlannedReplicationRecoveryPlanFailover_Planned'; + PlannedExpanded = 'Az.SiteRecovery.private\Invoke-AzSiteRecoveryPlannedReplicationRecoveryPlanFailover_PlannedExpanded'; + PlannedViaIdentity = 'Az.SiteRecovery.private\Invoke-AzSiteRecoveryPlannedReplicationRecoveryPlanFailover_PlannedViaIdentity'; + PlannedViaIdentityExpanded = 'Az.SiteRecovery.private\Invoke-AzSiteRecoveryPlannedReplicationRecoveryPlanFailover_PlannedViaIdentityExpanded'; + } + if (('Planned', 'PlannedExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/Invoke-AzSiteRecoveryRenewReplicationFabricCertificate.ps1 b/swaggerci/recoveryservicessiterecovery/exports/Invoke-AzSiteRecoveryRenewReplicationFabricCertificate.ps1 new file mode 100644 index 000000000000..97ca65a3592f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/Invoke-AzSiteRecoveryRenewReplicationFabricCertificate.ps1 @@ -0,0 +1,258 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Renews the connection certificate for the ASR replication fabric. +.Description +Renews the connection certificate for the ASR replication fabric. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRenewCertificateInput +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabric +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. + +RENEWCERTIFICATE : Certificate renewal input. + [RenewCertificateType ]: Renew certificate type. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/invoke-azsiterecoveryrenewreplicationfabriccertificate +#> +function Invoke-AzSiteRecoveryRenewReplicationFabricCertificate { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabric])] +[CmdletBinding(DefaultParameterSetName='RenewExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Renew', Mandatory)] + [Parameter(ParameterSetName='RenewExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # fabric name to renew certs for. + ${FabricName}, + + [Parameter(ParameterSetName='Renew', Mandatory)] + [Parameter(ParameterSetName='RenewExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Renew', Mandatory)] + [Parameter(ParameterSetName='RenewExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Renew')] + [Parameter(ParameterSetName='RenewExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='RenewViaIdentity', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='RenewViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='Renew', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='RenewViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRenewCertificateInput] + # Certificate renewal input. + # To construct, see NOTES section for RENEWCERTIFICATE properties and create a hash table. + ${RenewCertificate}, + + [Parameter(ParameterSetName='RenewExpanded')] + [Parameter(ParameterSetName='RenewViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # Renew certificate type. + ${RenewCertificateType}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Renew = 'Az.SiteRecovery.private\Invoke-AzSiteRecoveryRenewReplicationFabricCertificate_Renew'; + RenewExpanded = 'Az.SiteRecovery.private\Invoke-AzSiteRecoveryRenewReplicationFabricCertificate_RenewExpanded'; + RenewViaIdentity = 'Az.SiteRecovery.private\Invoke-AzSiteRecoveryRenewReplicationFabricCertificate_RenewViaIdentity'; + RenewViaIdentityExpanded = 'Az.SiteRecovery.private\Invoke-AzSiteRecoveryRenewReplicationFabricCertificate_RenewViaIdentityExpanded'; + } + if (('Renew', 'RenewExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/Invoke-AzSiteRecoveryReprotectReplicationProtectedItem.ps1 b/swaggerci/recoveryservicessiterecovery/exports/Invoke-AzSiteRecoveryReprotectReplicationProtectedItem.ps1 new file mode 100644 index 000000000000..4981279ef447 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/Invoke-AzSiteRecoveryReprotectReplicationProtectedItem.ps1 @@ -0,0 +1,280 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Operation to reprotect or reverse replicate a failed over replication protected item. +.Description +Operation to reprotect or reverse replicate a failed over replication protected item. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationInput +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. + +REPROTECTINPUT : Reverse replication input. + [FailoverDirection ]: Failover direction. + [ProviderSpecificDetailInstanceType ]: The class type. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/invoke-azsiterecoveryreprotectreplicationprotecteditem +#> +function Invoke-AzSiteRecoveryReprotectReplicationProtectedItem { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem])] +[CmdletBinding(DefaultParameterSetName='ReprotectExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Reprotect', Mandatory)] + [Parameter(ParameterSetName='ReprotectExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Unique fabric name. + ${FabricName}, + + [Parameter(ParameterSetName='Reprotect', Mandatory)] + [Parameter(ParameterSetName='ReprotectExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Protection container name. + ${ProtectionContainerName}, + + [Parameter(ParameterSetName='Reprotect', Mandatory)] + [Parameter(ParameterSetName='ReprotectExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Replication protected item name. + ${ReplicatedProtectedItemName}, + + [Parameter(ParameterSetName='Reprotect', Mandatory)] + [Parameter(ParameterSetName='ReprotectExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Reprotect', Mandatory)] + [Parameter(ParameterSetName='ReprotectExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Reprotect')] + [Parameter(ParameterSetName='ReprotectExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='ReprotectViaIdentity', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='ReprotectViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='Reprotect', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='ReprotectViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationInput] + # Reverse replication input. + # To construct, see NOTES section for REPROTECTINPUT properties and create a hash table. + ${ReprotectInput}, + + [Parameter(ParameterSetName='ReprotectExpanded')] + [Parameter(ParameterSetName='ReprotectViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # Failover direction. + ${FailoverDirection}, + + [Parameter(ParameterSetName='ReprotectExpanded')] + [Parameter(ParameterSetName='ReprotectViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The class type. + ${ProviderSpecificDetailInstanceType}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Reprotect = 'Az.SiteRecovery.private\Invoke-AzSiteRecoveryReprotectReplicationProtectedItem_Reprotect'; + ReprotectExpanded = 'Az.SiteRecovery.private\Invoke-AzSiteRecoveryReprotectReplicationProtectedItem_ReprotectExpanded'; + ReprotectViaIdentity = 'Az.SiteRecovery.private\Invoke-AzSiteRecoveryReprotectReplicationProtectedItem_ReprotectViaIdentity'; + ReprotectViaIdentityExpanded = 'Az.SiteRecovery.private\Invoke-AzSiteRecoveryReprotectReplicationProtectedItem_ReprotectViaIdentityExpanded'; + } + if (('Reprotect', 'ReprotectExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/Invoke-AzSiteRecoveryReprotectReplicationRecoveryPlan.ps1 b/swaggerci/recoveryservicessiterecovery/exports/Invoke-AzSiteRecoveryReprotectReplicationRecoveryPlan.ps1 new file mode 100644 index 000000000000..cecbd27da831 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/Invoke-AzSiteRecoveryReprotectReplicationRecoveryPlan.ps1 @@ -0,0 +1,231 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to reprotect(reverse replicate) a recovery plan. +.Description +The operation to reprotect(reverse replicate) a recovery plan. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/invoke-azsiterecoveryreprotectreplicationrecoveryplan +#> +function Invoke-AzSiteRecoveryReprotectReplicationRecoveryPlan { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan])] +[CmdletBinding(DefaultParameterSetName='Reprotect', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Reprotect', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Recovery plan name. + ${RecoveryPlanName}, + + [Parameter(ParameterSetName='Reprotect', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Reprotect', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Reprotect')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='ReprotectViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Reprotect = 'Az.SiteRecovery.private\Invoke-AzSiteRecoveryReprotectReplicationRecoveryPlan_Reprotect'; + ReprotectViaIdentity = 'Az.SiteRecovery.private\Invoke-AzSiteRecoveryReprotectReplicationRecoveryPlan_ReprotectViaIdentity'; + } + if (('Reprotect') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/Invoke-AzSiteRecoveryResyncReplicationMigrationItem.ps1 b/swaggerci/recoveryservicessiterecovery/exports/Invoke-AzSiteRecoveryResyncReplicationMigrationItem.ps1 new file mode 100644 index 000000000000..14e825d3706b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/Invoke-AzSiteRecoveryResyncReplicationMigrationItem.ps1 @@ -0,0 +1,272 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to resynchronize replication of an ASR migration item. +.Description +The operation to resynchronize replication of an ASR migration item. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncInput +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUT : Resync input. + ProviderSpecificDetailInstanceType : The class type. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/invoke-azsiterecoveryresyncreplicationmigrationitem +#> +function Invoke-AzSiteRecoveryResyncReplicationMigrationItem { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem])] +[CmdletBinding(DefaultParameterSetName='ResyncExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Resync', Mandatory)] + [Parameter(ParameterSetName='ResyncExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Fabric name. + ${FabricName}, + + [Parameter(ParameterSetName='Resync', Mandatory)] + [Parameter(ParameterSetName='ResyncExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Migration item name. + ${MigrationItemName}, + + [Parameter(ParameterSetName='Resync', Mandatory)] + [Parameter(ParameterSetName='ResyncExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Protection container name. + ${ProtectionContainerName}, + + [Parameter(ParameterSetName='Resync', Mandatory)] + [Parameter(ParameterSetName='ResyncExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Resync', Mandatory)] + [Parameter(ParameterSetName='ResyncExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Resync')] + [Parameter(ParameterSetName='ResyncExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='ResyncViaIdentity', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='ResyncViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='Resync', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='ResyncViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncInput] + # Resync input. + # To construct, see NOTES section for INPUT properties and create a hash table. + ${Input}, + + [Parameter(ParameterSetName='ResyncExpanded', Mandatory)] + [Parameter(ParameterSetName='ResyncViaIdentityExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The class type. + ${ProviderSpecificDetailInstanceType}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Resync = 'Az.SiteRecovery.private\Invoke-AzSiteRecoveryResyncReplicationMigrationItem_Resync'; + ResyncExpanded = 'Az.SiteRecovery.private\Invoke-AzSiteRecoveryResyncReplicationMigrationItem_ResyncExpanded'; + ResyncViaIdentity = 'Az.SiteRecovery.private\Invoke-AzSiteRecoveryResyncReplicationMigrationItem_ResyncViaIdentity'; + ResyncViaIdentityExpanded = 'Az.SiteRecovery.private\Invoke-AzSiteRecoveryResyncReplicationMigrationItem_ResyncViaIdentityExpanded'; + } + if (('Resync', 'ResyncExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/Invoke-AzSiteRecoveryUnplannedReplicationProtectedItemFailover.ps1 b/swaggerci/recoveryservicessiterecovery/exports/Invoke-AzSiteRecoveryUnplannedReplicationProtectedItemFailover.ps1 new file mode 100644 index 000000000000..66e779601f65 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/Invoke-AzSiteRecoveryUnplannedReplicationProtectedItemFailover.ps1 @@ -0,0 +1,288 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Operation to initiate a failover of the replication protected item. +.Description +Operation to initiate a failover of the replication protected item. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverInput +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +FAILOVERINPUT : Input definition for unplanned failover. + [FailoverDirection ]: Failover direction. + [ProviderSpecificDetailInstanceType ]: The class type. + [SourceSiteOperation ]: Source site operations status. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/invoke-azsiterecoveryunplannedreplicationprotecteditemfailover +#> +function Invoke-AzSiteRecoveryUnplannedReplicationProtectedItemFailover { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem])] +[CmdletBinding(DefaultParameterSetName='UnplannedExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Unplanned', Mandatory)] + [Parameter(ParameterSetName='UnplannedExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Unique fabric name. + ${FabricName}, + + [Parameter(ParameterSetName='Unplanned', Mandatory)] + [Parameter(ParameterSetName='UnplannedExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Protection container name. + ${ProtectionContainerName}, + + [Parameter(ParameterSetName='Unplanned', Mandatory)] + [Parameter(ParameterSetName='UnplannedExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Replication protected item name. + ${ReplicatedProtectedItemName}, + + [Parameter(ParameterSetName='Unplanned', Mandatory)] + [Parameter(ParameterSetName='UnplannedExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Unplanned', Mandatory)] + [Parameter(ParameterSetName='UnplannedExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Unplanned')] + [Parameter(ParameterSetName='UnplannedExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='UnplannedViaIdentity', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='UnplannedViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='Unplanned', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='UnplannedViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverInput] + # Input definition for unplanned failover. + # To construct, see NOTES section for FAILOVERINPUT properties and create a hash table. + ${FailoverInput}, + + [Parameter(ParameterSetName='UnplannedExpanded')] + [Parameter(ParameterSetName='UnplannedViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # Failover direction. + ${FailoverDirection}, + + [Parameter(ParameterSetName='UnplannedExpanded')] + [Parameter(ParameterSetName='UnplannedViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The class type. + ${ProviderSpecificDetailInstanceType}, + + [Parameter(ParameterSetName='UnplannedExpanded')] + [Parameter(ParameterSetName='UnplannedViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # Source site operations status. + ${SourceSiteOperation}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Unplanned = 'Az.SiteRecovery.private\Invoke-AzSiteRecoveryUnplannedReplicationProtectedItemFailover_Unplanned'; + UnplannedExpanded = 'Az.SiteRecovery.private\Invoke-AzSiteRecoveryUnplannedReplicationProtectedItemFailover_UnplannedExpanded'; + UnplannedViaIdentity = 'Az.SiteRecovery.private\Invoke-AzSiteRecoveryUnplannedReplicationProtectedItemFailover_UnplannedViaIdentity'; + UnplannedViaIdentityExpanded = 'Az.SiteRecovery.private\Invoke-AzSiteRecoveryUnplannedReplicationProtectedItemFailover_UnplannedViaIdentityExpanded'; + } + if (('Unplanned', 'UnplannedExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/Invoke-AzSiteRecoveryUnplannedReplicationRecoveryPlanFailover.ps1 b/swaggerci/recoveryservicessiterecovery/exports/Invoke-AzSiteRecoveryUnplannedReplicationRecoveryPlanFailover.ps1 new file mode 100644 index 000000000000..c70ee09444f3 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/Invoke-AzSiteRecoveryUnplannedReplicationRecoveryPlanFailover.ps1 @@ -0,0 +1,282 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to start the unplanned failover of a recovery plan. +.Description +The operation to start the unplanned failover of a recovery plan. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanUnplannedFailoverInput +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUT : Recovery plan unplanned failover input. + FailoverDirection : The failover direction. + SourceSiteOperation : A value indicating whether source site operations are required. + [ProviderSpecificDetail ]: The provider specific properties. + InstanceType : The class type. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. + +PROVIDERSPECIFICDETAIL : The provider specific properties. + InstanceType : The class type. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/invoke-azsiterecoveryunplannedreplicationrecoveryplanfailover +#> +function Invoke-AzSiteRecoveryUnplannedReplicationRecoveryPlanFailover { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan])] +[CmdletBinding(DefaultParameterSetName='UnplannedExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Unplanned', Mandatory)] + [Parameter(ParameterSetName='UnplannedExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Recovery plan name. + ${RecoveryPlanName}, + + [Parameter(ParameterSetName='Unplanned', Mandatory)] + [Parameter(ParameterSetName='UnplannedExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Unplanned', Mandatory)] + [Parameter(ParameterSetName='UnplannedExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Unplanned')] + [Parameter(ParameterSetName='UnplannedExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='UnplannedViaIdentity', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='UnplannedViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='Unplanned', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='UnplannedViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanUnplannedFailoverInput] + # Recovery plan unplanned failover input. + # To construct, see NOTES section for INPUT properties and create a hash table. + ${Input}, + + [Parameter(ParameterSetName='UnplannedExpanded', Mandatory)] + [Parameter(ParameterSetName='UnplannedViaIdentityExpanded', Mandatory)] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections])] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections] + # The failover direction. + ${FailoverDirection}, + + [Parameter(ParameterSetName='UnplannedExpanded', Mandatory)] + [Parameter(ParameterSetName='UnplannedViaIdentityExpanded', Mandatory)] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SourceSiteOperations])] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SourceSiteOperations] + # A value indicating whether source site operations are required. + ${SourceSiteOperation}, + + [Parameter(ParameterSetName='UnplannedExpanded')] + [Parameter(ParameterSetName='UnplannedViaIdentityExpanded')] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInput[]] + # The provider specific properties. + # To construct, see NOTES section for PROVIDERSPECIFICDETAIL properties and create a hash table. + ${ProviderSpecificDetail}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Unplanned = 'Az.SiteRecovery.private\Invoke-AzSiteRecoveryUnplannedReplicationRecoveryPlanFailover_Unplanned'; + UnplannedExpanded = 'Az.SiteRecovery.private\Invoke-AzSiteRecoveryUnplannedReplicationRecoveryPlanFailover_UnplannedExpanded'; + UnplannedViaIdentity = 'Az.SiteRecovery.private\Invoke-AzSiteRecoveryUnplannedReplicationRecoveryPlanFailover_UnplannedViaIdentity'; + UnplannedViaIdentityExpanded = 'Az.SiteRecovery.private\Invoke-AzSiteRecoveryUnplannedReplicationRecoveryPlanFailover_UnplannedViaIdentityExpanded'; + } + if (('Unplanned', 'UnplannedExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/Move-AzSiteRecoveryReplicationFabricGateway.ps1 b/swaggerci/recoveryservicessiterecovery/exports/Move-AzSiteRecoveryReplicationFabricGateway.ps1 new file mode 100644 index 000000000000..c73bcc3e3c4a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/Move-AzSiteRecoveryReplicationFabricGateway.ps1 @@ -0,0 +1,292 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to move replications from a process server to another process server. +.Description +The operation to move replications from a process server to another process server. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverProcessServerRequest +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabric +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +FAILOVERPROCESSSERVERREQUEST : Request to failover a process server. + [ContainerName ]: The container identifier. + [SourceProcessServerId ]: The source process server. + [TargetProcessServerId ]: The new process server. + [UpdateType ]: A value for failover type. It can be systemlevel/serverlevel. + [VmsToMigrate ]: The VMS to migrate. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/move-azsiterecoveryreplicationfabricgateway +#> +function Move-AzSiteRecoveryReplicationFabricGateway { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabric])] +[CmdletBinding(DefaultParameterSetName='ReassociateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Reassociate', Mandatory)] + [Parameter(ParameterSetName='ReassociateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the fabric containing the process server. + ${FabricName}, + + [Parameter(ParameterSetName='Reassociate', Mandatory)] + [Parameter(ParameterSetName='ReassociateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Reassociate', Mandatory)] + [Parameter(ParameterSetName='ReassociateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Reassociate')] + [Parameter(ParameterSetName='ReassociateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='ReassociateViaIdentity', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='ReassociateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='Reassociate', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='ReassociateViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverProcessServerRequest] + # Request to failover a process server. + # To construct, see NOTES section for FAILOVERPROCESSSERVERREQUEST properties and create a hash table. + ${FailoverProcessServerRequest}, + + [Parameter(ParameterSetName='ReassociateExpanded')] + [Parameter(ParameterSetName='ReassociateViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The container identifier. + ${ContainerName}, + + [Parameter(ParameterSetName='ReassociateExpanded')] + [Parameter(ParameterSetName='ReassociateViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The source process server. + ${SourceProcessServerId}, + + [Parameter(ParameterSetName='ReassociateExpanded')] + [Parameter(ParameterSetName='ReassociateViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The new process server. + ${TargetProcessServerId}, + + [Parameter(ParameterSetName='ReassociateExpanded')] + [Parameter(ParameterSetName='ReassociateViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # A value for failover type. + # It can be systemlevel/serverlevel. + ${UpdateType}, + + [Parameter(ParameterSetName='ReassociateExpanded')] + [Parameter(ParameterSetName='ReassociateViaIdentityExpanded')] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String[]] + # The VMS to migrate. + ${VmsToMigrate}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Reassociate = 'Az.SiteRecovery.private\Move-AzSiteRecoveryReplicationFabricGateway_Reassociate'; + ReassociateExpanded = 'Az.SiteRecovery.private\Move-AzSiteRecoveryReplicationFabricGateway_ReassociateExpanded'; + ReassociateViaIdentity = 'Az.SiteRecovery.private\Move-AzSiteRecoveryReplicationFabricGateway_ReassociateViaIdentity'; + ReassociateViaIdentityExpanded = 'Az.SiteRecovery.private\Move-AzSiteRecoveryReplicationFabricGateway_ReassociateViaIdentityExpanded'; + } + if (('Reassociate', 'ReassociateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/Move-AzSiteRecoveryReplicationFabricToAad.ps1 b/swaggerci/recoveryservicessiterecovery/exports/Move-AzSiteRecoveryReplicationFabricToAad.ps1 new file mode 100644 index 000000000000..a42c40646e84 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/Move-AzSiteRecoveryReplicationFabricToAad.ps1 @@ -0,0 +1,237 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to migrate an Azure Site Recovery fabric to AAD. +.Description +The operation to migrate an Azure Site Recovery fabric to AAD. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +System.Boolean +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/move-azsiterecoveryreplicationfabrictoaad +#> +function Move-AzSiteRecoveryReplicationFabricToAad { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Migrate', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Migrate', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # ASR fabric to migrate. + ${FabricName}, + + [Parameter(ParameterSetName='Migrate', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Migrate', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Migrate')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='MigrateViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Migrate = 'Az.SiteRecovery.private\Move-AzSiteRecoveryReplicationFabricToAad_Migrate'; + MigrateViaIdentity = 'Az.SiteRecovery.private\Move-AzSiteRecoveryReplicationFabricToAad_MigrateViaIdentity'; + } + if (('Migrate') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/Move-AzSiteRecoveryReplicationMigrationItem.ps1 b/swaggerci/recoveryservicessiterecovery/exports/Move-AzSiteRecoveryReplicationMigrationItem.ps1 new file mode 100644 index 000000000000..e4d77a5be35a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/Move-AzSiteRecoveryReplicationMigrationItem.ps1 @@ -0,0 +1,272 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to initiate migration of the item. +.Description +The operation to initiate migration of the item. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateInput +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. + +MIGRATEINPUT : Input for migrate. + ProviderSpecificDetailInstanceType : The class type. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/move-azsiterecoveryreplicationmigrationitem +#> +function Move-AzSiteRecoveryReplicationMigrationItem { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem])] +[CmdletBinding(DefaultParameterSetName='MigrateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Migrate', Mandatory)] + [Parameter(ParameterSetName='MigrateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Fabric name. + ${FabricName}, + + [Parameter(ParameterSetName='Migrate', Mandatory)] + [Parameter(ParameterSetName='MigrateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Migration item name. + ${MigrationItemName}, + + [Parameter(ParameterSetName='Migrate', Mandatory)] + [Parameter(ParameterSetName='MigrateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Protection container name. + ${ProtectionContainerName}, + + [Parameter(ParameterSetName='Migrate', Mandatory)] + [Parameter(ParameterSetName='MigrateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Migrate', Mandatory)] + [Parameter(ParameterSetName='MigrateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Migrate')] + [Parameter(ParameterSetName='MigrateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='MigrateViaIdentity', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='MigrateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='Migrate', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='MigrateViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateInput] + # Input for migrate. + # To construct, see NOTES section for MIGRATEINPUT properties and create a hash table. + ${MigrateInput}, + + [Parameter(ParameterSetName='MigrateExpanded', Mandatory)] + [Parameter(ParameterSetName='MigrateViaIdentityExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The class type. + ${ProviderSpecificDetailInstanceType}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Migrate = 'Az.SiteRecovery.private\Move-AzSiteRecoveryReplicationMigrationItem_Migrate'; + MigrateExpanded = 'Az.SiteRecovery.private\Move-AzSiteRecoveryReplicationMigrationItem_MigrateExpanded'; + MigrateViaIdentity = 'Az.SiteRecovery.private\Move-AzSiteRecoveryReplicationMigrationItem_MigrateViaIdentity'; + MigrateViaIdentityExpanded = 'Az.SiteRecovery.private\Move-AzSiteRecoveryReplicationMigrationItem_MigrateViaIdentityExpanded'; + } + if (('Migrate', 'MigrateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/New-AzSiteRecoveryReplicationAlertSetting.ps1 b/swaggerci/recoveryservicessiterecovery/exports/New-AzSiteRecoveryReplicationAlertSetting.ps1 new file mode 100644 index 000000000000..40dae6498397 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/New-AzSiteRecoveryReplicationAlertSetting.ps1 @@ -0,0 +1,195 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Create or update an email notification(alert) configuration. +.Description +Create or update an email notification(alert) configuration. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlert +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/new-azsiterecoveryreplicationalertsetting +#> +function New-AzSiteRecoveryReplicationAlertSetting { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlert])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the email notification(alert) configuration. + ${AlertSettingName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String[]] + # The custom email address for sending emails. + ${CustomEmailAddress}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The locale for the email notification. + ${Locale}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # A value indicating whether to send email to subscription administrator. + ${SendToOwner}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + CreateExpanded = 'Az.SiteRecovery.private\New-AzSiteRecoveryReplicationAlertSetting_CreateExpanded'; + } + if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/New-AzSiteRecoveryReplicationFabric.ps1 b/swaggerci/recoveryservicessiterecovery/exports/New-AzSiteRecoveryReplicationFabric.ps1 new file mode 100644 index 000000000000..d3dd52c1b24b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/New-AzSiteRecoveryReplicationFabric.ps1 @@ -0,0 +1,196 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to create an Azure Site Recovery fabric (for e.g. +Hyper-V site). +.Description +The operation to create an Azure Site Recovery fabric (for e.g. +Hyper-V site). +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabric +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/new-azsiterecoveryreplicationfabric +#> +function New-AzSiteRecoveryReplicationFabric { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabric])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Name of the ASR fabric. + ${FabricName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # Gets the class type. + ${CustomDetailInstanceType}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + CreateExpanded = 'Az.SiteRecovery.private\New-AzSiteRecoveryReplicationFabric_CreateExpanded'; + } + if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/New-AzSiteRecoveryReplicationMigrationItem.ps1 b/swaggerci/recoveryservicessiterecovery/exports/New-AzSiteRecoveryReplicationMigrationItem.ps1 new file mode 100644 index 000000000000..f9a1d6d2d9d7 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/New-AzSiteRecoveryReplicationMigrationItem.ps1 @@ -0,0 +1,212 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to create an ASR migration item (enable migration). +.Description +The operation to create an ASR migration item (enable migration). +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/new-azsiterecoveryreplicationmigrationitem +#> +function New-AzSiteRecoveryReplicationMigrationItem { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Fabric name. + ${FabricName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Migration item name. + ${MigrationItemName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Protection container name. + ${ProtectionContainerName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The policy Id. + ${PolicyId}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The class type. + ${ProviderSpecificDetailInstanceType}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + CreateExpanded = 'Az.SiteRecovery.private\New-AzSiteRecoveryReplicationMigrationItem_CreateExpanded'; + } + if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/New-AzSiteRecoveryReplicationNetworkMapping.ps1 b/swaggerci/recoveryservicessiterecovery/exports/New-AzSiteRecoveryReplicationNetworkMapping.ps1 new file mode 100644 index 000000000000..01e60a998ba3 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/New-AzSiteRecoveryReplicationNetworkMapping.ps1 @@ -0,0 +1,218 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to create an ASR network mapping. +.Description +The operation to create an ASR network mapping. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMapping +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/new-azsiterecoveryreplicationnetworkmapping +#> +function New-AzSiteRecoveryReplicationNetworkMapping { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMapping])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Primary fabric name. + ${FabricName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Network mapping name. + ${NetworkMappingName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Primary network name. + ${NetworkName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # Recovery network Id. + ${RecoveryNetworkId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The instance type. + ${FabricSpecificDetailInstanceType}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # Recovery fabric Name. + ${RecoveryFabricName}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + CreateExpanded = 'Az.SiteRecovery.private\New-AzSiteRecoveryReplicationNetworkMapping_CreateExpanded'; + } + if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/New-AzSiteRecoveryReplicationPolicy.ps1 b/swaggerci/recoveryservicessiterecovery/exports/New-AzSiteRecoveryReplicationPolicy.ps1 new file mode 100644 index 000000000000..2bdbd1c56bb4 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/New-AzSiteRecoveryReplicationPolicy.ps1 @@ -0,0 +1,194 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to create a replication policy. +.Description +The operation to create a replication policy. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicy +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/new-azsiterecoveryreplicationpolicy +#> +function New-AzSiteRecoveryReplicationPolicy { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicy])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Replication policy name. + ${PolicyName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The class type. + ${ProviderSpecificInputInstanceType}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + CreateExpanded = 'Az.SiteRecovery.private\New-AzSiteRecoveryReplicationPolicy_CreateExpanded'; + } + if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/New-AzSiteRecoveryReplicationProtectedItem.ps1 b/swaggerci/recoveryservicessiterecovery/exports/New-AzSiteRecoveryReplicationProtectedItem.ps1 new file mode 100644 index 000000000000..0f1e4cba99b2 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/New-AzSiteRecoveryReplicationProtectedItem.ps1 @@ -0,0 +1,218 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to create an ASR replication protected item (Enable replication). +.Description +The operation to create an ASR replication protected item (Enable replication). +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/new-azsiterecoveryreplicationprotecteditem +#> +function New-AzSiteRecoveryReplicationProtectedItem { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Name of the fabric. + ${FabricName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Protection container name. + ${ProtectionContainerName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # A name for the replication protected item. + ${ReplicatedProtectedItemName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The Policy Id. + ${PolicyId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The protectable item Id. + ${ProtectableItemId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The class type. + ${ProviderSpecificDetailInstanceType}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + CreateExpanded = 'Az.SiteRecovery.private\New-AzSiteRecoveryReplicationProtectedItem_CreateExpanded'; + } + if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/New-AzSiteRecoveryReplicationProtectionContainer.ps1 b/swaggerci/recoveryservicessiterecovery/exports/New-AzSiteRecoveryReplicationProtectionContainer.ps1 new file mode 100644 index 000000000000..4eb5f6d4131a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/New-AzSiteRecoveryReplicationProtectionContainer.ps1 @@ -0,0 +1,209 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Operation to create a protection container. +.Description +Operation to create a protection container. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainer +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +PROVIDERSPECIFICINPUT : Provider specific inputs for container creation. + InstanceType : The class type. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/new-azsiterecoveryreplicationprotectioncontainer +#> +function New-AzSiteRecoveryReplicationProtectionContainer { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainer])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Unique fabric ARM name. + ${FabricName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Unique protection container ARM name. + ${ProtectionContainerName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerCreationInput[]] + # Provider specific inputs for container creation. + # To construct, see NOTES section for PROVIDERSPECIFICINPUT properties and create a hash table. + ${ProviderSpecificInput}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + CreateExpanded = 'Az.SiteRecovery.private\New-AzSiteRecoveryReplicationProtectionContainer_CreateExpanded'; + } + if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/New-AzSiteRecoveryReplicationProtectionContainerMapping.ps1 b/swaggerci/recoveryservicessiterecovery/exports/New-AzSiteRecoveryReplicationProtectionContainerMapping.ps1 new file mode 100644 index 000000000000..186117c10722 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/New-AzSiteRecoveryReplicationProtectionContainerMapping.ps1 @@ -0,0 +1,218 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to create a protection container mapping. +.Description +The operation to create a protection container mapping. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMapping +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/new-azsiterecoveryreplicationprotectioncontainermapping +#> +function New-AzSiteRecoveryReplicationProtectionContainerMapping { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMapping])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Fabric name. + ${FabricName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Protection container mapping name. + ${MappingName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Protection container name. + ${ProtectionContainerName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # Applicable policy. + ${PolicyId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The class type. + ${ProviderSpecificInputInstanceType}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The target unique protection container name. + ${TargetProtectionContainerId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + CreateExpanded = 'Az.SiteRecovery.private\New-AzSiteRecoveryReplicationProtectionContainerMapping_CreateExpanded'; + } + if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/New-AzSiteRecoveryReplicationProtectionIntent.ps1 b/swaggerci/recoveryservicessiterecovery/exports/New-AzSiteRecoveryReplicationProtectionIntent.ps1 new file mode 100644 index 000000000000..f180b134e2e4 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/New-AzSiteRecoveryReplicationProtectionIntent.ps1 @@ -0,0 +1,182 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to create an ASR replication protection intent item. +.Description +The operation to create an ASR replication protection intent item. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntent +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/new-azsiterecoveryreplicationprotectionintent +#> +function New-AzSiteRecoveryReplicationProtectionIntent { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntent])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # A name for the replication protection item. + ${IntentObjectName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The class type. + ${ProviderSpecificDetailInstanceType}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + CreateExpanded = 'Az.SiteRecovery.private\New-AzSiteRecoveryReplicationProtectionIntent_CreateExpanded'; + } + if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/New-AzSiteRecoveryReplicationRecoveryPlan.ps1 b/swaggerci/recoveryservicessiterecovery/exports/New-AzSiteRecoveryReplicationRecoveryPlan.ps1 new file mode 100644 index 000000000000..a75606e73429 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/New-AzSiteRecoveryReplicationRecoveryPlan.ps1 @@ -0,0 +1,242 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to create a recovery plan. +.Description +The operation to create a recovery plan. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +GROUP : The recovery plan groups. + GroupType : The group type. + [EndGroupAction ]: The end group actions. + ActionName : The action name. + CustomDetailInstanceType : Gets the type of action details (see RecoveryPlanActionDetailsTypes enum for possible values). + FailoverDirection : The list of failover directions. + FailoverType : The list of failover types. + [ReplicationProtectedItem ]: The list of protected items. + [Id ]: The ARM Id of the recovery plan protected item. + [VirtualMachineId ]: The virtual machine Id. + [StartGroupAction ]: The start group actions. + +PROVIDERSPECIFICINPUT : The provider specific input. + InstanceType : Gets the Instance type. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/new-azsiterecoveryreplicationrecoveryplan +#> +function New-AzSiteRecoveryReplicationRecoveryPlan { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Recovery plan name. + ${RecoveryPlanName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(Mandatory)] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroup[]] + # The recovery plan groups. + # To construct, see NOTES section for GROUP properties and create a hash table. + ${Group}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The primary fabric Id. + ${PrimaryFabricId}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The recovery fabric Id. + ${RecoveryFabricId}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.FailoverDeploymentModel])] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.FailoverDeploymentModel] + # The failover deployment model. + ${FailoverDeploymentModel}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificInput[]] + # The provider specific input. + # To construct, see NOTES section for PROVIDERSPECIFICINPUT properties and create a hash table. + ${ProviderSpecificInput}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + CreateExpanded = 'Az.SiteRecovery.private\New-AzSiteRecoveryReplicationRecoveryPlan_CreateExpanded'; + } + if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/New-AzSiteRecoveryReplicationRecoveryServicesProvider.ps1 b/swaggerci/recoveryservicessiterecovery/exports/New-AzSiteRecoveryReplicationRecoveryServicesProvider.ps1 new file mode 100644 index 000000000000..f674198d13c4 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/New-AzSiteRecoveryReplicationRecoveryServicesProvider.ps1 @@ -0,0 +1,302 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to add a recovery services provider. +.Description +The operation to add a recovery services provider. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProvider +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/new-azsiterecoveryreplicationrecoveryservicesprovider +#> +function New-AzSiteRecoveryReplicationRecoveryServicesProvider { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProvider])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Fabric name. + ${FabricName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Recovery services provider name. + ${ProviderName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The base authority for Azure Active Directory authentication. + ${AuthenticationIdentityInputAadAuthority}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The application/client Id for the service principal with which the on-premise management/data plane components would communicate with our Azure services. + ${AuthenticationIdentityInputApplicationId}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The intended Audience of the service principal with which the on-premise management/data plane components would communicate with our Azure services. + ${AuthenticationIdentityInputAudience}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The object Id of the service principal with which the on-premise management/data plane components would communicate with our Azure services. + ${AuthenticationIdentityInputObjectId}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The tenant Id for the service principal with which the on-premise management/data plane components would communicate with our Azure services. + ${AuthenticationIdentityInputTenantId}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The name of the machine where the provider is getting added. + ${MachineName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The base authority for Azure Active Directory authentication. + ${ResourceAccessIdentityInputAadAuthority}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The application/client Id for the service principal with which the on-premise management/data plane components would communicate with our Azure services. + ${ResourceAccessIdentityInputApplicationId}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The intended Audience of the service principal with which the on-premise management/data plane components would communicate with our Azure services. + ${ResourceAccessIdentityInputAudience}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The object Id of the service principal with which the on-premise management/data plane components would communicate with our Azure services. + ${ResourceAccessIdentityInputObjectId}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The tenant Id for the service principal with which the on-premise management/data plane components would communicate with our Azure services. + ${ResourceAccessIdentityInputTenantId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The Bios Id of the machine. + ${BiosId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The base authority for Azure Active Directory authentication. + ${DataPlaneAuthenticationIdentityInputAadAuthority}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The application/client Id for the service principal with which the on-premise management/data plane components would communicate with our Azure services. + ${DataPlaneAuthenticationIdentityInputApplicationId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The intended Audience of the service principal with which the on-premise management/data plane components would communicate with our Azure services. + ${DataPlaneAuthenticationIdentityInputAudience}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The object Id of the service principal with which the on-premise management/data plane components would communicate with our Azure services. + ${DataPlaneAuthenticationIdentityInputObjectId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The tenant Id for the service principal with which the on-premise management/data plane components would communicate with our Azure services. + ${DataPlaneAuthenticationIdentityInputTenantId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The Id of the machine where the provider is getting added. + ${MachineId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + CreateExpanded = 'Az.SiteRecovery.private\New-AzSiteRecoveryReplicationRecoveryServicesProvider_CreateExpanded'; + } + if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/New-AzSiteRecoveryReplicationStorageClassificationMapping.ps1 b/swaggerci/recoveryservicessiterecovery/exports/New-AzSiteRecoveryReplicationStorageClassificationMapping.ps1 new file mode 100644 index 000000000000..bd5b0c3051e3 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/New-AzSiteRecoveryReplicationStorageClassificationMapping.ps1 @@ -0,0 +1,206 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to create a storage classification mapping. +.Description +The operation to create a storage classification mapping. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMapping +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/new-azsiterecoveryreplicationstorageclassificationmapping +#> +function New-AzSiteRecoveryReplicationStorageClassificationMapping { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMapping])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Fabric name. + ${FabricName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Storage classification mapping name. + ${StorageClassificationMappingName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Storage classification name. + ${StorageClassificationName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The ID of the storage object. + ${TargetStorageClassificationId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + CreateExpanded = 'Az.SiteRecovery.private\New-AzSiteRecoveryReplicationStorageClassificationMapping_CreateExpanded'; + } + if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/New-AzSiteRecoveryReplicationVaultSetting.ps1 b/swaggerci/recoveryservicessiterecovery/exports/New-AzSiteRecoveryReplicationVaultSetting.ps1 new file mode 100644 index 000000000000..abcb2545c783 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/New-AzSiteRecoveryReplicationVaultSetting.ps1 @@ -0,0 +1,200 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to configure vault setting. +.Description +The operation to configure vault setting. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSetting +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/new-azsiterecoveryreplicationvaultsetting +#> +function New-AzSiteRecoveryReplicationVaultSetting { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSetting])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Vault setting name. + ${VaultSettingName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The migration solution Id. + ${MigrationSolutionId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # VMware to Azure provider type. + ${VmwareToAzureProviderType}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + CreateExpanded = 'Az.SiteRecovery.private\New-AzSiteRecoveryReplicationVaultSetting_CreateExpanded'; + } + if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/New-AzSiteRecoveryReplicationvCenter.ps1 b/swaggerci/recoveryservicessiterecovery/exports/New-AzSiteRecoveryReplicationvCenter.ps1 new file mode 100644 index 000000000000..6707bb82955a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/New-AzSiteRecoveryReplicationvCenter.ps1 @@ -0,0 +1,224 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to create a vCenter object.. +.Description +The operation to create a vCenter object.. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenter +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/new-azsiterecoveryreplicationvcenter +#> +function New-AzSiteRecoveryReplicationvCenter { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenter])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Fabric name. + ${FabricName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # vcenter name. + ${VcenterName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The friendly name of the vCenter. + ${FriendlyName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The IP address of the vCenter to be discovered. + ${IPAddress}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The port number for discovery. + ${Port}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The process server Id from where the discovery is orchestrated. + ${ProcessServerId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The account Id which has privileges to discover the vCenter. + ${RunAsAccountId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + CreateExpanded = 'Az.SiteRecovery.private\New-AzSiteRecoveryReplicationvCenter_CreateExpanded'; + } + if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/ProxyCmdletDefinitions.ps1 b/swaggerci/recoveryservicessiterecovery/exports/ProxyCmdletDefinitions.ps1 new file mode 100644 index 000000000000..ea48ee8ce2c2 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/ProxyCmdletDefinitions.ps1 @@ -0,0 +1,24791 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Operation to add disks(s) to the replication protected item. +.Description +Operation to add disks(s) to the replication protected item. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksInput +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +ADDDISKSINPUT : Input for add disk(s) operation. + [ProviderSpecificDetailInstanceType ]: The class type. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/add-azsiterecoveryreplicationprotecteditemdisk +#> +function Add-AzSiteRecoveryReplicationProtectedItemDisk { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem])] +[CmdletBinding(DefaultParameterSetName='AddExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Add', Mandatory)] + [Parameter(ParameterSetName='AddExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Unique fabric name. + ${FabricName}, + + [Parameter(ParameterSetName='Add', Mandatory)] + [Parameter(ParameterSetName='AddExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Protection container name. + ${ProtectionContainerName}, + + [Parameter(ParameterSetName='Add', Mandatory)] + [Parameter(ParameterSetName='AddExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Replication protected item name. + ${ReplicatedProtectedItemName}, + + [Parameter(ParameterSetName='Add', Mandatory)] + [Parameter(ParameterSetName='AddExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Add', Mandatory)] + [Parameter(ParameterSetName='AddExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Add')] + [Parameter(ParameterSetName='AddExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='AddViaIdentity', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='AddViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='Add', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='AddViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksInput] + # Input for add disk(s) operation. + # To construct, see NOTES section for ADDDISKSINPUT properties and create a hash table. + ${AddDisksInput}, + + [Parameter(ParameterSetName='AddExpanded')] + [Parameter(ParameterSetName='AddViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The class type. + ${ProviderSpecificDetailInstanceType}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Add = 'Az.SiteRecovery.private\Add-AzSiteRecoveryReplicationProtectedItemDisk_Add'; + AddExpanded = 'Az.SiteRecovery.private\Add-AzSiteRecoveryReplicationProtectedItemDisk_AddExpanded'; + AddViaIdentity = 'Az.SiteRecovery.private\Add-AzSiteRecoveryReplicationProtectedItemDisk_AddViaIdentity'; + AddViaIdentityExpanded = 'Az.SiteRecovery.private\Add-AzSiteRecoveryReplicationProtectedItemDisk_AddViaIdentityExpanded'; + } + if (('Add', 'AddExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +The operation to change the recovery point of a failed over replication protected item. +.Description +The operation to change the recovery point of a failed over replication protected item. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointInput +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +APPLYRECOVERYPOINTINPUT : Input to apply recovery point. + ProviderSpecificDetailInstanceType : The class type. + [RecoveryPointId ]: The recovery point Id. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/add-azsiterecoveryreplicationprotecteditemrecoverypoint +#> +function Add-AzSiteRecoveryReplicationProtectedItemRecoveryPoint { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem])] +[CmdletBinding(DefaultParameterSetName='ApplyExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Apply', Mandatory)] + [Parameter(ParameterSetName='ApplyExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The ARM fabric name. + ${FabricName}, + + [Parameter(ParameterSetName='Apply', Mandatory)] + [Parameter(ParameterSetName='ApplyExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The protection container name. + ${ProtectionContainerName}, + + [Parameter(ParameterSetName='Apply', Mandatory)] + [Parameter(ParameterSetName='ApplyExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The replicated protected item name. + ${ReplicatedProtectedItemName}, + + [Parameter(ParameterSetName='Apply', Mandatory)] + [Parameter(ParameterSetName='ApplyExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Apply', Mandatory)] + [Parameter(ParameterSetName='ApplyExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Apply')] + [Parameter(ParameterSetName='ApplyExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='ApplyViaIdentity', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='ApplyViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='Apply', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='ApplyViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointInput] + # Input to apply recovery point. + # To construct, see NOTES section for APPLYRECOVERYPOINTINPUT properties and create a hash table. + ${ApplyRecoveryPointInput}, + + [Parameter(ParameterSetName='ApplyExpanded', Mandatory)] + [Parameter(ParameterSetName='ApplyViaIdentityExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The class type. + ${ProviderSpecificDetailInstanceType}, + + [Parameter(ParameterSetName='ApplyExpanded')] + [Parameter(ParameterSetName='ApplyViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The recovery point Id. + ${RecoveryPointId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Apply = 'Az.SiteRecovery.private\Add-AzSiteRecoveryReplicationProtectedItemRecoveryPoint_Apply'; + ApplyExpanded = 'Az.SiteRecovery.private\Add-AzSiteRecoveryReplicationProtectedItemRecoveryPoint_ApplyExpanded'; + ApplyViaIdentity = 'Az.SiteRecovery.private\Add-AzSiteRecoveryReplicationProtectedItemRecoveryPoint_ApplyViaIdentity'; + ApplyViaIdentityExpanded = 'Az.SiteRecovery.private\Add-AzSiteRecoveryReplicationProtectedItemRecoveryPoint_ApplyViaIdentityExpanded'; + } + if (('Apply', 'ApplyExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +The operation to purge(force delete) an Azure Site Recovery fabric. +.Description +The operation to purge(force delete) an Azure Site Recovery fabric. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +System.Boolean +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/clear-azsiterecoveryreplicationfabric +#> +function Clear-AzSiteRecoveryReplicationFabric { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Purge', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Purge', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # ASR fabric to purge. + ${FabricName}, + + [Parameter(ParameterSetName='Purge', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Purge', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Purge')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='PurgeViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Purge = 'Az.SiteRecovery.private\Clear-AzSiteRecoveryReplicationFabric_Purge'; + PurgeViaIdentity = 'Az.SiteRecovery.private\Clear-AzSiteRecoveryReplicationFabric_PurgeViaIdentity'; + } + if (('Purge') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +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. +.Description +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. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +System.Boolean +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/clear-azsiterecoveryreplicationprotecteditem +#> +function Clear-AzSiteRecoveryReplicationProtectedItem { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Purge', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Purge', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Fabric name. + ${FabricName}, + + [Parameter(ParameterSetName='Purge', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Protection container name. + ${ProtectionContainerName}, + + [Parameter(ParameterSetName='Purge', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Replication protected item name. + ${ReplicatedProtectedItemName}, + + [Parameter(ParameterSetName='Purge', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Purge', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Purge')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='PurgeViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Purge = 'Az.SiteRecovery.private\Clear-AzSiteRecoveryReplicationProtectedItem_Purge'; + PurgeViaIdentity = 'Az.SiteRecovery.private\Clear-AzSiteRecoveryReplicationProtectedItem_PurgeViaIdentity'; + } + if (('Purge') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +The operation to purge(force delete) a protection container mapping. +.Description +The operation to purge(force delete) a protection container mapping. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +System.Boolean +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/clear-azsiterecoveryreplicationprotectioncontainermapping +#> +function Clear-AzSiteRecoveryReplicationProtectionContainerMapping { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Purge', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Purge', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Fabric name. + ${FabricName}, + + [Parameter(ParameterSetName='Purge', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Protection container mapping name. + ${MappingName}, + + [Parameter(ParameterSetName='Purge', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Protection container name. + ${ProtectionContainerName}, + + [Parameter(ParameterSetName='Purge', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Purge', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Purge')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='PurgeViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Purge = 'Az.SiteRecovery.private\Clear-AzSiteRecoveryReplicationProtectionContainerMapping_Purge'; + PurgeViaIdentity = 'Az.SiteRecovery.private\Clear-AzSiteRecoveryReplicationProtectionContainerMapping_PurgeViaIdentity'; + } + if (('Purge') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +The operation to purge(force delete) a recovery services provider from the vault. +.Description +The operation to purge(force delete) a recovery services provider from the vault. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +System.Boolean +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/clear-azsiterecoveryreplicationrecoveryservicesprovider +#> +function Clear-AzSiteRecoveryReplicationRecoveryServicesProvider { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Purge', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Purge', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Fabric name. + ${FabricName}, + + [Parameter(ParameterSetName='Purge', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Recovery services provider name. + ${ProviderName}, + + [Parameter(ParameterSetName='Purge', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Purge', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Purge')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='PurgeViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Purge = 'Az.SiteRecovery.private\Clear-AzSiteRecoveryReplicationRecoveryServicesProvider_Purge'; + PurgeViaIdentity = 'Az.SiteRecovery.private\Clear-AzSiteRecoveryReplicationRecoveryServicesProvider_PurgeViaIdentity'; + } + if (('Purge') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +The operation to export the details of the Azure Site Recovery jobs of the vault. +.Description +The operation to export the details of the Azure Site Recovery jobs of the vault. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobQueryParameter +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJob +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. + +JOBQUERYPARAMETER : Query parameter to enumerate jobs. + [AffectedObjectType ]: The type of objects. + [EndTime ]: Date time to get jobs upto. + [FabricId ]: The Id of the fabric to search jobs under. + [JobName ]: The job Name. + [JobOutputType ]: The output type of the jobs. + [JobStatus ]: The states of the job to be filtered can be in. + [StartTime ]: Date time to get jobs from. + [TimezoneOffset ]: The timezone offset for the location of the request (in minutes). +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/export-azsiterecoveryreplicationjob +#> +function Export-AzSiteRecoveryReplicationJob { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJob])] +[CmdletBinding(DefaultParameterSetName='ExportExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Export', Mandatory)] + [Parameter(ParameterSetName='ExportExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Export', Mandatory)] + [Parameter(ParameterSetName='ExportExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Export')] + [Parameter(ParameterSetName='ExportExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='ExportViaIdentity', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='ExportViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='Export', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='ExportViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobQueryParameter] + # Query parameter to enumerate jobs. + # To construct, see NOTES section for JOBQUERYPARAMETER properties and create a hash table. + ${JobQueryParameter}, + + [Parameter(ParameterSetName='ExportExpanded')] + [Parameter(ParameterSetName='ExportViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The type of objects. + ${AffectedObjectType}, + + [Parameter(ParameterSetName='ExportExpanded')] + [Parameter(ParameterSetName='ExportViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # Date time to get jobs upto. + ${EndTime}, + + [Parameter(ParameterSetName='ExportExpanded')] + [Parameter(ParameterSetName='ExportViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The Id of the fabric to search jobs under. + ${FabricId}, + + [Parameter(ParameterSetName='ExportExpanded')] + [Parameter(ParameterSetName='ExportViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The job Name. + ${JobName}, + + [Parameter(ParameterSetName='ExportExpanded')] + [Parameter(ParameterSetName='ExportViaIdentityExpanded')] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ExportJobOutputSerializationType])] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ExportJobOutputSerializationType] + # The output type of the jobs. + ${JobOutputType}, + + [Parameter(ParameterSetName='ExportExpanded')] + [Parameter(ParameterSetName='ExportViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The states of the job to be filtered can be in. + ${JobStatus}, + + [Parameter(ParameterSetName='ExportExpanded')] + [Parameter(ParameterSetName='ExportViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # Date time to get jobs from. + ${StartTime}, + + [Parameter(ParameterSetName='ExportExpanded')] + [Parameter(ParameterSetName='ExportViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.Double] + # The timezone offset for the location of the request (in minutes). + ${TimezoneOffset}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Export = 'Az.SiteRecovery.private\Export-AzSiteRecoveryReplicationJob_Export'; + ExportExpanded = 'Az.SiteRecovery.private\Export-AzSiteRecoveryReplicationJob_ExportExpanded'; + ExportViaIdentity = 'Az.SiteRecovery.private\Export-AzSiteRecoveryReplicationJob_ExportViaIdentity'; + ExportViaIdentityExpanded = 'Az.SiteRecovery.private\Export-AzSiteRecoveryReplicationJob_ExportViaIdentityExpanded'; + } + if (('Export', 'ExportExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +The operation to a add a protectable item to a protection container(Add physical server). +.Description +The operation to a add a protectable item to a protection container(Add physical server). +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiscoverProtectableItemRequest +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainer +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +DISCOVERPROTECTABLEITEMREQUEST : Request to add a physical machine as a protectable item in a container. + [FriendlyName ]: The friendly name of the physical machine. + [IPAddress ]: The IP address of the physical machine to be discovered. + [OSType ]: The OS type on the physical machine. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/find-azsiterecoveryreplicationprotectioncontainerprotectableitem +#> +function Find-AzSiteRecoveryReplicationProtectionContainerProtectableItem { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainer])] +[CmdletBinding(DefaultParameterSetName='DiscoverExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Discover', Mandatory)] + [Parameter(ParameterSetName='DiscoverExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the fabric. + ${FabricName}, + + [Parameter(ParameterSetName='Discover', Mandatory)] + [Parameter(ParameterSetName='DiscoverExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the protection container. + ${ProtectionContainerName}, + + [Parameter(ParameterSetName='Discover', Mandatory)] + [Parameter(ParameterSetName='DiscoverExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Discover', Mandatory)] + [Parameter(ParameterSetName='DiscoverExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Discover')] + [Parameter(ParameterSetName='DiscoverExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='DiscoverViaIdentity', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='DiscoverViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='Discover', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='DiscoverViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiscoverProtectableItemRequest] + # Request to add a physical machine as a protectable item in a container. + # To construct, see NOTES section for DISCOVERPROTECTABLEITEMREQUEST properties and create a hash table. + ${DiscoverProtectableItemRequest}, + + [Parameter(ParameterSetName='DiscoverExpanded')] + [Parameter(ParameterSetName='DiscoverViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The friendly name of the physical machine. + ${FriendlyName}, + + [Parameter(ParameterSetName='DiscoverExpanded')] + [Parameter(ParameterSetName='DiscoverViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The IP address of the physical machine to be discovered. + ${IPAddress}, + + [Parameter(ParameterSetName='DiscoverExpanded')] + [Parameter(ParameterSetName='DiscoverViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The OS type on the physical machine. + ${OSType}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Discover = 'Az.SiteRecovery.private\Find-AzSiteRecoveryReplicationProtectionContainerProtectableItem_Discover'; + DiscoverExpanded = 'Az.SiteRecovery.private\Find-AzSiteRecoveryReplicationProtectionContainerProtectableItem_DiscoverExpanded'; + DiscoverViaIdentity = 'Az.SiteRecovery.private\Find-AzSiteRecoveryReplicationProtectionContainerProtectableItem_DiscoverViaIdentity'; + DiscoverViaIdentityExpanded = 'Az.SiteRecovery.private\Find-AzSiteRecoveryReplicationProtectionContainerProtectableItem_DiscoverViaIdentityExpanded'; + } + if (('Discover', 'DiscoverExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Gets a recovery point for a migration item. +.Description +Gets a recovery point for a migration item. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationRecoveryPoint +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/get-azsiterecoverymigrationrecoverypoint +#> +function Get-AzSiteRecoveryMigrationRecoveryPoint { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationRecoveryPoint])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Fabric unique name. + ${FabricName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Migration item name. + ${MigrationItemName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Alias('MigrationRecoveryPointName')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The migration recovery point name. + ${Name}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Protection container name. + ${ProtectionContainerName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Get = 'Az.SiteRecovery.private\Get-AzSiteRecoveryMigrationRecoveryPoint_Get'; + GetViaIdentity = 'Az.SiteRecovery.private\Get-AzSiteRecoveryMigrationRecoveryPoint_GetViaIdentity'; + List = 'Az.SiteRecovery.private\Get-AzSiteRecoveryMigrationRecoveryPoint_List'; + } + if (('Get', 'List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Get the details of specified recovery point. +.Description +Get the details of specified recovery point. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPoint +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/get-azsiterecoverypoint +#> +function Get-AzSiteRecoveryPoint { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPoint])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The fabric name. + ${FabricName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Alias('RecoveryPointName')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The recovery point name. + ${Name}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The protection container name. + ${ProtectionContainerName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The replication protected item name. + ${ReplicatedProtectedItemName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Get = 'Az.SiteRecovery.private\Get-AzSiteRecoveryPoint_Get'; + GetViaIdentity = 'Az.SiteRecovery.private\Get-AzSiteRecoveryPoint_GetViaIdentity'; + List = 'Az.SiteRecovery.private\Get-AzSiteRecoveryPoint_List'; + } + if (('Get', 'List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Gets the details of the specified email notification(alert) configuration. +.Description +Gets the details of the specified email notification(alert) configuration. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlert +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/get-azsiterecoveryreplicationalertsetting +#> +function Get-AzSiteRecoveryReplicationAlertSetting { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlert])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the email notification configuration. + ${AlertSettingName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Get = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationAlertSetting_Get'; + GetViaIdentity = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationAlertSetting_GetViaIdentity'; + List = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationAlertSetting_List'; + } + if (('Get', 'List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Gets the list of Azure Site Recovery appliances for the vault. +.Description +Gets the list of Azure Site Recovery appliances for the vault. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAppliance +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/get-azsiterecoveryreplicationappliance +#> +function Get-AzSiteRecoveryReplicationAppliance { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAppliance])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The subscription Id. + ${SubscriptionId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Query')] + [System.String] + # OData filter options. + ${Filter}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + List = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationAppliance_List'; + } + if (('List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Validates whether a given VM can be protected or not in which case returns list of errors. +.Description +Validates whether a given VM can be protected or not in which case returns list of errors. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResults +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/get-azsiterecoveryreplicationeligibilityresult +#> +function Get-AzSiteRecoveryReplicationEligibilityResult { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResults])] +[CmdletBinding(DefaultParameterSetName='Get', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Virtual Machine name. + ${VirtualMachineName}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Get = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationEligibilityResult_Get'; + GetViaIdentity = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationEligibilityResult_GetViaIdentity'; + List = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationEligibilityResult_List'; + } + if (('Get', 'List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +The operation to get the details of an Azure Site recovery event. +.Description +The operation to get the details of an Azure Site recovery event. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEvent +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/get-azsiterecoveryreplicationevent +#> +function Get-AzSiteRecoveryReplicationEvent { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEvent])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the Azure Site Recovery event. + ${EventName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Query')] + [System.String] + # OData filter options. + ${Filter}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Get = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationEvent_Get'; + GetViaIdentity = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationEvent_GetViaIdentity'; + List = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationEvent_List'; + } + if (('Get', 'List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Gets the details of an Azure Site Recovery fabric. +.Description +Gets the details of an Azure Site Recovery fabric. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabric +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/get-azsiterecoveryreplicationfabric +#> +function Get-AzSiteRecoveryReplicationFabric { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabric])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Fabric name. + ${FabricName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='GetViaIdentity')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Query')] + [System.String] + # OData filter options. + ${Filter}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Get = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationFabric_Get'; + GetViaIdentity = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationFabric_GetViaIdentity'; + List = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationFabric_List'; + } + if (('Get', 'List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Get the details of an Azure Site Recovery job. +.Description +Get the details of an Azure Site Recovery job. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJob +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/get-azsiterecoveryreplicationjob +#> +function Get-AzSiteRecoveryReplicationJob { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJob])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Job identifier. + ${JobName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Query')] + [System.String] + # OData filter options. + ${Filter}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Get = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationJob_Get'; + GetViaIdentity = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationJob_GetViaIdentity'; + List = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationJob_List'; + } + if (('Get', 'List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Gets the details of a logical network. +.Description +Gets the details of a logical network. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetwork +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/get-azsiterecoveryreplicationlogicalnetwork +#> +function Get-AzSiteRecoveryReplicationLogicalNetwork { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetwork])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Server Id. + ${FabricName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Logical network name. + ${LogicalNetworkName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Get = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationLogicalNetwork_Get'; + GetViaIdentity = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationLogicalNetwork_GetViaIdentity'; + List = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationLogicalNetwork_List'; + } + if (('Get', 'List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Gets the details of a migration item. +.Description +Gets the details of a migration item. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/get-azsiterecoveryreplicationmigrationitem +#> +function Get-AzSiteRecoveryReplicationMigrationItem { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem])] +[CmdletBinding(DefaultParameterSetName='List1', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Fabric unique name. + ${FabricName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Migration item name. + ${MigrationItemName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Protection container name. + ${ProtectionContainerName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Parameter(ParameterSetName='List1', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Parameter(ParameterSetName='List1', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Parameter(ParameterSetName='List1')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='List')] + [Parameter(ParameterSetName='List1')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Query')] + [System.String] + # OData filter options. + ${Filter}, + + [Parameter(ParameterSetName='List')] + [Parameter(ParameterSetName='List1')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Query')] + [System.String] + # The pagination token. + ${SkipToken}, + + [Parameter(ParameterSetName='List')] + [Parameter(ParameterSetName='List1')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Query')] + [System.String] + # The page size. + ${TakeToken}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Get = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationMigrationItem_Get'; + GetViaIdentity = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationMigrationItem_GetViaIdentity'; + List = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationMigrationItem_List'; + List1 = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationMigrationItem_List1'; + } + if (('Get', 'List', 'List1') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Gets the details of an ASR network mapping. +.Description +Gets the details of an ASR network mapping. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMapping +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/get-azsiterecoveryreplicationnetworkmapping +#> +function Get-AzSiteRecoveryReplicationNetworkMapping { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMapping])] +[CmdletBinding(DefaultParameterSetName='List1', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Primary fabric name. + ${FabricName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Network mapping name. + ${NetworkMappingName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Primary network name. + ${NetworkName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Parameter(ParameterSetName='List1', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Parameter(ParameterSetName='List1', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Parameter(ParameterSetName='List1')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Get = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationNetworkMapping_Get'; + GetViaIdentity = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationNetworkMapping_GetViaIdentity'; + List = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationNetworkMapping_List'; + List1 = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationNetworkMapping_List1'; + } + if (('Get', 'List', 'List1') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Gets the details of a network. +.Description +Gets the details of a network. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetwork +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/get-azsiterecoveryreplicationnetwork +#> +function Get-AzSiteRecoveryReplicationNetwork { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetwork])] +[CmdletBinding(DefaultParameterSetName='List1', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Server Id. + ${FabricName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Primary network name. + ${NetworkName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Parameter(ParameterSetName='List1', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Parameter(ParameterSetName='List1', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Parameter(ParameterSetName='List1')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Get = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationNetwork_Get'; + GetViaIdentity = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationNetwork_GetViaIdentity'; + List = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationNetwork_List'; + List1 = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationNetwork_List1'; + } + if (('Get', 'List', 'List1') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Gets the details of a replication policy. +.Description +Gets the details of a replication policy. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicy +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/get-azsiterecoveryreplicationpolicy +#> +function Get-AzSiteRecoveryReplicationPolicy { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicy])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Replication policy name. + ${PolicyName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Get = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationPolicy_Get'; + GetViaIdentity = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationPolicy_GetViaIdentity'; + List = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationPolicy_List'; + } + if (('Get', 'List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +The operation to get the details of a protectable item. +.Description +The operation to get the details of a protectable item. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItem +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/get-azsiterecoveryreplicationprotectableitem +#> +function Get-AzSiteRecoveryReplicationProtectableItem { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItem])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Fabric name. + ${FabricName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Protectable item name. + ${ProtectableItemName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Protection container name. + ${ProtectionContainerName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Query')] + [System.String] + # OData filter options. + ${Filter}, + + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Query')] + [System.String] + # skipToken OData query parameter. + ${SkipToken}, + + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Query')] + [System.String] + # take OData query parameter. + ${Take}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Get = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationProtectableItem_Get'; + GetViaIdentity = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationProtectableItem_GetViaIdentity'; + List = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationProtectableItem_List'; + } + if (('Get', 'List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Gets the details of an ASR replication protected item. +.Description +Gets the details of an ASR replication protected item. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/get-azsiterecoveryreplicationprotecteditem +#> +function Get-AzSiteRecoveryReplicationProtectedItem { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem])] +[CmdletBinding(DefaultParameterSetName='List1', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Fabric unique name. + ${FabricName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Protection container name. + ${ProtectionContainerName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Replication protected item name. + ${ReplicatedProtectedItemName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Parameter(ParameterSetName='List1', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Parameter(ParameterSetName='List1', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Parameter(ParameterSetName='List1')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='List1')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Query')] + [System.String] + # OData filter options. + ${Filter}, + + [Parameter(ParameterSetName='List1')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Query')] + [System.String] + # The pagination token. + # Possible values: "FabricId" or "FabricId_CloudId" or null. + ${SkipToken}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Get = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationProtectedItem_Get'; + GetViaIdentity = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationProtectedItem_GetViaIdentity'; + List = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationProtectedItem_List'; + List1 = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationProtectedItem_List1'; + } + if (('Get', 'List', 'List1') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Gets the details of a protection container mapping. +.Description +Gets the details of a protection container mapping. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMapping +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/get-azsiterecoveryreplicationprotectioncontainermapping +#> +function Get-AzSiteRecoveryReplicationProtectionContainerMapping { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMapping])] +[CmdletBinding(DefaultParameterSetName='List1', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Fabric name. + ${FabricName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Protection Container mapping name. + ${MappingName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Protection container name. + ${ProtectionContainerName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Parameter(ParameterSetName='List1', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Parameter(ParameterSetName='List1', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Parameter(ParameterSetName='List1')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Get = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationProtectionContainerMapping_Get'; + GetViaIdentity = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationProtectionContainerMapping_GetViaIdentity'; + List = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationProtectionContainerMapping_List'; + List1 = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationProtectionContainerMapping_List1'; + } + if (('Get', 'List', 'List1') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Gets the details of a protection container. +.Description +Gets the details of a protection container. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainer +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/get-azsiterecoveryreplicationprotectioncontainer +#> +function Get-AzSiteRecoveryReplicationProtectionContainer { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainer])] +[CmdletBinding(DefaultParameterSetName='List1', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Fabric name. + ${FabricName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Protection container name. + ${ProtectionContainerName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Parameter(ParameterSetName='List1', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Parameter(ParameterSetName='List1', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Parameter(ParameterSetName='List1')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Get = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationProtectionContainer_Get'; + GetViaIdentity = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationProtectionContainer_GetViaIdentity'; + List = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationProtectionContainer_List'; + List1 = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationProtectionContainer_List1'; + } + if (('Get', 'List', 'List1') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Gets the details of an ASR replication protection intent. +.Description +Gets the details of an ASR replication protection intent. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntent +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/get-azsiterecoveryreplicationprotectionintent +#> +function Get-AzSiteRecoveryReplicationProtectionIntent { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntent])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Replication protection intent name. + ${IntentObjectName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Query')] + [System.String] + # The pagination token. + ${SkipToken}, + + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Query')] + [System.String] + # The page size. + ${TakeToken}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Get = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationProtectionIntent_Get'; + GetViaIdentity = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationProtectionIntent_GetViaIdentity'; + List = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationProtectionIntent_List'; + } + if (('Get', 'List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Gets the details of the recovery plan. +.Description +Gets the details of the recovery plan. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/get-azsiterecoveryreplicationrecoveryplan +#> +function Get-AzSiteRecoveryReplicationRecoveryPlan { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Name of the recovery plan. + ${RecoveryPlanName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Get = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationRecoveryPlan_Get'; + GetViaIdentity = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationRecoveryPlan_GetViaIdentity'; + List = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationRecoveryPlan_List'; + } + if (('Get', 'List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Lists the registered recovery services providers for the specified fabric. +.Description +Lists the registered recovery services providers for the specified fabric. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProvider +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/get-azsiterecoveryreplicationrecoveryserviceprovider +#> +function Get-AzSiteRecoveryReplicationRecoveryServiceProvider { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProvider])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Fabric name. + ${FabricName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The subscription Id. + ${SubscriptionId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + List = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationRecoveryServiceProvider_List'; + } + if (('List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Gets the details of registered recovery services provider. +.Description +Gets the details of registered recovery services provider. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProvider +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/get-azsiterecoveryreplicationrecoveryservicesprovider +#> +function Get-AzSiteRecoveryReplicationRecoveryServicesProvider { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProvider])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Fabric name. + ${FabricName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Recovery services provider name. + ${ProviderName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Get = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationRecoveryServicesProvider_Get'; + GetViaIdentity = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationRecoveryServicesProvider_GetViaIdentity'; + List = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationRecoveryServicesProvider_List'; + } + if (('Get', 'List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Gets the details of the specified storage classification mapping. +.Description +Gets the details of the specified storage classification mapping. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMapping +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/get-azsiterecoveryreplicationstorageclassificationmapping +#> +function Get-AzSiteRecoveryReplicationStorageClassificationMapping { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMapping])] +[CmdletBinding(DefaultParameterSetName='List1', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Fabric name. + ${FabricName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Parameter(ParameterSetName='List1', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Parameter(ParameterSetName='List1', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Storage classification mapping name. + ${StorageClassificationMappingName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Storage classification name. + ${StorageClassificationName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Parameter(ParameterSetName='List1')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Get = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationStorageClassificationMapping_Get'; + GetViaIdentity = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationStorageClassificationMapping_GetViaIdentity'; + List = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationStorageClassificationMapping_List'; + List1 = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationStorageClassificationMapping_List1'; + } + if (('Get', 'List', 'List1') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Gets the details of the specified storage classification. +.Description +Gets the details of the specified storage classification. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassification +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/get-azsiterecoveryreplicationstorageclassification +#> +function Get-AzSiteRecoveryReplicationStorageClassification { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassification])] +[CmdletBinding(DefaultParameterSetName='List1', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Fabric name. + ${FabricName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Parameter(ParameterSetName='List1', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Parameter(ParameterSetName='List1', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Storage classification name. + ${StorageClassificationName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Parameter(ParameterSetName='List1')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Get = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationStorageClassification_Get'; + GetViaIdentity = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationStorageClassification_GetViaIdentity'; + List = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationStorageClassification_List'; + List1 = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationStorageClassification_List1'; + } + if (('Get', 'List', 'List1') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Gets the health details of the vault. +.Description +Gets the health details of the vault. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthDetails +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/get-azsiterecoveryreplicationvaulthealth +#> +function Get-AzSiteRecoveryReplicationVaultHealth { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthDetails])] +[CmdletBinding(DefaultParameterSetName='Get', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Get')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Get = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationVaultHealth_Get'; + GetViaIdentity = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationVaultHealth_GetViaIdentity'; + } + if (('Get') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Gets the vault setting. +This includes the Migration Hub connection settings. +.Description +Gets the vault setting. +This includes the Migration Hub connection settings. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSetting +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/get-azsiterecoveryreplicationvaultsetting +#> +function Get-AzSiteRecoveryReplicationVaultSetting { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSetting])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Vault setting name. + ${VaultSettingName}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Get = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationVaultSetting_Get'; + GetViaIdentity = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationVaultSetting_GetViaIdentity'; + List = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationVaultSetting_List'; + } + if (('Get', 'List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Gets the details of a registered vCenter server(Add vCenter server). +.Description +Gets the details of a registered vCenter server(Add vCenter server). +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenter +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/get-azsiterecoveryreplicationvcenter +#> +function Get-AzSiteRecoveryReplicationvCenter { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenter])] +[CmdletBinding(DefaultParameterSetName='List1', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Fabric name. + ${FabricName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Parameter(ParameterSetName='List1', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Parameter(ParameterSetName='List1', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Parameter(ParameterSetName='List1')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # vcenter name. + ${VcenterName}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Get = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationvCenter_Get'; + GetViaIdentity = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationvCenter_GetViaIdentity'; + List = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationvCenter_List'; + List1 = 'Az.SiteRecovery.private\Get-AzSiteRecoveryReplicationvCenter_List1'; + } + if (('Get', 'List', 'List1') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Gets the data of supported operating systems by SRS. +.Description +Gets the data of supported operating systems by SRS. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOperatingSystems +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/get-azsiterecoverysupportedoperatingsystem +#> +function Get-AzSiteRecoverySupportedOperatingSystem { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOperatingSystems])] +[CmdletBinding(DefaultParameterSetName='Get', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Get')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Query')] + [System.String] + # The instance type. + ${InstanceType}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Get = 'Az.SiteRecovery.private\Get-AzSiteRecoverySupportedOperatingSystem_Get'; + GetViaIdentity = 'Az.SiteRecovery.private\Get-AzSiteRecoverySupportedOperatingSystem_GetViaIdentity'; + } + if (('Get') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Lists the available target compute sizes for a replication protected item. +.Description +Lists the available target compute sizes for a replication protected item. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSize +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/get-azsiterecoverytargetcomputesize +#> +function Get-AzSiteRecoveryTargetComputeSize { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSize])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Fabric name. + ${FabricName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # protection container name. + ${ProtectionContainerName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Replication protected item name. + ${ReplicatedProtectedItemName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The subscription Id. + ${SubscriptionId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + List = 'Az.SiteRecovery.private\Get-AzSiteRecoveryTargetComputeSize_List'; + } + if (('List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Operation to commit the failover of the replication protected item. +.Description +Operation to commit the failover of the replication protected item. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/invoke-azsiterecoverycommitreplicationprotecteditemfailover +#> +function Invoke-AzSiteRecoveryCommitReplicationProtectedItemFailover { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem])] +[CmdletBinding(DefaultParameterSetName='Commit', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Commit', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Unique fabric name. + ${FabricName}, + + [Parameter(ParameterSetName='Commit', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Protection container name. + ${ProtectionContainerName}, + + [Parameter(ParameterSetName='Commit', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Replication protected item name. + ${ReplicatedProtectedItemName}, + + [Parameter(ParameterSetName='Commit', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Commit', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Commit')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='CommitViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Commit = 'Az.SiteRecovery.private\Invoke-AzSiteRecoveryCommitReplicationProtectedItemFailover_Commit'; + CommitViaIdentity = 'Az.SiteRecovery.private\Invoke-AzSiteRecoveryCommitReplicationProtectedItemFailover_CommitViaIdentity'; + } + if (('Commit') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +The operation to commit the failover of a recovery plan. +.Description +The operation to commit the failover of a recovery plan. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/invoke-azsiterecoverycommitreplicationrecoveryplanfailover +#> +function Invoke-AzSiteRecoveryCommitReplicationRecoveryPlanFailover { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan])] +[CmdletBinding(DefaultParameterSetName='Commit', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Commit', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Recovery plan name. + ${RecoveryPlanName}, + + [Parameter(ParameterSetName='Commit', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Commit', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Commit')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='CommitViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Commit = 'Az.SiteRecovery.private\Invoke-AzSiteRecoveryCommitReplicationRecoveryPlanFailover_Commit'; + CommitViaIdentity = 'Az.SiteRecovery.private\Invoke-AzSiteRecoveryCommitReplicationRecoveryPlanFailover_CommitViaIdentity'; + } + if (('Commit') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Operation to initiate a planned failover of the replication protected item. +.Description +Operation to initiate a planned failover of the replication protected item. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverInput +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +FAILOVERINPUT : Input definition for planned failover. + [FailoverDirection ]: Failover direction. + [ProviderSpecificDetailInstanceType ]: The class type. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/invoke-azsiterecoveryplannedreplicationprotecteditemfailover +#> +function Invoke-AzSiteRecoveryPlannedReplicationProtectedItemFailover { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem])] +[CmdletBinding(DefaultParameterSetName='PlannedExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Planned', Mandatory)] + [Parameter(ParameterSetName='PlannedExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Unique fabric name. + ${FabricName}, + + [Parameter(ParameterSetName='Planned', Mandatory)] + [Parameter(ParameterSetName='PlannedExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Protection container name. + ${ProtectionContainerName}, + + [Parameter(ParameterSetName='Planned', Mandatory)] + [Parameter(ParameterSetName='PlannedExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Replication protected item name. + ${ReplicatedProtectedItemName}, + + [Parameter(ParameterSetName='Planned', Mandatory)] + [Parameter(ParameterSetName='PlannedExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Planned', Mandatory)] + [Parameter(ParameterSetName='PlannedExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Planned')] + [Parameter(ParameterSetName='PlannedExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='PlannedViaIdentity', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='PlannedViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='Planned', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='PlannedViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverInput] + # Input definition for planned failover. + # To construct, see NOTES section for FAILOVERINPUT properties and create a hash table. + ${FailoverInput}, + + [Parameter(ParameterSetName='PlannedExpanded')] + [Parameter(ParameterSetName='PlannedViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # Failover direction. + ${FailoverDirection}, + + [Parameter(ParameterSetName='PlannedExpanded')] + [Parameter(ParameterSetName='PlannedViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The class type. + ${ProviderSpecificDetailInstanceType}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Planned = 'Az.SiteRecovery.private\Invoke-AzSiteRecoveryPlannedReplicationProtectedItemFailover_Planned'; + PlannedExpanded = 'Az.SiteRecovery.private\Invoke-AzSiteRecoveryPlannedReplicationProtectedItemFailover_PlannedExpanded'; + PlannedViaIdentity = 'Az.SiteRecovery.private\Invoke-AzSiteRecoveryPlannedReplicationProtectedItemFailover_PlannedViaIdentity'; + PlannedViaIdentityExpanded = 'Az.SiteRecovery.private\Invoke-AzSiteRecoveryPlannedReplicationProtectedItemFailover_PlannedViaIdentityExpanded'; + } + if (('Planned', 'PlannedExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +The operation to start the planned failover of a recovery plan. +.Description +The operation to start the planned failover of a recovery plan. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPlannedFailoverInput +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUT : Recovery plan planned failover input. + FailoverDirection : The failover direction. + [ProviderSpecificDetail ]: The provider specific properties. + InstanceType : The class type. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. + +PROVIDERSPECIFICDETAIL : The provider specific properties. + InstanceType : The class type. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/invoke-azsiterecoveryplannedreplicationrecoveryplanfailover +#> +function Invoke-AzSiteRecoveryPlannedReplicationRecoveryPlanFailover { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan])] +[CmdletBinding(DefaultParameterSetName='PlannedExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Planned', Mandatory)] + [Parameter(ParameterSetName='PlannedExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Recovery plan name. + ${RecoveryPlanName}, + + [Parameter(ParameterSetName='Planned', Mandatory)] + [Parameter(ParameterSetName='PlannedExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Planned', Mandatory)] + [Parameter(ParameterSetName='PlannedExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Planned')] + [Parameter(ParameterSetName='PlannedExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='PlannedViaIdentity', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='PlannedViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='Planned', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='PlannedViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPlannedFailoverInput] + # Recovery plan planned failover input. + # To construct, see NOTES section for INPUT properties and create a hash table. + ${Input}, + + [Parameter(ParameterSetName='PlannedExpanded', Mandatory)] + [Parameter(ParameterSetName='PlannedViaIdentityExpanded', Mandatory)] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections])] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections] + # The failover direction. + ${FailoverDirection}, + + [Parameter(ParameterSetName='PlannedExpanded')] + [Parameter(ParameterSetName='PlannedViaIdentityExpanded')] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInput[]] + # The provider specific properties. + # To construct, see NOTES section for PROVIDERSPECIFICDETAIL properties and create a hash table. + ${ProviderSpecificDetail}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Planned = 'Az.SiteRecovery.private\Invoke-AzSiteRecoveryPlannedReplicationRecoveryPlanFailover_Planned'; + PlannedExpanded = 'Az.SiteRecovery.private\Invoke-AzSiteRecoveryPlannedReplicationRecoveryPlanFailover_PlannedExpanded'; + PlannedViaIdentity = 'Az.SiteRecovery.private\Invoke-AzSiteRecoveryPlannedReplicationRecoveryPlanFailover_PlannedViaIdentity'; + PlannedViaIdentityExpanded = 'Az.SiteRecovery.private\Invoke-AzSiteRecoveryPlannedReplicationRecoveryPlanFailover_PlannedViaIdentityExpanded'; + } + if (('Planned', 'PlannedExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Renews the connection certificate for the ASR replication fabric. +.Description +Renews the connection certificate for the ASR replication fabric. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRenewCertificateInput +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabric +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. + +RENEWCERTIFICATE : Certificate renewal input. + [RenewCertificateType ]: Renew certificate type. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/invoke-azsiterecoveryrenewreplicationfabriccertificate +#> +function Invoke-AzSiteRecoveryRenewReplicationFabricCertificate { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabric])] +[CmdletBinding(DefaultParameterSetName='RenewExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Renew', Mandatory)] + [Parameter(ParameterSetName='RenewExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # fabric name to renew certs for. + ${FabricName}, + + [Parameter(ParameterSetName='Renew', Mandatory)] + [Parameter(ParameterSetName='RenewExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Renew', Mandatory)] + [Parameter(ParameterSetName='RenewExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Renew')] + [Parameter(ParameterSetName='RenewExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='RenewViaIdentity', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='RenewViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='Renew', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='RenewViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRenewCertificateInput] + # Certificate renewal input. + # To construct, see NOTES section for RENEWCERTIFICATE properties and create a hash table. + ${RenewCertificate}, + + [Parameter(ParameterSetName='RenewExpanded')] + [Parameter(ParameterSetName='RenewViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # Renew certificate type. + ${RenewCertificateType}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Renew = 'Az.SiteRecovery.private\Invoke-AzSiteRecoveryRenewReplicationFabricCertificate_Renew'; + RenewExpanded = 'Az.SiteRecovery.private\Invoke-AzSiteRecoveryRenewReplicationFabricCertificate_RenewExpanded'; + RenewViaIdentity = 'Az.SiteRecovery.private\Invoke-AzSiteRecoveryRenewReplicationFabricCertificate_RenewViaIdentity'; + RenewViaIdentityExpanded = 'Az.SiteRecovery.private\Invoke-AzSiteRecoveryRenewReplicationFabricCertificate_RenewViaIdentityExpanded'; + } + if (('Renew', 'RenewExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Operation to reprotect or reverse replicate a failed over replication protected item. +.Description +Operation to reprotect or reverse replicate a failed over replication protected item. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationInput +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. + +REPROTECTINPUT : Reverse replication input. + [FailoverDirection ]: Failover direction. + [ProviderSpecificDetailInstanceType ]: The class type. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/invoke-azsiterecoveryreprotectreplicationprotecteditem +#> +function Invoke-AzSiteRecoveryReprotectReplicationProtectedItem { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem])] +[CmdletBinding(DefaultParameterSetName='ReprotectExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Reprotect', Mandatory)] + [Parameter(ParameterSetName='ReprotectExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Unique fabric name. + ${FabricName}, + + [Parameter(ParameterSetName='Reprotect', Mandatory)] + [Parameter(ParameterSetName='ReprotectExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Protection container name. + ${ProtectionContainerName}, + + [Parameter(ParameterSetName='Reprotect', Mandatory)] + [Parameter(ParameterSetName='ReprotectExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Replication protected item name. + ${ReplicatedProtectedItemName}, + + [Parameter(ParameterSetName='Reprotect', Mandatory)] + [Parameter(ParameterSetName='ReprotectExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Reprotect', Mandatory)] + [Parameter(ParameterSetName='ReprotectExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Reprotect')] + [Parameter(ParameterSetName='ReprotectExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='ReprotectViaIdentity', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='ReprotectViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='Reprotect', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='ReprotectViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationInput] + # Reverse replication input. + # To construct, see NOTES section for REPROTECTINPUT properties and create a hash table. + ${ReprotectInput}, + + [Parameter(ParameterSetName='ReprotectExpanded')] + [Parameter(ParameterSetName='ReprotectViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # Failover direction. + ${FailoverDirection}, + + [Parameter(ParameterSetName='ReprotectExpanded')] + [Parameter(ParameterSetName='ReprotectViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The class type. + ${ProviderSpecificDetailInstanceType}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Reprotect = 'Az.SiteRecovery.private\Invoke-AzSiteRecoveryReprotectReplicationProtectedItem_Reprotect'; + ReprotectExpanded = 'Az.SiteRecovery.private\Invoke-AzSiteRecoveryReprotectReplicationProtectedItem_ReprotectExpanded'; + ReprotectViaIdentity = 'Az.SiteRecovery.private\Invoke-AzSiteRecoveryReprotectReplicationProtectedItem_ReprotectViaIdentity'; + ReprotectViaIdentityExpanded = 'Az.SiteRecovery.private\Invoke-AzSiteRecoveryReprotectReplicationProtectedItem_ReprotectViaIdentityExpanded'; + } + if (('Reprotect', 'ReprotectExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +The operation to reprotect(reverse replicate) a recovery plan. +.Description +The operation to reprotect(reverse replicate) a recovery plan. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/invoke-azsiterecoveryreprotectreplicationrecoveryplan +#> +function Invoke-AzSiteRecoveryReprotectReplicationRecoveryPlan { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan])] +[CmdletBinding(DefaultParameterSetName='Reprotect', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Reprotect', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Recovery plan name. + ${RecoveryPlanName}, + + [Parameter(ParameterSetName='Reprotect', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Reprotect', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Reprotect')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='ReprotectViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Reprotect = 'Az.SiteRecovery.private\Invoke-AzSiteRecoveryReprotectReplicationRecoveryPlan_Reprotect'; + ReprotectViaIdentity = 'Az.SiteRecovery.private\Invoke-AzSiteRecoveryReprotectReplicationRecoveryPlan_ReprotectViaIdentity'; + } + if (('Reprotect') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +The operation to resynchronize replication of an ASR migration item. +.Description +The operation to resynchronize replication of an ASR migration item. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncInput +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUT : Resync input. + ProviderSpecificDetailInstanceType : The class type. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/invoke-azsiterecoveryresyncreplicationmigrationitem +#> +function Invoke-AzSiteRecoveryResyncReplicationMigrationItem { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem])] +[CmdletBinding(DefaultParameterSetName='ResyncExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Resync', Mandatory)] + [Parameter(ParameterSetName='ResyncExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Fabric name. + ${FabricName}, + + [Parameter(ParameterSetName='Resync', Mandatory)] + [Parameter(ParameterSetName='ResyncExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Migration item name. + ${MigrationItemName}, + + [Parameter(ParameterSetName='Resync', Mandatory)] + [Parameter(ParameterSetName='ResyncExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Protection container name. + ${ProtectionContainerName}, + + [Parameter(ParameterSetName='Resync', Mandatory)] + [Parameter(ParameterSetName='ResyncExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Resync', Mandatory)] + [Parameter(ParameterSetName='ResyncExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Resync')] + [Parameter(ParameterSetName='ResyncExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='ResyncViaIdentity', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='ResyncViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='Resync', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='ResyncViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncInput] + # Resync input. + # To construct, see NOTES section for INPUT properties and create a hash table. + ${Input}, + + [Parameter(ParameterSetName='ResyncExpanded', Mandatory)] + [Parameter(ParameterSetName='ResyncViaIdentityExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The class type. + ${ProviderSpecificDetailInstanceType}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Resync = 'Az.SiteRecovery.private\Invoke-AzSiteRecoveryResyncReplicationMigrationItem_Resync'; + ResyncExpanded = 'Az.SiteRecovery.private\Invoke-AzSiteRecoveryResyncReplicationMigrationItem_ResyncExpanded'; + ResyncViaIdentity = 'Az.SiteRecovery.private\Invoke-AzSiteRecoveryResyncReplicationMigrationItem_ResyncViaIdentity'; + ResyncViaIdentityExpanded = 'Az.SiteRecovery.private\Invoke-AzSiteRecoveryResyncReplicationMigrationItem_ResyncViaIdentityExpanded'; + } + if (('Resync', 'ResyncExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Operation to initiate a failover of the replication protected item. +.Description +Operation to initiate a failover of the replication protected item. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverInput +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +FAILOVERINPUT : Input definition for unplanned failover. + [FailoverDirection ]: Failover direction. + [ProviderSpecificDetailInstanceType ]: The class type. + [SourceSiteOperation ]: Source site operations status. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/invoke-azsiterecoveryunplannedreplicationprotecteditemfailover +#> +function Invoke-AzSiteRecoveryUnplannedReplicationProtectedItemFailover { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem])] +[CmdletBinding(DefaultParameterSetName='UnplannedExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Unplanned', Mandatory)] + [Parameter(ParameterSetName='UnplannedExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Unique fabric name. + ${FabricName}, + + [Parameter(ParameterSetName='Unplanned', Mandatory)] + [Parameter(ParameterSetName='UnplannedExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Protection container name. + ${ProtectionContainerName}, + + [Parameter(ParameterSetName='Unplanned', Mandatory)] + [Parameter(ParameterSetName='UnplannedExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Replication protected item name. + ${ReplicatedProtectedItemName}, + + [Parameter(ParameterSetName='Unplanned', Mandatory)] + [Parameter(ParameterSetName='UnplannedExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Unplanned', Mandatory)] + [Parameter(ParameterSetName='UnplannedExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Unplanned')] + [Parameter(ParameterSetName='UnplannedExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='UnplannedViaIdentity', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='UnplannedViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='Unplanned', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='UnplannedViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverInput] + # Input definition for unplanned failover. + # To construct, see NOTES section for FAILOVERINPUT properties and create a hash table. + ${FailoverInput}, + + [Parameter(ParameterSetName='UnplannedExpanded')] + [Parameter(ParameterSetName='UnplannedViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # Failover direction. + ${FailoverDirection}, + + [Parameter(ParameterSetName='UnplannedExpanded')] + [Parameter(ParameterSetName='UnplannedViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The class type. + ${ProviderSpecificDetailInstanceType}, + + [Parameter(ParameterSetName='UnplannedExpanded')] + [Parameter(ParameterSetName='UnplannedViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # Source site operations status. + ${SourceSiteOperation}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Unplanned = 'Az.SiteRecovery.private\Invoke-AzSiteRecoveryUnplannedReplicationProtectedItemFailover_Unplanned'; + UnplannedExpanded = 'Az.SiteRecovery.private\Invoke-AzSiteRecoveryUnplannedReplicationProtectedItemFailover_UnplannedExpanded'; + UnplannedViaIdentity = 'Az.SiteRecovery.private\Invoke-AzSiteRecoveryUnplannedReplicationProtectedItemFailover_UnplannedViaIdentity'; + UnplannedViaIdentityExpanded = 'Az.SiteRecovery.private\Invoke-AzSiteRecoveryUnplannedReplicationProtectedItemFailover_UnplannedViaIdentityExpanded'; + } + if (('Unplanned', 'UnplannedExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +The operation to start the unplanned failover of a recovery plan. +.Description +The operation to start the unplanned failover of a recovery plan. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanUnplannedFailoverInput +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUT : Recovery plan unplanned failover input. + FailoverDirection : The failover direction. + SourceSiteOperation : A value indicating whether source site operations are required. + [ProviderSpecificDetail ]: The provider specific properties. + InstanceType : The class type. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. + +PROVIDERSPECIFICDETAIL : The provider specific properties. + InstanceType : The class type. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/invoke-azsiterecoveryunplannedreplicationrecoveryplanfailover +#> +function Invoke-AzSiteRecoveryUnplannedReplicationRecoveryPlanFailover { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan])] +[CmdletBinding(DefaultParameterSetName='UnplannedExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Unplanned', Mandatory)] + [Parameter(ParameterSetName='UnplannedExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Recovery plan name. + ${RecoveryPlanName}, + + [Parameter(ParameterSetName='Unplanned', Mandatory)] + [Parameter(ParameterSetName='UnplannedExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Unplanned', Mandatory)] + [Parameter(ParameterSetName='UnplannedExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Unplanned')] + [Parameter(ParameterSetName='UnplannedExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='UnplannedViaIdentity', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='UnplannedViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='Unplanned', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='UnplannedViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanUnplannedFailoverInput] + # Recovery plan unplanned failover input. + # To construct, see NOTES section for INPUT properties and create a hash table. + ${Input}, + + [Parameter(ParameterSetName='UnplannedExpanded', Mandatory)] + [Parameter(ParameterSetName='UnplannedViaIdentityExpanded', Mandatory)] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections])] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections] + # The failover direction. + ${FailoverDirection}, + + [Parameter(ParameterSetName='UnplannedExpanded', Mandatory)] + [Parameter(ParameterSetName='UnplannedViaIdentityExpanded', Mandatory)] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SourceSiteOperations])] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SourceSiteOperations] + # A value indicating whether source site operations are required. + ${SourceSiteOperation}, + + [Parameter(ParameterSetName='UnplannedExpanded')] + [Parameter(ParameterSetName='UnplannedViaIdentityExpanded')] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInput[]] + # The provider specific properties. + # To construct, see NOTES section for PROVIDERSPECIFICDETAIL properties and create a hash table. + ${ProviderSpecificDetail}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Unplanned = 'Az.SiteRecovery.private\Invoke-AzSiteRecoveryUnplannedReplicationRecoveryPlanFailover_Unplanned'; + UnplannedExpanded = 'Az.SiteRecovery.private\Invoke-AzSiteRecoveryUnplannedReplicationRecoveryPlanFailover_UnplannedExpanded'; + UnplannedViaIdentity = 'Az.SiteRecovery.private\Invoke-AzSiteRecoveryUnplannedReplicationRecoveryPlanFailover_UnplannedViaIdentity'; + UnplannedViaIdentityExpanded = 'Az.SiteRecovery.private\Invoke-AzSiteRecoveryUnplannedReplicationRecoveryPlanFailover_UnplannedViaIdentityExpanded'; + } + if (('Unplanned', 'UnplannedExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +The operation to move replications from a process server to another process server. +.Description +The operation to move replications from a process server to another process server. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverProcessServerRequest +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabric +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +FAILOVERPROCESSSERVERREQUEST : Request to failover a process server. + [ContainerName ]: The container identifier. + [SourceProcessServerId ]: The source process server. + [TargetProcessServerId ]: The new process server. + [UpdateType ]: A value for failover type. It can be systemlevel/serverlevel. + [VmsToMigrate ]: The VMS to migrate. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/move-azsiterecoveryreplicationfabricgateway +#> +function Move-AzSiteRecoveryReplicationFabricGateway { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabric])] +[CmdletBinding(DefaultParameterSetName='ReassociateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Reassociate', Mandatory)] + [Parameter(ParameterSetName='ReassociateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the fabric containing the process server. + ${FabricName}, + + [Parameter(ParameterSetName='Reassociate', Mandatory)] + [Parameter(ParameterSetName='ReassociateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Reassociate', Mandatory)] + [Parameter(ParameterSetName='ReassociateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Reassociate')] + [Parameter(ParameterSetName='ReassociateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='ReassociateViaIdentity', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='ReassociateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='Reassociate', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='ReassociateViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverProcessServerRequest] + # Request to failover a process server. + # To construct, see NOTES section for FAILOVERPROCESSSERVERREQUEST properties and create a hash table. + ${FailoverProcessServerRequest}, + + [Parameter(ParameterSetName='ReassociateExpanded')] + [Parameter(ParameterSetName='ReassociateViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The container identifier. + ${ContainerName}, + + [Parameter(ParameterSetName='ReassociateExpanded')] + [Parameter(ParameterSetName='ReassociateViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The source process server. + ${SourceProcessServerId}, + + [Parameter(ParameterSetName='ReassociateExpanded')] + [Parameter(ParameterSetName='ReassociateViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The new process server. + ${TargetProcessServerId}, + + [Parameter(ParameterSetName='ReassociateExpanded')] + [Parameter(ParameterSetName='ReassociateViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # A value for failover type. + # It can be systemlevel/serverlevel. + ${UpdateType}, + + [Parameter(ParameterSetName='ReassociateExpanded')] + [Parameter(ParameterSetName='ReassociateViaIdentityExpanded')] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String[]] + # The VMS to migrate. + ${VmsToMigrate}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Reassociate = 'Az.SiteRecovery.private\Move-AzSiteRecoveryReplicationFabricGateway_Reassociate'; + ReassociateExpanded = 'Az.SiteRecovery.private\Move-AzSiteRecoveryReplicationFabricGateway_ReassociateExpanded'; + ReassociateViaIdentity = 'Az.SiteRecovery.private\Move-AzSiteRecoveryReplicationFabricGateway_ReassociateViaIdentity'; + ReassociateViaIdentityExpanded = 'Az.SiteRecovery.private\Move-AzSiteRecoveryReplicationFabricGateway_ReassociateViaIdentityExpanded'; + } + if (('Reassociate', 'ReassociateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +The operation to migrate an Azure Site Recovery fabric to AAD. +.Description +The operation to migrate an Azure Site Recovery fabric to AAD. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +System.Boolean +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/move-azsiterecoveryreplicationfabrictoaad +#> +function Move-AzSiteRecoveryReplicationFabricToAad { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Migrate', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Migrate', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # ASR fabric to migrate. + ${FabricName}, + + [Parameter(ParameterSetName='Migrate', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Migrate', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Migrate')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='MigrateViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Migrate = 'Az.SiteRecovery.private\Move-AzSiteRecoveryReplicationFabricToAad_Migrate'; + MigrateViaIdentity = 'Az.SiteRecovery.private\Move-AzSiteRecoveryReplicationFabricToAad_MigrateViaIdentity'; + } + if (('Migrate') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +The operation to initiate migration of the item. +.Description +The operation to initiate migration of the item. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateInput +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. + +MIGRATEINPUT : Input for migrate. + ProviderSpecificDetailInstanceType : The class type. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/move-azsiterecoveryreplicationmigrationitem +#> +function Move-AzSiteRecoveryReplicationMigrationItem { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem])] +[CmdletBinding(DefaultParameterSetName='MigrateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Migrate', Mandatory)] + [Parameter(ParameterSetName='MigrateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Fabric name. + ${FabricName}, + + [Parameter(ParameterSetName='Migrate', Mandatory)] + [Parameter(ParameterSetName='MigrateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Migration item name. + ${MigrationItemName}, + + [Parameter(ParameterSetName='Migrate', Mandatory)] + [Parameter(ParameterSetName='MigrateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Protection container name. + ${ProtectionContainerName}, + + [Parameter(ParameterSetName='Migrate', Mandatory)] + [Parameter(ParameterSetName='MigrateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Migrate', Mandatory)] + [Parameter(ParameterSetName='MigrateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Migrate')] + [Parameter(ParameterSetName='MigrateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='MigrateViaIdentity', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='MigrateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='Migrate', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='MigrateViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateInput] + # Input for migrate. + # To construct, see NOTES section for MIGRATEINPUT properties and create a hash table. + ${MigrateInput}, + + [Parameter(ParameterSetName='MigrateExpanded', Mandatory)] + [Parameter(ParameterSetName='MigrateViaIdentityExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The class type. + ${ProviderSpecificDetailInstanceType}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Migrate = 'Az.SiteRecovery.private\Move-AzSiteRecoveryReplicationMigrationItem_Migrate'; + MigrateExpanded = 'Az.SiteRecovery.private\Move-AzSiteRecoveryReplicationMigrationItem_MigrateExpanded'; + MigrateViaIdentity = 'Az.SiteRecovery.private\Move-AzSiteRecoveryReplicationMigrationItem_MigrateViaIdentity'; + MigrateViaIdentityExpanded = 'Az.SiteRecovery.private\Move-AzSiteRecoveryReplicationMigrationItem_MigrateViaIdentityExpanded'; + } + if (('Migrate', 'MigrateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Create or update an email notification(alert) configuration. +.Description +Create or update an email notification(alert) configuration. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlert +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/new-azsiterecoveryreplicationalertsetting +#> +function New-AzSiteRecoveryReplicationAlertSetting { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlert])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the email notification(alert) configuration. + ${AlertSettingName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String[]] + # The custom email address for sending emails. + ${CustomEmailAddress}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The locale for the email notification. + ${Locale}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # A value indicating whether to send email to subscription administrator. + ${SendToOwner}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + CreateExpanded = 'Az.SiteRecovery.private\New-AzSiteRecoveryReplicationAlertSetting_CreateExpanded'; + } + if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +The operation to create an Azure Site Recovery fabric (for e.g. +Hyper-V site). +.Description +The operation to create an Azure Site Recovery fabric (for e.g. +Hyper-V site). +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabric +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/new-azsiterecoveryreplicationfabric +#> +function New-AzSiteRecoveryReplicationFabric { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabric])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Name of the ASR fabric. + ${FabricName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # Gets the class type. + ${CustomDetailInstanceType}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + CreateExpanded = 'Az.SiteRecovery.private\New-AzSiteRecoveryReplicationFabric_CreateExpanded'; + } + if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +The operation to create an ASR migration item (enable migration). +.Description +The operation to create an ASR migration item (enable migration). +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/new-azsiterecoveryreplicationmigrationitem +#> +function New-AzSiteRecoveryReplicationMigrationItem { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Fabric name. + ${FabricName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Migration item name. + ${MigrationItemName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Protection container name. + ${ProtectionContainerName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The policy Id. + ${PolicyId}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The class type. + ${ProviderSpecificDetailInstanceType}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + CreateExpanded = 'Az.SiteRecovery.private\New-AzSiteRecoveryReplicationMigrationItem_CreateExpanded'; + } + if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +The operation to create an ASR network mapping. +.Description +The operation to create an ASR network mapping. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMapping +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/new-azsiterecoveryreplicationnetworkmapping +#> +function New-AzSiteRecoveryReplicationNetworkMapping { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMapping])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Primary fabric name. + ${FabricName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Network mapping name. + ${NetworkMappingName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Primary network name. + ${NetworkName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # Recovery network Id. + ${RecoveryNetworkId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The instance type. + ${FabricSpecificDetailInstanceType}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # Recovery fabric Name. + ${RecoveryFabricName}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + CreateExpanded = 'Az.SiteRecovery.private\New-AzSiteRecoveryReplicationNetworkMapping_CreateExpanded'; + } + if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +The operation to create a replication policy. +.Description +The operation to create a replication policy. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicy +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/new-azsiterecoveryreplicationpolicy +#> +function New-AzSiteRecoveryReplicationPolicy { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicy])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Replication policy name. + ${PolicyName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The class type. + ${ProviderSpecificInputInstanceType}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + CreateExpanded = 'Az.SiteRecovery.private\New-AzSiteRecoveryReplicationPolicy_CreateExpanded'; + } + if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +The operation to create an ASR replication protected item (Enable replication). +.Description +The operation to create an ASR replication protected item (Enable replication). +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/new-azsiterecoveryreplicationprotecteditem +#> +function New-AzSiteRecoveryReplicationProtectedItem { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Name of the fabric. + ${FabricName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Protection container name. + ${ProtectionContainerName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # A name for the replication protected item. + ${ReplicatedProtectedItemName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The Policy Id. + ${PolicyId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The protectable item Id. + ${ProtectableItemId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The class type. + ${ProviderSpecificDetailInstanceType}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + CreateExpanded = 'Az.SiteRecovery.private\New-AzSiteRecoveryReplicationProtectedItem_CreateExpanded'; + } + if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +The operation to create a protection container mapping. +.Description +The operation to create a protection container mapping. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMapping +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/new-azsiterecoveryreplicationprotectioncontainermapping +#> +function New-AzSiteRecoveryReplicationProtectionContainerMapping { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMapping])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Fabric name. + ${FabricName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Protection container mapping name. + ${MappingName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Protection container name. + ${ProtectionContainerName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # Applicable policy. + ${PolicyId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The class type. + ${ProviderSpecificInputInstanceType}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The target unique protection container name. + ${TargetProtectionContainerId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + CreateExpanded = 'Az.SiteRecovery.private\New-AzSiteRecoveryReplicationProtectionContainerMapping_CreateExpanded'; + } + if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Operation to create a protection container. +.Description +Operation to create a protection container. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainer +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +PROVIDERSPECIFICINPUT : Provider specific inputs for container creation. + InstanceType : The class type. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/new-azsiterecoveryreplicationprotectioncontainer +#> +function New-AzSiteRecoveryReplicationProtectionContainer { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainer])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Unique fabric ARM name. + ${FabricName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Unique protection container ARM name. + ${ProtectionContainerName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerCreationInput[]] + # Provider specific inputs for container creation. + # To construct, see NOTES section for PROVIDERSPECIFICINPUT properties and create a hash table. + ${ProviderSpecificInput}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + CreateExpanded = 'Az.SiteRecovery.private\New-AzSiteRecoveryReplicationProtectionContainer_CreateExpanded'; + } + if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +The operation to create an ASR replication protection intent item. +.Description +The operation to create an ASR replication protection intent item. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntent +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/new-azsiterecoveryreplicationprotectionintent +#> +function New-AzSiteRecoveryReplicationProtectionIntent { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntent])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # A name for the replication protection item. + ${IntentObjectName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The class type. + ${ProviderSpecificDetailInstanceType}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + CreateExpanded = 'Az.SiteRecovery.private\New-AzSiteRecoveryReplicationProtectionIntent_CreateExpanded'; + } + if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +The operation to create a recovery plan. +.Description +The operation to create a recovery plan. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +GROUP : The recovery plan groups. + GroupType : The group type. + [EndGroupAction ]: The end group actions. + ActionName : The action name. + CustomDetailInstanceType : Gets the type of action details (see RecoveryPlanActionDetailsTypes enum for possible values). + FailoverDirection : The list of failover directions. + FailoverType : The list of failover types. + [ReplicationProtectedItem ]: The list of protected items. + [Id ]: The ARM Id of the recovery plan protected item. + [VirtualMachineId ]: The virtual machine Id. + [StartGroupAction ]: The start group actions. + +PROVIDERSPECIFICINPUT : The provider specific input. + InstanceType : Gets the Instance type. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/new-azsiterecoveryreplicationrecoveryplan +#> +function New-AzSiteRecoveryReplicationRecoveryPlan { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Recovery plan name. + ${RecoveryPlanName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(Mandatory)] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroup[]] + # The recovery plan groups. + # To construct, see NOTES section for GROUP properties and create a hash table. + ${Group}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The primary fabric Id. + ${PrimaryFabricId}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The recovery fabric Id. + ${RecoveryFabricId}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.FailoverDeploymentModel])] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.FailoverDeploymentModel] + # The failover deployment model. + ${FailoverDeploymentModel}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificInput[]] + # The provider specific input. + # To construct, see NOTES section for PROVIDERSPECIFICINPUT properties and create a hash table. + ${ProviderSpecificInput}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + CreateExpanded = 'Az.SiteRecovery.private\New-AzSiteRecoveryReplicationRecoveryPlan_CreateExpanded'; + } + if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +The operation to add a recovery services provider. +.Description +The operation to add a recovery services provider. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProvider +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/new-azsiterecoveryreplicationrecoveryservicesprovider +#> +function New-AzSiteRecoveryReplicationRecoveryServicesProvider { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProvider])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Fabric name. + ${FabricName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Recovery services provider name. + ${ProviderName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The base authority for Azure Active Directory authentication. + ${AuthenticationIdentityInputAadAuthority}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The application/client Id for the service principal with which the on-premise management/data plane components would communicate with our Azure services. + ${AuthenticationIdentityInputApplicationId}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The intended Audience of the service principal with which the on-premise management/data plane components would communicate with our Azure services. + ${AuthenticationIdentityInputAudience}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The object Id of the service principal with which the on-premise management/data plane components would communicate with our Azure services. + ${AuthenticationIdentityInputObjectId}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The tenant Id for the service principal with which the on-premise management/data plane components would communicate with our Azure services. + ${AuthenticationIdentityInputTenantId}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The name of the machine where the provider is getting added. + ${MachineName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The base authority for Azure Active Directory authentication. + ${ResourceAccessIdentityInputAadAuthority}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The application/client Id for the service principal with which the on-premise management/data plane components would communicate with our Azure services. + ${ResourceAccessIdentityInputApplicationId}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The intended Audience of the service principal with which the on-premise management/data plane components would communicate with our Azure services. + ${ResourceAccessIdentityInputAudience}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The object Id of the service principal with which the on-premise management/data plane components would communicate with our Azure services. + ${ResourceAccessIdentityInputObjectId}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The tenant Id for the service principal with which the on-premise management/data plane components would communicate with our Azure services. + ${ResourceAccessIdentityInputTenantId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The Bios Id of the machine. + ${BiosId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The base authority for Azure Active Directory authentication. + ${DataPlaneAuthenticationIdentityInputAadAuthority}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The application/client Id for the service principal with which the on-premise management/data plane components would communicate with our Azure services. + ${DataPlaneAuthenticationIdentityInputApplicationId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The intended Audience of the service principal with which the on-premise management/data plane components would communicate with our Azure services. + ${DataPlaneAuthenticationIdentityInputAudience}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The object Id of the service principal with which the on-premise management/data plane components would communicate with our Azure services. + ${DataPlaneAuthenticationIdentityInputObjectId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The tenant Id for the service principal with which the on-premise management/data plane components would communicate with our Azure services. + ${DataPlaneAuthenticationIdentityInputTenantId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The Id of the machine where the provider is getting added. + ${MachineId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + CreateExpanded = 'Az.SiteRecovery.private\New-AzSiteRecoveryReplicationRecoveryServicesProvider_CreateExpanded'; + } + if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +The operation to create a storage classification mapping. +.Description +The operation to create a storage classification mapping. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMapping +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/new-azsiterecoveryreplicationstorageclassificationmapping +#> +function New-AzSiteRecoveryReplicationStorageClassificationMapping { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMapping])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Fabric name. + ${FabricName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Storage classification mapping name. + ${StorageClassificationMappingName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Storage classification name. + ${StorageClassificationName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The ID of the storage object. + ${TargetStorageClassificationId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + CreateExpanded = 'Az.SiteRecovery.private\New-AzSiteRecoveryReplicationStorageClassificationMapping_CreateExpanded'; + } + if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +The operation to configure vault setting. +.Description +The operation to configure vault setting. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSetting +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/new-azsiterecoveryreplicationvaultsetting +#> +function New-AzSiteRecoveryReplicationVaultSetting { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSetting])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Vault setting name. + ${VaultSettingName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The migration solution Id. + ${MigrationSolutionId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # VMware to Azure provider type. + ${VmwareToAzureProviderType}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + CreateExpanded = 'Az.SiteRecovery.private\New-AzSiteRecoveryReplicationVaultSetting_CreateExpanded'; + } + if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +The operation to create a vCenter object.. +.Description +The operation to create a vCenter object.. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenter +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/new-azsiterecoveryreplicationvcenter +#> +function New-AzSiteRecoveryReplicationvCenter { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenter])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Fabric name. + ${FabricName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # vcenter name. + ${VcenterName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The friendly name of the vCenter. + ${FriendlyName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The IP address of the vCenter to be discovered. + ${IPAddress}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The port number for discovery. + ${Port}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The process server Id from where the discovery is orchestrated. + ${ProcessServerId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The account Id which has privileges to discover the vCenter. + ${RunAsAccountId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + CreateExpanded = 'Az.SiteRecovery.private\New-AzSiteRecoveryReplicationvCenter_CreateExpanded'; + } + if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +The operation to delete or remove an Azure Site Recovery fabric. +.Description +The operation to delete or remove an Azure Site Recovery fabric. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +System.Boolean +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/remove-azsiterecoveryreplicationfabric +#> +function Remove-AzSiteRecoveryReplicationFabric { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # ASR fabric to delete. + ${FabricName}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Delete')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Delete = 'Az.SiteRecovery.private\Remove-AzSiteRecoveryReplicationFabric_Delete'; + DeleteViaIdentity = 'Az.SiteRecovery.private\Remove-AzSiteRecoveryReplicationFabric_DeleteViaIdentity'; + } + if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +The operation to delete an ASR migration item. +.Description +The operation to delete an ASR migration item. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +System.Boolean +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/remove-azsiterecoveryreplicationmigrationitem +#> +function Remove-AzSiteRecoveryReplicationMigrationItem { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Fabric name. + ${FabricName}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Migration item name. + ${MigrationItemName}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Protection container name. + ${ProtectionContainerName}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Delete')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Query')] + [System.String] + # The delete option. + ${DeleteOption}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Delete = 'Az.SiteRecovery.private\Remove-AzSiteRecoveryReplicationMigrationItem_Delete'; + DeleteViaIdentity = 'Az.SiteRecovery.private\Remove-AzSiteRecoveryReplicationMigrationItem_DeleteViaIdentity'; + } + if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +The operation to delete a network mapping. +.Description +The operation to delete a network mapping. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +System.Boolean +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/remove-azsiterecoveryreplicationnetworkmapping +#> +function Remove-AzSiteRecoveryReplicationNetworkMapping { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Primary fabric name. + ${FabricName}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # ARM Resource Name for network mapping. + ${NetworkMappingName}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Primary network name. + ${NetworkName}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Delete')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Delete = 'Az.SiteRecovery.private\Remove-AzSiteRecoveryReplicationNetworkMapping_Delete'; + DeleteViaIdentity = 'Az.SiteRecovery.private\Remove-AzSiteRecoveryReplicationNetworkMapping_DeleteViaIdentity'; + } + if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +The operation to delete a replication policy. +.Description +The operation to delete a replication policy. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +System.Boolean +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/remove-azsiterecoveryreplicationpolicy +#> +function Remove-AzSiteRecoveryReplicationPolicy { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Replication policy name. + ${PolicyName}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Delete')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Delete = 'Az.SiteRecovery.private\Remove-AzSiteRecoveryReplicationPolicy_Delete'; + DeleteViaIdentity = 'Az.SiteRecovery.private\Remove-AzSiteRecoveryReplicationPolicy_DeleteViaIdentity'; + } + if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Operation to remove disk(s) from the replication protected item. +.Description +Operation to remove disk(s) from the replication protected item. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksInput +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. + +REMOVEDISKSINPUT : Input for remove disk(s) operation. + [ProviderSpecificDetailInstanceType ]: The class type. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/remove-azsiterecoveryreplicationprotecteditemdisk +#> +function Remove-AzSiteRecoveryReplicationProtectedItemDisk { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem])] +[CmdletBinding(DefaultParameterSetName='RemoveExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Remove', Mandatory)] + [Parameter(ParameterSetName='RemoveExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Unique fabric name. + ${FabricName}, + + [Parameter(ParameterSetName='Remove', Mandatory)] + [Parameter(ParameterSetName='RemoveExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Protection container name. + ${ProtectionContainerName}, + + [Parameter(ParameterSetName='Remove', Mandatory)] + [Parameter(ParameterSetName='RemoveExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Replication protected item name. + ${ReplicatedProtectedItemName}, + + [Parameter(ParameterSetName='Remove', Mandatory)] + [Parameter(ParameterSetName='RemoveExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Remove', Mandatory)] + [Parameter(ParameterSetName='RemoveExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Remove')] + [Parameter(ParameterSetName='RemoveExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='RemoveViaIdentity', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='RemoveViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='Remove', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='RemoveViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksInput] + # Input for remove disk(s) operation. + # To construct, see NOTES section for REMOVEDISKSINPUT properties and create a hash table. + ${RemoveDisksInput}, + + [Parameter(ParameterSetName='RemoveExpanded')] + [Parameter(ParameterSetName='RemoveViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The class type. + ${ProviderSpecificDetailInstanceType}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Remove = 'Az.SiteRecovery.private\Remove-AzSiteRecoveryReplicationProtectedItemDisk_Remove'; + RemoveExpanded = 'Az.SiteRecovery.private\Remove-AzSiteRecoveryReplicationProtectedItemDisk_RemoveExpanded'; + RemoveViaIdentity = 'Az.SiteRecovery.private\Remove-AzSiteRecoveryReplicationProtectedItemDisk_RemoveViaIdentity'; + RemoveViaIdentityExpanded = 'Az.SiteRecovery.private\Remove-AzSiteRecoveryReplicationProtectedItemDisk_RemoveViaIdentityExpanded'; + } + if (('Remove', 'RemoveExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +The operation to disable replication on a replication protected item. +This will also remove the item. +.Description +The operation to disable replication on a replication protected item. +This will also remove the item. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionInput +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +System.Boolean +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +DISABLEPROTECTIONINPUT : Disable protection input. + [DisableProtectionReason ]: Disable protection reason. It can have values NotSpecified/MigrationComplete. + [ReplicationProviderInputInstanceType ]: The class type. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/remove-azsiterecoveryreplicationprotecteditem +#> +function Remove-AzSiteRecoveryReplicationProtectedItem { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='DeleteExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Delete', Mandatory)] + [Parameter(ParameterSetName='DeleteExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Fabric name. + ${FabricName}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Parameter(ParameterSetName='DeleteExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Protection container name. + ${ProtectionContainerName}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Parameter(ParameterSetName='DeleteExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Replication protected item name. + ${ReplicatedProtectedItemName}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Parameter(ParameterSetName='DeleteExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Parameter(ParameterSetName='DeleteExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Delete')] + [Parameter(ParameterSetName='DeleteExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='DeleteViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='Delete', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionInput] + # Disable protection input. + # To construct, see NOTES section for DISABLEPROTECTIONINPUT properties and create a hash table. + ${DisableProtectionInput}, + + [Parameter(ParameterSetName='DeleteExpanded')] + [Parameter(ParameterSetName='DeleteViaIdentityExpanded')] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DisableProtectionReason])] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DisableProtectionReason] + # Disable protection reason. + # It can have values NotSpecified/MigrationComplete. + ${DisableProtectionReason}, + + [Parameter(ParameterSetName='DeleteExpanded')] + [Parameter(ParameterSetName='DeleteViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The class type. + ${ReplicationProviderInputInstanceType}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Delete = 'Az.SiteRecovery.private\Remove-AzSiteRecoveryReplicationProtectedItem_Delete'; + DeleteExpanded = 'Az.SiteRecovery.private\Remove-AzSiteRecoveryReplicationProtectedItem_DeleteExpanded'; + DeleteViaIdentity = 'Az.SiteRecovery.private\Remove-AzSiteRecoveryReplicationProtectedItem_DeleteViaIdentity'; + DeleteViaIdentityExpanded = 'Az.SiteRecovery.private\Remove-AzSiteRecoveryReplicationProtectedItem_DeleteViaIdentityExpanded'; + } + if (('Delete', 'DeleteExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +The operation to delete or remove a protection container mapping. +.Description +The operation to delete or remove a protection container mapping. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveProtectionContainerMappingInput +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +System.Boolean +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. + +REMOVALINPUT : Container unpairing input. + [ProviderSpecificInputInstanceType ]: The class type. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/remove-azsiterecoveryreplicationprotectioncontainermapping +#> +function Remove-AzSiteRecoveryReplicationProtectionContainerMapping { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='DeleteExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Delete', Mandatory)] + [Parameter(ParameterSetName='DeleteExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Fabric name. + ${FabricName}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Parameter(ParameterSetName='DeleteExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Protection container mapping name. + ${MappingName}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Parameter(ParameterSetName='DeleteExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Protection container name. + ${ProtectionContainerName}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Parameter(ParameterSetName='DeleteExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Parameter(ParameterSetName='DeleteExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Delete')] + [Parameter(ParameterSetName='DeleteExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='DeleteViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='Delete', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveProtectionContainerMappingInput] + # Container unpairing input. + # To construct, see NOTES section for REMOVALINPUT properties and create a hash table. + ${RemovalInput}, + + [Parameter(ParameterSetName='DeleteExpanded')] + [Parameter(ParameterSetName='DeleteViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The class type. + ${ProviderSpecificInputInstanceType}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Delete = 'Az.SiteRecovery.private\Remove-AzSiteRecoveryReplicationProtectionContainerMapping_Delete'; + DeleteExpanded = 'Az.SiteRecovery.private\Remove-AzSiteRecoveryReplicationProtectionContainerMapping_DeleteExpanded'; + DeleteViaIdentity = 'Az.SiteRecovery.private\Remove-AzSiteRecoveryReplicationProtectionContainerMapping_DeleteViaIdentity'; + DeleteViaIdentityExpanded = 'Az.SiteRecovery.private\Remove-AzSiteRecoveryReplicationProtectionContainerMapping_DeleteViaIdentityExpanded'; + } + if (('Delete', 'DeleteExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Operation to remove a protection container. +.Description +Operation to remove a protection container. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +System.Boolean +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/remove-azsiterecoveryreplicationprotectioncontainer +#> +function Remove-AzSiteRecoveryReplicationProtectionContainer { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Unique fabric ARM name. + ${FabricName}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Unique protection container ARM name. + ${ProtectionContainerName}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Delete')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Delete = 'Az.SiteRecovery.private\Remove-AzSiteRecoveryReplicationProtectionContainer_Delete'; + DeleteViaIdentity = 'Az.SiteRecovery.private\Remove-AzSiteRecoveryReplicationProtectionContainer_DeleteViaIdentity'; + } + if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Delete a recovery plan. +.Description +Delete a recovery plan. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +System.Boolean +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/remove-azsiterecoveryreplicationrecoveryplan +#> +function Remove-AzSiteRecoveryReplicationRecoveryPlan { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Recovery plan name. + ${RecoveryPlanName}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Delete')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Delete = 'Az.SiteRecovery.private\Remove-AzSiteRecoveryReplicationRecoveryPlan_Delete'; + DeleteViaIdentity = 'Az.SiteRecovery.private\Remove-AzSiteRecoveryReplicationRecoveryPlan_DeleteViaIdentity'; + } + if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +The operation to removes/delete(unregister) a recovery services provider from the vault. +.Description +The operation to removes/delete(unregister) a recovery services provider from the vault. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +System.Boolean +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/remove-azsiterecoveryreplicationrecoveryservicesprovider +#> +function Remove-AzSiteRecoveryReplicationRecoveryServicesProvider { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Fabric name. + ${FabricName}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Recovery services provider name. + ${ProviderName}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Delete')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Delete = 'Az.SiteRecovery.private\Remove-AzSiteRecoveryReplicationRecoveryServicesProvider_Delete'; + DeleteViaIdentity = 'Az.SiteRecovery.private\Remove-AzSiteRecoveryReplicationRecoveryServicesProvider_DeleteViaIdentity'; + } + if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +The operation to delete a storage classification mapping. +.Description +The operation to delete a storage classification mapping. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +System.Boolean +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/remove-azsiterecoveryreplicationstorageclassificationmapping +#> +function Remove-AzSiteRecoveryReplicationStorageClassificationMapping { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Fabric name. + ${FabricName}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Storage classification mapping name. + ${StorageClassificationMappingName}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Storage classification name. + ${StorageClassificationName}, + + [Parameter(ParameterSetName='Delete')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Delete = 'Az.SiteRecovery.private\Remove-AzSiteRecoveryReplicationStorageClassificationMapping_Delete'; + DeleteViaIdentity = 'Az.SiteRecovery.private\Remove-AzSiteRecoveryReplicationStorageClassificationMapping_DeleteViaIdentity'; + } + if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +The operation to remove(unregister) a registered vCenter server from the vault. +.Description +The operation to remove(unregister) a registered vCenter server from the vault. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +System.Boolean +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/remove-azsiterecoveryreplicationvcenter +#> +function Remove-AzSiteRecoveryReplicationvCenter { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Fabric name. + ${FabricName}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Delete')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # vcenter name. + ${VcenterName}, + + [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Delete = 'Az.SiteRecovery.private\Remove-AzSiteRecoveryReplicationvCenter_Delete'; + DeleteViaIdentity = 'Az.SiteRecovery.private\Remove-AzSiteRecoveryReplicationvCenter_DeleteViaIdentity'; + } + if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +The operation to start resynchronize/repair replication for a replication protected item requiring resynchronization. +.Description +The operation to start resynchronize/repair replication for a replication protected item requiring resynchronization. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/repair-azsiterecoveryreplicationprotecteditemreplication +#> +function Repair-AzSiteRecoveryReplicationProtectedItemReplication { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem])] +[CmdletBinding(DefaultParameterSetName='Repair', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Repair', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the fabric. + ${FabricName}, + + [Parameter(ParameterSetName='Repair', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the container. + ${ProtectionContainerName}, + + [Parameter(ParameterSetName='Repair', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the replication protected item. + ${ReplicatedProtectedItemName}, + + [Parameter(ParameterSetName='Repair', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Repair', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Repair')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='RepairViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Repair = 'Az.SiteRecovery.private\Repair-AzSiteRecoveryReplicationProtectedItemReplication_Repair'; + RepairViaIdentity = 'Az.SiteRecovery.private\Repair-AzSiteRecoveryReplicationProtectedItemReplication_RepairViaIdentity'; + } + if (('Repair') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Operation to resolve health issues of the replication protected item. +.Description +Operation to resolve health issues of the replication protected item. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResolveHealthInput +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +HEALTHERROR : Health errors. + [HealthErrorId ]: Health error id. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. + +RESOLVEHEALTHINPUT : Resolve health input. + [HealthError ]: Health errors. + [HealthErrorId ]: Health error id. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/resolve-azsiterecoveryreplicationprotecteditemhealtherror +#> +function Resolve-AzSiteRecoveryReplicationProtectedItemHealthError { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem])] +[CmdletBinding(DefaultParameterSetName='ResolveExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Resolve', Mandatory)] + [Parameter(ParameterSetName='ResolveExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Unique fabric name. + ${FabricName}, + + [Parameter(ParameterSetName='Resolve', Mandatory)] + [Parameter(ParameterSetName='ResolveExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Protection container name. + ${ProtectionContainerName}, + + [Parameter(ParameterSetName='Resolve', Mandatory)] + [Parameter(ParameterSetName='ResolveExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Replication protected item name. + ${ReplicatedProtectedItemName}, + + [Parameter(ParameterSetName='Resolve', Mandatory)] + [Parameter(ParameterSetName='ResolveExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Resolve', Mandatory)] + [Parameter(ParameterSetName='ResolveExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Resolve')] + [Parameter(ParameterSetName='ResolveExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='ResolveViaIdentity', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='ResolveViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='Resolve', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='ResolveViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResolveHealthInput] + # Resolve health input. + # To construct, see NOTES section for RESOLVEHEALTHINPUT properties and create a hash table. + ${ResolveHealthInput}, + + [Parameter(ParameterSetName='ResolveExpanded')] + [Parameter(ParameterSetName='ResolveViaIdentityExpanded')] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResolveHealthError[]] + # Health errors. + # To construct, see NOTES section for HEALTHERROR properties and create a hash table. + ${HealthError}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Resolve = 'Az.SiteRecovery.private\Resolve-AzSiteRecoveryReplicationProtectedItemHealthError_Resolve'; + ResolveExpanded = 'Az.SiteRecovery.private\Resolve-AzSiteRecoveryReplicationProtectedItemHealthError_ResolveExpanded'; + ResolveViaIdentity = 'Az.SiteRecovery.private\Resolve-AzSiteRecoveryReplicationProtectedItemHealthError_ResolveViaIdentity'; + ResolveViaIdentityExpanded = 'Az.SiteRecovery.private\Resolve-AzSiteRecoveryReplicationProtectedItemHealthError_ResolveViaIdentityExpanded'; + } + if (('Resolve', 'ResolveExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +The operation to restart an Azure Site Recovery job. +.Description +The operation to restart an Azure Site Recovery job. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJob +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/restart-azsiterecoveryreplicationjob +#> +function Restart-AzSiteRecoveryReplicationJob { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJob])] +[CmdletBinding(DefaultParameterSetName='Restart', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Restart', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Job identifier. + ${JobName}, + + [Parameter(ParameterSetName='Restart', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Restart', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Restart')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='RestartViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Restart = 'Az.SiteRecovery.private\Restart-AzSiteRecoveryReplicationJob_Restart'; + RestartViaIdentity = 'Az.SiteRecovery.private\Restart-AzSiteRecoveryReplicationJob_RestartViaIdentity'; + } + if (('Restart') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +The operation to resume an Azure Site Recovery job. +.Description +The operation to resume an Azure Site Recovery job. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeJobParams +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJob +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. + +RESUMEJOBPARAM : Resume job params. + [Comment ]: Resume job comments. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/resume-azsiterecoveryreplicationjob +#> +function Resume-AzSiteRecoveryReplicationJob { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJob])] +[CmdletBinding(DefaultParameterSetName='ResumeExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Resume', Mandatory)] + [Parameter(ParameterSetName='ResumeExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Job identifier. + ${JobName}, + + [Parameter(ParameterSetName='Resume', Mandatory)] + [Parameter(ParameterSetName='ResumeExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Resume', Mandatory)] + [Parameter(ParameterSetName='ResumeExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Resume')] + [Parameter(ParameterSetName='ResumeExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='ResumeViaIdentity', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='ResumeViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='Resume', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='ResumeViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeJobParams] + # Resume job params. + # To construct, see NOTES section for RESUMEJOBPARAM properties and create a hash table. + ${ResumeJobParam}, + + [Parameter(ParameterSetName='ResumeExpanded')] + [Parameter(ParameterSetName='ResumeViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # Resume job comments. + ${Comment}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Resume = 'Az.SiteRecovery.private\Resume-AzSiteRecoveryReplicationJob_Resume'; + ResumeExpanded = 'Az.SiteRecovery.private\Resume-AzSiteRecoveryReplicationJob_ResumeExpanded'; + ResumeViaIdentity = 'Az.SiteRecovery.private\Resume-AzSiteRecoveryReplicationJob_ResumeViaIdentity'; + ResumeViaIdentityExpanded = 'Az.SiteRecovery.private\Resume-AzSiteRecoveryReplicationJob_ResumeViaIdentityExpanded'; + } + if (('Resume', 'ResumeExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +The operation to initiate resume replication of the item. +.Description +The operation to initiate resume replication of the item. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationInput +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. + +RESUMEREPLICATIONINPUT : Resume replication input. + ProviderSpecificDetailInstanceType : The class type. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/resume-azsiterecoveryreplicationmigrationitemreplication +#> +function Resume-AzSiteRecoveryReplicationMigrationItemReplication { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem])] +[CmdletBinding(DefaultParameterSetName='ResumeExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Resume', Mandatory)] + [Parameter(ParameterSetName='ResumeExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Fabric name. + ${FabricName}, + + [Parameter(ParameterSetName='Resume', Mandatory)] + [Parameter(ParameterSetName='ResumeExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Migration item name. + ${MigrationItemName}, + + [Parameter(ParameterSetName='Resume', Mandatory)] + [Parameter(ParameterSetName='ResumeExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Protection container name. + ${ProtectionContainerName}, + + [Parameter(ParameterSetName='Resume', Mandatory)] + [Parameter(ParameterSetName='ResumeExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Resume', Mandatory)] + [Parameter(ParameterSetName='ResumeExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Resume')] + [Parameter(ParameterSetName='ResumeExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='ResumeViaIdentity', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='ResumeViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='Resume', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='ResumeViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationInput] + # Resume replication input. + # To construct, see NOTES section for RESUMEREPLICATIONINPUT properties and create a hash table. + ${ResumeReplicationInput}, + + [Parameter(ParameterSetName='ResumeExpanded', Mandatory)] + [Parameter(ParameterSetName='ResumeViaIdentityExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The class type. + ${ProviderSpecificDetailInstanceType}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Resume = 'Az.SiteRecovery.private\Resume-AzSiteRecoveryReplicationMigrationItemReplication_Resume'; + ResumeExpanded = 'Az.SiteRecovery.private\Resume-AzSiteRecoveryReplicationMigrationItemReplication_ResumeExpanded'; + ResumeViaIdentity = 'Az.SiteRecovery.private\Resume-AzSiteRecoveryReplicationMigrationItemReplication_ResumeViaIdentity'; + ResumeViaIdentityExpanded = 'Az.SiteRecovery.private\Resume-AzSiteRecoveryReplicationMigrationItemReplication_ResumeViaIdentityExpanded'; + } + if (('Resume', 'ResumeExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +The operation to cancel an Azure Site Recovery job. +.Description +The operation to cancel an Azure Site Recovery job. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJob +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/stop-azsiterecoveryreplicationjob +#> +function Stop-AzSiteRecoveryReplicationJob { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJob])] +[CmdletBinding(DefaultParameterSetName='Cancel', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Cancel', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Job identifier. + ${JobName}, + + [Parameter(ParameterSetName='Cancel', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Cancel', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Cancel')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='CancelViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Cancel = 'Az.SiteRecovery.private\Stop-AzSiteRecoveryReplicationJob_Cancel'; + CancelViaIdentity = 'Az.SiteRecovery.private\Stop-AzSiteRecoveryReplicationJob_CancelViaIdentity'; + } + if (('Cancel') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Operation to cancel the failover of the replication protected item. +.Description +Operation to cancel the failover of the replication protected item. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/stop-azsiterecoveryreplicationprotecteditemfailover +#> +function Stop-AzSiteRecoveryReplicationProtectedItemFailover { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem])] +[CmdletBinding(DefaultParameterSetName='Cancel', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Cancel', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Unique fabric name. + ${FabricName}, + + [Parameter(ParameterSetName='Cancel', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Protection container name. + ${ProtectionContainerName}, + + [Parameter(ParameterSetName='Cancel', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Replication protected item name. + ${ReplicatedProtectedItemName}, + + [Parameter(ParameterSetName='Cancel', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Cancel', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Cancel')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='CancelViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Cancel = 'Az.SiteRecovery.private\Stop-AzSiteRecoveryReplicationProtectedItemFailover_Cancel'; + CancelViaIdentity = 'Az.SiteRecovery.private\Stop-AzSiteRecoveryReplicationProtectedItemFailover_CancelViaIdentity'; + } + if (('Cancel') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +The operation to cancel the failover of a recovery plan. +.Description +The operation to cancel the failover of a recovery plan. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/stop-azsiterecoveryreplicationrecoveryplanfailover +#> +function Stop-AzSiteRecoveryReplicationRecoveryPlanFailover { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan])] +[CmdletBinding(DefaultParameterSetName='Cancel', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Cancel', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Recovery plan name. + ${RecoveryPlanName}, + + [Parameter(ParameterSetName='Cancel', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Cancel', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Cancel')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='CancelViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Cancel = 'Az.SiteRecovery.private\Stop-AzSiteRecoveryReplicationRecoveryPlanFailover_Cancel'; + CancelViaIdentity = 'Az.SiteRecovery.private\Stop-AzSiteRecoveryReplicationRecoveryPlanFailover_CancelViaIdentity'; + } + if (('Cancel') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +The operation to initiate pause replication of the item. +.Description +The operation to initiate pause replication of the item. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPauseReplicationInput +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. + +PAUSEREPLICATIONINPUT : Pause replication input. + InstanceType : The class type. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/suspend-azsiterecoveryreplicationmigrationitemreplication +#> +function Suspend-AzSiteRecoveryReplicationMigrationItemReplication { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem])] +[CmdletBinding(DefaultParameterSetName='PauseExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Pause', Mandatory)] + [Parameter(ParameterSetName='PauseExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Fabric name. + ${FabricName}, + + [Parameter(ParameterSetName='Pause', Mandatory)] + [Parameter(ParameterSetName='PauseExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Migration item name. + ${MigrationItemName}, + + [Parameter(ParameterSetName='Pause', Mandatory)] + [Parameter(ParameterSetName='PauseExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Protection container name. + ${ProtectionContainerName}, + + [Parameter(ParameterSetName='Pause', Mandatory)] + [Parameter(ParameterSetName='PauseExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Pause', Mandatory)] + [Parameter(ParameterSetName='PauseExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Pause')] + [Parameter(ParameterSetName='PauseExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='PauseViaIdentity', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='PauseViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='Pause', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='PauseViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPauseReplicationInput] + # Pause replication input. + # To construct, see NOTES section for PAUSEREPLICATIONINPUT properties and create a hash table. + ${PauseReplicationInput}, + + [Parameter(ParameterSetName='PauseExpanded', Mandatory)] + [Parameter(ParameterSetName='PauseViaIdentityExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The class type. + ${InstanceType}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Pause = 'Az.SiteRecovery.private\Suspend-AzSiteRecoveryReplicationMigrationItemReplication_Pause'; + PauseExpanded = 'Az.SiteRecovery.private\Suspend-AzSiteRecoveryReplicationMigrationItemReplication_PauseExpanded'; + PauseViaIdentity = 'Az.SiteRecovery.private\Suspend-AzSiteRecoveryReplicationMigrationItemReplication_PauseViaIdentity'; + PauseViaIdentityExpanded = 'Az.SiteRecovery.private\Suspend-AzSiteRecoveryReplicationMigrationItemReplication_PauseViaIdentityExpanded'; + } + if (('Pause', 'PauseExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Operation to initiate a switch provider of the replication protected item. +.Description +Operation to initiate a switch provider of the replication protected item. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderInput +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. + +SWITCHPROVIDERINPUT : Input definition for switch provider. + [ProviderSpecificDetailInstanceType ]: The class type. + [TargetInstanceType ]: Target provider type. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/switch-azsiterecoveryreplicationprotecteditemprovider +#> +function Switch-AzSiteRecoveryReplicationProtectedItemProvider { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem])] +[CmdletBinding(DefaultParameterSetName='SwitchExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Switch', Mandatory)] + [Parameter(ParameterSetName='SwitchExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Unique fabric name. + ${FabricName}, + + [Parameter(ParameterSetName='Switch', Mandatory)] + [Parameter(ParameterSetName='SwitchExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Protection container name. + ${ProtectionContainerName}, + + [Parameter(ParameterSetName='Switch', Mandatory)] + [Parameter(ParameterSetName='SwitchExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Replication protected item name. + ${ReplicatedProtectedItemName}, + + [Parameter(ParameterSetName='Switch', Mandatory)] + [Parameter(ParameterSetName='SwitchExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Switch', Mandatory)] + [Parameter(ParameterSetName='SwitchExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Switch')] + [Parameter(ParameterSetName='SwitchExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='SwitchViaIdentity', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='SwitchViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='Switch', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='SwitchViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderInput] + # Input definition for switch provider. + # To construct, see NOTES section for SWITCHPROVIDERINPUT properties and create a hash table. + ${SwitchProviderInput}, + + [Parameter(ParameterSetName='SwitchExpanded')] + [Parameter(ParameterSetName='SwitchViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The class type. + ${ProviderSpecificDetailInstanceType}, + + [Parameter(ParameterSetName='SwitchExpanded')] + [Parameter(ParameterSetName='SwitchViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # Target provider type. + ${TargetInstanceType}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Switch = 'Az.SiteRecovery.private\Switch-AzSiteRecoveryReplicationProtectedItemProvider_Switch'; + SwitchExpanded = 'Az.SiteRecovery.private\Switch-AzSiteRecoveryReplicationProtectedItemProvider_SwitchExpanded'; + SwitchViaIdentity = 'Az.SiteRecovery.private\Switch-AzSiteRecoveryReplicationProtectedItemProvider_SwitchViaIdentity'; + SwitchViaIdentityExpanded = 'Az.SiteRecovery.private\Switch-AzSiteRecoveryReplicationProtectedItemProvider_SwitchViaIdentityExpanded'; + } + if (('Switch', 'SwitchExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Operation to switch protection from one container to another or one replication provider to another. +.Description +Operation to switch protection from one container to another or one replication provider to another. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionInput +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainer +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. + +SWITCHINPUT : Switch protection input. + [ProviderSpecificDetailInstanceType ]: Gets the Instance type. + [ReplicationProtectedItemName ]: The unique replication protected item name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/switch-azsiterecoveryreplicationprotectioncontainerprotection +#> +function Switch-AzSiteRecoveryReplicationProtectionContainerProtection { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainer])] +[CmdletBinding(DefaultParameterSetName='SwitchExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Switch', Mandatory)] + [Parameter(ParameterSetName='SwitchExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Unique fabric name. + ${FabricName}, + + [Parameter(ParameterSetName='Switch', Mandatory)] + [Parameter(ParameterSetName='SwitchExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Protection container name. + ${ProtectionContainerName}, + + [Parameter(ParameterSetName='Switch', Mandatory)] + [Parameter(ParameterSetName='SwitchExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Switch', Mandatory)] + [Parameter(ParameterSetName='SwitchExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Switch')] + [Parameter(ParameterSetName='SwitchExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='SwitchViaIdentity', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='SwitchViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='Switch', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='SwitchViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionInput] + # Switch protection input. + # To construct, see NOTES section for SWITCHINPUT properties and create a hash table. + ${SwitchInput}, + + [Parameter(ParameterSetName='SwitchExpanded')] + [Parameter(ParameterSetName='SwitchViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # Gets the Instance type. + ${ProviderSpecificDetailInstanceType}, + + [Parameter(ParameterSetName='SwitchExpanded')] + [Parameter(ParameterSetName='SwitchViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The unique replication protected item name. + ${ReplicationProtectedItemName}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Switch = 'Az.SiteRecovery.private\Switch-AzSiteRecoveryReplicationProtectionContainerProtection_Switch'; + SwitchExpanded = 'Az.SiteRecovery.private\Switch-AzSiteRecoveryReplicationProtectionContainerProtection_SwitchExpanded'; + SwitchViaIdentity = 'Az.SiteRecovery.private\Switch-AzSiteRecoveryReplicationProtectionContainerProtection_SwitchViaIdentity'; + SwitchViaIdentityExpanded = 'Az.SiteRecovery.private\Switch-AzSiteRecoveryReplicationProtectionContainerProtection_SwitchViaIdentityExpanded'; + } + if (('Switch', 'SwitchExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +The operation to perform a consistency check on the fabric. +.Description +The operation to perform a consistency check on the fabric. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabric +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/test-azsiterecoveryreplicationfabricconsistency +#> +function Test-AzSiteRecoveryReplicationFabricConsistency { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabric])] +[CmdletBinding(DefaultParameterSetName='Check', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Check', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Fabric name. + ${FabricName}, + + [Parameter(ParameterSetName='Check', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Check', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Check')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='CheckViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Check = 'Az.SiteRecovery.private\Test-AzSiteRecoveryReplicationFabricConsistency_Check'; + CheckViaIdentity = 'Az.SiteRecovery.private\Test-AzSiteRecoveryReplicationFabricConsistency_CheckViaIdentity'; + } + if (('Check') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +The operation to initiate test migrate cleanup. +.Description +The operation to initiate test migrate cleanup. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateCleanupInput +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. + +TESTMIGRATECLEANUPINPUT : Input for test migrate cleanup. + [Comment ]: Test migrate cleanup comments. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/test-azsiterecoveryreplicationmigrationitemmigratecleanup +#> +function Test-AzSiteRecoveryReplicationMigrationItemMigrateCleanup { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem])] +[CmdletBinding(DefaultParameterSetName='TestExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Test', Mandatory)] + [Parameter(ParameterSetName='TestExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Fabric name. + ${FabricName}, + + [Parameter(ParameterSetName='Test', Mandatory)] + [Parameter(ParameterSetName='TestExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Migration item name. + ${MigrationItemName}, + + [Parameter(ParameterSetName='Test', Mandatory)] + [Parameter(ParameterSetName='TestExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Protection container name. + ${ProtectionContainerName}, + + [Parameter(ParameterSetName='Test', Mandatory)] + [Parameter(ParameterSetName='TestExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Test', Mandatory)] + [Parameter(ParameterSetName='TestExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Test')] + [Parameter(ParameterSetName='TestExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='TestViaIdentity', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='TestViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='Test', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='TestViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateCleanupInput] + # Input for test migrate cleanup. + # To construct, see NOTES section for TESTMIGRATECLEANUPINPUT properties and create a hash table. + ${TestMigrateCleanupInput}, + + [Parameter(ParameterSetName='TestExpanded')] + [Parameter(ParameterSetName='TestViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # Test migrate cleanup comments. + ${Comment}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Test = 'Az.SiteRecovery.private\Test-AzSiteRecoveryReplicationMigrationItemMigrateCleanup_Test'; + TestExpanded = 'Az.SiteRecovery.private\Test-AzSiteRecoveryReplicationMigrationItemMigrateCleanup_TestExpanded'; + TestViaIdentity = 'Az.SiteRecovery.private\Test-AzSiteRecoveryReplicationMigrationItemMigrateCleanup_TestViaIdentity'; + TestViaIdentityExpanded = 'Az.SiteRecovery.private\Test-AzSiteRecoveryReplicationMigrationItemMigrateCleanup_TestViaIdentityExpanded'; + } + if (('Test', 'TestExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +The operation to initiate test migration of the item. +.Description +The operation to initiate test migration of the item. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateInput +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. + +TESTMIGRATEINPUT : Input for test migrate. + ProviderSpecificDetailInstanceType : The class type. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/test-azsiterecoveryreplicationmigrationitemmigrate +#> +function Test-AzSiteRecoveryReplicationMigrationItemMigrate { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem])] +[CmdletBinding(DefaultParameterSetName='TestExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Test', Mandatory)] + [Parameter(ParameterSetName='TestExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Fabric name. + ${FabricName}, + + [Parameter(ParameterSetName='Test', Mandatory)] + [Parameter(ParameterSetName='TestExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Migration item name. + ${MigrationItemName}, + + [Parameter(ParameterSetName='Test', Mandatory)] + [Parameter(ParameterSetName='TestExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Protection container name. + ${ProtectionContainerName}, + + [Parameter(ParameterSetName='Test', Mandatory)] + [Parameter(ParameterSetName='TestExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Test', Mandatory)] + [Parameter(ParameterSetName='TestExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Test')] + [Parameter(ParameterSetName='TestExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='TestViaIdentity', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='TestViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='Test', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='TestViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateInput] + # Input for test migrate. + # To construct, see NOTES section for TESTMIGRATEINPUT properties and create a hash table. + ${TestMigrateInput}, + + [Parameter(ParameterSetName='TestExpanded', Mandatory)] + [Parameter(ParameterSetName='TestViaIdentityExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The class type. + ${ProviderSpecificDetailInstanceType}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Test = 'Az.SiteRecovery.private\Test-AzSiteRecoveryReplicationMigrationItemMigrate_Test'; + TestExpanded = 'Az.SiteRecovery.private\Test-AzSiteRecoveryReplicationMigrationItemMigrate_TestExpanded'; + TestViaIdentity = 'Az.SiteRecovery.private\Test-AzSiteRecoveryReplicationMigrationItemMigrate_TestViaIdentity'; + TestViaIdentityExpanded = 'Az.SiteRecovery.private\Test-AzSiteRecoveryReplicationMigrationItemMigrate_TestViaIdentityExpanded'; + } + if (('Test', 'TestExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Operation to clean up the test failover of a replication protected item. +.Description +Operation to clean up the test failover of a replication protected item. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverCleanupInput +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +CLEANUPINPUT : Input definition for test failover cleanup. + [Comment ]: Test failover cleanup comments. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/test-azsiterecoveryreplicationprotecteditemfailovercleanup +#> +function Test-AzSiteRecoveryReplicationProtectedItemFailoverCleanup { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem])] +[CmdletBinding(DefaultParameterSetName='TestExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Test', Mandatory)] + [Parameter(ParameterSetName='TestExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Unique fabric name. + ${FabricName}, + + [Parameter(ParameterSetName='Test', Mandatory)] + [Parameter(ParameterSetName='TestExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Protection container name. + ${ProtectionContainerName}, + + [Parameter(ParameterSetName='Test', Mandatory)] + [Parameter(ParameterSetName='TestExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Replication protected item name. + ${ReplicatedProtectedItemName}, + + [Parameter(ParameterSetName='Test', Mandatory)] + [Parameter(ParameterSetName='TestExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Test', Mandatory)] + [Parameter(ParameterSetName='TestExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Test')] + [Parameter(ParameterSetName='TestExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='TestViaIdentity', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='TestViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='Test', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='TestViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverCleanupInput] + # Input definition for test failover cleanup. + # To construct, see NOTES section for CLEANUPINPUT properties and create a hash table. + ${CleanupInput}, + + [Parameter(ParameterSetName='TestExpanded')] + [Parameter(ParameterSetName='TestViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # Test failover cleanup comments. + ${Comment}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Test = 'Az.SiteRecovery.private\Test-AzSiteRecoveryReplicationProtectedItemFailoverCleanup_Test'; + TestExpanded = 'Az.SiteRecovery.private\Test-AzSiteRecoveryReplicationProtectedItemFailoverCleanup_TestExpanded'; + TestViaIdentity = 'Az.SiteRecovery.private\Test-AzSiteRecoveryReplicationProtectedItemFailoverCleanup_TestViaIdentity'; + TestViaIdentityExpanded = 'Az.SiteRecovery.private\Test-AzSiteRecoveryReplicationProtectedItemFailoverCleanup_TestViaIdentityExpanded'; + } + if (('Test', 'TestExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Operation to perform a test failover of the replication protected item. +.Description +Operation to perform a test failover of the replication protected item. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverInput +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. + +TESTFAILOVERINPUT : Input definition for test failover. + [FailoverDirection ]: Test failover direction. + [NetworkId ]: The id of the network to be used for test failover. + [NetworkType ]: Network type to be used for test failover. + [ProviderSpecificDetailInstanceType ]: The class type. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/test-azsiterecoveryreplicationprotecteditemfailover +#> +function Test-AzSiteRecoveryReplicationProtectedItemFailover { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem])] +[CmdletBinding(DefaultParameterSetName='TestExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Test', Mandatory)] + [Parameter(ParameterSetName='TestExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Unique fabric name. + ${FabricName}, + + [Parameter(ParameterSetName='Test', Mandatory)] + [Parameter(ParameterSetName='TestExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Protection container name. + ${ProtectionContainerName}, + + [Parameter(ParameterSetName='Test', Mandatory)] + [Parameter(ParameterSetName='TestExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Replication protected item name. + ${ReplicatedProtectedItemName}, + + [Parameter(ParameterSetName='Test', Mandatory)] + [Parameter(ParameterSetName='TestExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Test', Mandatory)] + [Parameter(ParameterSetName='TestExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Test')] + [Parameter(ParameterSetName='TestExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='TestViaIdentity', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='TestViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='Test', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='TestViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverInput] + # Input definition for test failover. + # To construct, see NOTES section for TESTFAILOVERINPUT properties and create a hash table. + ${TestfailoverInput}, + + [Parameter(ParameterSetName='TestExpanded')] + [Parameter(ParameterSetName='TestViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # Test failover direction. + ${FailoverDirection}, + + [Parameter(ParameterSetName='TestExpanded')] + [Parameter(ParameterSetName='TestViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The id of the network to be used for test failover. + ${NetworkId}, + + [Parameter(ParameterSetName='TestExpanded')] + [Parameter(ParameterSetName='TestViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # Network type to be used for test failover. + ${NetworkType}, + + [Parameter(ParameterSetName='TestExpanded')] + [Parameter(ParameterSetName='TestViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The class type. + ${ProviderSpecificDetailInstanceType}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Test = 'Az.SiteRecovery.private\Test-AzSiteRecoveryReplicationProtectedItemFailover_Test'; + TestExpanded = 'Az.SiteRecovery.private\Test-AzSiteRecoveryReplicationProtectedItemFailover_TestExpanded'; + TestViaIdentity = 'Az.SiteRecovery.private\Test-AzSiteRecoveryReplicationProtectedItemFailover_TestViaIdentity'; + TestViaIdentityExpanded = 'Az.SiteRecovery.private\Test-AzSiteRecoveryReplicationProtectedItemFailover_TestViaIdentityExpanded'; + } + if (('Test', 'TestExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +The operation to cleanup test failover of a recovery plan. +.Description +The operation to cleanup test failover of a recovery plan. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverCleanupInput +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUT : Recovery plan test failover cleanup input. + [Comment ]: The test failover cleanup comments. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/test-azsiterecoveryreplicationrecoveryplanfailovercleanup +#> +function Test-AzSiteRecoveryReplicationRecoveryPlanFailoverCleanup { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan])] +[CmdletBinding(DefaultParameterSetName='TestExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Test', Mandatory)] + [Parameter(ParameterSetName='TestExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Recovery plan name. + ${RecoveryPlanName}, + + [Parameter(ParameterSetName='Test', Mandatory)] + [Parameter(ParameterSetName='TestExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Test', Mandatory)] + [Parameter(ParameterSetName='TestExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Test')] + [Parameter(ParameterSetName='TestExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='TestViaIdentity', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='TestViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='Test', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='TestViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverCleanupInput] + # Recovery plan test failover cleanup input. + # To construct, see NOTES section for INPUT properties and create a hash table. + ${Input}, + + [Parameter(ParameterSetName='TestExpanded')] + [Parameter(ParameterSetName='TestViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The test failover cleanup comments. + ${Comment}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Test = 'Az.SiteRecovery.private\Test-AzSiteRecoveryReplicationRecoveryPlanFailoverCleanup_Test'; + TestExpanded = 'Az.SiteRecovery.private\Test-AzSiteRecoveryReplicationRecoveryPlanFailoverCleanup_TestExpanded'; + TestViaIdentity = 'Az.SiteRecovery.private\Test-AzSiteRecoveryReplicationRecoveryPlanFailoverCleanup_TestViaIdentity'; + TestViaIdentityExpanded = 'Az.SiteRecovery.private\Test-AzSiteRecoveryReplicationRecoveryPlanFailoverCleanup_TestViaIdentityExpanded'; + } + if (('Test', 'TestExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +The operation to start the test failover of a recovery plan. +.Description +The operation to start the test failover of a recovery plan. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverInput +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUT : Recovery plan test failover input. + FailoverDirection : The failover direction. + NetworkType : The network type to be used for test failover. + [NetworkId ]: The Id of the network to be used for test failover. + [ProviderSpecificDetail ]: The provider specific properties. + InstanceType : The class type. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. + +PROVIDERSPECIFICDETAIL : The provider specific properties. + InstanceType : The class type. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/test-azsiterecoveryreplicationrecoveryplanfailover +#> +function Test-AzSiteRecoveryReplicationRecoveryPlanFailover { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan])] +[CmdletBinding(DefaultParameterSetName='TestExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Test', Mandatory)] + [Parameter(ParameterSetName='TestExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Recovery plan name. + ${RecoveryPlanName}, + + [Parameter(ParameterSetName='Test', Mandatory)] + [Parameter(ParameterSetName='TestExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Test', Mandatory)] + [Parameter(ParameterSetName='TestExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Test')] + [Parameter(ParameterSetName='TestExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='TestViaIdentity', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='TestViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='Test', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='TestViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverInput] + # Recovery plan test failover input. + # To construct, see NOTES section for INPUT properties and create a hash table. + ${Input}, + + [Parameter(ParameterSetName='TestExpanded', Mandatory)] + [Parameter(ParameterSetName='TestViaIdentityExpanded', Mandatory)] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections])] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections] + # The failover direction. + ${FailoverDirection}, + + [Parameter(ParameterSetName='TestExpanded', Mandatory)] + [Parameter(ParameterSetName='TestViaIdentityExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The network type to be used for test failover. + ${NetworkType}, + + [Parameter(ParameterSetName='TestExpanded')] + [Parameter(ParameterSetName='TestViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The Id of the network to be used for test failover. + ${NetworkId}, + + [Parameter(ParameterSetName='TestExpanded')] + [Parameter(ParameterSetName='TestViaIdentityExpanded')] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInput[]] + # The provider specific properties. + # To construct, see NOTES section for PROVIDERSPECIFICDETAIL properties and create a hash table. + ${ProviderSpecificDetail}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Test = 'Az.SiteRecovery.private\Test-AzSiteRecoveryReplicationRecoveryPlanFailover_Test'; + TestExpanded = 'Az.SiteRecovery.private\Test-AzSiteRecoveryReplicationRecoveryPlanFailover_TestExpanded'; + TestViaIdentity = 'Az.SiteRecovery.private\Test-AzSiteRecoveryReplicationRecoveryPlanFailover_TestViaIdentity'; + TestViaIdentityExpanded = 'Az.SiteRecovery.private\Test-AzSiteRecoveryReplicationRecoveryPlanFailover_TestViaIdentityExpanded'; + } + if (('Test', 'TestExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +The operation to update the recovery settings of an ASR migration item. +.Description +The operation to update the recovery settings of an ASR migration item. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/update-azsiterecoveryreplicationmigrationitem +#> +function Update-AzSiteRecoveryReplicationMigrationItem { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem])] +[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Fabric name. + ${FabricName}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Migration item name. + ${MigrationItemName}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Protection container name. + ${ProtectionContainerName}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The class type. + ${ProviderSpecificDetailInstanceType}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + UpdateExpanded = 'Az.SiteRecovery.private\Update-AzSiteRecoveryReplicationMigrationItem_UpdateExpanded'; + UpdateViaIdentityExpanded = 'Az.SiteRecovery.private\Update-AzSiteRecoveryReplicationMigrationItem_UpdateViaIdentityExpanded'; + } + if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +The operation to update an ASR network mapping. +.Description +The operation to update an ASR network mapping. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMapping +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/update-azsiterecoveryreplicationnetworkmapping +#> +function Update-AzSiteRecoveryReplicationNetworkMapping { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMapping])] +[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Primary fabric name. + ${FabricName}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Network mapping name. + ${NetworkMappingName}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Primary network name. + ${NetworkName}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The instance type. + ${FabricSpecificDetailInstanceType}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # Recovery fabric name. + ${RecoveryFabricName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # Recovery network Id. + ${RecoveryNetworkId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + UpdateExpanded = 'Az.SiteRecovery.private\Update-AzSiteRecoveryReplicationNetworkMapping_UpdateExpanded'; + UpdateViaIdentityExpanded = 'Az.SiteRecovery.private\Update-AzSiteRecoveryReplicationNetworkMapping_UpdateViaIdentityExpanded'; + } + if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +The operation to update a replication policy. +.Description +The operation to update a replication policy. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicy +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/update-azsiterecoveryreplicationpolicy +#> +function Update-AzSiteRecoveryReplicationPolicy { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicy])] +[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Policy Id. + ${PolicyName}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The class type. + ${ReplicationProviderSettingInstanceType}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + UpdateExpanded = 'Az.SiteRecovery.private\Update-AzSiteRecoveryReplicationPolicy_UpdateExpanded'; + UpdateViaIdentityExpanded = 'Az.SiteRecovery.private\Update-AzSiteRecoveryReplicationPolicy_UpdateViaIdentityExpanded'; + } + if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +The operation to update appliance of an ASR replication protected item. +.Description +The operation to update appliance of an ASR replication protected item. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/update-azsiterecoveryreplicationprotecteditemappliance +#> +function Update-AzSiteRecoveryReplicationProtectedItemAppliance { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem])] +[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Fabric name. + ${FabricName}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Protection container name. + ${ProtectionContainerName}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Replication protected item name. + ${ReplicatedProtectedItemName}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The class type. + ${ProviderSpecificDetailInstanceType}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The target appliance Id. + ${TargetApplianceId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + UpdateExpanded = 'Az.SiteRecovery.private\Update-AzSiteRecoveryReplicationProtectedItemAppliance_UpdateExpanded'; + UpdateViaIdentityExpanded = 'Az.SiteRecovery.private\Update-AzSiteRecoveryReplicationProtectedItemAppliance_UpdateViaIdentityExpanded'; + } + if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +The operation to update(push update) the installed mobility service software on a replication protected item to the latest available version. +.Description +The operation to update(push update) the installed mobility service software on a replication protected item to the latest available version. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/update-azsiterecoveryreplicationprotecteditemmobilityservice +#> +function Update-AzSiteRecoveryReplicationProtectedItemMobilityService { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem])] +[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the fabric containing the protected item. + ${FabricName}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the container containing the protected item. + ${ProtectionContainerName}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the protected item on which the agent is to be updated. + ${ReplicatedProtectedItemName}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The CS run as account Id. + ${RunAsAccountId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + UpdateExpanded = 'Az.SiteRecovery.private\Update-AzSiteRecoveryReplicationProtectedItemMobilityService_UpdateExpanded'; + UpdateViaIdentityExpanded = 'Az.SiteRecovery.private\Update-AzSiteRecoveryReplicationProtectedItemMobilityService_UpdateViaIdentityExpanded'; + } + if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +The operation to update the recovery settings of an ASR replication protected item. +.Description +The operation to update the recovery settings of an ASR replication protected item. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. + +VMNIC : The list of VM nic details. + [EnableAcceleratedNetworkingOnRecovery ]: Whether the NIC has accelerated networking enabled. + [EnableAcceleratedNetworkingOnTfo ]: Whether the test NIC has accelerated networking enabled. + [IPConfig ]: The IP configurations to be used by NIC during test failover and failover. + [IPConfigName ]: + [IsPrimary ]: + [IsSeletedForFailover ]: + [RecoveryLbBackendAddressPoolId ]: + [RecoveryPublicIPAddressId ]: + [RecoveryStaticIPAddress ]: + [RecoverySubnetName ]: + [TfoLbBackendAddressPoolId ]: + [TfoPublicIPAddressId ]: + [TfoStaticIPAddress ]: + [TfoSubnetName ]: + [NicId ]: The nic Id. + [RecoveryNetworkSecurityGroupId ]: The id of the NSG associated with the NIC. + [RecoveryNicName ]: The name of the NIC to be used when creating target NICs. + [RecoveryNicResourceGroupName ]: The resource group of the NIC to be used when creating target NICs. + [ReuseExistingNic ]: A value indicating whether an existing NIC is allowed to be reused during failover subject to availability. + [SelectionType ]: Selection type for failover. + [TargetNicName ]: Target NIC name. + [TfoNetworkSecurityGroupId ]: The NSG to be used by NIC during test failover. + [TfoNicName ]: The name of the NIC to be used when creating target NICs in TFO. + [TfoNicResourceGroupName ]: The resource group of the NIC to be used when creating target NICs in TFO. + [TfoReuseExistingNic ]: A value indicating whether an existing NIC is allowed to be reused during test failover subject to availability. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/update-azsiterecoveryreplicationprotecteditem +#> +function Update-AzSiteRecoveryReplicationProtectedItem { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem])] +[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Fabric name. + ${FabricName}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Protection container name. + ${ProtectionContainerName}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Replication protected item name. + ${ReplicatedProtectedItemName}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The selected option to enable RDP\SSH on target vm after failover. + # String value of SrsDataContract.EnableRDPOnTargetOption enum. + ${EnableRdpOnTargetOption}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.LicenseType])] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.LicenseType] + # License type. + ${LicenseType}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The class type. + ${ProviderSpecificDetailInstanceType}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The target availability set Id. + ${RecoveryAvailabilitySetId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # Target Azure VM name given by the user. + ${RecoveryAzureVMName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # Target Azure VM size. + ${RecoveryAzureVMSize}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # Target Azure Network Id. + ${SelectedRecoveryAzureNetworkId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The selected source nic Id which will be used as the primary nic during failover. + ${SelectedSourceNicId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The Azure Network Id for test failover. + ${SelectedTfoAzureNetworkId}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicInputDetails[]] + # The list of VM nic details. + # To construct, see NOTES section for VMNIC properties and create a hash table. + ${VMNic}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + UpdateExpanded = 'Az.SiteRecovery.private\Update-AzSiteRecoveryReplicationProtectedItem_UpdateExpanded'; + UpdateViaIdentityExpanded = 'Az.SiteRecovery.private\Update-AzSiteRecoveryReplicationProtectedItem_UpdateViaIdentityExpanded'; + } + if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +The operation to update protection container mapping. +.Description +The operation to update protection container mapping. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMapping +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/update-azsiterecoveryreplicationprotectioncontainermapping +#> +function Update-AzSiteRecoveryReplicationProtectionContainerMapping { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMapping])] +[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Fabric name. + ${FabricName}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Protection container mapping name. + ${MappingName}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Protection container name. + ${ProtectionContainerName}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The class type. + ${ProviderSpecificInputInstanceType}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + UpdateExpanded = 'Az.SiteRecovery.private\Update-AzSiteRecoveryReplicationProtectionContainerMapping_UpdateExpanded'; + UpdateViaIdentityExpanded = 'Az.SiteRecovery.private\Update-AzSiteRecoveryReplicationProtectionContainerMapping_UpdateViaIdentityExpanded'; + } + if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +The operation to update a recovery plan. +.Description +The operation to update a recovery plan. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +GROUP : The recovery plan groups. + GroupType : The group type. + [EndGroupAction ]: The end group actions. + ActionName : The action name. + CustomDetailInstanceType : Gets the type of action details (see RecoveryPlanActionDetailsTypes enum for possible values). + FailoverDirection : The list of failover directions. + FailoverType : The list of failover types. + [ReplicationProtectedItem ]: The list of protected items. + [Id ]: The ARM Id of the recovery plan protected item. + [VirtualMachineId ]: The virtual machine Id. + [StartGroupAction ]: The start group actions. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/update-azsiterecoveryreplicationrecoveryplan +#> +function Update-AzSiteRecoveryReplicationRecoveryPlan { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan])] +[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Recovery plan name. + ${RecoveryPlanName}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroup[]] + # The recovery plan groups. + # To construct, see NOTES section for GROUP properties and create a hash table. + ${Group}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + UpdateExpanded = 'Az.SiteRecovery.private\Update-AzSiteRecoveryReplicationRecoveryPlan_UpdateExpanded'; + UpdateViaIdentityExpanded = 'Az.SiteRecovery.private\Update-AzSiteRecoveryReplicationRecoveryPlan_UpdateViaIdentityExpanded'; + } + if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +The operation to refresh the information from the recovery services provider. +.Description +The operation to refresh the information from the recovery services provider. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProvider +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/update-azsiterecoveryreplicationrecoveryserviceprovider +#> +function Update-AzSiteRecoveryReplicationRecoveryServiceProvider { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProvider])] +[CmdletBinding(DefaultParameterSetName='Refresh', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Refresh', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Fabric name. + ${FabricName}, + + [Parameter(ParameterSetName='Refresh', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Recovery services provider name. + ${ProviderName}, + + [Parameter(ParameterSetName='Refresh', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Refresh', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Refresh')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='RefreshViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Refresh = 'Az.SiteRecovery.private\Update-AzSiteRecoveryReplicationRecoveryServiceProvider_Refresh'; + RefreshViaIdentity = 'Az.SiteRecovery.private\Update-AzSiteRecoveryReplicationRecoveryServiceProvider_RefreshViaIdentity'; + } + if (('Refresh') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Refreshes health summary of the vault. +.Description +Refreshes health summary of the vault. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthDetails +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/update-azsiterecoveryreplicationvaulthealth +#> +function Update-AzSiteRecoveryReplicationVaultHealth { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthDetails])] +[CmdletBinding(DefaultParameterSetName='Refresh', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Refresh', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Refresh', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Refresh')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='RefreshViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Refresh = 'Az.SiteRecovery.private\Update-AzSiteRecoveryReplicationVaultHealth_Refresh'; + RefreshViaIdentity = 'Az.SiteRecovery.private\Update-AzSiteRecoveryReplicationVaultHealth_RefreshViaIdentity'; + } + if (('Refresh') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +The operation to update a registered vCenter. +.Description +The operation to update a registered vCenter. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenter +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/update-azsiterecoveryreplicationvcenter +#> +function Update-AzSiteRecoveryReplicationvCenter { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenter])] +[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Fabric name. + ${FabricName}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # vcenter name. + ${VcenterName}, + + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The friendly name of the vCenter. + ${FriendlyName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The IP address of the vCenter to be discovered. + ${IPAddress}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The port number for discovery. + ${Port}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The process server Id from where the update can be orchestrated. + ${ProcessServerId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The CS account Id which has privileges to update the vCenter. + ${RunAsAccountId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + UpdateExpanded = 'Az.SiteRecovery.private\Update-AzSiteRecoveryReplicationvCenter_UpdateExpanded'; + UpdateViaIdentityExpanded = 'Az.SiteRecovery.private\Update-AzSiteRecoveryReplicationvCenter_UpdateViaIdentityExpanded'; + } + if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/README.md b/swaggerci/recoveryservicessiterecovery/exports/README.md new file mode 100644 index 000000000000..c5a997e968f4 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/README.md @@ -0,0 +1,20 @@ +# Exports +This directory contains the cmdlets *exported by* `Az.SiteRecovery`. No other cmdlets in this repository are directly exported. What that means is the `Az.SiteRecovery` module will run [Export-ModuleMember](https://learn.microsoft.com/powershell/module/microsoft.powershell.core/export-modulemember) on the cmldets in this directory. The cmdlets in this directory are generated at **build-time**. Do not put any custom code, files, cmdlets, etc. into this directory. Please use `../custom` for all custom implementation. + +## Info +- Modifiable: no +- Generated: all +- Committed: no +- Packaged: yes + +## Details +The cmdlets generated here are created every time you run `build-module.ps1`. These cmdlets are a merge of all (excluding `InternalExport`) cmdlets from the private binary (`../bin/Az.SiteRecovery.private.dll`) and from the `../custom/Az.SiteRecovery.custom.psm1` module. Cmdlets that are *not merged* from those directories are decorated with the `InternalExport` attribute. This happens when you set the cmdlet to **hide** from configuration. For more information on hiding, see [cmdlet hiding](https://github.com/Azure/autorest/blob/master/docs/powershell/options.md#cmdlet-hiding-exportation-suppression) or the [README.md](../internal/README.md) in the `../internal` folder. + +## Purpose +We generate script cmdlets out of the binary cmdlets and custom cmdlets. The format of script cmdlets are simplistic; thus, easier to generate at build time. Generating the cmdlets is required as to allow merging of generated binary, hand-written binary, and hand-written custom cmdlets. For Azure cmdlets, having script cmdlets simplifies the mechanism for exporting Azure profiles. + +## Structure +The cmdlets generated here will flat in the directory (no sub-folders) as long as there are no Azure profiles specified for any cmdlets. Azure profiles (the `Profiles` attribute) is only applied when generating with the `--azure` attribute (or `azure: true` in the configuration). When Azure profiles are applied, the folder structure has a folder per profile. Each profile folder has only those cmdlets that apply to that profile. + +## Usage +When `./Az.SiteRecovery.psm1` is loaded, it dynamically exports cmdlets here based on the folder structure and on the selected profile. If there are no sub-folders, it exports all cmdlets at the root of this folder. If there are sub-folders, it checks to see the selected profile. If no profile is selected, it exports the cmdlets in the last sub-folder (alphabetically). If a profile is selected, it exports the cmdlets in the sub-folder that matches the profile name. If there is no sub-folder that matches the profile name, it exports no cmdlets and writes a warning message. \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/exports/Remove-AzSiteRecoveryReplicationFabric.ps1 b/swaggerci/recoveryservicessiterecovery/exports/Remove-AzSiteRecoveryReplicationFabric.ps1 new file mode 100644 index 000000000000..8652289afad2 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/Remove-AzSiteRecoveryReplicationFabric.ps1 @@ -0,0 +1,237 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to delete or remove an Azure Site Recovery fabric. +.Description +The operation to delete or remove an Azure Site Recovery fabric. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +System.Boolean +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/remove-azsiterecoveryreplicationfabric +#> +function Remove-AzSiteRecoveryReplicationFabric { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # ASR fabric to delete. + ${FabricName}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Delete')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Delete = 'Az.SiteRecovery.private\Remove-AzSiteRecoveryReplicationFabric_Delete'; + DeleteViaIdentity = 'Az.SiteRecovery.private\Remove-AzSiteRecoveryReplicationFabric_DeleteViaIdentity'; + } + if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/Remove-AzSiteRecoveryReplicationMigrationItem.ps1 b/swaggerci/recoveryservicessiterecovery/exports/Remove-AzSiteRecoveryReplicationMigrationItem.ps1 new file mode 100644 index 000000000000..04c550208c7e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/Remove-AzSiteRecoveryReplicationMigrationItem.ps1 @@ -0,0 +1,255 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to delete an ASR migration item. +.Description +The operation to delete an ASR migration item. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +System.Boolean +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/remove-azsiterecoveryreplicationmigrationitem +#> +function Remove-AzSiteRecoveryReplicationMigrationItem { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Fabric name. + ${FabricName}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Migration item name. + ${MigrationItemName}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Protection container name. + ${ProtectionContainerName}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Delete')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Query')] + [System.String] + # The delete option. + ${DeleteOption}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Delete = 'Az.SiteRecovery.private\Remove-AzSiteRecoveryReplicationMigrationItem_Delete'; + DeleteViaIdentity = 'Az.SiteRecovery.private\Remove-AzSiteRecoveryReplicationMigrationItem_DeleteViaIdentity'; + } + if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/Remove-AzSiteRecoveryReplicationNetworkMapping.ps1 b/swaggerci/recoveryservicessiterecovery/exports/Remove-AzSiteRecoveryReplicationNetworkMapping.ps1 new file mode 100644 index 000000000000..5cc2998f6978 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/Remove-AzSiteRecoveryReplicationNetworkMapping.ps1 @@ -0,0 +1,249 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to delete a network mapping. +.Description +The operation to delete a network mapping. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +System.Boolean +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/remove-azsiterecoveryreplicationnetworkmapping +#> +function Remove-AzSiteRecoveryReplicationNetworkMapping { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Primary fabric name. + ${FabricName}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # ARM Resource Name for network mapping. + ${NetworkMappingName}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Primary network name. + ${NetworkName}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Delete')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Delete = 'Az.SiteRecovery.private\Remove-AzSiteRecoveryReplicationNetworkMapping_Delete'; + DeleteViaIdentity = 'Az.SiteRecovery.private\Remove-AzSiteRecoveryReplicationNetworkMapping_DeleteViaIdentity'; + } + if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/Remove-AzSiteRecoveryReplicationPolicy.ps1 b/swaggerci/recoveryservicessiterecovery/exports/Remove-AzSiteRecoveryReplicationPolicy.ps1 new file mode 100644 index 000000000000..f26500507bc6 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/Remove-AzSiteRecoveryReplicationPolicy.ps1 @@ -0,0 +1,237 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to delete a replication policy. +.Description +The operation to delete a replication policy. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +System.Boolean +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/remove-azsiterecoveryreplicationpolicy +#> +function Remove-AzSiteRecoveryReplicationPolicy { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Replication policy name. + ${PolicyName}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Delete')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Delete = 'Az.SiteRecovery.private\Remove-AzSiteRecoveryReplicationPolicy_Delete'; + DeleteViaIdentity = 'Az.SiteRecovery.private\Remove-AzSiteRecoveryReplicationPolicy_DeleteViaIdentity'; + } + if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/Remove-AzSiteRecoveryReplicationProtectedItem.ps1 b/swaggerci/recoveryservicessiterecovery/exports/Remove-AzSiteRecoveryReplicationProtectedItem.ps1 new file mode 100644 index 000000000000..325eeb5ed271 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/Remove-AzSiteRecoveryReplicationProtectedItem.ps1 @@ -0,0 +1,290 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to disable replication on a replication protected item. +This will also remove the item. +.Description +The operation to disable replication on a replication protected item. +This will also remove the item. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionInput +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +System.Boolean +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +DISABLEPROTECTIONINPUT : Disable protection input. + [DisableProtectionReason ]: Disable protection reason. It can have values NotSpecified/MigrationComplete. + [ReplicationProviderInputInstanceType ]: The class type. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/remove-azsiterecoveryreplicationprotecteditem +#> +function Remove-AzSiteRecoveryReplicationProtectedItem { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='DeleteExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Delete', Mandatory)] + [Parameter(ParameterSetName='DeleteExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Fabric name. + ${FabricName}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Parameter(ParameterSetName='DeleteExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Protection container name. + ${ProtectionContainerName}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Parameter(ParameterSetName='DeleteExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Replication protected item name. + ${ReplicatedProtectedItemName}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Parameter(ParameterSetName='DeleteExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Parameter(ParameterSetName='DeleteExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Delete')] + [Parameter(ParameterSetName='DeleteExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='DeleteViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='Delete', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionInput] + # Disable protection input. + # To construct, see NOTES section for DISABLEPROTECTIONINPUT properties and create a hash table. + ${DisableProtectionInput}, + + [Parameter(ParameterSetName='DeleteExpanded')] + [Parameter(ParameterSetName='DeleteViaIdentityExpanded')] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DisableProtectionReason])] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DisableProtectionReason] + # Disable protection reason. + # It can have values NotSpecified/MigrationComplete. + ${DisableProtectionReason}, + + [Parameter(ParameterSetName='DeleteExpanded')] + [Parameter(ParameterSetName='DeleteViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The class type. + ${ReplicationProviderInputInstanceType}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Delete = 'Az.SiteRecovery.private\Remove-AzSiteRecoveryReplicationProtectedItem_Delete'; + DeleteExpanded = 'Az.SiteRecovery.private\Remove-AzSiteRecoveryReplicationProtectedItem_DeleteExpanded'; + DeleteViaIdentity = 'Az.SiteRecovery.private\Remove-AzSiteRecoveryReplicationProtectedItem_DeleteViaIdentity'; + DeleteViaIdentityExpanded = 'Az.SiteRecovery.private\Remove-AzSiteRecoveryReplicationProtectedItem_DeleteViaIdentityExpanded'; + } + if (('Delete', 'DeleteExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/Remove-AzSiteRecoveryReplicationProtectedItemDisk.ps1 b/swaggerci/recoveryservicessiterecovery/exports/Remove-AzSiteRecoveryReplicationProtectedItemDisk.ps1 new file mode 100644 index 000000000000..4765ef4cd24c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/Remove-AzSiteRecoveryReplicationProtectedItemDisk.ps1 @@ -0,0 +1,272 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Operation to remove disk(s) from the replication protected item. +.Description +Operation to remove disk(s) from the replication protected item. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksInput +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. + +REMOVEDISKSINPUT : Input for remove disk(s) operation. + [ProviderSpecificDetailInstanceType ]: The class type. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/remove-azsiterecoveryreplicationprotecteditemdisk +#> +function Remove-AzSiteRecoveryReplicationProtectedItemDisk { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem])] +[CmdletBinding(DefaultParameterSetName='RemoveExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Remove', Mandatory)] + [Parameter(ParameterSetName='RemoveExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Unique fabric name. + ${FabricName}, + + [Parameter(ParameterSetName='Remove', Mandatory)] + [Parameter(ParameterSetName='RemoveExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Protection container name. + ${ProtectionContainerName}, + + [Parameter(ParameterSetName='Remove', Mandatory)] + [Parameter(ParameterSetName='RemoveExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Replication protected item name. + ${ReplicatedProtectedItemName}, + + [Parameter(ParameterSetName='Remove', Mandatory)] + [Parameter(ParameterSetName='RemoveExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Remove', Mandatory)] + [Parameter(ParameterSetName='RemoveExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Remove')] + [Parameter(ParameterSetName='RemoveExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='RemoveViaIdentity', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='RemoveViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='Remove', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='RemoveViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksInput] + # Input for remove disk(s) operation. + # To construct, see NOTES section for REMOVEDISKSINPUT properties and create a hash table. + ${RemoveDisksInput}, + + [Parameter(ParameterSetName='RemoveExpanded')] + [Parameter(ParameterSetName='RemoveViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The class type. + ${ProviderSpecificDetailInstanceType}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Remove = 'Az.SiteRecovery.private\Remove-AzSiteRecoveryReplicationProtectedItemDisk_Remove'; + RemoveExpanded = 'Az.SiteRecovery.private\Remove-AzSiteRecoveryReplicationProtectedItemDisk_RemoveExpanded'; + RemoveViaIdentity = 'Az.SiteRecovery.private\Remove-AzSiteRecoveryReplicationProtectedItemDisk_RemoveViaIdentity'; + RemoveViaIdentityExpanded = 'Az.SiteRecovery.private\Remove-AzSiteRecoveryReplicationProtectedItemDisk_RemoveViaIdentityExpanded'; + } + if (('Remove', 'RemoveExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/Remove-AzSiteRecoveryReplicationProtectionContainer.ps1 b/swaggerci/recoveryservicessiterecovery/exports/Remove-AzSiteRecoveryReplicationProtectionContainer.ps1 new file mode 100644 index 000000000000..61d8b7e874db --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/Remove-AzSiteRecoveryReplicationProtectionContainer.ps1 @@ -0,0 +1,243 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Operation to remove a protection container. +.Description +Operation to remove a protection container. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +System.Boolean +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/remove-azsiterecoveryreplicationprotectioncontainer +#> +function Remove-AzSiteRecoveryReplicationProtectionContainer { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Unique fabric ARM name. + ${FabricName}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Unique protection container ARM name. + ${ProtectionContainerName}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Delete')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Delete = 'Az.SiteRecovery.private\Remove-AzSiteRecoveryReplicationProtectionContainer_Delete'; + DeleteViaIdentity = 'Az.SiteRecovery.private\Remove-AzSiteRecoveryReplicationProtectionContainer_DeleteViaIdentity'; + } + if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/Remove-AzSiteRecoveryReplicationProtectionContainerMapping.ps1 b/swaggerci/recoveryservicessiterecovery/exports/Remove-AzSiteRecoveryReplicationProtectionContainerMapping.ps1 new file mode 100644 index 000000000000..741b31b7e328 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/Remove-AzSiteRecoveryReplicationProtectionContainerMapping.ps1 @@ -0,0 +1,278 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to delete or remove a protection container mapping. +.Description +The operation to delete or remove a protection container mapping. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveProtectionContainerMappingInput +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +System.Boolean +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. + +REMOVALINPUT : Container unpairing input. + [ProviderSpecificInputInstanceType ]: The class type. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/remove-azsiterecoveryreplicationprotectioncontainermapping +#> +function Remove-AzSiteRecoveryReplicationProtectionContainerMapping { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='DeleteExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Delete', Mandatory)] + [Parameter(ParameterSetName='DeleteExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Fabric name. + ${FabricName}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Parameter(ParameterSetName='DeleteExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Protection container mapping name. + ${MappingName}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Parameter(ParameterSetName='DeleteExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Protection container name. + ${ProtectionContainerName}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Parameter(ParameterSetName='DeleteExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Parameter(ParameterSetName='DeleteExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Delete')] + [Parameter(ParameterSetName='DeleteExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='DeleteViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='Delete', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveProtectionContainerMappingInput] + # Container unpairing input. + # To construct, see NOTES section for REMOVALINPUT properties and create a hash table. + ${RemovalInput}, + + [Parameter(ParameterSetName='DeleteExpanded')] + [Parameter(ParameterSetName='DeleteViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The class type. + ${ProviderSpecificInputInstanceType}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Delete = 'Az.SiteRecovery.private\Remove-AzSiteRecoveryReplicationProtectionContainerMapping_Delete'; + DeleteExpanded = 'Az.SiteRecovery.private\Remove-AzSiteRecoveryReplicationProtectionContainerMapping_DeleteExpanded'; + DeleteViaIdentity = 'Az.SiteRecovery.private\Remove-AzSiteRecoveryReplicationProtectionContainerMapping_DeleteViaIdentity'; + DeleteViaIdentityExpanded = 'Az.SiteRecovery.private\Remove-AzSiteRecoveryReplicationProtectionContainerMapping_DeleteViaIdentityExpanded'; + } + if (('Delete', 'DeleteExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/Remove-AzSiteRecoveryReplicationRecoveryPlan.ps1 b/swaggerci/recoveryservicessiterecovery/exports/Remove-AzSiteRecoveryReplicationRecoveryPlan.ps1 new file mode 100644 index 000000000000..2c3428017c37 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/Remove-AzSiteRecoveryReplicationRecoveryPlan.ps1 @@ -0,0 +1,237 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Delete a recovery plan. +.Description +Delete a recovery plan. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +System.Boolean +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/remove-azsiterecoveryreplicationrecoveryplan +#> +function Remove-AzSiteRecoveryReplicationRecoveryPlan { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Recovery plan name. + ${RecoveryPlanName}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Delete')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Delete = 'Az.SiteRecovery.private\Remove-AzSiteRecoveryReplicationRecoveryPlan_Delete'; + DeleteViaIdentity = 'Az.SiteRecovery.private\Remove-AzSiteRecoveryReplicationRecoveryPlan_DeleteViaIdentity'; + } + if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/Remove-AzSiteRecoveryReplicationRecoveryServicesProvider.ps1 b/swaggerci/recoveryservicessiterecovery/exports/Remove-AzSiteRecoveryReplicationRecoveryServicesProvider.ps1 new file mode 100644 index 000000000000..d1effc1ecb36 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/Remove-AzSiteRecoveryReplicationRecoveryServicesProvider.ps1 @@ -0,0 +1,243 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to removes/delete(unregister) a recovery services provider from the vault. +.Description +The operation to removes/delete(unregister) a recovery services provider from the vault. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +System.Boolean +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/remove-azsiterecoveryreplicationrecoveryservicesprovider +#> +function Remove-AzSiteRecoveryReplicationRecoveryServicesProvider { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Fabric name. + ${FabricName}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Recovery services provider name. + ${ProviderName}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Delete')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Delete = 'Az.SiteRecovery.private\Remove-AzSiteRecoveryReplicationRecoveryServicesProvider_Delete'; + DeleteViaIdentity = 'Az.SiteRecovery.private\Remove-AzSiteRecoveryReplicationRecoveryServicesProvider_DeleteViaIdentity'; + } + if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/Remove-AzSiteRecoveryReplicationStorageClassificationMapping.ps1 b/swaggerci/recoveryservicessiterecovery/exports/Remove-AzSiteRecoveryReplicationStorageClassificationMapping.ps1 new file mode 100644 index 000000000000..50e09504fb2c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/Remove-AzSiteRecoveryReplicationStorageClassificationMapping.ps1 @@ -0,0 +1,249 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to delete a storage classification mapping. +.Description +The operation to delete a storage classification mapping. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +System.Boolean +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/remove-azsiterecoveryreplicationstorageclassificationmapping +#> +function Remove-AzSiteRecoveryReplicationStorageClassificationMapping { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Fabric name. + ${FabricName}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Storage classification mapping name. + ${StorageClassificationMappingName}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Storage classification name. + ${StorageClassificationName}, + + [Parameter(ParameterSetName='Delete')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Delete = 'Az.SiteRecovery.private\Remove-AzSiteRecoveryReplicationStorageClassificationMapping_Delete'; + DeleteViaIdentity = 'Az.SiteRecovery.private\Remove-AzSiteRecoveryReplicationStorageClassificationMapping_DeleteViaIdentity'; + } + if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/Remove-AzSiteRecoveryReplicationvCenter.ps1 b/swaggerci/recoveryservicessiterecovery/exports/Remove-AzSiteRecoveryReplicationvCenter.ps1 new file mode 100644 index 000000000000..c2f1851cd4fb --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/Remove-AzSiteRecoveryReplicationvCenter.ps1 @@ -0,0 +1,243 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to remove(unregister) a registered vCenter server from the vault. +.Description +The operation to remove(unregister) a registered vCenter server from the vault. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +System.Boolean +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/remove-azsiterecoveryreplicationvcenter +#> +function Remove-AzSiteRecoveryReplicationvCenter { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Fabric name. + ${FabricName}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Delete')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # vcenter name. + ${VcenterName}, + + [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Delete = 'Az.SiteRecovery.private\Remove-AzSiteRecoveryReplicationvCenter_Delete'; + DeleteViaIdentity = 'Az.SiteRecovery.private\Remove-AzSiteRecoveryReplicationvCenter_DeleteViaIdentity'; + } + if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/Repair-AzSiteRecoveryReplicationProtectedItemReplication.ps1 b/swaggerci/recoveryservicessiterecovery/exports/Repair-AzSiteRecoveryReplicationProtectedItemReplication.ps1 new file mode 100644 index 000000000000..f1aeb66350e2 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/Repair-AzSiteRecoveryReplicationProtectedItemReplication.ps1 @@ -0,0 +1,243 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to start resynchronize/repair replication for a replication protected item requiring resynchronization. +.Description +The operation to start resynchronize/repair replication for a replication protected item requiring resynchronization. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/repair-azsiterecoveryreplicationprotecteditemreplication +#> +function Repair-AzSiteRecoveryReplicationProtectedItemReplication { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem])] +[CmdletBinding(DefaultParameterSetName='Repair', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Repair', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the fabric. + ${FabricName}, + + [Parameter(ParameterSetName='Repair', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the container. + ${ProtectionContainerName}, + + [Parameter(ParameterSetName='Repair', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the replication protected item. + ${ReplicatedProtectedItemName}, + + [Parameter(ParameterSetName='Repair', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Repair', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Repair')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='RepairViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Repair = 'Az.SiteRecovery.private\Repair-AzSiteRecoveryReplicationProtectedItemReplication_Repair'; + RepairViaIdentity = 'Az.SiteRecovery.private\Repair-AzSiteRecoveryReplicationProtectedItemReplication_RepairViaIdentity'; + } + if (('Repair') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/Resolve-AzSiteRecoveryReplicationProtectedItemHealthError.ps1 b/swaggerci/recoveryservicessiterecovery/exports/Resolve-AzSiteRecoveryReplicationProtectedItemHealthError.ps1 new file mode 100644 index 000000000000..ced7cfaa53bf --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/Resolve-AzSiteRecoveryReplicationProtectedItemHealthError.ps1 @@ -0,0 +1,278 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Operation to resolve health issues of the replication protected item. +.Description +Operation to resolve health issues of the replication protected item. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResolveHealthInput +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +HEALTHERROR : Health errors. + [HealthErrorId ]: Health error id. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. + +RESOLVEHEALTHINPUT : Resolve health input. + [HealthError ]: Health errors. + [HealthErrorId ]: Health error id. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/resolve-azsiterecoveryreplicationprotecteditemhealtherror +#> +function Resolve-AzSiteRecoveryReplicationProtectedItemHealthError { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem])] +[CmdletBinding(DefaultParameterSetName='ResolveExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Resolve', Mandatory)] + [Parameter(ParameterSetName='ResolveExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Unique fabric name. + ${FabricName}, + + [Parameter(ParameterSetName='Resolve', Mandatory)] + [Parameter(ParameterSetName='ResolveExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Protection container name. + ${ProtectionContainerName}, + + [Parameter(ParameterSetName='Resolve', Mandatory)] + [Parameter(ParameterSetName='ResolveExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Replication protected item name. + ${ReplicatedProtectedItemName}, + + [Parameter(ParameterSetName='Resolve', Mandatory)] + [Parameter(ParameterSetName='ResolveExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Resolve', Mandatory)] + [Parameter(ParameterSetName='ResolveExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Resolve')] + [Parameter(ParameterSetName='ResolveExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='ResolveViaIdentity', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='ResolveViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='Resolve', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='ResolveViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResolveHealthInput] + # Resolve health input. + # To construct, see NOTES section for RESOLVEHEALTHINPUT properties and create a hash table. + ${ResolveHealthInput}, + + [Parameter(ParameterSetName='ResolveExpanded')] + [Parameter(ParameterSetName='ResolveViaIdentityExpanded')] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResolveHealthError[]] + # Health errors. + # To construct, see NOTES section for HEALTHERROR properties and create a hash table. + ${HealthError}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Resolve = 'Az.SiteRecovery.private\Resolve-AzSiteRecoveryReplicationProtectedItemHealthError_Resolve'; + ResolveExpanded = 'Az.SiteRecovery.private\Resolve-AzSiteRecoveryReplicationProtectedItemHealthError_ResolveExpanded'; + ResolveViaIdentity = 'Az.SiteRecovery.private\Resolve-AzSiteRecoveryReplicationProtectedItemHealthError_ResolveViaIdentity'; + ResolveViaIdentityExpanded = 'Az.SiteRecovery.private\Resolve-AzSiteRecoveryReplicationProtectedItemHealthError_ResolveViaIdentityExpanded'; + } + if (('Resolve', 'ResolveExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/Restart-AzSiteRecoveryReplicationJob.ps1 b/swaggerci/recoveryservicessiterecovery/exports/Restart-AzSiteRecoveryReplicationJob.ps1 new file mode 100644 index 000000000000..f87a1d148937 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/Restart-AzSiteRecoveryReplicationJob.ps1 @@ -0,0 +1,231 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to restart an Azure Site Recovery job. +.Description +The operation to restart an Azure Site Recovery job. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJob +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/restart-azsiterecoveryreplicationjob +#> +function Restart-AzSiteRecoveryReplicationJob { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJob])] +[CmdletBinding(DefaultParameterSetName='Restart', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Restart', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Job identifier. + ${JobName}, + + [Parameter(ParameterSetName='Restart', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Restart', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Restart')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='RestartViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Restart = 'Az.SiteRecovery.private\Restart-AzSiteRecoveryReplicationJob_Restart'; + RestartViaIdentity = 'Az.SiteRecovery.private\Restart-AzSiteRecoveryReplicationJob_RestartViaIdentity'; + } + if (('Restart') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/Resume-AzSiteRecoveryReplicationJob.ps1 b/swaggerci/recoveryservicessiterecovery/exports/Resume-AzSiteRecoveryReplicationJob.ps1 new file mode 100644 index 000000000000..02f2787b1626 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/Resume-AzSiteRecoveryReplicationJob.ps1 @@ -0,0 +1,258 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to resume an Azure Site Recovery job. +.Description +The operation to resume an Azure Site Recovery job. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeJobParams +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJob +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. + +RESUMEJOBPARAM : Resume job params. + [Comment ]: Resume job comments. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/resume-azsiterecoveryreplicationjob +#> +function Resume-AzSiteRecoveryReplicationJob { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJob])] +[CmdletBinding(DefaultParameterSetName='ResumeExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Resume', Mandatory)] + [Parameter(ParameterSetName='ResumeExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Job identifier. + ${JobName}, + + [Parameter(ParameterSetName='Resume', Mandatory)] + [Parameter(ParameterSetName='ResumeExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Resume', Mandatory)] + [Parameter(ParameterSetName='ResumeExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Resume')] + [Parameter(ParameterSetName='ResumeExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='ResumeViaIdentity', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='ResumeViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='Resume', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='ResumeViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeJobParams] + # Resume job params. + # To construct, see NOTES section for RESUMEJOBPARAM properties and create a hash table. + ${ResumeJobParam}, + + [Parameter(ParameterSetName='ResumeExpanded')] + [Parameter(ParameterSetName='ResumeViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # Resume job comments. + ${Comment}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Resume = 'Az.SiteRecovery.private\Resume-AzSiteRecoveryReplicationJob_Resume'; + ResumeExpanded = 'Az.SiteRecovery.private\Resume-AzSiteRecoveryReplicationJob_ResumeExpanded'; + ResumeViaIdentity = 'Az.SiteRecovery.private\Resume-AzSiteRecoveryReplicationJob_ResumeViaIdentity'; + ResumeViaIdentityExpanded = 'Az.SiteRecovery.private\Resume-AzSiteRecoveryReplicationJob_ResumeViaIdentityExpanded'; + } + if (('Resume', 'ResumeExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/Resume-AzSiteRecoveryReplicationMigrationItemReplication.ps1 b/swaggerci/recoveryservicessiterecovery/exports/Resume-AzSiteRecoveryReplicationMigrationItemReplication.ps1 new file mode 100644 index 000000000000..343338097c08 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/Resume-AzSiteRecoveryReplicationMigrationItemReplication.ps1 @@ -0,0 +1,272 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to initiate resume replication of the item. +.Description +The operation to initiate resume replication of the item. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationInput +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. + +RESUMEREPLICATIONINPUT : Resume replication input. + ProviderSpecificDetailInstanceType : The class type. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/resume-azsiterecoveryreplicationmigrationitemreplication +#> +function Resume-AzSiteRecoveryReplicationMigrationItemReplication { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem])] +[CmdletBinding(DefaultParameterSetName='ResumeExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Resume', Mandatory)] + [Parameter(ParameterSetName='ResumeExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Fabric name. + ${FabricName}, + + [Parameter(ParameterSetName='Resume', Mandatory)] + [Parameter(ParameterSetName='ResumeExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Migration item name. + ${MigrationItemName}, + + [Parameter(ParameterSetName='Resume', Mandatory)] + [Parameter(ParameterSetName='ResumeExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Protection container name. + ${ProtectionContainerName}, + + [Parameter(ParameterSetName='Resume', Mandatory)] + [Parameter(ParameterSetName='ResumeExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Resume', Mandatory)] + [Parameter(ParameterSetName='ResumeExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Resume')] + [Parameter(ParameterSetName='ResumeExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='ResumeViaIdentity', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='ResumeViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='Resume', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='ResumeViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationInput] + # Resume replication input. + # To construct, see NOTES section for RESUMEREPLICATIONINPUT properties and create a hash table. + ${ResumeReplicationInput}, + + [Parameter(ParameterSetName='ResumeExpanded', Mandatory)] + [Parameter(ParameterSetName='ResumeViaIdentityExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The class type. + ${ProviderSpecificDetailInstanceType}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Resume = 'Az.SiteRecovery.private\Resume-AzSiteRecoveryReplicationMigrationItemReplication_Resume'; + ResumeExpanded = 'Az.SiteRecovery.private\Resume-AzSiteRecoveryReplicationMigrationItemReplication_ResumeExpanded'; + ResumeViaIdentity = 'Az.SiteRecovery.private\Resume-AzSiteRecoveryReplicationMigrationItemReplication_ResumeViaIdentity'; + ResumeViaIdentityExpanded = 'Az.SiteRecovery.private\Resume-AzSiteRecoveryReplicationMigrationItemReplication_ResumeViaIdentityExpanded'; + } + if (('Resume', 'ResumeExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/Stop-AzSiteRecoveryReplicationJob.ps1 b/swaggerci/recoveryservicessiterecovery/exports/Stop-AzSiteRecoveryReplicationJob.ps1 new file mode 100644 index 000000000000..0af090b620a3 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/Stop-AzSiteRecoveryReplicationJob.ps1 @@ -0,0 +1,231 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to cancel an Azure Site Recovery job. +.Description +The operation to cancel an Azure Site Recovery job. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJob +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/stop-azsiterecoveryreplicationjob +#> +function Stop-AzSiteRecoveryReplicationJob { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJob])] +[CmdletBinding(DefaultParameterSetName='Cancel', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Cancel', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Job identifier. + ${JobName}, + + [Parameter(ParameterSetName='Cancel', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Cancel', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Cancel')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='CancelViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Cancel = 'Az.SiteRecovery.private\Stop-AzSiteRecoveryReplicationJob_Cancel'; + CancelViaIdentity = 'Az.SiteRecovery.private\Stop-AzSiteRecoveryReplicationJob_CancelViaIdentity'; + } + if (('Cancel') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/Stop-AzSiteRecoveryReplicationProtectedItemFailover.ps1 b/swaggerci/recoveryservicessiterecovery/exports/Stop-AzSiteRecoveryReplicationProtectedItemFailover.ps1 new file mode 100644 index 000000000000..24824d7588ee --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/Stop-AzSiteRecoveryReplicationProtectedItemFailover.ps1 @@ -0,0 +1,243 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Operation to cancel the failover of the replication protected item. +.Description +Operation to cancel the failover of the replication protected item. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/stop-azsiterecoveryreplicationprotecteditemfailover +#> +function Stop-AzSiteRecoveryReplicationProtectedItemFailover { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem])] +[CmdletBinding(DefaultParameterSetName='Cancel', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Cancel', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Unique fabric name. + ${FabricName}, + + [Parameter(ParameterSetName='Cancel', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Protection container name. + ${ProtectionContainerName}, + + [Parameter(ParameterSetName='Cancel', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Replication protected item name. + ${ReplicatedProtectedItemName}, + + [Parameter(ParameterSetName='Cancel', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Cancel', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Cancel')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='CancelViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Cancel = 'Az.SiteRecovery.private\Stop-AzSiteRecoveryReplicationProtectedItemFailover_Cancel'; + CancelViaIdentity = 'Az.SiteRecovery.private\Stop-AzSiteRecoveryReplicationProtectedItemFailover_CancelViaIdentity'; + } + if (('Cancel') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/Stop-AzSiteRecoveryReplicationRecoveryPlanFailover.ps1 b/swaggerci/recoveryservicessiterecovery/exports/Stop-AzSiteRecoveryReplicationRecoveryPlanFailover.ps1 new file mode 100644 index 000000000000..9041fa1a6845 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/Stop-AzSiteRecoveryReplicationRecoveryPlanFailover.ps1 @@ -0,0 +1,231 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to cancel the failover of a recovery plan. +.Description +The operation to cancel the failover of a recovery plan. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/stop-azsiterecoveryreplicationrecoveryplanfailover +#> +function Stop-AzSiteRecoveryReplicationRecoveryPlanFailover { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan])] +[CmdletBinding(DefaultParameterSetName='Cancel', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Cancel', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Recovery plan name. + ${RecoveryPlanName}, + + [Parameter(ParameterSetName='Cancel', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Cancel', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Cancel')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='CancelViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Cancel = 'Az.SiteRecovery.private\Stop-AzSiteRecoveryReplicationRecoveryPlanFailover_Cancel'; + CancelViaIdentity = 'Az.SiteRecovery.private\Stop-AzSiteRecoveryReplicationRecoveryPlanFailover_CancelViaIdentity'; + } + if (('Cancel') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/Suspend-AzSiteRecoveryReplicationMigrationItemReplication.ps1 b/swaggerci/recoveryservicessiterecovery/exports/Suspend-AzSiteRecoveryReplicationMigrationItemReplication.ps1 new file mode 100644 index 000000000000..c7efe826a66b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/Suspend-AzSiteRecoveryReplicationMigrationItemReplication.ps1 @@ -0,0 +1,272 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to initiate pause replication of the item. +.Description +The operation to initiate pause replication of the item. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPauseReplicationInput +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. + +PAUSEREPLICATIONINPUT : Pause replication input. + InstanceType : The class type. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/suspend-azsiterecoveryreplicationmigrationitemreplication +#> +function Suspend-AzSiteRecoveryReplicationMigrationItemReplication { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem])] +[CmdletBinding(DefaultParameterSetName='PauseExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Pause', Mandatory)] + [Parameter(ParameterSetName='PauseExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Fabric name. + ${FabricName}, + + [Parameter(ParameterSetName='Pause', Mandatory)] + [Parameter(ParameterSetName='PauseExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Migration item name. + ${MigrationItemName}, + + [Parameter(ParameterSetName='Pause', Mandatory)] + [Parameter(ParameterSetName='PauseExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Protection container name. + ${ProtectionContainerName}, + + [Parameter(ParameterSetName='Pause', Mandatory)] + [Parameter(ParameterSetName='PauseExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Pause', Mandatory)] + [Parameter(ParameterSetName='PauseExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Pause')] + [Parameter(ParameterSetName='PauseExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='PauseViaIdentity', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='PauseViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='Pause', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='PauseViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPauseReplicationInput] + # Pause replication input. + # To construct, see NOTES section for PAUSEREPLICATIONINPUT properties and create a hash table. + ${PauseReplicationInput}, + + [Parameter(ParameterSetName='PauseExpanded', Mandatory)] + [Parameter(ParameterSetName='PauseViaIdentityExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The class type. + ${InstanceType}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Pause = 'Az.SiteRecovery.private\Suspend-AzSiteRecoveryReplicationMigrationItemReplication_Pause'; + PauseExpanded = 'Az.SiteRecovery.private\Suspend-AzSiteRecoveryReplicationMigrationItemReplication_PauseExpanded'; + PauseViaIdentity = 'Az.SiteRecovery.private\Suspend-AzSiteRecoveryReplicationMigrationItemReplication_PauseViaIdentity'; + PauseViaIdentityExpanded = 'Az.SiteRecovery.private\Suspend-AzSiteRecoveryReplicationMigrationItemReplication_PauseViaIdentityExpanded'; + } + if (('Pause', 'PauseExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/Switch-AzSiteRecoveryReplicationProtectedItemProvider.ps1 b/swaggerci/recoveryservicessiterecovery/exports/Switch-AzSiteRecoveryReplicationProtectedItemProvider.ps1 new file mode 100644 index 000000000000..2ef51b1d6282 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/Switch-AzSiteRecoveryReplicationProtectedItemProvider.ps1 @@ -0,0 +1,280 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Operation to initiate a switch provider of the replication protected item. +.Description +Operation to initiate a switch provider of the replication protected item. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderInput +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. + +SWITCHPROVIDERINPUT : Input definition for switch provider. + [ProviderSpecificDetailInstanceType ]: The class type. + [TargetInstanceType ]: Target provider type. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/switch-azsiterecoveryreplicationprotecteditemprovider +#> +function Switch-AzSiteRecoveryReplicationProtectedItemProvider { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem])] +[CmdletBinding(DefaultParameterSetName='SwitchExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Switch', Mandatory)] + [Parameter(ParameterSetName='SwitchExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Unique fabric name. + ${FabricName}, + + [Parameter(ParameterSetName='Switch', Mandatory)] + [Parameter(ParameterSetName='SwitchExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Protection container name. + ${ProtectionContainerName}, + + [Parameter(ParameterSetName='Switch', Mandatory)] + [Parameter(ParameterSetName='SwitchExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Replication protected item name. + ${ReplicatedProtectedItemName}, + + [Parameter(ParameterSetName='Switch', Mandatory)] + [Parameter(ParameterSetName='SwitchExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Switch', Mandatory)] + [Parameter(ParameterSetName='SwitchExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Switch')] + [Parameter(ParameterSetName='SwitchExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='SwitchViaIdentity', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='SwitchViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='Switch', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='SwitchViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderInput] + # Input definition for switch provider. + # To construct, see NOTES section for SWITCHPROVIDERINPUT properties and create a hash table. + ${SwitchProviderInput}, + + [Parameter(ParameterSetName='SwitchExpanded')] + [Parameter(ParameterSetName='SwitchViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The class type. + ${ProviderSpecificDetailInstanceType}, + + [Parameter(ParameterSetName='SwitchExpanded')] + [Parameter(ParameterSetName='SwitchViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # Target provider type. + ${TargetInstanceType}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Switch = 'Az.SiteRecovery.private\Switch-AzSiteRecoveryReplicationProtectedItemProvider_Switch'; + SwitchExpanded = 'Az.SiteRecovery.private\Switch-AzSiteRecoveryReplicationProtectedItemProvider_SwitchExpanded'; + SwitchViaIdentity = 'Az.SiteRecovery.private\Switch-AzSiteRecoveryReplicationProtectedItemProvider_SwitchViaIdentity'; + SwitchViaIdentityExpanded = 'Az.SiteRecovery.private\Switch-AzSiteRecoveryReplicationProtectedItemProvider_SwitchViaIdentityExpanded'; + } + if (('Switch', 'SwitchExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/Switch-AzSiteRecoveryReplicationProtectionContainerProtection.ps1 b/swaggerci/recoveryservicessiterecovery/exports/Switch-AzSiteRecoveryReplicationProtectionContainerProtection.ps1 new file mode 100644 index 000000000000..6c0f2baf0a03 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/Switch-AzSiteRecoveryReplicationProtectionContainerProtection.ps1 @@ -0,0 +1,273 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Operation to switch protection from one container to another or one replication provider to another. +.Description +Operation to switch protection from one container to another or one replication provider to another. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionInput +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainer +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. + +SWITCHINPUT : Switch protection input. + [ProviderSpecificDetailInstanceType ]: Gets the Instance type. + [ReplicationProtectedItemName ]: The unique replication protected item name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/switch-azsiterecoveryreplicationprotectioncontainerprotection +#> +function Switch-AzSiteRecoveryReplicationProtectionContainerProtection { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainer])] +[CmdletBinding(DefaultParameterSetName='SwitchExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Switch', Mandatory)] + [Parameter(ParameterSetName='SwitchExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Unique fabric name. + ${FabricName}, + + [Parameter(ParameterSetName='Switch', Mandatory)] + [Parameter(ParameterSetName='SwitchExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Protection container name. + ${ProtectionContainerName}, + + [Parameter(ParameterSetName='Switch', Mandatory)] + [Parameter(ParameterSetName='SwitchExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Switch', Mandatory)] + [Parameter(ParameterSetName='SwitchExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Switch')] + [Parameter(ParameterSetName='SwitchExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='SwitchViaIdentity', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='SwitchViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='Switch', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='SwitchViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionInput] + # Switch protection input. + # To construct, see NOTES section for SWITCHINPUT properties and create a hash table. + ${SwitchInput}, + + [Parameter(ParameterSetName='SwitchExpanded')] + [Parameter(ParameterSetName='SwitchViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # Gets the Instance type. + ${ProviderSpecificDetailInstanceType}, + + [Parameter(ParameterSetName='SwitchExpanded')] + [Parameter(ParameterSetName='SwitchViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The unique replication protected item name. + ${ReplicationProtectedItemName}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Switch = 'Az.SiteRecovery.private\Switch-AzSiteRecoveryReplicationProtectionContainerProtection_Switch'; + SwitchExpanded = 'Az.SiteRecovery.private\Switch-AzSiteRecoveryReplicationProtectionContainerProtection_SwitchExpanded'; + SwitchViaIdentity = 'Az.SiteRecovery.private\Switch-AzSiteRecoveryReplicationProtectionContainerProtection_SwitchViaIdentity'; + SwitchViaIdentityExpanded = 'Az.SiteRecovery.private\Switch-AzSiteRecoveryReplicationProtectionContainerProtection_SwitchViaIdentityExpanded'; + } + if (('Switch', 'SwitchExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/Test-AzSiteRecoveryReplicationFabricConsistency.ps1 b/swaggerci/recoveryservicessiterecovery/exports/Test-AzSiteRecoveryReplicationFabricConsistency.ps1 new file mode 100644 index 000000000000..0b61a3467456 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/Test-AzSiteRecoveryReplicationFabricConsistency.ps1 @@ -0,0 +1,231 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to perform a consistency check on the fabric. +.Description +The operation to perform a consistency check on the fabric. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabric +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/test-azsiterecoveryreplicationfabricconsistency +#> +function Test-AzSiteRecoveryReplicationFabricConsistency { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabric])] +[CmdletBinding(DefaultParameterSetName='Check', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Check', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Fabric name. + ${FabricName}, + + [Parameter(ParameterSetName='Check', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Check', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Check')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='CheckViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Check = 'Az.SiteRecovery.private\Test-AzSiteRecoveryReplicationFabricConsistency_Check'; + CheckViaIdentity = 'Az.SiteRecovery.private\Test-AzSiteRecoveryReplicationFabricConsistency_CheckViaIdentity'; + } + if (('Check') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/Test-AzSiteRecoveryReplicationMigrationItemMigrate.ps1 b/swaggerci/recoveryservicessiterecovery/exports/Test-AzSiteRecoveryReplicationMigrationItemMigrate.ps1 new file mode 100644 index 000000000000..061b161aded9 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/Test-AzSiteRecoveryReplicationMigrationItemMigrate.ps1 @@ -0,0 +1,272 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to initiate test migration of the item. +.Description +The operation to initiate test migration of the item. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateInput +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. + +TESTMIGRATEINPUT : Input for test migrate. + ProviderSpecificDetailInstanceType : The class type. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/test-azsiterecoveryreplicationmigrationitemmigrate +#> +function Test-AzSiteRecoveryReplicationMigrationItemMigrate { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem])] +[CmdletBinding(DefaultParameterSetName='TestExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Test', Mandatory)] + [Parameter(ParameterSetName='TestExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Fabric name. + ${FabricName}, + + [Parameter(ParameterSetName='Test', Mandatory)] + [Parameter(ParameterSetName='TestExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Migration item name. + ${MigrationItemName}, + + [Parameter(ParameterSetName='Test', Mandatory)] + [Parameter(ParameterSetName='TestExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Protection container name. + ${ProtectionContainerName}, + + [Parameter(ParameterSetName='Test', Mandatory)] + [Parameter(ParameterSetName='TestExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Test', Mandatory)] + [Parameter(ParameterSetName='TestExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Test')] + [Parameter(ParameterSetName='TestExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='TestViaIdentity', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='TestViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='Test', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='TestViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateInput] + # Input for test migrate. + # To construct, see NOTES section for TESTMIGRATEINPUT properties and create a hash table. + ${TestMigrateInput}, + + [Parameter(ParameterSetName='TestExpanded', Mandatory)] + [Parameter(ParameterSetName='TestViaIdentityExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The class type. + ${ProviderSpecificDetailInstanceType}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Test = 'Az.SiteRecovery.private\Test-AzSiteRecoveryReplicationMigrationItemMigrate_Test'; + TestExpanded = 'Az.SiteRecovery.private\Test-AzSiteRecoveryReplicationMigrationItemMigrate_TestExpanded'; + TestViaIdentity = 'Az.SiteRecovery.private\Test-AzSiteRecoveryReplicationMigrationItemMigrate_TestViaIdentity'; + TestViaIdentityExpanded = 'Az.SiteRecovery.private\Test-AzSiteRecoveryReplicationMigrationItemMigrate_TestViaIdentityExpanded'; + } + if (('Test', 'TestExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/Test-AzSiteRecoveryReplicationMigrationItemMigrateCleanup.ps1 b/swaggerci/recoveryservicessiterecovery/exports/Test-AzSiteRecoveryReplicationMigrationItemMigrateCleanup.ps1 new file mode 100644 index 000000000000..32bab18d7388 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/Test-AzSiteRecoveryReplicationMigrationItemMigrateCleanup.ps1 @@ -0,0 +1,272 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to initiate test migrate cleanup. +.Description +The operation to initiate test migrate cleanup. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateCleanupInput +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. + +TESTMIGRATECLEANUPINPUT : Input for test migrate cleanup. + [Comment ]: Test migrate cleanup comments. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/test-azsiterecoveryreplicationmigrationitemmigratecleanup +#> +function Test-AzSiteRecoveryReplicationMigrationItemMigrateCleanup { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem])] +[CmdletBinding(DefaultParameterSetName='TestExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Test', Mandatory)] + [Parameter(ParameterSetName='TestExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Fabric name. + ${FabricName}, + + [Parameter(ParameterSetName='Test', Mandatory)] + [Parameter(ParameterSetName='TestExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Migration item name. + ${MigrationItemName}, + + [Parameter(ParameterSetName='Test', Mandatory)] + [Parameter(ParameterSetName='TestExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Protection container name. + ${ProtectionContainerName}, + + [Parameter(ParameterSetName='Test', Mandatory)] + [Parameter(ParameterSetName='TestExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Test', Mandatory)] + [Parameter(ParameterSetName='TestExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Test')] + [Parameter(ParameterSetName='TestExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='TestViaIdentity', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='TestViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='Test', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='TestViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateCleanupInput] + # Input for test migrate cleanup. + # To construct, see NOTES section for TESTMIGRATECLEANUPINPUT properties and create a hash table. + ${TestMigrateCleanupInput}, + + [Parameter(ParameterSetName='TestExpanded')] + [Parameter(ParameterSetName='TestViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # Test migrate cleanup comments. + ${Comment}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Test = 'Az.SiteRecovery.private\Test-AzSiteRecoveryReplicationMigrationItemMigrateCleanup_Test'; + TestExpanded = 'Az.SiteRecovery.private\Test-AzSiteRecoveryReplicationMigrationItemMigrateCleanup_TestExpanded'; + TestViaIdentity = 'Az.SiteRecovery.private\Test-AzSiteRecoveryReplicationMigrationItemMigrateCleanup_TestViaIdentity'; + TestViaIdentityExpanded = 'Az.SiteRecovery.private\Test-AzSiteRecoveryReplicationMigrationItemMigrateCleanup_TestViaIdentityExpanded'; + } + if (('Test', 'TestExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/Test-AzSiteRecoveryReplicationProtectedItemFailover.ps1 b/swaggerci/recoveryservicessiterecovery/exports/Test-AzSiteRecoveryReplicationProtectedItemFailover.ps1 new file mode 100644 index 000000000000..bcb2fa94e355 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/Test-AzSiteRecoveryReplicationProtectedItemFailover.ps1 @@ -0,0 +1,296 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Operation to perform a test failover of the replication protected item. +.Description +Operation to perform a test failover of the replication protected item. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverInput +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. + +TESTFAILOVERINPUT : Input definition for test failover. + [FailoverDirection ]: Test failover direction. + [NetworkId ]: The id of the network to be used for test failover. + [NetworkType ]: Network type to be used for test failover. + [ProviderSpecificDetailInstanceType ]: The class type. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/test-azsiterecoveryreplicationprotecteditemfailover +#> +function Test-AzSiteRecoveryReplicationProtectedItemFailover { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem])] +[CmdletBinding(DefaultParameterSetName='TestExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Test', Mandatory)] + [Parameter(ParameterSetName='TestExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Unique fabric name. + ${FabricName}, + + [Parameter(ParameterSetName='Test', Mandatory)] + [Parameter(ParameterSetName='TestExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Protection container name. + ${ProtectionContainerName}, + + [Parameter(ParameterSetName='Test', Mandatory)] + [Parameter(ParameterSetName='TestExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Replication protected item name. + ${ReplicatedProtectedItemName}, + + [Parameter(ParameterSetName='Test', Mandatory)] + [Parameter(ParameterSetName='TestExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Test', Mandatory)] + [Parameter(ParameterSetName='TestExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Test')] + [Parameter(ParameterSetName='TestExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='TestViaIdentity', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='TestViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='Test', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='TestViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverInput] + # Input definition for test failover. + # To construct, see NOTES section for TESTFAILOVERINPUT properties and create a hash table. + ${TestfailoverInput}, + + [Parameter(ParameterSetName='TestExpanded')] + [Parameter(ParameterSetName='TestViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # Test failover direction. + ${FailoverDirection}, + + [Parameter(ParameterSetName='TestExpanded')] + [Parameter(ParameterSetName='TestViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The id of the network to be used for test failover. + ${NetworkId}, + + [Parameter(ParameterSetName='TestExpanded')] + [Parameter(ParameterSetName='TestViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # Network type to be used for test failover. + ${NetworkType}, + + [Parameter(ParameterSetName='TestExpanded')] + [Parameter(ParameterSetName='TestViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The class type. + ${ProviderSpecificDetailInstanceType}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Test = 'Az.SiteRecovery.private\Test-AzSiteRecoveryReplicationProtectedItemFailover_Test'; + TestExpanded = 'Az.SiteRecovery.private\Test-AzSiteRecoveryReplicationProtectedItemFailover_TestExpanded'; + TestViaIdentity = 'Az.SiteRecovery.private\Test-AzSiteRecoveryReplicationProtectedItemFailover_TestViaIdentity'; + TestViaIdentityExpanded = 'Az.SiteRecovery.private\Test-AzSiteRecoveryReplicationProtectedItemFailover_TestViaIdentityExpanded'; + } + if (('Test', 'TestExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/Test-AzSiteRecoveryReplicationProtectedItemFailoverCleanup.ps1 b/swaggerci/recoveryservicessiterecovery/exports/Test-AzSiteRecoveryReplicationProtectedItemFailoverCleanup.ps1 new file mode 100644 index 000000000000..638d11827fd2 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/Test-AzSiteRecoveryReplicationProtectedItemFailoverCleanup.ps1 @@ -0,0 +1,272 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Operation to clean up the test failover of a replication protected item. +.Description +Operation to clean up the test failover of a replication protected item. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverCleanupInput +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +CLEANUPINPUT : Input definition for test failover cleanup. + [Comment ]: Test failover cleanup comments. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/test-azsiterecoveryreplicationprotecteditemfailovercleanup +#> +function Test-AzSiteRecoveryReplicationProtectedItemFailoverCleanup { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem])] +[CmdletBinding(DefaultParameterSetName='TestExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Test', Mandatory)] + [Parameter(ParameterSetName='TestExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Unique fabric name. + ${FabricName}, + + [Parameter(ParameterSetName='Test', Mandatory)] + [Parameter(ParameterSetName='TestExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Protection container name. + ${ProtectionContainerName}, + + [Parameter(ParameterSetName='Test', Mandatory)] + [Parameter(ParameterSetName='TestExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Replication protected item name. + ${ReplicatedProtectedItemName}, + + [Parameter(ParameterSetName='Test', Mandatory)] + [Parameter(ParameterSetName='TestExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Test', Mandatory)] + [Parameter(ParameterSetName='TestExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Test')] + [Parameter(ParameterSetName='TestExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='TestViaIdentity', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='TestViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='Test', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='TestViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverCleanupInput] + # Input definition for test failover cleanup. + # To construct, see NOTES section for CLEANUPINPUT properties and create a hash table. + ${CleanupInput}, + + [Parameter(ParameterSetName='TestExpanded')] + [Parameter(ParameterSetName='TestViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # Test failover cleanup comments. + ${Comment}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Test = 'Az.SiteRecovery.private\Test-AzSiteRecoveryReplicationProtectedItemFailoverCleanup_Test'; + TestExpanded = 'Az.SiteRecovery.private\Test-AzSiteRecoveryReplicationProtectedItemFailoverCleanup_TestExpanded'; + TestViaIdentity = 'Az.SiteRecovery.private\Test-AzSiteRecoveryReplicationProtectedItemFailoverCleanup_TestViaIdentity'; + TestViaIdentityExpanded = 'Az.SiteRecovery.private\Test-AzSiteRecoveryReplicationProtectedItemFailoverCleanup_TestViaIdentityExpanded'; + } + if (('Test', 'TestExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/Test-AzSiteRecoveryReplicationRecoveryPlanFailover.ps1 b/swaggerci/recoveryservicessiterecovery/exports/Test-AzSiteRecoveryReplicationRecoveryPlanFailover.ps1 new file mode 100644 index 000000000000..e53510e3ab90 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/Test-AzSiteRecoveryReplicationRecoveryPlanFailover.ps1 @@ -0,0 +1,289 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to start the test failover of a recovery plan. +.Description +The operation to start the test failover of a recovery plan. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverInput +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUT : Recovery plan test failover input. + FailoverDirection : The failover direction. + NetworkType : The network type to be used for test failover. + [NetworkId ]: The Id of the network to be used for test failover. + [ProviderSpecificDetail ]: The provider specific properties. + InstanceType : The class type. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. + +PROVIDERSPECIFICDETAIL : The provider specific properties. + InstanceType : The class type. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/test-azsiterecoveryreplicationrecoveryplanfailover +#> +function Test-AzSiteRecoveryReplicationRecoveryPlanFailover { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan])] +[CmdletBinding(DefaultParameterSetName='TestExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Test', Mandatory)] + [Parameter(ParameterSetName='TestExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Recovery plan name. + ${RecoveryPlanName}, + + [Parameter(ParameterSetName='Test', Mandatory)] + [Parameter(ParameterSetName='TestExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Test', Mandatory)] + [Parameter(ParameterSetName='TestExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Test')] + [Parameter(ParameterSetName='TestExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='TestViaIdentity', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='TestViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='Test', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='TestViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverInput] + # Recovery plan test failover input. + # To construct, see NOTES section for INPUT properties and create a hash table. + ${Input}, + + [Parameter(ParameterSetName='TestExpanded', Mandatory)] + [Parameter(ParameterSetName='TestViaIdentityExpanded', Mandatory)] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections])] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections] + # The failover direction. + ${FailoverDirection}, + + [Parameter(ParameterSetName='TestExpanded', Mandatory)] + [Parameter(ParameterSetName='TestViaIdentityExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The network type to be used for test failover. + ${NetworkType}, + + [Parameter(ParameterSetName='TestExpanded')] + [Parameter(ParameterSetName='TestViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The Id of the network to be used for test failover. + ${NetworkId}, + + [Parameter(ParameterSetName='TestExpanded')] + [Parameter(ParameterSetName='TestViaIdentityExpanded')] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInput[]] + # The provider specific properties. + # To construct, see NOTES section for PROVIDERSPECIFICDETAIL properties and create a hash table. + ${ProviderSpecificDetail}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Test = 'Az.SiteRecovery.private\Test-AzSiteRecoveryReplicationRecoveryPlanFailover_Test'; + TestExpanded = 'Az.SiteRecovery.private\Test-AzSiteRecoveryReplicationRecoveryPlanFailover_TestExpanded'; + TestViaIdentity = 'Az.SiteRecovery.private\Test-AzSiteRecoveryReplicationRecoveryPlanFailover_TestViaIdentity'; + TestViaIdentityExpanded = 'Az.SiteRecovery.private\Test-AzSiteRecoveryReplicationRecoveryPlanFailover_TestViaIdentityExpanded'; + } + if (('Test', 'TestExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/Test-AzSiteRecoveryReplicationRecoveryPlanFailoverCleanup.ps1 b/swaggerci/recoveryservicessiterecovery/exports/Test-AzSiteRecoveryReplicationRecoveryPlanFailoverCleanup.ps1 new file mode 100644 index 000000000000..dd902e24ec50 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/Test-AzSiteRecoveryReplicationRecoveryPlanFailoverCleanup.ps1 @@ -0,0 +1,258 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to cleanup test failover of a recovery plan. +.Description +The operation to cleanup test failover of a recovery plan. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverCleanupInput +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUT : Recovery plan test failover cleanup input. + [Comment ]: The test failover cleanup comments. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/test-azsiterecoveryreplicationrecoveryplanfailovercleanup +#> +function Test-AzSiteRecoveryReplicationRecoveryPlanFailoverCleanup { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan])] +[CmdletBinding(DefaultParameterSetName='TestExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Test', Mandatory)] + [Parameter(ParameterSetName='TestExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Recovery plan name. + ${RecoveryPlanName}, + + [Parameter(ParameterSetName='Test', Mandatory)] + [Parameter(ParameterSetName='TestExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Test', Mandatory)] + [Parameter(ParameterSetName='TestExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Test')] + [Parameter(ParameterSetName='TestExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='TestViaIdentity', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='TestViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='Test', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='TestViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverCleanupInput] + # Recovery plan test failover cleanup input. + # To construct, see NOTES section for INPUT properties and create a hash table. + ${Input}, + + [Parameter(ParameterSetName='TestExpanded')] + [Parameter(ParameterSetName='TestViaIdentityExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The test failover cleanup comments. + ${Comment}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Test = 'Az.SiteRecovery.private\Test-AzSiteRecoveryReplicationRecoveryPlanFailoverCleanup_Test'; + TestExpanded = 'Az.SiteRecovery.private\Test-AzSiteRecoveryReplicationRecoveryPlanFailoverCleanup_TestExpanded'; + TestViaIdentity = 'Az.SiteRecovery.private\Test-AzSiteRecoveryReplicationRecoveryPlanFailoverCleanup_TestViaIdentity'; + TestViaIdentityExpanded = 'Az.SiteRecovery.private\Test-AzSiteRecoveryReplicationRecoveryPlanFailoverCleanup_TestViaIdentityExpanded'; + } + if (('Test', 'TestExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/Update-AzSiteRecoveryReplicationMigrationItem.ps1 b/swaggerci/recoveryservicessiterecovery/exports/Update-AzSiteRecoveryReplicationMigrationItem.ps1 new file mode 100644 index 000000000000..848a4fb2c6d3 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/Update-AzSiteRecoveryReplicationMigrationItem.ps1 @@ -0,0 +1,249 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to update the recovery settings of an ASR migration item. +.Description +The operation to update the recovery settings of an ASR migration item. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/update-azsiterecoveryreplicationmigrationitem +#> +function Update-AzSiteRecoveryReplicationMigrationItem { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem])] +[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Fabric name. + ${FabricName}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Migration item name. + ${MigrationItemName}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Protection container name. + ${ProtectionContainerName}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The class type. + ${ProviderSpecificDetailInstanceType}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + UpdateExpanded = 'Az.SiteRecovery.private\Update-AzSiteRecoveryReplicationMigrationItem_UpdateExpanded'; + UpdateViaIdentityExpanded = 'Az.SiteRecovery.private\Update-AzSiteRecoveryReplicationMigrationItem_UpdateViaIdentityExpanded'; + } + if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/Update-AzSiteRecoveryReplicationNetworkMapping.ps1 b/swaggerci/recoveryservicessiterecovery/exports/Update-AzSiteRecoveryReplicationNetworkMapping.ps1 new file mode 100644 index 000000000000..15d77c80ff83 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/Update-AzSiteRecoveryReplicationNetworkMapping.ps1 @@ -0,0 +1,261 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to update an ASR network mapping. +.Description +The operation to update an ASR network mapping. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMapping +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/update-azsiterecoveryreplicationnetworkmapping +#> +function Update-AzSiteRecoveryReplicationNetworkMapping { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMapping])] +[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Primary fabric name. + ${FabricName}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Network mapping name. + ${NetworkMappingName}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Primary network name. + ${NetworkName}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The instance type. + ${FabricSpecificDetailInstanceType}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # Recovery fabric name. + ${RecoveryFabricName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # Recovery network Id. + ${RecoveryNetworkId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + UpdateExpanded = 'Az.SiteRecovery.private\Update-AzSiteRecoveryReplicationNetworkMapping_UpdateExpanded'; + UpdateViaIdentityExpanded = 'Az.SiteRecovery.private\Update-AzSiteRecoveryReplicationNetworkMapping_UpdateViaIdentityExpanded'; + } + if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/Update-AzSiteRecoveryReplicationPolicy.ps1 b/swaggerci/recoveryservicessiterecovery/exports/Update-AzSiteRecoveryReplicationPolicy.ps1 new file mode 100644 index 000000000000..3ab0381ae472 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/Update-AzSiteRecoveryReplicationPolicy.ps1 @@ -0,0 +1,237 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to update a replication policy. +.Description +The operation to update a replication policy. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicy +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/update-azsiterecoveryreplicationpolicy +#> +function Update-AzSiteRecoveryReplicationPolicy { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicy])] +[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Policy Id. + ${PolicyName}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The class type. + ${ReplicationProviderSettingInstanceType}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + UpdateExpanded = 'Az.SiteRecovery.private\Update-AzSiteRecoveryReplicationPolicy_UpdateExpanded'; + UpdateViaIdentityExpanded = 'Az.SiteRecovery.private\Update-AzSiteRecoveryReplicationPolicy_UpdateViaIdentityExpanded'; + } + if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/Update-AzSiteRecoveryReplicationProtectedItem.ps1 b/swaggerci/recoveryservicessiterecovery/exports/Update-AzSiteRecoveryReplicationProtectedItem.ps1 new file mode 100644 index 000000000000..db9c15ab764e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/Update-AzSiteRecoveryReplicationProtectedItem.ps1 @@ -0,0 +1,334 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to update the recovery settings of an ASR replication protected item. +.Description +The operation to update the recovery settings of an ASR replication protected item. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. + +VMNIC : The list of VM nic details. + [EnableAcceleratedNetworkingOnRecovery ]: Whether the NIC has accelerated networking enabled. + [EnableAcceleratedNetworkingOnTfo ]: Whether the test NIC has accelerated networking enabled. + [IPConfig ]: The IP configurations to be used by NIC during test failover and failover. + [IPConfigName ]: + [IsPrimary ]: + [IsSeletedForFailover ]: + [RecoveryLbBackendAddressPoolId ]: + [RecoveryPublicIPAddressId ]: + [RecoveryStaticIPAddress ]: + [RecoverySubnetName ]: + [TfoLbBackendAddressPoolId ]: + [TfoPublicIPAddressId ]: + [TfoStaticIPAddress ]: + [TfoSubnetName ]: + [NicId ]: The nic Id. + [RecoveryNetworkSecurityGroupId ]: The id of the NSG associated with the NIC. + [RecoveryNicName ]: The name of the NIC to be used when creating target NICs. + [RecoveryNicResourceGroupName ]: The resource group of the NIC to be used when creating target NICs. + [ReuseExistingNic ]: A value indicating whether an existing NIC is allowed to be reused during failover subject to availability. + [SelectionType ]: Selection type for failover. + [TargetNicName ]: Target NIC name. + [TfoNetworkSecurityGroupId ]: The NSG to be used by NIC during test failover. + [TfoNicName ]: The name of the NIC to be used when creating target NICs in TFO. + [TfoNicResourceGroupName ]: The resource group of the NIC to be used when creating target NICs in TFO. + [TfoReuseExistingNic ]: A value indicating whether an existing NIC is allowed to be reused during test failover subject to availability. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/update-azsiterecoveryreplicationprotecteditem +#> +function Update-AzSiteRecoveryReplicationProtectedItem { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem])] +[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Fabric name. + ${FabricName}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Protection container name. + ${ProtectionContainerName}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Replication protected item name. + ${ReplicatedProtectedItemName}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The selected option to enable RDP\SSH on target vm after failover. + # String value of SrsDataContract.EnableRDPOnTargetOption enum. + ${EnableRdpOnTargetOption}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.LicenseType])] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.LicenseType] + # License type. + ${LicenseType}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The class type. + ${ProviderSpecificDetailInstanceType}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The target availability set Id. + ${RecoveryAvailabilitySetId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # Target Azure VM name given by the user. + ${RecoveryAzureVMName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # Target Azure VM size. + ${RecoveryAzureVMSize}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # Target Azure Network Id. + ${SelectedRecoveryAzureNetworkId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The selected source nic Id which will be used as the primary nic during failover. + ${SelectedSourceNicId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The Azure Network Id for test failover. + ${SelectedTfoAzureNetworkId}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicInputDetails[]] + # The list of VM nic details. + # To construct, see NOTES section for VMNIC properties and create a hash table. + ${VMNic}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + UpdateExpanded = 'Az.SiteRecovery.private\Update-AzSiteRecoveryReplicationProtectedItem_UpdateExpanded'; + UpdateViaIdentityExpanded = 'Az.SiteRecovery.private\Update-AzSiteRecoveryReplicationProtectedItem_UpdateViaIdentityExpanded'; + } + if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/Update-AzSiteRecoveryReplicationProtectedItemAppliance.ps1 b/swaggerci/recoveryservicessiterecovery/exports/Update-AzSiteRecoveryReplicationProtectedItemAppliance.ps1 new file mode 100644 index 000000000000..06a5fc7a1c92 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/Update-AzSiteRecoveryReplicationProtectedItemAppliance.ps1 @@ -0,0 +1,255 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to update appliance of an ASR replication protected item. +.Description +The operation to update appliance of an ASR replication protected item. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/update-azsiterecoveryreplicationprotecteditemappliance +#> +function Update-AzSiteRecoveryReplicationProtectedItemAppliance { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem])] +[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Fabric name. + ${FabricName}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Protection container name. + ${ProtectionContainerName}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Replication protected item name. + ${ReplicatedProtectedItemName}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The class type. + ${ProviderSpecificDetailInstanceType}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The target appliance Id. + ${TargetApplianceId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + UpdateExpanded = 'Az.SiteRecovery.private\Update-AzSiteRecoveryReplicationProtectedItemAppliance_UpdateExpanded'; + UpdateViaIdentityExpanded = 'Az.SiteRecovery.private\Update-AzSiteRecoveryReplicationProtectedItemAppliance_UpdateViaIdentityExpanded'; + } + if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/Update-AzSiteRecoveryReplicationProtectedItemMobilityService.ps1 b/swaggerci/recoveryservicessiterecovery/exports/Update-AzSiteRecoveryReplicationProtectedItemMobilityService.ps1 new file mode 100644 index 000000000000..4e0a74435dc1 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/Update-AzSiteRecoveryReplicationProtectedItemMobilityService.ps1 @@ -0,0 +1,249 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to update(push update) the installed mobility service software on a replication protected item to the latest available version. +.Description +The operation to update(push update) the installed mobility service software on a replication protected item to the latest available version. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/update-azsiterecoveryreplicationprotecteditemmobilityservice +#> +function Update-AzSiteRecoveryReplicationProtectedItemMobilityService { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem])] +[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the fabric containing the protected item. + ${FabricName}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the container containing the protected item. + ${ProtectionContainerName}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the protected item on which the agent is to be updated. + ${ReplicatedProtectedItemName}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The CS run as account Id. + ${RunAsAccountId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + UpdateExpanded = 'Az.SiteRecovery.private\Update-AzSiteRecoveryReplicationProtectedItemMobilityService_UpdateExpanded'; + UpdateViaIdentityExpanded = 'Az.SiteRecovery.private\Update-AzSiteRecoveryReplicationProtectedItemMobilityService_UpdateViaIdentityExpanded'; + } + if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/Update-AzSiteRecoveryReplicationProtectionContainerMapping.ps1 b/swaggerci/recoveryservicessiterecovery/exports/Update-AzSiteRecoveryReplicationProtectionContainerMapping.ps1 new file mode 100644 index 000000000000..66c2619b7895 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/Update-AzSiteRecoveryReplicationProtectionContainerMapping.ps1 @@ -0,0 +1,249 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to update protection container mapping. +.Description +The operation to update protection container mapping. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMapping +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/update-azsiterecoveryreplicationprotectioncontainermapping +#> +function Update-AzSiteRecoveryReplicationProtectionContainerMapping { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMapping])] +[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Fabric name. + ${FabricName}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Protection container mapping name. + ${MappingName}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Protection container name. + ${ProtectionContainerName}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The class type. + ${ProviderSpecificInputInstanceType}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + UpdateExpanded = 'Az.SiteRecovery.private\Update-AzSiteRecoveryReplicationProtectionContainerMapping_UpdateExpanded'; + UpdateViaIdentityExpanded = 'Az.SiteRecovery.private\Update-AzSiteRecoveryReplicationProtectionContainerMapping_UpdateViaIdentityExpanded'; + } + if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/Update-AzSiteRecoveryReplicationRecoveryPlan.ps1 b/swaggerci/recoveryservicessiterecovery/exports/Update-AzSiteRecoveryReplicationRecoveryPlan.ps1 new file mode 100644 index 000000000000..0c3ef66dc30b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/Update-AzSiteRecoveryReplicationRecoveryPlan.ps1 @@ -0,0 +1,251 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to update a recovery plan. +.Description +The operation to update a recovery plan. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +GROUP : The recovery plan groups. + GroupType : The group type. + [EndGroupAction ]: The end group actions. + ActionName : The action name. + CustomDetailInstanceType : Gets the type of action details (see RecoveryPlanActionDetailsTypes enum for possible values). + FailoverDirection : The list of failover directions. + FailoverType : The list of failover types. + [ReplicationProtectedItem ]: The list of protected items. + [Id ]: The ARM Id of the recovery plan protected item. + [VirtualMachineId ]: The virtual machine Id. + [StartGroupAction ]: The start group actions. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/update-azsiterecoveryreplicationrecoveryplan +#> +function Update-AzSiteRecoveryReplicationRecoveryPlan { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan])] +[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Recovery plan name. + ${RecoveryPlanName}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroup[]] + # The recovery plan groups. + # To construct, see NOTES section for GROUP properties and create a hash table. + ${Group}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + UpdateExpanded = 'Az.SiteRecovery.private\Update-AzSiteRecoveryReplicationRecoveryPlan_UpdateExpanded'; + UpdateViaIdentityExpanded = 'Az.SiteRecovery.private\Update-AzSiteRecoveryReplicationRecoveryPlan_UpdateViaIdentityExpanded'; + } + if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/Update-AzSiteRecoveryReplicationRecoveryServiceProvider.ps1 b/swaggerci/recoveryservicessiterecovery/exports/Update-AzSiteRecoveryReplicationRecoveryServiceProvider.ps1 new file mode 100644 index 000000000000..31634222f66e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/Update-AzSiteRecoveryReplicationRecoveryServiceProvider.ps1 @@ -0,0 +1,237 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to refresh the information from the recovery services provider. +.Description +The operation to refresh the information from the recovery services provider. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProvider +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/update-azsiterecoveryreplicationrecoveryserviceprovider +#> +function Update-AzSiteRecoveryReplicationRecoveryServiceProvider { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProvider])] +[CmdletBinding(DefaultParameterSetName='Refresh', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Refresh', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Fabric name. + ${FabricName}, + + [Parameter(ParameterSetName='Refresh', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Recovery services provider name. + ${ProviderName}, + + [Parameter(ParameterSetName='Refresh', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Refresh', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Refresh')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='RefreshViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Refresh = 'Az.SiteRecovery.private\Update-AzSiteRecoveryReplicationRecoveryServiceProvider_Refresh'; + RefreshViaIdentity = 'Az.SiteRecovery.private\Update-AzSiteRecoveryReplicationRecoveryServiceProvider_RefreshViaIdentity'; + } + if (('Refresh') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/Update-AzSiteRecoveryReplicationVaultHealth.ps1 b/swaggerci/recoveryservicessiterecovery/exports/Update-AzSiteRecoveryReplicationVaultHealth.ps1 new file mode 100644 index 000000000000..eee5a41463e8 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/Update-AzSiteRecoveryReplicationVaultHealth.ps1 @@ -0,0 +1,225 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Refreshes health summary of the vault. +.Description +Refreshes health summary of the vault. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthDetails +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/update-azsiterecoveryreplicationvaulthealth +#> +function Update-AzSiteRecoveryReplicationVaultHealth { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthDetails])] +[CmdletBinding(DefaultParameterSetName='Refresh', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Refresh', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Refresh', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Refresh')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='RefreshViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Refresh = 'Az.SiteRecovery.private\Update-AzSiteRecoveryReplicationVaultHealth_Refresh'; + RefreshViaIdentity = 'Az.SiteRecovery.private\Update-AzSiteRecoveryReplicationVaultHealth_RefreshViaIdentity'; + } + if (('Refresh') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/exports/Update-AzSiteRecoveryReplicationvCenter.ps1 b/swaggerci/recoveryservicessiterecovery/exports/Update-AzSiteRecoveryReplicationvCenter.ps1 new file mode 100644 index 000000000000..779d4b5557a3 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/exports/Update-AzSiteRecoveryReplicationvCenter.ps1 @@ -0,0 +1,267 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +The operation to update a registered vCenter. +.Description +The operation to update a registered vCenter. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenter +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AlertSettingName ]: The name of the email notification configuration. + [EventName ]: The name of the Azure Site Recovery event. + [FabricName ]: Fabric name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job identifier. + [LogicalNetworkName ]: Logical network name. + [MappingName ]: Protection Container mapping name. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ResourceGroupName ]: The name of the resource group where the recovery services vault is present. + [ResourceName ]: The name of the recovery services vault. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The subscription Id. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: vcenter name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/update-azsiterecoveryreplicationvcenter +#> +function Update-AzSiteRecoveryReplicationvCenter { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenter])] +[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # Fabric name. + ${FabricName}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # vcenter name. + ${VcenterName}, + + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The friendly name of the vCenter. + ${FriendlyName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The IP address of the vCenter to be discovered. + ${IPAddress}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The port number for discovery. + ${Port}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The process server Id from where the update can be orchestrated. + ${ProcessServerId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Body')] + [System.String] + # The CS account Id which has privileges to update the vCenter. + ${RunAsAccountId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + UpdateExpanded = 'Az.SiteRecovery.private\Update-AzSiteRecoveryReplicationvCenter_UpdateExpanded'; + UpdateViaIdentityExpanded = 'Az.SiteRecovery.private\Update-AzSiteRecoveryReplicationvCenter_UpdateViaIdentityExpanded'; + } + if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/generate-help.ps1 b/swaggerci/recoveryservicessiterecovery/generate-help.ps1 new file mode 100644 index 000000000000..60e2213c8a5c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generate-help.ps1 @@ -0,0 +1,66 @@ +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- +param([switch]$Isolated) +$ErrorActionPreference = 'Stop' + +$pwsh = [System.Diagnostics.Process]::GetCurrentProcess().Path +if(-not $Isolated) { + Write-Host -ForegroundColor Green 'Creating isolated process...' + & "$pwsh" -NonInteractive -NoLogo -NoProfile -File $MyInvocation.MyCommand.Path @PSBoundParameters -Isolated + return +} + +$exportsFolder = Join-Path $PSScriptRoot 'exports' +if(-not (Test-Path $exportsFolder)) { + Write-Error "Exports folder '$exportsFolder' was not found." +} + +$directories = Get-ChildItem -Directory -Path $exportsFolder +$hasProfiles = ($directories | Measure-Object).Count -gt 0 +if(-not $hasProfiles) { + $directories = Get-Item -Path $exportsFolder +} + +$docsFolder = Join-Path $PSScriptRoot 'docs' +if(Test-Path $docsFolder) { + $null = Get-ChildItem -Path $docsFolder -Recurse -Exclude 'README.md' | Remove-Item -Recurse -ErrorAction SilentlyContinue +} +$null = New-Item -ItemType Directory -Force -Path $docsFolder -ErrorAction SilentlyContinue +$examplesFolder = Join-Path $PSScriptRoot 'examples' + +$modulePsd1 = Get-Item -Path (Join-Path $PSScriptRoot './Az.SiteRecovery.psd1') +$modulePath = $modulePsd1.FullName +$moduleName = $modulePsd1.BaseName + +# Load DLL to use build-time cmdlets +Import-Module -Name $modulePath +Import-Module -Name (Join-Path $PSScriptRoot './bin/Az.SiteRecovery.private.dll') +$instance = [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module]::Instance +# Module info is shared per profile +$moduleInfo = Get-Module -Name $moduleName + +foreach($directory in $directories) +{ + if($hasProfiles) { + Select-AzProfile -Name $directory.Name + } + # Reload module per profile + Import-Module -Name $modulePath -Force + + $cmdletNames = Get-ScriptCmdlet -ScriptFolder $directory.FullName + $cmdletHelpInfo = $cmdletNames | ForEach-Object { Get-Help -Name $_ -Full } + $cmdletFunctionInfo = Get-ScriptCmdlet -ScriptFolder $directory.FullName -AsFunctionInfo + + $docsPath = Join-Path $docsFolder $directory.Name + $null = New-Item -ItemType Directory -Force -Path $docsPath -ErrorAction SilentlyContinue + $examplesPath = Join-Path $examplesFolder $directory.Name + + Export-HelpMarkdown -ModuleInfo $moduleInfo -FunctionInfo $cmdletFunctionInfo -HelpInfo $cmdletHelpInfo -DocsFolder $docsPath -ExamplesFolder $examplesPath + Write-Host -ForegroundColor Green "Created documentation in '$docsPath'" +} + +Write-Host -ForegroundColor Green '-------------Done-------------' \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/Module.cs b/swaggerci/recoveryservicessiterecovery/generated/Module.cs new file mode 100644 index 000000000000..eba1e665f793 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/Module.cs @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using SendAsyncStepDelegate = global::System.Func, global::System.Threading.Tasks.Task>, global::System.Func, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>; + using PipelineChangeDelegate = global::System.Action, global::System.Threading.Tasks.Task>, global::System.Func, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>>; + using GetParameterDelegate = global::System.Func; + using ModuleLoadPipelineDelegate = global::System.Action, global::System.Threading.Tasks.Task>, global::System.Func, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>>, global::System.Action, global::System.Threading.Tasks.Task>, global::System.Func, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>>>; + using ArgumentCompleterDelegate = global::System.Func; + using GetTelemetryIdDelegate = global::System.Func; + using TelemetryDelegate = global::System.Action; + using NewRequestPipelineDelegate = global::System.Action, global::System.Threading.Tasks.Task>, global::System.Func, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>>, global::System.Action, global::System.Threading.Tasks.Task>, global::System.Func, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>>>; + using SignalDelegate = global::System.Func, global::System.Threading.Tasks.Task>; + using EventListenerDelegate = global::System.Func, global::System.Func, global::System.Threading.Tasks.Task>, global::System.Management.Automation.InvocationInfo, string, string, string, global::System.Exception, global::System.Threading.Tasks.Task>; + using NextDelegate = global::System.Func, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>; + + /// A class that contains the module-common code and data. + public partial class Module + { + /// The currently selected profile. + public string Profile = global::System.String.Empty; + + public global::System.Net.Http.HttpClientHandler _handler = new global::System.Net.Http.HttpClientHandler(); + + /// the ISendAsync pipeline instance + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline _pipeline; + + /// the ISendAsync pipeline instance (when proxy is enabled) + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline _pipelineWithProxy; + + public bool _useProxy = false; + + public global::System.Net.WebProxy _webProxy = new global::System.Net.WebProxy(); + + /// Gets completion data for azure specific fields + public ArgumentCompleterDelegate ArgumentCompleter { get; set; } + + /// The instance of the Client API + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient ClientAPI { get; set; } + + /// A delegate that gets called for each signalled event + public EventListenerDelegate EventListener { get; set; } + + /// The delegate to call to get parameter data from a common module. + public GetParameterDelegate GetParameterValue { get; set; } + + /// The delegate to get the telemetry Id. + public GetTelemetryIdDelegate GetTelemetryId { get; set; } + + /// Backing field for property. + private static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module _instance; + + /// the singleton of this module class + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module Instance => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module._instance?? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module._instance = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module()); + + /// The Name of this module + public string Name => @"Az.SiteRecovery"; + + /// The delegate to call when this module is loaded (supporting a commmon module). + public ModuleLoadPipelineDelegate OnModuleLoad { get; set; } + + /// The delegate to call before each new request (supporting a commmon module). + public NewRequestPipelineDelegate OnNewRequest { get; set; } + + /// The name of the currently selected Azure profile + public global::System.String ProfileName { get; set; } + + /// The ResourceID for this module (azure arm). + public string ResourceId => @"Az.SiteRecovery"; + + /// The delegate for creating a telemetry. + public TelemetryDelegate Telemetry { get; set; } + + /// The from the cmdlet + /// The HttpPipeline for the request + + partial void AfterCreatePipeline(global::System.Management.Automation.InvocationInfo invocationInfo, ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline pipeline); + + /// The from the cmdlet + /// The HttpPipeline for the request + + partial void BeforeCreatePipeline(global::System.Management.Automation.InvocationInfo invocationInfo, ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline pipeline); + + partial void CustomInit(); + + /// Creates an instance of the HttpPipeline for each call. + /// The from the cmdlet + /// the cmdlet's correlation id. + /// the cmdlet's process record correlation id. + /// the cmdlet's parameterset name. + /// a dict for extensible parameters + /// An instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline for the remote call. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline CreatePipeline(global::System.Management.Automation.InvocationInfo invocationInfo, string correlationId, string processRecordId, string parameterSetName = null, global::System.Collections.Generic.IDictionary extensibleParameters = null) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline pipeline = null; + BeforeCreatePipeline(invocationInfo, ref pipeline); + pipeline = (pipeline ?? (_useProxy ? _pipelineWithProxy : _pipeline)).Clone(); + AfterCreatePipeline(invocationInfo, ref pipeline); + pipeline.Append(new Runtime.CmdInfoHandler(processRecordId, invocationInfo, parameterSetName).SendAsync); + OnNewRequest?.Invoke( invocationInfo, correlationId,processRecordId, (step)=> { pipeline.Prepend(step); } , (step)=> { pipeline.Append(step); } ); + return pipeline; + } + + /// Gets parameters from a common module. + /// The from the cmdlet + /// the cmdlet's correlation id. + /// The name of the parameter to get the value for. + /// + /// The parameter value from the common module. (Note: this should be type converted on the way back) + /// + public object GetParameter(global::System.Management.Automation.InvocationInfo invocationInfo, string correlationId, string parameterName) => GetParameterValue?.Invoke( ResourceId, Name, invocationInfo, correlationId,parameterName ); + + /// Initialization steps performed after the module is loaded. + public void Init() + { + OnModuleLoad?.Invoke( ResourceId, Name ,(step)=> { _pipeline.Prepend(step); } , (step)=> { _pipeline.Append(step); } ); + OnModuleLoad?.Invoke( ResourceId, Name ,(step)=> { _pipelineWithProxy.Prepend(step); } , (step)=> { _pipelineWithProxy.Append(step); } ); + CustomInit(); + } + + /// Creates the module instance. + private Module() + { + // constructor + ClientAPI = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient(); + _handler.Proxy = _webProxy; + _pipeline = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpClientFactory(new global::System.Net.Http.HttpClient())); + _pipelineWithProxy = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpClientFactory(new global::System.Net.Http.HttpClient(_handler))); + } + + /// The HTTP Proxy to use. + /// The HTTP Proxy Credentials + /// True if the proxy should use default credentials + public void SetProxyConfiguration(global::System.Uri proxy, global::System.Management.Automation.PSCredential proxyCredential, bool proxyUseDefaultCredentials) + { + _useProxy = proxy != null; + if (proxy == null) + { + return; + } + // set the proxy configuration + _webProxy.Address = proxy; + _webProxy.BypassProxyOnLocal = false; + if (proxyUseDefaultCredentials) + { + _webProxy.Credentials = null; + _webProxy.UseDefaultCredentials = true; + } + else + { + _webProxy.UseDefaultCredentials = false; + _webProxy.Credentials = proxyCredential ?.GetNetworkCredential(); + } + } + + /// Called to dispatch events to the common module listener + /// The ID of the event + /// The cancellation token for the event + /// A delegate to get the detailed event data + /// The callback for the event dispatcher + /// The from the cmdlet + /// the cmdlet's parameterset name. + /// the cmdlet's correlation id. + /// the cmdlet's process record correlation id. + /// the exception that is being thrown (if available) + /// + /// A that will be complete when handling of the event is completed. + /// + public async global::System.Threading.Tasks.Task Signal(string id, global::System.Threading.CancellationToken token, global::System.Func getEventData, SignalDelegate signal, global::System.Management.Automation.InvocationInfo invocationInfo, string parameterSetName, string correlationId, string processRecordId, global::System.Exception exception) + { + using( NoSynchronizationContext ) + { + await EventListener?.Invoke(id,token,getEventData, signal, invocationInfo, parameterSetName, correlationId,processRecordId,exception); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Any.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Any.PowerShell.cs new file mode 100644 index 000000000000..9491be48cc66 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Any.PowerShell.cs @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Any object + [System.ComponentModel.TypeConverter(typeof(AnyTypeConverter))] + public partial class Any + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal Any(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal Any(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.IAny DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new Any(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.IAny DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new Any(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.IAny FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Any object + [System.ComponentModel.TypeConverter(typeof(AnyTypeConverter))] + public partial interface IAny + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Any.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Any.TypeConverter.cs new file mode 100644 index 000000000000..5bf09c7b41e1 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Any.TypeConverter.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class AnyTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.IAny ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.IAny).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return Any.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return Any.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return Any.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Any.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Any.cs new file mode 100644 index 000000000000..048894cef06c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Any.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Any object + public partial class Any : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.IAny, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.IAnyInternal + { + + /// Creates an new instance. + public Any() + { + + } + } + /// Any object + public partial interface IAny : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + + } + /// Any object + internal partial interface IAnyInternal + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Any.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Any.json.cs new file mode 100644 index 000000000000..d758afb347a2 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Any.json.cs @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Any object + public partial class Any + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal Any(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.IAny. + /// + /// a to deserialize from. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.IAny. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.IAny FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new Any(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AAddDisksInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AAddDisksInput.PowerShell.cs new file mode 100644 index 000000000000..f3be1169f539 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AAddDisksInput.PowerShell.cs @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// A2A add disk(s) input. + [System.ComponentModel.TypeConverter(typeof(A2AAddDisksInputTypeConverter))] + public partial class A2AAddDisksInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal A2AAddDisksInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("VMDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AAddDisksInputInternal)this).VMDisk = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmDiskInputDetails[]) content.GetValueForProperty("VMDisk",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AAddDisksInputInternal)this).VMDisk, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2AvmDiskInputDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("VMManagedDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AAddDisksInputInternal)this).VMManagedDisk = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskInputDetails[]) content.GetValueForProperty("VMManagedDisk",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AAddDisksInputInternal)this).VMManagedDisk, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2AvmManagedDiskInputDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal A2AAddDisksInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("VMDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AAddDisksInputInternal)this).VMDisk = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmDiskInputDetails[]) content.GetValueForProperty("VMDisk",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AAddDisksInputInternal)this).VMDisk, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2AvmDiskInputDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("VMManagedDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AAddDisksInputInternal)this).VMManagedDisk = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskInputDetails[]) content.GetValueForProperty("VMManagedDisk",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AAddDisksInputInternal)this).VMManagedDisk, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2AvmManagedDiskInputDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AAddDisksInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new A2AAddDisksInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AAddDisksInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new A2AAddDisksInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AAddDisksInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// A2A add disk(s) input. + [System.ComponentModel.TypeConverter(typeof(A2AAddDisksInputTypeConverter))] + public partial interface IA2AAddDisksInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AAddDisksInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AAddDisksInput.TypeConverter.cs new file mode 100644 index 000000000000..985961d0843c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AAddDisksInput.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class A2AAddDisksInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AAddDisksInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AAddDisksInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return A2AAddDisksInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return A2AAddDisksInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return A2AAddDisksInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AAddDisksInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AAddDisksInput.cs new file mode 100644 index 000000000000..a3e8996763eb --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AAddDisksInput.cs @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// A2A add disk(s) input. + public partial class A2AAddDisksInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AAddDisksInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AAddDisksInputInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksProviderSpecificInput __addDisksProviderSpecificInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AddDisksProviderSpecificInput(); + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksProviderSpecificInputInternal)__addDisksProviderSpecificInput).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksProviderSpecificInputInternal)__addDisksProviderSpecificInput).InstanceType = value ; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmDiskInputDetails[] _vMDisk; + + /// The list of vm disk details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmDiskInputDetails[] VMDisk { get => this._vMDisk; set => this._vMDisk = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskInputDetails[] _vMManagedDisk; + + /// The list of vm managed disk details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskInputDetails[] VMManagedDisk { get => this._vMManagedDisk; set => this._vMManagedDisk = value; } + + /// Creates an new instance. + public A2AAddDisksInput() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__addDisksProviderSpecificInput), __addDisksProviderSpecificInput); + await eventListener.AssertObjectIsValid(nameof(__addDisksProviderSpecificInput), __addDisksProviderSpecificInput); + } + } + /// A2A add disk(s) input. + public partial interface IA2AAddDisksInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksProviderSpecificInput + { + /// The list of vm disk details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of vm disk details.", + SerializedName = @"vmDisks", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmDiskInputDetails) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmDiskInputDetails[] VMDisk { get; set; } + /// The list of vm managed disk details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of vm managed disk details.", + SerializedName = @"vmManagedDisks", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskInputDetails) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskInputDetails[] VMManagedDisk { get; set; } + + } + /// A2A add disk(s) input. + internal partial interface IA2AAddDisksInputInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksProviderSpecificInputInternal + { + /// The list of vm disk details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmDiskInputDetails[] VMDisk { get; set; } + /// The list of vm managed disk details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskInputDetails[] VMManagedDisk { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AAddDisksInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AAddDisksInput.json.cs new file mode 100644 index 000000000000..b2213fe763dd --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AAddDisksInput.json.cs @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// A2A add disk(s) input. + public partial class A2AAddDisksInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal A2AAddDisksInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __addDisksProviderSpecificInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AddDisksProviderSpecificInput(json); + {_vMDisk = If( json?.PropertyT("vmDisks"), out var __jsonVMDisks) ? If( __jsonVMDisks as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmDiskInputDetails) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2AvmDiskInputDetails.FromJson(__u) )) ))() : null : VMDisk;} + {_vMManagedDisk = If( json?.PropertyT("vmManagedDisks"), out var __jsonVMManagedDisks) ? If( __jsonVMManagedDisks as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __q) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__q, (__p)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskInputDetails) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2AvmManagedDiskInputDetails.FromJson(__p) )) ))() : null : VMManagedDisk;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AAddDisksInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AAddDisksInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AAddDisksInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new A2AAddDisksInput(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __addDisksProviderSpecificInput?.ToJson(container, serializationMode); + if (null != this._vMDisk) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._vMDisk ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("vmDisks",__w); + } + if (null != this._vMManagedDisk) + { + var __r = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __s in this._vMManagedDisk ) + { + AddIf(__s?.ToJson(null, serializationMode) ,__r.Add); + } + container.Add("vmManagedDisks",__r); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AApplyRecoveryPointInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AApplyRecoveryPointInput.PowerShell.cs new file mode 100644 index 000000000000..3b2c6fadf59a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AApplyRecoveryPointInput.PowerShell.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// ApplyRecoveryPoint input specific to A2A provider. + [System.ComponentModel.TypeConverter(typeof(A2AApplyRecoveryPointInputTypeConverter))] + public partial class A2AApplyRecoveryPointInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal A2AApplyRecoveryPointInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal A2AApplyRecoveryPointInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AApplyRecoveryPointInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new A2AApplyRecoveryPointInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AApplyRecoveryPointInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new A2AApplyRecoveryPointInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AApplyRecoveryPointInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// ApplyRecoveryPoint input specific to A2A provider. + [System.ComponentModel.TypeConverter(typeof(A2AApplyRecoveryPointInputTypeConverter))] + public partial interface IA2AApplyRecoveryPointInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AApplyRecoveryPointInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AApplyRecoveryPointInput.TypeConverter.cs new file mode 100644 index 000000000000..380b00bc6101 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AApplyRecoveryPointInput.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class A2AApplyRecoveryPointInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AApplyRecoveryPointInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AApplyRecoveryPointInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return A2AApplyRecoveryPointInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return A2AApplyRecoveryPointInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return A2AApplyRecoveryPointInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AApplyRecoveryPointInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AApplyRecoveryPointInput.cs new file mode 100644 index 000000000000..52bc59cf72e7 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AApplyRecoveryPointInput.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// ApplyRecoveryPoint input specific to A2A provider. + public partial class A2AApplyRecoveryPointInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AApplyRecoveryPointInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AApplyRecoveryPointInputInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointProviderSpecificInput __applyRecoveryPointProviderSpecificInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ApplyRecoveryPointProviderSpecificInput(); + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointProviderSpecificInputInternal)__applyRecoveryPointProviderSpecificInput).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointProviderSpecificInputInternal)__applyRecoveryPointProviderSpecificInput).InstanceType = value ; } + + /// Creates an new instance. + public A2AApplyRecoveryPointInput() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__applyRecoveryPointProviderSpecificInput), __applyRecoveryPointProviderSpecificInput); + await eventListener.AssertObjectIsValid(nameof(__applyRecoveryPointProviderSpecificInput), __applyRecoveryPointProviderSpecificInput); + } + } + /// ApplyRecoveryPoint input specific to A2A provider. + public partial interface IA2AApplyRecoveryPointInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointProviderSpecificInput + { + + } + /// ApplyRecoveryPoint input specific to A2A provider. + internal partial interface IA2AApplyRecoveryPointInputInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointProviderSpecificInputInternal + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AApplyRecoveryPointInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AApplyRecoveryPointInput.json.cs new file mode 100644 index 000000000000..85cc899d3df7 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AApplyRecoveryPointInput.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// ApplyRecoveryPoint input specific to A2A provider. + public partial class A2AApplyRecoveryPointInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal A2AApplyRecoveryPointInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __applyRecoveryPointProviderSpecificInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ApplyRecoveryPointProviderSpecificInput(json); + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AApplyRecoveryPointInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AApplyRecoveryPointInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AApplyRecoveryPointInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new A2AApplyRecoveryPointInput(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __applyRecoveryPointProviderSpecificInput?.ToJson(container, serializationMode); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AContainerCreationInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AContainerCreationInput.PowerShell.cs new file mode 100644 index 000000000000..ea01de470884 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AContainerCreationInput.PowerShell.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// A2A cloud creation input. + [System.ComponentModel.TypeConverter(typeof(A2AContainerCreationInputTypeConverter))] + public partial class A2AContainerCreationInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal A2AContainerCreationInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerCreationInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerCreationInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal A2AContainerCreationInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerCreationInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerCreationInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AContainerCreationInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new A2AContainerCreationInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AContainerCreationInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new A2AContainerCreationInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AContainerCreationInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// A2A cloud creation input. + [System.ComponentModel.TypeConverter(typeof(A2AContainerCreationInputTypeConverter))] + public partial interface IA2AContainerCreationInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AContainerCreationInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AContainerCreationInput.TypeConverter.cs new file mode 100644 index 000000000000..a26abb7cad39 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AContainerCreationInput.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class A2AContainerCreationInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AContainerCreationInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AContainerCreationInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return A2AContainerCreationInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return A2AContainerCreationInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return A2AContainerCreationInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AContainerCreationInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AContainerCreationInput.cs new file mode 100644 index 000000000000..6007291d3e4a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AContainerCreationInput.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// A2A cloud creation input. + public partial class A2AContainerCreationInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AContainerCreationInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AContainerCreationInputInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerCreationInput __replicationProviderSpecificContainerCreationInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProviderSpecificContainerCreationInput(); + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerCreationInputInternal)__replicationProviderSpecificContainerCreationInput).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerCreationInputInternal)__replicationProviderSpecificContainerCreationInput).InstanceType = value ; } + + /// Creates an new instance. + public A2AContainerCreationInput() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__replicationProviderSpecificContainerCreationInput), __replicationProviderSpecificContainerCreationInput); + await eventListener.AssertObjectIsValid(nameof(__replicationProviderSpecificContainerCreationInput), __replicationProviderSpecificContainerCreationInput); + } + } + /// A2A cloud creation input. + public partial interface IA2AContainerCreationInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerCreationInput + { + + } + /// A2A cloud creation input. + internal partial interface IA2AContainerCreationInputInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerCreationInputInternal + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AContainerCreationInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AContainerCreationInput.json.cs new file mode 100644 index 000000000000..85eb9e3d77ad --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AContainerCreationInput.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// A2A cloud creation input. + public partial class A2AContainerCreationInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal A2AContainerCreationInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __replicationProviderSpecificContainerCreationInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProviderSpecificContainerCreationInput(json); + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AContainerCreationInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AContainerCreationInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AContainerCreationInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new A2AContainerCreationInput(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __replicationProviderSpecificContainerCreationInput?.ToJson(container, serializationMode); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AContainerMappingInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AContainerMappingInput.PowerShell.cs new file mode 100644 index 000000000000..f938d9b05482 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AContainerMappingInput.PowerShell.cs @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// A2A container mapping input. + [System.ComponentModel.TypeConverter(typeof(A2AContainerMappingInputTypeConverter))] + public partial class A2AContainerMappingInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal A2AContainerMappingInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("AgentAutoUpdateStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AContainerMappingInputInternal)this).AgentAutoUpdateStatus = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentAutoUpdateStatus?) content.GetValueForProperty("AgentAutoUpdateStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AContainerMappingInputInternal)this).AgentAutoUpdateStatus, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentAutoUpdateStatus.CreateFrom); + } + if (content.Contains("AutomationAccountArmId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AContainerMappingInputInternal)this).AutomationAccountArmId = (string) content.GetValueForProperty("AutomationAccountArmId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AContainerMappingInputInternal)this).AutomationAccountArmId, global::System.Convert.ToString); + } + if (content.Contains("AutomationAccountAuthenticationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AContainerMappingInputInternal)this).AutomationAccountAuthenticationType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AutomationAccountAuthenticationType?) content.GetValueForProperty("AutomationAccountAuthenticationType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AContainerMappingInputInternal)this).AutomationAccountAuthenticationType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AutomationAccountAuthenticationType.CreateFrom); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerMappingInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerMappingInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal A2AContainerMappingInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("AgentAutoUpdateStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AContainerMappingInputInternal)this).AgentAutoUpdateStatus = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentAutoUpdateStatus?) content.GetValueForProperty("AgentAutoUpdateStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AContainerMappingInputInternal)this).AgentAutoUpdateStatus, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentAutoUpdateStatus.CreateFrom); + } + if (content.Contains("AutomationAccountArmId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AContainerMappingInputInternal)this).AutomationAccountArmId = (string) content.GetValueForProperty("AutomationAccountArmId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AContainerMappingInputInternal)this).AutomationAccountArmId, global::System.Convert.ToString); + } + if (content.Contains("AutomationAccountAuthenticationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AContainerMappingInputInternal)this).AutomationAccountAuthenticationType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AutomationAccountAuthenticationType?) content.GetValueForProperty("AutomationAccountAuthenticationType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AContainerMappingInputInternal)this).AutomationAccountAuthenticationType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AutomationAccountAuthenticationType.CreateFrom); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerMappingInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerMappingInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AContainerMappingInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new A2AContainerMappingInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AContainerMappingInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new A2AContainerMappingInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AContainerMappingInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// A2A container mapping input. + [System.ComponentModel.TypeConverter(typeof(A2AContainerMappingInputTypeConverter))] + public partial interface IA2AContainerMappingInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AContainerMappingInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AContainerMappingInput.TypeConverter.cs new file mode 100644 index 000000000000..d97b0ebf2d70 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AContainerMappingInput.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class A2AContainerMappingInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AContainerMappingInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AContainerMappingInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return A2AContainerMappingInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return A2AContainerMappingInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return A2AContainerMappingInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AContainerMappingInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AContainerMappingInput.cs new file mode 100644 index 000000000000..ffa288441064 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AContainerMappingInput.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// A2A container mapping input. + public partial class A2AContainerMappingInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AContainerMappingInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AContainerMappingInputInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerMappingInput __replicationProviderSpecificContainerMappingInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProviderSpecificContainerMappingInput(); + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentAutoUpdateStatus? _agentAutoUpdateStatus; + + /// A value indicating whether the auto update is enabled. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentAutoUpdateStatus? AgentAutoUpdateStatus { get => this._agentAutoUpdateStatus; set => this._agentAutoUpdateStatus = value; } + + /// Backing field for property. + private string _automationAccountArmId; + + /// The automation account arm id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string AutomationAccountArmId { get => this._automationAccountArmId; set => this._automationAccountArmId = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AutomationAccountAuthenticationType? _automationAccountAuthenticationType; + + /// A value indicating the type authentication to use for automation Account. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AutomationAccountAuthenticationType? AutomationAccountAuthenticationType { get => this._automationAccountAuthenticationType; set => this._automationAccountAuthenticationType = value; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerMappingInputInternal)__replicationProviderSpecificContainerMappingInput).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerMappingInputInternal)__replicationProviderSpecificContainerMappingInput).InstanceType = value ; } + + /// Creates an new instance. + public A2AContainerMappingInput() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__replicationProviderSpecificContainerMappingInput), __replicationProviderSpecificContainerMappingInput); + await eventListener.AssertObjectIsValid(nameof(__replicationProviderSpecificContainerMappingInput), __replicationProviderSpecificContainerMappingInput); + } + } + /// A2A container mapping input. + public partial interface IA2AContainerMappingInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerMappingInput + { + /// A value indicating whether the auto update is enabled. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether the auto update is enabled.", + SerializedName = @"agentAutoUpdateStatus", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentAutoUpdateStatus) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentAutoUpdateStatus? AgentAutoUpdateStatus { get; set; } + /// The automation account arm id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The automation account arm id.", + SerializedName = @"automationAccountArmId", + PossibleTypes = new [] { typeof(string) })] + string AutomationAccountArmId { get; set; } + /// A value indicating the type authentication to use for automation Account. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating the type authentication to use for automation Account.", + SerializedName = @"automationAccountAuthenticationType", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AutomationAccountAuthenticationType) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AutomationAccountAuthenticationType? AutomationAccountAuthenticationType { get; set; } + + } + /// A2A container mapping input. + internal partial interface IA2AContainerMappingInputInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerMappingInputInternal + { + /// A value indicating whether the auto update is enabled. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentAutoUpdateStatus? AgentAutoUpdateStatus { get; set; } + /// The automation account arm id. + string AutomationAccountArmId { get; set; } + /// A value indicating the type authentication to use for automation Account. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AutomationAccountAuthenticationType? AutomationAccountAuthenticationType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AContainerMappingInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AContainerMappingInput.json.cs new file mode 100644 index 000000000000..385c0f064d24 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AContainerMappingInput.json.cs @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// A2A container mapping input. + public partial class A2AContainerMappingInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal A2AContainerMappingInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __replicationProviderSpecificContainerMappingInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProviderSpecificContainerMappingInput(json); + {_agentAutoUpdateStatus = If( json?.PropertyT("agentAutoUpdateStatus"), out var __jsonAgentAutoUpdateStatus) ? (string)__jsonAgentAutoUpdateStatus : (string)AgentAutoUpdateStatus;} + {_automationAccountArmId = If( json?.PropertyT("automationAccountArmId"), out var __jsonAutomationAccountArmId) ? (string)__jsonAutomationAccountArmId : (string)AutomationAccountArmId;} + {_automationAccountAuthenticationType = If( json?.PropertyT("automationAccountAuthenticationType"), out var __jsonAutomationAccountAuthenticationType) ? (string)__jsonAutomationAccountAuthenticationType : (string)AutomationAccountAuthenticationType;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AContainerMappingInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AContainerMappingInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AContainerMappingInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new A2AContainerMappingInput(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __replicationProviderSpecificContainerMappingInput?.ToJson(container, serializationMode); + AddIf( null != (((object)this._agentAutoUpdateStatus)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._agentAutoUpdateStatus.ToString()) : null, "agentAutoUpdateStatus" ,container.Add ); + AddIf( null != (((object)this._automationAccountArmId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._automationAccountArmId.ToString()) : null, "automationAccountArmId" ,container.Add ); + AddIf( null != (((object)this._automationAccountAuthenticationType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._automationAccountAuthenticationType.ToString()) : null, "automationAccountAuthenticationType" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ACreateProtectionIntentInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ACreateProtectionIntentInput.PowerShell.cs new file mode 100644 index 000000000000..1f408a65dfd9 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ACreateProtectionIntentInput.PowerShell.cs @@ -0,0 +1,418 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// A2A create protection intent input. + [System.ComponentModel.TypeConverter(typeof(A2ACreateProtectionIntentInputTypeConverter))] + public partial class A2ACreateProtectionIntentInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal A2ACreateProtectionIntentInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProtectionProfileCustomInput")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).ProtectionProfileCustomInput = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionProfileCustomDetails) content.GetValueForProperty("ProtectionProfileCustomInput",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).ProtectionProfileCustomInput, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProtectionProfileCustomDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("PrimaryStagingStorageAccountCustomInput")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).PrimaryStagingStorageAccountCustomInput = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageAccountCustomDetails) content.GetValueForProperty("PrimaryStagingStorageAccountCustomInput",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).PrimaryStagingStorageAccountCustomInput, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.StorageAccountCustomDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("RecoveryAvailabilitySetCustomInput")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).RecoveryAvailabilitySetCustomInput = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryAvailabilitySetCustomDetails) content.GetValueForProperty("RecoveryAvailabilitySetCustomInput",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).RecoveryAvailabilitySetCustomInput, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryAvailabilitySetCustomDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("RecoveryVirtualNetworkCustomInput")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).RecoveryVirtualNetworkCustomInput = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryVirtualNetworkCustomDetails) content.GetValueForProperty("RecoveryVirtualNetworkCustomInput",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).RecoveryVirtualNetworkCustomInput, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryVirtualNetworkCustomDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("RecoveryProximityPlacementGroupCustomInput")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).RecoveryProximityPlacementGroupCustomInput = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryProximityPlacementGroupCustomDetails) content.GetValueForProperty("RecoveryProximityPlacementGroupCustomInput",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).RecoveryProximityPlacementGroupCustomInput, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryProximityPlacementGroupCustomDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("RecoveryBootDiagStorageAccount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).RecoveryBootDiagStorageAccount = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageAccountCustomDetails) content.GetValueForProperty("RecoveryBootDiagStorageAccount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).RecoveryBootDiagStorageAccount, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.StorageAccountCustomDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("DiskEncryptionInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).DiskEncryptionInfo = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfo) content.GetValueForProperty("DiskEncryptionInfo",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).DiskEncryptionInfo, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DiskEncryptionInfoTypeConverter.ConvertFrom); + } + if (content.Contains("FabricObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).FabricObjectId = (string) content.GetValueForProperty("FabricObjectId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).FabricObjectId, global::System.Convert.ToString); + } + if (content.Contains("PrimaryLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).PrimaryLocation = (string) content.GetValueForProperty("PrimaryLocation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).PrimaryLocation, global::System.Convert.ToString); + } + if (content.Contains("RecoveryLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).RecoveryLocation = (string) content.GetValueForProperty("RecoveryLocation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).RecoveryLocation, global::System.Convert.ToString); + } + if (content.Contains("RecoverySubscriptionId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).RecoverySubscriptionId = (string) content.GetValueForProperty("RecoverySubscriptionId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).RecoverySubscriptionId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryAvailabilityType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).RecoveryAvailabilityType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.A2ARecoveryAvailabilityType) content.GetValueForProperty("RecoveryAvailabilityType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).RecoveryAvailabilityType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.A2ARecoveryAvailabilityType.CreateFrom); + } + if (content.Contains("RecoveryResourceGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).RecoveryResourceGroupId = (string) content.GetValueForProperty("RecoveryResourceGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).RecoveryResourceGroupId, global::System.Convert.ToString); + } + if (content.Contains("AutoProtectionOfDataDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).AutoProtectionOfDataDisk = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AutoProtectionOfDataDisk?) content.GetValueForProperty("AutoProtectionOfDataDisk",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).AutoProtectionOfDataDisk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AutoProtectionOfDataDisk.CreateFrom); + } + if (content.Contains("VMDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).VMDisk = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentDiskInputDetails[]) content.GetValueForProperty("VMDisk",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).VMDisk, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2AProtectionIntentDiskInputDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("VMManagedDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).VMManagedDisk = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentManagedDiskInputDetails[]) content.GetValueForProperty("VMManagedDisk",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).VMManagedDisk, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2AProtectionIntentManagedDiskInputDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("MultiVMGroupName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).MultiVMGroupName = (string) content.GetValueForProperty("MultiVMGroupName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).MultiVMGroupName, global::System.Convert.ToString); + } + if (content.Contains("MultiVMGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).MultiVMGroupId = (string) content.GetValueForProperty("MultiVMGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).MultiVMGroupId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryAvailabilityZone")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).RecoveryAvailabilityZone = (string) content.GetValueForProperty("RecoveryAvailabilityZone",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).RecoveryAvailabilityZone, global::System.Convert.ToString); + } + if (content.Contains("AgentAutoUpdateStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).AgentAutoUpdateStatus = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentAutoUpdateStatus?) content.GetValueForProperty("AgentAutoUpdateStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).AgentAutoUpdateStatus, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentAutoUpdateStatus.CreateFrom); + } + if (content.Contains("AutomationAccountAuthenticationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).AutomationAccountAuthenticationType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AutomationAccountAuthenticationType?) content.GetValueForProperty("AutomationAccountAuthenticationType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).AutomationAccountAuthenticationType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AutomationAccountAuthenticationType.CreateFrom); + } + if (content.Contains("AutomationAccountArmId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).AutomationAccountArmId = (string) content.GetValueForProperty("AutomationAccountArmId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).AutomationAccountArmId, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionIntentProviderSpecificDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionIntentProviderSpecificDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + if (content.Contains("ProtectionProfileCustomInputResourceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).ProtectionProfileCustomInputResourceType = (string) content.GetValueForProperty("ProtectionProfileCustomInputResourceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).ProtectionProfileCustomInputResourceType, global::System.Convert.ToString); + } + if (content.Contains("PrimaryStagingStorageAccountCustomInputResourceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).PrimaryStagingStorageAccountCustomInputResourceType = (string) content.GetValueForProperty("PrimaryStagingStorageAccountCustomInputResourceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).PrimaryStagingStorageAccountCustomInputResourceType, global::System.Convert.ToString); + } + if (content.Contains("RecoveryAvailabilitySetCustomInputResourceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).RecoveryAvailabilitySetCustomInputResourceType = (string) content.GetValueForProperty("RecoveryAvailabilitySetCustomInputResourceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).RecoveryAvailabilitySetCustomInputResourceType, global::System.Convert.ToString); + } + if (content.Contains("RecoveryVirtualNetworkCustomInputResourceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).RecoveryVirtualNetworkCustomInputResourceType = (string) content.GetValueForProperty("RecoveryVirtualNetworkCustomInputResourceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).RecoveryVirtualNetworkCustomInputResourceType, global::System.Convert.ToString); + } + if (content.Contains("RecoveryProximityPlacementGroupCustomInputResourceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).RecoveryProximityPlacementGroupCustomInputResourceType = (string) content.GetValueForProperty("RecoveryProximityPlacementGroupCustomInputResourceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).RecoveryProximityPlacementGroupCustomInputResourceType, global::System.Convert.ToString); + } + if (content.Contains("RecoveryBootDiagStorageAccountResourceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).RecoveryBootDiagStorageAccountResourceType = (string) content.GetValueForProperty("RecoveryBootDiagStorageAccountResourceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).RecoveryBootDiagStorageAccountResourceType, global::System.Convert.ToString); + } + if (content.Contains("DiskEncryptionInfoDiskEncryptionKeyInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).DiskEncryptionInfoDiskEncryptionKeyInfo = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionKeyInfo) content.GetValueForProperty("DiskEncryptionInfoDiskEncryptionKeyInfo",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).DiskEncryptionInfoDiskEncryptionKeyInfo, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DiskEncryptionKeyInfoTypeConverter.ConvertFrom); + } + if (content.Contains("DiskEncryptionInfoKeyEncryptionKeyInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).DiskEncryptionInfoKeyEncryptionKeyInfo = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IKeyEncryptionKeyInfo) content.GetValueForProperty("DiskEncryptionInfoKeyEncryptionKeyInfo",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).DiskEncryptionInfoKeyEncryptionKeyInfo, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.KeyEncryptionKeyInfoTypeConverter.ConvertFrom); + } + if (content.Contains("DiskEncryptionKeyInfoSecretIdentifier")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).DiskEncryptionKeyInfoSecretIdentifier = (string) content.GetValueForProperty("DiskEncryptionKeyInfoSecretIdentifier",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).DiskEncryptionKeyInfoSecretIdentifier, global::System.Convert.ToString); + } + if (content.Contains("KeyEncryptionKeyInfoKeyIdentifier")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).KeyEncryptionKeyInfoKeyIdentifier = (string) content.GetValueForProperty("KeyEncryptionKeyInfoKeyIdentifier",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).KeyEncryptionKeyInfoKeyIdentifier, global::System.Convert.ToString); + } + if (content.Contains("DiskEncryptionKeyInfoKeyVaultResourceArmId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).DiskEncryptionKeyInfoKeyVaultResourceArmId = (string) content.GetValueForProperty("DiskEncryptionKeyInfoKeyVaultResourceArmId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).DiskEncryptionKeyInfoKeyVaultResourceArmId, global::System.Convert.ToString); + } + if (content.Contains("KeyEncryptionKeyInfoKeyVaultResourceArmId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).KeyEncryptionKeyInfoKeyVaultResourceArmId = (string) content.GetValueForProperty("KeyEncryptionKeyInfoKeyVaultResourceArmId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).KeyEncryptionKeyInfoKeyVaultResourceArmId, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal A2ACreateProtectionIntentInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProtectionProfileCustomInput")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).ProtectionProfileCustomInput = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionProfileCustomDetails) content.GetValueForProperty("ProtectionProfileCustomInput",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).ProtectionProfileCustomInput, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProtectionProfileCustomDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("PrimaryStagingStorageAccountCustomInput")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).PrimaryStagingStorageAccountCustomInput = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageAccountCustomDetails) content.GetValueForProperty("PrimaryStagingStorageAccountCustomInput",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).PrimaryStagingStorageAccountCustomInput, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.StorageAccountCustomDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("RecoveryAvailabilitySetCustomInput")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).RecoveryAvailabilitySetCustomInput = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryAvailabilitySetCustomDetails) content.GetValueForProperty("RecoveryAvailabilitySetCustomInput",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).RecoveryAvailabilitySetCustomInput, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryAvailabilitySetCustomDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("RecoveryVirtualNetworkCustomInput")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).RecoveryVirtualNetworkCustomInput = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryVirtualNetworkCustomDetails) content.GetValueForProperty("RecoveryVirtualNetworkCustomInput",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).RecoveryVirtualNetworkCustomInput, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryVirtualNetworkCustomDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("RecoveryProximityPlacementGroupCustomInput")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).RecoveryProximityPlacementGroupCustomInput = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryProximityPlacementGroupCustomDetails) content.GetValueForProperty("RecoveryProximityPlacementGroupCustomInput",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).RecoveryProximityPlacementGroupCustomInput, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryProximityPlacementGroupCustomDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("RecoveryBootDiagStorageAccount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).RecoveryBootDiagStorageAccount = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageAccountCustomDetails) content.GetValueForProperty("RecoveryBootDiagStorageAccount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).RecoveryBootDiagStorageAccount, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.StorageAccountCustomDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("DiskEncryptionInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).DiskEncryptionInfo = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfo) content.GetValueForProperty("DiskEncryptionInfo",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).DiskEncryptionInfo, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DiskEncryptionInfoTypeConverter.ConvertFrom); + } + if (content.Contains("FabricObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).FabricObjectId = (string) content.GetValueForProperty("FabricObjectId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).FabricObjectId, global::System.Convert.ToString); + } + if (content.Contains("PrimaryLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).PrimaryLocation = (string) content.GetValueForProperty("PrimaryLocation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).PrimaryLocation, global::System.Convert.ToString); + } + if (content.Contains("RecoveryLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).RecoveryLocation = (string) content.GetValueForProperty("RecoveryLocation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).RecoveryLocation, global::System.Convert.ToString); + } + if (content.Contains("RecoverySubscriptionId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).RecoverySubscriptionId = (string) content.GetValueForProperty("RecoverySubscriptionId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).RecoverySubscriptionId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryAvailabilityType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).RecoveryAvailabilityType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.A2ARecoveryAvailabilityType) content.GetValueForProperty("RecoveryAvailabilityType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).RecoveryAvailabilityType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.A2ARecoveryAvailabilityType.CreateFrom); + } + if (content.Contains("RecoveryResourceGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).RecoveryResourceGroupId = (string) content.GetValueForProperty("RecoveryResourceGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).RecoveryResourceGroupId, global::System.Convert.ToString); + } + if (content.Contains("AutoProtectionOfDataDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).AutoProtectionOfDataDisk = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AutoProtectionOfDataDisk?) content.GetValueForProperty("AutoProtectionOfDataDisk",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).AutoProtectionOfDataDisk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AutoProtectionOfDataDisk.CreateFrom); + } + if (content.Contains("VMDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).VMDisk = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentDiskInputDetails[]) content.GetValueForProperty("VMDisk",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).VMDisk, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2AProtectionIntentDiskInputDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("VMManagedDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).VMManagedDisk = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentManagedDiskInputDetails[]) content.GetValueForProperty("VMManagedDisk",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).VMManagedDisk, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2AProtectionIntentManagedDiskInputDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("MultiVMGroupName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).MultiVMGroupName = (string) content.GetValueForProperty("MultiVMGroupName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).MultiVMGroupName, global::System.Convert.ToString); + } + if (content.Contains("MultiVMGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).MultiVMGroupId = (string) content.GetValueForProperty("MultiVMGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).MultiVMGroupId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryAvailabilityZone")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).RecoveryAvailabilityZone = (string) content.GetValueForProperty("RecoveryAvailabilityZone",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).RecoveryAvailabilityZone, global::System.Convert.ToString); + } + if (content.Contains("AgentAutoUpdateStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).AgentAutoUpdateStatus = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentAutoUpdateStatus?) content.GetValueForProperty("AgentAutoUpdateStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).AgentAutoUpdateStatus, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentAutoUpdateStatus.CreateFrom); + } + if (content.Contains("AutomationAccountAuthenticationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).AutomationAccountAuthenticationType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AutomationAccountAuthenticationType?) content.GetValueForProperty("AutomationAccountAuthenticationType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).AutomationAccountAuthenticationType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AutomationAccountAuthenticationType.CreateFrom); + } + if (content.Contains("AutomationAccountArmId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).AutomationAccountArmId = (string) content.GetValueForProperty("AutomationAccountArmId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).AutomationAccountArmId, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionIntentProviderSpecificDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionIntentProviderSpecificDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + if (content.Contains("ProtectionProfileCustomInputResourceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).ProtectionProfileCustomInputResourceType = (string) content.GetValueForProperty("ProtectionProfileCustomInputResourceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).ProtectionProfileCustomInputResourceType, global::System.Convert.ToString); + } + if (content.Contains("PrimaryStagingStorageAccountCustomInputResourceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).PrimaryStagingStorageAccountCustomInputResourceType = (string) content.GetValueForProperty("PrimaryStagingStorageAccountCustomInputResourceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).PrimaryStagingStorageAccountCustomInputResourceType, global::System.Convert.ToString); + } + if (content.Contains("RecoveryAvailabilitySetCustomInputResourceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).RecoveryAvailabilitySetCustomInputResourceType = (string) content.GetValueForProperty("RecoveryAvailabilitySetCustomInputResourceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).RecoveryAvailabilitySetCustomInputResourceType, global::System.Convert.ToString); + } + if (content.Contains("RecoveryVirtualNetworkCustomInputResourceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).RecoveryVirtualNetworkCustomInputResourceType = (string) content.GetValueForProperty("RecoveryVirtualNetworkCustomInputResourceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).RecoveryVirtualNetworkCustomInputResourceType, global::System.Convert.ToString); + } + if (content.Contains("RecoveryProximityPlacementGroupCustomInputResourceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).RecoveryProximityPlacementGroupCustomInputResourceType = (string) content.GetValueForProperty("RecoveryProximityPlacementGroupCustomInputResourceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).RecoveryProximityPlacementGroupCustomInputResourceType, global::System.Convert.ToString); + } + if (content.Contains("RecoveryBootDiagStorageAccountResourceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).RecoveryBootDiagStorageAccountResourceType = (string) content.GetValueForProperty("RecoveryBootDiagStorageAccountResourceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).RecoveryBootDiagStorageAccountResourceType, global::System.Convert.ToString); + } + if (content.Contains("DiskEncryptionInfoDiskEncryptionKeyInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).DiskEncryptionInfoDiskEncryptionKeyInfo = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionKeyInfo) content.GetValueForProperty("DiskEncryptionInfoDiskEncryptionKeyInfo",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).DiskEncryptionInfoDiskEncryptionKeyInfo, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DiskEncryptionKeyInfoTypeConverter.ConvertFrom); + } + if (content.Contains("DiskEncryptionInfoKeyEncryptionKeyInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).DiskEncryptionInfoKeyEncryptionKeyInfo = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IKeyEncryptionKeyInfo) content.GetValueForProperty("DiskEncryptionInfoKeyEncryptionKeyInfo",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).DiskEncryptionInfoKeyEncryptionKeyInfo, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.KeyEncryptionKeyInfoTypeConverter.ConvertFrom); + } + if (content.Contains("DiskEncryptionKeyInfoSecretIdentifier")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).DiskEncryptionKeyInfoSecretIdentifier = (string) content.GetValueForProperty("DiskEncryptionKeyInfoSecretIdentifier",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).DiskEncryptionKeyInfoSecretIdentifier, global::System.Convert.ToString); + } + if (content.Contains("KeyEncryptionKeyInfoKeyIdentifier")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).KeyEncryptionKeyInfoKeyIdentifier = (string) content.GetValueForProperty("KeyEncryptionKeyInfoKeyIdentifier",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).KeyEncryptionKeyInfoKeyIdentifier, global::System.Convert.ToString); + } + if (content.Contains("DiskEncryptionKeyInfoKeyVaultResourceArmId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).DiskEncryptionKeyInfoKeyVaultResourceArmId = (string) content.GetValueForProperty("DiskEncryptionKeyInfoKeyVaultResourceArmId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).DiskEncryptionKeyInfoKeyVaultResourceArmId, global::System.Convert.ToString); + } + if (content.Contains("KeyEncryptionKeyInfoKeyVaultResourceArmId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).KeyEncryptionKeyInfoKeyVaultResourceArmId = (string) content.GetValueForProperty("KeyEncryptionKeyInfoKeyVaultResourceArmId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal)this).KeyEncryptionKeyInfoKeyVaultResourceArmId, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new A2ACreateProtectionIntentInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new A2ACreateProtectionIntentInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// A2A create protection intent input. + [System.ComponentModel.TypeConverter(typeof(A2ACreateProtectionIntentInputTypeConverter))] + public partial interface IA2ACreateProtectionIntentInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ACreateProtectionIntentInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ACreateProtectionIntentInput.TypeConverter.cs new file mode 100644 index 000000000000..98ff1a7d971b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ACreateProtectionIntentInput.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class A2ACreateProtectionIntentInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return A2ACreateProtectionIntentInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return A2ACreateProtectionIntentInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return A2ACreateProtectionIntentInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ACreateProtectionIntentInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ACreateProtectionIntentInput.cs new file mode 100644 index 000000000000..1c2ceca95830 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ACreateProtectionIntentInput.cs @@ -0,0 +1,556 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// A2A create protection intent input. + public partial class A2ACreateProtectionIntentInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionIntentProviderSpecificDetails __createProtectionIntentProviderSpecificDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.CreateProtectionIntentProviderSpecificDetails(); + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentAutoUpdateStatus? _agentAutoUpdateStatus; + + /// A value indicating whether the auto update is enabled. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentAutoUpdateStatus? AgentAutoUpdateStatus { get => this._agentAutoUpdateStatus; set => this._agentAutoUpdateStatus = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AutoProtectionOfDataDisk? _autoProtectionOfDataDisk; + + /// A value indicating whether the auto protection is enabled. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AutoProtectionOfDataDisk? AutoProtectionOfDataDisk { get => this._autoProtectionOfDataDisk; set => this._autoProtectionOfDataDisk = value; } + + /// Backing field for property. + private string _automationAccountArmId; + + /// The automation account arm id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string AutomationAccountArmId { get => this._automationAccountArmId; set => this._automationAccountArmId = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AutomationAccountAuthenticationType? _automationAccountAuthenticationType; + + /// + /// A value indicating the authentication type for automation account. The default value is "RunAsAccount". + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AutomationAccountAuthenticationType? AutomationAccountAuthenticationType { get => this._automationAccountAuthenticationType; set => this._automationAccountAuthenticationType = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfo _diskEncryptionInfo; + + /// The recovery disk encryption information (for two pass flows). + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfo DiskEncryptionInfo { get => (this._diskEncryptionInfo = this._diskEncryptionInfo ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DiskEncryptionInfo()); set => this._diskEncryptionInfo = value; } + + /// The KeyVault resource ARM id for secret. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string DiskEncryptionKeyInfoKeyVaultResourceArmId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)DiskEncryptionInfo).DiskEncryptionKeyInfoKeyVaultResourceArmId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)DiskEncryptionInfo).DiskEncryptionKeyInfoKeyVaultResourceArmId = value ?? null; } + + /// The secret url / identifier. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string DiskEncryptionKeyInfoSecretIdentifier { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)DiskEncryptionInfo).DiskEncryptionKeyInfoSecretIdentifier; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)DiskEncryptionInfo).DiskEncryptionKeyInfoSecretIdentifier = value ?? null; } + + /// Backing field for property. + private string _fabricObjectId; + + /// The fabric specific object Id of the virtual machine. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string FabricObjectId { get => this._fabricObjectId; set => this._fabricObjectId = value; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionIntentProviderSpecificDetailsInternal)__createProtectionIntentProviderSpecificDetails).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionIntentProviderSpecificDetailsInternal)__createProtectionIntentProviderSpecificDetails).InstanceType = value ; } + + /// The key URL / identifier. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string KeyEncryptionKeyInfoKeyIdentifier { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)DiskEncryptionInfo).KeyEncryptionKeyInfoKeyIdentifier; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)DiskEncryptionInfo).KeyEncryptionKeyInfoKeyIdentifier = value ?? null; } + + /// The KeyVault resource ARM Id for key. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string KeyEncryptionKeyInfoKeyVaultResourceArmId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)DiskEncryptionInfo).KeyEncryptionKeyInfoKeyVaultResourceArmId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)DiskEncryptionInfo).KeyEncryptionKeyInfoKeyVaultResourceArmId = value ?? null; } + + /// Internal Acessors for DiskEncryptionInfo + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfo Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal.DiskEncryptionInfo { get => (this._diskEncryptionInfo = this._diskEncryptionInfo ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DiskEncryptionInfo()); set { {_diskEncryptionInfo = value;} } } + + /// Internal Acessors for DiskEncryptionInfoDiskEncryptionKeyInfo + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionKeyInfo Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal.DiskEncryptionInfoDiskEncryptionKeyInfo { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)DiskEncryptionInfo).DiskEncryptionKeyInfo; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)DiskEncryptionInfo).DiskEncryptionKeyInfo = value; } + + /// Internal Acessors for DiskEncryptionInfoKeyEncryptionKeyInfo + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IKeyEncryptionKeyInfo Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal.DiskEncryptionInfoKeyEncryptionKeyInfo { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)DiskEncryptionInfo).KeyEncryptionKeyInfo; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)DiskEncryptionInfo).KeyEncryptionKeyInfo = value; } + + /// Internal Acessors for PrimaryStagingStorageAccountCustomInput + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageAccountCustomDetails Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal.PrimaryStagingStorageAccountCustomInput { get => (this._primaryStagingStorageAccountCustomInput = this._primaryStagingStorageAccountCustomInput ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.StorageAccountCustomDetails()); set { {_primaryStagingStorageAccountCustomInput = value;} } } + + /// Internal Acessors for ProtectionProfileCustomInput + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionProfileCustomDetails Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal.ProtectionProfileCustomInput { get => (this._protectionProfileCustomInput = this._protectionProfileCustomInput ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProtectionProfileCustomDetails()); set { {_protectionProfileCustomInput = value;} } } + + /// Internal Acessors for RecoveryAvailabilitySetCustomInput + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryAvailabilitySetCustomDetails Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal.RecoveryAvailabilitySetCustomInput { get => (this._recoveryAvailabilitySetCustomInput = this._recoveryAvailabilitySetCustomInput ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryAvailabilitySetCustomDetails()); set { {_recoveryAvailabilitySetCustomInput = value;} } } + + /// Internal Acessors for RecoveryBootDiagStorageAccount + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageAccountCustomDetails Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal.RecoveryBootDiagStorageAccount { get => (this._recoveryBootDiagStorageAccount = this._recoveryBootDiagStorageAccount ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.StorageAccountCustomDetails()); set { {_recoveryBootDiagStorageAccount = value;} } } + + /// Internal Acessors for RecoveryProximityPlacementGroupCustomInput + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryProximityPlacementGroupCustomDetails Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal.RecoveryProximityPlacementGroupCustomInput { get => (this._recoveryProximityPlacementGroupCustomInput = this._recoveryProximityPlacementGroupCustomInput ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryProximityPlacementGroupCustomDetails()); set { {_recoveryProximityPlacementGroupCustomInput = value;} } } + + /// Internal Acessors for RecoveryVirtualNetworkCustomInput + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryVirtualNetworkCustomDetails Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInputInternal.RecoveryVirtualNetworkCustomInput { get => (this._recoveryVirtualNetworkCustomInput = this._recoveryVirtualNetworkCustomInput ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryVirtualNetworkCustomDetails()); set { {_recoveryVirtualNetworkCustomInput = value;} } } + + /// Backing field for property. + private string _multiVMGroupId; + + /// The multi vm group id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string MultiVMGroupId { get => this._multiVMGroupId; set => this._multiVMGroupId = value; } + + /// Backing field for property. + private string _multiVMGroupName; + + /// The multi vm group name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string MultiVMGroupName { get => this._multiVMGroupName; set => this._multiVMGroupName = value; } + + /// Backing field for property. + private string _primaryLocation; + + /// The primary location for the virtual machine. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string PrimaryLocation { get => this._primaryLocation; set => this._primaryLocation = value; } + + /// + /// Backing field for property. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageAccountCustomDetails _primaryStagingStorageAccountCustomInput; + + /// The primary staging storage account input. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageAccountCustomDetails PrimaryStagingStorageAccountCustomInput { get => (this._primaryStagingStorageAccountCustomInput = this._primaryStagingStorageAccountCustomInput ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.StorageAccountCustomDetails()); set => this._primaryStagingStorageAccountCustomInput = value; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string PrimaryStagingStorageAccountCustomInputResourceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageAccountCustomDetailsInternal)PrimaryStagingStorageAccountCustomInput).ResourceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageAccountCustomDetailsInternal)PrimaryStagingStorageAccountCustomInput).ResourceType = value ?? null; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionProfileCustomDetails _protectionProfileCustomInput; + + /// The protection profile custom inputs. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionProfileCustomDetails ProtectionProfileCustomInput { get => (this._protectionProfileCustomInput = this._protectionProfileCustomInput ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProtectionProfileCustomDetails()); set => this._protectionProfileCustomInput = value; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ProtectionProfileCustomInputResourceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionProfileCustomDetailsInternal)ProtectionProfileCustomInput).ResourceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionProfileCustomDetailsInternal)ProtectionProfileCustomInput).ResourceType = value ?? null; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryAvailabilitySetCustomDetails _recoveryAvailabilitySetCustomInput; + + /// The recovery availability set input. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryAvailabilitySetCustomDetails RecoveryAvailabilitySetCustomInput { get => (this._recoveryAvailabilitySetCustomInput = this._recoveryAvailabilitySetCustomInput ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryAvailabilitySetCustomDetails()); set => this._recoveryAvailabilitySetCustomInput = value; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string RecoveryAvailabilitySetCustomInputResourceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryAvailabilitySetCustomDetailsInternal)RecoveryAvailabilitySetCustomInput).ResourceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryAvailabilitySetCustomDetailsInternal)RecoveryAvailabilitySetCustomInput).ResourceType = value ?? null; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.A2ARecoveryAvailabilityType _recoveryAvailabilityType; + + /// The recovery availability type of the virtual machine. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.A2ARecoveryAvailabilityType RecoveryAvailabilityType { get => this._recoveryAvailabilityType; set => this._recoveryAvailabilityType = value; } + + /// Backing field for property. + private string _recoveryAvailabilityZone; + + /// The recovery availability zone. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryAvailabilityZone { get => this._recoveryAvailabilityZone; set => this._recoveryAvailabilityZone = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageAccountCustomDetails _recoveryBootDiagStorageAccount; + + /// The boot diagnostic storage account. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageAccountCustomDetails RecoveryBootDiagStorageAccount { get => (this._recoveryBootDiagStorageAccount = this._recoveryBootDiagStorageAccount ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.StorageAccountCustomDetails()); set => this._recoveryBootDiagStorageAccount = value; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string RecoveryBootDiagStorageAccountResourceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageAccountCustomDetailsInternal)RecoveryBootDiagStorageAccount).ResourceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageAccountCustomDetailsInternal)RecoveryBootDiagStorageAccount).ResourceType = value ?? null; } + + /// Backing field for property. + private string _recoveryLocation; + + /// The recovery location for the virtual machine. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryLocation { get => this._recoveryLocation; set => this._recoveryLocation = value; } + + /// + /// Backing field for property. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryProximityPlacementGroupCustomDetails _recoveryProximityPlacementGroupCustomInput; + + /// The recovery proximity placement group custom input. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryProximityPlacementGroupCustomDetails RecoveryProximityPlacementGroupCustomInput { get => (this._recoveryProximityPlacementGroupCustomInput = this._recoveryProximityPlacementGroupCustomInput ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryProximityPlacementGroupCustomDetails()); set => this._recoveryProximityPlacementGroupCustomInput = value; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string RecoveryProximityPlacementGroupCustomInputResourceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryProximityPlacementGroupCustomDetailsInternal)RecoveryProximityPlacementGroupCustomInput).ResourceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryProximityPlacementGroupCustomDetailsInternal)RecoveryProximityPlacementGroupCustomInput).ResourceType = value ?? null; } + + /// Backing field for property. + private string _recoveryResourceGroupId; + + /// The recovery resource group Id. Valid for V2 scenarios. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryResourceGroupId { get => this._recoveryResourceGroupId; set => this._recoveryResourceGroupId = value; } + + /// Backing field for property. + private string _recoverySubscriptionId; + + /// The recovery subscription Id of the virtual machine. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoverySubscriptionId { get => this._recoverySubscriptionId; set => this._recoverySubscriptionId = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryVirtualNetworkCustomDetails _recoveryVirtualNetworkCustomInput; + + /// The recovery virtual network input. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryVirtualNetworkCustomDetails RecoveryVirtualNetworkCustomInput { get => (this._recoveryVirtualNetworkCustomInput = this._recoveryVirtualNetworkCustomInput ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryVirtualNetworkCustomDetails()); set => this._recoveryVirtualNetworkCustomInput = value; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string RecoveryVirtualNetworkCustomInputResourceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryVirtualNetworkCustomDetailsInternal)RecoveryVirtualNetworkCustomInput).ResourceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryVirtualNetworkCustomDetailsInternal)RecoveryVirtualNetworkCustomInput).ResourceType = value ?? null; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentDiskInputDetails[] _vMDisk; + + /// The list of vm disk inputs. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentDiskInputDetails[] VMDisk { get => this._vMDisk; set => this._vMDisk = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentManagedDiskInputDetails[] _vMManagedDisk; + + /// The list of vm managed disk inputs. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentManagedDiskInputDetails[] VMManagedDisk { get => this._vMManagedDisk; set => this._vMManagedDisk = value; } + + /// Creates an new instance. + public A2ACreateProtectionIntentInput() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__createProtectionIntentProviderSpecificDetails), __createProtectionIntentProviderSpecificDetails); + await eventListener.AssertObjectIsValid(nameof(__createProtectionIntentProviderSpecificDetails), __createProtectionIntentProviderSpecificDetails); + } + } + /// A2A create protection intent input. + public partial interface IA2ACreateProtectionIntentInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionIntentProviderSpecificDetails + { + /// A value indicating whether the auto update is enabled. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether the auto update is enabled.", + SerializedName = @"agentAutoUpdateStatus", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentAutoUpdateStatus) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentAutoUpdateStatus? AgentAutoUpdateStatus { get; set; } + /// A value indicating whether the auto protection is enabled. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether the auto protection is enabled.", + SerializedName = @"autoProtectionOfDataDisk", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AutoProtectionOfDataDisk) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AutoProtectionOfDataDisk? AutoProtectionOfDataDisk { get; set; } + /// The automation account arm id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The automation account arm id.", + SerializedName = @"automationAccountArmId", + PossibleTypes = new [] { typeof(string) })] + string AutomationAccountArmId { get; set; } + /// + /// A value indicating the authentication type for automation account. The default value is "RunAsAccount". + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating the authentication type for automation account. The default value is ""RunAsAccount"".", + SerializedName = @"automationAccountAuthenticationType", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AutomationAccountAuthenticationType) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AutomationAccountAuthenticationType? AutomationAccountAuthenticationType { get; set; } + /// The KeyVault resource ARM id for secret. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The KeyVault resource ARM id for secret.", + SerializedName = @"keyVaultResourceArmId", + PossibleTypes = new [] { typeof(string) })] + string DiskEncryptionKeyInfoKeyVaultResourceArmId { get; set; } + /// The secret url / identifier. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The secret url / identifier.", + SerializedName = @"secretIdentifier", + PossibleTypes = new [] { typeof(string) })] + string DiskEncryptionKeyInfoSecretIdentifier { get; set; } + /// The fabric specific object Id of the virtual machine. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The fabric specific object Id of the virtual machine.", + SerializedName = @"fabricObjectId", + PossibleTypes = new [] { typeof(string) })] + string FabricObjectId { get; set; } + /// The key URL / identifier. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The key URL / identifier.", + SerializedName = @"keyIdentifier", + PossibleTypes = new [] { typeof(string) })] + string KeyEncryptionKeyInfoKeyIdentifier { get; set; } + /// The KeyVault resource ARM Id for key. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The KeyVault resource ARM Id for key.", + SerializedName = @"keyVaultResourceArmId", + PossibleTypes = new [] { typeof(string) })] + string KeyEncryptionKeyInfoKeyVaultResourceArmId { get; set; } + /// The multi vm group id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The multi vm group id.", + SerializedName = @"multiVmGroupId", + PossibleTypes = new [] { typeof(string) })] + string MultiVMGroupId { get; set; } + /// The multi vm group name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The multi vm group name.", + SerializedName = @"multiVmGroupName", + PossibleTypes = new [] { typeof(string) })] + string MultiVMGroupName { get; set; } + /// The primary location for the virtual machine. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The primary location for the virtual machine.", + SerializedName = @"primaryLocation", + PossibleTypes = new [] { typeof(string) })] + string PrimaryLocation { get; set; } + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"resourceType", + PossibleTypes = new [] { typeof(string) })] + string PrimaryStagingStorageAccountCustomInputResourceType { get; set; } + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"resourceType", + PossibleTypes = new [] { typeof(string) })] + string ProtectionProfileCustomInputResourceType { get; set; } + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"resourceType", + PossibleTypes = new [] { typeof(string) })] + string RecoveryAvailabilitySetCustomInputResourceType { get; set; } + /// The recovery availability type of the virtual machine. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The recovery availability type of the virtual machine.", + SerializedName = @"recoveryAvailabilityType", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.A2ARecoveryAvailabilityType) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.A2ARecoveryAvailabilityType RecoveryAvailabilityType { get; set; } + /// The recovery availability zone. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery availability zone.", + SerializedName = @"recoveryAvailabilityZone", + PossibleTypes = new [] { typeof(string) })] + string RecoveryAvailabilityZone { get; set; } + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"resourceType", + PossibleTypes = new [] { typeof(string) })] + string RecoveryBootDiagStorageAccountResourceType { get; set; } + /// The recovery location for the virtual machine. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The recovery location for the virtual machine.", + SerializedName = @"recoveryLocation", + PossibleTypes = new [] { typeof(string) })] + string RecoveryLocation { get; set; } + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"resourceType", + PossibleTypes = new [] { typeof(string) })] + string RecoveryProximityPlacementGroupCustomInputResourceType { get; set; } + /// The recovery resource group Id. Valid for V2 scenarios. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The recovery resource group Id. Valid for V2 scenarios.", + SerializedName = @"recoveryResourceGroupId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryResourceGroupId { get; set; } + /// The recovery subscription Id of the virtual machine. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The recovery subscription Id of the virtual machine.", + SerializedName = @"recoverySubscriptionId", + PossibleTypes = new [] { typeof(string) })] + string RecoverySubscriptionId { get; set; } + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"resourceType", + PossibleTypes = new [] { typeof(string) })] + string RecoveryVirtualNetworkCustomInputResourceType { get; set; } + /// The list of vm disk inputs. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of vm disk inputs.", + SerializedName = @"vmDisks", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentDiskInputDetails) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentDiskInputDetails[] VMDisk { get; set; } + /// The list of vm managed disk inputs. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of vm managed disk inputs.", + SerializedName = @"vmManagedDisks", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentManagedDiskInputDetails) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentManagedDiskInputDetails[] VMManagedDisk { get; set; } + + } + /// A2A create protection intent input. + internal partial interface IA2ACreateProtectionIntentInputInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionIntentProviderSpecificDetailsInternal + { + /// A value indicating whether the auto update is enabled. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentAutoUpdateStatus? AgentAutoUpdateStatus { get; set; } + /// A value indicating whether the auto protection is enabled. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AutoProtectionOfDataDisk? AutoProtectionOfDataDisk { get; set; } + /// The automation account arm id. + string AutomationAccountArmId { get; set; } + /// + /// A value indicating the authentication type for automation account. The default value is "RunAsAccount". + /// + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AutomationAccountAuthenticationType? AutomationAccountAuthenticationType { get; set; } + /// The recovery disk encryption information (for two pass flows). + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfo DiskEncryptionInfo { get; set; } + /// The recovery KeyVault reference for secret. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionKeyInfo DiskEncryptionInfoDiskEncryptionKeyInfo { get; set; } + /// The recovery KeyVault reference for key. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IKeyEncryptionKeyInfo DiskEncryptionInfoKeyEncryptionKeyInfo { get; set; } + /// The KeyVault resource ARM id for secret. + string DiskEncryptionKeyInfoKeyVaultResourceArmId { get; set; } + /// The secret url / identifier. + string DiskEncryptionKeyInfoSecretIdentifier { get; set; } + /// The fabric specific object Id of the virtual machine. + string FabricObjectId { get; set; } + /// The key URL / identifier. + string KeyEncryptionKeyInfoKeyIdentifier { get; set; } + /// The KeyVault resource ARM Id for key. + string KeyEncryptionKeyInfoKeyVaultResourceArmId { get; set; } + /// The multi vm group id. + string MultiVMGroupId { get; set; } + /// The multi vm group name. + string MultiVMGroupName { get; set; } + /// The primary location for the virtual machine. + string PrimaryLocation { get; set; } + /// The primary staging storage account input. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageAccountCustomDetails PrimaryStagingStorageAccountCustomInput { get; set; } + /// The class type. + string PrimaryStagingStorageAccountCustomInputResourceType { get; set; } + /// The protection profile custom inputs. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionProfileCustomDetails ProtectionProfileCustomInput { get; set; } + /// The class type. + string ProtectionProfileCustomInputResourceType { get; set; } + /// The recovery availability set input. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryAvailabilitySetCustomDetails RecoveryAvailabilitySetCustomInput { get; set; } + /// The class type. + string RecoveryAvailabilitySetCustomInputResourceType { get; set; } + /// The recovery availability type of the virtual machine. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.A2ARecoveryAvailabilityType RecoveryAvailabilityType { get; set; } + /// The recovery availability zone. + string RecoveryAvailabilityZone { get; set; } + /// The boot diagnostic storage account. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageAccountCustomDetails RecoveryBootDiagStorageAccount { get; set; } + /// The class type. + string RecoveryBootDiagStorageAccountResourceType { get; set; } + /// The recovery location for the virtual machine. + string RecoveryLocation { get; set; } + /// The recovery proximity placement group custom input. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryProximityPlacementGroupCustomDetails RecoveryProximityPlacementGroupCustomInput { get; set; } + /// The class type. + string RecoveryProximityPlacementGroupCustomInputResourceType { get; set; } + /// The recovery resource group Id. Valid for V2 scenarios. + string RecoveryResourceGroupId { get; set; } + /// The recovery subscription Id of the virtual machine. + string RecoverySubscriptionId { get; set; } + /// The recovery virtual network input. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryVirtualNetworkCustomDetails RecoveryVirtualNetworkCustomInput { get; set; } + /// The class type. + string RecoveryVirtualNetworkCustomInputResourceType { get; set; } + /// The list of vm disk inputs. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentDiskInputDetails[] VMDisk { get; set; } + /// The list of vm managed disk inputs. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentManagedDiskInputDetails[] VMManagedDisk { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ACreateProtectionIntentInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ACreateProtectionIntentInput.json.cs new file mode 100644 index 000000000000..e7ca633b58fa --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ACreateProtectionIntentInput.json.cs @@ -0,0 +1,168 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// A2A create protection intent input. + public partial class A2ACreateProtectionIntentInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal A2ACreateProtectionIntentInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __createProtectionIntentProviderSpecificDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.CreateProtectionIntentProviderSpecificDetails(json); + {_protectionProfileCustomInput = If( json?.PropertyT("protectionProfileCustomInput"), out var __jsonProtectionProfileCustomInput) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProtectionProfileCustomDetails.FromJson(__jsonProtectionProfileCustomInput) : ProtectionProfileCustomInput;} + {_primaryStagingStorageAccountCustomInput = If( json?.PropertyT("primaryStagingStorageAccountCustomInput"), out var __jsonPrimaryStagingStorageAccountCustomInput) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.StorageAccountCustomDetails.FromJson(__jsonPrimaryStagingStorageAccountCustomInput) : PrimaryStagingStorageAccountCustomInput;} + {_recoveryAvailabilitySetCustomInput = If( json?.PropertyT("recoveryAvailabilitySetCustomInput"), out var __jsonRecoveryAvailabilitySetCustomInput) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryAvailabilitySetCustomDetails.FromJson(__jsonRecoveryAvailabilitySetCustomInput) : RecoveryAvailabilitySetCustomInput;} + {_recoveryVirtualNetworkCustomInput = If( json?.PropertyT("recoveryVirtualNetworkCustomInput"), out var __jsonRecoveryVirtualNetworkCustomInput) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryVirtualNetworkCustomDetails.FromJson(__jsonRecoveryVirtualNetworkCustomInput) : RecoveryVirtualNetworkCustomInput;} + {_recoveryProximityPlacementGroupCustomInput = If( json?.PropertyT("recoveryProximityPlacementGroupCustomInput"), out var __jsonRecoveryProximityPlacementGroupCustomInput) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryProximityPlacementGroupCustomDetails.FromJson(__jsonRecoveryProximityPlacementGroupCustomInput) : RecoveryProximityPlacementGroupCustomInput;} + {_recoveryBootDiagStorageAccount = If( json?.PropertyT("recoveryBootDiagStorageAccount"), out var __jsonRecoveryBootDiagStorageAccount) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.StorageAccountCustomDetails.FromJson(__jsonRecoveryBootDiagStorageAccount) : RecoveryBootDiagStorageAccount;} + {_diskEncryptionInfo = If( json?.PropertyT("diskEncryptionInfo"), out var __jsonDiskEncryptionInfo) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DiskEncryptionInfo.FromJson(__jsonDiskEncryptionInfo) : DiskEncryptionInfo;} + {_fabricObjectId = If( json?.PropertyT("fabricObjectId"), out var __jsonFabricObjectId) ? (string)__jsonFabricObjectId : (string)FabricObjectId;} + {_primaryLocation = If( json?.PropertyT("primaryLocation"), out var __jsonPrimaryLocation) ? (string)__jsonPrimaryLocation : (string)PrimaryLocation;} + {_recoveryLocation = If( json?.PropertyT("recoveryLocation"), out var __jsonRecoveryLocation) ? (string)__jsonRecoveryLocation : (string)RecoveryLocation;} + {_recoverySubscriptionId = If( json?.PropertyT("recoverySubscriptionId"), out var __jsonRecoverySubscriptionId) ? (string)__jsonRecoverySubscriptionId : (string)RecoverySubscriptionId;} + {_recoveryAvailabilityType = If( json?.PropertyT("recoveryAvailabilityType"), out var __jsonRecoveryAvailabilityType) ? (string)__jsonRecoveryAvailabilityType : (string)RecoveryAvailabilityType;} + {_recoveryResourceGroupId = If( json?.PropertyT("recoveryResourceGroupId"), out var __jsonRecoveryResourceGroupId) ? (string)__jsonRecoveryResourceGroupId : (string)RecoveryResourceGroupId;} + {_autoProtectionOfDataDisk = If( json?.PropertyT("autoProtectionOfDataDisk"), out var __jsonAutoProtectionOfDataDisk) ? (string)__jsonAutoProtectionOfDataDisk : (string)AutoProtectionOfDataDisk;} + {_vMDisk = If( json?.PropertyT("vmDisks"), out var __jsonVMDisks) ? If( __jsonVMDisks as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentDiskInputDetails) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2AProtectionIntentDiskInputDetails.FromJson(__u) )) ))() : null : VMDisk;} + {_vMManagedDisk = If( json?.PropertyT("vmManagedDisks"), out var __jsonVMManagedDisks) ? If( __jsonVMManagedDisks as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __q) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__q, (__p)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentManagedDiskInputDetails) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2AProtectionIntentManagedDiskInputDetails.FromJson(__p) )) ))() : null : VMManagedDisk;} + {_multiVMGroupName = If( json?.PropertyT("multiVmGroupName"), out var __jsonMultiVMGroupName) ? (string)__jsonMultiVMGroupName : (string)MultiVMGroupName;} + {_multiVMGroupId = If( json?.PropertyT("multiVmGroupId"), out var __jsonMultiVMGroupId) ? (string)__jsonMultiVMGroupId : (string)MultiVMGroupId;} + {_recoveryAvailabilityZone = If( json?.PropertyT("recoveryAvailabilityZone"), out var __jsonRecoveryAvailabilityZone) ? (string)__jsonRecoveryAvailabilityZone : (string)RecoveryAvailabilityZone;} + {_agentAutoUpdateStatus = If( json?.PropertyT("agentAutoUpdateStatus"), out var __jsonAgentAutoUpdateStatus) ? (string)__jsonAgentAutoUpdateStatus : (string)AgentAutoUpdateStatus;} + {_automationAccountAuthenticationType = If( json?.PropertyT("automationAccountAuthenticationType"), out var __jsonAutomationAccountAuthenticationType) ? (string)__jsonAutomationAccountAuthenticationType : (string)AutomationAccountAuthenticationType;} + {_automationAccountArmId = If( json?.PropertyT("automationAccountArmId"), out var __jsonAutomationAccountArmId) ? (string)__jsonAutomationAccountArmId : (string)AutomationAccountArmId;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACreateProtectionIntentInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new A2ACreateProtectionIntentInput(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __createProtectionIntentProviderSpecificDetails?.ToJson(container, serializationMode); + AddIf( null != this._protectionProfileCustomInput ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._protectionProfileCustomInput.ToJson(null,serializationMode) : null, "protectionProfileCustomInput" ,container.Add ); + AddIf( null != this._primaryStagingStorageAccountCustomInput ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._primaryStagingStorageAccountCustomInput.ToJson(null,serializationMode) : null, "primaryStagingStorageAccountCustomInput" ,container.Add ); + AddIf( null != this._recoveryAvailabilitySetCustomInput ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._recoveryAvailabilitySetCustomInput.ToJson(null,serializationMode) : null, "recoveryAvailabilitySetCustomInput" ,container.Add ); + AddIf( null != this._recoveryVirtualNetworkCustomInput ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._recoveryVirtualNetworkCustomInput.ToJson(null,serializationMode) : null, "recoveryVirtualNetworkCustomInput" ,container.Add ); + AddIf( null != this._recoveryProximityPlacementGroupCustomInput ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._recoveryProximityPlacementGroupCustomInput.ToJson(null,serializationMode) : null, "recoveryProximityPlacementGroupCustomInput" ,container.Add ); + AddIf( null != this._recoveryBootDiagStorageAccount ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._recoveryBootDiagStorageAccount.ToJson(null,serializationMode) : null, "recoveryBootDiagStorageAccount" ,container.Add ); + AddIf( null != this._diskEncryptionInfo ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._diskEncryptionInfo.ToJson(null,serializationMode) : null, "diskEncryptionInfo" ,container.Add ); + AddIf( null != (((object)this._fabricObjectId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._fabricObjectId.ToString()) : null, "fabricObjectId" ,container.Add ); + AddIf( null != (((object)this._primaryLocation)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._primaryLocation.ToString()) : null, "primaryLocation" ,container.Add ); + AddIf( null != (((object)this._recoveryLocation)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryLocation.ToString()) : null, "recoveryLocation" ,container.Add ); + AddIf( null != (((object)this._recoverySubscriptionId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoverySubscriptionId.ToString()) : null, "recoverySubscriptionId" ,container.Add ); + AddIf( null != (((object)this._recoveryAvailabilityType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryAvailabilityType.ToString()) : null, "recoveryAvailabilityType" ,container.Add ); + AddIf( null != (((object)this._recoveryResourceGroupId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryResourceGroupId.ToString()) : null, "recoveryResourceGroupId" ,container.Add ); + AddIf( null != (((object)this._autoProtectionOfDataDisk)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._autoProtectionOfDataDisk.ToString()) : null, "autoProtectionOfDataDisk" ,container.Add ); + if (null != this._vMDisk) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._vMDisk ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("vmDisks",__w); + } + if (null != this._vMManagedDisk) + { + var __r = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __s in this._vMManagedDisk ) + { + AddIf(__s?.ToJson(null, serializationMode) ,__r.Add); + } + container.Add("vmManagedDisks",__r); + } + AddIf( null != (((object)this._multiVMGroupName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._multiVMGroupName.ToString()) : null, "multiVmGroupName" ,container.Add ); + AddIf( null != (((object)this._multiVMGroupId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._multiVMGroupId.ToString()) : null, "multiVmGroupId" ,container.Add ); + AddIf( null != (((object)this._recoveryAvailabilityZone)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryAvailabilityZone.ToString()) : null, "recoveryAvailabilityZone" ,container.Add ); + AddIf( null != (((object)this._agentAutoUpdateStatus)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._agentAutoUpdateStatus.ToString()) : null, "agentAutoUpdateStatus" ,container.Add ); + AddIf( null != (((object)this._automationAccountAuthenticationType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._automationAccountAuthenticationType.ToString()) : null, "automationAccountAuthenticationType" ,container.Add ); + AddIf( null != (((object)this._automationAccountArmId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._automationAccountArmId.ToString()) : null, "automationAccountArmId" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ACrossClusterMigrationApplyRecoveryPointInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ACrossClusterMigrationApplyRecoveryPointInput.PowerShell.cs new file mode 100644 index 000000000000..9bb56c989d85 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ACrossClusterMigrationApplyRecoveryPointInput.PowerShell.cs @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// ApplyRecoveryPoint input specific to A2ACrossClusterMigration provider. + [System.ComponentModel.TypeConverter(typeof(A2ACrossClusterMigrationApplyRecoveryPointInputTypeConverter))] + public partial class A2ACrossClusterMigrationApplyRecoveryPointInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal A2ACrossClusterMigrationApplyRecoveryPointInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal A2ACrossClusterMigrationApplyRecoveryPointInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACrossClusterMigrationApplyRecoveryPointInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new A2ACrossClusterMigrationApplyRecoveryPointInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACrossClusterMigrationApplyRecoveryPointInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new A2ACrossClusterMigrationApplyRecoveryPointInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from + /// a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACrossClusterMigrationApplyRecoveryPointInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// ApplyRecoveryPoint input specific to A2ACrossClusterMigration provider. + [System.ComponentModel.TypeConverter(typeof(A2ACrossClusterMigrationApplyRecoveryPointInputTypeConverter))] + public partial interface IA2ACrossClusterMigrationApplyRecoveryPointInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ACrossClusterMigrationApplyRecoveryPointInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ACrossClusterMigrationApplyRecoveryPointInput.TypeConverter.cs new file mode 100644 index 000000000000..7b6d0885bbdc --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ACrossClusterMigrationApplyRecoveryPointInput.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class A2ACrossClusterMigrationApplyRecoveryPointInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, + /// otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACrossClusterMigrationApplyRecoveryPointInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACrossClusterMigrationApplyRecoveryPointInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return A2ACrossClusterMigrationApplyRecoveryPointInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return A2ACrossClusterMigrationApplyRecoveryPointInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return A2ACrossClusterMigrationApplyRecoveryPointInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ACrossClusterMigrationApplyRecoveryPointInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ACrossClusterMigrationApplyRecoveryPointInput.cs new file mode 100644 index 000000000000..9fdfd44fc442 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ACrossClusterMigrationApplyRecoveryPointInput.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// ApplyRecoveryPoint input specific to A2ACrossClusterMigration provider. + public partial class A2ACrossClusterMigrationApplyRecoveryPointInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACrossClusterMigrationApplyRecoveryPointInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACrossClusterMigrationApplyRecoveryPointInputInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointProviderSpecificInput __applyRecoveryPointProviderSpecificInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ApplyRecoveryPointProviderSpecificInput(); + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointProviderSpecificInputInternal)__applyRecoveryPointProviderSpecificInput).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointProviderSpecificInputInternal)__applyRecoveryPointProviderSpecificInput).InstanceType = value ; } + + /// + /// Creates an new instance. + /// + public A2ACrossClusterMigrationApplyRecoveryPointInput() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__applyRecoveryPointProviderSpecificInput), __applyRecoveryPointProviderSpecificInput); + await eventListener.AssertObjectIsValid(nameof(__applyRecoveryPointProviderSpecificInput), __applyRecoveryPointProviderSpecificInput); + } + } + /// ApplyRecoveryPoint input specific to A2ACrossClusterMigration provider. + public partial interface IA2ACrossClusterMigrationApplyRecoveryPointInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointProviderSpecificInput + { + + } + /// ApplyRecoveryPoint input specific to A2ACrossClusterMigration provider. + internal partial interface IA2ACrossClusterMigrationApplyRecoveryPointInputInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointProviderSpecificInputInternal + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ACrossClusterMigrationApplyRecoveryPointInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ACrossClusterMigrationApplyRecoveryPointInput.json.cs new file mode 100644 index 000000000000..0d886da38971 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ACrossClusterMigrationApplyRecoveryPointInput.json.cs @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// ApplyRecoveryPoint input specific to A2ACrossClusterMigration provider. + public partial class A2ACrossClusterMigrationApplyRecoveryPointInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal A2ACrossClusterMigrationApplyRecoveryPointInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __applyRecoveryPointProviderSpecificInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ApplyRecoveryPointProviderSpecificInput(json); + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACrossClusterMigrationApplyRecoveryPointInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACrossClusterMigrationApplyRecoveryPointInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACrossClusterMigrationApplyRecoveryPointInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new A2ACrossClusterMigrationApplyRecoveryPointInput(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __applyRecoveryPointProviderSpecificInput?.ToJson(container, serializationMode); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ACrossClusterMigrationContainerCreationInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ACrossClusterMigrationContainerCreationInput.PowerShell.cs new file mode 100644 index 000000000000..17b23de3c50c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ACrossClusterMigrationContainerCreationInput.PowerShell.cs @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// A2ACrossClusterMigration cloud creation input. + [System.ComponentModel.TypeConverter(typeof(A2ACrossClusterMigrationContainerCreationInputTypeConverter))] + public partial class A2ACrossClusterMigrationContainerCreationInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal A2ACrossClusterMigrationContainerCreationInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerCreationInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerCreationInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal A2ACrossClusterMigrationContainerCreationInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerCreationInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerCreationInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACrossClusterMigrationContainerCreationInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new A2ACrossClusterMigrationContainerCreationInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACrossClusterMigrationContainerCreationInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new A2ACrossClusterMigrationContainerCreationInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from + /// a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACrossClusterMigrationContainerCreationInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// A2ACrossClusterMigration cloud creation input. + [System.ComponentModel.TypeConverter(typeof(A2ACrossClusterMigrationContainerCreationInputTypeConverter))] + public partial interface IA2ACrossClusterMigrationContainerCreationInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ACrossClusterMigrationContainerCreationInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ACrossClusterMigrationContainerCreationInput.TypeConverter.cs new file mode 100644 index 000000000000..b8a313ccad86 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ACrossClusterMigrationContainerCreationInput.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class A2ACrossClusterMigrationContainerCreationInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, + /// otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACrossClusterMigrationContainerCreationInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACrossClusterMigrationContainerCreationInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return A2ACrossClusterMigrationContainerCreationInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return A2ACrossClusterMigrationContainerCreationInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return A2ACrossClusterMigrationContainerCreationInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ACrossClusterMigrationContainerCreationInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ACrossClusterMigrationContainerCreationInput.cs new file mode 100644 index 000000000000..bbe99d334977 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ACrossClusterMigrationContainerCreationInput.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// A2ACrossClusterMigration cloud creation input. + public partial class A2ACrossClusterMigrationContainerCreationInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACrossClusterMigrationContainerCreationInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACrossClusterMigrationContainerCreationInputInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerCreationInput __replicationProviderSpecificContainerCreationInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProviderSpecificContainerCreationInput(); + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerCreationInputInternal)__replicationProviderSpecificContainerCreationInput).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerCreationInputInternal)__replicationProviderSpecificContainerCreationInput).InstanceType = value ; } + + /// + /// Creates an new instance. + /// + public A2ACrossClusterMigrationContainerCreationInput() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__replicationProviderSpecificContainerCreationInput), __replicationProviderSpecificContainerCreationInput); + await eventListener.AssertObjectIsValid(nameof(__replicationProviderSpecificContainerCreationInput), __replicationProviderSpecificContainerCreationInput); + } + } + /// A2ACrossClusterMigration cloud creation input. + public partial interface IA2ACrossClusterMigrationContainerCreationInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerCreationInput + { + + } + /// A2ACrossClusterMigration cloud creation input. + internal partial interface IA2ACrossClusterMigrationContainerCreationInputInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerCreationInputInternal + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ACrossClusterMigrationContainerCreationInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ACrossClusterMigrationContainerCreationInput.json.cs new file mode 100644 index 000000000000..c32b14166295 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ACrossClusterMigrationContainerCreationInput.json.cs @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// A2ACrossClusterMigration cloud creation input. + public partial class A2ACrossClusterMigrationContainerCreationInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal A2ACrossClusterMigrationContainerCreationInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __replicationProviderSpecificContainerCreationInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProviderSpecificContainerCreationInput(json); + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACrossClusterMigrationContainerCreationInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACrossClusterMigrationContainerCreationInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACrossClusterMigrationContainerCreationInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new A2ACrossClusterMigrationContainerCreationInput(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __replicationProviderSpecificContainerCreationInput?.ToJson(container, serializationMode); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ACrossClusterMigrationEnableProtectionInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ACrossClusterMigrationEnableProtectionInput.PowerShell.cs new file mode 100644 index 000000000000..79324d83d29e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ACrossClusterMigrationEnableProtectionInput.PowerShell.cs @@ -0,0 +1,165 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// A2A Cross-Cluster Migration enable protection input. + [System.ComponentModel.TypeConverter(typeof(A2ACrossClusterMigrationEnableProtectionInputTypeConverter))] + public partial class A2ACrossClusterMigrationEnableProtectionInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal A2ACrossClusterMigrationEnableProtectionInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("FabricObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACrossClusterMigrationEnableProtectionInputInternal)this).FabricObjectId = (string) content.GetValueForProperty("FabricObjectId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACrossClusterMigrationEnableProtectionInputInternal)this).FabricObjectId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryContainerId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACrossClusterMigrationEnableProtectionInputInternal)this).RecoveryContainerId = (string) content.GetValueForProperty("RecoveryContainerId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACrossClusterMigrationEnableProtectionInputInternal)this).RecoveryContainerId, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal A2ACrossClusterMigrationEnableProtectionInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("FabricObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACrossClusterMigrationEnableProtectionInputInternal)this).FabricObjectId = (string) content.GetValueForProperty("FabricObjectId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACrossClusterMigrationEnableProtectionInputInternal)this).FabricObjectId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryContainerId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACrossClusterMigrationEnableProtectionInputInternal)this).RecoveryContainerId = (string) content.GetValueForProperty("RecoveryContainerId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACrossClusterMigrationEnableProtectionInputInternal)this).RecoveryContainerId, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACrossClusterMigrationEnableProtectionInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new A2ACrossClusterMigrationEnableProtectionInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACrossClusterMigrationEnableProtectionInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new A2ACrossClusterMigrationEnableProtectionInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from + /// a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACrossClusterMigrationEnableProtectionInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// A2A Cross-Cluster Migration enable protection input. + [System.ComponentModel.TypeConverter(typeof(A2ACrossClusterMigrationEnableProtectionInputTypeConverter))] + public partial interface IA2ACrossClusterMigrationEnableProtectionInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ACrossClusterMigrationEnableProtectionInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ACrossClusterMigrationEnableProtectionInput.TypeConverter.cs new file mode 100644 index 000000000000..841e4a3efdb2 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ACrossClusterMigrationEnableProtectionInput.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class A2ACrossClusterMigrationEnableProtectionInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, + /// otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACrossClusterMigrationEnableProtectionInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACrossClusterMigrationEnableProtectionInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return A2ACrossClusterMigrationEnableProtectionInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return A2ACrossClusterMigrationEnableProtectionInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return A2ACrossClusterMigrationEnableProtectionInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ACrossClusterMigrationEnableProtectionInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ACrossClusterMigrationEnableProtectionInput.cs new file mode 100644 index 000000000000..b2b87daf9e0c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ACrossClusterMigrationEnableProtectionInput.cs @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// A2A Cross-Cluster Migration enable protection input. + public partial class A2ACrossClusterMigrationEnableProtectionInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACrossClusterMigrationEnableProtectionInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACrossClusterMigrationEnableProtectionInputInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionProviderSpecificInput __enableProtectionProviderSpecificInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EnableProtectionProviderSpecificInput(); + + /// Backing field for property. + private string _fabricObjectId; + + /// The fabric specific object Id of the virtual machine. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string FabricObjectId { get => this._fabricObjectId; set => this._fabricObjectId = value; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionProviderSpecificInputInternal)__enableProtectionProviderSpecificInput).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionProviderSpecificInputInternal)__enableProtectionProviderSpecificInput).InstanceType = value ; } + + /// Backing field for property. + private string _recoveryContainerId; + + /// The recovery container Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryContainerId { get => this._recoveryContainerId; set => this._recoveryContainerId = value; } + + /// + /// Creates an new instance. + /// + public A2ACrossClusterMigrationEnableProtectionInput() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__enableProtectionProviderSpecificInput), __enableProtectionProviderSpecificInput); + await eventListener.AssertObjectIsValid(nameof(__enableProtectionProviderSpecificInput), __enableProtectionProviderSpecificInput); + } + } + /// A2A Cross-Cluster Migration enable protection input. + public partial interface IA2ACrossClusterMigrationEnableProtectionInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionProviderSpecificInput + { + /// The fabric specific object Id of the virtual machine. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The fabric specific object Id of the virtual machine.", + SerializedName = @"fabricObjectId", + PossibleTypes = new [] { typeof(string) })] + string FabricObjectId { get; set; } + /// The recovery container Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery container Id.", + SerializedName = @"recoveryContainerId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryContainerId { get; set; } + + } + /// A2A Cross-Cluster Migration enable protection input. + internal partial interface IA2ACrossClusterMigrationEnableProtectionInputInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionProviderSpecificInputInternal + { + /// The fabric specific object Id of the virtual machine. + string FabricObjectId { get; set; } + /// The recovery container Id. + string RecoveryContainerId { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ACrossClusterMigrationEnableProtectionInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ACrossClusterMigrationEnableProtectionInput.json.cs new file mode 100644 index 000000000000..5ddac016170f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ACrossClusterMigrationEnableProtectionInput.json.cs @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// A2A Cross-Cluster Migration enable protection input. + public partial class A2ACrossClusterMigrationEnableProtectionInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal A2ACrossClusterMigrationEnableProtectionInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __enableProtectionProviderSpecificInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EnableProtectionProviderSpecificInput(json); + {_fabricObjectId = If( json?.PropertyT("fabricObjectId"), out var __jsonFabricObjectId) ? (string)__jsonFabricObjectId : (string)FabricObjectId;} + {_recoveryContainerId = If( json?.PropertyT("recoveryContainerId"), out var __jsonRecoveryContainerId) ? (string)__jsonRecoveryContainerId : (string)RecoveryContainerId;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACrossClusterMigrationEnableProtectionInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACrossClusterMigrationEnableProtectionInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACrossClusterMigrationEnableProtectionInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new A2ACrossClusterMigrationEnableProtectionInput(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __enableProtectionProviderSpecificInput?.ToJson(container, serializationMode); + AddIf( null != (((object)this._fabricObjectId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._fabricObjectId.ToString()) : null, "fabricObjectId" ,container.Add ); + AddIf( null != (((object)this._recoveryContainerId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryContainerId.ToString()) : null, "recoveryContainerId" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ACrossClusterMigrationPolicyCreationInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ACrossClusterMigrationPolicyCreationInput.PowerShell.cs new file mode 100644 index 000000000000..82f08d30ec9d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ACrossClusterMigrationPolicyCreationInput.PowerShell.cs @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// A2A Cross-Cluster Migration Policy creation input. + [System.ComponentModel.TypeConverter(typeof(A2ACrossClusterMigrationPolicyCreationInputTypeConverter))] + public partial class A2ACrossClusterMigrationPolicyCreationInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal A2ACrossClusterMigrationPolicyCreationInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal A2ACrossClusterMigrationPolicyCreationInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACrossClusterMigrationPolicyCreationInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new A2ACrossClusterMigrationPolicyCreationInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACrossClusterMigrationPolicyCreationInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new A2ACrossClusterMigrationPolicyCreationInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a + /// json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACrossClusterMigrationPolicyCreationInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// A2A Cross-Cluster Migration Policy creation input. + [System.ComponentModel.TypeConverter(typeof(A2ACrossClusterMigrationPolicyCreationInputTypeConverter))] + public partial interface IA2ACrossClusterMigrationPolicyCreationInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ACrossClusterMigrationPolicyCreationInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ACrossClusterMigrationPolicyCreationInput.TypeConverter.cs new file mode 100644 index 000000000000..27634aaaf340 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ACrossClusterMigrationPolicyCreationInput.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class A2ACrossClusterMigrationPolicyCreationInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACrossClusterMigrationPolicyCreationInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACrossClusterMigrationPolicyCreationInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return A2ACrossClusterMigrationPolicyCreationInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return A2ACrossClusterMigrationPolicyCreationInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return A2ACrossClusterMigrationPolicyCreationInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ACrossClusterMigrationPolicyCreationInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ACrossClusterMigrationPolicyCreationInput.cs new file mode 100644 index 000000000000..b85547c3332f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ACrossClusterMigrationPolicyCreationInput.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// A2A Cross-Cluster Migration Policy creation input. + public partial class A2ACrossClusterMigrationPolicyCreationInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACrossClusterMigrationPolicyCreationInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACrossClusterMigrationPolicyCreationInputInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInput __policyProviderSpecificInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PolicyProviderSpecificInput(); + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInputInternal)__policyProviderSpecificInput).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInputInternal)__policyProviderSpecificInput).InstanceType = value ; } + + /// + /// Creates an new instance. + /// + public A2ACrossClusterMigrationPolicyCreationInput() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__policyProviderSpecificInput), __policyProviderSpecificInput); + await eventListener.AssertObjectIsValid(nameof(__policyProviderSpecificInput), __policyProviderSpecificInput); + } + } + /// A2A Cross-Cluster Migration Policy creation input. + public partial interface IA2ACrossClusterMigrationPolicyCreationInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInput + { + + } + /// A2A Cross-Cluster Migration Policy creation input. + internal partial interface IA2ACrossClusterMigrationPolicyCreationInputInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInputInternal + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ACrossClusterMigrationPolicyCreationInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ACrossClusterMigrationPolicyCreationInput.json.cs new file mode 100644 index 000000000000..46e73c68d249 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ACrossClusterMigrationPolicyCreationInput.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// A2A Cross-Cluster Migration Policy creation input. + public partial class A2ACrossClusterMigrationPolicyCreationInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal A2ACrossClusterMigrationPolicyCreationInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __policyProviderSpecificInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PolicyProviderSpecificInput(json); + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACrossClusterMigrationPolicyCreationInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACrossClusterMigrationPolicyCreationInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACrossClusterMigrationPolicyCreationInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new A2ACrossClusterMigrationPolicyCreationInput(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __policyProviderSpecificInput?.ToJson(container, serializationMode); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ACrossClusterMigrationReplicationDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ACrossClusterMigrationReplicationDetails.PowerShell.cs new file mode 100644 index 000000000000..d30a4f199d84 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ACrossClusterMigrationReplicationDetails.PowerShell.cs @@ -0,0 +1,197 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// A2A provider specific settings. + [System.ComponentModel.TypeConverter(typeof(A2ACrossClusterMigrationReplicationDetailsTypeConverter))] + public partial class A2ACrossClusterMigrationReplicationDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal A2ACrossClusterMigrationReplicationDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("FabricObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACrossClusterMigrationReplicationDetailsInternal)this).FabricObjectId = (string) content.GetValueForProperty("FabricObjectId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACrossClusterMigrationReplicationDetailsInternal)this).FabricObjectId, global::System.Convert.ToString); + } + if (content.Contains("PrimaryFabricLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACrossClusterMigrationReplicationDetailsInternal)this).PrimaryFabricLocation = (string) content.GetValueForProperty("PrimaryFabricLocation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACrossClusterMigrationReplicationDetailsInternal)this).PrimaryFabricLocation, global::System.Convert.ToString); + } + if (content.Contains("OSType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACrossClusterMigrationReplicationDetailsInternal)this).OSType = (string) content.GetValueForProperty("OSType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACrossClusterMigrationReplicationDetailsInternal)this).OSType, global::System.Convert.ToString); + } + if (content.Contains("VMProtectionState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACrossClusterMigrationReplicationDetailsInternal)this).VMProtectionState = (string) content.GetValueForProperty("VMProtectionState",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACrossClusterMigrationReplicationDetailsInternal)this).VMProtectionState, global::System.Convert.ToString); + } + if (content.Contains("VMProtectionStateDescription")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACrossClusterMigrationReplicationDetailsInternal)this).VMProtectionStateDescription = (string) content.GetValueForProperty("VMProtectionStateDescription",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACrossClusterMigrationReplicationDetailsInternal)this).VMProtectionStateDescription, global::System.Convert.ToString); + } + if (content.Contains("LifecycleId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACrossClusterMigrationReplicationDetailsInternal)this).LifecycleId = (string) content.GetValueForProperty("LifecycleId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACrossClusterMigrationReplicationDetailsInternal)this).LifecycleId, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettingsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettingsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal A2ACrossClusterMigrationReplicationDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("FabricObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACrossClusterMigrationReplicationDetailsInternal)this).FabricObjectId = (string) content.GetValueForProperty("FabricObjectId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACrossClusterMigrationReplicationDetailsInternal)this).FabricObjectId, global::System.Convert.ToString); + } + if (content.Contains("PrimaryFabricLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACrossClusterMigrationReplicationDetailsInternal)this).PrimaryFabricLocation = (string) content.GetValueForProperty("PrimaryFabricLocation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACrossClusterMigrationReplicationDetailsInternal)this).PrimaryFabricLocation, global::System.Convert.ToString); + } + if (content.Contains("OSType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACrossClusterMigrationReplicationDetailsInternal)this).OSType = (string) content.GetValueForProperty("OSType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACrossClusterMigrationReplicationDetailsInternal)this).OSType, global::System.Convert.ToString); + } + if (content.Contains("VMProtectionState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACrossClusterMigrationReplicationDetailsInternal)this).VMProtectionState = (string) content.GetValueForProperty("VMProtectionState",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACrossClusterMigrationReplicationDetailsInternal)this).VMProtectionState, global::System.Convert.ToString); + } + if (content.Contains("VMProtectionStateDescription")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACrossClusterMigrationReplicationDetailsInternal)this).VMProtectionStateDescription = (string) content.GetValueForProperty("VMProtectionStateDescription",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACrossClusterMigrationReplicationDetailsInternal)this).VMProtectionStateDescription, global::System.Convert.ToString); + } + if (content.Contains("LifecycleId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACrossClusterMigrationReplicationDetailsInternal)this).LifecycleId = (string) content.GetValueForProperty("LifecycleId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACrossClusterMigrationReplicationDetailsInternal)this).LifecycleId, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettingsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettingsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACrossClusterMigrationReplicationDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new A2ACrossClusterMigrationReplicationDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACrossClusterMigrationReplicationDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new A2ACrossClusterMigrationReplicationDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a + /// json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACrossClusterMigrationReplicationDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// A2A provider specific settings. + [System.ComponentModel.TypeConverter(typeof(A2ACrossClusterMigrationReplicationDetailsTypeConverter))] + public partial interface IA2ACrossClusterMigrationReplicationDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ACrossClusterMigrationReplicationDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ACrossClusterMigrationReplicationDetails.TypeConverter.cs new file mode 100644 index 000000000000..13973ff711c9 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ACrossClusterMigrationReplicationDetails.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class A2ACrossClusterMigrationReplicationDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACrossClusterMigrationReplicationDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACrossClusterMigrationReplicationDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return A2ACrossClusterMigrationReplicationDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return A2ACrossClusterMigrationReplicationDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return A2ACrossClusterMigrationReplicationDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ACrossClusterMigrationReplicationDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ACrossClusterMigrationReplicationDetails.cs new file mode 100644 index 000000000000..ddd1607164d7 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ACrossClusterMigrationReplicationDetails.cs @@ -0,0 +1,173 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// A2A provider specific settings. + public partial class A2ACrossClusterMigrationReplicationDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACrossClusterMigrationReplicationDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACrossClusterMigrationReplicationDetailsInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettings __replicationProviderSpecificSettings = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProviderSpecificSettings(); + + /// Backing field for property. + private string _fabricObjectId; + + /// The fabric specific object Id of the virtual machine. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string FabricObjectId { get => this._fabricObjectId; set => this._fabricObjectId = value; } + + /// Gets the Instance type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettingsInternal)__replicationProviderSpecificSettings).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettingsInternal)__replicationProviderSpecificSettings).InstanceType = value ; } + + /// Backing field for property. + private string _lifecycleId; + + /// + /// 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. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string LifecycleId { get => this._lifecycleId; set => this._lifecycleId = value; } + + /// Backing field for property. + private string _oSType; + + /// The type of operating system. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string OSType { get => this._oSType; set => this._oSType = value; } + + /// Backing field for property. + private string _primaryFabricLocation; + + /// Primary fabric location. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string PrimaryFabricLocation { get => this._primaryFabricLocation; set => this._primaryFabricLocation = value; } + + /// Backing field for property. + private string _vMProtectionState; + + /// The protection state for the vm. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string VMProtectionState { get => this._vMProtectionState; set => this._vMProtectionState = value; } + + /// Backing field for property. + private string _vMProtectionStateDescription; + + /// The protection state description for the vm. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string VMProtectionStateDescription { get => this._vMProtectionStateDescription; set => this._vMProtectionStateDescription = value; } + + /// + /// Creates an new instance. + /// + public A2ACrossClusterMigrationReplicationDetails() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__replicationProviderSpecificSettings), __replicationProviderSpecificSettings); + await eventListener.AssertObjectIsValid(nameof(__replicationProviderSpecificSettings), __replicationProviderSpecificSettings); + } + } + /// A2A provider specific settings. + public partial interface IA2ACrossClusterMigrationReplicationDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettings + { + /// The fabric specific object Id of the virtual machine. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The fabric specific object Id of the virtual machine.", + SerializedName = @"fabricObjectId", + PossibleTypes = new [] { typeof(string) })] + string FabricObjectId { get; set; } + /// + /// 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. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"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.", + SerializedName = @"lifecycleId", + PossibleTypes = new [] { typeof(string) })] + string LifecycleId { get; set; } + /// The type of operating system. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The type of operating system.", + SerializedName = @"osType", + PossibleTypes = new [] { typeof(string) })] + string OSType { get; set; } + /// Primary fabric location. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Primary fabric location.", + SerializedName = @"primaryFabricLocation", + PossibleTypes = new [] { typeof(string) })] + string PrimaryFabricLocation { get; set; } + /// The protection state for the vm. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The protection state for the vm.", + SerializedName = @"vmProtectionState", + PossibleTypes = new [] { typeof(string) })] + string VMProtectionState { get; set; } + /// The protection state description for the vm. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The protection state description for the vm.", + SerializedName = @"vmProtectionStateDescription", + PossibleTypes = new [] { typeof(string) })] + string VMProtectionStateDescription { get; set; } + + } + /// A2A provider specific settings. + internal partial interface IA2ACrossClusterMigrationReplicationDetailsInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettingsInternal + { + /// The fabric specific object Id of the virtual machine. + string FabricObjectId { get; set; } + /// + /// 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. + /// + string LifecycleId { get; set; } + /// The type of operating system. + string OSType { get; set; } + /// Primary fabric location. + string PrimaryFabricLocation { get; set; } + /// The protection state for the vm. + string VMProtectionState { get; set; } + /// The protection state description for the vm. + string VMProtectionStateDescription { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ACrossClusterMigrationReplicationDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ACrossClusterMigrationReplicationDetails.json.cs new file mode 100644 index 000000000000..cc1447436c6b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ACrossClusterMigrationReplicationDetails.json.cs @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// A2A provider specific settings. + public partial class A2ACrossClusterMigrationReplicationDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal A2ACrossClusterMigrationReplicationDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __replicationProviderSpecificSettings = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProviderSpecificSettings(json); + {_fabricObjectId = If( json?.PropertyT("fabricObjectId"), out var __jsonFabricObjectId) ? (string)__jsonFabricObjectId : (string)FabricObjectId;} + {_primaryFabricLocation = If( json?.PropertyT("primaryFabricLocation"), out var __jsonPrimaryFabricLocation) ? (string)__jsonPrimaryFabricLocation : (string)PrimaryFabricLocation;} + {_oSType = If( json?.PropertyT("osType"), out var __jsonOSType) ? (string)__jsonOSType : (string)OSType;} + {_vMProtectionState = If( json?.PropertyT("vmProtectionState"), out var __jsonVMProtectionState) ? (string)__jsonVMProtectionState : (string)VMProtectionState;} + {_vMProtectionStateDescription = If( json?.PropertyT("vmProtectionStateDescription"), out var __jsonVMProtectionStateDescription) ? (string)__jsonVMProtectionStateDescription : (string)VMProtectionStateDescription;} + {_lifecycleId = If( json?.PropertyT("lifecycleId"), out var __jsonLifecycleId) ? (string)__jsonLifecycleId : (string)LifecycleId;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACrossClusterMigrationReplicationDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACrossClusterMigrationReplicationDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ACrossClusterMigrationReplicationDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new A2ACrossClusterMigrationReplicationDetails(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __replicationProviderSpecificSettings?.ToJson(container, serializationMode); + AddIf( null != (((object)this._fabricObjectId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._fabricObjectId.ToString()) : null, "fabricObjectId" ,container.Add ); + AddIf( null != (((object)this._primaryFabricLocation)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._primaryFabricLocation.ToString()) : null, "primaryFabricLocation" ,container.Add ); + AddIf( null != (((object)this._oSType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._oSType.ToString()) : null, "osType" ,container.Add ); + AddIf( null != (((object)this._vMProtectionState)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._vMProtectionState.ToString()) : null, "vmProtectionState" ,container.Add ); + AddIf( null != (((object)this._vMProtectionStateDescription)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._vMProtectionStateDescription.ToString()) : null, "vmProtectionStateDescription" ,container.Add ); + AddIf( null != (((object)this._lifecycleId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._lifecycleId.ToString()) : null, "lifecycleId" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AEnableProtectionInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AEnableProtectionInput.PowerShell.cs new file mode 100644 index 000000000000..276494ffce3d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AEnableProtectionInput.PowerShell.cs @@ -0,0 +1,354 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// A2A enable protection input. + [System.ComponentModel.TypeConverter(typeof(A2AEnableProtectionInputTypeConverter))] + public partial class A2AEnableProtectionInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal A2AEnableProtectionInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DiskEncryptionInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).DiskEncryptionInfo = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfo) content.GetValueForProperty("DiskEncryptionInfo",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).DiskEncryptionInfo, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DiskEncryptionInfoTypeConverter.ConvertFrom); + } + if (content.Contains("RecoveryExtendedLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).RecoveryExtendedLocation = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocation) content.GetValueForProperty("RecoveryExtendedLocation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).RecoveryExtendedLocation, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ExtendedLocationTypeConverter.ConvertFrom); + } + if (content.Contains("FabricObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).FabricObjectId = (string) content.GetValueForProperty("FabricObjectId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).FabricObjectId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryContainerId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).RecoveryContainerId = (string) content.GetValueForProperty("RecoveryContainerId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).RecoveryContainerId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryResourceGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).RecoveryResourceGroupId = (string) content.GetValueForProperty("RecoveryResourceGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).RecoveryResourceGroupId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryCloudServiceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).RecoveryCloudServiceId = (string) content.GetValueForProperty("RecoveryCloudServiceId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).RecoveryCloudServiceId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryAvailabilitySetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).RecoveryAvailabilitySetId = (string) content.GetValueForProperty("RecoveryAvailabilitySetId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).RecoveryAvailabilitySetId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryProximityPlacementGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).RecoveryProximityPlacementGroupId = (string) content.GetValueForProperty("RecoveryProximityPlacementGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).RecoveryProximityPlacementGroupId, global::System.Convert.ToString); + } + if (content.Contains("VMDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).VMDisk = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmDiskInputDetails[]) content.GetValueForProperty("VMDisk",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).VMDisk, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2AvmDiskInputDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("VMManagedDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).VMManagedDisk = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskInputDetails[]) content.GetValueForProperty("VMManagedDisk",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).VMManagedDisk, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2AvmManagedDiskInputDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("MultiVMGroupName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).MultiVMGroupName = (string) content.GetValueForProperty("MultiVMGroupName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).MultiVMGroupName, global::System.Convert.ToString); + } + if (content.Contains("MultiVMGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).MultiVMGroupId = (string) content.GetValueForProperty("MultiVMGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).MultiVMGroupId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryBootDiagStorageAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).RecoveryBootDiagStorageAccountId = (string) content.GetValueForProperty("RecoveryBootDiagStorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).RecoveryBootDiagStorageAccountId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryAvailabilityZone")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).RecoveryAvailabilityZone = (string) content.GetValueForProperty("RecoveryAvailabilityZone",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).RecoveryAvailabilityZone, global::System.Convert.ToString); + } + if (content.Contains("RecoveryAzureNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).RecoveryAzureNetworkId = (string) content.GetValueForProperty("RecoveryAzureNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).RecoveryAzureNetworkId, global::System.Convert.ToString); + } + if (content.Contains("RecoverySubnetName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).RecoverySubnetName = (string) content.GetValueForProperty("RecoverySubnetName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).RecoverySubnetName, global::System.Convert.ToString); + } + if (content.Contains("RecoveryVirtualMachineScaleSetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).RecoveryVirtualMachineScaleSetId = (string) content.GetValueForProperty("RecoveryVirtualMachineScaleSetId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).RecoveryVirtualMachineScaleSetId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryCapacityReservationGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).RecoveryCapacityReservationGroupId = (string) content.GetValueForProperty("RecoveryCapacityReservationGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).RecoveryCapacityReservationGroupId, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + if (content.Contains("DiskEncryptionInfoDiskEncryptionKeyInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).DiskEncryptionInfoDiskEncryptionKeyInfo = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionKeyInfo) content.GetValueForProperty("DiskEncryptionInfoDiskEncryptionKeyInfo",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).DiskEncryptionInfoDiskEncryptionKeyInfo, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DiskEncryptionKeyInfoTypeConverter.ConvertFrom); + } + if (content.Contains("DiskEncryptionInfoKeyEncryptionKeyInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).DiskEncryptionInfoKeyEncryptionKeyInfo = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IKeyEncryptionKeyInfo) content.GetValueForProperty("DiskEncryptionInfoKeyEncryptionKeyInfo",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).DiskEncryptionInfoKeyEncryptionKeyInfo, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.KeyEncryptionKeyInfoTypeConverter.ConvertFrom); + } + if (content.Contains("DiskEncryptionKeyInfoSecretIdentifier")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).DiskEncryptionKeyInfoSecretIdentifier = (string) content.GetValueForProperty("DiskEncryptionKeyInfoSecretIdentifier",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).DiskEncryptionKeyInfoSecretIdentifier, global::System.Convert.ToString); + } + if (content.Contains("KeyEncryptionKeyInfoKeyIdentifier")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).KeyEncryptionKeyInfoKeyIdentifier = (string) content.GetValueForProperty("KeyEncryptionKeyInfoKeyIdentifier",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).KeyEncryptionKeyInfoKeyIdentifier, global::System.Convert.ToString); + } + if (content.Contains("RecoveryExtendedLocationName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).RecoveryExtendedLocationName = (string) content.GetValueForProperty("RecoveryExtendedLocationName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).RecoveryExtendedLocationName, global::System.Convert.ToString); + } + if (content.Contains("RecoveryExtendedLocationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).RecoveryExtendedLocationType = (string) content.GetValueForProperty("RecoveryExtendedLocationType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).RecoveryExtendedLocationType, global::System.Convert.ToString); + } + if (content.Contains("DiskEncryptionKeyInfoKeyVaultResourceArmId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).DiskEncryptionKeyInfoKeyVaultResourceArmId = (string) content.GetValueForProperty("DiskEncryptionKeyInfoKeyVaultResourceArmId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).DiskEncryptionKeyInfoKeyVaultResourceArmId, global::System.Convert.ToString); + } + if (content.Contains("KeyEncryptionKeyInfoKeyVaultResourceArmId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).KeyEncryptionKeyInfoKeyVaultResourceArmId = (string) content.GetValueForProperty("KeyEncryptionKeyInfoKeyVaultResourceArmId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).KeyEncryptionKeyInfoKeyVaultResourceArmId, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal A2AEnableProtectionInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DiskEncryptionInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).DiskEncryptionInfo = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfo) content.GetValueForProperty("DiskEncryptionInfo",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).DiskEncryptionInfo, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DiskEncryptionInfoTypeConverter.ConvertFrom); + } + if (content.Contains("RecoveryExtendedLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).RecoveryExtendedLocation = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocation) content.GetValueForProperty("RecoveryExtendedLocation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).RecoveryExtendedLocation, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ExtendedLocationTypeConverter.ConvertFrom); + } + if (content.Contains("FabricObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).FabricObjectId = (string) content.GetValueForProperty("FabricObjectId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).FabricObjectId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryContainerId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).RecoveryContainerId = (string) content.GetValueForProperty("RecoveryContainerId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).RecoveryContainerId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryResourceGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).RecoveryResourceGroupId = (string) content.GetValueForProperty("RecoveryResourceGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).RecoveryResourceGroupId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryCloudServiceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).RecoveryCloudServiceId = (string) content.GetValueForProperty("RecoveryCloudServiceId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).RecoveryCloudServiceId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryAvailabilitySetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).RecoveryAvailabilitySetId = (string) content.GetValueForProperty("RecoveryAvailabilitySetId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).RecoveryAvailabilitySetId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryProximityPlacementGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).RecoveryProximityPlacementGroupId = (string) content.GetValueForProperty("RecoveryProximityPlacementGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).RecoveryProximityPlacementGroupId, global::System.Convert.ToString); + } + if (content.Contains("VMDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).VMDisk = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmDiskInputDetails[]) content.GetValueForProperty("VMDisk",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).VMDisk, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2AvmDiskInputDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("VMManagedDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).VMManagedDisk = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskInputDetails[]) content.GetValueForProperty("VMManagedDisk",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).VMManagedDisk, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2AvmManagedDiskInputDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("MultiVMGroupName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).MultiVMGroupName = (string) content.GetValueForProperty("MultiVMGroupName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).MultiVMGroupName, global::System.Convert.ToString); + } + if (content.Contains("MultiVMGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).MultiVMGroupId = (string) content.GetValueForProperty("MultiVMGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).MultiVMGroupId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryBootDiagStorageAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).RecoveryBootDiagStorageAccountId = (string) content.GetValueForProperty("RecoveryBootDiagStorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).RecoveryBootDiagStorageAccountId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryAvailabilityZone")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).RecoveryAvailabilityZone = (string) content.GetValueForProperty("RecoveryAvailabilityZone",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).RecoveryAvailabilityZone, global::System.Convert.ToString); + } + if (content.Contains("RecoveryAzureNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).RecoveryAzureNetworkId = (string) content.GetValueForProperty("RecoveryAzureNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).RecoveryAzureNetworkId, global::System.Convert.ToString); + } + if (content.Contains("RecoverySubnetName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).RecoverySubnetName = (string) content.GetValueForProperty("RecoverySubnetName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).RecoverySubnetName, global::System.Convert.ToString); + } + if (content.Contains("RecoveryVirtualMachineScaleSetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).RecoveryVirtualMachineScaleSetId = (string) content.GetValueForProperty("RecoveryVirtualMachineScaleSetId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).RecoveryVirtualMachineScaleSetId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryCapacityReservationGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).RecoveryCapacityReservationGroupId = (string) content.GetValueForProperty("RecoveryCapacityReservationGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).RecoveryCapacityReservationGroupId, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + if (content.Contains("DiskEncryptionInfoDiskEncryptionKeyInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).DiskEncryptionInfoDiskEncryptionKeyInfo = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionKeyInfo) content.GetValueForProperty("DiskEncryptionInfoDiskEncryptionKeyInfo",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).DiskEncryptionInfoDiskEncryptionKeyInfo, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DiskEncryptionKeyInfoTypeConverter.ConvertFrom); + } + if (content.Contains("DiskEncryptionInfoKeyEncryptionKeyInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).DiskEncryptionInfoKeyEncryptionKeyInfo = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IKeyEncryptionKeyInfo) content.GetValueForProperty("DiskEncryptionInfoKeyEncryptionKeyInfo",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).DiskEncryptionInfoKeyEncryptionKeyInfo, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.KeyEncryptionKeyInfoTypeConverter.ConvertFrom); + } + if (content.Contains("DiskEncryptionKeyInfoSecretIdentifier")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).DiskEncryptionKeyInfoSecretIdentifier = (string) content.GetValueForProperty("DiskEncryptionKeyInfoSecretIdentifier",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).DiskEncryptionKeyInfoSecretIdentifier, global::System.Convert.ToString); + } + if (content.Contains("KeyEncryptionKeyInfoKeyIdentifier")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).KeyEncryptionKeyInfoKeyIdentifier = (string) content.GetValueForProperty("KeyEncryptionKeyInfoKeyIdentifier",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).KeyEncryptionKeyInfoKeyIdentifier, global::System.Convert.ToString); + } + if (content.Contains("RecoveryExtendedLocationName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).RecoveryExtendedLocationName = (string) content.GetValueForProperty("RecoveryExtendedLocationName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).RecoveryExtendedLocationName, global::System.Convert.ToString); + } + if (content.Contains("RecoveryExtendedLocationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).RecoveryExtendedLocationType = (string) content.GetValueForProperty("RecoveryExtendedLocationType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).RecoveryExtendedLocationType, global::System.Convert.ToString); + } + if (content.Contains("DiskEncryptionKeyInfoKeyVaultResourceArmId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).DiskEncryptionKeyInfoKeyVaultResourceArmId = (string) content.GetValueForProperty("DiskEncryptionKeyInfoKeyVaultResourceArmId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).DiskEncryptionKeyInfoKeyVaultResourceArmId, global::System.Convert.ToString); + } + if (content.Contains("KeyEncryptionKeyInfoKeyVaultResourceArmId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).KeyEncryptionKeyInfoKeyVaultResourceArmId = (string) content.GetValueForProperty("KeyEncryptionKeyInfoKeyVaultResourceArmId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal)this).KeyEncryptionKeyInfoKeyVaultResourceArmId, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new A2AEnableProtectionInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new A2AEnableProtectionInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// A2A enable protection input. + [System.ComponentModel.TypeConverter(typeof(A2AEnableProtectionInputTypeConverter))] + public partial interface IA2AEnableProtectionInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AEnableProtectionInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AEnableProtectionInput.TypeConverter.cs new file mode 100644 index 000000000000..1fbf89988f50 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AEnableProtectionInput.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class A2AEnableProtectionInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return A2AEnableProtectionInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return A2AEnableProtectionInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return A2AEnableProtectionInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AEnableProtectionInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AEnableProtectionInput.cs new file mode 100644 index 000000000000..c3728071efa8 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AEnableProtectionInput.cs @@ -0,0 +1,450 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// A2A enable protection input. + public partial class A2AEnableProtectionInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionProviderSpecificInput __enableProtectionProviderSpecificInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EnableProtectionProviderSpecificInput(); + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfo _diskEncryptionInfo; + + /// The recovery disk encryption information (for two pass flows). + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfo DiskEncryptionInfo { get => (this._diskEncryptionInfo = this._diskEncryptionInfo ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DiskEncryptionInfo()); set => this._diskEncryptionInfo = value; } + + /// The KeyVault resource ARM id for secret. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string DiskEncryptionKeyInfoKeyVaultResourceArmId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)DiskEncryptionInfo).DiskEncryptionKeyInfoKeyVaultResourceArmId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)DiskEncryptionInfo).DiskEncryptionKeyInfoKeyVaultResourceArmId = value ?? null; } + + /// The secret url / identifier. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string DiskEncryptionKeyInfoSecretIdentifier { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)DiskEncryptionInfo).DiskEncryptionKeyInfoSecretIdentifier; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)DiskEncryptionInfo).DiskEncryptionKeyInfoSecretIdentifier = value ?? null; } + + /// Backing field for property. + private string _fabricObjectId; + + /// The fabric specific object Id of the virtual machine. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string FabricObjectId { get => this._fabricObjectId; set => this._fabricObjectId = value; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionProviderSpecificInputInternal)__enableProtectionProviderSpecificInput).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionProviderSpecificInputInternal)__enableProtectionProviderSpecificInput).InstanceType = value ; } + + /// The key URL / identifier. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string KeyEncryptionKeyInfoKeyIdentifier { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)DiskEncryptionInfo).KeyEncryptionKeyInfoKeyIdentifier; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)DiskEncryptionInfo).KeyEncryptionKeyInfoKeyIdentifier = value ?? null; } + + /// The KeyVault resource ARM Id for key. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string KeyEncryptionKeyInfoKeyVaultResourceArmId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)DiskEncryptionInfo).KeyEncryptionKeyInfoKeyVaultResourceArmId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)DiskEncryptionInfo).KeyEncryptionKeyInfoKeyVaultResourceArmId = value ?? null; } + + /// Internal Acessors for DiskEncryptionInfo + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfo Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal.DiskEncryptionInfo { get => (this._diskEncryptionInfo = this._diskEncryptionInfo ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DiskEncryptionInfo()); set { {_diskEncryptionInfo = value;} } } + + /// Internal Acessors for DiskEncryptionInfoDiskEncryptionKeyInfo + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionKeyInfo Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal.DiskEncryptionInfoDiskEncryptionKeyInfo { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)DiskEncryptionInfo).DiskEncryptionKeyInfo; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)DiskEncryptionInfo).DiskEncryptionKeyInfo = value; } + + /// Internal Acessors for DiskEncryptionInfoKeyEncryptionKeyInfo + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IKeyEncryptionKeyInfo Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal.DiskEncryptionInfoKeyEncryptionKeyInfo { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)DiskEncryptionInfo).KeyEncryptionKeyInfo; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)DiskEncryptionInfo).KeyEncryptionKeyInfo = value; } + + /// Internal Acessors for RecoveryExtendedLocation + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocation Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal.RecoveryExtendedLocation { get => (this._recoveryExtendedLocation = this._recoveryExtendedLocation ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ExtendedLocation()); set { {_recoveryExtendedLocation = value;} } } + + /// Internal Acessors for RecoveryExtendedLocationType + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInputInternal.RecoveryExtendedLocationType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocationInternal)RecoveryExtendedLocation).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocationInternal)RecoveryExtendedLocation).Type = value; } + + /// Backing field for property. + private string _multiVMGroupId; + + /// The multi vm group id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string MultiVMGroupId { get => this._multiVMGroupId; set => this._multiVMGroupId = value; } + + /// Backing field for property. + private string _multiVMGroupName; + + /// The multi vm group name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string MultiVMGroupName { get => this._multiVMGroupName; set => this._multiVMGroupName = value; } + + /// Backing field for property. + private string _recoveryAvailabilitySetId; + + /// The recovery availability set Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryAvailabilitySetId { get => this._recoveryAvailabilitySetId; set => this._recoveryAvailabilitySetId = value; } + + /// Backing field for property. + private string _recoveryAvailabilityZone; + + /// The recovery availability zone. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryAvailabilityZone { get => this._recoveryAvailabilityZone; set => this._recoveryAvailabilityZone = value; } + + /// Backing field for property. + private string _recoveryAzureNetworkId; + + /// The recovery Azure virtual network ARM id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryAzureNetworkId { get => this._recoveryAzureNetworkId; set => this._recoveryAzureNetworkId = value; } + + /// Backing field for property. + private string _recoveryBootDiagStorageAccountId; + + /// The boot diagnostic storage account. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryBootDiagStorageAccountId { get => this._recoveryBootDiagStorageAccountId; set => this._recoveryBootDiagStorageAccountId = value; } + + /// Backing field for property. + private string _recoveryCapacityReservationGroupId; + + /// The recovery capacity reservation group Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryCapacityReservationGroupId { get => this._recoveryCapacityReservationGroupId; set => this._recoveryCapacityReservationGroupId = value; } + + /// Backing field for property. + private string _recoveryCloudServiceId; + + /// The recovery cloud service Id. Valid for V1 scenarios. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryCloudServiceId { get => this._recoveryCloudServiceId; set => this._recoveryCloudServiceId = value; } + + /// Backing field for property. + private string _recoveryContainerId; + + /// The recovery container Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryContainerId { get => this._recoveryContainerId; set => this._recoveryContainerId = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocation _recoveryExtendedLocation; + + /// The recovery extended location. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocation RecoveryExtendedLocation { get => (this._recoveryExtendedLocation = this._recoveryExtendedLocation ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ExtendedLocation()); set => this._recoveryExtendedLocation = value; } + + /// The name of the extended location. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string RecoveryExtendedLocationName { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocationInternal)RecoveryExtendedLocation).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocationInternal)RecoveryExtendedLocation).Name = value ?? null; } + + /// The extended location type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string RecoveryExtendedLocationType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocationInternal)RecoveryExtendedLocation).Type; } + + /// Backing field for property. + private string _recoveryProximityPlacementGroupId; + + /// The recovery proximity placement group Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryProximityPlacementGroupId { get => this._recoveryProximityPlacementGroupId; set => this._recoveryProximityPlacementGroupId = value; } + + /// Backing field for property. + private string _recoveryResourceGroupId; + + /// The recovery resource group Id. Valid for V2 scenarios. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryResourceGroupId { get => this._recoveryResourceGroupId; set => this._recoveryResourceGroupId = value; } + + /// Backing field for property. + private string _recoverySubnetName; + + /// The recovery subnet name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoverySubnetName { get => this._recoverySubnetName; set => this._recoverySubnetName = value; } + + /// Backing field for property. + private string _recoveryVirtualMachineScaleSetId; + + /// The virtual machine scale set Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryVirtualMachineScaleSetId { get => this._recoveryVirtualMachineScaleSetId; set => this._recoveryVirtualMachineScaleSetId = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmDiskInputDetails[] _vMDisk; + + /// The list of vm disk details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmDiskInputDetails[] VMDisk { get => this._vMDisk; set => this._vMDisk = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskInputDetails[] _vMManagedDisk; + + /// The list of vm managed disk details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskInputDetails[] VMManagedDisk { get => this._vMManagedDisk; set => this._vMManagedDisk = value; } + + /// Creates an new instance. + public A2AEnableProtectionInput() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__enableProtectionProviderSpecificInput), __enableProtectionProviderSpecificInput); + await eventListener.AssertObjectIsValid(nameof(__enableProtectionProviderSpecificInput), __enableProtectionProviderSpecificInput); + } + } + /// A2A enable protection input. + public partial interface IA2AEnableProtectionInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionProviderSpecificInput + { + /// The KeyVault resource ARM id for secret. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The KeyVault resource ARM id for secret.", + SerializedName = @"keyVaultResourceArmId", + PossibleTypes = new [] { typeof(string) })] + string DiskEncryptionKeyInfoKeyVaultResourceArmId { get; set; } + /// The secret url / identifier. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The secret url / identifier.", + SerializedName = @"secretIdentifier", + PossibleTypes = new [] { typeof(string) })] + string DiskEncryptionKeyInfoSecretIdentifier { get; set; } + /// The fabric specific object Id of the virtual machine. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The fabric specific object Id of the virtual machine.", + SerializedName = @"fabricObjectId", + PossibleTypes = new [] { typeof(string) })] + string FabricObjectId { get; set; } + /// The key URL / identifier. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The key URL / identifier.", + SerializedName = @"keyIdentifier", + PossibleTypes = new [] { typeof(string) })] + string KeyEncryptionKeyInfoKeyIdentifier { get; set; } + /// The KeyVault resource ARM Id for key. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The KeyVault resource ARM Id for key.", + SerializedName = @"keyVaultResourceArmId", + PossibleTypes = new [] { typeof(string) })] + string KeyEncryptionKeyInfoKeyVaultResourceArmId { get; set; } + /// The multi vm group id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The multi vm group id.", + SerializedName = @"multiVmGroupId", + PossibleTypes = new [] { typeof(string) })] + string MultiVMGroupId { get; set; } + /// The multi vm group name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The multi vm group name.", + SerializedName = @"multiVmGroupName", + PossibleTypes = new [] { typeof(string) })] + string MultiVMGroupName { get; set; } + /// The recovery availability set Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery availability set Id.", + SerializedName = @"recoveryAvailabilitySetId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryAvailabilitySetId { get; set; } + /// The recovery availability zone. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery availability zone.", + SerializedName = @"recoveryAvailabilityZone", + PossibleTypes = new [] { typeof(string) })] + string RecoveryAvailabilityZone { get; set; } + /// The recovery Azure virtual network ARM id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery Azure virtual network ARM id.", + SerializedName = @"recoveryAzureNetworkId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryAzureNetworkId { get; set; } + /// The boot diagnostic storage account. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The boot diagnostic storage account.", + SerializedName = @"recoveryBootDiagStorageAccountId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryBootDiagStorageAccountId { get; set; } + /// The recovery capacity reservation group Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery capacity reservation group Id.", + SerializedName = @"recoveryCapacityReservationGroupId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryCapacityReservationGroupId { get; set; } + /// The recovery cloud service Id. Valid for V1 scenarios. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery cloud service Id. Valid for V1 scenarios.", + SerializedName = @"recoveryCloudServiceId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryCloudServiceId { get; set; } + /// The recovery container Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery container Id.", + SerializedName = @"recoveryContainerId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryContainerId { get; set; } + /// The name of the extended location. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the extended location.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string RecoveryExtendedLocationName { get; set; } + /// The extended location type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The extended location type.", + SerializedName = @"type", + PossibleTypes = new [] { typeof(string) })] + string RecoveryExtendedLocationType { get; } + /// The recovery proximity placement group Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery proximity placement group Id.", + SerializedName = @"recoveryProximityPlacementGroupId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryProximityPlacementGroupId { get; set; } + /// The recovery resource group Id. Valid for V2 scenarios. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery resource group Id. Valid for V2 scenarios.", + SerializedName = @"recoveryResourceGroupId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryResourceGroupId { get; set; } + /// The recovery subnet name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery subnet name.", + SerializedName = @"recoverySubnetName", + PossibleTypes = new [] { typeof(string) })] + string RecoverySubnetName { get; set; } + /// The virtual machine scale set Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The virtual machine scale set Id.", + SerializedName = @"recoveryVirtualMachineScaleSetId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryVirtualMachineScaleSetId { get; set; } + /// The list of vm disk details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of vm disk details.", + SerializedName = @"vmDisks", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmDiskInputDetails) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmDiskInputDetails[] VMDisk { get; set; } + /// The list of vm managed disk details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of vm managed disk details.", + SerializedName = @"vmManagedDisks", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskInputDetails) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskInputDetails[] VMManagedDisk { get; set; } + + } + /// A2A enable protection input. + internal partial interface IA2AEnableProtectionInputInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionProviderSpecificInputInternal + { + /// The recovery disk encryption information (for two pass flows). + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfo DiskEncryptionInfo { get; set; } + /// The recovery KeyVault reference for secret. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionKeyInfo DiskEncryptionInfoDiskEncryptionKeyInfo { get; set; } + /// The recovery KeyVault reference for key. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IKeyEncryptionKeyInfo DiskEncryptionInfoKeyEncryptionKeyInfo { get; set; } + /// The KeyVault resource ARM id for secret. + string DiskEncryptionKeyInfoKeyVaultResourceArmId { get; set; } + /// The secret url / identifier. + string DiskEncryptionKeyInfoSecretIdentifier { get; set; } + /// The fabric specific object Id of the virtual machine. + string FabricObjectId { get; set; } + /// The key URL / identifier. + string KeyEncryptionKeyInfoKeyIdentifier { get; set; } + /// The KeyVault resource ARM Id for key. + string KeyEncryptionKeyInfoKeyVaultResourceArmId { get; set; } + /// The multi vm group id. + string MultiVMGroupId { get; set; } + /// The multi vm group name. + string MultiVMGroupName { get; set; } + /// The recovery availability set Id. + string RecoveryAvailabilitySetId { get; set; } + /// The recovery availability zone. + string RecoveryAvailabilityZone { get; set; } + /// The recovery Azure virtual network ARM id. + string RecoveryAzureNetworkId { get; set; } + /// The boot diagnostic storage account. + string RecoveryBootDiagStorageAccountId { get; set; } + /// The recovery capacity reservation group Id. + string RecoveryCapacityReservationGroupId { get; set; } + /// The recovery cloud service Id. Valid for V1 scenarios. + string RecoveryCloudServiceId { get; set; } + /// The recovery container Id. + string RecoveryContainerId { get; set; } + /// The recovery extended location. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocation RecoveryExtendedLocation { get; set; } + /// The name of the extended location. + string RecoveryExtendedLocationName { get; set; } + /// The extended location type. + string RecoveryExtendedLocationType { get; set; } + /// The recovery proximity placement group Id. + string RecoveryProximityPlacementGroupId { get; set; } + /// The recovery resource group Id. Valid for V2 scenarios. + string RecoveryResourceGroupId { get; set; } + /// The recovery subnet name. + string RecoverySubnetName { get; set; } + /// The virtual machine scale set Id. + string RecoveryVirtualMachineScaleSetId { get; set; } + /// The list of vm disk details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmDiskInputDetails[] VMDisk { get; set; } + /// The list of vm managed disk details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskInputDetails[] VMManagedDisk { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AEnableProtectionInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AEnableProtectionInput.json.cs new file mode 100644 index 000000000000..f167e0735130 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AEnableProtectionInput.json.cs @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// A2A enable protection input. + public partial class A2AEnableProtectionInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal A2AEnableProtectionInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __enableProtectionProviderSpecificInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EnableProtectionProviderSpecificInput(json); + {_diskEncryptionInfo = If( json?.PropertyT("diskEncryptionInfo"), out var __jsonDiskEncryptionInfo) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DiskEncryptionInfo.FromJson(__jsonDiskEncryptionInfo) : DiskEncryptionInfo;} + {_recoveryExtendedLocation = If( json?.PropertyT("recoveryExtendedLocation"), out var __jsonRecoveryExtendedLocation) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ExtendedLocation.FromJson(__jsonRecoveryExtendedLocation) : RecoveryExtendedLocation;} + {_fabricObjectId = If( json?.PropertyT("fabricObjectId"), out var __jsonFabricObjectId) ? (string)__jsonFabricObjectId : (string)FabricObjectId;} + {_recoveryContainerId = If( json?.PropertyT("recoveryContainerId"), out var __jsonRecoveryContainerId) ? (string)__jsonRecoveryContainerId : (string)RecoveryContainerId;} + {_recoveryResourceGroupId = If( json?.PropertyT("recoveryResourceGroupId"), out var __jsonRecoveryResourceGroupId) ? (string)__jsonRecoveryResourceGroupId : (string)RecoveryResourceGroupId;} + {_recoveryCloudServiceId = If( json?.PropertyT("recoveryCloudServiceId"), out var __jsonRecoveryCloudServiceId) ? (string)__jsonRecoveryCloudServiceId : (string)RecoveryCloudServiceId;} + {_recoveryAvailabilitySetId = If( json?.PropertyT("recoveryAvailabilitySetId"), out var __jsonRecoveryAvailabilitySetId) ? (string)__jsonRecoveryAvailabilitySetId : (string)RecoveryAvailabilitySetId;} + {_recoveryProximityPlacementGroupId = If( json?.PropertyT("recoveryProximityPlacementGroupId"), out var __jsonRecoveryProximityPlacementGroupId) ? (string)__jsonRecoveryProximityPlacementGroupId : (string)RecoveryProximityPlacementGroupId;} + {_vMDisk = If( json?.PropertyT("vmDisks"), out var __jsonVMDisks) ? If( __jsonVMDisks as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmDiskInputDetails) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2AvmDiskInputDetails.FromJson(__u) )) ))() : null : VMDisk;} + {_vMManagedDisk = If( json?.PropertyT("vmManagedDisks"), out var __jsonVMManagedDisks) ? If( __jsonVMManagedDisks as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __q) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__q, (__p)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskInputDetails) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2AvmManagedDiskInputDetails.FromJson(__p) )) ))() : null : VMManagedDisk;} + {_multiVMGroupName = If( json?.PropertyT("multiVmGroupName"), out var __jsonMultiVMGroupName) ? (string)__jsonMultiVMGroupName : (string)MultiVMGroupName;} + {_multiVMGroupId = If( json?.PropertyT("multiVmGroupId"), out var __jsonMultiVMGroupId) ? (string)__jsonMultiVMGroupId : (string)MultiVMGroupId;} + {_recoveryBootDiagStorageAccountId = If( json?.PropertyT("recoveryBootDiagStorageAccountId"), out var __jsonRecoveryBootDiagStorageAccountId) ? (string)__jsonRecoveryBootDiagStorageAccountId : (string)RecoveryBootDiagStorageAccountId;} + {_recoveryAvailabilityZone = If( json?.PropertyT("recoveryAvailabilityZone"), out var __jsonRecoveryAvailabilityZone) ? (string)__jsonRecoveryAvailabilityZone : (string)RecoveryAvailabilityZone;} + {_recoveryAzureNetworkId = If( json?.PropertyT("recoveryAzureNetworkId"), out var __jsonRecoveryAzureNetworkId) ? (string)__jsonRecoveryAzureNetworkId : (string)RecoveryAzureNetworkId;} + {_recoverySubnetName = If( json?.PropertyT("recoverySubnetName"), out var __jsonRecoverySubnetName) ? (string)__jsonRecoverySubnetName : (string)RecoverySubnetName;} + {_recoveryVirtualMachineScaleSetId = If( json?.PropertyT("recoveryVirtualMachineScaleSetId"), out var __jsonRecoveryVirtualMachineScaleSetId) ? (string)__jsonRecoveryVirtualMachineScaleSetId : (string)RecoveryVirtualMachineScaleSetId;} + {_recoveryCapacityReservationGroupId = If( json?.PropertyT("recoveryCapacityReservationGroupId"), out var __jsonRecoveryCapacityReservationGroupId) ? (string)__jsonRecoveryCapacityReservationGroupId : (string)RecoveryCapacityReservationGroupId;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEnableProtectionInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new A2AEnableProtectionInput(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __enableProtectionProviderSpecificInput?.ToJson(container, serializationMode); + AddIf( null != this._diskEncryptionInfo ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._diskEncryptionInfo.ToJson(null,serializationMode) : null, "diskEncryptionInfo" ,container.Add ); + AddIf( null != this._recoveryExtendedLocation ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._recoveryExtendedLocation.ToJson(null,serializationMode) : null, "recoveryExtendedLocation" ,container.Add ); + AddIf( null != (((object)this._fabricObjectId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._fabricObjectId.ToString()) : null, "fabricObjectId" ,container.Add ); + AddIf( null != (((object)this._recoveryContainerId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryContainerId.ToString()) : null, "recoveryContainerId" ,container.Add ); + AddIf( null != (((object)this._recoveryResourceGroupId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryResourceGroupId.ToString()) : null, "recoveryResourceGroupId" ,container.Add ); + AddIf( null != (((object)this._recoveryCloudServiceId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryCloudServiceId.ToString()) : null, "recoveryCloudServiceId" ,container.Add ); + AddIf( null != (((object)this._recoveryAvailabilitySetId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryAvailabilitySetId.ToString()) : null, "recoveryAvailabilitySetId" ,container.Add ); + AddIf( null != (((object)this._recoveryProximityPlacementGroupId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryProximityPlacementGroupId.ToString()) : null, "recoveryProximityPlacementGroupId" ,container.Add ); + if (null != this._vMDisk) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._vMDisk ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("vmDisks",__w); + } + if (null != this._vMManagedDisk) + { + var __r = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __s in this._vMManagedDisk ) + { + AddIf(__s?.ToJson(null, serializationMode) ,__r.Add); + } + container.Add("vmManagedDisks",__r); + } + AddIf( null != (((object)this._multiVMGroupName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._multiVMGroupName.ToString()) : null, "multiVmGroupName" ,container.Add ); + AddIf( null != (((object)this._multiVMGroupId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._multiVMGroupId.ToString()) : null, "multiVmGroupId" ,container.Add ); + AddIf( null != (((object)this._recoveryBootDiagStorageAccountId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryBootDiagStorageAccountId.ToString()) : null, "recoveryBootDiagStorageAccountId" ,container.Add ); + AddIf( null != (((object)this._recoveryAvailabilityZone)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryAvailabilityZone.ToString()) : null, "recoveryAvailabilityZone" ,container.Add ); + AddIf( null != (((object)this._recoveryAzureNetworkId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryAzureNetworkId.ToString()) : null, "recoveryAzureNetworkId" ,container.Add ); + AddIf( null != (((object)this._recoverySubnetName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoverySubnetName.ToString()) : null, "recoverySubnetName" ,container.Add ); + AddIf( null != (((object)this._recoveryVirtualMachineScaleSetId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryVirtualMachineScaleSetId.ToString()) : null, "recoveryVirtualMachineScaleSetId" ,container.Add ); + AddIf( null != (((object)this._recoveryCapacityReservationGroupId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryCapacityReservationGroupId.ToString()) : null, "recoveryCapacityReservationGroupId" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AEventDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AEventDetails.PowerShell.cs new file mode 100644 index 000000000000..69700a1564a5 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AEventDetails.PowerShell.cs @@ -0,0 +1,192 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Model class for event details of a A2A event. + [System.ComponentModel.TypeConverter(typeof(A2AEventDetailsTypeConverter))] + public partial class A2AEventDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal A2AEventDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProtectedItemName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEventDetailsInternal)this).ProtectedItemName = (string) content.GetValueForProperty("ProtectedItemName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEventDetailsInternal)this).ProtectedItemName, global::System.Convert.ToString); + } + if (content.Contains("FabricObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEventDetailsInternal)this).FabricObjectId = (string) content.GetValueForProperty("FabricObjectId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEventDetailsInternal)this).FabricObjectId, global::System.Convert.ToString); + } + if (content.Contains("FabricName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEventDetailsInternal)this).FabricName = (string) content.GetValueForProperty("FabricName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEventDetailsInternal)this).FabricName, global::System.Convert.ToString); + } + if (content.Contains("FabricLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEventDetailsInternal)this).FabricLocation = (string) content.GetValueForProperty("FabricLocation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEventDetailsInternal)this).FabricLocation, global::System.Convert.ToString); + } + if (content.Contains("RemoteFabricName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEventDetailsInternal)this).RemoteFabricName = (string) content.GetValueForProperty("RemoteFabricName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEventDetailsInternal)this).RemoteFabricName, global::System.Convert.ToString); + } + if (content.Contains("RemoteFabricLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEventDetailsInternal)this).RemoteFabricLocation = (string) content.GetValueForProperty("RemoteFabricLocation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEventDetailsInternal)this).RemoteFabricLocation, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal A2AEventDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProtectedItemName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEventDetailsInternal)this).ProtectedItemName = (string) content.GetValueForProperty("ProtectedItemName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEventDetailsInternal)this).ProtectedItemName, global::System.Convert.ToString); + } + if (content.Contains("FabricObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEventDetailsInternal)this).FabricObjectId = (string) content.GetValueForProperty("FabricObjectId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEventDetailsInternal)this).FabricObjectId, global::System.Convert.ToString); + } + if (content.Contains("FabricName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEventDetailsInternal)this).FabricName = (string) content.GetValueForProperty("FabricName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEventDetailsInternal)this).FabricName, global::System.Convert.ToString); + } + if (content.Contains("FabricLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEventDetailsInternal)this).FabricLocation = (string) content.GetValueForProperty("FabricLocation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEventDetailsInternal)this).FabricLocation, global::System.Convert.ToString); + } + if (content.Contains("RemoteFabricName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEventDetailsInternal)this).RemoteFabricName = (string) content.GetValueForProperty("RemoteFabricName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEventDetailsInternal)this).RemoteFabricName, global::System.Convert.ToString); + } + if (content.Contains("RemoteFabricLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEventDetailsInternal)this).RemoteFabricLocation = (string) content.GetValueForProperty("RemoteFabricLocation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEventDetailsInternal)this).RemoteFabricLocation, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEventDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new A2AEventDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEventDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new A2AEventDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEventDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Model class for event details of a A2A event. + [System.ComponentModel.TypeConverter(typeof(A2AEventDetailsTypeConverter))] + public partial interface IA2AEventDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AEventDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AEventDetails.TypeConverter.cs new file mode 100644 index 000000000000..a4ead4689ca4 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AEventDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class A2AEventDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEventDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEventDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return A2AEventDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return A2AEventDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return A2AEventDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AEventDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AEventDetails.cs new file mode 100644 index 000000000000..cda73e69715c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AEventDetails.cs @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Model class for event details of a A2A event. + public partial class A2AEventDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEventDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEventDetailsInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetails __eventProviderSpecificDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EventProviderSpecificDetails(); + + /// Backing field for property. + private string _fabricLocation; + + /// The fabric location. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string FabricLocation { get => this._fabricLocation; set => this._fabricLocation = value; } + + /// Backing field for property. + private string _fabricName; + + /// Fabric arm name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// Backing field for property. + private string _fabricObjectId; + + /// The azure vm arm id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string FabricObjectId { get => this._fabricObjectId; set => this._fabricObjectId = value; } + + /// Gets the class type. Overridden in derived classes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetailsInternal)__eventProviderSpecificDetails).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetailsInternal)__eventProviderSpecificDetails).InstanceType = value ; } + + /// Backing field for property. + private string _protectedItemName; + + /// The protected item arm name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ProtectedItemName { get => this._protectedItemName; set => this._protectedItemName = value; } + + /// Backing field for property. + private string _remoteFabricLocation; + + /// Remote fabric location. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RemoteFabricLocation { get => this._remoteFabricLocation; set => this._remoteFabricLocation = value; } + + /// Backing field for property. + private string _remoteFabricName; + + /// Remote fabric arm name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RemoteFabricName { get => this._remoteFabricName; set => this._remoteFabricName = value; } + + /// Creates an new instance. + public A2AEventDetails() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__eventProviderSpecificDetails), __eventProviderSpecificDetails); + await eventListener.AssertObjectIsValid(nameof(__eventProviderSpecificDetails), __eventProviderSpecificDetails); + } + } + /// Model class for event details of a A2A event. + public partial interface IA2AEventDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetails + { + /// The fabric location. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The fabric location.", + SerializedName = @"fabricLocation", + PossibleTypes = new [] { typeof(string) })] + string FabricLocation { get; set; } + /// Fabric arm name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Fabric arm name.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + string FabricName { get; set; } + /// The azure vm arm id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The azure vm arm id.", + SerializedName = @"fabricObjectId", + PossibleTypes = new [] { typeof(string) })] + string FabricObjectId { get; set; } + /// The protected item arm name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The protected item arm name.", + SerializedName = @"protectedItemName", + PossibleTypes = new [] { typeof(string) })] + string ProtectedItemName { get; set; } + /// Remote fabric location. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Remote fabric location.", + SerializedName = @"remoteFabricLocation", + PossibleTypes = new [] { typeof(string) })] + string RemoteFabricLocation { get; set; } + /// Remote fabric arm name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Remote fabric arm name.", + SerializedName = @"remoteFabricName", + PossibleTypes = new [] { typeof(string) })] + string RemoteFabricName { get; set; } + + } + /// Model class for event details of a A2A event. + internal partial interface IA2AEventDetailsInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetailsInternal + { + /// The fabric location. + string FabricLocation { get; set; } + /// Fabric arm name. + string FabricName { get; set; } + /// The azure vm arm id. + string FabricObjectId { get; set; } + /// The protected item arm name. + string ProtectedItemName { get; set; } + /// Remote fabric location. + string RemoteFabricLocation { get; set; } + /// Remote fabric arm name. + string RemoteFabricName { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AEventDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AEventDetails.json.cs new file mode 100644 index 000000000000..1124bc336a6b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AEventDetails.json.cs @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Model class for event details of a A2A event. + public partial class A2AEventDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal A2AEventDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __eventProviderSpecificDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EventProviderSpecificDetails(json); + {_protectedItemName = If( json?.PropertyT("protectedItemName"), out var __jsonProtectedItemName) ? (string)__jsonProtectedItemName : (string)ProtectedItemName;} + {_fabricObjectId = If( json?.PropertyT("fabricObjectId"), out var __jsonFabricObjectId) ? (string)__jsonFabricObjectId : (string)FabricObjectId;} + {_fabricName = If( json?.PropertyT("fabricName"), out var __jsonFabricName) ? (string)__jsonFabricName : (string)FabricName;} + {_fabricLocation = If( json?.PropertyT("fabricLocation"), out var __jsonFabricLocation) ? (string)__jsonFabricLocation : (string)FabricLocation;} + {_remoteFabricName = If( json?.PropertyT("remoteFabricName"), out var __jsonRemoteFabricName) ? (string)__jsonRemoteFabricName : (string)RemoteFabricName;} + {_remoteFabricLocation = If( json?.PropertyT("remoteFabricLocation"), out var __jsonRemoteFabricLocation) ? (string)__jsonRemoteFabricLocation : (string)RemoteFabricLocation;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEventDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEventDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AEventDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new A2AEventDetails(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __eventProviderSpecificDetails?.ToJson(container, serializationMode); + AddIf( null != (((object)this._protectedItemName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._protectedItemName.ToString()) : null, "protectedItemName" ,container.Add ); + AddIf( null != (((object)this._fabricObjectId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._fabricObjectId.ToString()) : null, "fabricObjectId" ,container.Add ); + AddIf( null != (((object)this._fabricName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._fabricName.ToString()) : null, "fabricName" ,container.Add ); + AddIf( null != (((object)this._fabricLocation)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._fabricLocation.ToString()) : null, "fabricLocation" ,container.Add ); + AddIf( null != (((object)this._remoteFabricName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._remoteFabricName.ToString()) : null, "remoteFabricName" ,container.Add ); + AddIf( null != (((object)this._remoteFabricLocation)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._remoteFabricLocation.ToString()) : null, "remoteFabricLocation" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AExtendedLocationDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AExtendedLocationDetails.PowerShell.cs new file mode 100644 index 000000000000..05b75e09362a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AExtendedLocationDetails.PowerShell.cs @@ -0,0 +1,186 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// ExtendedLocation details data. + [System.ComponentModel.TypeConverter(typeof(A2AExtendedLocationDetailsTypeConverter))] + public partial class A2AExtendedLocationDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal A2AExtendedLocationDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("PrimaryExtendedLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AExtendedLocationDetailsInternal)this).PrimaryExtendedLocation = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocation) content.GetValueForProperty("PrimaryExtendedLocation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AExtendedLocationDetailsInternal)this).PrimaryExtendedLocation, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ExtendedLocationTypeConverter.ConvertFrom); + } + if (content.Contains("RecoveryExtendedLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AExtendedLocationDetailsInternal)this).RecoveryExtendedLocation = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocation) content.GetValueForProperty("RecoveryExtendedLocation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AExtendedLocationDetailsInternal)this).RecoveryExtendedLocation, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ExtendedLocationTypeConverter.ConvertFrom); + } + if (content.Contains("PrimaryExtendedLocationName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AExtendedLocationDetailsInternal)this).PrimaryExtendedLocationName = (string) content.GetValueForProperty("PrimaryExtendedLocationName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AExtendedLocationDetailsInternal)this).PrimaryExtendedLocationName, global::System.Convert.ToString); + } + if (content.Contains("PrimaryExtendedLocationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AExtendedLocationDetailsInternal)this).PrimaryExtendedLocationType = (string) content.GetValueForProperty("PrimaryExtendedLocationType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AExtendedLocationDetailsInternal)this).PrimaryExtendedLocationType, global::System.Convert.ToString); + } + if (content.Contains("RecoveryExtendedLocationName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AExtendedLocationDetailsInternal)this).RecoveryExtendedLocationName = (string) content.GetValueForProperty("RecoveryExtendedLocationName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AExtendedLocationDetailsInternal)this).RecoveryExtendedLocationName, global::System.Convert.ToString); + } + if (content.Contains("RecoveryExtendedLocationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AExtendedLocationDetailsInternal)this).RecoveryExtendedLocationType = (string) content.GetValueForProperty("RecoveryExtendedLocationType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AExtendedLocationDetailsInternal)this).RecoveryExtendedLocationType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal A2AExtendedLocationDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("PrimaryExtendedLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AExtendedLocationDetailsInternal)this).PrimaryExtendedLocation = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocation) content.GetValueForProperty("PrimaryExtendedLocation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AExtendedLocationDetailsInternal)this).PrimaryExtendedLocation, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ExtendedLocationTypeConverter.ConvertFrom); + } + if (content.Contains("RecoveryExtendedLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AExtendedLocationDetailsInternal)this).RecoveryExtendedLocation = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocation) content.GetValueForProperty("RecoveryExtendedLocation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AExtendedLocationDetailsInternal)this).RecoveryExtendedLocation, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ExtendedLocationTypeConverter.ConvertFrom); + } + if (content.Contains("PrimaryExtendedLocationName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AExtendedLocationDetailsInternal)this).PrimaryExtendedLocationName = (string) content.GetValueForProperty("PrimaryExtendedLocationName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AExtendedLocationDetailsInternal)this).PrimaryExtendedLocationName, global::System.Convert.ToString); + } + if (content.Contains("PrimaryExtendedLocationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AExtendedLocationDetailsInternal)this).PrimaryExtendedLocationType = (string) content.GetValueForProperty("PrimaryExtendedLocationType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AExtendedLocationDetailsInternal)this).PrimaryExtendedLocationType, global::System.Convert.ToString); + } + if (content.Contains("RecoveryExtendedLocationName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AExtendedLocationDetailsInternal)this).RecoveryExtendedLocationName = (string) content.GetValueForProperty("RecoveryExtendedLocationName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AExtendedLocationDetailsInternal)this).RecoveryExtendedLocationName, global::System.Convert.ToString); + } + if (content.Contains("RecoveryExtendedLocationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AExtendedLocationDetailsInternal)this).RecoveryExtendedLocationType = (string) content.GetValueForProperty("RecoveryExtendedLocationType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AExtendedLocationDetailsInternal)this).RecoveryExtendedLocationType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AExtendedLocationDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new A2AExtendedLocationDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AExtendedLocationDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new A2AExtendedLocationDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AExtendedLocationDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// ExtendedLocation details data. + [System.ComponentModel.TypeConverter(typeof(A2AExtendedLocationDetailsTypeConverter))] + public partial interface IA2AExtendedLocationDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AExtendedLocationDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AExtendedLocationDetails.TypeConverter.cs new file mode 100644 index 000000000000..efbd600f2f9b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AExtendedLocationDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class A2AExtendedLocationDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AExtendedLocationDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AExtendedLocationDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return A2AExtendedLocationDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return A2AExtendedLocationDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return A2AExtendedLocationDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AExtendedLocationDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AExtendedLocationDetails.cs new file mode 100644 index 000000000000..13cc19bd29f2 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AExtendedLocationDetails.cs @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// ExtendedLocation details data. + public partial class A2AExtendedLocationDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AExtendedLocationDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AExtendedLocationDetailsInternal + { + + /// Internal Acessors for PrimaryExtendedLocation + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocation Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AExtendedLocationDetailsInternal.PrimaryExtendedLocation { get => (this._primaryExtendedLocation = this._primaryExtendedLocation ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ExtendedLocation()); set { {_primaryExtendedLocation = value;} } } + + /// Internal Acessors for PrimaryExtendedLocationType + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AExtendedLocationDetailsInternal.PrimaryExtendedLocationType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocationInternal)PrimaryExtendedLocation).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocationInternal)PrimaryExtendedLocation).Type = value; } + + /// Internal Acessors for RecoveryExtendedLocation + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocation Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AExtendedLocationDetailsInternal.RecoveryExtendedLocation { get => (this._recoveryExtendedLocation = this._recoveryExtendedLocation ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ExtendedLocation()); set { {_recoveryExtendedLocation = value;} } } + + /// Internal Acessors for RecoveryExtendedLocationType + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AExtendedLocationDetailsInternal.RecoveryExtendedLocationType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocationInternal)RecoveryExtendedLocation).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocationInternal)RecoveryExtendedLocation).Type = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocation _primaryExtendedLocation; + + /// The primary ExtendedLocation. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocation PrimaryExtendedLocation { get => (this._primaryExtendedLocation = this._primaryExtendedLocation ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ExtendedLocation()); set => this._primaryExtendedLocation = value; } + + /// The name of the extended location. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string PrimaryExtendedLocationName { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocationInternal)PrimaryExtendedLocation).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocationInternal)PrimaryExtendedLocation).Name = value ?? null; } + + /// The extended location type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string PrimaryExtendedLocationType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocationInternal)PrimaryExtendedLocation).Type; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocation _recoveryExtendedLocation; + + /// The recovery ExtendedLocation. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocation RecoveryExtendedLocation { get => (this._recoveryExtendedLocation = this._recoveryExtendedLocation ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ExtendedLocation()); set => this._recoveryExtendedLocation = value; } + + /// The name of the extended location. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string RecoveryExtendedLocationName { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocationInternal)RecoveryExtendedLocation).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocationInternal)RecoveryExtendedLocation).Name = value ?? null; } + + /// The extended location type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string RecoveryExtendedLocationType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocationInternal)RecoveryExtendedLocation).Type; } + + /// Creates an new instance. + public A2AExtendedLocationDetails() + { + + } + } + /// ExtendedLocation details data. + public partial interface IA2AExtendedLocationDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The name of the extended location. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the extended location.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string PrimaryExtendedLocationName { get; set; } + /// The extended location type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The extended location type.", + SerializedName = @"type", + PossibleTypes = new [] { typeof(string) })] + string PrimaryExtendedLocationType { get; } + /// The name of the extended location. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the extended location.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string RecoveryExtendedLocationName { get; set; } + /// The extended location type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The extended location type.", + SerializedName = @"type", + PossibleTypes = new [] { typeof(string) })] + string RecoveryExtendedLocationType { get; } + + } + /// ExtendedLocation details data. + internal partial interface IA2AExtendedLocationDetailsInternal + + { + /// The primary ExtendedLocation. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocation PrimaryExtendedLocation { get; set; } + /// The name of the extended location. + string PrimaryExtendedLocationName { get; set; } + /// The extended location type. + string PrimaryExtendedLocationType { get; set; } + /// The recovery ExtendedLocation. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocation RecoveryExtendedLocation { get; set; } + /// The name of the extended location. + string RecoveryExtendedLocationName { get; set; } + /// The extended location type. + string RecoveryExtendedLocationType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AExtendedLocationDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AExtendedLocationDetails.json.cs new file mode 100644 index 000000000000..9a046440d36d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AExtendedLocationDetails.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// ExtendedLocation details data. + public partial class A2AExtendedLocationDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal A2AExtendedLocationDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_primaryExtendedLocation = If( json?.PropertyT("primaryExtendedLocation"), out var __jsonPrimaryExtendedLocation) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ExtendedLocation.FromJson(__jsonPrimaryExtendedLocation) : PrimaryExtendedLocation;} + {_recoveryExtendedLocation = If( json?.PropertyT("recoveryExtendedLocation"), out var __jsonRecoveryExtendedLocation) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ExtendedLocation.FromJson(__jsonRecoveryExtendedLocation) : RecoveryExtendedLocation;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AExtendedLocationDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AExtendedLocationDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AExtendedLocationDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new A2AExtendedLocationDetails(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._primaryExtendedLocation ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._primaryExtendedLocation.ToJson(null,serializationMode) : null, "primaryExtendedLocation" ,container.Add ); + AddIf( null != this._recoveryExtendedLocation ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._recoveryExtendedLocation.ToJson(null,serializationMode) : null, "recoveryExtendedLocation" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2APolicyCreationInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2APolicyCreationInput.PowerShell.cs new file mode 100644 index 000000000000..973761e59e9b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2APolicyCreationInput.PowerShell.cs @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// A2A Policy creation input. + [System.ComponentModel.TypeConverter(typeof(A2APolicyCreationInputTypeConverter))] + public partial class A2APolicyCreationInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal A2APolicyCreationInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("RecoveryPointHistory")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2APolicyCreationInputInternal)this).RecoveryPointHistory = (int?) content.GetValueForProperty("RecoveryPointHistory",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2APolicyCreationInputInternal)this).RecoveryPointHistory, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("CrashConsistentFrequencyInMinute")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2APolicyCreationInputInternal)this).CrashConsistentFrequencyInMinute = (int?) content.GetValueForProperty("CrashConsistentFrequencyInMinute",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2APolicyCreationInputInternal)this).CrashConsistentFrequencyInMinute, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("AppConsistentFrequencyInMinute")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2APolicyCreationInputInternal)this).AppConsistentFrequencyInMinute = (int?) content.GetValueForProperty("AppConsistentFrequencyInMinute",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2APolicyCreationInputInternal)this).AppConsistentFrequencyInMinute, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("MultiVMSyncStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2APolicyCreationInputInternal)this).MultiVMSyncStatus = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SetMultiVMSyncStatus) content.GetValueForProperty("MultiVMSyncStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2APolicyCreationInputInternal)this).MultiVMSyncStatus, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SetMultiVMSyncStatus.CreateFrom); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal A2APolicyCreationInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("RecoveryPointHistory")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2APolicyCreationInputInternal)this).RecoveryPointHistory = (int?) content.GetValueForProperty("RecoveryPointHistory",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2APolicyCreationInputInternal)this).RecoveryPointHistory, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("CrashConsistentFrequencyInMinute")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2APolicyCreationInputInternal)this).CrashConsistentFrequencyInMinute = (int?) content.GetValueForProperty("CrashConsistentFrequencyInMinute",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2APolicyCreationInputInternal)this).CrashConsistentFrequencyInMinute, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("AppConsistentFrequencyInMinute")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2APolicyCreationInputInternal)this).AppConsistentFrequencyInMinute = (int?) content.GetValueForProperty("AppConsistentFrequencyInMinute",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2APolicyCreationInputInternal)this).AppConsistentFrequencyInMinute, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("MultiVMSyncStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2APolicyCreationInputInternal)this).MultiVMSyncStatus = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SetMultiVMSyncStatus) content.GetValueForProperty("MultiVMSyncStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2APolicyCreationInputInternal)this).MultiVMSyncStatus, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SetMultiVMSyncStatus.CreateFrom); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2APolicyCreationInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new A2APolicyCreationInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2APolicyCreationInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new A2APolicyCreationInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2APolicyCreationInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// A2A Policy creation input. + [System.ComponentModel.TypeConverter(typeof(A2APolicyCreationInputTypeConverter))] + public partial interface IA2APolicyCreationInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2APolicyCreationInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2APolicyCreationInput.TypeConverter.cs new file mode 100644 index 000000000000..f8f413195ca5 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2APolicyCreationInput.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class A2APolicyCreationInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2APolicyCreationInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2APolicyCreationInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return A2APolicyCreationInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return A2APolicyCreationInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return A2APolicyCreationInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2APolicyCreationInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2APolicyCreationInput.cs new file mode 100644 index 000000000000..6162fd09556f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2APolicyCreationInput.cs @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// A2A Policy creation input. + public partial class A2APolicyCreationInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2APolicyCreationInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2APolicyCreationInputInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInput __policyProviderSpecificInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PolicyProviderSpecificInput(); + + /// Backing field for property. + private int? _appConsistentFrequencyInMinute; + + /// The app consistent snapshot frequency (in minutes). + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? AppConsistentFrequencyInMinute { get => this._appConsistentFrequencyInMinute; set => this._appConsistentFrequencyInMinute = value; } + + /// Backing field for property. + private int? _crashConsistentFrequencyInMinute; + + /// The crash consistent snapshot frequency (in minutes). + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? CrashConsistentFrequencyInMinute { get => this._crashConsistentFrequencyInMinute; set => this._crashConsistentFrequencyInMinute = value; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInputInternal)__policyProviderSpecificInput).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInputInternal)__policyProviderSpecificInput).InstanceType = value ; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SetMultiVMSyncStatus _multiVMSyncStatus; + + /// + /// A value indicating whether multi-VM sync has to be enabled. Value should be 'Enabled' or 'Disabled'. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SetMultiVMSyncStatus MultiVMSyncStatus { get => this._multiVMSyncStatus; set => this._multiVMSyncStatus = value; } + + /// Backing field for property. + private int? _recoveryPointHistory; + + /// The duration in minutes until which the recovery points need to be stored. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? RecoveryPointHistory { get => this._recoveryPointHistory; set => this._recoveryPointHistory = value; } + + /// Creates an new instance. + public A2APolicyCreationInput() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__policyProviderSpecificInput), __policyProviderSpecificInput); + await eventListener.AssertObjectIsValid(nameof(__policyProviderSpecificInput), __policyProviderSpecificInput); + } + } + /// A2A Policy creation input. + public partial interface IA2APolicyCreationInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInput + { + /// The app consistent snapshot frequency (in minutes). + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The app consistent snapshot frequency (in minutes).", + SerializedName = @"appConsistentFrequencyInMinutes", + PossibleTypes = new [] { typeof(int) })] + int? AppConsistentFrequencyInMinute { get; set; } + /// The crash consistent snapshot frequency (in minutes). + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The crash consistent snapshot frequency (in minutes).", + SerializedName = @"crashConsistentFrequencyInMinutes", + PossibleTypes = new [] { typeof(int) })] + int? CrashConsistentFrequencyInMinute { get; set; } + /// + /// A value indicating whether multi-VM sync has to be enabled. Value should be 'Enabled' or 'Disabled'. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"A value indicating whether multi-VM sync has to be enabled. Value should be 'Enabled' or 'Disabled'.", + SerializedName = @"multiVmSyncStatus", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SetMultiVMSyncStatus) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SetMultiVMSyncStatus MultiVMSyncStatus { get; set; } + /// The duration in minutes until which the recovery points need to be stored. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The duration in minutes until which the recovery points need to be stored.", + SerializedName = @"recoveryPointHistory", + PossibleTypes = new [] { typeof(int) })] + int? RecoveryPointHistory { get; set; } + + } + /// A2A Policy creation input. + internal partial interface IA2APolicyCreationInputInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInputInternal + { + /// The app consistent snapshot frequency (in minutes). + int? AppConsistentFrequencyInMinute { get; set; } + /// The crash consistent snapshot frequency (in minutes). + int? CrashConsistentFrequencyInMinute { get; set; } + /// + /// A value indicating whether multi-VM sync has to be enabled. Value should be 'Enabled' or 'Disabled'. + /// + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SetMultiVMSyncStatus MultiVMSyncStatus { get; set; } + /// The duration in minutes until which the recovery points need to be stored. + int? RecoveryPointHistory { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2APolicyCreationInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2APolicyCreationInput.json.cs new file mode 100644 index 000000000000..3583071d6d20 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2APolicyCreationInput.json.cs @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// A2A Policy creation input. + public partial class A2APolicyCreationInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal A2APolicyCreationInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __policyProviderSpecificInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PolicyProviderSpecificInput(json); + {_recoveryPointHistory = If( json?.PropertyT("recoveryPointHistory"), out var __jsonRecoveryPointHistory) ? (int?)__jsonRecoveryPointHistory : RecoveryPointHistory;} + {_crashConsistentFrequencyInMinute = If( json?.PropertyT("crashConsistentFrequencyInMinutes"), out var __jsonCrashConsistentFrequencyInMinutes) ? (int?)__jsonCrashConsistentFrequencyInMinutes : CrashConsistentFrequencyInMinute;} + {_appConsistentFrequencyInMinute = If( json?.PropertyT("appConsistentFrequencyInMinutes"), out var __jsonAppConsistentFrequencyInMinutes) ? (int?)__jsonAppConsistentFrequencyInMinutes : AppConsistentFrequencyInMinute;} + {_multiVMSyncStatus = If( json?.PropertyT("multiVmSyncStatus"), out var __jsonMultiVMSyncStatus) ? (string)__jsonMultiVMSyncStatus : (string)MultiVMSyncStatus;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2APolicyCreationInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2APolicyCreationInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2APolicyCreationInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new A2APolicyCreationInput(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __policyProviderSpecificInput?.ToJson(container, serializationMode); + AddIf( null != this._recoveryPointHistory ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._recoveryPointHistory) : null, "recoveryPointHistory" ,container.Add ); + AddIf( null != this._crashConsistentFrequencyInMinute ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._crashConsistentFrequencyInMinute) : null, "crashConsistentFrequencyInMinutes" ,container.Add ); + AddIf( null != this._appConsistentFrequencyInMinute ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._appConsistentFrequencyInMinute) : null, "appConsistentFrequencyInMinutes" ,container.Add ); + AddIf( null != (((object)this._multiVMSyncStatus)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._multiVMSyncStatus.ToString()) : null, "multiVmSyncStatus" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2APolicyDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2APolicyDetails.PowerShell.cs new file mode 100644 index 000000000000..e9a76c277e70 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2APolicyDetails.PowerShell.cs @@ -0,0 +1,184 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// A2A specific policy details. + [System.ComponentModel.TypeConverter(typeof(A2APolicyDetailsTypeConverter))] + public partial class A2APolicyDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal A2APolicyDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("RecoveryPointThresholdInMinute")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2APolicyDetailsInternal)this).RecoveryPointThresholdInMinute = (int?) content.GetValueForProperty("RecoveryPointThresholdInMinute",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2APolicyDetailsInternal)this).RecoveryPointThresholdInMinute, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("RecoveryPointHistory")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2APolicyDetailsInternal)this).RecoveryPointHistory = (int?) content.GetValueForProperty("RecoveryPointHistory",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2APolicyDetailsInternal)this).RecoveryPointHistory, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("AppConsistentFrequencyInMinute")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2APolicyDetailsInternal)this).AppConsistentFrequencyInMinute = (int?) content.GetValueForProperty("AppConsistentFrequencyInMinute",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2APolicyDetailsInternal)this).AppConsistentFrequencyInMinute, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("MultiVMSyncStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2APolicyDetailsInternal)this).MultiVMSyncStatus = (string) content.GetValueForProperty("MultiVMSyncStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2APolicyDetailsInternal)this).MultiVMSyncStatus, global::System.Convert.ToString); + } + if (content.Contains("CrashConsistentFrequencyInMinute")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2APolicyDetailsInternal)this).CrashConsistentFrequencyInMinute = (int?) content.GetValueForProperty("CrashConsistentFrequencyInMinute",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2APolicyDetailsInternal)this).CrashConsistentFrequencyInMinute, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal A2APolicyDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("RecoveryPointThresholdInMinute")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2APolicyDetailsInternal)this).RecoveryPointThresholdInMinute = (int?) content.GetValueForProperty("RecoveryPointThresholdInMinute",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2APolicyDetailsInternal)this).RecoveryPointThresholdInMinute, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("RecoveryPointHistory")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2APolicyDetailsInternal)this).RecoveryPointHistory = (int?) content.GetValueForProperty("RecoveryPointHistory",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2APolicyDetailsInternal)this).RecoveryPointHistory, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("AppConsistentFrequencyInMinute")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2APolicyDetailsInternal)this).AppConsistentFrequencyInMinute = (int?) content.GetValueForProperty("AppConsistentFrequencyInMinute",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2APolicyDetailsInternal)this).AppConsistentFrequencyInMinute, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("MultiVMSyncStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2APolicyDetailsInternal)this).MultiVMSyncStatus = (string) content.GetValueForProperty("MultiVMSyncStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2APolicyDetailsInternal)this).MultiVMSyncStatus, global::System.Convert.ToString); + } + if (content.Contains("CrashConsistentFrequencyInMinute")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2APolicyDetailsInternal)this).CrashConsistentFrequencyInMinute = (int?) content.GetValueForProperty("CrashConsistentFrequencyInMinute",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2APolicyDetailsInternal)this).CrashConsistentFrequencyInMinute, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2APolicyDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new A2APolicyDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2APolicyDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new A2APolicyDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2APolicyDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// A2A specific policy details. + [System.ComponentModel.TypeConverter(typeof(A2APolicyDetailsTypeConverter))] + public partial interface IA2APolicyDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2APolicyDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2APolicyDetails.TypeConverter.cs new file mode 100644 index 000000000000..02a4c3006b41 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2APolicyDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class A2APolicyDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2APolicyDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2APolicyDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return A2APolicyDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return A2APolicyDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return A2APolicyDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2APolicyDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2APolicyDetails.cs new file mode 100644 index 000000000000..923422a7815e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2APolicyDetails.cs @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// A2A specific policy details. + public partial class A2APolicyDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2APolicyDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2APolicyDetailsInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetails __policyProviderSpecificDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PolicyProviderSpecificDetails(); + + /// Backing field for property. + private int? _appConsistentFrequencyInMinute; + + /// The app consistent snapshot frequency in minutes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? AppConsistentFrequencyInMinute { get => this._appConsistentFrequencyInMinute; set => this._appConsistentFrequencyInMinute = value; } + + /// Backing field for property. + private int? _crashConsistentFrequencyInMinute; + + /// The crash consistent snapshot frequency in minutes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? CrashConsistentFrequencyInMinute { get => this._crashConsistentFrequencyInMinute; set => this._crashConsistentFrequencyInMinute = value; } + + /// Gets the class type. Overridden in derived classes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetailsInternal)__policyProviderSpecificDetails).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetailsInternal)__policyProviderSpecificDetails).InstanceType = value ; } + + /// Backing field for property. + private string _multiVMSyncStatus; + + /// A value indicating whether multi-VM sync has to be enabled. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string MultiVMSyncStatus { get => this._multiVMSyncStatus; set => this._multiVMSyncStatus = value; } + + /// Backing field for property. + private int? _recoveryPointHistory; + + /// The duration in minutes until which the recovery points need to be stored. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? RecoveryPointHistory { get => this._recoveryPointHistory; set => this._recoveryPointHistory = value; } + + /// Backing field for property. + private int? _recoveryPointThresholdInMinute; + + /// The recovery point threshold in minutes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? RecoveryPointThresholdInMinute { get => this._recoveryPointThresholdInMinute; set => this._recoveryPointThresholdInMinute = value; } + + /// Creates an new instance. + public A2APolicyDetails() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__policyProviderSpecificDetails), __policyProviderSpecificDetails); + await eventListener.AssertObjectIsValid(nameof(__policyProviderSpecificDetails), __policyProviderSpecificDetails); + } + } + /// A2A specific policy details. + public partial interface IA2APolicyDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetails + { + /// The app consistent snapshot frequency in minutes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The app consistent snapshot frequency in minutes.", + SerializedName = @"appConsistentFrequencyInMinutes", + PossibleTypes = new [] { typeof(int) })] + int? AppConsistentFrequencyInMinute { get; set; } + /// The crash consistent snapshot frequency in minutes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The crash consistent snapshot frequency in minutes.", + SerializedName = @"crashConsistentFrequencyInMinutes", + PossibleTypes = new [] { typeof(int) })] + int? CrashConsistentFrequencyInMinute { get; set; } + /// A value indicating whether multi-VM sync has to be enabled. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether multi-VM sync has to be enabled.", + SerializedName = @"multiVmSyncStatus", + PossibleTypes = new [] { typeof(string) })] + string MultiVMSyncStatus { get; set; } + /// The duration in minutes until which the recovery points need to be stored. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The duration in minutes until which the recovery points need to be stored.", + SerializedName = @"recoveryPointHistory", + PossibleTypes = new [] { typeof(int) })] + int? RecoveryPointHistory { get; set; } + /// The recovery point threshold in minutes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery point threshold in minutes.", + SerializedName = @"recoveryPointThresholdInMinutes", + PossibleTypes = new [] { typeof(int) })] + int? RecoveryPointThresholdInMinute { get; set; } + + } + /// A2A specific policy details. + internal partial interface IA2APolicyDetailsInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetailsInternal + { + /// The app consistent snapshot frequency in minutes. + int? AppConsistentFrequencyInMinute { get; set; } + /// The crash consistent snapshot frequency in minutes. + int? CrashConsistentFrequencyInMinute { get; set; } + /// A value indicating whether multi-VM sync has to be enabled. + string MultiVMSyncStatus { get; set; } + /// The duration in minutes until which the recovery points need to be stored. + int? RecoveryPointHistory { get; set; } + /// The recovery point threshold in minutes. + int? RecoveryPointThresholdInMinute { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2APolicyDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2APolicyDetails.json.cs new file mode 100644 index 000000000000..266bd1ddc14c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2APolicyDetails.json.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// A2A specific policy details. + public partial class A2APolicyDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal A2APolicyDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __policyProviderSpecificDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PolicyProviderSpecificDetails(json); + {_recoveryPointThresholdInMinute = If( json?.PropertyT("recoveryPointThresholdInMinutes"), out var __jsonRecoveryPointThresholdInMinutes) ? (int?)__jsonRecoveryPointThresholdInMinutes : RecoveryPointThresholdInMinute;} + {_recoveryPointHistory = If( json?.PropertyT("recoveryPointHistory"), out var __jsonRecoveryPointHistory) ? (int?)__jsonRecoveryPointHistory : RecoveryPointHistory;} + {_appConsistentFrequencyInMinute = If( json?.PropertyT("appConsistentFrequencyInMinutes"), out var __jsonAppConsistentFrequencyInMinutes) ? (int?)__jsonAppConsistentFrequencyInMinutes : AppConsistentFrequencyInMinute;} + {_multiVMSyncStatus = If( json?.PropertyT("multiVmSyncStatus"), out var __jsonMultiVMSyncStatus) ? (string)__jsonMultiVMSyncStatus : (string)MultiVMSyncStatus;} + {_crashConsistentFrequencyInMinute = If( json?.PropertyT("crashConsistentFrequencyInMinutes"), out var __jsonCrashConsistentFrequencyInMinutes) ? (int?)__jsonCrashConsistentFrequencyInMinutes : CrashConsistentFrequencyInMinute;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2APolicyDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2APolicyDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2APolicyDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new A2APolicyDetails(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __policyProviderSpecificDetails?.ToJson(container, serializationMode); + AddIf( null != this._recoveryPointThresholdInMinute ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._recoveryPointThresholdInMinute) : null, "recoveryPointThresholdInMinutes" ,container.Add ); + AddIf( null != this._recoveryPointHistory ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._recoveryPointHistory) : null, "recoveryPointHistory" ,container.Add ); + AddIf( null != this._appConsistentFrequencyInMinute ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._appConsistentFrequencyInMinute) : null, "appConsistentFrequencyInMinutes" ,container.Add ); + AddIf( null != (((object)this._multiVMSyncStatus)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._multiVMSyncStatus.ToString()) : null, "multiVmSyncStatus" ,container.Add ); + AddIf( null != this._crashConsistentFrequencyInMinute ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._crashConsistentFrequencyInMinute) : null, "crashConsistentFrequencyInMinutes" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AProtectedDiskDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AProtectedDiskDetails.PowerShell.cs new file mode 100644 index 000000000000..faa8d2eef33f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AProtectedDiskDetails.PowerShell.cs @@ -0,0 +1,320 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// A2A protected disk details. + [System.ComponentModel.TypeConverter(typeof(A2AProtectedDiskDetailsTypeConverter))] + public partial class A2AProtectedDiskDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal A2AProtectedDiskDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DiskUri")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetailsInternal)this).DiskUri = (string) content.GetValueForProperty("DiskUri",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetailsInternal)this).DiskUri, global::System.Convert.ToString); + } + if (content.Contains("RecoveryAzureStorageAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetailsInternal)this).RecoveryAzureStorageAccountId = (string) content.GetValueForProperty("RecoveryAzureStorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetailsInternal)this).RecoveryAzureStorageAccountId, global::System.Convert.ToString); + } + if (content.Contains("PrimaryDiskAzureStorageAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetailsInternal)this).PrimaryDiskAzureStorageAccountId = (string) content.GetValueForProperty("PrimaryDiskAzureStorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetailsInternal)this).PrimaryDiskAzureStorageAccountId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryDiskUri")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetailsInternal)this).RecoveryDiskUri = (string) content.GetValueForProperty("RecoveryDiskUri",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetailsInternal)this).RecoveryDiskUri, global::System.Convert.ToString); + } + if (content.Contains("DiskName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetailsInternal)this).DiskName = (string) content.GetValueForProperty("DiskName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetailsInternal)this).DiskName, global::System.Convert.ToString); + } + if (content.Contains("DiskCapacityInByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetailsInternal)this).DiskCapacityInByte = (long?) content.GetValueForProperty("DiskCapacityInByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetailsInternal)this).DiskCapacityInByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("PrimaryStagingAzureStorageAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetailsInternal)this).PrimaryStagingAzureStorageAccountId = (string) content.GetValueForProperty("PrimaryStagingAzureStorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetailsInternal)this).PrimaryStagingAzureStorageAccountId, global::System.Convert.ToString); + } + if (content.Contains("DiskType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetailsInternal)this).DiskType = (string) content.GetValueForProperty("DiskType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetailsInternal)this).DiskType, global::System.Convert.ToString); + } + if (content.Contains("ResyncRequired")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetailsInternal)this).ResyncRequired = (bool?) content.GetValueForProperty("ResyncRequired",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetailsInternal)this).ResyncRequired, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("MonitoringPercentageCompletion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetailsInternal)this).MonitoringPercentageCompletion = (int?) content.GetValueForProperty("MonitoringPercentageCompletion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetailsInternal)this).MonitoringPercentageCompletion, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("MonitoringJobType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetailsInternal)this).MonitoringJobType = (string) content.GetValueForProperty("MonitoringJobType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetailsInternal)this).MonitoringJobType, global::System.Convert.ToString); + } + if (content.Contains("DataPendingInStagingStorageAccountInMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetailsInternal)this).DataPendingInStagingStorageAccountInMb = (double?) content.GetValueForProperty("DataPendingInStagingStorageAccountInMb",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetailsInternal)this).DataPendingInStagingStorageAccountInMb, (__y)=> (double) global::System.Convert.ChangeType(__y, typeof(double))); + } + if (content.Contains("DataPendingAtSourceAgentInMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetailsInternal)this).DataPendingAtSourceAgentInMb = (double?) content.GetValueForProperty("DataPendingAtSourceAgentInMb",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetailsInternal)this).DataPendingAtSourceAgentInMb, (__y)=> (double) global::System.Convert.ChangeType(__y, typeof(double))); + } + if (content.Contains("DiskState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetailsInternal)this).DiskState = (string) content.GetValueForProperty("DiskState",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetailsInternal)this).DiskState, global::System.Convert.ToString); + } + if (content.Contains("AllowedDiskLevelOperation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetailsInternal)this).AllowedDiskLevelOperation = (string[]) content.GetValueForProperty("AllowedDiskLevelOperation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetailsInternal)this).AllowedDiskLevelOperation, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("IsDiskEncrypted")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetailsInternal)this).IsDiskEncrypted = (bool?) content.GetValueForProperty("IsDiskEncrypted",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetailsInternal)this).IsDiskEncrypted, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("SecretIdentifier")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetailsInternal)this).SecretIdentifier = (string) content.GetValueForProperty("SecretIdentifier",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetailsInternal)this).SecretIdentifier, global::System.Convert.ToString); + } + if (content.Contains("DekKeyVaultArmId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetailsInternal)this).DekKeyVaultArmId = (string) content.GetValueForProperty("DekKeyVaultArmId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetailsInternal)this).DekKeyVaultArmId, global::System.Convert.ToString); + } + if (content.Contains("IsDiskKeyEncrypted")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetailsInternal)this).IsDiskKeyEncrypted = (bool?) content.GetValueForProperty("IsDiskKeyEncrypted",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetailsInternal)this).IsDiskKeyEncrypted, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("KeyIdentifier")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetailsInternal)this).KeyIdentifier = (string) content.GetValueForProperty("KeyIdentifier",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetailsInternal)this).KeyIdentifier, global::System.Convert.ToString); + } + if (content.Contains("KekKeyVaultArmId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetailsInternal)this).KekKeyVaultArmId = (string) content.GetValueForProperty("KekKeyVaultArmId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetailsInternal)this).KekKeyVaultArmId, global::System.Convert.ToString); + } + if (content.Contains("FailoverDiskName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetailsInternal)this).FailoverDiskName = (string) content.GetValueForProperty("FailoverDiskName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetailsInternal)this).FailoverDiskName, global::System.Convert.ToString); + } + if (content.Contains("TfoDiskName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetailsInternal)this).TfoDiskName = (string) content.GetValueForProperty("TfoDiskName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetailsInternal)this).TfoDiskName, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal A2AProtectedDiskDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DiskUri")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetailsInternal)this).DiskUri = (string) content.GetValueForProperty("DiskUri",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetailsInternal)this).DiskUri, global::System.Convert.ToString); + } + if (content.Contains("RecoveryAzureStorageAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetailsInternal)this).RecoveryAzureStorageAccountId = (string) content.GetValueForProperty("RecoveryAzureStorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetailsInternal)this).RecoveryAzureStorageAccountId, global::System.Convert.ToString); + } + if (content.Contains("PrimaryDiskAzureStorageAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetailsInternal)this).PrimaryDiskAzureStorageAccountId = (string) content.GetValueForProperty("PrimaryDiskAzureStorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetailsInternal)this).PrimaryDiskAzureStorageAccountId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryDiskUri")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetailsInternal)this).RecoveryDiskUri = (string) content.GetValueForProperty("RecoveryDiskUri",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetailsInternal)this).RecoveryDiskUri, global::System.Convert.ToString); + } + if (content.Contains("DiskName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetailsInternal)this).DiskName = (string) content.GetValueForProperty("DiskName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetailsInternal)this).DiskName, global::System.Convert.ToString); + } + if (content.Contains("DiskCapacityInByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetailsInternal)this).DiskCapacityInByte = (long?) content.GetValueForProperty("DiskCapacityInByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetailsInternal)this).DiskCapacityInByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("PrimaryStagingAzureStorageAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetailsInternal)this).PrimaryStagingAzureStorageAccountId = (string) content.GetValueForProperty("PrimaryStagingAzureStorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetailsInternal)this).PrimaryStagingAzureStorageAccountId, global::System.Convert.ToString); + } + if (content.Contains("DiskType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetailsInternal)this).DiskType = (string) content.GetValueForProperty("DiskType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetailsInternal)this).DiskType, global::System.Convert.ToString); + } + if (content.Contains("ResyncRequired")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetailsInternal)this).ResyncRequired = (bool?) content.GetValueForProperty("ResyncRequired",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetailsInternal)this).ResyncRequired, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("MonitoringPercentageCompletion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetailsInternal)this).MonitoringPercentageCompletion = (int?) content.GetValueForProperty("MonitoringPercentageCompletion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetailsInternal)this).MonitoringPercentageCompletion, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("MonitoringJobType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetailsInternal)this).MonitoringJobType = (string) content.GetValueForProperty("MonitoringJobType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetailsInternal)this).MonitoringJobType, global::System.Convert.ToString); + } + if (content.Contains("DataPendingInStagingStorageAccountInMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetailsInternal)this).DataPendingInStagingStorageAccountInMb = (double?) content.GetValueForProperty("DataPendingInStagingStorageAccountInMb",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetailsInternal)this).DataPendingInStagingStorageAccountInMb, (__y)=> (double) global::System.Convert.ChangeType(__y, typeof(double))); + } + if (content.Contains("DataPendingAtSourceAgentInMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetailsInternal)this).DataPendingAtSourceAgentInMb = (double?) content.GetValueForProperty("DataPendingAtSourceAgentInMb",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetailsInternal)this).DataPendingAtSourceAgentInMb, (__y)=> (double) global::System.Convert.ChangeType(__y, typeof(double))); + } + if (content.Contains("DiskState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetailsInternal)this).DiskState = (string) content.GetValueForProperty("DiskState",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetailsInternal)this).DiskState, global::System.Convert.ToString); + } + if (content.Contains("AllowedDiskLevelOperation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetailsInternal)this).AllowedDiskLevelOperation = (string[]) content.GetValueForProperty("AllowedDiskLevelOperation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetailsInternal)this).AllowedDiskLevelOperation, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("IsDiskEncrypted")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetailsInternal)this).IsDiskEncrypted = (bool?) content.GetValueForProperty("IsDiskEncrypted",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetailsInternal)this).IsDiskEncrypted, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("SecretIdentifier")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetailsInternal)this).SecretIdentifier = (string) content.GetValueForProperty("SecretIdentifier",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetailsInternal)this).SecretIdentifier, global::System.Convert.ToString); + } + if (content.Contains("DekKeyVaultArmId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetailsInternal)this).DekKeyVaultArmId = (string) content.GetValueForProperty("DekKeyVaultArmId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetailsInternal)this).DekKeyVaultArmId, global::System.Convert.ToString); + } + if (content.Contains("IsDiskKeyEncrypted")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetailsInternal)this).IsDiskKeyEncrypted = (bool?) content.GetValueForProperty("IsDiskKeyEncrypted",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetailsInternal)this).IsDiskKeyEncrypted, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("KeyIdentifier")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetailsInternal)this).KeyIdentifier = (string) content.GetValueForProperty("KeyIdentifier",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetailsInternal)this).KeyIdentifier, global::System.Convert.ToString); + } + if (content.Contains("KekKeyVaultArmId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetailsInternal)this).KekKeyVaultArmId = (string) content.GetValueForProperty("KekKeyVaultArmId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetailsInternal)this).KekKeyVaultArmId, global::System.Convert.ToString); + } + if (content.Contains("FailoverDiskName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetailsInternal)this).FailoverDiskName = (string) content.GetValueForProperty("FailoverDiskName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetailsInternal)this).FailoverDiskName, global::System.Convert.ToString); + } + if (content.Contains("TfoDiskName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetailsInternal)this).TfoDiskName = (string) content.GetValueForProperty("TfoDiskName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetailsInternal)this).TfoDiskName, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new A2AProtectedDiskDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new A2AProtectedDiskDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// A2A protected disk details. + [System.ComponentModel.TypeConverter(typeof(A2AProtectedDiskDetailsTypeConverter))] + public partial interface IA2AProtectedDiskDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AProtectedDiskDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AProtectedDiskDetails.TypeConverter.cs new file mode 100644 index 000000000000..e61049e2e7dc --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AProtectedDiskDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class A2AProtectedDiskDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return A2AProtectedDiskDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return A2AProtectedDiskDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return A2AProtectedDiskDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AProtectedDiskDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AProtectedDiskDetails.cs new file mode 100644 index 000000000000..d07c751f855a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AProtectedDiskDetails.cs @@ -0,0 +1,439 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// A2A protected disk details. + public partial class A2AProtectedDiskDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetailsInternal + { + + /// Backing field for property. + private string[] _allowedDiskLevelOperation; + + /// The disk level operations list. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string[] AllowedDiskLevelOperation { get => this._allowedDiskLevelOperation; set => this._allowedDiskLevelOperation = value; } + + /// Backing field for property. + private double? _dataPendingAtSourceAgentInMb; + + /// The data pending at source virtual machine in MB. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public double? DataPendingAtSourceAgentInMb { get => this._dataPendingAtSourceAgentInMb; set => this._dataPendingAtSourceAgentInMb = value; } + + /// + /// Backing field for property. + /// + private double? _dataPendingInStagingStorageAccountInMb; + + /// The data pending for replication in MB at staging account. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public double? DataPendingInStagingStorageAccountInMb { get => this._dataPendingInStagingStorageAccountInMb; set => this._dataPendingInStagingStorageAccountInMb = value; } + + /// Backing field for property. + private string _dekKeyVaultArmId; + + /// The KeyVault resource id for secret (BEK). + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string DekKeyVaultArmId { get => this._dekKeyVaultArmId; set => this._dekKeyVaultArmId = value; } + + /// Backing field for property. + private long? _diskCapacityInByte; + + /// The disk capacity in bytes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public long? DiskCapacityInByte { get => this._diskCapacityInByte; set => this._diskCapacityInByte = value; } + + /// Backing field for property. + private string _diskName; + + /// The disk name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string DiskName { get => this._diskName; set => this._diskName = value; } + + /// Backing field for property. + private string _diskState; + + /// The disk state. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string DiskState { get => this._diskState; set => this._diskState = value; } + + /// Backing field for property. + private string _diskType; + + /// The type of disk. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string DiskType { get => this._diskType; set => this._diskType = value; } + + /// Backing field for property. + private string _diskUri; + + /// The disk uri. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string DiskUri { get => this._diskUri; set => this._diskUri = value; } + + /// Backing field for property. + private string _failoverDiskName; + + /// The failover name for the managed disk. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string FailoverDiskName { get => this._failoverDiskName; set => this._failoverDiskName = value; } + + /// Backing field for property. + private bool? _isDiskEncrypted; + + /// A value indicating whether vm has encrypted os disk or not. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public bool? IsDiskEncrypted { get => this._isDiskEncrypted; set => this._isDiskEncrypted = value; } + + /// Backing field for property. + private bool? _isDiskKeyEncrypted; + + /// A value indicating whether disk key got encrypted or not. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public bool? IsDiskKeyEncrypted { get => this._isDiskKeyEncrypted; set => this._isDiskKeyEncrypted = value; } + + /// Backing field for property. + private string _kekKeyVaultArmId; + + /// The KeyVault resource id for key (KEK). + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string KekKeyVaultArmId { get => this._kekKeyVaultArmId; set => this._kekKeyVaultArmId = value; } + + /// Backing field for property. + private string _keyIdentifier; + + /// The key URL / identifier (KEK). + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string KeyIdentifier { get => this._keyIdentifier; set => this._keyIdentifier = value; } + + /// Backing field for property. + private string _monitoringJobType; + + /// + /// The type of the monitoring job. The progress is contained in MonitoringPercentageCompletion property. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string MonitoringJobType { get => this._monitoringJobType; set => this._monitoringJobType = value; } + + /// Backing field for property. + private int? _monitoringPercentageCompletion; + + /// + /// The percentage of the monitoring job. The type of the monitoring job is defined by MonitoringJobType property. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? MonitoringPercentageCompletion { get => this._monitoringPercentageCompletion; set => this._monitoringPercentageCompletion = value; } + + /// Backing field for property. + private string _primaryDiskAzureStorageAccountId; + + /// The primary disk storage account. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string PrimaryDiskAzureStorageAccountId { get => this._primaryDiskAzureStorageAccountId; set => this._primaryDiskAzureStorageAccountId = value; } + + /// Backing field for property. + private string _primaryStagingAzureStorageAccountId; + + /// The primary staging storage account. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string PrimaryStagingAzureStorageAccountId { get => this._primaryStagingAzureStorageAccountId; set => this._primaryStagingAzureStorageAccountId = value; } + + /// Backing field for property. + private string _recoveryAzureStorageAccountId; + + /// The recovery disk storage account. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryAzureStorageAccountId { get => this._recoveryAzureStorageAccountId; set => this._recoveryAzureStorageAccountId = value; } + + /// Backing field for property. + private string _recoveryDiskUri; + + /// Recovery disk uri. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryDiskUri { get => this._recoveryDiskUri; set => this._recoveryDiskUri = value; } + + /// Backing field for property. + private bool? _resyncRequired; + + /// A value indicating whether resync is required for this disk. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public bool? ResyncRequired { get => this._resyncRequired; set => this._resyncRequired = value; } + + /// Backing field for property. + private string _secretIdentifier; + + /// The secret URL / identifier (BEK). + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string SecretIdentifier { get => this._secretIdentifier; set => this._secretIdentifier = value; } + + /// Backing field for property. + private string _tfoDiskName; + + /// The test failover name for the managed disk. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TfoDiskName { get => this._tfoDiskName; set => this._tfoDiskName = value; } + + /// Creates an new instance. + public A2AProtectedDiskDetails() + { + + } + } + /// A2A protected disk details. + public partial interface IA2AProtectedDiskDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The disk level operations list. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The disk level operations list.", + SerializedName = @"allowedDiskLevelOperation", + PossibleTypes = new [] { typeof(string) })] + string[] AllowedDiskLevelOperation { get; set; } + /// The data pending at source virtual machine in MB. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The data pending at source virtual machine in MB.", + SerializedName = @"dataPendingAtSourceAgentInMB", + PossibleTypes = new [] { typeof(double) })] + double? DataPendingAtSourceAgentInMb { get; set; } + /// The data pending for replication in MB at staging account. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The data pending for replication in MB at staging account.", + SerializedName = @"dataPendingInStagingStorageAccountInMB", + PossibleTypes = new [] { typeof(double) })] + double? DataPendingInStagingStorageAccountInMb { get; set; } + /// The KeyVault resource id for secret (BEK). + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The KeyVault resource id for secret (BEK).", + SerializedName = @"dekKeyVaultArmId", + PossibleTypes = new [] { typeof(string) })] + string DekKeyVaultArmId { get; set; } + /// The disk capacity in bytes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The disk capacity in bytes.", + SerializedName = @"diskCapacityInBytes", + PossibleTypes = new [] { typeof(long) })] + long? DiskCapacityInByte { get; set; } + /// The disk name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The disk name.", + SerializedName = @"diskName", + PossibleTypes = new [] { typeof(string) })] + string DiskName { get; set; } + /// The disk state. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The disk state.", + SerializedName = @"diskState", + PossibleTypes = new [] { typeof(string) })] + string DiskState { get; set; } + /// The type of disk. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The type of disk.", + SerializedName = @"diskType", + PossibleTypes = new [] { typeof(string) })] + string DiskType { get; set; } + /// The disk uri. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The disk uri.", + SerializedName = @"diskUri", + PossibleTypes = new [] { typeof(string) })] + string DiskUri { get; set; } + /// The failover name for the managed disk. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The failover name for the managed disk.", + SerializedName = @"failoverDiskName", + PossibleTypes = new [] { typeof(string) })] + string FailoverDiskName { get; set; } + /// A value indicating whether vm has encrypted os disk or not. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether vm has encrypted os disk or not.", + SerializedName = @"isDiskEncrypted", + PossibleTypes = new [] { typeof(bool) })] + bool? IsDiskEncrypted { get; set; } + /// A value indicating whether disk key got encrypted or not. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether disk key got encrypted or not.", + SerializedName = @"isDiskKeyEncrypted", + PossibleTypes = new [] { typeof(bool) })] + bool? IsDiskKeyEncrypted { get; set; } + /// The KeyVault resource id for key (KEK). + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The KeyVault resource id for key (KEK).", + SerializedName = @"kekKeyVaultArmId", + PossibleTypes = new [] { typeof(string) })] + string KekKeyVaultArmId { get; set; } + /// The key URL / identifier (KEK). + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The key URL / identifier (KEK).", + SerializedName = @"keyIdentifier", + PossibleTypes = new [] { typeof(string) })] + string KeyIdentifier { get; set; } + /// + /// The type of the monitoring job. The progress is contained in MonitoringPercentageCompletion property. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The type of the monitoring job. The progress is contained in MonitoringPercentageCompletion property.", + SerializedName = @"monitoringJobType", + PossibleTypes = new [] { typeof(string) })] + string MonitoringJobType { get; set; } + /// + /// The percentage of the monitoring job. The type of the monitoring job is defined by MonitoringJobType property. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The percentage of the monitoring job. The type of the monitoring job is defined by MonitoringJobType property.", + SerializedName = @"monitoringPercentageCompletion", + PossibleTypes = new [] { typeof(int) })] + int? MonitoringPercentageCompletion { get; set; } + /// The primary disk storage account. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The primary disk storage account.", + SerializedName = @"primaryDiskAzureStorageAccountId", + PossibleTypes = new [] { typeof(string) })] + string PrimaryDiskAzureStorageAccountId { get; set; } + /// The primary staging storage account. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The primary staging storage account.", + SerializedName = @"primaryStagingAzureStorageAccountId", + PossibleTypes = new [] { typeof(string) })] + string PrimaryStagingAzureStorageAccountId { get; set; } + /// The recovery disk storage account. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery disk storage account.", + SerializedName = @"recoveryAzureStorageAccountId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryAzureStorageAccountId { get; set; } + /// Recovery disk uri. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Recovery disk uri.", + SerializedName = @"recoveryDiskUri", + PossibleTypes = new [] { typeof(string) })] + string RecoveryDiskUri { get; set; } + /// A value indicating whether resync is required for this disk. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether resync is required for this disk.", + SerializedName = @"resyncRequired", + PossibleTypes = new [] { typeof(bool) })] + bool? ResyncRequired { get; set; } + /// The secret URL / identifier (BEK). + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The secret URL / identifier (BEK).", + SerializedName = @"secretIdentifier", + PossibleTypes = new [] { typeof(string) })] + string SecretIdentifier { get; set; } + /// The test failover name for the managed disk. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The test failover name for the managed disk.", + SerializedName = @"tfoDiskName", + PossibleTypes = new [] { typeof(string) })] + string TfoDiskName { get; set; } + + } + /// A2A protected disk details. + internal partial interface IA2AProtectedDiskDetailsInternal + + { + /// The disk level operations list. + string[] AllowedDiskLevelOperation { get; set; } + /// The data pending at source virtual machine in MB. + double? DataPendingAtSourceAgentInMb { get; set; } + /// The data pending for replication in MB at staging account. + double? DataPendingInStagingStorageAccountInMb { get; set; } + /// The KeyVault resource id for secret (BEK). + string DekKeyVaultArmId { get; set; } + /// The disk capacity in bytes. + long? DiskCapacityInByte { get; set; } + /// The disk name. + string DiskName { get; set; } + /// The disk state. + string DiskState { get; set; } + /// The type of disk. + string DiskType { get; set; } + /// The disk uri. + string DiskUri { get; set; } + /// The failover name for the managed disk. + string FailoverDiskName { get; set; } + /// A value indicating whether vm has encrypted os disk or not. + bool? IsDiskEncrypted { get; set; } + /// A value indicating whether disk key got encrypted or not. + bool? IsDiskKeyEncrypted { get; set; } + /// The KeyVault resource id for key (KEK). + string KekKeyVaultArmId { get; set; } + /// The key URL / identifier (KEK). + string KeyIdentifier { get; set; } + /// + /// The type of the monitoring job. The progress is contained in MonitoringPercentageCompletion property. + /// + string MonitoringJobType { get; set; } + /// + /// The percentage of the monitoring job. The type of the monitoring job is defined by MonitoringJobType property. + /// + int? MonitoringPercentageCompletion { get; set; } + /// The primary disk storage account. + string PrimaryDiskAzureStorageAccountId { get; set; } + /// The primary staging storage account. + string PrimaryStagingAzureStorageAccountId { get; set; } + /// The recovery disk storage account. + string RecoveryAzureStorageAccountId { get; set; } + /// Recovery disk uri. + string RecoveryDiskUri { get; set; } + /// A value indicating whether resync is required for this disk. + bool? ResyncRequired { get; set; } + /// The secret URL / identifier (BEK). + string SecretIdentifier { get; set; } + /// The test failover name for the managed disk. + string TfoDiskName { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AProtectedDiskDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AProtectedDiskDetails.json.cs new file mode 100644 index 000000000000..8cca7bbd33d0 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AProtectedDiskDetails.json.cs @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// A2A protected disk details. + public partial class A2AProtectedDiskDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal A2AProtectedDiskDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_diskUri = If( json?.PropertyT("diskUri"), out var __jsonDiskUri) ? (string)__jsonDiskUri : (string)DiskUri;} + {_recoveryAzureStorageAccountId = If( json?.PropertyT("recoveryAzureStorageAccountId"), out var __jsonRecoveryAzureStorageAccountId) ? (string)__jsonRecoveryAzureStorageAccountId : (string)RecoveryAzureStorageAccountId;} + {_primaryDiskAzureStorageAccountId = If( json?.PropertyT("primaryDiskAzureStorageAccountId"), out var __jsonPrimaryDiskAzureStorageAccountId) ? (string)__jsonPrimaryDiskAzureStorageAccountId : (string)PrimaryDiskAzureStorageAccountId;} + {_recoveryDiskUri = If( json?.PropertyT("recoveryDiskUri"), out var __jsonRecoveryDiskUri) ? (string)__jsonRecoveryDiskUri : (string)RecoveryDiskUri;} + {_diskName = If( json?.PropertyT("diskName"), out var __jsonDiskName) ? (string)__jsonDiskName : (string)DiskName;} + {_diskCapacityInByte = If( json?.PropertyT("diskCapacityInBytes"), out var __jsonDiskCapacityInBytes) ? (long?)__jsonDiskCapacityInBytes : DiskCapacityInByte;} + {_primaryStagingAzureStorageAccountId = If( json?.PropertyT("primaryStagingAzureStorageAccountId"), out var __jsonPrimaryStagingAzureStorageAccountId) ? (string)__jsonPrimaryStagingAzureStorageAccountId : (string)PrimaryStagingAzureStorageAccountId;} + {_diskType = If( json?.PropertyT("diskType"), out var __jsonDiskType) ? (string)__jsonDiskType : (string)DiskType;} + {_resyncRequired = If( json?.PropertyT("resyncRequired"), out var __jsonResyncRequired) ? (bool?)__jsonResyncRequired : ResyncRequired;} + {_monitoringPercentageCompletion = If( json?.PropertyT("monitoringPercentageCompletion"), out var __jsonMonitoringPercentageCompletion) ? (int?)__jsonMonitoringPercentageCompletion : MonitoringPercentageCompletion;} + {_monitoringJobType = If( json?.PropertyT("monitoringJobType"), out var __jsonMonitoringJobType) ? (string)__jsonMonitoringJobType : (string)MonitoringJobType;} + {_dataPendingInStagingStorageAccountInMb = If( json?.PropertyT("dataPendingInStagingStorageAccountInMB"), out var __jsonDataPendingInStagingStorageAccountInMb) ? (double?)__jsonDataPendingInStagingStorageAccountInMb : DataPendingInStagingStorageAccountInMb;} + {_dataPendingAtSourceAgentInMb = If( json?.PropertyT("dataPendingAtSourceAgentInMB"), out var __jsonDataPendingAtSourceAgentInMb) ? (double?)__jsonDataPendingAtSourceAgentInMb : DataPendingAtSourceAgentInMb;} + {_diskState = If( json?.PropertyT("diskState"), out var __jsonDiskState) ? (string)__jsonDiskState : (string)DiskState;} + {_allowedDiskLevelOperation = If( json?.PropertyT("allowedDiskLevelOperation"), out var __jsonAllowedDiskLevelOperation) ? If( __jsonAllowedDiskLevelOperation as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(string) (__u is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : AllowedDiskLevelOperation;} + {_isDiskEncrypted = If( json?.PropertyT("isDiskEncrypted"), out var __jsonIsDiskEncrypted) ? (bool?)__jsonIsDiskEncrypted : IsDiskEncrypted;} + {_secretIdentifier = If( json?.PropertyT("secretIdentifier"), out var __jsonSecretIdentifier) ? (string)__jsonSecretIdentifier : (string)SecretIdentifier;} + {_dekKeyVaultArmId = If( json?.PropertyT("dekKeyVaultArmId"), out var __jsonDekKeyVaultArmId) ? (string)__jsonDekKeyVaultArmId : (string)DekKeyVaultArmId;} + {_isDiskKeyEncrypted = If( json?.PropertyT("isDiskKeyEncrypted"), out var __jsonIsDiskKeyEncrypted) ? (bool?)__jsonIsDiskKeyEncrypted : IsDiskKeyEncrypted;} + {_keyIdentifier = If( json?.PropertyT("keyIdentifier"), out var __jsonKeyIdentifier) ? (string)__jsonKeyIdentifier : (string)KeyIdentifier;} + {_kekKeyVaultArmId = If( json?.PropertyT("kekKeyVaultArmId"), out var __jsonKekKeyVaultArmId) ? (string)__jsonKekKeyVaultArmId : (string)KekKeyVaultArmId;} + {_failoverDiskName = If( json?.PropertyT("failoverDiskName"), out var __jsonFailoverDiskName) ? (string)__jsonFailoverDiskName : (string)FailoverDiskName;} + {_tfoDiskName = If( json?.PropertyT("tfoDiskName"), out var __jsonTfoDiskName) ? (string)__jsonTfoDiskName : (string)TfoDiskName;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new A2AProtectedDiskDetails(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._diskUri)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._diskUri.ToString()) : null, "diskUri" ,container.Add ); + AddIf( null != (((object)this._recoveryAzureStorageAccountId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryAzureStorageAccountId.ToString()) : null, "recoveryAzureStorageAccountId" ,container.Add ); + AddIf( null != (((object)this._primaryDiskAzureStorageAccountId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._primaryDiskAzureStorageAccountId.ToString()) : null, "primaryDiskAzureStorageAccountId" ,container.Add ); + AddIf( null != (((object)this._recoveryDiskUri)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryDiskUri.ToString()) : null, "recoveryDiskUri" ,container.Add ); + AddIf( null != (((object)this._diskName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._diskName.ToString()) : null, "diskName" ,container.Add ); + AddIf( null != this._diskCapacityInByte ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((long)this._diskCapacityInByte) : null, "diskCapacityInBytes" ,container.Add ); + AddIf( null != (((object)this._primaryStagingAzureStorageAccountId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._primaryStagingAzureStorageAccountId.ToString()) : null, "primaryStagingAzureStorageAccountId" ,container.Add ); + AddIf( null != (((object)this._diskType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._diskType.ToString()) : null, "diskType" ,container.Add ); + AddIf( null != this._resyncRequired ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonBoolean((bool)this._resyncRequired) : null, "resyncRequired" ,container.Add ); + AddIf( null != this._monitoringPercentageCompletion ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._monitoringPercentageCompletion) : null, "monitoringPercentageCompletion" ,container.Add ); + AddIf( null != (((object)this._monitoringJobType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._monitoringJobType.ToString()) : null, "monitoringJobType" ,container.Add ); + AddIf( null != this._dataPendingInStagingStorageAccountInMb ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((double)this._dataPendingInStagingStorageAccountInMb) : null, "dataPendingInStagingStorageAccountInMB" ,container.Add ); + AddIf( null != this._dataPendingAtSourceAgentInMb ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((double)this._dataPendingAtSourceAgentInMb) : null, "dataPendingAtSourceAgentInMB" ,container.Add ); + AddIf( null != (((object)this._diskState)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._diskState.ToString()) : null, "diskState" ,container.Add ); + if (null != this._allowedDiskLevelOperation) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._allowedDiskLevelOperation ) + { + AddIf(null != (((object)__x)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(__x.ToString()) : null ,__w.Add); + } + container.Add("allowedDiskLevelOperation",__w); + } + AddIf( null != this._isDiskEncrypted ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonBoolean((bool)this._isDiskEncrypted) : null, "isDiskEncrypted" ,container.Add ); + AddIf( null != (((object)this._secretIdentifier)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._secretIdentifier.ToString()) : null, "secretIdentifier" ,container.Add ); + AddIf( null != (((object)this._dekKeyVaultArmId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._dekKeyVaultArmId.ToString()) : null, "dekKeyVaultArmId" ,container.Add ); + AddIf( null != this._isDiskKeyEncrypted ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonBoolean((bool)this._isDiskKeyEncrypted) : null, "isDiskKeyEncrypted" ,container.Add ); + AddIf( null != (((object)this._keyIdentifier)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._keyIdentifier.ToString()) : null, "keyIdentifier" ,container.Add ); + AddIf( null != (((object)this._kekKeyVaultArmId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._kekKeyVaultArmId.ToString()) : null, "kekKeyVaultArmId" ,container.Add ); + AddIf( null != (((object)this._failoverDiskName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._failoverDiskName.ToString()) : null, "failoverDiskName" ,container.Add ); + AddIf( null != (((object)this._tfoDiskName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._tfoDiskName.ToString()) : null, "tfoDiskName" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AProtectedManagedDiskDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AProtectedManagedDiskDetails.PowerShell.cs new file mode 100644 index 000000000000..9ec40a02f9e1 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AProtectedManagedDiskDetails.PowerShell.cs @@ -0,0 +1,362 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// A2A protected managed disk details. + [System.ComponentModel.TypeConverter(typeof(A2AProtectedManagedDiskDetailsTypeConverter))] + public partial class A2AProtectedManagedDiskDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal A2AProtectedManagedDiskDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DiskId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).DiskId = (string) content.GetValueForProperty("DiskId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).DiskId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryResourceGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).RecoveryResourceGroupId = (string) content.GetValueForProperty("RecoveryResourceGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).RecoveryResourceGroupId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryTargetDiskId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).RecoveryTargetDiskId = (string) content.GetValueForProperty("RecoveryTargetDiskId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).RecoveryTargetDiskId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryReplicaDiskId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).RecoveryReplicaDiskId = (string) content.GetValueForProperty("RecoveryReplicaDiskId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).RecoveryReplicaDiskId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryOrignalTargetDiskId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).RecoveryOrignalTargetDiskId = (string) content.GetValueForProperty("RecoveryOrignalTargetDiskId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).RecoveryOrignalTargetDiskId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryReplicaDiskAccountType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).RecoveryReplicaDiskAccountType = (string) content.GetValueForProperty("RecoveryReplicaDiskAccountType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).RecoveryReplicaDiskAccountType, global::System.Convert.ToString); + } + if (content.Contains("RecoveryTargetDiskAccountType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).RecoveryTargetDiskAccountType = (string) content.GetValueForProperty("RecoveryTargetDiskAccountType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).RecoveryTargetDiskAccountType, global::System.Convert.ToString); + } + if (content.Contains("RecoveryDiskEncryptionSetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).RecoveryDiskEncryptionSetId = (string) content.GetValueForProperty("RecoveryDiskEncryptionSetId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).RecoveryDiskEncryptionSetId, global::System.Convert.ToString); + } + if (content.Contains("PrimaryDiskEncryptionSetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).PrimaryDiskEncryptionSetId = (string) content.GetValueForProperty("PrimaryDiskEncryptionSetId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).PrimaryDiskEncryptionSetId, global::System.Convert.ToString); + } + if (content.Contains("DiskName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).DiskName = (string) content.GetValueForProperty("DiskName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).DiskName, global::System.Convert.ToString); + } + if (content.Contains("DiskCapacityInByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).DiskCapacityInByte = (long?) content.GetValueForProperty("DiskCapacityInByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).DiskCapacityInByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("PrimaryStagingAzureStorageAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).PrimaryStagingAzureStorageAccountId = (string) content.GetValueForProperty("PrimaryStagingAzureStorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).PrimaryStagingAzureStorageAccountId, global::System.Convert.ToString); + } + if (content.Contains("DiskType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).DiskType = (string) content.GetValueForProperty("DiskType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).DiskType, global::System.Convert.ToString); + } + if (content.Contains("ResyncRequired")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).ResyncRequired = (bool?) content.GetValueForProperty("ResyncRequired",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).ResyncRequired, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("MonitoringPercentageCompletion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).MonitoringPercentageCompletion = (int?) content.GetValueForProperty("MonitoringPercentageCompletion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).MonitoringPercentageCompletion, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("MonitoringJobType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).MonitoringJobType = (string) content.GetValueForProperty("MonitoringJobType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).MonitoringJobType, global::System.Convert.ToString); + } + if (content.Contains("DataPendingInStagingStorageAccountInMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).DataPendingInStagingStorageAccountInMb = (double?) content.GetValueForProperty("DataPendingInStagingStorageAccountInMb",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).DataPendingInStagingStorageAccountInMb, (__y)=> (double) global::System.Convert.ChangeType(__y, typeof(double))); + } + if (content.Contains("DataPendingAtSourceAgentInMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).DataPendingAtSourceAgentInMb = (double?) content.GetValueForProperty("DataPendingAtSourceAgentInMb",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).DataPendingAtSourceAgentInMb, (__y)=> (double) global::System.Convert.ChangeType(__y, typeof(double))); + } + if (content.Contains("DiskState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).DiskState = (string) content.GetValueForProperty("DiskState",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).DiskState, global::System.Convert.ToString); + } + if (content.Contains("AllowedDiskLevelOperation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).AllowedDiskLevelOperation = (string[]) content.GetValueForProperty("AllowedDiskLevelOperation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).AllowedDiskLevelOperation, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("IsDiskEncrypted")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).IsDiskEncrypted = (bool?) content.GetValueForProperty("IsDiskEncrypted",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).IsDiskEncrypted, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("SecretIdentifier")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).SecretIdentifier = (string) content.GetValueForProperty("SecretIdentifier",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).SecretIdentifier, global::System.Convert.ToString); + } + if (content.Contains("DekKeyVaultArmId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).DekKeyVaultArmId = (string) content.GetValueForProperty("DekKeyVaultArmId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).DekKeyVaultArmId, global::System.Convert.ToString); + } + if (content.Contains("IsDiskKeyEncrypted")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).IsDiskKeyEncrypted = (bool?) content.GetValueForProperty("IsDiskKeyEncrypted",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).IsDiskKeyEncrypted, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("KeyIdentifier")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).KeyIdentifier = (string) content.GetValueForProperty("KeyIdentifier",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).KeyIdentifier, global::System.Convert.ToString); + } + if (content.Contains("KekKeyVaultArmId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).KekKeyVaultArmId = (string) content.GetValueForProperty("KekKeyVaultArmId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).KekKeyVaultArmId, global::System.Convert.ToString); + } + if (content.Contains("FailoverDiskName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).FailoverDiskName = (string) content.GetValueForProperty("FailoverDiskName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).FailoverDiskName, global::System.Convert.ToString); + } + if (content.Contains("TfoDiskName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).TfoDiskName = (string) content.GetValueForProperty("TfoDiskName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).TfoDiskName, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal A2AProtectedManagedDiskDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DiskId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).DiskId = (string) content.GetValueForProperty("DiskId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).DiskId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryResourceGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).RecoveryResourceGroupId = (string) content.GetValueForProperty("RecoveryResourceGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).RecoveryResourceGroupId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryTargetDiskId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).RecoveryTargetDiskId = (string) content.GetValueForProperty("RecoveryTargetDiskId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).RecoveryTargetDiskId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryReplicaDiskId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).RecoveryReplicaDiskId = (string) content.GetValueForProperty("RecoveryReplicaDiskId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).RecoveryReplicaDiskId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryOrignalTargetDiskId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).RecoveryOrignalTargetDiskId = (string) content.GetValueForProperty("RecoveryOrignalTargetDiskId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).RecoveryOrignalTargetDiskId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryReplicaDiskAccountType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).RecoveryReplicaDiskAccountType = (string) content.GetValueForProperty("RecoveryReplicaDiskAccountType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).RecoveryReplicaDiskAccountType, global::System.Convert.ToString); + } + if (content.Contains("RecoveryTargetDiskAccountType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).RecoveryTargetDiskAccountType = (string) content.GetValueForProperty("RecoveryTargetDiskAccountType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).RecoveryTargetDiskAccountType, global::System.Convert.ToString); + } + if (content.Contains("RecoveryDiskEncryptionSetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).RecoveryDiskEncryptionSetId = (string) content.GetValueForProperty("RecoveryDiskEncryptionSetId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).RecoveryDiskEncryptionSetId, global::System.Convert.ToString); + } + if (content.Contains("PrimaryDiskEncryptionSetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).PrimaryDiskEncryptionSetId = (string) content.GetValueForProperty("PrimaryDiskEncryptionSetId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).PrimaryDiskEncryptionSetId, global::System.Convert.ToString); + } + if (content.Contains("DiskName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).DiskName = (string) content.GetValueForProperty("DiskName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).DiskName, global::System.Convert.ToString); + } + if (content.Contains("DiskCapacityInByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).DiskCapacityInByte = (long?) content.GetValueForProperty("DiskCapacityInByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).DiskCapacityInByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("PrimaryStagingAzureStorageAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).PrimaryStagingAzureStorageAccountId = (string) content.GetValueForProperty("PrimaryStagingAzureStorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).PrimaryStagingAzureStorageAccountId, global::System.Convert.ToString); + } + if (content.Contains("DiskType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).DiskType = (string) content.GetValueForProperty("DiskType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).DiskType, global::System.Convert.ToString); + } + if (content.Contains("ResyncRequired")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).ResyncRequired = (bool?) content.GetValueForProperty("ResyncRequired",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).ResyncRequired, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("MonitoringPercentageCompletion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).MonitoringPercentageCompletion = (int?) content.GetValueForProperty("MonitoringPercentageCompletion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).MonitoringPercentageCompletion, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("MonitoringJobType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).MonitoringJobType = (string) content.GetValueForProperty("MonitoringJobType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).MonitoringJobType, global::System.Convert.ToString); + } + if (content.Contains("DataPendingInStagingStorageAccountInMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).DataPendingInStagingStorageAccountInMb = (double?) content.GetValueForProperty("DataPendingInStagingStorageAccountInMb",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).DataPendingInStagingStorageAccountInMb, (__y)=> (double) global::System.Convert.ChangeType(__y, typeof(double))); + } + if (content.Contains("DataPendingAtSourceAgentInMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).DataPendingAtSourceAgentInMb = (double?) content.GetValueForProperty("DataPendingAtSourceAgentInMb",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).DataPendingAtSourceAgentInMb, (__y)=> (double) global::System.Convert.ChangeType(__y, typeof(double))); + } + if (content.Contains("DiskState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).DiskState = (string) content.GetValueForProperty("DiskState",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).DiskState, global::System.Convert.ToString); + } + if (content.Contains("AllowedDiskLevelOperation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).AllowedDiskLevelOperation = (string[]) content.GetValueForProperty("AllowedDiskLevelOperation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).AllowedDiskLevelOperation, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("IsDiskEncrypted")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).IsDiskEncrypted = (bool?) content.GetValueForProperty("IsDiskEncrypted",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).IsDiskEncrypted, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("SecretIdentifier")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).SecretIdentifier = (string) content.GetValueForProperty("SecretIdentifier",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).SecretIdentifier, global::System.Convert.ToString); + } + if (content.Contains("DekKeyVaultArmId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).DekKeyVaultArmId = (string) content.GetValueForProperty("DekKeyVaultArmId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).DekKeyVaultArmId, global::System.Convert.ToString); + } + if (content.Contains("IsDiskKeyEncrypted")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).IsDiskKeyEncrypted = (bool?) content.GetValueForProperty("IsDiskKeyEncrypted",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).IsDiskKeyEncrypted, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("KeyIdentifier")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).KeyIdentifier = (string) content.GetValueForProperty("KeyIdentifier",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).KeyIdentifier, global::System.Convert.ToString); + } + if (content.Contains("KekKeyVaultArmId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).KekKeyVaultArmId = (string) content.GetValueForProperty("KekKeyVaultArmId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).KekKeyVaultArmId, global::System.Convert.ToString); + } + if (content.Contains("FailoverDiskName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).FailoverDiskName = (string) content.GetValueForProperty("FailoverDiskName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).FailoverDiskName, global::System.Convert.ToString); + } + if (content.Contains("TfoDiskName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).TfoDiskName = (string) content.GetValueForProperty("TfoDiskName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal)this).TfoDiskName, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new A2AProtectedManagedDiskDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new A2AProtectedManagedDiskDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// A2A protected managed disk details. + [System.ComponentModel.TypeConverter(typeof(A2AProtectedManagedDiskDetailsTypeConverter))] + public partial interface IA2AProtectedManagedDiskDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AProtectedManagedDiskDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AProtectedManagedDiskDetails.TypeConverter.cs new file mode 100644 index 000000000000..cb0f9fa59f7a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AProtectedManagedDiskDetails.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class A2AProtectedManagedDiskDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return A2AProtectedManagedDiskDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return A2AProtectedManagedDiskDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return A2AProtectedManagedDiskDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AProtectedManagedDiskDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AProtectedManagedDiskDetails.cs new file mode 100644 index 000000000000..473da1a2b412 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AProtectedManagedDiskDetails.cs @@ -0,0 +1,536 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// A2A protected managed disk details. + public partial class A2AProtectedManagedDiskDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetailsInternal + { + + /// Backing field for property. + private string[] _allowedDiskLevelOperation; + + /// The disk level operations list. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string[] AllowedDiskLevelOperation { get => this._allowedDiskLevelOperation; set => this._allowedDiskLevelOperation = value; } + + /// Backing field for property. + private double? _dataPendingAtSourceAgentInMb; + + /// The data pending at source virtual machine in MB. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public double? DataPendingAtSourceAgentInMb { get => this._dataPendingAtSourceAgentInMb; set => this._dataPendingAtSourceAgentInMb = value; } + + /// + /// Backing field for property. + /// + private double? _dataPendingInStagingStorageAccountInMb; + + /// The data pending for replication in MB at staging account. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public double? DataPendingInStagingStorageAccountInMb { get => this._dataPendingInStagingStorageAccountInMb; set => this._dataPendingInStagingStorageAccountInMb = value; } + + /// Backing field for property. + private string _dekKeyVaultArmId; + + /// The KeyVault resource id for secret (BEK). + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string DekKeyVaultArmId { get => this._dekKeyVaultArmId; set => this._dekKeyVaultArmId = value; } + + /// Backing field for property. + private long? _diskCapacityInByte; + + /// The disk capacity in bytes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public long? DiskCapacityInByte { get => this._diskCapacityInByte; set => this._diskCapacityInByte = value; } + + /// Backing field for property. + private string _diskId; + + /// The managed disk Arm id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string DiskId { get => this._diskId; set => this._diskId = value; } + + /// Backing field for property. + private string _diskName; + + /// The disk name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string DiskName { get => this._diskName; set => this._diskName = value; } + + /// Backing field for property. + private string _diskState; + + /// The disk state. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string DiskState { get => this._diskState; set => this._diskState = value; } + + /// Backing field for property. + private string _diskType; + + /// The type of disk. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string DiskType { get => this._diskType; set => this._diskType = value; } + + /// Backing field for property. + private string _failoverDiskName; + + /// The failover name for the managed disk. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string FailoverDiskName { get => this._failoverDiskName; set => this._failoverDiskName = value; } + + /// Backing field for property. + private bool? _isDiskEncrypted; + + /// A value indicating whether vm has encrypted os disk or not. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public bool? IsDiskEncrypted { get => this._isDiskEncrypted; set => this._isDiskEncrypted = value; } + + /// Backing field for property. + private bool? _isDiskKeyEncrypted; + + /// A value indicating whether disk key got encrypted or not. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public bool? IsDiskKeyEncrypted { get => this._isDiskKeyEncrypted; set => this._isDiskKeyEncrypted = value; } + + /// Backing field for property. + private string _kekKeyVaultArmId; + + /// The KeyVault resource id for key (KEK). + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string KekKeyVaultArmId { get => this._kekKeyVaultArmId; set => this._kekKeyVaultArmId = value; } + + /// Backing field for property. + private string _keyIdentifier; + + /// The key URL / identifier (KEK). + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string KeyIdentifier { get => this._keyIdentifier; set => this._keyIdentifier = value; } + + /// Backing field for property. + private string _monitoringJobType; + + /// + /// The type of the monitoring job. The progress is contained in MonitoringPercentageCompletion property. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string MonitoringJobType { get => this._monitoringJobType; set => this._monitoringJobType = value; } + + /// Backing field for property. + private int? _monitoringPercentageCompletion; + + /// + /// The percentage of the monitoring job. The type of the monitoring job is defined by MonitoringJobType property. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? MonitoringPercentageCompletion { get => this._monitoringPercentageCompletion; set => this._monitoringPercentageCompletion = value; } + + /// Backing field for property. + private string _primaryDiskEncryptionSetId; + + /// The primary disk encryption set Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string PrimaryDiskEncryptionSetId { get => this._primaryDiskEncryptionSetId; set => this._primaryDiskEncryptionSetId = value; } + + /// Backing field for property. + private string _primaryStagingAzureStorageAccountId; + + /// The primary staging storage account. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string PrimaryStagingAzureStorageAccountId { get => this._primaryStagingAzureStorageAccountId; set => this._primaryStagingAzureStorageAccountId = value; } + + /// Backing field for property. + private string _recoveryDiskEncryptionSetId; + + /// The recovery disk encryption set Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryDiskEncryptionSetId { get => this._recoveryDiskEncryptionSetId; set => this._recoveryDiskEncryptionSetId = value; } + + /// Backing field for property. + private string _recoveryOrignalTargetDiskId; + + /// Recovery original target disk Arm Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryOrignalTargetDiskId { get => this._recoveryOrignalTargetDiskId; set => this._recoveryOrignalTargetDiskId = value; } + + /// Backing field for property. + private string _recoveryReplicaDiskAccountType; + + /// + /// The replica disk type. Its an optional value and will be same as source disk type if not user provided. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryReplicaDiskAccountType { get => this._recoveryReplicaDiskAccountType; set => this._recoveryReplicaDiskAccountType = value; } + + /// Backing field for property. + private string _recoveryReplicaDiskId; + + /// Recovery replica disk Arm Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryReplicaDiskId { get => this._recoveryReplicaDiskId; set => this._recoveryReplicaDiskId = value; } + + /// Backing field for property. + private string _recoveryResourceGroupId; + + /// The recovery disk resource group Arm Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryResourceGroupId { get => this._recoveryResourceGroupId; set => this._recoveryResourceGroupId = value; } + + /// Backing field for property. + private string _recoveryTargetDiskAccountType; + + /// + /// The target disk type after failover. Its an optional value and will be same as source disk type if not user provided. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryTargetDiskAccountType { get => this._recoveryTargetDiskAccountType; set => this._recoveryTargetDiskAccountType = value; } + + /// Backing field for property. + private string _recoveryTargetDiskId; + + /// Recovery target disk Arm Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryTargetDiskId { get => this._recoveryTargetDiskId; set => this._recoveryTargetDiskId = value; } + + /// Backing field for property. + private bool? _resyncRequired; + + /// A value indicating whether resync is required for this disk. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public bool? ResyncRequired { get => this._resyncRequired; set => this._resyncRequired = value; } + + /// Backing field for property. + private string _secretIdentifier; + + /// The secret URL / identifier (BEK). + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string SecretIdentifier { get => this._secretIdentifier; set => this._secretIdentifier = value; } + + /// Backing field for property. + private string _tfoDiskName; + + /// The test failover name for the managed disk. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TfoDiskName { get => this._tfoDiskName; set => this._tfoDiskName = value; } + + /// Creates an new instance. + public A2AProtectedManagedDiskDetails() + { + + } + } + /// A2A protected managed disk details. + public partial interface IA2AProtectedManagedDiskDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The disk level operations list. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The disk level operations list.", + SerializedName = @"allowedDiskLevelOperation", + PossibleTypes = new [] { typeof(string) })] + string[] AllowedDiskLevelOperation { get; set; } + /// The data pending at source virtual machine in MB. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The data pending at source virtual machine in MB.", + SerializedName = @"dataPendingAtSourceAgentInMB", + PossibleTypes = new [] { typeof(double) })] + double? DataPendingAtSourceAgentInMb { get; set; } + /// The data pending for replication in MB at staging account. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The data pending for replication in MB at staging account.", + SerializedName = @"dataPendingInStagingStorageAccountInMB", + PossibleTypes = new [] { typeof(double) })] + double? DataPendingInStagingStorageAccountInMb { get; set; } + /// The KeyVault resource id for secret (BEK). + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The KeyVault resource id for secret (BEK).", + SerializedName = @"dekKeyVaultArmId", + PossibleTypes = new [] { typeof(string) })] + string DekKeyVaultArmId { get; set; } + /// The disk capacity in bytes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The disk capacity in bytes.", + SerializedName = @"diskCapacityInBytes", + PossibleTypes = new [] { typeof(long) })] + long? DiskCapacityInByte { get; set; } + /// The managed disk Arm id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The managed disk Arm id.", + SerializedName = @"diskId", + PossibleTypes = new [] { typeof(string) })] + string DiskId { get; set; } + /// The disk name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The disk name.", + SerializedName = @"diskName", + PossibleTypes = new [] { typeof(string) })] + string DiskName { get; set; } + /// The disk state. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The disk state.", + SerializedName = @"diskState", + PossibleTypes = new [] { typeof(string) })] + string DiskState { get; set; } + /// The type of disk. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The type of disk.", + SerializedName = @"diskType", + PossibleTypes = new [] { typeof(string) })] + string DiskType { get; set; } + /// The failover name for the managed disk. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The failover name for the managed disk.", + SerializedName = @"failoverDiskName", + PossibleTypes = new [] { typeof(string) })] + string FailoverDiskName { get; set; } + /// A value indicating whether vm has encrypted os disk or not. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether vm has encrypted os disk or not.", + SerializedName = @"isDiskEncrypted", + PossibleTypes = new [] { typeof(bool) })] + bool? IsDiskEncrypted { get; set; } + /// A value indicating whether disk key got encrypted or not. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether disk key got encrypted or not.", + SerializedName = @"isDiskKeyEncrypted", + PossibleTypes = new [] { typeof(bool) })] + bool? IsDiskKeyEncrypted { get; set; } + /// The KeyVault resource id for key (KEK). + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The KeyVault resource id for key (KEK).", + SerializedName = @"kekKeyVaultArmId", + PossibleTypes = new [] { typeof(string) })] + string KekKeyVaultArmId { get; set; } + /// The key URL / identifier (KEK). + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The key URL / identifier (KEK).", + SerializedName = @"keyIdentifier", + PossibleTypes = new [] { typeof(string) })] + string KeyIdentifier { get; set; } + /// + /// The type of the monitoring job. The progress is contained in MonitoringPercentageCompletion property. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The type of the monitoring job. The progress is contained in MonitoringPercentageCompletion property.", + SerializedName = @"monitoringJobType", + PossibleTypes = new [] { typeof(string) })] + string MonitoringJobType { get; set; } + /// + /// The percentage of the monitoring job. The type of the monitoring job is defined by MonitoringJobType property. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The percentage of the monitoring job. The type of the monitoring job is defined by MonitoringJobType property.", + SerializedName = @"monitoringPercentageCompletion", + PossibleTypes = new [] { typeof(int) })] + int? MonitoringPercentageCompletion { get; set; } + /// The primary disk encryption set Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The primary disk encryption set Id.", + SerializedName = @"primaryDiskEncryptionSetId", + PossibleTypes = new [] { typeof(string) })] + string PrimaryDiskEncryptionSetId { get; set; } + /// The primary staging storage account. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The primary staging storage account.", + SerializedName = @"primaryStagingAzureStorageAccountId", + PossibleTypes = new [] { typeof(string) })] + string PrimaryStagingAzureStorageAccountId { get; set; } + /// The recovery disk encryption set Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery disk encryption set Id.", + SerializedName = @"recoveryDiskEncryptionSetId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryDiskEncryptionSetId { get; set; } + /// Recovery original target disk Arm Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Recovery original target disk Arm Id.", + SerializedName = @"recoveryOrignalTargetDiskId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryOrignalTargetDiskId { get; set; } + /// + /// The replica disk type. Its an optional value and will be same as source disk type if not user provided. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The replica disk type. Its an optional value and will be same as source disk type if not user provided.", + SerializedName = @"recoveryReplicaDiskAccountType", + PossibleTypes = new [] { typeof(string) })] + string RecoveryReplicaDiskAccountType { get; set; } + /// Recovery replica disk Arm Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Recovery replica disk Arm Id.", + SerializedName = @"recoveryReplicaDiskId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryReplicaDiskId { get; set; } + /// The recovery disk resource group Arm Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery disk resource group Arm Id.", + SerializedName = @"recoveryResourceGroupId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryResourceGroupId { get; set; } + /// + /// The target disk type after failover. Its an optional value and will be same as source disk type if not user provided. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target disk type after failover. Its an optional value and will be same as source disk type if not user provided.", + SerializedName = @"recoveryTargetDiskAccountType", + PossibleTypes = new [] { typeof(string) })] + string RecoveryTargetDiskAccountType { get; set; } + /// Recovery target disk Arm Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Recovery target disk Arm Id.", + SerializedName = @"recoveryTargetDiskId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryTargetDiskId { get; set; } + /// A value indicating whether resync is required for this disk. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether resync is required for this disk.", + SerializedName = @"resyncRequired", + PossibleTypes = new [] { typeof(bool) })] + bool? ResyncRequired { get; set; } + /// The secret URL / identifier (BEK). + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The secret URL / identifier (BEK).", + SerializedName = @"secretIdentifier", + PossibleTypes = new [] { typeof(string) })] + string SecretIdentifier { get; set; } + /// The test failover name for the managed disk. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The test failover name for the managed disk.", + SerializedName = @"tfoDiskName", + PossibleTypes = new [] { typeof(string) })] + string TfoDiskName { get; set; } + + } + /// A2A protected managed disk details. + internal partial interface IA2AProtectedManagedDiskDetailsInternal + + { + /// The disk level operations list. + string[] AllowedDiskLevelOperation { get; set; } + /// The data pending at source virtual machine in MB. + double? DataPendingAtSourceAgentInMb { get; set; } + /// The data pending for replication in MB at staging account. + double? DataPendingInStagingStorageAccountInMb { get; set; } + /// The KeyVault resource id for secret (BEK). + string DekKeyVaultArmId { get; set; } + /// The disk capacity in bytes. + long? DiskCapacityInByte { get; set; } + /// The managed disk Arm id. + string DiskId { get; set; } + /// The disk name. + string DiskName { get; set; } + /// The disk state. + string DiskState { get; set; } + /// The type of disk. + string DiskType { get; set; } + /// The failover name for the managed disk. + string FailoverDiskName { get; set; } + /// A value indicating whether vm has encrypted os disk or not. + bool? IsDiskEncrypted { get; set; } + /// A value indicating whether disk key got encrypted or not. + bool? IsDiskKeyEncrypted { get; set; } + /// The KeyVault resource id for key (KEK). + string KekKeyVaultArmId { get; set; } + /// The key URL / identifier (KEK). + string KeyIdentifier { get; set; } + /// + /// The type of the monitoring job. The progress is contained in MonitoringPercentageCompletion property. + /// + string MonitoringJobType { get; set; } + /// + /// The percentage of the monitoring job. The type of the monitoring job is defined by MonitoringJobType property. + /// + int? MonitoringPercentageCompletion { get; set; } + /// The primary disk encryption set Id. + string PrimaryDiskEncryptionSetId { get; set; } + /// The primary staging storage account. + string PrimaryStagingAzureStorageAccountId { get; set; } + /// The recovery disk encryption set Id. + string RecoveryDiskEncryptionSetId { get; set; } + /// Recovery original target disk Arm Id. + string RecoveryOrignalTargetDiskId { get; set; } + /// + /// The replica disk type. Its an optional value and will be same as source disk type if not user provided. + /// + string RecoveryReplicaDiskAccountType { get; set; } + /// Recovery replica disk Arm Id. + string RecoveryReplicaDiskId { get; set; } + /// The recovery disk resource group Arm Id. + string RecoveryResourceGroupId { get; set; } + /// + /// The target disk type after failover. Its an optional value and will be same as source disk type if not user provided. + /// + string RecoveryTargetDiskAccountType { get; set; } + /// Recovery target disk Arm Id. + string RecoveryTargetDiskId { get; set; } + /// A value indicating whether resync is required for this disk. + bool? ResyncRequired { get; set; } + /// The secret URL / identifier (BEK). + string SecretIdentifier { get; set; } + /// The test failover name for the managed disk. + string TfoDiskName { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AProtectedManagedDiskDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AProtectedManagedDiskDetails.json.cs new file mode 100644 index 000000000000..9fcb3358e554 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AProtectedManagedDiskDetails.json.cs @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// A2A protected managed disk details. + public partial class A2AProtectedManagedDiskDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal A2AProtectedManagedDiskDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_diskId = If( json?.PropertyT("diskId"), out var __jsonDiskId) ? (string)__jsonDiskId : (string)DiskId;} + {_recoveryResourceGroupId = If( json?.PropertyT("recoveryResourceGroupId"), out var __jsonRecoveryResourceGroupId) ? (string)__jsonRecoveryResourceGroupId : (string)RecoveryResourceGroupId;} + {_recoveryTargetDiskId = If( json?.PropertyT("recoveryTargetDiskId"), out var __jsonRecoveryTargetDiskId) ? (string)__jsonRecoveryTargetDiskId : (string)RecoveryTargetDiskId;} + {_recoveryReplicaDiskId = If( json?.PropertyT("recoveryReplicaDiskId"), out var __jsonRecoveryReplicaDiskId) ? (string)__jsonRecoveryReplicaDiskId : (string)RecoveryReplicaDiskId;} + {_recoveryOrignalTargetDiskId = If( json?.PropertyT("recoveryOrignalTargetDiskId"), out var __jsonRecoveryOrignalTargetDiskId) ? (string)__jsonRecoveryOrignalTargetDiskId : (string)RecoveryOrignalTargetDiskId;} + {_recoveryReplicaDiskAccountType = If( json?.PropertyT("recoveryReplicaDiskAccountType"), out var __jsonRecoveryReplicaDiskAccountType) ? (string)__jsonRecoveryReplicaDiskAccountType : (string)RecoveryReplicaDiskAccountType;} + {_recoveryTargetDiskAccountType = If( json?.PropertyT("recoveryTargetDiskAccountType"), out var __jsonRecoveryTargetDiskAccountType) ? (string)__jsonRecoveryTargetDiskAccountType : (string)RecoveryTargetDiskAccountType;} + {_recoveryDiskEncryptionSetId = If( json?.PropertyT("recoveryDiskEncryptionSetId"), out var __jsonRecoveryDiskEncryptionSetId) ? (string)__jsonRecoveryDiskEncryptionSetId : (string)RecoveryDiskEncryptionSetId;} + {_primaryDiskEncryptionSetId = If( json?.PropertyT("primaryDiskEncryptionSetId"), out var __jsonPrimaryDiskEncryptionSetId) ? (string)__jsonPrimaryDiskEncryptionSetId : (string)PrimaryDiskEncryptionSetId;} + {_diskName = If( json?.PropertyT("diskName"), out var __jsonDiskName) ? (string)__jsonDiskName : (string)DiskName;} + {_diskCapacityInByte = If( json?.PropertyT("diskCapacityInBytes"), out var __jsonDiskCapacityInBytes) ? (long?)__jsonDiskCapacityInBytes : DiskCapacityInByte;} + {_primaryStagingAzureStorageAccountId = If( json?.PropertyT("primaryStagingAzureStorageAccountId"), out var __jsonPrimaryStagingAzureStorageAccountId) ? (string)__jsonPrimaryStagingAzureStorageAccountId : (string)PrimaryStagingAzureStorageAccountId;} + {_diskType = If( json?.PropertyT("diskType"), out var __jsonDiskType) ? (string)__jsonDiskType : (string)DiskType;} + {_resyncRequired = If( json?.PropertyT("resyncRequired"), out var __jsonResyncRequired) ? (bool?)__jsonResyncRequired : ResyncRequired;} + {_monitoringPercentageCompletion = If( json?.PropertyT("monitoringPercentageCompletion"), out var __jsonMonitoringPercentageCompletion) ? (int?)__jsonMonitoringPercentageCompletion : MonitoringPercentageCompletion;} + {_monitoringJobType = If( json?.PropertyT("monitoringJobType"), out var __jsonMonitoringJobType) ? (string)__jsonMonitoringJobType : (string)MonitoringJobType;} + {_dataPendingInStagingStorageAccountInMb = If( json?.PropertyT("dataPendingInStagingStorageAccountInMB"), out var __jsonDataPendingInStagingStorageAccountInMb) ? (double?)__jsonDataPendingInStagingStorageAccountInMb : DataPendingInStagingStorageAccountInMb;} + {_dataPendingAtSourceAgentInMb = If( json?.PropertyT("dataPendingAtSourceAgentInMB"), out var __jsonDataPendingAtSourceAgentInMb) ? (double?)__jsonDataPendingAtSourceAgentInMb : DataPendingAtSourceAgentInMb;} + {_diskState = If( json?.PropertyT("diskState"), out var __jsonDiskState) ? (string)__jsonDiskState : (string)DiskState;} + {_allowedDiskLevelOperation = If( json?.PropertyT("allowedDiskLevelOperation"), out var __jsonAllowedDiskLevelOperation) ? If( __jsonAllowedDiskLevelOperation as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(string) (__u is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : AllowedDiskLevelOperation;} + {_isDiskEncrypted = If( json?.PropertyT("isDiskEncrypted"), out var __jsonIsDiskEncrypted) ? (bool?)__jsonIsDiskEncrypted : IsDiskEncrypted;} + {_secretIdentifier = If( json?.PropertyT("secretIdentifier"), out var __jsonSecretIdentifier) ? (string)__jsonSecretIdentifier : (string)SecretIdentifier;} + {_dekKeyVaultArmId = If( json?.PropertyT("dekKeyVaultArmId"), out var __jsonDekKeyVaultArmId) ? (string)__jsonDekKeyVaultArmId : (string)DekKeyVaultArmId;} + {_isDiskKeyEncrypted = If( json?.PropertyT("isDiskKeyEncrypted"), out var __jsonIsDiskKeyEncrypted) ? (bool?)__jsonIsDiskKeyEncrypted : IsDiskKeyEncrypted;} + {_keyIdentifier = If( json?.PropertyT("keyIdentifier"), out var __jsonKeyIdentifier) ? (string)__jsonKeyIdentifier : (string)KeyIdentifier;} + {_kekKeyVaultArmId = If( json?.PropertyT("kekKeyVaultArmId"), out var __jsonKekKeyVaultArmId) ? (string)__jsonKekKeyVaultArmId : (string)KekKeyVaultArmId;} + {_failoverDiskName = If( json?.PropertyT("failoverDiskName"), out var __jsonFailoverDiskName) ? (string)__jsonFailoverDiskName : (string)FailoverDiskName;} + {_tfoDiskName = If( json?.PropertyT("tfoDiskName"), out var __jsonTfoDiskName) ? (string)__jsonTfoDiskName : (string)TfoDiskName;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new A2AProtectedManagedDiskDetails(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._diskId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._diskId.ToString()) : null, "diskId" ,container.Add ); + AddIf( null != (((object)this._recoveryResourceGroupId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryResourceGroupId.ToString()) : null, "recoveryResourceGroupId" ,container.Add ); + AddIf( null != (((object)this._recoveryTargetDiskId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryTargetDiskId.ToString()) : null, "recoveryTargetDiskId" ,container.Add ); + AddIf( null != (((object)this._recoveryReplicaDiskId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryReplicaDiskId.ToString()) : null, "recoveryReplicaDiskId" ,container.Add ); + AddIf( null != (((object)this._recoveryOrignalTargetDiskId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryOrignalTargetDiskId.ToString()) : null, "recoveryOrignalTargetDiskId" ,container.Add ); + AddIf( null != (((object)this._recoveryReplicaDiskAccountType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryReplicaDiskAccountType.ToString()) : null, "recoveryReplicaDiskAccountType" ,container.Add ); + AddIf( null != (((object)this._recoveryTargetDiskAccountType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryTargetDiskAccountType.ToString()) : null, "recoveryTargetDiskAccountType" ,container.Add ); + AddIf( null != (((object)this._recoveryDiskEncryptionSetId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryDiskEncryptionSetId.ToString()) : null, "recoveryDiskEncryptionSetId" ,container.Add ); + AddIf( null != (((object)this._primaryDiskEncryptionSetId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._primaryDiskEncryptionSetId.ToString()) : null, "primaryDiskEncryptionSetId" ,container.Add ); + AddIf( null != (((object)this._diskName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._diskName.ToString()) : null, "diskName" ,container.Add ); + AddIf( null != this._diskCapacityInByte ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((long)this._diskCapacityInByte) : null, "diskCapacityInBytes" ,container.Add ); + AddIf( null != (((object)this._primaryStagingAzureStorageAccountId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._primaryStagingAzureStorageAccountId.ToString()) : null, "primaryStagingAzureStorageAccountId" ,container.Add ); + AddIf( null != (((object)this._diskType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._diskType.ToString()) : null, "diskType" ,container.Add ); + AddIf( null != this._resyncRequired ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonBoolean((bool)this._resyncRequired) : null, "resyncRequired" ,container.Add ); + AddIf( null != this._monitoringPercentageCompletion ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._monitoringPercentageCompletion) : null, "monitoringPercentageCompletion" ,container.Add ); + AddIf( null != (((object)this._monitoringJobType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._monitoringJobType.ToString()) : null, "monitoringJobType" ,container.Add ); + AddIf( null != this._dataPendingInStagingStorageAccountInMb ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((double)this._dataPendingInStagingStorageAccountInMb) : null, "dataPendingInStagingStorageAccountInMB" ,container.Add ); + AddIf( null != this._dataPendingAtSourceAgentInMb ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((double)this._dataPendingAtSourceAgentInMb) : null, "dataPendingAtSourceAgentInMB" ,container.Add ); + AddIf( null != (((object)this._diskState)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._diskState.ToString()) : null, "diskState" ,container.Add ); + if (null != this._allowedDiskLevelOperation) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._allowedDiskLevelOperation ) + { + AddIf(null != (((object)__x)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(__x.ToString()) : null ,__w.Add); + } + container.Add("allowedDiskLevelOperation",__w); + } + AddIf( null != this._isDiskEncrypted ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonBoolean((bool)this._isDiskEncrypted) : null, "isDiskEncrypted" ,container.Add ); + AddIf( null != (((object)this._secretIdentifier)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._secretIdentifier.ToString()) : null, "secretIdentifier" ,container.Add ); + AddIf( null != (((object)this._dekKeyVaultArmId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._dekKeyVaultArmId.ToString()) : null, "dekKeyVaultArmId" ,container.Add ); + AddIf( null != this._isDiskKeyEncrypted ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonBoolean((bool)this._isDiskKeyEncrypted) : null, "isDiskKeyEncrypted" ,container.Add ); + AddIf( null != (((object)this._keyIdentifier)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._keyIdentifier.ToString()) : null, "keyIdentifier" ,container.Add ); + AddIf( null != (((object)this._kekKeyVaultArmId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._kekKeyVaultArmId.ToString()) : null, "kekKeyVaultArmId" ,container.Add ); + AddIf( null != (((object)this._failoverDiskName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._failoverDiskName.ToString()) : null, "failoverDiskName" ,container.Add ); + AddIf( null != (((object)this._tfoDiskName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._tfoDiskName.ToString()) : null, "tfoDiskName" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AProtectionContainerMappingDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AProtectionContainerMappingDetails.PowerShell.cs new file mode 100644 index 000000000000..8f695dc27e9f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AProtectionContainerMappingDetails.PowerShell.cs @@ -0,0 +1,188 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// A2A provider specific settings. + [System.ComponentModel.TypeConverter(typeof(A2AProtectionContainerMappingDetailsTypeConverter))] + public partial class A2AProtectionContainerMappingDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal A2AProtectionContainerMappingDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("AgentAutoUpdateStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionContainerMappingDetailsInternal)this).AgentAutoUpdateStatus = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentAutoUpdateStatus?) content.GetValueForProperty("AgentAutoUpdateStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionContainerMappingDetailsInternal)this).AgentAutoUpdateStatus, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentAutoUpdateStatus.CreateFrom); + } + if (content.Contains("AutomationAccountArmId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionContainerMappingDetailsInternal)this).AutomationAccountArmId = (string) content.GetValueForProperty("AutomationAccountArmId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionContainerMappingDetailsInternal)this).AutomationAccountArmId, global::System.Convert.ToString); + } + if (content.Contains("AutomationAccountAuthenticationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionContainerMappingDetailsInternal)this).AutomationAccountAuthenticationType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AutomationAccountAuthenticationType?) content.GetValueForProperty("AutomationAccountAuthenticationType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionContainerMappingDetailsInternal)this).AutomationAccountAuthenticationType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AutomationAccountAuthenticationType.CreateFrom); + } + if (content.Contains("ScheduleName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionContainerMappingDetailsInternal)this).ScheduleName = (string) content.GetValueForProperty("ScheduleName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionContainerMappingDetailsInternal)this).ScheduleName, global::System.Convert.ToString); + } + if (content.Contains("JobScheduleName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionContainerMappingDetailsInternal)this).JobScheduleName = (string) content.GetValueForProperty("JobScheduleName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionContainerMappingDetailsInternal)this).JobScheduleName, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingProviderSpecificDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingProviderSpecificDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal A2AProtectionContainerMappingDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("AgentAutoUpdateStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionContainerMappingDetailsInternal)this).AgentAutoUpdateStatus = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentAutoUpdateStatus?) content.GetValueForProperty("AgentAutoUpdateStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionContainerMappingDetailsInternal)this).AgentAutoUpdateStatus, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentAutoUpdateStatus.CreateFrom); + } + if (content.Contains("AutomationAccountArmId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionContainerMappingDetailsInternal)this).AutomationAccountArmId = (string) content.GetValueForProperty("AutomationAccountArmId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionContainerMappingDetailsInternal)this).AutomationAccountArmId, global::System.Convert.ToString); + } + if (content.Contains("AutomationAccountAuthenticationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionContainerMappingDetailsInternal)this).AutomationAccountAuthenticationType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AutomationAccountAuthenticationType?) content.GetValueForProperty("AutomationAccountAuthenticationType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionContainerMappingDetailsInternal)this).AutomationAccountAuthenticationType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AutomationAccountAuthenticationType.CreateFrom); + } + if (content.Contains("ScheduleName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionContainerMappingDetailsInternal)this).ScheduleName = (string) content.GetValueForProperty("ScheduleName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionContainerMappingDetailsInternal)this).ScheduleName, global::System.Convert.ToString); + } + if (content.Contains("JobScheduleName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionContainerMappingDetailsInternal)this).JobScheduleName = (string) content.GetValueForProperty("JobScheduleName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionContainerMappingDetailsInternal)this).JobScheduleName, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingProviderSpecificDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingProviderSpecificDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionContainerMappingDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new A2AProtectionContainerMappingDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionContainerMappingDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new A2AProtectionContainerMappingDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionContainerMappingDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// A2A provider specific settings. + [System.ComponentModel.TypeConverter(typeof(A2AProtectionContainerMappingDetailsTypeConverter))] + public partial interface IA2AProtectionContainerMappingDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AProtectionContainerMappingDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AProtectionContainerMappingDetails.TypeConverter.cs new file mode 100644 index 000000000000..975c98fb4281 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AProtectionContainerMappingDetails.TypeConverter.cs @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class A2AProtectionContainerMappingDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionContainerMappingDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionContainerMappingDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return A2AProtectionContainerMappingDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return A2AProtectionContainerMappingDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return A2AProtectionContainerMappingDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AProtectionContainerMappingDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AProtectionContainerMappingDetails.cs new file mode 100644 index 000000000000..52694fae1417 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AProtectionContainerMappingDetails.cs @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// A2A provider specific settings. + public partial class A2AProtectionContainerMappingDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionContainerMappingDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionContainerMappingDetailsInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingProviderSpecificDetails __protectionContainerMappingProviderSpecificDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProtectionContainerMappingProviderSpecificDetails(); + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentAutoUpdateStatus? _agentAutoUpdateStatus; + + /// A value indicating whether the auto update is enabled. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentAutoUpdateStatus? AgentAutoUpdateStatus { get => this._agentAutoUpdateStatus; set => this._agentAutoUpdateStatus = value; } + + /// Backing field for property. + private string _automationAccountArmId; + + /// The automation account arm id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string AutomationAccountArmId { get => this._automationAccountArmId; set => this._automationAccountArmId = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AutomationAccountAuthenticationType? _automationAccountAuthenticationType; + + /// A value indicating the type authentication to use for automation Account. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AutomationAccountAuthenticationType? AutomationAccountAuthenticationType { get => this._automationAccountAuthenticationType; set => this._automationAccountAuthenticationType = value; } + + /// Gets the class type. Overridden in derived classes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingProviderSpecificDetailsInternal)__protectionContainerMappingProviderSpecificDetails).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingProviderSpecificDetailsInternal)__protectionContainerMappingProviderSpecificDetails).InstanceType = value ; } + + /// Backing field for property. + private string _jobScheduleName; + + /// The job schedule arm name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string JobScheduleName { get => this._jobScheduleName; set => this._jobScheduleName = value; } + + /// Backing field for property. + private string _scheduleName; + + /// The schedule arm name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ScheduleName { get => this._scheduleName; set => this._scheduleName = value; } + + /// Creates an new instance. + public A2AProtectionContainerMappingDetails() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__protectionContainerMappingProviderSpecificDetails), __protectionContainerMappingProviderSpecificDetails); + await eventListener.AssertObjectIsValid(nameof(__protectionContainerMappingProviderSpecificDetails), __protectionContainerMappingProviderSpecificDetails); + } + } + /// A2A provider specific settings. + public partial interface IA2AProtectionContainerMappingDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingProviderSpecificDetails + { + /// A value indicating whether the auto update is enabled. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether the auto update is enabled.", + SerializedName = @"agentAutoUpdateStatus", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentAutoUpdateStatus) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentAutoUpdateStatus? AgentAutoUpdateStatus { get; set; } + /// The automation account arm id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The automation account arm id.", + SerializedName = @"automationAccountArmId", + PossibleTypes = new [] { typeof(string) })] + string AutomationAccountArmId { get; set; } + /// A value indicating the type authentication to use for automation Account. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating the type authentication to use for automation Account.", + SerializedName = @"automationAccountAuthenticationType", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AutomationAccountAuthenticationType) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AutomationAccountAuthenticationType? AutomationAccountAuthenticationType { get; set; } + /// The job schedule arm name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The job schedule arm name.", + SerializedName = @"jobScheduleName", + PossibleTypes = new [] { typeof(string) })] + string JobScheduleName { get; set; } + /// The schedule arm name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The schedule arm name.", + SerializedName = @"scheduleName", + PossibleTypes = new [] { typeof(string) })] + string ScheduleName { get; set; } + + } + /// A2A provider specific settings. + internal partial interface IA2AProtectionContainerMappingDetailsInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingProviderSpecificDetailsInternal + { + /// A value indicating whether the auto update is enabled. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentAutoUpdateStatus? AgentAutoUpdateStatus { get; set; } + /// The automation account arm id. + string AutomationAccountArmId { get; set; } + /// A value indicating the type authentication to use for automation Account. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AutomationAccountAuthenticationType? AutomationAccountAuthenticationType { get; set; } + /// The job schedule arm name. + string JobScheduleName { get; set; } + /// The schedule arm name. + string ScheduleName { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AProtectionContainerMappingDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AProtectionContainerMappingDetails.json.cs new file mode 100644 index 000000000000..26fa50dcb292 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AProtectionContainerMappingDetails.json.cs @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// A2A provider specific settings. + public partial class A2AProtectionContainerMappingDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal A2AProtectionContainerMappingDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __protectionContainerMappingProviderSpecificDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProtectionContainerMappingProviderSpecificDetails(json); + {_agentAutoUpdateStatus = If( json?.PropertyT("agentAutoUpdateStatus"), out var __jsonAgentAutoUpdateStatus) ? (string)__jsonAgentAutoUpdateStatus : (string)AgentAutoUpdateStatus;} + {_automationAccountArmId = If( json?.PropertyT("automationAccountArmId"), out var __jsonAutomationAccountArmId) ? (string)__jsonAutomationAccountArmId : (string)AutomationAccountArmId;} + {_automationAccountAuthenticationType = If( json?.PropertyT("automationAccountAuthenticationType"), out var __jsonAutomationAccountAuthenticationType) ? (string)__jsonAutomationAccountAuthenticationType : (string)AutomationAccountAuthenticationType;} + {_scheduleName = If( json?.PropertyT("scheduleName"), out var __jsonScheduleName) ? (string)__jsonScheduleName : (string)ScheduleName;} + {_jobScheduleName = If( json?.PropertyT("jobScheduleName"), out var __jsonJobScheduleName) ? (string)__jsonJobScheduleName : (string)JobScheduleName;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionContainerMappingDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionContainerMappingDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionContainerMappingDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new A2AProtectionContainerMappingDetails(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __protectionContainerMappingProviderSpecificDetails?.ToJson(container, serializationMode); + AddIf( null != (((object)this._agentAutoUpdateStatus)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._agentAutoUpdateStatus.ToString()) : null, "agentAutoUpdateStatus" ,container.Add ); + AddIf( null != (((object)this._automationAccountArmId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._automationAccountArmId.ToString()) : null, "automationAccountArmId" ,container.Add ); + AddIf( null != (((object)this._automationAccountAuthenticationType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._automationAccountAuthenticationType.ToString()) : null, "automationAccountAuthenticationType" ,container.Add ); + AddIf( null != (((object)this._scheduleName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._scheduleName.ToString()) : null, "scheduleName" ,container.Add ); + AddIf( null != (((object)this._jobScheduleName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._jobScheduleName.ToString()) : null, "jobScheduleName" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AProtectionIntentDiskInputDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AProtectionIntentDiskInputDetails.PowerShell.cs new file mode 100644 index 000000000000..4dbe1d8e6ce9 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AProtectionIntentDiskInputDetails.PowerShell.cs @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Azure VM unmanaged disk input details. + [System.ComponentModel.TypeConverter(typeof(A2AProtectionIntentDiskInputDetailsTypeConverter))] + public partial class A2AProtectionIntentDiskInputDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal A2AProtectionIntentDiskInputDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("RecoveryAzureStorageAccountCustomInput")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentDiskInputDetailsInternal)this).RecoveryAzureStorageAccountCustomInput = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageAccountCustomDetails) content.GetValueForProperty("RecoveryAzureStorageAccountCustomInput",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentDiskInputDetailsInternal)this).RecoveryAzureStorageAccountCustomInput, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.StorageAccountCustomDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("PrimaryStagingStorageAccountCustomInput")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentDiskInputDetailsInternal)this).PrimaryStagingStorageAccountCustomInput = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageAccountCustomDetails) content.GetValueForProperty("PrimaryStagingStorageAccountCustomInput",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentDiskInputDetailsInternal)this).PrimaryStagingStorageAccountCustomInput, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.StorageAccountCustomDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("DiskUri")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentDiskInputDetailsInternal)this).DiskUri = (string) content.GetValueForProperty("DiskUri",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentDiskInputDetailsInternal)this).DiskUri, global::System.Convert.ToString); + } + if (content.Contains("RecoveryAzureStorageAccountCustomInputResourceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentDiskInputDetailsInternal)this).RecoveryAzureStorageAccountCustomInputResourceType = (string) content.GetValueForProperty("RecoveryAzureStorageAccountCustomInputResourceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentDiskInputDetailsInternal)this).RecoveryAzureStorageAccountCustomInputResourceType, global::System.Convert.ToString); + } + if (content.Contains("PrimaryStagingStorageAccountCustomInputResourceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentDiskInputDetailsInternal)this).PrimaryStagingStorageAccountCustomInputResourceType = (string) content.GetValueForProperty("PrimaryStagingStorageAccountCustomInputResourceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentDiskInputDetailsInternal)this).PrimaryStagingStorageAccountCustomInputResourceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal A2AProtectionIntentDiskInputDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("RecoveryAzureStorageAccountCustomInput")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentDiskInputDetailsInternal)this).RecoveryAzureStorageAccountCustomInput = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageAccountCustomDetails) content.GetValueForProperty("RecoveryAzureStorageAccountCustomInput",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentDiskInputDetailsInternal)this).RecoveryAzureStorageAccountCustomInput, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.StorageAccountCustomDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("PrimaryStagingStorageAccountCustomInput")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentDiskInputDetailsInternal)this).PrimaryStagingStorageAccountCustomInput = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageAccountCustomDetails) content.GetValueForProperty("PrimaryStagingStorageAccountCustomInput",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentDiskInputDetailsInternal)this).PrimaryStagingStorageAccountCustomInput, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.StorageAccountCustomDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("DiskUri")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentDiskInputDetailsInternal)this).DiskUri = (string) content.GetValueForProperty("DiskUri",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentDiskInputDetailsInternal)this).DiskUri, global::System.Convert.ToString); + } + if (content.Contains("RecoveryAzureStorageAccountCustomInputResourceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentDiskInputDetailsInternal)this).RecoveryAzureStorageAccountCustomInputResourceType = (string) content.GetValueForProperty("RecoveryAzureStorageAccountCustomInputResourceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentDiskInputDetailsInternal)this).RecoveryAzureStorageAccountCustomInputResourceType, global::System.Convert.ToString); + } + if (content.Contains("PrimaryStagingStorageAccountCustomInputResourceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentDiskInputDetailsInternal)this).PrimaryStagingStorageAccountCustomInputResourceType = (string) content.GetValueForProperty("PrimaryStagingStorageAccountCustomInputResourceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentDiskInputDetailsInternal)this).PrimaryStagingStorageAccountCustomInputResourceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentDiskInputDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new A2AProtectionIntentDiskInputDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentDiskInputDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new A2AProtectionIntentDiskInputDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentDiskInputDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Azure VM unmanaged disk input details. + [System.ComponentModel.TypeConverter(typeof(A2AProtectionIntentDiskInputDetailsTypeConverter))] + public partial interface IA2AProtectionIntentDiskInputDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AProtectionIntentDiskInputDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AProtectionIntentDiskInputDetails.TypeConverter.cs new file mode 100644 index 000000000000..9960b2b09410 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AProtectionIntentDiskInputDetails.TypeConverter.cs @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class A2AProtectionIntentDiskInputDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentDiskInputDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentDiskInputDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return A2AProtectionIntentDiskInputDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return A2AProtectionIntentDiskInputDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return A2AProtectionIntentDiskInputDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AProtectionIntentDiskInputDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AProtectionIntentDiskInputDetails.cs new file mode 100644 index 000000000000..17ba0094c073 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AProtectionIntentDiskInputDetails.cs @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Azure VM unmanaged disk input details. + public partial class A2AProtectionIntentDiskInputDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentDiskInputDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentDiskInputDetailsInternal + { + + /// Backing field for property. + private string _diskUri; + + /// The disk Uri. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string DiskUri { get => this._diskUri; set => this._diskUri = value; } + + /// Internal Acessors for PrimaryStagingStorageAccountCustomInput + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageAccountCustomDetails Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentDiskInputDetailsInternal.PrimaryStagingStorageAccountCustomInput { get => (this._primaryStagingStorageAccountCustomInput = this._primaryStagingStorageAccountCustomInput ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.StorageAccountCustomDetails()); set { {_primaryStagingStorageAccountCustomInput = value;} } } + + /// Internal Acessors for RecoveryAzureStorageAccountCustomInput + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageAccountCustomDetails Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentDiskInputDetailsInternal.RecoveryAzureStorageAccountCustomInput { get => (this._recoveryAzureStorageAccountCustomInput = this._recoveryAzureStorageAccountCustomInput ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.StorageAccountCustomDetails()); set { {_recoveryAzureStorageAccountCustomInput = value;} } } + + /// + /// Backing field for property. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageAccountCustomDetails _primaryStagingStorageAccountCustomInput; + + /// The primary staging storage account input. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageAccountCustomDetails PrimaryStagingStorageAccountCustomInput { get => (this._primaryStagingStorageAccountCustomInput = this._primaryStagingStorageAccountCustomInput ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.StorageAccountCustomDetails()); set => this._primaryStagingStorageAccountCustomInput = value; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string PrimaryStagingStorageAccountCustomInputResourceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageAccountCustomDetailsInternal)PrimaryStagingStorageAccountCustomInput).ResourceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageAccountCustomDetailsInternal)PrimaryStagingStorageAccountCustomInput).ResourceType = value ?? null; } + + /// + /// Backing field for property. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageAccountCustomDetails _recoveryAzureStorageAccountCustomInput; + + /// The recovery VHD storage account input. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageAccountCustomDetails RecoveryAzureStorageAccountCustomInput { get => (this._recoveryAzureStorageAccountCustomInput = this._recoveryAzureStorageAccountCustomInput ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.StorageAccountCustomDetails()); set => this._recoveryAzureStorageAccountCustomInput = value; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string RecoveryAzureStorageAccountCustomInputResourceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageAccountCustomDetailsInternal)RecoveryAzureStorageAccountCustomInput).ResourceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageAccountCustomDetailsInternal)RecoveryAzureStorageAccountCustomInput).ResourceType = value ?? null; } + + /// Creates an new instance. + public A2AProtectionIntentDiskInputDetails() + { + + } + } + /// Azure VM unmanaged disk input details. + public partial interface IA2AProtectionIntentDiskInputDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The disk Uri. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The disk Uri.", + SerializedName = @"diskUri", + PossibleTypes = new [] { typeof(string) })] + string DiskUri { get; set; } + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"resourceType", + PossibleTypes = new [] { typeof(string) })] + string PrimaryStagingStorageAccountCustomInputResourceType { get; set; } + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"resourceType", + PossibleTypes = new [] { typeof(string) })] + string RecoveryAzureStorageAccountCustomInputResourceType { get; set; } + + } + /// Azure VM unmanaged disk input details. + internal partial interface IA2AProtectionIntentDiskInputDetailsInternal + + { + /// The disk Uri. + string DiskUri { get; set; } + /// The primary staging storage account input. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageAccountCustomDetails PrimaryStagingStorageAccountCustomInput { get; set; } + /// The class type. + string PrimaryStagingStorageAccountCustomInputResourceType { get; set; } + /// The recovery VHD storage account input. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageAccountCustomDetails RecoveryAzureStorageAccountCustomInput { get; set; } + /// The class type. + string RecoveryAzureStorageAccountCustomInputResourceType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AProtectionIntentDiskInputDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AProtectionIntentDiskInputDetails.json.cs new file mode 100644 index 000000000000..31d7ede4d4a1 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AProtectionIntentDiskInputDetails.json.cs @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Azure VM unmanaged disk input details. + public partial class A2AProtectionIntentDiskInputDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal A2AProtectionIntentDiskInputDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_recoveryAzureStorageAccountCustomInput = If( json?.PropertyT("recoveryAzureStorageAccountCustomInput"), out var __jsonRecoveryAzureStorageAccountCustomInput) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.StorageAccountCustomDetails.FromJson(__jsonRecoveryAzureStorageAccountCustomInput) : RecoveryAzureStorageAccountCustomInput;} + {_primaryStagingStorageAccountCustomInput = If( json?.PropertyT("primaryStagingStorageAccountCustomInput"), out var __jsonPrimaryStagingStorageAccountCustomInput) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.StorageAccountCustomDetails.FromJson(__jsonPrimaryStagingStorageAccountCustomInput) : PrimaryStagingStorageAccountCustomInput;} + {_diskUri = If( json?.PropertyT("diskUri"), out var __jsonDiskUri) ? (string)__jsonDiskUri : (string)DiskUri;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentDiskInputDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentDiskInputDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentDiskInputDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new A2AProtectionIntentDiskInputDetails(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._recoveryAzureStorageAccountCustomInput ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._recoveryAzureStorageAccountCustomInput.ToJson(null,serializationMode) : null, "recoveryAzureStorageAccountCustomInput" ,container.Add ); + AddIf( null != this._primaryStagingStorageAccountCustomInput ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._primaryStagingStorageAccountCustomInput.ToJson(null,serializationMode) : null, "primaryStagingStorageAccountCustomInput" ,container.Add ); + AddIf( null != (((object)this._diskUri)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._diskUri.ToString()) : null, "diskUri" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AProtectionIntentManagedDiskInputDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AProtectionIntentManagedDiskInputDetails.PowerShell.cs new file mode 100644 index 000000000000..5cb364d5cce4 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AProtectionIntentManagedDiskInputDetails.PowerShell.cs @@ -0,0 +1,261 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Azure VM managed disk input details. + [System.ComponentModel.TypeConverter(typeof(A2AProtectionIntentManagedDiskInputDetailsTypeConverter))] + public partial class A2AProtectionIntentManagedDiskInputDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal A2AProtectionIntentManagedDiskInputDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("PrimaryStagingStorageAccountCustomInput")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentManagedDiskInputDetailsInternal)this).PrimaryStagingStorageAccountCustomInput = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageAccountCustomDetails) content.GetValueForProperty("PrimaryStagingStorageAccountCustomInput",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentManagedDiskInputDetailsInternal)this).PrimaryStagingStorageAccountCustomInput, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.StorageAccountCustomDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("RecoveryResourceGroupCustomInput")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentManagedDiskInputDetailsInternal)this).RecoveryResourceGroupCustomInput = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryResourceGroupCustomDetails) content.GetValueForProperty("RecoveryResourceGroupCustomInput",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentManagedDiskInputDetailsInternal)this).RecoveryResourceGroupCustomInput, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryResourceGroupCustomDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("DiskEncryptionInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentManagedDiskInputDetailsInternal)this).DiskEncryptionInfo = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfo) content.GetValueForProperty("DiskEncryptionInfo",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentManagedDiskInputDetailsInternal)this).DiskEncryptionInfo, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DiskEncryptionInfoTypeConverter.ConvertFrom); + } + if (content.Contains("DiskId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentManagedDiskInputDetailsInternal)this).DiskId = (string) content.GetValueForProperty("DiskId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentManagedDiskInputDetailsInternal)this).DiskId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryReplicaDiskAccountType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentManagedDiskInputDetailsInternal)this).RecoveryReplicaDiskAccountType = (string) content.GetValueForProperty("RecoveryReplicaDiskAccountType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentManagedDiskInputDetailsInternal)this).RecoveryReplicaDiskAccountType, global::System.Convert.ToString); + } + if (content.Contains("RecoveryTargetDiskAccountType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentManagedDiskInputDetailsInternal)this).RecoveryTargetDiskAccountType = (string) content.GetValueForProperty("RecoveryTargetDiskAccountType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentManagedDiskInputDetailsInternal)this).RecoveryTargetDiskAccountType, global::System.Convert.ToString); + } + if (content.Contains("RecoveryDiskEncryptionSetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentManagedDiskInputDetailsInternal)this).RecoveryDiskEncryptionSetId = (string) content.GetValueForProperty("RecoveryDiskEncryptionSetId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentManagedDiskInputDetailsInternal)this).RecoveryDiskEncryptionSetId, global::System.Convert.ToString); + } + if (content.Contains("PrimaryStagingStorageAccountCustomInputResourceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentManagedDiskInputDetailsInternal)this).PrimaryStagingStorageAccountCustomInputResourceType = (string) content.GetValueForProperty("PrimaryStagingStorageAccountCustomInputResourceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentManagedDiskInputDetailsInternal)this).PrimaryStagingStorageAccountCustomInputResourceType, global::System.Convert.ToString); + } + if (content.Contains("RecoveryResourceGroupCustomInputResourceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentManagedDiskInputDetailsInternal)this).RecoveryResourceGroupCustomInputResourceType = (string) content.GetValueForProperty("RecoveryResourceGroupCustomInputResourceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentManagedDiskInputDetailsInternal)this).RecoveryResourceGroupCustomInputResourceType, global::System.Convert.ToString); + } + if (content.Contains("DiskEncryptionInfoDiskEncryptionKeyInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentManagedDiskInputDetailsInternal)this).DiskEncryptionInfoDiskEncryptionKeyInfo = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionKeyInfo) content.GetValueForProperty("DiskEncryptionInfoDiskEncryptionKeyInfo",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentManagedDiskInputDetailsInternal)this).DiskEncryptionInfoDiskEncryptionKeyInfo, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DiskEncryptionKeyInfoTypeConverter.ConvertFrom); + } + if (content.Contains("DiskEncryptionInfoKeyEncryptionKeyInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentManagedDiskInputDetailsInternal)this).DiskEncryptionInfoKeyEncryptionKeyInfo = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IKeyEncryptionKeyInfo) content.GetValueForProperty("DiskEncryptionInfoKeyEncryptionKeyInfo",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentManagedDiskInputDetailsInternal)this).DiskEncryptionInfoKeyEncryptionKeyInfo, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.KeyEncryptionKeyInfoTypeConverter.ConvertFrom); + } + if (content.Contains("DiskEncryptionKeyInfoSecretIdentifier")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentManagedDiskInputDetailsInternal)this).DiskEncryptionKeyInfoSecretIdentifier = (string) content.GetValueForProperty("DiskEncryptionKeyInfoSecretIdentifier",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentManagedDiskInputDetailsInternal)this).DiskEncryptionKeyInfoSecretIdentifier, global::System.Convert.ToString); + } + if (content.Contains("KeyEncryptionKeyInfoKeyIdentifier")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentManagedDiskInputDetailsInternal)this).KeyEncryptionKeyInfoKeyIdentifier = (string) content.GetValueForProperty("KeyEncryptionKeyInfoKeyIdentifier",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentManagedDiskInputDetailsInternal)this).KeyEncryptionKeyInfoKeyIdentifier, global::System.Convert.ToString); + } + if (content.Contains("DiskEncryptionKeyInfoKeyVaultResourceArmId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentManagedDiskInputDetailsInternal)this).DiskEncryptionKeyInfoKeyVaultResourceArmId = (string) content.GetValueForProperty("DiskEncryptionKeyInfoKeyVaultResourceArmId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentManagedDiskInputDetailsInternal)this).DiskEncryptionKeyInfoKeyVaultResourceArmId, global::System.Convert.ToString); + } + if (content.Contains("KeyEncryptionKeyInfoKeyVaultResourceArmId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentManagedDiskInputDetailsInternal)this).KeyEncryptionKeyInfoKeyVaultResourceArmId = (string) content.GetValueForProperty("KeyEncryptionKeyInfoKeyVaultResourceArmId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentManagedDiskInputDetailsInternal)this).KeyEncryptionKeyInfoKeyVaultResourceArmId, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal A2AProtectionIntentManagedDiskInputDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("PrimaryStagingStorageAccountCustomInput")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentManagedDiskInputDetailsInternal)this).PrimaryStagingStorageAccountCustomInput = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageAccountCustomDetails) content.GetValueForProperty("PrimaryStagingStorageAccountCustomInput",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentManagedDiskInputDetailsInternal)this).PrimaryStagingStorageAccountCustomInput, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.StorageAccountCustomDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("RecoveryResourceGroupCustomInput")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentManagedDiskInputDetailsInternal)this).RecoveryResourceGroupCustomInput = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryResourceGroupCustomDetails) content.GetValueForProperty("RecoveryResourceGroupCustomInput",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentManagedDiskInputDetailsInternal)this).RecoveryResourceGroupCustomInput, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryResourceGroupCustomDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("DiskEncryptionInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentManagedDiskInputDetailsInternal)this).DiskEncryptionInfo = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfo) content.GetValueForProperty("DiskEncryptionInfo",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentManagedDiskInputDetailsInternal)this).DiskEncryptionInfo, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DiskEncryptionInfoTypeConverter.ConvertFrom); + } + if (content.Contains("DiskId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentManagedDiskInputDetailsInternal)this).DiskId = (string) content.GetValueForProperty("DiskId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentManagedDiskInputDetailsInternal)this).DiskId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryReplicaDiskAccountType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentManagedDiskInputDetailsInternal)this).RecoveryReplicaDiskAccountType = (string) content.GetValueForProperty("RecoveryReplicaDiskAccountType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentManagedDiskInputDetailsInternal)this).RecoveryReplicaDiskAccountType, global::System.Convert.ToString); + } + if (content.Contains("RecoveryTargetDiskAccountType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentManagedDiskInputDetailsInternal)this).RecoveryTargetDiskAccountType = (string) content.GetValueForProperty("RecoveryTargetDiskAccountType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentManagedDiskInputDetailsInternal)this).RecoveryTargetDiskAccountType, global::System.Convert.ToString); + } + if (content.Contains("RecoveryDiskEncryptionSetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentManagedDiskInputDetailsInternal)this).RecoveryDiskEncryptionSetId = (string) content.GetValueForProperty("RecoveryDiskEncryptionSetId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentManagedDiskInputDetailsInternal)this).RecoveryDiskEncryptionSetId, global::System.Convert.ToString); + } + if (content.Contains("PrimaryStagingStorageAccountCustomInputResourceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentManagedDiskInputDetailsInternal)this).PrimaryStagingStorageAccountCustomInputResourceType = (string) content.GetValueForProperty("PrimaryStagingStorageAccountCustomInputResourceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentManagedDiskInputDetailsInternal)this).PrimaryStagingStorageAccountCustomInputResourceType, global::System.Convert.ToString); + } + if (content.Contains("RecoveryResourceGroupCustomInputResourceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentManagedDiskInputDetailsInternal)this).RecoveryResourceGroupCustomInputResourceType = (string) content.GetValueForProperty("RecoveryResourceGroupCustomInputResourceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentManagedDiskInputDetailsInternal)this).RecoveryResourceGroupCustomInputResourceType, global::System.Convert.ToString); + } + if (content.Contains("DiskEncryptionInfoDiskEncryptionKeyInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentManagedDiskInputDetailsInternal)this).DiskEncryptionInfoDiskEncryptionKeyInfo = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionKeyInfo) content.GetValueForProperty("DiskEncryptionInfoDiskEncryptionKeyInfo",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentManagedDiskInputDetailsInternal)this).DiskEncryptionInfoDiskEncryptionKeyInfo, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DiskEncryptionKeyInfoTypeConverter.ConvertFrom); + } + if (content.Contains("DiskEncryptionInfoKeyEncryptionKeyInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentManagedDiskInputDetailsInternal)this).DiskEncryptionInfoKeyEncryptionKeyInfo = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IKeyEncryptionKeyInfo) content.GetValueForProperty("DiskEncryptionInfoKeyEncryptionKeyInfo",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentManagedDiskInputDetailsInternal)this).DiskEncryptionInfoKeyEncryptionKeyInfo, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.KeyEncryptionKeyInfoTypeConverter.ConvertFrom); + } + if (content.Contains("DiskEncryptionKeyInfoSecretIdentifier")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentManagedDiskInputDetailsInternal)this).DiskEncryptionKeyInfoSecretIdentifier = (string) content.GetValueForProperty("DiskEncryptionKeyInfoSecretIdentifier",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentManagedDiskInputDetailsInternal)this).DiskEncryptionKeyInfoSecretIdentifier, global::System.Convert.ToString); + } + if (content.Contains("KeyEncryptionKeyInfoKeyIdentifier")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentManagedDiskInputDetailsInternal)this).KeyEncryptionKeyInfoKeyIdentifier = (string) content.GetValueForProperty("KeyEncryptionKeyInfoKeyIdentifier",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentManagedDiskInputDetailsInternal)this).KeyEncryptionKeyInfoKeyIdentifier, global::System.Convert.ToString); + } + if (content.Contains("DiskEncryptionKeyInfoKeyVaultResourceArmId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentManagedDiskInputDetailsInternal)this).DiskEncryptionKeyInfoKeyVaultResourceArmId = (string) content.GetValueForProperty("DiskEncryptionKeyInfoKeyVaultResourceArmId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentManagedDiskInputDetailsInternal)this).DiskEncryptionKeyInfoKeyVaultResourceArmId, global::System.Convert.ToString); + } + if (content.Contains("KeyEncryptionKeyInfoKeyVaultResourceArmId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentManagedDiskInputDetailsInternal)this).KeyEncryptionKeyInfoKeyVaultResourceArmId = (string) content.GetValueForProperty("KeyEncryptionKeyInfoKeyVaultResourceArmId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentManagedDiskInputDetailsInternal)this).KeyEncryptionKeyInfoKeyVaultResourceArmId, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentManagedDiskInputDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new A2AProtectionIntentManagedDiskInputDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentManagedDiskInputDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new A2AProtectionIntentManagedDiskInputDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a + /// json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentManagedDiskInputDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Azure VM managed disk input details. + [System.ComponentModel.TypeConverter(typeof(A2AProtectionIntentManagedDiskInputDetailsTypeConverter))] + public partial interface IA2AProtectionIntentManagedDiskInputDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AProtectionIntentManagedDiskInputDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AProtectionIntentManagedDiskInputDetails.TypeConverter.cs new file mode 100644 index 000000000000..504d369fe714 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AProtectionIntentManagedDiskInputDetails.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class A2AProtectionIntentManagedDiskInputDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentManagedDiskInputDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentManagedDiskInputDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return A2AProtectionIntentManagedDiskInputDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return A2AProtectionIntentManagedDiskInputDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return A2AProtectionIntentManagedDiskInputDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AProtectionIntentManagedDiskInputDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AProtectionIntentManagedDiskInputDetails.cs new file mode 100644 index 000000000000..e2bd788fc3d9 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AProtectionIntentManagedDiskInputDetails.cs @@ -0,0 +1,248 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Azure VM managed disk input details. + public partial class A2AProtectionIntentManagedDiskInputDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentManagedDiskInputDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentManagedDiskInputDetailsInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfo _diskEncryptionInfo; + + /// The recovery disk encryption information (for one / single pass flows). + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfo DiskEncryptionInfo { get => (this._diskEncryptionInfo = this._diskEncryptionInfo ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DiskEncryptionInfo()); set => this._diskEncryptionInfo = value; } + + /// The KeyVault resource ARM id for secret. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string DiskEncryptionKeyInfoKeyVaultResourceArmId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)DiskEncryptionInfo).DiskEncryptionKeyInfoKeyVaultResourceArmId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)DiskEncryptionInfo).DiskEncryptionKeyInfoKeyVaultResourceArmId = value ?? null; } + + /// The secret url / identifier. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string DiskEncryptionKeyInfoSecretIdentifier { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)DiskEncryptionInfo).DiskEncryptionKeyInfoSecretIdentifier; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)DiskEncryptionInfo).DiskEncryptionKeyInfoSecretIdentifier = value ?? null; } + + /// Backing field for property. + private string _diskId; + + /// The disk Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string DiskId { get => this._diskId; set => this._diskId = value; } + + /// The key URL / identifier. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string KeyEncryptionKeyInfoKeyIdentifier { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)DiskEncryptionInfo).KeyEncryptionKeyInfoKeyIdentifier; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)DiskEncryptionInfo).KeyEncryptionKeyInfoKeyIdentifier = value ?? null; } + + /// The KeyVault resource ARM Id for key. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string KeyEncryptionKeyInfoKeyVaultResourceArmId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)DiskEncryptionInfo).KeyEncryptionKeyInfoKeyVaultResourceArmId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)DiskEncryptionInfo).KeyEncryptionKeyInfoKeyVaultResourceArmId = value ?? null; } + + /// Internal Acessors for DiskEncryptionInfo + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfo Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentManagedDiskInputDetailsInternal.DiskEncryptionInfo { get => (this._diskEncryptionInfo = this._diskEncryptionInfo ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DiskEncryptionInfo()); set { {_diskEncryptionInfo = value;} } } + + /// Internal Acessors for DiskEncryptionInfoDiskEncryptionKeyInfo + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionKeyInfo Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentManagedDiskInputDetailsInternal.DiskEncryptionInfoDiskEncryptionKeyInfo { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)DiskEncryptionInfo).DiskEncryptionKeyInfo; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)DiskEncryptionInfo).DiskEncryptionKeyInfo = value; } + + /// Internal Acessors for DiskEncryptionInfoKeyEncryptionKeyInfo + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IKeyEncryptionKeyInfo Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentManagedDiskInputDetailsInternal.DiskEncryptionInfoKeyEncryptionKeyInfo { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)DiskEncryptionInfo).KeyEncryptionKeyInfo; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)DiskEncryptionInfo).KeyEncryptionKeyInfo = value; } + + /// Internal Acessors for PrimaryStagingStorageAccountCustomInput + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageAccountCustomDetails Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentManagedDiskInputDetailsInternal.PrimaryStagingStorageAccountCustomInput { get => (this._primaryStagingStorageAccountCustomInput = this._primaryStagingStorageAccountCustomInput ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.StorageAccountCustomDetails()); set { {_primaryStagingStorageAccountCustomInput = value;} } } + + /// Internal Acessors for RecoveryResourceGroupCustomInput + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryResourceGroupCustomDetails Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentManagedDiskInputDetailsInternal.RecoveryResourceGroupCustomInput { get => (this._recoveryResourceGroupCustomInput = this._recoveryResourceGroupCustomInput ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryResourceGroupCustomDetails()); set { {_recoveryResourceGroupCustomInput = value;} } } + + /// + /// Backing field for property. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageAccountCustomDetails _primaryStagingStorageAccountCustomInput; + + /// The primary staging storage account input. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageAccountCustomDetails PrimaryStagingStorageAccountCustomInput { get => (this._primaryStagingStorageAccountCustomInput = this._primaryStagingStorageAccountCustomInput ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.StorageAccountCustomDetails()); set => this._primaryStagingStorageAccountCustomInput = value; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string PrimaryStagingStorageAccountCustomInputResourceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageAccountCustomDetailsInternal)PrimaryStagingStorageAccountCustomInput).ResourceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageAccountCustomDetailsInternal)PrimaryStagingStorageAccountCustomInput).ResourceType = value ?? null; } + + /// Backing field for property. + private string _recoveryDiskEncryptionSetId; + + /// The recovery disk encryption set Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryDiskEncryptionSetId { get => this._recoveryDiskEncryptionSetId; set => this._recoveryDiskEncryptionSetId = value; } + + /// Backing field for property. + private string _recoveryReplicaDiskAccountType; + + /// + /// The replica disk type. Its an optional value and will be same as source disk type if not user provided. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryReplicaDiskAccountType { get => this._recoveryReplicaDiskAccountType; set => this._recoveryReplicaDiskAccountType = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryResourceGroupCustomDetails _recoveryResourceGroupCustomInput; + + /// The recovery resource group input. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryResourceGroupCustomDetails RecoveryResourceGroupCustomInput { get => (this._recoveryResourceGroupCustomInput = this._recoveryResourceGroupCustomInput ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryResourceGroupCustomDetails()); set => this._recoveryResourceGroupCustomInput = value; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string RecoveryResourceGroupCustomInputResourceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryResourceGroupCustomDetailsInternal)RecoveryResourceGroupCustomInput).ResourceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryResourceGroupCustomDetailsInternal)RecoveryResourceGroupCustomInput).ResourceType = value ?? null; } + + /// Backing field for property. + private string _recoveryTargetDiskAccountType; + + /// + /// The target disk type after failover. Its an optional value and will be same as source disk type if not user provided. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryTargetDiskAccountType { get => this._recoveryTargetDiskAccountType; set => this._recoveryTargetDiskAccountType = value; } + + /// + /// Creates an new instance. + /// + public A2AProtectionIntentManagedDiskInputDetails() + { + + } + } + /// Azure VM managed disk input details. + public partial interface IA2AProtectionIntentManagedDiskInputDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The KeyVault resource ARM id for secret. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The KeyVault resource ARM id for secret.", + SerializedName = @"keyVaultResourceArmId", + PossibleTypes = new [] { typeof(string) })] + string DiskEncryptionKeyInfoKeyVaultResourceArmId { get; set; } + /// The secret url / identifier. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The secret url / identifier.", + SerializedName = @"secretIdentifier", + PossibleTypes = new [] { typeof(string) })] + string DiskEncryptionKeyInfoSecretIdentifier { get; set; } + /// The disk Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The disk Id.", + SerializedName = @"diskId", + PossibleTypes = new [] { typeof(string) })] + string DiskId { get; set; } + /// The key URL / identifier. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The key URL / identifier.", + SerializedName = @"keyIdentifier", + PossibleTypes = new [] { typeof(string) })] + string KeyEncryptionKeyInfoKeyIdentifier { get; set; } + /// The KeyVault resource ARM Id for key. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The KeyVault resource ARM Id for key.", + SerializedName = @"keyVaultResourceArmId", + PossibleTypes = new [] { typeof(string) })] + string KeyEncryptionKeyInfoKeyVaultResourceArmId { get; set; } + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"resourceType", + PossibleTypes = new [] { typeof(string) })] + string PrimaryStagingStorageAccountCustomInputResourceType { get; set; } + /// The recovery disk encryption set Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery disk encryption set Id.", + SerializedName = @"recoveryDiskEncryptionSetId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryDiskEncryptionSetId { get; set; } + /// + /// The replica disk type. Its an optional value and will be same as source disk type if not user provided. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The replica disk type. Its an optional value and will be same as source disk type if not user provided.", + SerializedName = @"recoveryReplicaDiskAccountType", + PossibleTypes = new [] { typeof(string) })] + string RecoveryReplicaDiskAccountType { get; set; } + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"resourceType", + PossibleTypes = new [] { typeof(string) })] + string RecoveryResourceGroupCustomInputResourceType { get; set; } + /// + /// The target disk type after failover. Its an optional value and will be same as source disk type if not user provided. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target disk type after failover. Its an optional value and will be same as source disk type if not user provided.", + SerializedName = @"recoveryTargetDiskAccountType", + PossibleTypes = new [] { typeof(string) })] + string RecoveryTargetDiskAccountType { get; set; } + + } + /// Azure VM managed disk input details. + internal partial interface IA2AProtectionIntentManagedDiskInputDetailsInternal + + { + /// The recovery disk encryption information (for one / single pass flows). + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfo DiskEncryptionInfo { get; set; } + /// The recovery KeyVault reference for secret. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionKeyInfo DiskEncryptionInfoDiskEncryptionKeyInfo { get; set; } + /// The recovery KeyVault reference for key. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IKeyEncryptionKeyInfo DiskEncryptionInfoKeyEncryptionKeyInfo { get; set; } + /// The KeyVault resource ARM id for secret. + string DiskEncryptionKeyInfoKeyVaultResourceArmId { get; set; } + /// The secret url / identifier. + string DiskEncryptionKeyInfoSecretIdentifier { get; set; } + /// The disk Id. + string DiskId { get; set; } + /// The key URL / identifier. + string KeyEncryptionKeyInfoKeyIdentifier { get; set; } + /// The KeyVault resource ARM Id for key. + string KeyEncryptionKeyInfoKeyVaultResourceArmId { get; set; } + /// The primary staging storage account input. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageAccountCustomDetails PrimaryStagingStorageAccountCustomInput { get; set; } + /// The class type. + string PrimaryStagingStorageAccountCustomInputResourceType { get; set; } + /// The recovery disk encryption set Id. + string RecoveryDiskEncryptionSetId { get; set; } + /// + /// The replica disk type. Its an optional value and will be same as source disk type if not user provided. + /// + string RecoveryReplicaDiskAccountType { get; set; } + /// The recovery resource group input. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryResourceGroupCustomDetails RecoveryResourceGroupCustomInput { get; set; } + /// The class type. + string RecoveryResourceGroupCustomInputResourceType { get; set; } + /// + /// The target disk type after failover. Its an optional value and will be same as source disk type if not user provided. + /// + string RecoveryTargetDiskAccountType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AProtectionIntentManagedDiskInputDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AProtectionIntentManagedDiskInputDetails.json.cs new file mode 100644 index 000000000000..bc47ff3793b4 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AProtectionIntentManagedDiskInputDetails.json.cs @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Azure VM managed disk input details. + public partial class A2AProtectionIntentManagedDiskInputDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal A2AProtectionIntentManagedDiskInputDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_primaryStagingStorageAccountCustomInput = If( json?.PropertyT("primaryStagingStorageAccountCustomInput"), out var __jsonPrimaryStagingStorageAccountCustomInput) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.StorageAccountCustomDetails.FromJson(__jsonPrimaryStagingStorageAccountCustomInput) : PrimaryStagingStorageAccountCustomInput;} + {_recoveryResourceGroupCustomInput = If( json?.PropertyT("recoveryResourceGroupCustomInput"), out var __jsonRecoveryResourceGroupCustomInput) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryResourceGroupCustomDetails.FromJson(__jsonRecoveryResourceGroupCustomInput) : RecoveryResourceGroupCustomInput;} + {_diskEncryptionInfo = If( json?.PropertyT("diskEncryptionInfo"), out var __jsonDiskEncryptionInfo) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DiskEncryptionInfo.FromJson(__jsonDiskEncryptionInfo) : DiskEncryptionInfo;} + {_diskId = If( json?.PropertyT("diskId"), out var __jsonDiskId) ? (string)__jsonDiskId : (string)DiskId;} + {_recoveryReplicaDiskAccountType = If( json?.PropertyT("recoveryReplicaDiskAccountType"), out var __jsonRecoveryReplicaDiskAccountType) ? (string)__jsonRecoveryReplicaDiskAccountType : (string)RecoveryReplicaDiskAccountType;} + {_recoveryTargetDiskAccountType = If( json?.PropertyT("recoveryTargetDiskAccountType"), out var __jsonRecoveryTargetDiskAccountType) ? (string)__jsonRecoveryTargetDiskAccountType : (string)RecoveryTargetDiskAccountType;} + {_recoveryDiskEncryptionSetId = If( json?.PropertyT("recoveryDiskEncryptionSetId"), out var __jsonRecoveryDiskEncryptionSetId) ? (string)__jsonRecoveryDiskEncryptionSetId : (string)RecoveryDiskEncryptionSetId;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentManagedDiskInputDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentManagedDiskInputDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentManagedDiskInputDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new A2AProtectionIntentManagedDiskInputDetails(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._primaryStagingStorageAccountCustomInput ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._primaryStagingStorageAccountCustomInput.ToJson(null,serializationMode) : null, "primaryStagingStorageAccountCustomInput" ,container.Add ); + AddIf( null != this._recoveryResourceGroupCustomInput ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._recoveryResourceGroupCustomInput.ToJson(null,serializationMode) : null, "recoveryResourceGroupCustomInput" ,container.Add ); + AddIf( null != this._diskEncryptionInfo ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._diskEncryptionInfo.ToJson(null,serializationMode) : null, "diskEncryptionInfo" ,container.Add ); + AddIf( null != (((object)this._diskId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._diskId.ToString()) : null, "diskId" ,container.Add ); + AddIf( null != (((object)this._recoveryReplicaDiskAccountType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryReplicaDiskAccountType.ToString()) : null, "recoveryReplicaDiskAccountType" ,container.Add ); + AddIf( null != (((object)this._recoveryTargetDiskAccountType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryTargetDiskAccountType.ToString()) : null, "recoveryTargetDiskAccountType" ,container.Add ); + AddIf( null != (((object)this._recoveryDiskEncryptionSetId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryDiskEncryptionSetId.ToString()) : null, "recoveryDiskEncryptionSetId" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ARecoveryPointDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ARecoveryPointDetails.PowerShell.cs new file mode 100644 index 000000000000..3d268c6cac94 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ARecoveryPointDetails.PowerShell.cs @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// A2A provider specific recovery point details. + [System.ComponentModel.TypeConverter(typeof(A2ARecoveryPointDetailsTypeConverter))] + public partial class A2ARecoveryPointDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal A2ARecoveryPointDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("RecoveryPointSyncType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ARecoveryPointDetailsInternal)this).RecoveryPointSyncType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPointSyncType?) content.GetValueForProperty("RecoveryPointSyncType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ARecoveryPointDetailsInternal)this).RecoveryPointSyncType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPointSyncType.CreateFrom); + } + if (content.Contains("Disk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ARecoveryPointDetailsInternal)this).Disk = (string[]) content.GetValueForProperty("Disk",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ARecoveryPointDetailsInternal)this).Disk, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProviderSpecificRecoveryPointDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProviderSpecificRecoveryPointDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal A2ARecoveryPointDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("RecoveryPointSyncType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ARecoveryPointDetailsInternal)this).RecoveryPointSyncType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPointSyncType?) content.GetValueForProperty("RecoveryPointSyncType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ARecoveryPointDetailsInternal)this).RecoveryPointSyncType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPointSyncType.CreateFrom); + } + if (content.Contains("Disk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ARecoveryPointDetailsInternal)this).Disk = (string[]) content.GetValueForProperty("Disk",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ARecoveryPointDetailsInternal)this).Disk, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProviderSpecificRecoveryPointDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProviderSpecificRecoveryPointDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ARecoveryPointDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new A2ARecoveryPointDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ARecoveryPointDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new A2ARecoveryPointDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ARecoveryPointDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// A2A provider specific recovery point details. + [System.ComponentModel.TypeConverter(typeof(A2ARecoveryPointDetailsTypeConverter))] + public partial interface IA2ARecoveryPointDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ARecoveryPointDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ARecoveryPointDetails.TypeConverter.cs new file mode 100644 index 000000000000..eed8f40f0abd --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ARecoveryPointDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class A2ARecoveryPointDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ARecoveryPointDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ARecoveryPointDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return A2ARecoveryPointDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return A2ARecoveryPointDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return A2ARecoveryPointDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ARecoveryPointDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ARecoveryPointDetails.cs new file mode 100644 index 000000000000..7f13cf3ef6cf --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ARecoveryPointDetails.cs @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// A2A provider specific recovery point details. + public partial class A2ARecoveryPointDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ARecoveryPointDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ARecoveryPointDetailsInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProviderSpecificRecoveryPointDetails __providerSpecificRecoveryPointDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProviderSpecificRecoveryPointDetails(); + + /// Backing field for property. + private string[] _disk; + + /// List of disk ids representing a recovery point. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string[] Disk { get => this._disk; set => this._disk = value; } + + /// Gets the provider type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProviderSpecificRecoveryPointDetailsInternal)__providerSpecificRecoveryPointDetails).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProviderSpecificRecoveryPointDetailsInternal)__providerSpecificRecoveryPointDetails).InstanceType = value ; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPointSyncType? _recoveryPointSyncType; + + /// A value indicating whether the recovery point is multi VM consistent. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPointSyncType? RecoveryPointSyncType { get => this._recoveryPointSyncType; set => this._recoveryPointSyncType = value; } + + /// Creates an new instance. + public A2ARecoveryPointDetails() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__providerSpecificRecoveryPointDetails), __providerSpecificRecoveryPointDetails); + await eventListener.AssertObjectIsValid(nameof(__providerSpecificRecoveryPointDetails), __providerSpecificRecoveryPointDetails); + } + } + /// A2A provider specific recovery point details. + public partial interface IA2ARecoveryPointDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProviderSpecificRecoveryPointDetails + { + /// List of disk ids representing a recovery point. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"List of disk ids representing a recovery point.", + SerializedName = @"disks", + PossibleTypes = new [] { typeof(string) })] + string[] Disk { get; set; } + /// A value indicating whether the recovery point is multi VM consistent. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether the recovery point is multi VM consistent.", + SerializedName = @"recoveryPointSyncType", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPointSyncType) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPointSyncType? RecoveryPointSyncType { get; set; } + + } + /// A2A provider specific recovery point details. + internal partial interface IA2ARecoveryPointDetailsInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProviderSpecificRecoveryPointDetailsInternal + { + /// List of disk ids representing a recovery point. + string[] Disk { get; set; } + /// A value indicating whether the recovery point is multi VM consistent. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPointSyncType? RecoveryPointSyncType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ARecoveryPointDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ARecoveryPointDetails.json.cs new file mode 100644 index 000000000000..cfb5f444759f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ARecoveryPointDetails.json.cs @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// A2A provider specific recovery point details. + public partial class A2ARecoveryPointDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal A2ARecoveryPointDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __providerSpecificRecoveryPointDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProviderSpecificRecoveryPointDetails(json); + {_recoveryPointSyncType = If( json?.PropertyT("recoveryPointSyncType"), out var __jsonRecoveryPointSyncType) ? (string)__jsonRecoveryPointSyncType : (string)RecoveryPointSyncType;} + {_disk = If( json?.PropertyT("disks"), out var __jsonDisks) ? If( __jsonDisks as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(string) (__u is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : Disk;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ARecoveryPointDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ARecoveryPointDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ARecoveryPointDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new A2ARecoveryPointDetails(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __providerSpecificRecoveryPointDetails?.ToJson(container, serializationMode); + AddIf( null != (((object)this._recoveryPointSyncType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryPointSyncType.ToString()) : null, "recoveryPointSyncType" ,container.Add ); + if (null != this._disk) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._disk ) + { + AddIf(null != (((object)__x)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(__x.ToString()) : null ,__w.Add); + } + container.Add("disks",__w); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ARemoveDisksInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ARemoveDisksInput.PowerShell.cs new file mode 100644 index 000000000000..9fcca20265f4 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ARemoveDisksInput.PowerShell.cs @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// A2A remove disk(s) input. + [System.ComponentModel.TypeConverter(typeof(A2ARemoveDisksInputTypeConverter))] + public partial class A2ARemoveDisksInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal A2ARemoveDisksInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("VMDisksUri")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ARemoveDisksInputInternal)this).VMDisksUri = (string[]) content.GetValueForProperty("VMDisksUri",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ARemoveDisksInputInternal)this).VMDisksUri, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("VMManagedDisksId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ARemoveDisksInputInternal)this).VMManagedDisksId = (string[]) content.GetValueForProperty("VMManagedDisksId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ARemoveDisksInputInternal)this).VMManagedDisksId, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal A2ARemoveDisksInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("VMDisksUri")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ARemoveDisksInputInternal)this).VMDisksUri = (string[]) content.GetValueForProperty("VMDisksUri",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ARemoveDisksInputInternal)this).VMDisksUri, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("VMManagedDisksId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ARemoveDisksInputInternal)this).VMManagedDisksId = (string[]) content.GetValueForProperty("VMManagedDisksId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ARemoveDisksInputInternal)this).VMManagedDisksId, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ARemoveDisksInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new A2ARemoveDisksInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ARemoveDisksInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new A2ARemoveDisksInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ARemoveDisksInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// A2A remove disk(s) input. + [System.ComponentModel.TypeConverter(typeof(A2ARemoveDisksInputTypeConverter))] + public partial interface IA2ARemoveDisksInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ARemoveDisksInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ARemoveDisksInput.TypeConverter.cs new file mode 100644 index 000000000000..2a0e4c75cd48 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ARemoveDisksInput.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class A2ARemoveDisksInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ARemoveDisksInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ARemoveDisksInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return A2ARemoveDisksInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return A2ARemoveDisksInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return A2ARemoveDisksInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ARemoveDisksInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ARemoveDisksInput.cs new file mode 100644 index 000000000000..83448536c541 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ARemoveDisksInput.cs @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// A2A remove disk(s) input. + public partial class A2ARemoveDisksInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ARemoveDisksInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ARemoveDisksInputInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksProviderSpecificInput __removeDisksProviderSpecificInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RemoveDisksProviderSpecificInput(); + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksProviderSpecificInputInternal)__removeDisksProviderSpecificInput).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksProviderSpecificInputInternal)__removeDisksProviderSpecificInput).InstanceType = value ; } + + /// Backing field for property. + private string[] _vMDisksUri; + + /// The list of vm disk vhd URIs. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string[] VMDisksUri { get => this._vMDisksUri; set => this._vMDisksUri = value; } + + /// Backing field for property. + private string[] _vMManagedDisksId; + + /// The list of vm managed disk Ids. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string[] VMManagedDisksId { get => this._vMManagedDisksId; set => this._vMManagedDisksId = value; } + + /// Creates an new instance. + public A2ARemoveDisksInput() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__removeDisksProviderSpecificInput), __removeDisksProviderSpecificInput); + await eventListener.AssertObjectIsValid(nameof(__removeDisksProviderSpecificInput), __removeDisksProviderSpecificInput); + } + } + /// A2A remove disk(s) input. + public partial interface IA2ARemoveDisksInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksProviderSpecificInput + { + /// The list of vm disk vhd URIs. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of vm disk vhd URIs.", + SerializedName = @"vmDisksUris", + PossibleTypes = new [] { typeof(string) })] + string[] VMDisksUri { get; set; } + /// The list of vm managed disk Ids. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of vm managed disk Ids.", + SerializedName = @"vmManagedDisksIds", + PossibleTypes = new [] { typeof(string) })] + string[] VMManagedDisksId { get; set; } + + } + /// A2A remove disk(s) input. + internal partial interface IA2ARemoveDisksInputInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksProviderSpecificInputInternal + { + /// The list of vm disk vhd URIs. + string[] VMDisksUri { get; set; } + /// The list of vm managed disk Ids. + string[] VMManagedDisksId { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ARemoveDisksInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ARemoveDisksInput.json.cs new file mode 100644 index 000000000000..7528fa4d2470 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ARemoveDisksInput.json.cs @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// A2A remove disk(s) input. + public partial class A2ARemoveDisksInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal A2ARemoveDisksInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __removeDisksProviderSpecificInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RemoveDisksProviderSpecificInput(json); + {_vMDisksUri = If( json?.PropertyT("vmDisksUris"), out var __jsonVMDisksUris) ? If( __jsonVMDisksUris as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(string) (__u is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : VMDisksUri;} + {_vMManagedDisksId = If( json?.PropertyT("vmManagedDisksIds"), out var __jsonVMManagedDisksIds) ? If( __jsonVMManagedDisksIds as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __q) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__q, (__p)=>(string) (__p is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString __o ? (string)(__o.ToString()) : null)) ))() : null : VMManagedDisksId;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ARemoveDisksInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ARemoveDisksInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ARemoveDisksInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new A2ARemoveDisksInput(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __removeDisksProviderSpecificInput?.ToJson(container, serializationMode); + if (null != this._vMDisksUri) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._vMDisksUri ) + { + AddIf(null != (((object)__x)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(__x.ToString()) : null ,__w.Add); + } + container.Add("vmDisksUris",__w); + } + if (null != this._vMManagedDisksId) + { + var __r = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __s in this._vMManagedDisksId ) + { + AddIf(null != (((object)__s)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(__s.ToString()) : null ,__r.Add); + } + container.Add("vmManagedDisksIds",__r); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AReplicationDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AReplicationDetails.PowerShell.cs new file mode 100644 index 000000000000..39b9d5b4b931 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AReplicationDetails.PowerShell.cs @@ -0,0 +1,648 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// A2A provider specific settings. + [System.ComponentModel.TypeConverter(typeof(A2AReplicationDetailsTypeConverter))] + public partial class A2AReplicationDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal A2AReplicationDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InitialPrimaryExtendedLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).InitialPrimaryExtendedLocation = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocation) content.GetValueForProperty("InitialPrimaryExtendedLocation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).InitialPrimaryExtendedLocation, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ExtendedLocationTypeConverter.ConvertFrom); + } + if (content.Contains("InitialRecoveryExtendedLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).InitialRecoveryExtendedLocation = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocation) content.GetValueForProperty("InitialRecoveryExtendedLocation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).InitialRecoveryExtendedLocation, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ExtendedLocationTypeConverter.ConvertFrom); + } + if (content.Contains("VMSyncedConfigDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).VMSyncedConfigDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureToAzureVMSyncedConfigDetails) content.GetValueForProperty("VMSyncedConfigDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).VMSyncedConfigDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AzureToAzureVMSyncedConfigDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("PrimaryExtendedLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).PrimaryExtendedLocation = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocation) content.GetValueForProperty("PrimaryExtendedLocation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).PrimaryExtendedLocation, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ExtendedLocationTypeConverter.ConvertFrom); + } + if (content.Contains("RecoveryExtendedLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).RecoveryExtendedLocation = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocation) content.GetValueForProperty("RecoveryExtendedLocation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).RecoveryExtendedLocation, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ExtendedLocationTypeConverter.ConvertFrom); + } + if (content.Contains("FabricObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).FabricObjectId = (string) content.GetValueForProperty("FabricObjectId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).FabricObjectId, global::System.Convert.ToString); + } + if (content.Contains("InitialPrimaryZone")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).InitialPrimaryZone = (string) content.GetValueForProperty("InitialPrimaryZone",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).InitialPrimaryZone, global::System.Convert.ToString); + } + if (content.Contains("InitialPrimaryFabricLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).InitialPrimaryFabricLocation = (string) content.GetValueForProperty("InitialPrimaryFabricLocation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).InitialPrimaryFabricLocation, global::System.Convert.ToString); + } + if (content.Contains("InitialRecoveryZone")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).InitialRecoveryZone = (string) content.GetValueForProperty("InitialRecoveryZone",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).InitialRecoveryZone, global::System.Convert.ToString); + } + if (content.Contains("InitialRecoveryFabricLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).InitialRecoveryFabricLocation = (string) content.GetValueForProperty("InitialRecoveryFabricLocation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).InitialRecoveryFabricLocation, global::System.Convert.ToString); + } + if (content.Contains("MultiVMGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).MultiVMGroupId = (string) content.GetValueForProperty("MultiVMGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).MultiVMGroupId, global::System.Convert.ToString); + } + if (content.Contains("MultiVMGroupName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).MultiVMGroupName = (string) content.GetValueForProperty("MultiVMGroupName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).MultiVMGroupName, global::System.Convert.ToString); + } + if (content.Contains("MultiVMGroupCreateOption")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).MultiVMGroupCreateOption = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MultiVMGroupCreateOption?) content.GetValueForProperty("MultiVMGroupCreateOption",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).MultiVMGroupCreateOption, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MultiVMGroupCreateOption.CreateFrom); + } + if (content.Contains("ManagementId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).ManagementId = (string) content.GetValueForProperty("ManagementId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).ManagementId, global::System.Convert.ToString); + } + if (content.Contains("ProtectedDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).ProtectedDisk = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetails[]) content.GetValueForProperty("ProtectedDisk",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).ProtectedDisk, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2AProtectedDiskDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("UnprotectedDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).UnprotectedDisk = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUnprotectedDiskDetails[]) content.GetValueForProperty("UnprotectedDisk",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).UnprotectedDisk, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2AUnprotectedDiskDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("ProtectedManagedDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).ProtectedManagedDisk = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetails[]) content.GetValueForProperty("ProtectedManagedDisk",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).ProtectedManagedDisk, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2AProtectedManagedDiskDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("RecoveryBootDiagStorageAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).RecoveryBootDiagStorageAccountId = (string) content.GetValueForProperty("RecoveryBootDiagStorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).RecoveryBootDiagStorageAccountId, global::System.Convert.ToString); + } + if (content.Contains("PrimaryFabricLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).PrimaryFabricLocation = (string) content.GetValueForProperty("PrimaryFabricLocation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).PrimaryFabricLocation, global::System.Convert.ToString); + } + if (content.Contains("RecoveryFabricLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).RecoveryFabricLocation = (string) content.GetValueForProperty("RecoveryFabricLocation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).RecoveryFabricLocation, global::System.Convert.ToString); + } + if (content.Contains("OSType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).OSType = (string) content.GetValueForProperty("OSType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).OSType, global::System.Convert.ToString); + } + if (content.Contains("RecoveryAzureVMSize")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).RecoveryAzureVMSize = (string) content.GetValueForProperty("RecoveryAzureVMSize",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).RecoveryAzureVMSize, global::System.Convert.ToString); + } + if (content.Contains("RecoveryAzureVMName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).RecoveryAzureVMName = (string) content.GetValueForProperty("RecoveryAzureVMName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).RecoveryAzureVMName, global::System.Convert.ToString); + } + if (content.Contains("RecoveryAzureResourceGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).RecoveryAzureResourceGroupId = (string) content.GetValueForProperty("RecoveryAzureResourceGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).RecoveryAzureResourceGroupId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryCloudService")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).RecoveryCloudService = (string) content.GetValueForProperty("RecoveryCloudService",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).RecoveryCloudService, global::System.Convert.ToString); + } + if (content.Contains("RecoveryAvailabilitySet")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).RecoveryAvailabilitySet = (string) content.GetValueForProperty("RecoveryAvailabilitySet",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).RecoveryAvailabilitySet, global::System.Convert.ToString); + } + if (content.Contains("SelectedRecoveryAzureNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).SelectedRecoveryAzureNetworkId = (string) content.GetValueForProperty("SelectedRecoveryAzureNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).SelectedRecoveryAzureNetworkId, global::System.Convert.ToString); + } + if (content.Contains("SelectedTfoAzureNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).SelectedTfoAzureNetworkId = (string) content.GetValueForProperty("SelectedTfoAzureNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).SelectedTfoAzureNetworkId, global::System.Convert.ToString); + } + if (content.Contains("VMNic")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).VMNic = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetails[]) content.GetValueForProperty("VMNic",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).VMNic, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMNicDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("MonitoringPercentageCompletion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).MonitoringPercentageCompletion = (int?) content.GetValueForProperty("MonitoringPercentageCompletion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).MonitoringPercentageCompletion, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("MonitoringJobType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).MonitoringJobType = (string) content.GetValueForProperty("MonitoringJobType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).MonitoringJobType, global::System.Convert.ToString); + } + if (content.Contains("LastHeartbeat")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).LastHeartbeat = (global::System.DateTime?) content.GetValueForProperty("LastHeartbeat",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).LastHeartbeat, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("AgentVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).AgentVersion = (string) content.GetValueForProperty("AgentVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).AgentVersion, global::System.Convert.ToString); + } + if (content.Contains("AgentExpiryDate")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).AgentExpiryDate = (global::System.DateTime?) content.GetValueForProperty("AgentExpiryDate",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).AgentExpiryDate, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("IsReplicationAgentUpdateRequired")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).IsReplicationAgentUpdateRequired = (bool?) content.GetValueForProperty("IsReplicationAgentUpdateRequired",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).IsReplicationAgentUpdateRequired, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("AgentCertificateExpiryDate")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).AgentCertificateExpiryDate = (global::System.DateTime?) content.GetValueForProperty("AgentCertificateExpiryDate",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).AgentCertificateExpiryDate, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("IsReplicationAgentCertificateUpdateRequired")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).IsReplicationAgentCertificateUpdateRequired = (bool?) content.GetValueForProperty("IsReplicationAgentCertificateUpdateRequired",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).IsReplicationAgentCertificateUpdateRequired, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("RecoveryFabricObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).RecoveryFabricObjectId = (string) content.GetValueForProperty("RecoveryFabricObjectId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).RecoveryFabricObjectId, global::System.Convert.ToString); + } + if (content.Contains("VMProtectionState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).VMProtectionState = (string) content.GetValueForProperty("VMProtectionState",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).VMProtectionState, global::System.Convert.ToString); + } + if (content.Contains("VMProtectionStateDescription")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).VMProtectionStateDescription = (string) content.GetValueForProperty("VMProtectionStateDescription",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).VMProtectionStateDescription, global::System.Convert.ToString); + } + if (content.Contains("LifecycleId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).LifecycleId = (string) content.GetValueForProperty("LifecycleId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).LifecycleId, global::System.Convert.ToString); + } + if (content.Contains("TestFailoverRecoveryFabricObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).TestFailoverRecoveryFabricObjectId = (string) content.GetValueForProperty("TestFailoverRecoveryFabricObjectId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).TestFailoverRecoveryFabricObjectId, global::System.Convert.ToString); + } + if (content.Contains("RpoInSecond")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).RpoInSecond = (long?) content.GetValueForProperty("RpoInSecond",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).RpoInSecond, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("LastRpoCalculatedTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).LastRpoCalculatedTime = (global::System.DateTime?) content.GetValueForProperty("LastRpoCalculatedTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).LastRpoCalculatedTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("PrimaryAvailabilityZone")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).PrimaryAvailabilityZone = (string) content.GetValueForProperty("PrimaryAvailabilityZone",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).PrimaryAvailabilityZone, global::System.Convert.ToString); + } + if (content.Contains("RecoveryAvailabilityZone")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).RecoveryAvailabilityZone = (string) content.GetValueForProperty("RecoveryAvailabilityZone",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).RecoveryAvailabilityZone, global::System.Convert.ToString); + } + if (content.Contains("VMEncryptionType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).VMEncryptionType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.VMEncryptionType?) content.GetValueForProperty("VMEncryptionType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).VMEncryptionType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.VMEncryptionType.CreateFrom); + } + if (content.Contains("TfoAzureVMName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).TfoAzureVMName = (string) content.GetValueForProperty("TfoAzureVMName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).TfoAzureVMName, global::System.Convert.ToString); + } + if (content.Contains("RecoveryAzureGeneration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).RecoveryAzureGeneration = (string) content.GetValueForProperty("RecoveryAzureGeneration",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).RecoveryAzureGeneration, global::System.Convert.ToString); + } + if (content.Contains("RecoveryProximityPlacementGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).RecoveryProximityPlacementGroupId = (string) content.GetValueForProperty("RecoveryProximityPlacementGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).RecoveryProximityPlacementGroupId, global::System.Convert.ToString); + } + if (content.Contains("AutoProtectionOfDataDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).AutoProtectionOfDataDisk = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AutoProtectionOfDataDisk?) content.GetValueForProperty("AutoProtectionOfDataDisk",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).AutoProtectionOfDataDisk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AutoProtectionOfDataDisk.CreateFrom); + } + if (content.Contains("RecoveryVirtualMachineScaleSetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).RecoveryVirtualMachineScaleSetId = (string) content.GetValueForProperty("RecoveryVirtualMachineScaleSetId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).RecoveryVirtualMachineScaleSetId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryCapacityReservationGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).RecoveryCapacityReservationGroupId = (string) content.GetValueForProperty("RecoveryCapacityReservationGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).RecoveryCapacityReservationGroupId, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettingsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettingsInternal)this).InstanceType, global::System.Convert.ToString); + } + if (content.Contains("InitialPrimaryExtendedLocationName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).InitialPrimaryExtendedLocationName = (string) content.GetValueForProperty("InitialPrimaryExtendedLocationName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).InitialPrimaryExtendedLocationName, global::System.Convert.ToString); + } + if (content.Contains("InitialPrimaryExtendedLocationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).InitialPrimaryExtendedLocationType = (string) content.GetValueForProperty("InitialPrimaryExtendedLocationType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).InitialPrimaryExtendedLocationType, global::System.Convert.ToString); + } + if (content.Contains("InitialRecoveryExtendedLocationName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).InitialRecoveryExtendedLocationName = (string) content.GetValueForProperty("InitialRecoveryExtendedLocationName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).InitialRecoveryExtendedLocationName, global::System.Convert.ToString); + } + if (content.Contains("InitialRecoveryExtendedLocationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).InitialRecoveryExtendedLocationType = (string) content.GetValueForProperty("InitialRecoveryExtendedLocationType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).InitialRecoveryExtendedLocationType, global::System.Convert.ToString); + } + if (content.Contains("VMSyncedConfigDetailTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).VMSyncedConfigDetailTag = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureToAzureVMSyncedConfigDetailsTags) content.GetValueForProperty("VMSyncedConfigDetailTag",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).VMSyncedConfigDetailTag, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AzureToAzureVMSyncedConfigDetailsTagsTypeConverter.ConvertFrom); + } + if (content.Contains("VMSyncedConfigDetailInputEndpoint")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).VMSyncedConfigDetailInputEndpoint = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInputEndpoint[]) content.GetValueForProperty("VMSyncedConfigDetailInputEndpoint",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).VMSyncedConfigDetailInputEndpoint, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InputEndpointTypeConverter.ConvertFrom)); + } + if (content.Contains("PrimaryExtendedLocationName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).PrimaryExtendedLocationName = (string) content.GetValueForProperty("PrimaryExtendedLocationName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).PrimaryExtendedLocationName, global::System.Convert.ToString); + } + if (content.Contains("PrimaryExtendedLocationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).PrimaryExtendedLocationType = (string) content.GetValueForProperty("PrimaryExtendedLocationType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).PrimaryExtendedLocationType, global::System.Convert.ToString); + } + if (content.Contains("RecoveryExtendedLocationName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).RecoveryExtendedLocationName = (string) content.GetValueForProperty("RecoveryExtendedLocationName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).RecoveryExtendedLocationName, global::System.Convert.ToString); + } + if (content.Contains("RecoveryExtendedLocationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).RecoveryExtendedLocationType = (string) content.GetValueForProperty("RecoveryExtendedLocationType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).RecoveryExtendedLocationType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal A2AReplicationDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InitialPrimaryExtendedLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).InitialPrimaryExtendedLocation = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocation) content.GetValueForProperty("InitialPrimaryExtendedLocation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).InitialPrimaryExtendedLocation, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ExtendedLocationTypeConverter.ConvertFrom); + } + if (content.Contains("InitialRecoveryExtendedLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).InitialRecoveryExtendedLocation = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocation) content.GetValueForProperty("InitialRecoveryExtendedLocation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).InitialRecoveryExtendedLocation, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ExtendedLocationTypeConverter.ConvertFrom); + } + if (content.Contains("VMSyncedConfigDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).VMSyncedConfigDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureToAzureVMSyncedConfigDetails) content.GetValueForProperty("VMSyncedConfigDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).VMSyncedConfigDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AzureToAzureVMSyncedConfigDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("PrimaryExtendedLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).PrimaryExtendedLocation = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocation) content.GetValueForProperty("PrimaryExtendedLocation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).PrimaryExtendedLocation, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ExtendedLocationTypeConverter.ConvertFrom); + } + if (content.Contains("RecoveryExtendedLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).RecoveryExtendedLocation = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocation) content.GetValueForProperty("RecoveryExtendedLocation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).RecoveryExtendedLocation, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ExtendedLocationTypeConverter.ConvertFrom); + } + if (content.Contains("FabricObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).FabricObjectId = (string) content.GetValueForProperty("FabricObjectId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).FabricObjectId, global::System.Convert.ToString); + } + if (content.Contains("InitialPrimaryZone")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).InitialPrimaryZone = (string) content.GetValueForProperty("InitialPrimaryZone",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).InitialPrimaryZone, global::System.Convert.ToString); + } + if (content.Contains("InitialPrimaryFabricLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).InitialPrimaryFabricLocation = (string) content.GetValueForProperty("InitialPrimaryFabricLocation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).InitialPrimaryFabricLocation, global::System.Convert.ToString); + } + if (content.Contains("InitialRecoveryZone")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).InitialRecoveryZone = (string) content.GetValueForProperty("InitialRecoveryZone",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).InitialRecoveryZone, global::System.Convert.ToString); + } + if (content.Contains("InitialRecoveryFabricLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).InitialRecoveryFabricLocation = (string) content.GetValueForProperty("InitialRecoveryFabricLocation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).InitialRecoveryFabricLocation, global::System.Convert.ToString); + } + if (content.Contains("MultiVMGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).MultiVMGroupId = (string) content.GetValueForProperty("MultiVMGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).MultiVMGroupId, global::System.Convert.ToString); + } + if (content.Contains("MultiVMGroupName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).MultiVMGroupName = (string) content.GetValueForProperty("MultiVMGroupName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).MultiVMGroupName, global::System.Convert.ToString); + } + if (content.Contains("MultiVMGroupCreateOption")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).MultiVMGroupCreateOption = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MultiVMGroupCreateOption?) content.GetValueForProperty("MultiVMGroupCreateOption",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).MultiVMGroupCreateOption, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MultiVMGroupCreateOption.CreateFrom); + } + if (content.Contains("ManagementId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).ManagementId = (string) content.GetValueForProperty("ManagementId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).ManagementId, global::System.Convert.ToString); + } + if (content.Contains("ProtectedDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).ProtectedDisk = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetails[]) content.GetValueForProperty("ProtectedDisk",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).ProtectedDisk, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2AProtectedDiskDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("UnprotectedDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).UnprotectedDisk = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUnprotectedDiskDetails[]) content.GetValueForProperty("UnprotectedDisk",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).UnprotectedDisk, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2AUnprotectedDiskDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("ProtectedManagedDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).ProtectedManagedDisk = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetails[]) content.GetValueForProperty("ProtectedManagedDisk",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).ProtectedManagedDisk, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2AProtectedManagedDiskDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("RecoveryBootDiagStorageAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).RecoveryBootDiagStorageAccountId = (string) content.GetValueForProperty("RecoveryBootDiagStorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).RecoveryBootDiagStorageAccountId, global::System.Convert.ToString); + } + if (content.Contains("PrimaryFabricLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).PrimaryFabricLocation = (string) content.GetValueForProperty("PrimaryFabricLocation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).PrimaryFabricLocation, global::System.Convert.ToString); + } + if (content.Contains("RecoveryFabricLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).RecoveryFabricLocation = (string) content.GetValueForProperty("RecoveryFabricLocation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).RecoveryFabricLocation, global::System.Convert.ToString); + } + if (content.Contains("OSType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).OSType = (string) content.GetValueForProperty("OSType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).OSType, global::System.Convert.ToString); + } + if (content.Contains("RecoveryAzureVMSize")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).RecoveryAzureVMSize = (string) content.GetValueForProperty("RecoveryAzureVMSize",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).RecoveryAzureVMSize, global::System.Convert.ToString); + } + if (content.Contains("RecoveryAzureVMName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).RecoveryAzureVMName = (string) content.GetValueForProperty("RecoveryAzureVMName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).RecoveryAzureVMName, global::System.Convert.ToString); + } + if (content.Contains("RecoveryAzureResourceGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).RecoveryAzureResourceGroupId = (string) content.GetValueForProperty("RecoveryAzureResourceGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).RecoveryAzureResourceGroupId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryCloudService")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).RecoveryCloudService = (string) content.GetValueForProperty("RecoveryCloudService",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).RecoveryCloudService, global::System.Convert.ToString); + } + if (content.Contains("RecoveryAvailabilitySet")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).RecoveryAvailabilitySet = (string) content.GetValueForProperty("RecoveryAvailabilitySet",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).RecoveryAvailabilitySet, global::System.Convert.ToString); + } + if (content.Contains("SelectedRecoveryAzureNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).SelectedRecoveryAzureNetworkId = (string) content.GetValueForProperty("SelectedRecoveryAzureNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).SelectedRecoveryAzureNetworkId, global::System.Convert.ToString); + } + if (content.Contains("SelectedTfoAzureNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).SelectedTfoAzureNetworkId = (string) content.GetValueForProperty("SelectedTfoAzureNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).SelectedTfoAzureNetworkId, global::System.Convert.ToString); + } + if (content.Contains("VMNic")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).VMNic = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetails[]) content.GetValueForProperty("VMNic",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).VMNic, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMNicDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("MonitoringPercentageCompletion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).MonitoringPercentageCompletion = (int?) content.GetValueForProperty("MonitoringPercentageCompletion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).MonitoringPercentageCompletion, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("MonitoringJobType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).MonitoringJobType = (string) content.GetValueForProperty("MonitoringJobType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).MonitoringJobType, global::System.Convert.ToString); + } + if (content.Contains("LastHeartbeat")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).LastHeartbeat = (global::System.DateTime?) content.GetValueForProperty("LastHeartbeat",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).LastHeartbeat, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("AgentVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).AgentVersion = (string) content.GetValueForProperty("AgentVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).AgentVersion, global::System.Convert.ToString); + } + if (content.Contains("AgentExpiryDate")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).AgentExpiryDate = (global::System.DateTime?) content.GetValueForProperty("AgentExpiryDate",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).AgentExpiryDate, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("IsReplicationAgentUpdateRequired")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).IsReplicationAgentUpdateRequired = (bool?) content.GetValueForProperty("IsReplicationAgentUpdateRequired",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).IsReplicationAgentUpdateRequired, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("AgentCertificateExpiryDate")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).AgentCertificateExpiryDate = (global::System.DateTime?) content.GetValueForProperty("AgentCertificateExpiryDate",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).AgentCertificateExpiryDate, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("IsReplicationAgentCertificateUpdateRequired")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).IsReplicationAgentCertificateUpdateRequired = (bool?) content.GetValueForProperty("IsReplicationAgentCertificateUpdateRequired",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).IsReplicationAgentCertificateUpdateRequired, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("RecoveryFabricObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).RecoveryFabricObjectId = (string) content.GetValueForProperty("RecoveryFabricObjectId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).RecoveryFabricObjectId, global::System.Convert.ToString); + } + if (content.Contains("VMProtectionState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).VMProtectionState = (string) content.GetValueForProperty("VMProtectionState",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).VMProtectionState, global::System.Convert.ToString); + } + if (content.Contains("VMProtectionStateDescription")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).VMProtectionStateDescription = (string) content.GetValueForProperty("VMProtectionStateDescription",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).VMProtectionStateDescription, global::System.Convert.ToString); + } + if (content.Contains("LifecycleId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).LifecycleId = (string) content.GetValueForProperty("LifecycleId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).LifecycleId, global::System.Convert.ToString); + } + if (content.Contains("TestFailoverRecoveryFabricObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).TestFailoverRecoveryFabricObjectId = (string) content.GetValueForProperty("TestFailoverRecoveryFabricObjectId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).TestFailoverRecoveryFabricObjectId, global::System.Convert.ToString); + } + if (content.Contains("RpoInSecond")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).RpoInSecond = (long?) content.GetValueForProperty("RpoInSecond",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).RpoInSecond, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("LastRpoCalculatedTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).LastRpoCalculatedTime = (global::System.DateTime?) content.GetValueForProperty("LastRpoCalculatedTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).LastRpoCalculatedTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("PrimaryAvailabilityZone")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).PrimaryAvailabilityZone = (string) content.GetValueForProperty("PrimaryAvailabilityZone",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).PrimaryAvailabilityZone, global::System.Convert.ToString); + } + if (content.Contains("RecoveryAvailabilityZone")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).RecoveryAvailabilityZone = (string) content.GetValueForProperty("RecoveryAvailabilityZone",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).RecoveryAvailabilityZone, global::System.Convert.ToString); + } + if (content.Contains("VMEncryptionType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).VMEncryptionType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.VMEncryptionType?) content.GetValueForProperty("VMEncryptionType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).VMEncryptionType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.VMEncryptionType.CreateFrom); + } + if (content.Contains("TfoAzureVMName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).TfoAzureVMName = (string) content.GetValueForProperty("TfoAzureVMName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).TfoAzureVMName, global::System.Convert.ToString); + } + if (content.Contains("RecoveryAzureGeneration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).RecoveryAzureGeneration = (string) content.GetValueForProperty("RecoveryAzureGeneration",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).RecoveryAzureGeneration, global::System.Convert.ToString); + } + if (content.Contains("RecoveryProximityPlacementGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).RecoveryProximityPlacementGroupId = (string) content.GetValueForProperty("RecoveryProximityPlacementGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).RecoveryProximityPlacementGroupId, global::System.Convert.ToString); + } + if (content.Contains("AutoProtectionOfDataDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).AutoProtectionOfDataDisk = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AutoProtectionOfDataDisk?) content.GetValueForProperty("AutoProtectionOfDataDisk",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).AutoProtectionOfDataDisk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AutoProtectionOfDataDisk.CreateFrom); + } + if (content.Contains("RecoveryVirtualMachineScaleSetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).RecoveryVirtualMachineScaleSetId = (string) content.GetValueForProperty("RecoveryVirtualMachineScaleSetId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).RecoveryVirtualMachineScaleSetId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryCapacityReservationGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).RecoveryCapacityReservationGroupId = (string) content.GetValueForProperty("RecoveryCapacityReservationGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).RecoveryCapacityReservationGroupId, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettingsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettingsInternal)this).InstanceType, global::System.Convert.ToString); + } + if (content.Contains("InitialPrimaryExtendedLocationName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).InitialPrimaryExtendedLocationName = (string) content.GetValueForProperty("InitialPrimaryExtendedLocationName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).InitialPrimaryExtendedLocationName, global::System.Convert.ToString); + } + if (content.Contains("InitialPrimaryExtendedLocationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).InitialPrimaryExtendedLocationType = (string) content.GetValueForProperty("InitialPrimaryExtendedLocationType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).InitialPrimaryExtendedLocationType, global::System.Convert.ToString); + } + if (content.Contains("InitialRecoveryExtendedLocationName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).InitialRecoveryExtendedLocationName = (string) content.GetValueForProperty("InitialRecoveryExtendedLocationName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).InitialRecoveryExtendedLocationName, global::System.Convert.ToString); + } + if (content.Contains("InitialRecoveryExtendedLocationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).InitialRecoveryExtendedLocationType = (string) content.GetValueForProperty("InitialRecoveryExtendedLocationType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).InitialRecoveryExtendedLocationType, global::System.Convert.ToString); + } + if (content.Contains("VMSyncedConfigDetailTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).VMSyncedConfigDetailTag = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureToAzureVMSyncedConfigDetailsTags) content.GetValueForProperty("VMSyncedConfigDetailTag",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).VMSyncedConfigDetailTag, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AzureToAzureVMSyncedConfigDetailsTagsTypeConverter.ConvertFrom); + } + if (content.Contains("VMSyncedConfigDetailInputEndpoint")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).VMSyncedConfigDetailInputEndpoint = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInputEndpoint[]) content.GetValueForProperty("VMSyncedConfigDetailInputEndpoint",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).VMSyncedConfigDetailInputEndpoint, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InputEndpointTypeConverter.ConvertFrom)); + } + if (content.Contains("PrimaryExtendedLocationName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).PrimaryExtendedLocationName = (string) content.GetValueForProperty("PrimaryExtendedLocationName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).PrimaryExtendedLocationName, global::System.Convert.ToString); + } + if (content.Contains("PrimaryExtendedLocationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).PrimaryExtendedLocationType = (string) content.GetValueForProperty("PrimaryExtendedLocationType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).PrimaryExtendedLocationType, global::System.Convert.ToString); + } + if (content.Contains("RecoveryExtendedLocationName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).RecoveryExtendedLocationName = (string) content.GetValueForProperty("RecoveryExtendedLocationName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).RecoveryExtendedLocationName, global::System.Convert.ToString); + } + if (content.Contains("RecoveryExtendedLocationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).RecoveryExtendedLocationType = (string) content.GetValueForProperty("RecoveryExtendedLocationType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal)this).RecoveryExtendedLocationType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new A2AReplicationDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new A2AReplicationDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// A2A provider specific settings. + [System.ComponentModel.TypeConverter(typeof(A2AReplicationDetailsTypeConverter))] + public partial interface IA2AReplicationDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AReplicationDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AReplicationDetails.TypeConverter.cs new file mode 100644 index 000000000000..f10460074084 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AReplicationDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class A2AReplicationDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return A2AReplicationDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return A2AReplicationDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return A2AReplicationDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AReplicationDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AReplicationDetails.cs new file mode 100644 index 000000000000..569528f76cf1 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AReplicationDetails.cs @@ -0,0 +1,1132 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// A2A provider specific settings. + public partial class A2AReplicationDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettings __replicationProviderSpecificSettings = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProviderSpecificSettings(); + + /// Backing field for property. + private global::System.DateTime? _agentCertificateExpiryDate; + + /// Agent certificate expiry date. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public global::System.DateTime? AgentCertificateExpiryDate { get => this._agentCertificateExpiryDate; } + + /// Backing field for property. + private global::System.DateTime? _agentExpiryDate; + + /// Agent expiry date. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public global::System.DateTime? AgentExpiryDate { get => this._agentExpiryDate; set => this._agentExpiryDate = value; } + + /// Backing field for property. + private string _agentVersion; + + /// The agent version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string AgentVersion { get => this._agentVersion; set => this._agentVersion = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AutoProtectionOfDataDisk? _autoProtectionOfDataDisk; + + /// A value indicating whether the auto protection is enabled. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AutoProtectionOfDataDisk? AutoProtectionOfDataDisk { get => this._autoProtectionOfDataDisk; set => this._autoProtectionOfDataDisk = value; } + + /// Backing field for property. + private string _fabricObjectId; + + /// The fabric specific object Id of the virtual machine. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string FabricObjectId { get => this._fabricObjectId; set => this._fabricObjectId = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocation _initialPrimaryExtendedLocation; + + /// The initial primary extended location. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocation InitialPrimaryExtendedLocation { get => (this._initialPrimaryExtendedLocation = this._initialPrimaryExtendedLocation ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ExtendedLocation()); set => this._initialPrimaryExtendedLocation = value; } + + /// The name of the extended location. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string InitialPrimaryExtendedLocationName { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocationInternal)InitialPrimaryExtendedLocation).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocationInternal)InitialPrimaryExtendedLocation).Name = value ?? null; } + + /// The extended location type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string InitialPrimaryExtendedLocationType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocationInternal)InitialPrimaryExtendedLocation).Type; } + + /// Backing field for property. + private string _initialPrimaryFabricLocation; + + /// The initial primary fabric location. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string InitialPrimaryFabricLocation { get => this._initialPrimaryFabricLocation; } + + /// Backing field for property. + private string _initialPrimaryZone; + + /// The initial primary availability zone. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string InitialPrimaryZone { get => this._initialPrimaryZone; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocation _initialRecoveryExtendedLocation; + + /// The initial recovery extended location. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocation InitialRecoveryExtendedLocation { get => (this._initialRecoveryExtendedLocation = this._initialRecoveryExtendedLocation ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ExtendedLocation()); set => this._initialRecoveryExtendedLocation = value; } + + /// The name of the extended location. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string InitialRecoveryExtendedLocationName { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocationInternal)InitialRecoveryExtendedLocation).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocationInternal)InitialRecoveryExtendedLocation).Name = value ?? null; } + + /// The extended location type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string InitialRecoveryExtendedLocationType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocationInternal)InitialRecoveryExtendedLocation).Type; } + + /// Backing field for property. + private string _initialRecoveryFabricLocation; + + /// The initial recovery fabric location. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string InitialRecoveryFabricLocation { get => this._initialRecoveryFabricLocation; } + + /// Backing field for property. + private string _initialRecoveryZone; + + /// The initial recovery availability zone. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string InitialRecoveryZone { get => this._initialRecoveryZone; } + + /// Gets the Instance type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettingsInternal)__replicationProviderSpecificSettings).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettingsInternal)__replicationProviderSpecificSettings).InstanceType = value ; } + + /// + /// Backing field for property. + /// + private bool? _isReplicationAgentCertificateUpdateRequired; + + /// A value indicating whether agent certificate update is required. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public bool? IsReplicationAgentCertificateUpdateRequired { get => this._isReplicationAgentCertificateUpdateRequired; set => this._isReplicationAgentCertificateUpdateRequired = value; } + + /// Backing field for property. + private bool? _isReplicationAgentUpdateRequired; + + /// A value indicating whether replication agent update is required. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public bool? IsReplicationAgentUpdateRequired { get => this._isReplicationAgentUpdateRequired; set => this._isReplicationAgentUpdateRequired = value; } + + /// Backing field for property. + private global::System.DateTime? _lastHeartbeat; + + /// The last heartbeat received from the source server. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public global::System.DateTime? LastHeartbeat { get => this._lastHeartbeat; set => this._lastHeartbeat = value; } + + /// Backing field for property. + private global::System.DateTime? _lastRpoCalculatedTime; + + /// The time (in UTC) when the last RPO value was calculated by Protection Service. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public global::System.DateTime? LastRpoCalculatedTime { get => this._lastRpoCalculatedTime; set => this._lastRpoCalculatedTime = value; } + + /// Backing field for property. + private string _lifecycleId; + + /// + /// 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. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string LifecycleId { get => this._lifecycleId; set => this._lifecycleId = value; } + + /// Backing field for property. + private string _managementId; + + /// The management Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ManagementId { get => this._managementId; set => this._managementId = value; } + + /// Internal Acessors for AgentCertificateExpiryDate + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal.AgentCertificateExpiryDate { get => this._agentCertificateExpiryDate; set { {_agentCertificateExpiryDate = value;} } } + + /// Internal Acessors for InitialPrimaryExtendedLocation + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocation Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal.InitialPrimaryExtendedLocation { get => (this._initialPrimaryExtendedLocation = this._initialPrimaryExtendedLocation ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ExtendedLocation()); set { {_initialPrimaryExtendedLocation = value;} } } + + /// Internal Acessors for InitialPrimaryExtendedLocationType + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal.InitialPrimaryExtendedLocationType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocationInternal)InitialPrimaryExtendedLocation).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocationInternal)InitialPrimaryExtendedLocation).Type = value; } + + /// Internal Acessors for InitialPrimaryFabricLocation + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal.InitialPrimaryFabricLocation { get => this._initialPrimaryFabricLocation; set { {_initialPrimaryFabricLocation = value;} } } + + /// Internal Acessors for InitialPrimaryZone + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal.InitialPrimaryZone { get => this._initialPrimaryZone; set { {_initialPrimaryZone = value;} } } + + /// Internal Acessors for InitialRecoveryExtendedLocation + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocation Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal.InitialRecoveryExtendedLocation { get => (this._initialRecoveryExtendedLocation = this._initialRecoveryExtendedLocation ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ExtendedLocation()); set { {_initialRecoveryExtendedLocation = value;} } } + + /// Internal Acessors for InitialRecoveryExtendedLocationType + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal.InitialRecoveryExtendedLocationType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocationInternal)InitialRecoveryExtendedLocation).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocationInternal)InitialRecoveryExtendedLocation).Type = value; } + + /// Internal Acessors for InitialRecoveryFabricLocation + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal.InitialRecoveryFabricLocation { get => this._initialRecoveryFabricLocation; set { {_initialRecoveryFabricLocation = value;} } } + + /// Internal Acessors for InitialRecoveryZone + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal.InitialRecoveryZone { get => this._initialRecoveryZone; set { {_initialRecoveryZone = value;} } } + + /// Internal Acessors for PrimaryExtendedLocation + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocation Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal.PrimaryExtendedLocation { get => (this._primaryExtendedLocation = this._primaryExtendedLocation ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ExtendedLocation()); set { {_primaryExtendedLocation = value;} } } + + /// Internal Acessors for PrimaryExtendedLocationType + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal.PrimaryExtendedLocationType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocationInternal)PrimaryExtendedLocation).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocationInternal)PrimaryExtendedLocation).Type = value; } + + /// Internal Acessors for RecoveryAzureGeneration + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal.RecoveryAzureGeneration { get => this._recoveryAzureGeneration; set { {_recoveryAzureGeneration = value;} } } + + /// Internal Acessors for RecoveryExtendedLocation + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocation Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal.RecoveryExtendedLocation { get => (this._recoveryExtendedLocation = this._recoveryExtendedLocation ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ExtendedLocation()); set { {_recoveryExtendedLocation = value;} } } + + /// Internal Acessors for RecoveryExtendedLocationType + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal.RecoveryExtendedLocationType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocationInternal)RecoveryExtendedLocation).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocationInternal)RecoveryExtendedLocation).Type = value; } + + /// Internal Acessors for VMEncryptionType + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.VMEncryptionType? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal.VMEncryptionType { get => this._vMEncryptionType; set { {_vMEncryptionType = value;} } } + + /// Internal Acessors for VMSyncedConfigDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureToAzureVMSyncedConfigDetails Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetailsInternal.VMSyncedConfigDetail { get => (this._vMSyncedConfigDetail = this._vMSyncedConfigDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AzureToAzureVMSyncedConfigDetails()); set { {_vMSyncedConfigDetail = value;} } } + + /// Backing field for property. + private string _monitoringJobType; + + /// + /// The type of the monitoring job. The progress is contained in MonitoringPercentageCompletion property. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string MonitoringJobType { get => this._monitoringJobType; set => this._monitoringJobType = value; } + + /// Backing field for property. + private int? _monitoringPercentageCompletion; + + /// + /// The percentage of the monitoring job. The type of the monitoring job is defined by MonitoringJobType property. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? MonitoringPercentageCompletion { get => this._monitoringPercentageCompletion; set => this._monitoringPercentageCompletion = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MultiVMGroupCreateOption? _multiVMGroupCreateOption; + + /// Whether Multi VM group is auto created or specified by user. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MultiVMGroupCreateOption? MultiVMGroupCreateOption { get => this._multiVMGroupCreateOption; set => this._multiVMGroupCreateOption = value; } + + /// Backing field for property. + private string _multiVMGroupId; + + /// The multi vm group Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string MultiVMGroupId { get => this._multiVMGroupId; set => this._multiVMGroupId = value; } + + /// Backing field for property. + private string _multiVMGroupName; + + /// The multi vm group name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string MultiVMGroupName { get => this._multiVMGroupName; set => this._multiVMGroupName = value; } + + /// Backing field for property. + private string _oSType; + + /// The type of operating system. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string OSType { get => this._oSType; set => this._oSType = value; } + + /// Backing field for property. + private string _primaryAvailabilityZone; + + /// The primary availability zone. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string PrimaryAvailabilityZone { get => this._primaryAvailabilityZone; set => this._primaryAvailabilityZone = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocation _primaryExtendedLocation; + + /// The primary Extended Location. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocation PrimaryExtendedLocation { get => (this._primaryExtendedLocation = this._primaryExtendedLocation ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ExtendedLocation()); set => this._primaryExtendedLocation = value; } + + /// The name of the extended location. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string PrimaryExtendedLocationName { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocationInternal)PrimaryExtendedLocation).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocationInternal)PrimaryExtendedLocation).Name = value ?? null; } + + /// The extended location type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string PrimaryExtendedLocationType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocationInternal)PrimaryExtendedLocation).Type; } + + /// Backing field for property. + private string _primaryFabricLocation; + + /// Primary fabric location. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string PrimaryFabricLocation { get => this._primaryFabricLocation; set => this._primaryFabricLocation = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetails[] _protectedDisk; + + /// The list of protected disks. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetails[] ProtectedDisk { get => this._protectedDisk; set => this._protectedDisk = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetails[] _protectedManagedDisk; + + /// The list of protected managed disks. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetails[] ProtectedManagedDisk { get => this._protectedManagedDisk; set => this._protectedManagedDisk = value; } + + /// Backing field for property. + private string _recoveryAvailabilitySet; + + /// The recovery availability set. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryAvailabilitySet { get => this._recoveryAvailabilitySet; set => this._recoveryAvailabilitySet = value; } + + /// Backing field for property. + private string _recoveryAvailabilityZone; + + /// The recovery availability zone. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryAvailabilityZone { get => this._recoveryAvailabilityZone; set => this._recoveryAvailabilityZone = value; } + + /// Backing field for property. + private string _recoveryAzureGeneration; + + /// The recovery azure generation. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryAzureGeneration { get => this._recoveryAzureGeneration; } + + /// Backing field for property. + private string _recoveryAzureResourceGroupId; + + /// The recovery resource group. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryAzureResourceGroupId { get => this._recoveryAzureResourceGroupId; set => this._recoveryAzureResourceGroupId = value; } + + /// Backing field for property. + private string _recoveryAzureVMName; + + /// The name of recovery virtual machine. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryAzureVMName { get => this._recoveryAzureVMName; set => this._recoveryAzureVMName = value; } + + /// Backing field for property. + private string _recoveryAzureVMSize; + + /// The size of recovery virtual machine. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryAzureVMSize { get => this._recoveryAzureVMSize; set => this._recoveryAzureVMSize = value; } + + /// Backing field for property. + private string _recoveryBootDiagStorageAccountId; + + /// The recovery boot diagnostic storage account Arm Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryBootDiagStorageAccountId { get => this._recoveryBootDiagStorageAccountId; set => this._recoveryBootDiagStorageAccountId = value; } + + /// Backing field for property. + private string _recoveryCapacityReservationGroupId; + + /// The recovery capacity reservation group Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryCapacityReservationGroupId { get => this._recoveryCapacityReservationGroupId; set => this._recoveryCapacityReservationGroupId = value; } + + /// Backing field for property. + private string _recoveryCloudService; + + /// The recovery cloud service. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryCloudService { get => this._recoveryCloudService; set => this._recoveryCloudService = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocation _recoveryExtendedLocation; + + /// The recovery Extended Location. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocation RecoveryExtendedLocation { get => (this._recoveryExtendedLocation = this._recoveryExtendedLocation ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ExtendedLocation()); set => this._recoveryExtendedLocation = value; } + + /// The name of the extended location. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string RecoveryExtendedLocationName { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocationInternal)RecoveryExtendedLocation).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocationInternal)RecoveryExtendedLocation).Name = value ?? null; } + + /// The extended location type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string RecoveryExtendedLocationType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocationInternal)RecoveryExtendedLocation).Type; } + + /// Backing field for property. + private string _recoveryFabricLocation; + + /// The recovery fabric location. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryFabricLocation { get => this._recoveryFabricLocation; set => this._recoveryFabricLocation = value; } + + /// Backing field for property. + private string _recoveryFabricObjectId; + + /// The recovery fabric object Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryFabricObjectId { get => this._recoveryFabricObjectId; set => this._recoveryFabricObjectId = value; } + + /// Backing field for property. + private string _recoveryProximityPlacementGroupId; + + /// The recovery proximity placement group Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryProximityPlacementGroupId { get => this._recoveryProximityPlacementGroupId; set => this._recoveryProximityPlacementGroupId = value; } + + /// Backing field for property. + private string _recoveryVirtualMachineScaleSetId; + + /// The recovery virtual machine scale set id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryVirtualMachineScaleSetId { get => this._recoveryVirtualMachineScaleSetId; set => this._recoveryVirtualMachineScaleSetId = value; } + + /// Backing field for property. + private long? _rpoInSecond; + + /// The last RPO value in seconds. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public long? RpoInSecond { get => this._rpoInSecond; set => this._rpoInSecond = value; } + + /// Backing field for property. + private string _selectedRecoveryAzureNetworkId; + + /// The recovery virtual network. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string SelectedRecoveryAzureNetworkId { get => this._selectedRecoveryAzureNetworkId; set => this._selectedRecoveryAzureNetworkId = value; } + + /// Backing field for property. + private string _selectedTfoAzureNetworkId; + + /// The test failover virtual network. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string SelectedTfoAzureNetworkId { get => this._selectedTfoAzureNetworkId; set => this._selectedTfoAzureNetworkId = value; } + + /// Backing field for property. + private string _testFailoverRecoveryFabricObjectId; + + /// The test failover fabric object Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TestFailoverRecoveryFabricObjectId { get => this._testFailoverRecoveryFabricObjectId; set => this._testFailoverRecoveryFabricObjectId = value; } + + /// Backing field for property. + private string _tfoAzureVMName; + + /// The test failover vm name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TfoAzureVMName { get => this._tfoAzureVMName; set => this._tfoAzureVMName = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUnprotectedDiskDetails[] _unprotectedDisk; + + /// The list of unprotected disks. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUnprotectedDiskDetails[] UnprotectedDisk { get => this._unprotectedDisk; set => this._unprotectedDisk = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.VMEncryptionType? _vMEncryptionType; + + /// The encryption type of the VM. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.VMEncryptionType? VMEncryptionType { get => this._vMEncryptionType; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetails[] _vMNic; + + /// The virtual machine nic details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetails[] VMNic { get => this._vMNic; set => this._vMNic = value; } + + /// Backing field for property. + private string _vMProtectionState; + + /// The protection state for the vm. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string VMProtectionState { get => this._vMProtectionState; set => this._vMProtectionState = value; } + + /// Backing field for property. + private string _vMProtectionStateDescription; + + /// The protection state description for the vm. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string VMProtectionStateDescription { get => this._vMProtectionStateDescription; set => this._vMProtectionStateDescription = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureToAzureVMSyncedConfigDetails _vMSyncedConfigDetail; + + /// The synced configuration details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureToAzureVMSyncedConfigDetails VMSyncedConfigDetail { get => (this._vMSyncedConfigDetail = this._vMSyncedConfigDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AzureToAzureVMSyncedConfigDetails()); set => this._vMSyncedConfigDetail = value; } + + /// The Azure VM input endpoints. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInputEndpoint[] VMSyncedConfigDetailInputEndpoint { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureToAzureVMSyncedConfigDetailsInternal)VMSyncedConfigDetail).InputEndpoint; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureToAzureVMSyncedConfigDetailsInternal)VMSyncedConfigDetail).InputEndpoint = value ?? null /* arrayOf */; } + + /// The Azure VM tags. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureToAzureVMSyncedConfigDetailsTags VMSyncedConfigDetailTag { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureToAzureVMSyncedConfigDetailsInternal)VMSyncedConfigDetail).Tag; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureToAzureVMSyncedConfigDetailsInternal)VMSyncedConfigDetail).Tag = value ?? null /* model class */; } + + /// Creates an new instance. + public A2AReplicationDetails() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__replicationProviderSpecificSettings), __replicationProviderSpecificSettings); + await eventListener.AssertObjectIsValid(nameof(__replicationProviderSpecificSettings), __replicationProviderSpecificSettings); + } + } + /// A2A provider specific settings. + public partial interface IA2AReplicationDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettings + { + /// Agent certificate expiry date. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Agent certificate expiry date.", + SerializedName = @"agentCertificateExpiryDate", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? AgentCertificateExpiryDate { get; } + /// Agent expiry date. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Agent expiry date.", + SerializedName = @"agentExpiryDate", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? AgentExpiryDate { get; set; } + /// The agent version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The agent version.", + SerializedName = @"agentVersion", + PossibleTypes = new [] { typeof(string) })] + string AgentVersion { get; set; } + /// A value indicating whether the auto protection is enabled. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether the auto protection is enabled.", + SerializedName = @"autoProtectionOfDataDisk", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AutoProtectionOfDataDisk) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AutoProtectionOfDataDisk? AutoProtectionOfDataDisk { get; set; } + /// The fabric specific object Id of the virtual machine. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The fabric specific object Id of the virtual machine.", + SerializedName = @"fabricObjectId", + PossibleTypes = new [] { typeof(string) })] + string FabricObjectId { get; set; } + /// The name of the extended location. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the extended location.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string InitialPrimaryExtendedLocationName { get; set; } + /// The extended location type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The extended location type.", + SerializedName = @"type", + PossibleTypes = new [] { typeof(string) })] + string InitialPrimaryExtendedLocationType { get; } + /// The initial primary fabric location. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The initial primary fabric location.", + SerializedName = @"initialPrimaryFabricLocation", + PossibleTypes = new [] { typeof(string) })] + string InitialPrimaryFabricLocation { get; } + /// The initial primary availability zone. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The initial primary availability zone.", + SerializedName = @"initialPrimaryZone", + PossibleTypes = new [] { typeof(string) })] + string InitialPrimaryZone { get; } + /// The name of the extended location. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the extended location.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string InitialRecoveryExtendedLocationName { get; set; } + /// The extended location type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The extended location type.", + SerializedName = @"type", + PossibleTypes = new [] { typeof(string) })] + string InitialRecoveryExtendedLocationType { get; } + /// The initial recovery fabric location. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The initial recovery fabric location.", + SerializedName = @"initialRecoveryFabricLocation", + PossibleTypes = new [] { typeof(string) })] + string InitialRecoveryFabricLocation { get; } + /// The initial recovery availability zone. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The initial recovery availability zone.", + SerializedName = @"initialRecoveryZone", + PossibleTypes = new [] { typeof(string) })] + string InitialRecoveryZone { get; } + /// A value indicating whether agent certificate update is required. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether agent certificate update is required.", + SerializedName = @"isReplicationAgentCertificateUpdateRequired", + PossibleTypes = new [] { typeof(bool) })] + bool? IsReplicationAgentCertificateUpdateRequired { get; set; } + /// A value indicating whether replication agent update is required. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether replication agent update is required.", + SerializedName = @"isReplicationAgentUpdateRequired", + PossibleTypes = new [] { typeof(bool) })] + bool? IsReplicationAgentUpdateRequired { get; set; } + /// The last heartbeat received from the source server. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The last heartbeat received from the source server.", + SerializedName = @"lastHeartbeat", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? LastHeartbeat { get; set; } + /// The time (in UTC) when the last RPO value was calculated by Protection Service. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The time (in UTC) when the last RPO value was calculated by Protection Service.", + SerializedName = @"lastRpoCalculatedTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? LastRpoCalculatedTime { get; set; } + /// + /// 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. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"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.", + SerializedName = @"lifecycleId", + PossibleTypes = new [] { typeof(string) })] + string LifecycleId { get; set; } + /// The management Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The management Id.", + SerializedName = @"managementId", + PossibleTypes = new [] { typeof(string) })] + string ManagementId { get; set; } + /// + /// The type of the monitoring job. The progress is contained in MonitoringPercentageCompletion property. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The type of the monitoring job. The progress is contained in MonitoringPercentageCompletion property.", + SerializedName = @"monitoringJobType", + PossibleTypes = new [] { typeof(string) })] + string MonitoringJobType { get; set; } + /// + /// The percentage of the monitoring job. The type of the monitoring job is defined by MonitoringJobType property. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The percentage of the monitoring job. The type of the monitoring job is defined by MonitoringJobType property.", + SerializedName = @"monitoringPercentageCompletion", + PossibleTypes = new [] { typeof(int) })] + int? MonitoringPercentageCompletion { get; set; } + /// Whether Multi VM group is auto created or specified by user. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Whether Multi VM group is auto created or specified by user.", + SerializedName = @"multiVmGroupCreateOption", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MultiVMGroupCreateOption) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MultiVMGroupCreateOption? MultiVMGroupCreateOption { get; set; } + /// The multi vm group Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The multi vm group Id.", + SerializedName = @"multiVmGroupId", + PossibleTypes = new [] { typeof(string) })] + string MultiVMGroupId { get; set; } + /// The multi vm group name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The multi vm group name.", + SerializedName = @"multiVmGroupName", + PossibleTypes = new [] { typeof(string) })] + string MultiVMGroupName { get; set; } + /// The type of operating system. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The type of operating system.", + SerializedName = @"osType", + PossibleTypes = new [] { typeof(string) })] + string OSType { get; set; } + /// The primary availability zone. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The primary availability zone.", + SerializedName = @"primaryAvailabilityZone", + PossibleTypes = new [] { typeof(string) })] + string PrimaryAvailabilityZone { get; set; } + /// The name of the extended location. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the extended location.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string PrimaryExtendedLocationName { get; set; } + /// The extended location type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The extended location type.", + SerializedName = @"type", + PossibleTypes = new [] { typeof(string) })] + string PrimaryExtendedLocationType { get; } + /// Primary fabric location. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Primary fabric location.", + SerializedName = @"primaryFabricLocation", + PossibleTypes = new [] { typeof(string) })] + string PrimaryFabricLocation { get; set; } + /// The list of protected disks. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of protected disks.", + SerializedName = @"protectedDisks", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetails) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetails[] ProtectedDisk { get; set; } + /// The list of protected managed disks. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of protected managed disks.", + SerializedName = @"protectedManagedDisks", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetails) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetails[] ProtectedManagedDisk { get; set; } + /// The recovery availability set. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery availability set.", + SerializedName = @"recoveryAvailabilitySet", + PossibleTypes = new [] { typeof(string) })] + string RecoveryAvailabilitySet { get; set; } + /// The recovery availability zone. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery availability zone.", + SerializedName = @"recoveryAvailabilityZone", + PossibleTypes = new [] { typeof(string) })] + string RecoveryAvailabilityZone { get; set; } + /// The recovery azure generation. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The recovery azure generation.", + SerializedName = @"recoveryAzureGeneration", + PossibleTypes = new [] { typeof(string) })] + string RecoveryAzureGeneration { get; } + /// The recovery resource group. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery resource group.", + SerializedName = @"recoveryAzureResourceGroupId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryAzureResourceGroupId { get; set; } + /// The name of recovery virtual machine. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of recovery virtual machine.", + SerializedName = @"recoveryAzureVMName", + PossibleTypes = new [] { typeof(string) })] + string RecoveryAzureVMName { get; set; } + /// The size of recovery virtual machine. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The size of recovery virtual machine.", + SerializedName = @"recoveryAzureVMSize", + PossibleTypes = new [] { typeof(string) })] + string RecoveryAzureVMSize { get; set; } + /// The recovery boot diagnostic storage account Arm Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery boot diagnostic storage account Arm Id.", + SerializedName = @"recoveryBootDiagStorageAccountId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryBootDiagStorageAccountId { get; set; } + /// The recovery capacity reservation group Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery capacity reservation group Id.", + SerializedName = @"recoveryCapacityReservationGroupId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryCapacityReservationGroupId { get; set; } + /// The recovery cloud service. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery cloud service.", + SerializedName = @"recoveryCloudService", + PossibleTypes = new [] { typeof(string) })] + string RecoveryCloudService { get; set; } + /// The name of the extended location. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the extended location.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string RecoveryExtendedLocationName { get; set; } + /// The extended location type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The extended location type.", + SerializedName = @"type", + PossibleTypes = new [] { typeof(string) })] + string RecoveryExtendedLocationType { get; } + /// The recovery fabric location. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery fabric location.", + SerializedName = @"recoveryFabricLocation", + PossibleTypes = new [] { typeof(string) })] + string RecoveryFabricLocation { get; set; } + /// The recovery fabric object Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery fabric object Id.", + SerializedName = @"recoveryFabricObjectId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryFabricObjectId { get; set; } + /// The recovery proximity placement group Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery proximity placement group Id.", + SerializedName = @"recoveryProximityPlacementGroupId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryProximityPlacementGroupId { get; set; } + /// The recovery virtual machine scale set id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery virtual machine scale set id.", + SerializedName = @"recoveryVirtualMachineScaleSetId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryVirtualMachineScaleSetId { get; set; } + /// The last RPO value in seconds. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The last RPO value in seconds.", + SerializedName = @"rpoInSeconds", + PossibleTypes = new [] { typeof(long) })] + long? RpoInSecond { get; set; } + /// The recovery virtual network. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery virtual network.", + SerializedName = @"selectedRecoveryAzureNetworkId", + PossibleTypes = new [] { typeof(string) })] + string SelectedRecoveryAzureNetworkId { get; set; } + /// The test failover virtual network. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The test failover virtual network.", + SerializedName = @"selectedTfoAzureNetworkId", + PossibleTypes = new [] { typeof(string) })] + string SelectedTfoAzureNetworkId { get; set; } + /// The test failover fabric object Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The test failover fabric object Id.", + SerializedName = @"testFailoverRecoveryFabricObjectId", + PossibleTypes = new [] { typeof(string) })] + string TestFailoverRecoveryFabricObjectId { get; set; } + /// The test failover vm name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The test failover vm name.", + SerializedName = @"tfoAzureVMName", + PossibleTypes = new [] { typeof(string) })] + string TfoAzureVMName { get; set; } + /// The list of unprotected disks. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of unprotected disks.", + SerializedName = @"unprotectedDisks", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUnprotectedDiskDetails) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUnprotectedDiskDetails[] UnprotectedDisk { get; set; } + /// The encryption type of the VM. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The encryption type of the VM.", + SerializedName = @"vmEncryptionType", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.VMEncryptionType) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.VMEncryptionType? VMEncryptionType { get; } + /// The virtual machine nic details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The virtual machine nic details.", + SerializedName = @"vmNics", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetails) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetails[] VMNic { get; set; } + /// The protection state for the vm. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The protection state for the vm.", + SerializedName = @"vmProtectionState", + PossibleTypes = new [] { typeof(string) })] + string VMProtectionState { get; set; } + /// The protection state description for the vm. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The protection state description for the vm.", + SerializedName = @"vmProtectionStateDescription", + PossibleTypes = new [] { typeof(string) })] + string VMProtectionStateDescription { get; set; } + /// The Azure VM input endpoints. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Azure VM input endpoints.", + SerializedName = @"inputEndpoints", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInputEndpoint) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInputEndpoint[] VMSyncedConfigDetailInputEndpoint { get; set; } + /// The Azure VM tags. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Azure VM tags.", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureToAzureVMSyncedConfigDetailsTags) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureToAzureVMSyncedConfigDetailsTags VMSyncedConfigDetailTag { get; set; } + + } + /// A2A provider specific settings. + internal partial interface IA2AReplicationDetailsInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettingsInternal + { + /// Agent certificate expiry date. + global::System.DateTime? AgentCertificateExpiryDate { get; set; } + /// Agent expiry date. + global::System.DateTime? AgentExpiryDate { get; set; } + /// The agent version. + string AgentVersion { get; set; } + /// A value indicating whether the auto protection is enabled. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AutoProtectionOfDataDisk? AutoProtectionOfDataDisk { get; set; } + /// The fabric specific object Id of the virtual machine. + string FabricObjectId { get; set; } + /// The initial primary extended location. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocation InitialPrimaryExtendedLocation { get; set; } + /// The name of the extended location. + string InitialPrimaryExtendedLocationName { get; set; } + /// The extended location type. + string InitialPrimaryExtendedLocationType { get; set; } + /// The initial primary fabric location. + string InitialPrimaryFabricLocation { get; set; } + /// The initial primary availability zone. + string InitialPrimaryZone { get; set; } + /// The initial recovery extended location. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocation InitialRecoveryExtendedLocation { get; set; } + /// The name of the extended location. + string InitialRecoveryExtendedLocationName { get; set; } + /// The extended location type. + string InitialRecoveryExtendedLocationType { get; set; } + /// The initial recovery fabric location. + string InitialRecoveryFabricLocation { get; set; } + /// The initial recovery availability zone. + string InitialRecoveryZone { get; set; } + /// A value indicating whether agent certificate update is required. + bool? IsReplicationAgentCertificateUpdateRequired { get; set; } + /// A value indicating whether replication agent update is required. + bool? IsReplicationAgentUpdateRequired { get; set; } + /// The last heartbeat received from the source server. + global::System.DateTime? LastHeartbeat { get; set; } + /// The time (in UTC) when the last RPO value was calculated by Protection Service. + global::System.DateTime? LastRpoCalculatedTime { get; set; } + /// + /// 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. + /// + string LifecycleId { get; set; } + /// The management Id. + string ManagementId { get; set; } + /// + /// The type of the monitoring job. The progress is contained in MonitoringPercentageCompletion property. + /// + string MonitoringJobType { get; set; } + /// + /// The percentage of the monitoring job. The type of the monitoring job is defined by MonitoringJobType property. + /// + int? MonitoringPercentageCompletion { get; set; } + /// Whether Multi VM group is auto created or specified by user. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MultiVMGroupCreateOption? MultiVMGroupCreateOption { get; set; } + /// The multi vm group Id. + string MultiVMGroupId { get; set; } + /// The multi vm group name. + string MultiVMGroupName { get; set; } + /// The type of operating system. + string OSType { get; set; } + /// The primary availability zone. + string PrimaryAvailabilityZone { get; set; } + /// The primary Extended Location. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocation PrimaryExtendedLocation { get; set; } + /// The name of the extended location. + string PrimaryExtendedLocationName { get; set; } + /// The extended location type. + string PrimaryExtendedLocationType { get; set; } + /// Primary fabric location. + string PrimaryFabricLocation { get; set; } + /// The list of protected disks. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetails[] ProtectedDisk { get; set; } + /// The list of protected managed disks. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetails[] ProtectedManagedDisk { get; set; } + /// The recovery availability set. + string RecoveryAvailabilitySet { get; set; } + /// The recovery availability zone. + string RecoveryAvailabilityZone { get; set; } + /// The recovery azure generation. + string RecoveryAzureGeneration { get; set; } + /// The recovery resource group. + string RecoveryAzureResourceGroupId { get; set; } + /// The name of recovery virtual machine. + string RecoveryAzureVMName { get; set; } + /// The size of recovery virtual machine. + string RecoveryAzureVMSize { get; set; } + /// The recovery boot diagnostic storage account Arm Id. + string RecoveryBootDiagStorageAccountId { get; set; } + /// The recovery capacity reservation group Id. + string RecoveryCapacityReservationGroupId { get; set; } + /// The recovery cloud service. + string RecoveryCloudService { get; set; } + /// The recovery Extended Location. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocation RecoveryExtendedLocation { get; set; } + /// The name of the extended location. + string RecoveryExtendedLocationName { get; set; } + /// The extended location type. + string RecoveryExtendedLocationType { get; set; } + /// The recovery fabric location. + string RecoveryFabricLocation { get; set; } + /// The recovery fabric object Id. + string RecoveryFabricObjectId { get; set; } + /// The recovery proximity placement group Id. + string RecoveryProximityPlacementGroupId { get; set; } + /// The recovery virtual machine scale set id. + string RecoveryVirtualMachineScaleSetId { get; set; } + /// The last RPO value in seconds. + long? RpoInSecond { get; set; } + /// The recovery virtual network. + string SelectedRecoveryAzureNetworkId { get; set; } + /// The test failover virtual network. + string SelectedTfoAzureNetworkId { get; set; } + /// The test failover fabric object Id. + string TestFailoverRecoveryFabricObjectId { get; set; } + /// The test failover vm name. + string TfoAzureVMName { get; set; } + /// The list of unprotected disks. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUnprotectedDiskDetails[] UnprotectedDisk { get; set; } + /// The encryption type of the VM. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.VMEncryptionType? VMEncryptionType { get; set; } + /// The virtual machine nic details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetails[] VMNic { get; set; } + /// The protection state for the vm. + string VMProtectionState { get; set; } + /// The protection state description for the vm. + string VMProtectionStateDescription { get; set; } + /// The synced configuration details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureToAzureVMSyncedConfigDetails VMSyncedConfigDetail { get; set; } + /// The Azure VM input endpoints. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInputEndpoint[] VMSyncedConfigDetailInputEndpoint { get; set; } + /// The Azure VM tags. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureToAzureVMSyncedConfigDetailsTags VMSyncedConfigDetailTag { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AReplicationDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AReplicationDetails.json.cs new file mode 100644 index 000000000000..1ada2c913f13 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AReplicationDetails.json.cs @@ -0,0 +1,267 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// A2A provider specific settings. + public partial class A2AReplicationDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal A2AReplicationDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __replicationProviderSpecificSettings = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProviderSpecificSettings(json); + {_initialPrimaryExtendedLocation = If( json?.PropertyT("initialPrimaryExtendedLocation"), out var __jsonInitialPrimaryExtendedLocation) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ExtendedLocation.FromJson(__jsonInitialPrimaryExtendedLocation) : InitialPrimaryExtendedLocation;} + {_initialRecoveryExtendedLocation = If( json?.PropertyT("initialRecoveryExtendedLocation"), out var __jsonInitialRecoveryExtendedLocation) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ExtendedLocation.FromJson(__jsonInitialRecoveryExtendedLocation) : InitialRecoveryExtendedLocation;} + {_vMSyncedConfigDetail = If( json?.PropertyT("vmSyncedConfigDetails"), out var __jsonVMSyncedConfigDetails) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AzureToAzureVMSyncedConfigDetails.FromJson(__jsonVMSyncedConfigDetails) : VMSyncedConfigDetail;} + {_primaryExtendedLocation = If( json?.PropertyT("primaryExtendedLocation"), out var __jsonPrimaryExtendedLocation) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ExtendedLocation.FromJson(__jsonPrimaryExtendedLocation) : PrimaryExtendedLocation;} + {_recoveryExtendedLocation = If( json?.PropertyT("recoveryExtendedLocation"), out var __jsonRecoveryExtendedLocation) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ExtendedLocation.FromJson(__jsonRecoveryExtendedLocation) : RecoveryExtendedLocation;} + {_fabricObjectId = If( json?.PropertyT("fabricObjectId"), out var __jsonFabricObjectId) ? (string)__jsonFabricObjectId : (string)FabricObjectId;} + {_initialPrimaryZone = If( json?.PropertyT("initialPrimaryZone"), out var __jsonInitialPrimaryZone) ? (string)__jsonInitialPrimaryZone : (string)InitialPrimaryZone;} + {_initialPrimaryFabricLocation = If( json?.PropertyT("initialPrimaryFabricLocation"), out var __jsonInitialPrimaryFabricLocation) ? (string)__jsonInitialPrimaryFabricLocation : (string)InitialPrimaryFabricLocation;} + {_initialRecoveryZone = If( json?.PropertyT("initialRecoveryZone"), out var __jsonInitialRecoveryZone) ? (string)__jsonInitialRecoveryZone : (string)InitialRecoveryZone;} + {_initialRecoveryFabricLocation = If( json?.PropertyT("initialRecoveryFabricLocation"), out var __jsonInitialRecoveryFabricLocation) ? (string)__jsonInitialRecoveryFabricLocation : (string)InitialRecoveryFabricLocation;} + {_multiVMGroupId = If( json?.PropertyT("multiVmGroupId"), out var __jsonMultiVMGroupId) ? (string)__jsonMultiVMGroupId : (string)MultiVMGroupId;} + {_multiVMGroupName = If( json?.PropertyT("multiVmGroupName"), out var __jsonMultiVMGroupName) ? (string)__jsonMultiVMGroupName : (string)MultiVMGroupName;} + {_multiVMGroupCreateOption = If( json?.PropertyT("multiVmGroupCreateOption"), out var __jsonMultiVMGroupCreateOption) ? (string)__jsonMultiVMGroupCreateOption : (string)MultiVMGroupCreateOption;} + {_managementId = If( json?.PropertyT("managementId"), out var __jsonManagementId) ? (string)__jsonManagementId : (string)ManagementId;} + {_protectedDisk = If( json?.PropertyT("protectedDisks"), out var __jsonProtectedDisks) ? If( __jsonProtectedDisks as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedDiskDetails) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2AProtectedDiskDetails.FromJson(__u) )) ))() : null : ProtectedDisk;} + {_unprotectedDisk = If( json?.PropertyT("unprotectedDisks"), out var __jsonUnprotectedDisks) ? If( __jsonUnprotectedDisks as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __q) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__q, (__p)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUnprotectedDiskDetails) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2AUnprotectedDiskDetails.FromJson(__p) )) ))() : null : UnprotectedDisk;} + {_protectedManagedDisk = If( json?.PropertyT("protectedManagedDisks"), out var __jsonProtectedManagedDisks) ? If( __jsonProtectedManagedDisks as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __l) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__l, (__k)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectedManagedDiskDetails) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2AProtectedManagedDiskDetails.FromJson(__k) )) ))() : null : ProtectedManagedDisk;} + {_recoveryBootDiagStorageAccountId = If( json?.PropertyT("recoveryBootDiagStorageAccountId"), out var __jsonRecoveryBootDiagStorageAccountId) ? (string)__jsonRecoveryBootDiagStorageAccountId : (string)RecoveryBootDiagStorageAccountId;} + {_primaryFabricLocation = If( json?.PropertyT("primaryFabricLocation"), out var __jsonPrimaryFabricLocation) ? (string)__jsonPrimaryFabricLocation : (string)PrimaryFabricLocation;} + {_recoveryFabricLocation = If( json?.PropertyT("recoveryFabricLocation"), out var __jsonRecoveryFabricLocation) ? (string)__jsonRecoveryFabricLocation : (string)RecoveryFabricLocation;} + {_oSType = If( json?.PropertyT("osType"), out var __jsonOSType) ? (string)__jsonOSType : (string)OSType;} + {_recoveryAzureVMSize = If( json?.PropertyT("recoveryAzureVMSize"), out var __jsonRecoveryAzureVMSize) ? (string)__jsonRecoveryAzureVMSize : (string)RecoveryAzureVMSize;} + {_recoveryAzureVMName = If( json?.PropertyT("recoveryAzureVMName"), out var __jsonRecoveryAzureVMName) ? (string)__jsonRecoveryAzureVMName : (string)RecoveryAzureVMName;} + {_recoveryAzureResourceGroupId = If( json?.PropertyT("recoveryAzureResourceGroupId"), out var __jsonRecoveryAzureResourceGroupId) ? (string)__jsonRecoveryAzureResourceGroupId : (string)RecoveryAzureResourceGroupId;} + {_recoveryCloudService = If( json?.PropertyT("recoveryCloudService"), out var __jsonRecoveryCloudService) ? (string)__jsonRecoveryCloudService : (string)RecoveryCloudService;} + {_recoveryAvailabilitySet = If( json?.PropertyT("recoveryAvailabilitySet"), out var __jsonRecoveryAvailabilitySet) ? (string)__jsonRecoveryAvailabilitySet : (string)RecoveryAvailabilitySet;} + {_selectedRecoveryAzureNetworkId = If( json?.PropertyT("selectedRecoveryAzureNetworkId"), out var __jsonSelectedRecoveryAzureNetworkId) ? (string)__jsonSelectedRecoveryAzureNetworkId : (string)SelectedRecoveryAzureNetworkId;} + {_selectedTfoAzureNetworkId = If( json?.PropertyT("selectedTfoAzureNetworkId"), out var __jsonSelectedTfoAzureNetworkId) ? (string)__jsonSelectedTfoAzureNetworkId : (string)SelectedTfoAzureNetworkId;} + {_vMNic = If( json?.PropertyT("vmNics"), out var __jsonVMNics) ? If( __jsonVMNics as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __g) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__g, (__f)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetails) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMNicDetails.FromJson(__f) )) ))() : null : VMNic;} + {_monitoringPercentageCompletion = If( json?.PropertyT("monitoringPercentageCompletion"), out var __jsonMonitoringPercentageCompletion) ? (int?)__jsonMonitoringPercentageCompletion : MonitoringPercentageCompletion;} + {_monitoringJobType = If( json?.PropertyT("monitoringJobType"), out var __jsonMonitoringJobType) ? (string)__jsonMonitoringJobType : (string)MonitoringJobType;} + {_lastHeartbeat = If( json?.PropertyT("lastHeartbeat"), out var __jsonLastHeartbeat) ? global::System.DateTime.TryParse((string)__jsonLastHeartbeat, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonLastHeartbeatValue) ? __jsonLastHeartbeatValue : LastHeartbeat : LastHeartbeat;} + {_agentVersion = If( json?.PropertyT("agentVersion"), out var __jsonAgentVersion) ? (string)__jsonAgentVersion : (string)AgentVersion;} + {_agentExpiryDate = If( json?.PropertyT("agentExpiryDate"), out var __jsonAgentExpiryDate) ? global::System.DateTime.TryParse((string)__jsonAgentExpiryDate, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonAgentExpiryDateValue) ? __jsonAgentExpiryDateValue : AgentExpiryDate : AgentExpiryDate;} + {_isReplicationAgentUpdateRequired = If( json?.PropertyT("isReplicationAgentUpdateRequired"), out var __jsonIsReplicationAgentUpdateRequired) ? (bool?)__jsonIsReplicationAgentUpdateRequired : IsReplicationAgentUpdateRequired;} + {_agentCertificateExpiryDate = If( json?.PropertyT("agentCertificateExpiryDate"), out var __jsonAgentCertificateExpiryDate) ? global::System.DateTime.TryParse((string)__jsonAgentCertificateExpiryDate, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonAgentCertificateExpiryDateValue) ? __jsonAgentCertificateExpiryDateValue : AgentCertificateExpiryDate : AgentCertificateExpiryDate;} + {_isReplicationAgentCertificateUpdateRequired = If( json?.PropertyT("isReplicationAgentCertificateUpdateRequired"), out var __jsonIsReplicationAgentCertificateUpdateRequired) ? (bool?)__jsonIsReplicationAgentCertificateUpdateRequired : IsReplicationAgentCertificateUpdateRequired;} + {_recoveryFabricObjectId = If( json?.PropertyT("recoveryFabricObjectId"), out var __jsonRecoveryFabricObjectId) ? (string)__jsonRecoveryFabricObjectId : (string)RecoveryFabricObjectId;} + {_vMProtectionState = If( json?.PropertyT("vmProtectionState"), out var __jsonVMProtectionState) ? (string)__jsonVMProtectionState : (string)VMProtectionState;} + {_vMProtectionStateDescription = If( json?.PropertyT("vmProtectionStateDescription"), out var __jsonVMProtectionStateDescription) ? (string)__jsonVMProtectionStateDescription : (string)VMProtectionStateDescription;} + {_lifecycleId = If( json?.PropertyT("lifecycleId"), out var __jsonLifecycleId) ? (string)__jsonLifecycleId : (string)LifecycleId;} + {_testFailoverRecoveryFabricObjectId = If( json?.PropertyT("testFailoverRecoveryFabricObjectId"), out var __jsonTestFailoverRecoveryFabricObjectId) ? (string)__jsonTestFailoverRecoveryFabricObjectId : (string)TestFailoverRecoveryFabricObjectId;} + {_rpoInSecond = If( json?.PropertyT("rpoInSeconds"), out var __jsonRpoInSeconds) ? (long?)__jsonRpoInSeconds : RpoInSecond;} + {_lastRpoCalculatedTime = If( json?.PropertyT("lastRpoCalculatedTime"), out var __jsonLastRpoCalculatedTime) ? global::System.DateTime.TryParse((string)__jsonLastRpoCalculatedTime, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonLastRpoCalculatedTimeValue) ? __jsonLastRpoCalculatedTimeValue : LastRpoCalculatedTime : LastRpoCalculatedTime;} + {_primaryAvailabilityZone = If( json?.PropertyT("primaryAvailabilityZone"), out var __jsonPrimaryAvailabilityZone) ? (string)__jsonPrimaryAvailabilityZone : (string)PrimaryAvailabilityZone;} + {_recoveryAvailabilityZone = If( json?.PropertyT("recoveryAvailabilityZone"), out var __jsonRecoveryAvailabilityZone) ? (string)__jsonRecoveryAvailabilityZone : (string)RecoveryAvailabilityZone;} + {_vMEncryptionType = If( json?.PropertyT("vmEncryptionType"), out var __jsonVMEncryptionType) ? (string)__jsonVMEncryptionType : (string)VMEncryptionType;} + {_tfoAzureVMName = If( json?.PropertyT("tfoAzureVMName"), out var __jsonTfoAzureVMName) ? (string)__jsonTfoAzureVMName : (string)TfoAzureVMName;} + {_recoveryAzureGeneration = If( json?.PropertyT("recoveryAzureGeneration"), out var __jsonRecoveryAzureGeneration) ? (string)__jsonRecoveryAzureGeneration : (string)RecoveryAzureGeneration;} + {_recoveryProximityPlacementGroupId = If( json?.PropertyT("recoveryProximityPlacementGroupId"), out var __jsonRecoveryProximityPlacementGroupId) ? (string)__jsonRecoveryProximityPlacementGroupId : (string)RecoveryProximityPlacementGroupId;} + {_autoProtectionOfDataDisk = If( json?.PropertyT("autoProtectionOfDataDisk"), out var __jsonAutoProtectionOfDataDisk) ? (string)__jsonAutoProtectionOfDataDisk : (string)AutoProtectionOfDataDisk;} + {_recoveryVirtualMachineScaleSetId = If( json?.PropertyT("recoveryVirtualMachineScaleSetId"), out var __jsonRecoveryVirtualMachineScaleSetId) ? (string)__jsonRecoveryVirtualMachineScaleSetId : (string)RecoveryVirtualMachineScaleSetId;} + {_recoveryCapacityReservationGroupId = If( json?.PropertyT("recoveryCapacityReservationGroupId"), out var __jsonRecoveryCapacityReservationGroupId) ? (string)__jsonRecoveryCapacityReservationGroupId : (string)RecoveryCapacityReservationGroupId;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new A2AReplicationDetails(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __replicationProviderSpecificSettings?.ToJson(container, serializationMode); + AddIf( null != this._initialPrimaryExtendedLocation ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._initialPrimaryExtendedLocation.ToJson(null,serializationMode) : null, "initialPrimaryExtendedLocation" ,container.Add ); + AddIf( null != this._initialRecoveryExtendedLocation ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._initialRecoveryExtendedLocation.ToJson(null,serializationMode) : null, "initialRecoveryExtendedLocation" ,container.Add ); + AddIf( null != this._vMSyncedConfigDetail ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._vMSyncedConfigDetail.ToJson(null,serializationMode) : null, "vmSyncedConfigDetails" ,container.Add ); + AddIf( null != this._primaryExtendedLocation ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._primaryExtendedLocation.ToJson(null,serializationMode) : null, "primaryExtendedLocation" ,container.Add ); + AddIf( null != this._recoveryExtendedLocation ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._recoveryExtendedLocation.ToJson(null,serializationMode) : null, "recoveryExtendedLocation" ,container.Add ); + AddIf( null != (((object)this._fabricObjectId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._fabricObjectId.ToString()) : null, "fabricObjectId" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._initialPrimaryZone)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._initialPrimaryZone.ToString()) : null, "initialPrimaryZone" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._initialPrimaryFabricLocation)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._initialPrimaryFabricLocation.ToString()) : null, "initialPrimaryFabricLocation" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._initialRecoveryZone)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._initialRecoveryZone.ToString()) : null, "initialRecoveryZone" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._initialRecoveryFabricLocation)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._initialRecoveryFabricLocation.ToString()) : null, "initialRecoveryFabricLocation" ,container.Add ); + } + AddIf( null != (((object)this._multiVMGroupId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._multiVMGroupId.ToString()) : null, "multiVmGroupId" ,container.Add ); + AddIf( null != (((object)this._multiVMGroupName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._multiVMGroupName.ToString()) : null, "multiVmGroupName" ,container.Add ); + AddIf( null != (((object)this._multiVMGroupCreateOption)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._multiVMGroupCreateOption.ToString()) : null, "multiVmGroupCreateOption" ,container.Add ); + AddIf( null != (((object)this._managementId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._managementId.ToString()) : null, "managementId" ,container.Add ); + if (null != this._protectedDisk) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._protectedDisk ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("protectedDisks",__w); + } + if (null != this._unprotectedDisk) + { + var __r = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __s in this._unprotectedDisk ) + { + AddIf(__s?.ToJson(null, serializationMode) ,__r.Add); + } + container.Add("unprotectedDisks",__r); + } + if (null != this._protectedManagedDisk) + { + var __m = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __n in this._protectedManagedDisk ) + { + AddIf(__n?.ToJson(null, serializationMode) ,__m.Add); + } + container.Add("protectedManagedDisks",__m); + } + AddIf( null != (((object)this._recoveryBootDiagStorageAccountId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryBootDiagStorageAccountId.ToString()) : null, "recoveryBootDiagStorageAccountId" ,container.Add ); + AddIf( null != (((object)this._primaryFabricLocation)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._primaryFabricLocation.ToString()) : null, "primaryFabricLocation" ,container.Add ); + AddIf( null != (((object)this._recoveryFabricLocation)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryFabricLocation.ToString()) : null, "recoveryFabricLocation" ,container.Add ); + AddIf( null != (((object)this._oSType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._oSType.ToString()) : null, "osType" ,container.Add ); + AddIf( null != (((object)this._recoveryAzureVMSize)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryAzureVMSize.ToString()) : null, "recoveryAzureVMSize" ,container.Add ); + AddIf( null != (((object)this._recoveryAzureVMName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryAzureVMName.ToString()) : null, "recoveryAzureVMName" ,container.Add ); + AddIf( null != (((object)this._recoveryAzureResourceGroupId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryAzureResourceGroupId.ToString()) : null, "recoveryAzureResourceGroupId" ,container.Add ); + AddIf( null != (((object)this._recoveryCloudService)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryCloudService.ToString()) : null, "recoveryCloudService" ,container.Add ); + AddIf( null != (((object)this._recoveryAvailabilitySet)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryAvailabilitySet.ToString()) : null, "recoveryAvailabilitySet" ,container.Add ); + AddIf( null != (((object)this._selectedRecoveryAzureNetworkId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._selectedRecoveryAzureNetworkId.ToString()) : null, "selectedRecoveryAzureNetworkId" ,container.Add ); + AddIf( null != (((object)this._selectedTfoAzureNetworkId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._selectedTfoAzureNetworkId.ToString()) : null, "selectedTfoAzureNetworkId" ,container.Add ); + if (null != this._vMNic) + { + var __h = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __i in this._vMNic ) + { + AddIf(__i?.ToJson(null, serializationMode) ,__h.Add); + } + container.Add("vmNics",__h); + } + AddIf( null != this._monitoringPercentageCompletion ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._monitoringPercentageCompletion) : null, "monitoringPercentageCompletion" ,container.Add ); + AddIf( null != (((object)this._monitoringJobType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._monitoringJobType.ToString()) : null, "monitoringJobType" ,container.Add ); + AddIf( null != this._lastHeartbeat ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._lastHeartbeat?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "lastHeartbeat" ,container.Add ); + AddIf( null != (((object)this._agentVersion)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._agentVersion.ToString()) : null, "agentVersion" ,container.Add ); + AddIf( null != this._agentExpiryDate ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._agentExpiryDate?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "agentExpiryDate" ,container.Add ); + AddIf( null != this._isReplicationAgentUpdateRequired ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonBoolean((bool)this._isReplicationAgentUpdateRequired) : null, "isReplicationAgentUpdateRequired" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._agentCertificateExpiryDate ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._agentCertificateExpiryDate?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "agentCertificateExpiryDate" ,container.Add ); + } + AddIf( null != this._isReplicationAgentCertificateUpdateRequired ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonBoolean((bool)this._isReplicationAgentCertificateUpdateRequired) : null, "isReplicationAgentCertificateUpdateRequired" ,container.Add ); + AddIf( null != (((object)this._recoveryFabricObjectId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryFabricObjectId.ToString()) : null, "recoveryFabricObjectId" ,container.Add ); + AddIf( null != (((object)this._vMProtectionState)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._vMProtectionState.ToString()) : null, "vmProtectionState" ,container.Add ); + AddIf( null != (((object)this._vMProtectionStateDescription)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._vMProtectionStateDescription.ToString()) : null, "vmProtectionStateDescription" ,container.Add ); + AddIf( null != (((object)this._lifecycleId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._lifecycleId.ToString()) : null, "lifecycleId" ,container.Add ); + AddIf( null != (((object)this._testFailoverRecoveryFabricObjectId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._testFailoverRecoveryFabricObjectId.ToString()) : null, "testFailoverRecoveryFabricObjectId" ,container.Add ); + AddIf( null != this._rpoInSecond ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((long)this._rpoInSecond) : null, "rpoInSeconds" ,container.Add ); + AddIf( null != this._lastRpoCalculatedTime ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._lastRpoCalculatedTime?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "lastRpoCalculatedTime" ,container.Add ); + AddIf( null != (((object)this._primaryAvailabilityZone)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._primaryAvailabilityZone.ToString()) : null, "primaryAvailabilityZone" ,container.Add ); + AddIf( null != (((object)this._recoveryAvailabilityZone)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryAvailabilityZone.ToString()) : null, "recoveryAvailabilityZone" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._vMEncryptionType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._vMEncryptionType.ToString()) : null, "vmEncryptionType" ,container.Add ); + } + AddIf( null != (((object)this._tfoAzureVMName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._tfoAzureVMName.ToString()) : null, "tfoAzureVMName" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._recoveryAzureGeneration)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryAzureGeneration.ToString()) : null, "recoveryAzureGeneration" ,container.Add ); + } + AddIf( null != (((object)this._recoveryProximityPlacementGroupId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryProximityPlacementGroupId.ToString()) : null, "recoveryProximityPlacementGroupId" ,container.Add ); + AddIf( null != (((object)this._autoProtectionOfDataDisk)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._autoProtectionOfDataDisk.ToString()) : null, "autoProtectionOfDataDisk" ,container.Add ); + AddIf( null != (((object)this._recoveryVirtualMachineScaleSetId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryVirtualMachineScaleSetId.ToString()) : null, "recoveryVirtualMachineScaleSetId" ,container.Add ); + AddIf( null != (((object)this._recoveryCapacityReservationGroupId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryCapacityReservationGroupId.ToString()) : null, "recoveryCapacityReservationGroupId" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AReplicationIntentDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AReplicationIntentDetails.PowerShell.cs new file mode 100644 index 000000000000..62fad1261760 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AReplicationIntentDetails.PowerShell.cs @@ -0,0 +1,418 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// A2A provider specific settings. + [System.ComponentModel.TypeConverter(typeof(A2AReplicationIntentDetailsTypeConverter))] + public partial class A2AReplicationIntentDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal A2AReplicationIntentDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProtectionProfile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).ProtectionProfile = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionProfileCustomDetails) content.GetValueForProperty("ProtectionProfile",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).ProtectionProfile, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProtectionProfileCustomDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("PrimaryStagingStorageAccount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).PrimaryStagingStorageAccount = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageAccountCustomDetails) content.GetValueForProperty("PrimaryStagingStorageAccount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).PrimaryStagingStorageAccount, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.StorageAccountCustomDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("RecoveryAvailabilitySet")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).RecoveryAvailabilitySet = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryAvailabilitySetCustomDetails) content.GetValueForProperty("RecoveryAvailabilitySet",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).RecoveryAvailabilitySet, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryAvailabilitySetCustomDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("RecoveryVirtualNetwork")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).RecoveryVirtualNetwork = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryVirtualNetworkCustomDetails) content.GetValueForProperty("RecoveryVirtualNetwork",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).RecoveryVirtualNetwork, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryVirtualNetworkCustomDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("RecoveryProximityPlacementGroup")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).RecoveryProximityPlacementGroup = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryProximityPlacementGroupCustomDetails) content.GetValueForProperty("RecoveryProximityPlacementGroup",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).RecoveryProximityPlacementGroup, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryProximityPlacementGroupCustomDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("RecoveryBootDiagStorageAccount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).RecoveryBootDiagStorageAccount = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageAccountCustomDetails) content.GetValueForProperty("RecoveryBootDiagStorageAccount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).RecoveryBootDiagStorageAccount, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.StorageAccountCustomDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("DiskEncryptionInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).DiskEncryptionInfo = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfo) content.GetValueForProperty("DiskEncryptionInfo",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).DiskEncryptionInfo, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DiskEncryptionInfoTypeConverter.ConvertFrom); + } + if (content.Contains("FabricObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).FabricObjectId = (string) content.GetValueForProperty("FabricObjectId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).FabricObjectId, global::System.Convert.ToString); + } + if (content.Contains("PrimaryLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).PrimaryLocation = (string) content.GetValueForProperty("PrimaryLocation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).PrimaryLocation, global::System.Convert.ToString); + } + if (content.Contains("RecoveryLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).RecoveryLocation = (string) content.GetValueForProperty("RecoveryLocation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).RecoveryLocation, global::System.Convert.ToString); + } + if (content.Contains("RecoverySubscriptionId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).RecoverySubscriptionId = (string) content.GetValueForProperty("RecoverySubscriptionId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).RecoverySubscriptionId, global::System.Convert.ToString); + } + if (content.Contains("VMDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).VMDisk = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentDiskInputDetails[]) content.GetValueForProperty("VMDisk",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).VMDisk, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2AProtectionIntentDiskInputDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("VMManagedDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).VMManagedDisk = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentManagedDiskInputDetails[]) content.GetValueForProperty("VMManagedDisk",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).VMManagedDisk, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2AProtectionIntentManagedDiskInputDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("RecoveryResourceGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).RecoveryResourceGroupId = (string) content.GetValueForProperty("RecoveryResourceGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).RecoveryResourceGroupId, global::System.Convert.ToString); + } + if (content.Contains("AutoProtectionOfDataDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).AutoProtectionOfDataDisk = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AutoProtectionOfDataDisk?) content.GetValueForProperty("AutoProtectionOfDataDisk",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).AutoProtectionOfDataDisk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AutoProtectionOfDataDisk.CreateFrom); + } + if (content.Contains("MultiVMGroupName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).MultiVMGroupName = (string) content.GetValueForProperty("MultiVMGroupName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).MultiVMGroupName, global::System.Convert.ToString); + } + if (content.Contains("MultiVMGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).MultiVMGroupId = (string) content.GetValueForProperty("MultiVMGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).MultiVMGroupId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryAvailabilityZone")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).RecoveryAvailabilityZone = (string) content.GetValueForProperty("RecoveryAvailabilityZone",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).RecoveryAvailabilityZone, global::System.Convert.ToString); + } + if (content.Contains("RecoveryAvailabilityType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).RecoveryAvailabilityType = (string) content.GetValueForProperty("RecoveryAvailabilityType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).RecoveryAvailabilityType, global::System.Convert.ToString); + } + if (content.Contains("AgentAutoUpdateStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).AgentAutoUpdateStatus = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentAutoUpdateStatus?) content.GetValueForProperty("AgentAutoUpdateStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).AgentAutoUpdateStatus, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentAutoUpdateStatus.CreateFrom); + } + if (content.Contains("AutomationAccountArmId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).AutomationAccountArmId = (string) content.GetValueForProperty("AutomationAccountArmId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).AutomationAccountArmId, global::System.Convert.ToString); + } + if (content.Contains("AutomationAccountAuthenticationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).AutomationAccountAuthenticationType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AutomationAccountAuthenticationType?) content.GetValueForProperty("AutomationAccountAuthenticationType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).AutomationAccountAuthenticationType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AutomationAccountAuthenticationType.CreateFrom); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentProviderSpecificSettingsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentProviderSpecificSettingsInternal)this).InstanceType, global::System.Convert.ToString); + } + if (content.Contains("ProtectionProfileResourceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).ProtectionProfileResourceType = (string) content.GetValueForProperty("ProtectionProfileResourceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).ProtectionProfileResourceType, global::System.Convert.ToString); + } + if (content.Contains("PrimaryStagingStorageAccountResourceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).PrimaryStagingStorageAccountResourceType = (string) content.GetValueForProperty("PrimaryStagingStorageAccountResourceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).PrimaryStagingStorageAccountResourceType, global::System.Convert.ToString); + } + if (content.Contains("RecoveryAvailabilitySetResourceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).RecoveryAvailabilitySetResourceType = (string) content.GetValueForProperty("RecoveryAvailabilitySetResourceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).RecoveryAvailabilitySetResourceType, global::System.Convert.ToString); + } + if (content.Contains("RecoveryVirtualNetworkResourceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).RecoveryVirtualNetworkResourceType = (string) content.GetValueForProperty("RecoveryVirtualNetworkResourceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).RecoveryVirtualNetworkResourceType, global::System.Convert.ToString); + } + if (content.Contains("RecoveryProximityPlacementGroupResourceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).RecoveryProximityPlacementGroupResourceType = (string) content.GetValueForProperty("RecoveryProximityPlacementGroupResourceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).RecoveryProximityPlacementGroupResourceType, global::System.Convert.ToString); + } + if (content.Contains("RecoveryBootDiagStorageAccountResourceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).RecoveryBootDiagStorageAccountResourceType = (string) content.GetValueForProperty("RecoveryBootDiagStorageAccountResourceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).RecoveryBootDiagStorageAccountResourceType, global::System.Convert.ToString); + } + if (content.Contains("DiskEncryptionInfoDiskEncryptionKeyInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).DiskEncryptionInfoDiskEncryptionKeyInfo = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionKeyInfo) content.GetValueForProperty("DiskEncryptionInfoDiskEncryptionKeyInfo",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).DiskEncryptionInfoDiskEncryptionKeyInfo, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DiskEncryptionKeyInfoTypeConverter.ConvertFrom); + } + if (content.Contains("DiskEncryptionInfoKeyEncryptionKeyInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).DiskEncryptionInfoKeyEncryptionKeyInfo = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IKeyEncryptionKeyInfo) content.GetValueForProperty("DiskEncryptionInfoKeyEncryptionKeyInfo",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).DiskEncryptionInfoKeyEncryptionKeyInfo, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.KeyEncryptionKeyInfoTypeConverter.ConvertFrom); + } + if (content.Contains("DiskEncryptionKeyInfoSecretIdentifier")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).DiskEncryptionKeyInfoSecretIdentifier = (string) content.GetValueForProperty("DiskEncryptionKeyInfoSecretIdentifier",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).DiskEncryptionKeyInfoSecretIdentifier, global::System.Convert.ToString); + } + if (content.Contains("KeyEncryptionKeyInfoKeyIdentifier")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).KeyEncryptionKeyInfoKeyIdentifier = (string) content.GetValueForProperty("KeyEncryptionKeyInfoKeyIdentifier",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).KeyEncryptionKeyInfoKeyIdentifier, global::System.Convert.ToString); + } + if (content.Contains("DiskEncryptionKeyInfoKeyVaultResourceArmId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).DiskEncryptionKeyInfoKeyVaultResourceArmId = (string) content.GetValueForProperty("DiskEncryptionKeyInfoKeyVaultResourceArmId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).DiskEncryptionKeyInfoKeyVaultResourceArmId, global::System.Convert.ToString); + } + if (content.Contains("KeyEncryptionKeyInfoKeyVaultResourceArmId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).KeyEncryptionKeyInfoKeyVaultResourceArmId = (string) content.GetValueForProperty("KeyEncryptionKeyInfoKeyVaultResourceArmId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).KeyEncryptionKeyInfoKeyVaultResourceArmId, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal A2AReplicationIntentDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProtectionProfile")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).ProtectionProfile = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionProfileCustomDetails) content.GetValueForProperty("ProtectionProfile",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).ProtectionProfile, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProtectionProfileCustomDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("PrimaryStagingStorageAccount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).PrimaryStagingStorageAccount = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageAccountCustomDetails) content.GetValueForProperty("PrimaryStagingStorageAccount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).PrimaryStagingStorageAccount, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.StorageAccountCustomDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("RecoveryAvailabilitySet")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).RecoveryAvailabilitySet = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryAvailabilitySetCustomDetails) content.GetValueForProperty("RecoveryAvailabilitySet",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).RecoveryAvailabilitySet, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryAvailabilitySetCustomDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("RecoveryVirtualNetwork")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).RecoveryVirtualNetwork = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryVirtualNetworkCustomDetails) content.GetValueForProperty("RecoveryVirtualNetwork",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).RecoveryVirtualNetwork, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryVirtualNetworkCustomDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("RecoveryProximityPlacementGroup")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).RecoveryProximityPlacementGroup = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryProximityPlacementGroupCustomDetails) content.GetValueForProperty("RecoveryProximityPlacementGroup",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).RecoveryProximityPlacementGroup, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryProximityPlacementGroupCustomDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("RecoveryBootDiagStorageAccount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).RecoveryBootDiagStorageAccount = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageAccountCustomDetails) content.GetValueForProperty("RecoveryBootDiagStorageAccount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).RecoveryBootDiagStorageAccount, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.StorageAccountCustomDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("DiskEncryptionInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).DiskEncryptionInfo = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfo) content.GetValueForProperty("DiskEncryptionInfo",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).DiskEncryptionInfo, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DiskEncryptionInfoTypeConverter.ConvertFrom); + } + if (content.Contains("FabricObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).FabricObjectId = (string) content.GetValueForProperty("FabricObjectId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).FabricObjectId, global::System.Convert.ToString); + } + if (content.Contains("PrimaryLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).PrimaryLocation = (string) content.GetValueForProperty("PrimaryLocation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).PrimaryLocation, global::System.Convert.ToString); + } + if (content.Contains("RecoveryLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).RecoveryLocation = (string) content.GetValueForProperty("RecoveryLocation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).RecoveryLocation, global::System.Convert.ToString); + } + if (content.Contains("RecoverySubscriptionId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).RecoverySubscriptionId = (string) content.GetValueForProperty("RecoverySubscriptionId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).RecoverySubscriptionId, global::System.Convert.ToString); + } + if (content.Contains("VMDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).VMDisk = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentDiskInputDetails[]) content.GetValueForProperty("VMDisk",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).VMDisk, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2AProtectionIntentDiskInputDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("VMManagedDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).VMManagedDisk = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentManagedDiskInputDetails[]) content.GetValueForProperty("VMManagedDisk",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).VMManagedDisk, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2AProtectionIntentManagedDiskInputDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("RecoveryResourceGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).RecoveryResourceGroupId = (string) content.GetValueForProperty("RecoveryResourceGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).RecoveryResourceGroupId, global::System.Convert.ToString); + } + if (content.Contains("AutoProtectionOfDataDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).AutoProtectionOfDataDisk = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AutoProtectionOfDataDisk?) content.GetValueForProperty("AutoProtectionOfDataDisk",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).AutoProtectionOfDataDisk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AutoProtectionOfDataDisk.CreateFrom); + } + if (content.Contains("MultiVMGroupName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).MultiVMGroupName = (string) content.GetValueForProperty("MultiVMGroupName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).MultiVMGroupName, global::System.Convert.ToString); + } + if (content.Contains("MultiVMGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).MultiVMGroupId = (string) content.GetValueForProperty("MultiVMGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).MultiVMGroupId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryAvailabilityZone")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).RecoveryAvailabilityZone = (string) content.GetValueForProperty("RecoveryAvailabilityZone",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).RecoveryAvailabilityZone, global::System.Convert.ToString); + } + if (content.Contains("RecoveryAvailabilityType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).RecoveryAvailabilityType = (string) content.GetValueForProperty("RecoveryAvailabilityType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).RecoveryAvailabilityType, global::System.Convert.ToString); + } + if (content.Contains("AgentAutoUpdateStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).AgentAutoUpdateStatus = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentAutoUpdateStatus?) content.GetValueForProperty("AgentAutoUpdateStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).AgentAutoUpdateStatus, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentAutoUpdateStatus.CreateFrom); + } + if (content.Contains("AutomationAccountArmId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).AutomationAccountArmId = (string) content.GetValueForProperty("AutomationAccountArmId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).AutomationAccountArmId, global::System.Convert.ToString); + } + if (content.Contains("AutomationAccountAuthenticationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).AutomationAccountAuthenticationType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AutomationAccountAuthenticationType?) content.GetValueForProperty("AutomationAccountAuthenticationType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).AutomationAccountAuthenticationType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AutomationAccountAuthenticationType.CreateFrom); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentProviderSpecificSettingsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentProviderSpecificSettingsInternal)this).InstanceType, global::System.Convert.ToString); + } + if (content.Contains("ProtectionProfileResourceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).ProtectionProfileResourceType = (string) content.GetValueForProperty("ProtectionProfileResourceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).ProtectionProfileResourceType, global::System.Convert.ToString); + } + if (content.Contains("PrimaryStagingStorageAccountResourceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).PrimaryStagingStorageAccountResourceType = (string) content.GetValueForProperty("PrimaryStagingStorageAccountResourceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).PrimaryStagingStorageAccountResourceType, global::System.Convert.ToString); + } + if (content.Contains("RecoveryAvailabilitySetResourceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).RecoveryAvailabilitySetResourceType = (string) content.GetValueForProperty("RecoveryAvailabilitySetResourceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).RecoveryAvailabilitySetResourceType, global::System.Convert.ToString); + } + if (content.Contains("RecoveryVirtualNetworkResourceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).RecoveryVirtualNetworkResourceType = (string) content.GetValueForProperty("RecoveryVirtualNetworkResourceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).RecoveryVirtualNetworkResourceType, global::System.Convert.ToString); + } + if (content.Contains("RecoveryProximityPlacementGroupResourceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).RecoveryProximityPlacementGroupResourceType = (string) content.GetValueForProperty("RecoveryProximityPlacementGroupResourceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).RecoveryProximityPlacementGroupResourceType, global::System.Convert.ToString); + } + if (content.Contains("RecoveryBootDiagStorageAccountResourceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).RecoveryBootDiagStorageAccountResourceType = (string) content.GetValueForProperty("RecoveryBootDiagStorageAccountResourceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).RecoveryBootDiagStorageAccountResourceType, global::System.Convert.ToString); + } + if (content.Contains("DiskEncryptionInfoDiskEncryptionKeyInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).DiskEncryptionInfoDiskEncryptionKeyInfo = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionKeyInfo) content.GetValueForProperty("DiskEncryptionInfoDiskEncryptionKeyInfo",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).DiskEncryptionInfoDiskEncryptionKeyInfo, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DiskEncryptionKeyInfoTypeConverter.ConvertFrom); + } + if (content.Contains("DiskEncryptionInfoKeyEncryptionKeyInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).DiskEncryptionInfoKeyEncryptionKeyInfo = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IKeyEncryptionKeyInfo) content.GetValueForProperty("DiskEncryptionInfoKeyEncryptionKeyInfo",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).DiskEncryptionInfoKeyEncryptionKeyInfo, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.KeyEncryptionKeyInfoTypeConverter.ConvertFrom); + } + if (content.Contains("DiskEncryptionKeyInfoSecretIdentifier")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).DiskEncryptionKeyInfoSecretIdentifier = (string) content.GetValueForProperty("DiskEncryptionKeyInfoSecretIdentifier",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).DiskEncryptionKeyInfoSecretIdentifier, global::System.Convert.ToString); + } + if (content.Contains("KeyEncryptionKeyInfoKeyIdentifier")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).KeyEncryptionKeyInfoKeyIdentifier = (string) content.GetValueForProperty("KeyEncryptionKeyInfoKeyIdentifier",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).KeyEncryptionKeyInfoKeyIdentifier, global::System.Convert.ToString); + } + if (content.Contains("DiskEncryptionKeyInfoKeyVaultResourceArmId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).DiskEncryptionKeyInfoKeyVaultResourceArmId = (string) content.GetValueForProperty("DiskEncryptionKeyInfoKeyVaultResourceArmId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).DiskEncryptionKeyInfoKeyVaultResourceArmId, global::System.Convert.ToString); + } + if (content.Contains("KeyEncryptionKeyInfoKeyVaultResourceArmId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).KeyEncryptionKeyInfoKeyVaultResourceArmId = (string) content.GetValueForProperty("KeyEncryptionKeyInfoKeyVaultResourceArmId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal)this).KeyEncryptionKeyInfoKeyVaultResourceArmId, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new A2AReplicationIntentDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new A2AReplicationIntentDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// A2A provider specific settings. + [System.ComponentModel.TypeConverter(typeof(A2AReplicationIntentDetailsTypeConverter))] + public partial interface IA2AReplicationIntentDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AReplicationIntentDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AReplicationIntentDetails.TypeConverter.cs new file mode 100644 index 000000000000..dc636c17ce79 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AReplicationIntentDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class A2AReplicationIntentDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return A2AReplicationIntentDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return A2AReplicationIntentDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return A2AReplicationIntentDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AReplicationIntentDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AReplicationIntentDetails.cs new file mode 100644 index 000000000000..6d597fa708ee --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AReplicationIntentDetails.cs @@ -0,0 +1,546 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// A2A provider specific settings. + public partial class A2AReplicationIntentDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentProviderSpecificSettings __replicationProtectionIntentProviderSpecificSettings = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProtectionIntentProviderSpecificSettings(); + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentAutoUpdateStatus? _agentAutoUpdateStatus; + + /// A value indicating whether the auto update is enabled. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentAutoUpdateStatus? AgentAutoUpdateStatus { get => this._agentAutoUpdateStatus; set => this._agentAutoUpdateStatus = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AutoProtectionOfDataDisk? _autoProtectionOfDataDisk; + + /// A value indicating whether the auto protection is enabled. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AutoProtectionOfDataDisk? AutoProtectionOfDataDisk { get => this._autoProtectionOfDataDisk; set => this._autoProtectionOfDataDisk = value; } + + /// Backing field for property. + private string _automationAccountArmId; + + /// The automation account arm id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string AutomationAccountArmId { get => this._automationAccountArmId; set => this._automationAccountArmId = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AutomationAccountAuthenticationType? _automationAccountAuthenticationType; + + /// A value indicating the type authentication to use for automation Account. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AutomationAccountAuthenticationType? AutomationAccountAuthenticationType { get => this._automationAccountAuthenticationType; set => this._automationAccountAuthenticationType = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfo _diskEncryptionInfo; + + /// The recovery disk encryption information (for two pass flows). + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfo DiskEncryptionInfo { get => (this._diskEncryptionInfo = this._diskEncryptionInfo ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DiskEncryptionInfo()); set => this._diskEncryptionInfo = value; } + + /// The KeyVault resource ARM id for secret. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string DiskEncryptionKeyInfoKeyVaultResourceArmId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)DiskEncryptionInfo).DiskEncryptionKeyInfoKeyVaultResourceArmId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)DiskEncryptionInfo).DiskEncryptionKeyInfoKeyVaultResourceArmId = value ?? null; } + + /// The secret url / identifier. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string DiskEncryptionKeyInfoSecretIdentifier { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)DiskEncryptionInfo).DiskEncryptionKeyInfoSecretIdentifier; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)DiskEncryptionInfo).DiskEncryptionKeyInfoSecretIdentifier = value ?? null; } + + /// Backing field for property. + private string _fabricObjectId; + + /// The fabric specific object Id of the virtual machine. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string FabricObjectId { get => this._fabricObjectId; set => this._fabricObjectId = value; } + + /// Gets the Instance type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentProviderSpecificSettingsInternal)__replicationProtectionIntentProviderSpecificSettings).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentProviderSpecificSettingsInternal)__replicationProtectionIntentProviderSpecificSettings).InstanceType = value ; } + + /// The key URL / identifier. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string KeyEncryptionKeyInfoKeyIdentifier { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)DiskEncryptionInfo).KeyEncryptionKeyInfoKeyIdentifier; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)DiskEncryptionInfo).KeyEncryptionKeyInfoKeyIdentifier = value ?? null; } + + /// The KeyVault resource ARM Id for key. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string KeyEncryptionKeyInfoKeyVaultResourceArmId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)DiskEncryptionInfo).KeyEncryptionKeyInfoKeyVaultResourceArmId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)DiskEncryptionInfo).KeyEncryptionKeyInfoKeyVaultResourceArmId = value ?? null; } + + /// Internal Acessors for DiskEncryptionInfo + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfo Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal.DiskEncryptionInfo { get => (this._diskEncryptionInfo = this._diskEncryptionInfo ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DiskEncryptionInfo()); set { {_diskEncryptionInfo = value;} } } + + /// Internal Acessors for DiskEncryptionInfoDiskEncryptionKeyInfo + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionKeyInfo Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal.DiskEncryptionInfoDiskEncryptionKeyInfo { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)DiskEncryptionInfo).DiskEncryptionKeyInfo; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)DiskEncryptionInfo).DiskEncryptionKeyInfo = value; } + + /// Internal Acessors for DiskEncryptionInfoKeyEncryptionKeyInfo + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IKeyEncryptionKeyInfo Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal.DiskEncryptionInfoKeyEncryptionKeyInfo { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)DiskEncryptionInfo).KeyEncryptionKeyInfo; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)DiskEncryptionInfo).KeyEncryptionKeyInfo = value; } + + /// Internal Acessors for PrimaryStagingStorageAccount + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageAccountCustomDetails Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal.PrimaryStagingStorageAccount { get => (this._primaryStagingStorageAccount = this._primaryStagingStorageAccount ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.StorageAccountCustomDetails()); set { {_primaryStagingStorageAccount = value;} } } + + /// Internal Acessors for ProtectionProfile + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionProfileCustomDetails Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal.ProtectionProfile { get => (this._protectionProfile = this._protectionProfile ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProtectionProfileCustomDetails()); set { {_protectionProfile = value;} } } + + /// Internal Acessors for RecoveryAvailabilitySet + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryAvailabilitySetCustomDetails Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal.RecoveryAvailabilitySet { get => (this._recoveryAvailabilitySet = this._recoveryAvailabilitySet ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryAvailabilitySetCustomDetails()); set { {_recoveryAvailabilitySet = value;} } } + + /// Internal Acessors for RecoveryBootDiagStorageAccount + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageAccountCustomDetails Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal.RecoveryBootDiagStorageAccount { get => (this._recoveryBootDiagStorageAccount = this._recoveryBootDiagStorageAccount ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.StorageAccountCustomDetails()); set { {_recoveryBootDiagStorageAccount = value;} } } + + /// Internal Acessors for RecoveryProximityPlacementGroup + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryProximityPlacementGroupCustomDetails Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal.RecoveryProximityPlacementGroup { get => (this._recoveryProximityPlacementGroup = this._recoveryProximityPlacementGroup ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryProximityPlacementGroupCustomDetails()); set { {_recoveryProximityPlacementGroup = value;} } } + + /// Internal Acessors for RecoveryVirtualNetwork + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryVirtualNetworkCustomDetails Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetailsInternal.RecoveryVirtualNetwork { get => (this._recoveryVirtualNetwork = this._recoveryVirtualNetwork ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryVirtualNetworkCustomDetails()); set { {_recoveryVirtualNetwork = value;} } } + + /// Backing field for property. + private string _multiVMGroupId; + + /// The multi vm group id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string MultiVMGroupId { get => this._multiVMGroupId; set => this._multiVMGroupId = value; } + + /// Backing field for property. + private string _multiVMGroupName; + + /// The multi vm group name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string MultiVMGroupName { get => this._multiVMGroupName; set => this._multiVMGroupName = value; } + + /// Backing field for property. + private string _primaryLocation; + + /// The primary location for the virtual machine. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string PrimaryLocation { get => this._primaryLocation; set => this._primaryLocation = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageAccountCustomDetails _primaryStagingStorageAccount; + + /// The primary staging storage account details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageAccountCustomDetails PrimaryStagingStorageAccount { get => (this._primaryStagingStorageAccount = this._primaryStagingStorageAccount ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.StorageAccountCustomDetails()); set => this._primaryStagingStorageAccount = value; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string PrimaryStagingStorageAccountResourceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageAccountCustomDetailsInternal)PrimaryStagingStorageAccount).ResourceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageAccountCustomDetailsInternal)PrimaryStagingStorageAccount).ResourceType = value ?? null; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionProfileCustomDetails _protectionProfile; + + /// The protection profile custom details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionProfileCustomDetails ProtectionProfile { get => (this._protectionProfile = this._protectionProfile ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProtectionProfileCustomDetails()); set => this._protectionProfile = value; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ProtectionProfileResourceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionProfileCustomDetailsInternal)ProtectionProfile).ResourceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionProfileCustomDetailsInternal)ProtectionProfile).ResourceType = value ?? null; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryAvailabilitySetCustomDetails _recoveryAvailabilitySet; + + /// The recovery availability set details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryAvailabilitySetCustomDetails RecoveryAvailabilitySet { get => (this._recoveryAvailabilitySet = this._recoveryAvailabilitySet ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryAvailabilitySetCustomDetails()); set => this._recoveryAvailabilitySet = value; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string RecoveryAvailabilitySetResourceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryAvailabilitySetCustomDetailsInternal)RecoveryAvailabilitySet).ResourceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryAvailabilitySetCustomDetailsInternal)RecoveryAvailabilitySet).ResourceType = value ?? null; } + + /// Backing field for property. + private string _recoveryAvailabilityType; + + /// The recovery availability type of the virtual machine. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryAvailabilityType { get => this._recoveryAvailabilityType; set => this._recoveryAvailabilityType = value; } + + /// Backing field for property. + private string _recoveryAvailabilityZone; + + /// The recovery availability zone. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryAvailabilityZone { get => this._recoveryAvailabilityZone; set => this._recoveryAvailabilityZone = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageAccountCustomDetails _recoveryBootDiagStorageAccount; + + /// The boot diagnostic storage account. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageAccountCustomDetails RecoveryBootDiagStorageAccount { get => (this._recoveryBootDiagStorageAccount = this._recoveryBootDiagStorageAccount ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.StorageAccountCustomDetails()); set => this._recoveryBootDiagStorageAccount = value; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string RecoveryBootDiagStorageAccountResourceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageAccountCustomDetailsInternal)RecoveryBootDiagStorageAccount).ResourceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageAccountCustomDetailsInternal)RecoveryBootDiagStorageAccount).ResourceType = value ?? null; } + + /// Backing field for property. + private string _recoveryLocation; + + /// The recovery location for the virtual machine. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryLocation { get => this._recoveryLocation; set => this._recoveryLocation = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryProximityPlacementGroupCustomDetails _recoveryProximityPlacementGroup; + + /// The recovery proximity placement group custom details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryProximityPlacementGroupCustomDetails RecoveryProximityPlacementGroup { get => (this._recoveryProximityPlacementGroup = this._recoveryProximityPlacementGroup ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryProximityPlacementGroupCustomDetails()); set => this._recoveryProximityPlacementGroup = value; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string RecoveryProximityPlacementGroupResourceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryProximityPlacementGroupCustomDetailsInternal)RecoveryProximityPlacementGroup).ResourceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryProximityPlacementGroupCustomDetailsInternal)RecoveryProximityPlacementGroup).ResourceType = value ?? null; } + + /// Backing field for property. + private string _recoveryResourceGroupId; + + /// The recovery resource group id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryResourceGroupId { get => this._recoveryResourceGroupId; set => this._recoveryResourceGroupId = value; } + + /// Backing field for property. + private string _recoverySubscriptionId; + + /// The recovery subscription Id of the virtual machine. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoverySubscriptionId { get => this._recoverySubscriptionId; set => this._recoverySubscriptionId = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryVirtualNetworkCustomDetails _recoveryVirtualNetwork; + + /// The recovery virtual network details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryVirtualNetworkCustomDetails RecoveryVirtualNetwork { get => (this._recoveryVirtualNetwork = this._recoveryVirtualNetwork ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryVirtualNetworkCustomDetails()); set => this._recoveryVirtualNetwork = value; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string RecoveryVirtualNetworkResourceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryVirtualNetworkCustomDetailsInternal)RecoveryVirtualNetwork).ResourceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryVirtualNetworkCustomDetailsInternal)RecoveryVirtualNetwork).ResourceType = value ?? null; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentDiskInputDetails[] _vMDisk; + + /// The list of vm disk details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentDiskInputDetails[] VMDisk { get => this._vMDisk; set => this._vMDisk = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentManagedDiskInputDetails[] _vMManagedDisk; + + /// The list of vm managed disk details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentManagedDiskInputDetails[] VMManagedDisk { get => this._vMManagedDisk; set => this._vMManagedDisk = value; } + + /// Creates an new instance. + public A2AReplicationIntentDetails() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__replicationProtectionIntentProviderSpecificSettings), __replicationProtectionIntentProviderSpecificSettings); + await eventListener.AssertObjectIsValid(nameof(__replicationProtectionIntentProviderSpecificSettings), __replicationProtectionIntentProviderSpecificSettings); + } + } + /// A2A provider specific settings. + public partial interface IA2AReplicationIntentDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentProviderSpecificSettings + { + /// A value indicating whether the auto update is enabled. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether the auto update is enabled.", + SerializedName = @"agentAutoUpdateStatus", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentAutoUpdateStatus) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentAutoUpdateStatus? AgentAutoUpdateStatus { get; set; } + /// A value indicating whether the auto protection is enabled. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether the auto protection is enabled.", + SerializedName = @"autoProtectionOfDataDisk", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AutoProtectionOfDataDisk) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AutoProtectionOfDataDisk? AutoProtectionOfDataDisk { get; set; } + /// The automation account arm id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The automation account arm id.", + SerializedName = @"automationAccountArmId", + PossibleTypes = new [] { typeof(string) })] + string AutomationAccountArmId { get; set; } + /// A value indicating the type authentication to use for automation Account. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating the type authentication to use for automation Account.", + SerializedName = @"automationAccountAuthenticationType", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AutomationAccountAuthenticationType) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AutomationAccountAuthenticationType? AutomationAccountAuthenticationType { get; set; } + /// The KeyVault resource ARM id for secret. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The KeyVault resource ARM id for secret.", + SerializedName = @"keyVaultResourceArmId", + PossibleTypes = new [] { typeof(string) })] + string DiskEncryptionKeyInfoKeyVaultResourceArmId { get; set; } + /// The secret url / identifier. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The secret url / identifier.", + SerializedName = @"secretIdentifier", + PossibleTypes = new [] { typeof(string) })] + string DiskEncryptionKeyInfoSecretIdentifier { get; set; } + /// The fabric specific object Id of the virtual machine. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The fabric specific object Id of the virtual machine.", + SerializedName = @"fabricObjectId", + PossibleTypes = new [] { typeof(string) })] + string FabricObjectId { get; set; } + /// The key URL / identifier. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The key URL / identifier.", + SerializedName = @"keyIdentifier", + PossibleTypes = new [] { typeof(string) })] + string KeyEncryptionKeyInfoKeyIdentifier { get; set; } + /// The KeyVault resource ARM Id for key. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The KeyVault resource ARM Id for key.", + SerializedName = @"keyVaultResourceArmId", + PossibleTypes = new [] { typeof(string) })] + string KeyEncryptionKeyInfoKeyVaultResourceArmId { get; set; } + /// The multi vm group id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The multi vm group id.", + SerializedName = @"multiVmGroupId", + PossibleTypes = new [] { typeof(string) })] + string MultiVMGroupId { get; set; } + /// The multi vm group name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The multi vm group name.", + SerializedName = @"multiVmGroupName", + PossibleTypes = new [] { typeof(string) })] + string MultiVMGroupName { get; set; } + /// The primary location for the virtual machine. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The primary location for the virtual machine.", + SerializedName = @"primaryLocation", + PossibleTypes = new [] { typeof(string) })] + string PrimaryLocation { get; set; } + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"resourceType", + PossibleTypes = new [] { typeof(string) })] + string PrimaryStagingStorageAccountResourceType { get; set; } + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"resourceType", + PossibleTypes = new [] { typeof(string) })] + string ProtectionProfileResourceType { get; set; } + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"resourceType", + PossibleTypes = new [] { typeof(string) })] + string RecoveryAvailabilitySetResourceType { get; set; } + /// The recovery availability type of the virtual machine. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The recovery availability type of the virtual machine.", + SerializedName = @"recoveryAvailabilityType", + PossibleTypes = new [] { typeof(string) })] + string RecoveryAvailabilityType { get; set; } + /// The recovery availability zone. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery availability zone.", + SerializedName = @"recoveryAvailabilityZone", + PossibleTypes = new [] { typeof(string) })] + string RecoveryAvailabilityZone { get; set; } + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"resourceType", + PossibleTypes = new [] { typeof(string) })] + string RecoveryBootDiagStorageAccountResourceType { get; set; } + /// The recovery location for the virtual machine. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery location for the virtual machine.", + SerializedName = @"recoveryLocation", + PossibleTypes = new [] { typeof(string) })] + string RecoveryLocation { get; set; } + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"resourceType", + PossibleTypes = new [] { typeof(string) })] + string RecoveryProximityPlacementGroupResourceType { get; set; } + /// The recovery resource group id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery resource group id.", + SerializedName = @"recoveryResourceGroupId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryResourceGroupId { get; set; } + /// The recovery subscription Id of the virtual machine. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery subscription Id of the virtual machine.", + SerializedName = @"recoverySubscriptionId", + PossibleTypes = new [] { typeof(string) })] + string RecoverySubscriptionId { get; set; } + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"resourceType", + PossibleTypes = new [] { typeof(string) })] + string RecoveryVirtualNetworkResourceType { get; set; } + /// The list of vm disk details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of vm disk details.", + SerializedName = @"vmDisks", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentDiskInputDetails) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentDiskInputDetails[] VMDisk { get; set; } + /// The list of vm managed disk details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of vm managed disk details.", + SerializedName = @"vmManagedDisks", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentManagedDiskInputDetails) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentManagedDiskInputDetails[] VMManagedDisk { get; set; } + + } + /// A2A provider specific settings. + internal partial interface IA2AReplicationIntentDetailsInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentProviderSpecificSettingsInternal + { + /// A value indicating whether the auto update is enabled. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentAutoUpdateStatus? AgentAutoUpdateStatus { get; set; } + /// A value indicating whether the auto protection is enabled. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AutoProtectionOfDataDisk? AutoProtectionOfDataDisk { get; set; } + /// The automation account arm id. + string AutomationAccountArmId { get; set; } + /// A value indicating the type authentication to use for automation Account. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AutomationAccountAuthenticationType? AutomationAccountAuthenticationType { get; set; } + /// The recovery disk encryption information (for two pass flows). + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfo DiskEncryptionInfo { get; set; } + /// The recovery KeyVault reference for secret. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionKeyInfo DiskEncryptionInfoDiskEncryptionKeyInfo { get; set; } + /// The recovery KeyVault reference for key. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IKeyEncryptionKeyInfo DiskEncryptionInfoKeyEncryptionKeyInfo { get; set; } + /// The KeyVault resource ARM id for secret. + string DiskEncryptionKeyInfoKeyVaultResourceArmId { get; set; } + /// The secret url / identifier. + string DiskEncryptionKeyInfoSecretIdentifier { get; set; } + /// The fabric specific object Id of the virtual machine. + string FabricObjectId { get; set; } + /// The key URL / identifier. + string KeyEncryptionKeyInfoKeyIdentifier { get; set; } + /// The KeyVault resource ARM Id for key. + string KeyEncryptionKeyInfoKeyVaultResourceArmId { get; set; } + /// The multi vm group id. + string MultiVMGroupId { get; set; } + /// The multi vm group name. + string MultiVMGroupName { get; set; } + /// The primary location for the virtual machine. + string PrimaryLocation { get; set; } + /// The primary staging storage account details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageAccountCustomDetails PrimaryStagingStorageAccount { get; set; } + /// The class type. + string PrimaryStagingStorageAccountResourceType { get; set; } + /// The protection profile custom details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionProfileCustomDetails ProtectionProfile { get; set; } + /// The class type. + string ProtectionProfileResourceType { get; set; } + /// The recovery availability set details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryAvailabilitySetCustomDetails RecoveryAvailabilitySet { get; set; } + /// The class type. + string RecoveryAvailabilitySetResourceType { get; set; } + /// The recovery availability type of the virtual machine. + string RecoveryAvailabilityType { get; set; } + /// The recovery availability zone. + string RecoveryAvailabilityZone { get; set; } + /// The boot diagnostic storage account. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageAccountCustomDetails RecoveryBootDiagStorageAccount { get; set; } + /// The class type. + string RecoveryBootDiagStorageAccountResourceType { get; set; } + /// The recovery location for the virtual machine. + string RecoveryLocation { get; set; } + /// The recovery proximity placement group custom details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryProximityPlacementGroupCustomDetails RecoveryProximityPlacementGroup { get; set; } + /// The class type. + string RecoveryProximityPlacementGroupResourceType { get; set; } + /// The recovery resource group id. + string RecoveryResourceGroupId { get; set; } + /// The recovery subscription Id of the virtual machine. + string RecoverySubscriptionId { get; set; } + /// The recovery virtual network details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryVirtualNetworkCustomDetails RecoveryVirtualNetwork { get; set; } + /// The class type. + string RecoveryVirtualNetworkResourceType { get; set; } + /// The list of vm disk details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentDiskInputDetails[] VMDisk { get; set; } + /// The list of vm managed disk details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentManagedDiskInputDetails[] VMManagedDisk { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AReplicationIntentDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AReplicationIntentDetails.json.cs new file mode 100644 index 000000000000..0107934bdd4e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AReplicationIntentDetails.json.cs @@ -0,0 +1,168 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// A2A provider specific settings. + public partial class A2AReplicationIntentDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal A2AReplicationIntentDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __replicationProtectionIntentProviderSpecificSettings = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProtectionIntentProviderSpecificSettings(json); + {_protectionProfile = If( json?.PropertyT("protectionProfile"), out var __jsonProtectionProfile) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProtectionProfileCustomDetails.FromJson(__jsonProtectionProfile) : ProtectionProfile;} + {_primaryStagingStorageAccount = If( json?.PropertyT("primaryStagingStorageAccount"), out var __jsonPrimaryStagingStorageAccount) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.StorageAccountCustomDetails.FromJson(__jsonPrimaryStagingStorageAccount) : PrimaryStagingStorageAccount;} + {_recoveryAvailabilitySet = If( json?.PropertyT("recoveryAvailabilitySet"), out var __jsonRecoveryAvailabilitySet) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryAvailabilitySetCustomDetails.FromJson(__jsonRecoveryAvailabilitySet) : RecoveryAvailabilitySet;} + {_recoveryVirtualNetwork = If( json?.PropertyT("recoveryVirtualNetwork"), out var __jsonRecoveryVirtualNetwork) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryVirtualNetworkCustomDetails.FromJson(__jsonRecoveryVirtualNetwork) : RecoveryVirtualNetwork;} + {_recoveryProximityPlacementGroup = If( json?.PropertyT("recoveryProximityPlacementGroup"), out var __jsonRecoveryProximityPlacementGroup) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryProximityPlacementGroupCustomDetails.FromJson(__jsonRecoveryProximityPlacementGroup) : RecoveryProximityPlacementGroup;} + {_recoveryBootDiagStorageAccount = If( json?.PropertyT("recoveryBootDiagStorageAccount"), out var __jsonRecoveryBootDiagStorageAccount) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.StorageAccountCustomDetails.FromJson(__jsonRecoveryBootDiagStorageAccount) : RecoveryBootDiagStorageAccount;} + {_diskEncryptionInfo = If( json?.PropertyT("diskEncryptionInfo"), out var __jsonDiskEncryptionInfo) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DiskEncryptionInfo.FromJson(__jsonDiskEncryptionInfo) : DiskEncryptionInfo;} + {_fabricObjectId = If( json?.PropertyT("fabricObjectId"), out var __jsonFabricObjectId) ? (string)__jsonFabricObjectId : (string)FabricObjectId;} + {_primaryLocation = If( json?.PropertyT("primaryLocation"), out var __jsonPrimaryLocation) ? (string)__jsonPrimaryLocation : (string)PrimaryLocation;} + {_recoveryLocation = If( json?.PropertyT("recoveryLocation"), out var __jsonRecoveryLocation) ? (string)__jsonRecoveryLocation : (string)RecoveryLocation;} + {_recoverySubscriptionId = If( json?.PropertyT("recoverySubscriptionId"), out var __jsonRecoverySubscriptionId) ? (string)__jsonRecoverySubscriptionId : (string)RecoverySubscriptionId;} + {_vMDisk = If( json?.PropertyT("vmDisks"), out var __jsonVMDisks) ? If( __jsonVMDisks as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentDiskInputDetails) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2AProtectionIntentDiskInputDetails.FromJson(__u) )) ))() : null : VMDisk;} + {_vMManagedDisk = If( json?.PropertyT("vmManagedDisks"), out var __jsonVMManagedDisks) ? If( __jsonVMManagedDisks as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __q) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__q, (__p)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AProtectionIntentManagedDiskInputDetails) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2AProtectionIntentManagedDiskInputDetails.FromJson(__p) )) ))() : null : VMManagedDisk;} + {_recoveryResourceGroupId = If( json?.PropertyT("recoveryResourceGroupId"), out var __jsonRecoveryResourceGroupId) ? (string)__jsonRecoveryResourceGroupId : (string)RecoveryResourceGroupId;} + {_autoProtectionOfDataDisk = If( json?.PropertyT("autoProtectionOfDataDisk"), out var __jsonAutoProtectionOfDataDisk) ? (string)__jsonAutoProtectionOfDataDisk : (string)AutoProtectionOfDataDisk;} + {_multiVMGroupName = If( json?.PropertyT("multiVmGroupName"), out var __jsonMultiVMGroupName) ? (string)__jsonMultiVMGroupName : (string)MultiVMGroupName;} + {_multiVMGroupId = If( json?.PropertyT("multiVmGroupId"), out var __jsonMultiVMGroupId) ? (string)__jsonMultiVMGroupId : (string)MultiVMGroupId;} + {_recoveryAvailabilityZone = If( json?.PropertyT("recoveryAvailabilityZone"), out var __jsonRecoveryAvailabilityZone) ? (string)__jsonRecoveryAvailabilityZone : (string)RecoveryAvailabilityZone;} + {_recoveryAvailabilityType = If( json?.PropertyT("recoveryAvailabilityType"), out var __jsonRecoveryAvailabilityType) ? (string)__jsonRecoveryAvailabilityType : (string)RecoveryAvailabilityType;} + {_agentAutoUpdateStatus = If( json?.PropertyT("agentAutoUpdateStatus"), out var __jsonAgentAutoUpdateStatus) ? (string)__jsonAgentAutoUpdateStatus : (string)AgentAutoUpdateStatus;} + {_automationAccountArmId = If( json?.PropertyT("automationAccountArmId"), out var __jsonAutomationAccountArmId) ? (string)__jsonAutomationAccountArmId : (string)AutomationAccountArmId;} + {_automationAccountAuthenticationType = If( json?.PropertyT("automationAccountAuthenticationType"), out var __jsonAutomationAccountAuthenticationType) ? (string)__jsonAutomationAccountAuthenticationType : (string)AutomationAccountAuthenticationType;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReplicationIntentDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new A2AReplicationIntentDetails(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __replicationProtectionIntentProviderSpecificSettings?.ToJson(container, serializationMode); + AddIf( null != this._protectionProfile ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._protectionProfile.ToJson(null,serializationMode) : null, "protectionProfile" ,container.Add ); + AddIf( null != this._primaryStagingStorageAccount ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._primaryStagingStorageAccount.ToJson(null,serializationMode) : null, "primaryStagingStorageAccount" ,container.Add ); + AddIf( null != this._recoveryAvailabilitySet ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._recoveryAvailabilitySet.ToJson(null,serializationMode) : null, "recoveryAvailabilitySet" ,container.Add ); + AddIf( null != this._recoveryVirtualNetwork ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._recoveryVirtualNetwork.ToJson(null,serializationMode) : null, "recoveryVirtualNetwork" ,container.Add ); + AddIf( null != this._recoveryProximityPlacementGroup ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._recoveryProximityPlacementGroup.ToJson(null,serializationMode) : null, "recoveryProximityPlacementGroup" ,container.Add ); + AddIf( null != this._recoveryBootDiagStorageAccount ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._recoveryBootDiagStorageAccount.ToJson(null,serializationMode) : null, "recoveryBootDiagStorageAccount" ,container.Add ); + AddIf( null != this._diskEncryptionInfo ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._diskEncryptionInfo.ToJson(null,serializationMode) : null, "diskEncryptionInfo" ,container.Add ); + AddIf( null != (((object)this._fabricObjectId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._fabricObjectId.ToString()) : null, "fabricObjectId" ,container.Add ); + AddIf( null != (((object)this._primaryLocation)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._primaryLocation.ToString()) : null, "primaryLocation" ,container.Add ); + AddIf( null != (((object)this._recoveryLocation)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryLocation.ToString()) : null, "recoveryLocation" ,container.Add ); + AddIf( null != (((object)this._recoverySubscriptionId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoverySubscriptionId.ToString()) : null, "recoverySubscriptionId" ,container.Add ); + if (null != this._vMDisk) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._vMDisk ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("vmDisks",__w); + } + if (null != this._vMManagedDisk) + { + var __r = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __s in this._vMManagedDisk ) + { + AddIf(__s?.ToJson(null, serializationMode) ,__r.Add); + } + container.Add("vmManagedDisks",__r); + } + AddIf( null != (((object)this._recoveryResourceGroupId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryResourceGroupId.ToString()) : null, "recoveryResourceGroupId" ,container.Add ); + AddIf( null != (((object)this._autoProtectionOfDataDisk)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._autoProtectionOfDataDisk.ToString()) : null, "autoProtectionOfDataDisk" ,container.Add ); + AddIf( null != (((object)this._multiVMGroupName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._multiVMGroupName.ToString()) : null, "multiVmGroupName" ,container.Add ); + AddIf( null != (((object)this._multiVMGroupId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._multiVMGroupId.ToString()) : null, "multiVmGroupId" ,container.Add ); + AddIf( null != (((object)this._recoveryAvailabilityZone)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryAvailabilityZone.ToString()) : null, "recoveryAvailabilityZone" ,container.Add ); + AddIf( null != (((object)this._recoveryAvailabilityType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryAvailabilityType.ToString()) : null, "recoveryAvailabilityType" ,container.Add ); + AddIf( null != (((object)this._agentAutoUpdateStatus)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._agentAutoUpdateStatus.ToString()) : null, "agentAutoUpdateStatus" ,container.Add ); + AddIf( null != (((object)this._automationAccountArmId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._automationAccountArmId.ToString()) : null, "automationAccountArmId" ,container.Add ); + AddIf( null != (((object)this._automationAccountAuthenticationType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._automationAccountAuthenticationType.ToString()) : null, "automationAccountAuthenticationType" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AReprotectInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AReprotectInput.PowerShell.cs new file mode 100644 index 000000000000..d3723cb70bab --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AReprotectInput.PowerShell.cs @@ -0,0 +1,192 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Azure specific reprotect input. + [System.ComponentModel.TypeConverter(typeof(A2AReprotectInputTypeConverter))] + public partial class A2AReprotectInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal A2AReprotectInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("RecoveryContainerId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReprotectInputInternal)this).RecoveryContainerId = (string) content.GetValueForProperty("RecoveryContainerId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReprotectInputInternal)this).RecoveryContainerId, global::System.Convert.ToString); + } + if (content.Contains("VMDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReprotectInputInternal)this).VMDisk = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmDiskInputDetails[]) content.GetValueForProperty("VMDisk",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReprotectInputInternal)this).VMDisk, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2AvmDiskInputDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("RecoveryResourceGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReprotectInputInternal)this).RecoveryResourceGroupId = (string) content.GetValueForProperty("RecoveryResourceGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReprotectInputInternal)this).RecoveryResourceGroupId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryCloudServiceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReprotectInputInternal)this).RecoveryCloudServiceId = (string) content.GetValueForProperty("RecoveryCloudServiceId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReprotectInputInternal)this).RecoveryCloudServiceId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryAvailabilitySetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReprotectInputInternal)this).RecoveryAvailabilitySetId = (string) content.GetValueForProperty("RecoveryAvailabilitySetId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReprotectInputInternal)this).RecoveryAvailabilitySetId, global::System.Convert.ToString); + } + if (content.Contains("PolicyId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReprotectInputInternal)this).PolicyId = (string) content.GetValueForProperty("PolicyId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReprotectInputInternal)this).PolicyId, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal A2AReprotectInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("RecoveryContainerId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReprotectInputInternal)this).RecoveryContainerId = (string) content.GetValueForProperty("RecoveryContainerId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReprotectInputInternal)this).RecoveryContainerId, global::System.Convert.ToString); + } + if (content.Contains("VMDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReprotectInputInternal)this).VMDisk = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmDiskInputDetails[]) content.GetValueForProperty("VMDisk",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReprotectInputInternal)this).VMDisk, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2AvmDiskInputDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("RecoveryResourceGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReprotectInputInternal)this).RecoveryResourceGroupId = (string) content.GetValueForProperty("RecoveryResourceGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReprotectInputInternal)this).RecoveryResourceGroupId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryCloudServiceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReprotectInputInternal)this).RecoveryCloudServiceId = (string) content.GetValueForProperty("RecoveryCloudServiceId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReprotectInputInternal)this).RecoveryCloudServiceId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryAvailabilitySetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReprotectInputInternal)this).RecoveryAvailabilitySetId = (string) content.GetValueForProperty("RecoveryAvailabilitySetId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReprotectInputInternal)this).RecoveryAvailabilitySetId, global::System.Convert.ToString); + } + if (content.Contains("PolicyId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReprotectInputInternal)this).PolicyId = (string) content.GetValueForProperty("PolicyId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReprotectInputInternal)this).PolicyId, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReprotectInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new A2AReprotectInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReprotectInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new A2AReprotectInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReprotectInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Azure specific reprotect input. + [System.ComponentModel.TypeConverter(typeof(A2AReprotectInputTypeConverter))] + public partial interface IA2AReprotectInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AReprotectInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AReprotectInput.TypeConverter.cs new file mode 100644 index 000000000000..410361137293 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AReprotectInput.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class A2AReprotectInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReprotectInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReprotectInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return A2AReprotectInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return A2AReprotectInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return A2AReprotectInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AReprotectInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AReprotectInput.cs new file mode 100644 index 000000000000..d3bc7b080965 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AReprotectInput.cs @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Azure specific reprotect input. + public partial class A2AReprotectInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReprotectInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReprotectInputInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationProviderSpecificInput __reverseReplicationProviderSpecificInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReverseReplicationProviderSpecificInput(); + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationProviderSpecificInputInternal)__reverseReplicationProviderSpecificInput).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationProviderSpecificInputInternal)__reverseReplicationProviderSpecificInput).InstanceType = value ; } + + /// Backing field for property. + private string _policyId; + + /// The Policy Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string PolicyId { get => this._policyId; set => this._policyId = value; } + + /// Backing field for property. + private string _recoveryAvailabilitySetId; + + /// The recovery availability set. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryAvailabilitySetId { get => this._recoveryAvailabilitySetId; set => this._recoveryAvailabilitySetId = value; } + + /// Backing field for property. + private string _recoveryCloudServiceId; + + /// The recovery cloud service Id. Valid for V1 scenarios. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryCloudServiceId { get => this._recoveryCloudServiceId; set => this._recoveryCloudServiceId = value; } + + /// Backing field for property. + private string _recoveryContainerId; + + /// The recovery container Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryContainerId { get => this._recoveryContainerId; set => this._recoveryContainerId = value; } + + /// Backing field for property. + private string _recoveryResourceGroupId; + + /// The recovery resource group Id. Valid for V2 scenarios. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryResourceGroupId { get => this._recoveryResourceGroupId; set => this._recoveryResourceGroupId = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmDiskInputDetails[] _vMDisk; + + /// The list of vm disk details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmDiskInputDetails[] VMDisk { get => this._vMDisk; set => this._vMDisk = value; } + + /// Creates an new instance. + public A2AReprotectInput() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__reverseReplicationProviderSpecificInput), __reverseReplicationProviderSpecificInput); + await eventListener.AssertObjectIsValid(nameof(__reverseReplicationProviderSpecificInput), __reverseReplicationProviderSpecificInput); + } + } + /// Azure specific reprotect input. + public partial interface IA2AReprotectInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationProviderSpecificInput + { + /// The Policy Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Policy Id.", + SerializedName = @"policyId", + PossibleTypes = new [] { typeof(string) })] + string PolicyId { get; set; } + /// The recovery availability set. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery availability set.", + SerializedName = @"recoveryAvailabilitySetId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryAvailabilitySetId { get; set; } + /// The recovery cloud service Id. Valid for V1 scenarios. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery cloud service Id. Valid for V1 scenarios.", + SerializedName = @"recoveryCloudServiceId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryCloudServiceId { get; set; } + /// The recovery container Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery container Id.", + SerializedName = @"recoveryContainerId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryContainerId { get; set; } + /// The recovery resource group Id. Valid for V2 scenarios. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery resource group Id. Valid for V2 scenarios.", + SerializedName = @"recoveryResourceGroupId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryResourceGroupId { get; set; } + /// The list of vm disk details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of vm disk details.", + SerializedName = @"vmDisks", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmDiskInputDetails) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmDiskInputDetails[] VMDisk { get; set; } + + } + /// Azure specific reprotect input. + internal partial interface IA2AReprotectInputInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationProviderSpecificInputInternal + { + /// The Policy Id. + string PolicyId { get; set; } + /// The recovery availability set. + string RecoveryAvailabilitySetId { get; set; } + /// The recovery cloud service Id. Valid for V1 scenarios. + string RecoveryCloudServiceId { get; set; } + /// The recovery container Id. + string RecoveryContainerId { get; set; } + /// The recovery resource group Id. Valid for V2 scenarios. + string RecoveryResourceGroupId { get; set; } + /// The list of vm disk details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmDiskInputDetails[] VMDisk { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AReprotectInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AReprotectInput.json.cs new file mode 100644 index 000000000000..7739f7a15cbb --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AReprotectInput.json.cs @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Azure specific reprotect input. + public partial class A2AReprotectInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal A2AReprotectInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __reverseReplicationProviderSpecificInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReverseReplicationProviderSpecificInput(json); + {_recoveryContainerId = If( json?.PropertyT("recoveryContainerId"), out var __jsonRecoveryContainerId) ? (string)__jsonRecoveryContainerId : (string)RecoveryContainerId;} + {_vMDisk = If( json?.PropertyT("vmDisks"), out var __jsonVMDisks) ? If( __jsonVMDisks as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmDiskInputDetails) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2AvmDiskInputDetails.FromJson(__u) )) ))() : null : VMDisk;} + {_recoveryResourceGroupId = If( json?.PropertyT("recoveryResourceGroupId"), out var __jsonRecoveryResourceGroupId) ? (string)__jsonRecoveryResourceGroupId : (string)RecoveryResourceGroupId;} + {_recoveryCloudServiceId = If( json?.PropertyT("recoveryCloudServiceId"), out var __jsonRecoveryCloudServiceId) ? (string)__jsonRecoveryCloudServiceId : (string)RecoveryCloudServiceId;} + {_recoveryAvailabilitySetId = If( json?.PropertyT("recoveryAvailabilitySetId"), out var __jsonRecoveryAvailabilitySetId) ? (string)__jsonRecoveryAvailabilitySetId : (string)RecoveryAvailabilitySetId;} + {_policyId = If( json?.PropertyT("policyId"), out var __jsonPolicyId) ? (string)__jsonPolicyId : (string)PolicyId;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReprotectInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReprotectInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AReprotectInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new A2AReprotectInput(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __reverseReplicationProviderSpecificInput?.ToJson(container, serializationMode); + AddIf( null != (((object)this._recoveryContainerId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryContainerId.ToString()) : null, "recoveryContainerId" ,container.Add ); + if (null != this._vMDisk) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._vMDisk ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("vmDisks",__w); + } + AddIf( null != (((object)this._recoveryResourceGroupId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryResourceGroupId.ToString()) : null, "recoveryResourceGroupId" ,container.Add ); + AddIf( null != (((object)this._recoveryCloudServiceId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryCloudServiceId.ToString()) : null, "recoveryCloudServiceId" ,container.Add ); + AddIf( null != (((object)this._recoveryAvailabilitySetId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryAvailabilitySetId.ToString()) : null, "recoveryAvailabilitySetId" ,container.Add ); + AddIf( null != (((object)this._policyId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._policyId.ToString()) : null, "policyId" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ASwitchProtectionInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ASwitchProtectionInput.PowerShell.cs new file mode 100644 index 000000000000..97b884cf46ec --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ASwitchProtectionInput.PowerShell.cs @@ -0,0 +1,298 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// A2A specific switch protection input. + [System.ComponentModel.TypeConverter(typeof(A2ASwitchProtectionInputTypeConverter))] + public partial class A2ASwitchProtectionInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal A2ASwitchProtectionInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DiskEncryptionInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ASwitchProtectionInputInternal)this).DiskEncryptionInfo = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfo) content.GetValueForProperty("DiskEncryptionInfo",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ASwitchProtectionInputInternal)this).DiskEncryptionInfo, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DiskEncryptionInfoTypeConverter.ConvertFrom); + } + if (content.Contains("RecoveryContainerId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ASwitchProtectionInputInternal)this).RecoveryContainerId = (string) content.GetValueForProperty("RecoveryContainerId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ASwitchProtectionInputInternal)this).RecoveryContainerId, global::System.Convert.ToString); + } + if (content.Contains("VMDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ASwitchProtectionInputInternal)this).VMDisk = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmDiskInputDetails[]) content.GetValueForProperty("VMDisk",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ASwitchProtectionInputInternal)this).VMDisk, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2AvmDiskInputDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("VMManagedDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ASwitchProtectionInputInternal)this).VMManagedDisk = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskInputDetails[]) content.GetValueForProperty("VMManagedDisk",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ASwitchProtectionInputInternal)this).VMManagedDisk, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2AvmManagedDiskInputDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("RecoveryResourceGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ASwitchProtectionInputInternal)this).RecoveryResourceGroupId = (string) content.GetValueForProperty("RecoveryResourceGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ASwitchProtectionInputInternal)this).RecoveryResourceGroupId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryCloudServiceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ASwitchProtectionInputInternal)this).RecoveryCloudServiceId = (string) content.GetValueForProperty("RecoveryCloudServiceId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ASwitchProtectionInputInternal)this).RecoveryCloudServiceId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryAvailabilitySetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ASwitchProtectionInputInternal)this).RecoveryAvailabilitySetId = (string) content.GetValueForProperty("RecoveryAvailabilitySetId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ASwitchProtectionInputInternal)this).RecoveryAvailabilitySetId, global::System.Convert.ToString); + } + if (content.Contains("PolicyId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ASwitchProtectionInputInternal)this).PolicyId = (string) content.GetValueForProperty("PolicyId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ASwitchProtectionInputInternal)this).PolicyId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryBootDiagStorageAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ASwitchProtectionInputInternal)this).RecoveryBootDiagStorageAccountId = (string) content.GetValueForProperty("RecoveryBootDiagStorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ASwitchProtectionInputInternal)this).RecoveryBootDiagStorageAccountId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryAvailabilityZone")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ASwitchProtectionInputInternal)this).RecoveryAvailabilityZone = (string) content.GetValueForProperty("RecoveryAvailabilityZone",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ASwitchProtectionInputInternal)this).RecoveryAvailabilityZone, global::System.Convert.ToString); + } + if (content.Contains("RecoveryProximityPlacementGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ASwitchProtectionInputInternal)this).RecoveryProximityPlacementGroupId = (string) content.GetValueForProperty("RecoveryProximityPlacementGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ASwitchProtectionInputInternal)this).RecoveryProximityPlacementGroupId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryVirtualMachineScaleSetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ASwitchProtectionInputInternal)this).RecoveryVirtualMachineScaleSetId = (string) content.GetValueForProperty("RecoveryVirtualMachineScaleSetId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ASwitchProtectionInputInternal)this).RecoveryVirtualMachineScaleSetId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryCapacityReservationGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ASwitchProtectionInputInternal)this).RecoveryCapacityReservationGroupId = (string) content.GetValueForProperty("RecoveryCapacityReservationGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ASwitchProtectionInputInternal)this).RecoveryCapacityReservationGroupId, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + if (content.Contains("DiskEncryptionInfoDiskEncryptionKeyInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ASwitchProtectionInputInternal)this).DiskEncryptionInfoDiskEncryptionKeyInfo = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionKeyInfo) content.GetValueForProperty("DiskEncryptionInfoDiskEncryptionKeyInfo",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ASwitchProtectionInputInternal)this).DiskEncryptionInfoDiskEncryptionKeyInfo, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DiskEncryptionKeyInfoTypeConverter.ConvertFrom); + } + if (content.Contains("DiskEncryptionInfoKeyEncryptionKeyInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ASwitchProtectionInputInternal)this).DiskEncryptionInfoKeyEncryptionKeyInfo = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IKeyEncryptionKeyInfo) content.GetValueForProperty("DiskEncryptionInfoKeyEncryptionKeyInfo",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ASwitchProtectionInputInternal)this).DiskEncryptionInfoKeyEncryptionKeyInfo, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.KeyEncryptionKeyInfoTypeConverter.ConvertFrom); + } + if (content.Contains("DiskEncryptionKeyInfoSecretIdentifier")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ASwitchProtectionInputInternal)this).DiskEncryptionKeyInfoSecretIdentifier = (string) content.GetValueForProperty("DiskEncryptionKeyInfoSecretIdentifier",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ASwitchProtectionInputInternal)this).DiskEncryptionKeyInfoSecretIdentifier, global::System.Convert.ToString); + } + if (content.Contains("KeyEncryptionKeyInfoKeyIdentifier")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ASwitchProtectionInputInternal)this).KeyEncryptionKeyInfoKeyIdentifier = (string) content.GetValueForProperty("KeyEncryptionKeyInfoKeyIdentifier",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ASwitchProtectionInputInternal)this).KeyEncryptionKeyInfoKeyIdentifier, global::System.Convert.ToString); + } + if (content.Contains("DiskEncryptionKeyInfoKeyVaultResourceArmId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ASwitchProtectionInputInternal)this).DiskEncryptionKeyInfoKeyVaultResourceArmId = (string) content.GetValueForProperty("DiskEncryptionKeyInfoKeyVaultResourceArmId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ASwitchProtectionInputInternal)this).DiskEncryptionKeyInfoKeyVaultResourceArmId, global::System.Convert.ToString); + } + if (content.Contains("KeyEncryptionKeyInfoKeyVaultResourceArmId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ASwitchProtectionInputInternal)this).KeyEncryptionKeyInfoKeyVaultResourceArmId = (string) content.GetValueForProperty("KeyEncryptionKeyInfoKeyVaultResourceArmId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ASwitchProtectionInputInternal)this).KeyEncryptionKeyInfoKeyVaultResourceArmId, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal A2ASwitchProtectionInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DiskEncryptionInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ASwitchProtectionInputInternal)this).DiskEncryptionInfo = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfo) content.GetValueForProperty("DiskEncryptionInfo",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ASwitchProtectionInputInternal)this).DiskEncryptionInfo, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DiskEncryptionInfoTypeConverter.ConvertFrom); + } + if (content.Contains("RecoveryContainerId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ASwitchProtectionInputInternal)this).RecoveryContainerId = (string) content.GetValueForProperty("RecoveryContainerId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ASwitchProtectionInputInternal)this).RecoveryContainerId, global::System.Convert.ToString); + } + if (content.Contains("VMDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ASwitchProtectionInputInternal)this).VMDisk = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmDiskInputDetails[]) content.GetValueForProperty("VMDisk",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ASwitchProtectionInputInternal)this).VMDisk, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2AvmDiskInputDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("VMManagedDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ASwitchProtectionInputInternal)this).VMManagedDisk = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskInputDetails[]) content.GetValueForProperty("VMManagedDisk",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ASwitchProtectionInputInternal)this).VMManagedDisk, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2AvmManagedDiskInputDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("RecoveryResourceGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ASwitchProtectionInputInternal)this).RecoveryResourceGroupId = (string) content.GetValueForProperty("RecoveryResourceGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ASwitchProtectionInputInternal)this).RecoveryResourceGroupId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryCloudServiceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ASwitchProtectionInputInternal)this).RecoveryCloudServiceId = (string) content.GetValueForProperty("RecoveryCloudServiceId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ASwitchProtectionInputInternal)this).RecoveryCloudServiceId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryAvailabilitySetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ASwitchProtectionInputInternal)this).RecoveryAvailabilitySetId = (string) content.GetValueForProperty("RecoveryAvailabilitySetId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ASwitchProtectionInputInternal)this).RecoveryAvailabilitySetId, global::System.Convert.ToString); + } + if (content.Contains("PolicyId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ASwitchProtectionInputInternal)this).PolicyId = (string) content.GetValueForProperty("PolicyId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ASwitchProtectionInputInternal)this).PolicyId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryBootDiagStorageAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ASwitchProtectionInputInternal)this).RecoveryBootDiagStorageAccountId = (string) content.GetValueForProperty("RecoveryBootDiagStorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ASwitchProtectionInputInternal)this).RecoveryBootDiagStorageAccountId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryAvailabilityZone")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ASwitchProtectionInputInternal)this).RecoveryAvailabilityZone = (string) content.GetValueForProperty("RecoveryAvailabilityZone",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ASwitchProtectionInputInternal)this).RecoveryAvailabilityZone, global::System.Convert.ToString); + } + if (content.Contains("RecoveryProximityPlacementGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ASwitchProtectionInputInternal)this).RecoveryProximityPlacementGroupId = (string) content.GetValueForProperty("RecoveryProximityPlacementGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ASwitchProtectionInputInternal)this).RecoveryProximityPlacementGroupId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryVirtualMachineScaleSetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ASwitchProtectionInputInternal)this).RecoveryVirtualMachineScaleSetId = (string) content.GetValueForProperty("RecoveryVirtualMachineScaleSetId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ASwitchProtectionInputInternal)this).RecoveryVirtualMachineScaleSetId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryCapacityReservationGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ASwitchProtectionInputInternal)this).RecoveryCapacityReservationGroupId = (string) content.GetValueForProperty("RecoveryCapacityReservationGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ASwitchProtectionInputInternal)this).RecoveryCapacityReservationGroupId, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + if (content.Contains("DiskEncryptionInfoDiskEncryptionKeyInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ASwitchProtectionInputInternal)this).DiskEncryptionInfoDiskEncryptionKeyInfo = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionKeyInfo) content.GetValueForProperty("DiskEncryptionInfoDiskEncryptionKeyInfo",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ASwitchProtectionInputInternal)this).DiskEncryptionInfoDiskEncryptionKeyInfo, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DiskEncryptionKeyInfoTypeConverter.ConvertFrom); + } + if (content.Contains("DiskEncryptionInfoKeyEncryptionKeyInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ASwitchProtectionInputInternal)this).DiskEncryptionInfoKeyEncryptionKeyInfo = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IKeyEncryptionKeyInfo) content.GetValueForProperty("DiskEncryptionInfoKeyEncryptionKeyInfo",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ASwitchProtectionInputInternal)this).DiskEncryptionInfoKeyEncryptionKeyInfo, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.KeyEncryptionKeyInfoTypeConverter.ConvertFrom); + } + if (content.Contains("DiskEncryptionKeyInfoSecretIdentifier")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ASwitchProtectionInputInternal)this).DiskEncryptionKeyInfoSecretIdentifier = (string) content.GetValueForProperty("DiskEncryptionKeyInfoSecretIdentifier",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ASwitchProtectionInputInternal)this).DiskEncryptionKeyInfoSecretIdentifier, global::System.Convert.ToString); + } + if (content.Contains("KeyEncryptionKeyInfoKeyIdentifier")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ASwitchProtectionInputInternal)this).KeyEncryptionKeyInfoKeyIdentifier = (string) content.GetValueForProperty("KeyEncryptionKeyInfoKeyIdentifier",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ASwitchProtectionInputInternal)this).KeyEncryptionKeyInfoKeyIdentifier, global::System.Convert.ToString); + } + if (content.Contains("DiskEncryptionKeyInfoKeyVaultResourceArmId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ASwitchProtectionInputInternal)this).DiskEncryptionKeyInfoKeyVaultResourceArmId = (string) content.GetValueForProperty("DiskEncryptionKeyInfoKeyVaultResourceArmId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ASwitchProtectionInputInternal)this).DiskEncryptionKeyInfoKeyVaultResourceArmId, global::System.Convert.ToString); + } + if (content.Contains("KeyEncryptionKeyInfoKeyVaultResourceArmId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ASwitchProtectionInputInternal)this).KeyEncryptionKeyInfoKeyVaultResourceArmId = (string) content.GetValueForProperty("KeyEncryptionKeyInfoKeyVaultResourceArmId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ASwitchProtectionInputInternal)this).KeyEncryptionKeyInfoKeyVaultResourceArmId, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ASwitchProtectionInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new A2ASwitchProtectionInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ASwitchProtectionInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new A2ASwitchProtectionInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ASwitchProtectionInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// A2A specific switch protection input. + [System.ComponentModel.TypeConverter(typeof(A2ASwitchProtectionInputTypeConverter))] + public partial interface IA2ASwitchProtectionInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ASwitchProtectionInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ASwitchProtectionInput.TypeConverter.cs new file mode 100644 index 000000000000..bc3172de38b1 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ASwitchProtectionInput.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class A2ASwitchProtectionInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ASwitchProtectionInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ASwitchProtectionInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return A2ASwitchProtectionInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return A2ASwitchProtectionInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return A2ASwitchProtectionInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ASwitchProtectionInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ASwitchProtectionInput.cs new file mode 100644 index 000000000000..d6249a73fa12 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ASwitchProtectionInput.cs @@ -0,0 +1,339 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// A2A specific switch protection input. + public partial class A2ASwitchProtectionInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ASwitchProtectionInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ASwitchProtectionInputInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionProviderSpecificInput __switchProtectionProviderSpecificInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.SwitchProtectionProviderSpecificInput(); + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfo _diskEncryptionInfo; + + /// The recovery disk encryption information. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfo DiskEncryptionInfo { get => (this._diskEncryptionInfo = this._diskEncryptionInfo ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DiskEncryptionInfo()); set => this._diskEncryptionInfo = value; } + + /// The KeyVault resource ARM id for secret. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string DiskEncryptionKeyInfoKeyVaultResourceArmId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)DiskEncryptionInfo).DiskEncryptionKeyInfoKeyVaultResourceArmId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)DiskEncryptionInfo).DiskEncryptionKeyInfoKeyVaultResourceArmId = value ?? null; } + + /// The secret url / identifier. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string DiskEncryptionKeyInfoSecretIdentifier { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)DiskEncryptionInfo).DiskEncryptionKeyInfoSecretIdentifier; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)DiskEncryptionInfo).DiskEncryptionKeyInfoSecretIdentifier = value ?? null; } + + /// Gets the Instance type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionProviderSpecificInputInternal)__switchProtectionProviderSpecificInput).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionProviderSpecificInputInternal)__switchProtectionProviderSpecificInput).InstanceType = value ; } + + /// The key URL / identifier. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string KeyEncryptionKeyInfoKeyIdentifier { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)DiskEncryptionInfo).KeyEncryptionKeyInfoKeyIdentifier; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)DiskEncryptionInfo).KeyEncryptionKeyInfoKeyIdentifier = value ?? null; } + + /// The KeyVault resource ARM Id for key. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string KeyEncryptionKeyInfoKeyVaultResourceArmId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)DiskEncryptionInfo).KeyEncryptionKeyInfoKeyVaultResourceArmId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)DiskEncryptionInfo).KeyEncryptionKeyInfoKeyVaultResourceArmId = value ?? null; } + + /// Internal Acessors for DiskEncryptionInfo + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfo Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ASwitchProtectionInputInternal.DiskEncryptionInfo { get => (this._diskEncryptionInfo = this._diskEncryptionInfo ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DiskEncryptionInfo()); set { {_diskEncryptionInfo = value;} } } + + /// Internal Acessors for DiskEncryptionInfoDiskEncryptionKeyInfo + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionKeyInfo Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ASwitchProtectionInputInternal.DiskEncryptionInfoDiskEncryptionKeyInfo { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)DiskEncryptionInfo).DiskEncryptionKeyInfo; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)DiskEncryptionInfo).DiskEncryptionKeyInfo = value; } + + /// Internal Acessors for DiskEncryptionInfoKeyEncryptionKeyInfo + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IKeyEncryptionKeyInfo Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ASwitchProtectionInputInternal.DiskEncryptionInfoKeyEncryptionKeyInfo { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)DiskEncryptionInfo).KeyEncryptionKeyInfo; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)DiskEncryptionInfo).KeyEncryptionKeyInfo = value; } + + /// Backing field for property. + private string _policyId; + + /// The Policy Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string PolicyId { get => this._policyId; set => this._policyId = value; } + + /// Backing field for property. + private string _recoveryAvailabilitySetId; + + /// The recovery availability set. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryAvailabilitySetId { get => this._recoveryAvailabilitySetId; set => this._recoveryAvailabilitySetId = value; } + + /// Backing field for property. + private string _recoveryAvailabilityZone; + + /// The recovery availability zone. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryAvailabilityZone { get => this._recoveryAvailabilityZone; set => this._recoveryAvailabilityZone = value; } + + /// Backing field for property. + private string _recoveryBootDiagStorageAccountId; + + /// The boot diagnostic storage account. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryBootDiagStorageAccountId { get => this._recoveryBootDiagStorageAccountId; set => this._recoveryBootDiagStorageAccountId = value; } + + /// Backing field for property. + private string _recoveryCapacityReservationGroupId; + + /// The recovery capacity reservation group Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryCapacityReservationGroupId { get => this._recoveryCapacityReservationGroupId; set => this._recoveryCapacityReservationGroupId = value; } + + /// Backing field for property. + private string _recoveryCloudServiceId; + + /// The recovery cloud service Id. Valid for V1 scenarios. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryCloudServiceId { get => this._recoveryCloudServiceId; set => this._recoveryCloudServiceId = value; } + + /// Backing field for property. + private string _recoveryContainerId; + + /// The recovery container Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryContainerId { get => this._recoveryContainerId; set => this._recoveryContainerId = value; } + + /// Backing field for property. + private string _recoveryProximityPlacementGroupId; + + /// The recovery proximity placement group Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryProximityPlacementGroupId { get => this._recoveryProximityPlacementGroupId; set => this._recoveryProximityPlacementGroupId = value; } + + /// Backing field for property. + private string _recoveryResourceGroupId; + + /// The recovery resource group Id. Valid for V2 scenarios. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryResourceGroupId { get => this._recoveryResourceGroupId; set => this._recoveryResourceGroupId = value; } + + /// Backing field for property. + private string _recoveryVirtualMachineScaleSetId; + + /// The virtual machine scale set id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryVirtualMachineScaleSetId { get => this._recoveryVirtualMachineScaleSetId; set => this._recoveryVirtualMachineScaleSetId = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmDiskInputDetails[] _vMDisk; + + /// The list of vm disk details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmDiskInputDetails[] VMDisk { get => this._vMDisk; set => this._vMDisk = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskInputDetails[] _vMManagedDisk; + + /// The list of vm managed disk details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskInputDetails[] VMManagedDisk { get => this._vMManagedDisk; set => this._vMManagedDisk = value; } + + /// Creates an new instance. + public A2ASwitchProtectionInput() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__switchProtectionProviderSpecificInput), __switchProtectionProviderSpecificInput); + await eventListener.AssertObjectIsValid(nameof(__switchProtectionProviderSpecificInput), __switchProtectionProviderSpecificInput); + } + } + /// A2A specific switch protection input. + public partial interface IA2ASwitchProtectionInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionProviderSpecificInput + { + /// The KeyVault resource ARM id for secret. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The KeyVault resource ARM id for secret.", + SerializedName = @"keyVaultResourceArmId", + PossibleTypes = new [] { typeof(string) })] + string DiskEncryptionKeyInfoKeyVaultResourceArmId { get; set; } + /// The secret url / identifier. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The secret url / identifier.", + SerializedName = @"secretIdentifier", + PossibleTypes = new [] { typeof(string) })] + string DiskEncryptionKeyInfoSecretIdentifier { get; set; } + /// The key URL / identifier. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The key URL / identifier.", + SerializedName = @"keyIdentifier", + PossibleTypes = new [] { typeof(string) })] + string KeyEncryptionKeyInfoKeyIdentifier { get; set; } + /// The KeyVault resource ARM Id for key. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The KeyVault resource ARM Id for key.", + SerializedName = @"keyVaultResourceArmId", + PossibleTypes = new [] { typeof(string) })] + string KeyEncryptionKeyInfoKeyVaultResourceArmId { get; set; } + /// The Policy Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Policy Id.", + SerializedName = @"policyId", + PossibleTypes = new [] { typeof(string) })] + string PolicyId { get; set; } + /// The recovery availability set. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery availability set.", + SerializedName = @"recoveryAvailabilitySetId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryAvailabilitySetId { get; set; } + /// The recovery availability zone. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery availability zone.", + SerializedName = @"recoveryAvailabilityZone", + PossibleTypes = new [] { typeof(string) })] + string RecoveryAvailabilityZone { get; set; } + /// The boot diagnostic storage account. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The boot diagnostic storage account.", + SerializedName = @"recoveryBootDiagStorageAccountId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryBootDiagStorageAccountId { get; set; } + /// The recovery capacity reservation group Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery capacity reservation group Id.", + SerializedName = @"recoveryCapacityReservationGroupId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryCapacityReservationGroupId { get; set; } + /// The recovery cloud service Id. Valid for V1 scenarios. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery cloud service Id. Valid for V1 scenarios.", + SerializedName = @"recoveryCloudServiceId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryCloudServiceId { get; set; } + /// The recovery container Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery container Id.", + SerializedName = @"recoveryContainerId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryContainerId { get; set; } + /// The recovery proximity placement group Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery proximity placement group Id.", + SerializedName = @"recoveryProximityPlacementGroupId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryProximityPlacementGroupId { get; set; } + /// The recovery resource group Id. Valid for V2 scenarios. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery resource group Id. Valid for V2 scenarios.", + SerializedName = @"recoveryResourceGroupId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryResourceGroupId { get; set; } + /// The virtual machine scale set id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The virtual machine scale set id.", + SerializedName = @"recoveryVirtualMachineScaleSetId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryVirtualMachineScaleSetId { get; set; } + /// The list of vm disk details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of vm disk details.", + SerializedName = @"vmDisks", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmDiskInputDetails) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmDiskInputDetails[] VMDisk { get; set; } + /// The list of vm managed disk details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of vm managed disk details.", + SerializedName = @"vmManagedDisks", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskInputDetails) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskInputDetails[] VMManagedDisk { get; set; } + + } + /// A2A specific switch protection input. + internal partial interface IA2ASwitchProtectionInputInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionProviderSpecificInputInternal + { + /// The recovery disk encryption information. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfo DiskEncryptionInfo { get; set; } + /// The recovery KeyVault reference for secret. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionKeyInfo DiskEncryptionInfoDiskEncryptionKeyInfo { get; set; } + /// The recovery KeyVault reference for key. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IKeyEncryptionKeyInfo DiskEncryptionInfoKeyEncryptionKeyInfo { get; set; } + /// The KeyVault resource ARM id for secret. + string DiskEncryptionKeyInfoKeyVaultResourceArmId { get; set; } + /// The secret url / identifier. + string DiskEncryptionKeyInfoSecretIdentifier { get; set; } + /// The key URL / identifier. + string KeyEncryptionKeyInfoKeyIdentifier { get; set; } + /// The KeyVault resource ARM Id for key. + string KeyEncryptionKeyInfoKeyVaultResourceArmId { get; set; } + /// The Policy Id. + string PolicyId { get; set; } + /// The recovery availability set. + string RecoveryAvailabilitySetId { get; set; } + /// The recovery availability zone. + string RecoveryAvailabilityZone { get; set; } + /// The boot diagnostic storage account. + string RecoveryBootDiagStorageAccountId { get; set; } + /// The recovery capacity reservation group Id. + string RecoveryCapacityReservationGroupId { get; set; } + /// The recovery cloud service Id. Valid for V1 scenarios. + string RecoveryCloudServiceId { get; set; } + /// The recovery container Id. + string RecoveryContainerId { get; set; } + /// The recovery proximity placement group Id. + string RecoveryProximityPlacementGroupId { get; set; } + /// The recovery resource group Id. Valid for V2 scenarios. + string RecoveryResourceGroupId { get; set; } + /// The virtual machine scale set id. + string RecoveryVirtualMachineScaleSetId { get; set; } + /// The list of vm disk details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmDiskInputDetails[] VMDisk { get; set; } + /// The list of vm managed disk details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskInputDetails[] VMManagedDisk { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ASwitchProtectionInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ASwitchProtectionInput.json.cs new file mode 100644 index 000000000000..8e61b22f9bdb --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ASwitchProtectionInput.json.cs @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// A2A specific switch protection input. + public partial class A2ASwitchProtectionInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal A2ASwitchProtectionInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __switchProtectionProviderSpecificInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.SwitchProtectionProviderSpecificInput(json); + {_diskEncryptionInfo = If( json?.PropertyT("diskEncryptionInfo"), out var __jsonDiskEncryptionInfo) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DiskEncryptionInfo.FromJson(__jsonDiskEncryptionInfo) : DiskEncryptionInfo;} + {_recoveryContainerId = If( json?.PropertyT("recoveryContainerId"), out var __jsonRecoveryContainerId) ? (string)__jsonRecoveryContainerId : (string)RecoveryContainerId;} + {_vMDisk = If( json?.PropertyT("vmDisks"), out var __jsonVMDisks) ? If( __jsonVMDisks as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmDiskInputDetails) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2AvmDiskInputDetails.FromJson(__u) )) ))() : null : VMDisk;} + {_vMManagedDisk = If( json?.PropertyT("vmManagedDisks"), out var __jsonVMManagedDisks) ? If( __jsonVMManagedDisks as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __q) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__q, (__p)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskInputDetails) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2AvmManagedDiskInputDetails.FromJson(__p) )) ))() : null : VMManagedDisk;} + {_recoveryResourceGroupId = If( json?.PropertyT("recoveryResourceGroupId"), out var __jsonRecoveryResourceGroupId) ? (string)__jsonRecoveryResourceGroupId : (string)RecoveryResourceGroupId;} + {_recoveryCloudServiceId = If( json?.PropertyT("recoveryCloudServiceId"), out var __jsonRecoveryCloudServiceId) ? (string)__jsonRecoveryCloudServiceId : (string)RecoveryCloudServiceId;} + {_recoveryAvailabilitySetId = If( json?.PropertyT("recoveryAvailabilitySetId"), out var __jsonRecoveryAvailabilitySetId) ? (string)__jsonRecoveryAvailabilitySetId : (string)RecoveryAvailabilitySetId;} + {_policyId = If( json?.PropertyT("policyId"), out var __jsonPolicyId) ? (string)__jsonPolicyId : (string)PolicyId;} + {_recoveryBootDiagStorageAccountId = If( json?.PropertyT("recoveryBootDiagStorageAccountId"), out var __jsonRecoveryBootDiagStorageAccountId) ? (string)__jsonRecoveryBootDiagStorageAccountId : (string)RecoveryBootDiagStorageAccountId;} + {_recoveryAvailabilityZone = If( json?.PropertyT("recoveryAvailabilityZone"), out var __jsonRecoveryAvailabilityZone) ? (string)__jsonRecoveryAvailabilityZone : (string)RecoveryAvailabilityZone;} + {_recoveryProximityPlacementGroupId = If( json?.PropertyT("recoveryProximityPlacementGroupId"), out var __jsonRecoveryProximityPlacementGroupId) ? (string)__jsonRecoveryProximityPlacementGroupId : (string)RecoveryProximityPlacementGroupId;} + {_recoveryVirtualMachineScaleSetId = If( json?.PropertyT("recoveryVirtualMachineScaleSetId"), out var __jsonRecoveryVirtualMachineScaleSetId) ? (string)__jsonRecoveryVirtualMachineScaleSetId : (string)RecoveryVirtualMachineScaleSetId;} + {_recoveryCapacityReservationGroupId = If( json?.PropertyT("recoveryCapacityReservationGroupId"), out var __jsonRecoveryCapacityReservationGroupId) ? (string)__jsonRecoveryCapacityReservationGroupId : (string)RecoveryCapacityReservationGroupId;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ASwitchProtectionInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ASwitchProtectionInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ASwitchProtectionInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new A2ASwitchProtectionInput(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __switchProtectionProviderSpecificInput?.ToJson(container, serializationMode); + AddIf( null != this._diskEncryptionInfo ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._diskEncryptionInfo.ToJson(null,serializationMode) : null, "diskEncryptionInfo" ,container.Add ); + AddIf( null != (((object)this._recoveryContainerId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryContainerId.ToString()) : null, "recoveryContainerId" ,container.Add ); + if (null != this._vMDisk) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._vMDisk ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("vmDisks",__w); + } + if (null != this._vMManagedDisk) + { + var __r = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __s in this._vMManagedDisk ) + { + AddIf(__s?.ToJson(null, serializationMode) ,__r.Add); + } + container.Add("vmManagedDisks",__r); + } + AddIf( null != (((object)this._recoveryResourceGroupId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryResourceGroupId.ToString()) : null, "recoveryResourceGroupId" ,container.Add ); + AddIf( null != (((object)this._recoveryCloudServiceId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryCloudServiceId.ToString()) : null, "recoveryCloudServiceId" ,container.Add ); + AddIf( null != (((object)this._recoveryAvailabilitySetId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryAvailabilitySetId.ToString()) : null, "recoveryAvailabilitySetId" ,container.Add ); + AddIf( null != (((object)this._policyId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._policyId.ToString()) : null, "policyId" ,container.Add ); + AddIf( null != (((object)this._recoveryBootDiagStorageAccountId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryBootDiagStorageAccountId.ToString()) : null, "recoveryBootDiagStorageAccountId" ,container.Add ); + AddIf( null != (((object)this._recoveryAvailabilityZone)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryAvailabilityZone.ToString()) : null, "recoveryAvailabilityZone" ,container.Add ); + AddIf( null != (((object)this._recoveryProximityPlacementGroupId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryProximityPlacementGroupId.ToString()) : null, "recoveryProximityPlacementGroupId" ,container.Add ); + AddIf( null != (((object)this._recoveryVirtualMachineScaleSetId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryVirtualMachineScaleSetId.ToString()) : null, "recoveryVirtualMachineScaleSetId" ,container.Add ); + AddIf( null != (((object)this._recoveryCapacityReservationGroupId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryCapacityReservationGroupId.ToString()) : null, "recoveryCapacityReservationGroupId" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ATestFailoverInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ATestFailoverInput.PowerShell.cs new file mode 100644 index 000000000000..7f8f2668612c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ATestFailoverInput.PowerShell.cs @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// A2A provider specific input for test failover. + [System.ComponentModel.TypeConverter(typeof(A2ATestFailoverInputTypeConverter))] + public partial class A2ATestFailoverInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal A2ATestFailoverInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("RecoveryPointId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ATestFailoverInputInternal)this).RecoveryPointId = (string) content.GetValueForProperty("RecoveryPointId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ATestFailoverInputInternal)this).RecoveryPointId, global::System.Convert.ToString); + } + if (content.Contains("CloudServiceCreationOption")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ATestFailoverInputInternal)this).CloudServiceCreationOption = (string) content.GetValueForProperty("CloudServiceCreationOption",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ATestFailoverInputInternal)this).CloudServiceCreationOption, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal A2ATestFailoverInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("RecoveryPointId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ATestFailoverInputInternal)this).RecoveryPointId = (string) content.GetValueForProperty("RecoveryPointId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ATestFailoverInputInternal)this).RecoveryPointId, global::System.Convert.ToString); + } + if (content.Contains("CloudServiceCreationOption")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ATestFailoverInputInternal)this).CloudServiceCreationOption = (string) content.GetValueForProperty("CloudServiceCreationOption",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ATestFailoverInputInternal)this).CloudServiceCreationOption, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ATestFailoverInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new A2ATestFailoverInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ATestFailoverInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new A2ATestFailoverInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ATestFailoverInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// A2A provider specific input for test failover. + [System.ComponentModel.TypeConverter(typeof(A2ATestFailoverInputTypeConverter))] + public partial interface IA2ATestFailoverInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ATestFailoverInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ATestFailoverInput.TypeConverter.cs new file mode 100644 index 000000000000..1a2acef78c4c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ATestFailoverInput.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class A2ATestFailoverInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ATestFailoverInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ATestFailoverInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return A2ATestFailoverInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return A2ATestFailoverInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return A2ATestFailoverInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ATestFailoverInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ATestFailoverInput.cs new file mode 100644 index 000000000000..74e48d075c88 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ATestFailoverInput.cs @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// A2A provider specific input for test failover. + public partial class A2ATestFailoverInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ATestFailoverInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ATestFailoverInputInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverProviderSpecificInput __testFailoverProviderSpecificInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.TestFailoverProviderSpecificInput(); + + /// Backing field for property. + private string _cloudServiceCreationOption; + + /// A value indicating whether to use recovery cloud service for TFO or not. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string CloudServiceCreationOption { get => this._cloudServiceCreationOption; set => this._cloudServiceCreationOption = value; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverProviderSpecificInputInternal)__testFailoverProviderSpecificInput).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverProviderSpecificInputInternal)__testFailoverProviderSpecificInput).InstanceType = value ; } + + /// Backing field for property. + private string _recoveryPointId; + + /// + /// 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. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryPointId { get => this._recoveryPointId; set => this._recoveryPointId = value; } + + /// Creates an new instance. + public A2ATestFailoverInput() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__testFailoverProviderSpecificInput), __testFailoverProviderSpecificInput); + await eventListener.AssertObjectIsValid(nameof(__testFailoverProviderSpecificInput), __testFailoverProviderSpecificInput); + } + } + /// A2A provider specific input for test failover. + public partial interface IA2ATestFailoverInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverProviderSpecificInput + { + /// A value indicating whether to use recovery cloud service for TFO or not. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether to use recovery cloud service for TFO or not.", + SerializedName = @"cloudServiceCreationOption", + PossibleTypes = new [] { typeof(string) })] + string CloudServiceCreationOption { get; set; } + /// + /// 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. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"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.", + SerializedName = @"recoveryPointId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryPointId { get; set; } + + } + /// A2A provider specific input for test failover. + internal partial interface IA2ATestFailoverInputInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverProviderSpecificInputInternal + { + /// A value indicating whether to use recovery cloud service for TFO or not. + string CloudServiceCreationOption { get; set; } + /// + /// 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. + /// + string RecoveryPointId { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ATestFailoverInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ATestFailoverInput.json.cs new file mode 100644 index 000000000000..00ca81962414 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2ATestFailoverInput.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// A2A provider specific input for test failover. + public partial class A2ATestFailoverInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal A2ATestFailoverInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __testFailoverProviderSpecificInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.TestFailoverProviderSpecificInput(json); + {_recoveryPointId = If( json?.PropertyT("recoveryPointId"), out var __jsonRecoveryPointId) ? (string)__jsonRecoveryPointId : (string)RecoveryPointId;} + {_cloudServiceCreationOption = If( json?.PropertyT("cloudServiceCreationOption"), out var __jsonCloudServiceCreationOption) ? (string)__jsonCloudServiceCreationOption : (string)CloudServiceCreationOption;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ATestFailoverInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ATestFailoverInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2ATestFailoverInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new A2ATestFailoverInput(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __testFailoverProviderSpecificInput?.ToJson(container, serializationMode); + AddIf( null != (((object)this._recoveryPointId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryPointId.ToString()) : null, "recoveryPointId" ,container.Add ); + AddIf( null != (((object)this._cloudServiceCreationOption)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._cloudServiceCreationOption.ToString()) : null, "cloudServiceCreationOption" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AUnplannedFailoverInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AUnplannedFailoverInput.PowerShell.cs new file mode 100644 index 000000000000..94f8189177ee --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AUnplannedFailoverInput.PowerShell.cs @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// A2A provider specific input for unplanned failover. + [System.ComponentModel.TypeConverter(typeof(A2AUnplannedFailoverInputTypeConverter))] + public partial class A2AUnplannedFailoverInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal A2AUnplannedFailoverInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("RecoveryPointId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUnplannedFailoverInputInternal)this).RecoveryPointId = (string) content.GetValueForProperty("RecoveryPointId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUnplannedFailoverInputInternal)this).RecoveryPointId, global::System.Convert.ToString); + } + if (content.Contains("CloudServiceCreationOption")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUnplannedFailoverInputInternal)this).CloudServiceCreationOption = (string) content.GetValueForProperty("CloudServiceCreationOption",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUnplannedFailoverInputInternal)this).CloudServiceCreationOption, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal A2AUnplannedFailoverInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("RecoveryPointId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUnplannedFailoverInputInternal)this).RecoveryPointId = (string) content.GetValueForProperty("RecoveryPointId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUnplannedFailoverInputInternal)this).RecoveryPointId, global::System.Convert.ToString); + } + if (content.Contains("CloudServiceCreationOption")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUnplannedFailoverInputInternal)this).CloudServiceCreationOption = (string) content.GetValueForProperty("CloudServiceCreationOption",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUnplannedFailoverInputInternal)this).CloudServiceCreationOption, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUnplannedFailoverInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new A2AUnplannedFailoverInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUnplannedFailoverInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new A2AUnplannedFailoverInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUnplannedFailoverInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// A2A provider specific input for unplanned failover. + [System.ComponentModel.TypeConverter(typeof(A2AUnplannedFailoverInputTypeConverter))] + public partial interface IA2AUnplannedFailoverInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AUnplannedFailoverInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AUnplannedFailoverInput.TypeConverter.cs new file mode 100644 index 000000000000..88d0eba46ff7 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AUnplannedFailoverInput.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class A2AUnplannedFailoverInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUnplannedFailoverInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUnplannedFailoverInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return A2AUnplannedFailoverInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return A2AUnplannedFailoverInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return A2AUnplannedFailoverInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AUnplannedFailoverInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AUnplannedFailoverInput.cs new file mode 100644 index 000000000000..c9bea23ca683 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AUnplannedFailoverInput.cs @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// A2A provider specific input for unplanned failover. + public partial class A2AUnplannedFailoverInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUnplannedFailoverInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUnplannedFailoverInputInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverProviderSpecificInput __unplannedFailoverProviderSpecificInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UnplannedFailoverProviderSpecificInput(); + + /// Backing field for property. + private string _cloudServiceCreationOption; + + /// A value indicating whether to use recovery cloud service for failover or not. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string CloudServiceCreationOption { get => this._cloudServiceCreationOption; set => this._cloudServiceCreationOption = value; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverProviderSpecificInputInternal)__unplannedFailoverProviderSpecificInput).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverProviderSpecificInputInternal)__unplannedFailoverProviderSpecificInput).InstanceType = value ; } + + /// Backing field for property. + private string _recoveryPointId; + + /// + /// The recovery point id to be passed to failover to a particular recovery point. In case of latest recovery point, null + /// should be passed. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryPointId { get => this._recoveryPointId; set => this._recoveryPointId = value; } + + /// Creates an new instance. + public A2AUnplannedFailoverInput() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__unplannedFailoverProviderSpecificInput), __unplannedFailoverProviderSpecificInput); + await eventListener.AssertObjectIsValid(nameof(__unplannedFailoverProviderSpecificInput), __unplannedFailoverProviderSpecificInput); + } + } + /// A2A provider specific input for unplanned failover. + public partial interface IA2AUnplannedFailoverInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverProviderSpecificInput + { + /// A value indicating whether to use recovery cloud service for failover or not. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether to use recovery cloud service for failover or not.", + SerializedName = @"cloudServiceCreationOption", + PossibleTypes = new [] { typeof(string) })] + string CloudServiceCreationOption { get; set; } + /// + /// The recovery point id to be passed to failover to a particular recovery point. In case of latest recovery point, null + /// should be passed. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery point id to be passed to failover to a particular recovery point. In case of latest recovery point, null should be passed.", + SerializedName = @"recoveryPointId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryPointId { get; set; } + + } + /// A2A provider specific input for unplanned failover. + internal partial interface IA2AUnplannedFailoverInputInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverProviderSpecificInputInternal + { + /// A value indicating whether to use recovery cloud service for failover or not. + string CloudServiceCreationOption { get; set; } + /// + /// The recovery point id to be passed to failover to a particular recovery point. In case of latest recovery point, null + /// should be passed. + /// + string RecoveryPointId { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AUnplannedFailoverInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AUnplannedFailoverInput.json.cs new file mode 100644 index 000000000000..ce93ccdd4d26 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AUnplannedFailoverInput.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// A2A provider specific input for unplanned failover. + public partial class A2AUnplannedFailoverInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal A2AUnplannedFailoverInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __unplannedFailoverProviderSpecificInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UnplannedFailoverProviderSpecificInput(json); + {_recoveryPointId = If( json?.PropertyT("recoveryPointId"), out var __jsonRecoveryPointId) ? (string)__jsonRecoveryPointId : (string)RecoveryPointId;} + {_cloudServiceCreationOption = If( json?.PropertyT("cloudServiceCreationOption"), out var __jsonCloudServiceCreationOption) ? (string)__jsonCloudServiceCreationOption : (string)CloudServiceCreationOption;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUnplannedFailoverInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUnplannedFailoverInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUnplannedFailoverInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new A2AUnplannedFailoverInput(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __unplannedFailoverProviderSpecificInput?.ToJson(container, serializationMode); + AddIf( null != (((object)this._recoveryPointId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryPointId.ToString()) : null, "recoveryPointId" ,container.Add ); + AddIf( null != (((object)this._cloudServiceCreationOption)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._cloudServiceCreationOption.ToString()) : null, "cloudServiceCreationOption" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AUnprotectedDiskDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AUnprotectedDiskDetails.PowerShell.cs new file mode 100644 index 000000000000..14b21e25eba8 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AUnprotectedDiskDetails.PowerShell.cs @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// A2A unprotected disk details. + [System.ComponentModel.TypeConverter(typeof(A2AUnprotectedDiskDetailsTypeConverter))] + public partial class A2AUnprotectedDiskDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal A2AUnprotectedDiskDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DiskLunId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUnprotectedDiskDetailsInternal)this).DiskLunId = (int?) content.GetValueForProperty("DiskLunId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUnprotectedDiskDetailsInternal)this).DiskLunId, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("DiskAutoProtectionStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUnprotectedDiskDetailsInternal)this).DiskAutoProtectionStatus = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AutoProtectionOfDataDisk?) content.GetValueForProperty("DiskAutoProtectionStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUnprotectedDiskDetailsInternal)this).DiskAutoProtectionStatus, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AutoProtectionOfDataDisk.CreateFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal A2AUnprotectedDiskDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DiskLunId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUnprotectedDiskDetailsInternal)this).DiskLunId = (int?) content.GetValueForProperty("DiskLunId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUnprotectedDiskDetailsInternal)this).DiskLunId, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("DiskAutoProtectionStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUnprotectedDiskDetailsInternal)this).DiskAutoProtectionStatus = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AutoProtectionOfDataDisk?) content.GetValueForProperty("DiskAutoProtectionStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUnprotectedDiskDetailsInternal)this).DiskAutoProtectionStatus, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AutoProtectionOfDataDisk.CreateFrom); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUnprotectedDiskDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new A2AUnprotectedDiskDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUnprotectedDiskDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new A2AUnprotectedDiskDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUnprotectedDiskDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// A2A unprotected disk details. + [System.ComponentModel.TypeConverter(typeof(A2AUnprotectedDiskDetailsTypeConverter))] + public partial interface IA2AUnprotectedDiskDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AUnprotectedDiskDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AUnprotectedDiskDetails.TypeConverter.cs new file mode 100644 index 000000000000..9aa0c3fa58ab --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AUnprotectedDiskDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class A2AUnprotectedDiskDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUnprotectedDiskDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUnprotectedDiskDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return A2AUnprotectedDiskDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return A2AUnprotectedDiskDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return A2AUnprotectedDiskDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AUnprotectedDiskDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AUnprotectedDiskDetails.cs new file mode 100644 index 000000000000..7c8c14d513c8 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AUnprotectedDiskDetails.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// A2A unprotected disk details. + public partial class A2AUnprotectedDiskDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUnprotectedDiskDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUnprotectedDiskDetailsInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AutoProtectionOfDataDisk? _diskAutoProtectionStatus; + + /// A value indicating whether the disk auto protection is enabled. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AutoProtectionOfDataDisk? DiskAutoProtectionStatus { get => this._diskAutoProtectionStatus; set => this._diskAutoProtectionStatus = value; } + + /// Backing field for property. + private int? _diskLunId; + + /// The source lun Id for the data disk. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? DiskLunId { get => this._diskLunId; set => this._diskLunId = value; } + + /// Creates an new instance. + public A2AUnprotectedDiskDetails() + { + + } + } + /// A2A unprotected disk details. + public partial interface IA2AUnprotectedDiskDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// A value indicating whether the disk auto protection is enabled. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether the disk auto protection is enabled.", + SerializedName = @"diskAutoProtectionStatus", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AutoProtectionOfDataDisk) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AutoProtectionOfDataDisk? DiskAutoProtectionStatus { get; set; } + /// The source lun Id for the data disk. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The source lun Id for the data disk.", + SerializedName = @"diskLunId", + PossibleTypes = new [] { typeof(int) })] + int? DiskLunId { get; set; } + + } + /// A2A unprotected disk details. + internal partial interface IA2AUnprotectedDiskDetailsInternal + + { + /// A value indicating whether the disk auto protection is enabled. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AutoProtectionOfDataDisk? DiskAutoProtectionStatus { get; set; } + /// The source lun Id for the data disk. + int? DiskLunId { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AUnprotectedDiskDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AUnprotectedDiskDetails.json.cs new file mode 100644 index 000000000000..6eb41bd10569 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AUnprotectedDiskDetails.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// A2A unprotected disk details. + public partial class A2AUnprotectedDiskDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal A2AUnprotectedDiskDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_diskLunId = If( json?.PropertyT("diskLunId"), out var __jsonDiskLunId) ? (int?)__jsonDiskLunId : DiskLunId;} + {_diskAutoProtectionStatus = If( json?.PropertyT("diskAutoProtectionStatus"), out var __jsonDiskAutoProtectionStatus) ? (string)__jsonDiskAutoProtectionStatus : (string)DiskAutoProtectionStatus;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUnprotectedDiskDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUnprotectedDiskDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUnprotectedDiskDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new A2AUnprotectedDiskDetails(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._diskLunId ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._diskLunId) : null, "diskLunId" ,container.Add ); + AddIf( null != (((object)this._diskAutoProtectionStatus)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._diskAutoProtectionStatus.ToString()) : null, "diskAutoProtectionStatus" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AUpdateContainerMappingInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AUpdateContainerMappingInput.PowerShell.cs new file mode 100644 index 000000000000..75c21d569d2e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AUpdateContainerMappingInput.PowerShell.cs @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// A2A update protection container mapping. + [System.ComponentModel.TypeConverter(typeof(A2AUpdateContainerMappingInputTypeConverter))] + public partial class A2AUpdateContainerMappingInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal A2AUpdateContainerMappingInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("AgentAutoUpdateStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUpdateContainerMappingInputInternal)this).AgentAutoUpdateStatus = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentAutoUpdateStatus?) content.GetValueForProperty("AgentAutoUpdateStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUpdateContainerMappingInputInternal)this).AgentAutoUpdateStatus, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentAutoUpdateStatus.CreateFrom); + } + if (content.Contains("AutomationAccountArmId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUpdateContainerMappingInputInternal)this).AutomationAccountArmId = (string) content.GetValueForProperty("AutomationAccountArmId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUpdateContainerMappingInputInternal)this).AutomationAccountArmId, global::System.Convert.ToString); + } + if (content.Contains("AutomationAccountAuthenticationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUpdateContainerMappingInputInternal)this).AutomationAccountAuthenticationType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AutomationAccountAuthenticationType?) content.GetValueForProperty("AutomationAccountAuthenticationType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUpdateContainerMappingInputInternal)this).AutomationAccountAuthenticationType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AutomationAccountAuthenticationType.CreateFrom); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificUpdateContainerMappingInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificUpdateContainerMappingInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal A2AUpdateContainerMappingInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("AgentAutoUpdateStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUpdateContainerMappingInputInternal)this).AgentAutoUpdateStatus = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentAutoUpdateStatus?) content.GetValueForProperty("AgentAutoUpdateStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUpdateContainerMappingInputInternal)this).AgentAutoUpdateStatus, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentAutoUpdateStatus.CreateFrom); + } + if (content.Contains("AutomationAccountArmId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUpdateContainerMappingInputInternal)this).AutomationAccountArmId = (string) content.GetValueForProperty("AutomationAccountArmId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUpdateContainerMappingInputInternal)this).AutomationAccountArmId, global::System.Convert.ToString); + } + if (content.Contains("AutomationAccountAuthenticationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUpdateContainerMappingInputInternal)this).AutomationAccountAuthenticationType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AutomationAccountAuthenticationType?) content.GetValueForProperty("AutomationAccountAuthenticationType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUpdateContainerMappingInputInternal)this).AutomationAccountAuthenticationType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AutomationAccountAuthenticationType.CreateFrom); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificUpdateContainerMappingInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificUpdateContainerMappingInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUpdateContainerMappingInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new A2AUpdateContainerMappingInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUpdateContainerMappingInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new A2AUpdateContainerMappingInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUpdateContainerMappingInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// A2A update protection container mapping. + [System.ComponentModel.TypeConverter(typeof(A2AUpdateContainerMappingInputTypeConverter))] + public partial interface IA2AUpdateContainerMappingInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AUpdateContainerMappingInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AUpdateContainerMappingInput.TypeConverter.cs new file mode 100644 index 000000000000..af465d5f7d18 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AUpdateContainerMappingInput.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class A2AUpdateContainerMappingInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUpdateContainerMappingInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUpdateContainerMappingInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return A2AUpdateContainerMappingInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return A2AUpdateContainerMappingInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return A2AUpdateContainerMappingInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AUpdateContainerMappingInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AUpdateContainerMappingInput.cs new file mode 100644 index 000000000000..b81f2076cabe --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AUpdateContainerMappingInput.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// A2A update protection container mapping. + public partial class A2AUpdateContainerMappingInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUpdateContainerMappingInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUpdateContainerMappingInputInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificUpdateContainerMappingInput __replicationProviderSpecificUpdateContainerMappingInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProviderSpecificUpdateContainerMappingInput(); + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentAutoUpdateStatus? _agentAutoUpdateStatus; + + /// A value indicating whether the auto update is enabled. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentAutoUpdateStatus? AgentAutoUpdateStatus { get => this._agentAutoUpdateStatus; set => this._agentAutoUpdateStatus = value; } + + /// Backing field for property. + private string _automationAccountArmId; + + /// The automation account arm id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string AutomationAccountArmId { get => this._automationAccountArmId; set => this._automationAccountArmId = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AutomationAccountAuthenticationType? _automationAccountAuthenticationType; + + /// A value indicating the type authentication to use for automation Account. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AutomationAccountAuthenticationType? AutomationAccountAuthenticationType { get => this._automationAccountAuthenticationType; set => this._automationAccountAuthenticationType = value; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificUpdateContainerMappingInputInternal)__replicationProviderSpecificUpdateContainerMappingInput).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificUpdateContainerMappingInputInternal)__replicationProviderSpecificUpdateContainerMappingInput).InstanceType = value ; } + + /// Creates an new instance. + public A2AUpdateContainerMappingInput() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__replicationProviderSpecificUpdateContainerMappingInput), __replicationProviderSpecificUpdateContainerMappingInput); + await eventListener.AssertObjectIsValid(nameof(__replicationProviderSpecificUpdateContainerMappingInput), __replicationProviderSpecificUpdateContainerMappingInput); + } + } + /// A2A update protection container mapping. + public partial interface IA2AUpdateContainerMappingInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificUpdateContainerMappingInput + { + /// A value indicating whether the auto update is enabled. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether the auto update is enabled.", + SerializedName = @"agentAutoUpdateStatus", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentAutoUpdateStatus) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentAutoUpdateStatus? AgentAutoUpdateStatus { get; set; } + /// The automation account arm id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The automation account arm id.", + SerializedName = @"automationAccountArmId", + PossibleTypes = new [] { typeof(string) })] + string AutomationAccountArmId { get; set; } + /// A value indicating the type authentication to use for automation Account. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating the type authentication to use for automation Account.", + SerializedName = @"automationAccountAuthenticationType", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AutomationAccountAuthenticationType) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AutomationAccountAuthenticationType? AutomationAccountAuthenticationType { get; set; } + + } + /// A2A update protection container mapping. + internal partial interface IA2AUpdateContainerMappingInputInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificUpdateContainerMappingInputInternal + { + /// A value indicating whether the auto update is enabled. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentAutoUpdateStatus? AgentAutoUpdateStatus { get; set; } + /// The automation account arm id. + string AutomationAccountArmId { get; set; } + /// A value indicating the type authentication to use for automation Account. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AutomationAccountAuthenticationType? AutomationAccountAuthenticationType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AUpdateContainerMappingInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AUpdateContainerMappingInput.json.cs new file mode 100644 index 000000000000..00cc38533867 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AUpdateContainerMappingInput.json.cs @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// A2A update protection container mapping. + public partial class A2AUpdateContainerMappingInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal A2AUpdateContainerMappingInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __replicationProviderSpecificUpdateContainerMappingInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProviderSpecificUpdateContainerMappingInput(json); + {_agentAutoUpdateStatus = If( json?.PropertyT("agentAutoUpdateStatus"), out var __jsonAgentAutoUpdateStatus) ? (string)__jsonAgentAutoUpdateStatus : (string)AgentAutoUpdateStatus;} + {_automationAccountArmId = If( json?.PropertyT("automationAccountArmId"), out var __jsonAutomationAccountArmId) ? (string)__jsonAutomationAccountArmId : (string)AutomationAccountArmId;} + {_automationAccountAuthenticationType = If( json?.PropertyT("automationAccountAuthenticationType"), out var __jsonAutomationAccountAuthenticationType) ? (string)__jsonAutomationAccountAuthenticationType : (string)AutomationAccountAuthenticationType;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUpdateContainerMappingInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUpdateContainerMappingInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUpdateContainerMappingInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new A2AUpdateContainerMappingInput(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __replicationProviderSpecificUpdateContainerMappingInput?.ToJson(container, serializationMode); + AddIf( null != (((object)this._agentAutoUpdateStatus)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._agentAutoUpdateStatus.ToString()) : null, "agentAutoUpdateStatus" ,container.Add ); + AddIf( null != (((object)this._automationAccountArmId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._automationAccountArmId.ToString()) : null, "automationAccountArmId" ,container.Add ); + AddIf( null != (((object)this._automationAccountAuthenticationType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._automationAccountAuthenticationType.ToString()) : null, "automationAccountAuthenticationType" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AUpdateReplicationProtectedItemInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AUpdateReplicationProtectedItemInput.PowerShell.cs new file mode 100644 index 000000000000..1cc53c2daba2 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AUpdateReplicationProtectedItemInput.PowerShell.cs @@ -0,0 +1,269 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// InMage Azure V2 input to update replication protected item. + [System.ComponentModel.TypeConverter(typeof(A2AUpdateReplicationProtectedItemInputTypeConverter))] + public partial class A2AUpdateReplicationProtectedItemInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal A2AUpdateReplicationProtectedItemInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DiskEncryptionInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUpdateReplicationProtectedItemInputInternal)this).DiskEncryptionInfo = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfo) content.GetValueForProperty("DiskEncryptionInfo",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUpdateReplicationProtectedItemInputInternal)this).DiskEncryptionInfo, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DiskEncryptionInfoTypeConverter.ConvertFrom); + } + if (content.Contains("RecoveryCloudServiceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUpdateReplicationProtectedItemInputInternal)this).RecoveryCloudServiceId = (string) content.GetValueForProperty("RecoveryCloudServiceId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUpdateReplicationProtectedItemInputInternal)this).RecoveryCloudServiceId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryResourceGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUpdateReplicationProtectedItemInputInternal)this).RecoveryResourceGroupId = (string) content.GetValueForProperty("RecoveryResourceGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUpdateReplicationProtectedItemInputInternal)this).RecoveryResourceGroupId, global::System.Convert.ToString); + } + if (content.Contains("ManagedDiskUpdateDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUpdateReplicationProtectedItemInputInternal)this).ManagedDiskUpdateDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskUpdateDetails[]) content.GetValueForProperty("ManagedDiskUpdateDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUpdateReplicationProtectedItemInputInternal)this).ManagedDiskUpdateDetail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2AvmManagedDiskUpdateDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("RecoveryBootDiagStorageAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUpdateReplicationProtectedItemInputInternal)this).RecoveryBootDiagStorageAccountId = (string) content.GetValueForProperty("RecoveryBootDiagStorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUpdateReplicationProtectedItemInputInternal)this).RecoveryBootDiagStorageAccountId, global::System.Convert.ToString); + } + if (content.Contains("TfoAzureVMName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUpdateReplicationProtectedItemInputInternal)this).TfoAzureVMName = (string) content.GetValueForProperty("TfoAzureVMName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUpdateReplicationProtectedItemInputInternal)this).TfoAzureVMName, global::System.Convert.ToString); + } + if (content.Contains("RecoveryProximityPlacementGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUpdateReplicationProtectedItemInputInternal)this).RecoveryProximityPlacementGroupId = (string) content.GetValueForProperty("RecoveryProximityPlacementGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUpdateReplicationProtectedItemInputInternal)this).RecoveryProximityPlacementGroupId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryVirtualMachineScaleSetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUpdateReplicationProtectedItemInputInternal)this).RecoveryVirtualMachineScaleSetId = (string) content.GetValueForProperty("RecoveryVirtualMachineScaleSetId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUpdateReplicationProtectedItemInputInternal)this).RecoveryVirtualMachineScaleSetId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryCapacityReservationGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUpdateReplicationProtectedItemInputInternal)this).RecoveryCapacityReservationGroupId = (string) content.GetValueForProperty("RecoveryCapacityReservationGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUpdateReplicationProtectedItemInputInternal)this).RecoveryCapacityReservationGroupId, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemProviderInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemProviderInputInternal)this).InstanceType, global::System.Convert.ToString); + } + if (content.Contains("DiskEncryptionInfoDiskEncryptionKeyInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUpdateReplicationProtectedItemInputInternal)this).DiskEncryptionInfoDiskEncryptionKeyInfo = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionKeyInfo) content.GetValueForProperty("DiskEncryptionInfoDiskEncryptionKeyInfo",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUpdateReplicationProtectedItemInputInternal)this).DiskEncryptionInfoDiskEncryptionKeyInfo, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DiskEncryptionKeyInfoTypeConverter.ConvertFrom); + } + if (content.Contains("DiskEncryptionInfoKeyEncryptionKeyInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUpdateReplicationProtectedItemInputInternal)this).DiskEncryptionInfoKeyEncryptionKeyInfo = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IKeyEncryptionKeyInfo) content.GetValueForProperty("DiskEncryptionInfoKeyEncryptionKeyInfo",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUpdateReplicationProtectedItemInputInternal)this).DiskEncryptionInfoKeyEncryptionKeyInfo, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.KeyEncryptionKeyInfoTypeConverter.ConvertFrom); + } + if (content.Contains("DiskEncryptionKeyInfoSecretIdentifier")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUpdateReplicationProtectedItemInputInternal)this).DiskEncryptionKeyInfoSecretIdentifier = (string) content.GetValueForProperty("DiskEncryptionKeyInfoSecretIdentifier",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUpdateReplicationProtectedItemInputInternal)this).DiskEncryptionKeyInfoSecretIdentifier, global::System.Convert.ToString); + } + if (content.Contains("KeyEncryptionKeyInfoKeyIdentifier")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUpdateReplicationProtectedItemInputInternal)this).KeyEncryptionKeyInfoKeyIdentifier = (string) content.GetValueForProperty("KeyEncryptionKeyInfoKeyIdentifier",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUpdateReplicationProtectedItemInputInternal)this).KeyEncryptionKeyInfoKeyIdentifier, global::System.Convert.ToString); + } + if (content.Contains("DiskEncryptionKeyInfoKeyVaultResourceArmId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUpdateReplicationProtectedItemInputInternal)this).DiskEncryptionKeyInfoKeyVaultResourceArmId = (string) content.GetValueForProperty("DiskEncryptionKeyInfoKeyVaultResourceArmId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUpdateReplicationProtectedItemInputInternal)this).DiskEncryptionKeyInfoKeyVaultResourceArmId, global::System.Convert.ToString); + } + if (content.Contains("KeyEncryptionKeyInfoKeyVaultResourceArmId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUpdateReplicationProtectedItemInputInternal)this).KeyEncryptionKeyInfoKeyVaultResourceArmId = (string) content.GetValueForProperty("KeyEncryptionKeyInfoKeyVaultResourceArmId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUpdateReplicationProtectedItemInputInternal)this).KeyEncryptionKeyInfoKeyVaultResourceArmId, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal A2AUpdateReplicationProtectedItemInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DiskEncryptionInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUpdateReplicationProtectedItemInputInternal)this).DiskEncryptionInfo = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfo) content.GetValueForProperty("DiskEncryptionInfo",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUpdateReplicationProtectedItemInputInternal)this).DiskEncryptionInfo, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DiskEncryptionInfoTypeConverter.ConvertFrom); + } + if (content.Contains("RecoveryCloudServiceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUpdateReplicationProtectedItemInputInternal)this).RecoveryCloudServiceId = (string) content.GetValueForProperty("RecoveryCloudServiceId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUpdateReplicationProtectedItemInputInternal)this).RecoveryCloudServiceId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryResourceGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUpdateReplicationProtectedItemInputInternal)this).RecoveryResourceGroupId = (string) content.GetValueForProperty("RecoveryResourceGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUpdateReplicationProtectedItemInputInternal)this).RecoveryResourceGroupId, global::System.Convert.ToString); + } + if (content.Contains("ManagedDiskUpdateDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUpdateReplicationProtectedItemInputInternal)this).ManagedDiskUpdateDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskUpdateDetails[]) content.GetValueForProperty("ManagedDiskUpdateDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUpdateReplicationProtectedItemInputInternal)this).ManagedDiskUpdateDetail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2AvmManagedDiskUpdateDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("RecoveryBootDiagStorageAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUpdateReplicationProtectedItemInputInternal)this).RecoveryBootDiagStorageAccountId = (string) content.GetValueForProperty("RecoveryBootDiagStorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUpdateReplicationProtectedItemInputInternal)this).RecoveryBootDiagStorageAccountId, global::System.Convert.ToString); + } + if (content.Contains("TfoAzureVMName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUpdateReplicationProtectedItemInputInternal)this).TfoAzureVMName = (string) content.GetValueForProperty("TfoAzureVMName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUpdateReplicationProtectedItemInputInternal)this).TfoAzureVMName, global::System.Convert.ToString); + } + if (content.Contains("RecoveryProximityPlacementGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUpdateReplicationProtectedItemInputInternal)this).RecoveryProximityPlacementGroupId = (string) content.GetValueForProperty("RecoveryProximityPlacementGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUpdateReplicationProtectedItemInputInternal)this).RecoveryProximityPlacementGroupId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryVirtualMachineScaleSetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUpdateReplicationProtectedItemInputInternal)this).RecoveryVirtualMachineScaleSetId = (string) content.GetValueForProperty("RecoveryVirtualMachineScaleSetId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUpdateReplicationProtectedItemInputInternal)this).RecoveryVirtualMachineScaleSetId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryCapacityReservationGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUpdateReplicationProtectedItemInputInternal)this).RecoveryCapacityReservationGroupId = (string) content.GetValueForProperty("RecoveryCapacityReservationGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUpdateReplicationProtectedItemInputInternal)this).RecoveryCapacityReservationGroupId, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemProviderInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemProviderInputInternal)this).InstanceType, global::System.Convert.ToString); + } + if (content.Contains("DiskEncryptionInfoDiskEncryptionKeyInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUpdateReplicationProtectedItemInputInternal)this).DiskEncryptionInfoDiskEncryptionKeyInfo = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionKeyInfo) content.GetValueForProperty("DiskEncryptionInfoDiskEncryptionKeyInfo",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUpdateReplicationProtectedItemInputInternal)this).DiskEncryptionInfoDiskEncryptionKeyInfo, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DiskEncryptionKeyInfoTypeConverter.ConvertFrom); + } + if (content.Contains("DiskEncryptionInfoKeyEncryptionKeyInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUpdateReplicationProtectedItemInputInternal)this).DiskEncryptionInfoKeyEncryptionKeyInfo = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IKeyEncryptionKeyInfo) content.GetValueForProperty("DiskEncryptionInfoKeyEncryptionKeyInfo",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUpdateReplicationProtectedItemInputInternal)this).DiskEncryptionInfoKeyEncryptionKeyInfo, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.KeyEncryptionKeyInfoTypeConverter.ConvertFrom); + } + if (content.Contains("DiskEncryptionKeyInfoSecretIdentifier")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUpdateReplicationProtectedItemInputInternal)this).DiskEncryptionKeyInfoSecretIdentifier = (string) content.GetValueForProperty("DiskEncryptionKeyInfoSecretIdentifier",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUpdateReplicationProtectedItemInputInternal)this).DiskEncryptionKeyInfoSecretIdentifier, global::System.Convert.ToString); + } + if (content.Contains("KeyEncryptionKeyInfoKeyIdentifier")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUpdateReplicationProtectedItemInputInternal)this).KeyEncryptionKeyInfoKeyIdentifier = (string) content.GetValueForProperty("KeyEncryptionKeyInfoKeyIdentifier",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUpdateReplicationProtectedItemInputInternal)this).KeyEncryptionKeyInfoKeyIdentifier, global::System.Convert.ToString); + } + if (content.Contains("DiskEncryptionKeyInfoKeyVaultResourceArmId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUpdateReplicationProtectedItemInputInternal)this).DiskEncryptionKeyInfoKeyVaultResourceArmId = (string) content.GetValueForProperty("DiskEncryptionKeyInfoKeyVaultResourceArmId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUpdateReplicationProtectedItemInputInternal)this).DiskEncryptionKeyInfoKeyVaultResourceArmId, global::System.Convert.ToString); + } + if (content.Contains("KeyEncryptionKeyInfoKeyVaultResourceArmId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUpdateReplicationProtectedItemInputInternal)this).KeyEncryptionKeyInfoKeyVaultResourceArmId = (string) content.GetValueForProperty("KeyEncryptionKeyInfoKeyVaultResourceArmId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUpdateReplicationProtectedItemInputInternal)this).KeyEncryptionKeyInfoKeyVaultResourceArmId, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUpdateReplicationProtectedItemInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new A2AUpdateReplicationProtectedItemInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUpdateReplicationProtectedItemInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new A2AUpdateReplicationProtectedItemInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json + /// string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUpdateReplicationProtectedItemInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// InMage Azure V2 input to update replication protected item. + [System.ComponentModel.TypeConverter(typeof(A2AUpdateReplicationProtectedItemInputTypeConverter))] + public partial interface IA2AUpdateReplicationProtectedItemInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AUpdateReplicationProtectedItemInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AUpdateReplicationProtectedItemInput.TypeConverter.cs new file mode 100644 index 000000000000..2ff051807233 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AUpdateReplicationProtectedItemInput.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class A2AUpdateReplicationProtectedItemInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUpdateReplicationProtectedItemInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUpdateReplicationProtectedItemInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return A2AUpdateReplicationProtectedItemInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return A2AUpdateReplicationProtectedItemInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return A2AUpdateReplicationProtectedItemInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AUpdateReplicationProtectedItemInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AUpdateReplicationProtectedItemInput.cs new file mode 100644 index 000000000000..249c20ed2fbd --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AUpdateReplicationProtectedItemInput.cs @@ -0,0 +1,271 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMage Azure V2 input to update replication protected item. + public partial class A2AUpdateReplicationProtectedItemInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUpdateReplicationProtectedItemInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUpdateReplicationProtectedItemInputInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemProviderInput __updateReplicationProtectedItemProviderInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateReplicationProtectedItemProviderInput(); + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfo _diskEncryptionInfo; + + /// The recovery os disk encryption information. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfo DiskEncryptionInfo { get => (this._diskEncryptionInfo = this._diskEncryptionInfo ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DiskEncryptionInfo()); set => this._diskEncryptionInfo = value; } + + /// The KeyVault resource ARM id for secret. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string DiskEncryptionKeyInfoKeyVaultResourceArmId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)DiskEncryptionInfo).DiskEncryptionKeyInfoKeyVaultResourceArmId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)DiskEncryptionInfo).DiskEncryptionKeyInfoKeyVaultResourceArmId = value ?? null; } + + /// The secret url / identifier. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string DiskEncryptionKeyInfoSecretIdentifier { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)DiskEncryptionInfo).DiskEncryptionKeyInfoSecretIdentifier; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)DiskEncryptionInfo).DiskEncryptionKeyInfoSecretIdentifier = value ?? null; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemProviderInputInternal)__updateReplicationProtectedItemProviderInput).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemProviderInputInternal)__updateReplicationProtectedItemProviderInput).InstanceType = value ; } + + /// The key URL / identifier. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string KeyEncryptionKeyInfoKeyIdentifier { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)DiskEncryptionInfo).KeyEncryptionKeyInfoKeyIdentifier; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)DiskEncryptionInfo).KeyEncryptionKeyInfoKeyIdentifier = value ?? null; } + + /// The KeyVault resource ARM Id for key. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string KeyEncryptionKeyInfoKeyVaultResourceArmId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)DiskEncryptionInfo).KeyEncryptionKeyInfoKeyVaultResourceArmId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)DiskEncryptionInfo).KeyEncryptionKeyInfoKeyVaultResourceArmId = value ?? null; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskUpdateDetails[] _managedDiskUpdateDetail; + + /// Managed disk update details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskUpdateDetails[] ManagedDiskUpdateDetail { get => this._managedDiskUpdateDetail; set => this._managedDiskUpdateDetail = value; } + + /// Internal Acessors for DiskEncryptionInfo + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfo Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUpdateReplicationProtectedItemInputInternal.DiskEncryptionInfo { get => (this._diskEncryptionInfo = this._diskEncryptionInfo ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DiskEncryptionInfo()); set { {_diskEncryptionInfo = value;} } } + + /// Internal Acessors for DiskEncryptionInfoDiskEncryptionKeyInfo + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionKeyInfo Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUpdateReplicationProtectedItemInputInternal.DiskEncryptionInfoDiskEncryptionKeyInfo { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)DiskEncryptionInfo).DiskEncryptionKeyInfo; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)DiskEncryptionInfo).DiskEncryptionKeyInfo = value; } + + /// Internal Acessors for DiskEncryptionInfoKeyEncryptionKeyInfo + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IKeyEncryptionKeyInfo Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUpdateReplicationProtectedItemInputInternal.DiskEncryptionInfoKeyEncryptionKeyInfo { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)DiskEncryptionInfo).KeyEncryptionKeyInfo; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)DiskEncryptionInfo).KeyEncryptionKeyInfo = value; } + + /// Backing field for property. + private string _recoveryBootDiagStorageAccountId; + + /// The boot diagnostic storage account. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryBootDiagStorageAccountId { get => this._recoveryBootDiagStorageAccountId; set => this._recoveryBootDiagStorageAccountId = value; } + + /// Backing field for property. + private string _recoveryCapacityReservationGroupId; + + /// The recovery capacity reservation group Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryCapacityReservationGroupId { get => this._recoveryCapacityReservationGroupId; set => this._recoveryCapacityReservationGroupId = value; } + + /// Backing field for property. + private string _recoveryCloudServiceId; + + /// The target cloud service ARM Id (for V1). + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryCloudServiceId { get => this._recoveryCloudServiceId; set => this._recoveryCloudServiceId = value; } + + /// Backing field for property. + private string _recoveryProximityPlacementGroupId; + + /// The recovery proximity placement group Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryProximityPlacementGroupId { get => this._recoveryProximityPlacementGroupId; set => this._recoveryProximityPlacementGroupId = value; } + + /// Backing field for property. + private string _recoveryResourceGroupId; + + /// The target resource group ARM Id (for V2). + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryResourceGroupId { get => this._recoveryResourceGroupId; set => this._recoveryResourceGroupId = value; } + + /// Backing field for property. + private string _recoveryVirtualMachineScaleSetId; + + /// The recovery virtual machine scale set Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryVirtualMachineScaleSetId { get => this._recoveryVirtualMachineScaleSetId; set => this._recoveryVirtualMachineScaleSetId = value; } + + /// Backing field for property. + private string _tfoAzureVMName; + + /// The user given name for Test Failover VM. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TfoAzureVMName { get => this._tfoAzureVMName; set => this._tfoAzureVMName = value; } + + /// Creates an new instance. + public A2AUpdateReplicationProtectedItemInput() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__updateReplicationProtectedItemProviderInput), __updateReplicationProtectedItemProviderInput); + await eventListener.AssertObjectIsValid(nameof(__updateReplicationProtectedItemProviderInput), __updateReplicationProtectedItemProviderInput); + } + } + /// InMage Azure V2 input to update replication protected item. + public partial interface IA2AUpdateReplicationProtectedItemInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemProviderInput + { + /// The KeyVault resource ARM id for secret. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The KeyVault resource ARM id for secret.", + SerializedName = @"keyVaultResourceArmId", + PossibleTypes = new [] { typeof(string) })] + string DiskEncryptionKeyInfoKeyVaultResourceArmId { get; set; } + /// The secret url / identifier. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The secret url / identifier.", + SerializedName = @"secretIdentifier", + PossibleTypes = new [] { typeof(string) })] + string DiskEncryptionKeyInfoSecretIdentifier { get; set; } + /// The key URL / identifier. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The key URL / identifier.", + SerializedName = @"keyIdentifier", + PossibleTypes = new [] { typeof(string) })] + string KeyEncryptionKeyInfoKeyIdentifier { get; set; } + /// The KeyVault resource ARM Id for key. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The KeyVault resource ARM Id for key.", + SerializedName = @"keyVaultResourceArmId", + PossibleTypes = new [] { typeof(string) })] + string KeyEncryptionKeyInfoKeyVaultResourceArmId { get; set; } + /// Managed disk update details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Managed disk update details.", + SerializedName = @"managedDiskUpdateDetails", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskUpdateDetails) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskUpdateDetails[] ManagedDiskUpdateDetail { get; set; } + /// The boot diagnostic storage account. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The boot diagnostic storage account.", + SerializedName = @"recoveryBootDiagStorageAccountId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryBootDiagStorageAccountId { get; set; } + /// The recovery capacity reservation group Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery capacity reservation group Id.", + SerializedName = @"recoveryCapacityReservationGroupId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryCapacityReservationGroupId { get; set; } + /// The target cloud service ARM Id (for V1). + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target cloud service ARM Id (for V1).", + SerializedName = @"recoveryCloudServiceId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryCloudServiceId { get; set; } + /// The recovery proximity placement group Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery proximity placement group Id.", + SerializedName = @"recoveryProximityPlacementGroupId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryProximityPlacementGroupId { get; set; } + /// The target resource group ARM Id (for V2). + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target resource group ARM Id (for V2).", + SerializedName = @"recoveryResourceGroupId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryResourceGroupId { get; set; } + /// The recovery virtual machine scale set Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery virtual machine scale set Id.", + SerializedName = @"recoveryVirtualMachineScaleSetId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryVirtualMachineScaleSetId { get; set; } + /// The user given name for Test Failover VM. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The user given name for Test Failover VM.", + SerializedName = @"tfoAzureVMName", + PossibleTypes = new [] { typeof(string) })] + string TfoAzureVMName { get; set; } + + } + /// InMage Azure V2 input to update replication protected item. + internal partial interface IA2AUpdateReplicationProtectedItemInputInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemProviderInputInternal + { + /// The recovery os disk encryption information. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfo DiskEncryptionInfo { get; set; } + /// The recovery KeyVault reference for secret. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionKeyInfo DiskEncryptionInfoDiskEncryptionKeyInfo { get; set; } + /// The recovery KeyVault reference for key. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IKeyEncryptionKeyInfo DiskEncryptionInfoKeyEncryptionKeyInfo { get; set; } + /// The KeyVault resource ARM id for secret. + string DiskEncryptionKeyInfoKeyVaultResourceArmId { get; set; } + /// The secret url / identifier. + string DiskEncryptionKeyInfoSecretIdentifier { get; set; } + /// The key URL / identifier. + string KeyEncryptionKeyInfoKeyIdentifier { get; set; } + /// The KeyVault resource ARM Id for key. + string KeyEncryptionKeyInfoKeyVaultResourceArmId { get; set; } + /// Managed disk update details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskUpdateDetails[] ManagedDiskUpdateDetail { get; set; } + /// The boot diagnostic storage account. + string RecoveryBootDiagStorageAccountId { get; set; } + /// The recovery capacity reservation group Id. + string RecoveryCapacityReservationGroupId { get; set; } + /// The target cloud service ARM Id (for V1). + string RecoveryCloudServiceId { get; set; } + /// The recovery proximity placement group Id. + string RecoveryProximityPlacementGroupId { get; set; } + /// The target resource group ARM Id (for V2). + string RecoveryResourceGroupId { get; set; } + /// The recovery virtual machine scale set Id. + string RecoveryVirtualMachineScaleSetId { get; set; } + /// The user given name for Test Failover VM. + string TfoAzureVMName { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AUpdateReplicationProtectedItemInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AUpdateReplicationProtectedItemInput.json.cs new file mode 100644 index 000000000000..35dde5ab1f10 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AUpdateReplicationProtectedItemInput.json.cs @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMage Azure V2 input to update replication protected item. + public partial class A2AUpdateReplicationProtectedItemInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal A2AUpdateReplicationProtectedItemInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __updateReplicationProtectedItemProviderInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateReplicationProtectedItemProviderInput(json); + {_diskEncryptionInfo = If( json?.PropertyT("diskEncryptionInfo"), out var __jsonDiskEncryptionInfo) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DiskEncryptionInfo.FromJson(__jsonDiskEncryptionInfo) : DiskEncryptionInfo;} + {_recoveryCloudServiceId = If( json?.PropertyT("recoveryCloudServiceId"), out var __jsonRecoveryCloudServiceId) ? (string)__jsonRecoveryCloudServiceId : (string)RecoveryCloudServiceId;} + {_recoveryResourceGroupId = If( json?.PropertyT("recoveryResourceGroupId"), out var __jsonRecoveryResourceGroupId) ? (string)__jsonRecoveryResourceGroupId : (string)RecoveryResourceGroupId;} + {_managedDiskUpdateDetail = If( json?.PropertyT("managedDiskUpdateDetails"), out var __jsonManagedDiskUpdateDetails) ? If( __jsonManagedDiskUpdateDetails as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskUpdateDetails) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2AvmManagedDiskUpdateDetails.FromJson(__u) )) ))() : null : ManagedDiskUpdateDetail;} + {_recoveryBootDiagStorageAccountId = If( json?.PropertyT("recoveryBootDiagStorageAccountId"), out var __jsonRecoveryBootDiagStorageAccountId) ? (string)__jsonRecoveryBootDiagStorageAccountId : (string)RecoveryBootDiagStorageAccountId;} + {_tfoAzureVMName = If( json?.PropertyT("tfoAzureVMName"), out var __jsonTfoAzureVMName) ? (string)__jsonTfoAzureVMName : (string)TfoAzureVMName;} + {_recoveryProximityPlacementGroupId = If( json?.PropertyT("recoveryProximityPlacementGroupId"), out var __jsonRecoveryProximityPlacementGroupId) ? (string)__jsonRecoveryProximityPlacementGroupId : (string)RecoveryProximityPlacementGroupId;} + {_recoveryVirtualMachineScaleSetId = If( json?.PropertyT("recoveryVirtualMachineScaleSetId"), out var __jsonRecoveryVirtualMachineScaleSetId) ? (string)__jsonRecoveryVirtualMachineScaleSetId : (string)RecoveryVirtualMachineScaleSetId;} + {_recoveryCapacityReservationGroupId = If( json?.PropertyT("recoveryCapacityReservationGroupId"), out var __jsonRecoveryCapacityReservationGroupId) ? (string)__jsonRecoveryCapacityReservationGroupId : (string)RecoveryCapacityReservationGroupId;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUpdateReplicationProtectedItemInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUpdateReplicationProtectedItemInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AUpdateReplicationProtectedItemInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new A2AUpdateReplicationProtectedItemInput(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __updateReplicationProtectedItemProviderInput?.ToJson(container, serializationMode); + AddIf( null != this._diskEncryptionInfo ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._diskEncryptionInfo.ToJson(null,serializationMode) : null, "diskEncryptionInfo" ,container.Add ); + AddIf( null != (((object)this._recoveryCloudServiceId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryCloudServiceId.ToString()) : null, "recoveryCloudServiceId" ,container.Add ); + AddIf( null != (((object)this._recoveryResourceGroupId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryResourceGroupId.ToString()) : null, "recoveryResourceGroupId" ,container.Add ); + if (null != this._managedDiskUpdateDetail) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._managedDiskUpdateDetail ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("managedDiskUpdateDetails",__w); + } + AddIf( null != (((object)this._recoveryBootDiagStorageAccountId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryBootDiagStorageAccountId.ToString()) : null, "recoveryBootDiagStorageAccountId" ,container.Add ); + AddIf( null != (((object)this._tfoAzureVMName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._tfoAzureVMName.ToString()) : null, "tfoAzureVMName" ,container.Add ); + AddIf( null != (((object)this._recoveryProximityPlacementGroupId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryProximityPlacementGroupId.ToString()) : null, "recoveryProximityPlacementGroupId" ,container.Add ); + AddIf( null != (((object)this._recoveryVirtualMachineScaleSetId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryVirtualMachineScaleSetId.ToString()) : null, "recoveryVirtualMachineScaleSetId" ,container.Add ); + AddIf( null != (((object)this._recoveryCapacityReservationGroupId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryCapacityReservationGroupId.ToString()) : null, "recoveryCapacityReservationGroupId" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AZoneDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AZoneDetails.PowerShell.cs new file mode 100644 index 000000000000..caf3f1744a69 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AZoneDetails.PowerShell.cs @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Zone details data. + [System.ComponentModel.TypeConverter(typeof(A2AZoneDetailsTypeConverter))] + public partial class A2AZoneDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal A2AZoneDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Source")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AZoneDetailsInternal)this).Source = (string) content.GetValueForProperty("Source",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AZoneDetailsInternal)this).Source, global::System.Convert.ToString); + } + if (content.Contains("Target")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AZoneDetailsInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AZoneDetailsInternal)this).Target, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal A2AZoneDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Source")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AZoneDetailsInternal)this).Source = (string) content.GetValueForProperty("Source",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AZoneDetailsInternal)this).Source, global::System.Convert.ToString); + } + if (content.Contains("Target")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AZoneDetailsInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AZoneDetailsInternal)this).Target, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AZoneDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new A2AZoneDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AZoneDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new A2AZoneDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AZoneDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Zone details data. + [System.ComponentModel.TypeConverter(typeof(A2AZoneDetailsTypeConverter))] + public partial interface IA2AZoneDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AZoneDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AZoneDetails.TypeConverter.cs new file mode 100644 index 000000000000..215421a1ff48 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AZoneDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class A2AZoneDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AZoneDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AZoneDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return A2AZoneDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return A2AZoneDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return A2AZoneDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AZoneDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AZoneDetails.cs new file mode 100644 index 000000000000..c89223efedd9 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AZoneDetails.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Zone details data. + public partial class A2AZoneDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AZoneDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AZoneDetailsInternal + { + + /// Backing field for property. + private string _source; + + /// Source zone info. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Source { get => this._source; set => this._source = value; } + + /// Backing field for property. + private string _target; + + /// The target zone info. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Target { get => this._target; set => this._target = value; } + + /// Creates an new instance. + public A2AZoneDetails() + { + + } + } + /// Zone details data. + public partial interface IA2AZoneDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// Source zone info. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Source zone info.", + SerializedName = @"source", + PossibleTypes = new [] { typeof(string) })] + string Source { get; set; } + /// The target zone info. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target zone info.", + SerializedName = @"target", + PossibleTypes = new [] { typeof(string) })] + string Target { get; set; } + + } + /// Zone details data. + internal partial interface IA2AZoneDetailsInternal + + { + /// Source zone info. + string Source { get; set; } + /// The target zone info. + string Target { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AZoneDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AZoneDetails.json.cs new file mode 100644 index 000000000000..27e920d28951 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AZoneDetails.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Zone details data. + public partial class A2AZoneDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal A2AZoneDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_source = If( json?.PropertyT("source"), out var __jsonSource) ? (string)__jsonSource : (string)Source;} + {_target = If( json?.PropertyT("target"), out var __jsonTarget) ? (string)__jsonTarget : (string)Target;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AZoneDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AZoneDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AZoneDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new A2AZoneDetails(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._source)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._source.ToString()) : null, "source" ,container.Add ); + AddIf( null != (((object)this._target)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._target.ToString()) : null, "target" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AvmDiskInputDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AvmDiskInputDetails.PowerShell.cs new file mode 100644 index 000000000000..077610c82455 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AvmDiskInputDetails.PowerShell.cs @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// A2A disk input details. + [System.ComponentModel.TypeConverter(typeof(A2AvmDiskInputDetailsTypeConverter))] + public partial class A2AvmDiskInputDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal A2AvmDiskInputDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DiskUri")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmDiskInputDetailsInternal)this).DiskUri = (string) content.GetValueForProperty("DiskUri",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmDiskInputDetailsInternal)this).DiskUri, global::System.Convert.ToString); + } + if (content.Contains("RecoveryAzureStorageAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmDiskInputDetailsInternal)this).RecoveryAzureStorageAccountId = (string) content.GetValueForProperty("RecoveryAzureStorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmDiskInputDetailsInternal)this).RecoveryAzureStorageAccountId, global::System.Convert.ToString); + } + if (content.Contains("PrimaryStagingAzureStorageAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmDiskInputDetailsInternal)this).PrimaryStagingAzureStorageAccountId = (string) content.GetValueForProperty("PrimaryStagingAzureStorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmDiskInputDetailsInternal)this).PrimaryStagingAzureStorageAccountId, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal A2AvmDiskInputDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DiskUri")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmDiskInputDetailsInternal)this).DiskUri = (string) content.GetValueForProperty("DiskUri",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmDiskInputDetailsInternal)this).DiskUri, global::System.Convert.ToString); + } + if (content.Contains("RecoveryAzureStorageAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmDiskInputDetailsInternal)this).RecoveryAzureStorageAccountId = (string) content.GetValueForProperty("RecoveryAzureStorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmDiskInputDetailsInternal)this).RecoveryAzureStorageAccountId, global::System.Convert.ToString); + } + if (content.Contains("PrimaryStagingAzureStorageAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmDiskInputDetailsInternal)this).PrimaryStagingAzureStorageAccountId = (string) content.GetValueForProperty("PrimaryStagingAzureStorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmDiskInputDetailsInternal)this).PrimaryStagingAzureStorageAccountId, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmDiskInputDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new A2AvmDiskInputDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmDiskInputDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new A2AvmDiskInputDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmDiskInputDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// A2A disk input details. + [System.ComponentModel.TypeConverter(typeof(A2AvmDiskInputDetailsTypeConverter))] + public partial interface IA2AvmDiskInputDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AvmDiskInputDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AvmDiskInputDetails.TypeConverter.cs new file mode 100644 index 000000000000..d480e2659885 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AvmDiskInputDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class A2AvmDiskInputDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmDiskInputDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmDiskInputDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return A2AvmDiskInputDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return A2AvmDiskInputDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return A2AvmDiskInputDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AvmDiskInputDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AvmDiskInputDetails.cs new file mode 100644 index 000000000000..ecd15a89a711 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AvmDiskInputDetails.cs @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// A2A disk input details. + public partial class A2AvmDiskInputDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmDiskInputDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmDiskInputDetailsInternal + { + + /// Backing field for property. + private string _diskUri; + + /// The disk Uri. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string DiskUri { get => this._diskUri; set => this._diskUri = value; } + + /// Backing field for property. + private string _primaryStagingAzureStorageAccountId; + + /// The primary staging storage account Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string PrimaryStagingAzureStorageAccountId { get => this._primaryStagingAzureStorageAccountId; set => this._primaryStagingAzureStorageAccountId = value; } + + /// Backing field for property. + private string _recoveryAzureStorageAccountId; + + /// The recovery VHD storage account Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryAzureStorageAccountId { get => this._recoveryAzureStorageAccountId; set => this._recoveryAzureStorageAccountId = value; } + + /// Creates an new instance. + public A2AvmDiskInputDetails() + { + + } + } + /// A2A disk input details. + public partial interface IA2AvmDiskInputDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The disk Uri. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The disk Uri.", + SerializedName = @"diskUri", + PossibleTypes = new [] { typeof(string) })] + string DiskUri { get; set; } + /// The primary staging storage account Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The primary staging storage account Id.", + SerializedName = @"primaryStagingAzureStorageAccountId", + PossibleTypes = new [] { typeof(string) })] + string PrimaryStagingAzureStorageAccountId { get; set; } + /// The recovery VHD storage account Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The recovery VHD storage account Id.", + SerializedName = @"recoveryAzureStorageAccountId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryAzureStorageAccountId { get; set; } + + } + /// A2A disk input details. + internal partial interface IA2AvmDiskInputDetailsInternal + + { + /// The disk Uri. + string DiskUri { get; set; } + /// The primary staging storage account Id. + string PrimaryStagingAzureStorageAccountId { get; set; } + /// The recovery VHD storage account Id. + string RecoveryAzureStorageAccountId { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AvmDiskInputDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AvmDiskInputDetails.json.cs new file mode 100644 index 000000000000..5f6e8ffbe446 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AvmDiskInputDetails.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// A2A disk input details. + public partial class A2AvmDiskInputDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal A2AvmDiskInputDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_diskUri = If( json?.PropertyT("diskUri"), out var __jsonDiskUri) ? (string)__jsonDiskUri : (string)DiskUri;} + {_recoveryAzureStorageAccountId = If( json?.PropertyT("recoveryAzureStorageAccountId"), out var __jsonRecoveryAzureStorageAccountId) ? (string)__jsonRecoveryAzureStorageAccountId : (string)RecoveryAzureStorageAccountId;} + {_primaryStagingAzureStorageAccountId = If( json?.PropertyT("primaryStagingAzureStorageAccountId"), out var __jsonPrimaryStagingAzureStorageAccountId) ? (string)__jsonPrimaryStagingAzureStorageAccountId : (string)PrimaryStagingAzureStorageAccountId;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmDiskInputDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmDiskInputDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmDiskInputDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new A2AvmDiskInputDetails(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._diskUri)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._diskUri.ToString()) : null, "diskUri" ,container.Add ); + AddIf( null != (((object)this._recoveryAzureStorageAccountId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryAzureStorageAccountId.ToString()) : null, "recoveryAzureStorageAccountId" ,container.Add ); + AddIf( null != (((object)this._primaryStagingAzureStorageAccountId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._primaryStagingAzureStorageAccountId.ToString()) : null, "primaryStagingAzureStorageAccountId" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AvmManagedDiskInputDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AvmManagedDiskInputDetails.PowerShell.cs new file mode 100644 index 000000000000..3a6b5c1988e5 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AvmManagedDiskInputDetails.PowerShell.cs @@ -0,0 +1,242 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// A2A managed disk input details. + [System.ComponentModel.TypeConverter(typeof(A2AvmManagedDiskInputDetailsTypeConverter))] + public partial class A2AvmManagedDiskInputDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal A2AvmManagedDiskInputDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DiskEncryptionInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskInputDetailsInternal)this).DiskEncryptionInfo = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfo) content.GetValueForProperty("DiskEncryptionInfo",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskInputDetailsInternal)this).DiskEncryptionInfo, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DiskEncryptionInfoTypeConverter.ConvertFrom); + } + if (content.Contains("DiskId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskInputDetailsInternal)this).DiskId = (string) content.GetValueForProperty("DiskId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskInputDetailsInternal)this).DiskId, global::System.Convert.ToString); + } + if (content.Contains("PrimaryStagingAzureStorageAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskInputDetailsInternal)this).PrimaryStagingAzureStorageAccountId = (string) content.GetValueForProperty("PrimaryStagingAzureStorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskInputDetailsInternal)this).PrimaryStagingAzureStorageAccountId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryResourceGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskInputDetailsInternal)this).RecoveryResourceGroupId = (string) content.GetValueForProperty("RecoveryResourceGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskInputDetailsInternal)this).RecoveryResourceGroupId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryReplicaDiskAccountType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskInputDetailsInternal)this).RecoveryReplicaDiskAccountType = (string) content.GetValueForProperty("RecoveryReplicaDiskAccountType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskInputDetailsInternal)this).RecoveryReplicaDiskAccountType, global::System.Convert.ToString); + } + if (content.Contains("RecoveryTargetDiskAccountType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskInputDetailsInternal)this).RecoveryTargetDiskAccountType = (string) content.GetValueForProperty("RecoveryTargetDiskAccountType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskInputDetailsInternal)this).RecoveryTargetDiskAccountType, global::System.Convert.ToString); + } + if (content.Contains("RecoveryDiskEncryptionSetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskInputDetailsInternal)this).RecoveryDiskEncryptionSetId = (string) content.GetValueForProperty("RecoveryDiskEncryptionSetId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskInputDetailsInternal)this).RecoveryDiskEncryptionSetId, global::System.Convert.ToString); + } + if (content.Contains("DiskEncryptionInfoDiskEncryptionKeyInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskInputDetailsInternal)this).DiskEncryptionInfoDiskEncryptionKeyInfo = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionKeyInfo) content.GetValueForProperty("DiskEncryptionInfoDiskEncryptionKeyInfo",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskInputDetailsInternal)this).DiskEncryptionInfoDiskEncryptionKeyInfo, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DiskEncryptionKeyInfoTypeConverter.ConvertFrom); + } + if (content.Contains("DiskEncryptionInfoKeyEncryptionKeyInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskInputDetailsInternal)this).DiskEncryptionInfoKeyEncryptionKeyInfo = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IKeyEncryptionKeyInfo) content.GetValueForProperty("DiskEncryptionInfoKeyEncryptionKeyInfo",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskInputDetailsInternal)this).DiskEncryptionInfoKeyEncryptionKeyInfo, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.KeyEncryptionKeyInfoTypeConverter.ConvertFrom); + } + if (content.Contains("DiskEncryptionKeyInfoSecretIdentifier")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskInputDetailsInternal)this).DiskEncryptionKeyInfoSecretIdentifier = (string) content.GetValueForProperty("DiskEncryptionKeyInfoSecretIdentifier",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskInputDetailsInternal)this).DiskEncryptionKeyInfoSecretIdentifier, global::System.Convert.ToString); + } + if (content.Contains("KeyEncryptionKeyInfoKeyIdentifier")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskInputDetailsInternal)this).KeyEncryptionKeyInfoKeyIdentifier = (string) content.GetValueForProperty("KeyEncryptionKeyInfoKeyIdentifier",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskInputDetailsInternal)this).KeyEncryptionKeyInfoKeyIdentifier, global::System.Convert.ToString); + } + if (content.Contains("DiskEncryptionKeyInfoKeyVaultResourceArmId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskInputDetailsInternal)this).DiskEncryptionKeyInfoKeyVaultResourceArmId = (string) content.GetValueForProperty("DiskEncryptionKeyInfoKeyVaultResourceArmId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskInputDetailsInternal)this).DiskEncryptionKeyInfoKeyVaultResourceArmId, global::System.Convert.ToString); + } + if (content.Contains("KeyEncryptionKeyInfoKeyVaultResourceArmId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskInputDetailsInternal)this).KeyEncryptionKeyInfoKeyVaultResourceArmId = (string) content.GetValueForProperty("KeyEncryptionKeyInfoKeyVaultResourceArmId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskInputDetailsInternal)this).KeyEncryptionKeyInfoKeyVaultResourceArmId, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal A2AvmManagedDiskInputDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DiskEncryptionInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskInputDetailsInternal)this).DiskEncryptionInfo = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfo) content.GetValueForProperty("DiskEncryptionInfo",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskInputDetailsInternal)this).DiskEncryptionInfo, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DiskEncryptionInfoTypeConverter.ConvertFrom); + } + if (content.Contains("DiskId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskInputDetailsInternal)this).DiskId = (string) content.GetValueForProperty("DiskId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskInputDetailsInternal)this).DiskId, global::System.Convert.ToString); + } + if (content.Contains("PrimaryStagingAzureStorageAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskInputDetailsInternal)this).PrimaryStagingAzureStorageAccountId = (string) content.GetValueForProperty("PrimaryStagingAzureStorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskInputDetailsInternal)this).PrimaryStagingAzureStorageAccountId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryResourceGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskInputDetailsInternal)this).RecoveryResourceGroupId = (string) content.GetValueForProperty("RecoveryResourceGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskInputDetailsInternal)this).RecoveryResourceGroupId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryReplicaDiskAccountType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskInputDetailsInternal)this).RecoveryReplicaDiskAccountType = (string) content.GetValueForProperty("RecoveryReplicaDiskAccountType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskInputDetailsInternal)this).RecoveryReplicaDiskAccountType, global::System.Convert.ToString); + } + if (content.Contains("RecoveryTargetDiskAccountType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskInputDetailsInternal)this).RecoveryTargetDiskAccountType = (string) content.GetValueForProperty("RecoveryTargetDiskAccountType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskInputDetailsInternal)this).RecoveryTargetDiskAccountType, global::System.Convert.ToString); + } + if (content.Contains("RecoveryDiskEncryptionSetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskInputDetailsInternal)this).RecoveryDiskEncryptionSetId = (string) content.GetValueForProperty("RecoveryDiskEncryptionSetId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskInputDetailsInternal)this).RecoveryDiskEncryptionSetId, global::System.Convert.ToString); + } + if (content.Contains("DiskEncryptionInfoDiskEncryptionKeyInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskInputDetailsInternal)this).DiskEncryptionInfoDiskEncryptionKeyInfo = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionKeyInfo) content.GetValueForProperty("DiskEncryptionInfoDiskEncryptionKeyInfo",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskInputDetailsInternal)this).DiskEncryptionInfoDiskEncryptionKeyInfo, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DiskEncryptionKeyInfoTypeConverter.ConvertFrom); + } + if (content.Contains("DiskEncryptionInfoKeyEncryptionKeyInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskInputDetailsInternal)this).DiskEncryptionInfoKeyEncryptionKeyInfo = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IKeyEncryptionKeyInfo) content.GetValueForProperty("DiskEncryptionInfoKeyEncryptionKeyInfo",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskInputDetailsInternal)this).DiskEncryptionInfoKeyEncryptionKeyInfo, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.KeyEncryptionKeyInfoTypeConverter.ConvertFrom); + } + if (content.Contains("DiskEncryptionKeyInfoSecretIdentifier")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskInputDetailsInternal)this).DiskEncryptionKeyInfoSecretIdentifier = (string) content.GetValueForProperty("DiskEncryptionKeyInfoSecretIdentifier",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskInputDetailsInternal)this).DiskEncryptionKeyInfoSecretIdentifier, global::System.Convert.ToString); + } + if (content.Contains("KeyEncryptionKeyInfoKeyIdentifier")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskInputDetailsInternal)this).KeyEncryptionKeyInfoKeyIdentifier = (string) content.GetValueForProperty("KeyEncryptionKeyInfoKeyIdentifier",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskInputDetailsInternal)this).KeyEncryptionKeyInfoKeyIdentifier, global::System.Convert.ToString); + } + if (content.Contains("DiskEncryptionKeyInfoKeyVaultResourceArmId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskInputDetailsInternal)this).DiskEncryptionKeyInfoKeyVaultResourceArmId = (string) content.GetValueForProperty("DiskEncryptionKeyInfoKeyVaultResourceArmId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskInputDetailsInternal)this).DiskEncryptionKeyInfoKeyVaultResourceArmId, global::System.Convert.ToString); + } + if (content.Contains("KeyEncryptionKeyInfoKeyVaultResourceArmId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskInputDetailsInternal)this).KeyEncryptionKeyInfoKeyVaultResourceArmId = (string) content.GetValueForProperty("KeyEncryptionKeyInfoKeyVaultResourceArmId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskInputDetailsInternal)this).KeyEncryptionKeyInfoKeyVaultResourceArmId, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskInputDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new A2AvmManagedDiskInputDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskInputDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new A2AvmManagedDiskInputDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskInputDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// A2A managed disk input details. + [System.ComponentModel.TypeConverter(typeof(A2AvmManagedDiskInputDetailsTypeConverter))] + public partial interface IA2AvmManagedDiskInputDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AvmManagedDiskInputDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AvmManagedDiskInputDetails.TypeConverter.cs new file mode 100644 index 000000000000..5ff94db049c3 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AvmManagedDiskInputDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class A2AvmManagedDiskInputDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskInputDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskInputDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return A2AvmManagedDiskInputDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return A2AvmManagedDiskInputDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return A2AvmManagedDiskInputDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AvmManagedDiskInputDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AvmManagedDiskInputDetails.cs new file mode 100644 index 000000000000..3ae649ee3571 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AvmManagedDiskInputDetails.cs @@ -0,0 +1,226 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// A2A managed disk input details. + public partial class A2AvmManagedDiskInputDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskInputDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskInputDetailsInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfo _diskEncryptionInfo; + + /// The recovery disk encryption information (for one / single pass flows). + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfo DiskEncryptionInfo { get => (this._diskEncryptionInfo = this._diskEncryptionInfo ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DiskEncryptionInfo()); set => this._diskEncryptionInfo = value; } + + /// The KeyVault resource ARM id for secret. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string DiskEncryptionKeyInfoKeyVaultResourceArmId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)DiskEncryptionInfo).DiskEncryptionKeyInfoKeyVaultResourceArmId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)DiskEncryptionInfo).DiskEncryptionKeyInfoKeyVaultResourceArmId = value ?? null; } + + /// The secret url / identifier. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string DiskEncryptionKeyInfoSecretIdentifier { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)DiskEncryptionInfo).DiskEncryptionKeyInfoSecretIdentifier; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)DiskEncryptionInfo).DiskEncryptionKeyInfoSecretIdentifier = value ?? null; } + + /// Backing field for property. + private string _diskId; + + /// The disk Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string DiskId { get => this._diskId; set => this._diskId = value; } + + /// The key URL / identifier. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string KeyEncryptionKeyInfoKeyIdentifier { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)DiskEncryptionInfo).KeyEncryptionKeyInfoKeyIdentifier; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)DiskEncryptionInfo).KeyEncryptionKeyInfoKeyIdentifier = value ?? null; } + + /// The KeyVault resource ARM Id for key. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string KeyEncryptionKeyInfoKeyVaultResourceArmId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)DiskEncryptionInfo).KeyEncryptionKeyInfoKeyVaultResourceArmId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)DiskEncryptionInfo).KeyEncryptionKeyInfoKeyVaultResourceArmId = value ?? null; } + + /// Internal Acessors for DiskEncryptionInfo + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfo Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskInputDetailsInternal.DiskEncryptionInfo { get => (this._diskEncryptionInfo = this._diskEncryptionInfo ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DiskEncryptionInfo()); set { {_diskEncryptionInfo = value;} } } + + /// Internal Acessors for DiskEncryptionInfoDiskEncryptionKeyInfo + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionKeyInfo Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskInputDetailsInternal.DiskEncryptionInfoDiskEncryptionKeyInfo { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)DiskEncryptionInfo).DiskEncryptionKeyInfo; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)DiskEncryptionInfo).DiskEncryptionKeyInfo = value; } + + /// Internal Acessors for DiskEncryptionInfoKeyEncryptionKeyInfo + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IKeyEncryptionKeyInfo Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskInputDetailsInternal.DiskEncryptionInfoKeyEncryptionKeyInfo { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)DiskEncryptionInfo).KeyEncryptionKeyInfo; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)DiskEncryptionInfo).KeyEncryptionKeyInfo = value; } + + /// Backing field for property. + private string _primaryStagingAzureStorageAccountId; + + /// The primary staging storage account Arm Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string PrimaryStagingAzureStorageAccountId { get => this._primaryStagingAzureStorageAccountId; set => this._primaryStagingAzureStorageAccountId = value; } + + /// Backing field for property. + private string _recoveryDiskEncryptionSetId; + + /// The recovery disk encryption set Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryDiskEncryptionSetId { get => this._recoveryDiskEncryptionSetId; set => this._recoveryDiskEncryptionSetId = value; } + + /// Backing field for property. + private string _recoveryReplicaDiskAccountType; + + /// + /// The replica disk type. Its an optional value and will be same as source disk type if not user provided. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryReplicaDiskAccountType { get => this._recoveryReplicaDiskAccountType; set => this._recoveryReplicaDiskAccountType = value; } + + /// Backing field for property. + private string _recoveryResourceGroupId; + + /// The target resource group Arm Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryResourceGroupId { get => this._recoveryResourceGroupId; set => this._recoveryResourceGroupId = value; } + + /// Backing field for property. + private string _recoveryTargetDiskAccountType; + + /// + /// The target disk type after failover. Its an optional value and will be same as source disk type if not user provided. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryTargetDiskAccountType { get => this._recoveryTargetDiskAccountType; set => this._recoveryTargetDiskAccountType = value; } + + /// Creates an new instance. + public A2AvmManagedDiskInputDetails() + { + + } + } + /// A2A managed disk input details. + public partial interface IA2AvmManagedDiskInputDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The KeyVault resource ARM id for secret. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The KeyVault resource ARM id for secret.", + SerializedName = @"keyVaultResourceArmId", + PossibleTypes = new [] { typeof(string) })] + string DiskEncryptionKeyInfoKeyVaultResourceArmId { get; set; } + /// The secret url / identifier. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The secret url / identifier.", + SerializedName = @"secretIdentifier", + PossibleTypes = new [] { typeof(string) })] + string DiskEncryptionKeyInfoSecretIdentifier { get; set; } + /// The disk Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The disk Id.", + SerializedName = @"diskId", + PossibleTypes = new [] { typeof(string) })] + string DiskId { get; set; } + /// The key URL / identifier. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The key URL / identifier.", + SerializedName = @"keyIdentifier", + PossibleTypes = new [] { typeof(string) })] + string KeyEncryptionKeyInfoKeyIdentifier { get; set; } + /// The KeyVault resource ARM Id for key. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The KeyVault resource ARM Id for key.", + SerializedName = @"keyVaultResourceArmId", + PossibleTypes = new [] { typeof(string) })] + string KeyEncryptionKeyInfoKeyVaultResourceArmId { get; set; } + /// The primary staging storage account Arm Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The primary staging storage account Arm Id.", + SerializedName = @"primaryStagingAzureStorageAccountId", + PossibleTypes = new [] { typeof(string) })] + string PrimaryStagingAzureStorageAccountId { get; set; } + /// The recovery disk encryption set Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery disk encryption set Id.", + SerializedName = @"recoveryDiskEncryptionSetId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryDiskEncryptionSetId { get; set; } + /// + /// The replica disk type. Its an optional value and will be same as source disk type if not user provided. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The replica disk type. Its an optional value and will be same as source disk type if not user provided.", + SerializedName = @"recoveryReplicaDiskAccountType", + PossibleTypes = new [] { typeof(string) })] + string RecoveryReplicaDiskAccountType { get; set; } + /// The target resource group Arm Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The target resource group Arm Id.", + SerializedName = @"recoveryResourceGroupId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryResourceGroupId { get; set; } + /// + /// The target disk type after failover. Its an optional value and will be same as source disk type if not user provided. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target disk type after failover. Its an optional value and will be same as source disk type if not user provided.", + SerializedName = @"recoveryTargetDiskAccountType", + PossibleTypes = new [] { typeof(string) })] + string RecoveryTargetDiskAccountType { get; set; } + + } + /// A2A managed disk input details. + internal partial interface IA2AvmManagedDiskInputDetailsInternal + + { + /// The recovery disk encryption information (for one / single pass flows). + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfo DiskEncryptionInfo { get; set; } + /// The recovery KeyVault reference for secret. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionKeyInfo DiskEncryptionInfoDiskEncryptionKeyInfo { get; set; } + /// The recovery KeyVault reference for key. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IKeyEncryptionKeyInfo DiskEncryptionInfoKeyEncryptionKeyInfo { get; set; } + /// The KeyVault resource ARM id for secret. + string DiskEncryptionKeyInfoKeyVaultResourceArmId { get; set; } + /// The secret url / identifier. + string DiskEncryptionKeyInfoSecretIdentifier { get; set; } + /// The disk Id. + string DiskId { get; set; } + /// The key URL / identifier. + string KeyEncryptionKeyInfoKeyIdentifier { get; set; } + /// The KeyVault resource ARM Id for key. + string KeyEncryptionKeyInfoKeyVaultResourceArmId { get; set; } + /// The primary staging storage account Arm Id. + string PrimaryStagingAzureStorageAccountId { get; set; } + /// The recovery disk encryption set Id. + string RecoveryDiskEncryptionSetId { get; set; } + /// + /// The replica disk type. Its an optional value and will be same as source disk type if not user provided. + /// + string RecoveryReplicaDiskAccountType { get; set; } + /// The target resource group Arm Id. + string RecoveryResourceGroupId { get; set; } + /// + /// The target disk type after failover. Its an optional value and will be same as source disk type if not user provided. + /// + string RecoveryTargetDiskAccountType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AvmManagedDiskInputDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AvmManagedDiskInputDetails.json.cs new file mode 100644 index 000000000000..c3ad2f09a2b6 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AvmManagedDiskInputDetails.json.cs @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// A2A managed disk input details. + public partial class A2AvmManagedDiskInputDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal A2AvmManagedDiskInputDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_diskEncryptionInfo = If( json?.PropertyT("diskEncryptionInfo"), out var __jsonDiskEncryptionInfo) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DiskEncryptionInfo.FromJson(__jsonDiskEncryptionInfo) : DiskEncryptionInfo;} + {_diskId = If( json?.PropertyT("diskId"), out var __jsonDiskId) ? (string)__jsonDiskId : (string)DiskId;} + {_primaryStagingAzureStorageAccountId = If( json?.PropertyT("primaryStagingAzureStorageAccountId"), out var __jsonPrimaryStagingAzureStorageAccountId) ? (string)__jsonPrimaryStagingAzureStorageAccountId : (string)PrimaryStagingAzureStorageAccountId;} + {_recoveryResourceGroupId = If( json?.PropertyT("recoveryResourceGroupId"), out var __jsonRecoveryResourceGroupId) ? (string)__jsonRecoveryResourceGroupId : (string)RecoveryResourceGroupId;} + {_recoveryReplicaDiskAccountType = If( json?.PropertyT("recoveryReplicaDiskAccountType"), out var __jsonRecoveryReplicaDiskAccountType) ? (string)__jsonRecoveryReplicaDiskAccountType : (string)RecoveryReplicaDiskAccountType;} + {_recoveryTargetDiskAccountType = If( json?.PropertyT("recoveryTargetDiskAccountType"), out var __jsonRecoveryTargetDiskAccountType) ? (string)__jsonRecoveryTargetDiskAccountType : (string)RecoveryTargetDiskAccountType;} + {_recoveryDiskEncryptionSetId = If( json?.PropertyT("recoveryDiskEncryptionSetId"), out var __jsonRecoveryDiskEncryptionSetId) ? (string)__jsonRecoveryDiskEncryptionSetId : (string)RecoveryDiskEncryptionSetId;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskInputDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskInputDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskInputDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new A2AvmManagedDiskInputDetails(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._diskEncryptionInfo ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._diskEncryptionInfo.ToJson(null,serializationMode) : null, "diskEncryptionInfo" ,container.Add ); + AddIf( null != (((object)this._diskId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._diskId.ToString()) : null, "diskId" ,container.Add ); + AddIf( null != (((object)this._primaryStagingAzureStorageAccountId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._primaryStagingAzureStorageAccountId.ToString()) : null, "primaryStagingAzureStorageAccountId" ,container.Add ); + AddIf( null != (((object)this._recoveryResourceGroupId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryResourceGroupId.ToString()) : null, "recoveryResourceGroupId" ,container.Add ); + AddIf( null != (((object)this._recoveryReplicaDiskAccountType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryReplicaDiskAccountType.ToString()) : null, "recoveryReplicaDiskAccountType" ,container.Add ); + AddIf( null != (((object)this._recoveryTargetDiskAccountType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryTargetDiskAccountType.ToString()) : null, "recoveryTargetDiskAccountType" ,container.Add ); + AddIf( null != (((object)this._recoveryDiskEncryptionSetId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryDiskEncryptionSetId.ToString()) : null, "recoveryDiskEncryptionSetId" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AvmManagedDiskUpdateDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AvmManagedDiskUpdateDetails.PowerShell.cs new file mode 100644 index 000000000000..59597597deeb --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AvmManagedDiskUpdateDetails.PowerShell.cs @@ -0,0 +1,234 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// A2A Vm managed disk update details. + [System.ComponentModel.TypeConverter(typeof(A2AvmManagedDiskUpdateDetailsTypeConverter))] + public partial class A2AvmManagedDiskUpdateDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal A2AvmManagedDiskUpdateDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DiskEncryptionInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskUpdateDetailsInternal)this).DiskEncryptionInfo = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfo) content.GetValueForProperty("DiskEncryptionInfo",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskUpdateDetailsInternal)this).DiskEncryptionInfo, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DiskEncryptionInfoTypeConverter.ConvertFrom); + } + if (content.Contains("DiskId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskUpdateDetailsInternal)this).DiskId = (string) content.GetValueForProperty("DiskId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskUpdateDetailsInternal)this).DiskId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryTargetDiskAccountType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskUpdateDetailsInternal)this).RecoveryTargetDiskAccountType = (string) content.GetValueForProperty("RecoveryTargetDiskAccountType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskUpdateDetailsInternal)this).RecoveryTargetDiskAccountType, global::System.Convert.ToString); + } + if (content.Contains("RecoveryReplicaDiskAccountType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskUpdateDetailsInternal)this).RecoveryReplicaDiskAccountType = (string) content.GetValueForProperty("RecoveryReplicaDiskAccountType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskUpdateDetailsInternal)this).RecoveryReplicaDiskAccountType, global::System.Convert.ToString); + } + if (content.Contains("FailoverDiskName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskUpdateDetailsInternal)this).FailoverDiskName = (string) content.GetValueForProperty("FailoverDiskName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskUpdateDetailsInternal)this).FailoverDiskName, global::System.Convert.ToString); + } + if (content.Contains("TfoDiskName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskUpdateDetailsInternal)this).TfoDiskName = (string) content.GetValueForProperty("TfoDiskName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskUpdateDetailsInternal)this).TfoDiskName, global::System.Convert.ToString); + } + if (content.Contains("DiskEncryptionInfoDiskEncryptionKeyInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskUpdateDetailsInternal)this).DiskEncryptionInfoDiskEncryptionKeyInfo = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionKeyInfo) content.GetValueForProperty("DiskEncryptionInfoDiskEncryptionKeyInfo",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskUpdateDetailsInternal)this).DiskEncryptionInfoDiskEncryptionKeyInfo, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DiskEncryptionKeyInfoTypeConverter.ConvertFrom); + } + if (content.Contains("DiskEncryptionInfoKeyEncryptionKeyInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskUpdateDetailsInternal)this).DiskEncryptionInfoKeyEncryptionKeyInfo = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IKeyEncryptionKeyInfo) content.GetValueForProperty("DiskEncryptionInfoKeyEncryptionKeyInfo",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskUpdateDetailsInternal)this).DiskEncryptionInfoKeyEncryptionKeyInfo, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.KeyEncryptionKeyInfoTypeConverter.ConvertFrom); + } + if (content.Contains("DiskEncryptionKeyInfoSecretIdentifier")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskUpdateDetailsInternal)this).DiskEncryptionKeyInfoSecretIdentifier = (string) content.GetValueForProperty("DiskEncryptionKeyInfoSecretIdentifier",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskUpdateDetailsInternal)this).DiskEncryptionKeyInfoSecretIdentifier, global::System.Convert.ToString); + } + if (content.Contains("KeyEncryptionKeyInfoKeyIdentifier")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskUpdateDetailsInternal)this).KeyEncryptionKeyInfoKeyIdentifier = (string) content.GetValueForProperty("KeyEncryptionKeyInfoKeyIdentifier",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskUpdateDetailsInternal)this).KeyEncryptionKeyInfoKeyIdentifier, global::System.Convert.ToString); + } + if (content.Contains("DiskEncryptionKeyInfoKeyVaultResourceArmId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskUpdateDetailsInternal)this).DiskEncryptionKeyInfoKeyVaultResourceArmId = (string) content.GetValueForProperty("DiskEncryptionKeyInfoKeyVaultResourceArmId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskUpdateDetailsInternal)this).DiskEncryptionKeyInfoKeyVaultResourceArmId, global::System.Convert.ToString); + } + if (content.Contains("KeyEncryptionKeyInfoKeyVaultResourceArmId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskUpdateDetailsInternal)this).KeyEncryptionKeyInfoKeyVaultResourceArmId = (string) content.GetValueForProperty("KeyEncryptionKeyInfoKeyVaultResourceArmId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskUpdateDetailsInternal)this).KeyEncryptionKeyInfoKeyVaultResourceArmId, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal A2AvmManagedDiskUpdateDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DiskEncryptionInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskUpdateDetailsInternal)this).DiskEncryptionInfo = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfo) content.GetValueForProperty("DiskEncryptionInfo",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskUpdateDetailsInternal)this).DiskEncryptionInfo, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DiskEncryptionInfoTypeConverter.ConvertFrom); + } + if (content.Contains("DiskId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskUpdateDetailsInternal)this).DiskId = (string) content.GetValueForProperty("DiskId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskUpdateDetailsInternal)this).DiskId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryTargetDiskAccountType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskUpdateDetailsInternal)this).RecoveryTargetDiskAccountType = (string) content.GetValueForProperty("RecoveryTargetDiskAccountType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskUpdateDetailsInternal)this).RecoveryTargetDiskAccountType, global::System.Convert.ToString); + } + if (content.Contains("RecoveryReplicaDiskAccountType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskUpdateDetailsInternal)this).RecoveryReplicaDiskAccountType = (string) content.GetValueForProperty("RecoveryReplicaDiskAccountType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskUpdateDetailsInternal)this).RecoveryReplicaDiskAccountType, global::System.Convert.ToString); + } + if (content.Contains("FailoverDiskName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskUpdateDetailsInternal)this).FailoverDiskName = (string) content.GetValueForProperty("FailoverDiskName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskUpdateDetailsInternal)this).FailoverDiskName, global::System.Convert.ToString); + } + if (content.Contains("TfoDiskName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskUpdateDetailsInternal)this).TfoDiskName = (string) content.GetValueForProperty("TfoDiskName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskUpdateDetailsInternal)this).TfoDiskName, global::System.Convert.ToString); + } + if (content.Contains("DiskEncryptionInfoDiskEncryptionKeyInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskUpdateDetailsInternal)this).DiskEncryptionInfoDiskEncryptionKeyInfo = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionKeyInfo) content.GetValueForProperty("DiskEncryptionInfoDiskEncryptionKeyInfo",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskUpdateDetailsInternal)this).DiskEncryptionInfoDiskEncryptionKeyInfo, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DiskEncryptionKeyInfoTypeConverter.ConvertFrom); + } + if (content.Contains("DiskEncryptionInfoKeyEncryptionKeyInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskUpdateDetailsInternal)this).DiskEncryptionInfoKeyEncryptionKeyInfo = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IKeyEncryptionKeyInfo) content.GetValueForProperty("DiskEncryptionInfoKeyEncryptionKeyInfo",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskUpdateDetailsInternal)this).DiskEncryptionInfoKeyEncryptionKeyInfo, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.KeyEncryptionKeyInfoTypeConverter.ConvertFrom); + } + if (content.Contains("DiskEncryptionKeyInfoSecretIdentifier")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskUpdateDetailsInternal)this).DiskEncryptionKeyInfoSecretIdentifier = (string) content.GetValueForProperty("DiskEncryptionKeyInfoSecretIdentifier",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskUpdateDetailsInternal)this).DiskEncryptionKeyInfoSecretIdentifier, global::System.Convert.ToString); + } + if (content.Contains("KeyEncryptionKeyInfoKeyIdentifier")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskUpdateDetailsInternal)this).KeyEncryptionKeyInfoKeyIdentifier = (string) content.GetValueForProperty("KeyEncryptionKeyInfoKeyIdentifier",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskUpdateDetailsInternal)this).KeyEncryptionKeyInfoKeyIdentifier, global::System.Convert.ToString); + } + if (content.Contains("DiskEncryptionKeyInfoKeyVaultResourceArmId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskUpdateDetailsInternal)this).DiskEncryptionKeyInfoKeyVaultResourceArmId = (string) content.GetValueForProperty("DiskEncryptionKeyInfoKeyVaultResourceArmId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskUpdateDetailsInternal)this).DiskEncryptionKeyInfoKeyVaultResourceArmId, global::System.Convert.ToString); + } + if (content.Contains("KeyEncryptionKeyInfoKeyVaultResourceArmId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskUpdateDetailsInternal)this).KeyEncryptionKeyInfoKeyVaultResourceArmId = (string) content.GetValueForProperty("KeyEncryptionKeyInfoKeyVaultResourceArmId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskUpdateDetailsInternal)this).KeyEncryptionKeyInfoKeyVaultResourceArmId, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskUpdateDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new A2AvmManagedDiskUpdateDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskUpdateDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new A2AvmManagedDiskUpdateDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskUpdateDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// A2A Vm managed disk update details. + [System.ComponentModel.TypeConverter(typeof(A2AvmManagedDiskUpdateDetailsTypeConverter))] + public partial interface IA2AvmManagedDiskUpdateDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AvmManagedDiskUpdateDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AvmManagedDiskUpdateDetails.TypeConverter.cs new file mode 100644 index 000000000000..18454ac997d7 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AvmManagedDiskUpdateDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class A2AvmManagedDiskUpdateDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskUpdateDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskUpdateDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return A2AvmManagedDiskUpdateDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return A2AvmManagedDiskUpdateDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return A2AvmManagedDiskUpdateDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AvmManagedDiskUpdateDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AvmManagedDiskUpdateDetails.cs new file mode 100644 index 000000000000..4b4f43398953 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AvmManagedDiskUpdateDetails.cs @@ -0,0 +1,197 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// A2A Vm managed disk update details. + public partial class A2AvmManagedDiskUpdateDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskUpdateDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskUpdateDetailsInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfo _diskEncryptionInfo; + + /// The recovery os disk encryption information. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfo DiskEncryptionInfo { get => (this._diskEncryptionInfo = this._diskEncryptionInfo ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DiskEncryptionInfo()); set => this._diskEncryptionInfo = value; } + + /// The KeyVault resource ARM id for secret. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string DiskEncryptionKeyInfoKeyVaultResourceArmId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)DiskEncryptionInfo).DiskEncryptionKeyInfoKeyVaultResourceArmId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)DiskEncryptionInfo).DiskEncryptionKeyInfoKeyVaultResourceArmId = value ?? null; } + + /// The secret url / identifier. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string DiskEncryptionKeyInfoSecretIdentifier { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)DiskEncryptionInfo).DiskEncryptionKeyInfoSecretIdentifier; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)DiskEncryptionInfo).DiskEncryptionKeyInfoSecretIdentifier = value ?? null; } + + /// Backing field for property. + private string _diskId; + + /// The disk Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string DiskId { get => this._diskId; set => this._diskId = value; } + + /// Backing field for property. + private string _failoverDiskName; + + /// The target disk name for unplanned failover operation. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string FailoverDiskName { get => this._failoverDiskName; set => this._failoverDiskName = value; } + + /// The key URL / identifier. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string KeyEncryptionKeyInfoKeyIdentifier { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)DiskEncryptionInfo).KeyEncryptionKeyInfoKeyIdentifier; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)DiskEncryptionInfo).KeyEncryptionKeyInfoKeyIdentifier = value ?? null; } + + /// The KeyVault resource ARM Id for key. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string KeyEncryptionKeyInfoKeyVaultResourceArmId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)DiskEncryptionInfo).KeyEncryptionKeyInfoKeyVaultResourceArmId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)DiskEncryptionInfo).KeyEncryptionKeyInfoKeyVaultResourceArmId = value ?? null; } + + /// Internal Acessors for DiskEncryptionInfo + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfo Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskUpdateDetailsInternal.DiskEncryptionInfo { get => (this._diskEncryptionInfo = this._diskEncryptionInfo ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DiskEncryptionInfo()); set { {_diskEncryptionInfo = value;} } } + + /// Internal Acessors for DiskEncryptionInfoDiskEncryptionKeyInfo + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionKeyInfo Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskUpdateDetailsInternal.DiskEncryptionInfoDiskEncryptionKeyInfo { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)DiskEncryptionInfo).DiskEncryptionKeyInfo; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)DiskEncryptionInfo).DiskEncryptionKeyInfo = value; } + + /// Internal Acessors for DiskEncryptionInfoKeyEncryptionKeyInfo + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IKeyEncryptionKeyInfo Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskUpdateDetailsInternal.DiskEncryptionInfoKeyEncryptionKeyInfo { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)DiskEncryptionInfo).KeyEncryptionKeyInfo; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)DiskEncryptionInfo).KeyEncryptionKeyInfo = value; } + + /// Backing field for property. + private string _recoveryReplicaDiskAccountType; + + /// The replica disk type before failover. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryReplicaDiskAccountType { get => this._recoveryReplicaDiskAccountType; set => this._recoveryReplicaDiskAccountType = value; } + + /// Backing field for property. + private string _recoveryTargetDiskAccountType; + + /// The target disk type before failover. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryTargetDiskAccountType { get => this._recoveryTargetDiskAccountType; set => this._recoveryTargetDiskAccountType = value; } + + /// Backing field for property. + private string _tfoDiskName; + + /// The target disk name for test failover operation. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TfoDiskName { get => this._tfoDiskName; set => this._tfoDiskName = value; } + + /// Creates an new instance. + public A2AvmManagedDiskUpdateDetails() + { + + } + } + /// A2A Vm managed disk update details. + public partial interface IA2AvmManagedDiskUpdateDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The KeyVault resource ARM id for secret. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The KeyVault resource ARM id for secret.", + SerializedName = @"keyVaultResourceArmId", + PossibleTypes = new [] { typeof(string) })] + string DiskEncryptionKeyInfoKeyVaultResourceArmId { get; set; } + /// The secret url / identifier. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The secret url / identifier.", + SerializedName = @"secretIdentifier", + PossibleTypes = new [] { typeof(string) })] + string DiskEncryptionKeyInfoSecretIdentifier { get; set; } + /// The disk Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The disk Id.", + SerializedName = @"diskId", + PossibleTypes = new [] { typeof(string) })] + string DiskId { get; set; } + /// The target disk name for unplanned failover operation. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target disk name for unplanned failover operation.", + SerializedName = @"failoverDiskName", + PossibleTypes = new [] { typeof(string) })] + string FailoverDiskName { get; set; } + /// The key URL / identifier. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The key URL / identifier.", + SerializedName = @"keyIdentifier", + PossibleTypes = new [] { typeof(string) })] + string KeyEncryptionKeyInfoKeyIdentifier { get; set; } + /// The KeyVault resource ARM Id for key. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The KeyVault resource ARM Id for key.", + SerializedName = @"keyVaultResourceArmId", + PossibleTypes = new [] { typeof(string) })] + string KeyEncryptionKeyInfoKeyVaultResourceArmId { get; set; } + /// The replica disk type before failover. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The replica disk type before failover.", + SerializedName = @"recoveryReplicaDiskAccountType", + PossibleTypes = new [] { typeof(string) })] + string RecoveryReplicaDiskAccountType { get; set; } + /// The target disk type before failover. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target disk type before failover.", + SerializedName = @"recoveryTargetDiskAccountType", + PossibleTypes = new [] { typeof(string) })] + string RecoveryTargetDiskAccountType { get; set; } + /// The target disk name for test failover operation. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target disk name for test failover operation.", + SerializedName = @"tfoDiskName", + PossibleTypes = new [] { typeof(string) })] + string TfoDiskName { get; set; } + + } + /// A2A Vm managed disk update details. + internal partial interface IA2AvmManagedDiskUpdateDetailsInternal + + { + /// The recovery os disk encryption information. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfo DiskEncryptionInfo { get; set; } + /// The recovery KeyVault reference for secret. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionKeyInfo DiskEncryptionInfoDiskEncryptionKeyInfo { get; set; } + /// The recovery KeyVault reference for key. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IKeyEncryptionKeyInfo DiskEncryptionInfoKeyEncryptionKeyInfo { get; set; } + /// The KeyVault resource ARM id for secret. + string DiskEncryptionKeyInfoKeyVaultResourceArmId { get; set; } + /// The secret url / identifier. + string DiskEncryptionKeyInfoSecretIdentifier { get; set; } + /// The disk Id. + string DiskId { get; set; } + /// The target disk name for unplanned failover operation. + string FailoverDiskName { get; set; } + /// The key URL / identifier. + string KeyEncryptionKeyInfoKeyIdentifier { get; set; } + /// The KeyVault resource ARM Id for key. + string KeyEncryptionKeyInfoKeyVaultResourceArmId { get; set; } + /// The replica disk type before failover. + string RecoveryReplicaDiskAccountType { get; set; } + /// The target disk type before failover. + string RecoveryTargetDiskAccountType { get; set; } + /// The target disk name for test failover operation. + string TfoDiskName { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AvmManagedDiskUpdateDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AvmManagedDiskUpdateDetails.json.cs new file mode 100644 index 000000000000..f855d96eded0 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/A2AvmManagedDiskUpdateDetails.json.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// A2A Vm managed disk update details. + public partial class A2AvmManagedDiskUpdateDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal A2AvmManagedDiskUpdateDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_diskEncryptionInfo = If( json?.PropertyT("diskEncryptionInfo"), out var __jsonDiskEncryptionInfo) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DiskEncryptionInfo.FromJson(__jsonDiskEncryptionInfo) : DiskEncryptionInfo;} + {_diskId = If( json?.PropertyT("diskId"), out var __jsonDiskId) ? (string)__jsonDiskId : (string)DiskId;} + {_recoveryTargetDiskAccountType = If( json?.PropertyT("recoveryTargetDiskAccountType"), out var __jsonRecoveryTargetDiskAccountType) ? (string)__jsonRecoveryTargetDiskAccountType : (string)RecoveryTargetDiskAccountType;} + {_recoveryReplicaDiskAccountType = If( json?.PropertyT("recoveryReplicaDiskAccountType"), out var __jsonRecoveryReplicaDiskAccountType) ? (string)__jsonRecoveryReplicaDiskAccountType : (string)RecoveryReplicaDiskAccountType;} + {_failoverDiskName = If( json?.PropertyT("failoverDiskName"), out var __jsonFailoverDiskName) ? (string)__jsonFailoverDiskName : (string)FailoverDiskName;} + {_tfoDiskName = If( json?.PropertyT("tfoDiskName"), out var __jsonTfoDiskName) ? (string)__jsonTfoDiskName : (string)TfoDiskName;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskUpdateDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskUpdateDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AvmManagedDiskUpdateDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new A2AvmManagedDiskUpdateDetails(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._diskEncryptionInfo ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._diskEncryptionInfo.ToJson(null,serializationMode) : null, "diskEncryptionInfo" ,container.Add ); + AddIf( null != (((object)this._diskId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._diskId.ToString()) : null, "diskId" ,container.Add ); + AddIf( null != (((object)this._recoveryTargetDiskAccountType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryTargetDiskAccountType.ToString()) : null, "recoveryTargetDiskAccountType" ,container.Add ); + AddIf( null != (((object)this._recoveryReplicaDiskAccountType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryReplicaDiskAccountType.ToString()) : null, "recoveryReplicaDiskAccountType" ,container.Add ); + AddIf( null != (((object)this._failoverDiskName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._failoverDiskName.ToString()) : null, "failoverDiskName" ,container.Add ); + AddIf( null != (((object)this._tfoDiskName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._tfoDiskName.ToString()) : null, "tfoDiskName" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AddDisksInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AddDisksInput.PowerShell.cs new file mode 100644 index 000000000000..9a96ca58285c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AddDisksInput.PowerShell.cs @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Input for add disk(s) operation. + [System.ComponentModel.TypeConverter(typeof(AddDisksInputTypeConverter))] + public partial class AddDisksInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal AddDisksInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksInputInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksInputProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksInputInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AddDisksInputPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksInputInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksProviderSpecificInput) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksInputInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AddDisksProviderSpecificInputTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksInputInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksInputInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal AddDisksInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksInputInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksInputProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksInputInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AddDisksInputPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksInputInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksProviderSpecificInput) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksInputInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AddDisksProviderSpecificInputTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksInputInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksInputInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new AddDisksInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new AddDisksInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Input for add disk(s) operation. + [System.ComponentModel.TypeConverter(typeof(AddDisksInputTypeConverter))] + public partial interface IAddDisksInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AddDisksInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AddDisksInput.TypeConverter.cs new file mode 100644 index 000000000000..c6f112037ef7 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AddDisksInput.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class AddDisksInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return AddDisksInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return AddDisksInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return AddDisksInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AddDisksInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AddDisksInput.cs new file mode 100644 index 000000000000..bda20718ca30 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AddDisksInput.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Input for add disk(s) operation. + public partial class AddDisksInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksInputInternal + { + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksInputProperties Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksInputInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AddDisksInputProperties()); set { {_property = value;} } } + + /// Internal Acessors for ProviderSpecificDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksProviderSpecificInput Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksInputInternal.ProviderSpecificDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksInputPropertiesInternal)Property).ProviderSpecificDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksInputPropertiesInternal)Property).ProviderSpecificDetail = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksInputProperties _property; + + /// Add disks input properties. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksInputProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AddDisksInputProperties()); set => this._property = value; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ProviderSpecificDetailInstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksInputPropertiesInternal)Property).ProviderSpecificDetailInstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksInputPropertiesInternal)Property).ProviderSpecificDetailInstanceType = value ?? null; } + + /// Creates an new instance. + public AddDisksInput() + { + + } + } + /// Input for add disk(s) operation. + public partial interface IAddDisksInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string ProviderSpecificDetailInstanceType { get; set; } + + } + /// Input for add disk(s) operation. + internal partial interface IAddDisksInputInternal + + { + /// Add disks input properties. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksInputProperties Property { get; set; } + /// + /// 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. + /// + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksProviderSpecificInput ProviderSpecificDetail { get; set; } + /// The class type. + string ProviderSpecificDetailInstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AddDisksInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AddDisksInput.json.cs new file mode 100644 index 000000000000..acaf2dfdda32 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AddDisksInput.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Input for add disk(s) operation. + public partial class AddDisksInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal AddDisksInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AddDisksInputProperties.FromJson(__jsonProperties) : Property;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new AddDisksInput(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AddDisksInputProperties.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AddDisksInputProperties.PowerShell.cs new file mode 100644 index 000000000000..19cb56e32b97 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AddDisksInputProperties.PowerShell.cs @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Add Disks input properties. + [System.ComponentModel.TypeConverter(typeof(AddDisksInputPropertiesTypeConverter))] + public partial class AddDisksInputProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal AddDisksInputProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksInputPropertiesInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksProviderSpecificInput) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksInputPropertiesInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AddDisksProviderSpecificInputTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksInputPropertiesInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksInputPropertiesInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal AddDisksInputProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksInputPropertiesInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksProviderSpecificInput) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksInputPropertiesInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AddDisksProviderSpecificInputTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksInputPropertiesInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksInputPropertiesInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksInputProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new AddDisksInputProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksInputProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new AddDisksInputProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksInputProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Add Disks input properties. + [System.ComponentModel.TypeConverter(typeof(AddDisksInputPropertiesTypeConverter))] + public partial interface IAddDisksInputProperties + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AddDisksInputProperties.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AddDisksInputProperties.TypeConverter.cs new file mode 100644 index 000000000000..7cce246d122d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AddDisksInputProperties.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class AddDisksInputPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksInputProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksInputProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return AddDisksInputProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return AddDisksInputProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return AddDisksInputProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AddDisksInputProperties.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AddDisksInputProperties.cs new file mode 100644 index 000000000000..949846358d4e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AddDisksInputProperties.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Add Disks input properties. + public partial class AddDisksInputProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksInputProperties, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksInputPropertiesInternal + { + + /// Internal Acessors for ProviderSpecificDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksProviderSpecificInput Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksInputPropertiesInternal.ProviderSpecificDetail { get => (this._providerSpecificDetail = this._providerSpecificDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AddDisksProviderSpecificInput()); set { {_providerSpecificDetail = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksProviderSpecificInput _providerSpecificDetail; + + /// + /// 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. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksProviderSpecificInput ProviderSpecificDetail { get => (this._providerSpecificDetail = this._providerSpecificDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AddDisksProviderSpecificInput()); set => this._providerSpecificDetail = value; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ProviderSpecificDetailInstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksProviderSpecificInputInternal)ProviderSpecificDetail).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksProviderSpecificInputInternal)ProviderSpecificDetail).InstanceType = value ; } + + /// Creates an new instance. + public AddDisksInputProperties() + { + + } + } + /// Add Disks input properties. + public partial interface IAddDisksInputProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string ProviderSpecificDetailInstanceType { get; set; } + + } + /// Add Disks input properties. + internal partial interface IAddDisksInputPropertiesInternal + + { + /// + /// 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. + /// + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksProviderSpecificInput ProviderSpecificDetail { get; set; } + /// The class type. + string ProviderSpecificDetailInstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AddDisksInputProperties.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AddDisksInputProperties.json.cs new file mode 100644 index 000000000000..800ddd0b1bd0 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AddDisksInputProperties.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Add Disks input properties. + public partial class AddDisksInputProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal AddDisksInputProperties(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_providerSpecificDetail = If( json?.PropertyT("providerSpecificDetails"), out var __jsonProviderSpecificDetails) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AddDisksProviderSpecificInput.FromJson(__jsonProviderSpecificDetails) : ProviderSpecificDetail;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksInputProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksInputProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksInputProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new AddDisksInputProperties(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._providerSpecificDetail ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._providerSpecificDetail.ToJson(null,serializationMode) : null, "providerSpecificDetails" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AddDisksProviderSpecificInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AddDisksProviderSpecificInput.PowerShell.cs new file mode 100644 index 000000000000..76a9ca168ee6 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AddDisksProviderSpecificInput.PowerShell.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Add Disks provider specific input. + [System.ComponentModel.TypeConverter(typeof(AddDisksProviderSpecificInputTypeConverter))] + public partial class AddDisksProviderSpecificInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal AddDisksProviderSpecificInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal AddDisksProviderSpecificInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksProviderSpecificInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new AddDisksProviderSpecificInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksProviderSpecificInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new AddDisksProviderSpecificInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksProviderSpecificInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Add Disks provider specific input. + [System.ComponentModel.TypeConverter(typeof(AddDisksProviderSpecificInputTypeConverter))] + public partial interface IAddDisksProviderSpecificInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AddDisksProviderSpecificInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AddDisksProviderSpecificInput.TypeConverter.cs new file mode 100644 index 000000000000..2f7266edb53b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AddDisksProviderSpecificInput.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class AddDisksProviderSpecificInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksProviderSpecificInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksProviderSpecificInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return AddDisksProviderSpecificInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return AddDisksProviderSpecificInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return AddDisksProviderSpecificInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AddDisksProviderSpecificInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AddDisksProviderSpecificInput.cs new file mode 100644 index 000000000000..49b9f429b320 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AddDisksProviderSpecificInput.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Add Disks provider specific input. + public partial class AddDisksProviderSpecificInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksProviderSpecificInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksProviderSpecificInputInternal + { + + /// Backing field for property. + private string _instanceType; + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string InstanceType { get => this._instanceType; set => this._instanceType = value; } + + /// Creates an new instance. + public AddDisksProviderSpecificInput() + { + + } + } + /// Add Disks provider specific input. + public partial interface IAddDisksProviderSpecificInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string InstanceType { get; set; } + + } + /// Add Disks provider specific input. + internal partial interface IAddDisksProviderSpecificInputInternal + + { + /// The class type. + string InstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AddDisksProviderSpecificInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AddDisksProviderSpecificInput.json.cs new file mode 100644 index 000000000000..99f3016ac4d1 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AddDisksProviderSpecificInput.json.cs @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Add Disks provider specific input. + public partial class AddDisksProviderSpecificInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal AddDisksProviderSpecificInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_instanceType = If( json?.PropertyT("instanceType"), out var __jsonInstanceType) ? (string)__jsonInstanceType : (string)InstanceType;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksProviderSpecificInput. + /// Note: the Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksProviderSpecificInput interface is + /// polymorphic, and the precise model class that will get deserialized is determined at runtime based on the payload. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksProviderSpecificInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksProviderSpecificInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + if (!(node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json)) + { + return null; + } + // Polymorphic type -- select the appropriate constructor using the discriminator + + switch ( json.StringProperty("instanceType") ) + { + case "A2A": + { + return new A2AAddDisksInput(json); + } + } + return new AddDisksProviderSpecificInput(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._instanceType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._instanceType.ToString()) : null, "instanceType" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AddRecoveryServicesProviderInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AddRecoveryServicesProviderInput.PowerShell.cs new file mode 100644 index 000000000000..8bbd6b5352bf --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AddRecoveryServicesProviderInput.PowerShell.cs @@ -0,0 +1,314 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Input required to add a provider. + [System.ComponentModel.TypeConverter(typeof(AddRecoveryServicesProviderInputTypeConverter))] + public partial class AddRecoveryServicesProviderInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal AddRecoveryServicesProviderInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AddRecoveryServicesProviderInputPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("AuthenticationIdentityInput")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputInternal)this).AuthenticationIdentityInput = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInput) content.GetValueForProperty("AuthenticationIdentityInput",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputInternal)this).AuthenticationIdentityInput, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IdentityProviderInputTypeConverter.ConvertFrom); + } + if (content.Contains("ResourceAccessIdentityInput")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputInternal)this).ResourceAccessIdentityInput = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInput) content.GetValueForProperty("ResourceAccessIdentityInput",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputInternal)this).ResourceAccessIdentityInput, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IdentityProviderInputTypeConverter.ConvertFrom); + } + if (content.Contains("DataPlaneAuthenticationIdentityInput")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputInternal)this).DataPlaneAuthenticationIdentityInput = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInput) content.GetValueForProperty("DataPlaneAuthenticationIdentityInput",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputInternal)this).DataPlaneAuthenticationIdentityInput, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IdentityProviderInputTypeConverter.ConvertFrom); + } + if (content.Contains("MachineName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputInternal)this).MachineName = (string) content.GetValueForProperty("MachineName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputInternal)this).MachineName, global::System.Convert.ToString); + } + if (content.Contains("MachineId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputInternal)this).MachineId = (string) content.GetValueForProperty("MachineId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputInternal)this).MachineId, global::System.Convert.ToString); + } + if (content.Contains("BiosId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputInternal)this).BiosId = (string) content.GetValueForProperty("BiosId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputInternal)this).BiosId, global::System.Convert.ToString); + } + if (content.Contains("AuthenticationIdentityInputTenantId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputInternal)this).AuthenticationIdentityInputTenantId = (string) content.GetValueForProperty("AuthenticationIdentityInputTenantId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputInternal)this).AuthenticationIdentityInputTenantId, global::System.Convert.ToString); + } + if (content.Contains("AuthenticationIdentityInputApplicationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputInternal)this).AuthenticationIdentityInputApplicationId = (string) content.GetValueForProperty("AuthenticationIdentityInputApplicationId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputInternal)this).AuthenticationIdentityInputApplicationId, global::System.Convert.ToString); + } + if (content.Contains("AuthenticationIdentityInputObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputInternal)this).AuthenticationIdentityInputObjectId = (string) content.GetValueForProperty("AuthenticationIdentityInputObjectId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputInternal)this).AuthenticationIdentityInputObjectId, global::System.Convert.ToString); + } + if (content.Contains("AuthenticationIdentityInputAudience")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputInternal)this).AuthenticationIdentityInputAudience = (string) content.GetValueForProperty("AuthenticationIdentityInputAudience",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputInternal)this).AuthenticationIdentityInputAudience, global::System.Convert.ToString); + } + if (content.Contains("AuthenticationIdentityInputAadAuthority")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputInternal)this).AuthenticationIdentityInputAadAuthority = (string) content.GetValueForProperty("AuthenticationIdentityInputAadAuthority",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputInternal)this).AuthenticationIdentityInputAadAuthority, global::System.Convert.ToString); + } + if (content.Contains("ResourceAccessIdentityInputTenantId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputInternal)this).ResourceAccessIdentityInputTenantId = (string) content.GetValueForProperty("ResourceAccessIdentityInputTenantId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputInternal)this).ResourceAccessIdentityInputTenantId, global::System.Convert.ToString); + } + if (content.Contains("ResourceAccessIdentityInputApplicationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputInternal)this).ResourceAccessIdentityInputApplicationId = (string) content.GetValueForProperty("ResourceAccessIdentityInputApplicationId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputInternal)this).ResourceAccessIdentityInputApplicationId, global::System.Convert.ToString); + } + if (content.Contains("ResourceAccessIdentityInputObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputInternal)this).ResourceAccessIdentityInputObjectId = (string) content.GetValueForProperty("ResourceAccessIdentityInputObjectId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputInternal)this).ResourceAccessIdentityInputObjectId, global::System.Convert.ToString); + } + if (content.Contains("ResourceAccessIdentityInputAudience")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputInternal)this).ResourceAccessIdentityInputAudience = (string) content.GetValueForProperty("ResourceAccessIdentityInputAudience",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputInternal)this).ResourceAccessIdentityInputAudience, global::System.Convert.ToString); + } + if (content.Contains("ResourceAccessIdentityInputAadAuthority")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputInternal)this).ResourceAccessIdentityInputAadAuthority = (string) content.GetValueForProperty("ResourceAccessIdentityInputAadAuthority",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputInternal)this).ResourceAccessIdentityInputAadAuthority, global::System.Convert.ToString); + } + if (content.Contains("DataPlaneAuthenticationIdentityInputTenantId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputInternal)this).DataPlaneAuthenticationIdentityInputTenantId = (string) content.GetValueForProperty("DataPlaneAuthenticationIdentityInputTenantId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputInternal)this).DataPlaneAuthenticationIdentityInputTenantId, global::System.Convert.ToString); + } + if (content.Contains("DataPlaneAuthenticationIdentityInputApplicationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputInternal)this).DataPlaneAuthenticationIdentityInputApplicationId = (string) content.GetValueForProperty("DataPlaneAuthenticationIdentityInputApplicationId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputInternal)this).DataPlaneAuthenticationIdentityInputApplicationId, global::System.Convert.ToString); + } + if (content.Contains("DataPlaneAuthenticationIdentityInputObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputInternal)this).DataPlaneAuthenticationIdentityInputObjectId = (string) content.GetValueForProperty("DataPlaneAuthenticationIdentityInputObjectId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputInternal)this).DataPlaneAuthenticationIdentityInputObjectId, global::System.Convert.ToString); + } + if (content.Contains("DataPlaneAuthenticationIdentityInputAudience")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputInternal)this).DataPlaneAuthenticationIdentityInputAudience = (string) content.GetValueForProperty("DataPlaneAuthenticationIdentityInputAudience",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputInternal)this).DataPlaneAuthenticationIdentityInputAudience, global::System.Convert.ToString); + } + if (content.Contains("DataPlaneAuthenticationIdentityInputAadAuthority")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputInternal)this).DataPlaneAuthenticationIdentityInputAadAuthority = (string) content.GetValueForProperty("DataPlaneAuthenticationIdentityInputAadAuthority",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputInternal)this).DataPlaneAuthenticationIdentityInputAadAuthority, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal AddRecoveryServicesProviderInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AddRecoveryServicesProviderInputPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("AuthenticationIdentityInput")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputInternal)this).AuthenticationIdentityInput = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInput) content.GetValueForProperty("AuthenticationIdentityInput",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputInternal)this).AuthenticationIdentityInput, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IdentityProviderInputTypeConverter.ConvertFrom); + } + if (content.Contains("ResourceAccessIdentityInput")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputInternal)this).ResourceAccessIdentityInput = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInput) content.GetValueForProperty("ResourceAccessIdentityInput",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputInternal)this).ResourceAccessIdentityInput, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IdentityProviderInputTypeConverter.ConvertFrom); + } + if (content.Contains("DataPlaneAuthenticationIdentityInput")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputInternal)this).DataPlaneAuthenticationIdentityInput = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInput) content.GetValueForProperty("DataPlaneAuthenticationIdentityInput",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputInternal)this).DataPlaneAuthenticationIdentityInput, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IdentityProviderInputTypeConverter.ConvertFrom); + } + if (content.Contains("MachineName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputInternal)this).MachineName = (string) content.GetValueForProperty("MachineName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputInternal)this).MachineName, global::System.Convert.ToString); + } + if (content.Contains("MachineId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputInternal)this).MachineId = (string) content.GetValueForProperty("MachineId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputInternal)this).MachineId, global::System.Convert.ToString); + } + if (content.Contains("BiosId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputInternal)this).BiosId = (string) content.GetValueForProperty("BiosId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputInternal)this).BiosId, global::System.Convert.ToString); + } + if (content.Contains("AuthenticationIdentityInputTenantId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputInternal)this).AuthenticationIdentityInputTenantId = (string) content.GetValueForProperty("AuthenticationIdentityInputTenantId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputInternal)this).AuthenticationIdentityInputTenantId, global::System.Convert.ToString); + } + if (content.Contains("AuthenticationIdentityInputApplicationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputInternal)this).AuthenticationIdentityInputApplicationId = (string) content.GetValueForProperty("AuthenticationIdentityInputApplicationId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputInternal)this).AuthenticationIdentityInputApplicationId, global::System.Convert.ToString); + } + if (content.Contains("AuthenticationIdentityInputObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputInternal)this).AuthenticationIdentityInputObjectId = (string) content.GetValueForProperty("AuthenticationIdentityInputObjectId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputInternal)this).AuthenticationIdentityInputObjectId, global::System.Convert.ToString); + } + if (content.Contains("AuthenticationIdentityInputAudience")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputInternal)this).AuthenticationIdentityInputAudience = (string) content.GetValueForProperty("AuthenticationIdentityInputAudience",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputInternal)this).AuthenticationIdentityInputAudience, global::System.Convert.ToString); + } + if (content.Contains("AuthenticationIdentityInputAadAuthority")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputInternal)this).AuthenticationIdentityInputAadAuthority = (string) content.GetValueForProperty("AuthenticationIdentityInputAadAuthority",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputInternal)this).AuthenticationIdentityInputAadAuthority, global::System.Convert.ToString); + } + if (content.Contains("ResourceAccessIdentityInputTenantId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputInternal)this).ResourceAccessIdentityInputTenantId = (string) content.GetValueForProperty("ResourceAccessIdentityInputTenantId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputInternal)this).ResourceAccessIdentityInputTenantId, global::System.Convert.ToString); + } + if (content.Contains("ResourceAccessIdentityInputApplicationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputInternal)this).ResourceAccessIdentityInputApplicationId = (string) content.GetValueForProperty("ResourceAccessIdentityInputApplicationId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputInternal)this).ResourceAccessIdentityInputApplicationId, global::System.Convert.ToString); + } + if (content.Contains("ResourceAccessIdentityInputObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputInternal)this).ResourceAccessIdentityInputObjectId = (string) content.GetValueForProperty("ResourceAccessIdentityInputObjectId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputInternal)this).ResourceAccessIdentityInputObjectId, global::System.Convert.ToString); + } + if (content.Contains("ResourceAccessIdentityInputAudience")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputInternal)this).ResourceAccessIdentityInputAudience = (string) content.GetValueForProperty("ResourceAccessIdentityInputAudience",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputInternal)this).ResourceAccessIdentityInputAudience, global::System.Convert.ToString); + } + if (content.Contains("ResourceAccessIdentityInputAadAuthority")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputInternal)this).ResourceAccessIdentityInputAadAuthority = (string) content.GetValueForProperty("ResourceAccessIdentityInputAadAuthority",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputInternal)this).ResourceAccessIdentityInputAadAuthority, global::System.Convert.ToString); + } + if (content.Contains("DataPlaneAuthenticationIdentityInputTenantId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputInternal)this).DataPlaneAuthenticationIdentityInputTenantId = (string) content.GetValueForProperty("DataPlaneAuthenticationIdentityInputTenantId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputInternal)this).DataPlaneAuthenticationIdentityInputTenantId, global::System.Convert.ToString); + } + if (content.Contains("DataPlaneAuthenticationIdentityInputApplicationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputInternal)this).DataPlaneAuthenticationIdentityInputApplicationId = (string) content.GetValueForProperty("DataPlaneAuthenticationIdentityInputApplicationId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputInternal)this).DataPlaneAuthenticationIdentityInputApplicationId, global::System.Convert.ToString); + } + if (content.Contains("DataPlaneAuthenticationIdentityInputObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputInternal)this).DataPlaneAuthenticationIdentityInputObjectId = (string) content.GetValueForProperty("DataPlaneAuthenticationIdentityInputObjectId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputInternal)this).DataPlaneAuthenticationIdentityInputObjectId, global::System.Convert.ToString); + } + if (content.Contains("DataPlaneAuthenticationIdentityInputAudience")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputInternal)this).DataPlaneAuthenticationIdentityInputAudience = (string) content.GetValueForProperty("DataPlaneAuthenticationIdentityInputAudience",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputInternal)this).DataPlaneAuthenticationIdentityInputAudience, global::System.Convert.ToString); + } + if (content.Contains("DataPlaneAuthenticationIdentityInputAadAuthority")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputInternal)this).DataPlaneAuthenticationIdentityInputAadAuthority = (string) content.GetValueForProperty("DataPlaneAuthenticationIdentityInputAadAuthority",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputInternal)this).DataPlaneAuthenticationIdentityInputAadAuthority, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new AddRecoveryServicesProviderInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new AddRecoveryServicesProviderInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Input required to add a provider. + [System.ComponentModel.TypeConverter(typeof(AddRecoveryServicesProviderInputTypeConverter))] + public partial interface IAddRecoveryServicesProviderInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AddRecoveryServicesProviderInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AddRecoveryServicesProviderInput.TypeConverter.cs new file mode 100644 index 000000000000..8fbb35b52072 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AddRecoveryServicesProviderInput.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class AddRecoveryServicesProviderInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return AddRecoveryServicesProviderInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return AddRecoveryServicesProviderInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return AddRecoveryServicesProviderInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AddRecoveryServicesProviderInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AddRecoveryServicesProviderInput.cs new file mode 100644 index 000000000000..862c719d0a4e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AddRecoveryServicesProviderInput.cs @@ -0,0 +1,421 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Input required to add a provider. + public partial class AddRecoveryServicesProviderInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputInternal + { + + /// The base authority for Azure Active Directory authentication. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string AuthenticationIdentityInputAadAuthority { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)Property).AuthenticationIdentityInputAadAuthority; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)Property).AuthenticationIdentityInputAadAuthority = value ; } + + /// + /// The application/client Id for the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string AuthenticationIdentityInputApplicationId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)Property).AuthenticationIdentityInputApplicationId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)Property).AuthenticationIdentityInputApplicationId = value ; } + + /// + /// The intended Audience of the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string AuthenticationIdentityInputAudience { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)Property).AuthenticationIdentityInputAudience; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)Property).AuthenticationIdentityInputAudience = value ; } + + /// + /// The object Id of the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string AuthenticationIdentityInputObjectId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)Property).AuthenticationIdentityInputObjectId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)Property).AuthenticationIdentityInputObjectId = value ; } + + /// + /// The tenant Id for the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string AuthenticationIdentityInputTenantId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)Property).AuthenticationIdentityInputTenantId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)Property).AuthenticationIdentityInputTenantId = value ; } + + /// The Bios Id of the machine. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string BiosId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)Property).BiosId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)Property).BiosId = value ?? null; } + + /// The base authority for Azure Active Directory authentication. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string DataPlaneAuthenticationIdentityInputAadAuthority { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)Property).DataPlaneAuthenticationIdentityInputAadAuthority; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)Property).DataPlaneAuthenticationIdentityInputAadAuthority = value ?? null; } + + /// + /// The application/client Id for the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string DataPlaneAuthenticationIdentityInputApplicationId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)Property).DataPlaneAuthenticationIdentityInputApplicationId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)Property).DataPlaneAuthenticationIdentityInputApplicationId = value ?? null; } + + /// + /// The intended Audience of the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string DataPlaneAuthenticationIdentityInputAudience { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)Property).DataPlaneAuthenticationIdentityInputAudience; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)Property).DataPlaneAuthenticationIdentityInputAudience = value ?? null; } + + /// + /// The object Id of the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string DataPlaneAuthenticationIdentityInputObjectId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)Property).DataPlaneAuthenticationIdentityInputObjectId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)Property).DataPlaneAuthenticationIdentityInputObjectId = value ?? null; } + + /// + /// The tenant Id for the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string DataPlaneAuthenticationIdentityInputTenantId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)Property).DataPlaneAuthenticationIdentityInputTenantId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)Property).DataPlaneAuthenticationIdentityInputTenantId = value ?? null; } + + /// The Id of the machine where the provider is getting added. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string MachineId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)Property).MachineId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)Property).MachineId = value ?? null; } + + /// The name of the machine where the provider is getting added. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string MachineName { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)Property).MachineName; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)Property).MachineName = value ; } + + /// Internal Acessors for AuthenticationIdentityInput + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInput Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputInternal.AuthenticationIdentityInput { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)Property).AuthenticationIdentityInput; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)Property).AuthenticationIdentityInput = value; } + + /// Internal Acessors for DataPlaneAuthenticationIdentityInput + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInput Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputInternal.DataPlaneAuthenticationIdentityInput { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)Property).DataPlaneAuthenticationIdentityInput; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)Property).DataPlaneAuthenticationIdentityInput = value; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputProperties Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AddRecoveryServicesProviderInputProperties()); set { {_property = value;} } } + + /// Internal Acessors for ResourceAccessIdentityInput + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInput Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputInternal.ResourceAccessIdentityInput { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)Property).ResourceAccessIdentityInput; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)Property).ResourceAccessIdentityInput = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputProperties _property; + + /// The properties of an add provider request. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AddRecoveryServicesProviderInputProperties()); set => this._property = value; } + + /// The base authority for Azure Active Directory authentication. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ResourceAccessIdentityInputAadAuthority { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)Property).ResourceAccessIdentityInputAadAuthority; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)Property).ResourceAccessIdentityInputAadAuthority = value ; } + + /// + /// The application/client Id for the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ResourceAccessIdentityInputApplicationId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)Property).ResourceAccessIdentityInputApplicationId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)Property).ResourceAccessIdentityInputApplicationId = value ; } + + /// + /// The intended Audience of the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ResourceAccessIdentityInputAudience { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)Property).ResourceAccessIdentityInputAudience; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)Property).ResourceAccessIdentityInputAudience = value ; } + + /// + /// The object Id of the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ResourceAccessIdentityInputObjectId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)Property).ResourceAccessIdentityInputObjectId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)Property).ResourceAccessIdentityInputObjectId = value ; } + + /// + /// The tenant Id for the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ResourceAccessIdentityInputTenantId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)Property).ResourceAccessIdentityInputTenantId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)Property).ResourceAccessIdentityInputTenantId = value ; } + + /// Creates an new instance. + public AddRecoveryServicesProviderInput() + { + + } + } + /// Input required to add a provider. + public partial interface IAddRecoveryServicesProviderInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The base authority for Azure Active Directory authentication. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The base authority for Azure Active Directory authentication.", + SerializedName = @"aadAuthority", + PossibleTypes = new [] { typeof(string) })] + string AuthenticationIdentityInputAadAuthority { get; set; } + /// + /// The application/client Id for the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The application/client Id for the service principal with which the on-premise management/data plane components would communicate with our Azure services.", + SerializedName = @"applicationId", + PossibleTypes = new [] { typeof(string) })] + string AuthenticationIdentityInputApplicationId { get; set; } + /// + /// The intended Audience of the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The intended Audience of the service principal with which the on-premise management/data plane components would communicate with our Azure services.", + SerializedName = @"audience", + PossibleTypes = new [] { typeof(string) })] + string AuthenticationIdentityInputAudience { get; set; } + /// + /// The object Id of the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The object Id of the service principal with which the on-premise management/data plane components would communicate with our Azure services.", + SerializedName = @"objectId", + PossibleTypes = new [] { typeof(string) })] + string AuthenticationIdentityInputObjectId { get; set; } + /// + /// The tenant Id for the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The tenant Id for the service principal with which the on-premise management/data plane components would communicate with our Azure services.", + SerializedName = @"tenantId", + PossibleTypes = new [] { typeof(string) })] + string AuthenticationIdentityInputTenantId { get; set; } + /// The Bios Id of the machine. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Bios Id of the machine.", + SerializedName = @"biosId", + PossibleTypes = new [] { typeof(string) })] + string BiosId { get; set; } + /// The base authority for Azure Active Directory authentication. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The base authority for Azure Active Directory authentication.", + SerializedName = @"aadAuthority", + PossibleTypes = new [] { typeof(string) })] + string DataPlaneAuthenticationIdentityInputAadAuthority { get; set; } + /// + /// The application/client Id for the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The application/client Id for the service principal with which the on-premise management/data plane components would communicate with our Azure services.", + SerializedName = @"applicationId", + PossibleTypes = new [] { typeof(string) })] + string DataPlaneAuthenticationIdentityInputApplicationId { get; set; } + /// + /// The intended Audience of the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The intended Audience of the service principal with which the on-premise management/data plane components would communicate with our Azure services.", + SerializedName = @"audience", + PossibleTypes = new [] { typeof(string) })] + string DataPlaneAuthenticationIdentityInputAudience { get; set; } + /// + /// The object Id of the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The object Id of the service principal with which the on-premise management/data plane components would communicate with our Azure services.", + SerializedName = @"objectId", + PossibleTypes = new [] { typeof(string) })] + string DataPlaneAuthenticationIdentityInputObjectId { get; set; } + /// + /// The tenant Id for the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The tenant Id for the service principal with which the on-premise management/data plane components would communicate with our Azure services.", + SerializedName = @"tenantId", + PossibleTypes = new [] { typeof(string) })] + string DataPlaneAuthenticationIdentityInputTenantId { get; set; } + /// The Id of the machine where the provider is getting added. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Id of the machine where the provider is getting added.", + SerializedName = @"machineId", + PossibleTypes = new [] { typeof(string) })] + string MachineId { get; set; } + /// The name of the machine where the provider is getting added. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the machine where the provider is getting added.", + SerializedName = @"machineName", + PossibleTypes = new [] { typeof(string) })] + string MachineName { get; set; } + /// The base authority for Azure Active Directory authentication. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The base authority for Azure Active Directory authentication.", + SerializedName = @"aadAuthority", + PossibleTypes = new [] { typeof(string) })] + string ResourceAccessIdentityInputAadAuthority { get; set; } + /// + /// The application/client Id for the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The application/client Id for the service principal with which the on-premise management/data plane components would communicate with our Azure services.", + SerializedName = @"applicationId", + PossibleTypes = new [] { typeof(string) })] + string ResourceAccessIdentityInputApplicationId { get; set; } + /// + /// The intended Audience of the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The intended Audience of the service principal with which the on-premise management/data plane components would communicate with our Azure services.", + SerializedName = @"audience", + PossibleTypes = new [] { typeof(string) })] + string ResourceAccessIdentityInputAudience { get; set; } + /// + /// The object Id of the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The object Id of the service principal with which the on-premise management/data plane components would communicate with our Azure services.", + SerializedName = @"objectId", + PossibleTypes = new [] { typeof(string) })] + string ResourceAccessIdentityInputObjectId { get; set; } + /// + /// The tenant Id for the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The tenant Id for the service principal with which the on-premise management/data plane components would communicate with our Azure services.", + SerializedName = @"tenantId", + PossibleTypes = new [] { typeof(string) })] + string ResourceAccessIdentityInputTenantId { get; set; } + + } + /// Input required to add a provider. + internal partial interface IAddRecoveryServicesProviderInputInternal + + { + /// The identity provider input for DRA authentication. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInput AuthenticationIdentityInput { get; set; } + /// The base authority for Azure Active Directory authentication. + string AuthenticationIdentityInputAadAuthority { get; set; } + /// + /// The application/client Id for the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + string AuthenticationIdentityInputApplicationId { get; set; } + /// + /// The intended Audience of the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + string AuthenticationIdentityInputAudience { get; set; } + /// + /// The object Id of the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + string AuthenticationIdentityInputObjectId { get; set; } + /// + /// The tenant Id for the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + string AuthenticationIdentityInputTenantId { get; set; } + /// The Bios Id of the machine. + string BiosId { get; set; } + /// The identity provider input for data plane authentication. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInput DataPlaneAuthenticationIdentityInput { get; set; } + /// The base authority for Azure Active Directory authentication. + string DataPlaneAuthenticationIdentityInputAadAuthority { get; set; } + /// + /// The application/client Id for the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + string DataPlaneAuthenticationIdentityInputApplicationId { get; set; } + /// + /// The intended Audience of the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + string DataPlaneAuthenticationIdentityInputAudience { get; set; } + /// + /// The object Id of the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + string DataPlaneAuthenticationIdentityInputObjectId { get; set; } + /// + /// The tenant Id for the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + string DataPlaneAuthenticationIdentityInputTenantId { get; set; } + /// The Id of the machine where the provider is getting added. + string MachineId { get; set; } + /// The name of the machine where the provider is getting added. + string MachineName { get; set; } + /// The properties of an add provider request. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputProperties Property { get; set; } + /// The identity provider input for resource access. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInput ResourceAccessIdentityInput { get; set; } + /// The base authority for Azure Active Directory authentication. + string ResourceAccessIdentityInputAadAuthority { get; set; } + /// + /// The application/client Id for the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + string ResourceAccessIdentityInputApplicationId { get; set; } + /// + /// The intended Audience of the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + string ResourceAccessIdentityInputAudience { get; set; } + /// + /// The object Id of the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + string ResourceAccessIdentityInputObjectId { get; set; } + /// + /// The tenant Id for the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + string ResourceAccessIdentityInputTenantId { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AddRecoveryServicesProviderInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AddRecoveryServicesProviderInput.json.cs new file mode 100644 index 000000000000..904f138bc152 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AddRecoveryServicesProviderInput.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Input required to add a provider. + public partial class AddRecoveryServicesProviderInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal AddRecoveryServicesProviderInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AddRecoveryServicesProviderInputProperties.FromJson(__jsonProperties) : Property;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new AddRecoveryServicesProviderInput(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AddRecoveryServicesProviderInputProperties.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AddRecoveryServicesProviderInputProperties.PowerShell.cs new file mode 100644 index 000000000000..6de18a5090f0 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AddRecoveryServicesProviderInputProperties.PowerShell.cs @@ -0,0 +1,309 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// The properties of an add provider request. + [System.ComponentModel.TypeConverter(typeof(AddRecoveryServicesProviderInputPropertiesTypeConverter))] + public partial class AddRecoveryServicesProviderInputProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal AddRecoveryServicesProviderInputProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("AuthenticationIdentityInput")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)this).AuthenticationIdentityInput = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInput) content.GetValueForProperty("AuthenticationIdentityInput",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)this).AuthenticationIdentityInput, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IdentityProviderInputTypeConverter.ConvertFrom); + } + if (content.Contains("ResourceAccessIdentityInput")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)this).ResourceAccessIdentityInput = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInput) content.GetValueForProperty("ResourceAccessIdentityInput",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)this).ResourceAccessIdentityInput, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IdentityProviderInputTypeConverter.ConvertFrom); + } + if (content.Contains("DataPlaneAuthenticationIdentityInput")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)this).DataPlaneAuthenticationIdentityInput = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInput) content.GetValueForProperty("DataPlaneAuthenticationIdentityInput",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)this).DataPlaneAuthenticationIdentityInput, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IdentityProviderInputTypeConverter.ConvertFrom); + } + if (content.Contains("MachineName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)this).MachineName = (string) content.GetValueForProperty("MachineName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)this).MachineName, global::System.Convert.ToString); + } + if (content.Contains("MachineId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)this).MachineId = (string) content.GetValueForProperty("MachineId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)this).MachineId, global::System.Convert.ToString); + } + if (content.Contains("BiosId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)this).BiosId = (string) content.GetValueForProperty("BiosId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)this).BiosId, global::System.Convert.ToString); + } + if (content.Contains("AuthenticationIdentityInputTenantId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)this).AuthenticationIdentityInputTenantId = (string) content.GetValueForProperty("AuthenticationIdentityInputTenantId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)this).AuthenticationIdentityInputTenantId, global::System.Convert.ToString); + } + if (content.Contains("AuthenticationIdentityInputApplicationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)this).AuthenticationIdentityInputApplicationId = (string) content.GetValueForProperty("AuthenticationIdentityInputApplicationId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)this).AuthenticationIdentityInputApplicationId, global::System.Convert.ToString); + } + if (content.Contains("AuthenticationIdentityInputObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)this).AuthenticationIdentityInputObjectId = (string) content.GetValueForProperty("AuthenticationIdentityInputObjectId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)this).AuthenticationIdentityInputObjectId, global::System.Convert.ToString); + } + if (content.Contains("AuthenticationIdentityInputAudience")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)this).AuthenticationIdentityInputAudience = (string) content.GetValueForProperty("AuthenticationIdentityInputAudience",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)this).AuthenticationIdentityInputAudience, global::System.Convert.ToString); + } + if (content.Contains("AuthenticationIdentityInputAadAuthority")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)this).AuthenticationIdentityInputAadAuthority = (string) content.GetValueForProperty("AuthenticationIdentityInputAadAuthority",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)this).AuthenticationIdentityInputAadAuthority, global::System.Convert.ToString); + } + if (content.Contains("ResourceAccessIdentityInputTenantId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)this).ResourceAccessIdentityInputTenantId = (string) content.GetValueForProperty("ResourceAccessIdentityInputTenantId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)this).ResourceAccessIdentityInputTenantId, global::System.Convert.ToString); + } + if (content.Contains("ResourceAccessIdentityInputApplicationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)this).ResourceAccessIdentityInputApplicationId = (string) content.GetValueForProperty("ResourceAccessIdentityInputApplicationId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)this).ResourceAccessIdentityInputApplicationId, global::System.Convert.ToString); + } + if (content.Contains("ResourceAccessIdentityInputObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)this).ResourceAccessIdentityInputObjectId = (string) content.GetValueForProperty("ResourceAccessIdentityInputObjectId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)this).ResourceAccessIdentityInputObjectId, global::System.Convert.ToString); + } + if (content.Contains("ResourceAccessIdentityInputAudience")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)this).ResourceAccessIdentityInputAudience = (string) content.GetValueForProperty("ResourceAccessIdentityInputAudience",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)this).ResourceAccessIdentityInputAudience, global::System.Convert.ToString); + } + if (content.Contains("ResourceAccessIdentityInputAadAuthority")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)this).ResourceAccessIdentityInputAadAuthority = (string) content.GetValueForProperty("ResourceAccessIdentityInputAadAuthority",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)this).ResourceAccessIdentityInputAadAuthority, global::System.Convert.ToString); + } + if (content.Contains("DataPlaneAuthenticationIdentityInputTenantId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)this).DataPlaneAuthenticationIdentityInputTenantId = (string) content.GetValueForProperty("DataPlaneAuthenticationIdentityInputTenantId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)this).DataPlaneAuthenticationIdentityInputTenantId, global::System.Convert.ToString); + } + if (content.Contains("DataPlaneAuthenticationIdentityInputApplicationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)this).DataPlaneAuthenticationIdentityInputApplicationId = (string) content.GetValueForProperty("DataPlaneAuthenticationIdentityInputApplicationId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)this).DataPlaneAuthenticationIdentityInputApplicationId, global::System.Convert.ToString); + } + if (content.Contains("DataPlaneAuthenticationIdentityInputObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)this).DataPlaneAuthenticationIdentityInputObjectId = (string) content.GetValueForProperty("DataPlaneAuthenticationIdentityInputObjectId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)this).DataPlaneAuthenticationIdentityInputObjectId, global::System.Convert.ToString); + } + if (content.Contains("DataPlaneAuthenticationIdentityInputAudience")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)this).DataPlaneAuthenticationIdentityInputAudience = (string) content.GetValueForProperty("DataPlaneAuthenticationIdentityInputAudience",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)this).DataPlaneAuthenticationIdentityInputAudience, global::System.Convert.ToString); + } + if (content.Contains("DataPlaneAuthenticationIdentityInputAadAuthority")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)this).DataPlaneAuthenticationIdentityInputAadAuthority = (string) content.GetValueForProperty("DataPlaneAuthenticationIdentityInputAadAuthority",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)this).DataPlaneAuthenticationIdentityInputAadAuthority, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal AddRecoveryServicesProviderInputProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("AuthenticationIdentityInput")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)this).AuthenticationIdentityInput = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInput) content.GetValueForProperty("AuthenticationIdentityInput",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)this).AuthenticationIdentityInput, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IdentityProviderInputTypeConverter.ConvertFrom); + } + if (content.Contains("ResourceAccessIdentityInput")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)this).ResourceAccessIdentityInput = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInput) content.GetValueForProperty("ResourceAccessIdentityInput",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)this).ResourceAccessIdentityInput, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IdentityProviderInputTypeConverter.ConvertFrom); + } + if (content.Contains("DataPlaneAuthenticationIdentityInput")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)this).DataPlaneAuthenticationIdentityInput = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInput) content.GetValueForProperty("DataPlaneAuthenticationIdentityInput",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)this).DataPlaneAuthenticationIdentityInput, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IdentityProviderInputTypeConverter.ConvertFrom); + } + if (content.Contains("MachineName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)this).MachineName = (string) content.GetValueForProperty("MachineName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)this).MachineName, global::System.Convert.ToString); + } + if (content.Contains("MachineId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)this).MachineId = (string) content.GetValueForProperty("MachineId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)this).MachineId, global::System.Convert.ToString); + } + if (content.Contains("BiosId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)this).BiosId = (string) content.GetValueForProperty("BiosId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)this).BiosId, global::System.Convert.ToString); + } + if (content.Contains("AuthenticationIdentityInputTenantId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)this).AuthenticationIdentityInputTenantId = (string) content.GetValueForProperty("AuthenticationIdentityInputTenantId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)this).AuthenticationIdentityInputTenantId, global::System.Convert.ToString); + } + if (content.Contains("AuthenticationIdentityInputApplicationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)this).AuthenticationIdentityInputApplicationId = (string) content.GetValueForProperty("AuthenticationIdentityInputApplicationId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)this).AuthenticationIdentityInputApplicationId, global::System.Convert.ToString); + } + if (content.Contains("AuthenticationIdentityInputObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)this).AuthenticationIdentityInputObjectId = (string) content.GetValueForProperty("AuthenticationIdentityInputObjectId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)this).AuthenticationIdentityInputObjectId, global::System.Convert.ToString); + } + if (content.Contains("AuthenticationIdentityInputAudience")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)this).AuthenticationIdentityInputAudience = (string) content.GetValueForProperty("AuthenticationIdentityInputAudience",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)this).AuthenticationIdentityInputAudience, global::System.Convert.ToString); + } + if (content.Contains("AuthenticationIdentityInputAadAuthority")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)this).AuthenticationIdentityInputAadAuthority = (string) content.GetValueForProperty("AuthenticationIdentityInputAadAuthority",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)this).AuthenticationIdentityInputAadAuthority, global::System.Convert.ToString); + } + if (content.Contains("ResourceAccessIdentityInputTenantId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)this).ResourceAccessIdentityInputTenantId = (string) content.GetValueForProperty("ResourceAccessIdentityInputTenantId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)this).ResourceAccessIdentityInputTenantId, global::System.Convert.ToString); + } + if (content.Contains("ResourceAccessIdentityInputApplicationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)this).ResourceAccessIdentityInputApplicationId = (string) content.GetValueForProperty("ResourceAccessIdentityInputApplicationId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)this).ResourceAccessIdentityInputApplicationId, global::System.Convert.ToString); + } + if (content.Contains("ResourceAccessIdentityInputObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)this).ResourceAccessIdentityInputObjectId = (string) content.GetValueForProperty("ResourceAccessIdentityInputObjectId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)this).ResourceAccessIdentityInputObjectId, global::System.Convert.ToString); + } + if (content.Contains("ResourceAccessIdentityInputAudience")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)this).ResourceAccessIdentityInputAudience = (string) content.GetValueForProperty("ResourceAccessIdentityInputAudience",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)this).ResourceAccessIdentityInputAudience, global::System.Convert.ToString); + } + if (content.Contains("ResourceAccessIdentityInputAadAuthority")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)this).ResourceAccessIdentityInputAadAuthority = (string) content.GetValueForProperty("ResourceAccessIdentityInputAadAuthority",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)this).ResourceAccessIdentityInputAadAuthority, global::System.Convert.ToString); + } + if (content.Contains("DataPlaneAuthenticationIdentityInputTenantId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)this).DataPlaneAuthenticationIdentityInputTenantId = (string) content.GetValueForProperty("DataPlaneAuthenticationIdentityInputTenantId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)this).DataPlaneAuthenticationIdentityInputTenantId, global::System.Convert.ToString); + } + if (content.Contains("DataPlaneAuthenticationIdentityInputApplicationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)this).DataPlaneAuthenticationIdentityInputApplicationId = (string) content.GetValueForProperty("DataPlaneAuthenticationIdentityInputApplicationId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)this).DataPlaneAuthenticationIdentityInputApplicationId, global::System.Convert.ToString); + } + if (content.Contains("DataPlaneAuthenticationIdentityInputObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)this).DataPlaneAuthenticationIdentityInputObjectId = (string) content.GetValueForProperty("DataPlaneAuthenticationIdentityInputObjectId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)this).DataPlaneAuthenticationIdentityInputObjectId, global::System.Convert.ToString); + } + if (content.Contains("DataPlaneAuthenticationIdentityInputAudience")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)this).DataPlaneAuthenticationIdentityInputAudience = (string) content.GetValueForProperty("DataPlaneAuthenticationIdentityInputAudience",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)this).DataPlaneAuthenticationIdentityInputAudience, global::System.Convert.ToString); + } + if (content.Contains("DataPlaneAuthenticationIdentityInputAadAuthority")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)this).DataPlaneAuthenticationIdentityInputAadAuthority = (string) content.GetValueForProperty("DataPlaneAuthenticationIdentityInputAadAuthority",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal)this).DataPlaneAuthenticationIdentityInputAadAuthority, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new AddRecoveryServicesProviderInputProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new AddRecoveryServicesProviderInputProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a + /// json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// The properties of an add provider request. + [System.ComponentModel.TypeConverter(typeof(AddRecoveryServicesProviderInputPropertiesTypeConverter))] + public partial interface IAddRecoveryServicesProviderInputProperties + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AddRecoveryServicesProviderInputProperties.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AddRecoveryServicesProviderInputProperties.TypeConverter.cs new file mode 100644 index 000000000000..cefa3762291b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AddRecoveryServicesProviderInputProperties.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class AddRecoveryServicesProviderInputPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return AddRecoveryServicesProviderInputProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return AddRecoveryServicesProviderInputProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return AddRecoveryServicesProviderInputProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AddRecoveryServicesProviderInputProperties.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AddRecoveryServicesProviderInputProperties.cs new file mode 100644 index 000000000000..8faba9e47677 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AddRecoveryServicesProviderInputProperties.cs @@ -0,0 +1,441 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The properties of an add provider request. + public partial class AddRecoveryServicesProviderInputProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputProperties, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInput _authenticationIdentityInput; + + /// The identity provider input for DRA authentication. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInput AuthenticationIdentityInput { get => (this._authenticationIdentityInput = this._authenticationIdentityInput ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IdentityProviderInput()); set => this._authenticationIdentityInput = value; } + + /// The base authority for Azure Active Directory authentication. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string AuthenticationIdentityInputAadAuthority { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInputInternal)AuthenticationIdentityInput).AadAuthority; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInputInternal)AuthenticationIdentityInput).AadAuthority = value ; } + + /// + /// The application/client Id for the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string AuthenticationIdentityInputApplicationId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInputInternal)AuthenticationIdentityInput).ApplicationId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInputInternal)AuthenticationIdentityInput).ApplicationId = value ; } + + /// + /// The intended Audience of the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string AuthenticationIdentityInputAudience { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInputInternal)AuthenticationIdentityInput).Audience; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInputInternal)AuthenticationIdentityInput).Audience = value ; } + + /// + /// The object Id of the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string AuthenticationIdentityInputObjectId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInputInternal)AuthenticationIdentityInput).ObjectId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInputInternal)AuthenticationIdentityInput).ObjectId = value ; } + + /// + /// The tenant Id for the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string AuthenticationIdentityInputTenantId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInputInternal)AuthenticationIdentityInput).TenantId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInputInternal)AuthenticationIdentityInput).TenantId = value ; } + + /// Backing field for property. + private string _biosId; + + /// The Bios Id of the machine. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string BiosId { get => this._biosId; set => this._biosId = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInput _dataPlaneAuthenticationIdentityInput; + + /// The identity provider input for data plane authentication. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInput DataPlaneAuthenticationIdentityInput { get => (this._dataPlaneAuthenticationIdentityInput = this._dataPlaneAuthenticationIdentityInput ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IdentityProviderInput()); set => this._dataPlaneAuthenticationIdentityInput = value; } + + /// The base authority for Azure Active Directory authentication. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string DataPlaneAuthenticationIdentityInputAadAuthority { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInputInternal)DataPlaneAuthenticationIdentityInput).AadAuthority; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInputInternal)DataPlaneAuthenticationIdentityInput).AadAuthority = value ?? null; } + + /// + /// The application/client Id for the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string DataPlaneAuthenticationIdentityInputApplicationId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInputInternal)DataPlaneAuthenticationIdentityInput).ApplicationId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInputInternal)DataPlaneAuthenticationIdentityInput).ApplicationId = value ?? null; } + + /// + /// The intended Audience of the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string DataPlaneAuthenticationIdentityInputAudience { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInputInternal)DataPlaneAuthenticationIdentityInput).Audience; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInputInternal)DataPlaneAuthenticationIdentityInput).Audience = value ?? null; } + + /// + /// The object Id of the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string DataPlaneAuthenticationIdentityInputObjectId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInputInternal)DataPlaneAuthenticationIdentityInput).ObjectId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInputInternal)DataPlaneAuthenticationIdentityInput).ObjectId = value ?? null; } + + /// + /// The tenant Id for the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string DataPlaneAuthenticationIdentityInputTenantId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInputInternal)DataPlaneAuthenticationIdentityInput).TenantId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInputInternal)DataPlaneAuthenticationIdentityInput).TenantId = value ?? null; } + + /// Backing field for property. + private string _machineId; + + /// The Id of the machine where the provider is getting added. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string MachineId { get => this._machineId; set => this._machineId = value; } + + /// Backing field for property. + private string _machineName; + + /// The name of the machine where the provider is getting added. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string MachineName { get => this._machineName; set => this._machineName = value; } + + /// Internal Acessors for AuthenticationIdentityInput + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInput Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal.AuthenticationIdentityInput { get => (this._authenticationIdentityInput = this._authenticationIdentityInput ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IdentityProviderInput()); set { {_authenticationIdentityInput = value;} } } + + /// Internal Acessors for DataPlaneAuthenticationIdentityInput + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInput Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal.DataPlaneAuthenticationIdentityInput { get => (this._dataPlaneAuthenticationIdentityInput = this._dataPlaneAuthenticationIdentityInput ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IdentityProviderInput()); set { {_dataPlaneAuthenticationIdentityInput = value;} } } + + /// Internal Acessors for ResourceAccessIdentityInput + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInput Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputPropertiesInternal.ResourceAccessIdentityInput { get => (this._resourceAccessIdentityInput = this._resourceAccessIdentityInput ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IdentityProviderInput()); set { {_resourceAccessIdentityInput = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInput _resourceAccessIdentityInput; + + /// The identity provider input for resource access. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInput ResourceAccessIdentityInput { get => (this._resourceAccessIdentityInput = this._resourceAccessIdentityInput ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IdentityProviderInput()); set => this._resourceAccessIdentityInput = value; } + + /// The base authority for Azure Active Directory authentication. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ResourceAccessIdentityInputAadAuthority { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInputInternal)ResourceAccessIdentityInput).AadAuthority; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInputInternal)ResourceAccessIdentityInput).AadAuthority = value ; } + + /// + /// The application/client Id for the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ResourceAccessIdentityInputApplicationId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInputInternal)ResourceAccessIdentityInput).ApplicationId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInputInternal)ResourceAccessIdentityInput).ApplicationId = value ; } + + /// + /// The intended Audience of the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ResourceAccessIdentityInputAudience { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInputInternal)ResourceAccessIdentityInput).Audience; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInputInternal)ResourceAccessIdentityInput).Audience = value ; } + + /// + /// The object Id of the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ResourceAccessIdentityInputObjectId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInputInternal)ResourceAccessIdentityInput).ObjectId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInputInternal)ResourceAccessIdentityInput).ObjectId = value ; } + + /// + /// The tenant Id for the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ResourceAccessIdentityInputTenantId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInputInternal)ResourceAccessIdentityInput).TenantId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInputInternal)ResourceAccessIdentityInput).TenantId = value ; } + + /// + /// Creates an new instance. + /// + public AddRecoveryServicesProviderInputProperties() + { + + } + } + /// The properties of an add provider request. + public partial interface IAddRecoveryServicesProviderInputProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The base authority for Azure Active Directory authentication. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The base authority for Azure Active Directory authentication.", + SerializedName = @"aadAuthority", + PossibleTypes = new [] { typeof(string) })] + string AuthenticationIdentityInputAadAuthority { get; set; } + /// + /// The application/client Id for the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The application/client Id for the service principal with which the on-premise management/data plane components would communicate with our Azure services.", + SerializedName = @"applicationId", + PossibleTypes = new [] { typeof(string) })] + string AuthenticationIdentityInputApplicationId { get; set; } + /// + /// The intended Audience of the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The intended Audience of the service principal with which the on-premise management/data plane components would communicate with our Azure services.", + SerializedName = @"audience", + PossibleTypes = new [] { typeof(string) })] + string AuthenticationIdentityInputAudience { get; set; } + /// + /// The object Id of the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The object Id of the service principal with which the on-premise management/data plane components would communicate with our Azure services.", + SerializedName = @"objectId", + PossibleTypes = new [] { typeof(string) })] + string AuthenticationIdentityInputObjectId { get; set; } + /// + /// The tenant Id for the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The tenant Id for the service principal with which the on-premise management/data plane components would communicate with our Azure services.", + SerializedName = @"tenantId", + PossibleTypes = new [] { typeof(string) })] + string AuthenticationIdentityInputTenantId { get; set; } + /// The Bios Id of the machine. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Bios Id of the machine.", + SerializedName = @"biosId", + PossibleTypes = new [] { typeof(string) })] + string BiosId { get; set; } + /// The base authority for Azure Active Directory authentication. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The base authority for Azure Active Directory authentication.", + SerializedName = @"aadAuthority", + PossibleTypes = new [] { typeof(string) })] + string DataPlaneAuthenticationIdentityInputAadAuthority { get; set; } + /// + /// The application/client Id for the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The application/client Id for the service principal with which the on-premise management/data plane components would communicate with our Azure services.", + SerializedName = @"applicationId", + PossibleTypes = new [] { typeof(string) })] + string DataPlaneAuthenticationIdentityInputApplicationId { get; set; } + /// + /// The intended Audience of the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The intended Audience of the service principal with which the on-premise management/data plane components would communicate with our Azure services.", + SerializedName = @"audience", + PossibleTypes = new [] { typeof(string) })] + string DataPlaneAuthenticationIdentityInputAudience { get; set; } + /// + /// The object Id of the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The object Id of the service principal with which the on-premise management/data plane components would communicate with our Azure services.", + SerializedName = @"objectId", + PossibleTypes = new [] { typeof(string) })] + string DataPlaneAuthenticationIdentityInputObjectId { get; set; } + /// + /// The tenant Id for the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The tenant Id for the service principal with which the on-premise management/data plane components would communicate with our Azure services.", + SerializedName = @"tenantId", + PossibleTypes = new [] { typeof(string) })] + string DataPlaneAuthenticationIdentityInputTenantId { get; set; } + /// The Id of the machine where the provider is getting added. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Id of the machine where the provider is getting added.", + SerializedName = @"machineId", + PossibleTypes = new [] { typeof(string) })] + string MachineId { get; set; } + /// The name of the machine where the provider is getting added. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the machine where the provider is getting added.", + SerializedName = @"machineName", + PossibleTypes = new [] { typeof(string) })] + string MachineName { get; set; } + /// The base authority for Azure Active Directory authentication. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The base authority for Azure Active Directory authentication.", + SerializedName = @"aadAuthority", + PossibleTypes = new [] { typeof(string) })] + string ResourceAccessIdentityInputAadAuthority { get; set; } + /// + /// The application/client Id for the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The application/client Id for the service principal with which the on-premise management/data plane components would communicate with our Azure services.", + SerializedName = @"applicationId", + PossibleTypes = new [] { typeof(string) })] + string ResourceAccessIdentityInputApplicationId { get; set; } + /// + /// The intended Audience of the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The intended Audience of the service principal with which the on-premise management/data plane components would communicate with our Azure services.", + SerializedName = @"audience", + PossibleTypes = new [] { typeof(string) })] + string ResourceAccessIdentityInputAudience { get; set; } + /// + /// The object Id of the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The object Id of the service principal with which the on-premise management/data plane components would communicate with our Azure services.", + SerializedName = @"objectId", + PossibleTypes = new [] { typeof(string) })] + string ResourceAccessIdentityInputObjectId { get; set; } + /// + /// The tenant Id for the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The tenant Id for the service principal with which the on-premise management/data plane components would communicate with our Azure services.", + SerializedName = @"tenantId", + PossibleTypes = new [] { typeof(string) })] + string ResourceAccessIdentityInputTenantId { get; set; } + + } + /// The properties of an add provider request. + internal partial interface IAddRecoveryServicesProviderInputPropertiesInternal + + { + /// The identity provider input for DRA authentication. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInput AuthenticationIdentityInput { get; set; } + /// The base authority for Azure Active Directory authentication. + string AuthenticationIdentityInputAadAuthority { get; set; } + /// + /// The application/client Id for the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + string AuthenticationIdentityInputApplicationId { get; set; } + /// + /// The intended Audience of the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + string AuthenticationIdentityInputAudience { get; set; } + /// + /// The object Id of the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + string AuthenticationIdentityInputObjectId { get; set; } + /// + /// The tenant Id for the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + string AuthenticationIdentityInputTenantId { get; set; } + /// The Bios Id of the machine. + string BiosId { get; set; } + /// The identity provider input for data plane authentication. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInput DataPlaneAuthenticationIdentityInput { get; set; } + /// The base authority for Azure Active Directory authentication. + string DataPlaneAuthenticationIdentityInputAadAuthority { get; set; } + /// + /// The application/client Id for the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + string DataPlaneAuthenticationIdentityInputApplicationId { get; set; } + /// + /// The intended Audience of the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + string DataPlaneAuthenticationIdentityInputAudience { get; set; } + /// + /// The object Id of the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + string DataPlaneAuthenticationIdentityInputObjectId { get; set; } + /// + /// The tenant Id for the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + string DataPlaneAuthenticationIdentityInputTenantId { get; set; } + /// The Id of the machine where the provider is getting added. + string MachineId { get; set; } + /// The name of the machine where the provider is getting added. + string MachineName { get; set; } + /// The identity provider input for resource access. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInput ResourceAccessIdentityInput { get; set; } + /// The base authority for Azure Active Directory authentication. + string ResourceAccessIdentityInputAadAuthority { get; set; } + /// + /// The application/client Id for the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + string ResourceAccessIdentityInputApplicationId { get; set; } + /// + /// The intended Audience of the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + string ResourceAccessIdentityInputAudience { get; set; } + /// + /// The object Id of the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + string ResourceAccessIdentityInputObjectId { get; set; } + /// + /// The tenant Id for the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + string ResourceAccessIdentityInputTenantId { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AddRecoveryServicesProviderInputProperties.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AddRecoveryServicesProviderInputProperties.json.cs new file mode 100644 index 000000000000..762db8428820 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AddRecoveryServicesProviderInputProperties.json.cs @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The properties of an add provider request. + public partial class AddRecoveryServicesProviderInputProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal AddRecoveryServicesProviderInputProperties(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_authenticationIdentityInput = If( json?.PropertyT("authenticationIdentityInput"), out var __jsonAuthenticationIdentityInput) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IdentityProviderInput.FromJson(__jsonAuthenticationIdentityInput) : AuthenticationIdentityInput;} + {_resourceAccessIdentityInput = If( json?.PropertyT("resourceAccessIdentityInput"), out var __jsonResourceAccessIdentityInput) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IdentityProviderInput.FromJson(__jsonResourceAccessIdentityInput) : ResourceAccessIdentityInput;} + {_dataPlaneAuthenticationIdentityInput = If( json?.PropertyT("dataPlaneAuthenticationIdentityInput"), out var __jsonDataPlaneAuthenticationIdentityInput) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IdentityProviderInput.FromJson(__jsonDataPlaneAuthenticationIdentityInput) : DataPlaneAuthenticationIdentityInput;} + {_machineName = If( json?.PropertyT("machineName"), out var __jsonMachineName) ? (string)__jsonMachineName : (string)MachineName;} + {_machineId = If( json?.PropertyT("machineId"), out var __jsonMachineId) ? (string)__jsonMachineId : (string)MachineId;} + {_biosId = If( json?.PropertyT("biosId"), out var __jsonBiosId) ? (string)__jsonBiosId : (string)BiosId;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInputProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new AddRecoveryServicesProviderInputProperties(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._authenticationIdentityInput ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._authenticationIdentityInput.ToJson(null,serializationMode) : null, "authenticationIdentityInput" ,container.Add ); + AddIf( null != this._resourceAccessIdentityInput ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._resourceAccessIdentityInput.ToJson(null,serializationMode) : null, "resourceAccessIdentityInput" ,container.Add ); + AddIf( null != this._dataPlaneAuthenticationIdentityInput ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._dataPlaneAuthenticationIdentityInput.ToJson(null,serializationMode) : null, "dataPlaneAuthenticationIdentityInput" ,container.Add ); + AddIf( null != (((object)this._machineName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._machineName.ToString()) : null, "machineName" ,container.Add ); + AddIf( null != (((object)this._machineId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._machineId.ToString()) : null, "machineId" ,container.Add ); + AddIf( null != (((object)this._biosId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._biosId.ToString()) : null, "biosId" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AddVCenterRequest.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AddVCenterRequest.PowerShell.cs new file mode 100644 index 000000000000..e2cf3ba1b7b8 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AddVCenterRequest.PowerShell.cs @@ -0,0 +1,184 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Input required to add vCenter. + [System.ComponentModel.TypeConverter(typeof(AddVCenterRequestTypeConverter))] + public partial class AddVCenterRequest + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal AddVCenterRequest(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddVCenterRequestInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddVCenterRequestProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddVCenterRequestInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AddVCenterRequestPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("FriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddVCenterRequestInternal)this).FriendlyName = (string) content.GetValueForProperty("FriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddVCenterRequestInternal)this).FriendlyName, global::System.Convert.ToString); + } + if (content.Contains("IPAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddVCenterRequestInternal)this).IPAddress = (string) content.GetValueForProperty("IPAddress",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddVCenterRequestInternal)this).IPAddress, global::System.Convert.ToString); + } + if (content.Contains("ProcessServerId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddVCenterRequestInternal)this).ProcessServerId = (string) content.GetValueForProperty("ProcessServerId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddVCenterRequestInternal)this).ProcessServerId, global::System.Convert.ToString); + } + if (content.Contains("Port")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddVCenterRequestInternal)this).Port = (string) content.GetValueForProperty("Port",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddVCenterRequestInternal)this).Port, global::System.Convert.ToString); + } + if (content.Contains("RunAsAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddVCenterRequestInternal)this).RunAsAccountId = (string) content.GetValueForProperty("RunAsAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddVCenterRequestInternal)this).RunAsAccountId, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal AddVCenterRequest(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddVCenterRequestInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddVCenterRequestProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddVCenterRequestInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AddVCenterRequestPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("FriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddVCenterRequestInternal)this).FriendlyName = (string) content.GetValueForProperty("FriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddVCenterRequestInternal)this).FriendlyName, global::System.Convert.ToString); + } + if (content.Contains("IPAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddVCenterRequestInternal)this).IPAddress = (string) content.GetValueForProperty("IPAddress",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddVCenterRequestInternal)this).IPAddress, global::System.Convert.ToString); + } + if (content.Contains("ProcessServerId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddVCenterRequestInternal)this).ProcessServerId = (string) content.GetValueForProperty("ProcessServerId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddVCenterRequestInternal)this).ProcessServerId, global::System.Convert.ToString); + } + if (content.Contains("Port")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddVCenterRequestInternal)this).Port = (string) content.GetValueForProperty("Port",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddVCenterRequestInternal)this).Port, global::System.Convert.ToString); + } + if (content.Contains("RunAsAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddVCenterRequestInternal)this).RunAsAccountId = (string) content.GetValueForProperty("RunAsAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddVCenterRequestInternal)this).RunAsAccountId, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddVCenterRequest DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new AddVCenterRequest(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddVCenterRequest DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new AddVCenterRequest(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddVCenterRequest FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Input required to add vCenter. + [System.ComponentModel.TypeConverter(typeof(AddVCenterRequestTypeConverter))] + public partial interface IAddVCenterRequest + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AddVCenterRequest.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AddVCenterRequest.TypeConverter.cs new file mode 100644 index 000000000000..aaf295531774 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AddVCenterRequest.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class AddVCenterRequestTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddVCenterRequest ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddVCenterRequest).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return AddVCenterRequest.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return AddVCenterRequest.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return AddVCenterRequest.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AddVCenterRequest.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AddVCenterRequest.cs new file mode 100644 index 000000000000..a1572d49f560 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AddVCenterRequest.cs @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Input required to add vCenter. + public partial class AddVCenterRequest : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddVCenterRequest, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddVCenterRequestInternal + { + + /// The friendly name of the vCenter. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string FriendlyName { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddVCenterRequestPropertiesInternal)Property).FriendlyName; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddVCenterRequestPropertiesInternal)Property).FriendlyName = value ?? null; } + + /// The IP address of the vCenter to be discovered. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string IPAddress { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddVCenterRequestPropertiesInternal)Property).IPAddress; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddVCenterRequestPropertiesInternal)Property).IPAddress = value ?? null; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddVCenterRequestProperties Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddVCenterRequestInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AddVCenterRequestProperties()); set { {_property = value;} } } + + /// The port number for discovery. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string Port { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddVCenterRequestPropertiesInternal)Property).Port; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddVCenterRequestPropertiesInternal)Property).Port = value ?? null; } + + /// The process server Id from where the discovery is orchestrated. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ProcessServerId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddVCenterRequestPropertiesInternal)Property).ProcessServerId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddVCenterRequestPropertiesInternal)Property).ProcessServerId = value ?? null; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddVCenterRequestProperties _property; + + /// The properties of an add vCenter request. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddVCenterRequestProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AddVCenterRequestProperties()); set => this._property = value; } + + /// The account Id which has privileges to discover the vCenter. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string RunAsAccountId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddVCenterRequestPropertiesInternal)Property).RunAsAccountId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddVCenterRequestPropertiesInternal)Property).RunAsAccountId = value ?? null; } + + /// Creates an new instance. + public AddVCenterRequest() + { + + } + } + /// Input required to add vCenter. + public partial interface IAddVCenterRequest : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The friendly name of the vCenter. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The friendly name of the vCenter.", + SerializedName = @"friendlyName", + PossibleTypes = new [] { typeof(string) })] + string FriendlyName { get; set; } + /// The IP address of the vCenter to be discovered. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The IP address of the vCenter to be discovered.", + SerializedName = @"ipAddress", + PossibleTypes = new [] { typeof(string) })] + string IPAddress { get; set; } + /// The port number for discovery. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The port number for discovery.", + SerializedName = @"port", + PossibleTypes = new [] { typeof(string) })] + string Port { get; set; } + /// The process server Id from where the discovery is orchestrated. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The process server Id from where the discovery is orchestrated.", + SerializedName = @"processServerId", + PossibleTypes = new [] { typeof(string) })] + string ProcessServerId { get; set; } + /// The account Id which has privileges to discover the vCenter. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The account Id which has privileges to discover the vCenter.", + SerializedName = @"runAsAccountId", + PossibleTypes = new [] { typeof(string) })] + string RunAsAccountId { get; set; } + + } + /// Input required to add vCenter. + internal partial interface IAddVCenterRequestInternal + + { + /// The friendly name of the vCenter. + string FriendlyName { get; set; } + /// The IP address of the vCenter to be discovered. + string IPAddress { get; set; } + /// The port number for discovery. + string Port { get; set; } + /// The process server Id from where the discovery is orchestrated. + string ProcessServerId { get; set; } + /// The properties of an add vCenter request. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddVCenterRequestProperties Property { get; set; } + /// The account Id which has privileges to discover the vCenter. + string RunAsAccountId { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AddVCenterRequest.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AddVCenterRequest.json.cs new file mode 100644 index 000000000000..7dfc24e42aa8 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AddVCenterRequest.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Input required to add vCenter. + public partial class AddVCenterRequest + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal AddVCenterRequest(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AddVCenterRequestProperties.FromJson(__jsonProperties) : Property;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddVCenterRequest. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddVCenterRequest. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddVCenterRequest FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new AddVCenterRequest(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AddVCenterRequestProperties.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AddVCenterRequestProperties.PowerShell.cs new file mode 100644 index 000000000000..98ef270894c7 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AddVCenterRequestProperties.PowerShell.cs @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// The properties of an add vCenter request. + [System.ComponentModel.TypeConverter(typeof(AddVCenterRequestPropertiesTypeConverter))] + public partial class AddVCenterRequestProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal AddVCenterRequestProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("FriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddVCenterRequestPropertiesInternal)this).FriendlyName = (string) content.GetValueForProperty("FriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddVCenterRequestPropertiesInternal)this).FriendlyName, global::System.Convert.ToString); + } + if (content.Contains("IPAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddVCenterRequestPropertiesInternal)this).IPAddress = (string) content.GetValueForProperty("IPAddress",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddVCenterRequestPropertiesInternal)this).IPAddress, global::System.Convert.ToString); + } + if (content.Contains("ProcessServerId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddVCenterRequestPropertiesInternal)this).ProcessServerId = (string) content.GetValueForProperty("ProcessServerId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddVCenterRequestPropertiesInternal)this).ProcessServerId, global::System.Convert.ToString); + } + if (content.Contains("Port")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddVCenterRequestPropertiesInternal)this).Port = (string) content.GetValueForProperty("Port",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddVCenterRequestPropertiesInternal)this).Port, global::System.Convert.ToString); + } + if (content.Contains("RunAsAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddVCenterRequestPropertiesInternal)this).RunAsAccountId = (string) content.GetValueForProperty("RunAsAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddVCenterRequestPropertiesInternal)this).RunAsAccountId, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal AddVCenterRequestProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("FriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddVCenterRequestPropertiesInternal)this).FriendlyName = (string) content.GetValueForProperty("FriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddVCenterRequestPropertiesInternal)this).FriendlyName, global::System.Convert.ToString); + } + if (content.Contains("IPAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddVCenterRequestPropertiesInternal)this).IPAddress = (string) content.GetValueForProperty("IPAddress",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddVCenterRequestPropertiesInternal)this).IPAddress, global::System.Convert.ToString); + } + if (content.Contains("ProcessServerId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddVCenterRequestPropertiesInternal)this).ProcessServerId = (string) content.GetValueForProperty("ProcessServerId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddVCenterRequestPropertiesInternal)this).ProcessServerId, global::System.Convert.ToString); + } + if (content.Contains("Port")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddVCenterRequestPropertiesInternal)this).Port = (string) content.GetValueForProperty("Port",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddVCenterRequestPropertiesInternal)this).Port, global::System.Convert.ToString); + } + if (content.Contains("RunAsAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddVCenterRequestPropertiesInternal)this).RunAsAccountId = (string) content.GetValueForProperty("RunAsAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddVCenterRequestPropertiesInternal)this).RunAsAccountId, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddVCenterRequestProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new AddVCenterRequestProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddVCenterRequestProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new AddVCenterRequestProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddVCenterRequestProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// The properties of an add vCenter request. + [System.ComponentModel.TypeConverter(typeof(AddVCenterRequestPropertiesTypeConverter))] + public partial interface IAddVCenterRequestProperties + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AddVCenterRequestProperties.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AddVCenterRequestProperties.TypeConverter.cs new file mode 100644 index 000000000000..249ba29f3be2 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AddVCenterRequestProperties.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class AddVCenterRequestPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddVCenterRequestProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddVCenterRequestProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return AddVCenterRequestProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return AddVCenterRequestProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return AddVCenterRequestProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AddVCenterRequestProperties.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AddVCenterRequestProperties.cs new file mode 100644 index 000000000000..58c06b3c6976 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AddVCenterRequestProperties.cs @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The properties of an add vCenter request. + public partial class AddVCenterRequestProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddVCenterRequestProperties, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddVCenterRequestPropertiesInternal + { + + /// Backing field for property. + private string _friendlyName; + + /// The friendly name of the vCenter. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string FriendlyName { get => this._friendlyName; set => this._friendlyName = value; } + + /// Backing field for property. + private string _iPAddress; + + /// The IP address of the vCenter to be discovered. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string IPAddress { get => this._iPAddress; set => this._iPAddress = value; } + + /// Backing field for property. + private string _port; + + /// The port number for discovery. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Port { get => this._port; set => this._port = value; } + + /// Backing field for property. + private string _processServerId; + + /// The process server Id from where the discovery is orchestrated. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ProcessServerId { get => this._processServerId; set => this._processServerId = value; } + + /// Backing field for property. + private string _runAsAccountId; + + /// The account Id which has privileges to discover the vCenter. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RunAsAccountId { get => this._runAsAccountId; set => this._runAsAccountId = value; } + + /// Creates an new instance. + public AddVCenterRequestProperties() + { + + } + } + /// The properties of an add vCenter request. + public partial interface IAddVCenterRequestProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The friendly name of the vCenter. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The friendly name of the vCenter.", + SerializedName = @"friendlyName", + PossibleTypes = new [] { typeof(string) })] + string FriendlyName { get; set; } + /// The IP address of the vCenter to be discovered. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The IP address of the vCenter to be discovered.", + SerializedName = @"ipAddress", + PossibleTypes = new [] { typeof(string) })] + string IPAddress { get; set; } + /// The port number for discovery. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The port number for discovery.", + SerializedName = @"port", + PossibleTypes = new [] { typeof(string) })] + string Port { get; set; } + /// The process server Id from where the discovery is orchestrated. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The process server Id from where the discovery is orchestrated.", + SerializedName = @"processServerId", + PossibleTypes = new [] { typeof(string) })] + string ProcessServerId { get; set; } + /// The account Id which has privileges to discover the vCenter. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The account Id which has privileges to discover the vCenter.", + SerializedName = @"runAsAccountId", + PossibleTypes = new [] { typeof(string) })] + string RunAsAccountId { get; set; } + + } + /// The properties of an add vCenter request. + internal partial interface IAddVCenterRequestPropertiesInternal + + { + /// The friendly name of the vCenter. + string FriendlyName { get; set; } + /// The IP address of the vCenter to be discovered. + string IPAddress { get; set; } + /// The port number for discovery. + string Port { get; set; } + /// The process server Id from where the discovery is orchestrated. + string ProcessServerId { get; set; } + /// The account Id which has privileges to discover the vCenter. + string RunAsAccountId { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AddVCenterRequestProperties.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AddVCenterRequestProperties.json.cs new file mode 100644 index 000000000000..68c9bc3956f7 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AddVCenterRequestProperties.json.cs @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The properties of an add vCenter request. + public partial class AddVCenterRequestProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal AddVCenterRequestProperties(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_friendlyName = If( json?.PropertyT("friendlyName"), out var __jsonFriendlyName) ? (string)__jsonFriendlyName : (string)FriendlyName;} + {_iPAddress = If( json?.PropertyT("ipAddress"), out var __jsonIPAddress) ? (string)__jsonIPAddress : (string)IPAddress;} + {_processServerId = If( json?.PropertyT("processServerId"), out var __jsonProcessServerId) ? (string)__jsonProcessServerId : (string)ProcessServerId;} + {_port = If( json?.PropertyT("port"), out var __jsonPort) ? (string)__jsonPort : (string)Port;} + {_runAsAccountId = If( json?.PropertyT("runAsAccountId"), out var __jsonRunAsAccountId) ? (string)__jsonRunAsAccountId : (string)RunAsAccountId;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddVCenterRequestProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddVCenterRequestProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddVCenterRequestProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new AddVCenterRequestProperties(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._friendlyName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._friendlyName.ToString()) : null, "friendlyName" ,container.Add ); + AddIf( null != (((object)this._iPAddress)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._iPAddress.ToString()) : null, "ipAddress" ,container.Add ); + AddIf( null != (((object)this._processServerId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._processServerId.ToString()) : null, "processServerId" ,container.Add ); + AddIf( null != (((object)this._port)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._port.ToString()) : null, "port" ,container.Add ); + AddIf( null != (((object)this._runAsAccountId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._runAsAccountId.ToString()) : null, "runAsAccountId" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AgentDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AgentDetails.PowerShell.cs new file mode 100644 index 000000000000..f17f372a1f9e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AgentDetails.PowerShell.cs @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Agent details. + [System.ComponentModel.TypeConverter(typeof(AgentDetailsTypeConverter))] + public partial class AgentDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal AgentDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("AgentId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAgentDetailsInternal)this).AgentId = (string) content.GetValueForProperty("AgentId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAgentDetailsInternal)this).AgentId, global::System.Convert.ToString); + } + if (content.Contains("MachineId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAgentDetailsInternal)this).MachineId = (string) content.GetValueForProperty("MachineId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAgentDetailsInternal)this).MachineId, global::System.Convert.ToString); + } + if (content.Contains("BiosId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAgentDetailsInternal)this).BiosId = (string) content.GetValueForProperty("BiosId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAgentDetailsInternal)this).BiosId, global::System.Convert.ToString); + } + if (content.Contains("Fqdn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAgentDetailsInternal)this).Fqdn = (string) content.GetValueForProperty("Fqdn",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAgentDetailsInternal)this).Fqdn, global::System.Convert.ToString); + } + if (content.Contains("Disk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAgentDetailsInternal)this).Disk = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAgentDiskDetails[]) content.GetValueForProperty("Disk",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAgentDetailsInternal)this).Disk, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AgentDiskDetailsTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal AgentDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("AgentId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAgentDetailsInternal)this).AgentId = (string) content.GetValueForProperty("AgentId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAgentDetailsInternal)this).AgentId, global::System.Convert.ToString); + } + if (content.Contains("MachineId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAgentDetailsInternal)this).MachineId = (string) content.GetValueForProperty("MachineId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAgentDetailsInternal)this).MachineId, global::System.Convert.ToString); + } + if (content.Contains("BiosId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAgentDetailsInternal)this).BiosId = (string) content.GetValueForProperty("BiosId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAgentDetailsInternal)this).BiosId, global::System.Convert.ToString); + } + if (content.Contains("Fqdn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAgentDetailsInternal)this).Fqdn = (string) content.GetValueForProperty("Fqdn",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAgentDetailsInternal)this).Fqdn, global::System.Convert.ToString); + } + if (content.Contains("Disk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAgentDetailsInternal)this).Disk = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAgentDiskDetails[]) content.GetValueForProperty("Disk",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAgentDetailsInternal)this).Disk, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AgentDiskDetailsTypeConverter.ConvertFrom)); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAgentDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new AgentDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAgentDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new AgentDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAgentDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Agent details. + [System.ComponentModel.TypeConverter(typeof(AgentDetailsTypeConverter))] + public partial interface IAgentDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AgentDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AgentDetails.TypeConverter.cs new file mode 100644 index 000000000000..6d576a58108d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AgentDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class AgentDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAgentDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAgentDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return AgentDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return AgentDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return AgentDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AgentDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AgentDetails.cs new file mode 100644 index 000000000000..40f0b2a82e1a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AgentDetails.cs @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Agent details. + public partial class AgentDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAgentDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAgentDetailsInternal + { + + /// Backing field for property. + private string _agentId; + + /// The Id of the agent running on the server. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string AgentId { get => this._agentId; } + + /// Backing field for property. + private string _biosId; + + /// The machine BIOS Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string BiosId { get => this._biosId; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAgentDiskDetails[] _disk; + + /// The disks. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAgentDiskDetails[] Disk { get => this._disk; } + + /// Backing field for property. + private string _fqdn; + + /// The machine FQDN. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Fqdn { get => this._fqdn; } + + /// Backing field for property. + private string _machineId; + + /// The Id of the machine to which the agent is registered. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string MachineId { get => this._machineId; } + + /// Internal Acessors for AgentId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAgentDetailsInternal.AgentId { get => this._agentId; set { {_agentId = value;} } } + + /// Internal Acessors for BiosId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAgentDetailsInternal.BiosId { get => this._biosId; set { {_biosId = value;} } } + + /// Internal Acessors for Disk + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAgentDiskDetails[] Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAgentDetailsInternal.Disk { get => this._disk; set { {_disk = value;} } } + + /// Internal Acessors for Fqdn + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAgentDetailsInternal.Fqdn { get => this._fqdn; set { {_fqdn = value;} } } + + /// Internal Acessors for MachineId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAgentDetailsInternal.MachineId { get => this._machineId; set { {_machineId = value;} } } + + /// Creates an new instance. + public AgentDetails() + { + + } + } + /// Agent details. + public partial interface IAgentDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The Id of the agent running on the server. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The Id of the agent running on the server.", + SerializedName = @"agentId", + PossibleTypes = new [] { typeof(string) })] + string AgentId { get; } + /// The machine BIOS Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The machine BIOS Id.", + SerializedName = @"biosId", + PossibleTypes = new [] { typeof(string) })] + string BiosId { get; } + /// The disks. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The disks.", + SerializedName = @"disks", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAgentDiskDetails) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAgentDiskDetails[] Disk { get; } + /// The machine FQDN. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The machine FQDN.", + SerializedName = @"fqdn", + PossibleTypes = new [] { typeof(string) })] + string Fqdn { get; } + /// The Id of the machine to which the agent is registered. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The Id of the machine to which the agent is registered.", + SerializedName = @"machineId", + PossibleTypes = new [] { typeof(string) })] + string MachineId { get; } + + } + /// Agent details. + internal partial interface IAgentDetailsInternal + + { + /// The Id of the agent running on the server. + string AgentId { get; set; } + /// The machine BIOS Id. + string BiosId { get; set; } + /// The disks. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAgentDiskDetails[] Disk { get; set; } + /// The machine FQDN. + string Fqdn { get; set; } + /// The Id of the machine to which the agent is registered. + string MachineId { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AgentDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AgentDetails.json.cs new file mode 100644 index 000000000000..5eebecbe60e1 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AgentDetails.json.cs @@ -0,0 +1,139 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Agent details. + public partial class AgentDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal AgentDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_agentId = If( json?.PropertyT("agentId"), out var __jsonAgentId) ? (string)__jsonAgentId : (string)AgentId;} + {_machineId = If( json?.PropertyT("machineId"), out var __jsonMachineId) ? (string)__jsonMachineId : (string)MachineId;} + {_biosId = If( json?.PropertyT("biosId"), out var __jsonBiosId) ? (string)__jsonBiosId : (string)BiosId;} + {_fqdn = If( json?.PropertyT("fqdn"), out var __jsonFqdn) ? (string)__jsonFqdn : (string)Fqdn;} + {_disk = If( json?.PropertyT("disks"), out var __jsonDisks) ? If( __jsonDisks as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAgentDiskDetails) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AgentDiskDetails.FromJson(__u) )) ))() : null : Disk;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAgentDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAgentDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAgentDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new AgentDetails(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._agentId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._agentId.ToString()) : null, "agentId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._machineId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._machineId.ToString()) : null, "machineId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._biosId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._biosId.ToString()) : null, "biosId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._fqdn)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._fqdn.ToString()) : null, "fqdn" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + if (null != this._disk) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._disk ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("disks",__w); + } + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AgentDiskDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AgentDiskDetails.PowerShell.cs new file mode 100644 index 000000000000..d2fca595b60c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AgentDiskDetails.PowerShell.cs @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Agent disk details. + [System.ComponentModel.TypeConverter(typeof(AgentDiskDetailsTypeConverter))] + public partial class AgentDiskDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal AgentDiskDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DiskId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAgentDiskDetailsInternal)this).DiskId = (string) content.GetValueForProperty("DiskId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAgentDiskDetailsInternal)this).DiskId, global::System.Convert.ToString); + } + if (content.Contains("DiskName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAgentDiskDetailsInternal)this).DiskName = (string) content.GetValueForProperty("DiskName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAgentDiskDetailsInternal)this).DiskName, global::System.Convert.ToString); + } + if (content.Contains("IsOSDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAgentDiskDetailsInternal)this).IsOSDisk = (string) content.GetValueForProperty("IsOSDisk",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAgentDiskDetailsInternal)this).IsOSDisk, global::System.Convert.ToString); + } + if (content.Contains("CapacityInByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAgentDiskDetailsInternal)this).CapacityInByte = (long?) content.GetValueForProperty("CapacityInByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAgentDiskDetailsInternal)this).CapacityInByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("LunId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAgentDiskDetailsInternal)this).LunId = (int?) content.GetValueForProperty("LunId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAgentDiskDetailsInternal)this).LunId, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal AgentDiskDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DiskId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAgentDiskDetailsInternal)this).DiskId = (string) content.GetValueForProperty("DiskId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAgentDiskDetailsInternal)this).DiskId, global::System.Convert.ToString); + } + if (content.Contains("DiskName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAgentDiskDetailsInternal)this).DiskName = (string) content.GetValueForProperty("DiskName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAgentDiskDetailsInternal)this).DiskName, global::System.Convert.ToString); + } + if (content.Contains("IsOSDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAgentDiskDetailsInternal)this).IsOSDisk = (string) content.GetValueForProperty("IsOSDisk",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAgentDiskDetailsInternal)this).IsOSDisk, global::System.Convert.ToString); + } + if (content.Contains("CapacityInByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAgentDiskDetailsInternal)this).CapacityInByte = (long?) content.GetValueForProperty("CapacityInByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAgentDiskDetailsInternal)this).CapacityInByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("LunId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAgentDiskDetailsInternal)this).LunId = (int?) content.GetValueForProperty("LunId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAgentDiskDetailsInternal)this).LunId, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAgentDiskDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new AgentDiskDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAgentDiskDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new AgentDiskDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAgentDiskDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Agent disk details. + [System.ComponentModel.TypeConverter(typeof(AgentDiskDetailsTypeConverter))] + public partial interface IAgentDiskDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AgentDiskDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AgentDiskDetails.TypeConverter.cs new file mode 100644 index 000000000000..c8dc87916cbe --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AgentDiskDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class AgentDiskDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAgentDiskDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAgentDiskDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return AgentDiskDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return AgentDiskDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return AgentDiskDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AgentDiskDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AgentDiskDetails.cs new file mode 100644 index 000000000000..d51ffc0a1344 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AgentDiskDetails.cs @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Agent disk details. + public partial class AgentDiskDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAgentDiskDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAgentDiskDetailsInternal + { + + /// Backing field for property. + private long? _capacityInByte; + + /// The disk capacity in bytes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public long? CapacityInByte { get => this._capacityInByte; } + + /// Backing field for property. + private string _diskId; + + /// The disk Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string DiskId { get => this._diskId; } + + /// Backing field for property. + private string _diskName; + + /// The disk name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string DiskName { get => this._diskName; } + + /// Backing field for property. + private string _isOSDisk; + + /// A value indicating whether the disk is the OS disk. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string IsOSDisk { get => this._isOSDisk; } + + /// Backing field for property. + private int? _lunId; + + /// The lun of disk. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? LunId { get => this._lunId; } + + /// Internal Acessors for CapacityInByte + long? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAgentDiskDetailsInternal.CapacityInByte { get => this._capacityInByte; set { {_capacityInByte = value;} } } + + /// Internal Acessors for DiskId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAgentDiskDetailsInternal.DiskId { get => this._diskId; set { {_diskId = value;} } } + + /// Internal Acessors for DiskName + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAgentDiskDetailsInternal.DiskName { get => this._diskName; set { {_diskName = value;} } } + + /// Internal Acessors for IsOSDisk + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAgentDiskDetailsInternal.IsOSDisk { get => this._isOSDisk; set { {_isOSDisk = value;} } } + + /// Internal Acessors for LunId + int? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAgentDiskDetailsInternal.LunId { get => this._lunId; set { {_lunId = value;} } } + + /// Creates an new instance. + public AgentDiskDetails() + { + + } + } + /// Agent disk details. + public partial interface IAgentDiskDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The disk capacity in bytes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The disk capacity in bytes.", + SerializedName = @"capacityInBytes", + PossibleTypes = new [] { typeof(long) })] + long? CapacityInByte { get; } + /// The disk Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The disk Id.", + SerializedName = @"diskId", + PossibleTypes = new [] { typeof(string) })] + string DiskId { get; } + /// The disk name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The disk name.", + SerializedName = @"diskName", + PossibleTypes = new [] { typeof(string) })] + string DiskName { get; } + /// A value indicating whether the disk is the OS disk. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"A value indicating whether the disk is the OS disk.", + SerializedName = @"isOSDisk", + PossibleTypes = new [] { typeof(string) })] + string IsOSDisk { get; } + /// The lun of disk. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The lun of disk.", + SerializedName = @"lunId", + PossibleTypes = new [] { typeof(int) })] + int? LunId { get; } + + } + /// Agent disk details. + internal partial interface IAgentDiskDetailsInternal + + { + /// The disk capacity in bytes. + long? CapacityInByte { get; set; } + /// The disk Id. + string DiskId { get; set; } + /// The disk name. + string DiskName { get; set; } + /// A value indicating whether the disk is the OS disk. + string IsOSDisk { get; set; } + /// The lun of disk. + int? LunId { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AgentDiskDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AgentDiskDetails.json.cs new file mode 100644 index 000000000000..1b36c3953d62 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AgentDiskDetails.json.cs @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Agent disk details. + public partial class AgentDiskDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal AgentDiskDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_diskId = If( json?.PropertyT("diskId"), out var __jsonDiskId) ? (string)__jsonDiskId : (string)DiskId;} + {_diskName = If( json?.PropertyT("diskName"), out var __jsonDiskName) ? (string)__jsonDiskName : (string)DiskName;} + {_isOSDisk = If( json?.PropertyT("isOSDisk"), out var __jsonIsOSDisk) ? (string)__jsonIsOSDisk : (string)IsOSDisk;} + {_capacityInByte = If( json?.PropertyT("capacityInBytes"), out var __jsonCapacityInBytes) ? (long?)__jsonCapacityInBytes : CapacityInByte;} + {_lunId = If( json?.PropertyT("lunId"), out var __jsonLunId) ? (int?)__jsonLunId : LunId;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAgentDiskDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAgentDiskDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAgentDiskDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new AgentDiskDetails(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._diskId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._diskId.ToString()) : null, "diskId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._diskName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._diskName.ToString()) : null, "diskName" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._isOSDisk)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._isOSDisk.ToString()) : null, "isOSDisk" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._capacityInByte ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((long)this._capacityInByte) : null, "capacityInBytes" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._lunId ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._lunId) : null, "lunId" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Alert.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Alert.PowerShell.cs new file mode 100644 index 000000000000..f21846c1792f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Alert.PowerShell.cs @@ -0,0 +1,200 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Implements the Alert class. + [System.ComponentModel.TypeConverter(typeof(AlertTypeConverter))] + public partial class Alert + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal Alert(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlertInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlertProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlertInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AlertPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("SendToOwner")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlertInternal)this).SendToOwner = (string) content.GetValueForProperty("SendToOwner",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlertInternal)this).SendToOwner, global::System.Convert.ToString); + } + if (content.Contains("CustomEmailAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlertInternal)this).CustomEmailAddress = (string[]) content.GetValueForProperty("CustomEmailAddress",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlertInternal)this).CustomEmailAddress, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("Locale")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlertInternal)this).Locale = (string) content.GetValueForProperty("Locale",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlertInternal)this).Locale, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal Alert(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlertInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlertProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlertInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AlertPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("SendToOwner")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlertInternal)this).SendToOwner = (string) content.GetValueForProperty("SendToOwner",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlertInternal)this).SendToOwner, global::System.Convert.ToString); + } + if (content.Contains("CustomEmailAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlertInternal)this).CustomEmailAddress = (string[]) content.GetValueForProperty("CustomEmailAddress",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlertInternal)this).CustomEmailAddress, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("Locale")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlertInternal)this).Locale = (string) content.GetValueForProperty("Locale",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlertInternal)this).Locale, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlert DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new Alert(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlert DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new Alert(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlert FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Implements the Alert class. + [System.ComponentModel.TypeConverter(typeof(AlertTypeConverter))] + public partial interface IAlert + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Alert.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Alert.TypeConverter.cs new file mode 100644 index 000000000000..09cfe0f5a644 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Alert.TypeConverter.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class AlertTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlert ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlert).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return Alert.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return Alert.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return Alert.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Alert.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Alert.cs new file mode 100644 index 000000000000..a0db1e9cdc92 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Alert.cs @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Implements the Alert class. + public partial class Alert : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlert, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlertInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResource __resource = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.Resource(); + + /// The custom email address for sending emails. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string[] CustomEmailAddress { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlertPropertiesInternal)Property).CustomEmailAddress; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlertPropertiesInternal)Property).CustomEmailAddress = value ?? null /* arrayOf */; } + + /// Resource Id + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Id; } + + /// The locale for the email notification. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string Locale { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlertPropertiesInternal)Property).Locale; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlertPropertiesInternal)Property).Locale = value ?? null; } + + /// Resource Location + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string Location { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Location; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Location = value ?? null; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlertProperties Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlertInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AlertProperties()); set { {_property = value;} } } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Id = value; } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Name = value; } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Type = value; } + + /// Resource Name + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Name; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlertProperties _property; + + /// Alert related data. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlertProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AlertProperties()); set => this._property = value; } + + /// A value indicating whether to send email to subscription administrator. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string SendToOwner { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlertPropertiesInternal)Property).SendToOwner; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlertPropertiesInternal)Property).SendToOwner = value ?? null; } + + /// Resource Type + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Type; } + + /// Creates an new instance. + public Alert() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__resource), __resource); + await eventListener.AssertObjectIsValid(nameof(__resource), __resource); + } + } + /// Implements the Alert class. + public partial interface IAlert : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResource + { + /// The custom email address for sending emails. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The custom email address for sending emails.", + SerializedName = @"customEmailAddresses", + PossibleTypes = new [] { typeof(string) })] + string[] CustomEmailAddress { get; set; } + /// The locale for the email notification. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The locale for the email notification.", + SerializedName = @"locale", + PossibleTypes = new [] { typeof(string) })] + string Locale { get; set; } + /// A value indicating whether to send email to subscription administrator. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether to send email to subscription administrator.", + SerializedName = @"sendToOwners", + PossibleTypes = new [] { typeof(string) })] + string SendToOwner { get; set; } + + } + /// Implements the Alert class. + internal partial interface IAlertInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal + { + /// The custom email address for sending emails. + string[] CustomEmailAddress { get; set; } + /// The locale for the email notification. + string Locale { get; set; } + /// Alert related data. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlertProperties Property { get; set; } + /// A value indicating whether to send email to subscription administrator. + string SendToOwner { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Alert.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Alert.json.cs new file mode 100644 index 000000000000..ab9ba23526cf --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Alert.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Implements the Alert class. + public partial class Alert + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal Alert(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __resource = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.Resource(json); + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AlertProperties.FromJson(__jsonProperties) : Property;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlert. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlert. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlert FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new Alert(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __resource?.ToJson(container, serializationMode); + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AlertCollection.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AlertCollection.PowerShell.cs new file mode 100644 index 000000000000..9f09cef735d8 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AlertCollection.PowerShell.cs @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Collection of alerts. + [System.ComponentModel.TypeConverter(typeof(AlertCollectionTypeConverter))] + public partial class AlertCollection + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal AlertCollection(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlertCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlert[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlertCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AlertTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlertCollectionInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlertCollectionInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal AlertCollection(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlertCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlert[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlertCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AlertTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlertCollectionInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlertCollectionInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlertCollection DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new AlertCollection(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlertCollection DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new AlertCollection(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlertCollection FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Collection of alerts. + [System.ComponentModel.TypeConverter(typeof(AlertCollectionTypeConverter))] + public partial interface IAlertCollection + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AlertCollection.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AlertCollection.TypeConverter.cs new file mode 100644 index 000000000000..526856a16534 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AlertCollection.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class AlertCollectionTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlertCollection ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlertCollection).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return AlertCollection.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return AlertCollection.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return AlertCollection.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AlertCollection.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AlertCollection.cs new file mode 100644 index 000000000000..fd99f9786276 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AlertCollection.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Collection of alerts. + public partial class AlertCollection : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlertCollection, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlertCollectionInternal + { + + /// Backing field for property. + private string _nextLink; + + /// The value of next link. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string NextLink { get => this._nextLink; set => this._nextLink = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlert[] _value; + + /// The list of alerts. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlert[] Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public AlertCollection() + { + + } + } + /// Collection of alerts. + public partial interface IAlertCollection : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The value of next link. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The value of next link.", + SerializedName = @"nextLink", + PossibleTypes = new [] { typeof(string) })] + string NextLink { get; set; } + /// The list of alerts. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of alerts.", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlert) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlert[] Value { get; set; } + + } + /// Collection of alerts. + internal partial interface IAlertCollectionInternal + + { + /// The value of next link. + string NextLink { get; set; } + /// The list of alerts. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlert[] Value { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AlertCollection.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AlertCollection.json.cs new file mode 100644 index 000000000000..11e0b64500bd --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AlertCollection.json.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Collection of alerts. + public partial class AlertCollection + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal AlertCollection(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlert) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.Alert.FromJson(__u) )) ))() : null : Value;} + {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)NextLink;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlertCollection. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlertCollection. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlertCollection FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new AlertCollection(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._value) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._value ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("value",__w); + } + AddIf( null != (((object)this._nextLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AlertProperties.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AlertProperties.PowerShell.cs new file mode 100644 index 000000000000..c4ac3033ffd5 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AlertProperties.PowerShell.cs @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// The properties of an alert. + [System.ComponentModel.TypeConverter(typeof(AlertPropertiesTypeConverter))] + public partial class AlertProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal AlertProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SendToOwner")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlertPropertiesInternal)this).SendToOwner = (string) content.GetValueForProperty("SendToOwner",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlertPropertiesInternal)this).SendToOwner, global::System.Convert.ToString); + } + if (content.Contains("CustomEmailAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlertPropertiesInternal)this).CustomEmailAddress = (string[]) content.GetValueForProperty("CustomEmailAddress",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlertPropertiesInternal)this).CustomEmailAddress, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("Locale")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlertPropertiesInternal)this).Locale = (string) content.GetValueForProperty("Locale",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlertPropertiesInternal)this).Locale, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal AlertProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SendToOwner")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlertPropertiesInternal)this).SendToOwner = (string) content.GetValueForProperty("SendToOwner",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlertPropertiesInternal)this).SendToOwner, global::System.Convert.ToString); + } + if (content.Contains("CustomEmailAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlertPropertiesInternal)this).CustomEmailAddress = (string[]) content.GetValueForProperty("CustomEmailAddress",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlertPropertiesInternal)this).CustomEmailAddress, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("Locale")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlertPropertiesInternal)this).Locale = (string) content.GetValueForProperty("Locale",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlertPropertiesInternal)this).Locale, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlertProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new AlertProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlertProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new AlertProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlertProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// The properties of an alert. + [System.ComponentModel.TypeConverter(typeof(AlertPropertiesTypeConverter))] + public partial interface IAlertProperties + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AlertProperties.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AlertProperties.TypeConverter.cs new file mode 100644 index 000000000000..25865c548678 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AlertProperties.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class AlertPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlertProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlertProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return AlertProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return AlertProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return AlertProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AlertProperties.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AlertProperties.cs new file mode 100644 index 000000000000..c5ce598611d8 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AlertProperties.cs @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The properties of an alert. + public partial class AlertProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlertProperties, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlertPropertiesInternal + { + + /// Backing field for property. + private string[] _customEmailAddress; + + /// The custom email address for sending emails. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string[] CustomEmailAddress { get => this._customEmailAddress; set => this._customEmailAddress = value; } + + /// Backing field for property. + private string _locale; + + /// The locale for the email notification. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Locale { get => this._locale; set => this._locale = value; } + + /// Backing field for property. + private string _sendToOwner; + + /// A value indicating whether to send email to subscription administrator. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string SendToOwner { get => this._sendToOwner; set => this._sendToOwner = value; } + + /// Creates an new instance. + public AlertProperties() + { + + } + } + /// The properties of an alert. + public partial interface IAlertProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The custom email address for sending emails. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The custom email address for sending emails.", + SerializedName = @"customEmailAddresses", + PossibleTypes = new [] { typeof(string) })] + string[] CustomEmailAddress { get; set; } + /// The locale for the email notification. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The locale for the email notification.", + SerializedName = @"locale", + PossibleTypes = new [] { typeof(string) })] + string Locale { get; set; } + /// A value indicating whether to send email to subscription administrator. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether to send email to subscription administrator.", + SerializedName = @"sendToOwners", + PossibleTypes = new [] { typeof(string) })] + string SendToOwner { get; set; } + + } + /// The properties of an alert. + internal partial interface IAlertPropertiesInternal + + { + /// The custom email address for sending emails. + string[] CustomEmailAddress { get; set; } + /// The locale for the email notification. + string Locale { get; set; } + /// A value indicating whether to send email to subscription administrator. + string SendToOwner { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AlertProperties.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AlertProperties.json.cs new file mode 100644 index 000000000000..c6897abbff39 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AlertProperties.json.cs @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The properties of an alert. + public partial class AlertProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal AlertProperties(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_sendToOwner = If( json?.PropertyT("sendToOwners"), out var __jsonSendToOwners) ? (string)__jsonSendToOwners : (string)SendToOwner;} + {_customEmailAddress = If( json?.PropertyT("customEmailAddresses"), out var __jsonCustomEmailAddresses) ? If( __jsonCustomEmailAddresses as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(string) (__u is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : CustomEmailAddress;} + {_locale = If( json?.PropertyT("locale"), out var __jsonLocale) ? (string)__jsonLocale : (string)Locale;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlertProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlertProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlertProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new AlertProperties(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._sendToOwner)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._sendToOwner.ToString()) : null, "sendToOwners" ,container.Add ); + if (null != this._customEmailAddress) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._customEmailAddress ) + { + AddIf(null != (((object)__x)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(__x.ToString()) : null ,__w.Add); + } + container.Add("customEmailAddresses",__w); + } + AddIf( null != (((object)this._locale)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._locale.ToString()) : null, "locale" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ApplianceCollection.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ApplianceCollection.PowerShell.cs new file mode 100644 index 000000000000..b945ca7cc666 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ApplianceCollection.PowerShell.cs @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Collection of appliance details. + [System.ComponentModel.TypeConverter(typeof(ApplianceCollectionTypeConverter))] + public partial class ApplianceCollection + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ApplianceCollection(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplianceCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAppliance[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplianceCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationApplianceTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplianceCollectionInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplianceCollectionInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ApplianceCollection(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplianceCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAppliance[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplianceCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationApplianceTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplianceCollectionInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplianceCollectionInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplianceCollection DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ApplianceCollection(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplianceCollection DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ApplianceCollection(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplianceCollection FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Collection of appliance details. + [System.ComponentModel.TypeConverter(typeof(ApplianceCollectionTypeConverter))] + public partial interface IApplianceCollection + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ApplianceCollection.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ApplianceCollection.TypeConverter.cs new file mode 100644 index 000000000000..7a48224bc07e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ApplianceCollection.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ApplianceCollectionTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplianceCollection ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplianceCollection).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ApplianceCollection.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ApplianceCollection.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ApplianceCollection.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ApplianceCollection.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ApplianceCollection.cs new file mode 100644 index 000000000000..4f94c8531ad6 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ApplianceCollection.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Collection of appliance details. + public partial class ApplianceCollection : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplianceCollection, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplianceCollectionInternal + { + + /// Backing field for property. + private string _nextLink; + + /// The value of next link. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string NextLink { get => this._nextLink; set => this._nextLink = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAppliance[] _value; + + /// The appliance details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAppliance[] Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public ApplianceCollection() + { + + } + } + /// Collection of appliance details. + public partial interface IApplianceCollection : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The value of next link. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The value of next link.", + SerializedName = @"nextLink", + PossibleTypes = new [] { typeof(string) })] + string NextLink { get; set; } + /// The appliance details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The appliance details.", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAppliance) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAppliance[] Value { get; set; } + + } + /// Collection of appliance details. + internal partial interface IApplianceCollectionInternal + + { + /// The value of next link. + string NextLink { get; set; } + /// The appliance details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAppliance[] Value { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ApplianceCollection.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ApplianceCollection.json.cs new file mode 100644 index 000000000000..509a3eebf910 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ApplianceCollection.json.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Collection of appliance details. + public partial class ApplianceCollection + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal ApplianceCollection(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAppliance) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationAppliance.FromJson(__u) )) ))() : null : Value;} + {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)NextLink;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplianceCollection. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplianceCollection. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplianceCollection FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new ApplianceCollection(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._value) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._value ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("value",__w); + } + AddIf( null != (((object)this._nextLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ApplianceQueryParameter.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ApplianceQueryParameter.PowerShell.cs new file mode 100644 index 000000000000..fc2c00927ded --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ApplianceQueryParameter.PowerShell.cs @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Query parameter to get appliance. + [System.ComponentModel.TypeConverter(typeof(ApplianceQueryParameterTypeConverter))] + public partial class ApplianceQueryParameter + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ApplianceQueryParameter(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProviderType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplianceQueryParameterInternal)this).ProviderType = (string) content.GetValueForProperty("ProviderType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplianceQueryParameterInternal)this).ProviderType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ApplianceQueryParameter(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProviderType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplianceQueryParameterInternal)this).ProviderType = (string) content.GetValueForProperty("ProviderType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplianceQueryParameterInternal)this).ProviderType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplianceQueryParameter DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ApplianceQueryParameter(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplianceQueryParameter DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ApplianceQueryParameter(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplianceQueryParameter FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Query parameter to get appliance. + [System.ComponentModel.TypeConverter(typeof(ApplianceQueryParameterTypeConverter))] + public partial interface IApplianceQueryParameter + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ApplianceQueryParameter.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ApplianceQueryParameter.TypeConverter.cs new file mode 100644 index 000000000000..e89a8d4b7c91 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ApplianceQueryParameter.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ApplianceQueryParameterTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplianceQueryParameter ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplianceQueryParameter).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ApplianceQueryParameter.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ApplianceQueryParameter.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ApplianceQueryParameter.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ApplianceQueryParameter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ApplianceQueryParameter.cs new file mode 100644 index 000000000000..adc51f916b66 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ApplianceQueryParameter.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Query parameter to get appliance. + public partial class ApplianceQueryParameter : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplianceQueryParameter, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplianceQueryParameterInternal + { + + /// Backing field for property. + private string _providerType; + + /// The providerType to be used for fetching appliance details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ProviderType { get => this._providerType; set => this._providerType = value; } + + /// Creates an new instance. + public ApplianceQueryParameter() + { + + } + } + /// Query parameter to get appliance. + public partial interface IApplianceQueryParameter : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The providerType to be used for fetching appliance details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The providerType to be used for fetching appliance details.", + SerializedName = @"providerType", + PossibleTypes = new [] { typeof(string) })] + string ProviderType { get; set; } + + } + /// Query parameter to get appliance. + internal partial interface IApplianceQueryParameterInternal + + { + /// The providerType to be used for fetching appliance details. + string ProviderType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ApplianceQueryParameter.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ApplianceQueryParameter.json.cs new file mode 100644 index 000000000000..df8667e4f3b0 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ApplianceQueryParameter.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Query parameter to get appliance. + public partial class ApplianceQueryParameter + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal ApplianceQueryParameter(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_providerType = If( json?.PropertyT("providerType"), out var __jsonProviderType) ? (string)__jsonProviderType : (string)ProviderType;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplianceQueryParameter. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplianceQueryParameter. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplianceQueryParameter FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new ApplianceQueryParameter(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._providerType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._providerType.ToString()) : null, "providerType" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ApplianceSpecificDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ApplianceSpecificDetails.PowerShell.cs new file mode 100644 index 000000000000..8d46585122c7 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ApplianceSpecificDetails.PowerShell.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Appliance specific details. + [System.ComponentModel.TypeConverter(typeof(ApplianceSpecificDetailsTypeConverter))] + public partial class ApplianceSpecificDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ApplianceSpecificDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplianceSpecificDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplianceSpecificDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ApplianceSpecificDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplianceSpecificDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplianceSpecificDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplianceSpecificDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ApplianceSpecificDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplianceSpecificDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ApplianceSpecificDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplianceSpecificDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Appliance specific details. + [System.ComponentModel.TypeConverter(typeof(ApplianceSpecificDetailsTypeConverter))] + public partial interface IApplianceSpecificDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ApplianceSpecificDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ApplianceSpecificDetails.TypeConverter.cs new file mode 100644 index 000000000000..5d4134864531 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ApplianceSpecificDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ApplianceSpecificDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplianceSpecificDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplianceSpecificDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ApplianceSpecificDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ApplianceSpecificDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ApplianceSpecificDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ApplianceSpecificDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ApplianceSpecificDetails.cs new file mode 100644 index 000000000000..63eac46b079c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ApplianceSpecificDetails.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Appliance specific details. + public partial class ApplianceSpecificDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplianceSpecificDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplianceSpecificDetailsInternal + { + + /// Backing field for property. + private string _instanceType; + + /// Gets the class type. Overridden in derived classes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string InstanceType { get => this._instanceType; set => this._instanceType = value; } + + /// Creates an new instance. + public ApplianceSpecificDetails() + { + + } + } + /// Appliance specific details. + public partial interface IApplianceSpecificDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// Gets the class type. Overridden in derived classes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets the class type. Overridden in derived classes.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string InstanceType { get; set; } + + } + /// Appliance specific details. + internal partial interface IApplianceSpecificDetailsInternal + + { + /// Gets the class type. Overridden in derived classes. + string InstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ApplianceSpecificDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ApplianceSpecificDetails.json.cs new file mode 100644 index 000000000000..3af15542804f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ApplianceSpecificDetails.json.cs @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Appliance specific details. + public partial class ApplianceSpecificDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal ApplianceSpecificDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_instanceType = If( json?.PropertyT("instanceType"), out var __jsonInstanceType) ? (string)__jsonInstanceType : (string)InstanceType;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplianceSpecificDetails. + /// Note: the Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplianceSpecificDetails interface is polymorphic, + /// and the precise model class that will get deserialized is determined at runtime based on the payload. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplianceSpecificDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplianceSpecificDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + if (!(node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json)) + { + return null; + } + // Polymorphic type -- select the appropriate constructor using the discriminator + + switch ( json.StringProperty("instanceType") ) + { + case "InMageRcm": + { + return new InMageRcmApplianceSpecificDetails(json); + } + } + return new ApplianceSpecificDetails(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._instanceType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._instanceType.ToString()) : null, "instanceType" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ApplyRecoveryPointInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ApplyRecoveryPointInput.PowerShell.cs new file mode 100644 index 000000000000..2f4e03ce899c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ApplyRecoveryPointInput.PowerShell.cs @@ -0,0 +1,168 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Input to apply recovery point. + [System.ComponentModel.TypeConverter(typeof(ApplyRecoveryPointInputTypeConverter))] + public partial class ApplyRecoveryPointInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ApplyRecoveryPointInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointInputInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointInputProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointInputInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ApplyRecoveryPointInputPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointInputInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointProviderSpecificInput) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointInputInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ApplyRecoveryPointProviderSpecificInputTypeConverter.ConvertFrom); + } + if (content.Contains("RecoveryPointId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointInputInternal)this).RecoveryPointId = (string) content.GetValueForProperty("RecoveryPointId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointInputInternal)this).RecoveryPointId, global::System.Convert.ToString); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointInputInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointInputInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ApplyRecoveryPointInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointInputInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointInputProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointInputInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ApplyRecoveryPointInputPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointInputInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointProviderSpecificInput) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointInputInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ApplyRecoveryPointProviderSpecificInputTypeConverter.ConvertFrom); + } + if (content.Contains("RecoveryPointId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointInputInternal)this).RecoveryPointId = (string) content.GetValueForProperty("RecoveryPointId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointInputInternal)this).RecoveryPointId, global::System.Convert.ToString); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointInputInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointInputInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ApplyRecoveryPointInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ApplyRecoveryPointInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Input to apply recovery point. + [System.ComponentModel.TypeConverter(typeof(ApplyRecoveryPointInputTypeConverter))] + public partial interface IApplyRecoveryPointInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ApplyRecoveryPointInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ApplyRecoveryPointInput.TypeConverter.cs new file mode 100644 index 000000000000..80cddef28aa9 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ApplyRecoveryPointInput.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ApplyRecoveryPointInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ApplyRecoveryPointInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ApplyRecoveryPointInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ApplyRecoveryPointInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ApplyRecoveryPointInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ApplyRecoveryPointInput.cs new file mode 100644 index 000000000000..829b8c29a8cd --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ApplyRecoveryPointInput.cs @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Input to apply recovery point. + public partial class ApplyRecoveryPointInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointInputInternal + { + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointInputProperties Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointInputInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ApplyRecoveryPointInputProperties()); set { {_property = value;} } } + + /// Internal Acessors for ProviderSpecificDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointProviderSpecificInput Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointInputInternal.ProviderSpecificDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointInputPropertiesInternal)Property).ProviderSpecificDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointInputPropertiesInternal)Property).ProviderSpecificDetail = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointInputProperties _property; + + /// The input properties to apply recovery point. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointInputProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ApplyRecoveryPointInputProperties()); set => this._property = value; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ProviderSpecificDetailInstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointInputPropertiesInternal)Property).ProviderSpecificDetailInstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointInputPropertiesInternal)Property).ProviderSpecificDetailInstanceType = value ; } + + /// The recovery point Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string RecoveryPointId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointInputPropertiesInternal)Property).RecoveryPointId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointInputPropertiesInternal)Property).RecoveryPointId = value ?? null; } + + /// Creates an new instance. + public ApplyRecoveryPointInput() + { + + } + } + /// Input to apply recovery point. + public partial interface IApplyRecoveryPointInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string ProviderSpecificDetailInstanceType { get; set; } + /// The recovery point Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery point Id.", + SerializedName = @"recoveryPointId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryPointId { get; set; } + + } + /// Input to apply recovery point. + internal partial interface IApplyRecoveryPointInputInternal + + { + /// The input properties to apply recovery point. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointInputProperties Property { get; set; } + /// Provider specific input for applying recovery point. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointProviderSpecificInput ProviderSpecificDetail { get; set; } + /// The class type. + string ProviderSpecificDetailInstanceType { get; set; } + /// The recovery point Id. + string RecoveryPointId { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ApplyRecoveryPointInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ApplyRecoveryPointInput.json.cs new file mode 100644 index 000000000000..92f541be1832 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ApplyRecoveryPointInput.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Input to apply recovery point. + public partial class ApplyRecoveryPointInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal ApplyRecoveryPointInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ApplyRecoveryPointInputProperties.FromJson(__jsonProperties) : Property;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new ApplyRecoveryPointInput(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ApplyRecoveryPointInputProperties.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ApplyRecoveryPointInputProperties.PowerShell.cs new file mode 100644 index 000000000000..cad5ee85f502 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ApplyRecoveryPointInputProperties.PowerShell.cs @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Input properties to apply recovery point. + [System.ComponentModel.TypeConverter(typeof(ApplyRecoveryPointInputPropertiesTypeConverter))] + public partial class ApplyRecoveryPointInputProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ApplyRecoveryPointInputProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointInputPropertiesInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointProviderSpecificInput) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointInputPropertiesInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ApplyRecoveryPointProviderSpecificInputTypeConverter.ConvertFrom); + } + if (content.Contains("RecoveryPointId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointInputPropertiesInternal)this).RecoveryPointId = (string) content.GetValueForProperty("RecoveryPointId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointInputPropertiesInternal)this).RecoveryPointId, global::System.Convert.ToString); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointInputPropertiesInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointInputPropertiesInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ApplyRecoveryPointInputProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointInputPropertiesInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointProviderSpecificInput) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointInputPropertiesInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ApplyRecoveryPointProviderSpecificInputTypeConverter.ConvertFrom); + } + if (content.Contains("RecoveryPointId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointInputPropertiesInternal)this).RecoveryPointId = (string) content.GetValueForProperty("RecoveryPointId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointInputPropertiesInternal)this).RecoveryPointId, global::System.Convert.ToString); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointInputPropertiesInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointInputPropertiesInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointInputProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ApplyRecoveryPointInputProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointInputProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ApplyRecoveryPointInputProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointInputProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Input properties to apply recovery point. + [System.ComponentModel.TypeConverter(typeof(ApplyRecoveryPointInputPropertiesTypeConverter))] + public partial interface IApplyRecoveryPointInputProperties + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ApplyRecoveryPointInputProperties.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ApplyRecoveryPointInputProperties.TypeConverter.cs new file mode 100644 index 000000000000..10f8e7d998b1 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ApplyRecoveryPointInputProperties.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ApplyRecoveryPointInputPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointInputProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointInputProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ApplyRecoveryPointInputProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ApplyRecoveryPointInputProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ApplyRecoveryPointInputProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ApplyRecoveryPointInputProperties.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ApplyRecoveryPointInputProperties.cs new file mode 100644 index 000000000000..6a5f462e35c6 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ApplyRecoveryPointInputProperties.cs @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Input properties to apply recovery point. + public partial class ApplyRecoveryPointInputProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointInputProperties, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointInputPropertiesInternal + { + + /// Internal Acessors for ProviderSpecificDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointProviderSpecificInput Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointInputPropertiesInternal.ProviderSpecificDetail { get => (this._providerSpecificDetail = this._providerSpecificDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ApplyRecoveryPointProviderSpecificInput()); set { {_providerSpecificDetail = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointProviderSpecificInput _providerSpecificDetail; + + /// Provider specific input for applying recovery point. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointProviderSpecificInput ProviderSpecificDetail { get => (this._providerSpecificDetail = this._providerSpecificDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ApplyRecoveryPointProviderSpecificInput()); set => this._providerSpecificDetail = value; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ProviderSpecificDetailInstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointProviderSpecificInputInternal)ProviderSpecificDetail).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointProviderSpecificInputInternal)ProviderSpecificDetail).InstanceType = value ; } + + /// Backing field for property. + private string _recoveryPointId; + + /// The recovery point Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryPointId { get => this._recoveryPointId; set => this._recoveryPointId = value; } + + /// Creates an new instance. + public ApplyRecoveryPointInputProperties() + { + + } + } + /// Input properties to apply recovery point. + public partial interface IApplyRecoveryPointInputProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string ProviderSpecificDetailInstanceType { get; set; } + /// The recovery point Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery point Id.", + SerializedName = @"recoveryPointId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryPointId { get; set; } + + } + /// Input properties to apply recovery point. + internal partial interface IApplyRecoveryPointInputPropertiesInternal + + { + /// Provider specific input for applying recovery point. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointProviderSpecificInput ProviderSpecificDetail { get; set; } + /// The class type. + string ProviderSpecificDetailInstanceType { get; set; } + /// The recovery point Id. + string RecoveryPointId { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ApplyRecoveryPointInputProperties.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ApplyRecoveryPointInputProperties.json.cs new file mode 100644 index 000000000000..22c595b44ef7 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ApplyRecoveryPointInputProperties.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Input properties to apply recovery point. + public partial class ApplyRecoveryPointInputProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal ApplyRecoveryPointInputProperties(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_providerSpecificDetail = If( json?.PropertyT("providerSpecificDetails"), out var __jsonProviderSpecificDetails) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ApplyRecoveryPointProviderSpecificInput.FromJson(__jsonProviderSpecificDetails) : ProviderSpecificDetail;} + {_recoveryPointId = If( json?.PropertyT("recoveryPointId"), out var __jsonRecoveryPointId) ? (string)__jsonRecoveryPointId : (string)RecoveryPointId;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointInputProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointInputProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointInputProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new ApplyRecoveryPointInputProperties(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._providerSpecificDetail ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._providerSpecificDetail.ToJson(null,serializationMode) : null, "providerSpecificDetails" ,container.Add ); + AddIf( null != (((object)this._recoveryPointId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryPointId.ToString()) : null, "recoveryPointId" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ApplyRecoveryPointProviderSpecificInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ApplyRecoveryPointProviderSpecificInput.PowerShell.cs new file mode 100644 index 000000000000..670956fd4684 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ApplyRecoveryPointProviderSpecificInput.PowerShell.cs @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Provider specific input for apply recovery point. + [System.ComponentModel.TypeConverter(typeof(ApplyRecoveryPointProviderSpecificInputTypeConverter))] + public partial class ApplyRecoveryPointProviderSpecificInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ApplyRecoveryPointProviderSpecificInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ApplyRecoveryPointProviderSpecificInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointProviderSpecificInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ApplyRecoveryPointProviderSpecificInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointProviderSpecificInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ApplyRecoveryPointProviderSpecificInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json + /// string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointProviderSpecificInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Provider specific input for apply recovery point. + [System.ComponentModel.TypeConverter(typeof(ApplyRecoveryPointProviderSpecificInputTypeConverter))] + public partial interface IApplyRecoveryPointProviderSpecificInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ApplyRecoveryPointProviderSpecificInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ApplyRecoveryPointProviderSpecificInput.TypeConverter.cs new file mode 100644 index 000000000000..aaee4c8586da --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ApplyRecoveryPointProviderSpecificInput.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ApplyRecoveryPointProviderSpecificInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointProviderSpecificInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointProviderSpecificInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ApplyRecoveryPointProviderSpecificInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ApplyRecoveryPointProviderSpecificInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ApplyRecoveryPointProviderSpecificInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ApplyRecoveryPointProviderSpecificInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ApplyRecoveryPointProviderSpecificInput.cs new file mode 100644 index 000000000000..19e4cdeba7da --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ApplyRecoveryPointProviderSpecificInput.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Provider specific input for apply recovery point. + public partial class ApplyRecoveryPointProviderSpecificInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointProviderSpecificInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointProviderSpecificInputInternal + { + + /// Backing field for property. + private string _instanceType; + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string InstanceType { get => this._instanceType; set => this._instanceType = value; } + + /// Creates an new instance. + public ApplyRecoveryPointProviderSpecificInput() + { + + } + } + /// Provider specific input for apply recovery point. + public partial interface IApplyRecoveryPointProviderSpecificInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string InstanceType { get; set; } + + } + /// Provider specific input for apply recovery point. + internal partial interface IApplyRecoveryPointProviderSpecificInputInternal + + { + /// The class type. + string InstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ApplyRecoveryPointProviderSpecificInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ApplyRecoveryPointProviderSpecificInput.json.cs new file mode 100644 index 000000000000..2b061c96b3b2 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ApplyRecoveryPointProviderSpecificInput.json.cs @@ -0,0 +1,141 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Provider specific input for apply recovery point. + public partial class ApplyRecoveryPointProviderSpecificInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal ApplyRecoveryPointProviderSpecificInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_instanceType = If( json?.PropertyT("instanceType"), out var __jsonInstanceType) ? (string)__jsonInstanceType : (string)InstanceType;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointProviderSpecificInput. + /// Note: the Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointProviderSpecificInput interface + /// is polymorphic, and the precise model class that will get deserialized is determined at runtime based on the payload. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointProviderSpecificInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointProviderSpecificInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + if (!(node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json)) + { + return null; + } + // Polymorphic type -- select the appropriate constructor using the discriminator + + switch ( json.StringProperty("instanceType") ) + { + case "A2A": + { + return new A2AApplyRecoveryPointInput(json); + } + case "A2ACrossClusterMigration": + { + return new A2ACrossClusterMigrationApplyRecoveryPointInput(json); + } + case "HyperVReplicaAzure": + { + return new HyperVReplicaAzureApplyRecoveryPointInput(json); + } + case "InMageAzureV2": + { + return new InMageAzureV2ApplyRecoveryPointInput(json); + } + case "InMageRcm": + { + return new InMageRcmApplyRecoveryPointInput(json); + } + } + return new ApplyRecoveryPointProviderSpecificInput(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._instanceType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._instanceType.ToString()) : null, "instanceType" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AsrJobDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AsrJobDetails.PowerShell.cs new file mode 100644 index 000000000000..4a9468717c19 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AsrJobDetails.PowerShell.cs @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// This class represents job details based on specific job type. + [System.ComponentModel.TypeConverter(typeof(AsrJobDetailsTypeConverter))] + public partial class AsrJobDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal AsrJobDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + if (content.Contains("AffectedObjectDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsInternal)this).AffectedObjectDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsAffectedObjectDetails) content.GetValueForProperty("AffectedObjectDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsInternal)this).AffectedObjectDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.JobDetailsAffectedObjectDetailsTypeConverter.ConvertFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal AsrJobDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + if (content.Contains("AffectedObjectDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsInternal)this).AffectedObjectDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsAffectedObjectDetails) content.GetValueForProperty("AffectedObjectDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsInternal)this).AffectedObjectDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.JobDetailsAffectedObjectDetailsTypeConverter.ConvertFrom); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrJobDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new AsrJobDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrJobDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new AsrJobDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrJobDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// This class represents job details based on specific job type. + [System.ComponentModel.TypeConverter(typeof(AsrJobDetailsTypeConverter))] + public partial interface IAsrJobDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AsrJobDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AsrJobDetails.TypeConverter.cs new file mode 100644 index 000000000000..a056ad5275ff --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AsrJobDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class AsrJobDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrJobDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrJobDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return AsrJobDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return AsrJobDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return AsrJobDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AsrJobDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AsrJobDetails.cs new file mode 100644 index 000000000000..75b00a3aa517 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AsrJobDetails.cs @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// This class represents job details based on specific job type. + public partial class AsrJobDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrJobDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrJobDetailsInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetails __jobDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.JobDetails(); + + /// + /// The affected object properties like source server, source cloud, target server, target cloud etc. based on the workflow + /// object details. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsAffectedObjectDetails AffectedObjectDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsInternal)__jobDetails).AffectedObjectDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsInternal)__jobDetails).AffectedObjectDetail = value ?? null /* model class */; } + + /// Gets the type of job details (see JobDetailsTypes enum for possible values). + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsInternal)__jobDetails).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsInternal)__jobDetails).InstanceType = value ; } + + /// Creates an new instance. + public AsrJobDetails() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__jobDetails), __jobDetails); + await eventListener.AssertObjectIsValid(nameof(__jobDetails), __jobDetails); + } + } + /// This class represents job details based on specific job type. + public partial interface IAsrJobDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetails + { + + } + /// This class represents job details based on specific job type. + internal partial interface IAsrJobDetailsInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsInternal + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AsrJobDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AsrJobDetails.json.cs new file mode 100644 index 000000000000..bf4800da9a6a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AsrJobDetails.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// This class represents job details based on specific job type. + public partial class AsrJobDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal AsrJobDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __jobDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.JobDetails(json); + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrJobDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrJobDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrJobDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new AsrJobDetails(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __jobDetails?.ToJson(container, serializationMode); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AsrTask.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AsrTask.PowerShell.cs new file mode 100644 index 000000000000..d5bc6f82dea6 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AsrTask.PowerShell.cs @@ -0,0 +1,256 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Task of the Job. + [System.ComponentModel.TypeConverter(typeof(AsrTaskTypeConverter))] + public partial class AsrTask + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal AsrTask(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CustomDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTaskInternal)this).CustomDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITaskTypeDetails) content.GetValueForProperty("CustomDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTaskInternal)this).CustomDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.TaskTypeDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("GroupTaskCustomDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTaskInternal)this).GroupTaskCustomDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IGroupTaskDetails) content.GetValueForProperty("GroupTaskCustomDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTaskInternal)this).GroupTaskCustomDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.GroupTaskDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("TaskId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTaskInternal)this).TaskId = (string) content.GetValueForProperty("TaskId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTaskInternal)this).TaskId, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTaskInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTaskInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("StartTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTaskInternal)this).StartTime = (global::System.DateTime?) content.GetValueForProperty("StartTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTaskInternal)this).StartTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("EndTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTaskInternal)this).EndTime = (global::System.DateTime?) content.GetValueForProperty("EndTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTaskInternal)this).EndTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("AllowedAction")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTaskInternal)this).AllowedAction = (string[]) content.GetValueForProperty("AllowedAction",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTaskInternal)this).AllowedAction, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("FriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTaskInternal)this).FriendlyName = (string) content.GetValueForProperty("FriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTaskInternal)this).FriendlyName, global::System.Convert.ToString); + } + if (content.Contains("State")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTaskInternal)this).State = (string) content.GetValueForProperty("State",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTaskInternal)this).State, global::System.Convert.ToString); + } + if (content.Contains("StateDescription")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTaskInternal)this).StateDescription = (string) content.GetValueForProperty("StateDescription",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTaskInternal)this).StateDescription, global::System.Convert.ToString); + } + if (content.Contains("TaskType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTaskInternal)this).TaskType = (string) content.GetValueForProperty("TaskType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTaskInternal)this).TaskType, global::System.Convert.ToString); + } + if (content.Contains("Error")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTaskInternal)this).Error = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobErrorDetails[]) content.GetValueForProperty("Error",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTaskInternal)this).Error, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.JobErrorDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("CustomDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTaskInternal)this).CustomDetailInstanceType = (string) content.GetValueForProperty("CustomDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTaskInternal)this).CustomDetailInstanceType, global::System.Convert.ToString); + } + if (content.Contains("GroupTaskCustomDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTaskInternal)this).GroupTaskCustomDetailInstanceType = (string) content.GetValueForProperty("GroupTaskCustomDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTaskInternal)this).GroupTaskCustomDetailInstanceType, global::System.Convert.ToString); + } + if (content.Contains("GroupTaskCustomDetailChildTask")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTaskInternal)this).GroupTaskCustomDetailChildTask = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTask[]) content.GetValueForProperty("GroupTaskCustomDetailChildTask",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTaskInternal)this).GroupTaskCustomDetailChildTask, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AsrTaskTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal AsrTask(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CustomDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTaskInternal)this).CustomDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITaskTypeDetails) content.GetValueForProperty("CustomDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTaskInternal)this).CustomDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.TaskTypeDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("GroupTaskCustomDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTaskInternal)this).GroupTaskCustomDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IGroupTaskDetails) content.GetValueForProperty("GroupTaskCustomDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTaskInternal)this).GroupTaskCustomDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.GroupTaskDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("TaskId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTaskInternal)this).TaskId = (string) content.GetValueForProperty("TaskId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTaskInternal)this).TaskId, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTaskInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTaskInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("StartTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTaskInternal)this).StartTime = (global::System.DateTime?) content.GetValueForProperty("StartTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTaskInternal)this).StartTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("EndTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTaskInternal)this).EndTime = (global::System.DateTime?) content.GetValueForProperty("EndTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTaskInternal)this).EndTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("AllowedAction")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTaskInternal)this).AllowedAction = (string[]) content.GetValueForProperty("AllowedAction",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTaskInternal)this).AllowedAction, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("FriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTaskInternal)this).FriendlyName = (string) content.GetValueForProperty("FriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTaskInternal)this).FriendlyName, global::System.Convert.ToString); + } + if (content.Contains("State")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTaskInternal)this).State = (string) content.GetValueForProperty("State",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTaskInternal)this).State, global::System.Convert.ToString); + } + if (content.Contains("StateDescription")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTaskInternal)this).StateDescription = (string) content.GetValueForProperty("StateDescription",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTaskInternal)this).StateDescription, global::System.Convert.ToString); + } + if (content.Contains("TaskType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTaskInternal)this).TaskType = (string) content.GetValueForProperty("TaskType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTaskInternal)this).TaskType, global::System.Convert.ToString); + } + if (content.Contains("Error")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTaskInternal)this).Error = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobErrorDetails[]) content.GetValueForProperty("Error",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTaskInternal)this).Error, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.JobErrorDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("CustomDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTaskInternal)this).CustomDetailInstanceType = (string) content.GetValueForProperty("CustomDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTaskInternal)this).CustomDetailInstanceType, global::System.Convert.ToString); + } + if (content.Contains("GroupTaskCustomDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTaskInternal)this).GroupTaskCustomDetailInstanceType = (string) content.GetValueForProperty("GroupTaskCustomDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTaskInternal)this).GroupTaskCustomDetailInstanceType, global::System.Convert.ToString); + } + if (content.Contains("GroupTaskCustomDetailChildTask")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTaskInternal)this).GroupTaskCustomDetailChildTask = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTask[]) content.GetValueForProperty("GroupTaskCustomDetailChildTask",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTaskInternal)this).GroupTaskCustomDetailChildTask, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AsrTaskTypeConverter.ConvertFrom)); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTask DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new AsrTask(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTask DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new AsrTask(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTask FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Task of the Job. + [System.ComponentModel.TypeConverter(typeof(AsrTaskTypeConverter))] + public partial interface IAsrTask + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AsrTask.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AsrTask.TypeConverter.cs new file mode 100644 index 000000000000..caf5cf4ee024 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AsrTask.TypeConverter.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class AsrTaskTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTask ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTask).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return AsrTask.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return AsrTask.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return AsrTask.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AsrTask.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AsrTask.cs new file mode 100644 index 000000000000..51ebba1c96d7 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AsrTask.cs @@ -0,0 +1,291 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Task of the Job. + public partial class AsrTask : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTask, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTaskInternal + { + + /// Backing field for property. + private string[] _allowedAction; + + /// The state/actions applicable on this task. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string[] AllowedAction { get => this._allowedAction; set => this._allowedAction = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITaskTypeDetails _customDetail; + + /// The custom task details based on the task type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITaskTypeDetails CustomDetail { get => (this._customDetail = this._customDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.TaskTypeDetails()); set => this._customDetail = value; } + + /// The type of task details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string CustomDetailInstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITaskTypeDetailsInternal)CustomDetail).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITaskTypeDetailsInternal)CustomDetail).InstanceType = value ?? null; } + + /// Backing field for property. + private global::System.DateTime? _endTime; + + /// The end time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public global::System.DateTime? EndTime { get => this._endTime; set => this._endTime = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobErrorDetails[] _error; + + /// The task error details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobErrorDetails[] Error { get => this._error; set => this._error = value; } + + /// Backing field for property. + private string _friendlyName; + + /// The name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string FriendlyName { get => this._friendlyName; set => this._friendlyName = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IGroupTaskDetails _groupTaskCustomDetail; + + /// + /// The custom task details based on the task type, if the task type is GroupTaskDetails or one of the types derived from + /// it. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IGroupTaskDetails GroupTaskCustomDetail { get => (this._groupTaskCustomDetail = this._groupTaskCustomDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.GroupTaskDetails()); set => this._groupTaskCustomDetail = value; } + + /// The child tasks. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTask[] GroupTaskCustomDetailChildTask { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IGroupTaskDetailsInternal)GroupTaskCustomDetail).ChildTask; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IGroupTaskDetailsInternal)GroupTaskCustomDetail).ChildTask = value ?? null /* arrayOf */; } + + /// The type of task details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string GroupTaskCustomDetailInstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IGroupTaskDetailsInternal)GroupTaskCustomDetail).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IGroupTaskDetailsInternal)GroupTaskCustomDetail).InstanceType = value ?? null; } + + /// Internal Acessors for CustomDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITaskTypeDetails Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTaskInternal.CustomDetail { get => (this._customDetail = this._customDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.TaskTypeDetails()); set { {_customDetail = value;} } } + + /// Internal Acessors for GroupTaskCustomDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IGroupTaskDetails Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTaskInternal.GroupTaskCustomDetail { get => (this._groupTaskCustomDetail = this._groupTaskCustomDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.GroupTaskDetails()); set { {_groupTaskCustomDetail = value;} } } + + /// Backing field for property. + private string _name; + + /// The unique Task name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Name { get => this._name; set => this._name = value; } + + /// Backing field for property. + private global::System.DateTime? _startTime; + + /// The start time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public global::System.DateTime? StartTime { get => this._startTime; set => this._startTime = value; } + + /// Backing field for property. + private string _state; + + /// + /// The State. It is one of these values - NotStarted, InProgress, Succeeded, Failed, Cancelled, Suspended or Other. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string State { get => this._state; set => this._state = value; } + + /// Backing field for property. + private string _stateDescription; + + /// + /// The description of the task state. For example - For Succeeded state, description can be Completed, PartiallySucceeded, + /// CompletedWithInformation or Skipped. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string StateDescription { get => this._stateDescription; set => this._stateDescription = value; } + + /// Backing field for property. + private string _taskId; + + /// The Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TaskId { get => this._taskId; set => this._taskId = value; } + + /// Backing field for property. + private string _taskType; + + /// The type of task. Details in CustomDetails property depend on this type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TaskType { get => this._taskType; set => this._taskType = value; } + + /// Creates an new instance. + public AsrTask() + { + + } + } + /// Task of the Job. + public partial interface IAsrTask : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The state/actions applicable on this task. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The state/actions applicable on this task.", + SerializedName = @"allowedActions", + PossibleTypes = new [] { typeof(string) })] + string[] AllowedAction { get; set; } + /// The type of task details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The type of task details.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string CustomDetailInstanceType { get; set; } + /// The end time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The end time.", + SerializedName = @"endTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? EndTime { get; set; } + /// The task error details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The task error details.", + SerializedName = @"errors", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobErrorDetails) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobErrorDetails[] Error { get; set; } + /// The name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name.", + SerializedName = @"friendlyName", + PossibleTypes = new [] { typeof(string) })] + string FriendlyName { get; set; } + /// The child tasks. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The child tasks.", + SerializedName = @"childTasks", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTask) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTask[] GroupTaskCustomDetailChildTask { get; set; } + /// The type of task details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The type of task details.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string GroupTaskCustomDetailInstanceType { get; set; } + /// The unique Task name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The unique Task name.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string Name { get; set; } + /// The start time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The start time.", + SerializedName = @"startTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? StartTime { get; set; } + /// + /// The State. It is one of these values - NotStarted, InProgress, Succeeded, Failed, Cancelled, Suspended or Other. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The State. It is one of these values - NotStarted, InProgress, Succeeded, Failed, Cancelled, Suspended or Other.", + SerializedName = @"state", + PossibleTypes = new [] { typeof(string) })] + string State { get; set; } + /// + /// The description of the task state. For example - For Succeeded state, description can be Completed, PartiallySucceeded, + /// CompletedWithInformation or Skipped. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The description of the task state. For example - For Succeeded state, description can be Completed, PartiallySucceeded, CompletedWithInformation or Skipped.", + SerializedName = @"stateDescription", + PossibleTypes = new [] { typeof(string) })] + string StateDescription { get; set; } + /// The Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Id.", + SerializedName = @"taskId", + PossibleTypes = new [] { typeof(string) })] + string TaskId { get; set; } + /// The type of task. Details in CustomDetails property depend on this type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The type of task. Details in CustomDetails property depend on this type.", + SerializedName = @"taskType", + PossibleTypes = new [] { typeof(string) })] + string TaskType { get; set; } + + } + /// Task of the Job. + internal partial interface IAsrTaskInternal + + { + /// The state/actions applicable on this task. + string[] AllowedAction { get; set; } + /// The custom task details based on the task type. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITaskTypeDetails CustomDetail { get; set; } + /// The type of task details. + string CustomDetailInstanceType { get; set; } + /// The end time. + global::System.DateTime? EndTime { get; set; } + /// The task error details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobErrorDetails[] Error { get; set; } + /// The name. + string FriendlyName { get; set; } + /// + /// The custom task details based on the task type, if the task type is GroupTaskDetails or one of the types derived from + /// it. + /// + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IGroupTaskDetails GroupTaskCustomDetail { get; set; } + /// The child tasks. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTask[] GroupTaskCustomDetailChildTask { get; set; } + /// The type of task details. + string GroupTaskCustomDetailInstanceType { get; set; } + /// The unique Task name. + string Name { get; set; } + /// The start time. + global::System.DateTime? StartTime { get; set; } + /// + /// The State. It is one of these values - NotStarted, InProgress, Succeeded, Failed, Cancelled, Suspended or Other. + /// + string State { get; set; } + /// + /// The description of the task state. For example - For Succeeded state, description can be Completed, PartiallySucceeded, + /// CompletedWithInformation or Skipped. + /// + string StateDescription { get; set; } + /// The Id. + string TaskId { get; set; } + /// The type of task. Details in CustomDetails property depend on this type. + string TaskType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AsrTask.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AsrTask.json.cs new file mode 100644 index 000000000000..00e76693273f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AsrTask.json.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Task of the Job. + public partial class AsrTask + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal AsrTask(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_customDetail = If( json?.PropertyT("customDetails"), out var __jsonCustomDetails) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.TaskTypeDetails.FromJson(__jsonCustomDetails) : CustomDetail;} + {_groupTaskCustomDetail = If( json?.PropertyT("groupTaskCustomDetails"), out var __jsonGroupTaskCustomDetails) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.GroupTaskDetails.FromJson(__jsonGroupTaskCustomDetails) : GroupTaskCustomDetail;} + {_taskId = If( json?.PropertyT("taskId"), out var __jsonTaskId) ? (string)__jsonTaskId : (string)TaskId;} + {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)Name;} + {_startTime = If( json?.PropertyT("startTime"), out var __jsonStartTime) ? global::System.DateTime.TryParse((string)__jsonStartTime, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonStartTimeValue) ? __jsonStartTimeValue : StartTime : StartTime;} + {_endTime = If( json?.PropertyT("endTime"), out var __jsonEndTime) ? global::System.DateTime.TryParse((string)__jsonEndTime, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonEndTimeValue) ? __jsonEndTimeValue : EndTime : EndTime;} + {_allowedAction = If( json?.PropertyT("allowedActions"), out var __jsonAllowedActions) ? If( __jsonAllowedActions as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(string) (__u is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : AllowedAction;} + {_friendlyName = If( json?.PropertyT("friendlyName"), out var __jsonFriendlyName) ? (string)__jsonFriendlyName : (string)FriendlyName;} + {_state = If( json?.PropertyT("state"), out var __jsonState) ? (string)__jsonState : (string)State;} + {_stateDescription = If( json?.PropertyT("stateDescription"), out var __jsonStateDescription) ? (string)__jsonStateDescription : (string)StateDescription;} + {_taskType = If( json?.PropertyT("taskType"), out var __jsonTaskType) ? (string)__jsonTaskType : (string)TaskType;} + {_error = If( json?.PropertyT("errors"), out var __jsonErrors) ? If( __jsonErrors as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __q) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__q, (__p)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobErrorDetails) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.JobErrorDetails.FromJson(__p) )) ))() : null : Error;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTask. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTask. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTask FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new AsrTask(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._customDetail ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._customDetail.ToJson(null,serializationMode) : null, "customDetails" ,container.Add ); + AddIf( null != this._groupTaskCustomDetail ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._groupTaskCustomDetail.ToJson(null,serializationMode) : null, "groupTaskCustomDetails" ,container.Add ); + AddIf( null != (((object)this._taskId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._taskId.ToString()) : null, "taskId" ,container.Add ); + AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); + AddIf( null != this._startTime ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._startTime?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "startTime" ,container.Add ); + AddIf( null != this._endTime ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._endTime?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "endTime" ,container.Add ); + if (null != this._allowedAction) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._allowedAction ) + { + AddIf(null != (((object)__x)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(__x.ToString()) : null ,__w.Add); + } + container.Add("allowedActions",__w); + } + AddIf( null != (((object)this._friendlyName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._friendlyName.ToString()) : null, "friendlyName" ,container.Add ); + AddIf( null != (((object)this._state)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._state.ToString()) : null, "state" ,container.Add ); + AddIf( null != (((object)this._stateDescription)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._stateDescription.ToString()) : null, "stateDescription" ,container.Add ); + AddIf( null != (((object)this._taskType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._taskType.ToString()) : null, "taskType" ,container.Add ); + if (null != this._error) + { + var __r = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __s in this._error ) + { + AddIf(__s?.ToJson(null, serializationMode) ,__r.Add); + } + container.Add("errors",__r); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AutomationRunbookTaskDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AutomationRunbookTaskDetails.PowerShell.cs new file mode 100644 index 000000000000..79437677c4ab --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AutomationRunbookTaskDetails.PowerShell.cs @@ -0,0 +1,218 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// This class represents the task details for an automation runbook. + [System.ComponentModel.TypeConverter(typeof(AutomationRunbookTaskDetailsTypeConverter))] + public partial class AutomationRunbookTaskDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal AutomationRunbookTaskDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAutomationRunbookTaskDetailsInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAutomationRunbookTaskDetailsInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("CloudServiceName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAutomationRunbookTaskDetailsInternal)this).CloudServiceName = (string) content.GetValueForProperty("CloudServiceName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAutomationRunbookTaskDetailsInternal)this).CloudServiceName, global::System.Convert.ToString); + } + if (content.Contains("SubscriptionId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAutomationRunbookTaskDetailsInternal)this).SubscriptionId = (string) content.GetValueForProperty("SubscriptionId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAutomationRunbookTaskDetailsInternal)this).SubscriptionId, global::System.Convert.ToString); + } + if (content.Contains("AccountName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAutomationRunbookTaskDetailsInternal)this).AccountName = (string) content.GetValueForProperty("AccountName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAutomationRunbookTaskDetailsInternal)this).AccountName, global::System.Convert.ToString); + } + if (content.Contains("RunbookId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAutomationRunbookTaskDetailsInternal)this).RunbookId = (string) content.GetValueForProperty("RunbookId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAutomationRunbookTaskDetailsInternal)this).RunbookId, global::System.Convert.ToString); + } + if (content.Contains("RunbookName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAutomationRunbookTaskDetailsInternal)this).RunbookName = (string) content.GetValueForProperty("RunbookName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAutomationRunbookTaskDetailsInternal)this).RunbookName, global::System.Convert.ToString); + } + if (content.Contains("JobId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAutomationRunbookTaskDetailsInternal)this).JobId = (string) content.GetValueForProperty("JobId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAutomationRunbookTaskDetailsInternal)this).JobId, global::System.Convert.ToString); + } + if (content.Contains("JobOutput")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAutomationRunbookTaskDetailsInternal)this).JobOutput = (string) content.GetValueForProperty("JobOutput",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAutomationRunbookTaskDetailsInternal)this).JobOutput, global::System.Convert.ToString); + } + if (content.Contains("IsPrimarySideScript")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAutomationRunbookTaskDetailsInternal)this).IsPrimarySideScript = (bool?) content.GetValueForProperty("IsPrimarySideScript",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAutomationRunbookTaskDetailsInternal)this).IsPrimarySideScript, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITaskTypeDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITaskTypeDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal AutomationRunbookTaskDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAutomationRunbookTaskDetailsInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAutomationRunbookTaskDetailsInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("CloudServiceName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAutomationRunbookTaskDetailsInternal)this).CloudServiceName = (string) content.GetValueForProperty("CloudServiceName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAutomationRunbookTaskDetailsInternal)this).CloudServiceName, global::System.Convert.ToString); + } + if (content.Contains("SubscriptionId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAutomationRunbookTaskDetailsInternal)this).SubscriptionId = (string) content.GetValueForProperty("SubscriptionId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAutomationRunbookTaskDetailsInternal)this).SubscriptionId, global::System.Convert.ToString); + } + if (content.Contains("AccountName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAutomationRunbookTaskDetailsInternal)this).AccountName = (string) content.GetValueForProperty("AccountName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAutomationRunbookTaskDetailsInternal)this).AccountName, global::System.Convert.ToString); + } + if (content.Contains("RunbookId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAutomationRunbookTaskDetailsInternal)this).RunbookId = (string) content.GetValueForProperty("RunbookId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAutomationRunbookTaskDetailsInternal)this).RunbookId, global::System.Convert.ToString); + } + if (content.Contains("RunbookName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAutomationRunbookTaskDetailsInternal)this).RunbookName = (string) content.GetValueForProperty("RunbookName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAutomationRunbookTaskDetailsInternal)this).RunbookName, global::System.Convert.ToString); + } + if (content.Contains("JobId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAutomationRunbookTaskDetailsInternal)this).JobId = (string) content.GetValueForProperty("JobId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAutomationRunbookTaskDetailsInternal)this).JobId, global::System.Convert.ToString); + } + if (content.Contains("JobOutput")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAutomationRunbookTaskDetailsInternal)this).JobOutput = (string) content.GetValueForProperty("JobOutput",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAutomationRunbookTaskDetailsInternal)this).JobOutput, global::System.Convert.ToString); + } + if (content.Contains("IsPrimarySideScript")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAutomationRunbookTaskDetailsInternal)this).IsPrimarySideScript = (bool?) content.GetValueForProperty("IsPrimarySideScript",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAutomationRunbookTaskDetailsInternal)this).IsPrimarySideScript, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITaskTypeDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITaskTypeDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAutomationRunbookTaskDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new AutomationRunbookTaskDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAutomationRunbookTaskDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new AutomationRunbookTaskDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAutomationRunbookTaskDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// This class represents the task details for an automation runbook. + [System.ComponentModel.TypeConverter(typeof(AutomationRunbookTaskDetailsTypeConverter))] + public partial interface IAutomationRunbookTaskDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AutomationRunbookTaskDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AutomationRunbookTaskDetails.TypeConverter.cs new file mode 100644 index 000000000000..d96ec7e5888c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AutomationRunbookTaskDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class AutomationRunbookTaskDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAutomationRunbookTaskDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAutomationRunbookTaskDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return AutomationRunbookTaskDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return AutomationRunbookTaskDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return AutomationRunbookTaskDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AutomationRunbookTaskDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AutomationRunbookTaskDetails.cs new file mode 100644 index 000000000000..820af76ffdcc --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AutomationRunbookTaskDetails.cs @@ -0,0 +1,210 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// This class represents the task details for an automation runbook. + public partial class AutomationRunbookTaskDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAutomationRunbookTaskDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAutomationRunbookTaskDetailsInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITaskTypeDetails __taskTypeDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.TaskTypeDetails(); + + /// Backing field for property. + private string _accountName; + + /// The automation account name of the runbook. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string AccountName { get => this._accountName; set => this._accountName = value; } + + /// Backing field for property. + private string _cloudServiceName; + + /// The cloud service of the automation runbook account. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string CloudServiceName { get => this._cloudServiceName; set => this._cloudServiceName = value; } + + /// The type of task details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITaskTypeDetailsInternal)__taskTypeDetails).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITaskTypeDetailsInternal)__taskTypeDetails).InstanceType = value ; } + + /// Backing field for property. + private bool? _isPrimarySideScript; + + /// A value indicating whether it is a primary side script or not. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public bool? IsPrimarySideScript { get => this._isPrimarySideScript; set => this._isPrimarySideScript = value; } + + /// Backing field for property. + private string _jobId; + + /// The job Id of the runbook execution. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string JobId { get => this._jobId; set => this._jobId = value; } + + /// Backing field for property. + private string _jobOutput; + + /// The execution output of the runbook. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string JobOutput { get => this._jobOutput; set => this._jobOutput = value; } + + /// Backing field for property. + private string _name; + + /// The recovery plan task name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Name { get => this._name; set => this._name = value; } + + /// Backing field for property. + private string _runbookId; + + /// The runbook Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RunbookId { get => this._runbookId; set => this._runbookId = value; } + + /// Backing field for property. + private string _runbookName; + + /// The runbook name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RunbookName { get => this._runbookName; set => this._runbookName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id of the automation runbook account. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Creates an new instance. + public AutomationRunbookTaskDetails() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__taskTypeDetails), __taskTypeDetails); + await eventListener.AssertObjectIsValid(nameof(__taskTypeDetails), __taskTypeDetails); + } + } + /// This class represents the task details for an automation runbook. + public partial interface IAutomationRunbookTaskDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITaskTypeDetails + { + /// The automation account name of the runbook. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The automation account name of the runbook.", + SerializedName = @"accountName", + PossibleTypes = new [] { typeof(string) })] + string AccountName { get; set; } + /// The cloud service of the automation runbook account. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The cloud service of the automation runbook account.", + SerializedName = @"cloudServiceName", + PossibleTypes = new [] { typeof(string) })] + string CloudServiceName { get; set; } + /// A value indicating whether it is a primary side script or not. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether it is a primary side script or not.", + SerializedName = @"isPrimarySideScript", + PossibleTypes = new [] { typeof(bool) })] + bool? IsPrimarySideScript { get; set; } + /// The job Id of the runbook execution. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The job Id of the runbook execution.", + SerializedName = @"jobId", + PossibleTypes = new [] { typeof(string) })] + string JobId { get; set; } + /// The execution output of the runbook. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The execution output of the runbook.", + SerializedName = @"jobOutput", + PossibleTypes = new [] { typeof(string) })] + string JobOutput { get; set; } + /// The recovery plan task name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery plan task name.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string Name { get; set; } + /// The runbook Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The runbook Id.", + SerializedName = @"runbookId", + PossibleTypes = new [] { typeof(string) })] + string RunbookId { get; set; } + /// The runbook name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The runbook name.", + SerializedName = @"runbookName", + PossibleTypes = new [] { typeof(string) })] + string RunbookName { get; set; } + /// The subscription Id of the automation runbook account. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The subscription Id of the automation runbook account.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + string SubscriptionId { get; set; } + + } + /// This class represents the task details for an automation runbook. + internal partial interface IAutomationRunbookTaskDetailsInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITaskTypeDetailsInternal + { + /// The automation account name of the runbook. + string AccountName { get; set; } + /// The cloud service of the automation runbook account. + string CloudServiceName { get; set; } + /// A value indicating whether it is a primary side script or not. + bool? IsPrimarySideScript { get; set; } + /// The job Id of the runbook execution. + string JobId { get; set; } + /// The execution output of the runbook. + string JobOutput { get; set; } + /// The recovery plan task name. + string Name { get; set; } + /// The runbook Id. + string RunbookId { get; set; } + /// The runbook name. + string RunbookName { get; set; } + /// The subscription Id of the automation runbook account. + string SubscriptionId { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AutomationRunbookTaskDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AutomationRunbookTaskDetails.json.cs new file mode 100644 index 000000000000..d9d0844af263 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AutomationRunbookTaskDetails.json.cs @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// This class represents the task details for an automation runbook. + public partial class AutomationRunbookTaskDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal AutomationRunbookTaskDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __taskTypeDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.TaskTypeDetails(json); + {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)Name;} + {_cloudServiceName = If( json?.PropertyT("cloudServiceName"), out var __jsonCloudServiceName) ? (string)__jsonCloudServiceName : (string)CloudServiceName;} + {_subscriptionId = If( json?.PropertyT("subscriptionId"), out var __jsonSubscriptionId) ? (string)__jsonSubscriptionId : (string)SubscriptionId;} + {_accountName = If( json?.PropertyT("accountName"), out var __jsonAccountName) ? (string)__jsonAccountName : (string)AccountName;} + {_runbookId = If( json?.PropertyT("runbookId"), out var __jsonRunbookId) ? (string)__jsonRunbookId : (string)RunbookId;} + {_runbookName = If( json?.PropertyT("runbookName"), out var __jsonRunbookName) ? (string)__jsonRunbookName : (string)RunbookName;} + {_jobId = If( json?.PropertyT("jobId"), out var __jsonJobId) ? (string)__jsonJobId : (string)JobId;} + {_jobOutput = If( json?.PropertyT("jobOutput"), out var __jsonJobOutput) ? (string)__jsonJobOutput : (string)JobOutput;} + {_isPrimarySideScript = If( json?.PropertyT("isPrimarySideScript"), out var __jsonIsPrimarySideScript) ? (bool?)__jsonIsPrimarySideScript : IsPrimarySideScript;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAutomationRunbookTaskDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAutomationRunbookTaskDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAutomationRunbookTaskDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new AutomationRunbookTaskDetails(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __taskTypeDetails?.ToJson(container, serializationMode); + AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); + AddIf( null != (((object)this._cloudServiceName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._cloudServiceName.ToString()) : null, "cloudServiceName" ,container.Add ); + AddIf( null != (((object)this._subscriptionId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._subscriptionId.ToString()) : null, "subscriptionId" ,container.Add ); + AddIf( null != (((object)this._accountName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._accountName.ToString()) : null, "accountName" ,container.Add ); + AddIf( null != (((object)this._runbookId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._runbookId.ToString()) : null, "runbookId" ,container.Add ); + AddIf( null != (((object)this._runbookName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._runbookName.ToString()) : null, "runbookName" ,container.Add ); + AddIf( null != (((object)this._jobId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._jobId.ToString()) : null, "jobId" ,container.Add ); + AddIf( null != (((object)this._jobOutput)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._jobOutput.ToString()) : null, "jobOutput" ,container.Add ); + AddIf( null != this._isPrimarySideScript ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonBoolean((bool)this._isPrimarySideScript) : null, "isPrimarySideScript" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AzureFabricCreationInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AzureFabricCreationInput.PowerShell.cs new file mode 100644 index 000000000000..58a3fc92bb35 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AzureFabricCreationInput.PowerShell.cs @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Fabric provider specific settings. + [System.ComponentModel.TypeConverter(typeof(AzureFabricCreationInputTypeConverter))] + public partial class AzureFabricCreationInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal AzureFabricCreationInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureFabricCreationInputInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureFabricCreationInputInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreationInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreationInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal AzureFabricCreationInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureFabricCreationInputInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureFabricCreationInputInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreationInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreationInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureFabricCreationInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new AzureFabricCreationInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureFabricCreationInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new AzureFabricCreationInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureFabricCreationInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Fabric provider specific settings. + [System.ComponentModel.TypeConverter(typeof(AzureFabricCreationInputTypeConverter))] + public partial interface IAzureFabricCreationInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AzureFabricCreationInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AzureFabricCreationInput.TypeConverter.cs new file mode 100644 index 000000000000..48479604c53a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AzureFabricCreationInput.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class AzureFabricCreationInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureFabricCreationInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureFabricCreationInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return AzureFabricCreationInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return AzureFabricCreationInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return AzureFabricCreationInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AzureFabricCreationInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AzureFabricCreationInput.cs new file mode 100644 index 000000000000..55c5016199dd --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AzureFabricCreationInput.cs @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Fabric provider specific settings. + public partial class AzureFabricCreationInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureFabricCreationInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureFabricCreationInputInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreationInput __fabricSpecificCreationInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FabricSpecificCreationInput(); + + /// Gets the class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreationInputInternal)__fabricSpecificCreationInput).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreationInputInternal)__fabricSpecificCreationInput).InstanceType = value ; } + + /// Backing field for property. + private string _location; + + /// The Location. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Location { get => this._location; set => this._location = value; } + + /// Creates an new instance. + public AzureFabricCreationInput() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__fabricSpecificCreationInput), __fabricSpecificCreationInput); + await eventListener.AssertObjectIsValid(nameof(__fabricSpecificCreationInput), __fabricSpecificCreationInput); + } + } + /// Fabric provider specific settings. + public partial interface IAzureFabricCreationInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreationInput + { + /// The Location. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Location.", + SerializedName = @"location", + PossibleTypes = new [] { typeof(string) })] + string Location { get; set; } + + } + /// Fabric provider specific settings. + internal partial interface IAzureFabricCreationInputInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreationInputInternal + { + /// The Location. + string Location { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AzureFabricCreationInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AzureFabricCreationInput.json.cs new file mode 100644 index 000000000000..595bb1af072d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AzureFabricCreationInput.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Fabric provider specific settings. + public partial class AzureFabricCreationInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal AzureFabricCreationInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __fabricSpecificCreationInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FabricSpecificCreationInput(json); + {_location = If( json?.PropertyT("location"), out var __jsonLocation) ? (string)__jsonLocation : (string)Location;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureFabricCreationInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureFabricCreationInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureFabricCreationInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new AzureFabricCreationInput(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __fabricSpecificCreationInput?.ToJson(container, serializationMode); + AddIf( null != (((object)this._location)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._location.ToString()) : null, "location" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AzureFabricSpecificDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AzureFabricSpecificDetails.PowerShell.cs new file mode 100644 index 000000000000..7b0c4e136484 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AzureFabricSpecificDetails.PowerShell.cs @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Azure Fabric Specific Details. + [System.ComponentModel.TypeConverter(typeof(AzureFabricSpecificDetailsTypeConverter))] + public partial class AzureFabricSpecificDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal AzureFabricSpecificDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureFabricSpecificDetailsInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureFabricSpecificDetailsInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("ContainerId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureFabricSpecificDetailsInternal)this).ContainerId = (string[]) content.GetValueForProperty("ContainerId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureFabricSpecificDetailsInternal)this).ContainerId, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("Zone")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureFabricSpecificDetailsInternal)this).Zone = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AZoneDetails[]) content.GetValueForProperty("Zone",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureFabricSpecificDetailsInternal)this).Zone, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2AZoneDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("ExtendedLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureFabricSpecificDetailsInternal)this).ExtendedLocation = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AExtendedLocationDetails[]) content.GetValueForProperty("ExtendedLocation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureFabricSpecificDetailsInternal)this).ExtendedLocation, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2AExtendedLocationDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal AzureFabricSpecificDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureFabricSpecificDetailsInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureFabricSpecificDetailsInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("ContainerId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureFabricSpecificDetailsInternal)this).ContainerId = (string[]) content.GetValueForProperty("ContainerId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureFabricSpecificDetailsInternal)this).ContainerId, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("Zone")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureFabricSpecificDetailsInternal)this).Zone = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AZoneDetails[]) content.GetValueForProperty("Zone",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureFabricSpecificDetailsInternal)this).Zone, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2AZoneDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("ExtendedLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureFabricSpecificDetailsInternal)this).ExtendedLocation = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AExtendedLocationDetails[]) content.GetValueForProperty("ExtendedLocation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureFabricSpecificDetailsInternal)this).ExtendedLocation, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2AExtendedLocationDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureFabricSpecificDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new AzureFabricSpecificDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureFabricSpecificDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new AzureFabricSpecificDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureFabricSpecificDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Azure Fabric Specific Details. + [System.ComponentModel.TypeConverter(typeof(AzureFabricSpecificDetailsTypeConverter))] + public partial interface IAzureFabricSpecificDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AzureFabricSpecificDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AzureFabricSpecificDetails.TypeConverter.cs new file mode 100644 index 000000000000..cc3af36f693d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AzureFabricSpecificDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class AzureFabricSpecificDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureFabricSpecificDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureFabricSpecificDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return AzureFabricSpecificDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return AzureFabricSpecificDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return AzureFabricSpecificDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AzureFabricSpecificDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AzureFabricSpecificDetails.cs new file mode 100644 index 000000000000..07311366a9d5 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AzureFabricSpecificDetails.cs @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Azure Fabric Specific Details. + public partial class AzureFabricSpecificDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureFabricSpecificDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureFabricSpecificDetailsInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificDetails __fabricSpecificDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FabricSpecificDetails(); + + /// Backing field for property. + private string[] _containerId; + + /// The container Ids for the Azure fabric. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string[] ContainerId { get => this._containerId; set => this._containerId = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AExtendedLocationDetails[] _extendedLocation; + + /// The ExtendedLocations. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AExtendedLocationDetails[] ExtendedLocation { get => this._extendedLocation; set => this._extendedLocation = value; } + + /// Gets the class type. Overridden in derived classes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificDetailsInternal)__fabricSpecificDetails).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificDetailsInternal)__fabricSpecificDetails).InstanceType = value ; } + + /// Backing field for property. + private string _location; + + /// The Location for the Azure fabric. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Location { get => this._location; set => this._location = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AZoneDetails[] _zone; + + /// The zones. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AZoneDetails[] Zone { get => this._zone; set => this._zone = value; } + + /// Creates an new instance. + public AzureFabricSpecificDetails() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__fabricSpecificDetails), __fabricSpecificDetails); + await eventListener.AssertObjectIsValid(nameof(__fabricSpecificDetails), __fabricSpecificDetails); + } + } + /// Azure Fabric Specific Details. + public partial interface IAzureFabricSpecificDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificDetails + { + /// The container Ids for the Azure fabric. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The container Ids for the Azure fabric.", + SerializedName = @"containerIds", + PossibleTypes = new [] { typeof(string) })] + string[] ContainerId { get; set; } + /// The ExtendedLocations. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The ExtendedLocations.", + SerializedName = @"extendedLocations", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AExtendedLocationDetails) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AExtendedLocationDetails[] ExtendedLocation { get; set; } + /// The Location for the Azure fabric. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Location for the Azure fabric.", + SerializedName = @"location", + PossibleTypes = new [] { typeof(string) })] + string Location { get; set; } + /// The zones. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The zones.", + SerializedName = @"zones", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AZoneDetails) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AZoneDetails[] Zone { get; set; } + + } + /// Azure Fabric Specific Details. + internal partial interface IAzureFabricSpecificDetailsInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificDetailsInternal + { + /// The container Ids for the Azure fabric. + string[] ContainerId { get; set; } + /// The ExtendedLocations. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AExtendedLocationDetails[] ExtendedLocation { get; set; } + /// The Location for the Azure fabric. + string Location { get; set; } + /// The zones. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AZoneDetails[] Zone { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AzureFabricSpecificDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AzureFabricSpecificDetails.json.cs new file mode 100644 index 000000000000..c2e5eac00971 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AzureFabricSpecificDetails.json.cs @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Azure Fabric Specific Details. + public partial class AzureFabricSpecificDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal AzureFabricSpecificDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __fabricSpecificDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FabricSpecificDetails(json); + {_location = If( json?.PropertyT("location"), out var __jsonLocation) ? (string)__jsonLocation : (string)Location;} + {_containerId = If( json?.PropertyT("containerIds"), out var __jsonContainerIds) ? If( __jsonContainerIds as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(string) (__u is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : ContainerId;} + {_zone = If( json?.PropertyT("zones"), out var __jsonZones) ? If( __jsonZones as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __q) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__q, (__p)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AZoneDetails) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2AZoneDetails.FromJson(__p) )) ))() : null : Zone;} + {_extendedLocation = If( json?.PropertyT("extendedLocations"), out var __jsonExtendedLocations) ? If( __jsonExtendedLocations as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __l) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__l, (__k)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IA2AExtendedLocationDetails) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.A2AExtendedLocationDetails.FromJson(__k) )) ))() : null : ExtendedLocation;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureFabricSpecificDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureFabricSpecificDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureFabricSpecificDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new AzureFabricSpecificDetails(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __fabricSpecificDetails?.ToJson(container, serializationMode); + AddIf( null != (((object)this._location)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._location.ToString()) : null, "location" ,container.Add ); + if (null != this._containerId) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._containerId ) + { + AddIf(null != (((object)__x)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(__x.ToString()) : null ,__w.Add); + } + container.Add("containerIds",__w); + } + if (null != this._zone) + { + var __r = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __s in this._zone ) + { + AddIf(__s?.ToJson(null, serializationMode) ,__r.Add); + } + container.Add("zones",__r); + } + if (null != this._extendedLocation) + { + var __m = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __n in this._extendedLocation ) + { + AddIf(__n?.ToJson(null, serializationMode) ,__m.Add); + } + container.Add("extendedLocations",__m); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AzureToAzureCreateNetworkMappingInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AzureToAzureCreateNetworkMappingInput.PowerShell.cs new file mode 100644 index 000000000000..551ceeb48376 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AzureToAzureCreateNetworkMappingInput.PowerShell.cs @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// Create network mappings input properties/behavior specific to Azure to Azure Network mapping. + /// + [System.ComponentModel.TypeConverter(typeof(AzureToAzureCreateNetworkMappingInputTypeConverter))] + public partial class AzureToAzureCreateNetworkMappingInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal AzureToAzureCreateNetworkMappingInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("PrimaryNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureToAzureCreateNetworkMappingInputInternal)this).PrimaryNetworkId = (string) content.GetValueForProperty("PrimaryNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureToAzureCreateNetworkMappingInputInternal)this).PrimaryNetworkId, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreateNetworkMappingInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreateNetworkMappingInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal AzureToAzureCreateNetworkMappingInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("PrimaryNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureToAzureCreateNetworkMappingInputInternal)this).PrimaryNetworkId = (string) content.GetValueForProperty("PrimaryNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureToAzureCreateNetworkMappingInputInternal)this).PrimaryNetworkId, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreateNetworkMappingInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreateNetworkMappingInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureToAzureCreateNetworkMappingInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new AzureToAzureCreateNetworkMappingInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureToAzureCreateNetworkMappingInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new AzureToAzureCreateNetworkMappingInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json + /// string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureToAzureCreateNetworkMappingInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Create network mappings input properties/behavior specific to Azure to Azure Network mapping. + [System.ComponentModel.TypeConverter(typeof(AzureToAzureCreateNetworkMappingInputTypeConverter))] + public partial interface IAzureToAzureCreateNetworkMappingInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AzureToAzureCreateNetworkMappingInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AzureToAzureCreateNetworkMappingInput.TypeConverter.cs new file mode 100644 index 000000000000..8e29320ce1cc --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AzureToAzureCreateNetworkMappingInput.TypeConverter.cs @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class AzureToAzureCreateNetworkMappingInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureToAzureCreateNetworkMappingInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureToAzureCreateNetworkMappingInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return AzureToAzureCreateNetworkMappingInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return AzureToAzureCreateNetworkMappingInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return AzureToAzureCreateNetworkMappingInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AzureToAzureCreateNetworkMappingInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AzureToAzureCreateNetworkMappingInput.cs new file mode 100644 index 000000000000..90d4e4f446b3 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AzureToAzureCreateNetworkMappingInput.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// + /// Create network mappings input properties/behavior specific to Azure to Azure Network mapping. + /// + public partial class AzureToAzureCreateNetworkMappingInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureToAzureCreateNetworkMappingInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureToAzureCreateNetworkMappingInputInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreateNetworkMappingInput __fabricSpecificCreateNetworkMappingInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FabricSpecificCreateNetworkMappingInput(); + + /// The instance type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreateNetworkMappingInputInternal)__fabricSpecificCreateNetworkMappingInput).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreateNetworkMappingInputInternal)__fabricSpecificCreateNetworkMappingInput).InstanceType = value ; } + + /// Backing field for property. + private string _primaryNetworkId; + + /// The primary azure vnet Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string PrimaryNetworkId { get => this._primaryNetworkId; set => this._primaryNetworkId = value; } + + /// Creates an new instance. + public AzureToAzureCreateNetworkMappingInput() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__fabricSpecificCreateNetworkMappingInput), __fabricSpecificCreateNetworkMappingInput); + await eventListener.AssertObjectIsValid(nameof(__fabricSpecificCreateNetworkMappingInput), __fabricSpecificCreateNetworkMappingInput); + } + } + /// Create network mappings input properties/behavior specific to Azure to Azure Network mapping. + public partial interface IAzureToAzureCreateNetworkMappingInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreateNetworkMappingInput + { + /// The primary azure vnet Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The primary azure vnet Id.", + SerializedName = @"primaryNetworkId", + PossibleTypes = new [] { typeof(string) })] + string PrimaryNetworkId { get; set; } + + } + /// Create network mappings input properties/behavior specific to Azure to Azure Network mapping. + internal partial interface IAzureToAzureCreateNetworkMappingInputInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreateNetworkMappingInputInternal + { + /// The primary azure vnet Id. + string PrimaryNetworkId { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AzureToAzureCreateNetworkMappingInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AzureToAzureCreateNetworkMappingInput.json.cs new file mode 100644 index 000000000000..de16a3dee9bd --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AzureToAzureCreateNetworkMappingInput.json.cs @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// + /// Create network mappings input properties/behavior specific to Azure to Azure Network mapping. + /// + public partial class AzureToAzureCreateNetworkMappingInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal AzureToAzureCreateNetworkMappingInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __fabricSpecificCreateNetworkMappingInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FabricSpecificCreateNetworkMappingInput(json); + {_primaryNetworkId = If( json?.PropertyT("primaryNetworkId"), out var __jsonPrimaryNetworkId) ? (string)__jsonPrimaryNetworkId : (string)PrimaryNetworkId;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureToAzureCreateNetworkMappingInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureToAzureCreateNetworkMappingInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureToAzureCreateNetworkMappingInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new AzureToAzureCreateNetworkMappingInput(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __fabricSpecificCreateNetworkMappingInput?.ToJson(container, serializationMode); + AddIf( null != (((object)this._primaryNetworkId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._primaryNetworkId.ToString()) : null, "primaryNetworkId" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AzureToAzureNetworkMappingSettings.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AzureToAzureNetworkMappingSettings.PowerShell.cs new file mode 100644 index 000000000000..acf75867b9f9 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AzureToAzureNetworkMappingSettings.PowerShell.cs @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// A2A Network Mapping fabric specific settings. + [System.ComponentModel.TypeConverter(typeof(AzureToAzureNetworkMappingSettingsTypeConverter))] + public partial class AzureToAzureNetworkMappingSettings + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal AzureToAzureNetworkMappingSettings(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("PrimaryFabricLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureToAzureNetworkMappingSettingsInternal)this).PrimaryFabricLocation = (string) content.GetValueForProperty("PrimaryFabricLocation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureToAzureNetworkMappingSettingsInternal)this).PrimaryFabricLocation, global::System.Convert.ToString); + } + if (content.Contains("RecoveryFabricLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureToAzureNetworkMappingSettingsInternal)this).RecoveryFabricLocation = (string) content.GetValueForProperty("RecoveryFabricLocation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureToAzureNetworkMappingSettingsInternal)this).RecoveryFabricLocation, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingFabricSpecificSettingsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingFabricSpecificSettingsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal AzureToAzureNetworkMappingSettings(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("PrimaryFabricLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureToAzureNetworkMappingSettingsInternal)this).PrimaryFabricLocation = (string) content.GetValueForProperty("PrimaryFabricLocation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureToAzureNetworkMappingSettingsInternal)this).PrimaryFabricLocation, global::System.Convert.ToString); + } + if (content.Contains("RecoveryFabricLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureToAzureNetworkMappingSettingsInternal)this).RecoveryFabricLocation = (string) content.GetValueForProperty("RecoveryFabricLocation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureToAzureNetworkMappingSettingsInternal)this).RecoveryFabricLocation, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingFabricSpecificSettingsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingFabricSpecificSettingsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureToAzureNetworkMappingSettings DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new AzureToAzureNetworkMappingSettings(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureToAzureNetworkMappingSettings DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new AzureToAzureNetworkMappingSettings(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureToAzureNetworkMappingSettings FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// A2A Network Mapping fabric specific settings. + [System.ComponentModel.TypeConverter(typeof(AzureToAzureNetworkMappingSettingsTypeConverter))] + public partial interface IAzureToAzureNetworkMappingSettings + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AzureToAzureNetworkMappingSettings.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AzureToAzureNetworkMappingSettings.TypeConverter.cs new file mode 100644 index 000000000000..991092b50a1c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AzureToAzureNetworkMappingSettings.TypeConverter.cs @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class AzureToAzureNetworkMappingSettingsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureToAzureNetworkMappingSettings ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureToAzureNetworkMappingSettings).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return AzureToAzureNetworkMappingSettings.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return AzureToAzureNetworkMappingSettings.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return AzureToAzureNetworkMappingSettings.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AzureToAzureNetworkMappingSettings.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AzureToAzureNetworkMappingSettings.cs new file mode 100644 index 000000000000..100272b1e90e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AzureToAzureNetworkMappingSettings.cs @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// A2A Network Mapping fabric specific settings. + public partial class AzureToAzureNetworkMappingSettings : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureToAzureNetworkMappingSettings, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureToAzureNetworkMappingSettingsInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingFabricSpecificSettings __networkMappingFabricSpecificSettings = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.NetworkMappingFabricSpecificSettings(); + + /// Gets the Instance type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingFabricSpecificSettingsInternal)__networkMappingFabricSpecificSettings).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingFabricSpecificSettingsInternal)__networkMappingFabricSpecificSettings).InstanceType = value ; } + + /// Backing field for property. + private string _primaryFabricLocation; + + /// The primary fabric location. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string PrimaryFabricLocation { get => this._primaryFabricLocation; set => this._primaryFabricLocation = value; } + + /// Backing field for property. + private string _recoveryFabricLocation; + + /// The recovery fabric location. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryFabricLocation { get => this._recoveryFabricLocation; set => this._recoveryFabricLocation = value; } + + /// Creates an new instance. + public AzureToAzureNetworkMappingSettings() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__networkMappingFabricSpecificSettings), __networkMappingFabricSpecificSettings); + await eventListener.AssertObjectIsValid(nameof(__networkMappingFabricSpecificSettings), __networkMappingFabricSpecificSettings); + } + } + /// A2A Network Mapping fabric specific settings. + public partial interface IAzureToAzureNetworkMappingSettings : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingFabricSpecificSettings + { + /// The primary fabric location. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The primary fabric location.", + SerializedName = @"primaryFabricLocation", + PossibleTypes = new [] { typeof(string) })] + string PrimaryFabricLocation { get; set; } + /// The recovery fabric location. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery fabric location.", + SerializedName = @"recoveryFabricLocation", + PossibleTypes = new [] { typeof(string) })] + string RecoveryFabricLocation { get; set; } + + } + /// A2A Network Mapping fabric specific settings. + internal partial interface IAzureToAzureNetworkMappingSettingsInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingFabricSpecificSettingsInternal + { + /// The primary fabric location. + string PrimaryFabricLocation { get; set; } + /// The recovery fabric location. + string RecoveryFabricLocation { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AzureToAzureNetworkMappingSettings.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AzureToAzureNetworkMappingSettings.json.cs new file mode 100644 index 000000000000..2b27688c23b3 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AzureToAzureNetworkMappingSettings.json.cs @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// A2A Network Mapping fabric specific settings. + public partial class AzureToAzureNetworkMappingSettings + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal AzureToAzureNetworkMappingSettings(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __networkMappingFabricSpecificSettings = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.NetworkMappingFabricSpecificSettings(json); + {_primaryFabricLocation = If( json?.PropertyT("primaryFabricLocation"), out var __jsonPrimaryFabricLocation) ? (string)__jsonPrimaryFabricLocation : (string)PrimaryFabricLocation;} + {_recoveryFabricLocation = If( json?.PropertyT("recoveryFabricLocation"), out var __jsonRecoveryFabricLocation) ? (string)__jsonRecoveryFabricLocation : (string)RecoveryFabricLocation;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureToAzureNetworkMappingSettings. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureToAzureNetworkMappingSettings. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureToAzureNetworkMappingSettings FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new AzureToAzureNetworkMappingSettings(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __networkMappingFabricSpecificSettings?.ToJson(container, serializationMode); + AddIf( null != (((object)this._primaryFabricLocation)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._primaryFabricLocation.ToString()) : null, "primaryFabricLocation" ,container.Add ); + AddIf( null != (((object)this._recoveryFabricLocation)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryFabricLocation.ToString()) : null, "recoveryFabricLocation" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AzureToAzureUpdateNetworkMappingInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AzureToAzureUpdateNetworkMappingInput.PowerShell.cs new file mode 100644 index 000000000000..d4e0bcce5c3d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AzureToAzureUpdateNetworkMappingInput.PowerShell.cs @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Updates network mappings input. + [System.ComponentModel.TypeConverter(typeof(AzureToAzureUpdateNetworkMappingInputTypeConverter))] + public partial class AzureToAzureUpdateNetworkMappingInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal AzureToAzureUpdateNetworkMappingInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("PrimaryNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureToAzureUpdateNetworkMappingInputInternal)this).PrimaryNetworkId = (string) content.GetValueForProperty("PrimaryNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureToAzureUpdateNetworkMappingInputInternal)this).PrimaryNetworkId, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificUpdateNetworkMappingInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificUpdateNetworkMappingInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal AzureToAzureUpdateNetworkMappingInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("PrimaryNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureToAzureUpdateNetworkMappingInputInternal)this).PrimaryNetworkId = (string) content.GetValueForProperty("PrimaryNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureToAzureUpdateNetworkMappingInputInternal)this).PrimaryNetworkId, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificUpdateNetworkMappingInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificUpdateNetworkMappingInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureToAzureUpdateNetworkMappingInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new AzureToAzureUpdateNetworkMappingInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureToAzureUpdateNetworkMappingInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new AzureToAzureUpdateNetworkMappingInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json + /// string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureToAzureUpdateNetworkMappingInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Updates network mappings input. + [System.ComponentModel.TypeConverter(typeof(AzureToAzureUpdateNetworkMappingInputTypeConverter))] + public partial interface IAzureToAzureUpdateNetworkMappingInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AzureToAzureUpdateNetworkMappingInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AzureToAzureUpdateNetworkMappingInput.TypeConverter.cs new file mode 100644 index 000000000000..84750fc1edc7 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AzureToAzureUpdateNetworkMappingInput.TypeConverter.cs @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class AzureToAzureUpdateNetworkMappingInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureToAzureUpdateNetworkMappingInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureToAzureUpdateNetworkMappingInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return AzureToAzureUpdateNetworkMappingInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return AzureToAzureUpdateNetworkMappingInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return AzureToAzureUpdateNetworkMappingInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AzureToAzureUpdateNetworkMappingInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AzureToAzureUpdateNetworkMappingInput.cs new file mode 100644 index 000000000000..7539df84f05f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AzureToAzureUpdateNetworkMappingInput.cs @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Updates network mappings input. + public partial class AzureToAzureUpdateNetworkMappingInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureToAzureUpdateNetworkMappingInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureToAzureUpdateNetworkMappingInputInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificUpdateNetworkMappingInput __fabricSpecificUpdateNetworkMappingInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FabricSpecificUpdateNetworkMappingInput(); + + /// The instance type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificUpdateNetworkMappingInputInternal)__fabricSpecificUpdateNetworkMappingInput).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificUpdateNetworkMappingInputInternal)__fabricSpecificUpdateNetworkMappingInput).InstanceType = value ; } + + /// Backing field for property. + private string _primaryNetworkId; + + /// The primary azure vnet Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string PrimaryNetworkId { get => this._primaryNetworkId; set => this._primaryNetworkId = value; } + + /// Creates an new instance. + public AzureToAzureUpdateNetworkMappingInput() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__fabricSpecificUpdateNetworkMappingInput), __fabricSpecificUpdateNetworkMappingInput); + await eventListener.AssertObjectIsValid(nameof(__fabricSpecificUpdateNetworkMappingInput), __fabricSpecificUpdateNetworkMappingInput); + } + } + /// Updates network mappings input. + public partial interface IAzureToAzureUpdateNetworkMappingInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificUpdateNetworkMappingInput + { + /// The primary azure vnet Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The primary azure vnet Id.", + SerializedName = @"primaryNetworkId", + PossibleTypes = new [] { typeof(string) })] + string PrimaryNetworkId { get; set; } + + } + /// Updates network mappings input. + internal partial interface IAzureToAzureUpdateNetworkMappingInputInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificUpdateNetworkMappingInputInternal + { + /// The primary azure vnet Id. + string PrimaryNetworkId { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AzureToAzureUpdateNetworkMappingInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AzureToAzureUpdateNetworkMappingInput.json.cs new file mode 100644 index 000000000000..239351fce09b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AzureToAzureUpdateNetworkMappingInput.json.cs @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Updates network mappings input. + public partial class AzureToAzureUpdateNetworkMappingInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal AzureToAzureUpdateNetworkMappingInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __fabricSpecificUpdateNetworkMappingInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FabricSpecificUpdateNetworkMappingInput(json); + {_primaryNetworkId = If( json?.PropertyT("primaryNetworkId"), out var __jsonPrimaryNetworkId) ? (string)__jsonPrimaryNetworkId : (string)PrimaryNetworkId;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureToAzureUpdateNetworkMappingInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureToAzureUpdateNetworkMappingInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureToAzureUpdateNetworkMappingInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new AzureToAzureUpdateNetworkMappingInput(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __fabricSpecificUpdateNetworkMappingInput?.ToJson(container, serializationMode); + AddIf( null != (((object)this._primaryNetworkId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._primaryNetworkId.ToString()) : null, "primaryNetworkId" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AzureToAzureVMSyncedConfigDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AzureToAzureVMSyncedConfigDetails.PowerShell.cs new file mode 100644 index 000000000000..2e1f7ca7f09c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AzureToAzureVMSyncedConfigDetails.PowerShell.cs @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Azure to Azure VM synced configuration details. + [System.ComponentModel.TypeConverter(typeof(AzureToAzureVMSyncedConfigDetailsTypeConverter))] + public partial class AzureToAzureVMSyncedConfigDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal AzureToAzureVMSyncedConfigDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Tag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureToAzureVMSyncedConfigDetailsInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureToAzureVMSyncedConfigDetailsTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureToAzureVMSyncedConfigDetailsInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AzureToAzureVMSyncedConfigDetailsTagsTypeConverter.ConvertFrom); + } + if (content.Contains("InputEndpoint")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureToAzureVMSyncedConfigDetailsInternal)this).InputEndpoint = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInputEndpoint[]) content.GetValueForProperty("InputEndpoint",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureToAzureVMSyncedConfigDetailsInternal)this).InputEndpoint, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InputEndpointTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal AzureToAzureVMSyncedConfigDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Tag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureToAzureVMSyncedConfigDetailsInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureToAzureVMSyncedConfigDetailsTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureToAzureVMSyncedConfigDetailsInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AzureToAzureVMSyncedConfigDetailsTagsTypeConverter.ConvertFrom); + } + if (content.Contains("InputEndpoint")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureToAzureVMSyncedConfigDetailsInternal)this).InputEndpoint = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInputEndpoint[]) content.GetValueForProperty("InputEndpoint",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureToAzureVMSyncedConfigDetailsInternal)this).InputEndpoint, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InputEndpointTypeConverter.ConvertFrom)); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureToAzureVMSyncedConfigDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new AzureToAzureVMSyncedConfigDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureToAzureVMSyncedConfigDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new AzureToAzureVMSyncedConfigDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureToAzureVMSyncedConfigDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Azure to Azure VM synced configuration details. + [System.ComponentModel.TypeConverter(typeof(AzureToAzureVMSyncedConfigDetailsTypeConverter))] + public partial interface IAzureToAzureVMSyncedConfigDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AzureToAzureVMSyncedConfigDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AzureToAzureVMSyncedConfigDetails.TypeConverter.cs new file mode 100644 index 000000000000..04e41be82acd --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AzureToAzureVMSyncedConfigDetails.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class AzureToAzureVMSyncedConfigDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureToAzureVMSyncedConfigDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureToAzureVMSyncedConfigDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return AzureToAzureVMSyncedConfigDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return AzureToAzureVMSyncedConfigDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return AzureToAzureVMSyncedConfigDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AzureToAzureVMSyncedConfigDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AzureToAzureVMSyncedConfigDetails.cs new file mode 100644 index 000000000000..a178f12af198 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AzureToAzureVMSyncedConfigDetails.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Azure to Azure VM synced configuration details. + public partial class AzureToAzureVMSyncedConfigDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureToAzureVMSyncedConfigDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureToAzureVMSyncedConfigDetailsInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInputEndpoint[] _inputEndpoint; + + /// The Azure VM input endpoints. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInputEndpoint[] InputEndpoint { get => this._inputEndpoint; set => this._inputEndpoint = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureToAzureVMSyncedConfigDetailsTags _tag; + + /// The Azure VM tags. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureToAzureVMSyncedConfigDetailsTags Tag { get => (this._tag = this._tag ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AzureToAzureVMSyncedConfigDetailsTags()); set => this._tag = value; } + + /// Creates an new instance. + public AzureToAzureVMSyncedConfigDetails() + { + + } + } + /// Azure to Azure VM synced configuration details. + public partial interface IAzureToAzureVMSyncedConfigDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The Azure VM input endpoints. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Azure VM input endpoints.", + SerializedName = @"inputEndpoints", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInputEndpoint) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInputEndpoint[] InputEndpoint { get; set; } + /// The Azure VM tags. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Azure VM tags.", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureToAzureVMSyncedConfigDetailsTags) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureToAzureVMSyncedConfigDetailsTags Tag { get; set; } + + } + /// Azure to Azure VM synced configuration details. + internal partial interface IAzureToAzureVMSyncedConfigDetailsInternal + + { + /// The Azure VM input endpoints. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInputEndpoint[] InputEndpoint { get; set; } + /// The Azure VM tags. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureToAzureVMSyncedConfigDetailsTags Tag { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AzureToAzureVMSyncedConfigDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AzureToAzureVMSyncedConfigDetails.json.cs new file mode 100644 index 000000000000..f0d1741462f0 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AzureToAzureVMSyncedConfigDetails.json.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Azure to Azure VM synced configuration details. + public partial class AzureToAzureVMSyncedConfigDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal AzureToAzureVMSyncedConfigDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_tag = If( json?.PropertyT("tags"), out var __jsonTags) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AzureToAzureVMSyncedConfigDetailsTags.FromJson(__jsonTags) : Tag;} + {_inputEndpoint = If( json?.PropertyT("inputEndpoints"), out var __jsonInputEndpoints) ? If( __jsonInputEndpoints as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInputEndpoint) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InputEndpoint.FromJson(__u) )) ))() : null : InputEndpoint;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureToAzureVMSyncedConfigDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureToAzureVMSyncedConfigDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureToAzureVMSyncedConfigDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new AzureToAzureVMSyncedConfigDetails(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._tag ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._tag.ToJson(null,serializationMode) : null, "tags" ,container.Add ); + if (null != this._inputEndpoint) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._inputEndpoint ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("inputEndpoints",__w); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AzureToAzureVMSyncedConfigDetailsTags.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AzureToAzureVMSyncedConfigDetailsTags.PowerShell.cs new file mode 100644 index 000000000000..ea2560132e45 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AzureToAzureVMSyncedConfigDetailsTags.PowerShell.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// The Azure VM tags. + [System.ComponentModel.TypeConverter(typeof(AzureToAzureVMSyncedConfigDetailsTagsTypeConverter))] + public partial class AzureToAzureVMSyncedConfigDetailsTags + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal AzureToAzureVMSyncedConfigDetailsTags(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal AzureToAzureVMSyncedConfigDetailsTags(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureToAzureVMSyncedConfigDetailsTags DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new AzureToAzureVMSyncedConfigDetailsTags(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureToAzureVMSyncedConfigDetailsTags DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new AzureToAzureVMSyncedConfigDetailsTags(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json + /// string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureToAzureVMSyncedConfigDetailsTags FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// The Azure VM tags. + [System.ComponentModel.TypeConverter(typeof(AzureToAzureVMSyncedConfigDetailsTagsTypeConverter))] + public partial interface IAzureToAzureVMSyncedConfigDetailsTags + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AzureToAzureVMSyncedConfigDetailsTags.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AzureToAzureVMSyncedConfigDetailsTags.TypeConverter.cs new file mode 100644 index 000000000000..94589df3518a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AzureToAzureVMSyncedConfigDetailsTags.TypeConverter.cs @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class AzureToAzureVMSyncedConfigDetailsTagsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureToAzureVMSyncedConfigDetailsTags ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureToAzureVMSyncedConfigDetailsTags).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return AzureToAzureVMSyncedConfigDetailsTags.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return AzureToAzureVMSyncedConfigDetailsTags.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return AzureToAzureVMSyncedConfigDetailsTags.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AzureToAzureVMSyncedConfigDetailsTags.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AzureToAzureVMSyncedConfigDetailsTags.cs new file mode 100644 index 000000000000..4f3bafd0b045 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AzureToAzureVMSyncedConfigDetailsTags.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The Azure VM tags. + public partial class AzureToAzureVMSyncedConfigDetailsTags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureToAzureVMSyncedConfigDetailsTags, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureToAzureVMSyncedConfigDetailsTagsInternal + { + + /// Creates an new instance. + public AzureToAzureVMSyncedConfigDetailsTags() + { + + } + } + /// The Azure VM tags. + public partial interface IAzureToAzureVMSyncedConfigDetailsTags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray + { + + } + /// The Azure VM tags. + internal partial interface IAzureToAzureVMSyncedConfigDetailsTagsInternal + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AzureToAzureVMSyncedConfigDetailsTags.dictionary.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AzureToAzureVMSyncedConfigDetailsTags.dictionary.cs new file mode 100644 index 000000000000..37d8d31ca694 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AzureToAzureVMSyncedConfigDetailsTags.dictionary.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + public partial class AzureToAzureVMSyncedConfigDetailsTags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray + { + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + + int Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Values { get => __additionalProperties.Values; } + + public string this[global::System.String index] { get => __additionalProperties[index]; set => __additionalProperties[index] = value; } + + /// + /// + public void Add(global::System.String key, string value) => __additionalProperties.Add( key, value); + + public void Clear() => __additionalProperties.Clear(); + + /// + public bool ContainsKey(global::System.String key) => __additionalProperties.ContainsKey( key); + + /// + public void CopyFrom(global::System.Collections.IDictionary source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public void CopyFrom(global::System.Management.Automation.PSObject source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public bool Remove(global::System.String key) => __additionalProperties.Remove( key); + + /// + /// + public bool TryGetValue(global::System.String key, out string value) => __additionalProperties.TryGetValue( key, out value); + + /// + + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AzureToAzureVMSyncedConfigDetailsTags source) => source.__additionalProperties; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AzureToAzureVMSyncedConfigDetailsTags.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AzureToAzureVMSyncedConfigDetailsTags.json.cs new file mode 100644 index 000000000000..9221431ae1fd --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AzureToAzureVMSyncedConfigDetailsTags.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The Azure VM tags. + public partial class AzureToAzureVMSyncedConfigDetailsTags + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + /// + internal AzureToAzureVMSyncedConfigDetailsTags(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, global::System.Collections.Generic.HashSet exclusions = null) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray)this).AdditionalProperties, null ,exclusions ); + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureToAzureVMSyncedConfigDetailsTags. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureToAzureVMSyncedConfigDetailsTags. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureToAzureVMSyncedConfigDetailsTags FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new AzureToAzureVMSyncedConfigDetailsTags(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray)this).AdditionalProperties, container); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AzureVMDiskDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AzureVMDiskDetails.PowerShell.cs new file mode 100644 index 000000000000..6d63f666147d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AzureVMDiskDetails.PowerShell.cs @@ -0,0 +1,216 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Disk details for E2A provider. + [System.ComponentModel.TypeConverter(typeof(AzureVMDiskDetailsTypeConverter))] + public partial class AzureVMDiskDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal AzureVMDiskDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("VhdType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureVMDiskDetailsInternal)this).VhdType = (string) content.GetValueForProperty("VhdType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureVMDiskDetailsInternal)this).VhdType, global::System.Convert.ToString); + } + if (content.Contains("VhdId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureVMDiskDetailsInternal)this).VhdId = (string) content.GetValueForProperty("VhdId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureVMDiskDetailsInternal)this).VhdId, global::System.Convert.ToString); + } + if (content.Contains("DiskId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureVMDiskDetailsInternal)this).DiskId = (string) content.GetValueForProperty("DiskId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureVMDiskDetailsInternal)this).DiskId, global::System.Convert.ToString); + } + if (content.Contains("VhdName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureVMDiskDetailsInternal)this).VhdName = (string) content.GetValueForProperty("VhdName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureVMDiskDetailsInternal)this).VhdName, global::System.Convert.ToString); + } + if (content.Contains("MaxSizeMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureVMDiskDetailsInternal)this).MaxSizeMb = (string) content.GetValueForProperty("MaxSizeMb",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureVMDiskDetailsInternal)this).MaxSizeMb, global::System.Convert.ToString); + } + if (content.Contains("TargetDiskLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureVMDiskDetailsInternal)this).TargetDiskLocation = (string) content.GetValueForProperty("TargetDiskLocation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureVMDiskDetailsInternal)this).TargetDiskLocation, global::System.Convert.ToString); + } + if (content.Contains("TargetDiskName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureVMDiskDetailsInternal)this).TargetDiskName = (string) content.GetValueForProperty("TargetDiskName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureVMDiskDetailsInternal)this).TargetDiskName, global::System.Convert.ToString); + } + if (content.Contains("LunId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureVMDiskDetailsInternal)this).LunId = (string) content.GetValueForProperty("LunId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureVMDiskDetailsInternal)this).LunId, global::System.Convert.ToString); + } + if (content.Contains("DiskEncryptionSetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureVMDiskDetailsInternal)this).DiskEncryptionSetId = (string) content.GetValueForProperty("DiskEncryptionSetId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureVMDiskDetailsInternal)this).DiskEncryptionSetId, global::System.Convert.ToString); + } + if (content.Contains("CustomTargetDiskName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureVMDiskDetailsInternal)this).CustomTargetDiskName = (string) content.GetValueForProperty("CustomTargetDiskName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureVMDiskDetailsInternal)this).CustomTargetDiskName, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal AzureVMDiskDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("VhdType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureVMDiskDetailsInternal)this).VhdType = (string) content.GetValueForProperty("VhdType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureVMDiskDetailsInternal)this).VhdType, global::System.Convert.ToString); + } + if (content.Contains("VhdId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureVMDiskDetailsInternal)this).VhdId = (string) content.GetValueForProperty("VhdId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureVMDiskDetailsInternal)this).VhdId, global::System.Convert.ToString); + } + if (content.Contains("DiskId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureVMDiskDetailsInternal)this).DiskId = (string) content.GetValueForProperty("DiskId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureVMDiskDetailsInternal)this).DiskId, global::System.Convert.ToString); + } + if (content.Contains("VhdName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureVMDiskDetailsInternal)this).VhdName = (string) content.GetValueForProperty("VhdName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureVMDiskDetailsInternal)this).VhdName, global::System.Convert.ToString); + } + if (content.Contains("MaxSizeMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureVMDiskDetailsInternal)this).MaxSizeMb = (string) content.GetValueForProperty("MaxSizeMb",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureVMDiskDetailsInternal)this).MaxSizeMb, global::System.Convert.ToString); + } + if (content.Contains("TargetDiskLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureVMDiskDetailsInternal)this).TargetDiskLocation = (string) content.GetValueForProperty("TargetDiskLocation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureVMDiskDetailsInternal)this).TargetDiskLocation, global::System.Convert.ToString); + } + if (content.Contains("TargetDiskName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureVMDiskDetailsInternal)this).TargetDiskName = (string) content.GetValueForProperty("TargetDiskName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureVMDiskDetailsInternal)this).TargetDiskName, global::System.Convert.ToString); + } + if (content.Contains("LunId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureVMDiskDetailsInternal)this).LunId = (string) content.GetValueForProperty("LunId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureVMDiskDetailsInternal)this).LunId, global::System.Convert.ToString); + } + if (content.Contains("DiskEncryptionSetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureVMDiskDetailsInternal)this).DiskEncryptionSetId = (string) content.GetValueForProperty("DiskEncryptionSetId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureVMDiskDetailsInternal)this).DiskEncryptionSetId, global::System.Convert.ToString); + } + if (content.Contains("CustomTargetDiskName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureVMDiskDetailsInternal)this).CustomTargetDiskName = (string) content.GetValueForProperty("CustomTargetDiskName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureVMDiskDetailsInternal)this).CustomTargetDiskName, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureVMDiskDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new AzureVMDiskDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureVMDiskDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new AzureVMDiskDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureVMDiskDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Disk details for E2A provider. + [System.ComponentModel.TypeConverter(typeof(AzureVMDiskDetailsTypeConverter))] + public partial interface IAzureVMDiskDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AzureVMDiskDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AzureVMDiskDetails.TypeConverter.cs new file mode 100644 index 000000000000..f0efee34d77b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AzureVMDiskDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class AzureVMDiskDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureVMDiskDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureVMDiskDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return AzureVMDiskDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return AzureVMDiskDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return AzureVMDiskDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AzureVMDiskDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AzureVMDiskDetails.cs new file mode 100644 index 000000000000..60ff86abcad1 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AzureVMDiskDetails.cs @@ -0,0 +1,204 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Disk details for E2A provider. + public partial class AzureVMDiskDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureVMDiskDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureVMDiskDetailsInternal + { + + /// Backing field for property. + private string _customTargetDiskName; + + /// The custom target Azure disk name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string CustomTargetDiskName { get => this._customTargetDiskName; set => this._customTargetDiskName = value; } + + /// Backing field for property. + private string _diskEncryptionSetId; + + /// The DiskEncryptionSet ARM ID. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string DiskEncryptionSetId { get => this._diskEncryptionSetId; set => this._diskEncryptionSetId = value; } + + /// Backing field for property. + private string _diskId; + + /// The disk resource id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string DiskId { get => this._diskId; set => this._diskId = value; } + + /// Backing field for property. + private string _lunId; + + /// Ordinal\LunId of the disk for the Azure VM. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string LunId { get => this._lunId; set => this._lunId = value; } + + /// Backing field for property. + private string _maxSizeMb; + + /// Max side in MB. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string MaxSizeMb { get => this._maxSizeMb; set => this._maxSizeMb = value; } + + /// Backing field for property. + private string _targetDiskLocation; + + /// Blob uri of the Azure disk. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetDiskLocation { get => this._targetDiskLocation; set => this._targetDiskLocation = value; } + + /// Backing field for property. + private string _targetDiskName; + + /// The target Azure disk name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetDiskName { get => this._targetDiskName; set => this._targetDiskName = value; } + + /// Backing field for property. + private string _vhdId; + + /// The VHD id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string VhdId { get => this._vhdId; set => this._vhdId = value; } + + /// Backing field for property. + private string _vhdName; + + /// VHD name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string VhdName { get => this._vhdName; set => this._vhdName = value; } + + /// Backing field for property. + private string _vhdType; + + /// VHD type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string VhdType { get => this._vhdType; set => this._vhdType = value; } + + /// Creates an new instance. + public AzureVMDiskDetails() + { + + } + } + /// Disk details for E2A provider. + public partial interface IAzureVMDiskDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The custom target Azure disk name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The custom target Azure disk name.", + SerializedName = @"customTargetDiskName", + PossibleTypes = new [] { typeof(string) })] + string CustomTargetDiskName { get; set; } + /// The DiskEncryptionSet ARM ID. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The DiskEncryptionSet ARM ID.", + SerializedName = @"diskEncryptionSetId", + PossibleTypes = new [] { typeof(string) })] + string DiskEncryptionSetId { get; set; } + /// The disk resource id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The disk resource id.", + SerializedName = @"diskId", + PossibleTypes = new [] { typeof(string) })] + string DiskId { get; set; } + /// Ordinal\LunId of the disk for the Azure VM. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Ordinal\LunId of the disk for the Azure VM.", + SerializedName = @"lunId", + PossibleTypes = new [] { typeof(string) })] + string LunId { get; set; } + /// Max side in MB. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Max side in MB.", + SerializedName = @"maxSizeMB", + PossibleTypes = new [] { typeof(string) })] + string MaxSizeMb { get; set; } + /// Blob uri of the Azure disk. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Blob uri of the Azure disk.", + SerializedName = @"targetDiskLocation", + PossibleTypes = new [] { typeof(string) })] + string TargetDiskLocation { get; set; } + /// The target Azure disk name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target Azure disk name.", + SerializedName = @"targetDiskName", + PossibleTypes = new [] { typeof(string) })] + string TargetDiskName { get; set; } + /// The VHD id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The VHD id.", + SerializedName = @"vhdId", + PossibleTypes = new [] { typeof(string) })] + string VhdId { get; set; } + /// VHD name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"VHD name.", + SerializedName = @"vhdName", + PossibleTypes = new [] { typeof(string) })] + string VhdName { get; set; } + /// VHD type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"VHD type.", + SerializedName = @"vhdType", + PossibleTypes = new [] { typeof(string) })] + string VhdType { get; set; } + + } + /// Disk details for E2A provider. + internal partial interface IAzureVMDiskDetailsInternal + + { + /// The custom target Azure disk name. + string CustomTargetDiskName { get; set; } + /// The DiskEncryptionSet ARM ID. + string DiskEncryptionSetId { get; set; } + /// The disk resource id. + string DiskId { get; set; } + /// Ordinal\LunId of the disk for the Azure VM. + string LunId { get; set; } + /// Max side in MB. + string MaxSizeMb { get; set; } + /// Blob uri of the Azure disk. + string TargetDiskLocation { get; set; } + /// The target Azure disk name. + string TargetDiskName { get; set; } + /// The VHD id. + string VhdId { get; set; } + /// VHD name. + string VhdName { get; set; } + /// VHD type. + string VhdType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AzureVMDiskDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AzureVMDiskDetails.json.cs new file mode 100644 index 000000000000..1ae9af138b2e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/AzureVMDiskDetails.json.cs @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Disk details for E2A provider. + public partial class AzureVMDiskDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal AzureVMDiskDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_vhdType = If( json?.PropertyT("vhdType"), out var __jsonVhdType) ? (string)__jsonVhdType : (string)VhdType;} + {_vhdId = If( json?.PropertyT("vhdId"), out var __jsonVhdId) ? (string)__jsonVhdId : (string)VhdId;} + {_diskId = If( json?.PropertyT("diskId"), out var __jsonDiskId) ? (string)__jsonDiskId : (string)DiskId;} + {_vhdName = If( json?.PropertyT("vhdName"), out var __jsonVhdName) ? (string)__jsonVhdName : (string)VhdName;} + {_maxSizeMb = If( json?.PropertyT("maxSizeMB"), out var __jsonMaxSizeMb) ? (string)__jsonMaxSizeMb : (string)MaxSizeMb;} + {_targetDiskLocation = If( json?.PropertyT("targetDiskLocation"), out var __jsonTargetDiskLocation) ? (string)__jsonTargetDiskLocation : (string)TargetDiskLocation;} + {_targetDiskName = If( json?.PropertyT("targetDiskName"), out var __jsonTargetDiskName) ? (string)__jsonTargetDiskName : (string)TargetDiskName;} + {_lunId = If( json?.PropertyT("lunId"), out var __jsonLunId) ? (string)__jsonLunId : (string)LunId;} + {_diskEncryptionSetId = If( json?.PropertyT("diskEncryptionSetId"), out var __jsonDiskEncryptionSetId) ? (string)__jsonDiskEncryptionSetId : (string)DiskEncryptionSetId;} + {_customTargetDiskName = If( json?.PropertyT("customTargetDiskName"), out var __jsonCustomTargetDiskName) ? (string)__jsonCustomTargetDiskName : (string)CustomTargetDiskName;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureVMDiskDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureVMDiskDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureVMDiskDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new AzureVMDiskDetails(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._vhdType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._vhdType.ToString()) : null, "vhdType" ,container.Add ); + AddIf( null != (((object)this._vhdId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._vhdId.ToString()) : null, "vhdId" ,container.Add ); + AddIf( null != (((object)this._diskId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._diskId.ToString()) : null, "diskId" ,container.Add ); + AddIf( null != (((object)this._vhdName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._vhdName.ToString()) : null, "vhdName" ,container.Add ); + AddIf( null != (((object)this._maxSizeMb)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._maxSizeMb.ToString()) : null, "maxSizeMB" ,container.Add ); + AddIf( null != (((object)this._targetDiskLocation)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetDiskLocation.ToString()) : null, "targetDiskLocation" ,container.Add ); + AddIf( null != (((object)this._targetDiskName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetDiskName.ToString()) : null, "targetDiskName" ,container.Add ); + AddIf( null != (((object)this._lunId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._lunId.ToString()) : null, "lunId" ,container.Add ); + AddIf( null != (((object)this._diskEncryptionSetId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._diskEncryptionSetId.ToString()) : null, "diskEncryptionSetId" ,container.Add ); + AddIf( null != (((object)this._customTargetDiskName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._customTargetDiskName.ToString()) : null, "customTargetDiskName" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ComputeSizeErrorDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ComputeSizeErrorDetails.PowerShell.cs new file mode 100644 index 000000000000..f704d2aa3da4 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ComputeSizeErrorDetails.PowerShell.cs @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// Represents the error used to indicate why the target compute size is not applicable. + /// + [System.ComponentModel.TypeConverter(typeof(ComputeSizeErrorDetailsTypeConverter))] + public partial class ComputeSizeErrorDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ComputeSizeErrorDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IComputeSizeErrorDetailsInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IComputeSizeErrorDetailsInternal)this).Message, global::System.Convert.ToString); + } + if (content.Contains("Severity")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IComputeSizeErrorDetailsInternal)this).Severity = (string) content.GetValueForProperty("Severity",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IComputeSizeErrorDetailsInternal)this).Severity, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ComputeSizeErrorDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IComputeSizeErrorDetailsInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IComputeSizeErrorDetailsInternal)this).Message, global::System.Convert.ToString); + } + if (content.Contains("Severity")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IComputeSizeErrorDetailsInternal)this).Severity = (string) content.GetValueForProperty("Severity",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IComputeSizeErrorDetailsInternal)this).Severity, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IComputeSizeErrorDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ComputeSizeErrorDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IComputeSizeErrorDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ComputeSizeErrorDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IComputeSizeErrorDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Represents the error used to indicate why the target compute size is not applicable. + [System.ComponentModel.TypeConverter(typeof(ComputeSizeErrorDetailsTypeConverter))] + public partial interface IComputeSizeErrorDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ComputeSizeErrorDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ComputeSizeErrorDetails.TypeConverter.cs new file mode 100644 index 000000000000..85eba718a4df --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ComputeSizeErrorDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ComputeSizeErrorDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IComputeSizeErrorDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IComputeSizeErrorDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ComputeSizeErrorDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ComputeSizeErrorDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ComputeSizeErrorDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ComputeSizeErrorDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ComputeSizeErrorDetails.cs new file mode 100644 index 000000000000..89573fed669d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ComputeSizeErrorDetails.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// + /// Represents the error used to indicate why the target compute size is not applicable. + /// + public partial class ComputeSizeErrorDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IComputeSizeErrorDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IComputeSizeErrorDetailsInternal + { + + /// Backing field for property. + private string _message; + + /// The error message. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Message { get => this._message; set => this._message = value; } + + /// Backing field for property. + private string _severity; + + /// The severity of the error. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Severity { get => this._severity; set => this._severity = value; } + + /// Creates an new instance. + public ComputeSizeErrorDetails() + { + + } + } + /// Represents the error used to indicate why the target compute size is not applicable. + public partial interface IComputeSizeErrorDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The error message. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The error message.", + SerializedName = @"message", + PossibleTypes = new [] { typeof(string) })] + string Message { get; set; } + /// The severity of the error. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The severity of the error.", + SerializedName = @"severity", + PossibleTypes = new [] { typeof(string) })] + string Severity { get; set; } + + } + /// Represents the error used to indicate why the target compute size is not applicable. + internal partial interface IComputeSizeErrorDetailsInternal + + { + /// The error message. + string Message { get; set; } + /// The severity of the error. + string Severity { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ComputeSizeErrorDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ComputeSizeErrorDetails.json.cs new file mode 100644 index 000000000000..752920b073c8 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ComputeSizeErrorDetails.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// + /// Represents the error used to indicate why the target compute size is not applicable. + /// + public partial class ComputeSizeErrorDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal ComputeSizeErrorDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_message = If( json?.PropertyT("message"), out var __jsonMessage) ? (string)__jsonMessage : (string)Message;} + {_severity = If( json?.PropertyT("severity"), out var __jsonSeverity) ? (string)__jsonSeverity : (string)Severity;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IComputeSizeErrorDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IComputeSizeErrorDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IComputeSizeErrorDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new ComputeSizeErrorDetails(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._message)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._message.ToString()) : null, "message" ,container.Add ); + AddIf( null != (((object)this._severity)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._severity.ToString()) : null, "severity" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ConfigurationSettings.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ConfigurationSettings.PowerShell.cs new file mode 100644 index 000000000000..9e5c616eb077 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ConfigurationSettings.PowerShell.cs @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Replication provider specific settings. + [System.ComponentModel.TypeConverter(typeof(ConfigurationSettingsTypeConverter))] + public partial class ConfigurationSettings + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ConfigurationSettings(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigurationSettingsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigurationSettingsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ConfigurationSettings(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigurationSettingsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigurationSettingsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigurationSettings DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ConfigurationSettings(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigurationSettings DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ConfigurationSettings(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigurationSettings FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Replication provider specific settings. + [System.ComponentModel.TypeConverter(typeof(ConfigurationSettingsTypeConverter))] + public partial interface IConfigurationSettings + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ConfigurationSettings.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ConfigurationSettings.TypeConverter.cs new file mode 100644 index 000000000000..453487fe9aad --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ConfigurationSettings.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ConfigurationSettingsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigurationSettings ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigurationSettings).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ConfigurationSettings.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ConfigurationSettings.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ConfigurationSettings.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ConfigurationSettings.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ConfigurationSettings.cs new file mode 100644 index 000000000000..3508c4f93c20 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ConfigurationSettings.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Replication provider specific settings. + public partial class ConfigurationSettings : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigurationSettings, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigurationSettingsInternal + { + + /// Backing field for property. + private string _instanceType; + + /// Gets the class type. Overridden in derived classes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string InstanceType { get => this._instanceType; set => this._instanceType = value; } + + /// Creates an new instance. + public ConfigurationSettings() + { + + } + } + /// Replication provider specific settings. + public partial interface IConfigurationSettings : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// Gets the class type. Overridden in derived classes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets the class type. Overridden in derived classes.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string InstanceType { get; set; } + + } + /// Replication provider specific settings. + internal partial interface IConfigurationSettingsInternal + + { + /// Gets the class type. Overridden in derived classes. + string InstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ConfigurationSettings.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ConfigurationSettings.json.cs new file mode 100644 index 000000000000..6650edbc20e1 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ConfigurationSettings.json.cs @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Replication provider specific settings. + public partial class ConfigurationSettings + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal ConfigurationSettings(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_instanceType = If( json?.PropertyT("instanceType"), out var __jsonInstanceType) ? (string)__jsonInstanceType : (string)InstanceType;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigurationSettings. + /// Note: the Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigurationSettings interface is polymorphic, + /// and the precise model class that will get deserialized is determined at runtime based on the payload. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigurationSettings. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigurationSettings FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + if (!(node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json)) + { + return null; + } + // Polymorphic type -- select the appropriate constructor using the discriminator + + switch ( json.StringProperty("instanceType") ) + { + case "HyperVVirtualMachine": + { + return new HyperVVirtualMachineDetails(json); + } + case "ReplicationGroupDetails": + { + return new ReplicationGroupDetails(json); + } + case "VmmVirtualMachine": + { + return new VmmVirtualMachineDetails(json); + } + case "VMwareVirtualMachine": + { + return new VMwareVirtualMachineDetails(json); + } + } + return new ConfigurationSettings(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._instanceType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._instanceType.ToString()) : null, "instanceType" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ConfigureAlertRequest.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ConfigureAlertRequest.PowerShell.cs new file mode 100644 index 000000000000..c034fe89c119 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ConfigureAlertRequest.PowerShell.cs @@ -0,0 +1,168 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Request to configure alerts for the system. + [System.ComponentModel.TypeConverter(typeof(ConfigureAlertRequestTypeConverter))] + public partial class ConfigureAlertRequest + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ConfigureAlertRequest(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigureAlertRequestInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigureAlertRequestProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigureAlertRequestInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ConfigureAlertRequestPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("SendToOwner")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigureAlertRequestInternal)this).SendToOwner = (string) content.GetValueForProperty("SendToOwner",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigureAlertRequestInternal)this).SendToOwner, global::System.Convert.ToString); + } + if (content.Contains("CustomEmailAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigureAlertRequestInternal)this).CustomEmailAddress = (string[]) content.GetValueForProperty("CustomEmailAddress",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigureAlertRequestInternal)this).CustomEmailAddress, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("Locale")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigureAlertRequestInternal)this).Locale = (string) content.GetValueForProperty("Locale",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigureAlertRequestInternal)this).Locale, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ConfigureAlertRequest(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigureAlertRequestInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigureAlertRequestProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigureAlertRequestInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ConfigureAlertRequestPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("SendToOwner")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigureAlertRequestInternal)this).SendToOwner = (string) content.GetValueForProperty("SendToOwner",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigureAlertRequestInternal)this).SendToOwner, global::System.Convert.ToString); + } + if (content.Contains("CustomEmailAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigureAlertRequestInternal)this).CustomEmailAddress = (string[]) content.GetValueForProperty("CustomEmailAddress",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigureAlertRequestInternal)this).CustomEmailAddress, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("Locale")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigureAlertRequestInternal)this).Locale = (string) content.GetValueForProperty("Locale",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigureAlertRequestInternal)this).Locale, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigureAlertRequest DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ConfigureAlertRequest(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigureAlertRequest DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ConfigureAlertRequest(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigureAlertRequest FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Request to configure alerts for the system. + [System.ComponentModel.TypeConverter(typeof(ConfigureAlertRequestTypeConverter))] + public partial interface IConfigureAlertRequest + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ConfigureAlertRequest.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ConfigureAlertRequest.TypeConverter.cs new file mode 100644 index 000000000000..57f1ecc04c84 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ConfigureAlertRequest.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ConfigureAlertRequestTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigureAlertRequest ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigureAlertRequest).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ConfigureAlertRequest.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ConfigureAlertRequest.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ConfigureAlertRequest.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ConfigureAlertRequest.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ConfigureAlertRequest.cs new file mode 100644 index 000000000000..a74e7e9bb343 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ConfigureAlertRequest.cs @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Request to configure alerts for the system. + public partial class ConfigureAlertRequest : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigureAlertRequest, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigureAlertRequestInternal + { + + /// The custom email address for sending emails. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string[] CustomEmailAddress { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigureAlertRequestPropertiesInternal)Property).CustomEmailAddress; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigureAlertRequestPropertiesInternal)Property).CustomEmailAddress = value ?? null /* arrayOf */; } + + /// The locale for the email notification. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string Locale { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigureAlertRequestPropertiesInternal)Property).Locale; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigureAlertRequestPropertiesInternal)Property).Locale = value ?? null; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigureAlertRequestProperties Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigureAlertRequestInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ConfigureAlertRequestProperties()); set { {_property = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigureAlertRequestProperties _property; + + /// The properties of a configure alert request. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigureAlertRequestProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ConfigureAlertRequestProperties()); set => this._property = value; } + + /// A value indicating whether to send email to subscription administrator. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string SendToOwner { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigureAlertRequestPropertiesInternal)Property).SendToOwner; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigureAlertRequestPropertiesInternal)Property).SendToOwner = value ?? null; } + + /// Creates an new instance. + public ConfigureAlertRequest() + { + + } + } + /// Request to configure alerts for the system. + public partial interface IConfigureAlertRequest : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The custom email address for sending emails. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The custom email address for sending emails.", + SerializedName = @"customEmailAddresses", + PossibleTypes = new [] { typeof(string) })] + string[] CustomEmailAddress { get; set; } + /// The locale for the email notification. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The locale for the email notification.", + SerializedName = @"locale", + PossibleTypes = new [] { typeof(string) })] + string Locale { get; set; } + /// A value indicating whether to send email to subscription administrator. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether to send email to subscription administrator.", + SerializedName = @"sendToOwners", + PossibleTypes = new [] { typeof(string) })] + string SendToOwner { get; set; } + + } + /// Request to configure alerts for the system. + internal partial interface IConfigureAlertRequestInternal + + { + /// The custom email address for sending emails. + string[] CustomEmailAddress { get; set; } + /// The locale for the email notification. + string Locale { get; set; } + /// The properties of a configure alert request. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigureAlertRequestProperties Property { get; set; } + /// A value indicating whether to send email to subscription administrator. + string SendToOwner { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ConfigureAlertRequest.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ConfigureAlertRequest.json.cs new file mode 100644 index 000000000000..c74f65e91e1d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ConfigureAlertRequest.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Request to configure alerts for the system. + public partial class ConfigureAlertRequest + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal ConfigureAlertRequest(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ConfigureAlertRequestProperties.FromJson(__jsonProperties) : Property;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigureAlertRequest. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigureAlertRequest. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigureAlertRequest FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new ConfigureAlertRequest(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ConfigureAlertRequestProperties.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ConfigureAlertRequestProperties.PowerShell.cs new file mode 100644 index 000000000000..2cf113dec77c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ConfigureAlertRequestProperties.PowerShell.cs @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Properties of a configure alert request. + [System.ComponentModel.TypeConverter(typeof(ConfigureAlertRequestPropertiesTypeConverter))] + public partial class ConfigureAlertRequestProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ConfigureAlertRequestProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SendToOwner")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigureAlertRequestPropertiesInternal)this).SendToOwner = (string) content.GetValueForProperty("SendToOwner",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigureAlertRequestPropertiesInternal)this).SendToOwner, global::System.Convert.ToString); + } + if (content.Contains("CustomEmailAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigureAlertRequestPropertiesInternal)this).CustomEmailAddress = (string[]) content.GetValueForProperty("CustomEmailAddress",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigureAlertRequestPropertiesInternal)this).CustomEmailAddress, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("Locale")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigureAlertRequestPropertiesInternal)this).Locale = (string) content.GetValueForProperty("Locale",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigureAlertRequestPropertiesInternal)this).Locale, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ConfigureAlertRequestProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SendToOwner")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigureAlertRequestPropertiesInternal)this).SendToOwner = (string) content.GetValueForProperty("SendToOwner",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigureAlertRequestPropertiesInternal)this).SendToOwner, global::System.Convert.ToString); + } + if (content.Contains("CustomEmailAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigureAlertRequestPropertiesInternal)this).CustomEmailAddress = (string[]) content.GetValueForProperty("CustomEmailAddress",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigureAlertRequestPropertiesInternal)this).CustomEmailAddress, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("Locale")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigureAlertRequestPropertiesInternal)this).Locale = (string) content.GetValueForProperty("Locale",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigureAlertRequestPropertiesInternal)this).Locale, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigureAlertRequestProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ConfigureAlertRequestProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigureAlertRequestProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ConfigureAlertRequestProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigureAlertRequestProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Properties of a configure alert request. + [System.ComponentModel.TypeConverter(typeof(ConfigureAlertRequestPropertiesTypeConverter))] + public partial interface IConfigureAlertRequestProperties + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ConfigureAlertRequestProperties.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ConfigureAlertRequestProperties.TypeConverter.cs new file mode 100644 index 000000000000..26fd9eea19b0 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ConfigureAlertRequestProperties.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ConfigureAlertRequestPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigureAlertRequestProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigureAlertRequestProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ConfigureAlertRequestProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ConfigureAlertRequestProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ConfigureAlertRequestProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ConfigureAlertRequestProperties.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ConfigureAlertRequestProperties.cs new file mode 100644 index 000000000000..0ae80d917444 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ConfigureAlertRequestProperties.cs @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Properties of a configure alert request. + public partial class ConfigureAlertRequestProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigureAlertRequestProperties, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigureAlertRequestPropertiesInternal + { + + /// Backing field for property. + private string[] _customEmailAddress; + + /// The custom email address for sending emails. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string[] CustomEmailAddress { get => this._customEmailAddress; set => this._customEmailAddress = value; } + + /// Backing field for property. + private string _locale; + + /// The locale for the email notification. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Locale { get => this._locale; set => this._locale = value; } + + /// Backing field for property. + private string _sendToOwner; + + /// A value indicating whether to send email to subscription administrator. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string SendToOwner { get => this._sendToOwner; set => this._sendToOwner = value; } + + /// Creates an new instance. + public ConfigureAlertRequestProperties() + { + + } + } + /// Properties of a configure alert request. + public partial interface IConfigureAlertRequestProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The custom email address for sending emails. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The custom email address for sending emails.", + SerializedName = @"customEmailAddresses", + PossibleTypes = new [] { typeof(string) })] + string[] CustomEmailAddress { get; set; } + /// The locale for the email notification. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The locale for the email notification.", + SerializedName = @"locale", + PossibleTypes = new [] { typeof(string) })] + string Locale { get; set; } + /// A value indicating whether to send email to subscription administrator. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether to send email to subscription administrator.", + SerializedName = @"sendToOwners", + PossibleTypes = new [] { typeof(string) })] + string SendToOwner { get; set; } + + } + /// Properties of a configure alert request. + internal partial interface IConfigureAlertRequestPropertiesInternal + + { + /// The custom email address for sending emails. + string[] CustomEmailAddress { get; set; } + /// The locale for the email notification. + string Locale { get; set; } + /// A value indicating whether to send email to subscription administrator. + string SendToOwner { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ConfigureAlertRequestProperties.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ConfigureAlertRequestProperties.json.cs new file mode 100644 index 000000000000..d15ed14af9f8 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ConfigureAlertRequestProperties.json.cs @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Properties of a configure alert request. + public partial class ConfigureAlertRequestProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal ConfigureAlertRequestProperties(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_sendToOwner = If( json?.PropertyT("sendToOwners"), out var __jsonSendToOwners) ? (string)__jsonSendToOwners : (string)SendToOwner;} + {_customEmailAddress = If( json?.PropertyT("customEmailAddresses"), out var __jsonCustomEmailAddresses) ? If( __jsonCustomEmailAddresses as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(string) (__u is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : CustomEmailAddress;} + {_locale = If( json?.PropertyT("locale"), out var __jsonLocale) ? (string)__jsonLocale : (string)Locale;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigureAlertRequestProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigureAlertRequestProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigureAlertRequestProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new ConfigureAlertRequestProperties(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._sendToOwner)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._sendToOwner.ToString()) : null, "sendToOwners" ,container.Add ); + if (null != this._customEmailAddress) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._customEmailAddress ) + { + AddIf(null != (((object)__x)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(__x.ToString()) : null ,__w.Add); + } + container.Add("customEmailAddresses",__w); + } + AddIf( null != (((object)this._locale)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._locale.ToString()) : null, "locale" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ConsistencyCheckTaskDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ConsistencyCheckTaskDetails.PowerShell.cs new file mode 100644 index 000000000000..30c6bc51a124 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ConsistencyCheckTaskDetails.PowerShell.cs @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// This class contains monitoring details of all the inconsistent Protected Entities in Vmm. + /// + [System.ComponentModel.TypeConverter(typeof(ConsistencyCheckTaskDetailsTypeConverter))] + public partial class ConsistencyCheckTaskDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ConsistencyCheckTaskDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("VMDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConsistencyCheckTaskDetailsInternal)this).VMDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInconsistentVMDetails[]) content.GetValueForProperty("VMDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConsistencyCheckTaskDetailsInternal)this).VMDetail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InconsistentVMDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITaskTypeDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITaskTypeDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ConsistencyCheckTaskDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("VMDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConsistencyCheckTaskDetailsInternal)this).VMDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInconsistentVMDetails[]) content.GetValueForProperty("VMDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConsistencyCheckTaskDetailsInternal)this).VMDetail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InconsistentVMDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITaskTypeDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITaskTypeDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConsistencyCheckTaskDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ConsistencyCheckTaskDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConsistencyCheckTaskDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ConsistencyCheckTaskDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConsistencyCheckTaskDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// This class contains monitoring details of all the inconsistent Protected Entities in Vmm. + [System.ComponentModel.TypeConverter(typeof(ConsistencyCheckTaskDetailsTypeConverter))] + public partial interface IConsistencyCheckTaskDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ConsistencyCheckTaskDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ConsistencyCheckTaskDetails.TypeConverter.cs new file mode 100644 index 000000000000..c7ecedd18f5d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ConsistencyCheckTaskDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ConsistencyCheckTaskDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConsistencyCheckTaskDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConsistencyCheckTaskDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ConsistencyCheckTaskDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ConsistencyCheckTaskDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ConsistencyCheckTaskDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ConsistencyCheckTaskDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ConsistencyCheckTaskDetails.cs new file mode 100644 index 000000000000..bf5a4baad873 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ConsistencyCheckTaskDetails.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// + /// This class contains monitoring details of all the inconsistent Protected Entities in Vmm. + /// + public partial class ConsistencyCheckTaskDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConsistencyCheckTaskDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConsistencyCheckTaskDetailsInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITaskTypeDetails __taskTypeDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.TaskTypeDetails(); + + /// The type of task details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITaskTypeDetailsInternal)__taskTypeDetails).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITaskTypeDetailsInternal)__taskTypeDetails).InstanceType = value ; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInconsistentVMDetails[] _vMDetail; + + /// The list of inconsistent Vm details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInconsistentVMDetails[] VMDetail { get => this._vMDetail; set => this._vMDetail = value; } + + /// Creates an new instance. + public ConsistencyCheckTaskDetails() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__taskTypeDetails), __taskTypeDetails); + await eventListener.AssertObjectIsValid(nameof(__taskTypeDetails), __taskTypeDetails); + } + } + /// This class contains monitoring details of all the inconsistent Protected Entities in Vmm. + public partial interface IConsistencyCheckTaskDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITaskTypeDetails + { + /// The list of inconsistent Vm details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of inconsistent Vm details.", + SerializedName = @"vmDetails", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInconsistentVMDetails) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInconsistentVMDetails[] VMDetail { get; set; } + + } + /// This class contains monitoring details of all the inconsistent Protected Entities in Vmm. + internal partial interface IConsistencyCheckTaskDetailsInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITaskTypeDetailsInternal + { + /// The list of inconsistent Vm details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInconsistentVMDetails[] VMDetail { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ConsistencyCheckTaskDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ConsistencyCheckTaskDetails.json.cs new file mode 100644 index 000000000000..8e7b03f5180e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ConsistencyCheckTaskDetails.json.cs @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// + /// This class contains monitoring details of all the inconsistent Protected Entities in Vmm. + /// + public partial class ConsistencyCheckTaskDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal ConsistencyCheckTaskDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __taskTypeDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.TaskTypeDetails(json); + {_vMDetail = If( json?.PropertyT("vmDetails"), out var __jsonVMDetails) ? If( __jsonVMDetails as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInconsistentVMDetails) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InconsistentVMDetails.FromJson(__u) )) ))() : null : VMDetail;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConsistencyCheckTaskDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConsistencyCheckTaskDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConsistencyCheckTaskDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new ConsistencyCheckTaskDetails(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __taskTypeDetails?.ToJson(container, serializationMode); + if (null != this._vMDetail) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._vMDetail ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("vmDetails",__w); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateNetworkMappingInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateNetworkMappingInput.PowerShell.cs new file mode 100644 index 000000000000..6e0d864ee8de --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateNetworkMappingInput.PowerShell.cs @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Create network mappings input. + [System.ComponentModel.TypeConverter(typeof(CreateNetworkMappingInputTypeConverter))] + public partial class CreateNetworkMappingInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal CreateNetworkMappingInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateNetworkMappingInputInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateNetworkMappingInputProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateNetworkMappingInputInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.CreateNetworkMappingInputPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("FabricSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateNetworkMappingInputInternal)this).FabricSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreateNetworkMappingInput) content.GetValueForProperty("FabricSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateNetworkMappingInputInternal)this).FabricSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FabricSpecificCreateNetworkMappingInputTypeConverter.ConvertFrom); + } + if (content.Contains("RecoveryFabricName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateNetworkMappingInputInternal)this).RecoveryFabricName = (string) content.GetValueForProperty("RecoveryFabricName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateNetworkMappingInputInternal)this).RecoveryFabricName, global::System.Convert.ToString); + } + if (content.Contains("RecoveryNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateNetworkMappingInputInternal)this).RecoveryNetworkId = (string) content.GetValueForProperty("RecoveryNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateNetworkMappingInputInternal)this).RecoveryNetworkId, global::System.Convert.ToString); + } + if (content.Contains("FabricSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateNetworkMappingInputInternal)this).FabricSpecificDetailInstanceType = (string) content.GetValueForProperty("FabricSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateNetworkMappingInputInternal)this).FabricSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal CreateNetworkMappingInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateNetworkMappingInputInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateNetworkMappingInputProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateNetworkMappingInputInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.CreateNetworkMappingInputPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("FabricSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateNetworkMappingInputInternal)this).FabricSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreateNetworkMappingInput) content.GetValueForProperty("FabricSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateNetworkMappingInputInternal)this).FabricSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FabricSpecificCreateNetworkMappingInputTypeConverter.ConvertFrom); + } + if (content.Contains("RecoveryFabricName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateNetworkMappingInputInternal)this).RecoveryFabricName = (string) content.GetValueForProperty("RecoveryFabricName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateNetworkMappingInputInternal)this).RecoveryFabricName, global::System.Convert.ToString); + } + if (content.Contains("RecoveryNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateNetworkMappingInputInternal)this).RecoveryNetworkId = (string) content.GetValueForProperty("RecoveryNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateNetworkMappingInputInternal)this).RecoveryNetworkId, global::System.Convert.ToString); + } + if (content.Contains("FabricSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateNetworkMappingInputInternal)this).FabricSpecificDetailInstanceType = (string) content.GetValueForProperty("FabricSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateNetworkMappingInputInternal)this).FabricSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateNetworkMappingInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new CreateNetworkMappingInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateNetworkMappingInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new CreateNetworkMappingInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateNetworkMappingInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Create network mappings input. + [System.ComponentModel.TypeConverter(typeof(CreateNetworkMappingInputTypeConverter))] + public partial interface ICreateNetworkMappingInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateNetworkMappingInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateNetworkMappingInput.TypeConverter.cs new file mode 100644 index 000000000000..ed6cb6603195 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateNetworkMappingInput.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class CreateNetworkMappingInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateNetworkMappingInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateNetworkMappingInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return CreateNetworkMappingInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return CreateNetworkMappingInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return CreateNetworkMappingInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateNetworkMappingInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateNetworkMappingInput.cs new file mode 100644 index 000000000000..48a0530e9e5b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateNetworkMappingInput.cs @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Create network mappings input. + public partial class CreateNetworkMappingInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateNetworkMappingInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateNetworkMappingInputInternal + { + + /// The instance type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string FabricSpecificDetailInstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateNetworkMappingInputPropertiesInternal)Property).FabricSpecificDetailInstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateNetworkMappingInputPropertiesInternal)Property).FabricSpecificDetailInstanceType = value ?? null; } + + /// Internal Acessors for FabricSpecificDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreateNetworkMappingInput Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateNetworkMappingInputInternal.FabricSpecificDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateNetworkMappingInputPropertiesInternal)Property).FabricSpecificDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateNetworkMappingInputPropertiesInternal)Property).FabricSpecificDetail = value; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateNetworkMappingInputProperties Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateNetworkMappingInputInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.CreateNetworkMappingInputProperties()); set { {_property = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateNetworkMappingInputProperties _property; + + /// Input properties for creating network mapping. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateNetworkMappingInputProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.CreateNetworkMappingInputProperties()); set => this._property = value; } + + /// Recovery fabric Name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string RecoveryFabricName { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateNetworkMappingInputPropertiesInternal)Property).RecoveryFabricName; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateNetworkMappingInputPropertiesInternal)Property).RecoveryFabricName = value ?? null; } + + /// Recovery network Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string RecoveryNetworkId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateNetworkMappingInputPropertiesInternal)Property).RecoveryNetworkId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateNetworkMappingInputPropertiesInternal)Property).RecoveryNetworkId = value ; } + + /// Creates an new instance. + public CreateNetworkMappingInput() + { + + } + } + /// Create network mappings input. + public partial interface ICreateNetworkMappingInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The instance type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The instance type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string FabricSpecificDetailInstanceType { get; set; } + /// Recovery fabric Name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Recovery fabric Name.", + SerializedName = @"recoveryFabricName", + PossibleTypes = new [] { typeof(string) })] + string RecoveryFabricName { get; set; } + /// Recovery network Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Recovery network Id.", + SerializedName = @"recoveryNetworkId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryNetworkId { get; set; } + + } + /// Create network mappings input. + internal partial interface ICreateNetworkMappingInputInternal + + { + /// Fabric specific input properties. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreateNetworkMappingInput FabricSpecificDetail { get; set; } + /// The instance type. + string FabricSpecificDetailInstanceType { get; set; } + /// Input properties for creating network mapping. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateNetworkMappingInputProperties Property { get; set; } + /// Recovery fabric Name. + string RecoveryFabricName { get; set; } + /// Recovery network Id. + string RecoveryNetworkId { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateNetworkMappingInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateNetworkMappingInput.json.cs new file mode 100644 index 000000000000..72f7ee67fa2c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateNetworkMappingInput.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Create network mappings input. + public partial class CreateNetworkMappingInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal CreateNetworkMappingInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.CreateNetworkMappingInputProperties.FromJson(__jsonProperties) : Property;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateNetworkMappingInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateNetworkMappingInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateNetworkMappingInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new CreateNetworkMappingInput(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateNetworkMappingInputProperties.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateNetworkMappingInputProperties.PowerShell.cs new file mode 100644 index 000000000000..d4f243aefd6c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateNetworkMappingInputProperties.PowerShell.cs @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Common input details for network mapping operation. + [System.ComponentModel.TypeConverter(typeof(CreateNetworkMappingInputPropertiesTypeConverter))] + public partial class CreateNetworkMappingInputProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal CreateNetworkMappingInputProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("FabricSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateNetworkMappingInputPropertiesInternal)this).FabricSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreateNetworkMappingInput) content.GetValueForProperty("FabricSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateNetworkMappingInputPropertiesInternal)this).FabricSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FabricSpecificCreateNetworkMappingInputTypeConverter.ConvertFrom); + } + if (content.Contains("RecoveryFabricName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateNetworkMappingInputPropertiesInternal)this).RecoveryFabricName = (string) content.GetValueForProperty("RecoveryFabricName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateNetworkMappingInputPropertiesInternal)this).RecoveryFabricName, global::System.Convert.ToString); + } + if (content.Contains("RecoveryNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateNetworkMappingInputPropertiesInternal)this).RecoveryNetworkId = (string) content.GetValueForProperty("RecoveryNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateNetworkMappingInputPropertiesInternal)this).RecoveryNetworkId, global::System.Convert.ToString); + } + if (content.Contains("FabricSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateNetworkMappingInputPropertiesInternal)this).FabricSpecificDetailInstanceType = (string) content.GetValueForProperty("FabricSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateNetworkMappingInputPropertiesInternal)this).FabricSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal CreateNetworkMappingInputProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("FabricSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateNetworkMappingInputPropertiesInternal)this).FabricSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreateNetworkMappingInput) content.GetValueForProperty("FabricSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateNetworkMappingInputPropertiesInternal)this).FabricSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FabricSpecificCreateNetworkMappingInputTypeConverter.ConvertFrom); + } + if (content.Contains("RecoveryFabricName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateNetworkMappingInputPropertiesInternal)this).RecoveryFabricName = (string) content.GetValueForProperty("RecoveryFabricName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateNetworkMappingInputPropertiesInternal)this).RecoveryFabricName, global::System.Convert.ToString); + } + if (content.Contains("RecoveryNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateNetworkMappingInputPropertiesInternal)this).RecoveryNetworkId = (string) content.GetValueForProperty("RecoveryNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateNetworkMappingInputPropertiesInternal)this).RecoveryNetworkId, global::System.Convert.ToString); + } + if (content.Contains("FabricSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateNetworkMappingInputPropertiesInternal)this).FabricSpecificDetailInstanceType = (string) content.GetValueForProperty("FabricSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateNetworkMappingInputPropertiesInternal)this).FabricSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateNetworkMappingInputProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new CreateNetworkMappingInputProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateNetworkMappingInputProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new CreateNetworkMappingInputProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateNetworkMappingInputProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Common input details for network mapping operation. + [System.ComponentModel.TypeConverter(typeof(CreateNetworkMappingInputPropertiesTypeConverter))] + public partial interface ICreateNetworkMappingInputProperties + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateNetworkMappingInputProperties.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateNetworkMappingInputProperties.TypeConverter.cs new file mode 100644 index 000000000000..3007243e516b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateNetworkMappingInputProperties.TypeConverter.cs @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class CreateNetworkMappingInputPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateNetworkMappingInputProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateNetworkMappingInputProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return CreateNetworkMappingInputProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return CreateNetworkMappingInputProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return CreateNetworkMappingInputProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateNetworkMappingInputProperties.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateNetworkMappingInputProperties.cs new file mode 100644 index 000000000000..36768f43e522 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateNetworkMappingInputProperties.cs @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Common input details for network mapping operation. + public partial class CreateNetworkMappingInputProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateNetworkMappingInputProperties, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateNetworkMappingInputPropertiesInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreateNetworkMappingInput _fabricSpecificDetail; + + /// Fabric specific input properties. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreateNetworkMappingInput FabricSpecificDetail { get => (this._fabricSpecificDetail = this._fabricSpecificDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FabricSpecificCreateNetworkMappingInput()); set => this._fabricSpecificDetail = value; } + + /// The instance type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string FabricSpecificDetailInstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreateNetworkMappingInputInternal)FabricSpecificDetail).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreateNetworkMappingInputInternal)FabricSpecificDetail).InstanceType = value ?? null; } + + /// Internal Acessors for FabricSpecificDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreateNetworkMappingInput Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateNetworkMappingInputPropertiesInternal.FabricSpecificDetail { get => (this._fabricSpecificDetail = this._fabricSpecificDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FabricSpecificCreateNetworkMappingInput()); set { {_fabricSpecificDetail = value;} } } + + /// Backing field for property. + private string _recoveryFabricName; + + /// Recovery fabric Name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryFabricName { get => this._recoveryFabricName; set => this._recoveryFabricName = value; } + + /// Backing field for property. + private string _recoveryNetworkId; + + /// Recovery network Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryNetworkId { get => this._recoveryNetworkId; set => this._recoveryNetworkId = value; } + + /// Creates an new instance. + public CreateNetworkMappingInputProperties() + { + + } + } + /// Common input details for network mapping operation. + public partial interface ICreateNetworkMappingInputProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The instance type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The instance type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string FabricSpecificDetailInstanceType { get; set; } + /// Recovery fabric Name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Recovery fabric Name.", + SerializedName = @"recoveryFabricName", + PossibleTypes = new [] { typeof(string) })] + string RecoveryFabricName { get; set; } + /// Recovery network Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Recovery network Id.", + SerializedName = @"recoveryNetworkId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryNetworkId { get; set; } + + } + /// Common input details for network mapping operation. + internal partial interface ICreateNetworkMappingInputPropertiesInternal + + { + /// Fabric specific input properties. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreateNetworkMappingInput FabricSpecificDetail { get; set; } + /// The instance type. + string FabricSpecificDetailInstanceType { get; set; } + /// Recovery fabric Name. + string RecoveryFabricName { get; set; } + /// Recovery network Id. + string RecoveryNetworkId { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateNetworkMappingInputProperties.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateNetworkMappingInputProperties.json.cs new file mode 100644 index 000000000000..d18ea90f1efd --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateNetworkMappingInputProperties.json.cs @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Common input details for network mapping operation. + public partial class CreateNetworkMappingInputProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal CreateNetworkMappingInputProperties(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_fabricSpecificDetail = If( json?.PropertyT("fabricSpecificDetails"), out var __jsonFabricSpecificDetails) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FabricSpecificCreateNetworkMappingInput.FromJson(__jsonFabricSpecificDetails) : FabricSpecificDetail;} + {_recoveryFabricName = If( json?.PropertyT("recoveryFabricName"), out var __jsonRecoveryFabricName) ? (string)__jsonRecoveryFabricName : (string)RecoveryFabricName;} + {_recoveryNetworkId = If( json?.PropertyT("recoveryNetworkId"), out var __jsonRecoveryNetworkId) ? (string)__jsonRecoveryNetworkId : (string)RecoveryNetworkId;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateNetworkMappingInputProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateNetworkMappingInputProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateNetworkMappingInputProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new CreateNetworkMappingInputProperties(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._fabricSpecificDetail ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._fabricSpecificDetail.ToJson(null,serializationMode) : null, "fabricSpecificDetails" ,container.Add ); + AddIf( null != (((object)this._recoveryFabricName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryFabricName.ToString()) : null, "recoveryFabricName" ,container.Add ); + AddIf( null != (((object)this._recoveryNetworkId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryNetworkId.ToString()) : null, "recoveryNetworkId" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreatePolicyInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreatePolicyInput.PowerShell.cs new file mode 100644 index 000000000000..c043c4c54aa2 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreatePolicyInput.PowerShell.cs @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Protection Policy input. + [System.ComponentModel.TypeConverter(typeof(CreatePolicyInputTypeConverter))] + public partial class CreatePolicyInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal CreatePolicyInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreatePolicyInputInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreatePolicyInputProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreatePolicyInputInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.CreatePolicyInputPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificInput")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreatePolicyInputInternal)this).ProviderSpecificInput = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInput) content.GetValueForProperty("ProviderSpecificInput",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreatePolicyInputInternal)this).ProviderSpecificInput, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PolicyProviderSpecificInputTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificInputInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreatePolicyInputInternal)this).ProviderSpecificInputInstanceType = (string) content.GetValueForProperty("ProviderSpecificInputInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreatePolicyInputInternal)this).ProviderSpecificInputInstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal CreatePolicyInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreatePolicyInputInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreatePolicyInputProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreatePolicyInputInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.CreatePolicyInputPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificInput")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreatePolicyInputInternal)this).ProviderSpecificInput = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInput) content.GetValueForProperty("ProviderSpecificInput",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreatePolicyInputInternal)this).ProviderSpecificInput, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PolicyProviderSpecificInputTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificInputInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreatePolicyInputInternal)this).ProviderSpecificInputInstanceType = (string) content.GetValueForProperty("ProviderSpecificInputInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreatePolicyInputInternal)this).ProviderSpecificInputInstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreatePolicyInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new CreatePolicyInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreatePolicyInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new CreatePolicyInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreatePolicyInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Protection Policy input. + [System.ComponentModel.TypeConverter(typeof(CreatePolicyInputTypeConverter))] + public partial interface ICreatePolicyInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreatePolicyInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreatePolicyInput.TypeConverter.cs new file mode 100644 index 000000000000..7c81d6679433 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreatePolicyInput.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class CreatePolicyInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreatePolicyInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreatePolicyInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return CreatePolicyInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return CreatePolicyInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return CreatePolicyInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreatePolicyInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreatePolicyInput.cs new file mode 100644 index 000000000000..b13762dff14a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreatePolicyInput.cs @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Protection Policy input. + public partial class CreatePolicyInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreatePolicyInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreatePolicyInputInternal + { + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreatePolicyInputProperties Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreatePolicyInputInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.CreatePolicyInputProperties()); set { {_property = value;} } } + + /// Internal Acessors for ProviderSpecificInput + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInput Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreatePolicyInputInternal.ProviderSpecificInput { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreatePolicyInputPropertiesInternal)Property).ProviderSpecificInput; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreatePolicyInputPropertiesInternal)Property).ProviderSpecificInput = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreatePolicyInputProperties _property; + + /// Policy creation properties. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreatePolicyInputProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.CreatePolicyInputProperties()); set => this._property = value; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ProviderSpecificInputInstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreatePolicyInputPropertiesInternal)Property).ProviderSpecificInputInstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreatePolicyInputPropertiesInternal)Property).ProviderSpecificInputInstanceType = value ?? null; } + + /// Creates an new instance. + public CreatePolicyInput() + { + + } + } + /// Protection Policy input. + public partial interface ICreatePolicyInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string ProviderSpecificInputInstanceType { get; set; } + + } + /// Protection Policy input. + internal partial interface ICreatePolicyInputInternal + + { + /// Policy creation properties. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreatePolicyInputProperties Property { get; set; } + /// The ReplicationProviderSettings. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInput ProviderSpecificInput { get; set; } + /// The class type. + string ProviderSpecificInputInstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreatePolicyInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreatePolicyInput.json.cs new file mode 100644 index 000000000000..5fb97f7a9795 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreatePolicyInput.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Protection Policy input. + public partial class CreatePolicyInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal CreatePolicyInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.CreatePolicyInputProperties.FromJson(__jsonProperties) : Property;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreatePolicyInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreatePolicyInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreatePolicyInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new CreatePolicyInput(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreatePolicyInputProperties.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreatePolicyInputProperties.PowerShell.cs new file mode 100644 index 000000000000..695f722fba40 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreatePolicyInputProperties.PowerShell.cs @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Policy creation properties. + [System.ComponentModel.TypeConverter(typeof(CreatePolicyInputPropertiesTypeConverter))] + public partial class CreatePolicyInputProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal CreatePolicyInputProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProviderSpecificInput")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreatePolicyInputPropertiesInternal)this).ProviderSpecificInput = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInput) content.GetValueForProperty("ProviderSpecificInput",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreatePolicyInputPropertiesInternal)this).ProviderSpecificInput, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PolicyProviderSpecificInputTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificInputInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreatePolicyInputPropertiesInternal)this).ProviderSpecificInputInstanceType = (string) content.GetValueForProperty("ProviderSpecificInputInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreatePolicyInputPropertiesInternal)this).ProviderSpecificInputInstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal CreatePolicyInputProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProviderSpecificInput")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreatePolicyInputPropertiesInternal)this).ProviderSpecificInput = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInput) content.GetValueForProperty("ProviderSpecificInput",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreatePolicyInputPropertiesInternal)this).ProviderSpecificInput, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PolicyProviderSpecificInputTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificInputInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreatePolicyInputPropertiesInternal)this).ProviderSpecificInputInstanceType = (string) content.GetValueForProperty("ProviderSpecificInputInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreatePolicyInputPropertiesInternal)this).ProviderSpecificInputInstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreatePolicyInputProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new CreatePolicyInputProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreatePolicyInputProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new CreatePolicyInputProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreatePolicyInputProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Policy creation properties. + [System.ComponentModel.TypeConverter(typeof(CreatePolicyInputPropertiesTypeConverter))] + public partial interface ICreatePolicyInputProperties + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreatePolicyInputProperties.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreatePolicyInputProperties.TypeConverter.cs new file mode 100644 index 000000000000..2652b8c561ca --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreatePolicyInputProperties.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class CreatePolicyInputPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreatePolicyInputProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreatePolicyInputProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return CreatePolicyInputProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return CreatePolicyInputProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return CreatePolicyInputProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreatePolicyInputProperties.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreatePolicyInputProperties.cs new file mode 100644 index 000000000000..bc5912aae60b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreatePolicyInputProperties.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Policy creation properties. + public partial class CreatePolicyInputProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreatePolicyInputProperties, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreatePolicyInputPropertiesInternal + { + + /// Internal Acessors for ProviderSpecificInput + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInput Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreatePolicyInputPropertiesInternal.ProviderSpecificInput { get => (this._providerSpecificInput = this._providerSpecificInput ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PolicyProviderSpecificInput()); set { {_providerSpecificInput = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInput _providerSpecificInput; + + /// The ReplicationProviderSettings. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInput ProviderSpecificInput { get => (this._providerSpecificInput = this._providerSpecificInput ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PolicyProviderSpecificInput()); set => this._providerSpecificInput = value; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ProviderSpecificInputInstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInputInternal)ProviderSpecificInput).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInputInternal)ProviderSpecificInput).InstanceType = value ?? null; } + + /// Creates an new instance. + public CreatePolicyInputProperties() + { + + } + } + /// Policy creation properties. + public partial interface ICreatePolicyInputProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string ProviderSpecificInputInstanceType { get; set; } + + } + /// Policy creation properties. + internal partial interface ICreatePolicyInputPropertiesInternal + + { + /// The ReplicationProviderSettings. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInput ProviderSpecificInput { get; set; } + /// The class type. + string ProviderSpecificInputInstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreatePolicyInputProperties.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreatePolicyInputProperties.json.cs new file mode 100644 index 000000000000..bed304017fbb --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreatePolicyInputProperties.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Policy creation properties. + public partial class CreatePolicyInputProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal CreatePolicyInputProperties(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_providerSpecificInput = If( json?.PropertyT("providerSpecificInput"), out var __jsonProviderSpecificInput) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PolicyProviderSpecificInput.FromJson(__jsonProviderSpecificInput) : ProviderSpecificInput;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreatePolicyInputProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreatePolicyInputProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreatePolicyInputProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new CreatePolicyInputProperties(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._providerSpecificInput ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._providerSpecificInput.ToJson(null,serializationMode) : null, "providerSpecificInput" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateProtectionContainerInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateProtectionContainerInput.PowerShell.cs new file mode 100644 index 000000000000..a969197a9447 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateProtectionContainerInput.PowerShell.cs @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Create protection container input. + [System.ComponentModel.TypeConverter(typeof(CreateProtectionContainerInputTypeConverter))] + public partial class CreateProtectionContainerInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal CreateProtectionContainerInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerInputInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerInputProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerInputInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.CreateProtectionContainerInputPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificInput")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerInputInternal)this).ProviderSpecificInput = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerCreationInput[]) content.GetValueForProperty("ProviderSpecificInput",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerInputInternal)this).ProviderSpecificInput, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProviderSpecificContainerCreationInputTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal CreateProtectionContainerInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerInputInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerInputProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerInputInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.CreateProtectionContainerInputPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificInput")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerInputInternal)this).ProviderSpecificInput = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerCreationInput[]) content.GetValueForProperty("ProviderSpecificInput",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerInputInternal)this).ProviderSpecificInput, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProviderSpecificContainerCreationInputTypeConverter.ConvertFrom)); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new CreateProtectionContainerInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new CreateProtectionContainerInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Create protection container input. + [System.ComponentModel.TypeConverter(typeof(CreateProtectionContainerInputTypeConverter))] + public partial interface ICreateProtectionContainerInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateProtectionContainerInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateProtectionContainerInput.TypeConverter.cs new file mode 100644 index 000000000000..4ee8b3653129 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateProtectionContainerInput.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class CreateProtectionContainerInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return CreateProtectionContainerInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return CreateProtectionContainerInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return CreateProtectionContainerInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateProtectionContainerInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateProtectionContainerInput.cs new file mode 100644 index 000000000000..d4690011b415 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateProtectionContainerInput.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Create protection container input. + public partial class CreateProtectionContainerInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerInputInternal + { + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerInputProperties Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerInputInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.CreateProtectionContainerInputProperties()); set { {_property = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerInputProperties _property; + + /// Create protection container input properties. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerInputProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.CreateProtectionContainerInputProperties()); set => this._property = value; } + + /// Provider specific inputs for container creation. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerCreationInput[] ProviderSpecificInput { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerInputPropertiesInternal)Property).ProviderSpecificInput; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerInputPropertiesInternal)Property).ProviderSpecificInput = value ?? null /* arrayOf */; } + + /// Creates an new instance. + public CreateProtectionContainerInput() + { + + } + } + /// Create protection container input. + public partial interface ICreateProtectionContainerInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// Provider specific inputs for container creation. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Provider specific inputs for container creation.", + SerializedName = @"providerSpecificInput", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerCreationInput) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerCreationInput[] ProviderSpecificInput { get; set; } + + } + /// Create protection container input. + internal partial interface ICreateProtectionContainerInputInternal + + { + /// Create protection container input properties. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerInputProperties Property { get; set; } + /// Provider specific inputs for container creation. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerCreationInput[] ProviderSpecificInput { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateProtectionContainerInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateProtectionContainerInput.json.cs new file mode 100644 index 000000000000..9948a8cd3f32 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateProtectionContainerInput.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Create protection container input. + public partial class CreateProtectionContainerInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal CreateProtectionContainerInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.CreateProtectionContainerInputProperties.FromJson(__jsonProperties) : Property;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new CreateProtectionContainerInput(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateProtectionContainerInputProperties.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateProtectionContainerInputProperties.PowerShell.cs new file mode 100644 index 000000000000..86972e09f31a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateProtectionContainerInputProperties.PowerShell.cs @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Create protection container input properties. + [System.ComponentModel.TypeConverter(typeof(CreateProtectionContainerInputPropertiesTypeConverter))] + public partial class CreateProtectionContainerInputProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal CreateProtectionContainerInputProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProviderSpecificInput")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerInputPropertiesInternal)this).ProviderSpecificInput = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerCreationInput[]) content.GetValueForProperty("ProviderSpecificInput",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerInputPropertiesInternal)this).ProviderSpecificInput, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProviderSpecificContainerCreationInputTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal CreateProtectionContainerInputProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProviderSpecificInput")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerInputPropertiesInternal)this).ProviderSpecificInput = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerCreationInput[]) content.GetValueForProperty("ProviderSpecificInput",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerInputPropertiesInternal)this).ProviderSpecificInput, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProviderSpecificContainerCreationInputTypeConverter.ConvertFrom)); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerInputProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new CreateProtectionContainerInputProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerInputProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new CreateProtectionContainerInputProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json + /// string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerInputProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Create protection container input properties. + [System.ComponentModel.TypeConverter(typeof(CreateProtectionContainerInputPropertiesTypeConverter))] + public partial interface ICreateProtectionContainerInputProperties + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateProtectionContainerInputProperties.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateProtectionContainerInputProperties.TypeConverter.cs new file mode 100644 index 000000000000..0db59d0cf7da --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateProtectionContainerInputProperties.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class CreateProtectionContainerInputPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerInputProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerInputProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return CreateProtectionContainerInputProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return CreateProtectionContainerInputProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return CreateProtectionContainerInputProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateProtectionContainerInputProperties.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateProtectionContainerInputProperties.cs new file mode 100644 index 000000000000..6560832d2541 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateProtectionContainerInputProperties.cs @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Create protection container input properties. + public partial class CreateProtectionContainerInputProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerInputProperties, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerInputPropertiesInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerCreationInput[] _providerSpecificInput; + + /// Provider specific inputs for container creation. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerCreationInput[] ProviderSpecificInput { get => this._providerSpecificInput; set => this._providerSpecificInput = value; } + + /// + /// Creates an new instance. + /// + public CreateProtectionContainerInputProperties() + { + + } + } + /// Create protection container input properties. + public partial interface ICreateProtectionContainerInputProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// Provider specific inputs for container creation. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Provider specific inputs for container creation.", + SerializedName = @"providerSpecificInput", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerCreationInput) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerCreationInput[] ProviderSpecificInput { get; set; } + + } + /// Create protection container input properties. + internal partial interface ICreateProtectionContainerInputPropertiesInternal + + { + /// Provider specific inputs for container creation. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerCreationInput[] ProviderSpecificInput { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateProtectionContainerInputProperties.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateProtectionContainerInputProperties.json.cs new file mode 100644 index 000000000000..1e8c41a8ea7b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateProtectionContainerInputProperties.json.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Create protection container input properties. + public partial class CreateProtectionContainerInputProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal CreateProtectionContainerInputProperties(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_providerSpecificInput = If( json?.PropertyT("providerSpecificInput"), out var __jsonProviderSpecificInput) ? If( __jsonProviderSpecificInput as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerCreationInput) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProviderSpecificContainerCreationInput.FromJson(__u) )) ))() : null : ProviderSpecificInput;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerInputProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerInputProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerInputProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new CreateProtectionContainerInputProperties(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._providerSpecificInput) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._providerSpecificInput ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("providerSpecificInput",__w); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateProtectionContainerMappingInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateProtectionContainerMappingInput.PowerShell.cs new file mode 100644 index 000000000000..947fe8a267c1 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateProtectionContainerMappingInput.PowerShell.cs @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Configure pairing input. + [System.ComponentModel.TypeConverter(typeof(CreateProtectionContainerMappingInputTypeConverter))] + public partial class CreateProtectionContainerMappingInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal CreateProtectionContainerMappingInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerMappingInputInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerMappingInputProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerMappingInputInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.CreateProtectionContainerMappingInputPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificInput")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerMappingInputInternal)this).ProviderSpecificInput = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerMappingInput) content.GetValueForProperty("ProviderSpecificInput",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerMappingInputInternal)this).ProviderSpecificInput, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProviderSpecificContainerMappingInputTypeConverter.ConvertFrom); + } + if (content.Contains("TargetProtectionContainerId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerMappingInputInternal)this).TargetProtectionContainerId = (string) content.GetValueForProperty("TargetProtectionContainerId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerMappingInputInternal)this).TargetProtectionContainerId, global::System.Convert.ToString); + } + if (content.Contains("PolicyId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerMappingInputInternal)this).PolicyId = (string) content.GetValueForProperty("PolicyId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerMappingInputInternal)this).PolicyId, global::System.Convert.ToString); + } + if (content.Contains("ProviderSpecificInputInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerMappingInputInternal)this).ProviderSpecificInputInstanceType = (string) content.GetValueForProperty("ProviderSpecificInputInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerMappingInputInternal)this).ProviderSpecificInputInstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal CreateProtectionContainerMappingInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerMappingInputInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerMappingInputProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerMappingInputInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.CreateProtectionContainerMappingInputPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificInput")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerMappingInputInternal)this).ProviderSpecificInput = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerMappingInput) content.GetValueForProperty("ProviderSpecificInput",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerMappingInputInternal)this).ProviderSpecificInput, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProviderSpecificContainerMappingInputTypeConverter.ConvertFrom); + } + if (content.Contains("TargetProtectionContainerId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerMappingInputInternal)this).TargetProtectionContainerId = (string) content.GetValueForProperty("TargetProtectionContainerId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerMappingInputInternal)this).TargetProtectionContainerId, global::System.Convert.ToString); + } + if (content.Contains("PolicyId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerMappingInputInternal)this).PolicyId = (string) content.GetValueForProperty("PolicyId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerMappingInputInternal)this).PolicyId, global::System.Convert.ToString); + } + if (content.Contains("ProviderSpecificInputInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerMappingInputInternal)this).ProviderSpecificInputInstanceType = (string) content.GetValueForProperty("ProviderSpecificInputInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerMappingInputInternal)this).ProviderSpecificInputInstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerMappingInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new CreateProtectionContainerMappingInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerMappingInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new CreateProtectionContainerMappingInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json + /// string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerMappingInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Configure pairing input. + [System.ComponentModel.TypeConverter(typeof(CreateProtectionContainerMappingInputTypeConverter))] + public partial interface ICreateProtectionContainerMappingInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateProtectionContainerMappingInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateProtectionContainerMappingInput.TypeConverter.cs new file mode 100644 index 000000000000..c29e37d1da20 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateProtectionContainerMappingInput.TypeConverter.cs @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class CreateProtectionContainerMappingInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerMappingInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerMappingInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return CreateProtectionContainerMappingInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return CreateProtectionContainerMappingInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return CreateProtectionContainerMappingInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateProtectionContainerMappingInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateProtectionContainerMappingInput.cs new file mode 100644 index 000000000000..1f61cc0f4354 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateProtectionContainerMappingInput.cs @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Configure pairing input. + public partial class CreateProtectionContainerMappingInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerMappingInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerMappingInputInternal + { + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerMappingInputProperties Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerMappingInputInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.CreateProtectionContainerMappingInputProperties()); set { {_property = value;} } } + + /// Internal Acessors for ProviderSpecificInput + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerMappingInput Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerMappingInputInternal.ProviderSpecificInput { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerMappingInputPropertiesInternal)Property).ProviderSpecificInput; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerMappingInputPropertiesInternal)Property).ProviderSpecificInput = value; } + + /// Applicable policy. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string PolicyId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerMappingInputPropertiesInternal)Property).PolicyId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerMappingInputPropertiesInternal)Property).PolicyId = value ?? null; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerMappingInputProperties _property; + + /// Configure protection input properties. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerMappingInputProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.CreateProtectionContainerMappingInputProperties()); set => this._property = value; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ProviderSpecificInputInstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerMappingInputPropertiesInternal)Property).ProviderSpecificInputInstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerMappingInputPropertiesInternal)Property).ProviderSpecificInputInstanceType = value ?? null; } + + /// The target unique protection container name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string TargetProtectionContainerId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerMappingInputPropertiesInternal)Property).TargetProtectionContainerId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerMappingInputPropertiesInternal)Property).TargetProtectionContainerId = value ?? null; } + + /// Creates an new instance. + public CreateProtectionContainerMappingInput() + { + + } + } + /// Configure pairing input. + public partial interface ICreateProtectionContainerMappingInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// Applicable policy. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Applicable policy.", + SerializedName = @"policyId", + PossibleTypes = new [] { typeof(string) })] + string PolicyId { get; set; } + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string ProviderSpecificInputInstanceType { get; set; } + /// The target unique protection container name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target unique protection container name.", + SerializedName = @"targetProtectionContainerId", + PossibleTypes = new [] { typeof(string) })] + string TargetProtectionContainerId { get; set; } + + } + /// Configure pairing input. + internal partial interface ICreateProtectionContainerMappingInputInternal + + { + /// Applicable policy. + string PolicyId { get; set; } + /// Configure protection input properties. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerMappingInputProperties Property { get; set; } + /// Provider specific input for pairing. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerMappingInput ProviderSpecificInput { get; set; } + /// The class type. + string ProviderSpecificInputInstanceType { get; set; } + /// The target unique protection container name. + string TargetProtectionContainerId { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateProtectionContainerMappingInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateProtectionContainerMappingInput.json.cs new file mode 100644 index 000000000000..3961ec8f2624 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateProtectionContainerMappingInput.json.cs @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Configure pairing input. + public partial class CreateProtectionContainerMappingInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal CreateProtectionContainerMappingInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.CreateProtectionContainerMappingInputProperties.FromJson(__jsonProperties) : Property;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerMappingInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerMappingInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerMappingInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new CreateProtectionContainerMappingInput(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateProtectionContainerMappingInputProperties.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateProtectionContainerMappingInputProperties.PowerShell.cs new file mode 100644 index 000000000000..6abf6bfd25be --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateProtectionContainerMappingInputProperties.PowerShell.cs @@ -0,0 +1,173 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Configure pairing input properties. + [System.ComponentModel.TypeConverter(typeof(CreateProtectionContainerMappingInputPropertiesTypeConverter))] + public partial class CreateProtectionContainerMappingInputProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal CreateProtectionContainerMappingInputProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProviderSpecificInput")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerMappingInputPropertiesInternal)this).ProviderSpecificInput = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerMappingInput) content.GetValueForProperty("ProviderSpecificInput",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerMappingInputPropertiesInternal)this).ProviderSpecificInput, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProviderSpecificContainerMappingInputTypeConverter.ConvertFrom); + } + if (content.Contains("TargetProtectionContainerId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerMappingInputPropertiesInternal)this).TargetProtectionContainerId = (string) content.GetValueForProperty("TargetProtectionContainerId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerMappingInputPropertiesInternal)this).TargetProtectionContainerId, global::System.Convert.ToString); + } + if (content.Contains("PolicyId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerMappingInputPropertiesInternal)this).PolicyId = (string) content.GetValueForProperty("PolicyId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerMappingInputPropertiesInternal)this).PolicyId, global::System.Convert.ToString); + } + if (content.Contains("ProviderSpecificInputInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerMappingInputPropertiesInternal)this).ProviderSpecificInputInstanceType = (string) content.GetValueForProperty("ProviderSpecificInputInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerMappingInputPropertiesInternal)this).ProviderSpecificInputInstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal CreateProtectionContainerMappingInputProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProviderSpecificInput")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerMappingInputPropertiesInternal)this).ProviderSpecificInput = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerMappingInput) content.GetValueForProperty("ProviderSpecificInput",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerMappingInputPropertiesInternal)this).ProviderSpecificInput, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProviderSpecificContainerMappingInputTypeConverter.ConvertFrom); + } + if (content.Contains("TargetProtectionContainerId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerMappingInputPropertiesInternal)this).TargetProtectionContainerId = (string) content.GetValueForProperty("TargetProtectionContainerId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerMappingInputPropertiesInternal)this).TargetProtectionContainerId, global::System.Convert.ToString); + } + if (content.Contains("PolicyId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerMappingInputPropertiesInternal)this).PolicyId = (string) content.GetValueForProperty("PolicyId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerMappingInputPropertiesInternal)this).PolicyId, global::System.Convert.ToString); + } + if (content.Contains("ProviderSpecificInputInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerMappingInputPropertiesInternal)this).ProviderSpecificInputInstanceType = (string) content.GetValueForProperty("ProviderSpecificInputInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerMappingInputPropertiesInternal)this).ProviderSpecificInputInstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerMappingInputProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new CreateProtectionContainerMappingInputProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerMappingInputProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new CreateProtectionContainerMappingInputProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from + /// a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerMappingInputProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Configure pairing input properties. + [System.ComponentModel.TypeConverter(typeof(CreateProtectionContainerMappingInputPropertiesTypeConverter))] + public partial interface ICreateProtectionContainerMappingInputProperties + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateProtectionContainerMappingInputProperties.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateProtectionContainerMappingInputProperties.TypeConverter.cs new file mode 100644 index 000000000000..914986c800aa --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateProtectionContainerMappingInputProperties.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class CreateProtectionContainerMappingInputPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, + /// otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerMappingInputProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerMappingInputProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return CreateProtectionContainerMappingInputProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return CreateProtectionContainerMappingInputProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return CreateProtectionContainerMappingInputProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateProtectionContainerMappingInputProperties.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateProtectionContainerMappingInputProperties.cs new file mode 100644 index 000000000000..326f3f2ac89d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateProtectionContainerMappingInputProperties.cs @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Configure pairing input properties. + public partial class CreateProtectionContainerMappingInputProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerMappingInputProperties, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerMappingInputPropertiesInternal + { + + /// Internal Acessors for ProviderSpecificInput + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerMappingInput Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerMappingInputPropertiesInternal.ProviderSpecificInput { get => (this._providerSpecificInput = this._providerSpecificInput ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProviderSpecificContainerMappingInput()); set { {_providerSpecificInput = value;} } } + + /// Backing field for property. + private string _policyId; + + /// Applicable policy. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string PolicyId { get => this._policyId; set => this._policyId = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerMappingInput _providerSpecificInput; + + /// Provider specific input for pairing. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerMappingInput ProviderSpecificInput { get => (this._providerSpecificInput = this._providerSpecificInput ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProviderSpecificContainerMappingInput()); set => this._providerSpecificInput = value; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ProviderSpecificInputInstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerMappingInputInternal)ProviderSpecificInput).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerMappingInputInternal)ProviderSpecificInput).InstanceType = value ?? null; } + + /// Backing field for property. + private string _targetProtectionContainerId; + + /// The target unique protection container name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetProtectionContainerId { get => this._targetProtectionContainerId; set => this._targetProtectionContainerId = value; } + + /// + /// Creates an new instance. + /// + public CreateProtectionContainerMappingInputProperties() + { + + } + } + /// Configure pairing input properties. + public partial interface ICreateProtectionContainerMappingInputProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// Applicable policy. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Applicable policy.", + SerializedName = @"policyId", + PossibleTypes = new [] { typeof(string) })] + string PolicyId { get; set; } + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string ProviderSpecificInputInstanceType { get; set; } + /// The target unique protection container name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target unique protection container name.", + SerializedName = @"targetProtectionContainerId", + PossibleTypes = new [] { typeof(string) })] + string TargetProtectionContainerId { get; set; } + + } + /// Configure pairing input properties. + internal partial interface ICreateProtectionContainerMappingInputPropertiesInternal + + { + /// Applicable policy. + string PolicyId { get; set; } + /// Provider specific input for pairing. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerMappingInput ProviderSpecificInput { get; set; } + /// The class type. + string ProviderSpecificInputInstanceType { get; set; } + /// The target unique protection container name. + string TargetProtectionContainerId { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateProtectionContainerMappingInputProperties.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateProtectionContainerMappingInputProperties.json.cs new file mode 100644 index 000000000000..3b8a1a997a7e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateProtectionContainerMappingInputProperties.json.cs @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Configure pairing input properties. + public partial class CreateProtectionContainerMappingInputProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal CreateProtectionContainerMappingInputProperties(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_providerSpecificInput = If( json?.PropertyT("providerSpecificInput"), out var __jsonProviderSpecificInput) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProviderSpecificContainerMappingInput.FromJson(__jsonProviderSpecificInput) : ProviderSpecificInput;} + {_targetProtectionContainerId = If( json?.PropertyT("targetProtectionContainerId"), out var __jsonTargetProtectionContainerId) ? (string)__jsonTargetProtectionContainerId : (string)TargetProtectionContainerId;} + {_policyId = If( json?.PropertyT("policyId"), out var __jsonPolicyId) ? (string)__jsonPolicyId : (string)PolicyId;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerMappingInputProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerMappingInputProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerMappingInputProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new CreateProtectionContainerMappingInputProperties(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._providerSpecificInput ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._providerSpecificInput.ToJson(null,serializationMode) : null, "providerSpecificInput" ,container.Add ); + AddIf( null != (((object)this._targetProtectionContainerId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetProtectionContainerId.ToString()) : null, "targetProtectionContainerId" ,container.Add ); + AddIf( null != (((object)this._policyId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._policyId.ToString()) : null, "policyId" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateProtectionIntentInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateProtectionIntentInput.PowerShell.cs new file mode 100644 index 000000000000..1119d08f7de8 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateProtectionIntentInput.PowerShell.cs @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Create protection intent input. + [System.ComponentModel.TypeConverter(typeof(CreateProtectionIntentInputTypeConverter))] + public partial class CreateProtectionIntentInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal CreateProtectionIntentInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionIntentInputInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionIntentProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionIntentInputInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.CreateProtectionIntentPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionIntentInputInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionIntentProviderSpecificDetails) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionIntentInputInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.CreateProtectionIntentProviderSpecificDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionIntentInputInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionIntentInputInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal CreateProtectionIntentInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionIntentInputInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionIntentProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionIntentInputInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.CreateProtectionIntentPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionIntentInputInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionIntentProviderSpecificDetails) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionIntentInputInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.CreateProtectionIntentProviderSpecificDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionIntentInputInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionIntentInputInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionIntentInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new CreateProtectionIntentInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionIntentInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new CreateProtectionIntentInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionIntentInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Create protection intent input. + [System.ComponentModel.TypeConverter(typeof(CreateProtectionIntentInputTypeConverter))] + public partial interface ICreateProtectionIntentInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateProtectionIntentInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateProtectionIntentInput.TypeConverter.cs new file mode 100644 index 000000000000..d5a46843f293 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateProtectionIntentInput.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class CreateProtectionIntentInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionIntentInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionIntentInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return CreateProtectionIntentInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return CreateProtectionIntentInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return CreateProtectionIntentInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateProtectionIntentInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateProtectionIntentInput.cs new file mode 100644 index 000000000000..1e7bced76f68 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateProtectionIntentInput.cs @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Create protection intent input. + public partial class CreateProtectionIntentInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionIntentInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionIntentInputInternal + { + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionIntentProperties Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionIntentInputInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.CreateProtectionIntentProperties()); set { {_property = value;} } } + + /// Internal Acessors for ProviderSpecificDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionIntentProviderSpecificDetails Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionIntentInputInternal.ProviderSpecificDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionIntentPropertiesInternal)Property).ProviderSpecificDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionIntentPropertiesInternal)Property).ProviderSpecificDetail = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionIntentProperties _property; + + /// Create protection intent input properties. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionIntentProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.CreateProtectionIntentProperties()); set => this._property = value; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ProviderSpecificDetailInstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionIntentPropertiesInternal)Property).ProviderSpecificDetailInstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionIntentPropertiesInternal)Property).ProviderSpecificDetailInstanceType = value ?? null; } + + /// Creates an new instance. + public CreateProtectionIntentInput() + { + + } + } + /// Create protection intent input. + public partial interface ICreateProtectionIntentInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string ProviderSpecificDetailInstanceType { get; set; } + + } + /// Create protection intent input. + internal partial interface ICreateProtectionIntentInputInternal + + { + /// Create protection intent input properties. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionIntentProperties Property { get; set; } + /// + /// The ReplicationProviderInput. For A2A provider, it will be A2ACreateProtectionIntentInput object. + /// + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionIntentProviderSpecificDetails ProviderSpecificDetail { get; set; } + /// The class type. + string ProviderSpecificDetailInstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateProtectionIntentInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateProtectionIntentInput.json.cs new file mode 100644 index 000000000000..7b627cae8caa --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateProtectionIntentInput.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Create protection intent input. + public partial class CreateProtectionIntentInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal CreateProtectionIntentInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.CreateProtectionIntentProperties.FromJson(__jsonProperties) : Property;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionIntentInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionIntentInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionIntentInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new CreateProtectionIntentInput(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateProtectionIntentProperties.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateProtectionIntentProperties.PowerShell.cs new file mode 100644 index 000000000000..8016b42445c8 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateProtectionIntentProperties.PowerShell.cs @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Create protection intent input properties. + [System.ComponentModel.TypeConverter(typeof(CreateProtectionIntentPropertiesTypeConverter))] + public partial class CreateProtectionIntentProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal CreateProtectionIntentProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionIntentPropertiesInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionIntentProviderSpecificDetails) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionIntentPropertiesInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.CreateProtectionIntentProviderSpecificDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionIntentPropertiesInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionIntentPropertiesInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal CreateProtectionIntentProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionIntentPropertiesInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionIntentProviderSpecificDetails) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionIntentPropertiesInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.CreateProtectionIntentProviderSpecificDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionIntentPropertiesInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionIntentPropertiesInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionIntentProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new CreateProtectionIntentProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionIntentProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new CreateProtectionIntentProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionIntentProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Create protection intent input properties. + [System.ComponentModel.TypeConverter(typeof(CreateProtectionIntentPropertiesTypeConverter))] + public partial interface ICreateProtectionIntentProperties + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateProtectionIntentProperties.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateProtectionIntentProperties.TypeConverter.cs new file mode 100644 index 000000000000..9b644eea4dd1 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateProtectionIntentProperties.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class CreateProtectionIntentPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionIntentProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionIntentProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return CreateProtectionIntentProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return CreateProtectionIntentProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return CreateProtectionIntentProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateProtectionIntentProperties.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateProtectionIntentProperties.cs new file mode 100644 index 000000000000..3d81d165b574 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateProtectionIntentProperties.cs @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Create protection intent input properties. + public partial class CreateProtectionIntentProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionIntentProperties, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionIntentPropertiesInternal + { + + /// Internal Acessors for ProviderSpecificDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionIntentProviderSpecificDetails Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionIntentPropertiesInternal.ProviderSpecificDetail { get => (this._providerSpecificDetail = this._providerSpecificDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.CreateProtectionIntentProviderSpecificDetails()); set { {_providerSpecificDetail = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionIntentProviderSpecificDetails _providerSpecificDetail; + + /// + /// The ReplicationProviderInput. For A2A provider, it will be A2ACreateProtectionIntentInput object. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionIntentProviderSpecificDetails ProviderSpecificDetail { get => (this._providerSpecificDetail = this._providerSpecificDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.CreateProtectionIntentProviderSpecificDetails()); set => this._providerSpecificDetail = value; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ProviderSpecificDetailInstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionIntentProviderSpecificDetailsInternal)ProviderSpecificDetail).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionIntentProviderSpecificDetailsInternal)ProviderSpecificDetail).InstanceType = value ?? null; } + + /// Creates an new instance. + public CreateProtectionIntentProperties() + { + + } + } + /// Create protection intent input properties. + public partial interface ICreateProtectionIntentProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string ProviderSpecificDetailInstanceType { get; set; } + + } + /// Create protection intent input properties. + internal partial interface ICreateProtectionIntentPropertiesInternal + + { + /// + /// The ReplicationProviderInput. For A2A provider, it will be A2ACreateProtectionIntentInput object. + /// + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionIntentProviderSpecificDetails ProviderSpecificDetail { get; set; } + /// The class type. + string ProviderSpecificDetailInstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateProtectionIntentProperties.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateProtectionIntentProperties.json.cs new file mode 100644 index 000000000000..e18b95c4581c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateProtectionIntentProperties.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Create protection intent input properties. + public partial class CreateProtectionIntentProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal CreateProtectionIntentProperties(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_providerSpecificDetail = If( json?.PropertyT("providerSpecificDetails"), out var __jsonProviderSpecificDetails) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.CreateProtectionIntentProviderSpecificDetails.FromJson(__jsonProviderSpecificDetails) : ProviderSpecificDetail;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionIntentProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionIntentProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionIntentProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new CreateProtectionIntentProperties(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._providerSpecificDetail ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._providerSpecificDetail.ToJson(null,serializationMode) : null, "providerSpecificDetails" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateProtectionIntentProviderSpecificDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateProtectionIntentProviderSpecificDetails.PowerShell.cs new file mode 100644 index 000000000000..4cb1da4147f8 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateProtectionIntentProviderSpecificDetails.PowerShell.cs @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Create protection intent provider specific input. + [System.ComponentModel.TypeConverter(typeof(CreateProtectionIntentProviderSpecificDetailsTypeConverter))] + public partial class CreateProtectionIntentProviderSpecificDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal CreateProtectionIntentProviderSpecificDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionIntentProviderSpecificDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionIntentProviderSpecificDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal CreateProtectionIntentProviderSpecificDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionIntentProviderSpecificDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionIntentProviderSpecificDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionIntentProviderSpecificDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new CreateProtectionIntentProviderSpecificDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionIntentProviderSpecificDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new CreateProtectionIntentProviderSpecificDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from + /// a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionIntentProviderSpecificDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Create protection intent provider specific input. + [System.ComponentModel.TypeConverter(typeof(CreateProtectionIntentProviderSpecificDetailsTypeConverter))] + public partial interface ICreateProtectionIntentProviderSpecificDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateProtectionIntentProviderSpecificDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateProtectionIntentProviderSpecificDetails.TypeConverter.cs new file mode 100644 index 000000000000..85d75479111c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateProtectionIntentProviderSpecificDetails.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class CreateProtectionIntentProviderSpecificDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, + /// otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionIntentProviderSpecificDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionIntentProviderSpecificDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return CreateProtectionIntentProviderSpecificDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return CreateProtectionIntentProviderSpecificDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return CreateProtectionIntentProviderSpecificDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateProtectionIntentProviderSpecificDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateProtectionIntentProviderSpecificDetails.cs new file mode 100644 index 000000000000..877426bfe858 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateProtectionIntentProviderSpecificDetails.cs @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Create protection intent provider specific input. + public partial class CreateProtectionIntentProviderSpecificDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionIntentProviderSpecificDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionIntentProviderSpecificDetailsInternal + { + + /// Backing field for property. + private string _instanceType; + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string InstanceType { get => this._instanceType; set => this._instanceType = value; } + + /// + /// Creates an new instance. + /// + public CreateProtectionIntentProviderSpecificDetails() + { + + } + } + /// Create protection intent provider specific input. + public partial interface ICreateProtectionIntentProviderSpecificDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string InstanceType { get; set; } + + } + /// Create protection intent provider specific input. + internal partial interface ICreateProtectionIntentProviderSpecificDetailsInternal + + { + /// The class type. + string InstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateProtectionIntentProviderSpecificDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateProtectionIntentProviderSpecificDetails.json.cs new file mode 100644 index 000000000000..94992624caf5 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateProtectionIntentProviderSpecificDetails.json.cs @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Create protection intent provider specific input. + public partial class CreateProtectionIntentProviderSpecificDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal CreateProtectionIntentProviderSpecificDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_instanceType = If( json?.PropertyT("instanceType"), out var __jsonInstanceType) ? (string)__jsonInstanceType : (string)InstanceType;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionIntentProviderSpecificDetails. + /// Note: the Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionIntentProviderSpecificDetails + /// interface is polymorphic, and the precise model class that will get deserialized is determined at runtime based on the + /// payload. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionIntentProviderSpecificDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionIntentProviderSpecificDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + if (!(node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json)) + { + return null; + } + // Polymorphic type -- select the appropriate constructor using the discriminator + + switch ( json.StringProperty("instanceType") ) + { + case "A2A": + { + return new A2ACreateProtectionIntentInput(json); + } + } + return new CreateProtectionIntentProviderSpecificDetails(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._instanceType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._instanceType.ToString()) : null, "instanceType" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateRecoveryPlanInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateRecoveryPlanInput.PowerShell.cs new file mode 100644 index 000000000000..b1bcfc1428bc --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateRecoveryPlanInput.PowerShell.cs @@ -0,0 +1,184 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Create recovery plan input class. + [System.ComponentModel.TypeConverter(typeof(CreateRecoveryPlanInputTypeConverter))] + public partial class CreateRecoveryPlanInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal CreateRecoveryPlanInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateRecoveryPlanInputInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateRecoveryPlanInputProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateRecoveryPlanInputInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.CreateRecoveryPlanInputPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("PrimaryFabricId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateRecoveryPlanInputInternal)this).PrimaryFabricId = (string) content.GetValueForProperty("PrimaryFabricId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateRecoveryPlanInputInternal)this).PrimaryFabricId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryFabricId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateRecoveryPlanInputInternal)this).RecoveryFabricId = (string) content.GetValueForProperty("RecoveryFabricId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateRecoveryPlanInputInternal)this).RecoveryFabricId, global::System.Convert.ToString); + } + if (content.Contains("FailoverDeploymentModel")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateRecoveryPlanInputInternal)this).FailoverDeploymentModel = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.FailoverDeploymentModel?) content.GetValueForProperty("FailoverDeploymentModel",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateRecoveryPlanInputInternal)this).FailoverDeploymentModel, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.FailoverDeploymentModel.CreateFrom); + } + if (content.Contains("Group")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateRecoveryPlanInputInternal)this).Group = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroup[]) content.GetValueForProperty("Group",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateRecoveryPlanInputInternal)this).Group, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanGroupTypeConverter.ConvertFrom)); + } + if (content.Contains("ProviderSpecificInput")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateRecoveryPlanInputInternal)this).ProviderSpecificInput = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificInput[]) content.GetValueForProperty("ProviderSpecificInput",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateRecoveryPlanInputInternal)this).ProviderSpecificInput, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanProviderSpecificInputTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal CreateRecoveryPlanInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateRecoveryPlanInputInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateRecoveryPlanInputProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateRecoveryPlanInputInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.CreateRecoveryPlanInputPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("PrimaryFabricId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateRecoveryPlanInputInternal)this).PrimaryFabricId = (string) content.GetValueForProperty("PrimaryFabricId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateRecoveryPlanInputInternal)this).PrimaryFabricId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryFabricId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateRecoveryPlanInputInternal)this).RecoveryFabricId = (string) content.GetValueForProperty("RecoveryFabricId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateRecoveryPlanInputInternal)this).RecoveryFabricId, global::System.Convert.ToString); + } + if (content.Contains("FailoverDeploymentModel")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateRecoveryPlanInputInternal)this).FailoverDeploymentModel = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.FailoverDeploymentModel?) content.GetValueForProperty("FailoverDeploymentModel",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateRecoveryPlanInputInternal)this).FailoverDeploymentModel, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.FailoverDeploymentModel.CreateFrom); + } + if (content.Contains("Group")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateRecoveryPlanInputInternal)this).Group = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroup[]) content.GetValueForProperty("Group",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateRecoveryPlanInputInternal)this).Group, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanGroupTypeConverter.ConvertFrom)); + } + if (content.Contains("ProviderSpecificInput")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateRecoveryPlanInputInternal)this).ProviderSpecificInput = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificInput[]) content.GetValueForProperty("ProviderSpecificInput",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateRecoveryPlanInputInternal)this).ProviderSpecificInput, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanProviderSpecificInputTypeConverter.ConvertFrom)); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateRecoveryPlanInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new CreateRecoveryPlanInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateRecoveryPlanInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new CreateRecoveryPlanInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateRecoveryPlanInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Create recovery plan input class. + [System.ComponentModel.TypeConverter(typeof(CreateRecoveryPlanInputTypeConverter))] + public partial interface ICreateRecoveryPlanInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateRecoveryPlanInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateRecoveryPlanInput.TypeConverter.cs new file mode 100644 index 000000000000..af6d3eaf9691 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateRecoveryPlanInput.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class CreateRecoveryPlanInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateRecoveryPlanInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateRecoveryPlanInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return CreateRecoveryPlanInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return CreateRecoveryPlanInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return CreateRecoveryPlanInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateRecoveryPlanInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateRecoveryPlanInput.cs new file mode 100644 index 000000000000..bb8f7e16cece --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateRecoveryPlanInput.cs @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Create recovery plan input class. + public partial class CreateRecoveryPlanInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateRecoveryPlanInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateRecoveryPlanInputInternal + { + + /// The failover deployment model. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.FailoverDeploymentModel? FailoverDeploymentModel { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateRecoveryPlanInputPropertiesInternal)Property).FailoverDeploymentModel; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateRecoveryPlanInputPropertiesInternal)Property).FailoverDeploymentModel = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.FailoverDeploymentModel)""); } + + /// The recovery plan groups. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroup[] Group { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateRecoveryPlanInputPropertiesInternal)Property).Group; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateRecoveryPlanInputPropertiesInternal)Property).Group = value ; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateRecoveryPlanInputProperties Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateRecoveryPlanInputInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.CreateRecoveryPlanInputProperties()); set { {_property = value;} } } + + /// The primary fabric Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string PrimaryFabricId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateRecoveryPlanInputPropertiesInternal)Property).PrimaryFabricId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateRecoveryPlanInputPropertiesInternal)Property).PrimaryFabricId = value ; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateRecoveryPlanInputProperties _property; + + /// Recovery plan creation properties. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateRecoveryPlanInputProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.CreateRecoveryPlanInputProperties()); set => this._property = value; } + + /// The provider specific input. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificInput[] ProviderSpecificInput { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateRecoveryPlanInputPropertiesInternal)Property).ProviderSpecificInput; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateRecoveryPlanInputPropertiesInternal)Property).ProviderSpecificInput = value ?? null /* arrayOf */; } + + /// The recovery fabric Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string RecoveryFabricId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateRecoveryPlanInputPropertiesInternal)Property).RecoveryFabricId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateRecoveryPlanInputPropertiesInternal)Property).RecoveryFabricId = value ; } + + /// Creates an new instance. + public CreateRecoveryPlanInput() + { + + } + } + /// Create recovery plan input class. + public partial interface ICreateRecoveryPlanInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The failover deployment model. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The failover deployment model.", + SerializedName = @"failoverDeploymentModel", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.FailoverDeploymentModel) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.FailoverDeploymentModel? FailoverDeploymentModel { get; set; } + /// The recovery plan groups. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The recovery plan groups.", + SerializedName = @"groups", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroup) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroup[] Group { get; set; } + /// The primary fabric Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The primary fabric Id.", + SerializedName = @"primaryFabricId", + PossibleTypes = new [] { typeof(string) })] + string PrimaryFabricId { get; set; } + /// The provider specific input. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The provider specific input.", + SerializedName = @"providerSpecificInput", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificInput) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificInput[] ProviderSpecificInput { get; set; } + /// The recovery fabric Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The recovery fabric Id.", + SerializedName = @"recoveryFabricId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryFabricId { get; set; } + + } + /// Create recovery plan input class. + internal partial interface ICreateRecoveryPlanInputInternal + + { + /// The failover deployment model. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.FailoverDeploymentModel? FailoverDeploymentModel { get; set; } + /// The recovery plan groups. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroup[] Group { get; set; } + /// The primary fabric Id. + string PrimaryFabricId { get; set; } + /// Recovery plan creation properties. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateRecoveryPlanInputProperties Property { get; set; } + /// The provider specific input. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificInput[] ProviderSpecificInput { get; set; } + /// The recovery fabric Id. + string RecoveryFabricId { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateRecoveryPlanInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateRecoveryPlanInput.json.cs new file mode 100644 index 000000000000..9dc57fdb6bae --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateRecoveryPlanInput.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Create recovery plan input class. + public partial class CreateRecoveryPlanInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal CreateRecoveryPlanInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.CreateRecoveryPlanInputProperties.FromJson(__jsonProperties) : Property;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateRecoveryPlanInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateRecoveryPlanInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateRecoveryPlanInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new CreateRecoveryPlanInput(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateRecoveryPlanInputProperties.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateRecoveryPlanInputProperties.PowerShell.cs new file mode 100644 index 000000000000..46828038aa4b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateRecoveryPlanInputProperties.PowerShell.cs @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Recovery plan creation properties. + [System.ComponentModel.TypeConverter(typeof(CreateRecoveryPlanInputPropertiesTypeConverter))] + public partial class CreateRecoveryPlanInputProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal CreateRecoveryPlanInputProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("PrimaryFabricId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateRecoveryPlanInputPropertiesInternal)this).PrimaryFabricId = (string) content.GetValueForProperty("PrimaryFabricId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateRecoveryPlanInputPropertiesInternal)this).PrimaryFabricId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryFabricId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateRecoveryPlanInputPropertiesInternal)this).RecoveryFabricId = (string) content.GetValueForProperty("RecoveryFabricId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateRecoveryPlanInputPropertiesInternal)this).RecoveryFabricId, global::System.Convert.ToString); + } + if (content.Contains("FailoverDeploymentModel")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateRecoveryPlanInputPropertiesInternal)this).FailoverDeploymentModel = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.FailoverDeploymentModel?) content.GetValueForProperty("FailoverDeploymentModel",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateRecoveryPlanInputPropertiesInternal)this).FailoverDeploymentModel, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.FailoverDeploymentModel.CreateFrom); + } + if (content.Contains("Group")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateRecoveryPlanInputPropertiesInternal)this).Group = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroup[]) content.GetValueForProperty("Group",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateRecoveryPlanInputPropertiesInternal)this).Group, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanGroupTypeConverter.ConvertFrom)); + } + if (content.Contains("ProviderSpecificInput")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateRecoveryPlanInputPropertiesInternal)this).ProviderSpecificInput = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificInput[]) content.GetValueForProperty("ProviderSpecificInput",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateRecoveryPlanInputPropertiesInternal)this).ProviderSpecificInput, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanProviderSpecificInputTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal CreateRecoveryPlanInputProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("PrimaryFabricId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateRecoveryPlanInputPropertiesInternal)this).PrimaryFabricId = (string) content.GetValueForProperty("PrimaryFabricId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateRecoveryPlanInputPropertiesInternal)this).PrimaryFabricId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryFabricId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateRecoveryPlanInputPropertiesInternal)this).RecoveryFabricId = (string) content.GetValueForProperty("RecoveryFabricId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateRecoveryPlanInputPropertiesInternal)this).RecoveryFabricId, global::System.Convert.ToString); + } + if (content.Contains("FailoverDeploymentModel")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateRecoveryPlanInputPropertiesInternal)this).FailoverDeploymentModel = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.FailoverDeploymentModel?) content.GetValueForProperty("FailoverDeploymentModel",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateRecoveryPlanInputPropertiesInternal)this).FailoverDeploymentModel, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.FailoverDeploymentModel.CreateFrom); + } + if (content.Contains("Group")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateRecoveryPlanInputPropertiesInternal)this).Group = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroup[]) content.GetValueForProperty("Group",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateRecoveryPlanInputPropertiesInternal)this).Group, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanGroupTypeConverter.ConvertFrom)); + } + if (content.Contains("ProviderSpecificInput")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateRecoveryPlanInputPropertiesInternal)this).ProviderSpecificInput = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificInput[]) content.GetValueForProperty("ProviderSpecificInput",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateRecoveryPlanInputPropertiesInternal)this).ProviderSpecificInput, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanProviderSpecificInputTypeConverter.ConvertFrom)); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateRecoveryPlanInputProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new CreateRecoveryPlanInputProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateRecoveryPlanInputProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new CreateRecoveryPlanInputProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateRecoveryPlanInputProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Recovery plan creation properties. + [System.ComponentModel.TypeConverter(typeof(CreateRecoveryPlanInputPropertiesTypeConverter))] + public partial interface ICreateRecoveryPlanInputProperties + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateRecoveryPlanInputProperties.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateRecoveryPlanInputProperties.TypeConverter.cs new file mode 100644 index 000000000000..f57b68f18c90 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateRecoveryPlanInputProperties.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class CreateRecoveryPlanInputPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateRecoveryPlanInputProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateRecoveryPlanInputProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return CreateRecoveryPlanInputProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return CreateRecoveryPlanInputProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return CreateRecoveryPlanInputProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateRecoveryPlanInputProperties.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateRecoveryPlanInputProperties.cs new file mode 100644 index 000000000000..0a983440574d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateRecoveryPlanInputProperties.cs @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Recovery plan creation properties. + public partial class CreateRecoveryPlanInputProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateRecoveryPlanInputProperties, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateRecoveryPlanInputPropertiesInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.FailoverDeploymentModel? _failoverDeploymentModel; + + /// The failover deployment model. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.FailoverDeploymentModel? FailoverDeploymentModel { get => this._failoverDeploymentModel; set => this._failoverDeploymentModel = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroup[] _group; + + /// The recovery plan groups. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroup[] Group { get => this._group; set => this._group = value; } + + /// Backing field for property. + private string _primaryFabricId; + + /// The primary fabric Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string PrimaryFabricId { get => this._primaryFabricId; set => this._primaryFabricId = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificInput[] _providerSpecificInput; + + /// The provider specific input. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificInput[] ProviderSpecificInput { get => this._providerSpecificInput; set => this._providerSpecificInput = value; } + + /// Backing field for property. + private string _recoveryFabricId; + + /// The recovery fabric Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryFabricId { get => this._recoveryFabricId; set => this._recoveryFabricId = value; } + + /// Creates an new instance. + public CreateRecoveryPlanInputProperties() + { + + } + } + /// Recovery plan creation properties. + public partial interface ICreateRecoveryPlanInputProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The failover deployment model. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The failover deployment model.", + SerializedName = @"failoverDeploymentModel", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.FailoverDeploymentModel) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.FailoverDeploymentModel? FailoverDeploymentModel { get; set; } + /// The recovery plan groups. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The recovery plan groups.", + SerializedName = @"groups", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroup) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroup[] Group { get; set; } + /// The primary fabric Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The primary fabric Id.", + SerializedName = @"primaryFabricId", + PossibleTypes = new [] { typeof(string) })] + string PrimaryFabricId { get; set; } + /// The provider specific input. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The provider specific input.", + SerializedName = @"providerSpecificInput", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificInput) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificInput[] ProviderSpecificInput { get; set; } + /// The recovery fabric Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The recovery fabric Id.", + SerializedName = @"recoveryFabricId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryFabricId { get; set; } + + } + /// Recovery plan creation properties. + internal partial interface ICreateRecoveryPlanInputPropertiesInternal + + { + /// The failover deployment model. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.FailoverDeploymentModel? FailoverDeploymentModel { get; set; } + /// The recovery plan groups. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroup[] Group { get; set; } + /// The primary fabric Id. + string PrimaryFabricId { get; set; } + /// The provider specific input. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificInput[] ProviderSpecificInput { get; set; } + /// The recovery fabric Id. + string RecoveryFabricId { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateRecoveryPlanInputProperties.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateRecoveryPlanInputProperties.json.cs new file mode 100644 index 000000000000..0d099f19e6d7 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CreateRecoveryPlanInputProperties.json.cs @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Recovery plan creation properties. + public partial class CreateRecoveryPlanInputProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal CreateRecoveryPlanInputProperties(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_primaryFabricId = If( json?.PropertyT("primaryFabricId"), out var __jsonPrimaryFabricId) ? (string)__jsonPrimaryFabricId : (string)PrimaryFabricId;} + {_recoveryFabricId = If( json?.PropertyT("recoveryFabricId"), out var __jsonRecoveryFabricId) ? (string)__jsonRecoveryFabricId : (string)RecoveryFabricId;} + {_failoverDeploymentModel = If( json?.PropertyT("failoverDeploymentModel"), out var __jsonFailoverDeploymentModel) ? (string)__jsonFailoverDeploymentModel : (string)FailoverDeploymentModel;} + {_group = If( json?.PropertyT("groups"), out var __jsonGroups) ? If( __jsonGroups as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroup) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanGroup.FromJson(__u) )) ))() : null : Group;} + {_providerSpecificInput = If( json?.PropertyT("providerSpecificInput"), out var __jsonProviderSpecificInput) ? If( __jsonProviderSpecificInput as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __q) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__q, (__p)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificInput) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanProviderSpecificInput.FromJson(__p) )) ))() : null : ProviderSpecificInput;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateRecoveryPlanInputProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateRecoveryPlanInputProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateRecoveryPlanInputProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new CreateRecoveryPlanInputProperties(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._primaryFabricId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._primaryFabricId.ToString()) : null, "primaryFabricId" ,container.Add ); + AddIf( null != (((object)this._recoveryFabricId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryFabricId.ToString()) : null, "recoveryFabricId" ,container.Add ); + AddIf( null != (((object)this._failoverDeploymentModel)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._failoverDeploymentModel.ToString()) : null, "failoverDeploymentModel" ,container.Add ); + if (null != this._group) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._group ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("groups",__w); + } + if (null != this._providerSpecificInput) + { + var __r = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __s in this._providerSpecificInput ) + { + AddIf(__s?.ToJson(null, serializationMode) ,__r.Add); + } + container.Add("providerSpecificInput",__r); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CriticalJobHistoryDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CriticalJobHistoryDetails.PowerShell.cs new file mode 100644 index 000000000000..dc43a1c070e7 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CriticalJobHistoryDetails.PowerShell.cs @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Critical past job details of the migration item. + [System.ComponentModel.TypeConverter(typeof(CriticalJobHistoryDetailsTypeConverter))] + public partial class CriticalJobHistoryDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal CriticalJobHistoryDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("JobName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICriticalJobHistoryDetailsInternal)this).JobName = (string) content.GetValueForProperty("JobName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICriticalJobHistoryDetailsInternal)this).JobName, global::System.Convert.ToString); + } + if (content.Contains("JobId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICriticalJobHistoryDetailsInternal)this).JobId = (string) content.GetValueForProperty("JobId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICriticalJobHistoryDetailsInternal)this).JobId, global::System.Convert.ToString); + } + if (content.Contains("StartTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICriticalJobHistoryDetailsInternal)this).StartTime = (global::System.DateTime?) content.GetValueForProperty("StartTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICriticalJobHistoryDetailsInternal)this).StartTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("JobStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICriticalJobHistoryDetailsInternal)this).JobStatus = (string) content.GetValueForProperty("JobStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICriticalJobHistoryDetailsInternal)this).JobStatus, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal CriticalJobHistoryDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("JobName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICriticalJobHistoryDetailsInternal)this).JobName = (string) content.GetValueForProperty("JobName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICriticalJobHistoryDetailsInternal)this).JobName, global::System.Convert.ToString); + } + if (content.Contains("JobId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICriticalJobHistoryDetailsInternal)this).JobId = (string) content.GetValueForProperty("JobId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICriticalJobHistoryDetailsInternal)this).JobId, global::System.Convert.ToString); + } + if (content.Contains("StartTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICriticalJobHistoryDetailsInternal)this).StartTime = (global::System.DateTime?) content.GetValueForProperty("StartTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICriticalJobHistoryDetailsInternal)this).StartTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("JobStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICriticalJobHistoryDetailsInternal)this).JobStatus = (string) content.GetValueForProperty("JobStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICriticalJobHistoryDetailsInternal)this).JobStatus, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICriticalJobHistoryDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new CriticalJobHistoryDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICriticalJobHistoryDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new CriticalJobHistoryDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICriticalJobHistoryDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Critical past job details of the migration item. + [System.ComponentModel.TypeConverter(typeof(CriticalJobHistoryDetailsTypeConverter))] + public partial interface ICriticalJobHistoryDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CriticalJobHistoryDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CriticalJobHistoryDetails.TypeConverter.cs new file mode 100644 index 000000000000..cf456efecc2d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CriticalJobHistoryDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class CriticalJobHistoryDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICriticalJobHistoryDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICriticalJobHistoryDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return CriticalJobHistoryDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return CriticalJobHistoryDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return CriticalJobHistoryDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CriticalJobHistoryDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CriticalJobHistoryDetails.cs new file mode 100644 index 000000000000..ef0979d7109a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CriticalJobHistoryDetails.cs @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Critical past job details of the migration item. + public partial class CriticalJobHistoryDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICriticalJobHistoryDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICriticalJobHistoryDetailsInternal + { + + /// Backing field for property. + private string _jobId; + + /// The ARM Id of the job being executed. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string JobId { get => this._jobId; } + + /// Backing field for property. + private string _jobName; + + /// The job name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string JobName { get => this._jobName; } + + /// Backing field for property. + private string _jobStatus; + + /// The job state. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string JobStatus { get => this._jobStatus; } + + /// Internal Acessors for JobId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICriticalJobHistoryDetailsInternal.JobId { get => this._jobId; set { {_jobId = value;} } } + + /// Internal Acessors for JobName + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICriticalJobHistoryDetailsInternal.JobName { get => this._jobName; set { {_jobName = value;} } } + + /// Internal Acessors for JobStatus + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICriticalJobHistoryDetailsInternal.JobStatus { get => this._jobStatus; set { {_jobStatus = value;} } } + + /// Internal Acessors for StartTime + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICriticalJobHistoryDetailsInternal.StartTime { get => this._startTime; set { {_startTime = value;} } } + + /// Backing field for property. + private global::System.DateTime? _startTime; + + /// The start time of the job. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public global::System.DateTime? StartTime { get => this._startTime; } + + /// Creates an new instance. + public CriticalJobHistoryDetails() + { + + } + } + /// Critical past job details of the migration item. + public partial interface ICriticalJobHistoryDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The ARM Id of the job being executed. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The ARM Id of the job being executed.", + SerializedName = @"jobId", + PossibleTypes = new [] { typeof(string) })] + string JobId { get; } + /// The job name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The job name.", + SerializedName = @"jobName", + PossibleTypes = new [] { typeof(string) })] + string JobName { get; } + /// The job state. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The job state.", + SerializedName = @"jobStatus", + PossibleTypes = new [] { typeof(string) })] + string JobStatus { get; } + /// The start time of the job. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The start time of the job.", + SerializedName = @"startTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? StartTime { get; } + + } + /// Critical past job details of the migration item. + internal partial interface ICriticalJobHistoryDetailsInternal + + { + /// The ARM Id of the job being executed. + string JobId { get; set; } + /// The job name. + string JobName { get; set; } + /// The job state. + string JobStatus { get; set; } + /// The start time of the job. + global::System.DateTime? StartTime { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CriticalJobHistoryDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CriticalJobHistoryDetails.json.cs new file mode 100644 index 000000000000..00d03bb81d6b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CriticalJobHistoryDetails.json.cs @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Critical past job details of the migration item. + public partial class CriticalJobHistoryDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal CriticalJobHistoryDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_jobName = If( json?.PropertyT("jobName"), out var __jsonJobName) ? (string)__jsonJobName : (string)JobName;} + {_jobId = If( json?.PropertyT("jobId"), out var __jsonJobId) ? (string)__jsonJobId : (string)JobId;} + {_startTime = If( json?.PropertyT("startTime"), out var __jsonStartTime) ? global::System.DateTime.TryParse((string)__jsonStartTime, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonStartTimeValue) ? __jsonStartTimeValue : StartTime : StartTime;} + {_jobStatus = If( json?.PropertyT("jobStatus"), out var __jsonJobStatus) ? (string)__jsonJobStatus : (string)JobStatus;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICriticalJobHistoryDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICriticalJobHistoryDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICriticalJobHistoryDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new CriticalJobHistoryDetails(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._jobName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._jobName.ToString()) : null, "jobName" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._jobId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._jobId.ToString()) : null, "jobId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._startTime ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._startTime?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "startTime" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._jobStatus)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._jobStatus.ToString()) : null, "jobStatus" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CurrentJobDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CurrentJobDetails.PowerShell.cs new file mode 100644 index 000000000000..c9fb41e86a63 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CurrentJobDetails.PowerShell.cs @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Current job details of the migration item. + [System.ComponentModel.TypeConverter(typeof(CurrentJobDetailsTypeConverter))] + public partial class CurrentJobDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal CurrentJobDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("JobName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICurrentJobDetailsInternal)this).JobName = (string) content.GetValueForProperty("JobName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICurrentJobDetailsInternal)this).JobName, global::System.Convert.ToString); + } + if (content.Contains("JobId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICurrentJobDetailsInternal)this).JobId = (string) content.GetValueForProperty("JobId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICurrentJobDetailsInternal)this).JobId, global::System.Convert.ToString); + } + if (content.Contains("StartTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICurrentJobDetailsInternal)this).StartTime = (global::System.DateTime?) content.GetValueForProperty("StartTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICurrentJobDetailsInternal)this).StartTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal CurrentJobDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("JobName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICurrentJobDetailsInternal)this).JobName = (string) content.GetValueForProperty("JobName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICurrentJobDetailsInternal)this).JobName, global::System.Convert.ToString); + } + if (content.Contains("JobId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICurrentJobDetailsInternal)this).JobId = (string) content.GetValueForProperty("JobId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICurrentJobDetailsInternal)this).JobId, global::System.Convert.ToString); + } + if (content.Contains("StartTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICurrentJobDetailsInternal)this).StartTime = (global::System.DateTime?) content.GetValueForProperty("StartTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICurrentJobDetailsInternal)this).StartTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICurrentJobDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new CurrentJobDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICurrentJobDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new CurrentJobDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICurrentJobDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Current job details of the migration item. + [System.ComponentModel.TypeConverter(typeof(CurrentJobDetailsTypeConverter))] + public partial interface ICurrentJobDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CurrentJobDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CurrentJobDetails.TypeConverter.cs new file mode 100644 index 000000000000..88ee15363aa5 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CurrentJobDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class CurrentJobDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICurrentJobDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICurrentJobDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return CurrentJobDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return CurrentJobDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return CurrentJobDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CurrentJobDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CurrentJobDetails.cs new file mode 100644 index 000000000000..30f1a0429f7b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CurrentJobDetails.cs @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Current job details of the migration item. + public partial class CurrentJobDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICurrentJobDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICurrentJobDetailsInternal + { + + /// Backing field for property. + private string _jobId; + + /// The ARM Id of the job being executed. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string JobId { get => this._jobId; } + + /// Backing field for property. + private string _jobName; + + /// The job name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string JobName { get => this._jobName; } + + /// Internal Acessors for JobId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICurrentJobDetailsInternal.JobId { get => this._jobId; set { {_jobId = value;} } } + + /// Internal Acessors for JobName + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICurrentJobDetailsInternal.JobName { get => this._jobName; set { {_jobName = value;} } } + + /// Internal Acessors for StartTime + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICurrentJobDetailsInternal.StartTime { get => this._startTime; set { {_startTime = value;} } } + + /// Backing field for property. + private global::System.DateTime? _startTime; + + /// The start time of the job. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public global::System.DateTime? StartTime { get => this._startTime; } + + /// Creates an new instance. + public CurrentJobDetails() + { + + } + } + /// Current job details of the migration item. + public partial interface ICurrentJobDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The ARM Id of the job being executed. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The ARM Id of the job being executed.", + SerializedName = @"jobId", + PossibleTypes = new [] { typeof(string) })] + string JobId { get; } + /// The job name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The job name.", + SerializedName = @"jobName", + PossibleTypes = new [] { typeof(string) })] + string JobName { get; } + /// The start time of the job. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The start time of the job.", + SerializedName = @"startTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? StartTime { get; } + + } + /// Current job details of the migration item. + internal partial interface ICurrentJobDetailsInternal + + { + /// The ARM Id of the job being executed. + string JobId { get; set; } + /// The job name. + string JobName { get; set; } + /// The start time of the job. + global::System.DateTime? StartTime { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CurrentJobDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CurrentJobDetails.json.cs new file mode 100644 index 000000000000..2ce1a3b3b365 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CurrentJobDetails.json.cs @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Current job details of the migration item. + public partial class CurrentJobDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal CurrentJobDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_jobName = If( json?.PropertyT("jobName"), out var __jsonJobName) ? (string)__jsonJobName : (string)JobName;} + {_jobId = If( json?.PropertyT("jobId"), out var __jsonJobId) ? (string)__jsonJobId : (string)JobId;} + {_startTime = If( json?.PropertyT("startTime"), out var __jsonStartTime) ? global::System.DateTime.TryParse((string)__jsonStartTime, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonStartTimeValue) ? __jsonStartTimeValue : StartTime : StartTime;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICurrentJobDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICurrentJobDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICurrentJobDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new CurrentJobDetails(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._jobName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._jobName.ToString()) : null, "jobName" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._jobId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._jobId.ToString()) : null, "jobId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._startTime ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._startTime?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "startTime" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CurrentScenarioDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CurrentScenarioDetails.PowerShell.cs new file mode 100644 index 000000000000..00699449055d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CurrentScenarioDetails.PowerShell.cs @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Current scenario details of the protected entity. + [System.ComponentModel.TypeConverter(typeof(CurrentScenarioDetailsTypeConverter))] + public partial class CurrentScenarioDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal CurrentScenarioDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ScenarioName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICurrentScenarioDetailsInternal)this).ScenarioName = (string) content.GetValueForProperty("ScenarioName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICurrentScenarioDetailsInternal)this).ScenarioName, global::System.Convert.ToString); + } + if (content.Contains("JobId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICurrentScenarioDetailsInternal)this).JobId = (string) content.GetValueForProperty("JobId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICurrentScenarioDetailsInternal)this).JobId, global::System.Convert.ToString); + } + if (content.Contains("StartTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICurrentScenarioDetailsInternal)this).StartTime = (global::System.DateTime?) content.GetValueForProperty("StartTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICurrentScenarioDetailsInternal)this).StartTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal CurrentScenarioDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ScenarioName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICurrentScenarioDetailsInternal)this).ScenarioName = (string) content.GetValueForProperty("ScenarioName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICurrentScenarioDetailsInternal)this).ScenarioName, global::System.Convert.ToString); + } + if (content.Contains("JobId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICurrentScenarioDetailsInternal)this).JobId = (string) content.GetValueForProperty("JobId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICurrentScenarioDetailsInternal)this).JobId, global::System.Convert.ToString); + } + if (content.Contains("StartTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICurrentScenarioDetailsInternal)this).StartTime = (global::System.DateTime?) content.GetValueForProperty("StartTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICurrentScenarioDetailsInternal)this).StartTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICurrentScenarioDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new CurrentScenarioDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICurrentScenarioDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new CurrentScenarioDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICurrentScenarioDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Current scenario details of the protected entity. + [System.ComponentModel.TypeConverter(typeof(CurrentScenarioDetailsTypeConverter))] + public partial interface ICurrentScenarioDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CurrentScenarioDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CurrentScenarioDetails.TypeConverter.cs new file mode 100644 index 000000000000..7bea340c9af8 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CurrentScenarioDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class CurrentScenarioDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICurrentScenarioDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICurrentScenarioDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return CurrentScenarioDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return CurrentScenarioDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return CurrentScenarioDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CurrentScenarioDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CurrentScenarioDetails.cs new file mode 100644 index 000000000000..d49aa143a663 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CurrentScenarioDetails.cs @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Current scenario details of the protected entity. + public partial class CurrentScenarioDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICurrentScenarioDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICurrentScenarioDetailsInternal + { + + /// Backing field for property. + private string _jobId; + + /// ARM Id of the job being executed. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string JobId { get => this._jobId; set => this._jobId = value; } + + /// Backing field for property. + private string _scenarioName; + + /// Scenario name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ScenarioName { get => this._scenarioName; set => this._scenarioName = value; } + + /// Backing field for property. + private global::System.DateTime? _startTime; + + /// Start time of the workflow. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public global::System.DateTime? StartTime { get => this._startTime; set => this._startTime = value; } + + /// Creates an new instance. + public CurrentScenarioDetails() + { + + } + } + /// Current scenario details of the protected entity. + public partial interface ICurrentScenarioDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// ARM Id of the job being executed. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"ARM Id of the job being executed.", + SerializedName = @"jobId", + PossibleTypes = new [] { typeof(string) })] + string JobId { get; set; } + /// Scenario name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Scenario name.", + SerializedName = @"scenarioName", + PossibleTypes = new [] { typeof(string) })] + string ScenarioName { get; set; } + /// Start time of the workflow. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Start time of the workflow.", + SerializedName = @"startTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? StartTime { get; set; } + + } + /// Current scenario details of the protected entity. + internal partial interface ICurrentScenarioDetailsInternal + + { + /// ARM Id of the job being executed. + string JobId { get; set; } + /// Scenario name. + string ScenarioName { get; set; } + /// Start time of the workflow. + global::System.DateTime? StartTime { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CurrentScenarioDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CurrentScenarioDetails.json.cs new file mode 100644 index 000000000000..c54236b87412 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/CurrentScenarioDetails.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Current scenario details of the protected entity. + public partial class CurrentScenarioDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal CurrentScenarioDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_scenarioName = If( json?.PropertyT("scenarioName"), out var __jsonScenarioName) ? (string)__jsonScenarioName : (string)ScenarioName;} + {_jobId = If( json?.PropertyT("jobId"), out var __jsonJobId) ? (string)__jsonJobId : (string)JobId;} + {_startTime = If( json?.PropertyT("startTime"), out var __jsonStartTime) ? global::System.DateTime.TryParse((string)__jsonStartTime, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonStartTimeValue) ? __jsonStartTimeValue : StartTime : StartTime;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICurrentScenarioDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICurrentScenarioDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICurrentScenarioDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new CurrentScenarioDetails(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._scenarioName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._scenarioName.ToString()) : null, "scenarioName" ,container.Add ); + AddIf( null != (((object)this._jobId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._jobId.ToString()) : null, "jobId" ,container.Add ); + AddIf( null != this._startTime ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._startTime?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "startTime" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DataStore.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DataStore.PowerShell.cs new file mode 100644 index 000000000000..db8244214c79 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DataStore.PowerShell.cs @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// The datastore details of the MT. + [System.ComponentModel.TypeConverter(typeof(DataStoreTypeConverter))] + public partial class DataStore + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal DataStore(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SymbolicName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDataStoreInternal)this).SymbolicName = (string) content.GetValueForProperty("SymbolicName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDataStoreInternal)this).SymbolicName, global::System.Convert.ToString); + } + if (content.Contains("Uuid")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDataStoreInternal)this).Uuid = (string) content.GetValueForProperty("Uuid",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDataStoreInternal)this).Uuid, global::System.Convert.ToString); + } + if (content.Contains("Capacity")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDataStoreInternal)this).Capacity = (string) content.GetValueForProperty("Capacity",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDataStoreInternal)this).Capacity, global::System.Convert.ToString); + } + if (content.Contains("FreeSpace")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDataStoreInternal)this).FreeSpace = (string) content.GetValueForProperty("FreeSpace",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDataStoreInternal)this).FreeSpace, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDataStoreInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDataStoreInternal)this).Type, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal DataStore(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SymbolicName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDataStoreInternal)this).SymbolicName = (string) content.GetValueForProperty("SymbolicName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDataStoreInternal)this).SymbolicName, global::System.Convert.ToString); + } + if (content.Contains("Uuid")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDataStoreInternal)this).Uuid = (string) content.GetValueForProperty("Uuid",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDataStoreInternal)this).Uuid, global::System.Convert.ToString); + } + if (content.Contains("Capacity")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDataStoreInternal)this).Capacity = (string) content.GetValueForProperty("Capacity",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDataStoreInternal)this).Capacity, global::System.Convert.ToString); + } + if (content.Contains("FreeSpace")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDataStoreInternal)this).FreeSpace = (string) content.GetValueForProperty("FreeSpace",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDataStoreInternal)this).FreeSpace, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDataStoreInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDataStoreInternal)this).Type, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDataStore DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DataStore(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDataStore DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DataStore(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDataStore FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// The datastore details of the MT. + [System.ComponentModel.TypeConverter(typeof(DataStoreTypeConverter))] + public partial interface IDataStore + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DataStore.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DataStore.TypeConverter.cs new file mode 100644 index 000000000000..53453d4d53a3 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DataStore.TypeConverter.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DataStoreTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDataStore ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDataStore).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DataStore.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DataStore.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DataStore.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DataStore.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DataStore.cs new file mode 100644 index 000000000000..9dacc621228e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DataStore.cs @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The datastore details of the MT. + public partial class DataStore : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDataStore, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDataStoreInternal + { + + /// Backing field for property. + private string _capacity; + + /// The capacity of data store in GBs. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Capacity { get => this._capacity; set => this._capacity = value; } + + /// Backing field for property. + private string _freeSpace; + + /// The free space of data store in GBs. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string FreeSpace { get => this._freeSpace; set => this._freeSpace = value; } + + /// Backing field for property. + private string _symbolicName; + + /// The symbolic name of data store. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string SymbolicName { get => this._symbolicName; set => this._symbolicName = value; } + + /// Backing field for property. + private string _type; + + /// The type of data store. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Type { get => this._type; set => this._type = value; } + + /// Backing field for property. + private string _uuid; + + /// The uuid of data store. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Uuid { get => this._uuid; set => this._uuid = value; } + + /// Creates an new instance. + public DataStore() + { + + } + } + /// The datastore details of the MT. + public partial interface IDataStore : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The capacity of data store in GBs. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The capacity of data store in GBs.", + SerializedName = @"capacity", + PossibleTypes = new [] { typeof(string) })] + string Capacity { get; set; } + /// The free space of data store in GBs. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The free space of data store in GBs.", + SerializedName = @"freeSpace", + PossibleTypes = new [] { typeof(string) })] + string FreeSpace { get; set; } + /// The symbolic name of data store. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The symbolic name of data store.", + SerializedName = @"symbolicName", + PossibleTypes = new [] { typeof(string) })] + string SymbolicName { get; set; } + /// The type of data store. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The type of data store.", + SerializedName = @"type", + PossibleTypes = new [] { typeof(string) })] + string Type { get; set; } + /// The uuid of data store. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The uuid of data store.", + SerializedName = @"uuid", + PossibleTypes = new [] { typeof(string) })] + string Uuid { get; set; } + + } + /// The datastore details of the MT. + internal partial interface IDataStoreInternal + + { + /// The capacity of data store in GBs. + string Capacity { get; set; } + /// The free space of data store in GBs. + string FreeSpace { get; set; } + /// The symbolic name of data store. + string SymbolicName { get; set; } + /// The type of data store. + string Type { get; set; } + /// The uuid of data store. + string Uuid { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DataStore.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DataStore.json.cs new file mode 100644 index 000000000000..8026b2152a38 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DataStore.json.cs @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The datastore details of the MT. + public partial class DataStore + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal DataStore(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_symbolicName = If( json?.PropertyT("symbolicName"), out var __jsonSymbolicName) ? (string)__jsonSymbolicName : (string)SymbolicName;} + {_uuid = If( json?.PropertyT("uuid"), out var __jsonUuid) ? (string)__jsonUuid : (string)Uuid;} + {_capacity = If( json?.PropertyT("capacity"), out var __jsonCapacity) ? (string)__jsonCapacity : (string)Capacity;} + {_freeSpace = If( json?.PropertyT("freeSpace"), out var __jsonFreeSpace) ? (string)__jsonFreeSpace : (string)FreeSpace;} + {_type = If( json?.PropertyT("type"), out var __jsonType) ? (string)__jsonType : (string)Type;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDataStore. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDataStore. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDataStore FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new DataStore(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._symbolicName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._symbolicName.ToString()) : null, "symbolicName" ,container.Add ); + AddIf( null != (((object)this._uuid)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._uuid.ToString()) : null, "uuid" ,container.Add ); + AddIf( null != (((object)this._capacity)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._capacity.ToString()) : null, "capacity" ,container.Add ); + AddIf( null != (((object)this._freeSpace)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._freeSpace.ToString()) : null, "freeSpace" ,container.Add ); + AddIf( null != (((object)this._type)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._type.ToString()) : null, "type" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DisableProtectionInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DisableProtectionInput.PowerShell.cs new file mode 100644 index 000000000000..307e90d6e5f7 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DisableProtectionInput.PowerShell.cs @@ -0,0 +1,168 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Disable protection input. + [System.ComponentModel.TypeConverter(typeof(DisableProtectionInputTypeConverter))] + public partial class DisableProtectionInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DisableProtectionInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DisableProtectionInput(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal DisableProtectionInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionInputInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionInputProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionInputInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DisableProtectionInputPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("ReplicationProviderInput")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionInputInternal)this).ReplicationProviderInput = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionProviderSpecificInput) content.GetValueForProperty("ReplicationProviderInput",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionInputInternal)this).ReplicationProviderInput, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DisableProtectionProviderSpecificInputTypeConverter.ConvertFrom); + } + if (content.Contains("DisableProtectionReason")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionInputInternal)this).DisableProtectionReason = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DisableProtectionReason?) content.GetValueForProperty("DisableProtectionReason",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionInputInternal)this).DisableProtectionReason, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DisableProtectionReason.CreateFrom); + } + if (content.Contains("ReplicationProviderInputInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionInputInternal)this).ReplicationProviderInputInstanceType = (string) content.GetValueForProperty("ReplicationProviderInputInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionInputInternal)this).ReplicationProviderInputInstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal DisableProtectionInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionInputInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionInputProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionInputInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DisableProtectionInputPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("ReplicationProviderInput")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionInputInternal)this).ReplicationProviderInput = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionProviderSpecificInput) content.GetValueForProperty("ReplicationProviderInput",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionInputInternal)this).ReplicationProviderInput, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DisableProtectionProviderSpecificInputTypeConverter.ConvertFrom); + } + if (content.Contains("DisableProtectionReason")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionInputInternal)this).DisableProtectionReason = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DisableProtectionReason?) content.GetValueForProperty("DisableProtectionReason",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionInputInternal)this).DisableProtectionReason, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DisableProtectionReason.CreateFrom); + } + if (content.Contains("ReplicationProviderInputInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionInputInternal)this).ReplicationProviderInputInstanceType = (string) content.GetValueForProperty("ReplicationProviderInputInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionInputInternal)this).ReplicationProviderInputInstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Disable protection input. + [System.ComponentModel.TypeConverter(typeof(DisableProtectionInputTypeConverter))] + public partial interface IDisableProtectionInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DisableProtectionInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DisableProtectionInput.TypeConverter.cs new file mode 100644 index 000000000000..fc93a67ba055 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DisableProtectionInput.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DisableProtectionInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DisableProtectionInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DisableProtectionInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DisableProtectionInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DisableProtectionInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DisableProtectionInput.cs new file mode 100644 index 000000000000..fc041db64226 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DisableProtectionInput.cs @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Disable protection input. + public partial class DisableProtectionInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionInputInternal + { + + /// Disable protection reason. It can have values NotSpecified/MigrationComplete. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DisableProtectionReason? DisableProtectionReason { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionInputPropertiesInternal)Property).DisableProtectionReason; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionInputPropertiesInternal)Property).DisableProtectionReason = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DisableProtectionReason)""); } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionInputProperties Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionInputInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DisableProtectionInputProperties()); set { {_property = value;} } } + + /// Internal Acessors for ReplicationProviderInput + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionProviderSpecificInput Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionInputInternal.ReplicationProviderInput { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionInputPropertiesInternal)Property).ReplicationProviderInput; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionInputPropertiesInternal)Property).ReplicationProviderInput = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionInputProperties _property; + + /// Disable protection input properties. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionInputProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DisableProtectionInputProperties()); set => this._property = value; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ReplicationProviderInputInstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionInputPropertiesInternal)Property).ReplicationProviderInputInstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionInputPropertiesInternal)Property).ReplicationProviderInputInstanceType = value ?? null; } + + /// Creates an new instance. + public DisableProtectionInput() + { + + } + } + /// Disable protection input. + public partial interface IDisableProtectionInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// Disable protection reason. It can have values NotSpecified/MigrationComplete. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Disable protection reason. It can have values NotSpecified/MigrationComplete.", + SerializedName = @"disableProtectionReason", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DisableProtectionReason) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DisableProtectionReason? DisableProtectionReason { get; set; } + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string ReplicationProviderInputInstanceType { get; set; } + + } + /// Disable protection input. + internal partial interface IDisableProtectionInputInternal + + { + /// Disable protection reason. It can have values NotSpecified/MigrationComplete. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DisableProtectionReason? DisableProtectionReason { get; set; } + /// Disable protection input properties. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionInputProperties Property { get; set; } + /// Replication provider specific input. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionProviderSpecificInput ReplicationProviderInput { get; set; } + /// The class type. + string ReplicationProviderInputInstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DisableProtectionInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DisableProtectionInput.json.cs new file mode 100644 index 000000000000..ba70bc07f495 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DisableProtectionInput.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Disable protection input. + public partial class DisableProtectionInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal DisableProtectionInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DisableProtectionInputProperties.FromJson(__jsonProperties) : Property;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new DisableProtectionInput(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DisableProtectionInputProperties.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DisableProtectionInputProperties.PowerShell.cs new file mode 100644 index 000000000000..800c44b6c600 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DisableProtectionInputProperties.PowerShell.cs @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Disable protection input properties. + [System.ComponentModel.TypeConverter(typeof(DisableProtectionInputPropertiesTypeConverter))] + public partial class DisableProtectionInputProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionInputProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DisableProtectionInputProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionInputProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DisableProtectionInputProperties(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal DisableProtectionInputProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ReplicationProviderInput")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionInputPropertiesInternal)this).ReplicationProviderInput = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionProviderSpecificInput) content.GetValueForProperty("ReplicationProviderInput",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionInputPropertiesInternal)this).ReplicationProviderInput, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DisableProtectionProviderSpecificInputTypeConverter.ConvertFrom); + } + if (content.Contains("DisableProtectionReason")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionInputPropertiesInternal)this).DisableProtectionReason = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DisableProtectionReason?) content.GetValueForProperty("DisableProtectionReason",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionInputPropertiesInternal)this).DisableProtectionReason, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DisableProtectionReason.CreateFrom); + } + if (content.Contains("ReplicationProviderInputInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionInputPropertiesInternal)this).ReplicationProviderInputInstanceType = (string) content.GetValueForProperty("ReplicationProviderInputInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionInputPropertiesInternal)this).ReplicationProviderInputInstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal DisableProtectionInputProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ReplicationProviderInput")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionInputPropertiesInternal)this).ReplicationProviderInput = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionProviderSpecificInput) content.GetValueForProperty("ReplicationProviderInput",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionInputPropertiesInternal)this).ReplicationProviderInput, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DisableProtectionProviderSpecificInputTypeConverter.ConvertFrom); + } + if (content.Contains("DisableProtectionReason")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionInputPropertiesInternal)this).DisableProtectionReason = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DisableProtectionReason?) content.GetValueForProperty("DisableProtectionReason",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionInputPropertiesInternal)this).DisableProtectionReason, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DisableProtectionReason.CreateFrom); + } + if (content.Contains("ReplicationProviderInputInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionInputPropertiesInternal)this).ReplicationProviderInputInstanceType = (string) content.GetValueForProperty("ReplicationProviderInputInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionInputPropertiesInternal)this).ReplicationProviderInputInstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionInputProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Disable protection input properties. + [System.ComponentModel.TypeConverter(typeof(DisableProtectionInputPropertiesTypeConverter))] + public partial interface IDisableProtectionInputProperties + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DisableProtectionInputProperties.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DisableProtectionInputProperties.TypeConverter.cs new file mode 100644 index 000000000000..9ce828e36f24 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DisableProtectionInputProperties.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DisableProtectionInputPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionInputProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionInputProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DisableProtectionInputProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DisableProtectionInputProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DisableProtectionInputProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DisableProtectionInputProperties.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DisableProtectionInputProperties.cs new file mode 100644 index 000000000000..eb63aeb6ef67 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DisableProtectionInputProperties.cs @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Disable protection input properties. + public partial class DisableProtectionInputProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionInputProperties, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionInputPropertiesInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DisableProtectionReason? _disableProtectionReason; + + /// Disable protection reason. It can have values NotSpecified/MigrationComplete. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DisableProtectionReason? DisableProtectionReason { get => this._disableProtectionReason; set => this._disableProtectionReason = value; } + + /// Internal Acessors for ReplicationProviderInput + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionProviderSpecificInput Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionInputPropertiesInternal.ReplicationProviderInput { get => (this._replicationProviderInput = this._replicationProviderInput ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DisableProtectionProviderSpecificInput()); set { {_replicationProviderInput = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionProviderSpecificInput _replicationProviderInput; + + /// Replication provider specific input. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionProviderSpecificInput ReplicationProviderInput { get => (this._replicationProviderInput = this._replicationProviderInput ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DisableProtectionProviderSpecificInput()); set => this._replicationProviderInput = value; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ReplicationProviderInputInstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionProviderSpecificInputInternal)ReplicationProviderInput).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionProviderSpecificInputInternal)ReplicationProviderInput).InstanceType = value ?? null; } + + /// Creates an new instance. + public DisableProtectionInputProperties() + { + + } + } + /// Disable protection input properties. + public partial interface IDisableProtectionInputProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// Disable protection reason. It can have values NotSpecified/MigrationComplete. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Disable protection reason. It can have values NotSpecified/MigrationComplete.", + SerializedName = @"disableProtectionReason", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DisableProtectionReason) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DisableProtectionReason? DisableProtectionReason { get; set; } + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string ReplicationProviderInputInstanceType { get; set; } + + } + /// Disable protection input properties. + internal partial interface IDisableProtectionInputPropertiesInternal + + { + /// Disable protection reason. It can have values NotSpecified/MigrationComplete. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DisableProtectionReason? DisableProtectionReason { get; set; } + /// Replication provider specific input. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionProviderSpecificInput ReplicationProviderInput { get; set; } + /// The class type. + string ReplicationProviderInputInstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DisableProtectionInputProperties.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DisableProtectionInputProperties.json.cs new file mode 100644 index 000000000000..4bb569704959 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DisableProtectionInputProperties.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Disable protection input properties. + public partial class DisableProtectionInputProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal DisableProtectionInputProperties(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_replicationProviderInput = If( json?.PropertyT("replicationProviderInput"), out var __jsonReplicationProviderInput) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DisableProtectionProviderSpecificInput.FromJson(__jsonReplicationProviderInput) : ReplicationProviderInput;} + {_disableProtectionReason = If( json?.PropertyT("disableProtectionReason"), out var __jsonDisableProtectionReason) ? (string)__jsonDisableProtectionReason : (string)DisableProtectionReason;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionInputProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionInputProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionInputProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new DisableProtectionInputProperties(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._replicationProviderInput ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._replicationProviderInput.ToJson(null,serializationMode) : null, "replicationProviderInput" ,container.Add ); + AddIf( null != (((object)this._disableProtectionReason)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._disableProtectionReason.ToString()) : null, "disableProtectionReason" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DisableProtectionProviderSpecificInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DisableProtectionProviderSpecificInput.PowerShell.cs new file mode 100644 index 000000000000..3c216cdf5fbf --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DisableProtectionProviderSpecificInput.PowerShell.cs @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Disable protection provider specific input. + [System.ComponentModel.TypeConverter(typeof(DisableProtectionProviderSpecificInputTypeConverter))] + public partial class DisableProtectionProviderSpecificInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionProviderSpecificInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DisableProtectionProviderSpecificInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionProviderSpecificInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DisableProtectionProviderSpecificInput(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal DisableProtectionProviderSpecificInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal DisableProtectionProviderSpecificInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json + /// string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionProviderSpecificInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Disable protection provider specific input. + [System.ComponentModel.TypeConverter(typeof(DisableProtectionProviderSpecificInputTypeConverter))] + public partial interface IDisableProtectionProviderSpecificInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DisableProtectionProviderSpecificInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DisableProtectionProviderSpecificInput.TypeConverter.cs new file mode 100644 index 000000000000..6ae5e4cb8393 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DisableProtectionProviderSpecificInput.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DisableProtectionProviderSpecificInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionProviderSpecificInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionProviderSpecificInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DisableProtectionProviderSpecificInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DisableProtectionProviderSpecificInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DisableProtectionProviderSpecificInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DisableProtectionProviderSpecificInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DisableProtectionProviderSpecificInput.cs new file mode 100644 index 000000000000..c8e00fd9e294 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DisableProtectionProviderSpecificInput.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Disable protection provider specific input. + public partial class DisableProtectionProviderSpecificInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionProviderSpecificInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionProviderSpecificInputInternal + { + + /// Backing field for property. + private string _instanceType; + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string InstanceType { get => this._instanceType; set => this._instanceType = value; } + + /// Creates an new instance. + public DisableProtectionProviderSpecificInput() + { + + } + } + /// Disable protection provider specific input. + public partial interface IDisableProtectionProviderSpecificInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string InstanceType { get; set; } + + } + /// Disable protection provider specific input. + internal partial interface IDisableProtectionProviderSpecificInputInternal + + { + /// The class type. + string InstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DisableProtectionProviderSpecificInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DisableProtectionProviderSpecificInput.json.cs new file mode 100644 index 000000000000..4693b5814a04 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DisableProtectionProviderSpecificInput.json.cs @@ -0,0 +1,124 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Disable protection provider specific input. + public partial class DisableProtectionProviderSpecificInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal DisableProtectionProviderSpecificInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_instanceType = If( json?.PropertyT("instanceType"), out var __jsonInstanceType) ? (string)__jsonInstanceType : (string)InstanceType;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionProviderSpecificInput. + /// Note: the Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionProviderSpecificInput interface + /// is polymorphic, and the precise model class that will get deserialized is determined at runtime based on the payload. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionProviderSpecificInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionProviderSpecificInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + if (!(node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json)) + { + return null; + } + // Polymorphic type -- select the appropriate constructor using the discriminator + + switch ( json.StringProperty("instanceType") ) + { + case "InMage": + { + return new InMageDisableProtectionProviderSpecificInput(json); + } + } + return new DisableProtectionProviderSpecificInput(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._instanceType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._instanceType.ToString()) : null, "instanceType" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DiscoverProtectableItemRequest.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DiscoverProtectableItemRequest.PowerShell.cs new file mode 100644 index 000000000000..2dfeaa13580c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DiscoverProtectableItemRequest.PowerShell.cs @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Request to add a physical machine as a protectable item in a container. + [System.ComponentModel.TypeConverter(typeof(DiscoverProtectableItemRequestTypeConverter))] + public partial class DiscoverProtectableItemRequest + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiscoverProtectableItemRequest DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DiscoverProtectableItemRequest(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiscoverProtectableItemRequest DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DiscoverProtectableItemRequest(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal DiscoverProtectableItemRequest(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiscoverProtectableItemRequestInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiscoverProtectableItemRequestProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiscoverProtectableItemRequestInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DiscoverProtectableItemRequestPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("FriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiscoverProtectableItemRequestInternal)this).FriendlyName = (string) content.GetValueForProperty("FriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiscoverProtectableItemRequestInternal)this).FriendlyName, global::System.Convert.ToString); + } + if (content.Contains("IPAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiscoverProtectableItemRequestInternal)this).IPAddress = (string) content.GetValueForProperty("IPAddress",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiscoverProtectableItemRequestInternal)this).IPAddress, global::System.Convert.ToString); + } + if (content.Contains("OSType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiscoverProtectableItemRequestInternal)this).OSType = (string) content.GetValueForProperty("OSType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiscoverProtectableItemRequestInternal)this).OSType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal DiscoverProtectableItemRequest(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiscoverProtectableItemRequestInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiscoverProtectableItemRequestProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiscoverProtectableItemRequestInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DiscoverProtectableItemRequestPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("FriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiscoverProtectableItemRequestInternal)this).FriendlyName = (string) content.GetValueForProperty("FriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiscoverProtectableItemRequestInternal)this).FriendlyName, global::System.Convert.ToString); + } + if (content.Contains("IPAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiscoverProtectableItemRequestInternal)this).IPAddress = (string) content.GetValueForProperty("IPAddress",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiscoverProtectableItemRequestInternal)this).IPAddress, global::System.Convert.ToString); + } + if (content.Contains("OSType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiscoverProtectableItemRequestInternal)this).OSType = (string) content.GetValueForProperty("OSType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiscoverProtectableItemRequestInternal)this).OSType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiscoverProtectableItemRequest FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Request to add a physical machine as a protectable item in a container. + [System.ComponentModel.TypeConverter(typeof(DiscoverProtectableItemRequestTypeConverter))] + public partial interface IDiscoverProtectableItemRequest + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DiscoverProtectableItemRequest.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DiscoverProtectableItemRequest.TypeConverter.cs new file mode 100644 index 000000000000..792ecd2fbcd3 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DiscoverProtectableItemRequest.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DiscoverProtectableItemRequestTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiscoverProtectableItemRequest ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiscoverProtectableItemRequest).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DiscoverProtectableItemRequest.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DiscoverProtectableItemRequest.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DiscoverProtectableItemRequest.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DiscoverProtectableItemRequest.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DiscoverProtectableItemRequest.cs new file mode 100644 index 000000000000..f3dba59a07db --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DiscoverProtectableItemRequest.cs @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Request to add a physical machine as a protectable item in a container. + public partial class DiscoverProtectableItemRequest : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiscoverProtectableItemRequest, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiscoverProtectableItemRequestInternal + { + + /// The friendly name of the physical machine. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string FriendlyName { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiscoverProtectableItemRequestPropertiesInternal)Property).FriendlyName; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiscoverProtectableItemRequestPropertiesInternal)Property).FriendlyName = value ?? null; } + + /// The IP address of the physical machine to be discovered. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string IPAddress { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiscoverProtectableItemRequestPropertiesInternal)Property).IPAddress; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiscoverProtectableItemRequestPropertiesInternal)Property).IPAddress = value ?? null; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiscoverProtectableItemRequestProperties Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiscoverProtectableItemRequestInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DiscoverProtectableItemRequestProperties()); set { {_property = value;} } } + + /// The OS type on the physical machine. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string OSType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiscoverProtectableItemRequestPropertiesInternal)Property).OSType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiscoverProtectableItemRequestPropertiesInternal)Property).OSType = value ?? null; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiscoverProtectableItemRequestProperties _property; + + /// The properties of a discover protectable item request. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiscoverProtectableItemRequestProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DiscoverProtectableItemRequestProperties()); set => this._property = value; } + + /// Creates an new instance. + public DiscoverProtectableItemRequest() + { + + } + } + /// Request to add a physical machine as a protectable item in a container. + public partial interface IDiscoverProtectableItemRequest : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The friendly name of the physical machine. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The friendly name of the physical machine.", + SerializedName = @"friendlyName", + PossibleTypes = new [] { typeof(string) })] + string FriendlyName { get; set; } + /// The IP address of the physical machine to be discovered. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The IP address of the physical machine to be discovered.", + SerializedName = @"ipAddress", + PossibleTypes = new [] { typeof(string) })] + string IPAddress { get; set; } + /// The OS type on the physical machine. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The OS type on the physical machine.", + SerializedName = @"osType", + PossibleTypes = new [] { typeof(string) })] + string OSType { get; set; } + + } + /// Request to add a physical machine as a protectable item in a container. + internal partial interface IDiscoverProtectableItemRequestInternal + + { + /// The friendly name of the physical machine. + string FriendlyName { get; set; } + /// The IP address of the physical machine to be discovered. + string IPAddress { get; set; } + /// The OS type on the physical machine. + string OSType { get; set; } + /// The properties of a discover protectable item request. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiscoverProtectableItemRequestProperties Property { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DiscoverProtectableItemRequest.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DiscoverProtectableItemRequest.json.cs new file mode 100644 index 000000000000..5e92d5afb464 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DiscoverProtectableItemRequest.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Request to add a physical machine as a protectable item in a container. + public partial class DiscoverProtectableItemRequest + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal DiscoverProtectableItemRequest(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DiscoverProtectableItemRequestProperties.FromJson(__jsonProperties) : Property;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiscoverProtectableItemRequest. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiscoverProtectableItemRequest. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiscoverProtectableItemRequest FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new DiscoverProtectableItemRequest(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DiscoverProtectableItemRequestProperties.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DiscoverProtectableItemRequestProperties.PowerShell.cs new file mode 100644 index 000000000000..6af6a1977027 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DiscoverProtectableItemRequestProperties.PowerShell.cs @@ -0,0 +1,165 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Discover protectable item properties. + [System.ComponentModel.TypeConverter(typeof(DiscoverProtectableItemRequestPropertiesTypeConverter))] + public partial class DiscoverProtectableItemRequestProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiscoverProtectableItemRequestProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DiscoverProtectableItemRequestProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiscoverProtectableItemRequestProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DiscoverProtectableItemRequestProperties(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal DiscoverProtectableItemRequestProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("FriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiscoverProtectableItemRequestPropertiesInternal)this).FriendlyName = (string) content.GetValueForProperty("FriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiscoverProtectableItemRequestPropertiesInternal)this).FriendlyName, global::System.Convert.ToString); + } + if (content.Contains("IPAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiscoverProtectableItemRequestPropertiesInternal)this).IPAddress = (string) content.GetValueForProperty("IPAddress",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiscoverProtectableItemRequestPropertiesInternal)this).IPAddress, global::System.Convert.ToString); + } + if (content.Contains("OSType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiscoverProtectableItemRequestPropertiesInternal)this).OSType = (string) content.GetValueForProperty("OSType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiscoverProtectableItemRequestPropertiesInternal)this).OSType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal DiscoverProtectableItemRequestProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("FriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiscoverProtectableItemRequestPropertiesInternal)this).FriendlyName = (string) content.GetValueForProperty("FriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiscoverProtectableItemRequestPropertiesInternal)this).FriendlyName, global::System.Convert.ToString); + } + if (content.Contains("IPAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiscoverProtectableItemRequestPropertiesInternal)this).IPAddress = (string) content.GetValueForProperty("IPAddress",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiscoverProtectableItemRequestPropertiesInternal)this).IPAddress, global::System.Convert.ToString); + } + if (content.Contains("OSType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiscoverProtectableItemRequestPropertiesInternal)this).OSType = (string) content.GetValueForProperty("OSType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiscoverProtectableItemRequestPropertiesInternal)this).OSType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json + /// string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiscoverProtectableItemRequestProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Discover protectable item properties. + [System.ComponentModel.TypeConverter(typeof(DiscoverProtectableItemRequestPropertiesTypeConverter))] + public partial interface IDiscoverProtectableItemRequestProperties + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DiscoverProtectableItemRequestProperties.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DiscoverProtectableItemRequestProperties.TypeConverter.cs new file mode 100644 index 000000000000..cfb3d074f7e2 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DiscoverProtectableItemRequestProperties.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DiscoverProtectableItemRequestPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiscoverProtectableItemRequestProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiscoverProtectableItemRequestProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DiscoverProtectableItemRequestProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DiscoverProtectableItemRequestProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DiscoverProtectableItemRequestProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DiscoverProtectableItemRequestProperties.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DiscoverProtectableItemRequestProperties.cs new file mode 100644 index 000000000000..ead5081e4e21 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DiscoverProtectableItemRequestProperties.cs @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Discover protectable item properties. + public partial class DiscoverProtectableItemRequestProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiscoverProtectableItemRequestProperties, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiscoverProtectableItemRequestPropertiesInternal + { + + /// Backing field for property. + private string _friendlyName; + + /// The friendly name of the physical machine. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string FriendlyName { get => this._friendlyName; set => this._friendlyName = value; } + + /// Backing field for property. + private string _iPAddress; + + /// The IP address of the physical machine to be discovered. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string IPAddress { get => this._iPAddress; set => this._iPAddress = value; } + + /// Backing field for property. + private string _oSType; + + /// The OS type on the physical machine. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string OSType { get => this._oSType; set => this._oSType = value; } + + /// + /// Creates an new instance. + /// + public DiscoverProtectableItemRequestProperties() + { + + } + } + /// Discover protectable item properties. + public partial interface IDiscoverProtectableItemRequestProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The friendly name of the physical machine. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The friendly name of the physical machine.", + SerializedName = @"friendlyName", + PossibleTypes = new [] { typeof(string) })] + string FriendlyName { get; set; } + /// The IP address of the physical machine to be discovered. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The IP address of the physical machine to be discovered.", + SerializedName = @"ipAddress", + PossibleTypes = new [] { typeof(string) })] + string IPAddress { get; set; } + /// The OS type on the physical machine. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The OS type on the physical machine.", + SerializedName = @"osType", + PossibleTypes = new [] { typeof(string) })] + string OSType { get; set; } + + } + /// Discover protectable item properties. + internal partial interface IDiscoverProtectableItemRequestPropertiesInternal + + { + /// The friendly name of the physical machine. + string FriendlyName { get; set; } + /// The IP address of the physical machine to be discovered. + string IPAddress { get; set; } + /// The OS type on the physical machine. + string OSType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DiscoverProtectableItemRequestProperties.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DiscoverProtectableItemRequestProperties.json.cs new file mode 100644 index 000000000000..5cdd52caf229 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DiscoverProtectableItemRequestProperties.json.cs @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Discover protectable item properties. + public partial class DiscoverProtectableItemRequestProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal DiscoverProtectableItemRequestProperties(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_friendlyName = If( json?.PropertyT("friendlyName"), out var __jsonFriendlyName) ? (string)__jsonFriendlyName : (string)FriendlyName;} + {_iPAddress = If( json?.PropertyT("ipAddress"), out var __jsonIPAddress) ? (string)__jsonIPAddress : (string)IPAddress;} + {_oSType = If( json?.PropertyT("osType"), out var __jsonOSType) ? (string)__jsonOSType : (string)OSType;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiscoverProtectableItemRequestProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiscoverProtectableItemRequestProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiscoverProtectableItemRequestProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new DiscoverProtectableItemRequestProperties(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._friendlyName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._friendlyName.ToString()) : null, "friendlyName" ,container.Add ); + AddIf( null != (((object)this._iPAddress)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._iPAddress.ToString()) : null, "ipAddress" ,container.Add ); + AddIf( null != (((object)this._oSType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._oSType.ToString()) : null, "osType" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DiskDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DiskDetails.PowerShell.cs new file mode 100644 index 000000000000..866561dead1c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DiskDetails.PowerShell.cs @@ -0,0 +1,168 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Onprem disk details data. + [System.ComponentModel.TypeConverter(typeof(DiskDetailsTypeConverter))] + public partial class DiskDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DiskDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DiskDetails(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal DiskDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("MaxSizeMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskDetailsInternal)this).MaxSizeMb = (long?) content.GetValueForProperty("MaxSizeMb",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskDetailsInternal)this).MaxSizeMb, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("VhdType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskDetailsInternal)this).VhdType = (string) content.GetValueForProperty("VhdType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskDetailsInternal)this).VhdType, global::System.Convert.ToString); + } + if (content.Contains("VhdId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskDetailsInternal)this).VhdId = (string) content.GetValueForProperty("VhdId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskDetailsInternal)this).VhdId, global::System.Convert.ToString); + } + if (content.Contains("VhdName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskDetailsInternal)this).VhdName = (string) content.GetValueForProperty("VhdName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskDetailsInternal)this).VhdName, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal DiskDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("MaxSizeMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskDetailsInternal)this).MaxSizeMb = (long?) content.GetValueForProperty("MaxSizeMb",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskDetailsInternal)this).MaxSizeMb, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("VhdType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskDetailsInternal)this).VhdType = (string) content.GetValueForProperty("VhdType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskDetailsInternal)this).VhdType, global::System.Convert.ToString); + } + if (content.Contains("VhdId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskDetailsInternal)this).VhdId = (string) content.GetValueForProperty("VhdId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskDetailsInternal)this).VhdId, global::System.Convert.ToString); + } + if (content.Contains("VhdName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskDetailsInternal)this).VhdName = (string) content.GetValueForProperty("VhdName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskDetailsInternal)this).VhdName, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Onprem disk details data. + [System.ComponentModel.TypeConverter(typeof(DiskDetailsTypeConverter))] + public partial interface IDiskDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DiskDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DiskDetails.TypeConverter.cs new file mode 100644 index 000000000000..4529d85e7360 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DiskDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DiskDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DiskDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DiskDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DiskDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DiskDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DiskDetails.cs new file mode 100644 index 000000000000..c7d4d2c799ee --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DiskDetails.cs @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Onprem disk details data. + public partial class DiskDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskDetailsInternal + { + + /// Backing field for property. + private long? _maxSizeMb; + + /// The hard disk max size in MB. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public long? MaxSizeMb { get => this._maxSizeMb; set => this._maxSizeMb = value; } + + /// Backing field for property. + private string _vhdId; + + /// The VHD Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string VhdId { get => this._vhdId; set => this._vhdId = value; } + + /// Backing field for property. + private string _vhdName; + + /// The VHD name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string VhdName { get => this._vhdName; set => this._vhdName = value; } + + /// Backing field for property. + private string _vhdType; + + /// The type of the volume. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string VhdType { get => this._vhdType; set => this._vhdType = value; } + + /// Creates an new instance. + public DiskDetails() + { + + } + } + /// Onprem disk details data. + public partial interface IDiskDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The hard disk max size in MB. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The hard disk max size in MB.", + SerializedName = @"maxSizeMB", + PossibleTypes = new [] { typeof(long) })] + long? MaxSizeMb { get; set; } + /// The VHD Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The VHD Id.", + SerializedName = @"vhdId", + PossibleTypes = new [] { typeof(string) })] + string VhdId { get; set; } + /// The VHD name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The VHD name.", + SerializedName = @"vhdName", + PossibleTypes = new [] { typeof(string) })] + string VhdName { get; set; } + /// The type of the volume. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The type of the volume.", + SerializedName = @"vhdType", + PossibleTypes = new [] { typeof(string) })] + string VhdType { get; set; } + + } + /// Onprem disk details data. + internal partial interface IDiskDetailsInternal + + { + /// The hard disk max size in MB. + long? MaxSizeMb { get; set; } + /// The VHD Id. + string VhdId { get; set; } + /// The VHD name. + string VhdName { get; set; } + /// The type of the volume. + string VhdType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DiskDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DiskDetails.json.cs new file mode 100644 index 000000000000..54136f018f7b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DiskDetails.json.cs @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Onprem disk details data. + public partial class DiskDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal DiskDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_maxSizeMb = If( json?.PropertyT("maxSizeMB"), out var __jsonMaxSizeMb) ? (long?)__jsonMaxSizeMb : MaxSizeMb;} + {_vhdType = If( json?.PropertyT("vhdType"), out var __jsonVhdType) ? (string)__jsonVhdType : (string)VhdType;} + {_vhdId = If( json?.PropertyT("vhdId"), out var __jsonVhdId) ? (string)__jsonVhdId : (string)VhdId;} + {_vhdName = If( json?.PropertyT("vhdName"), out var __jsonVhdName) ? (string)__jsonVhdName : (string)VhdName;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new DiskDetails(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._maxSizeMb ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((long)this._maxSizeMb) : null, "maxSizeMB" ,container.Add ); + AddIf( null != (((object)this._vhdType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._vhdType.ToString()) : null, "vhdType" ,container.Add ); + AddIf( null != (((object)this._vhdId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._vhdId.ToString()) : null, "vhdId" ,container.Add ); + AddIf( null != (((object)this._vhdName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._vhdName.ToString()) : null, "vhdName" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DiskEncryptionInfo.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DiskEncryptionInfo.PowerShell.cs new file mode 100644 index 000000000000..823b4d9d9386 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DiskEncryptionInfo.PowerShell.cs @@ -0,0 +1,184 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Recovery disk encryption info (BEK and KEK). + [System.ComponentModel.TypeConverter(typeof(DiskEncryptionInfoTypeConverter))] + public partial class DiskEncryptionInfo + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfo DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DiskEncryptionInfo(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfo DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DiskEncryptionInfo(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal DiskEncryptionInfo(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DiskEncryptionKeyInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)this).DiskEncryptionKeyInfo = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionKeyInfo) content.GetValueForProperty("DiskEncryptionKeyInfo",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)this).DiskEncryptionKeyInfo, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DiskEncryptionKeyInfoTypeConverter.ConvertFrom); + } + if (content.Contains("KeyEncryptionKeyInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)this).KeyEncryptionKeyInfo = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IKeyEncryptionKeyInfo) content.GetValueForProperty("KeyEncryptionKeyInfo",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)this).KeyEncryptionKeyInfo, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.KeyEncryptionKeyInfoTypeConverter.ConvertFrom); + } + if (content.Contains("DiskEncryptionKeyInfoSecretIdentifier")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)this).DiskEncryptionKeyInfoSecretIdentifier = (string) content.GetValueForProperty("DiskEncryptionKeyInfoSecretIdentifier",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)this).DiskEncryptionKeyInfoSecretIdentifier, global::System.Convert.ToString); + } + if (content.Contains("KeyEncryptionKeyInfoKeyIdentifier")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)this).KeyEncryptionKeyInfoKeyIdentifier = (string) content.GetValueForProperty("KeyEncryptionKeyInfoKeyIdentifier",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)this).KeyEncryptionKeyInfoKeyIdentifier, global::System.Convert.ToString); + } + if (content.Contains("DiskEncryptionKeyInfoKeyVaultResourceArmId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)this).DiskEncryptionKeyInfoKeyVaultResourceArmId = (string) content.GetValueForProperty("DiskEncryptionKeyInfoKeyVaultResourceArmId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)this).DiskEncryptionKeyInfoKeyVaultResourceArmId, global::System.Convert.ToString); + } + if (content.Contains("KeyEncryptionKeyInfoKeyVaultResourceArmId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)this).KeyEncryptionKeyInfoKeyVaultResourceArmId = (string) content.GetValueForProperty("KeyEncryptionKeyInfoKeyVaultResourceArmId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)this).KeyEncryptionKeyInfoKeyVaultResourceArmId, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal DiskEncryptionInfo(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DiskEncryptionKeyInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)this).DiskEncryptionKeyInfo = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionKeyInfo) content.GetValueForProperty("DiskEncryptionKeyInfo",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)this).DiskEncryptionKeyInfo, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DiskEncryptionKeyInfoTypeConverter.ConvertFrom); + } + if (content.Contains("KeyEncryptionKeyInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)this).KeyEncryptionKeyInfo = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IKeyEncryptionKeyInfo) content.GetValueForProperty("KeyEncryptionKeyInfo",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)this).KeyEncryptionKeyInfo, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.KeyEncryptionKeyInfoTypeConverter.ConvertFrom); + } + if (content.Contains("DiskEncryptionKeyInfoSecretIdentifier")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)this).DiskEncryptionKeyInfoSecretIdentifier = (string) content.GetValueForProperty("DiskEncryptionKeyInfoSecretIdentifier",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)this).DiskEncryptionKeyInfoSecretIdentifier, global::System.Convert.ToString); + } + if (content.Contains("KeyEncryptionKeyInfoKeyIdentifier")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)this).KeyEncryptionKeyInfoKeyIdentifier = (string) content.GetValueForProperty("KeyEncryptionKeyInfoKeyIdentifier",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)this).KeyEncryptionKeyInfoKeyIdentifier, global::System.Convert.ToString); + } + if (content.Contains("DiskEncryptionKeyInfoKeyVaultResourceArmId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)this).DiskEncryptionKeyInfoKeyVaultResourceArmId = (string) content.GetValueForProperty("DiskEncryptionKeyInfoKeyVaultResourceArmId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)this).DiskEncryptionKeyInfoKeyVaultResourceArmId, global::System.Convert.ToString); + } + if (content.Contains("KeyEncryptionKeyInfoKeyVaultResourceArmId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)this).KeyEncryptionKeyInfoKeyVaultResourceArmId = (string) content.GetValueForProperty("KeyEncryptionKeyInfoKeyVaultResourceArmId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal)this).KeyEncryptionKeyInfoKeyVaultResourceArmId, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfo FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Recovery disk encryption info (BEK and KEK). + [System.ComponentModel.TypeConverter(typeof(DiskEncryptionInfoTypeConverter))] + public partial interface IDiskEncryptionInfo + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DiskEncryptionInfo.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DiskEncryptionInfo.TypeConverter.cs new file mode 100644 index 000000000000..87485927a508 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DiskEncryptionInfo.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DiskEncryptionInfoTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfo ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfo).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DiskEncryptionInfo.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DiskEncryptionInfo.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DiskEncryptionInfo.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DiskEncryptionInfo.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DiskEncryptionInfo.cs new file mode 100644 index 000000000000..bd1405a439ab --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DiskEncryptionInfo.cs @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Recovery disk encryption info (BEK and KEK). + public partial class DiskEncryptionInfo : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfo, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionKeyInfo _diskEncryptionKeyInfo; + + /// The recovery KeyVault reference for secret. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionKeyInfo DiskEncryptionKeyInfo { get => (this._diskEncryptionKeyInfo = this._diskEncryptionKeyInfo ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DiskEncryptionKeyInfo()); set => this._diskEncryptionKeyInfo = value; } + + /// The KeyVault resource ARM id for secret. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string DiskEncryptionKeyInfoKeyVaultResourceArmId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionKeyInfoInternal)DiskEncryptionKeyInfo).KeyVaultResourceArmId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionKeyInfoInternal)DiskEncryptionKeyInfo).KeyVaultResourceArmId = value ?? null; } + + /// The secret url / identifier. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string DiskEncryptionKeyInfoSecretIdentifier { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionKeyInfoInternal)DiskEncryptionKeyInfo).SecretIdentifier; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionKeyInfoInternal)DiskEncryptionKeyInfo).SecretIdentifier = value ?? null; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IKeyEncryptionKeyInfo _keyEncryptionKeyInfo; + + /// The recovery KeyVault reference for key. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IKeyEncryptionKeyInfo KeyEncryptionKeyInfo { get => (this._keyEncryptionKeyInfo = this._keyEncryptionKeyInfo ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.KeyEncryptionKeyInfo()); set => this._keyEncryptionKeyInfo = value; } + + /// The key URL / identifier. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string KeyEncryptionKeyInfoKeyIdentifier { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IKeyEncryptionKeyInfoInternal)KeyEncryptionKeyInfo).KeyIdentifier; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IKeyEncryptionKeyInfoInternal)KeyEncryptionKeyInfo).KeyIdentifier = value ?? null; } + + /// The KeyVault resource ARM Id for key. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string KeyEncryptionKeyInfoKeyVaultResourceArmId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IKeyEncryptionKeyInfoInternal)KeyEncryptionKeyInfo).KeyVaultResourceArmId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IKeyEncryptionKeyInfoInternal)KeyEncryptionKeyInfo).KeyVaultResourceArmId = value ?? null; } + + /// Internal Acessors for DiskEncryptionKeyInfo + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionKeyInfo Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal.DiskEncryptionKeyInfo { get => (this._diskEncryptionKeyInfo = this._diskEncryptionKeyInfo ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DiskEncryptionKeyInfo()); set { {_diskEncryptionKeyInfo = value;} } } + + /// Internal Acessors for KeyEncryptionKeyInfo + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IKeyEncryptionKeyInfo Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfoInternal.KeyEncryptionKeyInfo { get => (this._keyEncryptionKeyInfo = this._keyEncryptionKeyInfo ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.KeyEncryptionKeyInfo()); set { {_keyEncryptionKeyInfo = value;} } } + + /// Creates an new instance. + public DiskEncryptionInfo() + { + + } + } + /// Recovery disk encryption info (BEK and KEK). + public partial interface IDiskEncryptionInfo : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The KeyVault resource ARM id for secret. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The KeyVault resource ARM id for secret.", + SerializedName = @"keyVaultResourceArmId", + PossibleTypes = new [] { typeof(string) })] + string DiskEncryptionKeyInfoKeyVaultResourceArmId { get; set; } + /// The secret url / identifier. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The secret url / identifier.", + SerializedName = @"secretIdentifier", + PossibleTypes = new [] { typeof(string) })] + string DiskEncryptionKeyInfoSecretIdentifier { get; set; } + /// The key URL / identifier. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The key URL / identifier.", + SerializedName = @"keyIdentifier", + PossibleTypes = new [] { typeof(string) })] + string KeyEncryptionKeyInfoKeyIdentifier { get; set; } + /// The KeyVault resource ARM Id for key. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The KeyVault resource ARM Id for key.", + SerializedName = @"keyVaultResourceArmId", + PossibleTypes = new [] { typeof(string) })] + string KeyEncryptionKeyInfoKeyVaultResourceArmId { get; set; } + + } + /// Recovery disk encryption info (BEK and KEK). + internal partial interface IDiskEncryptionInfoInternal + + { + /// The recovery KeyVault reference for secret. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionKeyInfo DiskEncryptionKeyInfo { get; set; } + /// The KeyVault resource ARM id for secret. + string DiskEncryptionKeyInfoKeyVaultResourceArmId { get; set; } + /// The secret url / identifier. + string DiskEncryptionKeyInfoSecretIdentifier { get; set; } + /// The recovery KeyVault reference for key. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IKeyEncryptionKeyInfo KeyEncryptionKeyInfo { get; set; } + /// The key URL / identifier. + string KeyEncryptionKeyInfoKeyIdentifier { get; set; } + /// The KeyVault resource ARM Id for key. + string KeyEncryptionKeyInfoKeyVaultResourceArmId { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DiskEncryptionInfo.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DiskEncryptionInfo.json.cs new file mode 100644 index 000000000000..6fb81d54dc49 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DiskEncryptionInfo.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Recovery disk encryption info (BEK and KEK). + public partial class DiskEncryptionInfo + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal DiskEncryptionInfo(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_diskEncryptionKeyInfo = If( json?.PropertyT("diskEncryptionKeyInfo"), out var __jsonDiskEncryptionKeyInfo) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DiskEncryptionKeyInfo.FromJson(__jsonDiskEncryptionKeyInfo) : DiskEncryptionKeyInfo;} + {_keyEncryptionKeyInfo = If( json?.PropertyT("keyEncryptionKeyInfo"), out var __jsonKeyEncryptionKeyInfo) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.KeyEncryptionKeyInfo.FromJson(__jsonKeyEncryptionKeyInfo) : KeyEncryptionKeyInfo;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfo. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfo. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionInfo FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new DiskEncryptionInfo(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._diskEncryptionKeyInfo ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._diskEncryptionKeyInfo.ToJson(null,serializationMode) : null, "diskEncryptionKeyInfo" ,container.Add ); + AddIf( null != this._keyEncryptionKeyInfo ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._keyEncryptionKeyInfo.ToJson(null,serializationMode) : null, "keyEncryptionKeyInfo" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DiskEncryptionKeyInfo.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DiskEncryptionKeyInfo.PowerShell.cs new file mode 100644 index 000000000000..109d318a8d7d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DiskEncryptionKeyInfo.PowerShell.cs @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Disk Encryption Key Information (BitLocker Encryption Key (BEK) on Windows). + [System.ComponentModel.TypeConverter(typeof(DiskEncryptionKeyInfoTypeConverter))] + public partial class DiskEncryptionKeyInfo + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionKeyInfo DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DiskEncryptionKeyInfo(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionKeyInfo DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DiskEncryptionKeyInfo(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal DiskEncryptionKeyInfo(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SecretIdentifier")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionKeyInfoInternal)this).SecretIdentifier = (string) content.GetValueForProperty("SecretIdentifier",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionKeyInfoInternal)this).SecretIdentifier, global::System.Convert.ToString); + } + if (content.Contains("KeyVaultResourceArmId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionKeyInfoInternal)this).KeyVaultResourceArmId = (string) content.GetValueForProperty("KeyVaultResourceArmId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionKeyInfoInternal)this).KeyVaultResourceArmId, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal DiskEncryptionKeyInfo(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SecretIdentifier")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionKeyInfoInternal)this).SecretIdentifier = (string) content.GetValueForProperty("SecretIdentifier",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionKeyInfoInternal)this).SecretIdentifier, global::System.Convert.ToString); + } + if (content.Contains("KeyVaultResourceArmId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionKeyInfoInternal)this).KeyVaultResourceArmId = (string) content.GetValueForProperty("KeyVaultResourceArmId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionKeyInfoInternal)this).KeyVaultResourceArmId, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionKeyInfo FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Disk Encryption Key Information (BitLocker Encryption Key (BEK) on Windows). + [System.ComponentModel.TypeConverter(typeof(DiskEncryptionKeyInfoTypeConverter))] + public partial interface IDiskEncryptionKeyInfo + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DiskEncryptionKeyInfo.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DiskEncryptionKeyInfo.TypeConverter.cs new file mode 100644 index 000000000000..ef16d3656872 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DiskEncryptionKeyInfo.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DiskEncryptionKeyInfoTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionKeyInfo ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionKeyInfo).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DiskEncryptionKeyInfo.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DiskEncryptionKeyInfo.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DiskEncryptionKeyInfo.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DiskEncryptionKeyInfo.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DiskEncryptionKeyInfo.cs new file mode 100644 index 000000000000..c89484c58d04 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DiskEncryptionKeyInfo.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Disk Encryption Key Information (BitLocker Encryption Key (BEK) on Windows). + public partial class DiskEncryptionKeyInfo : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionKeyInfo, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionKeyInfoInternal + { + + /// Backing field for property. + private string _keyVaultResourceArmId; + + /// The KeyVault resource ARM id for secret. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string KeyVaultResourceArmId { get => this._keyVaultResourceArmId; set => this._keyVaultResourceArmId = value; } + + /// Backing field for property. + private string _secretIdentifier; + + /// The secret url / identifier. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string SecretIdentifier { get => this._secretIdentifier; set => this._secretIdentifier = value; } + + /// Creates an new instance. + public DiskEncryptionKeyInfo() + { + + } + } + /// Disk Encryption Key Information (BitLocker Encryption Key (BEK) on Windows). + public partial interface IDiskEncryptionKeyInfo : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The KeyVault resource ARM id for secret. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The KeyVault resource ARM id for secret.", + SerializedName = @"keyVaultResourceArmId", + PossibleTypes = new [] { typeof(string) })] + string KeyVaultResourceArmId { get; set; } + /// The secret url / identifier. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The secret url / identifier.", + SerializedName = @"secretIdentifier", + PossibleTypes = new [] { typeof(string) })] + string SecretIdentifier { get; set; } + + } + /// Disk Encryption Key Information (BitLocker Encryption Key (BEK) on Windows). + internal partial interface IDiskEncryptionKeyInfoInternal + + { + /// The KeyVault resource ARM id for secret. + string KeyVaultResourceArmId { get; set; } + /// The secret url / identifier. + string SecretIdentifier { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DiskEncryptionKeyInfo.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DiskEncryptionKeyInfo.json.cs new file mode 100644 index 000000000000..ad86a9d91d51 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DiskEncryptionKeyInfo.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Disk Encryption Key Information (BitLocker Encryption Key (BEK) on Windows). + public partial class DiskEncryptionKeyInfo + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal DiskEncryptionKeyInfo(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_secretIdentifier = If( json?.PropertyT("secretIdentifier"), out var __jsonSecretIdentifier) ? (string)__jsonSecretIdentifier : (string)SecretIdentifier;} + {_keyVaultResourceArmId = If( json?.PropertyT("keyVaultResourceArmId"), out var __jsonKeyVaultResourceArmId) ? (string)__jsonKeyVaultResourceArmId : (string)KeyVaultResourceArmId;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionKeyInfo. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionKeyInfo. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskEncryptionKeyInfo FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new DiskEncryptionKeyInfo(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._secretIdentifier)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._secretIdentifier.ToString()) : null, "secretIdentifier" ,container.Add ); + AddIf( null != (((object)this._keyVaultResourceArmId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._keyVaultResourceArmId.ToString()) : null, "keyVaultResourceArmId" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DiskVolumeDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DiskVolumeDetails.PowerShell.cs new file mode 100644 index 000000000000..b2380453820c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DiskVolumeDetails.PowerShell.cs @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Volume details. + [System.ComponentModel.TypeConverter(typeof(DiskVolumeDetailsTypeConverter))] + public partial class DiskVolumeDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskVolumeDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DiskVolumeDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskVolumeDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DiskVolumeDetails(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal DiskVolumeDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Label")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskVolumeDetailsInternal)this).Label = (string) content.GetValueForProperty("Label",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskVolumeDetailsInternal)this).Label, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskVolumeDetailsInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskVolumeDetailsInternal)this).Name, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal DiskVolumeDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Label")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskVolumeDetailsInternal)this).Label = (string) content.GetValueForProperty("Label",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskVolumeDetailsInternal)this).Label, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskVolumeDetailsInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskVolumeDetailsInternal)this).Name, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskVolumeDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Volume details. + [System.ComponentModel.TypeConverter(typeof(DiskVolumeDetailsTypeConverter))] + public partial interface IDiskVolumeDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DiskVolumeDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DiskVolumeDetails.TypeConverter.cs new file mode 100644 index 000000000000..bdf15cd3fa52 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DiskVolumeDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DiskVolumeDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskVolumeDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskVolumeDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DiskVolumeDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DiskVolumeDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DiskVolumeDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DiskVolumeDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DiskVolumeDetails.cs new file mode 100644 index 000000000000..4b793d62c600 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DiskVolumeDetails.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Volume details. + public partial class DiskVolumeDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskVolumeDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskVolumeDetailsInternal + { + + /// Backing field for property. + private string _label; + + /// The volume label. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Label { get => this._label; set => this._label = value; } + + /// Backing field for property. + private string _name; + + /// The volume name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Name { get => this._name; set => this._name = value; } + + /// Creates an new instance. + public DiskVolumeDetails() + { + + } + } + /// Volume details. + public partial interface IDiskVolumeDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The volume label. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The volume label.", + SerializedName = @"label", + PossibleTypes = new [] { typeof(string) })] + string Label { get; set; } + /// The volume name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The volume name.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string Name { get; set; } + + } + /// Volume details. + internal partial interface IDiskVolumeDetailsInternal + + { + /// The volume label. + string Label { get; set; } + /// The volume name. + string Name { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DiskVolumeDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DiskVolumeDetails.json.cs new file mode 100644 index 000000000000..dd42433c188b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DiskVolumeDetails.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Volume details. + public partial class DiskVolumeDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal DiskVolumeDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_label = If( json?.PropertyT("label"), out var __jsonLabel) ? (string)__jsonLabel : (string)Label;} + {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)Name;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskVolumeDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskVolumeDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskVolumeDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new DiskVolumeDetails(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._label)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._label.ToString()) : null, "label" ,container.Add ); + AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Display.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Display.PowerShell.cs new file mode 100644 index 000000000000..e4ef41ee70d8 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Display.PowerShell.cs @@ -0,0 +1,174 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// 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. + /// + [System.ComponentModel.TypeConverter(typeof(DisplayTypeConverter))] + public partial class Display + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisplay DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new Display(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisplay DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new Display(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal Display(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Provider")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisplayInternal)this).Provider = (string) content.GetValueForProperty("Provider",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisplayInternal)this).Provider, global::System.Convert.ToString); + } + if (content.Contains("Resource")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisplayInternal)this).Resource = (string) content.GetValueForProperty("Resource",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisplayInternal)this).Resource, global::System.Convert.ToString); + } + if (content.Contains("Operation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisplayInternal)this).Operation = (string) content.GetValueForProperty("Operation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisplayInternal)this).Operation, global::System.Convert.ToString); + } + if (content.Contains("Description")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisplayInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisplayInternal)this).Description, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal Display(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Provider")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisplayInternal)this).Provider = (string) content.GetValueForProperty("Provider",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisplayInternal)this).Provider, global::System.Convert.ToString); + } + if (content.Contains("Resource")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisplayInternal)this).Resource = (string) content.GetValueForProperty("Resource",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisplayInternal)this).Resource, global::System.Convert.ToString); + } + if (content.Contains("Operation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisplayInternal)this).Operation = (string) content.GetValueForProperty("Operation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisplayInternal)this).Operation, global::System.Convert.ToString); + } + if (content.Contains("Description")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisplayInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisplayInternal)this).Description, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisplay FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// 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. + [System.ComponentModel.TypeConverter(typeof(DisplayTypeConverter))] + public partial interface IDisplay + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Display.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Display.TypeConverter.cs new file mode 100644 index 000000000000..fc5022792d24 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Display.TypeConverter.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DisplayTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisplay ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisplay).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return Display.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return Display.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return Display.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Display.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Display.cs new file mode 100644 index 000000000000..0fd81043b55f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Display.cs @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// + /// 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. + /// + public partial class Display : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisplay, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisplayInternal + { + + /// Backing field for property. + private string _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'. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Description { get => this._description; set => this._description = value; } + + /// Backing field for property. + private string _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'. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Operation { get => this._operation; set => this._operation = value; } + + /// Backing field for property. + private string _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.". + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Provider { get => this._provider; set => this._provider = value; } + + /// Backing field for property. + private string _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". + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Resource { get => this._resource; set => this._resource = value; } + + /// Creates an new instance. + public Display() + { + + } + } + /// 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. + public partial interface IDisplay : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// + /// 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'. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + 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'.", + SerializedName = @"description", + PossibleTypes = new [] { typeof(string) })] + string Description { get; set; } + /// + /// 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'. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"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'.", + SerializedName = @"operation", + PossibleTypes = new [] { typeof(string) })] + string Operation { get; set; } + /// + /// 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.". + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"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."".", + SerializedName = @"provider", + PossibleTypes = new [] { typeof(string) })] + string Provider { get; set; } + /// + /// 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". + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"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"".", + SerializedName = @"resource", + PossibleTypes = new [] { typeof(string) })] + string Resource { get; set; } + + } + /// 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. + internal partial interface IDisplayInternal + + { + /// + /// 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'. + /// + string Description { get; set; } + /// + /// 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'. + /// + string Operation { get; set; } + /// + /// 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.". + /// + string Provider { get; set; } + /// + /// 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". + /// + string Resource { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Display.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Display.json.cs new file mode 100644 index 000000000000..177d86a03eab --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Display.json.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// + /// 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. + /// + public partial class Display + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal Display(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_provider = If( json?.PropertyT("provider"), out var __jsonProvider) ? (string)__jsonProvider : (string)Provider;} + {_resource = If( json?.PropertyT("resource"), out var __jsonResource) ? (string)__jsonResource : (string)Resource;} + {_operation = If( json?.PropertyT("operation"), out var __jsonOperation) ? (string)__jsonOperation : (string)Operation;} + {_description = If( json?.PropertyT("description"), out var __jsonDescription) ? (string)__jsonDescription : (string)Description;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisplay. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisplay. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisplay FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new Display(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._provider)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._provider.ToString()) : null, "provider" ,container.Add ); + AddIf( null != (((object)this._resource)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._resource.ToString()) : null, "resource" ,container.Add ); + AddIf( null != (((object)this._operation)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._operation.ToString()) : null, "operation" ,container.Add ); + AddIf( null != (((object)this._description)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._description.ToString()) : null, "description" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DraDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DraDetails.PowerShell.cs new file mode 100644 index 000000000000..b806da313d10 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DraDetails.PowerShell.cs @@ -0,0 +1,208 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// DRA details. + [System.ComponentModel.TypeConverter(typeof(DraDetailsTypeConverter))] + public partial class DraDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDraDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DraDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDraDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DraDetails(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal DraDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDraDetailsInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDraDetailsInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDraDetailsInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDraDetailsInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("BiosId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDraDetailsInternal)this).BiosId = (string) content.GetValueForProperty("BiosId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDraDetailsInternal)this).BiosId, global::System.Convert.ToString); + } + if (content.Contains("Version")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDraDetailsInternal)this).Version = (string) content.GetValueForProperty("Version",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDraDetailsInternal)this).Version, global::System.Convert.ToString); + } + if (content.Contains("LastHeartbeatUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDraDetailsInternal)this).LastHeartbeatUtc = (global::System.DateTime?) content.GetValueForProperty("LastHeartbeatUtc",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDraDetailsInternal)this).LastHeartbeatUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("Health")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDraDetailsInternal)this).Health = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth?) content.GetValueForProperty("Health",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDraDetailsInternal)this).Health, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth.CreateFrom); + } + if (content.Contains("HealthError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDraDetailsInternal)this).HealthError = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[]) content.GetValueForProperty("HealthError",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDraDetailsInternal)this).HealthError, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("ForwardProtectedItemCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDraDetailsInternal)this).ForwardProtectedItemCount = (int?) content.GetValueForProperty("ForwardProtectedItemCount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDraDetailsInternal)this).ForwardProtectedItemCount, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("ReverseProtectedItemCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDraDetailsInternal)this).ReverseProtectedItemCount = (int?) content.GetValueForProperty("ReverseProtectedItemCount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDraDetailsInternal)this).ReverseProtectedItemCount, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal DraDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDraDetailsInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDraDetailsInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDraDetailsInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDraDetailsInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("BiosId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDraDetailsInternal)this).BiosId = (string) content.GetValueForProperty("BiosId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDraDetailsInternal)this).BiosId, global::System.Convert.ToString); + } + if (content.Contains("Version")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDraDetailsInternal)this).Version = (string) content.GetValueForProperty("Version",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDraDetailsInternal)this).Version, global::System.Convert.ToString); + } + if (content.Contains("LastHeartbeatUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDraDetailsInternal)this).LastHeartbeatUtc = (global::System.DateTime?) content.GetValueForProperty("LastHeartbeatUtc",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDraDetailsInternal)this).LastHeartbeatUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("Health")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDraDetailsInternal)this).Health = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth?) content.GetValueForProperty("Health",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDraDetailsInternal)this).Health, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth.CreateFrom); + } + if (content.Contains("HealthError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDraDetailsInternal)this).HealthError = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[]) content.GetValueForProperty("HealthError",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDraDetailsInternal)this).HealthError, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("ForwardProtectedItemCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDraDetailsInternal)this).ForwardProtectedItemCount = (int?) content.GetValueForProperty("ForwardProtectedItemCount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDraDetailsInternal)this).ForwardProtectedItemCount, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("ReverseProtectedItemCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDraDetailsInternal)this).ReverseProtectedItemCount = (int?) content.GetValueForProperty("ReverseProtectedItemCount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDraDetailsInternal)this).ReverseProtectedItemCount, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + AfterDeserializePSObject(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDraDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// DRA details. + [System.ComponentModel.TypeConverter(typeof(DraDetailsTypeConverter))] + public partial interface IDraDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DraDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DraDetails.TypeConverter.cs new file mode 100644 index 000000000000..2538182a3a89 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DraDetails.TypeConverter.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DraDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDraDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDraDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DraDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DraDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DraDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DraDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DraDetails.cs new file mode 100644 index 000000000000..9cccc14d5cc3 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DraDetails.cs @@ -0,0 +1,214 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// DRA details. + public partial class DraDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDraDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDraDetailsInternal + { + + /// Backing field for property. + private string _biosId; + + /// The DRA Bios Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string BiosId { get => this._biosId; } + + /// Backing field for property. + private int? _forwardProtectedItemCount; + + /// The count of protected items which are protected in forward direction. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? ForwardProtectedItemCount { get => this._forwardProtectedItemCount; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth? _health; + + /// The health. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth? Health { get => this._health; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] _healthError; + + /// The health errors. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] HealthError { get => this._healthError; } + + /// Backing field for property. + private string _id; + + /// The DRA Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Id { get => this._id; } + + /// Backing field for property. + private global::System.DateTime? _lastHeartbeatUtc; + + /// The last heartbeat received from the DRA. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public global::System.DateTime? LastHeartbeatUtc { get => this._lastHeartbeatUtc; } + + /// Internal Acessors for BiosId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDraDetailsInternal.BiosId { get => this._biosId; set { {_biosId = value;} } } + + /// Internal Acessors for ForwardProtectedItemCount + int? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDraDetailsInternal.ForwardProtectedItemCount { get => this._forwardProtectedItemCount; set { {_forwardProtectedItemCount = value;} } } + + /// Internal Acessors for Health + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDraDetailsInternal.Health { get => this._health; set { {_health = value;} } } + + /// Internal Acessors for HealthError + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDraDetailsInternal.HealthError { get => this._healthError; set { {_healthError = value;} } } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDraDetailsInternal.Id { get => this._id; set { {_id = value;} } } + + /// Internal Acessors for LastHeartbeatUtc + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDraDetailsInternal.LastHeartbeatUtc { get => this._lastHeartbeatUtc; set { {_lastHeartbeatUtc = value;} } } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDraDetailsInternal.Name { get => this._name; set { {_name = value;} } } + + /// Internal Acessors for ReverseProtectedItemCount + int? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDraDetailsInternal.ReverseProtectedItemCount { get => this._reverseProtectedItemCount; set { {_reverseProtectedItemCount = value;} } } + + /// Internal Acessors for Version + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDraDetailsInternal.Version { get => this._version; set { {_version = value;} } } + + /// Backing field for property. + private string _name; + + /// The DRA name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Name { get => this._name; } + + /// Backing field for property. + private int? _reverseProtectedItemCount; + + /// The count of protected items which are protected in reverse direction. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? ReverseProtectedItemCount { get => this._reverseProtectedItemCount; } + + /// Backing field for property. + private string _version; + + /// The version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Version { get => this._version; } + + /// Creates an new instance. + public DraDetails() + { + + } + } + /// DRA details. + public partial interface IDraDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The DRA Bios Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The DRA Bios Id.", + SerializedName = @"biosId", + PossibleTypes = new [] { typeof(string) })] + string BiosId { get; } + /// The count of protected items which are protected in forward direction. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The count of protected items which are protected in forward direction.", + SerializedName = @"forwardProtectedItemCount", + PossibleTypes = new [] { typeof(int) })] + int? ForwardProtectedItemCount { get; } + /// The health. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The health.", + SerializedName = @"health", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth? Health { get; } + /// The health errors. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The health errors.", + SerializedName = @"healthErrors", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] HealthError { get; } + /// The DRA Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The DRA Id.", + SerializedName = @"id", + PossibleTypes = new [] { typeof(string) })] + string Id { get; } + /// The last heartbeat received from the DRA. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The last heartbeat received from the DRA.", + SerializedName = @"lastHeartbeatUtc", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? LastHeartbeatUtc { get; } + /// The DRA name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The DRA name.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string Name { get; } + /// The count of protected items which are protected in reverse direction. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The count of protected items which are protected in reverse direction.", + SerializedName = @"reverseProtectedItemCount", + PossibleTypes = new [] { typeof(int) })] + int? ReverseProtectedItemCount { get; } + /// The version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The version.", + SerializedName = @"version", + PossibleTypes = new [] { typeof(string) })] + string Version { get; } + + } + /// DRA details. + internal partial interface IDraDetailsInternal + + { + /// The DRA Bios Id. + string BiosId { get; set; } + /// The count of protected items which are protected in forward direction. + int? ForwardProtectedItemCount { get; set; } + /// The health. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth? Health { get; set; } + /// The health errors. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] HealthError { get; set; } + /// The DRA Id. + string Id { get; set; } + /// The last heartbeat received from the DRA. + global::System.DateTime? LastHeartbeatUtc { get; set; } + /// The DRA name. + string Name { get; set; } + /// The count of protected items which are protected in reverse direction. + int? ReverseProtectedItemCount { get; set; } + /// The version. + string Version { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DraDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DraDetails.json.cs new file mode 100644 index 000000000000..a0e3f5466e8b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/DraDetails.json.cs @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// DRA details. + public partial class DraDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal DraDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_id = If( json?.PropertyT("id"), out var __jsonId) ? (string)__jsonId : (string)Id;} + {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)Name;} + {_biosId = If( json?.PropertyT("biosId"), out var __jsonBiosId) ? (string)__jsonBiosId : (string)BiosId;} + {_version = If( json?.PropertyT("version"), out var __jsonVersion) ? (string)__jsonVersion : (string)Version;} + {_lastHeartbeatUtc = If( json?.PropertyT("lastHeartbeatUtc"), out var __jsonLastHeartbeatUtc) ? global::System.DateTime.TryParse((string)__jsonLastHeartbeatUtc, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonLastHeartbeatUtcValue) ? __jsonLastHeartbeatUtcValue : LastHeartbeatUtc : LastHeartbeatUtc;} + {_health = If( json?.PropertyT("health"), out var __jsonHealth) ? (string)__jsonHealth : (string)Health;} + {_healthError = If( json?.PropertyT("healthErrors"), out var __jsonHealthErrors) ? If( __jsonHealthErrors as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthError.FromJson(__u) )) ))() : null : HealthError;} + {_forwardProtectedItemCount = If( json?.PropertyT("forwardProtectedItemCount"), out var __jsonForwardProtectedItemCount) ? (int?)__jsonForwardProtectedItemCount : ForwardProtectedItemCount;} + {_reverseProtectedItemCount = If( json?.PropertyT("reverseProtectedItemCount"), out var __jsonReverseProtectedItemCount) ? (int?)__jsonReverseProtectedItemCount : ReverseProtectedItemCount;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDraDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDraDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDraDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new DraDetails(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._id)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._id.ToString()) : null, "id" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._biosId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._biosId.ToString()) : null, "biosId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._version)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._version.ToString()) : null, "version" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._lastHeartbeatUtc ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._lastHeartbeatUtc?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "lastHeartbeatUtc" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._health)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._health.ToString()) : null, "health" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + if (null != this._healthError) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._healthError ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("healthErrors",__w); + } + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._forwardProtectedItemCount ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._forwardProtectedItemCount) : null, "forwardProtectedItemCount" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._reverseProtectedItemCount ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._reverseProtectedItemCount) : null, "reverseProtectedItemCount" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EnableMigrationInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EnableMigrationInput.PowerShell.cs new file mode 100644 index 000000000000..4956e7bb264f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EnableMigrationInput.PowerShell.cs @@ -0,0 +1,168 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Enable migration input. + [System.ComponentModel.TypeConverter(typeof(EnableMigrationInputTypeConverter))] + public partial class EnableMigrationInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new EnableMigrationInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new EnableMigrationInput(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal EnableMigrationInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationInputInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationInputProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationInputInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EnableMigrationInputPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationInputInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationProviderSpecificInput) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationInputInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EnableMigrationProviderSpecificInputTypeConverter.ConvertFrom); + } + if (content.Contains("PolicyId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationInputInternal)this).PolicyId = (string) content.GetValueForProperty("PolicyId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationInputInternal)this).PolicyId, global::System.Convert.ToString); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationInputInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationInputInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal EnableMigrationInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationInputInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationInputProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationInputInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EnableMigrationInputPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationInputInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationProviderSpecificInput) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationInputInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EnableMigrationProviderSpecificInputTypeConverter.ConvertFrom); + } + if (content.Contains("PolicyId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationInputInternal)this).PolicyId = (string) content.GetValueForProperty("PolicyId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationInputInternal)this).PolicyId, global::System.Convert.ToString); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationInputInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationInputInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Enable migration input. + [System.ComponentModel.TypeConverter(typeof(EnableMigrationInputTypeConverter))] + public partial interface IEnableMigrationInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EnableMigrationInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EnableMigrationInput.TypeConverter.cs new file mode 100644 index 000000000000..98986170d45e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EnableMigrationInput.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class EnableMigrationInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return EnableMigrationInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return EnableMigrationInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return EnableMigrationInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EnableMigrationInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EnableMigrationInput.cs new file mode 100644 index 000000000000..3ff28ac6f8ef --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EnableMigrationInput.cs @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Enable migration input. + public partial class EnableMigrationInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationInputInternal + { + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationInputProperties Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationInputInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EnableMigrationInputProperties()); set { {_property = value;} } } + + /// Internal Acessors for ProviderSpecificDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationProviderSpecificInput Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationInputInternal.ProviderSpecificDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationInputPropertiesInternal)Property).ProviderSpecificDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationInputPropertiesInternal)Property).ProviderSpecificDetail = value; } + + /// The policy Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string PolicyId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationInputPropertiesInternal)Property).PolicyId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationInputPropertiesInternal)Property).PolicyId = value ; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationInputProperties _property; + + /// Enable migration input properties. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationInputProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EnableMigrationInputProperties()); set => this._property = value; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ProviderSpecificDetailInstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationInputPropertiesInternal)Property).ProviderSpecificDetailInstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationInputPropertiesInternal)Property).ProviderSpecificDetailInstanceType = value ; } + + /// Creates an new instance. + public EnableMigrationInput() + { + + } + } + /// Enable migration input. + public partial interface IEnableMigrationInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The policy Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The policy Id.", + SerializedName = @"policyId", + PossibleTypes = new [] { typeof(string) })] + string PolicyId { get; set; } + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string ProviderSpecificDetailInstanceType { get; set; } + + } + /// Enable migration input. + internal partial interface IEnableMigrationInputInternal + + { + /// The policy Id. + string PolicyId { get; set; } + /// Enable migration input properties. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationInputProperties Property { get; set; } + /// The provider specific details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationProviderSpecificInput ProviderSpecificDetail { get; set; } + /// The class type. + string ProviderSpecificDetailInstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EnableMigrationInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EnableMigrationInput.json.cs new file mode 100644 index 000000000000..0d45d9a48512 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EnableMigrationInput.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Enable migration input. + public partial class EnableMigrationInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal EnableMigrationInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EnableMigrationInputProperties.FromJson(__jsonProperties) : Property;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new EnableMigrationInput(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EnableMigrationInputProperties.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EnableMigrationInputProperties.PowerShell.cs new file mode 100644 index 000000000000..a5edf46d3273 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EnableMigrationInputProperties.PowerShell.cs @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Enable migration input properties. + [System.ComponentModel.TypeConverter(typeof(EnableMigrationInputPropertiesTypeConverter))] + public partial class EnableMigrationInputProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationInputProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new EnableMigrationInputProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationInputProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new EnableMigrationInputProperties(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal EnableMigrationInputProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationInputPropertiesInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationProviderSpecificInput) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationInputPropertiesInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EnableMigrationProviderSpecificInputTypeConverter.ConvertFrom); + } + if (content.Contains("PolicyId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationInputPropertiesInternal)this).PolicyId = (string) content.GetValueForProperty("PolicyId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationInputPropertiesInternal)this).PolicyId, global::System.Convert.ToString); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationInputPropertiesInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationInputPropertiesInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal EnableMigrationInputProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationInputPropertiesInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationProviderSpecificInput) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationInputPropertiesInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EnableMigrationProviderSpecificInputTypeConverter.ConvertFrom); + } + if (content.Contains("PolicyId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationInputPropertiesInternal)this).PolicyId = (string) content.GetValueForProperty("PolicyId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationInputPropertiesInternal)this).PolicyId, global::System.Convert.ToString); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationInputPropertiesInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationInputPropertiesInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationInputProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Enable migration input properties. + [System.ComponentModel.TypeConverter(typeof(EnableMigrationInputPropertiesTypeConverter))] + public partial interface IEnableMigrationInputProperties + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EnableMigrationInputProperties.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EnableMigrationInputProperties.TypeConverter.cs new file mode 100644 index 000000000000..599a26502351 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EnableMigrationInputProperties.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class EnableMigrationInputPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationInputProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationInputProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return EnableMigrationInputProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return EnableMigrationInputProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return EnableMigrationInputProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EnableMigrationInputProperties.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EnableMigrationInputProperties.cs new file mode 100644 index 000000000000..21caceb42344 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EnableMigrationInputProperties.cs @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Enable migration input properties. + public partial class EnableMigrationInputProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationInputProperties, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationInputPropertiesInternal + { + + /// Internal Acessors for ProviderSpecificDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationProviderSpecificInput Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationInputPropertiesInternal.ProviderSpecificDetail { get => (this._providerSpecificDetail = this._providerSpecificDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EnableMigrationProviderSpecificInput()); set { {_providerSpecificDetail = value;} } } + + /// Backing field for property. + private string _policyId; + + /// The policy Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string PolicyId { get => this._policyId; set => this._policyId = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationProviderSpecificInput _providerSpecificDetail; + + /// The provider specific details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationProviderSpecificInput ProviderSpecificDetail { get => (this._providerSpecificDetail = this._providerSpecificDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EnableMigrationProviderSpecificInput()); set => this._providerSpecificDetail = value; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ProviderSpecificDetailInstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationProviderSpecificInputInternal)ProviderSpecificDetail).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationProviderSpecificInputInternal)ProviderSpecificDetail).InstanceType = value ; } + + /// Creates an new instance. + public EnableMigrationInputProperties() + { + + } + } + /// Enable migration input properties. + public partial interface IEnableMigrationInputProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The policy Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The policy Id.", + SerializedName = @"policyId", + PossibleTypes = new [] { typeof(string) })] + string PolicyId { get; set; } + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string ProviderSpecificDetailInstanceType { get; set; } + + } + /// Enable migration input properties. + internal partial interface IEnableMigrationInputPropertiesInternal + + { + /// The policy Id. + string PolicyId { get; set; } + /// The provider specific details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationProviderSpecificInput ProviderSpecificDetail { get; set; } + /// The class type. + string ProviderSpecificDetailInstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EnableMigrationInputProperties.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EnableMigrationInputProperties.json.cs new file mode 100644 index 000000000000..eb7edea41985 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EnableMigrationInputProperties.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Enable migration input properties. + public partial class EnableMigrationInputProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal EnableMigrationInputProperties(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_providerSpecificDetail = If( json?.PropertyT("providerSpecificDetails"), out var __jsonProviderSpecificDetails) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EnableMigrationProviderSpecificInput.FromJson(__jsonProviderSpecificDetails) : ProviderSpecificDetail;} + {_policyId = If( json?.PropertyT("policyId"), out var __jsonPolicyId) ? (string)__jsonPolicyId : (string)PolicyId;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationInputProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationInputProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationInputProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new EnableMigrationInputProperties(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._providerSpecificDetail ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._providerSpecificDetail.ToJson(null,serializationMode) : null, "providerSpecificDetails" ,container.Add ); + AddIf( null != (((object)this._policyId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._policyId.ToString()) : null, "policyId" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EnableMigrationProviderSpecificInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EnableMigrationProviderSpecificInput.PowerShell.cs new file mode 100644 index 000000000000..4c081f9d5031 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EnableMigrationProviderSpecificInput.PowerShell.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Enable migration provider specific input. + [System.ComponentModel.TypeConverter(typeof(EnableMigrationProviderSpecificInputTypeConverter))] + public partial class EnableMigrationProviderSpecificInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationProviderSpecificInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new EnableMigrationProviderSpecificInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationProviderSpecificInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new EnableMigrationProviderSpecificInput(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal EnableMigrationProviderSpecificInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal EnableMigrationProviderSpecificInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationProviderSpecificInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Enable migration provider specific input. + [System.ComponentModel.TypeConverter(typeof(EnableMigrationProviderSpecificInputTypeConverter))] + public partial interface IEnableMigrationProviderSpecificInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EnableMigrationProviderSpecificInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EnableMigrationProviderSpecificInput.TypeConverter.cs new file mode 100644 index 000000000000..595782f68e60 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EnableMigrationProviderSpecificInput.TypeConverter.cs @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class EnableMigrationProviderSpecificInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationProviderSpecificInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationProviderSpecificInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return EnableMigrationProviderSpecificInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return EnableMigrationProviderSpecificInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return EnableMigrationProviderSpecificInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EnableMigrationProviderSpecificInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EnableMigrationProviderSpecificInput.cs new file mode 100644 index 000000000000..b99409b78da3 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EnableMigrationProviderSpecificInput.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Enable migration provider specific input. + public partial class EnableMigrationProviderSpecificInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationProviderSpecificInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationProviderSpecificInputInternal + { + + /// Backing field for property. + private string _instanceType; + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string InstanceType { get => this._instanceType; set => this._instanceType = value; } + + /// Creates an new instance. + public EnableMigrationProviderSpecificInput() + { + + } + } + /// Enable migration provider specific input. + public partial interface IEnableMigrationProviderSpecificInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string InstanceType { get; set; } + + } + /// Enable migration provider specific input. + internal partial interface IEnableMigrationProviderSpecificInputInternal + + { + /// The class type. + string InstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EnableMigrationProviderSpecificInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EnableMigrationProviderSpecificInput.json.cs new file mode 100644 index 000000000000..a07de73d07c9 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EnableMigrationProviderSpecificInput.json.cs @@ -0,0 +1,124 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Enable migration provider specific input. + public partial class EnableMigrationProviderSpecificInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal EnableMigrationProviderSpecificInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_instanceType = If( json?.PropertyT("instanceType"), out var __jsonInstanceType) ? (string)__jsonInstanceType : (string)InstanceType;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationProviderSpecificInput. + /// Note: the Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationProviderSpecificInput interface + /// is polymorphic, and the precise model class that will get deserialized is determined at runtime based on the payload. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationProviderSpecificInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationProviderSpecificInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + if (!(node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json)) + { + return null; + } + // Polymorphic type -- select the appropriate constructor using the discriminator + + switch ( json.StringProperty("instanceType") ) + { + case "VMwareCbt": + { + return new VMwareCbtEnableMigrationInput(json); + } + } + return new EnableMigrationProviderSpecificInput(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._instanceType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._instanceType.ToString()) : null, "instanceType" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EnableProtectionInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EnableProtectionInput.PowerShell.cs new file mode 100644 index 000000000000..a6eb0948f992 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EnableProtectionInput.PowerShell.cs @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Enable protection input. + [System.ComponentModel.TypeConverter(typeof(EnableProtectionInputTypeConverter))] + public partial class EnableProtectionInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new EnableProtectionInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new EnableProtectionInput(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal EnableProtectionInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionInputInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionInputProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionInputInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EnableProtectionInputPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionInputInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionProviderSpecificInput) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionInputInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EnableProtectionProviderSpecificInputTypeConverter.ConvertFrom); + } + if (content.Contains("PolicyId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionInputInternal)this).PolicyId = (string) content.GetValueForProperty("PolicyId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionInputInternal)this).PolicyId, global::System.Convert.ToString); + } + if (content.Contains("ProtectableItemId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionInputInternal)this).ProtectableItemId = (string) content.GetValueForProperty("ProtectableItemId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionInputInternal)this).ProtectableItemId, global::System.Convert.ToString); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionInputInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionInputInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal EnableProtectionInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionInputInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionInputProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionInputInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EnableProtectionInputPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionInputInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionProviderSpecificInput) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionInputInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EnableProtectionProviderSpecificInputTypeConverter.ConvertFrom); + } + if (content.Contains("PolicyId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionInputInternal)this).PolicyId = (string) content.GetValueForProperty("PolicyId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionInputInternal)this).PolicyId, global::System.Convert.ToString); + } + if (content.Contains("ProtectableItemId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionInputInternal)this).ProtectableItemId = (string) content.GetValueForProperty("ProtectableItemId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionInputInternal)this).ProtectableItemId, global::System.Convert.ToString); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionInputInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionInputInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Enable protection input. + [System.ComponentModel.TypeConverter(typeof(EnableProtectionInputTypeConverter))] + public partial interface IEnableProtectionInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EnableProtectionInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EnableProtectionInput.TypeConverter.cs new file mode 100644 index 000000000000..330c00ef3f5c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EnableProtectionInput.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class EnableProtectionInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return EnableProtectionInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return EnableProtectionInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return EnableProtectionInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EnableProtectionInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EnableProtectionInput.cs new file mode 100644 index 000000000000..62d2b2c27bc0 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EnableProtectionInput.cs @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Enable protection input. + public partial class EnableProtectionInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionInputInternal + { + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionInputProperties Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionInputInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EnableProtectionInputProperties()); set { {_property = value;} } } + + /// Internal Acessors for ProviderSpecificDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionProviderSpecificInput Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionInputInternal.ProviderSpecificDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionInputPropertiesInternal)Property).ProviderSpecificDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionInputPropertiesInternal)Property).ProviderSpecificDetail = value; } + + /// The Policy Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string PolicyId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionInputPropertiesInternal)Property).PolicyId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionInputPropertiesInternal)Property).PolicyId = value ?? null; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionInputProperties _property; + + /// Enable protection input properties. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionInputProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EnableProtectionInputProperties()); set => this._property = value; } + + /// The protectable item Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ProtectableItemId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionInputPropertiesInternal)Property).ProtectableItemId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionInputPropertiesInternal)Property).ProtectableItemId = value ?? null; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ProviderSpecificDetailInstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionInputPropertiesInternal)Property).ProviderSpecificDetailInstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionInputPropertiesInternal)Property).ProviderSpecificDetailInstanceType = value ?? null; } + + /// Creates an new instance. + public EnableProtectionInput() + { + + } + } + /// Enable protection input. + public partial interface IEnableProtectionInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The Policy Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Policy Id.", + SerializedName = @"policyId", + PossibleTypes = new [] { typeof(string) })] + string PolicyId { get; set; } + /// The protectable item Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The protectable item Id.", + SerializedName = @"protectableItemId", + PossibleTypes = new [] { typeof(string) })] + string ProtectableItemId { get; set; } + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string ProviderSpecificDetailInstanceType { get; set; } + + } + /// Enable protection input. + internal partial interface IEnableProtectionInputInternal + + { + /// The Policy Id. + string PolicyId { get; set; } + /// Enable protection input properties. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionInputProperties Property { get; set; } + /// The protectable item Id. + string ProtectableItemId { get; set; } + /// + /// 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. + /// + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionProviderSpecificInput ProviderSpecificDetail { get; set; } + /// The class type. + string ProviderSpecificDetailInstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EnableProtectionInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EnableProtectionInput.json.cs new file mode 100644 index 000000000000..cedab8a833ef --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EnableProtectionInput.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Enable protection input. + public partial class EnableProtectionInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal EnableProtectionInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EnableProtectionInputProperties.FromJson(__jsonProperties) : Property;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new EnableProtectionInput(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EnableProtectionInputProperties.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EnableProtectionInputProperties.PowerShell.cs new file mode 100644 index 000000000000..52435de49d2b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EnableProtectionInputProperties.PowerShell.cs @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Enable protection input properties. + [System.ComponentModel.TypeConverter(typeof(EnableProtectionInputPropertiesTypeConverter))] + public partial class EnableProtectionInputProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionInputProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new EnableProtectionInputProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionInputProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new EnableProtectionInputProperties(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal EnableProtectionInputProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionInputPropertiesInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionProviderSpecificInput) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionInputPropertiesInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EnableProtectionProviderSpecificInputTypeConverter.ConvertFrom); + } + if (content.Contains("PolicyId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionInputPropertiesInternal)this).PolicyId = (string) content.GetValueForProperty("PolicyId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionInputPropertiesInternal)this).PolicyId, global::System.Convert.ToString); + } + if (content.Contains("ProtectableItemId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionInputPropertiesInternal)this).ProtectableItemId = (string) content.GetValueForProperty("ProtectableItemId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionInputPropertiesInternal)this).ProtectableItemId, global::System.Convert.ToString); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionInputPropertiesInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionInputPropertiesInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal EnableProtectionInputProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionInputPropertiesInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionProviderSpecificInput) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionInputPropertiesInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EnableProtectionProviderSpecificInputTypeConverter.ConvertFrom); + } + if (content.Contains("PolicyId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionInputPropertiesInternal)this).PolicyId = (string) content.GetValueForProperty("PolicyId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionInputPropertiesInternal)this).PolicyId, global::System.Convert.ToString); + } + if (content.Contains("ProtectableItemId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionInputPropertiesInternal)this).ProtectableItemId = (string) content.GetValueForProperty("ProtectableItemId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionInputPropertiesInternal)this).ProtectableItemId, global::System.Convert.ToString); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionInputPropertiesInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionInputPropertiesInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionInputProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Enable protection input properties. + [System.ComponentModel.TypeConverter(typeof(EnableProtectionInputPropertiesTypeConverter))] + public partial interface IEnableProtectionInputProperties + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EnableProtectionInputProperties.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EnableProtectionInputProperties.TypeConverter.cs new file mode 100644 index 000000000000..30090a47bfbc --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EnableProtectionInputProperties.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class EnableProtectionInputPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionInputProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionInputProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return EnableProtectionInputProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return EnableProtectionInputProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return EnableProtectionInputProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EnableProtectionInputProperties.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EnableProtectionInputProperties.cs new file mode 100644 index 000000000000..c8b7225229b5 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EnableProtectionInputProperties.cs @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Enable protection input properties. + public partial class EnableProtectionInputProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionInputProperties, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionInputPropertiesInternal + { + + /// Internal Acessors for ProviderSpecificDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionProviderSpecificInput Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionInputPropertiesInternal.ProviderSpecificDetail { get => (this._providerSpecificDetail = this._providerSpecificDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EnableProtectionProviderSpecificInput()); set { {_providerSpecificDetail = value;} } } + + /// Backing field for property. + private string _policyId; + + /// The Policy Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string PolicyId { get => this._policyId; set => this._policyId = value; } + + /// Backing field for property. + private string _protectableItemId; + + /// The protectable item Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ProtectableItemId { get => this._protectableItemId; set => this._protectableItemId = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionProviderSpecificInput _providerSpecificDetail; + + /// + /// 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. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionProviderSpecificInput ProviderSpecificDetail { get => (this._providerSpecificDetail = this._providerSpecificDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EnableProtectionProviderSpecificInput()); set => this._providerSpecificDetail = value; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ProviderSpecificDetailInstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionProviderSpecificInputInternal)ProviderSpecificDetail).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionProviderSpecificInputInternal)ProviderSpecificDetail).InstanceType = value ?? null; } + + /// Creates an new instance. + public EnableProtectionInputProperties() + { + + } + } + /// Enable protection input properties. + public partial interface IEnableProtectionInputProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The Policy Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Policy Id.", + SerializedName = @"policyId", + PossibleTypes = new [] { typeof(string) })] + string PolicyId { get; set; } + /// The protectable item Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The protectable item Id.", + SerializedName = @"protectableItemId", + PossibleTypes = new [] { typeof(string) })] + string ProtectableItemId { get; set; } + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string ProviderSpecificDetailInstanceType { get; set; } + + } + /// Enable protection input properties. + internal partial interface IEnableProtectionInputPropertiesInternal + + { + /// The Policy Id. + string PolicyId { get; set; } + /// The protectable item Id. + string ProtectableItemId { get; set; } + /// + /// 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. + /// + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionProviderSpecificInput ProviderSpecificDetail { get; set; } + /// The class type. + string ProviderSpecificDetailInstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EnableProtectionInputProperties.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EnableProtectionInputProperties.json.cs new file mode 100644 index 000000000000..250936899531 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EnableProtectionInputProperties.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Enable protection input properties. + public partial class EnableProtectionInputProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal EnableProtectionInputProperties(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_providerSpecificDetail = If( json?.PropertyT("providerSpecificDetails"), out var __jsonProviderSpecificDetails) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EnableProtectionProviderSpecificInput.FromJson(__jsonProviderSpecificDetails) : ProviderSpecificDetail;} + {_policyId = If( json?.PropertyT("policyId"), out var __jsonPolicyId) ? (string)__jsonPolicyId : (string)PolicyId;} + {_protectableItemId = If( json?.PropertyT("protectableItemId"), out var __jsonProtectableItemId) ? (string)__jsonProtectableItemId : (string)ProtectableItemId;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionInputProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionInputProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionInputProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new EnableProtectionInputProperties(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._providerSpecificDetail ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._providerSpecificDetail.ToJson(null,serializationMode) : null, "providerSpecificDetails" ,container.Add ); + AddIf( null != (((object)this._policyId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._policyId.ToString()) : null, "policyId" ,container.Add ); + AddIf( null != (((object)this._protectableItemId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._protectableItemId.ToString()) : null, "protectableItemId" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EnableProtectionProviderSpecificInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EnableProtectionProviderSpecificInput.PowerShell.cs new file mode 100644 index 000000000000..007711b47181 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EnableProtectionProviderSpecificInput.PowerShell.cs @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Enable protection provider specific input. + [System.ComponentModel.TypeConverter(typeof(EnableProtectionProviderSpecificInputTypeConverter))] + public partial class EnableProtectionProviderSpecificInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionProviderSpecificInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new EnableProtectionProviderSpecificInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionProviderSpecificInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new EnableProtectionProviderSpecificInput(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal EnableProtectionProviderSpecificInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal EnableProtectionProviderSpecificInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json + /// string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionProviderSpecificInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Enable protection provider specific input. + [System.ComponentModel.TypeConverter(typeof(EnableProtectionProviderSpecificInputTypeConverter))] + public partial interface IEnableProtectionProviderSpecificInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EnableProtectionProviderSpecificInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EnableProtectionProviderSpecificInput.TypeConverter.cs new file mode 100644 index 000000000000..6dc50bf5e93f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EnableProtectionProviderSpecificInput.TypeConverter.cs @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class EnableProtectionProviderSpecificInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionProviderSpecificInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionProviderSpecificInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return EnableProtectionProviderSpecificInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return EnableProtectionProviderSpecificInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return EnableProtectionProviderSpecificInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EnableProtectionProviderSpecificInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EnableProtectionProviderSpecificInput.cs new file mode 100644 index 000000000000..7c1ffce3f735 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EnableProtectionProviderSpecificInput.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Enable protection provider specific input. + public partial class EnableProtectionProviderSpecificInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionProviderSpecificInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionProviderSpecificInputInternal + { + + /// Backing field for property. + private string _instanceType; + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string InstanceType { get => this._instanceType; set => this._instanceType = value; } + + /// Creates an new instance. + public EnableProtectionProviderSpecificInput() + { + + } + } + /// Enable protection provider specific input. + public partial interface IEnableProtectionProviderSpecificInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string InstanceType { get; set; } + + } + /// Enable protection provider specific input. + internal partial interface IEnableProtectionProviderSpecificInputInternal + + { + /// The class type. + string InstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EnableProtectionProviderSpecificInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EnableProtectionProviderSpecificInput.json.cs new file mode 100644 index 000000000000..43e2db4a6a40 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EnableProtectionProviderSpecificInput.json.cs @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Enable protection provider specific input. + public partial class EnableProtectionProviderSpecificInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal EnableProtectionProviderSpecificInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_instanceType = If( json?.PropertyT("instanceType"), out var __jsonInstanceType) ? (string)__jsonInstanceType : (string)InstanceType;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionProviderSpecificInput. + /// Note: the Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionProviderSpecificInput interface + /// is polymorphic, and the precise model class that will get deserialized is determined at runtime based on the payload. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionProviderSpecificInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionProviderSpecificInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + if (!(node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json)) + { + return null; + } + // Polymorphic type -- select the appropriate constructor using the discriminator + + switch ( json.StringProperty("instanceType") ) + { + case "A2ACrossClusterMigration": + { + return new A2ACrossClusterMigrationEnableProtectionInput(json); + } + case "A2A": + { + return new A2AEnableProtectionInput(json); + } + case "HyperVReplicaAzure": + { + return new HyperVReplicaAzureEnableProtectionInput(json); + } + case "InMageAzureV2": + { + return new InMageAzureV2EnableProtectionInput(json); + } + case "InMage": + { + return new InMageEnableProtectionInput(json); + } + case "InMageRcm": + { + return new InMageRcmEnableProtectionInput(json); + } + } + return new EnableProtectionProviderSpecificInput(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._instanceType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._instanceType.ToString()) : null, "instanceType" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EncryptionDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EncryptionDetails.PowerShell.cs new file mode 100644 index 000000000000..09366994f91b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EncryptionDetails.PowerShell.cs @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Encryption details for the fabric. + [System.ComponentModel.TypeConverter(typeof(EncryptionDetailsTypeConverter))] + public partial class EncryptionDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEncryptionDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new EncryptionDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEncryptionDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new EncryptionDetails(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal EncryptionDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("KekState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEncryptionDetailsInternal)this).KekState = (string) content.GetValueForProperty("KekState",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEncryptionDetailsInternal)this).KekState, global::System.Convert.ToString); + } + if (content.Contains("KekCertThumbprint")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEncryptionDetailsInternal)this).KekCertThumbprint = (string) content.GetValueForProperty("KekCertThumbprint",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEncryptionDetailsInternal)this).KekCertThumbprint, global::System.Convert.ToString); + } + if (content.Contains("KekCertExpiryDate")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEncryptionDetailsInternal)this).KekCertExpiryDate = (global::System.DateTime?) content.GetValueForProperty("KekCertExpiryDate",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEncryptionDetailsInternal)this).KekCertExpiryDate, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal EncryptionDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("KekState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEncryptionDetailsInternal)this).KekState = (string) content.GetValueForProperty("KekState",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEncryptionDetailsInternal)this).KekState, global::System.Convert.ToString); + } + if (content.Contains("KekCertThumbprint")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEncryptionDetailsInternal)this).KekCertThumbprint = (string) content.GetValueForProperty("KekCertThumbprint",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEncryptionDetailsInternal)this).KekCertThumbprint, global::System.Convert.ToString); + } + if (content.Contains("KekCertExpiryDate")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEncryptionDetailsInternal)this).KekCertExpiryDate = (global::System.DateTime?) content.GetValueForProperty("KekCertExpiryDate",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEncryptionDetailsInternal)this).KekCertExpiryDate, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + AfterDeserializePSObject(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEncryptionDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Encryption details for the fabric. + [System.ComponentModel.TypeConverter(typeof(EncryptionDetailsTypeConverter))] + public partial interface IEncryptionDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EncryptionDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EncryptionDetails.TypeConverter.cs new file mode 100644 index 000000000000..3d5d37d03bba --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EncryptionDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class EncryptionDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEncryptionDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEncryptionDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return EncryptionDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return EncryptionDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return EncryptionDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EncryptionDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EncryptionDetails.cs new file mode 100644 index 000000000000..15c15ce794f2 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EncryptionDetails.cs @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Encryption details for the fabric. + public partial class EncryptionDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEncryptionDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEncryptionDetailsInternal + { + + /// Backing field for property. + private global::System.DateTime? _kekCertExpiryDate; + + /// The key encryption key certificate expiry date. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public global::System.DateTime? KekCertExpiryDate { get => this._kekCertExpiryDate; set => this._kekCertExpiryDate = value; } + + /// Backing field for property. + private string _kekCertThumbprint; + + /// The key encryption key certificate thumbprint. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string KekCertThumbprint { get => this._kekCertThumbprint; set => this._kekCertThumbprint = value; } + + /// Backing field for property. + private string _kekState; + + /// The key encryption key state for the Vmm. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string KekState { get => this._kekState; set => this._kekState = value; } + + /// Creates an new instance. + public EncryptionDetails() + { + + } + } + /// Encryption details for the fabric. + public partial interface IEncryptionDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The key encryption key certificate expiry date. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The key encryption key certificate expiry date.", + SerializedName = @"kekCertExpiryDate", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? KekCertExpiryDate { get; set; } + /// The key encryption key certificate thumbprint. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The key encryption key certificate thumbprint.", + SerializedName = @"kekCertThumbprint", + PossibleTypes = new [] { typeof(string) })] + string KekCertThumbprint { get; set; } + /// The key encryption key state for the Vmm. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The key encryption key state for the Vmm.", + SerializedName = @"kekState", + PossibleTypes = new [] { typeof(string) })] + string KekState { get; set; } + + } + /// Encryption details for the fabric. + internal partial interface IEncryptionDetailsInternal + + { + /// The key encryption key certificate expiry date. + global::System.DateTime? KekCertExpiryDate { get; set; } + /// The key encryption key certificate thumbprint. + string KekCertThumbprint { get; set; } + /// The key encryption key state for the Vmm. + string KekState { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EncryptionDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EncryptionDetails.json.cs new file mode 100644 index 000000000000..f72f4a981b07 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EncryptionDetails.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Encryption details for the fabric. + public partial class EncryptionDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal EncryptionDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_kekState = If( json?.PropertyT("kekState"), out var __jsonKekState) ? (string)__jsonKekState : (string)KekState;} + {_kekCertThumbprint = If( json?.PropertyT("kekCertThumbprint"), out var __jsonKekCertThumbprint) ? (string)__jsonKekCertThumbprint : (string)KekCertThumbprint;} + {_kekCertExpiryDate = If( json?.PropertyT("kekCertExpiryDate"), out var __jsonKekCertExpiryDate) ? global::System.DateTime.TryParse((string)__jsonKekCertExpiryDate, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonKekCertExpiryDateValue) ? __jsonKekCertExpiryDateValue : KekCertExpiryDate : KekCertExpiryDate;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEncryptionDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEncryptionDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEncryptionDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new EncryptionDetails(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._kekState)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._kekState.ToString()) : null, "kekState" ,container.Add ); + AddIf( null != (((object)this._kekCertThumbprint)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._kekCertThumbprint.ToString()) : null, "kekCertThumbprint" ,container.Add ); + AddIf( null != this._kekCertExpiryDate ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._kekCertExpiryDate?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "kekCertExpiryDate" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Event.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Event.PowerShell.cs new file mode 100644 index 000000000000..8c374b2b9ebd --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Event.PowerShell.cs @@ -0,0 +1,280 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Implements the Event class. + [System.ComponentModel.TypeConverter(typeof(EventTypeConverter))] + public partial class Event + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEvent DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new Event(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEvent DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new Event(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal Event(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EventPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetails) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EventProviderSpecificDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("SpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventInternal)this).SpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventSpecificDetails) content.GetValueForProperty("SpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventInternal)this).SpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EventSpecificDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("Code")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventInternal)this).Code, global::System.Convert.ToString); + } + if (content.Contains("Description")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventInternal)this).Description, global::System.Convert.ToString); + } + if (content.Contains("EventType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventInternal)this).EventType = (string) content.GetValueForProperty("EventType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventInternal)this).EventType, global::System.Convert.ToString); + } + if (content.Contains("AffectedObjectFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventInternal)this).AffectedObjectFriendlyName = (string) content.GetValueForProperty("AffectedObjectFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventInternal)this).AffectedObjectFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("AffectedObjectCorrelationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventInternal)this).AffectedObjectCorrelationId = (string) content.GetValueForProperty("AffectedObjectCorrelationId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventInternal)this).AffectedObjectCorrelationId, global::System.Convert.ToString); + } + if (content.Contains("Severity")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventInternal)this).Severity = (string) content.GetValueForProperty("Severity",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventInternal)this).Severity, global::System.Convert.ToString); + } + if (content.Contains("TimeOfOccurrence")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventInternal)this).TimeOfOccurrence = (global::System.DateTime?) content.GetValueForProperty("TimeOfOccurrence",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventInternal)this).TimeOfOccurrence, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("FabricId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventInternal)this).FabricId = (string) content.GetValueForProperty("FabricId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventInternal)this).FabricId, global::System.Convert.ToString); + } + if (content.Contains("HealthError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventInternal)this).HealthError = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[]) content.GetValueForProperty("HealthError",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventInternal)this).HealthError, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("SpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventInternal)this).SpecificDetailInstanceType = (string) content.GetValueForProperty("SpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventInternal)this).SpecificDetailInstanceType, global::System.Convert.ToString); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal Event(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EventPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetails) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EventProviderSpecificDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("SpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventInternal)this).SpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventSpecificDetails) content.GetValueForProperty("SpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventInternal)this).SpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EventSpecificDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("Code")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventInternal)this).Code, global::System.Convert.ToString); + } + if (content.Contains("Description")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventInternal)this).Description, global::System.Convert.ToString); + } + if (content.Contains("EventType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventInternal)this).EventType = (string) content.GetValueForProperty("EventType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventInternal)this).EventType, global::System.Convert.ToString); + } + if (content.Contains("AffectedObjectFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventInternal)this).AffectedObjectFriendlyName = (string) content.GetValueForProperty("AffectedObjectFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventInternal)this).AffectedObjectFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("AffectedObjectCorrelationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventInternal)this).AffectedObjectCorrelationId = (string) content.GetValueForProperty("AffectedObjectCorrelationId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventInternal)this).AffectedObjectCorrelationId, global::System.Convert.ToString); + } + if (content.Contains("Severity")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventInternal)this).Severity = (string) content.GetValueForProperty("Severity",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventInternal)this).Severity, global::System.Convert.ToString); + } + if (content.Contains("TimeOfOccurrence")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventInternal)this).TimeOfOccurrence = (global::System.DateTime?) content.GetValueForProperty("TimeOfOccurrence",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventInternal)this).TimeOfOccurrence, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("FabricId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventInternal)this).FabricId = (string) content.GetValueForProperty("FabricId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventInternal)this).FabricId, global::System.Convert.ToString); + } + if (content.Contains("HealthError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventInternal)this).HealthError = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[]) content.GetValueForProperty("HealthError",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventInternal)this).HealthError, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("SpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventInternal)this).SpecificDetailInstanceType = (string) content.GetValueForProperty("SpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventInternal)this).SpecificDetailInstanceType, global::System.Convert.ToString); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEvent FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Implements the Event class. + [System.ComponentModel.TypeConverter(typeof(EventTypeConverter))] + public partial interface IEvent + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Event.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Event.TypeConverter.cs new file mode 100644 index 000000000000..7fcb368f272c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Event.TypeConverter.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class EventTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEvent ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEvent).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return Event.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return Event.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return Event.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Event.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Event.cs new file mode 100644 index 000000000000..af83fe90ffcc --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Event.cs @@ -0,0 +1,260 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Implements the Event class. + public partial class Event : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEvent, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResource __resource = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.Resource(); + + /// The affected object correlationId for the event. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string AffectedObjectCorrelationId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventPropertiesInternal)Property).AffectedObjectCorrelationId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventPropertiesInternal)Property).AffectedObjectCorrelationId = value ?? null; } + + /// + /// The friendly name of the source of the event on which it is raised (for example, VM, VMM etc). + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string AffectedObjectFriendlyName { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventPropertiesInternal)Property).AffectedObjectFriendlyName; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventPropertiesInternal)Property).AffectedObjectFriendlyName = value ?? null; } + + /// The Id of the monitoring event. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string Code { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventPropertiesInternal)Property).EventCode; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventPropertiesInternal)Property).EventCode = value ?? null; } + + /// The event name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string Description { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventPropertiesInternal)Property).Description; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventPropertiesInternal)Property).Description = value ?? null; } + + /// The type of the event. for example: VM Health, Server Health, Job Failure etc. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string EventType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventPropertiesInternal)Property).EventType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventPropertiesInternal)Property).EventType = value ?? null; } + + /// The ARM ID of the fabric. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string FabricId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventPropertiesInternal)Property).FabricId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventPropertiesInternal)Property).FabricId = value ?? null; } + + /// The list of errors / warnings capturing details associated with the issue(s). + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] HealthError { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventPropertiesInternal)Property).HealthError; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventPropertiesInternal)Property).HealthError = value ?? null /* arrayOf */; } + + /// Resource Id + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Id; } + + /// Resource Location + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string Location { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Location; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Location = value ?? null; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProperties Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EventProperties()); set { {_property = value;} } } + + /// Internal Acessors for ProviderSpecificDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetails Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventInternal.ProviderSpecificDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventPropertiesInternal)Property).ProviderSpecificDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventPropertiesInternal)Property).ProviderSpecificDetail = value; } + + /// Internal Acessors for SpecificDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventSpecificDetails Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventInternal.SpecificDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventPropertiesInternal)Property).EventSpecificDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventPropertiesInternal)Property).EventSpecificDetail = value; } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Id = value; } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Name = value; } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Type = value; } + + /// Resource Name + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Name; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProperties _property; + + /// Event related data. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EventProperties()); set => this._property = value; } + + /// Gets the class type. Overridden in derived classes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ProviderSpecificDetailInstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventPropertiesInternal)Property).ProviderSpecificDetailInstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventPropertiesInternal)Property).ProviderSpecificDetailInstanceType = value ?? null; } + + /// The severity of the event. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string Severity { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventPropertiesInternal)Property).Severity; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventPropertiesInternal)Property).Severity = value ?? null; } + + /// Gets the class type. Overridden in derived classes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string SpecificDetailInstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventPropertiesInternal)Property).EventSpecificDetailInstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventPropertiesInternal)Property).EventSpecificDetailInstanceType = value ?? null; } + + /// The time of occurrence of the event. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public global::System.DateTime? TimeOfOccurrence { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventPropertiesInternal)Property).TimeOfOccurrence; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventPropertiesInternal)Property).TimeOfOccurrence = value ?? default(global::System.DateTime); } + + /// Resource Type + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Type; } + + /// Creates an new instance. + public Event() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__resource), __resource); + await eventListener.AssertObjectIsValid(nameof(__resource), __resource); + } + } + /// Implements the Event class. + public partial interface IEvent : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResource + { + /// The affected object correlationId for the event. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The affected object correlationId for the event.", + SerializedName = @"affectedObjectCorrelationId", + PossibleTypes = new [] { typeof(string) })] + string AffectedObjectCorrelationId { get; set; } + /// + /// The friendly name of the source of the event on which it is raised (for example, VM, VMM etc). + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The friendly name of the source of the event on which it is raised (for example, VM, VMM etc).", + SerializedName = @"affectedObjectFriendlyName", + PossibleTypes = new [] { typeof(string) })] + string AffectedObjectFriendlyName { get; set; } + /// The Id of the monitoring event. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Id of the monitoring event.", + SerializedName = @"eventCode", + PossibleTypes = new [] { typeof(string) })] + string Code { get; set; } + /// The event name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The event name.", + SerializedName = @"description", + PossibleTypes = new [] { typeof(string) })] + string Description { get; set; } + /// The type of the event. for example: VM Health, Server Health, Job Failure etc. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The type of the event. for example: VM Health, Server Health, Job Failure etc.", + SerializedName = @"eventType", + PossibleTypes = new [] { typeof(string) })] + string EventType { get; set; } + /// The ARM ID of the fabric. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The ARM ID of the fabric.", + SerializedName = @"fabricId", + PossibleTypes = new [] { typeof(string) })] + string FabricId { get; set; } + /// The list of errors / warnings capturing details associated with the issue(s). + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of errors / warnings capturing details associated with the issue(s).", + SerializedName = @"healthErrors", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] HealthError { get; set; } + /// Gets the class type. Overridden in derived classes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets the class type. Overridden in derived classes.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string ProviderSpecificDetailInstanceType { get; set; } + /// The severity of the event. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The severity of the event.", + SerializedName = @"severity", + PossibleTypes = new [] { typeof(string) })] + string Severity { get; set; } + /// Gets the class type. Overridden in derived classes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets the class type. Overridden in derived classes.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string SpecificDetailInstanceType { get; set; } + /// The time of occurrence of the event. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The time of occurrence of the event.", + SerializedName = @"timeOfOccurrence", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? TimeOfOccurrence { get; set; } + + } + /// Implements the Event class. + internal partial interface IEventInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal + { + /// The affected object correlationId for the event. + string AffectedObjectCorrelationId { get; set; } + /// + /// The friendly name of the source of the event on which it is raised (for example, VM, VMM etc). + /// + string AffectedObjectFriendlyName { get; set; } + /// The Id of the monitoring event. + string Code { get; set; } + /// The event name. + string Description { get; set; } + /// The type of the event. for example: VM Health, Server Health, Job Failure etc. + string EventType { get; set; } + /// The ARM ID of the fabric. + string FabricId { get; set; } + /// The list of errors / warnings capturing details associated with the issue(s). + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] HealthError { get; set; } + /// Event related data. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProperties Property { get; set; } + /// The provider specific settings. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetails ProviderSpecificDetail { get; set; } + /// Gets the class type. Overridden in derived classes. + string ProviderSpecificDetailInstanceType { get; set; } + /// The severity of the event. + string Severity { get; set; } + /// The event specific settings. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventSpecificDetails SpecificDetail { get; set; } + /// Gets the class type. Overridden in derived classes. + string SpecificDetailInstanceType { get; set; } + /// The time of occurrence of the event. + global::System.DateTime? TimeOfOccurrence { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Event.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Event.json.cs new file mode 100644 index 000000000000..34de1091ce12 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Event.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Implements the Event class. + public partial class Event + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal Event(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __resource = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.Resource(json); + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EventProperties.FromJson(__jsonProperties) : Property;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEvent. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEvent. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEvent FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new Event(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __resource?.ToJson(container, serializationMode); + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EventCollection.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EventCollection.PowerShell.cs new file mode 100644 index 000000000000..5a706a00d126 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EventCollection.PowerShell.cs @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Collection of fabric details. + [System.ComponentModel.TypeConverter(typeof(EventCollectionTypeConverter))] + public partial class EventCollection + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventCollection DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new EventCollection(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventCollection DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new EventCollection(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal EventCollection(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEvent[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EventTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventCollectionInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventCollectionInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal EventCollection(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEvent[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EventTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventCollectionInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventCollectionInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventCollection FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Collection of fabric details. + [System.ComponentModel.TypeConverter(typeof(EventCollectionTypeConverter))] + public partial interface IEventCollection + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EventCollection.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EventCollection.TypeConverter.cs new file mode 100644 index 000000000000..26bbbfe0bdcc --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EventCollection.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class EventCollectionTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventCollection ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventCollection).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return EventCollection.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return EventCollection.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return EventCollection.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EventCollection.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EventCollection.cs new file mode 100644 index 000000000000..ade4e311bd5b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EventCollection.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Collection of fabric details. + public partial class EventCollection : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventCollection, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventCollectionInternal + { + + /// Backing field for property. + private string _nextLink; + + /// The value of next link. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string NextLink { get => this._nextLink; set => this._nextLink = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEvent[] _value; + + /// The list of events. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEvent[] Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public EventCollection() + { + + } + } + /// Collection of fabric details. + public partial interface IEventCollection : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The value of next link. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The value of next link.", + SerializedName = @"nextLink", + PossibleTypes = new [] { typeof(string) })] + string NextLink { get; set; } + /// The list of events. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of events.", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEvent) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEvent[] Value { get; set; } + + } + /// Collection of fabric details. + internal partial interface IEventCollectionInternal + + { + /// The value of next link. + string NextLink { get; set; } + /// The list of events. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEvent[] Value { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EventCollection.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EventCollection.json.cs new file mode 100644 index 000000000000..26a4daaa82dc --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EventCollection.json.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Collection of fabric details. + public partial class EventCollection + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal EventCollection(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEvent) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.Event.FromJson(__u) )) ))() : null : Value;} + {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)NextLink;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventCollection. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventCollection. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventCollection FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new EventCollection(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._value) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._value ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("value",__w); + } + AddIf( null != (((object)this._nextLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EventProperties.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EventProperties.PowerShell.cs new file mode 100644 index 000000000000..ed1e7fb9232b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EventProperties.PowerShell.cs @@ -0,0 +1,240 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// The properties of a monitoring event. + [System.ComponentModel.TypeConverter(typeof(EventPropertiesTypeConverter))] + public partial class EventProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new EventProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new EventProperties(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal EventProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventPropertiesInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetails) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventPropertiesInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EventProviderSpecificDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("EventSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventPropertiesInternal)this).EventSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventSpecificDetails) content.GetValueForProperty("EventSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventPropertiesInternal)this).EventSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EventSpecificDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("EventCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventPropertiesInternal)this).EventCode = (string) content.GetValueForProperty("EventCode",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventPropertiesInternal)this).EventCode, global::System.Convert.ToString); + } + if (content.Contains("Description")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventPropertiesInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventPropertiesInternal)this).Description, global::System.Convert.ToString); + } + if (content.Contains("EventType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventPropertiesInternal)this).EventType = (string) content.GetValueForProperty("EventType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventPropertiesInternal)this).EventType, global::System.Convert.ToString); + } + if (content.Contains("AffectedObjectFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventPropertiesInternal)this).AffectedObjectFriendlyName = (string) content.GetValueForProperty("AffectedObjectFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventPropertiesInternal)this).AffectedObjectFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("AffectedObjectCorrelationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventPropertiesInternal)this).AffectedObjectCorrelationId = (string) content.GetValueForProperty("AffectedObjectCorrelationId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventPropertiesInternal)this).AffectedObjectCorrelationId, global::System.Convert.ToString); + } + if (content.Contains("Severity")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventPropertiesInternal)this).Severity = (string) content.GetValueForProperty("Severity",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventPropertiesInternal)this).Severity, global::System.Convert.ToString); + } + if (content.Contains("TimeOfOccurrence")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventPropertiesInternal)this).TimeOfOccurrence = (global::System.DateTime?) content.GetValueForProperty("TimeOfOccurrence",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventPropertiesInternal)this).TimeOfOccurrence, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("FabricId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventPropertiesInternal)this).FabricId = (string) content.GetValueForProperty("FabricId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventPropertiesInternal)this).FabricId, global::System.Convert.ToString); + } + if (content.Contains("HealthError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventPropertiesInternal)this).HealthError = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[]) content.GetValueForProperty("HealthError",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventPropertiesInternal)this).HealthError, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("EventSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventPropertiesInternal)this).EventSpecificDetailInstanceType = (string) content.GetValueForProperty("EventSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventPropertiesInternal)this).EventSpecificDetailInstanceType, global::System.Convert.ToString); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventPropertiesInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventPropertiesInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal EventProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventPropertiesInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetails) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventPropertiesInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EventProviderSpecificDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("EventSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventPropertiesInternal)this).EventSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventSpecificDetails) content.GetValueForProperty("EventSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventPropertiesInternal)this).EventSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EventSpecificDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("EventCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventPropertiesInternal)this).EventCode = (string) content.GetValueForProperty("EventCode",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventPropertiesInternal)this).EventCode, global::System.Convert.ToString); + } + if (content.Contains("Description")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventPropertiesInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventPropertiesInternal)this).Description, global::System.Convert.ToString); + } + if (content.Contains("EventType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventPropertiesInternal)this).EventType = (string) content.GetValueForProperty("EventType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventPropertiesInternal)this).EventType, global::System.Convert.ToString); + } + if (content.Contains("AffectedObjectFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventPropertiesInternal)this).AffectedObjectFriendlyName = (string) content.GetValueForProperty("AffectedObjectFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventPropertiesInternal)this).AffectedObjectFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("AffectedObjectCorrelationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventPropertiesInternal)this).AffectedObjectCorrelationId = (string) content.GetValueForProperty("AffectedObjectCorrelationId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventPropertiesInternal)this).AffectedObjectCorrelationId, global::System.Convert.ToString); + } + if (content.Contains("Severity")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventPropertiesInternal)this).Severity = (string) content.GetValueForProperty("Severity",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventPropertiesInternal)this).Severity, global::System.Convert.ToString); + } + if (content.Contains("TimeOfOccurrence")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventPropertiesInternal)this).TimeOfOccurrence = (global::System.DateTime?) content.GetValueForProperty("TimeOfOccurrence",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventPropertiesInternal)this).TimeOfOccurrence, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("FabricId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventPropertiesInternal)this).FabricId = (string) content.GetValueForProperty("FabricId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventPropertiesInternal)this).FabricId, global::System.Convert.ToString); + } + if (content.Contains("HealthError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventPropertiesInternal)this).HealthError = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[]) content.GetValueForProperty("HealthError",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventPropertiesInternal)this).HealthError, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("EventSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventPropertiesInternal)this).EventSpecificDetailInstanceType = (string) content.GetValueForProperty("EventSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventPropertiesInternal)this).EventSpecificDetailInstanceType, global::System.Convert.ToString); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventPropertiesInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventPropertiesInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// The properties of a monitoring event. + [System.ComponentModel.TypeConverter(typeof(EventPropertiesTypeConverter))] + public partial interface IEventProperties + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EventProperties.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EventProperties.TypeConverter.cs new file mode 100644 index 000000000000..bf8ff85f5455 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EventProperties.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class EventPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return EventProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return EventProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return EventProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EventProperties.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EventProperties.cs new file mode 100644 index 000000000000..f38b3bcdee3c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EventProperties.cs @@ -0,0 +1,245 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The properties of a monitoring event. + public partial class EventProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProperties, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventPropertiesInternal + { + + /// Backing field for property. + private string _affectedObjectCorrelationId; + + /// The affected object correlationId for the event. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string AffectedObjectCorrelationId { get => this._affectedObjectCorrelationId; set => this._affectedObjectCorrelationId = value; } + + /// Backing field for property. + private string _affectedObjectFriendlyName; + + /// + /// The friendly name of the source of the event on which it is raised (for example, VM, VMM etc). + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string AffectedObjectFriendlyName { get => this._affectedObjectFriendlyName; set => this._affectedObjectFriendlyName = value; } + + /// Backing field for property. + private string _description; + + /// The event name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Description { get => this._description; set => this._description = value; } + + /// Backing field for property. + private string _eventCode; + + /// The Id of the monitoring event. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string EventCode { get => this._eventCode; set => this._eventCode = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventSpecificDetails _eventSpecificDetail; + + /// The event specific settings. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventSpecificDetails EventSpecificDetail { get => (this._eventSpecificDetail = this._eventSpecificDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EventSpecificDetails()); set => this._eventSpecificDetail = value; } + + /// Gets the class type. Overridden in derived classes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string EventSpecificDetailInstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventSpecificDetailsInternal)EventSpecificDetail).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventSpecificDetailsInternal)EventSpecificDetail).InstanceType = value ?? null; } + + /// Backing field for property. + private string _eventType; + + /// The type of the event. for example: VM Health, Server Health, Job Failure etc. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string EventType { get => this._eventType; set => this._eventType = value; } + + /// Backing field for property. + private string _fabricId; + + /// The ARM ID of the fabric. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string FabricId { get => this._fabricId; set => this._fabricId = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] _healthError; + + /// The list of errors / warnings capturing details associated with the issue(s). + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] HealthError { get => this._healthError; set => this._healthError = value; } + + /// Internal Acessors for EventSpecificDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventSpecificDetails Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventPropertiesInternal.EventSpecificDetail { get => (this._eventSpecificDetail = this._eventSpecificDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EventSpecificDetails()); set { {_eventSpecificDetail = value;} } } + + /// Internal Acessors for ProviderSpecificDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetails Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventPropertiesInternal.ProviderSpecificDetail { get => (this._providerSpecificDetail = this._providerSpecificDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EventProviderSpecificDetails()); set { {_providerSpecificDetail = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetails _providerSpecificDetail; + + /// The provider specific settings. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetails ProviderSpecificDetail { get => (this._providerSpecificDetail = this._providerSpecificDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EventProviderSpecificDetails()); set => this._providerSpecificDetail = value; } + + /// Gets the class type. Overridden in derived classes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ProviderSpecificDetailInstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetailsInternal)ProviderSpecificDetail).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetailsInternal)ProviderSpecificDetail).InstanceType = value ?? null; } + + /// Backing field for property. + private string _severity; + + /// The severity of the event. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Severity { get => this._severity; set => this._severity = value; } + + /// Backing field for property. + private global::System.DateTime? _timeOfOccurrence; + + /// The time of occurrence of the event. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public global::System.DateTime? TimeOfOccurrence { get => this._timeOfOccurrence; set => this._timeOfOccurrence = value; } + + /// Creates an new instance. + public EventProperties() + { + + } + } + /// The properties of a monitoring event. + public partial interface IEventProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The affected object correlationId for the event. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The affected object correlationId for the event.", + SerializedName = @"affectedObjectCorrelationId", + PossibleTypes = new [] { typeof(string) })] + string AffectedObjectCorrelationId { get; set; } + /// + /// The friendly name of the source of the event on which it is raised (for example, VM, VMM etc). + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The friendly name of the source of the event on which it is raised (for example, VM, VMM etc).", + SerializedName = @"affectedObjectFriendlyName", + PossibleTypes = new [] { typeof(string) })] + string AffectedObjectFriendlyName { get; set; } + /// The event name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The event name.", + SerializedName = @"description", + PossibleTypes = new [] { typeof(string) })] + string Description { get; set; } + /// The Id of the monitoring event. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Id of the monitoring event.", + SerializedName = @"eventCode", + PossibleTypes = new [] { typeof(string) })] + string EventCode { get; set; } + /// Gets the class type. Overridden in derived classes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets the class type. Overridden in derived classes.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string EventSpecificDetailInstanceType { get; set; } + /// The type of the event. for example: VM Health, Server Health, Job Failure etc. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The type of the event. for example: VM Health, Server Health, Job Failure etc.", + SerializedName = @"eventType", + PossibleTypes = new [] { typeof(string) })] + string EventType { get; set; } + /// The ARM ID of the fabric. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The ARM ID of the fabric.", + SerializedName = @"fabricId", + PossibleTypes = new [] { typeof(string) })] + string FabricId { get; set; } + /// The list of errors / warnings capturing details associated with the issue(s). + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of errors / warnings capturing details associated with the issue(s).", + SerializedName = @"healthErrors", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] HealthError { get; set; } + /// Gets the class type. Overridden in derived classes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets the class type. Overridden in derived classes.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string ProviderSpecificDetailInstanceType { get; set; } + /// The severity of the event. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The severity of the event.", + SerializedName = @"severity", + PossibleTypes = new [] { typeof(string) })] + string Severity { get; set; } + /// The time of occurrence of the event. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The time of occurrence of the event.", + SerializedName = @"timeOfOccurrence", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? TimeOfOccurrence { get; set; } + + } + /// The properties of a monitoring event. + internal partial interface IEventPropertiesInternal + + { + /// The affected object correlationId for the event. + string AffectedObjectCorrelationId { get; set; } + /// + /// The friendly name of the source of the event on which it is raised (for example, VM, VMM etc). + /// + string AffectedObjectFriendlyName { get; set; } + /// The event name. + string Description { get; set; } + /// The Id of the monitoring event. + string EventCode { get; set; } + /// The event specific settings. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventSpecificDetails EventSpecificDetail { get; set; } + /// Gets the class type. Overridden in derived classes. + string EventSpecificDetailInstanceType { get; set; } + /// The type of the event. for example: VM Health, Server Health, Job Failure etc. + string EventType { get; set; } + /// The ARM ID of the fabric. + string FabricId { get; set; } + /// The list of errors / warnings capturing details associated with the issue(s). + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] HealthError { get; set; } + /// The provider specific settings. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetails ProviderSpecificDetail { get; set; } + /// Gets the class type. Overridden in derived classes. + string ProviderSpecificDetailInstanceType { get; set; } + /// The severity of the event. + string Severity { get; set; } + /// The time of occurrence of the event. + global::System.DateTime? TimeOfOccurrence { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EventProperties.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EventProperties.json.cs new file mode 100644 index 000000000000..1883b4980359 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EventProperties.json.cs @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The properties of a monitoring event. + public partial class EventProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal EventProperties(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_providerSpecificDetail = If( json?.PropertyT("providerSpecificDetails"), out var __jsonProviderSpecificDetails) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EventProviderSpecificDetails.FromJson(__jsonProviderSpecificDetails) : ProviderSpecificDetail;} + {_eventSpecificDetail = If( json?.PropertyT("eventSpecificDetails"), out var __jsonEventSpecificDetails) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EventSpecificDetails.FromJson(__jsonEventSpecificDetails) : EventSpecificDetail;} + {_eventCode = If( json?.PropertyT("eventCode"), out var __jsonEventCode) ? (string)__jsonEventCode : (string)EventCode;} + {_description = If( json?.PropertyT("description"), out var __jsonDescription) ? (string)__jsonDescription : (string)Description;} + {_eventType = If( json?.PropertyT("eventType"), out var __jsonEventType) ? (string)__jsonEventType : (string)EventType;} + {_affectedObjectFriendlyName = If( json?.PropertyT("affectedObjectFriendlyName"), out var __jsonAffectedObjectFriendlyName) ? (string)__jsonAffectedObjectFriendlyName : (string)AffectedObjectFriendlyName;} + {_affectedObjectCorrelationId = If( json?.PropertyT("affectedObjectCorrelationId"), out var __jsonAffectedObjectCorrelationId) ? (string)__jsonAffectedObjectCorrelationId : (string)AffectedObjectCorrelationId;} + {_severity = If( json?.PropertyT("severity"), out var __jsonSeverity) ? (string)__jsonSeverity : (string)Severity;} + {_timeOfOccurrence = If( json?.PropertyT("timeOfOccurrence"), out var __jsonTimeOfOccurrence) ? global::System.DateTime.TryParse((string)__jsonTimeOfOccurrence, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonTimeOfOccurrenceValue) ? __jsonTimeOfOccurrenceValue : TimeOfOccurrence : TimeOfOccurrence;} + {_fabricId = If( json?.PropertyT("fabricId"), out var __jsonFabricId) ? (string)__jsonFabricId : (string)FabricId;} + {_healthError = If( json?.PropertyT("healthErrors"), out var __jsonHealthErrors) ? If( __jsonHealthErrors as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthError.FromJson(__u) )) ))() : null : HealthError;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new EventProperties(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._providerSpecificDetail ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._providerSpecificDetail.ToJson(null,serializationMode) : null, "providerSpecificDetails" ,container.Add ); + AddIf( null != this._eventSpecificDetail ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._eventSpecificDetail.ToJson(null,serializationMode) : null, "eventSpecificDetails" ,container.Add ); + AddIf( null != (((object)this._eventCode)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._eventCode.ToString()) : null, "eventCode" ,container.Add ); + AddIf( null != (((object)this._description)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._description.ToString()) : null, "description" ,container.Add ); + AddIf( null != (((object)this._eventType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._eventType.ToString()) : null, "eventType" ,container.Add ); + AddIf( null != (((object)this._affectedObjectFriendlyName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._affectedObjectFriendlyName.ToString()) : null, "affectedObjectFriendlyName" ,container.Add ); + AddIf( null != (((object)this._affectedObjectCorrelationId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._affectedObjectCorrelationId.ToString()) : null, "affectedObjectCorrelationId" ,container.Add ); + AddIf( null != (((object)this._severity)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._severity.ToString()) : null, "severity" ,container.Add ); + AddIf( null != this._timeOfOccurrence ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._timeOfOccurrence?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "timeOfOccurrence" ,container.Add ); + AddIf( null != (((object)this._fabricId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._fabricId.ToString()) : null, "fabricId" ,container.Add ); + if (null != this._healthError) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._healthError ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("healthErrors",__w); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EventProviderSpecificDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EventProviderSpecificDetails.PowerShell.cs new file mode 100644 index 000000000000..73e8175ce1da --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EventProviderSpecificDetails.PowerShell.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Model class for provider specific details for an event. + [System.ComponentModel.TypeConverter(typeof(EventProviderSpecificDetailsTypeConverter))] + public partial class EventProviderSpecificDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new EventProviderSpecificDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new EventProviderSpecificDetails(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal EventProviderSpecificDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal EventProviderSpecificDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Model class for provider specific details for an event. + [System.ComponentModel.TypeConverter(typeof(EventProviderSpecificDetailsTypeConverter))] + public partial interface IEventProviderSpecificDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EventProviderSpecificDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EventProviderSpecificDetails.TypeConverter.cs new file mode 100644 index 000000000000..c879158b7ace --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EventProviderSpecificDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class EventProviderSpecificDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return EventProviderSpecificDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return EventProviderSpecificDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return EventProviderSpecificDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EventProviderSpecificDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EventProviderSpecificDetails.cs new file mode 100644 index 000000000000..9bdeb92d566b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EventProviderSpecificDetails.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Model class for provider specific details for an event. + public partial class EventProviderSpecificDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetailsInternal + { + + /// Backing field for property. + private string _instanceType; + + /// Gets the class type. Overridden in derived classes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string InstanceType { get => this._instanceType; set => this._instanceType = value; } + + /// Creates an new instance. + public EventProviderSpecificDetails() + { + + } + } + /// Model class for provider specific details for an event. + public partial interface IEventProviderSpecificDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// Gets the class type. Overridden in derived classes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets the class type. Overridden in derived classes.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string InstanceType { get; set; } + + } + /// Model class for provider specific details for an event. + internal partial interface IEventProviderSpecificDetailsInternal + + { + /// Gets the class type. Overridden in derived classes. + string InstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EventProviderSpecificDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EventProviderSpecificDetails.json.cs new file mode 100644 index 000000000000..893a3d527111 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EventProviderSpecificDetails.json.cs @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Model class for provider specific details for an event. + public partial class EventProviderSpecificDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal EventProviderSpecificDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_instanceType = If( json?.PropertyT("instanceType"), out var __jsonInstanceType) ? (string)__jsonInstanceType : (string)InstanceType;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetails. + /// Note: the Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetails interface is + /// polymorphic, and the precise model class that will get deserialized is determined at runtime based on the payload. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + if (!(node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json)) + { + return null; + } + // Polymorphic type -- select the appropriate constructor using the discriminator + + switch ( json.StringProperty("instanceType") ) + { + case "A2A": + { + return new A2AEventDetails(json); + } + case "HyperVReplica2012": + { + return new HyperVReplica2012EventDetails(json); + } + case "HyperVReplica2012R2": + { + return new HyperVReplica2012R2EventDetails(json); + } + case "HyperVReplicaAzure": + { + return new HyperVReplicaAzureEventDetails(json); + } + case "HyperVReplicaBaseEventDetails": + { + return new HyperVReplicaBaseEventDetails(json); + } + case "InMageAzureV2": + { + return new InMageAzureV2EventDetails(json); + } + case "InMageRcm": + { + return new InMageRcmEventDetails(json); + } + case "InMageRcmFailback": + { + return new InMageRcmFailbackEventDetails(json); + } + case "VMwareCbt": + { + return new VMwareCbtEventDetails(json); + } + } + return new EventProviderSpecificDetails(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._instanceType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._instanceType.ToString()) : null, "instanceType" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EventQueryParameter.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EventQueryParameter.PowerShell.cs new file mode 100644 index 000000000000..0950052ccc3e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EventQueryParameter.PowerShell.cs @@ -0,0 +1,200 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Implements the event query parameter. + [System.ComponentModel.TypeConverter(typeof(EventQueryParameterTypeConverter))] + public partial class EventQueryParameter + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventQueryParameter DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new EventQueryParameter(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventQueryParameter DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new EventQueryParameter(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal EventQueryParameter(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("EventCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventQueryParameterInternal)this).EventCode = (string) content.GetValueForProperty("EventCode",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventQueryParameterInternal)this).EventCode, global::System.Convert.ToString); + } + if (content.Contains("Severity")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventQueryParameterInternal)this).Severity = (string) content.GetValueForProperty("Severity",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventQueryParameterInternal)this).Severity, global::System.Convert.ToString); + } + if (content.Contains("EventType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventQueryParameterInternal)this).EventType = (string) content.GetValueForProperty("EventType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventQueryParameterInternal)this).EventType, global::System.Convert.ToString); + } + if (content.Contains("FabricName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventQueryParameterInternal)this).FabricName = (string) content.GetValueForProperty("FabricName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventQueryParameterInternal)this).FabricName, global::System.Convert.ToString); + } + if (content.Contains("AffectedObjectFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventQueryParameterInternal)this).AffectedObjectFriendlyName = (string) content.GetValueForProperty("AffectedObjectFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventQueryParameterInternal)this).AffectedObjectFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("AffectedObjectCorrelationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventQueryParameterInternal)this).AffectedObjectCorrelationId = (string) content.GetValueForProperty("AffectedObjectCorrelationId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventQueryParameterInternal)this).AffectedObjectCorrelationId, global::System.Convert.ToString); + } + if (content.Contains("StartTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventQueryParameterInternal)this).StartTime = (global::System.DateTime?) content.GetValueForProperty("StartTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventQueryParameterInternal)this).StartTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("EndTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventQueryParameterInternal)this).EndTime = (global::System.DateTime?) content.GetValueForProperty("EndTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventQueryParameterInternal)this).EndTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal EventQueryParameter(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("EventCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventQueryParameterInternal)this).EventCode = (string) content.GetValueForProperty("EventCode",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventQueryParameterInternal)this).EventCode, global::System.Convert.ToString); + } + if (content.Contains("Severity")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventQueryParameterInternal)this).Severity = (string) content.GetValueForProperty("Severity",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventQueryParameterInternal)this).Severity, global::System.Convert.ToString); + } + if (content.Contains("EventType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventQueryParameterInternal)this).EventType = (string) content.GetValueForProperty("EventType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventQueryParameterInternal)this).EventType, global::System.Convert.ToString); + } + if (content.Contains("FabricName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventQueryParameterInternal)this).FabricName = (string) content.GetValueForProperty("FabricName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventQueryParameterInternal)this).FabricName, global::System.Convert.ToString); + } + if (content.Contains("AffectedObjectFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventQueryParameterInternal)this).AffectedObjectFriendlyName = (string) content.GetValueForProperty("AffectedObjectFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventQueryParameterInternal)this).AffectedObjectFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("AffectedObjectCorrelationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventQueryParameterInternal)this).AffectedObjectCorrelationId = (string) content.GetValueForProperty("AffectedObjectCorrelationId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventQueryParameterInternal)this).AffectedObjectCorrelationId, global::System.Convert.ToString); + } + if (content.Contains("StartTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventQueryParameterInternal)this).StartTime = (global::System.DateTime?) content.GetValueForProperty("StartTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventQueryParameterInternal)this).StartTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("EndTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventQueryParameterInternal)this).EndTime = (global::System.DateTime?) content.GetValueForProperty("EndTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventQueryParameterInternal)this).EndTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + AfterDeserializePSObject(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventQueryParameter FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Implements the event query parameter. + [System.ComponentModel.TypeConverter(typeof(EventQueryParameterTypeConverter))] + public partial interface IEventQueryParameter + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EventQueryParameter.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EventQueryParameter.TypeConverter.cs new file mode 100644 index 000000000000..a886d22c5abc --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EventQueryParameter.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class EventQueryParameterTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventQueryParameter ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventQueryParameter).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return EventQueryParameter.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return EventQueryParameter.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return EventQueryParameter.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EventQueryParameter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EventQueryParameter.cs new file mode 100644 index 000000000000..6451d10a8170 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EventQueryParameter.cs @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Implements the event query parameter. + public partial class EventQueryParameter : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventQueryParameter, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventQueryParameterInternal + { + + /// Backing field for property. + private string _affectedObjectCorrelationId; + + /// The affected object correlationId for the events to be queried. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string AffectedObjectCorrelationId { get => this._affectedObjectCorrelationId; set => this._affectedObjectCorrelationId = value; } + + /// Backing field for property. + private string _affectedObjectFriendlyName; + + /// The affected object name of the events to be queried. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string AffectedObjectFriendlyName { get => this._affectedObjectFriendlyName; set => this._affectedObjectFriendlyName = value; } + + /// Backing field for property. + private global::System.DateTime? _endTime; + + /// The end time of the time range within which the events are to be queried. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public global::System.DateTime? EndTime { get => this._endTime; set => this._endTime = value; } + + /// Backing field for property. + private string _eventCode; + + /// The source id of the events to be queried. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string EventCode { get => this._eventCode; set => this._eventCode = value; } + + /// Backing field for property. + private string _eventType; + + /// The type of the events to be queried. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string EventType { get => this._eventType; set => this._eventType = value; } + + /// Backing field for property. + private string _fabricName; + + /// The affected object server id of the events to be queried. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// Backing field for property. + private string _severity; + + /// The severity of the events to be queried. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Severity { get => this._severity; set => this._severity = value; } + + /// Backing field for property. + private global::System.DateTime? _startTime; + + /// The start time of the time range within which the events are to be queried. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public global::System.DateTime? StartTime { get => this._startTime; set => this._startTime = value; } + + /// Creates an new instance. + public EventQueryParameter() + { + + } + } + /// Implements the event query parameter. + public partial interface IEventQueryParameter : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The affected object correlationId for the events to be queried. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The affected object correlationId for the events to be queried.", + SerializedName = @"affectedObjectCorrelationId", + PossibleTypes = new [] { typeof(string) })] + string AffectedObjectCorrelationId { get; set; } + /// The affected object name of the events to be queried. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The affected object name of the events to be queried.", + SerializedName = @"affectedObjectFriendlyName", + PossibleTypes = new [] { typeof(string) })] + string AffectedObjectFriendlyName { get; set; } + /// The end time of the time range within which the events are to be queried. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The end time of the time range within which the events are to be queried.", + SerializedName = @"endTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? EndTime { get; set; } + /// The source id of the events to be queried. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The source id of the events to be queried.", + SerializedName = @"eventCode", + PossibleTypes = new [] { typeof(string) })] + string EventCode { get; set; } + /// The type of the events to be queried. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The type of the events to be queried.", + SerializedName = @"eventType", + PossibleTypes = new [] { typeof(string) })] + string EventType { get; set; } + /// The affected object server id of the events to be queried. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The affected object server id of the events to be queried.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + string FabricName { get; set; } + /// The severity of the events to be queried. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The severity of the events to be queried.", + SerializedName = @"severity", + PossibleTypes = new [] { typeof(string) })] + string Severity { get; set; } + /// The start time of the time range within which the events are to be queried. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The start time of the time range within which the events are to be queried.", + SerializedName = @"startTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? StartTime { get; set; } + + } + /// Implements the event query parameter. + internal partial interface IEventQueryParameterInternal + + { + /// The affected object correlationId for the events to be queried. + string AffectedObjectCorrelationId { get; set; } + /// The affected object name of the events to be queried. + string AffectedObjectFriendlyName { get; set; } + /// The end time of the time range within which the events are to be queried. + global::System.DateTime? EndTime { get; set; } + /// The source id of the events to be queried. + string EventCode { get; set; } + /// The type of the events to be queried. + string EventType { get; set; } + /// The affected object server id of the events to be queried. + string FabricName { get; set; } + /// The severity of the events to be queried. + string Severity { get; set; } + /// The start time of the time range within which the events are to be queried. + global::System.DateTime? StartTime { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EventQueryParameter.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EventQueryParameter.json.cs new file mode 100644 index 000000000000..20a9e31c4bff --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EventQueryParameter.json.cs @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Implements the event query parameter. + public partial class EventQueryParameter + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal EventQueryParameter(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_eventCode = If( json?.PropertyT("eventCode"), out var __jsonEventCode) ? (string)__jsonEventCode : (string)EventCode;} + {_severity = If( json?.PropertyT("severity"), out var __jsonSeverity) ? (string)__jsonSeverity : (string)Severity;} + {_eventType = If( json?.PropertyT("eventType"), out var __jsonEventType) ? (string)__jsonEventType : (string)EventType;} + {_fabricName = If( json?.PropertyT("fabricName"), out var __jsonFabricName) ? (string)__jsonFabricName : (string)FabricName;} + {_affectedObjectFriendlyName = If( json?.PropertyT("affectedObjectFriendlyName"), out var __jsonAffectedObjectFriendlyName) ? (string)__jsonAffectedObjectFriendlyName : (string)AffectedObjectFriendlyName;} + {_affectedObjectCorrelationId = If( json?.PropertyT("affectedObjectCorrelationId"), out var __jsonAffectedObjectCorrelationId) ? (string)__jsonAffectedObjectCorrelationId : (string)AffectedObjectCorrelationId;} + {_startTime = If( json?.PropertyT("startTime"), out var __jsonStartTime) ? global::System.DateTime.TryParse((string)__jsonStartTime, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonStartTimeValue) ? __jsonStartTimeValue : StartTime : StartTime;} + {_endTime = If( json?.PropertyT("endTime"), out var __jsonEndTime) ? global::System.DateTime.TryParse((string)__jsonEndTime, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonEndTimeValue) ? __jsonEndTimeValue : EndTime : EndTime;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventQueryParameter. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventQueryParameter. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventQueryParameter FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new EventQueryParameter(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._eventCode)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._eventCode.ToString()) : null, "eventCode" ,container.Add ); + AddIf( null != (((object)this._severity)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._severity.ToString()) : null, "severity" ,container.Add ); + AddIf( null != (((object)this._eventType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._eventType.ToString()) : null, "eventType" ,container.Add ); + AddIf( null != (((object)this._fabricName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._fabricName.ToString()) : null, "fabricName" ,container.Add ); + AddIf( null != (((object)this._affectedObjectFriendlyName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._affectedObjectFriendlyName.ToString()) : null, "affectedObjectFriendlyName" ,container.Add ); + AddIf( null != (((object)this._affectedObjectCorrelationId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._affectedObjectCorrelationId.ToString()) : null, "affectedObjectCorrelationId" ,container.Add ); + AddIf( null != this._startTime ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._startTime?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "startTime" ,container.Add ); + AddIf( null != this._endTime ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._endTime?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "endTime" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EventSpecificDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EventSpecificDetails.PowerShell.cs new file mode 100644 index 000000000000..ca32ff2b1d2e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EventSpecificDetails.PowerShell.cs @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Model class for event specific details for an event. + [System.ComponentModel.TypeConverter(typeof(EventSpecificDetailsTypeConverter))] + public partial class EventSpecificDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventSpecificDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new EventSpecificDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventSpecificDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new EventSpecificDetails(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal EventSpecificDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventSpecificDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventSpecificDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal EventSpecificDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventSpecificDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventSpecificDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventSpecificDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Model class for event specific details for an event. + [System.ComponentModel.TypeConverter(typeof(EventSpecificDetailsTypeConverter))] + public partial interface IEventSpecificDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EventSpecificDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EventSpecificDetails.TypeConverter.cs new file mode 100644 index 000000000000..bc996debacf1 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EventSpecificDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class EventSpecificDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventSpecificDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventSpecificDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return EventSpecificDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return EventSpecificDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return EventSpecificDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EventSpecificDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EventSpecificDetails.cs new file mode 100644 index 000000000000..a0c21b034351 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EventSpecificDetails.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Model class for event specific details for an event. + public partial class EventSpecificDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventSpecificDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventSpecificDetailsInternal + { + + /// Backing field for property. + private string _instanceType; + + /// Gets the class type. Overridden in derived classes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string InstanceType { get => this._instanceType; set => this._instanceType = value; } + + /// Creates an new instance. + public EventSpecificDetails() + { + + } + } + /// Model class for event specific details for an event. + public partial interface IEventSpecificDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// Gets the class type. Overridden in derived classes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets the class type. Overridden in derived classes.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string InstanceType { get; set; } + + } + /// Model class for event specific details for an event. + internal partial interface IEventSpecificDetailsInternal + + { + /// Gets the class type. Overridden in derived classes. + string InstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EventSpecificDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EventSpecificDetails.json.cs new file mode 100644 index 000000000000..4f680825543f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/EventSpecificDetails.json.cs @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Model class for event specific details for an event. + public partial class EventSpecificDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal EventSpecificDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_instanceType = If( json?.PropertyT("instanceType"), out var __jsonInstanceType) ? (string)__jsonInstanceType : (string)InstanceType;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventSpecificDetails. + /// Note: the Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventSpecificDetails interface is polymorphic, + /// and the precise model class that will get deserialized is determined at runtime based on the payload. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventSpecificDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventSpecificDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + if (!(node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json)) + { + return null; + } + // Polymorphic type -- select the appropriate constructor using the discriminator + + switch ( json.StringProperty("instanceType") ) + { + case "JobStatus": + { + return new JobStatusEventDetails(json); + } + } + return new EventSpecificDetails(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._instanceType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._instanceType.ToString()) : null, "instanceType" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ExistingProtectionProfile.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ExistingProtectionProfile.PowerShell.cs new file mode 100644 index 000000000000..fc06e5c6a6b3 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ExistingProtectionProfile.PowerShell.cs @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Existing storage account input. + [System.ComponentModel.TypeConverter(typeof(ExistingProtectionProfileTypeConverter))] + public partial class ExistingProtectionProfile + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExistingProtectionProfile DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ExistingProtectionProfile(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExistingProtectionProfile DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ExistingProtectionProfile(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ExistingProtectionProfile(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProtectionProfileId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExistingProtectionProfileInternal)this).ProtectionProfileId = (string) content.GetValueForProperty("ProtectionProfileId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExistingProtectionProfileInternal)this).ProtectionProfileId, global::System.Convert.ToString); + } + if (content.Contains("ResourceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionProfileCustomDetailsInternal)this).ResourceType = (string) content.GetValueForProperty("ResourceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionProfileCustomDetailsInternal)this).ResourceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ExistingProtectionProfile(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProtectionProfileId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExistingProtectionProfileInternal)this).ProtectionProfileId = (string) content.GetValueForProperty("ProtectionProfileId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExistingProtectionProfileInternal)this).ProtectionProfileId, global::System.Convert.ToString); + } + if (content.Contains("ResourceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionProfileCustomDetailsInternal)this).ResourceType = (string) content.GetValueForProperty("ResourceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionProfileCustomDetailsInternal)this).ResourceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExistingProtectionProfile FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Existing storage account input. + [System.ComponentModel.TypeConverter(typeof(ExistingProtectionProfileTypeConverter))] + public partial interface IExistingProtectionProfile + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ExistingProtectionProfile.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ExistingProtectionProfile.TypeConverter.cs new file mode 100644 index 000000000000..03f8e45e9cda --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ExistingProtectionProfile.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ExistingProtectionProfileTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExistingProtectionProfile ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExistingProtectionProfile).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ExistingProtectionProfile.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ExistingProtectionProfile.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ExistingProtectionProfile.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ExistingProtectionProfile.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ExistingProtectionProfile.cs new file mode 100644 index 000000000000..99e75a76f0b8 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ExistingProtectionProfile.cs @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Existing storage account input. + public partial class ExistingProtectionProfile : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExistingProtectionProfile, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExistingProtectionProfileInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionProfileCustomDetails __protectionProfileCustomDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProtectionProfileCustomDetails(); + + /// Backing field for property. + private string _protectionProfileId; + + /// The protection profile Arm Id. Throw error, if resource does not exists. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ProtectionProfileId { get => this._protectionProfileId; set => this._protectionProfileId = value; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string ResourceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionProfileCustomDetailsInternal)__protectionProfileCustomDetails).ResourceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionProfileCustomDetailsInternal)__protectionProfileCustomDetails).ResourceType = value ; } + + /// Creates an new instance. + public ExistingProtectionProfile() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__protectionProfileCustomDetails), __protectionProfileCustomDetails); + await eventListener.AssertObjectIsValid(nameof(__protectionProfileCustomDetails), __protectionProfileCustomDetails); + } + } + /// Existing storage account input. + public partial interface IExistingProtectionProfile : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionProfileCustomDetails + { + /// The protection profile Arm Id. Throw error, if resource does not exists. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The protection profile Arm Id. Throw error, if resource does not exists.", + SerializedName = @"protectionProfileId", + PossibleTypes = new [] { typeof(string) })] + string ProtectionProfileId { get; set; } + + } + /// Existing storage account input. + internal partial interface IExistingProtectionProfileInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionProfileCustomDetailsInternal + { + /// The protection profile Arm Id. Throw error, if resource does not exists. + string ProtectionProfileId { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ExistingProtectionProfile.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ExistingProtectionProfile.json.cs new file mode 100644 index 000000000000..92ebf36b2dee --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ExistingProtectionProfile.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Existing storage account input. + public partial class ExistingProtectionProfile + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal ExistingProtectionProfile(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __protectionProfileCustomDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProtectionProfileCustomDetails(json); + {_protectionProfileId = If( json?.PropertyT("protectionProfileId"), out var __jsonProtectionProfileId) ? (string)__jsonProtectionProfileId : (string)ProtectionProfileId;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExistingProtectionProfile. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExistingProtectionProfile. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExistingProtectionProfile FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new ExistingProtectionProfile(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __protectionProfileCustomDetails?.ToJson(container, serializationMode); + AddIf( null != (((object)this._protectionProfileId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._protectionProfileId.ToString()) : null, "protectionProfileId" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ExistingRecoveryAvailabilitySet.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ExistingRecoveryAvailabilitySet.PowerShell.cs new file mode 100644 index 000000000000..7c3b7614fd5e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ExistingRecoveryAvailabilitySet.PowerShell.cs @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Existing recovery availability set input. + [System.ComponentModel.TypeConverter(typeof(ExistingRecoveryAvailabilitySetTypeConverter))] + public partial class ExistingRecoveryAvailabilitySet + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExistingRecoveryAvailabilitySet DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ExistingRecoveryAvailabilitySet(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExistingRecoveryAvailabilitySet DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ExistingRecoveryAvailabilitySet(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ExistingRecoveryAvailabilitySet(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("RecoveryAvailabilitySetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExistingRecoveryAvailabilitySetInternal)this).RecoveryAvailabilitySetId = (string) content.GetValueForProperty("RecoveryAvailabilitySetId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExistingRecoveryAvailabilitySetInternal)this).RecoveryAvailabilitySetId, global::System.Convert.ToString); + } + if (content.Contains("ResourceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryAvailabilitySetCustomDetailsInternal)this).ResourceType = (string) content.GetValueForProperty("ResourceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryAvailabilitySetCustomDetailsInternal)this).ResourceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ExistingRecoveryAvailabilitySet(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("RecoveryAvailabilitySetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExistingRecoveryAvailabilitySetInternal)this).RecoveryAvailabilitySetId = (string) content.GetValueForProperty("RecoveryAvailabilitySetId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExistingRecoveryAvailabilitySetInternal)this).RecoveryAvailabilitySetId, global::System.Convert.ToString); + } + if (content.Contains("ResourceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryAvailabilitySetCustomDetailsInternal)this).ResourceType = (string) content.GetValueForProperty("ResourceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryAvailabilitySetCustomDetailsInternal)this).ResourceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExistingRecoveryAvailabilitySet FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Existing recovery availability set input. + [System.ComponentModel.TypeConverter(typeof(ExistingRecoveryAvailabilitySetTypeConverter))] + public partial interface IExistingRecoveryAvailabilitySet + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ExistingRecoveryAvailabilitySet.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ExistingRecoveryAvailabilitySet.TypeConverter.cs new file mode 100644 index 000000000000..4aafb68a16f4 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ExistingRecoveryAvailabilitySet.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ExistingRecoveryAvailabilitySetTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExistingRecoveryAvailabilitySet ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExistingRecoveryAvailabilitySet).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ExistingRecoveryAvailabilitySet.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ExistingRecoveryAvailabilitySet.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ExistingRecoveryAvailabilitySet.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ExistingRecoveryAvailabilitySet.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ExistingRecoveryAvailabilitySet.cs new file mode 100644 index 000000000000..cd7b76c93a39 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ExistingRecoveryAvailabilitySet.cs @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Existing recovery availability set input. + public partial class ExistingRecoveryAvailabilitySet : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExistingRecoveryAvailabilitySet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExistingRecoveryAvailabilitySetInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryAvailabilitySetCustomDetails __recoveryAvailabilitySetCustomDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryAvailabilitySetCustomDetails(); + + /// Backing field for property. + private string _recoveryAvailabilitySetId; + + /// The recovery availability set Id. Will throw error, if resource does not exist. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryAvailabilitySetId { get => this._recoveryAvailabilitySetId; set => this._recoveryAvailabilitySetId = value; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string ResourceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryAvailabilitySetCustomDetailsInternal)__recoveryAvailabilitySetCustomDetails).ResourceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryAvailabilitySetCustomDetailsInternal)__recoveryAvailabilitySetCustomDetails).ResourceType = value ; } + + /// Creates an new instance. + public ExistingRecoveryAvailabilitySet() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__recoveryAvailabilitySetCustomDetails), __recoveryAvailabilitySetCustomDetails); + await eventListener.AssertObjectIsValid(nameof(__recoveryAvailabilitySetCustomDetails), __recoveryAvailabilitySetCustomDetails); + } + } + /// Existing recovery availability set input. + public partial interface IExistingRecoveryAvailabilitySet : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryAvailabilitySetCustomDetails + { + /// The recovery availability set Id. Will throw error, if resource does not exist. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery availability set Id. Will throw error, if resource does not exist.", + SerializedName = @"recoveryAvailabilitySetId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryAvailabilitySetId { get; set; } + + } + /// Existing recovery availability set input. + internal partial interface IExistingRecoveryAvailabilitySetInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryAvailabilitySetCustomDetailsInternal + { + /// The recovery availability set Id. Will throw error, if resource does not exist. + string RecoveryAvailabilitySetId { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ExistingRecoveryAvailabilitySet.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ExistingRecoveryAvailabilitySet.json.cs new file mode 100644 index 000000000000..e041522279fe --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ExistingRecoveryAvailabilitySet.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Existing recovery availability set input. + public partial class ExistingRecoveryAvailabilitySet + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal ExistingRecoveryAvailabilitySet(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __recoveryAvailabilitySetCustomDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryAvailabilitySetCustomDetails(json); + {_recoveryAvailabilitySetId = If( json?.PropertyT("recoveryAvailabilitySetId"), out var __jsonRecoveryAvailabilitySetId) ? (string)__jsonRecoveryAvailabilitySetId : (string)RecoveryAvailabilitySetId;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExistingRecoveryAvailabilitySet. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExistingRecoveryAvailabilitySet. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExistingRecoveryAvailabilitySet FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new ExistingRecoveryAvailabilitySet(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __recoveryAvailabilitySetCustomDetails?.ToJson(container, serializationMode); + AddIf( null != (((object)this._recoveryAvailabilitySetId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryAvailabilitySetId.ToString()) : null, "recoveryAvailabilitySetId" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ExistingRecoveryProximityPlacementGroup.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ExistingRecoveryProximityPlacementGroup.PowerShell.cs new file mode 100644 index 000000000000..7f251c1038de --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ExistingRecoveryProximityPlacementGroup.PowerShell.cs @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Existing recovery proximity placement group input. + [System.ComponentModel.TypeConverter(typeof(ExistingRecoveryProximityPlacementGroupTypeConverter))] + public partial class ExistingRecoveryProximityPlacementGroup + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExistingRecoveryProximityPlacementGroup DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ExistingRecoveryProximityPlacementGroup(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExistingRecoveryProximityPlacementGroup DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ExistingRecoveryProximityPlacementGroup(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ExistingRecoveryProximityPlacementGroup(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("RecoveryProximityPlacementGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExistingRecoveryProximityPlacementGroupInternal)this).RecoveryProximityPlacementGroupId = (string) content.GetValueForProperty("RecoveryProximityPlacementGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExistingRecoveryProximityPlacementGroupInternal)this).RecoveryProximityPlacementGroupId, global::System.Convert.ToString); + } + if (content.Contains("ResourceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryProximityPlacementGroupCustomDetailsInternal)this).ResourceType = (string) content.GetValueForProperty("ResourceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryProximityPlacementGroupCustomDetailsInternal)this).ResourceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ExistingRecoveryProximityPlacementGroup(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("RecoveryProximityPlacementGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExistingRecoveryProximityPlacementGroupInternal)this).RecoveryProximityPlacementGroupId = (string) content.GetValueForProperty("RecoveryProximityPlacementGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExistingRecoveryProximityPlacementGroupInternal)this).RecoveryProximityPlacementGroupId, global::System.Convert.ToString); + } + if (content.Contains("ResourceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryProximityPlacementGroupCustomDetailsInternal)this).ResourceType = (string) content.GetValueForProperty("ResourceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryProximityPlacementGroupCustomDetailsInternal)this).ResourceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json + /// string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExistingRecoveryProximityPlacementGroup FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Existing recovery proximity placement group input. + [System.ComponentModel.TypeConverter(typeof(ExistingRecoveryProximityPlacementGroupTypeConverter))] + public partial interface IExistingRecoveryProximityPlacementGroup + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ExistingRecoveryProximityPlacementGroup.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ExistingRecoveryProximityPlacementGroup.TypeConverter.cs new file mode 100644 index 000000000000..d27d8c5f1a45 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ExistingRecoveryProximityPlacementGroup.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ExistingRecoveryProximityPlacementGroupTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExistingRecoveryProximityPlacementGroup ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExistingRecoveryProximityPlacementGroup).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ExistingRecoveryProximityPlacementGroup.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ExistingRecoveryProximityPlacementGroup.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ExistingRecoveryProximityPlacementGroup.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ExistingRecoveryProximityPlacementGroup.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ExistingRecoveryProximityPlacementGroup.cs new file mode 100644 index 000000000000..b940c911c0b4 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ExistingRecoveryProximityPlacementGroup.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Existing recovery proximity placement group input. + public partial class ExistingRecoveryProximityPlacementGroup : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExistingRecoveryProximityPlacementGroup, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExistingRecoveryProximityPlacementGroupInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryProximityPlacementGroupCustomDetails __recoveryProximityPlacementGroupCustomDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryProximityPlacementGroupCustomDetails(); + + /// Backing field for property. + private string _recoveryProximityPlacementGroupId; + + /// + /// The recovery proximity placement group Id. Will throw error, if resource does not exist. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryProximityPlacementGroupId { get => this._recoveryProximityPlacementGroupId; set => this._recoveryProximityPlacementGroupId = value; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string ResourceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryProximityPlacementGroupCustomDetailsInternal)__recoveryProximityPlacementGroupCustomDetails).ResourceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryProximityPlacementGroupCustomDetailsInternal)__recoveryProximityPlacementGroupCustomDetails).ResourceType = value ; } + + /// Creates an new instance. + public ExistingRecoveryProximityPlacementGroup() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__recoveryProximityPlacementGroupCustomDetails), __recoveryProximityPlacementGroupCustomDetails); + await eventListener.AssertObjectIsValid(nameof(__recoveryProximityPlacementGroupCustomDetails), __recoveryProximityPlacementGroupCustomDetails); + } + } + /// Existing recovery proximity placement group input. + public partial interface IExistingRecoveryProximityPlacementGroup : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryProximityPlacementGroupCustomDetails + { + /// + /// The recovery proximity placement group Id. Will throw error, if resource does not exist. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery proximity placement group Id. Will throw error, if resource does not exist.", + SerializedName = @"recoveryProximityPlacementGroupId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryProximityPlacementGroupId { get; set; } + + } + /// Existing recovery proximity placement group input. + internal partial interface IExistingRecoveryProximityPlacementGroupInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryProximityPlacementGroupCustomDetailsInternal + { + /// + /// The recovery proximity placement group Id. Will throw error, if resource does not exist. + /// + string RecoveryProximityPlacementGroupId { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ExistingRecoveryProximityPlacementGroup.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ExistingRecoveryProximityPlacementGroup.json.cs new file mode 100644 index 000000000000..fabe694fa5eb --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ExistingRecoveryProximityPlacementGroup.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Existing recovery proximity placement group input. + public partial class ExistingRecoveryProximityPlacementGroup + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal ExistingRecoveryProximityPlacementGroup(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __recoveryProximityPlacementGroupCustomDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryProximityPlacementGroupCustomDetails(json); + {_recoveryProximityPlacementGroupId = If( json?.PropertyT("recoveryProximityPlacementGroupId"), out var __jsonRecoveryProximityPlacementGroupId) ? (string)__jsonRecoveryProximityPlacementGroupId : (string)RecoveryProximityPlacementGroupId;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExistingRecoveryProximityPlacementGroup. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExistingRecoveryProximityPlacementGroup. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExistingRecoveryProximityPlacementGroup FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new ExistingRecoveryProximityPlacementGroup(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __recoveryProximityPlacementGroupCustomDetails?.ToJson(container, serializationMode); + AddIf( null != (((object)this._recoveryProximityPlacementGroupId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryProximityPlacementGroupId.ToString()) : null, "recoveryProximityPlacementGroupId" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ExistingRecoveryResourceGroup.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ExistingRecoveryResourceGroup.PowerShell.cs new file mode 100644 index 000000000000..63c0391c9da0 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ExistingRecoveryResourceGroup.PowerShell.cs @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Existing recovery resource group input. + [System.ComponentModel.TypeConverter(typeof(ExistingRecoveryResourceGroupTypeConverter))] + public partial class ExistingRecoveryResourceGroup + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExistingRecoveryResourceGroup DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ExistingRecoveryResourceGroup(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExistingRecoveryResourceGroup DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ExistingRecoveryResourceGroup(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ExistingRecoveryResourceGroup(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("RecoveryResourceGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExistingRecoveryResourceGroupInternal)this).RecoveryResourceGroupId = (string) content.GetValueForProperty("RecoveryResourceGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExistingRecoveryResourceGroupInternal)this).RecoveryResourceGroupId, global::System.Convert.ToString); + } + if (content.Contains("ResourceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryResourceGroupCustomDetailsInternal)this).ResourceType = (string) content.GetValueForProperty("ResourceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryResourceGroupCustomDetailsInternal)this).ResourceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ExistingRecoveryResourceGroup(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("RecoveryResourceGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExistingRecoveryResourceGroupInternal)this).RecoveryResourceGroupId = (string) content.GetValueForProperty("RecoveryResourceGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExistingRecoveryResourceGroupInternal)this).RecoveryResourceGroupId, global::System.Convert.ToString); + } + if (content.Contains("ResourceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryResourceGroupCustomDetailsInternal)this).ResourceType = (string) content.GetValueForProperty("ResourceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryResourceGroupCustomDetailsInternal)this).ResourceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExistingRecoveryResourceGroup FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Existing recovery resource group input. + [System.ComponentModel.TypeConverter(typeof(ExistingRecoveryResourceGroupTypeConverter))] + public partial interface IExistingRecoveryResourceGroup + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ExistingRecoveryResourceGroup.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ExistingRecoveryResourceGroup.TypeConverter.cs new file mode 100644 index 000000000000..7a3c48c8eb79 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ExistingRecoveryResourceGroup.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ExistingRecoveryResourceGroupTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExistingRecoveryResourceGroup ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExistingRecoveryResourceGroup).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ExistingRecoveryResourceGroup.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ExistingRecoveryResourceGroup.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ExistingRecoveryResourceGroup.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ExistingRecoveryResourceGroup.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ExistingRecoveryResourceGroup.cs new file mode 100644 index 000000000000..bec585e0ba87 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ExistingRecoveryResourceGroup.cs @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Existing recovery resource group input. + public partial class ExistingRecoveryResourceGroup : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExistingRecoveryResourceGroup, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExistingRecoveryResourceGroupInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryResourceGroupCustomDetails __recoveryResourceGroupCustomDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryResourceGroupCustomDetails(); + + /// Backing field for property. + private string _recoveryResourceGroupId; + + /// The recovery resource group Id. Valid for V2 scenarios. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryResourceGroupId { get => this._recoveryResourceGroupId; set => this._recoveryResourceGroupId = value; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string ResourceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryResourceGroupCustomDetailsInternal)__recoveryResourceGroupCustomDetails).ResourceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryResourceGroupCustomDetailsInternal)__recoveryResourceGroupCustomDetails).ResourceType = value ; } + + /// Creates an new instance. + public ExistingRecoveryResourceGroup() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__recoveryResourceGroupCustomDetails), __recoveryResourceGroupCustomDetails); + await eventListener.AssertObjectIsValid(nameof(__recoveryResourceGroupCustomDetails), __recoveryResourceGroupCustomDetails); + } + } + /// Existing recovery resource group input. + public partial interface IExistingRecoveryResourceGroup : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryResourceGroupCustomDetails + { + /// The recovery resource group Id. Valid for V2 scenarios. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery resource group Id. Valid for V2 scenarios.", + SerializedName = @"recoveryResourceGroupId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryResourceGroupId { get; set; } + + } + /// Existing recovery resource group input. + internal partial interface IExistingRecoveryResourceGroupInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryResourceGroupCustomDetailsInternal + { + /// The recovery resource group Id. Valid for V2 scenarios. + string RecoveryResourceGroupId { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ExistingRecoveryResourceGroup.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ExistingRecoveryResourceGroup.json.cs new file mode 100644 index 000000000000..aa82eb3d1742 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ExistingRecoveryResourceGroup.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Existing recovery resource group input. + public partial class ExistingRecoveryResourceGroup + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal ExistingRecoveryResourceGroup(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __recoveryResourceGroupCustomDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryResourceGroupCustomDetails(json); + {_recoveryResourceGroupId = If( json?.PropertyT("recoveryResourceGroupId"), out var __jsonRecoveryResourceGroupId) ? (string)__jsonRecoveryResourceGroupId : (string)RecoveryResourceGroupId;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExistingRecoveryResourceGroup. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExistingRecoveryResourceGroup. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExistingRecoveryResourceGroup FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new ExistingRecoveryResourceGroup(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __recoveryResourceGroupCustomDetails?.ToJson(container, serializationMode); + AddIf( null != (((object)this._recoveryResourceGroupId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryResourceGroupId.ToString()) : null, "recoveryResourceGroupId" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ExistingRecoveryVirtualNetwork.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ExistingRecoveryVirtualNetwork.PowerShell.cs new file mode 100644 index 000000000000..9d42e6dc37c6 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ExistingRecoveryVirtualNetwork.PowerShell.cs @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Existing recovery virtual network input. + [System.ComponentModel.TypeConverter(typeof(ExistingRecoveryVirtualNetworkTypeConverter))] + public partial class ExistingRecoveryVirtualNetwork + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExistingRecoveryVirtualNetwork DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ExistingRecoveryVirtualNetwork(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExistingRecoveryVirtualNetwork DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ExistingRecoveryVirtualNetwork(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ExistingRecoveryVirtualNetwork(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("RecoveryVirtualNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExistingRecoveryVirtualNetworkInternal)this).RecoveryVirtualNetworkId = (string) content.GetValueForProperty("RecoveryVirtualNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExistingRecoveryVirtualNetworkInternal)this).RecoveryVirtualNetworkId, global::System.Convert.ToString); + } + if (content.Contains("RecoverySubnetName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExistingRecoveryVirtualNetworkInternal)this).RecoverySubnetName = (string) content.GetValueForProperty("RecoverySubnetName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExistingRecoveryVirtualNetworkInternal)this).RecoverySubnetName, global::System.Convert.ToString); + } + if (content.Contains("ResourceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryVirtualNetworkCustomDetailsInternal)this).ResourceType = (string) content.GetValueForProperty("ResourceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryVirtualNetworkCustomDetailsInternal)this).ResourceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ExistingRecoveryVirtualNetwork(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("RecoveryVirtualNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExistingRecoveryVirtualNetworkInternal)this).RecoveryVirtualNetworkId = (string) content.GetValueForProperty("RecoveryVirtualNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExistingRecoveryVirtualNetworkInternal)this).RecoveryVirtualNetworkId, global::System.Convert.ToString); + } + if (content.Contains("RecoverySubnetName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExistingRecoveryVirtualNetworkInternal)this).RecoverySubnetName = (string) content.GetValueForProperty("RecoverySubnetName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExistingRecoveryVirtualNetworkInternal)this).RecoverySubnetName, global::System.Convert.ToString); + } + if (content.Contains("ResourceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryVirtualNetworkCustomDetailsInternal)this).ResourceType = (string) content.GetValueForProperty("ResourceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryVirtualNetworkCustomDetailsInternal)this).ResourceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExistingRecoveryVirtualNetwork FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Existing recovery virtual network input. + [System.ComponentModel.TypeConverter(typeof(ExistingRecoveryVirtualNetworkTypeConverter))] + public partial interface IExistingRecoveryVirtualNetwork + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ExistingRecoveryVirtualNetwork.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ExistingRecoveryVirtualNetwork.TypeConverter.cs new file mode 100644 index 000000000000..73cb162e2de3 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ExistingRecoveryVirtualNetwork.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ExistingRecoveryVirtualNetworkTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExistingRecoveryVirtualNetwork ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExistingRecoveryVirtualNetwork).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ExistingRecoveryVirtualNetwork.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ExistingRecoveryVirtualNetwork.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ExistingRecoveryVirtualNetwork.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ExistingRecoveryVirtualNetwork.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ExistingRecoveryVirtualNetwork.cs new file mode 100644 index 000000000000..03a34ca82770 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ExistingRecoveryVirtualNetwork.cs @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Existing recovery virtual network input. + public partial class ExistingRecoveryVirtualNetwork : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExistingRecoveryVirtualNetwork, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExistingRecoveryVirtualNetworkInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryVirtualNetworkCustomDetails __recoveryVirtualNetworkCustomDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryVirtualNetworkCustomDetails(); + + /// Backing field for property. + private string _recoverySubnetName; + + /// The recovery subnet name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoverySubnetName { get => this._recoverySubnetName; set => this._recoverySubnetName = value; } + + /// Backing field for property. + private string _recoveryVirtualNetworkId; + + /// The recovery virtual network Id. Will throw error, if resource does not exist. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryVirtualNetworkId { get => this._recoveryVirtualNetworkId; set => this._recoveryVirtualNetworkId = value; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string ResourceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryVirtualNetworkCustomDetailsInternal)__recoveryVirtualNetworkCustomDetails).ResourceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryVirtualNetworkCustomDetailsInternal)__recoveryVirtualNetworkCustomDetails).ResourceType = value ; } + + /// Creates an new instance. + public ExistingRecoveryVirtualNetwork() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__recoveryVirtualNetworkCustomDetails), __recoveryVirtualNetworkCustomDetails); + await eventListener.AssertObjectIsValid(nameof(__recoveryVirtualNetworkCustomDetails), __recoveryVirtualNetworkCustomDetails); + } + } + /// Existing recovery virtual network input. + public partial interface IExistingRecoveryVirtualNetwork : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryVirtualNetworkCustomDetails + { + /// The recovery subnet name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery subnet name.", + SerializedName = @"recoverySubnetName", + PossibleTypes = new [] { typeof(string) })] + string RecoverySubnetName { get; set; } + /// The recovery virtual network Id. Will throw error, if resource does not exist. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The recovery virtual network Id. Will throw error, if resource does not exist.", + SerializedName = @"recoveryVirtualNetworkId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryVirtualNetworkId { get; set; } + + } + /// Existing recovery virtual network input. + internal partial interface IExistingRecoveryVirtualNetworkInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryVirtualNetworkCustomDetailsInternal + { + /// The recovery subnet name. + string RecoverySubnetName { get; set; } + /// The recovery virtual network Id. Will throw error, if resource does not exist. + string RecoveryVirtualNetworkId { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ExistingRecoveryVirtualNetwork.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ExistingRecoveryVirtualNetwork.json.cs new file mode 100644 index 000000000000..7ae0f49c3ee0 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ExistingRecoveryVirtualNetwork.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Existing recovery virtual network input. + public partial class ExistingRecoveryVirtualNetwork + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal ExistingRecoveryVirtualNetwork(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __recoveryVirtualNetworkCustomDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryVirtualNetworkCustomDetails(json); + {_recoveryVirtualNetworkId = If( json?.PropertyT("recoveryVirtualNetworkId"), out var __jsonRecoveryVirtualNetworkId) ? (string)__jsonRecoveryVirtualNetworkId : (string)RecoveryVirtualNetworkId;} + {_recoverySubnetName = If( json?.PropertyT("recoverySubnetName"), out var __jsonRecoverySubnetName) ? (string)__jsonRecoverySubnetName : (string)RecoverySubnetName;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExistingRecoveryVirtualNetwork. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExistingRecoveryVirtualNetwork. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExistingRecoveryVirtualNetwork FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new ExistingRecoveryVirtualNetwork(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __recoveryVirtualNetworkCustomDetails?.ToJson(container, serializationMode); + AddIf( null != (((object)this._recoveryVirtualNetworkId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryVirtualNetworkId.ToString()) : null, "recoveryVirtualNetworkId" ,container.Add ); + AddIf( null != (((object)this._recoverySubnetName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoverySubnetName.ToString()) : null, "recoverySubnetName" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ExistingStorageAccount.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ExistingStorageAccount.PowerShell.cs new file mode 100644 index 000000000000..c60e0bd61a1e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ExistingStorageAccount.PowerShell.cs @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Existing storage account input. + [System.ComponentModel.TypeConverter(typeof(ExistingStorageAccountTypeConverter))] + public partial class ExistingStorageAccount + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExistingStorageAccount DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ExistingStorageAccount(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExistingStorageAccount DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ExistingStorageAccount(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ExistingStorageAccount(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("AzureStorageAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExistingStorageAccountInternal)this).AzureStorageAccountId = (string) content.GetValueForProperty("AzureStorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExistingStorageAccountInternal)this).AzureStorageAccountId, global::System.Convert.ToString); + } + if (content.Contains("ResourceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageAccountCustomDetailsInternal)this).ResourceType = (string) content.GetValueForProperty("ResourceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageAccountCustomDetailsInternal)this).ResourceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ExistingStorageAccount(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("AzureStorageAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExistingStorageAccountInternal)this).AzureStorageAccountId = (string) content.GetValueForProperty("AzureStorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExistingStorageAccountInternal)this).AzureStorageAccountId, global::System.Convert.ToString); + } + if (content.Contains("ResourceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageAccountCustomDetailsInternal)this).ResourceType = (string) content.GetValueForProperty("ResourceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageAccountCustomDetailsInternal)this).ResourceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExistingStorageAccount FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Existing storage account input. + [System.ComponentModel.TypeConverter(typeof(ExistingStorageAccountTypeConverter))] + public partial interface IExistingStorageAccount + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ExistingStorageAccount.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ExistingStorageAccount.TypeConverter.cs new file mode 100644 index 000000000000..933397a4a5cf --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ExistingStorageAccount.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ExistingStorageAccountTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExistingStorageAccount ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExistingStorageAccount).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ExistingStorageAccount.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ExistingStorageAccount.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ExistingStorageAccount.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ExistingStorageAccount.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ExistingStorageAccount.cs new file mode 100644 index 000000000000..d2bda7ecd1d4 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ExistingStorageAccount.cs @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Existing storage account input. + public partial class ExistingStorageAccount : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExistingStorageAccount, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExistingStorageAccountInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageAccountCustomDetails __storageAccountCustomDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.StorageAccountCustomDetails(); + + /// Backing field for property. + private string _azureStorageAccountId; + + /// The storage account Arm Id. Throw error, if resource does not exists. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string AzureStorageAccountId { get => this._azureStorageAccountId; set => this._azureStorageAccountId = value; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string ResourceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageAccountCustomDetailsInternal)__storageAccountCustomDetails).ResourceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageAccountCustomDetailsInternal)__storageAccountCustomDetails).ResourceType = value ; } + + /// Creates an new instance. + public ExistingStorageAccount() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__storageAccountCustomDetails), __storageAccountCustomDetails); + await eventListener.AssertObjectIsValid(nameof(__storageAccountCustomDetails), __storageAccountCustomDetails); + } + } + /// Existing storage account input. + public partial interface IExistingStorageAccount : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageAccountCustomDetails + { + /// The storage account Arm Id. Throw error, if resource does not exists. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The storage account Arm Id. Throw error, if resource does not exists.", + SerializedName = @"azureStorageAccountId", + PossibleTypes = new [] { typeof(string) })] + string AzureStorageAccountId { get; set; } + + } + /// Existing storage account input. + internal partial interface IExistingStorageAccountInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageAccountCustomDetailsInternal + { + /// The storage account Arm Id. Throw error, if resource does not exists. + string AzureStorageAccountId { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ExistingStorageAccount.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ExistingStorageAccount.json.cs new file mode 100644 index 000000000000..c2d75f0b9fb6 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ExistingStorageAccount.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Existing storage account input. + public partial class ExistingStorageAccount + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal ExistingStorageAccount(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __storageAccountCustomDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.StorageAccountCustomDetails(json); + {_azureStorageAccountId = If( json?.PropertyT("azureStorageAccountId"), out var __jsonAzureStorageAccountId) ? (string)__jsonAzureStorageAccountId : (string)AzureStorageAccountId;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExistingStorageAccount. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExistingStorageAccount. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExistingStorageAccount FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new ExistingStorageAccount(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __storageAccountCustomDetails?.ToJson(container, serializationMode); + AddIf( null != (((object)this._azureStorageAccountId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._azureStorageAccountId.ToString()) : null, "azureStorageAccountId" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ExportJobDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ExportJobDetails.PowerShell.cs new file mode 100644 index 000000000000..cb1ab8949391 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ExportJobDetails.PowerShell.cs @@ -0,0 +1,168 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// This class represents details for export jobs workflow. + [System.ComponentModel.TypeConverter(typeof(ExportJobDetailsTypeConverter))] + public partial class ExportJobDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExportJobDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ExportJobDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExportJobDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ExportJobDetails(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ExportJobDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("BlobUri")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExportJobDetailsInternal)this).BlobUri = (string) content.GetValueForProperty("BlobUri",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExportJobDetailsInternal)this).BlobUri, global::System.Convert.ToString); + } + if (content.Contains("SasToken")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExportJobDetailsInternal)this).SasToken = (string) content.GetValueForProperty("SasToken",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExportJobDetailsInternal)this).SasToken, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + if (content.Contains("AffectedObjectDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsInternal)this).AffectedObjectDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsAffectedObjectDetails) content.GetValueForProperty("AffectedObjectDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsInternal)this).AffectedObjectDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.JobDetailsAffectedObjectDetailsTypeConverter.ConvertFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ExportJobDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("BlobUri")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExportJobDetailsInternal)this).BlobUri = (string) content.GetValueForProperty("BlobUri",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExportJobDetailsInternal)this).BlobUri, global::System.Convert.ToString); + } + if (content.Contains("SasToken")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExportJobDetailsInternal)this).SasToken = (string) content.GetValueForProperty("SasToken",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExportJobDetailsInternal)this).SasToken, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + if (content.Contains("AffectedObjectDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsInternal)this).AffectedObjectDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsAffectedObjectDetails) content.GetValueForProperty("AffectedObjectDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsInternal)this).AffectedObjectDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.JobDetailsAffectedObjectDetailsTypeConverter.ConvertFrom); + } + AfterDeserializePSObject(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExportJobDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// This class represents details for export jobs workflow. + [System.ComponentModel.TypeConverter(typeof(ExportJobDetailsTypeConverter))] + public partial interface IExportJobDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ExportJobDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ExportJobDetails.TypeConverter.cs new file mode 100644 index 000000000000..ff2af37ef60c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ExportJobDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ExportJobDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExportJobDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExportJobDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ExportJobDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ExportJobDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ExportJobDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ExportJobDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ExportJobDetails.cs new file mode 100644 index 000000000000..5871d0522008 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ExportJobDetails.cs @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// This class represents details for export jobs workflow. + public partial class ExportJobDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExportJobDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExportJobDetailsInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetails __jobDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.JobDetails(); + + /// + /// The affected object properties like source server, source cloud, target server, target cloud etc. based on the workflow + /// object details. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsAffectedObjectDetails AffectedObjectDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsInternal)__jobDetails).AffectedObjectDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsInternal)__jobDetails).AffectedObjectDetail = value ?? null /* model class */; } + + /// Backing field for property. + private string _blobUri; + + /// BlobUri of the exported jobs. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string BlobUri { get => this._blobUri; set => this._blobUri = value; } + + /// Gets the type of job details (see JobDetailsTypes enum for possible values). + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsInternal)__jobDetails).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsInternal)__jobDetails).InstanceType = value ; } + + /// Backing field for property. + private string _sasToken; + + /// The sas token to access blob. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string SasToken { get => this._sasToken; set => this._sasToken = value; } + + /// Creates an new instance. + public ExportJobDetails() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__jobDetails), __jobDetails); + await eventListener.AssertObjectIsValid(nameof(__jobDetails), __jobDetails); + } + } + /// This class represents details for export jobs workflow. + public partial interface IExportJobDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetails + { + /// BlobUri of the exported jobs. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"BlobUri of the exported jobs.", + SerializedName = @"blobUri", + PossibleTypes = new [] { typeof(string) })] + string BlobUri { get; set; } + /// The sas token to access blob. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The sas token to access blob.", + SerializedName = @"sasToken", + PossibleTypes = new [] { typeof(string) })] + string SasToken { get; set; } + + } + /// This class represents details for export jobs workflow. + internal partial interface IExportJobDetailsInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsInternal + { + /// BlobUri of the exported jobs. + string BlobUri { get; set; } + /// The sas token to access blob. + string SasToken { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ExportJobDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ExportJobDetails.json.cs new file mode 100644 index 000000000000..69f8edde116e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ExportJobDetails.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// This class represents details for export jobs workflow. + public partial class ExportJobDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal ExportJobDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __jobDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.JobDetails(json); + {_blobUri = If( json?.PropertyT("blobUri"), out var __jsonBlobUri) ? (string)__jsonBlobUri : (string)BlobUri;} + {_sasToken = If( json?.PropertyT("sasToken"), out var __jsonSasToken) ? (string)__jsonSasToken : (string)SasToken;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExportJobDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExportJobDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExportJobDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new ExportJobDetails(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __jobDetails?.ToJson(container, serializationMode); + AddIf( null != (((object)this._blobUri)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._blobUri.ToString()) : null, "blobUri" ,container.Add ); + AddIf( null != (((object)this._sasToken)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._sasToken.ToString()) : null, "sasToken" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ExtendedLocation.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ExtendedLocation.PowerShell.cs new file mode 100644 index 000000000000..c77961697341 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ExtendedLocation.PowerShell.cs @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Extended location of the resource. + [System.ComponentModel.TypeConverter(typeof(ExtendedLocationTypeConverter))] + public partial class ExtendedLocation + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocation DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ExtendedLocation(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocation DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ExtendedLocation(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ExtendedLocation(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocationInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocationInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocationInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocationInternal)this).Type, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ExtendedLocation(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocationInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocationInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocationInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocationInternal)this).Type, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocation FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Extended location of the resource. + [System.ComponentModel.TypeConverter(typeof(ExtendedLocationTypeConverter))] + public partial interface IExtendedLocation + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ExtendedLocation.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ExtendedLocation.TypeConverter.cs new file mode 100644 index 000000000000..77ab4364e5ed --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ExtendedLocation.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ExtendedLocationTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocation ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocation).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ExtendedLocation.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ExtendedLocation.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ExtendedLocation.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ExtendedLocation.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ExtendedLocation.cs new file mode 100644 index 000000000000..c94c9e82b260 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ExtendedLocation.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Extended location of the resource. + public partial class ExtendedLocation : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocation, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocationInternal + { + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocationInternal.Type { get => this._type; set { {_type = value;} } } + + /// Backing field for property. + private string _name; + + /// The name of the extended location. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Name { get => this._name; set => this._name = value; } + + /// Backing field for property. + private string _type= @"EdgeZone"; + + /// The extended location type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Type { get => this._type; } + + /// Creates an new instance. + public ExtendedLocation() + { + + } + } + /// Extended location of the resource. + public partial interface IExtendedLocation : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The name of the extended location. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the extended location.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string Name { get; set; } + /// The extended location type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = true, + Description = @"The extended location type.", + SerializedName = @"type", + PossibleTypes = new [] { typeof(string) })] + string Type { get; } + + } + /// Extended location of the resource. + internal partial interface IExtendedLocationInternal + + { + /// The name of the extended location. + string Name { get; set; } + /// The extended location type. + string Type { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ExtendedLocation.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ExtendedLocation.json.cs new file mode 100644 index 000000000000..3eac9752a01a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ExtendedLocation.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Extended location of the resource. + public partial class ExtendedLocation + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal ExtendedLocation(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)Name;} + {_type = If( json?.PropertyT("type"), out var __jsonType) ? (string)__jsonType : (string)Type;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocation. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocation. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocation FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new ExtendedLocation(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); + AddIf( null != (((object)this._type)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._type.ToString()) : null, "type" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Fabric.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Fabric.PowerShell.cs new file mode 100644 index 000000000000..27d6854fb35b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Fabric.PowerShell.cs @@ -0,0 +1,296 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Fabric definition. + [System.ComponentModel.TypeConverter(typeof(FabricTypeConverter))] + public partial class Fabric + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabric DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new Fabric(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabric DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new Fabric(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal Fabric(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FabricPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("EncryptionDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricInternal)this).EncryptionDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEncryptionDetails) content.GetValueForProperty("EncryptionDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricInternal)this).EncryptionDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EncryptionDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("RolloverEncryptionDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricInternal)this).RolloverEncryptionDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEncryptionDetails) content.GetValueForProperty("RolloverEncryptionDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricInternal)this).RolloverEncryptionDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EncryptionDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("CustomDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricInternal)this).CustomDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificDetails) content.GetValueForProperty("CustomDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricInternal)this).CustomDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FabricSpecificDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("FriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricInternal)this).FriendlyName = (string) content.GetValueForProperty("FriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricInternal)this).FriendlyName, global::System.Convert.ToString); + } + if (content.Contains("InternalIdentifier")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricInternal)this).InternalIdentifier = (string) content.GetValueForProperty("InternalIdentifier",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricInternal)this).InternalIdentifier, global::System.Convert.ToString); + } + if (content.Contains("BcdrState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricInternal)this).BcdrState = (string) content.GetValueForProperty("BcdrState",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricInternal)this).BcdrState, global::System.Convert.ToString); + } + if (content.Contains("HealthErrorDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricInternal)this).HealthErrorDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[]) content.GetValueForProperty("HealthErrorDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricInternal)this).HealthErrorDetail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("Health")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricInternal)this).Health = (string) content.GetValueForProperty("Health",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricInternal)this).Health, global::System.Convert.ToString); + } + if (content.Contains("EncryptionDetailKekState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricInternal)this).EncryptionDetailKekState = (string) content.GetValueForProperty("EncryptionDetailKekState",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricInternal)this).EncryptionDetailKekState, global::System.Convert.ToString); + } + if (content.Contains("EncryptionDetailKekCertThumbprint")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricInternal)this).EncryptionDetailKekCertThumbprint = (string) content.GetValueForProperty("EncryptionDetailKekCertThumbprint",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricInternal)this).EncryptionDetailKekCertThumbprint, global::System.Convert.ToString); + } + if (content.Contains("EncryptionDetailKekCertExpiryDate")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricInternal)this).EncryptionDetailKekCertExpiryDate = (global::System.DateTime?) content.GetValueForProperty("EncryptionDetailKekCertExpiryDate",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricInternal)this).EncryptionDetailKekCertExpiryDate, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("RolloverEncryptionDetailKekState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricInternal)this).RolloverEncryptionDetailKekState = (string) content.GetValueForProperty("RolloverEncryptionDetailKekState",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricInternal)this).RolloverEncryptionDetailKekState, global::System.Convert.ToString); + } + if (content.Contains("RolloverEncryptionDetailKekCertThumbprint")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricInternal)this).RolloverEncryptionDetailKekCertThumbprint = (string) content.GetValueForProperty("RolloverEncryptionDetailKekCertThumbprint",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricInternal)this).RolloverEncryptionDetailKekCertThumbprint, global::System.Convert.ToString); + } + if (content.Contains("RolloverEncryptionDetailKekCertExpiryDate")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricInternal)this).RolloverEncryptionDetailKekCertExpiryDate = (global::System.DateTime?) content.GetValueForProperty("RolloverEncryptionDetailKekCertExpiryDate",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricInternal)this).RolloverEncryptionDetailKekCertExpiryDate, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("CustomDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricInternal)this).CustomDetailInstanceType = (string) content.GetValueForProperty("CustomDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricInternal)this).CustomDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal Fabric(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FabricPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("EncryptionDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricInternal)this).EncryptionDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEncryptionDetails) content.GetValueForProperty("EncryptionDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricInternal)this).EncryptionDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EncryptionDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("RolloverEncryptionDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricInternal)this).RolloverEncryptionDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEncryptionDetails) content.GetValueForProperty("RolloverEncryptionDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricInternal)this).RolloverEncryptionDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EncryptionDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("CustomDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricInternal)this).CustomDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificDetails) content.GetValueForProperty("CustomDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricInternal)this).CustomDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FabricSpecificDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("FriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricInternal)this).FriendlyName = (string) content.GetValueForProperty("FriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricInternal)this).FriendlyName, global::System.Convert.ToString); + } + if (content.Contains("InternalIdentifier")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricInternal)this).InternalIdentifier = (string) content.GetValueForProperty("InternalIdentifier",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricInternal)this).InternalIdentifier, global::System.Convert.ToString); + } + if (content.Contains("BcdrState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricInternal)this).BcdrState = (string) content.GetValueForProperty("BcdrState",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricInternal)this).BcdrState, global::System.Convert.ToString); + } + if (content.Contains("HealthErrorDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricInternal)this).HealthErrorDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[]) content.GetValueForProperty("HealthErrorDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricInternal)this).HealthErrorDetail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("Health")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricInternal)this).Health = (string) content.GetValueForProperty("Health",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricInternal)this).Health, global::System.Convert.ToString); + } + if (content.Contains("EncryptionDetailKekState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricInternal)this).EncryptionDetailKekState = (string) content.GetValueForProperty("EncryptionDetailKekState",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricInternal)this).EncryptionDetailKekState, global::System.Convert.ToString); + } + if (content.Contains("EncryptionDetailKekCertThumbprint")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricInternal)this).EncryptionDetailKekCertThumbprint = (string) content.GetValueForProperty("EncryptionDetailKekCertThumbprint",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricInternal)this).EncryptionDetailKekCertThumbprint, global::System.Convert.ToString); + } + if (content.Contains("EncryptionDetailKekCertExpiryDate")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricInternal)this).EncryptionDetailKekCertExpiryDate = (global::System.DateTime?) content.GetValueForProperty("EncryptionDetailKekCertExpiryDate",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricInternal)this).EncryptionDetailKekCertExpiryDate, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("RolloverEncryptionDetailKekState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricInternal)this).RolloverEncryptionDetailKekState = (string) content.GetValueForProperty("RolloverEncryptionDetailKekState",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricInternal)this).RolloverEncryptionDetailKekState, global::System.Convert.ToString); + } + if (content.Contains("RolloverEncryptionDetailKekCertThumbprint")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricInternal)this).RolloverEncryptionDetailKekCertThumbprint = (string) content.GetValueForProperty("RolloverEncryptionDetailKekCertThumbprint",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricInternal)this).RolloverEncryptionDetailKekCertThumbprint, global::System.Convert.ToString); + } + if (content.Contains("RolloverEncryptionDetailKekCertExpiryDate")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricInternal)this).RolloverEncryptionDetailKekCertExpiryDate = (global::System.DateTime?) content.GetValueForProperty("RolloverEncryptionDetailKekCertExpiryDate",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricInternal)this).RolloverEncryptionDetailKekCertExpiryDate, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("CustomDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricInternal)this).CustomDetailInstanceType = (string) content.GetValueForProperty("CustomDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricInternal)this).CustomDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabric FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Fabric definition. + [System.ComponentModel.TypeConverter(typeof(FabricTypeConverter))] + public partial interface IFabric + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Fabric.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Fabric.TypeConverter.cs new file mode 100644 index 000000000000..5d4ad507c901 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Fabric.TypeConverter.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class FabricTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabric ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabric).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return Fabric.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return Fabric.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return Fabric.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Fabric.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Fabric.cs new file mode 100644 index 000000000000..8cbcb69fc94f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Fabric.cs @@ -0,0 +1,273 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Fabric definition. + public partial class Fabric : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabric, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResource __resource = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.Resource(); + + /// BCDR state of the fabric. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string BcdrState { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricPropertiesInternal)Property).BcdrState; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricPropertiesInternal)Property).BcdrState = value ?? null; } + + /// Gets the class type. Overridden in derived classes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string CustomDetailInstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricPropertiesInternal)Property).CustomDetailInstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricPropertiesInternal)Property).CustomDetailInstanceType = value ?? null; } + + /// The key encryption key certificate expiry date. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public global::System.DateTime? EncryptionDetailKekCertExpiryDate { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricPropertiesInternal)Property).EncryptionDetailKekCertExpiryDate; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricPropertiesInternal)Property).EncryptionDetailKekCertExpiryDate = value ?? default(global::System.DateTime); } + + /// The key encryption key certificate thumbprint. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string EncryptionDetailKekCertThumbprint { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricPropertiesInternal)Property).EncryptionDetailKekCertThumbprint; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricPropertiesInternal)Property).EncryptionDetailKekCertThumbprint = value ?? null; } + + /// The key encryption key state for the Vmm. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string EncryptionDetailKekState { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricPropertiesInternal)Property).EncryptionDetailKekState; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricPropertiesInternal)Property).EncryptionDetailKekState = value ?? null; } + + /// Friendly name of the fabric. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string FriendlyName { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricPropertiesInternal)Property).FriendlyName; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricPropertiesInternal)Property).FriendlyName = value ?? null; } + + /// Health of fabric. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string Health { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricPropertiesInternal)Property).Health; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricPropertiesInternal)Property).Health = value ?? null; } + + /// Fabric health error details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] HealthErrorDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricPropertiesInternal)Property).HealthErrorDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricPropertiesInternal)Property).HealthErrorDetail = value ?? null /* arrayOf */; } + + /// Resource Id + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Id; } + + /// Dra Registration Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string InternalIdentifier { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricPropertiesInternal)Property).InternalIdentifier; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricPropertiesInternal)Property).InternalIdentifier = value ?? null; } + + /// Resource Location + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string Location { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Location; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Location = value ?? null; } + + /// Internal Acessors for CustomDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificDetails Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricInternal.CustomDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricPropertiesInternal)Property).CustomDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricPropertiesInternal)Property).CustomDetail = value; } + + /// Internal Acessors for EncryptionDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEncryptionDetails Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricInternal.EncryptionDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricPropertiesInternal)Property).EncryptionDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricPropertiesInternal)Property).EncryptionDetail = value; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricProperties Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FabricProperties()); set { {_property = value;} } } + + /// Internal Acessors for RolloverEncryptionDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEncryptionDetails Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricInternal.RolloverEncryptionDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricPropertiesInternal)Property).RolloverEncryptionDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricPropertiesInternal)Property).RolloverEncryptionDetail = value; } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Id = value; } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Name = value; } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Type = value; } + + /// Resource Name + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Name; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricProperties _property; + + /// Fabric related data. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FabricProperties()); set => this._property = value; } + + /// The key encryption key certificate expiry date. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public global::System.DateTime? RolloverEncryptionDetailKekCertExpiryDate { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricPropertiesInternal)Property).RolloverEncryptionDetailKekCertExpiryDate; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricPropertiesInternal)Property).RolloverEncryptionDetailKekCertExpiryDate = value ?? default(global::System.DateTime); } + + /// The key encryption key certificate thumbprint. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string RolloverEncryptionDetailKekCertThumbprint { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricPropertiesInternal)Property).RolloverEncryptionDetailKekCertThumbprint; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricPropertiesInternal)Property).RolloverEncryptionDetailKekCertThumbprint = value ?? null; } + + /// The key encryption key state for the Vmm. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string RolloverEncryptionDetailKekState { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricPropertiesInternal)Property).RolloverEncryptionDetailKekState; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricPropertiesInternal)Property).RolloverEncryptionDetailKekState = value ?? null; } + + /// Resource Type + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Type; } + + /// Creates an new instance. + public Fabric() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__resource), __resource); + await eventListener.AssertObjectIsValid(nameof(__resource), __resource); + } + } + /// Fabric definition. + public partial interface IFabric : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResource + { + /// BCDR state of the fabric. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"BCDR state of the fabric.", + SerializedName = @"bcdrState", + PossibleTypes = new [] { typeof(string) })] + string BcdrState { get; set; } + /// Gets the class type. Overridden in derived classes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets the class type. Overridden in derived classes.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string CustomDetailInstanceType { get; set; } + /// The key encryption key certificate expiry date. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The key encryption key certificate expiry date.", + SerializedName = @"kekCertExpiryDate", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? EncryptionDetailKekCertExpiryDate { get; set; } + /// The key encryption key certificate thumbprint. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The key encryption key certificate thumbprint.", + SerializedName = @"kekCertThumbprint", + PossibleTypes = new [] { typeof(string) })] + string EncryptionDetailKekCertThumbprint { get; set; } + /// The key encryption key state for the Vmm. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The key encryption key state for the Vmm.", + SerializedName = @"kekState", + PossibleTypes = new [] { typeof(string) })] + string EncryptionDetailKekState { get; set; } + /// Friendly name of the fabric. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Friendly name of the fabric.", + SerializedName = @"friendlyName", + PossibleTypes = new [] { typeof(string) })] + string FriendlyName { get; set; } + /// Health of fabric. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Health of fabric.", + SerializedName = @"health", + PossibleTypes = new [] { typeof(string) })] + string Health { get; set; } + /// Fabric health error details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Fabric health error details.", + SerializedName = @"healthErrorDetails", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] HealthErrorDetail { get; set; } + /// Dra Registration Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Dra Registration Id.", + SerializedName = @"internalIdentifier", + PossibleTypes = new [] { typeof(string) })] + string InternalIdentifier { get; set; } + /// The key encryption key certificate expiry date. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The key encryption key certificate expiry date.", + SerializedName = @"kekCertExpiryDate", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? RolloverEncryptionDetailKekCertExpiryDate { get; set; } + /// The key encryption key certificate thumbprint. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The key encryption key certificate thumbprint.", + SerializedName = @"kekCertThumbprint", + PossibleTypes = new [] { typeof(string) })] + string RolloverEncryptionDetailKekCertThumbprint { get; set; } + /// The key encryption key state for the Vmm. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The key encryption key state for the Vmm.", + SerializedName = @"kekState", + PossibleTypes = new [] { typeof(string) })] + string RolloverEncryptionDetailKekState { get; set; } + + } + /// Fabric definition. + internal partial interface IFabricInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal + { + /// BCDR state of the fabric. + string BcdrState { get; set; } + /// Fabric specific settings. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificDetails CustomDetail { get; set; } + /// Gets the class type. Overridden in derived classes. + string CustomDetailInstanceType { get; set; } + /// Encryption details for the fabric. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEncryptionDetails EncryptionDetail { get; set; } + /// The key encryption key certificate expiry date. + global::System.DateTime? EncryptionDetailKekCertExpiryDate { get; set; } + /// The key encryption key certificate thumbprint. + string EncryptionDetailKekCertThumbprint { get; set; } + /// The key encryption key state for the Vmm. + string EncryptionDetailKekState { get; set; } + /// Friendly name of the fabric. + string FriendlyName { get; set; } + /// Health of fabric. + string Health { get; set; } + /// Fabric health error details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] HealthErrorDetail { get; set; } + /// Dra Registration Id. + string InternalIdentifier { get; set; } + /// Fabric related data. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricProperties Property { get; set; } + /// Rollover encryption details for the fabric. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEncryptionDetails RolloverEncryptionDetail { get; set; } + /// The key encryption key certificate expiry date. + global::System.DateTime? RolloverEncryptionDetailKekCertExpiryDate { get; set; } + /// The key encryption key certificate thumbprint. + string RolloverEncryptionDetailKekCertThumbprint { get; set; } + /// The key encryption key state for the Vmm. + string RolloverEncryptionDetailKekState { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Fabric.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Fabric.json.cs new file mode 100644 index 000000000000..ea5aff16dc67 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Fabric.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Fabric definition. + public partial class Fabric + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal Fabric(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __resource = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.Resource(json); + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FabricProperties.FromJson(__jsonProperties) : Property;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabric. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabric. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabric FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new Fabric(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __resource?.ToJson(container, serializationMode); + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricCollection.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricCollection.PowerShell.cs new file mode 100644 index 000000000000..48b0ab4cd0bf --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricCollection.PowerShell.cs @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Collection of fabric details. + [System.ComponentModel.TypeConverter(typeof(FabricCollectionTypeConverter))] + public partial class FabricCollection + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricCollection DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new FabricCollection(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricCollection DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new FabricCollection(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal FabricCollection(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabric[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FabricTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricCollectionInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricCollectionInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal FabricCollection(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabric[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FabricTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricCollectionInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricCollectionInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricCollection FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Collection of fabric details. + [System.ComponentModel.TypeConverter(typeof(FabricCollectionTypeConverter))] + public partial interface IFabricCollection + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricCollection.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricCollection.TypeConverter.cs new file mode 100644 index 000000000000..44079ed5f5fa --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricCollection.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class FabricCollectionTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricCollection ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricCollection).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return FabricCollection.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return FabricCollection.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return FabricCollection.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricCollection.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricCollection.cs new file mode 100644 index 000000000000..28e75c8d7c44 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricCollection.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Collection of fabric details. + public partial class FabricCollection : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricCollection, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricCollectionInternal + { + + /// Backing field for property. + private string _nextLink; + + /// The value of next link. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string NextLink { get => this._nextLink; set => this._nextLink = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabric[] _value; + + /// The fabric details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabric[] Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public FabricCollection() + { + + } + } + /// Collection of fabric details. + public partial interface IFabricCollection : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The value of next link. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The value of next link.", + SerializedName = @"nextLink", + PossibleTypes = new [] { typeof(string) })] + string NextLink { get; set; } + /// The fabric details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The fabric details.", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabric) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabric[] Value { get; set; } + + } + /// Collection of fabric details. + internal partial interface IFabricCollectionInternal + + { + /// The value of next link. + string NextLink { get; set; } + /// The fabric details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabric[] Value { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricCollection.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricCollection.json.cs new file mode 100644 index 000000000000..eb1f15463795 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricCollection.json.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Collection of fabric details. + public partial class FabricCollection + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal FabricCollection(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabric) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.Fabric.FromJson(__u) )) ))() : null : Value;} + {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)NextLink;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricCollection. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricCollection. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricCollection FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new FabricCollection(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._value) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._value ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("value",__w); + } + AddIf( null != (((object)this._nextLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricCreationInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricCreationInput.PowerShell.cs new file mode 100644 index 000000000000..fb2afed1912f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricCreationInput.PowerShell.cs @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Site details provided during the time of site creation. + [System.ComponentModel.TypeConverter(typeof(FabricCreationInputTypeConverter))] + public partial class FabricCreationInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricCreationInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new FabricCreationInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricCreationInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new FabricCreationInput(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal FabricCreationInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricCreationInputInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricCreationInputProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricCreationInputInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FabricCreationInputPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("CustomDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricCreationInputInternal)this).CustomDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreationInput) content.GetValueForProperty("CustomDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricCreationInputInternal)this).CustomDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FabricSpecificCreationInputTypeConverter.ConvertFrom); + } + if (content.Contains("CustomDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricCreationInputInternal)this).CustomDetailInstanceType = (string) content.GetValueForProperty("CustomDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricCreationInputInternal)this).CustomDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal FabricCreationInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricCreationInputInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricCreationInputProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricCreationInputInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FabricCreationInputPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("CustomDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricCreationInputInternal)this).CustomDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreationInput) content.GetValueForProperty("CustomDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricCreationInputInternal)this).CustomDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FabricSpecificCreationInputTypeConverter.ConvertFrom); + } + if (content.Contains("CustomDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricCreationInputInternal)this).CustomDetailInstanceType = (string) content.GetValueForProperty("CustomDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricCreationInputInternal)this).CustomDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricCreationInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Site details provided during the time of site creation. + [System.ComponentModel.TypeConverter(typeof(FabricCreationInputTypeConverter))] + public partial interface IFabricCreationInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricCreationInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricCreationInput.TypeConverter.cs new file mode 100644 index 000000000000..113832ac6d84 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricCreationInput.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class FabricCreationInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricCreationInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricCreationInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return FabricCreationInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return FabricCreationInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return FabricCreationInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricCreationInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricCreationInput.cs new file mode 100644 index 000000000000..258d7049b448 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricCreationInput.cs @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Site details provided during the time of site creation. + public partial class FabricCreationInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricCreationInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricCreationInputInternal + { + + /// Gets the class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string CustomDetailInstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricCreationInputPropertiesInternal)Property).CustomDetailInstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricCreationInputPropertiesInternal)Property).CustomDetailInstanceType = value ?? null; } + + /// Internal Acessors for CustomDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreationInput Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricCreationInputInternal.CustomDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricCreationInputPropertiesInternal)Property).CustomDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricCreationInputPropertiesInternal)Property).CustomDetail = value; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricCreationInputProperties Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricCreationInputInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FabricCreationInputProperties()); set { {_property = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricCreationInputProperties _property; + + /// Fabric creation input. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricCreationInputProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FabricCreationInputProperties()); set => this._property = value; } + + /// Creates an new instance. + public FabricCreationInput() + { + + } + } + /// Site details provided during the time of site creation. + public partial interface IFabricCreationInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// Gets the class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets the class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string CustomDetailInstanceType { get; set; } + + } + /// Site details provided during the time of site creation. + internal partial interface IFabricCreationInputInternal + + { + /// Fabric provider specific creation input. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreationInput CustomDetail { get; set; } + /// Gets the class type. + string CustomDetailInstanceType { get; set; } + /// Fabric creation input. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricCreationInputProperties Property { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricCreationInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricCreationInput.json.cs new file mode 100644 index 000000000000..57178c341c88 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricCreationInput.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Site details provided during the time of site creation. + public partial class FabricCreationInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal FabricCreationInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FabricCreationInputProperties.FromJson(__jsonProperties) : Property;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricCreationInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricCreationInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricCreationInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new FabricCreationInput(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricCreationInputProperties.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricCreationInputProperties.PowerShell.cs new file mode 100644 index 000000000000..912ba3a0da81 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricCreationInputProperties.PowerShell.cs @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Properties of site details provided during the time of site creation. + [System.ComponentModel.TypeConverter(typeof(FabricCreationInputPropertiesTypeConverter))] + public partial class FabricCreationInputProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricCreationInputProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new FabricCreationInputProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricCreationInputProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new FabricCreationInputProperties(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal FabricCreationInputProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CustomDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricCreationInputPropertiesInternal)this).CustomDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreationInput) content.GetValueForProperty("CustomDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricCreationInputPropertiesInternal)this).CustomDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FabricSpecificCreationInputTypeConverter.ConvertFrom); + } + if (content.Contains("CustomDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricCreationInputPropertiesInternal)this).CustomDetailInstanceType = (string) content.GetValueForProperty("CustomDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricCreationInputPropertiesInternal)this).CustomDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal FabricCreationInputProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CustomDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricCreationInputPropertiesInternal)this).CustomDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreationInput) content.GetValueForProperty("CustomDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricCreationInputPropertiesInternal)this).CustomDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FabricSpecificCreationInputTypeConverter.ConvertFrom); + } + if (content.Contains("CustomDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricCreationInputPropertiesInternal)this).CustomDetailInstanceType = (string) content.GetValueForProperty("CustomDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricCreationInputPropertiesInternal)this).CustomDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricCreationInputProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Properties of site details provided during the time of site creation. + [System.ComponentModel.TypeConverter(typeof(FabricCreationInputPropertiesTypeConverter))] + public partial interface IFabricCreationInputProperties + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricCreationInputProperties.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricCreationInputProperties.TypeConverter.cs new file mode 100644 index 000000000000..972be5f3b1be --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricCreationInputProperties.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class FabricCreationInputPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricCreationInputProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricCreationInputProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return FabricCreationInputProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return FabricCreationInputProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return FabricCreationInputProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricCreationInputProperties.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricCreationInputProperties.cs new file mode 100644 index 000000000000..9ec77d3dcfea --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricCreationInputProperties.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Properties of site details provided during the time of site creation. + public partial class FabricCreationInputProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricCreationInputProperties, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricCreationInputPropertiesInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreationInput _customDetail; + + /// Fabric provider specific creation input. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreationInput CustomDetail { get => (this._customDetail = this._customDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FabricSpecificCreationInput()); set => this._customDetail = value; } + + /// Gets the class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string CustomDetailInstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreationInputInternal)CustomDetail).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreationInputInternal)CustomDetail).InstanceType = value ?? null; } + + /// Internal Acessors for CustomDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreationInput Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricCreationInputPropertiesInternal.CustomDetail { get => (this._customDetail = this._customDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FabricSpecificCreationInput()); set { {_customDetail = value;} } } + + /// Creates an new instance. + public FabricCreationInputProperties() + { + + } + } + /// Properties of site details provided during the time of site creation. + public partial interface IFabricCreationInputProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// Gets the class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets the class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string CustomDetailInstanceType { get; set; } + + } + /// Properties of site details provided during the time of site creation. + internal partial interface IFabricCreationInputPropertiesInternal + + { + /// Fabric provider specific creation input. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreationInput CustomDetail { get; set; } + /// Gets the class type. + string CustomDetailInstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricCreationInputProperties.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricCreationInputProperties.json.cs new file mode 100644 index 000000000000..dca684f24a38 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricCreationInputProperties.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Properties of site details provided during the time of site creation. + public partial class FabricCreationInputProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal FabricCreationInputProperties(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_customDetail = If( json?.PropertyT("customDetails"), out var __jsonCustomDetails) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FabricSpecificCreationInput.FromJson(__jsonCustomDetails) : CustomDetail;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricCreationInputProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricCreationInputProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricCreationInputProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new FabricCreationInputProperties(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._customDetail ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._customDetail.ToJson(null,serializationMode) : null, "customDetails" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricProperties.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricProperties.PowerShell.cs new file mode 100644 index 000000000000..b062241ee7a2 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricProperties.PowerShell.cs @@ -0,0 +1,256 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Fabric properties. + [System.ComponentModel.TypeConverter(typeof(FabricPropertiesTypeConverter))] + public partial class FabricProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new FabricProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new FabricProperties(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal FabricProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("EncryptionDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricPropertiesInternal)this).EncryptionDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEncryptionDetails) content.GetValueForProperty("EncryptionDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricPropertiesInternal)this).EncryptionDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EncryptionDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("RolloverEncryptionDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricPropertiesInternal)this).RolloverEncryptionDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEncryptionDetails) content.GetValueForProperty("RolloverEncryptionDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricPropertiesInternal)this).RolloverEncryptionDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EncryptionDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("CustomDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricPropertiesInternal)this).CustomDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificDetails) content.GetValueForProperty("CustomDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricPropertiesInternal)this).CustomDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FabricSpecificDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("FriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricPropertiesInternal)this).FriendlyName = (string) content.GetValueForProperty("FriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricPropertiesInternal)this).FriendlyName, global::System.Convert.ToString); + } + if (content.Contains("InternalIdentifier")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricPropertiesInternal)this).InternalIdentifier = (string) content.GetValueForProperty("InternalIdentifier",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricPropertiesInternal)this).InternalIdentifier, global::System.Convert.ToString); + } + if (content.Contains("BcdrState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricPropertiesInternal)this).BcdrState = (string) content.GetValueForProperty("BcdrState",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricPropertiesInternal)this).BcdrState, global::System.Convert.ToString); + } + if (content.Contains("HealthErrorDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricPropertiesInternal)this).HealthErrorDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[]) content.GetValueForProperty("HealthErrorDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricPropertiesInternal)this).HealthErrorDetail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("Health")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricPropertiesInternal)this).Health = (string) content.GetValueForProperty("Health",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricPropertiesInternal)this).Health, global::System.Convert.ToString); + } + if (content.Contains("EncryptionDetailKekState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricPropertiesInternal)this).EncryptionDetailKekState = (string) content.GetValueForProperty("EncryptionDetailKekState",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricPropertiesInternal)this).EncryptionDetailKekState, global::System.Convert.ToString); + } + if (content.Contains("EncryptionDetailKekCertThumbprint")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricPropertiesInternal)this).EncryptionDetailKekCertThumbprint = (string) content.GetValueForProperty("EncryptionDetailKekCertThumbprint",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricPropertiesInternal)this).EncryptionDetailKekCertThumbprint, global::System.Convert.ToString); + } + if (content.Contains("EncryptionDetailKekCertExpiryDate")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricPropertiesInternal)this).EncryptionDetailKekCertExpiryDate = (global::System.DateTime?) content.GetValueForProperty("EncryptionDetailKekCertExpiryDate",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricPropertiesInternal)this).EncryptionDetailKekCertExpiryDate, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("RolloverEncryptionDetailKekState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricPropertiesInternal)this).RolloverEncryptionDetailKekState = (string) content.GetValueForProperty("RolloverEncryptionDetailKekState",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricPropertiesInternal)this).RolloverEncryptionDetailKekState, global::System.Convert.ToString); + } + if (content.Contains("RolloverEncryptionDetailKekCertThumbprint")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricPropertiesInternal)this).RolloverEncryptionDetailKekCertThumbprint = (string) content.GetValueForProperty("RolloverEncryptionDetailKekCertThumbprint",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricPropertiesInternal)this).RolloverEncryptionDetailKekCertThumbprint, global::System.Convert.ToString); + } + if (content.Contains("RolloverEncryptionDetailKekCertExpiryDate")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricPropertiesInternal)this).RolloverEncryptionDetailKekCertExpiryDate = (global::System.DateTime?) content.GetValueForProperty("RolloverEncryptionDetailKekCertExpiryDate",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricPropertiesInternal)this).RolloverEncryptionDetailKekCertExpiryDate, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("CustomDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricPropertiesInternal)this).CustomDetailInstanceType = (string) content.GetValueForProperty("CustomDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricPropertiesInternal)this).CustomDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal FabricProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("EncryptionDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricPropertiesInternal)this).EncryptionDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEncryptionDetails) content.GetValueForProperty("EncryptionDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricPropertiesInternal)this).EncryptionDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EncryptionDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("RolloverEncryptionDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricPropertiesInternal)this).RolloverEncryptionDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEncryptionDetails) content.GetValueForProperty("RolloverEncryptionDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricPropertiesInternal)this).RolloverEncryptionDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EncryptionDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("CustomDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricPropertiesInternal)this).CustomDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificDetails) content.GetValueForProperty("CustomDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricPropertiesInternal)this).CustomDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FabricSpecificDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("FriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricPropertiesInternal)this).FriendlyName = (string) content.GetValueForProperty("FriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricPropertiesInternal)this).FriendlyName, global::System.Convert.ToString); + } + if (content.Contains("InternalIdentifier")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricPropertiesInternal)this).InternalIdentifier = (string) content.GetValueForProperty("InternalIdentifier",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricPropertiesInternal)this).InternalIdentifier, global::System.Convert.ToString); + } + if (content.Contains("BcdrState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricPropertiesInternal)this).BcdrState = (string) content.GetValueForProperty("BcdrState",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricPropertiesInternal)this).BcdrState, global::System.Convert.ToString); + } + if (content.Contains("HealthErrorDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricPropertiesInternal)this).HealthErrorDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[]) content.GetValueForProperty("HealthErrorDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricPropertiesInternal)this).HealthErrorDetail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("Health")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricPropertiesInternal)this).Health = (string) content.GetValueForProperty("Health",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricPropertiesInternal)this).Health, global::System.Convert.ToString); + } + if (content.Contains("EncryptionDetailKekState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricPropertiesInternal)this).EncryptionDetailKekState = (string) content.GetValueForProperty("EncryptionDetailKekState",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricPropertiesInternal)this).EncryptionDetailKekState, global::System.Convert.ToString); + } + if (content.Contains("EncryptionDetailKekCertThumbprint")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricPropertiesInternal)this).EncryptionDetailKekCertThumbprint = (string) content.GetValueForProperty("EncryptionDetailKekCertThumbprint",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricPropertiesInternal)this).EncryptionDetailKekCertThumbprint, global::System.Convert.ToString); + } + if (content.Contains("EncryptionDetailKekCertExpiryDate")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricPropertiesInternal)this).EncryptionDetailKekCertExpiryDate = (global::System.DateTime?) content.GetValueForProperty("EncryptionDetailKekCertExpiryDate",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricPropertiesInternal)this).EncryptionDetailKekCertExpiryDate, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("RolloverEncryptionDetailKekState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricPropertiesInternal)this).RolloverEncryptionDetailKekState = (string) content.GetValueForProperty("RolloverEncryptionDetailKekState",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricPropertiesInternal)this).RolloverEncryptionDetailKekState, global::System.Convert.ToString); + } + if (content.Contains("RolloverEncryptionDetailKekCertThumbprint")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricPropertiesInternal)this).RolloverEncryptionDetailKekCertThumbprint = (string) content.GetValueForProperty("RolloverEncryptionDetailKekCertThumbprint",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricPropertiesInternal)this).RolloverEncryptionDetailKekCertThumbprint, global::System.Convert.ToString); + } + if (content.Contains("RolloverEncryptionDetailKekCertExpiryDate")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricPropertiesInternal)this).RolloverEncryptionDetailKekCertExpiryDate = (global::System.DateTime?) content.GetValueForProperty("RolloverEncryptionDetailKekCertExpiryDate",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricPropertiesInternal)this).RolloverEncryptionDetailKekCertExpiryDate, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("CustomDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricPropertiesInternal)this).CustomDetailInstanceType = (string) content.GetValueForProperty("CustomDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricPropertiesInternal)this).CustomDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Fabric properties. + [System.ComponentModel.TypeConverter(typeof(FabricPropertiesTypeConverter))] + public partial interface IFabricProperties + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricProperties.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricProperties.TypeConverter.cs new file mode 100644 index 000000000000..0c52731363c2 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricProperties.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class FabricPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return FabricProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return FabricProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return FabricProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricProperties.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricProperties.cs new file mode 100644 index 000000000000..81b6fe234bc1 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricProperties.cs @@ -0,0 +1,253 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Fabric properties. + public partial class FabricProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricProperties, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricPropertiesInternal + { + + /// Backing field for property. + private string _bcdrState; + + /// BCDR state of the fabric. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string BcdrState { get => this._bcdrState; set => this._bcdrState = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificDetails _customDetail; + + /// Fabric specific settings. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificDetails CustomDetail { get => (this._customDetail = this._customDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FabricSpecificDetails()); set => this._customDetail = value; } + + /// Gets the class type. Overridden in derived classes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string CustomDetailInstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificDetailsInternal)CustomDetail).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificDetailsInternal)CustomDetail).InstanceType = value ?? null; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEncryptionDetails _encryptionDetail; + + /// Encryption details for the fabric. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEncryptionDetails EncryptionDetail { get => (this._encryptionDetail = this._encryptionDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EncryptionDetails()); set => this._encryptionDetail = value; } + + /// The key encryption key certificate expiry date. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public global::System.DateTime? EncryptionDetailKekCertExpiryDate { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEncryptionDetailsInternal)EncryptionDetail).KekCertExpiryDate; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEncryptionDetailsInternal)EncryptionDetail).KekCertExpiryDate = value ?? default(global::System.DateTime); } + + /// The key encryption key certificate thumbprint. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string EncryptionDetailKekCertThumbprint { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEncryptionDetailsInternal)EncryptionDetail).KekCertThumbprint; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEncryptionDetailsInternal)EncryptionDetail).KekCertThumbprint = value ?? null; } + + /// The key encryption key state for the Vmm. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string EncryptionDetailKekState { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEncryptionDetailsInternal)EncryptionDetail).KekState; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEncryptionDetailsInternal)EncryptionDetail).KekState = value ?? null; } + + /// Backing field for property. + private string _friendlyName; + + /// Friendly name of the fabric. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string FriendlyName { get => this._friendlyName; set => this._friendlyName = value; } + + /// Backing field for property. + private string _health; + + /// Health of fabric. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Health { get => this._health; set => this._health = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] _healthErrorDetail; + + /// Fabric health error details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] HealthErrorDetail { get => this._healthErrorDetail; set => this._healthErrorDetail = value; } + + /// Backing field for property. + private string _internalIdentifier; + + /// Dra Registration Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string InternalIdentifier { get => this._internalIdentifier; set => this._internalIdentifier = value; } + + /// Internal Acessors for CustomDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificDetails Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricPropertiesInternal.CustomDetail { get => (this._customDetail = this._customDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FabricSpecificDetails()); set { {_customDetail = value;} } } + + /// Internal Acessors for EncryptionDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEncryptionDetails Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricPropertiesInternal.EncryptionDetail { get => (this._encryptionDetail = this._encryptionDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EncryptionDetails()); set { {_encryptionDetail = value;} } } + + /// Internal Acessors for RolloverEncryptionDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEncryptionDetails Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricPropertiesInternal.RolloverEncryptionDetail { get => (this._rolloverEncryptionDetail = this._rolloverEncryptionDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EncryptionDetails()); set { {_rolloverEncryptionDetail = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEncryptionDetails _rolloverEncryptionDetail; + + /// Rollover encryption details for the fabric. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEncryptionDetails RolloverEncryptionDetail { get => (this._rolloverEncryptionDetail = this._rolloverEncryptionDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EncryptionDetails()); set => this._rolloverEncryptionDetail = value; } + + /// The key encryption key certificate expiry date. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public global::System.DateTime? RolloverEncryptionDetailKekCertExpiryDate { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEncryptionDetailsInternal)RolloverEncryptionDetail).KekCertExpiryDate; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEncryptionDetailsInternal)RolloverEncryptionDetail).KekCertExpiryDate = value ?? default(global::System.DateTime); } + + /// The key encryption key certificate thumbprint. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string RolloverEncryptionDetailKekCertThumbprint { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEncryptionDetailsInternal)RolloverEncryptionDetail).KekCertThumbprint; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEncryptionDetailsInternal)RolloverEncryptionDetail).KekCertThumbprint = value ?? null; } + + /// The key encryption key state for the Vmm. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string RolloverEncryptionDetailKekState { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEncryptionDetailsInternal)RolloverEncryptionDetail).KekState; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEncryptionDetailsInternal)RolloverEncryptionDetail).KekState = value ?? null; } + + /// Creates an new instance. + public FabricProperties() + { + + } + } + /// Fabric properties. + public partial interface IFabricProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// BCDR state of the fabric. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"BCDR state of the fabric.", + SerializedName = @"bcdrState", + PossibleTypes = new [] { typeof(string) })] + string BcdrState { get; set; } + /// Gets the class type. Overridden in derived classes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets the class type. Overridden in derived classes.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string CustomDetailInstanceType { get; set; } + /// The key encryption key certificate expiry date. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The key encryption key certificate expiry date.", + SerializedName = @"kekCertExpiryDate", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? EncryptionDetailKekCertExpiryDate { get; set; } + /// The key encryption key certificate thumbprint. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The key encryption key certificate thumbprint.", + SerializedName = @"kekCertThumbprint", + PossibleTypes = new [] { typeof(string) })] + string EncryptionDetailKekCertThumbprint { get; set; } + /// The key encryption key state for the Vmm. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The key encryption key state for the Vmm.", + SerializedName = @"kekState", + PossibleTypes = new [] { typeof(string) })] + string EncryptionDetailKekState { get; set; } + /// Friendly name of the fabric. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Friendly name of the fabric.", + SerializedName = @"friendlyName", + PossibleTypes = new [] { typeof(string) })] + string FriendlyName { get; set; } + /// Health of fabric. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Health of fabric.", + SerializedName = @"health", + PossibleTypes = new [] { typeof(string) })] + string Health { get; set; } + /// Fabric health error details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Fabric health error details.", + SerializedName = @"healthErrorDetails", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] HealthErrorDetail { get; set; } + /// Dra Registration Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Dra Registration Id.", + SerializedName = @"internalIdentifier", + PossibleTypes = new [] { typeof(string) })] + string InternalIdentifier { get; set; } + /// The key encryption key certificate expiry date. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The key encryption key certificate expiry date.", + SerializedName = @"kekCertExpiryDate", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? RolloverEncryptionDetailKekCertExpiryDate { get; set; } + /// The key encryption key certificate thumbprint. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The key encryption key certificate thumbprint.", + SerializedName = @"kekCertThumbprint", + PossibleTypes = new [] { typeof(string) })] + string RolloverEncryptionDetailKekCertThumbprint { get; set; } + /// The key encryption key state for the Vmm. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The key encryption key state for the Vmm.", + SerializedName = @"kekState", + PossibleTypes = new [] { typeof(string) })] + string RolloverEncryptionDetailKekState { get; set; } + + } + /// Fabric properties. + internal partial interface IFabricPropertiesInternal + + { + /// BCDR state of the fabric. + string BcdrState { get; set; } + /// Fabric specific settings. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificDetails CustomDetail { get; set; } + /// Gets the class type. Overridden in derived classes. + string CustomDetailInstanceType { get; set; } + /// Encryption details for the fabric. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEncryptionDetails EncryptionDetail { get; set; } + /// The key encryption key certificate expiry date. + global::System.DateTime? EncryptionDetailKekCertExpiryDate { get; set; } + /// The key encryption key certificate thumbprint. + string EncryptionDetailKekCertThumbprint { get; set; } + /// The key encryption key state for the Vmm. + string EncryptionDetailKekState { get; set; } + /// Friendly name of the fabric. + string FriendlyName { get; set; } + /// Health of fabric. + string Health { get; set; } + /// Fabric health error details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] HealthErrorDetail { get; set; } + /// Dra Registration Id. + string InternalIdentifier { get; set; } + /// Rollover encryption details for the fabric. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEncryptionDetails RolloverEncryptionDetail { get; set; } + /// The key encryption key certificate expiry date. + global::System.DateTime? RolloverEncryptionDetailKekCertExpiryDate { get; set; } + /// The key encryption key certificate thumbprint. + string RolloverEncryptionDetailKekCertThumbprint { get; set; } + /// The key encryption key state for the Vmm. + string RolloverEncryptionDetailKekState { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricProperties.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricProperties.json.cs new file mode 100644 index 000000000000..5d8860fa8450 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricProperties.json.cs @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Fabric properties. + public partial class FabricProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal FabricProperties(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_encryptionDetail = If( json?.PropertyT("encryptionDetails"), out var __jsonEncryptionDetails) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EncryptionDetails.FromJson(__jsonEncryptionDetails) : EncryptionDetail;} + {_rolloverEncryptionDetail = If( json?.PropertyT("rolloverEncryptionDetails"), out var __jsonRolloverEncryptionDetails) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EncryptionDetails.FromJson(__jsonRolloverEncryptionDetails) : RolloverEncryptionDetail;} + {_customDetail = If( json?.PropertyT("customDetails"), out var __jsonCustomDetails) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FabricSpecificDetails.FromJson(__jsonCustomDetails) : CustomDetail;} + {_friendlyName = If( json?.PropertyT("friendlyName"), out var __jsonFriendlyName) ? (string)__jsonFriendlyName : (string)FriendlyName;} + {_internalIdentifier = If( json?.PropertyT("internalIdentifier"), out var __jsonInternalIdentifier) ? (string)__jsonInternalIdentifier : (string)InternalIdentifier;} + {_bcdrState = If( json?.PropertyT("bcdrState"), out var __jsonBcdrState) ? (string)__jsonBcdrState : (string)BcdrState;} + {_healthErrorDetail = If( json?.PropertyT("healthErrorDetails"), out var __jsonHealthErrorDetails) ? If( __jsonHealthErrorDetails as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthError.FromJson(__u) )) ))() : null : HealthErrorDetail;} + {_health = If( json?.PropertyT("health"), out var __jsonHealth) ? (string)__jsonHealth : (string)Health;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new FabricProperties(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._encryptionDetail ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._encryptionDetail.ToJson(null,serializationMode) : null, "encryptionDetails" ,container.Add ); + AddIf( null != this._rolloverEncryptionDetail ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._rolloverEncryptionDetail.ToJson(null,serializationMode) : null, "rolloverEncryptionDetails" ,container.Add ); + AddIf( null != this._customDetail ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._customDetail.ToJson(null,serializationMode) : null, "customDetails" ,container.Add ); + AddIf( null != (((object)this._friendlyName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._friendlyName.ToString()) : null, "friendlyName" ,container.Add ); + AddIf( null != (((object)this._internalIdentifier)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._internalIdentifier.ToString()) : null, "internalIdentifier" ,container.Add ); + AddIf( null != (((object)this._bcdrState)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._bcdrState.ToString()) : null, "bcdrState" ,container.Add ); + if (null != this._healthErrorDetail) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._healthErrorDetail ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("healthErrorDetails",__w); + } + AddIf( null != (((object)this._health)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._health.ToString()) : null, "health" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricQueryParameter.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricQueryParameter.PowerShell.cs new file mode 100644 index 000000000000..2d7863acf635 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricQueryParameter.PowerShell.cs @@ -0,0 +1,184 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Query parameter to get fabric. + [System.ComponentModel.TypeConverter(typeof(FabricQueryParameterTypeConverter))] + public partial class FabricQueryParameter + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricQueryParameter DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new FabricQueryParameter(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricQueryParameter DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new FabricQueryParameter(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal FabricQueryParameter(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ZoneToZoneMapping")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricQueryParameterInternal)this).ZoneToZoneMapping = (string) content.GetValueForProperty("ZoneToZoneMapping",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricQueryParameterInternal)this).ZoneToZoneMapping, global::System.Convert.ToString); + } + if (content.Contains("FetchAgentDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricQueryParameterInternal)this).FetchAgentDetail = (string) content.GetValueForProperty("FetchAgentDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricQueryParameterInternal)this).FetchAgentDetail, global::System.Convert.ToString); + } + if (content.Contains("BiosId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricQueryParameterInternal)this).BiosId = (string) content.GetValueForProperty("BiosId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricQueryParameterInternal)this).BiosId, global::System.Convert.ToString); + } + if (content.Contains("Fqdn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricQueryParameterInternal)this).Fqdn = (string) content.GetValueForProperty("Fqdn",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricQueryParameterInternal)this).Fqdn, global::System.Convert.ToString); + } + if (content.Contains("DiscoveryType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricQueryParameterInternal)this).DiscoveryType = (string) content.GetValueForProperty("DiscoveryType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricQueryParameterInternal)this).DiscoveryType, global::System.Convert.ToString); + } + if (content.Contains("OSType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricQueryParameterInternal)this).OSType = (string) content.GetValueForProperty("OSType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricQueryParameterInternal)this).OSType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal FabricQueryParameter(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ZoneToZoneMapping")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricQueryParameterInternal)this).ZoneToZoneMapping = (string) content.GetValueForProperty("ZoneToZoneMapping",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricQueryParameterInternal)this).ZoneToZoneMapping, global::System.Convert.ToString); + } + if (content.Contains("FetchAgentDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricQueryParameterInternal)this).FetchAgentDetail = (string) content.GetValueForProperty("FetchAgentDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricQueryParameterInternal)this).FetchAgentDetail, global::System.Convert.ToString); + } + if (content.Contains("BiosId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricQueryParameterInternal)this).BiosId = (string) content.GetValueForProperty("BiosId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricQueryParameterInternal)this).BiosId, global::System.Convert.ToString); + } + if (content.Contains("Fqdn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricQueryParameterInternal)this).Fqdn = (string) content.GetValueForProperty("Fqdn",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricQueryParameterInternal)this).Fqdn, global::System.Convert.ToString); + } + if (content.Contains("DiscoveryType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricQueryParameterInternal)this).DiscoveryType = (string) content.GetValueForProperty("DiscoveryType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricQueryParameterInternal)this).DiscoveryType, global::System.Convert.ToString); + } + if (content.Contains("OSType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricQueryParameterInternal)this).OSType = (string) content.GetValueForProperty("OSType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricQueryParameterInternal)this).OSType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricQueryParameter FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Query parameter to get fabric. + [System.ComponentModel.TypeConverter(typeof(FabricQueryParameterTypeConverter))] + public partial interface IFabricQueryParameter + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricQueryParameter.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricQueryParameter.TypeConverter.cs new file mode 100644 index 000000000000..1dbf0fac4ad1 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricQueryParameter.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class FabricQueryParameterTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricQueryParameter ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricQueryParameter).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return FabricQueryParameter.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return FabricQueryParameter.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return FabricQueryParameter.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricQueryParameter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricQueryParameter.cs new file mode 100644 index 000000000000..8e7f86b7b7fc --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricQueryParameter.cs @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Query parameter to get fabric. + public partial class FabricQueryParameter : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricQueryParameter, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricQueryParameterInternal + { + + /// Backing field for property. + private string _biosId; + + /// The BIOS Id to be used for fetching agent details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string BiosId { get => this._biosId; set => this._biosId = value; } + + /// Backing field for property. + private string _discoveryType; + + /// The type of the discovered machine to be used for fetching agent details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string DiscoveryType { get => this._discoveryType; set => this._discoveryType = value; } + + /// Backing field for property. + private string _fetchAgentDetail; + + /// A value indicating whether the agent details are to be fetched. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string FetchAgentDetail { get => this._fetchAgentDetail; set => this._fetchAgentDetail = value; } + + /// Backing field for property. + private string _fqdn; + + /// The FQDN to be used for fetching agent details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Fqdn { get => this._fqdn; set => this._fqdn = value; } + + /// Backing field for property. + private string _oSType; + + /// The OS type to be used for fetching agent details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string OSType { get => this._oSType; set => this._oSType = value; } + + /// Backing field for property. + private string _zoneToZoneMapping; + + /// A value indicating whether the zone to zone mappings are to be returned. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ZoneToZoneMapping { get => this._zoneToZoneMapping; set => this._zoneToZoneMapping = value; } + + /// Creates an new instance. + public FabricQueryParameter() + { + + } + } + /// Query parameter to get fabric. + public partial interface IFabricQueryParameter : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The BIOS Id to be used for fetching agent details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The BIOS Id to be used for fetching agent details.", + SerializedName = @"biosId", + PossibleTypes = new [] { typeof(string) })] + string BiosId { get; set; } + /// The type of the discovered machine to be used for fetching agent details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The type of the discovered machine to be used for fetching agent details.", + SerializedName = @"discoveryType", + PossibleTypes = new [] { typeof(string) })] + string DiscoveryType { get; set; } + /// A value indicating whether the agent details are to be fetched. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether the agent details are to be fetched.", + SerializedName = @"fetchAgentDetails", + PossibleTypes = new [] { typeof(string) })] + string FetchAgentDetail { get; set; } + /// The FQDN to be used for fetching agent details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The FQDN to be used for fetching agent details.", + SerializedName = @"fqdn", + PossibleTypes = new [] { typeof(string) })] + string Fqdn { get; set; } + /// The OS type to be used for fetching agent details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The OS type to be used for fetching agent details.", + SerializedName = @"osType", + PossibleTypes = new [] { typeof(string) })] + string OSType { get; set; } + /// A value indicating whether the zone to zone mappings are to be returned. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether the zone to zone mappings are to be returned.", + SerializedName = @"zoneToZoneMappings", + PossibleTypes = new [] { typeof(string) })] + string ZoneToZoneMapping { get; set; } + + } + /// Query parameter to get fabric. + internal partial interface IFabricQueryParameterInternal + + { + /// The BIOS Id to be used for fetching agent details. + string BiosId { get; set; } + /// The type of the discovered machine to be used for fetching agent details. + string DiscoveryType { get; set; } + /// A value indicating whether the agent details are to be fetched. + string FetchAgentDetail { get; set; } + /// The FQDN to be used for fetching agent details. + string Fqdn { get; set; } + /// The OS type to be used for fetching agent details. + string OSType { get; set; } + /// A value indicating whether the zone to zone mappings are to be returned. + string ZoneToZoneMapping { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricQueryParameter.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricQueryParameter.json.cs new file mode 100644 index 000000000000..f97081d43b91 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricQueryParameter.json.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Query parameter to get fabric. + public partial class FabricQueryParameter + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal FabricQueryParameter(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_zoneToZoneMapping = If( json?.PropertyT("zoneToZoneMappings"), out var __jsonZoneToZoneMappings) ? (string)__jsonZoneToZoneMappings : (string)ZoneToZoneMapping;} + {_fetchAgentDetail = If( json?.PropertyT("fetchAgentDetails"), out var __jsonFetchAgentDetails) ? (string)__jsonFetchAgentDetails : (string)FetchAgentDetail;} + {_biosId = If( json?.PropertyT("biosId"), out var __jsonBiosId) ? (string)__jsonBiosId : (string)BiosId;} + {_fqdn = If( json?.PropertyT("fqdn"), out var __jsonFqdn) ? (string)__jsonFqdn : (string)Fqdn;} + {_discoveryType = If( json?.PropertyT("discoveryType"), out var __jsonDiscoveryType) ? (string)__jsonDiscoveryType : (string)DiscoveryType;} + {_oSType = If( json?.PropertyT("osType"), out var __jsonOSType) ? (string)__jsonOSType : (string)OSType;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricQueryParameter. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricQueryParameter. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricQueryParameter FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new FabricQueryParameter(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._zoneToZoneMapping)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._zoneToZoneMapping.ToString()) : null, "zoneToZoneMappings" ,container.Add ); + AddIf( null != (((object)this._fetchAgentDetail)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._fetchAgentDetail.ToString()) : null, "fetchAgentDetails" ,container.Add ); + AddIf( null != (((object)this._biosId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._biosId.ToString()) : null, "biosId" ,container.Add ); + AddIf( null != (((object)this._fqdn)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._fqdn.ToString()) : null, "fqdn" ,container.Add ); + AddIf( null != (((object)this._discoveryType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._discoveryType.ToString()) : null, "discoveryType" ,container.Add ); + AddIf( null != (((object)this._oSType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._oSType.ToString()) : null, "osType" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricReplicationGroupTaskDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricReplicationGroupTaskDetails.PowerShell.cs new file mode 100644 index 000000000000..41c670d4368c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricReplicationGroupTaskDetails.PowerShell.cs @@ -0,0 +1,220 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// This class represents the fabric replication group task details. + [System.ComponentModel.TypeConverter(typeof(FabricReplicationGroupTaskDetailsTypeConverter))] + public partial class FabricReplicationGroupTaskDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricReplicationGroupTaskDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new FabricReplicationGroupTaskDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricReplicationGroupTaskDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new FabricReplicationGroupTaskDetails(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal FabricReplicationGroupTaskDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SkippedReason")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricReplicationGroupTaskDetailsInternal)this).SkippedReason = (string) content.GetValueForProperty("SkippedReason",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricReplicationGroupTaskDetailsInternal)this).SkippedReason, global::System.Convert.ToString); + } + if (content.Contains("SkippedReasonString")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricReplicationGroupTaskDetailsInternal)this).SkippedReasonString = (string) content.GetValueForProperty("SkippedReasonString",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricReplicationGroupTaskDetailsInternal)this).SkippedReasonString, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITaskTypeDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITaskTypeDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + if (content.Contains("JobTaskJobId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)this).JobTaskJobId = (string) content.GetValueForProperty("JobTaskJobId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)this).JobTaskJobId, global::System.Convert.ToString); + } + if (content.Contains("JobTaskJobFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)this).JobTaskJobFriendlyName = (string) content.GetValueForProperty("JobTaskJobFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)this).JobTaskJobFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("JobTaskTargetObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)this).JobTaskTargetObjectId = (string) content.GetValueForProperty("JobTaskTargetObjectId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)this).JobTaskTargetObjectId, global::System.Convert.ToString); + } + if (content.Contains("JobTaskTargetObjectName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)this).JobTaskTargetObjectName = (string) content.GetValueForProperty("JobTaskTargetObjectName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)this).JobTaskTargetObjectName, global::System.Convert.ToString); + } + if (content.Contains("JobTaskTargetInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)this).JobTaskTargetInstanceType = (string) content.GetValueForProperty("JobTaskTargetInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)this).JobTaskTargetInstanceType, global::System.Convert.ToString); + } + if (content.Contains("JobTaskJobScenarioName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)this).JobTaskJobScenarioName = (string) content.GetValueForProperty("JobTaskJobScenarioName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)this).JobTaskJobScenarioName, global::System.Convert.ToString); + } + if (content.Contains("JobTask")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)this).JobTask = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobEntity) content.GetValueForProperty("JobTask",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)this).JobTask, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.JobEntityTypeConverter.ConvertFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal FabricReplicationGroupTaskDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SkippedReason")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricReplicationGroupTaskDetailsInternal)this).SkippedReason = (string) content.GetValueForProperty("SkippedReason",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricReplicationGroupTaskDetailsInternal)this).SkippedReason, global::System.Convert.ToString); + } + if (content.Contains("SkippedReasonString")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricReplicationGroupTaskDetailsInternal)this).SkippedReasonString = (string) content.GetValueForProperty("SkippedReasonString",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricReplicationGroupTaskDetailsInternal)this).SkippedReasonString, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITaskTypeDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITaskTypeDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + if (content.Contains("JobTaskJobId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)this).JobTaskJobId = (string) content.GetValueForProperty("JobTaskJobId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)this).JobTaskJobId, global::System.Convert.ToString); + } + if (content.Contains("JobTaskJobFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)this).JobTaskJobFriendlyName = (string) content.GetValueForProperty("JobTaskJobFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)this).JobTaskJobFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("JobTaskTargetObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)this).JobTaskTargetObjectId = (string) content.GetValueForProperty("JobTaskTargetObjectId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)this).JobTaskTargetObjectId, global::System.Convert.ToString); + } + if (content.Contains("JobTaskTargetObjectName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)this).JobTaskTargetObjectName = (string) content.GetValueForProperty("JobTaskTargetObjectName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)this).JobTaskTargetObjectName, global::System.Convert.ToString); + } + if (content.Contains("JobTaskTargetInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)this).JobTaskTargetInstanceType = (string) content.GetValueForProperty("JobTaskTargetInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)this).JobTaskTargetInstanceType, global::System.Convert.ToString); + } + if (content.Contains("JobTaskJobScenarioName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)this).JobTaskJobScenarioName = (string) content.GetValueForProperty("JobTaskJobScenarioName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)this).JobTaskJobScenarioName, global::System.Convert.ToString); + } + if (content.Contains("JobTask")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)this).JobTask = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobEntity) content.GetValueForProperty("JobTask",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)this).JobTask, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.JobEntityTypeConverter.ConvertFrom); + } + AfterDeserializePSObject(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricReplicationGroupTaskDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// This class represents the fabric replication group task details. + [System.ComponentModel.TypeConverter(typeof(FabricReplicationGroupTaskDetailsTypeConverter))] + public partial interface IFabricReplicationGroupTaskDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricReplicationGroupTaskDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricReplicationGroupTaskDetails.TypeConverter.cs new file mode 100644 index 000000000000..4d50b5df101c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricReplicationGroupTaskDetails.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class FabricReplicationGroupTaskDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricReplicationGroupTaskDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricReplicationGroupTaskDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return FabricReplicationGroupTaskDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return FabricReplicationGroupTaskDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return FabricReplicationGroupTaskDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricReplicationGroupTaskDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricReplicationGroupTaskDetails.cs new file mode 100644 index 000000000000..ab5913b1adef --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricReplicationGroupTaskDetails.cs @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// This class represents the fabric replication group task details. + public partial class FabricReplicationGroupTaskDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricReplicationGroupTaskDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricReplicationGroupTaskDetailsInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetails __jobTaskDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.JobTaskDetails(); + + /// The type of task details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITaskTypeDetailsInternal)__jobTaskDetails).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITaskTypeDetailsInternal)__jobTaskDetails).InstanceType = value ; } + + /// The job entity. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobEntity JobTask { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)__jobTaskDetails).JobTask; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)__jobTaskDetails).JobTask = value ?? null /* model class */; } + + /// The job display name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string JobTaskJobFriendlyName { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)__jobTaskDetails).JobTaskJobFriendlyName; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)__jobTaskDetails).JobTaskJobFriendlyName = value ?? null; } + + /// The job id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string JobTaskJobId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)__jobTaskDetails).JobTaskJobId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)__jobTaskDetails).JobTaskJobId = value ?? null; } + + /// The job name. Enum type ScenarioName. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string JobTaskJobScenarioName { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)__jobTaskDetails).JobTaskJobScenarioName; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)__jobTaskDetails).JobTaskJobScenarioName = value ?? null; } + + /// The workflow affected object type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string JobTaskTargetInstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)__jobTaskDetails).JobTaskTargetInstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)__jobTaskDetails).JobTaskTargetInstanceType = value ?? null; } + + /// The object id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string JobTaskTargetObjectId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)__jobTaskDetails).JobTaskTargetObjectId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)__jobTaskDetails).JobTaskTargetObjectId = value ?? null; } + + /// The object name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string JobTaskTargetObjectName { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)__jobTaskDetails).JobTaskTargetObjectName; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)__jobTaskDetails).JobTaskTargetObjectName = value ?? null; } + + /// Backing field for property. + private string _skippedReason; + + /// The skipped reason. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string SkippedReason { get => this._skippedReason; set => this._skippedReason = value; } + + /// Backing field for property. + private string _skippedReasonString; + + /// The skipped reason string. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string SkippedReasonString { get => this._skippedReasonString; set => this._skippedReasonString = value; } + + /// Creates an new instance. + public FabricReplicationGroupTaskDetails() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__jobTaskDetails), __jobTaskDetails); + await eventListener.AssertObjectIsValid(nameof(__jobTaskDetails), __jobTaskDetails); + } + } + /// This class represents the fabric replication group task details. + public partial interface IFabricReplicationGroupTaskDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetails + { + /// The skipped reason. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The skipped reason.", + SerializedName = @"skippedReason", + PossibleTypes = new [] { typeof(string) })] + string SkippedReason { get; set; } + /// The skipped reason string. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The skipped reason string.", + SerializedName = @"skippedReasonString", + PossibleTypes = new [] { typeof(string) })] + string SkippedReasonString { get; set; } + + } + /// This class represents the fabric replication group task details. + internal partial interface IFabricReplicationGroupTaskDetailsInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal + { + /// The skipped reason. + string SkippedReason { get; set; } + /// The skipped reason string. + string SkippedReasonString { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricReplicationGroupTaskDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricReplicationGroupTaskDetails.json.cs new file mode 100644 index 000000000000..0a22265869ea --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricReplicationGroupTaskDetails.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// This class represents the fabric replication group task details. + public partial class FabricReplicationGroupTaskDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal FabricReplicationGroupTaskDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __jobTaskDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.JobTaskDetails(json); + {_skippedReason = If( json?.PropertyT("skippedReason"), out var __jsonSkippedReason) ? (string)__jsonSkippedReason : (string)SkippedReason;} + {_skippedReasonString = If( json?.PropertyT("skippedReasonString"), out var __jsonSkippedReasonString) ? (string)__jsonSkippedReasonString : (string)SkippedReasonString;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricReplicationGroupTaskDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricReplicationGroupTaskDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricReplicationGroupTaskDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new FabricReplicationGroupTaskDetails(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __jobTaskDetails?.ToJson(container, serializationMode); + AddIf( null != (((object)this._skippedReason)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._skippedReason.ToString()) : null, "skippedReason" ,container.Add ); + AddIf( null != (((object)this._skippedReasonString)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._skippedReasonString.ToString()) : null, "skippedReasonString" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricSpecificCreateNetworkMappingInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricSpecificCreateNetworkMappingInput.PowerShell.cs new file mode 100644 index 000000000000..594f9258f1e1 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricSpecificCreateNetworkMappingInput.PowerShell.cs @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Input details specific to fabrics during Network Mapping. + [System.ComponentModel.TypeConverter(typeof(FabricSpecificCreateNetworkMappingInputTypeConverter))] + public partial class FabricSpecificCreateNetworkMappingInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreateNetworkMappingInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new FabricSpecificCreateNetworkMappingInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreateNetworkMappingInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new FabricSpecificCreateNetworkMappingInput(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal FabricSpecificCreateNetworkMappingInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreateNetworkMappingInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreateNetworkMappingInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal FabricSpecificCreateNetworkMappingInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreateNetworkMappingInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreateNetworkMappingInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json + /// string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreateNetworkMappingInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Input details specific to fabrics during Network Mapping. + [System.ComponentModel.TypeConverter(typeof(FabricSpecificCreateNetworkMappingInputTypeConverter))] + public partial interface IFabricSpecificCreateNetworkMappingInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricSpecificCreateNetworkMappingInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricSpecificCreateNetworkMappingInput.TypeConverter.cs new file mode 100644 index 000000000000..fc20a416c80d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricSpecificCreateNetworkMappingInput.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class FabricSpecificCreateNetworkMappingInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreateNetworkMappingInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreateNetworkMappingInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return FabricSpecificCreateNetworkMappingInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return FabricSpecificCreateNetworkMappingInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return FabricSpecificCreateNetworkMappingInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricSpecificCreateNetworkMappingInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricSpecificCreateNetworkMappingInput.cs new file mode 100644 index 000000000000..d39af624e3d2 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricSpecificCreateNetworkMappingInput.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Input details specific to fabrics during Network Mapping. + public partial class FabricSpecificCreateNetworkMappingInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreateNetworkMappingInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreateNetworkMappingInputInternal + { + + /// Backing field for property. + private string _instanceType; + + /// The instance type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string InstanceType { get => this._instanceType; set => this._instanceType = value; } + + /// Creates an new instance. + public FabricSpecificCreateNetworkMappingInput() + { + + } + } + /// Input details specific to fabrics during Network Mapping. + public partial interface IFabricSpecificCreateNetworkMappingInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The instance type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The instance type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string InstanceType { get; set; } + + } + /// Input details specific to fabrics during Network Mapping. + internal partial interface IFabricSpecificCreateNetworkMappingInputInternal + + { + /// The instance type. + string InstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricSpecificCreateNetworkMappingInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricSpecificCreateNetworkMappingInput.json.cs new file mode 100644 index 000000000000..d651335c1178 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricSpecificCreateNetworkMappingInput.json.cs @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Input details specific to fabrics during Network Mapping. + public partial class FabricSpecificCreateNetworkMappingInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal FabricSpecificCreateNetworkMappingInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_instanceType = If( json?.PropertyT("instanceType"), out var __jsonInstanceType) ? (string)__jsonInstanceType : (string)InstanceType;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreateNetworkMappingInput. + /// Note: the Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreateNetworkMappingInput interface + /// is polymorphic, and the precise model class that will get deserialized is determined at runtime based on the payload. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreateNetworkMappingInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreateNetworkMappingInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + if (!(node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json)) + { + return null; + } + // Polymorphic type -- select the appropriate constructor using the discriminator + + switch ( json.StringProperty("instanceType") ) + { + case "AzureToAzure": + { + return new AzureToAzureCreateNetworkMappingInput(json); + } + case "VmmToAzure": + { + return new VmmToAzureCreateNetworkMappingInput(json); + } + case "VmmToVmm": + { + return new VmmToVmmCreateNetworkMappingInput(json); + } + } + return new FabricSpecificCreateNetworkMappingInput(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._instanceType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._instanceType.ToString()) : null, "instanceType" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricSpecificCreationInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricSpecificCreationInput.PowerShell.cs new file mode 100644 index 000000000000..89f7cd6c417c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricSpecificCreationInput.PowerShell.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Fabric provider specific settings. + [System.ComponentModel.TypeConverter(typeof(FabricSpecificCreationInputTypeConverter))] + public partial class FabricSpecificCreationInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreationInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new FabricSpecificCreationInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreationInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new FabricSpecificCreationInput(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal FabricSpecificCreationInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreationInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreationInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal FabricSpecificCreationInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreationInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreationInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreationInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Fabric provider specific settings. + [System.ComponentModel.TypeConverter(typeof(FabricSpecificCreationInputTypeConverter))] + public partial interface IFabricSpecificCreationInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricSpecificCreationInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricSpecificCreationInput.TypeConverter.cs new file mode 100644 index 000000000000..3a12bf1bfd63 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricSpecificCreationInput.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class FabricSpecificCreationInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreationInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreationInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return FabricSpecificCreationInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return FabricSpecificCreationInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return FabricSpecificCreationInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricSpecificCreationInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricSpecificCreationInput.cs new file mode 100644 index 000000000000..456678b5a998 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricSpecificCreationInput.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Fabric provider specific settings. + public partial class FabricSpecificCreationInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreationInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreationInputInternal + { + + /// Backing field for property. + private string _instanceType; + + /// Gets the class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string InstanceType { get => this._instanceType; set => this._instanceType = value; } + + /// Creates an new instance. + public FabricSpecificCreationInput() + { + + } + } + /// Fabric provider specific settings. + public partial interface IFabricSpecificCreationInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// Gets the class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets the class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string InstanceType { get; set; } + + } + /// Fabric provider specific settings. + internal partial interface IFabricSpecificCreationInputInternal + + { + /// Gets the class type. + string InstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricSpecificCreationInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricSpecificCreationInput.json.cs new file mode 100644 index 000000000000..d4fccd1dcc46 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricSpecificCreationInput.json.cs @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Fabric provider specific settings. + public partial class FabricSpecificCreationInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal FabricSpecificCreationInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_instanceType = If( json?.PropertyT("instanceType"), out var __jsonInstanceType) ? (string)__jsonInstanceType : (string)InstanceType;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreationInput. + /// Note: the Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreationInput interface is polymorphic, + /// and the precise model class that will get deserialized is determined at runtime based on the payload. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreationInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreationInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + if (!(node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json)) + { + return null; + } + // Polymorphic type -- select the appropriate constructor using the discriminator + + switch ( json.StringProperty("instanceType") ) + { + case "Azure": + { + return new AzureFabricCreationInput(json); + } + case "InMageRcm": + { + return new InMageRcmFabricCreationInput(json); + } + case "VMwareV2": + { + return new VMwareV2FabricCreationInput(json); + } + } + return new FabricSpecificCreationInput(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._instanceType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._instanceType.ToString()) : null, "instanceType" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricSpecificDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricSpecificDetails.PowerShell.cs new file mode 100644 index 000000000000..4ec935f55d0b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricSpecificDetails.PowerShell.cs @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Fabric specific details. + [System.ComponentModel.TypeConverter(typeof(FabricSpecificDetailsTypeConverter))] + public partial class FabricSpecificDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new FabricSpecificDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new FabricSpecificDetails(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal FabricSpecificDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal FabricSpecificDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Fabric specific details. + [System.ComponentModel.TypeConverter(typeof(FabricSpecificDetailsTypeConverter))] + public partial interface IFabricSpecificDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricSpecificDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricSpecificDetails.TypeConverter.cs new file mode 100644 index 000000000000..b8fb481527e1 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricSpecificDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class FabricSpecificDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return FabricSpecificDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return FabricSpecificDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return FabricSpecificDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricSpecificDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricSpecificDetails.cs new file mode 100644 index 000000000000..379a9487a412 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricSpecificDetails.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Fabric specific details. + public partial class FabricSpecificDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificDetailsInternal + { + + /// Backing field for property. + private string _instanceType; + + /// Gets the class type. Overridden in derived classes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string InstanceType { get => this._instanceType; set => this._instanceType = value; } + + /// Creates an new instance. + public FabricSpecificDetails() + { + + } + } + /// Fabric specific details. + public partial interface IFabricSpecificDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// Gets the class type. Overridden in derived classes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets the class type. Overridden in derived classes.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string InstanceType { get; set; } + + } + /// Fabric specific details. + internal partial interface IFabricSpecificDetailsInternal + + { + /// Gets the class type. Overridden in derived classes. + string InstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricSpecificDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricSpecificDetails.json.cs new file mode 100644 index 000000000000..03681655007a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricSpecificDetails.json.cs @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Fabric specific details. + public partial class FabricSpecificDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal FabricSpecificDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_instanceType = If( json?.PropertyT("instanceType"), out var __jsonInstanceType) ? (string)__jsonInstanceType : (string)InstanceType;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificDetails. + /// Note: the Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificDetails interface is polymorphic, + /// and the precise model class that will get deserialized is determined at runtime based on the payload. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + if (!(node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json)) + { + return null; + } + // Polymorphic type -- select the appropriate constructor using the discriminator + + switch ( json.StringProperty("instanceType") ) + { + case "Azure": + { + return new AzureFabricSpecificDetails(json); + } + case "HyperVSite": + { + return new HyperVSiteDetails(json); + } + case "InMageRcm": + { + return new InMageRcmFabricSpecificDetails(json); + } + case "VMM": + { + return new VmmDetails(json); + } + case "VMware": + { + return new VMwareDetails(json); + } + case "VMwareV2": + { + return new VMwareV2FabricSpecificDetails(json); + } + } + return new FabricSpecificDetails(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._instanceType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._instanceType.ToString()) : null, "instanceType" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricSpecificUpdateNetworkMappingInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricSpecificUpdateNetworkMappingInput.PowerShell.cs new file mode 100644 index 000000000000..18d646df0171 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricSpecificUpdateNetworkMappingInput.PowerShell.cs @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Input details specific to fabrics during Network Mapping. + [System.ComponentModel.TypeConverter(typeof(FabricSpecificUpdateNetworkMappingInputTypeConverter))] + public partial class FabricSpecificUpdateNetworkMappingInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificUpdateNetworkMappingInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new FabricSpecificUpdateNetworkMappingInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificUpdateNetworkMappingInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new FabricSpecificUpdateNetworkMappingInput(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal FabricSpecificUpdateNetworkMappingInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificUpdateNetworkMappingInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificUpdateNetworkMappingInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal FabricSpecificUpdateNetworkMappingInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificUpdateNetworkMappingInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificUpdateNetworkMappingInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json + /// string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificUpdateNetworkMappingInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Input details specific to fabrics during Network Mapping. + [System.ComponentModel.TypeConverter(typeof(FabricSpecificUpdateNetworkMappingInputTypeConverter))] + public partial interface IFabricSpecificUpdateNetworkMappingInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricSpecificUpdateNetworkMappingInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricSpecificUpdateNetworkMappingInput.TypeConverter.cs new file mode 100644 index 000000000000..4a4311fa0f96 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricSpecificUpdateNetworkMappingInput.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class FabricSpecificUpdateNetworkMappingInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificUpdateNetworkMappingInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificUpdateNetworkMappingInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return FabricSpecificUpdateNetworkMappingInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return FabricSpecificUpdateNetworkMappingInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return FabricSpecificUpdateNetworkMappingInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricSpecificUpdateNetworkMappingInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricSpecificUpdateNetworkMappingInput.cs new file mode 100644 index 000000000000..134e714ae741 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricSpecificUpdateNetworkMappingInput.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Input details specific to fabrics during Network Mapping. + public partial class FabricSpecificUpdateNetworkMappingInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificUpdateNetworkMappingInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificUpdateNetworkMappingInputInternal + { + + /// Backing field for property. + private string _instanceType; + + /// The instance type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string InstanceType { get => this._instanceType; set => this._instanceType = value; } + + /// Creates an new instance. + public FabricSpecificUpdateNetworkMappingInput() + { + + } + } + /// Input details specific to fabrics during Network Mapping. + public partial interface IFabricSpecificUpdateNetworkMappingInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The instance type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The instance type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string InstanceType { get; set; } + + } + /// Input details specific to fabrics during Network Mapping. + internal partial interface IFabricSpecificUpdateNetworkMappingInputInternal + + { + /// The instance type. + string InstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricSpecificUpdateNetworkMappingInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricSpecificUpdateNetworkMappingInput.json.cs new file mode 100644 index 000000000000..f15d7be1e97d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FabricSpecificUpdateNetworkMappingInput.json.cs @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Input details specific to fabrics during Network Mapping. + public partial class FabricSpecificUpdateNetworkMappingInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal FabricSpecificUpdateNetworkMappingInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_instanceType = If( json?.PropertyT("instanceType"), out var __jsonInstanceType) ? (string)__jsonInstanceType : (string)InstanceType;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificUpdateNetworkMappingInput. + /// Note: the Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificUpdateNetworkMappingInput interface + /// is polymorphic, and the precise model class that will get deserialized is determined at runtime based on the payload. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificUpdateNetworkMappingInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificUpdateNetworkMappingInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + if (!(node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json)) + { + return null; + } + // Polymorphic type -- select the appropriate constructor using the discriminator + + switch ( json.StringProperty("instanceType") ) + { + case "AzureToAzure": + { + return new AzureToAzureUpdateNetworkMappingInput(json); + } + case "VmmToAzure": + { + return new VmmToAzureUpdateNetworkMappingInput(json); + } + case "VmmToVmm": + { + return new VmmToVmmUpdateNetworkMappingInput(json); + } + } + return new FabricSpecificUpdateNetworkMappingInput(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._instanceType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._instanceType.ToString()) : null, "instanceType" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FailoverJobDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FailoverJobDetails.PowerShell.cs new file mode 100644 index 000000000000..fcd1dec3f782 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FailoverJobDetails.PowerShell.cs @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// This class represents the details for a failover job. + [System.ComponentModel.TypeConverter(typeof(FailoverJobDetailsTypeConverter))] + public partial class FailoverJobDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverJobDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new FailoverJobDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverJobDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new FailoverJobDetails(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal FailoverJobDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProtectedItemDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverJobDetailsInternal)this).ProtectedItemDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverReplicationProtectedItemDetails[]) content.GetValueForProperty("ProtectedItemDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverJobDetailsInternal)this).ProtectedItemDetail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FailoverReplicationProtectedItemDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + if (content.Contains("AffectedObjectDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsInternal)this).AffectedObjectDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsAffectedObjectDetails) content.GetValueForProperty("AffectedObjectDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsInternal)this).AffectedObjectDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.JobDetailsAffectedObjectDetailsTypeConverter.ConvertFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal FailoverJobDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProtectedItemDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverJobDetailsInternal)this).ProtectedItemDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverReplicationProtectedItemDetails[]) content.GetValueForProperty("ProtectedItemDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverJobDetailsInternal)this).ProtectedItemDetail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FailoverReplicationProtectedItemDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + if (content.Contains("AffectedObjectDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsInternal)this).AffectedObjectDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsAffectedObjectDetails) content.GetValueForProperty("AffectedObjectDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsInternal)this).AffectedObjectDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.JobDetailsAffectedObjectDetailsTypeConverter.ConvertFrom); + } + AfterDeserializePSObject(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverJobDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// This class represents the details for a failover job. + [System.ComponentModel.TypeConverter(typeof(FailoverJobDetailsTypeConverter))] + public partial interface IFailoverJobDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FailoverJobDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FailoverJobDetails.TypeConverter.cs new file mode 100644 index 000000000000..4b366145518b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FailoverJobDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class FailoverJobDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverJobDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverJobDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return FailoverJobDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return FailoverJobDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return FailoverJobDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FailoverJobDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FailoverJobDetails.cs new file mode 100644 index 000000000000..8470413bc4d8 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FailoverJobDetails.cs @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// This class represents the details for a failover job. + public partial class FailoverJobDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverJobDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverJobDetailsInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetails __jobDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.JobDetails(); + + /// + /// The affected object properties like source server, source cloud, target server, target cloud etc. based on the workflow + /// object details. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsAffectedObjectDetails AffectedObjectDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsInternal)__jobDetails).AffectedObjectDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsInternal)__jobDetails).AffectedObjectDetail = value ?? null /* model class */; } + + /// Gets the type of job details (see JobDetailsTypes enum for possible values). + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsInternal)__jobDetails).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsInternal)__jobDetails).InstanceType = value ; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverReplicationProtectedItemDetails[] _protectedItemDetail; + + /// The test VM details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverReplicationProtectedItemDetails[] ProtectedItemDetail { get => this._protectedItemDetail; set => this._protectedItemDetail = value; } + + /// Creates an new instance. + public FailoverJobDetails() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__jobDetails), __jobDetails); + await eventListener.AssertObjectIsValid(nameof(__jobDetails), __jobDetails); + } + } + /// This class represents the details for a failover job. + public partial interface IFailoverJobDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetails + { + /// The test VM details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The test VM details.", + SerializedName = @"protectedItemDetails", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverReplicationProtectedItemDetails) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverReplicationProtectedItemDetails[] ProtectedItemDetail { get; set; } + + } + /// This class represents the details for a failover job. + internal partial interface IFailoverJobDetailsInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsInternal + { + /// The test VM details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverReplicationProtectedItemDetails[] ProtectedItemDetail { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FailoverJobDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FailoverJobDetails.json.cs new file mode 100644 index 000000000000..688a4bb0f840 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FailoverJobDetails.json.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// This class represents the details for a failover job. + public partial class FailoverJobDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal FailoverJobDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __jobDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.JobDetails(json); + {_protectedItemDetail = If( json?.PropertyT("protectedItemDetails"), out var __jsonProtectedItemDetails) ? If( __jsonProtectedItemDetails as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverReplicationProtectedItemDetails) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FailoverReplicationProtectedItemDetails.FromJson(__u) )) ))() : null : ProtectedItemDetail;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverJobDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverJobDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverJobDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new FailoverJobDetails(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __jobDetails?.ToJson(container, serializationMode); + if (null != this._protectedItemDetail) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._protectedItemDetail ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("protectedItemDetails",__w); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FailoverProcessServerRequest.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FailoverProcessServerRequest.PowerShell.cs new file mode 100644 index 000000000000..f4e8aaaeb368 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FailoverProcessServerRequest.PowerShell.cs @@ -0,0 +1,186 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Request to failover a process server. + [System.ComponentModel.TypeConverter(typeof(FailoverProcessServerRequestTypeConverter))] + public partial class FailoverProcessServerRequest + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverProcessServerRequest DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new FailoverProcessServerRequest(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverProcessServerRequest DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new FailoverProcessServerRequest(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal FailoverProcessServerRequest(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverProcessServerRequestInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverProcessServerRequestProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverProcessServerRequestInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FailoverProcessServerRequestPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("ContainerName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverProcessServerRequestInternal)this).ContainerName = (string) content.GetValueForProperty("ContainerName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverProcessServerRequestInternal)this).ContainerName, global::System.Convert.ToString); + } + if (content.Contains("SourceProcessServerId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverProcessServerRequestInternal)this).SourceProcessServerId = (string) content.GetValueForProperty("SourceProcessServerId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverProcessServerRequestInternal)this).SourceProcessServerId, global::System.Convert.ToString); + } + if (content.Contains("TargetProcessServerId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverProcessServerRequestInternal)this).TargetProcessServerId = (string) content.GetValueForProperty("TargetProcessServerId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverProcessServerRequestInternal)this).TargetProcessServerId, global::System.Convert.ToString); + } + if (content.Contains("VmsToMigrate")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverProcessServerRequestInternal)this).VmsToMigrate = (string[]) content.GetValueForProperty("VmsToMigrate",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverProcessServerRequestInternal)this).VmsToMigrate, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("UpdateType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverProcessServerRequestInternal)this).UpdateType = (string) content.GetValueForProperty("UpdateType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverProcessServerRequestInternal)this).UpdateType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal FailoverProcessServerRequest(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverProcessServerRequestInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverProcessServerRequestProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverProcessServerRequestInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FailoverProcessServerRequestPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("ContainerName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverProcessServerRequestInternal)this).ContainerName = (string) content.GetValueForProperty("ContainerName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverProcessServerRequestInternal)this).ContainerName, global::System.Convert.ToString); + } + if (content.Contains("SourceProcessServerId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverProcessServerRequestInternal)this).SourceProcessServerId = (string) content.GetValueForProperty("SourceProcessServerId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverProcessServerRequestInternal)this).SourceProcessServerId, global::System.Convert.ToString); + } + if (content.Contains("TargetProcessServerId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverProcessServerRequestInternal)this).TargetProcessServerId = (string) content.GetValueForProperty("TargetProcessServerId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverProcessServerRequestInternal)this).TargetProcessServerId, global::System.Convert.ToString); + } + if (content.Contains("VmsToMigrate")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverProcessServerRequestInternal)this).VmsToMigrate = (string[]) content.GetValueForProperty("VmsToMigrate",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverProcessServerRequestInternal)this).VmsToMigrate, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("UpdateType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverProcessServerRequestInternal)this).UpdateType = (string) content.GetValueForProperty("UpdateType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverProcessServerRequestInternal)this).UpdateType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverProcessServerRequest FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Request to failover a process server. + [System.ComponentModel.TypeConverter(typeof(FailoverProcessServerRequestTypeConverter))] + public partial interface IFailoverProcessServerRequest + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FailoverProcessServerRequest.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FailoverProcessServerRequest.TypeConverter.cs new file mode 100644 index 000000000000..5de7191d8121 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FailoverProcessServerRequest.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class FailoverProcessServerRequestTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverProcessServerRequest ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverProcessServerRequest).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return FailoverProcessServerRequest.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return FailoverProcessServerRequest.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return FailoverProcessServerRequest.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FailoverProcessServerRequest.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FailoverProcessServerRequest.cs new file mode 100644 index 000000000000..2ad639d4ab07 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FailoverProcessServerRequest.cs @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Request to failover a process server. + public partial class FailoverProcessServerRequest : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverProcessServerRequest, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverProcessServerRequestInternal + { + + /// The container identifier. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ContainerName { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverProcessServerRequestPropertiesInternal)Property).ContainerName; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverProcessServerRequestPropertiesInternal)Property).ContainerName = value ?? null; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverProcessServerRequestProperties Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverProcessServerRequestInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FailoverProcessServerRequestProperties()); set { {_property = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverProcessServerRequestProperties _property; + + /// The properties of the PS Failover request. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverProcessServerRequestProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FailoverProcessServerRequestProperties()); set => this._property = value; } + + /// The source process server. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string SourceProcessServerId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverProcessServerRequestPropertiesInternal)Property).SourceProcessServerId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverProcessServerRequestPropertiesInternal)Property).SourceProcessServerId = value ?? null; } + + /// The new process server. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string TargetProcessServerId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverProcessServerRequestPropertiesInternal)Property).TargetProcessServerId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverProcessServerRequestPropertiesInternal)Property).TargetProcessServerId = value ?? null; } + + /// A value for failover type. It can be systemlevel/serverlevel. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string UpdateType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverProcessServerRequestPropertiesInternal)Property).UpdateType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverProcessServerRequestPropertiesInternal)Property).UpdateType = value ?? null; } + + /// The VMS to migrate. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string[] VmsToMigrate { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverProcessServerRequestPropertiesInternal)Property).VmsToMigrate; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverProcessServerRequestPropertiesInternal)Property).VmsToMigrate = value ?? null /* arrayOf */; } + + /// Creates an new instance. + public FailoverProcessServerRequest() + { + + } + } + /// Request to failover a process server. + public partial interface IFailoverProcessServerRequest : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The container identifier. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The container identifier.", + SerializedName = @"containerName", + PossibleTypes = new [] { typeof(string) })] + string ContainerName { get; set; } + /// The source process server. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The source process server.", + SerializedName = @"sourceProcessServerId", + PossibleTypes = new [] { typeof(string) })] + string SourceProcessServerId { get; set; } + /// The new process server. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The new process server.", + SerializedName = @"targetProcessServerId", + PossibleTypes = new [] { typeof(string) })] + string TargetProcessServerId { get; set; } + /// A value for failover type. It can be systemlevel/serverlevel. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value for failover type. It can be systemlevel/serverlevel.", + SerializedName = @"updateType", + PossibleTypes = new [] { typeof(string) })] + string UpdateType { get; set; } + /// The VMS to migrate. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The VMS to migrate.", + SerializedName = @"vmsToMigrate", + PossibleTypes = new [] { typeof(string) })] + string[] VmsToMigrate { get; set; } + + } + /// Request to failover a process server. + internal partial interface IFailoverProcessServerRequestInternal + + { + /// The container identifier. + string ContainerName { get; set; } + /// The properties of the PS Failover request. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverProcessServerRequestProperties Property { get; set; } + /// The source process server. + string SourceProcessServerId { get; set; } + /// The new process server. + string TargetProcessServerId { get; set; } + /// A value for failover type. It can be systemlevel/serverlevel. + string UpdateType { get; set; } + /// The VMS to migrate. + string[] VmsToMigrate { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FailoverProcessServerRequest.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FailoverProcessServerRequest.json.cs new file mode 100644 index 000000000000..f5f58b7e16b3 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FailoverProcessServerRequest.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Request to failover a process server. + public partial class FailoverProcessServerRequest + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal FailoverProcessServerRequest(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FailoverProcessServerRequestProperties.FromJson(__jsonProperties) : Property;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverProcessServerRequest. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverProcessServerRequest. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverProcessServerRequest FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new FailoverProcessServerRequest(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FailoverProcessServerRequestProperties.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FailoverProcessServerRequestProperties.PowerShell.cs new file mode 100644 index 000000000000..1d8f96d0c3fb --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FailoverProcessServerRequestProperties.PowerShell.cs @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// The properties of the Failover Process Server request. + [System.ComponentModel.TypeConverter(typeof(FailoverProcessServerRequestPropertiesTypeConverter))] + public partial class FailoverProcessServerRequestProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverProcessServerRequestProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new FailoverProcessServerRequestProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverProcessServerRequestProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new FailoverProcessServerRequestProperties(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal FailoverProcessServerRequestProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ContainerName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverProcessServerRequestPropertiesInternal)this).ContainerName = (string) content.GetValueForProperty("ContainerName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverProcessServerRequestPropertiesInternal)this).ContainerName, global::System.Convert.ToString); + } + if (content.Contains("SourceProcessServerId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverProcessServerRequestPropertiesInternal)this).SourceProcessServerId = (string) content.GetValueForProperty("SourceProcessServerId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverProcessServerRequestPropertiesInternal)this).SourceProcessServerId, global::System.Convert.ToString); + } + if (content.Contains("TargetProcessServerId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverProcessServerRequestPropertiesInternal)this).TargetProcessServerId = (string) content.GetValueForProperty("TargetProcessServerId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverProcessServerRequestPropertiesInternal)this).TargetProcessServerId, global::System.Convert.ToString); + } + if (content.Contains("VmsToMigrate")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverProcessServerRequestPropertiesInternal)this).VmsToMigrate = (string[]) content.GetValueForProperty("VmsToMigrate",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverProcessServerRequestPropertiesInternal)this).VmsToMigrate, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("UpdateType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverProcessServerRequestPropertiesInternal)this).UpdateType = (string) content.GetValueForProperty("UpdateType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverProcessServerRequestPropertiesInternal)this).UpdateType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal FailoverProcessServerRequestProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ContainerName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverProcessServerRequestPropertiesInternal)this).ContainerName = (string) content.GetValueForProperty("ContainerName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverProcessServerRequestPropertiesInternal)this).ContainerName, global::System.Convert.ToString); + } + if (content.Contains("SourceProcessServerId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverProcessServerRequestPropertiesInternal)this).SourceProcessServerId = (string) content.GetValueForProperty("SourceProcessServerId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverProcessServerRequestPropertiesInternal)this).SourceProcessServerId, global::System.Convert.ToString); + } + if (content.Contains("TargetProcessServerId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverProcessServerRequestPropertiesInternal)this).TargetProcessServerId = (string) content.GetValueForProperty("TargetProcessServerId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverProcessServerRequestPropertiesInternal)this).TargetProcessServerId, global::System.Convert.ToString); + } + if (content.Contains("VmsToMigrate")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverProcessServerRequestPropertiesInternal)this).VmsToMigrate = (string[]) content.GetValueForProperty("VmsToMigrate",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverProcessServerRequestPropertiesInternal)this).VmsToMigrate, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("UpdateType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverProcessServerRequestPropertiesInternal)this).UpdateType = (string) content.GetValueForProperty("UpdateType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverProcessServerRequestPropertiesInternal)this).UpdateType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json + /// string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverProcessServerRequestProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// The properties of the Failover Process Server request. + [System.ComponentModel.TypeConverter(typeof(FailoverProcessServerRequestPropertiesTypeConverter))] + public partial interface IFailoverProcessServerRequestProperties + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FailoverProcessServerRequestProperties.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FailoverProcessServerRequestProperties.TypeConverter.cs new file mode 100644 index 000000000000..a19b414cb280 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FailoverProcessServerRequestProperties.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class FailoverProcessServerRequestPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverProcessServerRequestProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverProcessServerRequestProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return FailoverProcessServerRequestProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return FailoverProcessServerRequestProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return FailoverProcessServerRequestProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FailoverProcessServerRequestProperties.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FailoverProcessServerRequestProperties.cs new file mode 100644 index 000000000000..a16ac1edf67a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FailoverProcessServerRequestProperties.cs @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The properties of the Failover Process Server request. + public partial class FailoverProcessServerRequestProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverProcessServerRequestProperties, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverProcessServerRequestPropertiesInternal + { + + /// Backing field for property. + private string _containerName; + + /// The container identifier. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ContainerName { get => this._containerName; set => this._containerName = value; } + + /// Backing field for property. + private string _sourceProcessServerId; + + /// The source process server. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string SourceProcessServerId { get => this._sourceProcessServerId; set => this._sourceProcessServerId = value; } + + /// Backing field for property. + private string _targetProcessServerId; + + /// The new process server. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetProcessServerId { get => this._targetProcessServerId; set => this._targetProcessServerId = value; } + + /// Backing field for property. + private string _updateType; + + /// A value for failover type. It can be systemlevel/serverlevel. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string UpdateType { get => this._updateType; set => this._updateType = value; } + + /// Backing field for property. + private string[] _vmsToMigrate; + + /// The VMS to migrate. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string[] VmsToMigrate { get => this._vmsToMigrate; set => this._vmsToMigrate = value; } + + /// Creates an new instance. + public FailoverProcessServerRequestProperties() + { + + } + } + /// The properties of the Failover Process Server request. + public partial interface IFailoverProcessServerRequestProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The container identifier. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The container identifier.", + SerializedName = @"containerName", + PossibleTypes = new [] { typeof(string) })] + string ContainerName { get; set; } + /// The source process server. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The source process server.", + SerializedName = @"sourceProcessServerId", + PossibleTypes = new [] { typeof(string) })] + string SourceProcessServerId { get; set; } + /// The new process server. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The new process server.", + SerializedName = @"targetProcessServerId", + PossibleTypes = new [] { typeof(string) })] + string TargetProcessServerId { get; set; } + /// A value for failover type. It can be systemlevel/serverlevel. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value for failover type. It can be systemlevel/serverlevel.", + SerializedName = @"updateType", + PossibleTypes = new [] { typeof(string) })] + string UpdateType { get; set; } + /// The VMS to migrate. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The VMS to migrate.", + SerializedName = @"vmsToMigrate", + PossibleTypes = new [] { typeof(string) })] + string[] VmsToMigrate { get; set; } + + } + /// The properties of the Failover Process Server request. + internal partial interface IFailoverProcessServerRequestPropertiesInternal + + { + /// The container identifier. + string ContainerName { get; set; } + /// The source process server. + string SourceProcessServerId { get; set; } + /// The new process server. + string TargetProcessServerId { get; set; } + /// A value for failover type. It can be systemlevel/serverlevel. + string UpdateType { get; set; } + /// The VMS to migrate. + string[] VmsToMigrate { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FailoverProcessServerRequestProperties.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FailoverProcessServerRequestProperties.json.cs new file mode 100644 index 000000000000..c2f5df4d050e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FailoverProcessServerRequestProperties.json.cs @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The properties of the Failover Process Server request. + public partial class FailoverProcessServerRequestProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal FailoverProcessServerRequestProperties(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_containerName = If( json?.PropertyT("containerName"), out var __jsonContainerName) ? (string)__jsonContainerName : (string)ContainerName;} + {_sourceProcessServerId = If( json?.PropertyT("sourceProcessServerId"), out var __jsonSourceProcessServerId) ? (string)__jsonSourceProcessServerId : (string)SourceProcessServerId;} + {_targetProcessServerId = If( json?.PropertyT("targetProcessServerId"), out var __jsonTargetProcessServerId) ? (string)__jsonTargetProcessServerId : (string)TargetProcessServerId;} + {_vmsToMigrate = If( json?.PropertyT("vmsToMigrate"), out var __jsonVmsToMigrate) ? If( __jsonVmsToMigrate as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(string) (__u is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : VmsToMigrate;} + {_updateType = If( json?.PropertyT("updateType"), out var __jsonUpdateType) ? (string)__jsonUpdateType : (string)UpdateType;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverProcessServerRequestProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverProcessServerRequestProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverProcessServerRequestProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new FailoverProcessServerRequestProperties(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._containerName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._containerName.ToString()) : null, "containerName" ,container.Add ); + AddIf( null != (((object)this._sourceProcessServerId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._sourceProcessServerId.ToString()) : null, "sourceProcessServerId" ,container.Add ); + AddIf( null != (((object)this._targetProcessServerId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetProcessServerId.ToString()) : null, "targetProcessServerId" ,container.Add ); + if (null != this._vmsToMigrate) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._vmsToMigrate ) + { + AddIf(null != (((object)__x)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(__x.ToString()) : null ,__w.Add); + } + container.Add("vmsToMigrate",__w); + } + AddIf( null != (((object)this._updateType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._updateType.ToString()) : null, "updateType" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FailoverReplicationProtectedItemDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FailoverReplicationProtectedItemDetails.PowerShell.cs new file mode 100644 index 000000000000..ee88b6c73a84 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FailoverReplicationProtectedItemDetails.PowerShell.cs @@ -0,0 +1,213 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Failover details for a replication protected item. + [System.ComponentModel.TypeConverter(typeof(FailoverReplicationProtectedItemDetailsTypeConverter))] + public partial class FailoverReplicationProtectedItemDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverReplicationProtectedItemDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new FailoverReplicationProtectedItemDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverReplicationProtectedItemDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new FailoverReplicationProtectedItemDetails(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal FailoverReplicationProtectedItemDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverReplicationProtectedItemDetailsInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverReplicationProtectedItemDetailsInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("FriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverReplicationProtectedItemDetailsInternal)this).FriendlyName = (string) content.GetValueForProperty("FriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverReplicationProtectedItemDetailsInternal)this).FriendlyName, global::System.Convert.ToString); + } + if (content.Contains("TestVMName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverReplicationProtectedItemDetailsInternal)this).TestVMName = (string) content.GetValueForProperty("TestVMName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverReplicationProtectedItemDetailsInternal)this).TestVMName, global::System.Convert.ToString); + } + if (content.Contains("TestVMFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverReplicationProtectedItemDetailsInternal)this).TestVMFriendlyName = (string) content.GetValueForProperty("TestVMFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverReplicationProtectedItemDetailsInternal)this).TestVMFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("NetworkConnectionStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverReplicationProtectedItemDetailsInternal)this).NetworkConnectionStatus = (string) content.GetValueForProperty("NetworkConnectionStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverReplicationProtectedItemDetailsInternal)this).NetworkConnectionStatus, global::System.Convert.ToString); + } + if (content.Contains("NetworkFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverReplicationProtectedItemDetailsInternal)this).NetworkFriendlyName = (string) content.GetValueForProperty("NetworkFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverReplicationProtectedItemDetailsInternal)this).NetworkFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("Subnet")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverReplicationProtectedItemDetailsInternal)this).Subnet = (string) content.GetValueForProperty("Subnet",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverReplicationProtectedItemDetailsInternal)this).Subnet, global::System.Convert.ToString); + } + if (content.Contains("RecoveryPointId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverReplicationProtectedItemDetailsInternal)this).RecoveryPointId = (string) content.GetValueForProperty("RecoveryPointId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverReplicationProtectedItemDetailsInternal)this).RecoveryPointId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryPointTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverReplicationProtectedItemDetailsInternal)this).RecoveryPointTime = (global::System.DateTime?) content.GetValueForProperty("RecoveryPointTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverReplicationProtectedItemDetailsInternal)this).RecoveryPointTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal FailoverReplicationProtectedItemDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverReplicationProtectedItemDetailsInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverReplicationProtectedItemDetailsInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("FriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverReplicationProtectedItemDetailsInternal)this).FriendlyName = (string) content.GetValueForProperty("FriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverReplicationProtectedItemDetailsInternal)this).FriendlyName, global::System.Convert.ToString); + } + if (content.Contains("TestVMName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverReplicationProtectedItemDetailsInternal)this).TestVMName = (string) content.GetValueForProperty("TestVMName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverReplicationProtectedItemDetailsInternal)this).TestVMName, global::System.Convert.ToString); + } + if (content.Contains("TestVMFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverReplicationProtectedItemDetailsInternal)this).TestVMFriendlyName = (string) content.GetValueForProperty("TestVMFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverReplicationProtectedItemDetailsInternal)this).TestVMFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("NetworkConnectionStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverReplicationProtectedItemDetailsInternal)this).NetworkConnectionStatus = (string) content.GetValueForProperty("NetworkConnectionStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverReplicationProtectedItemDetailsInternal)this).NetworkConnectionStatus, global::System.Convert.ToString); + } + if (content.Contains("NetworkFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverReplicationProtectedItemDetailsInternal)this).NetworkFriendlyName = (string) content.GetValueForProperty("NetworkFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverReplicationProtectedItemDetailsInternal)this).NetworkFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("Subnet")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverReplicationProtectedItemDetailsInternal)this).Subnet = (string) content.GetValueForProperty("Subnet",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverReplicationProtectedItemDetailsInternal)this).Subnet, global::System.Convert.ToString); + } + if (content.Contains("RecoveryPointId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverReplicationProtectedItemDetailsInternal)this).RecoveryPointId = (string) content.GetValueForProperty("RecoveryPointId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverReplicationProtectedItemDetailsInternal)this).RecoveryPointId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryPointTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverReplicationProtectedItemDetailsInternal)this).RecoveryPointTime = (global::System.DateTime?) content.GetValueForProperty("RecoveryPointTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverReplicationProtectedItemDetailsInternal)this).RecoveryPointTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + AfterDeserializePSObject(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json + /// string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverReplicationProtectedItemDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Failover details for a replication protected item. + [System.ComponentModel.TypeConverter(typeof(FailoverReplicationProtectedItemDetailsTypeConverter))] + public partial interface IFailoverReplicationProtectedItemDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FailoverReplicationProtectedItemDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FailoverReplicationProtectedItemDetails.TypeConverter.cs new file mode 100644 index 000000000000..6b1c3a706a3a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FailoverReplicationProtectedItemDetails.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class FailoverReplicationProtectedItemDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverReplicationProtectedItemDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverReplicationProtectedItemDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return FailoverReplicationProtectedItemDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return FailoverReplicationProtectedItemDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return FailoverReplicationProtectedItemDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FailoverReplicationProtectedItemDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FailoverReplicationProtectedItemDetails.cs new file mode 100644 index 000000000000..64be7e498516 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FailoverReplicationProtectedItemDetails.cs @@ -0,0 +1,187 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Failover details for a replication protected item. + public partial class FailoverReplicationProtectedItemDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverReplicationProtectedItemDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverReplicationProtectedItemDetailsInternal + { + + /// Backing field for property. + private string _friendlyName; + + /// The friendly name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string FriendlyName { get => this._friendlyName; set => this._friendlyName = value; } + + /// Backing field for property. + private string _name; + + /// The name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Name { get => this._name; set => this._name = value; } + + /// Backing field for property. + private string _networkConnectionStatus; + + /// The network connection status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string NetworkConnectionStatus { get => this._networkConnectionStatus; set => this._networkConnectionStatus = value; } + + /// Backing field for property. + private string _networkFriendlyName; + + /// The network friendly name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string NetworkFriendlyName { get => this._networkFriendlyName; set => this._networkFriendlyName = value; } + + /// Backing field for property. + private string _recoveryPointId; + + /// The recovery point Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryPointId { get => this._recoveryPointId; set => this._recoveryPointId = value; } + + /// Backing field for property. + private global::System.DateTime? _recoveryPointTime; + + /// The recovery point time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public global::System.DateTime? RecoveryPointTime { get => this._recoveryPointTime; set => this._recoveryPointTime = value; } + + /// Backing field for property. + private string _subnet; + + /// The network subnet. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Subnet { get => this._subnet; set => this._subnet = value; } + + /// Backing field for property. + private string _testVMFriendlyName; + + /// The test Vm friendly name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TestVMFriendlyName { get => this._testVMFriendlyName; set => this._testVMFriendlyName = value; } + + /// Backing field for property. + private string _testVMName; + + /// The test Vm name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TestVMName { get => this._testVMName; set => this._testVMName = value; } + + /// Creates an new instance. + public FailoverReplicationProtectedItemDetails() + { + + } + } + /// Failover details for a replication protected item. + public partial interface IFailoverReplicationProtectedItemDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The friendly name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The friendly name.", + SerializedName = @"friendlyName", + PossibleTypes = new [] { typeof(string) })] + string FriendlyName { get; set; } + /// The name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string Name { get; set; } + /// The network connection status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The network connection status.", + SerializedName = @"networkConnectionStatus", + PossibleTypes = new [] { typeof(string) })] + string NetworkConnectionStatus { get; set; } + /// The network friendly name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The network friendly name.", + SerializedName = @"networkFriendlyName", + PossibleTypes = new [] { typeof(string) })] + string NetworkFriendlyName { get; set; } + /// The recovery point Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery point Id.", + SerializedName = @"recoveryPointId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryPointId { get; set; } + /// The recovery point time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery point time.", + SerializedName = @"recoveryPointTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? RecoveryPointTime { get; set; } + /// The network subnet. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The network subnet.", + SerializedName = @"subnet", + PossibleTypes = new [] { typeof(string) })] + string Subnet { get; set; } + /// The test Vm friendly name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The test Vm friendly name.", + SerializedName = @"testVmFriendlyName", + PossibleTypes = new [] { typeof(string) })] + string TestVMFriendlyName { get; set; } + /// The test Vm name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The test Vm name.", + SerializedName = @"testVmName", + PossibleTypes = new [] { typeof(string) })] + string TestVMName { get; set; } + + } + /// Failover details for a replication protected item. + internal partial interface IFailoverReplicationProtectedItemDetailsInternal + + { + /// The friendly name. + string FriendlyName { get; set; } + /// The name. + string Name { get; set; } + /// The network connection status. + string NetworkConnectionStatus { get; set; } + /// The network friendly name. + string NetworkFriendlyName { get; set; } + /// The recovery point Id. + string RecoveryPointId { get; set; } + /// The recovery point time. + global::System.DateTime? RecoveryPointTime { get; set; } + /// The network subnet. + string Subnet { get; set; } + /// The test Vm friendly name. + string TestVMFriendlyName { get; set; } + /// The test Vm name. + string TestVMName { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FailoverReplicationProtectedItemDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FailoverReplicationProtectedItemDetails.json.cs new file mode 100644 index 000000000000..94d111c26880 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/FailoverReplicationProtectedItemDetails.json.cs @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Failover details for a replication protected item. + public partial class FailoverReplicationProtectedItemDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal FailoverReplicationProtectedItemDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)Name;} + {_friendlyName = If( json?.PropertyT("friendlyName"), out var __jsonFriendlyName) ? (string)__jsonFriendlyName : (string)FriendlyName;} + {_testVMName = If( json?.PropertyT("testVmName"), out var __jsonTestVMName) ? (string)__jsonTestVMName : (string)TestVMName;} + {_testVMFriendlyName = If( json?.PropertyT("testVmFriendlyName"), out var __jsonTestVMFriendlyName) ? (string)__jsonTestVMFriendlyName : (string)TestVMFriendlyName;} + {_networkConnectionStatus = If( json?.PropertyT("networkConnectionStatus"), out var __jsonNetworkConnectionStatus) ? (string)__jsonNetworkConnectionStatus : (string)NetworkConnectionStatus;} + {_networkFriendlyName = If( json?.PropertyT("networkFriendlyName"), out var __jsonNetworkFriendlyName) ? (string)__jsonNetworkFriendlyName : (string)NetworkFriendlyName;} + {_subnet = If( json?.PropertyT("subnet"), out var __jsonSubnet) ? (string)__jsonSubnet : (string)Subnet;} + {_recoveryPointId = If( json?.PropertyT("recoveryPointId"), out var __jsonRecoveryPointId) ? (string)__jsonRecoveryPointId : (string)RecoveryPointId;} + {_recoveryPointTime = If( json?.PropertyT("recoveryPointTime"), out var __jsonRecoveryPointTime) ? global::System.DateTime.TryParse((string)__jsonRecoveryPointTime, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonRecoveryPointTimeValue) ? __jsonRecoveryPointTimeValue : RecoveryPointTime : RecoveryPointTime;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverReplicationProtectedItemDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverReplicationProtectedItemDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverReplicationProtectedItemDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new FailoverReplicationProtectedItemDetails(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); + AddIf( null != (((object)this._friendlyName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._friendlyName.ToString()) : null, "friendlyName" ,container.Add ); + AddIf( null != (((object)this._testVMName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._testVMName.ToString()) : null, "testVmName" ,container.Add ); + AddIf( null != (((object)this._testVMFriendlyName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._testVMFriendlyName.ToString()) : null, "testVmFriendlyName" ,container.Add ); + AddIf( null != (((object)this._networkConnectionStatus)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._networkConnectionStatus.ToString()) : null, "networkConnectionStatus" ,container.Add ); + AddIf( null != (((object)this._networkFriendlyName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._networkFriendlyName.ToString()) : null, "networkFriendlyName" ,container.Add ); + AddIf( null != (((object)this._subnet)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._subnet.ToString()) : null, "subnet" ,container.Add ); + AddIf( null != (((object)this._recoveryPointId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryPointId.ToString()) : null, "recoveryPointId" ,container.Add ); + AddIf( null != this._recoveryPointTime ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryPointTime?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "recoveryPointTime" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/GroupTaskDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/GroupTaskDetails.PowerShell.cs new file mode 100644 index 000000000000..da601032c551 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/GroupTaskDetails.PowerShell.cs @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// This class represents the group task details when parent child relationship exists in the drill down. + /// + [System.ComponentModel.TypeConverter(typeof(GroupTaskDetailsTypeConverter))] + public partial class GroupTaskDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IGroupTaskDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new GroupTaskDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IGroupTaskDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new GroupTaskDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IGroupTaskDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal GroupTaskDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IGroupTaskDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IGroupTaskDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + if (content.Contains("ChildTask")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IGroupTaskDetailsInternal)this).ChildTask = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTask[]) content.GetValueForProperty("ChildTask",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IGroupTaskDetailsInternal)this).ChildTask, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AsrTaskTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal GroupTaskDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IGroupTaskDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IGroupTaskDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + if (content.Contains("ChildTask")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IGroupTaskDetailsInternal)this).ChildTask = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTask[]) content.GetValueForProperty("ChildTask",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IGroupTaskDetailsInternal)this).ChildTask, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AsrTaskTypeConverter.ConvertFrom)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// This class represents the group task details when parent child relationship exists in the drill down. + [System.ComponentModel.TypeConverter(typeof(GroupTaskDetailsTypeConverter))] + public partial interface IGroupTaskDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/GroupTaskDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/GroupTaskDetails.TypeConverter.cs new file mode 100644 index 000000000000..04ce745f5bbc --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/GroupTaskDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class GroupTaskDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IGroupTaskDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IGroupTaskDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return GroupTaskDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return GroupTaskDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return GroupTaskDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/GroupTaskDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/GroupTaskDetails.cs new file mode 100644 index 000000000000..fc84dc33d105 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/GroupTaskDetails.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// + /// This class represents the group task details when parent child relationship exists in the drill down. + /// + public partial class GroupTaskDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IGroupTaskDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IGroupTaskDetailsInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTask[] _childTask; + + /// The child tasks. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTask[] ChildTask { get => this._childTask; set => this._childTask = value; } + + /// Backing field for property. + private string _instanceType; + + /// The type of task details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string InstanceType { get => this._instanceType; set => this._instanceType = value; } + + /// Creates an new instance. + public GroupTaskDetails() + { + + } + } + /// This class represents the group task details when parent child relationship exists in the drill down. + public partial interface IGroupTaskDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The child tasks. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The child tasks.", + SerializedName = @"childTasks", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTask) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTask[] ChildTask { get; set; } + /// The type of task details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The type of task details.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string InstanceType { get; set; } + + } + /// This class represents the group task details when parent child relationship exists in the drill down. + internal partial interface IGroupTaskDetailsInternal + + { + /// The child tasks. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTask[] ChildTask { get; set; } + /// The type of task details. + string InstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/GroupTaskDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/GroupTaskDetails.json.cs new file mode 100644 index 000000000000..8b341cbabade --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/GroupTaskDetails.json.cs @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// + /// This class represents the group task details when parent child relationship exists in the drill down. + /// + public partial class GroupTaskDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IGroupTaskDetails. + /// Note: the Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IGroupTaskDetails interface is polymorphic, + /// and the precise model class that will get deserialized is determined at runtime based on the payload. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IGroupTaskDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IGroupTaskDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + if (!(node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json)) + { + return null; + } + // Polymorphic type -- select the appropriate constructor using the discriminator + + switch ( json.StringProperty("instanceType") ) + { + case "InlineWorkflowTaskDetails": + { + return new InlineWorkflowTaskDetails(json); + } + case "RecoveryPlanGroupTaskDetails": + { + return new RecoveryPlanGroupTaskDetails(json); + } + case "RecoveryPlanShutdownGroupTaskDetails": + { + return new RecoveryPlanShutdownGroupTaskDetails(json); + } + } + return new GroupTaskDetails(json); + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal GroupTaskDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_instanceType = If( json?.PropertyT("instanceType"), out var __jsonInstanceType) ? (string)__jsonInstanceType : (string)InstanceType;} + {_childTask = If( json?.PropertyT("childTasks"), out var __jsonChildTasks) ? If( __jsonChildTasks as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTask) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AsrTask.FromJson(__u) )) ))() : null : ChildTask;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._instanceType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._instanceType.ToString()) : null, "instanceType" ,container.Add ); + if (null != this._childTask) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._childTask ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("childTasks",__w); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HealthError.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HealthError.PowerShell.cs new file mode 100644 index 000000000000..c820eb4d4fa9 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HealthError.PowerShell.cs @@ -0,0 +1,256 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Health Error. + [System.ComponentModel.TypeConverter(typeof(HealthErrorTypeConverter))] + public partial class HealthError + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new HealthError(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new HealthError(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal HealthError(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InnerHealthError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorInternal)this).InnerHealthError = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInnerHealthError[]) content.GetValueForProperty("InnerHealthError",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorInternal)this).InnerHealthError, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InnerHealthErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("ErrorSource")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorInternal)this).ErrorSource = (string) content.GetValueForProperty("ErrorSource",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorInternal)this).ErrorSource, global::System.Convert.ToString); + } + if (content.Contains("ErrorType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorInternal)this).ErrorType = (string) content.GetValueForProperty("ErrorType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorInternal)this).ErrorType, global::System.Convert.ToString); + } + if (content.Contains("ErrorLevel")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorInternal)this).ErrorLevel = (string) content.GetValueForProperty("ErrorLevel",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorInternal)this).ErrorLevel, global::System.Convert.ToString); + } + if (content.Contains("ErrorCategory")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorInternal)this).ErrorCategory = (string) content.GetValueForProperty("ErrorCategory",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorInternal)this).ErrorCategory, global::System.Convert.ToString); + } + if (content.Contains("ErrorCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorInternal)this).ErrorCode = (string) content.GetValueForProperty("ErrorCode",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorInternal)this).ErrorCode, global::System.Convert.ToString); + } + if (content.Contains("SummaryMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorInternal)this).SummaryMessage = (string) content.GetValueForProperty("SummaryMessage",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorInternal)this).SummaryMessage, global::System.Convert.ToString); + } + if (content.Contains("ErrorMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorInternal)this).ErrorMessage = (string) content.GetValueForProperty("ErrorMessage",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorInternal)this).ErrorMessage, global::System.Convert.ToString); + } + if (content.Contains("PossibleCaus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorInternal)this).PossibleCaus = (string) content.GetValueForProperty("PossibleCaus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorInternal)this).PossibleCaus, global::System.Convert.ToString); + } + if (content.Contains("RecommendedAction")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorInternal)this).RecommendedAction = (string) content.GetValueForProperty("RecommendedAction",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorInternal)this).RecommendedAction, global::System.Convert.ToString); + } + if (content.Contains("CreationTimeUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorInternal)this).CreationTimeUtc = (global::System.DateTime?) content.GetValueForProperty("CreationTimeUtc",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorInternal)this).CreationTimeUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("RecoveryProviderErrorMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorInternal)this).RecoveryProviderErrorMessage = (string) content.GetValueForProperty("RecoveryProviderErrorMessage",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorInternal)this).RecoveryProviderErrorMessage, global::System.Convert.ToString); + } + if (content.Contains("EntityId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorInternal)this).EntityId = (string) content.GetValueForProperty("EntityId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorInternal)this).EntityId, global::System.Convert.ToString); + } + if (content.Contains("ErrorId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorInternal)this).ErrorId = (string) content.GetValueForProperty("ErrorId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorInternal)this).ErrorId, global::System.Convert.ToString); + } + if (content.Contains("CustomerResolvability")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorInternal)this).CustomerResolvability = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.HealthErrorCustomerResolvability?) content.GetValueForProperty("CustomerResolvability",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorInternal)this).CustomerResolvability, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.HealthErrorCustomerResolvability.CreateFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal HealthError(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InnerHealthError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorInternal)this).InnerHealthError = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInnerHealthError[]) content.GetValueForProperty("InnerHealthError",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorInternal)this).InnerHealthError, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InnerHealthErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("ErrorSource")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorInternal)this).ErrorSource = (string) content.GetValueForProperty("ErrorSource",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorInternal)this).ErrorSource, global::System.Convert.ToString); + } + if (content.Contains("ErrorType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorInternal)this).ErrorType = (string) content.GetValueForProperty("ErrorType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorInternal)this).ErrorType, global::System.Convert.ToString); + } + if (content.Contains("ErrorLevel")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorInternal)this).ErrorLevel = (string) content.GetValueForProperty("ErrorLevel",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorInternal)this).ErrorLevel, global::System.Convert.ToString); + } + if (content.Contains("ErrorCategory")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorInternal)this).ErrorCategory = (string) content.GetValueForProperty("ErrorCategory",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorInternal)this).ErrorCategory, global::System.Convert.ToString); + } + if (content.Contains("ErrorCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorInternal)this).ErrorCode = (string) content.GetValueForProperty("ErrorCode",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorInternal)this).ErrorCode, global::System.Convert.ToString); + } + if (content.Contains("SummaryMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorInternal)this).SummaryMessage = (string) content.GetValueForProperty("SummaryMessage",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorInternal)this).SummaryMessage, global::System.Convert.ToString); + } + if (content.Contains("ErrorMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorInternal)this).ErrorMessage = (string) content.GetValueForProperty("ErrorMessage",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorInternal)this).ErrorMessage, global::System.Convert.ToString); + } + if (content.Contains("PossibleCaus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorInternal)this).PossibleCaus = (string) content.GetValueForProperty("PossibleCaus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorInternal)this).PossibleCaus, global::System.Convert.ToString); + } + if (content.Contains("RecommendedAction")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorInternal)this).RecommendedAction = (string) content.GetValueForProperty("RecommendedAction",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorInternal)this).RecommendedAction, global::System.Convert.ToString); + } + if (content.Contains("CreationTimeUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorInternal)this).CreationTimeUtc = (global::System.DateTime?) content.GetValueForProperty("CreationTimeUtc",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorInternal)this).CreationTimeUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("RecoveryProviderErrorMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorInternal)this).RecoveryProviderErrorMessage = (string) content.GetValueForProperty("RecoveryProviderErrorMessage",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorInternal)this).RecoveryProviderErrorMessage, global::System.Convert.ToString); + } + if (content.Contains("EntityId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorInternal)this).EntityId = (string) content.GetValueForProperty("EntityId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorInternal)this).EntityId, global::System.Convert.ToString); + } + if (content.Contains("ErrorId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorInternal)this).ErrorId = (string) content.GetValueForProperty("ErrorId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorInternal)this).ErrorId, global::System.Convert.ToString); + } + if (content.Contains("CustomerResolvability")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorInternal)this).CustomerResolvability = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.HealthErrorCustomerResolvability?) content.GetValueForProperty("CustomerResolvability",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorInternal)this).CustomerResolvability, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.HealthErrorCustomerResolvability.CreateFrom); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Health Error. + [System.ComponentModel.TypeConverter(typeof(HealthErrorTypeConverter))] + public partial interface IHealthError + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HealthError.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HealthError.TypeConverter.cs new file mode 100644 index 000000000000..05a75ddb6001 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HealthError.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class HealthErrorTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return HealthError.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return HealthError.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return HealthError.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HealthError.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HealthError.cs new file mode 100644 index 000000000000..a670c7be91d7 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HealthError.cs @@ -0,0 +1,304 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Health Error. + public partial class HealthError : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorInternal + { + + /// Backing field for property. + private global::System.DateTime? _creationTimeUtc; + + /// Error creation time (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public global::System.DateTime? CreationTimeUtc { get => this._creationTimeUtc; set => this._creationTimeUtc = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.HealthErrorCustomerResolvability? _customerResolvability; + + /// Value indicating whether the health error is customer resolvable. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.HealthErrorCustomerResolvability? CustomerResolvability { get => this._customerResolvability; set => this._customerResolvability = value; } + + /// Backing field for property. + private string _entityId; + + /// ID of the entity. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string EntityId { get => this._entityId; set => this._entityId = value; } + + /// Backing field for property. + private string _errorCategory; + + /// Category of error. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ErrorCategory { get => this._errorCategory; set => this._errorCategory = value; } + + /// Backing field for property. + private string _errorCode; + + /// Error code. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ErrorCode { get => this._errorCode; set => this._errorCode = value; } + + /// Backing field for property. + private string _errorId; + + /// The health error unique id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ErrorId { get => this._errorId; set => this._errorId = value; } + + /// Backing field for property. + private string _errorLevel; + + /// Level of error. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ErrorLevel { get => this._errorLevel; set => this._errorLevel = value; } + + /// Backing field for property. + private string _errorMessage; + + /// Error message. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ErrorMessage { get => this._errorMessage; set => this._errorMessage = value; } + + /// Backing field for property. + private string _errorSource; + + /// Source of error. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ErrorSource { get => this._errorSource; set => this._errorSource = value; } + + /// Backing field for property. + private string _errorType; + + /// Type of error. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ErrorType { get => this._errorType; set => this._errorType = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInnerHealthError[] _innerHealthError; + + /// + /// 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. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInnerHealthError[] InnerHealthError { get => this._innerHealthError; set => this._innerHealthError = value; } + + /// Backing field for property. + private string _possibleCaus; + + /// Possible causes of error. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string PossibleCaus { get => this._possibleCaus; set => this._possibleCaus = value; } + + /// Backing field for property. + private string _recommendedAction; + + /// Recommended action to resolve error. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecommendedAction { get => this._recommendedAction; set => this._recommendedAction = value; } + + /// Backing field for property. + private string _recoveryProviderErrorMessage; + + /// DRA error message. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryProviderErrorMessage { get => this._recoveryProviderErrorMessage; set => this._recoveryProviderErrorMessage = value; } + + /// Backing field for property. + private string _summaryMessage; + + /// Summary message of the entity. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string SummaryMessage { get => this._summaryMessage; set => this._summaryMessage = value; } + + /// Creates an new instance. + public HealthError() + { + + } + } + /// Health Error. + public partial interface IHealthError : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// Error creation time (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Error creation time (UTC).", + SerializedName = @"creationTimeUtc", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? CreationTimeUtc { get; set; } + /// Value indicating whether the health error is customer resolvable. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Value indicating whether the health error is customer resolvable.", + SerializedName = @"customerResolvability", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.HealthErrorCustomerResolvability) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.HealthErrorCustomerResolvability? CustomerResolvability { get; set; } + /// ID of the entity. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"ID of the entity.", + SerializedName = @"entityId", + PossibleTypes = new [] { typeof(string) })] + string EntityId { get; set; } + /// Category of error. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Category of error.", + SerializedName = @"errorCategory", + PossibleTypes = new [] { typeof(string) })] + string ErrorCategory { get; set; } + /// Error code. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Error code.", + SerializedName = @"errorCode", + PossibleTypes = new [] { typeof(string) })] + string ErrorCode { get; set; } + /// The health error unique id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The health error unique id.", + SerializedName = @"errorId", + PossibleTypes = new [] { typeof(string) })] + string ErrorId { get; set; } + /// Level of error. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Level of error.", + SerializedName = @"errorLevel", + PossibleTypes = new [] { typeof(string) })] + string ErrorLevel { get; set; } + /// Error message. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Error message.", + SerializedName = @"errorMessage", + PossibleTypes = new [] { typeof(string) })] + string ErrorMessage { get; set; } + /// Source of error. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Source of error.", + SerializedName = @"errorSource", + PossibleTypes = new [] { typeof(string) })] + string ErrorSource { get; set; } + /// Type of error. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Type of error.", + SerializedName = @"errorType", + PossibleTypes = new [] { typeof(string) })] + string ErrorType { get; set; } + /// + /// 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. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"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.", + SerializedName = @"innerHealthErrors", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInnerHealthError) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInnerHealthError[] InnerHealthError { get; set; } + /// Possible causes of error. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Possible causes of error.", + SerializedName = @"possibleCauses", + PossibleTypes = new [] { typeof(string) })] + string PossibleCaus { get; set; } + /// Recommended action to resolve error. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Recommended action to resolve error.", + SerializedName = @"recommendedAction", + PossibleTypes = new [] { typeof(string) })] + string RecommendedAction { get; set; } + /// DRA error message. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"DRA error message.", + SerializedName = @"recoveryProviderErrorMessage", + PossibleTypes = new [] { typeof(string) })] + string RecoveryProviderErrorMessage { get; set; } + /// Summary message of the entity. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Summary message of the entity.", + SerializedName = @"summaryMessage", + PossibleTypes = new [] { typeof(string) })] + string SummaryMessage { get; set; } + + } + /// Health Error. + internal partial interface IHealthErrorInternal + + { + /// Error creation time (UTC). + global::System.DateTime? CreationTimeUtc { get; set; } + /// Value indicating whether the health error is customer resolvable. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.HealthErrorCustomerResolvability? CustomerResolvability { get; set; } + /// ID of the entity. + string EntityId { get; set; } + /// Category of error. + string ErrorCategory { get; set; } + /// Error code. + string ErrorCode { get; set; } + /// The health error unique id. + string ErrorId { get; set; } + /// Level of error. + string ErrorLevel { get; set; } + /// Error message. + string ErrorMessage { get; set; } + /// Source of error. + string ErrorSource { get; set; } + /// Type of error. + string ErrorType { get; set; } + /// + /// 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. + /// + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInnerHealthError[] InnerHealthError { get; set; } + /// Possible causes of error. + string PossibleCaus { get; set; } + /// Recommended action to resolve error. + string RecommendedAction { get; set; } + /// DRA error message. + string RecoveryProviderErrorMessage { get; set; } + /// Summary message of the entity. + string SummaryMessage { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HealthError.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HealthError.json.cs new file mode 100644 index 000000000000..265968485699 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HealthError.json.cs @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Health Error. + public partial class HealthError + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new HealthError(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal HealthError(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_innerHealthError = If( json?.PropertyT("innerHealthErrors"), out var __jsonInnerHealthErrors) ? If( __jsonInnerHealthErrors as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInnerHealthError) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InnerHealthError.FromJson(__u) )) ))() : null : InnerHealthError;} + {_errorSource = If( json?.PropertyT("errorSource"), out var __jsonErrorSource) ? (string)__jsonErrorSource : (string)ErrorSource;} + {_errorType = If( json?.PropertyT("errorType"), out var __jsonErrorType) ? (string)__jsonErrorType : (string)ErrorType;} + {_errorLevel = If( json?.PropertyT("errorLevel"), out var __jsonErrorLevel) ? (string)__jsonErrorLevel : (string)ErrorLevel;} + {_errorCategory = If( json?.PropertyT("errorCategory"), out var __jsonErrorCategory) ? (string)__jsonErrorCategory : (string)ErrorCategory;} + {_errorCode = If( json?.PropertyT("errorCode"), out var __jsonErrorCode) ? (string)__jsonErrorCode : (string)ErrorCode;} + {_summaryMessage = If( json?.PropertyT("summaryMessage"), out var __jsonSummaryMessage) ? (string)__jsonSummaryMessage : (string)SummaryMessage;} + {_errorMessage = If( json?.PropertyT("errorMessage"), out var __jsonErrorMessage) ? (string)__jsonErrorMessage : (string)ErrorMessage;} + {_possibleCaus = If( json?.PropertyT("possibleCauses"), out var __jsonPossibleCauses) ? (string)__jsonPossibleCauses : (string)PossibleCaus;} + {_recommendedAction = If( json?.PropertyT("recommendedAction"), out var __jsonRecommendedAction) ? (string)__jsonRecommendedAction : (string)RecommendedAction;} + {_creationTimeUtc = If( json?.PropertyT("creationTimeUtc"), out var __jsonCreationTimeUtc) ? global::System.DateTime.TryParse((string)__jsonCreationTimeUtc, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonCreationTimeUtcValue) ? __jsonCreationTimeUtcValue : CreationTimeUtc : CreationTimeUtc;} + {_recoveryProviderErrorMessage = If( json?.PropertyT("recoveryProviderErrorMessage"), out var __jsonRecoveryProviderErrorMessage) ? (string)__jsonRecoveryProviderErrorMessage : (string)RecoveryProviderErrorMessage;} + {_entityId = If( json?.PropertyT("entityId"), out var __jsonEntityId) ? (string)__jsonEntityId : (string)EntityId;} + {_errorId = If( json?.PropertyT("errorId"), out var __jsonErrorId) ? (string)__jsonErrorId : (string)ErrorId;} + {_customerResolvability = If( json?.PropertyT("customerResolvability"), out var __jsonCustomerResolvability) ? (string)__jsonCustomerResolvability : (string)CustomerResolvability;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._innerHealthError) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._innerHealthError ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("innerHealthErrors",__w); + } + AddIf( null != (((object)this._errorSource)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._errorSource.ToString()) : null, "errorSource" ,container.Add ); + AddIf( null != (((object)this._errorType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._errorType.ToString()) : null, "errorType" ,container.Add ); + AddIf( null != (((object)this._errorLevel)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._errorLevel.ToString()) : null, "errorLevel" ,container.Add ); + AddIf( null != (((object)this._errorCategory)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._errorCategory.ToString()) : null, "errorCategory" ,container.Add ); + AddIf( null != (((object)this._errorCode)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._errorCode.ToString()) : null, "errorCode" ,container.Add ); + AddIf( null != (((object)this._summaryMessage)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._summaryMessage.ToString()) : null, "summaryMessage" ,container.Add ); + AddIf( null != (((object)this._errorMessage)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._errorMessage.ToString()) : null, "errorMessage" ,container.Add ); + AddIf( null != (((object)this._possibleCaus)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._possibleCaus.ToString()) : null, "possibleCauses" ,container.Add ); + AddIf( null != (((object)this._recommendedAction)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recommendedAction.ToString()) : null, "recommendedAction" ,container.Add ); + AddIf( null != this._creationTimeUtc ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._creationTimeUtc?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "creationTimeUtc" ,container.Add ); + AddIf( null != (((object)this._recoveryProviderErrorMessage)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryProviderErrorMessage.ToString()) : null, "recoveryProviderErrorMessage" ,container.Add ); + AddIf( null != (((object)this._entityId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._entityId.ToString()) : null, "entityId" ,container.Add ); + AddIf( null != (((object)this._errorId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._errorId.ToString()) : null, "errorId" ,container.Add ); + AddIf( null != (((object)this._customerResolvability)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._customerResolvability.ToString()) : null, "customerResolvability" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HealthErrorSummary.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HealthErrorSummary.PowerShell.cs new file mode 100644 index 000000000000..7e95deef01f7 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HealthErrorSummary.PowerShell.cs @@ -0,0 +1,192 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// class to define the summary of the health error details. + [System.ComponentModel.TypeConverter(typeof(HealthErrorSummaryTypeConverter))] + public partial class HealthErrorSummary + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorSummary DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new HealthErrorSummary(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorSummary DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new HealthErrorSummary(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorSummary FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal HealthErrorSummary(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SummaryCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorSummaryInternal)this).SummaryCode = (string) content.GetValueForProperty("SummaryCode",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorSummaryInternal)this).SummaryCode, global::System.Convert.ToString); + } + if (content.Contains("Category")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorSummaryInternal)this).Category = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.HealthErrorCategory?) content.GetValueForProperty("Category",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorSummaryInternal)this).Category, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.HealthErrorCategory.CreateFrom); + } + if (content.Contains("Severity")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorSummaryInternal)this).Severity = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.Severity?) content.GetValueForProperty("Severity",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorSummaryInternal)this).Severity, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.Severity.CreateFrom); + } + if (content.Contains("SummaryMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorSummaryInternal)this).SummaryMessage = (string) content.GetValueForProperty("SummaryMessage",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorSummaryInternal)this).SummaryMessage, global::System.Convert.ToString); + } + if (content.Contains("AffectedResourceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorSummaryInternal)this).AffectedResourceType = (string) content.GetValueForProperty("AffectedResourceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorSummaryInternal)this).AffectedResourceType, global::System.Convert.ToString); + } + if (content.Contains("AffectedResourceSubtype")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorSummaryInternal)this).AffectedResourceSubtype = (string) content.GetValueForProperty("AffectedResourceSubtype",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorSummaryInternal)this).AffectedResourceSubtype, global::System.Convert.ToString); + } + if (content.Contains("AffectedResourceCorrelationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorSummaryInternal)this).AffectedResourceCorrelationId = (string[]) content.GetValueForProperty("AffectedResourceCorrelationId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorSummaryInternal)this).AffectedResourceCorrelationId, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal HealthErrorSummary(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SummaryCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorSummaryInternal)this).SummaryCode = (string) content.GetValueForProperty("SummaryCode",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorSummaryInternal)this).SummaryCode, global::System.Convert.ToString); + } + if (content.Contains("Category")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorSummaryInternal)this).Category = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.HealthErrorCategory?) content.GetValueForProperty("Category",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorSummaryInternal)this).Category, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.HealthErrorCategory.CreateFrom); + } + if (content.Contains("Severity")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorSummaryInternal)this).Severity = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.Severity?) content.GetValueForProperty("Severity",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorSummaryInternal)this).Severity, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.Severity.CreateFrom); + } + if (content.Contains("SummaryMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorSummaryInternal)this).SummaryMessage = (string) content.GetValueForProperty("SummaryMessage",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorSummaryInternal)this).SummaryMessage, global::System.Convert.ToString); + } + if (content.Contains("AffectedResourceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorSummaryInternal)this).AffectedResourceType = (string) content.GetValueForProperty("AffectedResourceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorSummaryInternal)this).AffectedResourceType, global::System.Convert.ToString); + } + if (content.Contains("AffectedResourceSubtype")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorSummaryInternal)this).AffectedResourceSubtype = (string) content.GetValueForProperty("AffectedResourceSubtype",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorSummaryInternal)this).AffectedResourceSubtype, global::System.Convert.ToString); + } + if (content.Contains("AffectedResourceCorrelationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorSummaryInternal)this).AffectedResourceCorrelationId = (string[]) content.GetValueForProperty("AffectedResourceCorrelationId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorSummaryInternal)this).AffectedResourceCorrelationId, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// class to define the summary of the health error details. + [System.ComponentModel.TypeConverter(typeof(HealthErrorSummaryTypeConverter))] + public partial interface IHealthErrorSummary + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HealthErrorSummary.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HealthErrorSummary.TypeConverter.cs new file mode 100644 index 000000000000..c1ddf6d17fae --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HealthErrorSummary.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class HealthErrorSummaryTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorSummary ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorSummary).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return HealthErrorSummary.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return HealthErrorSummary.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return HealthErrorSummary.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HealthErrorSummary.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HealthErrorSummary.cs new file mode 100644 index 000000000000..c48944de62c9 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HealthErrorSummary.cs @@ -0,0 +1,168 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// class to define the summary of the health error details. + public partial class HealthErrorSummary : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorSummary, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorSummaryInternal + { + + /// Backing field for property. + private string[] _affectedResourceCorrelationId; + + /// + /// 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. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string[] AffectedResourceCorrelationId { get => this._affectedResourceCorrelationId; set => this._affectedResourceCorrelationId = value; } + + /// Backing field for property. + private string _affectedResourceSubtype; + + /// + /// The sub type of any subcomponent within the ARM resource that this might be applicable. Value remains null if not applicable. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string AffectedResourceSubtype { get => this._affectedResourceSubtype; set => this._affectedResourceSubtype = value; } + + /// Backing field for property. + private string _affectedResourceType; + + /// The type of affected ARM resource. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string AffectedResourceType { get => this._affectedResourceType; set => this._affectedResourceType = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.HealthErrorCategory? _category; + + /// The category of the health error. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.HealthErrorCategory? Category { get => this._category; set => this._category = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.Severity? _severity; + + /// Severity of error. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.Severity? Severity { get => this._severity; set => this._severity = value; } + + /// Backing field for property. + private string _summaryCode; + + /// The code of the health error. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string SummaryCode { get => this._summaryCode; set => this._summaryCode = value; } + + /// Backing field for property. + private string _summaryMessage; + + /// The summary message of the health error. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string SummaryMessage { get => this._summaryMessage; set => this._summaryMessage = value; } + + /// Creates an new instance. + public HealthErrorSummary() + { + + } + } + /// class to define the summary of the health error details. + public partial interface IHealthErrorSummary : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// + /// 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. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"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.", + SerializedName = @"affectedResourceCorrelationIds", + PossibleTypes = new [] { typeof(string) })] + string[] AffectedResourceCorrelationId { get; set; } + /// + /// The sub type of any subcomponent within the ARM resource that this might be applicable. Value remains null if not applicable. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The sub type of any subcomponent within the ARM resource that this might be applicable. Value remains null if not applicable.", + SerializedName = @"affectedResourceSubtype", + PossibleTypes = new [] { typeof(string) })] + string AffectedResourceSubtype { get; set; } + /// The type of affected ARM resource. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The type of affected ARM resource.", + SerializedName = @"affectedResourceType", + PossibleTypes = new [] { typeof(string) })] + string AffectedResourceType { get; set; } + /// The category of the health error. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The category of the health error.", + SerializedName = @"category", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.HealthErrorCategory) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.HealthErrorCategory? Category { get; set; } + /// Severity of error. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Severity of error.", + SerializedName = @"severity", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.Severity) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.Severity? Severity { get; set; } + /// The code of the health error. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The code of the health error.", + SerializedName = @"summaryCode", + PossibleTypes = new [] { typeof(string) })] + string SummaryCode { get; set; } + /// The summary message of the health error. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The summary message of the health error.", + SerializedName = @"summaryMessage", + PossibleTypes = new [] { typeof(string) })] + string SummaryMessage { get; set; } + + } + /// class to define the summary of the health error details. + internal partial interface IHealthErrorSummaryInternal + + { + /// + /// 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. + /// + string[] AffectedResourceCorrelationId { get; set; } + /// + /// The sub type of any subcomponent within the ARM resource that this might be applicable. Value remains null if not applicable. + /// + string AffectedResourceSubtype { get; set; } + /// The type of affected ARM resource. + string AffectedResourceType { get; set; } + /// The category of the health error. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.HealthErrorCategory? Category { get; set; } + /// Severity of error. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.Severity? Severity { get; set; } + /// The code of the health error. + string SummaryCode { get; set; } + /// The summary message of the health error. + string SummaryMessage { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HealthErrorSummary.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HealthErrorSummary.json.cs new file mode 100644 index 000000000000..98052138f341 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HealthErrorSummary.json.cs @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// class to define the summary of the health error details. + public partial class HealthErrorSummary + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorSummary. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorSummary. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorSummary FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new HealthErrorSummary(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal HealthErrorSummary(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_summaryCode = If( json?.PropertyT("summaryCode"), out var __jsonSummaryCode) ? (string)__jsonSummaryCode : (string)SummaryCode;} + {_category = If( json?.PropertyT("category"), out var __jsonCategory) ? (string)__jsonCategory : (string)Category;} + {_severity = If( json?.PropertyT("severity"), out var __jsonSeverity) ? (string)__jsonSeverity : (string)Severity;} + {_summaryMessage = If( json?.PropertyT("summaryMessage"), out var __jsonSummaryMessage) ? (string)__jsonSummaryMessage : (string)SummaryMessage;} + {_affectedResourceType = If( json?.PropertyT("affectedResourceType"), out var __jsonAffectedResourceType) ? (string)__jsonAffectedResourceType : (string)AffectedResourceType;} + {_affectedResourceSubtype = If( json?.PropertyT("affectedResourceSubtype"), out var __jsonAffectedResourceSubtype) ? (string)__jsonAffectedResourceSubtype : (string)AffectedResourceSubtype;} + {_affectedResourceCorrelationId = If( json?.PropertyT("affectedResourceCorrelationIds"), out var __jsonAffectedResourceCorrelationIds) ? If( __jsonAffectedResourceCorrelationIds as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(string) (__u is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : AffectedResourceCorrelationId;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._summaryCode)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._summaryCode.ToString()) : null, "summaryCode" ,container.Add ); + AddIf( null != (((object)this._category)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._category.ToString()) : null, "category" ,container.Add ); + AddIf( null != (((object)this._severity)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._severity.ToString()) : null, "severity" ,container.Add ); + AddIf( null != (((object)this._summaryMessage)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._summaryMessage.ToString()) : null, "summaryMessage" ,container.Add ); + AddIf( null != (((object)this._affectedResourceType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._affectedResourceType.ToString()) : null, "affectedResourceType" ,container.Add ); + AddIf( null != (((object)this._affectedResourceSubtype)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._affectedResourceSubtype.ToString()) : null, "affectedResourceSubtype" ,container.Add ); + if (null != this._affectedResourceCorrelationId) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._affectedResourceCorrelationId ) + { + AddIf(null != (((object)__x)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(__x.ToString()) : null ,__w.Add); + } + container.Add("affectedResourceCorrelationIds",__w); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVHostDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVHostDetails.PowerShell.cs new file mode 100644 index 000000000000..631c104fdc41 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVHostDetails.PowerShell.cs @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Hyper-V host details. + [System.ComponentModel.TypeConverter(typeof(HyperVHostDetailsTypeConverter))] + public partial class HyperVHostDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVHostDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new HyperVHostDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVHostDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new HyperVHostDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVHostDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal HyperVHostDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVHostDetailsInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVHostDetailsInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVHostDetailsInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVHostDetailsInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("MarsAgentVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVHostDetailsInternal)this).MarsAgentVersion = (string) content.GetValueForProperty("MarsAgentVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVHostDetailsInternal)this).MarsAgentVersion, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal HyperVHostDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVHostDetailsInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVHostDetailsInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVHostDetailsInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVHostDetailsInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("MarsAgentVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVHostDetailsInternal)this).MarsAgentVersion = (string) content.GetValueForProperty("MarsAgentVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVHostDetailsInternal)this).MarsAgentVersion, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Hyper-V host details. + [System.ComponentModel.TypeConverter(typeof(HyperVHostDetailsTypeConverter))] + public partial interface IHyperVHostDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVHostDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVHostDetails.TypeConverter.cs new file mode 100644 index 000000000000..133bf1945654 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVHostDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class HyperVHostDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVHostDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVHostDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return HyperVHostDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return HyperVHostDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return HyperVHostDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVHostDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVHostDetails.cs new file mode 100644 index 000000000000..93038de643e7 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVHostDetails.cs @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Hyper-V host details. + public partial class HyperVHostDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVHostDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVHostDetailsInternal + { + + /// Backing field for property. + private string _id; + + /// The Hyper-V host Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Id { get => this._id; } + + /// Backing field for property. + private string _marsAgentVersion; + + /// The Mars agent version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string MarsAgentVersion { get => this._marsAgentVersion; } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVHostDetailsInternal.Id { get => this._id; set { {_id = value;} } } + + /// Internal Acessors for MarsAgentVersion + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVHostDetailsInternal.MarsAgentVersion { get => this._marsAgentVersion; set { {_marsAgentVersion = value;} } } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVHostDetailsInternal.Name { get => this._name; set { {_name = value;} } } + + /// Backing field for property. + private string _name; + + /// The Hyper-V host name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Name { get => this._name; } + + /// Creates an new instance. + public HyperVHostDetails() + { + + } + } + /// Hyper-V host details. + public partial interface IHyperVHostDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The Hyper-V host Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The Hyper-V host Id.", + SerializedName = @"id", + PossibleTypes = new [] { typeof(string) })] + string Id { get; } + /// The Mars agent version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The Mars agent version.", + SerializedName = @"marsAgentVersion", + PossibleTypes = new [] { typeof(string) })] + string MarsAgentVersion { get; } + /// The Hyper-V host name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The Hyper-V host name.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string Name { get; } + + } + /// Hyper-V host details. + internal partial interface IHyperVHostDetailsInternal + + { + /// The Hyper-V host Id. + string Id { get; set; } + /// The Mars agent version. + string MarsAgentVersion { get; set; } + /// The Hyper-V host name. + string Name { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVHostDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVHostDetails.json.cs new file mode 100644 index 000000000000..b1bf1fe50b4e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVHostDetails.json.cs @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Hyper-V host details. + public partial class HyperVHostDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVHostDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVHostDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVHostDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new HyperVHostDetails(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal HyperVHostDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_id = If( json?.PropertyT("id"), out var __jsonId) ? (string)__jsonId : (string)Id;} + {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)Name;} + {_marsAgentVersion = If( json?.PropertyT("marsAgentVersion"), out var __jsonMarsAgentVersion) ? (string)__jsonMarsAgentVersion : (string)MarsAgentVersion;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._id)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._id.ToString()) : null, "id" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._marsAgentVersion)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._marsAgentVersion.ToString()) : null, "marsAgentVersion" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplica2012EventDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplica2012EventDetails.PowerShell.cs new file mode 100644 index 000000000000..2448f2099dee --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplica2012EventDetails.PowerShell.cs @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Model class for event details of a HyperVReplica E2E event. + [System.ComponentModel.TypeConverter(typeof(HyperVReplica2012EventDetailsTypeConverter))] + public partial class HyperVReplica2012EventDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplica2012EventDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new HyperVReplica2012EventDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplica2012EventDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new HyperVReplica2012EventDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplica2012EventDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal HyperVReplica2012EventDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ContainerName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplica2012EventDetailsInternal)this).ContainerName = (string) content.GetValueForProperty("ContainerName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplica2012EventDetailsInternal)this).ContainerName, global::System.Convert.ToString); + } + if (content.Contains("FabricName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplica2012EventDetailsInternal)this).FabricName = (string) content.GetValueForProperty("FabricName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplica2012EventDetailsInternal)this).FabricName, global::System.Convert.ToString); + } + if (content.Contains("RemoteContainerName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplica2012EventDetailsInternal)this).RemoteContainerName = (string) content.GetValueForProperty("RemoteContainerName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplica2012EventDetailsInternal)this).RemoteContainerName, global::System.Convert.ToString); + } + if (content.Contains("RemoteFabricName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplica2012EventDetailsInternal)this).RemoteFabricName = (string) content.GetValueForProperty("RemoteFabricName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplica2012EventDetailsInternal)this).RemoteFabricName, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal HyperVReplica2012EventDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ContainerName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplica2012EventDetailsInternal)this).ContainerName = (string) content.GetValueForProperty("ContainerName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplica2012EventDetailsInternal)this).ContainerName, global::System.Convert.ToString); + } + if (content.Contains("FabricName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplica2012EventDetailsInternal)this).FabricName = (string) content.GetValueForProperty("FabricName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplica2012EventDetailsInternal)this).FabricName, global::System.Convert.ToString); + } + if (content.Contains("RemoteContainerName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplica2012EventDetailsInternal)this).RemoteContainerName = (string) content.GetValueForProperty("RemoteContainerName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplica2012EventDetailsInternal)this).RemoteContainerName, global::System.Convert.ToString); + } + if (content.Contains("RemoteFabricName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplica2012EventDetailsInternal)this).RemoteFabricName = (string) content.GetValueForProperty("RemoteFabricName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplica2012EventDetailsInternal)this).RemoteFabricName, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Model class for event details of a HyperVReplica E2E event. + [System.ComponentModel.TypeConverter(typeof(HyperVReplica2012EventDetailsTypeConverter))] + public partial interface IHyperVReplica2012EventDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplica2012EventDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplica2012EventDetails.TypeConverter.cs new file mode 100644 index 000000000000..863c57fb6ea3 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplica2012EventDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class HyperVReplica2012EventDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplica2012EventDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplica2012EventDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return HyperVReplica2012EventDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return HyperVReplica2012EventDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return HyperVReplica2012EventDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplica2012EventDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplica2012EventDetails.cs new file mode 100644 index 000000000000..0b2a3543cfdd --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplica2012EventDetails.cs @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Model class for event details of a HyperVReplica E2E event. + public partial class HyperVReplica2012EventDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplica2012EventDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplica2012EventDetailsInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetails __eventProviderSpecificDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EventProviderSpecificDetails(); + + /// Backing field for property. + private string _containerName; + + /// The container friendly name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ContainerName { get => this._containerName; set => this._containerName = value; } + + /// Backing field for property. + private string _fabricName; + + /// The fabric friendly name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// Gets the class type. Overridden in derived classes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetailsInternal)__eventProviderSpecificDetails).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetailsInternal)__eventProviderSpecificDetails).InstanceType = value ; } + + /// Backing field for property. + private string _remoteContainerName; + + /// The remote container name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RemoteContainerName { get => this._remoteContainerName; set => this._remoteContainerName = value; } + + /// Backing field for property. + private string _remoteFabricName; + + /// The remote fabric name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RemoteFabricName { get => this._remoteFabricName; set => this._remoteFabricName = value; } + + /// Creates an new instance. + public HyperVReplica2012EventDetails() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__eventProviderSpecificDetails), __eventProviderSpecificDetails); + await eventListener.AssertObjectIsValid(nameof(__eventProviderSpecificDetails), __eventProviderSpecificDetails); + } + } + /// Model class for event details of a HyperVReplica E2E event. + public partial interface IHyperVReplica2012EventDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetails + { + /// The container friendly name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The container friendly name.", + SerializedName = @"containerName", + PossibleTypes = new [] { typeof(string) })] + string ContainerName { get; set; } + /// The fabric friendly name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The fabric friendly name.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + string FabricName { get; set; } + /// The remote container name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The remote container name.", + SerializedName = @"remoteContainerName", + PossibleTypes = new [] { typeof(string) })] + string RemoteContainerName { get; set; } + /// The remote fabric name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The remote fabric name.", + SerializedName = @"remoteFabricName", + PossibleTypes = new [] { typeof(string) })] + string RemoteFabricName { get; set; } + + } + /// Model class for event details of a HyperVReplica E2E event. + internal partial interface IHyperVReplica2012EventDetailsInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetailsInternal + { + /// The container friendly name. + string ContainerName { get; set; } + /// The fabric friendly name. + string FabricName { get; set; } + /// The remote container name. + string RemoteContainerName { get; set; } + /// The remote fabric name. + string RemoteFabricName { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplica2012EventDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplica2012EventDetails.json.cs new file mode 100644 index 000000000000..16cff1505651 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplica2012EventDetails.json.cs @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Model class for event details of a HyperVReplica E2E event. + public partial class HyperVReplica2012EventDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplica2012EventDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplica2012EventDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplica2012EventDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new HyperVReplica2012EventDetails(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal HyperVReplica2012EventDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __eventProviderSpecificDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EventProviderSpecificDetails(json); + {_containerName = If( json?.PropertyT("containerName"), out var __jsonContainerName) ? (string)__jsonContainerName : (string)ContainerName;} + {_fabricName = If( json?.PropertyT("fabricName"), out var __jsonFabricName) ? (string)__jsonFabricName : (string)FabricName;} + {_remoteContainerName = If( json?.PropertyT("remoteContainerName"), out var __jsonRemoteContainerName) ? (string)__jsonRemoteContainerName : (string)RemoteContainerName;} + {_remoteFabricName = If( json?.PropertyT("remoteFabricName"), out var __jsonRemoteFabricName) ? (string)__jsonRemoteFabricName : (string)RemoteFabricName;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __eventProviderSpecificDetails?.ToJson(container, serializationMode); + AddIf( null != (((object)this._containerName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._containerName.ToString()) : null, "containerName" ,container.Add ); + AddIf( null != (((object)this._fabricName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._fabricName.ToString()) : null, "fabricName" ,container.Add ); + AddIf( null != (((object)this._remoteContainerName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._remoteContainerName.ToString()) : null, "remoteContainerName" ,container.Add ); + AddIf( null != (((object)this._remoteFabricName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._remoteFabricName.ToString()) : null, "remoteFabricName" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplica2012R2EventDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplica2012R2EventDetails.PowerShell.cs new file mode 100644 index 000000000000..345aaa6f9c89 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplica2012R2EventDetails.PowerShell.cs @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Model class for event details of a HyperVReplica blue E2E event. + [System.ComponentModel.TypeConverter(typeof(HyperVReplica2012R2EventDetailsTypeConverter))] + public partial class HyperVReplica2012R2EventDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplica2012R2EventDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new HyperVReplica2012R2EventDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplica2012R2EventDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new HyperVReplica2012R2EventDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplica2012R2EventDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal HyperVReplica2012R2EventDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ContainerName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplica2012R2EventDetailsInternal)this).ContainerName = (string) content.GetValueForProperty("ContainerName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplica2012R2EventDetailsInternal)this).ContainerName, global::System.Convert.ToString); + } + if (content.Contains("FabricName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplica2012R2EventDetailsInternal)this).FabricName = (string) content.GetValueForProperty("FabricName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplica2012R2EventDetailsInternal)this).FabricName, global::System.Convert.ToString); + } + if (content.Contains("RemoteContainerName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplica2012R2EventDetailsInternal)this).RemoteContainerName = (string) content.GetValueForProperty("RemoteContainerName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplica2012R2EventDetailsInternal)this).RemoteContainerName, global::System.Convert.ToString); + } + if (content.Contains("RemoteFabricName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplica2012R2EventDetailsInternal)this).RemoteFabricName = (string) content.GetValueForProperty("RemoteFabricName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplica2012R2EventDetailsInternal)this).RemoteFabricName, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal HyperVReplica2012R2EventDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ContainerName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplica2012R2EventDetailsInternal)this).ContainerName = (string) content.GetValueForProperty("ContainerName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplica2012R2EventDetailsInternal)this).ContainerName, global::System.Convert.ToString); + } + if (content.Contains("FabricName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplica2012R2EventDetailsInternal)this).FabricName = (string) content.GetValueForProperty("FabricName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplica2012R2EventDetailsInternal)this).FabricName, global::System.Convert.ToString); + } + if (content.Contains("RemoteContainerName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplica2012R2EventDetailsInternal)this).RemoteContainerName = (string) content.GetValueForProperty("RemoteContainerName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplica2012R2EventDetailsInternal)this).RemoteContainerName, global::System.Convert.ToString); + } + if (content.Contains("RemoteFabricName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplica2012R2EventDetailsInternal)this).RemoteFabricName = (string) content.GetValueForProperty("RemoteFabricName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplica2012R2EventDetailsInternal)this).RemoteFabricName, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Model class for event details of a HyperVReplica blue E2E event. + [System.ComponentModel.TypeConverter(typeof(HyperVReplica2012R2EventDetailsTypeConverter))] + public partial interface IHyperVReplica2012R2EventDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplica2012R2EventDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplica2012R2EventDetails.TypeConverter.cs new file mode 100644 index 000000000000..837bdfa5cefb --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplica2012R2EventDetails.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class HyperVReplica2012R2EventDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplica2012R2EventDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplica2012R2EventDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return HyperVReplica2012R2EventDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return HyperVReplica2012R2EventDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return HyperVReplica2012R2EventDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplica2012R2EventDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplica2012R2EventDetails.cs new file mode 100644 index 000000000000..b8f63bbafd19 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplica2012R2EventDetails.cs @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Model class for event details of a HyperVReplica blue E2E event. + public partial class HyperVReplica2012R2EventDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplica2012R2EventDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplica2012R2EventDetailsInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetails __eventProviderSpecificDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EventProviderSpecificDetails(); + + /// Backing field for property. + private string _containerName; + + /// The container friendly name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ContainerName { get => this._containerName; set => this._containerName = value; } + + /// Backing field for property. + private string _fabricName; + + /// The fabric friendly name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// Gets the class type. Overridden in derived classes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetailsInternal)__eventProviderSpecificDetails).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetailsInternal)__eventProviderSpecificDetails).InstanceType = value ; } + + /// Backing field for property. + private string _remoteContainerName; + + /// The remote container name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RemoteContainerName { get => this._remoteContainerName; set => this._remoteContainerName = value; } + + /// Backing field for property. + private string _remoteFabricName; + + /// The remote fabric name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RemoteFabricName { get => this._remoteFabricName; set => this._remoteFabricName = value; } + + /// Creates an new instance. + public HyperVReplica2012R2EventDetails() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__eventProviderSpecificDetails), __eventProviderSpecificDetails); + await eventListener.AssertObjectIsValid(nameof(__eventProviderSpecificDetails), __eventProviderSpecificDetails); + } + } + /// Model class for event details of a HyperVReplica blue E2E event. + public partial interface IHyperVReplica2012R2EventDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetails + { + /// The container friendly name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The container friendly name.", + SerializedName = @"containerName", + PossibleTypes = new [] { typeof(string) })] + string ContainerName { get; set; } + /// The fabric friendly name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The fabric friendly name.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + string FabricName { get; set; } + /// The remote container name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The remote container name.", + SerializedName = @"remoteContainerName", + PossibleTypes = new [] { typeof(string) })] + string RemoteContainerName { get; set; } + /// The remote fabric name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The remote fabric name.", + SerializedName = @"remoteFabricName", + PossibleTypes = new [] { typeof(string) })] + string RemoteFabricName { get; set; } + + } + /// Model class for event details of a HyperVReplica blue E2E event. + internal partial interface IHyperVReplica2012R2EventDetailsInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetailsInternal + { + /// The container friendly name. + string ContainerName { get; set; } + /// The fabric friendly name. + string FabricName { get; set; } + /// The remote container name. + string RemoteContainerName { get; set; } + /// The remote fabric name. + string RemoteFabricName { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplica2012R2EventDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplica2012R2EventDetails.json.cs new file mode 100644 index 000000000000..4845dcfc0309 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplica2012R2EventDetails.json.cs @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Model class for event details of a HyperVReplica blue E2E event. + public partial class HyperVReplica2012R2EventDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplica2012R2EventDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplica2012R2EventDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplica2012R2EventDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new HyperVReplica2012R2EventDetails(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal HyperVReplica2012R2EventDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __eventProviderSpecificDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EventProviderSpecificDetails(json); + {_containerName = If( json?.PropertyT("containerName"), out var __jsonContainerName) ? (string)__jsonContainerName : (string)ContainerName;} + {_fabricName = If( json?.PropertyT("fabricName"), out var __jsonFabricName) ? (string)__jsonFabricName : (string)FabricName;} + {_remoteContainerName = If( json?.PropertyT("remoteContainerName"), out var __jsonRemoteContainerName) ? (string)__jsonRemoteContainerName : (string)RemoteContainerName;} + {_remoteFabricName = If( json?.PropertyT("remoteFabricName"), out var __jsonRemoteFabricName) ? (string)__jsonRemoteFabricName : (string)RemoteFabricName;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __eventProviderSpecificDetails?.ToJson(container, serializationMode); + AddIf( null != (((object)this._containerName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._containerName.ToString()) : null, "containerName" ,container.Add ); + AddIf( null != (((object)this._fabricName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._fabricName.ToString()) : null, "fabricName" ,container.Add ); + AddIf( null != (((object)this._remoteContainerName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._remoteContainerName.ToString()) : null, "remoteContainerName" ,container.Add ); + AddIf( null != (((object)this._remoteFabricName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._remoteFabricName.ToString()) : null, "remoteFabricName" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureApplyRecoveryPointInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureApplyRecoveryPointInput.PowerShell.cs new file mode 100644 index 000000000000..2a07b10fd9bc --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureApplyRecoveryPointInput.PowerShell.cs @@ -0,0 +1,165 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// ApplyRecoveryPoint input specific to HyperVReplicaAzure provider. + [System.ComponentModel.TypeConverter(typeof(HyperVReplicaAzureApplyRecoveryPointInputTypeConverter))] + public partial class HyperVReplicaAzureApplyRecoveryPointInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureApplyRecoveryPointInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new HyperVReplicaAzureApplyRecoveryPointInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureApplyRecoveryPointInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new HyperVReplicaAzureApplyRecoveryPointInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json + /// string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureApplyRecoveryPointInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal HyperVReplicaAzureApplyRecoveryPointInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("PrimaryKekCertificatePfx")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureApplyRecoveryPointInputInternal)this).PrimaryKekCertificatePfx = (string) content.GetValueForProperty("PrimaryKekCertificatePfx",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureApplyRecoveryPointInputInternal)this).PrimaryKekCertificatePfx, global::System.Convert.ToString); + } + if (content.Contains("SecondaryKekCertificatePfx")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureApplyRecoveryPointInputInternal)this).SecondaryKekCertificatePfx = (string) content.GetValueForProperty("SecondaryKekCertificatePfx",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureApplyRecoveryPointInputInternal)this).SecondaryKekCertificatePfx, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal HyperVReplicaAzureApplyRecoveryPointInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("PrimaryKekCertificatePfx")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureApplyRecoveryPointInputInternal)this).PrimaryKekCertificatePfx = (string) content.GetValueForProperty("PrimaryKekCertificatePfx",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureApplyRecoveryPointInputInternal)this).PrimaryKekCertificatePfx, global::System.Convert.ToString); + } + if (content.Contains("SecondaryKekCertificatePfx")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureApplyRecoveryPointInputInternal)this).SecondaryKekCertificatePfx = (string) content.GetValueForProperty("SecondaryKekCertificatePfx",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureApplyRecoveryPointInputInternal)this).SecondaryKekCertificatePfx, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// ApplyRecoveryPoint input specific to HyperVReplicaAzure provider. + [System.ComponentModel.TypeConverter(typeof(HyperVReplicaAzureApplyRecoveryPointInputTypeConverter))] + public partial interface IHyperVReplicaAzureApplyRecoveryPointInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureApplyRecoveryPointInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureApplyRecoveryPointInput.TypeConverter.cs new file mode 100644 index 000000000000..bc216c65e099 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureApplyRecoveryPointInput.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class HyperVReplicaAzureApplyRecoveryPointInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureApplyRecoveryPointInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureApplyRecoveryPointInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return HyperVReplicaAzureApplyRecoveryPointInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return HyperVReplicaAzureApplyRecoveryPointInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return HyperVReplicaAzureApplyRecoveryPointInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureApplyRecoveryPointInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureApplyRecoveryPointInput.cs new file mode 100644 index 000000000000..5a2520220274 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureApplyRecoveryPointInput.cs @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// ApplyRecoveryPoint input specific to HyperVReplicaAzure provider. + public partial class HyperVReplicaAzureApplyRecoveryPointInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureApplyRecoveryPointInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureApplyRecoveryPointInputInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointProviderSpecificInput __applyRecoveryPointProviderSpecificInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ApplyRecoveryPointProviderSpecificInput(); + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointProviderSpecificInputInternal)__applyRecoveryPointProviderSpecificInput).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointProviderSpecificInputInternal)__applyRecoveryPointProviderSpecificInput).InstanceType = value ; } + + /// Backing field for property. + private string _primaryKekCertificatePfx; + + /// The primary kek certificate pfx. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string PrimaryKekCertificatePfx { get => this._primaryKekCertificatePfx; set => this._primaryKekCertificatePfx = value; } + + /// Backing field for property. + private string _secondaryKekCertificatePfx; + + /// The secondary kek certificate pfx. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string SecondaryKekCertificatePfx { get => this._secondaryKekCertificatePfx; set => this._secondaryKekCertificatePfx = value; } + + /// + /// Creates an new instance. + /// + public HyperVReplicaAzureApplyRecoveryPointInput() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__applyRecoveryPointProviderSpecificInput), __applyRecoveryPointProviderSpecificInput); + await eventListener.AssertObjectIsValid(nameof(__applyRecoveryPointProviderSpecificInput), __applyRecoveryPointProviderSpecificInput); + } + } + /// ApplyRecoveryPoint input specific to HyperVReplicaAzure provider. + public partial interface IHyperVReplicaAzureApplyRecoveryPointInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointProviderSpecificInput + { + /// The primary kek certificate pfx. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The primary kek certificate pfx.", + SerializedName = @"primaryKekCertificatePfx", + PossibleTypes = new [] { typeof(string) })] + string PrimaryKekCertificatePfx { get; set; } + /// The secondary kek certificate pfx. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The secondary kek certificate pfx.", + SerializedName = @"secondaryKekCertificatePfx", + PossibleTypes = new [] { typeof(string) })] + string SecondaryKekCertificatePfx { get; set; } + + } + /// ApplyRecoveryPoint input specific to HyperVReplicaAzure provider. + internal partial interface IHyperVReplicaAzureApplyRecoveryPointInputInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointProviderSpecificInputInternal + { + /// The primary kek certificate pfx. + string PrimaryKekCertificatePfx { get; set; } + /// The secondary kek certificate pfx. + string SecondaryKekCertificatePfx { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureApplyRecoveryPointInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureApplyRecoveryPointInput.json.cs new file mode 100644 index 000000000000..fa9917cc7411 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureApplyRecoveryPointInput.json.cs @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// ApplyRecoveryPoint input specific to HyperVReplicaAzure provider. + public partial class HyperVReplicaAzureApplyRecoveryPointInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureApplyRecoveryPointInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureApplyRecoveryPointInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureApplyRecoveryPointInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new HyperVReplicaAzureApplyRecoveryPointInput(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal HyperVReplicaAzureApplyRecoveryPointInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __applyRecoveryPointProviderSpecificInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ApplyRecoveryPointProviderSpecificInput(json); + {_primaryKekCertificatePfx = If( json?.PropertyT("primaryKekCertificatePfx"), out var __jsonPrimaryKekCertificatePfx) ? (string)__jsonPrimaryKekCertificatePfx : (string)PrimaryKekCertificatePfx;} + {_secondaryKekCertificatePfx = If( json?.PropertyT("secondaryKekCertificatePfx"), out var __jsonSecondaryKekCertificatePfx) ? (string)__jsonSecondaryKekCertificatePfx : (string)SecondaryKekCertificatePfx;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __applyRecoveryPointProviderSpecificInput?.ToJson(container, serializationMode); + AddIf( null != (((object)this._primaryKekCertificatePfx)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._primaryKekCertificatePfx.ToString()) : null, "primaryKekCertificatePfx" ,container.Add ); + AddIf( null != (((object)this._secondaryKekCertificatePfx)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._secondaryKekCertificatePfx.ToString()) : null, "secondaryKekCertificatePfx" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureDiskInputDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureDiskInputDetails.PowerShell.cs new file mode 100644 index 000000000000..d54907c7eff2 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureDiskInputDetails.PowerShell.cs @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Disk input details. + [System.ComponentModel.TypeConverter(typeof(HyperVReplicaAzureDiskInputDetailsTypeConverter))] + public partial class HyperVReplicaAzureDiskInputDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureDiskInputDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new HyperVReplicaAzureDiskInputDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureDiskInputDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new HyperVReplicaAzureDiskInputDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureDiskInputDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal HyperVReplicaAzureDiskInputDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DiskId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureDiskInputDetailsInternal)this).DiskId = (string) content.GetValueForProperty("DiskId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureDiskInputDetailsInternal)this).DiskId, global::System.Convert.ToString); + } + if (content.Contains("LogStorageAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureDiskInputDetailsInternal)this).LogStorageAccountId = (string) content.GetValueForProperty("LogStorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureDiskInputDetailsInternal)this).LogStorageAccountId, global::System.Convert.ToString); + } + if (content.Contains("DiskType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureDiskInputDetailsInternal)this).DiskType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskAccountType?) content.GetValueForProperty("DiskType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureDiskInputDetailsInternal)this).DiskType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskAccountType.CreateFrom); + } + if (content.Contains("DiskEncryptionSetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureDiskInputDetailsInternal)this).DiskEncryptionSetId = (string) content.GetValueForProperty("DiskEncryptionSetId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureDiskInputDetailsInternal)this).DiskEncryptionSetId, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal HyperVReplicaAzureDiskInputDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DiskId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureDiskInputDetailsInternal)this).DiskId = (string) content.GetValueForProperty("DiskId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureDiskInputDetailsInternal)this).DiskId, global::System.Convert.ToString); + } + if (content.Contains("LogStorageAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureDiskInputDetailsInternal)this).LogStorageAccountId = (string) content.GetValueForProperty("LogStorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureDiskInputDetailsInternal)this).LogStorageAccountId, global::System.Convert.ToString); + } + if (content.Contains("DiskType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureDiskInputDetailsInternal)this).DiskType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskAccountType?) content.GetValueForProperty("DiskType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureDiskInputDetailsInternal)this).DiskType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskAccountType.CreateFrom); + } + if (content.Contains("DiskEncryptionSetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureDiskInputDetailsInternal)this).DiskEncryptionSetId = (string) content.GetValueForProperty("DiskEncryptionSetId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureDiskInputDetailsInternal)this).DiskEncryptionSetId, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Disk input details. + [System.ComponentModel.TypeConverter(typeof(HyperVReplicaAzureDiskInputDetailsTypeConverter))] + public partial interface IHyperVReplicaAzureDiskInputDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureDiskInputDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureDiskInputDetails.TypeConverter.cs new file mode 100644 index 000000000000..7922d4db2f90 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureDiskInputDetails.TypeConverter.cs @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class HyperVReplicaAzureDiskInputDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureDiskInputDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureDiskInputDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return HyperVReplicaAzureDiskInputDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return HyperVReplicaAzureDiskInputDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return HyperVReplicaAzureDiskInputDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureDiskInputDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureDiskInputDetails.cs new file mode 100644 index 000000000000..0346bfe0ea67 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureDiskInputDetails.cs @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Disk input details. + public partial class HyperVReplicaAzureDiskInputDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureDiskInputDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureDiskInputDetailsInternal + { + + /// Backing field for property. + private string _diskEncryptionSetId; + + /// The DiskEncryptionSet ARM ID. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string DiskEncryptionSetId { get => this._diskEncryptionSetId; set => this._diskEncryptionSetId = value; } + + /// Backing field for property. + private string _diskId; + + /// The DiskId. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string DiskId { get => this._diskId; set => this._diskId = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskAccountType? _diskType; + + /// The DiskType. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskAccountType? DiskType { get => this._diskType; set => this._diskType = value; } + + /// Backing field for property. + private string _logStorageAccountId; + + /// The LogStorageAccountId. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string LogStorageAccountId { get => this._logStorageAccountId; set => this._logStorageAccountId = value; } + + /// Creates an new instance. + public HyperVReplicaAzureDiskInputDetails() + { + + } + } + /// Disk input details. + public partial interface IHyperVReplicaAzureDiskInputDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The DiskEncryptionSet ARM ID. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The DiskEncryptionSet ARM ID.", + SerializedName = @"diskEncryptionSetId", + PossibleTypes = new [] { typeof(string) })] + string DiskEncryptionSetId { get; set; } + /// The DiskId. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The DiskId.", + SerializedName = @"diskId", + PossibleTypes = new [] { typeof(string) })] + string DiskId { get; set; } + /// The DiskType. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The DiskType.", + SerializedName = @"diskType", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskAccountType) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskAccountType? DiskType { get; set; } + /// The LogStorageAccountId. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The LogStorageAccountId.", + SerializedName = @"logStorageAccountId", + PossibleTypes = new [] { typeof(string) })] + string LogStorageAccountId { get; set; } + + } + /// Disk input details. + internal partial interface IHyperVReplicaAzureDiskInputDetailsInternal + + { + /// The DiskEncryptionSet ARM ID. + string DiskEncryptionSetId { get; set; } + /// The DiskId. + string DiskId { get; set; } + /// The DiskType. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskAccountType? DiskType { get; set; } + /// The LogStorageAccountId. + string LogStorageAccountId { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureDiskInputDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureDiskInputDetails.json.cs new file mode 100644 index 000000000000..ffb21b927c31 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureDiskInputDetails.json.cs @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Disk input details. + public partial class HyperVReplicaAzureDiskInputDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureDiskInputDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureDiskInputDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureDiskInputDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new HyperVReplicaAzureDiskInputDetails(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal HyperVReplicaAzureDiskInputDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_diskId = If( json?.PropertyT("diskId"), out var __jsonDiskId) ? (string)__jsonDiskId : (string)DiskId;} + {_logStorageAccountId = If( json?.PropertyT("logStorageAccountId"), out var __jsonLogStorageAccountId) ? (string)__jsonLogStorageAccountId : (string)LogStorageAccountId;} + {_diskType = If( json?.PropertyT("diskType"), out var __jsonDiskType) ? (string)__jsonDiskType : (string)DiskType;} + {_diskEncryptionSetId = If( json?.PropertyT("diskEncryptionSetId"), out var __jsonDiskEncryptionSetId) ? (string)__jsonDiskEncryptionSetId : (string)DiskEncryptionSetId;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._diskId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._diskId.ToString()) : null, "diskId" ,container.Add ); + AddIf( null != (((object)this._logStorageAccountId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._logStorageAccountId.ToString()) : null, "logStorageAccountId" ,container.Add ); + AddIf( null != (((object)this._diskType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._diskType.ToString()) : null, "diskType" ,container.Add ); + AddIf( null != (((object)this._diskEncryptionSetId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._diskEncryptionSetId.ToString()) : null, "diskEncryptionSetId" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureEnableProtectionInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureEnableProtectionInput.PowerShell.cs new file mode 100644 index 000000000000..4aa826a9c334 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureEnableProtectionInput.PowerShell.cs @@ -0,0 +1,373 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// HyperVReplicaAzure specific enable protection input. + [System.ComponentModel.TypeConverter(typeof(HyperVReplicaAzureEnableProtectionInputTypeConverter))] + public partial class HyperVReplicaAzureEnableProtectionInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new HyperVReplicaAzureEnableProtectionInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new HyperVReplicaAzureEnableProtectionInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json + /// string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal HyperVReplicaAzureEnableProtectionInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("HvHostVMId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).HvHostVMId = (string) content.GetValueForProperty("HvHostVMId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).HvHostVMId, global::System.Convert.ToString); + } + if (content.Contains("VMName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).VMName = (string) content.GetValueForProperty("VMName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).VMName, global::System.Convert.ToString); + } + if (content.Contains("OSType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).OSType = (string) content.GetValueForProperty("OSType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).OSType, global::System.Convert.ToString); + } + if (content.Contains("VhdId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).VhdId = (string) content.GetValueForProperty("VhdId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).VhdId, global::System.Convert.ToString); + } + if (content.Contains("TargetStorageAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).TargetStorageAccountId = (string) content.GetValueForProperty("TargetStorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).TargetStorageAccountId, global::System.Convert.ToString); + } + if (content.Contains("TargetAzureNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).TargetAzureNetworkId = (string) content.GetValueForProperty("TargetAzureNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).TargetAzureNetworkId, global::System.Convert.ToString); + } + if (content.Contains("TargetAzureSubnetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).TargetAzureSubnetId = (string) content.GetValueForProperty("TargetAzureSubnetId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).TargetAzureSubnetId, global::System.Convert.ToString); + } + if (content.Contains("EnableRdpOnTargetOption")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).EnableRdpOnTargetOption = (string) content.GetValueForProperty("EnableRdpOnTargetOption",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).EnableRdpOnTargetOption, global::System.Convert.ToString); + } + if (content.Contains("TargetAzureVMName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).TargetAzureVMName = (string) content.GetValueForProperty("TargetAzureVMName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).TargetAzureVMName, global::System.Convert.ToString); + } + if (content.Contains("LogStorageAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).LogStorageAccountId = (string) content.GetValueForProperty("LogStorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).LogStorageAccountId, global::System.Convert.ToString); + } + if (content.Contains("DisksToInclude")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).DisksToInclude = (string[]) content.GetValueForProperty("DisksToInclude",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).DisksToInclude, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("TargetAzureV1ResourceGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).TargetAzureV1ResourceGroupId = (string) content.GetValueForProperty("TargetAzureV1ResourceGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).TargetAzureV1ResourceGroupId, global::System.Convert.ToString); + } + if (content.Contains("TargetAzureV2ResourceGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).TargetAzureV2ResourceGroupId = (string) content.GetValueForProperty("TargetAzureV2ResourceGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).TargetAzureV2ResourceGroupId, global::System.Convert.ToString); + } + if (content.Contains("UseManagedDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).UseManagedDisk = (string) content.GetValueForProperty("UseManagedDisk",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).UseManagedDisk, global::System.Convert.ToString); + } + if (content.Contains("TargetAvailabilitySetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).TargetAvailabilitySetId = (string) content.GetValueForProperty("TargetAvailabilitySetId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).TargetAvailabilitySetId, global::System.Convert.ToString); + } + if (content.Contains("TargetAvailabilityZone")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).TargetAvailabilityZone = (string) content.GetValueForProperty("TargetAvailabilityZone",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).TargetAvailabilityZone, global::System.Convert.ToString); + } + if (content.Contains("LicenseType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).LicenseType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.LicenseType?) content.GetValueForProperty("LicenseType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).LicenseType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.LicenseType.CreateFrom); + } + if (content.Contains("SqlServerLicenseType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).SqlServerLicenseType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SqlServerLicenseType?) content.GetValueForProperty("SqlServerLicenseType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).SqlServerLicenseType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SqlServerLicenseType.CreateFrom); + } + if (content.Contains("TargetVMSize")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).TargetVMSize = (string) content.GetValueForProperty("TargetVMSize",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).TargetVMSize, global::System.Convert.ToString); + } + if (content.Contains("TargetProximityPlacementGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).TargetProximityPlacementGroupId = (string) content.GetValueForProperty("TargetProximityPlacementGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).TargetProximityPlacementGroupId, global::System.Convert.ToString); + } + if (content.Contains("UseManagedDisksForReplication")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).UseManagedDisksForReplication = (string) content.GetValueForProperty("UseManagedDisksForReplication",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).UseManagedDisksForReplication, global::System.Convert.ToString); + } + if (content.Contains("DiskType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).DiskType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskAccountType?) content.GetValueForProperty("DiskType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).DiskType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskAccountType.CreateFrom); + } + if (content.Contains("DisksToIncludeForManagedDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).DisksToIncludeForManagedDisk = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureDiskInputDetails[]) content.GetValueForProperty("DisksToIncludeForManagedDisk",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).DisksToIncludeForManagedDisk, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureDiskInputDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("DiskEncryptionSetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).DiskEncryptionSetId = (string) content.GetValueForProperty("DiskEncryptionSetId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).DiskEncryptionSetId, global::System.Convert.ToString); + } + if (content.Contains("TargetVMTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).TargetVMTag = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputTargetVmtags) content.GetValueForProperty("TargetVMTag",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).TargetVMTag, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureEnableProtectionInputTargetVmtagsTypeConverter.ConvertFrom); + } + if (content.Contains("SeedManagedDiskTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).SeedManagedDiskTag = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputSeedManagedDiskTags) content.GetValueForProperty("SeedManagedDiskTag",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).SeedManagedDiskTag, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureEnableProtectionInputSeedManagedDiskTagsTypeConverter.ConvertFrom); + } + if (content.Contains("TargetManagedDiskTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).TargetManagedDiskTag = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputTargetManagedDiskTags) content.GetValueForProperty("TargetManagedDiskTag",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).TargetManagedDiskTag, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureEnableProtectionInputTargetManagedDiskTagsTypeConverter.ConvertFrom); + } + if (content.Contains("TargetNicTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).TargetNicTag = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputTargetNicTags) content.GetValueForProperty("TargetNicTag",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).TargetNicTag, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureEnableProtectionInputTargetNicTagsTypeConverter.ConvertFrom); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal HyperVReplicaAzureEnableProtectionInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("HvHostVMId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).HvHostVMId = (string) content.GetValueForProperty("HvHostVMId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).HvHostVMId, global::System.Convert.ToString); + } + if (content.Contains("VMName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).VMName = (string) content.GetValueForProperty("VMName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).VMName, global::System.Convert.ToString); + } + if (content.Contains("OSType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).OSType = (string) content.GetValueForProperty("OSType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).OSType, global::System.Convert.ToString); + } + if (content.Contains("VhdId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).VhdId = (string) content.GetValueForProperty("VhdId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).VhdId, global::System.Convert.ToString); + } + if (content.Contains("TargetStorageAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).TargetStorageAccountId = (string) content.GetValueForProperty("TargetStorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).TargetStorageAccountId, global::System.Convert.ToString); + } + if (content.Contains("TargetAzureNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).TargetAzureNetworkId = (string) content.GetValueForProperty("TargetAzureNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).TargetAzureNetworkId, global::System.Convert.ToString); + } + if (content.Contains("TargetAzureSubnetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).TargetAzureSubnetId = (string) content.GetValueForProperty("TargetAzureSubnetId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).TargetAzureSubnetId, global::System.Convert.ToString); + } + if (content.Contains("EnableRdpOnTargetOption")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).EnableRdpOnTargetOption = (string) content.GetValueForProperty("EnableRdpOnTargetOption",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).EnableRdpOnTargetOption, global::System.Convert.ToString); + } + if (content.Contains("TargetAzureVMName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).TargetAzureVMName = (string) content.GetValueForProperty("TargetAzureVMName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).TargetAzureVMName, global::System.Convert.ToString); + } + if (content.Contains("LogStorageAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).LogStorageAccountId = (string) content.GetValueForProperty("LogStorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).LogStorageAccountId, global::System.Convert.ToString); + } + if (content.Contains("DisksToInclude")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).DisksToInclude = (string[]) content.GetValueForProperty("DisksToInclude",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).DisksToInclude, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("TargetAzureV1ResourceGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).TargetAzureV1ResourceGroupId = (string) content.GetValueForProperty("TargetAzureV1ResourceGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).TargetAzureV1ResourceGroupId, global::System.Convert.ToString); + } + if (content.Contains("TargetAzureV2ResourceGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).TargetAzureV2ResourceGroupId = (string) content.GetValueForProperty("TargetAzureV2ResourceGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).TargetAzureV2ResourceGroupId, global::System.Convert.ToString); + } + if (content.Contains("UseManagedDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).UseManagedDisk = (string) content.GetValueForProperty("UseManagedDisk",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).UseManagedDisk, global::System.Convert.ToString); + } + if (content.Contains("TargetAvailabilitySetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).TargetAvailabilitySetId = (string) content.GetValueForProperty("TargetAvailabilitySetId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).TargetAvailabilitySetId, global::System.Convert.ToString); + } + if (content.Contains("TargetAvailabilityZone")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).TargetAvailabilityZone = (string) content.GetValueForProperty("TargetAvailabilityZone",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).TargetAvailabilityZone, global::System.Convert.ToString); + } + if (content.Contains("LicenseType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).LicenseType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.LicenseType?) content.GetValueForProperty("LicenseType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).LicenseType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.LicenseType.CreateFrom); + } + if (content.Contains("SqlServerLicenseType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).SqlServerLicenseType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SqlServerLicenseType?) content.GetValueForProperty("SqlServerLicenseType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).SqlServerLicenseType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SqlServerLicenseType.CreateFrom); + } + if (content.Contains("TargetVMSize")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).TargetVMSize = (string) content.GetValueForProperty("TargetVMSize",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).TargetVMSize, global::System.Convert.ToString); + } + if (content.Contains("TargetProximityPlacementGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).TargetProximityPlacementGroupId = (string) content.GetValueForProperty("TargetProximityPlacementGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).TargetProximityPlacementGroupId, global::System.Convert.ToString); + } + if (content.Contains("UseManagedDisksForReplication")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).UseManagedDisksForReplication = (string) content.GetValueForProperty("UseManagedDisksForReplication",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).UseManagedDisksForReplication, global::System.Convert.ToString); + } + if (content.Contains("DiskType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).DiskType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskAccountType?) content.GetValueForProperty("DiskType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).DiskType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskAccountType.CreateFrom); + } + if (content.Contains("DisksToIncludeForManagedDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).DisksToIncludeForManagedDisk = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureDiskInputDetails[]) content.GetValueForProperty("DisksToIncludeForManagedDisk",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).DisksToIncludeForManagedDisk, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureDiskInputDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("DiskEncryptionSetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).DiskEncryptionSetId = (string) content.GetValueForProperty("DiskEncryptionSetId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).DiskEncryptionSetId, global::System.Convert.ToString); + } + if (content.Contains("TargetVMTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).TargetVMTag = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputTargetVmtags) content.GetValueForProperty("TargetVMTag",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).TargetVMTag, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureEnableProtectionInputTargetVmtagsTypeConverter.ConvertFrom); + } + if (content.Contains("SeedManagedDiskTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).SeedManagedDiskTag = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputSeedManagedDiskTags) content.GetValueForProperty("SeedManagedDiskTag",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).SeedManagedDiskTag, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureEnableProtectionInputSeedManagedDiskTagsTypeConverter.ConvertFrom); + } + if (content.Contains("TargetManagedDiskTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).TargetManagedDiskTag = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputTargetManagedDiskTags) content.GetValueForProperty("TargetManagedDiskTag",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).TargetManagedDiskTag, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureEnableProtectionInputTargetManagedDiskTagsTypeConverter.ConvertFrom); + } + if (content.Contains("TargetNicTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).TargetNicTag = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputTargetNicTags) content.GetValueForProperty("TargetNicTag",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal)this).TargetNicTag, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureEnableProtectionInputTargetNicTagsTypeConverter.ConvertFrom); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// HyperVReplicaAzure specific enable protection input. + [System.ComponentModel.TypeConverter(typeof(HyperVReplicaAzureEnableProtectionInputTypeConverter))] + public partial interface IHyperVReplicaAzureEnableProtectionInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureEnableProtectionInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureEnableProtectionInput.TypeConverter.cs new file mode 100644 index 000000000000..93b392c42a5e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureEnableProtectionInput.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class HyperVReplicaAzureEnableProtectionInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return HyperVReplicaAzureEnableProtectionInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return HyperVReplicaAzureEnableProtectionInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return HyperVReplicaAzureEnableProtectionInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureEnableProtectionInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureEnableProtectionInput.cs new file mode 100644 index 000000000000..3b4b54aac3c3 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureEnableProtectionInput.cs @@ -0,0 +1,554 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// HyperVReplicaAzure specific enable protection input. + public partial class HyperVReplicaAzureEnableProtectionInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionProviderSpecificInput __enableProtectionProviderSpecificInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EnableProtectionProviderSpecificInput(); + + /// Backing field for property. + private string _diskEncryptionSetId; + + /// The DiskEncryptionSet ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string DiskEncryptionSetId { get => this._diskEncryptionSetId; set => this._diskEncryptionSetId = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskAccountType? _diskType; + + /// The DiskType. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskAccountType? DiskType { get => this._diskType; set => this._diskType = value; } + + /// Backing field for property. + private string[] _disksToInclude; + + /// The list of VHD Ids of disks to be protected. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string[] DisksToInclude { get => this._disksToInclude; set => this._disksToInclude = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureDiskInputDetails[] _disksToIncludeForManagedDisk; + + /// The disks to include list for managed disks. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureDiskInputDetails[] DisksToIncludeForManagedDisk { get => this._disksToIncludeForManagedDisk; set => this._disksToIncludeForManagedDisk = value; } + + /// Backing field for property. + private string _enableRdpOnTargetOption; + + /// + /// The selected option to enable RDP\SSH on target vm after failover. String value of SrsDataContract.EnableRDPOnTargetOption + /// enum. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string EnableRdpOnTargetOption { get => this._enableRdpOnTargetOption; set => this._enableRdpOnTargetOption = value; } + + /// Backing field for property. + private string _hvHostVMId; + + /// The Hyper-V host VM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string HvHostVMId { get => this._hvHostVMId; set => this._hvHostVMId = value; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionProviderSpecificInputInternal)__enableProtectionProviderSpecificInput).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionProviderSpecificInputInternal)__enableProtectionProviderSpecificInput).InstanceType = value ; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.LicenseType? _licenseType; + + /// License type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.LicenseType? LicenseType { get => this._licenseType; set => this._licenseType = value; } + + /// Backing field for property. + private string _logStorageAccountId; + + /// The storage account to be used for logging during replication. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string LogStorageAccountId { get => this._logStorageAccountId; set => this._logStorageAccountId = value; } + + /// Backing field for property. + private string _oSType; + + /// The OS type associated with VM. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string OSType { get => this._oSType; set => this._oSType = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputSeedManagedDiskTags _seedManagedDiskTag; + + /// The tags for the seed managed disks. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputSeedManagedDiskTags SeedManagedDiskTag { get => (this._seedManagedDiskTag = this._seedManagedDiskTag ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureEnableProtectionInputSeedManagedDiskTags()); set => this._seedManagedDiskTag = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SqlServerLicenseType? _sqlServerLicenseType; + + /// The SQL Server license type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SqlServerLicenseType? SqlServerLicenseType { get => this._sqlServerLicenseType; set => this._sqlServerLicenseType = value; } + + /// Backing field for property. + private string _targetAvailabilitySetId; + + /// The target availability set ARM Id for resource manager deployment. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetAvailabilitySetId { get => this._targetAvailabilitySetId; set => this._targetAvailabilitySetId = value; } + + /// Backing field for property. + private string _targetAvailabilityZone; + + /// The target availability zone. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetAvailabilityZone { get => this._targetAvailabilityZone; set => this._targetAvailabilityZone = value; } + + /// Backing field for property. + private string _targetAzureNetworkId; + + /// The selected target Azure network Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetAzureNetworkId { get => this._targetAzureNetworkId; set => this._targetAzureNetworkId = value; } + + /// Backing field for property. + private string _targetAzureSubnetId; + + /// The selected target Azure subnet Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetAzureSubnetId { get => this._targetAzureSubnetId; set => this._targetAzureSubnetId = value; } + + /// Backing field for property. + private string _targetAzureV1ResourceGroupId; + + /// + /// The Id of the target resource group (for classic deployment) in which the failover VM is to be created. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetAzureV1ResourceGroupId { get => this._targetAzureV1ResourceGroupId; set => this._targetAzureV1ResourceGroupId = value; } + + /// Backing field for property. + private string _targetAzureV2ResourceGroupId; + + /// + /// The Id of the target resource group (for resource manager deployment) in which the failover VM is to be created. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetAzureV2ResourceGroupId { get => this._targetAzureV2ResourceGroupId; set => this._targetAzureV2ResourceGroupId = value; } + + /// Backing field for property. + private string _targetAzureVMName; + + /// The target azure VM Name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetAzureVMName { get => this._targetAzureVMName; set => this._targetAzureVMName = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputTargetManagedDiskTags _targetManagedDiskTag; + + /// The tags for the target managed disks. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputTargetManagedDiskTags TargetManagedDiskTag { get => (this._targetManagedDiskTag = this._targetManagedDiskTag ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureEnableProtectionInputTargetManagedDiskTags()); set => this._targetManagedDiskTag = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputTargetNicTags _targetNicTag; + + /// The tags for the target NICs. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputTargetNicTags TargetNicTag { get => (this._targetNicTag = this._targetNicTag ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureEnableProtectionInputTargetNicTags()); set => this._targetNicTag = value; } + + /// Backing field for property. + private string _targetProximityPlacementGroupId; + + /// The proximity placement group ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetProximityPlacementGroupId { get => this._targetProximityPlacementGroupId; set => this._targetProximityPlacementGroupId = value; } + + /// Backing field for property. + private string _targetStorageAccountId; + + /// The storage account Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetStorageAccountId { get => this._targetStorageAccountId; set => this._targetStorageAccountId = value; } + + /// Backing field for property. + private string _targetVMSize; + + /// The target VM size. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetVMSize { get => this._targetVMSize; set => this._targetVMSize = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputTargetVmtags _targetVMTag; + + /// The target VM tags. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputTargetVmtags TargetVMTag { get => (this._targetVMTag = this._targetVMTag ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureEnableProtectionInputTargetVmtags()); set => this._targetVMTag = value; } + + /// Backing field for property. + private string _useManagedDisk; + + /// A value indicating whether managed disks should be used during failover. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string UseManagedDisk { get => this._useManagedDisk; set => this._useManagedDisk = value; } + + /// Backing field for property. + private string _useManagedDisksForReplication; + + /// A value indicating whether managed disks should be used during replication. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string UseManagedDisksForReplication { get => this._useManagedDisksForReplication; set => this._useManagedDisksForReplication = value; } + + /// Backing field for property. + private string _vMName; + + /// The VM Name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string VMName { get => this._vMName; set => this._vMName = value; } + + /// Backing field for property. + private string _vhdId; + + /// The OS disk VHD id associated with VM. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string VhdId { get => this._vhdId; set => this._vhdId = value; } + + /// Creates an new instance. + public HyperVReplicaAzureEnableProtectionInput() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__enableProtectionProviderSpecificInput), __enableProtectionProviderSpecificInput); + await eventListener.AssertObjectIsValid(nameof(__enableProtectionProviderSpecificInput), __enableProtectionProviderSpecificInput); + } + } + /// HyperVReplicaAzure specific enable protection input. + public partial interface IHyperVReplicaAzureEnableProtectionInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionProviderSpecificInput + { + /// The DiskEncryptionSet ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The DiskEncryptionSet ARM Id.", + SerializedName = @"diskEncryptionSetId", + PossibleTypes = new [] { typeof(string) })] + string DiskEncryptionSetId { get; set; } + /// The DiskType. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The DiskType.", + SerializedName = @"diskType", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskAccountType) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskAccountType? DiskType { get; set; } + /// The list of VHD Ids of disks to be protected. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of VHD Ids of disks to be protected.", + SerializedName = @"disksToInclude", + PossibleTypes = new [] { typeof(string) })] + string[] DisksToInclude { get; set; } + /// The disks to include list for managed disks. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The disks to include list for managed disks.", + SerializedName = @"disksToIncludeForManagedDisks", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureDiskInputDetails) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureDiskInputDetails[] DisksToIncludeForManagedDisk { get; set; } + /// + /// The selected option to enable RDP\SSH on target vm after failover. String value of SrsDataContract.EnableRDPOnTargetOption + /// enum. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The selected option to enable RDP\SSH on target vm after failover. String value of SrsDataContract.EnableRDPOnTargetOption enum.", + SerializedName = @"enableRdpOnTargetOption", + PossibleTypes = new [] { typeof(string) })] + string EnableRdpOnTargetOption { get; set; } + /// The Hyper-V host VM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Hyper-V host VM Id.", + SerializedName = @"hvHostVmId", + PossibleTypes = new [] { typeof(string) })] + string HvHostVMId { get; set; } + /// License type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"License type.", + SerializedName = @"licenseType", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.LicenseType) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.LicenseType? LicenseType { get; set; } + /// The storage account to be used for logging during replication. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The storage account to be used for logging during replication.", + SerializedName = @"logStorageAccountId", + PossibleTypes = new [] { typeof(string) })] + string LogStorageAccountId { get; set; } + /// The OS type associated with VM. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The OS type associated with VM.", + SerializedName = @"osType", + PossibleTypes = new [] { typeof(string) })] + string OSType { get; set; } + /// The tags for the seed managed disks. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The tags for the seed managed disks.", + SerializedName = @"seedManagedDiskTags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputSeedManagedDiskTags) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputSeedManagedDiskTags SeedManagedDiskTag { get; set; } + /// The SQL Server license type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The SQL Server license type.", + SerializedName = @"sqlServerLicenseType", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SqlServerLicenseType) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SqlServerLicenseType? SqlServerLicenseType { get; set; } + /// The target availability set ARM Id for resource manager deployment. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target availability set ARM Id for resource manager deployment.", + SerializedName = @"targetAvailabilitySetId", + PossibleTypes = new [] { typeof(string) })] + string TargetAvailabilitySetId { get; set; } + /// The target availability zone. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target availability zone.", + SerializedName = @"targetAvailabilityZone", + PossibleTypes = new [] { typeof(string) })] + string TargetAvailabilityZone { get; set; } + /// The selected target Azure network Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The selected target Azure network Id.", + SerializedName = @"targetAzureNetworkId", + PossibleTypes = new [] { typeof(string) })] + string TargetAzureNetworkId { get; set; } + /// The selected target Azure subnet Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The selected target Azure subnet Id.", + SerializedName = @"targetAzureSubnetId", + PossibleTypes = new [] { typeof(string) })] + string TargetAzureSubnetId { get; set; } + /// + /// The Id of the target resource group (for classic deployment) in which the failover VM is to be created. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Id of the target resource group (for classic deployment) in which the failover VM is to be created.", + SerializedName = @"targetAzureV1ResourceGroupId", + PossibleTypes = new [] { typeof(string) })] + string TargetAzureV1ResourceGroupId { get; set; } + /// + /// The Id of the target resource group (for resource manager deployment) in which the failover VM is to be created. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Id of the target resource group (for resource manager deployment) in which the failover VM is to be created.", + SerializedName = @"targetAzureV2ResourceGroupId", + PossibleTypes = new [] { typeof(string) })] + string TargetAzureV2ResourceGroupId { get; set; } + /// The target azure VM Name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target azure VM Name.", + SerializedName = @"targetAzureVmName", + PossibleTypes = new [] { typeof(string) })] + string TargetAzureVMName { get; set; } + /// The tags for the target managed disks. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The tags for the target managed disks.", + SerializedName = @"targetManagedDiskTags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputTargetManagedDiskTags) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputTargetManagedDiskTags TargetManagedDiskTag { get; set; } + /// The tags for the target NICs. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The tags for the target NICs.", + SerializedName = @"targetNicTags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputTargetNicTags) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputTargetNicTags TargetNicTag { get; set; } + /// The proximity placement group ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The proximity placement group ARM Id.", + SerializedName = @"targetProximityPlacementGroupId", + PossibleTypes = new [] { typeof(string) })] + string TargetProximityPlacementGroupId { get; set; } + /// The storage account Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The storage account Id.", + SerializedName = @"targetStorageAccountId", + PossibleTypes = new [] { typeof(string) })] + string TargetStorageAccountId { get; set; } + /// The target VM size. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target VM size.", + SerializedName = @"targetVmSize", + PossibleTypes = new [] { typeof(string) })] + string TargetVMSize { get; set; } + /// The target VM tags. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target VM tags.", + SerializedName = @"targetVmTags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputTargetVmtags) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputTargetVmtags TargetVMTag { get; set; } + /// A value indicating whether managed disks should be used during failover. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether managed disks should be used during failover.", + SerializedName = @"useManagedDisks", + PossibleTypes = new [] { typeof(string) })] + string UseManagedDisk { get; set; } + /// A value indicating whether managed disks should be used during replication. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether managed disks should be used during replication.", + SerializedName = @"useManagedDisksForReplication", + PossibleTypes = new [] { typeof(string) })] + string UseManagedDisksForReplication { get; set; } + /// The VM Name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The VM Name.", + SerializedName = @"vmName", + PossibleTypes = new [] { typeof(string) })] + string VMName { get; set; } + /// The OS disk VHD id associated with VM. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The OS disk VHD id associated with VM.", + SerializedName = @"vhdId", + PossibleTypes = new [] { typeof(string) })] + string VhdId { get; set; } + + } + /// HyperVReplicaAzure specific enable protection input. + internal partial interface IHyperVReplicaAzureEnableProtectionInputInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionProviderSpecificInputInternal + { + /// The DiskEncryptionSet ARM Id. + string DiskEncryptionSetId { get; set; } + /// The DiskType. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskAccountType? DiskType { get; set; } + /// The list of VHD Ids of disks to be protected. + string[] DisksToInclude { get; set; } + /// The disks to include list for managed disks. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureDiskInputDetails[] DisksToIncludeForManagedDisk { get; set; } + /// + /// The selected option to enable RDP\SSH on target vm after failover. String value of SrsDataContract.EnableRDPOnTargetOption + /// enum. + /// + string EnableRdpOnTargetOption { get; set; } + /// The Hyper-V host VM Id. + string HvHostVMId { get; set; } + /// License type. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.LicenseType? LicenseType { get; set; } + /// The storage account to be used for logging during replication. + string LogStorageAccountId { get; set; } + /// The OS type associated with VM. + string OSType { get; set; } + /// The tags for the seed managed disks. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputSeedManagedDiskTags SeedManagedDiskTag { get; set; } + /// The SQL Server license type. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SqlServerLicenseType? SqlServerLicenseType { get; set; } + /// The target availability set ARM Id for resource manager deployment. + string TargetAvailabilitySetId { get; set; } + /// The target availability zone. + string TargetAvailabilityZone { get; set; } + /// The selected target Azure network Id. + string TargetAzureNetworkId { get; set; } + /// The selected target Azure subnet Id. + string TargetAzureSubnetId { get; set; } + /// + /// The Id of the target resource group (for classic deployment) in which the failover VM is to be created. + /// + string TargetAzureV1ResourceGroupId { get; set; } + /// + /// The Id of the target resource group (for resource manager deployment) in which the failover VM is to be created. + /// + string TargetAzureV2ResourceGroupId { get; set; } + /// The target azure VM Name. + string TargetAzureVMName { get; set; } + /// The tags for the target managed disks. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputTargetManagedDiskTags TargetManagedDiskTag { get; set; } + /// The tags for the target NICs. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputTargetNicTags TargetNicTag { get; set; } + /// The proximity placement group ARM Id. + string TargetProximityPlacementGroupId { get; set; } + /// The storage account Id. + string TargetStorageAccountId { get; set; } + /// The target VM size. + string TargetVMSize { get; set; } + /// The target VM tags. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputTargetVmtags TargetVMTag { get; set; } + /// A value indicating whether managed disks should be used during failover. + string UseManagedDisk { get; set; } + /// A value indicating whether managed disks should be used during replication. + string UseManagedDisksForReplication { get; set; } + /// The VM Name. + string VMName { get; set; } + /// The OS disk VHD id associated with VM. + string VhdId { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureEnableProtectionInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureEnableProtectionInput.json.cs new file mode 100644 index 000000000000..9dbceb03fbde --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureEnableProtectionInput.json.cs @@ -0,0 +1,182 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// HyperVReplicaAzure specific enable protection input. + public partial class HyperVReplicaAzureEnableProtectionInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new HyperVReplicaAzureEnableProtectionInput(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal HyperVReplicaAzureEnableProtectionInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __enableProtectionProviderSpecificInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EnableProtectionProviderSpecificInput(json); + {_hvHostVMId = If( json?.PropertyT("hvHostVmId"), out var __jsonHvHostVMId) ? (string)__jsonHvHostVMId : (string)HvHostVMId;} + {_vMName = If( json?.PropertyT("vmName"), out var __jsonVMName) ? (string)__jsonVMName : (string)VMName;} + {_oSType = If( json?.PropertyT("osType"), out var __jsonOSType) ? (string)__jsonOSType : (string)OSType;} + {_vhdId = If( json?.PropertyT("vhdId"), out var __jsonVhdId) ? (string)__jsonVhdId : (string)VhdId;} + {_targetStorageAccountId = If( json?.PropertyT("targetStorageAccountId"), out var __jsonTargetStorageAccountId) ? (string)__jsonTargetStorageAccountId : (string)TargetStorageAccountId;} + {_targetAzureNetworkId = If( json?.PropertyT("targetAzureNetworkId"), out var __jsonTargetAzureNetworkId) ? (string)__jsonTargetAzureNetworkId : (string)TargetAzureNetworkId;} + {_targetAzureSubnetId = If( json?.PropertyT("targetAzureSubnetId"), out var __jsonTargetAzureSubnetId) ? (string)__jsonTargetAzureSubnetId : (string)TargetAzureSubnetId;} + {_enableRdpOnTargetOption = If( json?.PropertyT("enableRdpOnTargetOption"), out var __jsonEnableRdpOnTargetOption) ? (string)__jsonEnableRdpOnTargetOption : (string)EnableRdpOnTargetOption;} + {_targetAzureVMName = If( json?.PropertyT("targetAzureVmName"), out var __jsonTargetAzureVMName) ? (string)__jsonTargetAzureVMName : (string)TargetAzureVMName;} + {_logStorageAccountId = If( json?.PropertyT("logStorageAccountId"), out var __jsonLogStorageAccountId) ? (string)__jsonLogStorageAccountId : (string)LogStorageAccountId;} + {_disksToInclude = If( json?.PropertyT("disksToInclude"), out var __jsonDisksToInclude) ? If( __jsonDisksToInclude as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(string) (__u is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : DisksToInclude;} + {_targetAzureV1ResourceGroupId = If( json?.PropertyT("targetAzureV1ResourceGroupId"), out var __jsonTargetAzureV1ResourceGroupId) ? (string)__jsonTargetAzureV1ResourceGroupId : (string)TargetAzureV1ResourceGroupId;} + {_targetAzureV2ResourceGroupId = If( json?.PropertyT("targetAzureV2ResourceGroupId"), out var __jsonTargetAzureV2ResourceGroupId) ? (string)__jsonTargetAzureV2ResourceGroupId : (string)TargetAzureV2ResourceGroupId;} + {_useManagedDisk = If( json?.PropertyT("useManagedDisks"), out var __jsonUseManagedDisks) ? (string)__jsonUseManagedDisks : (string)UseManagedDisk;} + {_targetAvailabilitySetId = If( json?.PropertyT("targetAvailabilitySetId"), out var __jsonTargetAvailabilitySetId) ? (string)__jsonTargetAvailabilitySetId : (string)TargetAvailabilitySetId;} + {_targetAvailabilityZone = If( json?.PropertyT("targetAvailabilityZone"), out var __jsonTargetAvailabilityZone) ? (string)__jsonTargetAvailabilityZone : (string)TargetAvailabilityZone;} + {_licenseType = If( json?.PropertyT("licenseType"), out var __jsonLicenseType) ? (string)__jsonLicenseType : (string)LicenseType;} + {_sqlServerLicenseType = If( json?.PropertyT("sqlServerLicenseType"), out var __jsonSqlServerLicenseType) ? (string)__jsonSqlServerLicenseType : (string)SqlServerLicenseType;} + {_targetVMSize = If( json?.PropertyT("targetVmSize"), out var __jsonTargetVMSize) ? (string)__jsonTargetVMSize : (string)TargetVMSize;} + {_targetProximityPlacementGroupId = If( json?.PropertyT("targetProximityPlacementGroupId"), out var __jsonTargetProximityPlacementGroupId) ? (string)__jsonTargetProximityPlacementGroupId : (string)TargetProximityPlacementGroupId;} + {_useManagedDisksForReplication = If( json?.PropertyT("useManagedDisksForReplication"), out var __jsonUseManagedDisksForReplication) ? (string)__jsonUseManagedDisksForReplication : (string)UseManagedDisksForReplication;} + {_diskType = If( json?.PropertyT("diskType"), out var __jsonDiskType) ? (string)__jsonDiskType : (string)DiskType;} + {_disksToIncludeForManagedDisk = If( json?.PropertyT("disksToIncludeForManagedDisks"), out var __jsonDisksToIncludeForManagedDisks) ? If( __jsonDisksToIncludeForManagedDisks as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __q) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__q, (__p)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureDiskInputDetails) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureDiskInputDetails.FromJson(__p) )) ))() : null : DisksToIncludeForManagedDisk;} + {_diskEncryptionSetId = If( json?.PropertyT("diskEncryptionSetId"), out var __jsonDiskEncryptionSetId) ? (string)__jsonDiskEncryptionSetId : (string)DiskEncryptionSetId;} + {_targetVMTag = If( json?.PropertyT("targetVmTags"), out var __jsonTargetVMTags) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureEnableProtectionInputTargetVmtags.FromJson(__jsonTargetVMTags) : TargetVMTag;} + {_seedManagedDiskTag = If( json?.PropertyT("seedManagedDiskTags"), out var __jsonSeedManagedDiskTags) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureEnableProtectionInputSeedManagedDiskTags.FromJson(__jsonSeedManagedDiskTags) : SeedManagedDiskTag;} + {_targetManagedDiskTag = If( json?.PropertyT("targetManagedDiskTags"), out var __jsonTargetManagedDiskTags) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureEnableProtectionInputTargetManagedDiskTags.FromJson(__jsonTargetManagedDiskTags) : TargetManagedDiskTag;} + {_targetNicTag = If( json?.PropertyT("targetNicTags"), out var __jsonTargetNicTags) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureEnableProtectionInputTargetNicTags.FromJson(__jsonTargetNicTags) : TargetNicTag;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __enableProtectionProviderSpecificInput?.ToJson(container, serializationMode); + AddIf( null != (((object)this._hvHostVMId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._hvHostVMId.ToString()) : null, "hvHostVmId" ,container.Add ); + AddIf( null != (((object)this._vMName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._vMName.ToString()) : null, "vmName" ,container.Add ); + AddIf( null != (((object)this._oSType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._oSType.ToString()) : null, "osType" ,container.Add ); + AddIf( null != (((object)this._vhdId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._vhdId.ToString()) : null, "vhdId" ,container.Add ); + AddIf( null != (((object)this._targetStorageAccountId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetStorageAccountId.ToString()) : null, "targetStorageAccountId" ,container.Add ); + AddIf( null != (((object)this._targetAzureNetworkId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetAzureNetworkId.ToString()) : null, "targetAzureNetworkId" ,container.Add ); + AddIf( null != (((object)this._targetAzureSubnetId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetAzureSubnetId.ToString()) : null, "targetAzureSubnetId" ,container.Add ); + AddIf( null != (((object)this._enableRdpOnTargetOption)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._enableRdpOnTargetOption.ToString()) : null, "enableRdpOnTargetOption" ,container.Add ); + AddIf( null != (((object)this._targetAzureVMName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetAzureVMName.ToString()) : null, "targetAzureVmName" ,container.Add ); + AddIf( null != (((object)this._logStorageAccountId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._logStorageAccountId.ToString()) : null, "logStorageAccountId" ,container.Add ); + if (null != this._disksToInclude) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._disksToInclude ) + { + AddIf(null != (((object)__x)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(__x.ToString()) : null ,__w.Add); + } + container.Add("disksToInclude",__w); + } + AddIf( null != (((object)this._targetAzureV1ResourceGroupId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetAzureV1ResourceGroupId.ToString()) : null, "targetAzureV1ResourceGroupId" ,container.Add ); + AddIf( null != (((object)this._targetAzureV2ResourceGroupId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetAzureV2ResourceGroupId.ToString()) : null, "targetAzureV2ResourceGroupId" ,container.Add ); + AddIf( null != (((object)this._useManagedDisk)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._useManagedDisk.ToString()) : null, "useManagedDisks" ,container.Add ); + AddIf( null != (((object)this._targetAvailabilitySetId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetAvailabilitySetId.ToString()) : null, "targetAvailabilitySetId" ,container.Add ); + AddIf( null != (((object)this._targetAvailabilityZone)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetAvailabilityZone.ToString()) : null, "targetAvailabilityZone" ,container.Add ); + AddIf( null != (((object)this._licenseType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._licenseType.ToString()) : null, "licenseType" ,container.Add ); + AddIf( null != (((object)this._sqlServerLicenseType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._sqlServerLicenseType.ToString()) : null, "sqlServerLicenseType" ,container.Add ); + AddIf( null != (((object)this._targetVMSize)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetVMSize.ToString()) : null, "targetVmSize" ,container.Add ); + AddIf( null != (((object)this._targetProximityPlacementGroupId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetProximityPlacementGroupId.ToString()) : null, "targetProximityPlacementGroupId" ,container.Add ); + AddIf( null != (((object)this._useManagedDisksForReplication)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._useManagedDisksForReplication.ToString()) : null, "useManagedDisksForReplication" ,container.Add ); + AddIf( null != (((object)this._diskType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._diskType.ToString()) : null, "diskType" ,container.Add ); + if (null != this._disksToIncludeForManagedDisk) + { + var __r = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __s in this._disksToIncludeForManagedDisk ) + { + AddIf(__s?.ToJson(null, serializationMode) ,__r.Add); + } + container.Add("disksToIncludeForManagedDisks",__r); + } + AddIf( null != (((object)this._diskEncryptionSetId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._diskEncryptionSetId.ToString()) : null, "diskEncryptionSetId" ,container.Add ); + AddIf( null != this._targetVMTag ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._targetVMTag.ToJson(null,serializationMode) : null, "targetVmTags" ,container.Add ); + AddIf( null != this._seedManagedDiskTag ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._seedManagedDiskTag.ToJson(null,serializationMode) : null, "seedManagedDiskTags" ,container.Add ); + AddIf( null != this._targetManagedDiskTag ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._targetManagedDiskTag.ToJson(null,serializationMode) : null, "targetManagedDiskTags" ,container.Add ); + AddIf( null != this._targetNicTag ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._targetNicTag.ToJson(null,serializationMode) : null, "targetNicTags" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureEnableProtectionInputSeedManagedDiskTags.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureEnableProtectionInputSeedManagedDiskTags.PowerShell.cs new file mode 100644 index 000000000000..db7927a72cf8 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureEnableProtectionInputSeedManagedDiskTags.PowerShell.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// The tags for the seed managed disks. + [System.ComponentModel.TypeConverter(typeof(HyperVReplicaAzureEnableProtectionInputSeedManagedDiskTagsTypeConverter))] + public partial class HyperVReplicaAzureEnableProtectionInputSeedManagedDiskTags + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputSeedManagedDiskTags DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new HyperVReplicaAzureEnableProtectionInputSeedManagedDiskTags(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputSeedManagedDiskTags DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new HyperVReplicaAzureEnableProtectionInputSeedManagedDiskTags(content); + } + + /// + /// Creates a new instance of , deserializing the + /// content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputSeedManagedDiskTags FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal HyperVReplicaAzureEnableProtectionInputSeedManagedDiskTags(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal HyperVReplicaAzureEnableProtectionInputSeedManagedDiskTags(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// The tags for the seed managed disks. + [System.ComponentModel.TypeConverter(typeof(HyperVReplicaAzureEnableProtectionInputSeedManagedDiskTagsTypeConverter))] + public partial interface IHyperVReplicaAzureEnableProtectionInputSeedManagedDiskTags + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureEnableProtectionInputSeedManagedDiskTags.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureEnableProtectionInputSeedManagedDiskTags.TypeConverter.cs new file mode 100644 index 000000000000..50d5aa48f446 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureEnableProtectionInputSeedManagedDiskTags.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class HyperVReplicaAzureEnableProtectionInputSeedManagedDiskTagsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no + /// suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no + /// suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputSeedManagedDiskTags ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputSeedManagedDiskTags).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return HyperVReplicaAzureEnableProtectionInputSeedManagedDiskTags.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return HyperVReplicaAzureEnableProtectionInputSeedManagedDiskTags.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return HyperVReplicaAzureEnableProtectionInputSeedManagedDiskTags.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureEnableProtectionInputSeedManagedDiskTags.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureEnableProtectionInputSeedManagedDiskTags.cs new file mode 100644 index 000000000000..19aa4d36c46c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureEnableProtectionInputSeedManagedDiskTags.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The tags for the seed managed disks. + public partial class HyperVReplicaAzureEnableProtectionInputSeedManagedDiskTags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputSeedManagedDiskTags, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputSeedManagedDiskTagsInternal + { + + /// + /// Creates an new instance. + /// + public HyperVReplicaAzureEnableProtectionInputSeedManagedDiskTags() + { + + } + } + /// The tags for the seed managed disks. + public partial interface IHyperVReplicaAzureEnableProtectionInputSeedManagedDiskTags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray + { + + } + /// The tags for the seed managed disks. + internal partial interface IHyperVReplicaAzureEnableProtectionInputSeedManagedDiskTagsInternal + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureEnableProtectionInputSeedManagedDiskTags.dictionary.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureEnableProtectionInputSeedManagedDiskTags.dictionary.cs new file mode 100644 index 000000000000..f7120e8ba233 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureEnableProtectionInputSeedManagedDiskTags.dictionary.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + public partial class HyperVReplicaAzureEnableProtectionInputSeedManagedDiskTags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray + { + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + + int Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Values { get => __additionalProperties.Values; } + + public string this[global::System.String index] { get => __additionalProperties[index]; set => __additionalProperties[index] = value; } + + /// + /// + public void Add(global::System.String key, string value) => __additionalProperties.Add( key, value); + + public void Clear() => __additionalProperties.Clear(); + + /// + public bool ContainsKey(global::System.String key) => __additionalProperties.ContainsKey( key); + + /// + public void CopyFrom(global::System.Collections.IDictionary source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public void CopyFrom(global::System.Management.Automation.PSObject source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public bool Remove(global::System.String key) => __additionalProperties.Remove( key); + + /// + /// + public bool TryGetValue(global::System.String key, out string value) => __additionalProperties.TryGetValue( key, out value); + + /// + + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureEnableProtectionInputSeedManagedDiskTags source) => source.__additionalProperties; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureEnableProtectionInputSeedManagedDiskTags.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureEnableProtectionInputSeedManagedDiskTags.json.cs new file mode 100644 index 000000000000..ed77df182872 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureEnableProtectionInputSeedManagedDiskTags.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The tags for the seed managed disks. + public partial class HyperVReplicaAzureEnableProtectionInputSeedManagedDiskTags + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputSeedManagedDiskTags. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputSeedManagedDiskTags. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputSeedManagedDiskTags FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new HyperVReplicaAzureEnableProtectionInputSeedManagedDiskTags(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + /// + internal HyperVReplicaAzureEnableProtectionInputSeedManagedDiskTags(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, global::System.Collections.Generic.HashSet exclusions = null) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray)this).AdditionalProperties, null ,exclusions ); + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray)this).AdditionalProperties, container); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureEnableProtectionInputTargetManagedDiskTags.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureEnableProtectionInputTargetManagedDiskTags.PowerShell.cs new file mode 100644 index 000000000000..cc7f893a960b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureEnableProtectionInputTargetManagedDiskTags.PowerShell.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// The tags for the target managed disks. + [System.ComponentModel.TypeConverter(typeof(HyperVReplicaAzureEnableProtectionInputTargetManagedDiskTagsTypeConverter))] + public partial class HyperVReplicaAzureEnableProtectionInputTargetManagedDiskTags + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputTargetManagedDiskTags DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new HyperVReplicaAzureEnableProtectionInputTargetManagedDiskTags(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputTargetManagedDiskTags DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new HyperVReplicaAzureEnableProtectionInputTargetManagedDiskTags(content); + } + + /// + /// Creates a new instance of , deserializing the + /// content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputTargetManagedDiskTags FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal HyperVReplicaAzureEnableProtectionInputTargetManagedDiskTags(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal HyperVReplicaAzureEnableProtectionInputTargetManagedDiskTags(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// The tags for the target managed disks. + [System.ComponentModel.TypeConverter(typeof(HyperVReplicaAzureEnableProtectionInputTargetManagedDiskTagsTypeConverter))] + public partial interface IHyperVReplicaAzureEnableProtectionInputTargetManagedDiskTags + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureEnableProtectionInputTargetManagedDiskTags.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureEnableProtectionInputTargetManagedDiskTags.TypeConverter.cs new file mode 100644 index 000000000000..2747b53e4d7b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureEnableProtectionInputTargetManagedDiskTags.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class HyperVReplicaAzureEnableProtectionInputTargetManagedDiskTagsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is + /// no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is + /// no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputTargetManagedDiskTags ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputTargetManagedDiskTags).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return HyperVReplicaAzureEnableProtectionInputTargetManagedDiskTags.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return HyperVReplicaAzureEnableProtectionInputTargetManagedDiskTags.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return HyperVReplicaAzureEnableProtectionInputTargetManagedDiskTags.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureEnableProtectionInputTargetManagedDiskTags.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureEnableProtectionInputTargetManagedDiskTags.cs new file mode 100644 index 000000000000..de28fe995abf --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureEnableProtectionInputTargetManagedDiskTags.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The tags for the target managed disks. + public partial class HyperVReplicaAzureEnableProtectionInputTargetManagedDiskTags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputTargetManagedDiskTags, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputTargetManagedDiskTagsInternal + { + + /// + /// Creates an new instance. + /// + public HyperVReplicaAzureEnableProtectionInputTargetManagedDiskTags() + { + + } + } + /// The tags for the target managed disks. + public partial interface IHyperVReplicaAzureEnableProtectionInputTargetManagedDiskTags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray + { + + } + /// The tags for the target managed disks. + internal partial interface IHyperVReplicaAzureEnableProtectionInputTargetManagedDiskTagsInternal + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureEnableProtectionInputTargetManagedDiskTags.dictionary.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureEnableProtectionInputTargetManagedDiskTags.dictionary.cs new file mode 100644 index 000000000000..fc3649be7ca2 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureEnableProtectionInputTargetManagedDiskTags.dictionary.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + public partial class HyperVReplicaAzureEnableProtectionInputTargetManagedDiskTags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray + { + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + + int Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Values { get => __additionalProperties.Values; } + + public string this[global::System.String index] { get => __additionalProperties[index]; set => __additionalProperties[index] = value; } + + /// + /// + public void Add(global::System.String key, string value) => __additionalProperties.Add( key, value); + + public void Clear() => __additionalProperties.Clear(); + + /// + public bool ContainsKey(global::System.String key) => __additionalProperties.ContainsKey( key); + + /// + public void CopyFrom(global::System.Collections.IDictionary source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public void CopyFrom(global::System.Management.Automation.PSObject source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public bool Remove(global::System.String key) => __additionalProperties.Remove( key); + + /// + /// + public bool TryGetValue(global::System.String key, out string value) => __additionalProperties.TryGetValue( key, out value); + + /// + + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureEnableProtectionInputTargetManagedDiskTags source) => source.__additionalProperties; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureEnableProtectionInputTargetManagedDiskTags.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureEnableProtectionInputTargetManagedDiskTags.json.cs new file mode 100644 index 000000000000..182225f96455 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureEnableProtectionInputTargetManagedDiskTags.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The tags for the target managed disks. + public partial class HyperVReplicaAzureEnableProtectionInputTargetManagedDiskTags + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputTargetManagedDiskTags. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputTargetManagedDiskTags. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputTargetManagedDiskTags FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new HyperVReplicaAzureEnableProtectionInputTargetManagedDiskTags(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + /// + internal HyperVReplicaAzureEnableProtectionInputTargetManagedDiskTags(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, global::System.Collections.Generic.HashSet exclusions = null) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray)this).AdditionalProperties, null ,exclusions ); + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray)this).AdditionalProperties, container); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureEnableProtectionInputTargetNicTags.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureEnableProtectionInputTargetNicTags.PowerShell.cs new file mode 100644 index 000000000000..27d5eef7eed8 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureEnableProtectionInputTargetNicTags.PowerShell.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// The tags for the target NICs. + [System.ComponentModel.TypeConverter(typeof(HyperVReplicaAzureEnableProtectionInputTargetNicTagsTypeConverter))] + public partial class HyperVReplicaAzureEnableProtectionInputTargetNicTags + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputTargetNicTags DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new HyperVReplicaAzureEnableProtectionInputTargetNicTags(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputTargetNicTags DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new HyperVReplicaAzureEnableProtectionInputTargetNicTags(content); + } + + /// + /// Creates a new instance of , deserializing the content + /// from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputTargetNicTags FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal HyperVReplicaAzureEnableProtectionInputTargetNicTags(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal HyperVReplicaAzureEnableProtectionInputTargetNicTags(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// The tags for the target NICs. + [System.ComponentModel.TypeConverter(typeof(HyperVReplicaAzureEnableProtectionInputTargetNicTagsTypeConverter))] + public partial interface IHyperVReplicaAzureEnableProtectionInputTargetNicTags + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureEnableProtectionInputTargetNicTags.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureEnableProtectionInputTargetNicTags.TypeConverter.cs new file mode 100644 index 000000000000..7b56ca5e62aa --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureEnableProtectionInputTargetNicTags.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class HyperVReplicaAzureEnableProtectionInputTargetNicTagsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a + /// type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputTargetNicTags ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputTargetNicTags).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return HyperVReplicaAzureEnableProtectionInputTargetNicTags.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return HyperVReplicaAzureEnableProtectionInputTargetNicTags.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return HyperVReplicaAzureEnableProtectionInputTargetNicTags.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureEnableProtectionInputTargetNicTags.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureEnableProtectionInputTargetNicTags.cs new file mode 100644 index 000000000000..e160fca681fb --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureEnableProtectionInputTargetNicTags.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The tags for the target NICs. + public partial class HyperVReplicaAzureEnableProtectionInputTargetNicTags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputTargetNicTags, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputTargetNicTagsInternal + { + + /// + /// Creates an new instance. + /// + public HyperVReplicaAzureEnableProtectionInputTargetNicTags() + { + + } + } + /// The tags for the target NICs. + public partial interface IHyperVReplicaAzureEnableProtectionInputTargetNicTags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray + { + + } + /// The tags for the target NICs. + internal partial interface IHyperVReplicaAzureEnableProtectionInputTargetNicTagsInternal + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureEnableProtectionInputTargetNicTags.dictionary.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureEnableProtectionInputTargetNicTags.dictionary.cs new file mode 100644 index 000000000000..4c616409bc30 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureEnableProtectionInputTargetNicTags.dictionary.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + public partial class HyperVReplicaAzureEnableProtectionInputTargetNicTags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray + { + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + + int Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Values { get => __additionalProperties.Values; } + + public string this[global::System.String index] { get => __additionalProperties[index]; set => __additionalProperties[index] = value; } + + /// + /// + public void Add(global::System.String key, string value) => __additionalProperties.Add( key, value); + + public void Clear() => __additionalProperties.Clear(); + + /// + public bool ContainsKey(global::System.String key) => __additionalProperties.ContainsKey( key); + + /// + public void CopyFrom(global::System.Collections.IDictionary source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public void CopyFrom(global::System.Management.Automation.PSObject source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public bool Remove(global::System.String key) => __additionalProperties.Remove( key); + + /// + /// + public bool TryGetValue(global::System.String key, out string value) => __additionalProperties.TryGetValue( key, out value); + + /// + + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureEnableProtectionInputTargetNicTags source) => source.__additionalProperties; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureEnableProtectionInputTargetNicTags.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureEnableProtectionInputTargetNicTags.json.cs new file mode 100644 index 000000000000..f1d0f3b80444 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureEnableProtectionInputTargetNicTags.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The tags for the target NICs. + public partial class HyperVReplicaAzureEnableProtectionInputTargetNicTags + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputTargetNicTags. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputTargetNicTags. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputTargetNicTags FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new HyperVReplicaAzureEnableProtectionInputTargetNicTags(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + /// + internal HyperVReplicaAzureEnableProtectionInputTargetNicTags(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, global::System.Collections.Generic.HashSet exclusions = null) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray)this).AdditionalProperties, null ,exclusions ); + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray)this).AdditionalProperties, container); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureEnableProtectionInputTargetVmtags.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureEnableProtectionInputTargetVmtags.PowerShell.cs new file mode 100644 index 000000000000..989c6e01d99d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureEnableProtectionInputTargetVmtags.PowerShell.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// The target VM tags. + [System.ComponentModel.TypeConverter(typeof(HyperVReplicaAzureEnableProtectionInputTargetVmtagsTypeConverter))] + public partial class HyperVReplicaAzureEnableProtectionInputTargetVmtags + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputTargetVmtags DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new HyperVReplicaAzureEnableProtectionInputTargetVmtags(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputTargetVmtags DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new HyperVReplicaAzureEnableProtectionInputTargetVmtags(content); + } + + /// + /// Creates a new instance of , deserializing the content + /// from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputTargetVmtags FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal HyperVReplicaAzureEnableProtectionInputTargetVmtags(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal HyperVReplicaAzureEnableProtectionInputTargetVmtags(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// The target VM tags. + [System.ComponentModel.TypeConverter(typeof(HyperVReplicaAzureEnableProtectionInputTargetVmtagsTypeConverter))] + public partial interface IHyperVReplicaAzureEnableProtectionInputTargetVmtags + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureEnableProtectionInputTargetVmtags.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureEnableProtectionInputTargetVmtags.TypeConverter.cs new file mode 100644 index 000000000000..79b15de10ca9 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureEnableProtectionInputTargetVmtags.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class HyperVReplicaAzureEnableProtectionInputTargetVmtagsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a + /// type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputTargetVmtags ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputTargetVmtags).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return HyperVReplicaAzureEnableProtectionInputTargetVmtags.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return HyperVReplicaAzureEnableProtectionInputTargetVmtags.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return HyperVReplicaAzureEnableProtectionInputTargetVmtags.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureEnableProtectionInputTargetVmtags.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureEnableProtectionInputTargetVmtags.cs new file mode 100644 index 000000000000..693c3d97a70d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureEnableProtectionInputTargetVmtags.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The target VM tags. + public partial class HyperVReplicaAzureEnableProtectionInputTargetVmtags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputTargetVmtags, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputTargetVmtagsInternal + { + + /// + /// Creates an new instance. + /// + public HyperVReplicaAzureEnableProtectionInputTargetVmtags() + { + + } + } + /// The target VM tags. + public partial interface IHyperVReplicaAzureEnableProtectionInputTargetVmtags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray + { + + } + /// The target VM tags. + internal partial interface IHyperVReplicaAzureEnableProtectionInputTargetVmtagsInternal + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureEnableProtectionInputTargetVmtags.dictionary.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureEnableProtectionInputTargetVmtags.dictionary.cs new file mode 100644 index 000000000000..8c0163f928ce --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureEnableProtectionInputTargetVmtags.dictionary.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + public partial class HyperVReplicaAzureEnableProtectionInputTargetVmtags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray + { + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + + int Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Values { get => __additionalProperties.Values; } + + public string this[global::System.String index] { get => __additionalProperties[index]; set => __additionalProperties[index] = value; } + + /// + /// + public void Add(global::System.String key, string value) => __additionalProperties.Add( key, value); + + public void Clear() => __additionalProperties.Clear(); + + /// + public bool ContainsKey(global::System.String key) => __additionalProperties.ContainsKey( key); + + /// + public void CopyFrom(global::System.Collections.IDictionary source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public void CopyFrom(global::System.Management.Automation.PSObject source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public bool Remove(global::System.String key) => __additionalProperties.Remove( key); + + /// + /// + public bool TryGetValue(global::System.String key, out string value) => __additionalProperties.TryGetValue( key, out value); + + /// + + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureEnableProtectionInputTargetVmtags source) => source.__additionalProperties; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureEnableProtectionInputTargetVmtags.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureEnableProtectionInputTargetVmtags.json.cs new file mode 100644 index 000000000000..db74b1a21e13 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureEnableProtectionInputTargetVmtags.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The target VM tags. + public partial class HyperVReplicaAzureEnableProtectionInputTargetVmtags + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputTargetVmtags. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputTargetVmtags. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEnableProtectionInputTargetVmtags FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new HyperVReplicaAzureEnableProtectionInputTargetVmtags(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + /// + internal HyperVReplicaAzureEnableProtectionInputTargetVmtags(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, global::System.Collections.Generic.HashSet exclusions = null) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray)this).AdditionalProperties, null ,exclusions ); + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray)this).AdditionalProperties, container); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureEventDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureEventDetails.PowerShell.cs new file mode 100644 index 000000000000..a44b9dbc8766 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureEventDetails.PowerShell.cs @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Model class for event details of a HyperVReplica E2A event. + [System.ComponentModel.TypeConverter(typeof(HyperVReplicaAzureEventDetailsTypeConverter))] + public partial class HyperVReplicaAzureEventDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEventDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new HyperVReplicaAzureEventDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEventDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new HyperVReplicaAzureEventDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEventDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal HyperVReplicaAzureEventDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ContainerName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEventDetailsInternal)this).ContainerName = (string) content.GetValueForProperty("ContainerName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEventDetailsInternal)this).ContainerName, global::System.Convert.ToString); + } + if (content.Contains("FabricName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEventDetailsInternal)this).FabricName = (string) content.GetValueForProperty("FabricName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEventDetailsInternal)this).FabricName, global::System.Convert.ToString); + } + if (content.Contains("RemoteContainerName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEventDetailsInternal)this).RemoteContainerName = (string) content.GetValueForProperty("RemoteContainerName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEventDetailsInternal)this).RemoteContainerName, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal HyperVReplicaAzureEventDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ContainerName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEventDetailsInternal)this).ContainerName = (string) content.GetValueForProperty("ContainerName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEventDetailsInternal)this).ContainerName, global::System.Convert.ToString); + } + if (content.Contains("FabricName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEventDetailsInternal)this).FabricName = (string) content.GetValueForProperty("FabricName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEventDetailsInternal)this).FabricName, global::System.Convert.ToString); + } + if (content.Contains("RemoteContainerName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEventDetailsInternal)this).RemoteContainerName = (string) content.GetValueForProperty("RemoteContainerName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEventDetailsInternal)this).RemoteContainerName, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Model class for event details of a HyperVReplica E2A event. + [System.ComponentModel.TypeConverter(typeof(HyperVReplicaAzureEventDetailsTypeConverter))] + public partial interface IHyperVReplicaAzureEventDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureEventDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureEventDetails.TypeConverter.cs new file mode 100644 index 000000000000..170952059769 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureEventDetails.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class HyperVReplicaAzureEventDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEventDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEventDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return HyperVReplicaAzureEventDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return HyperVReplicaAzureEventDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return HyperVReplicaAzureEventDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureEventDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureEventDetails.cs new file mode 100644 index 000000000000..24bd4e328f05 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureEventDetails.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Model class for event details of a HyperVReplica E2A event. + public partial class HyperVReplicaAzureEventDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEventDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEventDetailsInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetails __eventProviderSpecificDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EventProviderSpecificDetails(); + + /// Backing field for property. + private string _containerName; + + /// The container friendly name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ContainerName { get => this._containerName; set => this._containerName = value; } + + /// Backing field for property. + private string _fabricName; + + /// The fabric friendly name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// Gets the class type. Overridden in derived classes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetailsInternal)__eventProviderSpecificDetails).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetailsInternal)__eventProviderSpecificDetails).InstanceType = value ; } + + /// Backing field for property. + private string _remoteContainerName; + + /// The remote container name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RemoteContainerName { get => this._remoteContainerName; set => this._remoteContainerName = value; } + + /// Creates an new instance. + public HyperVReplicaAzureEventDetails() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__eventProviderSpecificDetails), __eventProviderSpecificDetails); + await eventListener.AssertObjectIsValid(nameof(__eventProviderSpecificDetails), __eventProviderSpecificDetails); + } + } + /// Model class for event details of a HyperVReplica E2A event. + public partial interface IHyperVReplicaAzureEventDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetails + { + /// The container friendly name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The container friendly name.", + SerializedName = @"containerName", + PossibleTypes = new [] { typeof(string) })] + string ContainerName { get; set; } + /// The fabric friendly name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The fabric friendly name.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + string FabricName { get; set; } + /// The remote container name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The remote container name.", + SerializedName = @"remoteContainerName", + PossibleTypes = new [] { typeof(string) })] + string RemoteContainerName { get; set; } + + } + /// Model class for event details of a HyperVReplica E2A event. + internal partial interface IHyperVReplicaAzureEventDetailsInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetailsInternal + { + /// The container friendly name. + string ContainerName { get; set; } + /// The fabric friendly name. + string FabricName { get; set; } + /// The remote container name. + string RemoteContainerName { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureEventDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureEventDetails.json.cs new file mode 100644 index 000000000000..c23bdcba5c2a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureEventDetails.json.cs @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Model class for event details of a HyperVReplica E2A event. + public partial class HyperVReplicaAzureEventDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEventDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEventDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureEventDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new HyperVReplicaAzureEventDetails(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal HyperVReplicaAzureEventDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __eventProviderSpecificDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EventProviderSpecificDetails(json); + {_containerName = If( json?.PropertyT("containerName"), out var __jsonContainerName) ? (string)__jsonContainerName : (string)ContainerName;} + {_fabricName = If( json?.PropertyT("fabricName"), out var __jsonFabricName) ? (string)__jsonFabricName : (string)FabricName;} + {_remoteContainerName = If( json?.PropertyT("remoteContainerName"), out var __jsonRemoteContainerName) ? (string)__jsonRemoteContainerName : (string)RemoteContainerName;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __eventProviderSpecificDetails?.ToJson(container, serializationMode); + AddIf( null != (((object)this._containerName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._containerName.ToString()) : null, "containerName" ,container.Add ); + AddIf( null != (((object)this._fabricName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._fabricName.ToString()) : null, "fabricName" ,container.Add ); + AddIf( null != (((object)this._remoteContainerName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._remoteContainerName.ToString()) : null, "remoteContainerName" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureFailbackProviderInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureFailbackProviderInput.PowerShell.cs new file mode 100644 index 000000000000..f607777861ff --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureFailbackProviderInput.PowerShell.cs @@ -0,0 +1,173 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// HyperVReplicaAzureFailback specific planned failover input. + [System.ComponentModel.TypeConverter(typeof(HyperVReplicaAzureFailbackProviderInputTypeConverter))] + public partial class HyperVReplicaAzureFailbackProviderInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureFailbackProviderInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new HyperVReplicaAzureFailbackProviderInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureFailbackProviderInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new HyperVReplicaAzureFailbackProviderInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json + /// string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureFailbackProviderInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal HyperVReplicaAzureFailbackProviderInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DataSyncOption")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureFailbackProviderInputInternal)this).DataSyncOption = (string) content.GetValueForProperty("DataSyncOption",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureFailbackProviderInputInternal)this).DataSyncOption, global::System.Convert.ToString); + } + if (content.Contains("RecoveryVMCreationOption")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureFailbackProviderInputInternal)this).RecoveryVMCreationOption = (string) content.GetValueForProperty("RecoveryVMCreationOption",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureFailbackProviderInputInternal)this).RecoveryVMCreationOption, global::System.Convert.ToString); + } + if (content.Contains("ProviderIdForAlternateRecovery")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureFailbackProviderInputInternal)this).ProviderIdForAlternateRecovery = (string) content.GetValueForProperty("ProviderIdForAlternateRecovery",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureFailbackProviderInputInternal)this).ProviderIdForAlternateRecovery, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverProviderSpecificFailoverInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverProviderSpecificFailoverInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal HyperVReplicaAzureFailbackProviderInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DataSyncOption")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureFailbackProviderInputInternal)this).DataSyncOption = (string) content.GetValueForProperty("DataSyncOption",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureFailbackProviderInputInternal)this).DataSyncOption, global::System.Convert.ToString); + } + if (content.Contains("RecoveryVMCreationOption")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureFailbackProviderInputInternal)this).RecoveryVMCreationOption = (string) content.GetValueForProperty("RecoveryVMCreationOption",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureFailbackProviderInputInternal)this).RecoveryVMCreationOption, global::System.Convert.ToString); + } + if (content.Contains("ProviderIdForAlternateRecovery")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureFailbackProviderInputInternal)this).ProviderIdForAlternateRecovery = (string) content.GetValueForProperty("ProviderIdForAlternateRecovery",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureFailbackProviderInputInternal)this).ProviderIdForAlternateRecovery, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverProviderSpecificFailoverInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverProviderSpecificFailoverInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// HyperVReplicaAzureFailback specific planned failover input. + [System.ComponentModel.TypeConverter(typeof(HyperVReplicaAzureFailbackProviderInputTypeConverter))] + public partial interface IHyperVReplicaAzureFailbackProviderInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureFailbackProviderInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureFailbackProviderInput.TypeConverter.cs new file mode 100644 index 000000000000..b641a3258404 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureFailbackProviderInput.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class HyperVReplicaAzureFailbackProviderInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureFailbackProviderInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureFailbackProviderInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return HyperVReplicaAzureFailbackProviderInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return HyperVReplicaAzureFailbackProviderInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return HyperVReplicaAzureFailbackProviderInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureFailbackProviderInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureFailbackProviderInput.cs new file mode 100644 index 000000000000..4a6c682fe2e2 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureFailbackProviderInput.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// HyperVReplicaAzureFailback specific planned failover input. + public partial class HyperVReplicaAzureFailbackProviderInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureFailbackProviderInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureFailbackProviderInputInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverProviderSpecificFailoverInput __plannedFailoverProviderSpecificFailoverInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PlannedFailoverProviderSpecificFailoverInput(); + + /// Backing field for property. + private string _dataSyncOption; + + /// Data sync option. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string DataSyncOption { get => this._dataSyncOption; set => this._dataSyncOption = value; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverProviderSpecificFailoverInputInternal)__plannedFailoverProviderSpecificFailoverInput).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverProviderSpecificFailoverInputInternal)__plannedFailoverProviderSpecificFailoverInput).InstanceType = value ; } + + /// Backing field for property. + private string _providerIdForAlternateRecovery; + + /// Provider Id for alternate location. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ProviderIdForAlternateRecovery { get => this._providerIdForAlternateRecovery; set => this._providerIdForAlternateRecovery = value; } + + /// Backing field for property. + private string _recoveryVMCreationOption; + + /// ALR options to create alternate recovery. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryVMCreationOption { get => this._recoveryVMCreationOption; set => this._recoveryVMCreationOption = value; } + + /// Creates an new instance. + public HyperVReplicaAzureFailbackProviderInput() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__plannedFailoverProviderSpecificFailoverInput), __plannedFailoverProviderSpecificFailoverInput); + await eventListener.AssertObjectIsValid(nameof(__plannedFailoverProviderSpecificFailoverInput), __plannedFailoverProviderSpecificFailoverInput); + } + } + /// HyperVReplicaAzureFailback specific planned failover input. + public partial interface IHyperVReplicaAzureFailbackProviderInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverProviderSpecificFailoverInput + { + /// Data sync option. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Data sync option.", + SerializedName = @"dataSyncOption", + PossibleTypes = new [] { typeof(string) })] + string DataSyncOption { get; set; } + /// Provider Id for alternate location. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Provider Id for alternate location.", + SerializedName = @"providerIdForAlternateRecovery", + PossibleTypes = new [] { typeof(string) })] + string ProviderIdForAlternateRecovery { get; set; } + /// ALR options to create alternate recovery. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"ALR options to create alternate recovery.", + SerializedName = @"recoveryVmCreationOption", + PossibleTypes = new [] { typeof(string) })] + string RecoveryVMCreationOption { get; set; } + + } + /// HyperVReplicaAzureFailback specific planned failover input. + internal partial interface IHyperVReplicaAzureFailbackProviderInputInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverProviderSpecificFailoverInputInternal + { + /// Data sync option. + string DataSyncOption { get; set; } + /// Provider Id for alternate location. + string ProviderIdForAlternateRecovery { get; set; } + /// ALR options to create alternate recovery. + string RecoveryVMCreationOption { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureFailbackProviderInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureFailbackProviderInput.json.cs new file mode 100644 index 000000000000..eb03ffbb160d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureFailbackProviderInput.json.cs @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// HyperVReplicaAzureFailback specific planned failover input. + public partial class HyperVReplicaAzureFailbackProviderInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureFailbackProviderInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureFailbackProviderInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureFailbackProviderInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new HyperVReplicaAzureFailbackProviderInput(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal HyperVReplicaAzureFailbackProviderInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __plannedFailoverProviderSpecificFailoverInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PlannedFailoverProviderSpecificFailoverInput(json); + {_dataSyncOption = If( json?.PropertyT("dataSyncOption"), out var __jsonDataSyncOption) ? (string)__jsonDataSyncOption : (string)DataSyncOption;} + {_recoveryVMCreationOption = If( json?.PropertyT("recoveryVmCreationOption"), out var __jsonRecoveryVMCreationOption) ? (string)__jsonRecoveryVMCreationOption : (string)RecoveryVMCreationOption;} + {_providerIdForAlternateRecovery = If( json?.PropertyT("providerIdForAlternateRecovery"), out var __jsonProviderIdForAlternateRecovery) ? (string)__jsonProviderIdForAlternateRecovery : (string)ProviderIdForAlternateRecovery;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __plannedFailoverProviderSpecificFailoverInput?.ToJson(container, serializationMode); + AddIf( null != (((object)this._dataSyncOption)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._dataSyncOption.ToString()) : null, "dataSyncOption" ,container.Add ); + AddIf( null != (((object)this._recoveryVMCreationOption)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryVMCreationOption.ToString()) : null, "recoveryVmCreationOption" ,container.Add ); + AddIf( null != (((object)this._providerIdForAlternateRecovery)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._providerIdForAlternateRecovery.ToString()) : null, "providerIdForAlternateRecovery" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureManagedDiskDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureManagedDiskDetails.PowerShell.cs new file mode 100644 index 000000000000..33fb3eaa0791 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureManagedDiskDetails.PowerShell.cs @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Hyper-V Managed disk details. + [System.ComponentModel.TypeConverter(typeof(HyperVReplicaAzureManagedDiskDetailsTypeConverter))] + public partial class HyperVReplicaAzureManagedDiskDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureManagedDiskDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new HyperVReplicaAzureManagedDiskDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureManagedDiskDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new HyperVReplicaAzureManagedDiskDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureManagedDiskDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal HyperVReplicaAzureManagedDiskDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DiskId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureManagedDiskDetailsInternal)this).DiskId = (string) content.GetValueForProperty("DiskId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureManagedDiskDetailsInternal)this).DiskId, global::System.Convert.ToString); + } + if (content.Contains("SeedManagedDiskId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureManagedDiskDetailsInternal)this).SeedManagedDiskId = (string) content.GetValueForProperty("SeedManagedDiskId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureManagedDiskDetailsInternal)this).SeedManagedDiskId, global::System.Convert.ToString); + } + if (content.Contains("ReplicaDiskType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureManagedDiskDetailsInternal)this).ReplicaDiskType = (string) content.GetValueForProperty("ReplicaDiskType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureManagedDiskDetailsInternal)this).ReplicaDiskType, global::System.Convert.ToString); + } + if (content.Contains("DiskEncryptionSetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureManagedDiskDetailsInternal)this).DiskEncryptionSetId = (string) content.GetValueForProperty("DiskEncryptionSetId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureManagedDiskDetailsInternal)this).DiskEncryptionSetId, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal HyperVReplicaAzureManagedDiskDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DiskId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureManagedDiskDetailsInternal)this).DiskId = (string) content.GetValueForProperty("DiskId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureManagedDiskDetailsInternal)this).DiskId, global::System.Convert.ToString); + } + if (content.Contains("SeedManagedDiskId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureManagedDiskDetailsInternal)this).SeedManagedDiskId = (string) content.GetValueForProperty("SeedManagedDiskId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureManagedDiskDetailsInternal)this).SeedManagedDiskId, global::System.Convert.ToString); + } + if (content.Contains("ReplicaDiskType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureManagedDiskDetailsInternal)this).ReplicaDiskType = (string) content.GetValueForProperty("ReplicaDiskType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureManagedDiskDetailsInternal)this).ReplicaDiskType, global::System.Convert.ToString); + } + if (content.Contains("DiskEncryptionSetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureManagedDiskDetailsInternal)this).DiskEncryptionSetId = (string) content.GetValueForProperty("DiskEncryptionSetId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureManagedDiskDetailsInternal)this).DiskEncryptionSetId, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Hyper-V Managed disk details. + [System.ComponentModel.TypeConverter(typeof(HyperVReplicaAzureManagedDiskDetailsTypeConverter))] + public partial interface IHyperVReplicaAzureManagedDiskDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureManagedDiskDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureManagedDiskDetails.TypeConverter.cs new file mode 100644 index 000000000000..3ddb11c31506 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureManagedDiskDetails.TypeConverter.cs @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class HyperVReplicaAzureManagedDiskDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureManagedDiskDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureManagedDiskDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return HyperVReplicaAzureManagedDiskDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return HyperVReplicaAzureManagedDiskDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return HyperVReplicaAzureManagedDiskDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureManagedDiskDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureManagedDiskDetails.cs new file mode 100644 index 000000000000..477b17ecb5c5 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureManagedDiskDetails.cs @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Hyper-V Managed disk details. + public partial class HyperVReplicaAzureManagedDiskDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureManagedDiskDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureManagedDiskDetailsInternal + { + + /// Backing field for property. + private string _diskEncryptionSetId; + + /// The disk encryption set ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string DiskEncryptionSetId { get => this._diskEncryptionSetId; set => this._diskEncryptionSetId = value; } + + /// Backing field for property. + private string _diskId; + + /// The disk Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string DiskId { get => this._diskId; set => this._diskId = value; } + + /// Backing field for property. + private string _replicaDiskType; + + /// The replica disk type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ReplicaDiskType { get => this._replicaDiskType; set => this._replicaDiskType = value; } + + /// Backing field for property. + private string _seedManagedDiskId; + + /// Seed managed disk Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string SeedManagedDiskId { get => this._seedManagedDiskId; set => this._seedManagedDiskId = value; } + + /// Creates an new instance. + public HyperVReplicaAzureManagedDiskDetails() + { + + } + } + /// Hyper-V Managed disk details. + public partial interface IHyperVReplicaAzureManagedDiskDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The disk encryption set ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The disk encryption set ARM Id.", + SerializedName = @"diskEncryptionSetId", + PossibleTypes = new [] { typeof(string) })] + string DiskEncryptionSetId { get; set; } + /// The disk Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The disk Id.", + SerializedName = @"diskId", + PossibleTypes = new [] { typeof(string) })] + string DiskId { get; set; } + /// The replica disk type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The replica disk type.", + SerializedName = @"replicaDiskType", + PossibleTypes = new [] { typeof(string) })] + string ReplicaDiskType { get; set; } + /// Seed managed disk Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Seed managed disk Id.", + SerializedName = @"seedManagedDiskId", + PossibleTypes = new [] { typeof(string) })] + string SeedManagedDiskId { get; set; } + + } + /// Hyper-V Managed disk details. + internal partial interface IHyperVReplicaAzureManagedDiskDetailsInternal + + { + /// The disk encryption set ARM Id. + string DiskEncryptionSetId { get; set; } + /// The disk Id. + string DiskId { get; set; } + /// The replica disk type. + string ReplicaDiskType { get; set; } + /// Seed managed disk Id. + string SeedManagedDiskId { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureManagedDiskDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureManagedDiskDetails.json.cs new file mode 100644 index 000000000000..694653eab8fe --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureManagedDiskDetails.json.cs @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Hyper-V Managed disk details. + public partial class HyperVReplicaAzureManagedDiskDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureManagedDiskDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureManagedDiskDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureManagedDiskDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new HyperVReplicaAzureManagedDiskDetails(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal HyperVReplicaAzureManagedDiskDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_diskId = If( json?.PropertyT("diskId"), out var __jsonDiskId) ? (string)__jsonDiskId : (string)DiskId;} + {_seedManagedDiskId = If( json?.PropertyT("seedManagedDiskId"), out var __jsonSeedManagedDiskId) ? (string)__jsonSeedManagedDiskId : (string)SeedManagedDiskId;} + {_replicaDiskType = If( json?.PropertyT("replicaDiskType"), out var __jsonReplicaDiskType) ? (string)__jsonReplicaDiskType : (string)ReplicaDiskType;} + {_diskEncryptionSetId = If( json?.PropertyT("diskEncryptionSetId"), out var __jsonDiskEncryptionSetId) ? (string)__jsonDiskEncryptionSetId : (string)DiskEncryptionSetId;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._diskId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._diskId.ToString()) : null, "diskId" ,container.Add ); + AddIf( null != (((object)this._seedManagedDiskId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._seedManagedDiskId.ToString()) : null, "seedManagedDiskId" ,container.Add ); + AddIf( null != (((object)this._replicaDiskType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._replicaDiskType.ToString()) : null, "replicaDiskType" ,container.Add ); + AddIf( null != (((object)this._diskEncryptionSetId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._diskEncryptionSetId.ToString()) : null, "diskEncryptionSetId" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzurePlannedFailoverProviderInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzurePlannedFailoverProviderInput.PowerShell.cs new file mode 100644 index 000000000000..201bd4c83cea --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzurePlannedFailoverProviderInput.PowerShell.cs @@ -0,0 +1,173 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// HyperVReplicaAzure specific planned failover input. + [System.ComponentModel.TypeConverter(typeof(HyperVReplicaAzurePlannedFailoverProviderInputTypeConverter))] + public partial class HyperVReplicaAzurePlannedFailoverProviderInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzurePlannedFailoverProviderInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new HyperVReplicaAzurePlannedFailoverProviderInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzurePlannedFailoverProviderInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new HyperVReplicaAzurePlannedFailoverProviderInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from + /// a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzurePlannedFailoverProviderInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal HyperVReplicaAzurePlannedFailoverProviderInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("PrimaryKekCertificatePfx")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzurePlannedFailoverProviderInputInternal)this).PrimaryKekCertificatePfx = (string) content.GetValueForProperty("PrimaryKekCertificatePfx",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzurePlannedFailoverProviderInputInternal)this).PrimaryKekCertificatePfx, global::System.Convert.ToString); + } + if (content.Contains("SecondaryKekCertificatePfx")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzurePlannedFailoverProviderInputInternal)this).SecondaryKekCertificatePfx = (string) content.GetValueForProperty("SecondaryKekCertificatePfx",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzurePlannedFailoverProviderInputInternal)this).SecondaryKekCertificatePfx, global::System.Convert.ToString); + } + if (content.Contains("RecoveryPointId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzurePlannedFailoverProviderInputInternal)this).RecoveryPointId = (string) content.GetValueForProperty("RecoveryPointId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzurePlannedFailoverProviderInputInternal)this).RecoveryPointId, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverProviderSpecificFailoverInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverProviderSpecificFailoverInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal HyperVReplicaAzurePlannedFailoverProviderInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("PrimaryKekCertificatePfx")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzurePlannedFailoverProviderInputInternal)this).PrimaryKekCertificatePfx = (string) content.GetValueForProperty("PrimaryKekCertificatePfx",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzurePlannedFailoverProviderInputInternal)this).PrimaryKekCertificatePfx, global::System.Convert.ToString); + } + if (content.Contains("SecondaryKekCertificatePfx")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzurePlannedFailoverProviderInputInternal)this).SecondaryKekCertificatePfx = (string) content.GetValueForProperty("SecondaryKekCertificatePfx",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzurePlannedFailoverProviderInputInternal)this).SecondaryKekCertificatePfx, global::System.Convert.ToString); + } + if (content.Contains("RecoveryPointId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzurePlannedFailoverProviderInputInternal)this).RecoveryPointId = (string) content.GetValueForProperty("RecoveryPointId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzurePlannedFailoverProviderInputInternal)this).RecoveryPointId, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverProviderSpecificFailoverInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverProviderSpecificFailoverInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// HyperVReplicaAzure specific planned failover input. + [System.ComponentModel.TypeConverter(typeof(HyperVReplicaAzurePlannedFailoverProviderInputTypeConverter))] + public partial interface IHyperVReplicaAzurePlannedFailoverProviderInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzurePlannedFailoverProviderInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzurePlannedFailoverProviderInput.TypeConverter.cs new file mode 100644 index 000000000000..29c76cd2730d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzurePlannedFailoverProviderInput.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class HyperVReplicaAzurePlannedFailoverProviderInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, + /// otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzurePlannedFailoverProviderInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzurePlannedFailoverProviderInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return HyperVReplicaAzurePlannedFailoverProviderInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return HyperVReplicaAzurePlannedFailoverProviderInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return HyperVReplicaAzurePlannedFailoverProviderInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzurePlannedFailoverProviderInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzurePlannedFailoverProviderInput.cs new file mode 100644 index 000000000000..c86b50d97e2a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzurePlannedFailoverProviderInput.cs @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// HyperVReplicaAzure specific planned failover input. + public partial class HyperVReplicaAzurePlannedFailoverProviderInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzurePlannedFailoverProviderInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzurePlannedFailoverProviderInputInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverProviderSpecificFailoverInput __plannedFailoverProviderSpecificFailoverInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PlannedFailoverProviderSpecificFailoverInput(); + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverProviderSpecificFailoverInputInternal)__plannedFailoverProviderSpecificFailoverInput).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverProviderSpecificFailoverInputInternal)__plannedFailoverProviderSpecificFailoverInput).InstanceType = value ; } + + /// Backing field for property. + private string _primaryKekCertificatePfx; + + /// Primary kek certificate pfx. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string PrimaryKekCertificatePfx { get => this._primaryKekCertificatePfx; set => this._primaryKekCertificatePfx = value; } + + /// Backing field for property. + private string _recoveryPointId; + + /// + /// The recovery point id to be passed to failover to a particular recovery point. In case of latest recovery point, null + /// should be passed. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryPointId { get => this._recoveryPointId; set => this._recoveryPointId = value; } + + /// Backing field for property. + private string _secondaryKekCertificatePfx; + + /// Secondary kek certificate pfx. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string SecondaryKekCertificatePfx { get => this._secondaryKekCertificatePfx; set => this._secondaryKekCertificatePfx = value; } + + /// + /// Creates an new instance. + /// + public HyperVReplicaAzurePlannedFailoverProviderInput() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__plannedFailoverProviderSpecificFailoverInput), __plannedFailoverProviderSpecificFailoverInput); + await eventListener.AssertObjectIsValid(nameof(__plannedFailoverProviderSpecificFailoverInput), __plannedFailoverProviderSpecificFailoverInput); + } + } + /// HyperVReplicaAzure specific planned failover input. + public partial interface IHyperVReplicaAzurePlannedFailoverProviderInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverProviderSpecificFailoverInput + { + /// Primary kek certificate pfx. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Primary kek certificate pfx.", + SerializedName = @"primaryKekCertificatePfx", + PossibleTypes = new [] { typeof(string) })] + string PrimaryKekCertificatePfx { get; set; } + /// + /// The recovery point id to be passed to failover to a particular recovery point. In case of latest recovery point, null + /// should be passed. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery point id to be passed to failover to a particular recovery point. In case of latest recovery point, null should be passed.", + SerializedName = @"recoveryPointId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryPointId { get; set; } + /// Secondary kek certificate pfx. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Secondary kek certificate pfx.", + SerializedName = @"secondaryKekCertificatePfx", + PossibleTypes = new [] { typeof(string) })] + string SecondaryKekCertificatePfx { get; set; } + + } + /// HyperVReplicaAzure specific planned failover input. + internal partial interface IHyperVReplicaAzurePlannedFailoverProviderInputInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverProviderSpecificFailoverInputInternal + { + /// Primary kek certificate pfx. + string PrimaryKekCertificatePfx { get; set; } + /// + /// The recovery point id to be passed to failover to a particular recovery point. In case of latest recovery point, null + /// should be passed. + /// + string RecoveryPointId { get; set; } + /// Secondary kek certificate pfx. + string SecondaryKekCertificatePfx { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzurePlannedFailoverProviderInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzurePlannedFailoverProviderInput.json.cs new file mode 100644 index 000000000000..15e86535e8fc --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzurePlannedFailoverProviderInput.json.cs @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// HyperVReplicaAzure specific planned failover input. + public partial class HyperVReplicaAzurePlannedFailoverProviderInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzurePlannedFailoverProviderInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzurePlannedFailoverProviderInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzurePlannedFailoverProviderInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new HyperVReplicaAzurePlannedFailoverProviderInput(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal HyperVReplicaAzurePlannedFailoverProviderInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __plannedFailoverProviderSpecificFailoverInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PlannedFailoverProviderSpecificFailoverInput(json); + {_primaryKekCertificatePfx = If( json?.PropertyT("primaryKekCertificatePfx"), out var __jsonPrimaryKekCertificatePfx) ? (string)__jsonPrimaryKekCertificatePfx : (string)PrimaryKekCertificatePfx;} + {_secondaryKekCertificatePfx = If( json?.PropertyT("secondaryKekCertificatePfx"), out var __jsonSecondaryKekCertificatePfx) ? (string)__jsonSecondaryKekCertificatePfx : (string)SecondaryKekCertificatePfx;} + {_recoveryPointId = If( json?.PropertyT("recoveryPointId"), out var __jsonRecoveryPointId) ? (string)__jsonRecoveryPointId : (string)RecoveryPointId;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __plannedFailoverProviderSpecificFailoverInput?.ToJson(container, serializationMode); + AddIf( null != (((object)this._primaryKekCertificatePfx)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._primaryKekCertificatePfx.ToString()) : null, "primaryKekCertificatePfx" ,container.Add ); + AddIf( null != (((object)this._secondaryKekCertificatePfx)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._secondaryKekCertificatePfx.ToString()) : null, "secondaryKekCertificatePfx" ,container.Add ); + AddIf( null != (((object)this._recoveryPointId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryPointId.ToString()) : null, "recoveryPointId" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzurePolicyDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzurePolicyDetails.PowerShell.cs new file mode 100644 index 000000000000..2a02a0dfe057 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzurePolicyDetails.PowerShell.cs @@ -0,0 +1,194 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Hyper-V Replica Azure specific protection profile details. + [System.ComponentModel.TypeConverter(typeof(HyperVReplicaAzurePolicyDetailsTypeConverter))] + public partial class HyperVReplicaAzurePolicyDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzurePolicyDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new HyperVReplicaAzurePolicyDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzurePolicyDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new HyperVReplicaAzurePolicyDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzurePolicyDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal HyperVReplicaAzurePolicyDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("RecoveryPointHistoryDurationInHour")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzurePolicyDetailsInternal)this).RecoveryPointHistoryDurationInHour = (int?) content.GetValueForProperty("RecoveryPointHistoryDurationInHour",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzurePolicyDetailsInternal)this).RecoveryPointHistoryDurationInHour, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("ApplicationConsistentSnapshotFrequencyInHour")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzurePolicyDetailsInternal)this).ApplicationConsistentSnapshotFrequencyInHour = (int?) content.GetValueForProperty("ApplicationConsistentSnapshotFrequencyInHour",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzurePolicyDetailsInternal)this).ApplicationConsistentSnapshotFrequencyInHour, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("ReplicationInterval")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzurePolicyDetailsInternal)this).ReplicationInterval = (int?) content.GetValueForProperty("ReplicationInterval",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzurePolicyDetailsInternal)this).ReplicationInterval, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("OnlineReplicationStartTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzurePolicyDetailsInternal)this).OnlineReplicationStartTime = (string) content.GetValueForProperty("OnlineReplicationStartTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzurePolicyDetailsInternal)this).OnlineReplicationStartTime, global::System.Convert.ToString); + } + if (content.Contains("Encryption")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzurePolicyDetailsInternal)this).Encryption = (string) content.GetValueForProperty("Encryption",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzurePolicyDetailsInternal)this).Encryption, global::System.Convert.ToString); + } + if (content.Contains("ActiveStorageAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzurePolicyDetailsInternal)this).ActiveStorageAccountId = (string) content.GetValueForProperty("ActiveStorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzurePolicyDetailsInternal)this).ActiveStorageAccountId, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal HyperVReplicaAzurePolicyDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("RecoveryPointHistoryDurationInHour")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzurePolicyDetailsInternal)this).RecoveryPointHistoryDurationInHour = (int?) content.GetValueForProperty("RecoveryPointHistoryDurationInHour",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzurePolicyDetailsInternal)this).RecoveryPointHistoryDurationInHour, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("ApplicationConsistentSnapshotFrequencyInHour")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzurePolicyDetailsInternal)this).ApplicationConsistentSnapshotFrequencyInHour = (int?) content.GetValueForProperty("ApplicationConsistentSnapshotFrequencyInHour",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzurePolicyDetailsInternal)this).ApplicationConsistentSnapshotFrequencyInHour, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("ReplicationInterval")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzurePolicyDetailsInternal)this).ReplicationInterval = (int?) content.GetValueForProperty("ReplicationInterval",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzurePolicyDetailsInternal)this).ReplicationInterval, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("OnlineReplicationStartTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzurePolicyDetailsInternal)this).OnlineReplicationStartTime = (string) content.GetValueForProperty("OnlineReplicationStartTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzurePolicyDetailsInternal)this).OnlineReplicationStartTime, global::System.Convert.ToString); + } + if (content.Contains("Encryption")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzurePolicyDetailsInternal)this).Encryption = (string) content.GetValueForProperty("Encryption",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzurePolicyDetailsInternal)this).Encryption, global::System.Convert.ToString); + } + if (content.Contains("ActiveStorageAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzurePolicyDetailsInternal)this).ActiveStorageAccountId = (string) content.GetValueForProperty("ActiveStorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzurePolicyDetailsInternal)this).ActiveStorageAccountId, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Hyper-V Replica Azure specific protection profile details. + [System.ComponentModel.TypeConverter(typeof(HyperVReplicaAzurePolicyDetailsTypeConverter))] + public partial interface IHyperVReplicaAzurePolicyDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzurePolicyDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzurePolicyDetails.TypeConverter.cs new file mode 100644 index 000000000000..b23c49048e7b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzurePolicyDetails.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class HyperVReplicaAzurePolicyDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzurePolicyDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzurePolicyDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return HyperVReplicaAzurePolicyDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return HyperVReplicaAzurePolicyDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return HyperVReplicaAzurePolicyDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzurePolicyDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzurePolicyDetails.cs new file mode 100644 index 000000000000..4376f90503f6 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzurePolicyDetails.cs @@ -0,0 +1,185 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Hyper-V Replica Azure specific protection profile details. + public partial class HyperVReplicaAzurePolicyDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzurePolicyDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzurePolicyDetailsInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetails __policyProviderSpecificDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PolicyProviderSpecificDetails(); + + /// Backing field for property. + private string _activeStorageAccountId; + + /// The active storage account Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ActiveStorageAccountId { get => this._activeStorageAccountId; set => this._activeStorageAccountId = value; } + + /// + /// Backing field for property. + /// + private int? _applicationConsistentSnapshotFrequencyInHour; + + /// + /// The interval (in hours) at which Hyper-V Replica should create an application consistent snapshot within the VM. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? ApplicationConsistentSnapshotFrequencyInHour { get => this._applicationConsistentSnapshotFrequencyInHour; set => this._applicationConsistentSnapshotFrequencyInHour = value; } + + /// Backing field for property. + private string _encryption; + + /// + /// A value indicating whether encryption is enabled for virtual machines in this cloud. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Encryption { get => this._encryption; set => this._encryption = value; } + + /// Gets the class type. Overridden in derived classes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetailsInternal)__policyProviderSpecificDetails).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetailsInternal)__policyProviderSpecificDetails).InstanceType = value ; } + + /// Backing field for property. + private string _onlineReplicationStartTime; + + /// + /// The scheduled start time for the initial replication. If this parameter is Null, the initial replication starts immediately. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string OnlineReplicationStartTime { get => this._onlineReplicationStartTime; set => this._onlineReplicationStartTime = value; } + + /// Backing field for property. + private int? _recoveryPointHistoryDurationInHour; + + /// + /// The duration (in hours) to which point the recovery history needs to be maintained. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? RecoveryPointHistoryDurationInHour { get => this._recoveryPointHistoryDurationInHour; set => this._recoveryPointHistoryDurationInHour = value; } + + /// Backing field for property. + private int? _replicationInterval; + + /// The replication interval. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? ReplicationInterval { get => this._replicationInterval; set => this._replicationInterval = value; } + + /// Creates an new instance. + public HyperVReplicaAzurePolicyDetails() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__policyProviderSpecificDetails), __policyProviderSpecificDetails); + await eventListener.AssertObjectIsValid(nameof(__policyProviderSpecificDetails), __policyProviderSpecificDetails); + } + } + /// Hyper-V Replica Azure specific protection profile details. + public partial interface IHyperVReplicaAzurePolicyDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetails + { + /// The active storage account Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The active storage account Id.", + SerializedName = @"activeStorageAccountId", + PossibleTypes = new [] { typeof(string) })] + string ActiveStorageAccountId { get; set; } + /// + /// The interval (in hours) at which Hyper-V Replica should create an application consistent snapshot within the VM. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The interval (in hours) at which Hyper-V Replica should create an application consistent snapshot within the VM.", + SerializedName = @"applicationConsistentSnapshotFrequencyInHours", + PossibleTypes = new [] { typeof(int) })] + int? ApplicationConsistentSnapshotFrequencyInHour { get; set; } + /// + /// A value indicating whether encryption is enabled for virtual machines in this cloud. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether encryption is enabled for virtual machines in this cloud.", + SerializedName = @"encryption", + PossibleTypes = new [] { typeof(string) })] + string Encryption { get; set; } + /// + /// The scheduled start time for the initial replication. If this parameter is Null, the initial replication starts immediately. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The scheduled start time for the initial replication. If this parameter is Null, the initial replication starts immediately.", + SerializedName = @"onlineReplicationStartTime", + PossibleTypes = new [] { typeof(string) })] + string OnlineReplicationStartTime { get; set; } + /// + /// The duration (in hours) to which point the recovery history needs to be maintained. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The duration (in hours) to which point the recovery history needs to be maintained.", + SerializedName = @"recoveryPointHistoryDurationInHours", + PossibleTypes = new [] { typeof(int) })] + int? RecoveryPointHistoryDurationInHour { get; set; } + /// The replication interval. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The replication interval.", + SerializedName = @"replicationInterval", + PossibleTypes = new [] { typeof(int) })] + int? ReplicationInterval { get; set; } + + } + /// Hyper-V Replica Azure specific protection profile details. + internal partial interface IHyperVReplicaAzurePolicyDetailsInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetailsInternal + { + /// The active storage account Id. + string ActiveStorageAccountId { get; set; } + /// + /// The interval (in hours) at which Hyper-V Replica should create an application consistent snapshot within the VM. + /// + int? ApplicationConsistentSnapshotFrequencyInHour { get; set; } + /// + /// A value indicating whether encryption is enabled for virtual machines in this cloud. + /// + string Encryption { get; set; } + /// + /// The scheduled start time for the initial replication. If this parameter is Null, the initial replication starts immediately. + /// + string OnlineReplicationStartTime { get; set; } + /// + /// The duration (in hours) to which point the recovery history needs to be maintained. + /// + int? RecoveryPointHistoryDurationInHour { get; set; } + /// The replication interval. + int? ReplicationInterval { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzurePolicyDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzurePolicyDetails.json.cs new file mode 100644 index 000000000000..727656ecdf30 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzurePolicyDetails.json.cs @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Hyper-V Replica Azure specific protection profile details. + public partial class HyperVReplicaAzurePolicyDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzurePolicyDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzurePolicyDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzurePolicyDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new HyperVReplicaAzurePolicyDetails(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal HyperVReplicaAzurePolicyDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __policyProviderSpecificDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PolicyProviderSpecificDetails(json); + {_recoveryPointHistoryDurationInHour = If( json?.PropertyT("recoveryPointHistoryDurationInHours"), out var __jsonRecoveryPointHistoryDurationInHours) ? (int?)__jsonRecoveryPointHistoryDurationInHours : RecoveryPointHistoryDurationInHour;} + {_applicationConsistentSnapshotFrequencyInHour = If( json?.PropertyT("applicationConsistentSnapshotFrequencyInHours"), out var __jsonApplicationConsistentSnapshotFrequencyInHours) ? (int?)__jsonApplicationConsistentSnapshotFrequencyInHours : ApplicationConsistentSnapshotFrequencyInHour;} + {_replicationInterval = If( json?.PropertyT("replicationInterval"), out var __jsonReplicationInterval) ? (int?)__jsonReplicationInterval : ReplicationInterval;} + {_onlineReplicationStartTime = If( json?.PropertyT("onlineReplicationStartTime"), out var __jsonOnlineReplicationStartTime) ? (string)__jsonOnlineReplicationStartTime : (string)OnlineReplicationStartTime;} + {_encryption = If( json?.PropertyT("encryption"), out var __jsonEncryption) ? (string)__jsonEncryption : (string)Encryption;} + {_activeStorageAccountId = If( json?.PropertyT("activeStorageAccountId"), out var __jsonActiveStorageAccountId) ? (string)__jsonActiveStorageAccountId : (string)ActiveStorageAccountId;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __policyProviderSpecificDetails?.ToJson(container, serializationMode); + AddIf( null != this._recoveryPointHistoryDurationInHour ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._recoveryPointHistoryDurationInHour) : null, "recoveryPointHistoryDurationInHours" ,container.Add ); + AddIf( null != this._applicationConsistentSnapshotFrequencyInHour ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._applicationConsistentSnapshotFrequencyInHour) : null, "applicationConsistentSnapshotFrequencyInHours" ,container.Add ); + AddIf( null != this._replicationInterval ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._replicationInterval) : null, "replicationInterval" ,container.Add ); + AddIf( null != (((object)this._onlineReplicationStartTime)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._onlineReplicationStartTime.ToString()) : null, "onlineReplicationStartTime" ,container.Add ); + AddIf( null != (((object)this._encryption)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._encryption.ToString()) : null, "encryption" ,container.Add ); + AddIf( null != (((object)this._activeStorageAccountId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._activeStorageAccountId.ToString()) : null, "activeStorageAccountId" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzurePolicyInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzurePolicyInput.PowerShell.cs new file mode 100644 index 000000000000..af533266b620 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzurePolicyInput.PowerShell.cs @@ -0,0 +1,186 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Hyper-V Replica Azure specific input for creating a protection profile. + [System.ComponentModel.TypeConverter(typeof(HyperVReplicaAzurePolicyInputTypeConverter))] + public partial class HyperVReplicaAzurePolicyInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzurePolicyInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new HyperVReplicaAzurePolicyInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzurePolicyInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new HyperVReplicaAzurePolicyInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzurePolicyInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal HyperVReplicaAzurePolicyInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("RecoveryPointHistoryDuration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzurePolicyInputInternal)this).RecoveryPointHistoryDuration = (int?) content.GetValueForProperty("RecoveryPointHistoryDuration",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzurePolicyInputInternal)this).RecoveryPointHistoryDuration, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("ApplicationConsistentSnapshotFrequencyInHour")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzurePolicyInputInternal)this).ApplicationConsistentSnapshotFrequencyInHour = (int?) content.GetValueForProperty("ApplicationConsistentSnapshotFrequencyInHour",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzurePolicyInputInternal)this).ApplicationConsistentSnapshotFrequencyInHour, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("ReplicationInterval")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzurePolicyInputInternal)this).ReplicationInterval = (int?) content.GetValueForProperty("ReplicationInterval",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzurePolicyInputInternal)this).ReplicationInterval, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("OnlineReplicationStartTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzurePolicyInputInternal)this).OnlineReplicationStartTime = (string) content.GetValueForProperty("OnlineReplicationStartTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzurePolicyInputInternal)this).OnlineReplicationStartTime, global::System.Convert.ToString); + } + if (content.Contains("StorageAccount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzurePolicyInputInternal)this).StorageAccount = (string[]) content.GetValueForProperty("StorageAccount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzurePolicyInputInternal)this).StorageAccount, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal HyperVReplicaAzurePolicyInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("RecoveryPointHistoryDuration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzurePolicyInputInternal)this).RecoveryPointHistoryDuration = (int?) content.GetValueForProperty("RecoveryPointHistoryDuration",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzurePolicyInputInternal)this).RecoveryPointHistoryDuration, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("ApplicationConsistentSnapshotFrequencyInHour")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzurePolicyInputInternal)this).ApplicationConsistentSnapshotFrequencyInHour = (int?) content.GetValueForProperty("ApplicationConsistentSnapshotFrequencyInHour",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzurePolicyInputInternal)this).ApplicationConsistentSnapshotFrequencyInHour, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("ReplicationInterval")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzurePolicyInputInternal)this).ReplicationInterval = (int?) content.GetValueForProperty("ReplicationInterval",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzurePolicyInputInternal)this).ReplicationInterval, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("OnlineReplicationStartTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzurePolicyInputInternal)this).OnlineReplicationStartTime = (string) content.GetValueForProperty("OnlineReplicationStartTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzurePolicyInputInternal)this).OnlineReplicationStartTime, global::System.Convert.ToString); + } + if (content.Contains("StorageAccount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzurePolicyInputInternal)this).StorageAccount = (string[]) content.GetValueForProperty("StorageAccount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzurePolicyInputInternal)this).StorageAccount, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Hyper-V Replica Azure specific input for creating a protection profile. + [System.ComponentModel.TypeConverter(typeof(HyperVReplicaAzurePolicyInputTypeConverter))] + public partial interface IHyperVReplicaAzurePolicyInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzurePolicyInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzurePolicyInput.TypeConverter.cs new file mode 100644 index 000000000000..78381c7b3c1c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzurePolicyInput.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class HyperVReplicaAzurePolicyInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzurePolicyInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzurePolicyInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return HyperVReplicaAzurePolicyInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return HyperVReplicaAzurePolicyInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return HyperVReplicaAzurePolicyInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzurePolicyInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzurePolicyInput.cs new file mode 100644 index 000000000000..f0114cb3ec52 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzurePolicyInput.cs @@ -0,0 +1,168 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Hyper-V Replica Azure specific input for creating a protection profile. + public partial class HyperVReplicaAzurePolicyInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzurePolicyInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzurePolicyInputInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInput __policyProviderSpecificInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PolicyProviderSpecificInput(); + + /// + /// Backing field for property. + /// + private int? _applicationConsistentSnapshotFrequencyInHour; + + /// + /// The interval (in hours) at which Hyper-V Replica should create an application consistent snapshot within the VM. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? ApplicationConsistentSnapshotFrequencyInHour { get => this._applicationConsistentSnapshotFrequencyInHour; set => this._applicationConsistentSnapshotFrequencyInHour = value; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInputInternal)__policyProviderSpecificInput).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInputInternal)__policyProviderSpecificInput).InstanceType = value ; } + + /// Backing field for property. + private string _onlineReplicationStartTime; + + /// + /// The scheduled start time for the initial replication. If this parameter is Null, the initial replication starts immediately. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string OnlineReplicationStartTime { get => this._onlineReplicationStartTime; set => this._onlineReplicationStartTime = value; } + + /// Backing field for property. + private int? _recoveryPointHistoryDuration; + + /// + /// The duration (in hours) to which point the recovery history needs to be maintained. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? RecoveryPointHistoryDuration { get => this._recoveryPointHistoryDuration; set => this._recoveryPointHistoryDuration = value; } + + /// Backing field for property. + private int? _replicationInterval; + + /// The replication interval. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? ReplicationInterval { get => this._replicationInterval; set => this._replicationInterval = value; } + + /// Backing field for property. + private string[] _storageAccount; + + /// + /// The list of storage accounts to which the VMs in the primary cloud can replicate to. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string[] StorageAccount { get => this._storageAccount; set => this._storageAccount = value; } + + /// Creates an new instance. + public HyperVReplicaAzurePolicyInput() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__policyProviderSpecificInput), __policyProviderSpecificInput); + await eventListener.AssertObjectIsValid(nameof(__policyProviderSpecificInput), __policyProviderSpecificInput); + } + } + /// Hyper-V Replica Azure specific input for creating a protection profile. + public partial interface IHyperVReplicaAzurePolicyInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInput + { + /// + /// The interval (in hours) at which Hyper-V Replica should create an application consistent snapshot within the VM. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The interval (in hours) at which Hyper-V Replica should create an application consistent snapshot within the VM.", + SerializedName = @"applicationConsistentSnapshotFrequencyInHours", + PossibleTypes = new [] { typeof(int) })] + int? ApplicationConsistentSnapshotFrequencyInHour { get; set; } + /// + /// The scheduled start time for the initial replication. If this parameter is Null, the initial replication starts immediately. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The scheduled start time for the initial replication. If this parameter is Null, the initial replication starts immediately.", + SerializedName = @"onlineReplicationStartTime", + PossibleTypes = new [] { typeof(string) })] + string OnlineReplicationStartTime { get; set; } + /// + /// The duration (in hours) to which point the recovery history needs to be maintained. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The duration (in hours) to which point the recovery history needs to be maintained.", + SerializedName = @"recoveryPointHistoryDuration", + PossibleTypes = new [] { typeof(int) })] + int? RecoveryPointHistoryDuration { get; set; } + /// The replication interval. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The replication interval.", + SerializedName = @"replicationInterval", + PossibleTypes = new [] { typeof(int) })] + int? ReplicationInterval { get; set; } + /// + /// The list of storage accounts to which the VMs in the primary cloud can replicate to. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of storage accounts to which the VMs in the primary cloud can replicate to.", + SerializedName = @"storageAccounts", + PossibleTypes = new [] { typeof(string) })] + string[] StorageAccount { get; set; } + + } + /// Hyper-V Replica Azure specific input for creating a protection profile. + internal partial interface IHyperVReplicaAzurePolicyInputInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInputInternal + { + /// + /// The interval (in hours) at which Hyper-V Replica should create an application consistent snapshot within the VM. + /// + int? ApplicationConsistentSnapshotFrequencyInHour { get; set; } + /// + /// The scheduled start time for the initial replication. If this parameter is Null, the initial replication starts immediately. + /// + string OnlineReplicationStartTime { get; set; } + /// + /// The duration (in hours) to which point the recovery history needs to be maintained. + /// + int? RecoveryPointHistoryDuration { get; set; } + /// The replication interval. + int? ReplicationInterval { get; set; } + /// + /// The list of storage accounts to which the VMs in the primary cloud can replicate to. + /// + string[] StorageAccount { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzurePolicyInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzurePolicyInput.json.cs new file mode 100644 index 000000000000..91e1a22f05f8 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzurePolicyInput.json.cs @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Hyper-V Replica Azure specific input for creating a protection profile. + public partial class HyperVReplicaAzurePolicyInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzurePolicyInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzurePolicyInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzurePolicyInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new HyperVReplicaAzurePolicyInput(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal HyperVReplicaAzurePolicyInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __policyProviderSpecificInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PolicyProviderSpecificInput(json); + {_recoveryPointHistoryDuration = If( json?.PropertyT("recoveryPointHistoryDuration"), out var __jsonRecoveryPointHistoryDuration) ? (int?)__jsonRecoveryPointHistoryDuration : RecoveryPointHistoryDuration;} + {_applicationConsistentSnapshotFrequencyInHour = If( json?.PropertyT("applicationConsistentSnapshotFrequencyInHours"), out var __jsonApplicationConsistentSnapshotFrequencyInHours) ? (int?)__jsonApplicationConsistentSnapshotFrequencyInHours : ApplicationConsistentSnapshotFrequencyInHour;} + {_replicationInterval = If( json?.PropertyT("replicationInterval"), out var __jsonReplicationInterval) ? (int?)__jsonReplicationInterval : ReplicationInterval;} + {_onlineReplicationStartTime = If( json?.PropertyT("onlineReplicationStartTime"), out var __jsonOnlineReplicationStartTime) ? (string)__jsonOnlineReplicationStartTime : (string)OnlineReplicationStartTime;} + {_storageAccount = If( json?.PropertyT("storageAccounts"), out var __jsonStorageAccounts) ? If( __jsonStorageAccounts as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(string) (__u is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : StorageAccount;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __policyProviderSpecificInput?.ToJson(container, serializationMode); + AddIf( null != this._recoveryPointHistoryDuration ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._recoveryPointHistoryDuration) : null, "recoveryPointHistoryDuration" ,container.Add ); + AddIf( null != this._applicationConsistentSnapshotFrequencyInHour ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._applicationConsistentSnapshotFrequencyInHour) : null, "applicationConsistentSnapshotFrequencyInHours" ,container.Add ); + AddIf( null != this._replicationInterval ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._replicationInterval) : null, "replicationInterval" ,container.Add ); + AddIf( null != (((object)this._onlineReplicationStartTime)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._onlineReplicationStartTime.ToString()) : null, "onlineReplicationStartTime" ,container.Add ); + if (null != this._storageAccount) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._storageAccount ) + { + AddIf(null != (((object)__x)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(__x.ToString()) : null ,__w.Add); + } + container.Add("storageAccounts",__w); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureReplicationDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureReplicationDetails.PowerShell.cs new file mode 100644 index 000000000000..4ece1fea909e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureReplicationDetails.PowerShell.cs @@ -0,0 +1,476 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Hyper V Replica Azure provider specific settings. + [System.ComponentModel.TypeConverter(typeof(HyperVReplicaAzureReplicationDetailsTypeConverter))] + public partial class HyperVReplicaAzureReplicationDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new HyperVReplicaAzureReplicationDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new HyperVReplicaAzureReplicationDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal HyperVReplicaAzureReplicationDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InitialReplicationDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).InitialReplicationDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInitialReplicationDetails) content.GetValueForProperty("InitialReplicationDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).InitialReplicationDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InitialReplicationDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("OSDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).OSDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDetails) content.GetValueForProperty("OSDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).OSDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.OSDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("AzureVMDiskDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).AzureVMDiskDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureVMDiskDetails[]) content.GetValueForProperty("AzureVMDiskDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).AzureVMDiskDetail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AzureVMDiskDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("RecoveryAzureVMName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).RecoveryAzureVMName = (string) content.GetValueForProperty("RecoveryAzureVMName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).RecoveryAzureVMName, global::System.Convert.ToString); + } + if (content.Contains("RecoveryAzureVMSize")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).RecoveryAzureVMSize = (string) content.GetValueForProperty("RecoveryAzureVMSize",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).RecoveryAzureVMSize, global::System.Convert.ToString); + } + if (content.Contains("RecoveryAzureStorageAccount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).RecoveryAzureStorageAccount = (string) content.GetValueForProperty("RecoveryAzureStorageAccount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).RecoveryAzureStorageAccount, global::System.Convert.ToString); + } + if (content.Contains("RecoveryAzureLogStorageAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).RecoveryAzureLogStorageAccountId = (string) content.GetValueForProperty("RecoveryAzureLogStorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).RecoveryAzureLogStorageAccountId, global::System.Convert.ToString); + } + if (content.Contains("LastReplicatedTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).LastReplicatedTime = (global::System.DateTime?) content.GetValueForProperty("LastReplicatedTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).LastReplicatedTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("RpoInSecond")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).RpoInSecond = (long?) content.GetValueForProperty("RpoInSecond",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).RpoInSecond, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("LastRpoCalculatedTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).LastRpoCalculatedTime = (global::System.DateTime?) content.GetValueForProperty("LastRpoCalculatedTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).LastRpoCalculatedTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("VMId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).VMId = (string) content.GetValueForProperty("VMId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).VMId, global::System.Convert.ToString); + } + if (content.Contains("VMProtectionState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).VMProtectionState = (string) content.GetValueForProperty("VMProtectionState",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).VMProtectionState, global::System.Convert.ToString); + } + if (content.Contains("VMProtectionStateDescription")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).VMProtectionStateDescription = (string) content.GetValueForProperty("VMProtectionStateDescription",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).VMProtectionStateDescription, global::System.Convert.ToString); + } + if (content.Contains("VMNic")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).VMNic = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetails[]) content.GetValueForProperty("VMNic",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).VMNic, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMNicDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("SelectedRecoveryAzureNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).SelectedRecoveryAzureNetworkId = (string) content.GetValueForProperty("SelectedRecoveryAzureNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).SelectedRecoveryAzureNetworkId, global::System.Convert.ToString); + } + if (content.Contains("SelectedSourceNicId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).SelectedSourceNicId = (string) content.GetValueForProperty("SelectedSourceNicId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).SelectedSourceNicId, global::System.Convert.ToString); + } + if (content.Contains("Encryption")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).Encryption = (string) content.GetValueForProperty("Encryption",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).Encryption, global::System.Convert.ToString); + } + if (content.Contains("SourceVMRamSizeInMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).SourceVMRamSizeInMb = (int?) content.GetValueForProperty("SourceVMRamSizeInMb",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).SourceVMRamSizeInMb, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("SourceVMCpuCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).SourceVMCpuCount = (int?) content.GetValueForProperty("SourceVMCpuCount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).SourceVMCpuCount, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("EnableRdpOnTargetOption")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).EnableRdpOnTargetOption = (string) content.GetValueForProperty("EnableRdpOnTargetOption",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).EnableRdpOnTargetOption, global::System.Convert.ToString); + } + if (content.Contains("RecoveryAzureResourceGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).RecoveryAzureResourceGroupId = (string) content.GetValueForProperty("RecoveryAzureResourceGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).RecoveryAzureResourceGroupId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryAvailabilitySetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).RecoveryAvailabilitySetId = (string) content.GetValueForProperty("RecoveryAvailabilitySetId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).RecoveryAvailabilitySetId, global::System.Convert.ToString); + } + if (content.Contains("TargetAvailabilityZone")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).TargetAvailabilityZone = (string) content.GetValueForProperty("TargetAvailabilityZone",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).TargetAvailabilityZone, global::System.Convert.ToString); + } + if (content.Contains("TargetProximityPlacementGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).TargetProximityPlacementGroupId = (string) content.GetValueForProperty("TargetProximityPlacementGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).TargetProximityPlacementGroupId, global::System.Convert.ToString); + } + if (content.Contains("UseManagedDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).UseManagedDisk = (string) content.GetValueForProperty("UseManagedDisk",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).UseManagedDisk, global::System.Convert.ToString); + } + if (content.Contains("LicenseType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).LicenseType = (string) content.GetValueForProperty("LicenseType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).LicenseType, global::System.Convert.ToString); + } + if (content.Contains("SqlServerLicenseType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).SqlServerLicenseType = (string) content.GetValueForProperty("SqlServerLicenseType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).SqlServerLicenseType, global::System.Convert.ToString); + } + if (content.Contains("LastRecoveryPointReceived")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).LastRecoveryPointReceived = (global::System.DateTime?) content.GetValueForProperty("LastRecoveryPointReceived",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).LastRecoveryPointReceived, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("TargetVMTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).TargetVMTag = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsTargetVmtags) content.GetValueForProperty("TargetVMTag",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).TargetVMTag, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureReplicationDetailsTargetVmtagsTypeConverter.ConvertFrom); + } + if (content.Contains("SeedManagedDiskTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).SeedManagedDiskTag = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsSeedManagedDiskTags) content.GetValueForProperty("SeedManagedDiskTag",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).SeedManagedDiskTag, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureReplicationDetailsSeedManagedDiskTagsTypeConverter.ConvertFrom); + } + if (content.Contains("TargetManagedDiskTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).TargetManagedDiskTag = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsTargetManagedDiskTags) content.GetValueForProperty("TargetManagedDiskTag",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).TargetManagedDiskTag, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureReplicationDetailsTargetManagedDiskTagsTypeConverter.ConvertFrom); + } + if (content.Contains("TargetNicTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).TargetNicTag = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsTargetNicTags) content.GetValueForProperty("TargetNicTag",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).TargetNicTag, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureReplicationDetailsTargetNicTagsTypeConverter.ConvertFrom); + } + if (content.Contains("ProtectedManagedDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).ProtectedManagedDisk = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureManagedDiskDetails[]) content.GetValueForProperty("ProtectedManagedDisk",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).ProtectedManagedDisk, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureManagedDiskDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettingsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettingsInternal)this).InstanceType, global::System.Convert.ToString); + } + if (content.Contains("OSDetailOstype")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).OSDetailOstype = (string) content.GetValueForProperty("OSDetailOstype",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).OSDetailOstype, global::System.Convert.ToString); + } + if (content.Contains("OSDetailProductType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).OSDetailProductType = (string) content.GetValueForProperty("OSDetailProductType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).OSDetailProductType, global::System.Convert.ToString); + } + if (content.Contains("OSDetailOsedition")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).OSDetailOsedition = (string) content.GetValueForProperty("OSDetailOsedition",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).OSDetailOsedition, global::System.Convert.ToString); + } + if (content.Contains("InitialReplicationDetailInitialReplicationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).InitialReplicationDetailInitialReplicationType = (string) content.GetValueForProperty("InitialReplicationDetailInitialReplicationType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).InitialReplicationDetailInitialReplicationType, global::System.Convert.ToString); + } + if (content.Contains("InitialReplicationDetailInitialReplicationProgressPercentage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).InitialReplicationDetailInitialReplicationProgressPercentage = (string) content.GetValueForProperty("InitialReplicationDetailInitialReplicationProgressPercentage",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).InitialReplicationDetailInitialReplicationProgressPercentage, global::System.Convert.ToString); + } + if (content.Contains("OSDetailOsversion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).OSDetailOsversion = (string) content.GetValueForProperty("OSDetailOsversion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).OSDetailOsversion, global::System.Convert.ToString); + } + if (content.Contains("OSDetailOsmajorVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).OSDetailOsmajorVersion = (string) content.GetValueForProperty("OSDetailOsmajorVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).OSDetailOsmajorVersion, global::System.Convert.ToString); + } + if (content.Contains("OSDetailOsminorVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).OSDetailOsminorVersion = (string) content.GetValueForProperty("OSDetailOsminorVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).OSDetailOsminorVersion, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal HyperVReplicaAzureReplicationDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InitialReplicationDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).InitialReplicationDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInitialReplicationDetails) content.GetValueForProperty("InitialReplicationDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).InitialReplicationDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InitialReplicationDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("OSDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).OSDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDetails) content.GetValueForProperty("OSDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).OSDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.OSDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("AzureVMDiskDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).AzureVMDiskDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureVMDiskDetails[]) content.GetValueForProperty("AzureVMDiskDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).AzureVMDiskDetail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AzureVMDiskDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("RecoveryAzureVMName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).RecoveryAzureVMName = (string) content.GetValueForProperty("RecoveryAzureVMName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).RecoveryAzureVMName, global::System.Convert.ToString); + } + if (content.Contains("RecoveryAzureVMSize")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).RecoveryAzureVMSize = (string) content.GetValueForProperty("RecoveryAzureVMSize",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).RecoveryAzureVMSize, global::System.Convert.ToString); + } + if (content.Contains("RecoveryAzureStorageAccount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).RecoveryAzureStorageAccount = (string) content.GetValueForProperty("RecoveryAzureStorageAccount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).RecoveryAzureStorageAccount, global::System.Convert.ToString); + } + if (content.Contains("RecoveryAzureLogStorageAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).RecoveryAzureLogStorageAccountId = (string) content.GetValueForProperty("RecoveryAzureLogStorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).RecoveryAzureLogStorageAccountId, global::System.Convert.ToString); + } + if (content.Contains("LastReplicatedTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).LastReplicatedTime = (global::System.DateTime?) content.GetValueForProperty("LastReplicatedTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).LastReplicatedTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("RpoInSecond")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).RpoInSecond = (long?) content.GetValueForProperty("RpoInSecond",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).RpoInSecond, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("LastRpoCalculatedTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).LastRpoCalculatedTime = (global::System.DateTime?) content.GetValueForProperty("LastRpoCalculatedTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).LastRpoCalculatedTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("VMId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).VMId = (string) content.GetValueForProperty("VMId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).VMId, global::System.Convert.ToString); + } + if (content.Contains("VMProtectionState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).VMProtectionState = (string) content.GetValueForProperty("VMProtectionState",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).VMProtectionState, global::System.Convert.ToString); + } + if (content.Contains("VMProtectionStateDescription")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).VMProtectionStateDescription = (string) content.GetValueForProperty("VMProtectionStateDescription",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).VMProtectionStateDescription, global::System.Convert.ToString); + } + if (content.Contains("VMNic")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).VMNic = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetails[]) content.GetValueForProperty("VMNic",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).VMNic, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMNicDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("SelectedRecoveryAzureNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).SelectedRecoveryAzureNetworkId = (string) content.GetValueForProperty("SelectedRecoveryAzureNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).SelectedRecoveryAzureNetworkId, global::System.Convert.ToString); + } + if (content.Contains("SelectedSourceNicId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).SelectedSourceNicId = (string) content.GetValueForProperty("SelectedSourceNicId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).SelectedSourceNicId, global::System.Convert.ToString); + } + if (content.Contains("Encryption")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).Encryption = (string) content.GetValueForProperty("Encryption",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).Encryption, global::System.Convert.ToString); + } + if (content.Contains("SourceVMRamSizeInMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).SourceVMRamSizeInMb = (int?) content.GetValueForProperty("SourceVMRamSizeInMb",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).SourceVMRamSizeInMb, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("SourceVMCpuCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).SourceVMCpuCount = (int?) content.GetValueForProperty("SourceVMCpuCount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).SourceVMCpuCount, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("EnableRdpOnTargetOption")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).EnableRdpOnTargetOption = (string) content.GetValueForProperty("EnableRdpOnTargetOption",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).EnableRdpOnTargetOption, global::System.Convert.ToString); + } + if (content.Contains("RecoveryAzureResourceGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).RecoveryAzureResourceGroupId = (string) content.GetValueForProperty("RecoveryAzureResourceGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).RecoveryAzureResourceGroupId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryAvailabilitySetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).RecoveryAvailabilitySetId = (string) content.GetValueForProperty("RecoveryAvailabilitySetId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).RecoveryAvailabilitySetId, global::System.Convert.ToString); + } + if (content.Contains("TargetAvailabilityZone")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).TargetAvailabilityZone = (string) content.GetValueForProperty("TargetAvailabilityZone",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).TargetAvailabilityZone, global::System.Convert.ToString); + } + if (content.Contains("TargetProximityPlacementGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).TargetProximityPlacementGroupId = (string) content.GetValueForProperty("TargetProximityPlacementGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).TargetProximityPlacementGroupId, global::System.Convert.ToString); + } + if (content.Contains("UseManagedDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).UseManagedDisk = (string) content.GetValueForProperty("UseManagedDisk",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).UseManagedDisk, global::System.Convert.ToString); + } + if (content.Contains("LicenseType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).LicenseType = (string) content.GetValueForProperty("LicenseType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).LicenseType, global::System.Convert.ToString); + } + if (content.Contains("SqlServerLicenseType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).SqlServerLicenseType = (string) content.GetValueForProperty("SqlServerLicenseType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).SqlServerLicenseType, global::System.Convert.ToString); + } + if (content.Contains("LastRecoveryPointReceived")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).LastRecoveryPointReceived = (global::System.DateTime?) content.GetValueForProperty("LastRecoveryPointReceived",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).LastRecoveryPointReceived, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("TargetVMTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).TargetVMTag = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsTargetVmtags) content.GetValueForProperty("TargetVMTag",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).TargetVMTag, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureReplicationDetailsTargetVmtagsTypeConverter.ConvertFrom); + } + if (content.Contains("SeedManagedDiskTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).SeedManagedDiskTag = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsSeedManagedDiskTags) content.GetValueForProperty("SeedManagedDiskTag",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).SeedManagedDiskTag, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureReplicationDetailsSeedManagedDiskTagsTypeConverter.ConvertFrom); + } + if (content.Contains("TargetManagedDiskTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).TargetManagedDiskTag = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsTargetManagedDiskTags) content.GetValueForProperty("TargetManagedDiskTag",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).TargetManagedDiskTag, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureReplicationDetailsTargetManagedDiskTagsTypeConverter.ConvertFrom); + } + if (content.Contains("TargetNicTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).TargetNicTag = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsTargetNicTags) content.GetValueForProperty("TargetNicTag",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).TargetNicTag, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureReplicationDetailsTargetNicTagsTypeConverter.ConvertFrom); + } + if (content.Contains("ProtectedManagedDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).ProtectedManagedDisk = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureManagedDiskDetails[]) content.GetValueForProperty("ProtectedManagedDisk",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).ProtectedManagedDisk, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureManagedDiskDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettingsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettingsInternal)this).InstanceType, global::System.Convert.ToString); + } + if (content.Contains("OSDetailOstype")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).OSDetailOstype = (string) content.GetValueForProperty("OSDetailOstype",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).OSDetailOstype, global::System.Convert.ToString); + } + if (content.Contains("OSDetailProductType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).OSDetailProductType = (string) content.GetValueForProperty("OSDetailProductType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).OSDetailProductType, global::System.Convert.ToString); + } + if (content.Contains("OSDetailOsedition")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).OSDetailOsedition = (string) content.GetValueForProperty("OSDetailOsedition",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).OSDetailOsedition, global::System.Convert.ToString); + } + if (content.Contains("InitialReplicationDetailInitialReplicationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).InitialReplicationDetailInitialReplicationType = (string) content.GetValueForProperty("InitialReplicationDetailInitialReplicationType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).InitialReplicationDetailInitialReplicationType, global::System.Convert.ToString); + } + if (content.Contains("InitialReplicationDetailInitialReplicationProgressPercentage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).InitialReplicationDetailInitialReplicationProgressPercentage = (string) content.GetValueForProperty("InitialReplicationDetailInitialReplicationProgressPercentage",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).InitialReplicationDetailInitialReplicationProgressPercentage, global::System.Convert.ToString); + } + if (content.Contains("OSDetailOsversion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).OSDetailOsversion = (string) content.GetValueForProperty("OSDetailOsversion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).OSDetailOsversion, global::System.Convert.ToString); + } + if (content.Contains("OSDetailOsmajorVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).OSDetailOsmajorVersion = (string) content.GetValueForProperty("OSDetailOsmajorVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).OSDetailOsmajorVersion, global::System.Convert.ToString); + } + if (content.Contains("OSDetailOsminorVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).OSDetailOsminorVersion = (string) content.GetValueForProperty("OSDetailOsminorVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal)this).OSDetailOsminorVersion, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Hyper V Replica Azure provider specific settings. + [System.ComponentModel.TypeConverter(typeof(HyperVReplicaAzureReplicationDetailsTypeConverter))] + public partial interface IHyperVReplicaAzureReplicationDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureReplicationDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureReplicationDetails.TypeConverter.cs new file mode 100644 index 000000000000..ba02d1965f98 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureReplicationDetails.TypeConverter.cs @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class HyperVReplicaAzureReplicationDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return HyperVReplicaAzureReplicationDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return HyperVReplicaAzureReplicationDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return HyperVReplicaAzureReplicationDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureReplicationDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureReplicationDetails.cs new file mode 100644 index 000000000000..44bdc2d014a8 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureReplicationDetails.cs @@ -0,0 +1,747 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Hyper V Replica Azure provider specific settings. + public partial class HyperVReplicaAzureReplicationDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettings __replicationProviderSpecificSettings = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProviderSpecificSettings(); + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureVMDiskDetails[] _azureVMDiskDetail; + + /// Azure VM Disk details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureVMDiskDetails[] AzureVMDiskDetail { get => this._azureVMDiskDetail; set => this._azureVMDiskDetail = value; } + + /// Backing field for property. + private string _enableRdpOnTargetOption; + + /// + /// The selected option to enable RDP\SSH on target vm after failover. String value of SrsDataContract.EnableRDPOnTargetOption + /// enum. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string EnableRdpOnTargetOption { get => this._enableRdpOnTargetOption; set => this._enableRdpOnTargetOption = value; } + + /// Backing field for property. + private string _encryption; + + /// The encryption info. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Encryption { get => this._encryption; set => this._encryption = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInitialReplicationDetails _initialReplicationDetail; + + /// Initial replication details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInitialReplicationDetails InitialReplicationDetail { get => (this._initialReplicationDetail = this._initialReplicationDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InitialReplicationDetails()); set => this._initialReplicationDetail = value; } + + /// The initial replication progress percentage. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string InitialReplicationDetailInitialReplicationProgressPercentage { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInitialReplicationDetailsInternal)InitialReplicationDetail).InitialReplicationProgressPercentage; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInitialReplicationDetailsInternal)InitialReplicationDetail).InitialReplicationProgressPercentage = value ?? null; } + + /// Initial replication type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string InitialReplicationDetailInitialReplicationType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInitialReplicationDetailsInternal)InitialReplicationDetail).InitialReplicationType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInitialReplicationDetailsInternal)InitialReplicationDetail).InitialReplicationType = value ?? null; } + + /// Gets the Instance type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettingsInternal)__replicationProviderSpecificSettings).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettingsInternal)__replicationProviderSpecificSettings).InstanceType = value ; } + + /// Backing field for property. + private global::System.DateTime? _lastRecoveryPointReceived; + + /// The last recovery point received time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public global::System.DateTime? LastRecoveryPointReceived { get => this._lastRecoveryPointReceived; } + + /// Backing field for property. + private global::System.DateTime? _lastReplicatedTime; + + /// The Last replication time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public global::System.DateTime? LastReplicatedTime { get => this._lastReplicatedTime; set => this._lastReplicatedTime = value; } + + /// Backing field for property. + private global::System.DateTime? _lastRpoCalculatedTime; + + /// The last RPO calculated time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public global::System.DateTime? LastRpoCalculatedTime { get => this._lastRpoCalculatedTime; set => this._lastRpoCalculatedTime = value; } + + /// Backing field for property. + private string _licenseType; + + /// License Type of the VM to be used. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string LicenseType { get => this._licenseType; set => this._licenseType = value; } + + /// Internal Acessors for InitialReplicationDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInitialReplicationDetails Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal.InitialReplicationDetail { get => (this._initialReplicationDetail = this._initialReplicationDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InitialReplicationDetails()); set { {_initialReplicationDetail = value;} } } + + /// Internal Acessors for LastRecoveryPointReceived + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal.LastRecoveryPointReceived { get => this._lastRecoveryPointReceived; set { {_lastRecoveryPointReceived = value;} } } + + /// Internal Acessors for OSDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDetails Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsInternal.OSDetail { get => (this._oSDetail = this._oSDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.OSDetails()); set { {_oSDetail = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDetails _oSDetail; + + /// The operating system info. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDetails OSDetail { get => (this._oSDetail = this._oSDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.OSDetails()); set => this._oSDetail = value; } + + /// The OSEdition. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string OSDetailOsedition { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDetailsInternal)OSDetail).OSEdition; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDetailsInternal)OSDetail).OSEdition = value ?? null; } + + /// The OS Major Version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string OSDetailOsmajorVersion { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDetailsInternal)OSDetail).OSMajorVersion; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDetailsInternal)OSDetail).OSMajorVersion = value ?? null; } + + /// The OS Minor Version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string OSDetailOsminorVersion { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDetailsInternal)OSDetail).OSMinorVersion; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDetailsInternal)OSDetail).OSMinorVersion = value ?? null; } + + /// VM Disk details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string OSDetailOstype { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDetailsInternal)OSDetail).OSType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDetailsInternal)OSDetail).OSType = value ?? null; } + + /// The OS Version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string OSDetailOsversion { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDetailsInternal)OSDetail).OSVersion; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDetailsInternal)OSDetail).OSVersion = value ?? null; } + + /// Product type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string OSDetailProductType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDetailsInternal)OSDetail).ProductType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDetailsInternal)OSDetail).ProductType = value ?? null; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureManagedDiskDetails[] _protectedManagedDisk; + + /// The list of protected managed disks. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureManagedDiskDetails[] ProtectedManagedDisk { get => this._protectedManagedDisk; set => this._protectedManagedDisk = value; } + + /// Backing field for property. + private string _recoveryAvailabilitySetId; + + /// The recovery availability set Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryAvailabilitySetId { get => this._recoveryAvailabilitySetId; set => this._recoveryAvailabilitySetId = value; } + + /// Backing field for property. + private string _recoveryAzureLogStorageAccountId; + + /// + /// 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. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryAzureLogStorageAccountId { get => this._recoveryAzureLogStorageAccountId; set => this._recoveryAzureLogStorageAccountId = value; } + + /// Backing field for property. + private string _recoveryAzureResourceGroupId; + + /// The target resource group Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryAzureResourceGroupId { get => this._recoveryAzureResourceGroupId; set => this._recoveryAzureResourceGroupId = value; } + + /// Backing field for property. + private string _recoveryAzureStorageAccount; + + /// The recovery Azure storage account. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryAzureStorageAccount { get => this._recoveryAzureStorageAccount; set => this._recoveryAzureStorageAccount = value; } + + /// Backing field for property. + private string _recoveryAzureVMName; + + /// Recovery Azure given name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryAzureVMName { get => this._recoveryAzureVMName; set => this._recoveryAzureVMName = value; } + + /// Backing field for property. + private string _recoveryAzureVMSize; + + /// The Recovery Azure VM size. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryAzureVMSize { get => this._recoveryAzureVMSize; set => this._recoveryAzureVMSize = value; } + + /// Backing field for property. + private long? _rpoInSecond; + + /// Last RPO value. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public long? RpoInSecond { get => this._rpoInSecond; set => this._rpoInSecond = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsSeedManagedDiskTags _seedManagedDiskTag; + + /// The tags for the seed managed disks. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsSeedManagedDiskTags SeedManagedDiskTag { get => (this._seedManagedDiskTag = this._seedManagedDiskTag ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureReplicationDetailsSeedManagedDiskTags()); set => this._seedManagedDiskTag = value; } + + /// Backing field for property. + private string _selectedRecoveryAzureNetworkId; + + /// The selected recovery azure network Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string SelectedRecoveryAzureNetworkId { get => this._selectedRecoveryAzureNetworkId; set => this._selectedRecoveryAzureNetworkId = value; } + + /// Backing field for property. + private string _selectedSourceNicId; + + /// + /// The selected source nic Id which will be used as the primary nic during failover. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string SelectedSourceNicId { get => this._selectedSourceNicId; set => this._selectedSourceNicId = value; } + + /// Backing field for property. + private int? _sourceVMCpuCount; + + /// The CPU count of the VM on the primary side. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? SourceVMCpuCount { get => this._sourceVMCpuCount; set => this._sourceVMCpuCount = value; } + + /// Backing field for property. + private int? _sourceVMRamSizeInMb; + + /// The RAM size of the VM on the primary side. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? SourceVMRamSizeInMb { get => this._sourceVMRamSizeInMb; set => this._sourceVMRamSizeInMb = value; } + + /// Backing field for property. + private string _sqlServerLicenseType; + + /// The SQL Server license type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string SqlServerLicenseType { get => this._sqlServerLicenseType; set => this._sqlServerLicenseType = value; } + + /// Backing field for property. + private string _targetAvailabilityZone; + + /// The target availability zone. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetAvailabilityZone { get => this._targetAvailabilityZone; set => this._targetAvailabilityZone = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsTargetManagedDiskTags _targetManagedDiskTag; + + /// The tags for the target managed disks. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsTargetManagedDiskTags TargetManagedDiskTag { get => (this._targetManagedDiskTag = this._targetManagedDiskTag ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureReplicationDetailsTargetManagedDiskTags()); set => this._targetManagedDiskTag = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsTargetNicTags _targetNicTag; + + /// The tags for the target NICs. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsTargetNicTags TargetNicTag { get => (this._targetNicTag = this._targetNicTag ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureReplicationDetailsTargetNicTags()); set => this._targetNicTag = value; } + + /// Backing field for property. + private string _targetProximityPlacementGroupId; + + /// The target proximity placement group Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetProximityPlacementGroupId { get => this._targetProximityPlacementGroupId; set => this._targetProximityPlacementGroupId = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsTargetVmtags _targetVMTag; + + /// The target VM tags. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsTargetVmtags TargetVMTag { get => (this._targetVMTag = this._targetVMTag ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureReplicationDetailsTargetVmtags()); set => this._targetVMTag = value; } + + /// Backing field for property. + private string _useManagedDisk; + + /// A value indicating whether managed disks should be used during failover. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string UseManagedDisk { get => this._useManagedDisk; set => this._useManagedDisk = value; } + + /// Backing field for property. + private string _vMId; + + /// The virtual machine Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string VMId { get => this._vMId; set => this._vMId = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetails[] _vMNic; + + /// The PE Network details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetails[] VMNic { get => this._vMNic; set => this._vMNic = value; } + + /// Backing field for property. + private string _vMProtectionState; + + /// The protection state for the vm. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string VMProtectionState { get => this._vMProtectionState; set => this._vMProtectionState = value; } + + /// Backing field for property. + private string _vMProtectionStateDescription; + + /// The protection state description for the vm. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string VMProtectionStateDescription { get => this._vMProtectionStateDescription; set => this._vMProtectionStateDescription = value; } + + /// Creates an new instance. + public HyperVReplicaAzureReplicationDetails() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__replicationProviderSpecificSettings), __replicationProviderSpecificSettings); + await eventListener.AssertObjectIsValid(nameof(__replicationProviderSpecificSettings), __replicationProviderSpecificSettings); + } + } + /// Hyper V Replica Azure provider specific settings. + public partial interface IHyperVReplicaAzureReplicationDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettings + { + /// Azure VM Disk details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Azure VM Disk details.", + SerializedName = @"azureVmDiskDetails", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureVMDiskDetails) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureVMDiskDetails[] AzureVMDiskDetail { get; set; } + /// + /// The selected option to enable RDP\SSH on target vm after failover. String value of SrsDataContract.EnableRDPOnTargetOption + /// enum. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The selected option to enable RDP\SSH on target vm after failover. String value of SrsDataContract.EnableRDPOnTargetOption enum.", + SerializedName = @"enableRdpOnTargetOption", + PossibleTypes = new [] { typeof(string) })] + string EnableRdpOnTargetOption { get; set; } + /// The encryption info. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The encryption info.", + SerializedName = @"encryption", + PossibleTypes = new [] { typeof(string) })] + string Encryption { get; set; } + /// The initial replication progress percentage. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The initial replication progress percentage.", + SerializedName = @"initialReplicationProgressPercentage", + PossibleTypes = new [] { typeof(string) })] + string InitialReplicationDetailInitialReplicationProgressPercentage { get; set; } + /// Initial replication type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Initial replication type.", + SerializedName = @"initialReplicationType", + PossibleTypes = new [] { typeof(string) })] + string InitialReplicationDetailInitialReplicationType { get; set; } + /// The last recovery point received time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The last recovery point received time.", + SerializedName = @"lastRecoveryPointReceived", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? LastRecoveryPointReceived { get; } + /// The Last replication time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Last replication time.", + SerializedName = @"lastReplicatedTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? LastReplicatedTime { get; set; } + /// The last RPO calculated time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The last RPO calculated time.", + SerializedName = @"lastRpoCalculatedTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? LastRpoCalculatedTime { get; set; } + /// License Type of the VM to be used. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"License Type of the VM to be used.", + SerializedName = @"licenseType", + PossibleTypes = new [] { typeof(string) })] + string LicenseType { get; set; } + /// The OSEdition. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The OSEdition.", + SerializedName = @"osEdition", + PossibleTypes = new [] { typeof(string) })] + string OSDetailOsedition { get; set; } + /// The OS Major Version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The OS Major Version.", + SerializedName = @"oSMajorVersion", + PossibleTypes = new [] { typeof(string) })] + string OSDetailOsmajorVersion { get; set; } + /// The OS Minor Version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The OS Minor Version.", + SerializedName = @"oSMinorVersion", + PossibleTypes = new [] { typeof(string) })] + string OSDetailOsminorVersion { get; set; } + /// VM Disk details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"VM Disk details.", + SerializedName = @"osType", + PossibleTypes = new [] { typeof(string) })] + string OSDetailOstype { get; set; } + /// The OS Version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The OS Version.", + SerializedName = @"oSVersion", + PossibleTypes = new [] { typeof(string) })] + string OSDetailOsversion { get; set; } + /// Product type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Product type.", + SerializedName = @"productType", + PossibleTypes = new [] { typeof(string) })] + string OSDetailProductType { get; set; } + /// The list of protected managed disks. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of protected managed disks.", + SerializedName = @"protectedManagedDisks", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureManagedDiskDetails) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureManagedDiskDetails[] ProtectedManagedDisk { get; set; } + /// The recovery availability set Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery availability set Id.", + SerializedName = @"recoveryAvailabilitySetId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryAvailabilitySetId { get; set; } + /// + /// 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. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"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.", + SerializedName = @"recoveryAzureLogStorageAccountId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryAzureLogStorageAccountId { get; set; } + /// The target resource group Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target resource group Id.", + SerializedName = @"recoveryAzureResourceGroupId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryAzureResourceGroupId { get; set; } + /// The recovery Azure storage account. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery Azure storage account.", + SerializedName = @"recoveryAzureStorageAccount", + PossibleTypes = new [] { typeof(string) })] + string RecoveryAzureStorageAccount { get; set; } + /// Recovery Azure given name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Recovery Azure given name.", + SerializedName = @"recoveryAzureVmName", + PossibleTypes = new [] { typeof(string) })] + string RecoveryAzureVMName { get; set; } + /// The Recovery Azure VM size. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Recovery Azure VM size.", + SerializedName = @"recoveryAzureVMSize", + PossibleTypes = new [] { typeof(string) })] + string RecoveryAzureVMSize { get; set; } + /// Last RPO value. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Last RPO value.", + SerializedName = @"rpoInSeconds", + PossibleTypes = new [] { typeof(long) })] + long? RpoInSecond { get; set; } + /// The tags for the seed managed disks. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The tags for the seed managed disks.", + SerializedName = @"seedManagedDiskTags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsSeedManagedDiskTags) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsSeedManagedDiskTags SeedManagedDiskTag { get; set; } + /// The selected recovery azure network Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The selected recovery azure network Id.", + SerializedName = @"selectedRecoveryAzureNetworkId", + PossibleTypes = new [] { typeof(string) })] + string SelectedRecoveryAzureNetworkId { get; set; } + /// + /// The selected source nic Id which will be used as the primary nic during failover. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The selected source nic Id which will be used as the primary nic during failover.", + SerializedName = @"selectedSourceNicId", + PossibleTypes = new [] { typeof(string) })] + string SelectedSourceNicId { get; set; } + /// The CPU count of the VM on the primary side. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The CPU count of the VM on the primary side.", + SerializedName = @"sourceVmCpuCount", + PossibleTypes = new [] { typeof(int) })] + int? SourceVMCpuCount { get; set; } + /// The RAM size of the VM on the primary side. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The RAM size of the VM on the primary side.", + SerializedName = @"sourceVmRamSizeInMB", + PossibleTypes = new [] { typeof(int) })] + int? SourceVMRamSizeInMb { get; set; } + /// The SQL Server license type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The SQL Server license type.", + SerializedName = @"sqlServerLicenseType", + PossibleTypes = new [] { typeof(string) })] + string SqlServerLicenseType { get; set; } + /// The target availability zone. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target availability zone.", + SerializedName = @"targetAvailabilityZone", + PossibleTypes = new [] { typeof(string) })] + string TargetAvailabilityZone { get; set; } + /// The tags for the target managed disks. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The tags for the target managed disks.", + SerializedName = @"targetManagedDiskTags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsTargetManagedDiskTags) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsTargetManagedDiskTags TargetManagedDiskTag { get; set; } + /// The tags for the target NICs. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The tags for the target NICs.", + SerializedName = @"targetNicTags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsTargetNicTags) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsTargetNicTags TargetNicTag { get; set; } + /// The target proximity placement group Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target proximity placement group Id.", + SerializedName = @"targetProximityPlacementGroupId", + PossibleTypes = new [] { typeof(string) })] + string TargetProximityPlacementGroupId { get; set; } + /// The target VM tags. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target VM tags.", + SerializedName = @"targetVmTags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsTargetVmtags) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsTargetVmtags TargetVMTag { get; set; } + /// A value indicating whether managed disks should be used during failover. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether managed disks should be used during failover.", + SerializedName = @"useManagedDisks", + PossibleTypes = new [] { typeof(string) })] + string UseManagedDisk { get; set; } + /// The virtual machine Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The virtual machine Id.", + SerializedName = @"vmId", + PossibleTypes = new [] { typeof(string) })] + string VMId { get; set; } + /// The PE Network details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The PE Network details.", + SerializedName = @"vmNics", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetails) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetails[] VMNic { get; set; } + /// The protection state for the vm. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The protection state for the vm.", + SerializedName = @"vmProtectionState", + PossibleTypes = new [] { typeof(string) })] + string VMProtectionState { get; set; } + /// The protection state description for the vm. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The protection state description for the vm.", + SerializedName = @"vmProtectionStateDescription", + PossibleTypes = new [] { typeof(string) })] + string VMProtectionStateDescription { get; set; } + + } + /// Hyper V Replica Azure provider specific settings. + internal partial interface IHyperVReplicaAzureReplicationDetailsInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettingsInternal + { + /// Azure VM Disk details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureVMDiskDetails[] AzureVMDiskDetail { get; set; } + /// + /// The selected option to enable RDP\SSH on target vm after failover. String value of SrsDataContract.EnableRDPOnTargetOption + /// enum. + /// + string EnableRdpOnTargetOption { get; set; } + /// The encryption info. + string Encryption { get; set; } + /// Initial replication details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInitialReplicationDetails InitialReplicationDetail { get; set; } + /// The initial replication progress percentage. + string InitialReplicationDetailInitialReplicationProgressPercentage { get; set; } + /// Initial replication type. + string InitialReplicationDetailInitialReplicationType { get; set; } + /// The last recovery point received time. + global::System.DateTime? LastRecoveryPointReceived { get; set; } + /// The Last replication time. + global::System.DateTime? LastReplicatedTime { get; set; } + /// The last RPO calculated time. + global::System.DateTime? LastRpoCalculatedTime { get; set; } + /// License Type of the VM to be used. + string LicenseType { get; set; } + /// The operating system info. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDetails OSDetail { get; set; } + /// The OSEdition. + string OSDetailOsedition { get; set; } + /// The OS Major Version. + string OSDetailOsmajorVersion { get; set; } + /// The OS Minor Version. + string OSDetailOsminorVersion { get; set; } + /// VM Disk details. + string OSDetailOstype { get; set; } + /// The OS Version. + string OSDetailOsversion { get; set; } + /// Product type. + string OSDetailProductType { get; set; } + /// The list of protected managed disks. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureManagedDiskDetails[] ProtectedManagedDisk { get; set; } + /// The recovery availability set Id. + string RecoveryAvailabilitySetId { get; set; } + /// + /// 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. + /// + string RecoveryAzureLogStorageAccountId { get; set; } + /// The target resource group Id. + string RecoveryAzureResourceGroupId { get; set; } + /// The recovery Azure storage account. + string RecoveryAzureStorageAccount { get; set; } + /// Recovery Azure given name. + string RecoveryAzureVMName { get; set; } + /// The Recovery Azure VM size. + string RecoveryAzureVMSize { get; set; } + /// Last RPO value. + long? RpoInSecond { get; set; } + /// The tags for the seed managed disks. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsSeedManagedDiskTags SeedManagedDiskTag { get; set; } + /// The selected recovery azure network Id. + string SelectedRecoveryAzureNetworkId { get; set; } + /// + /// The selected source nic Id which will be used as the primary nic during failover. + /// + string SelectedSourceNicId { get; set; } + /// The CPU count of the VM on the primary side. + int? SourceVMCpuCount { get; set; } + /// The RAM size of the VM on the primary side. + int? SourceVMRamSizeInMb { get; set; } + /// The SQL Server license type. + string SqlServerLicenseType { get; set; } + /// The target availability zone. + string TargetAvailabilityZone { get; set; } + /// The tags for the target managed disks. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsTargetManagedDiskTags TargetManagedDiskTag { get; set; } + /// The tags for the target NICs. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsTargetNicTags TargetNicTag { get; set; } + /// The target proximity placement group Id. + string TargetProximityPlacementGroupId { get; set; } + /// The target VM tags. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsTargetVmtags TargetVMTag { get; set; } + /// A value indicating whether managed disks should be used during failover. + string UseManagedDisk { get; set; } + /// The virtual machine Id. + string VMId { get; set; } + /// The PE Network details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetails[] VMNic { get; set; } + /// The protection state for the vm. + string VMProtectionState { get; set; } + /// The protection state description for the vm. + string VMProtectionStateDescription { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureReplicationDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureReplicationDetails.json.cs new file mode 100644 index 000000000000..7e7b9e8adf8e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureReplicationDetails.json.cs @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Hyper V Replica Azure provider specific settings. + public partial class HyperVReplicaAzureReplicationDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new HyperVReplicaAzureReplicationDetails(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal HyperVReplicaAzureReplicationDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __replicationProviderSpecificSettings = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProviderSpecificSettings(json); + {_initialReplicationDetail = If( json?.PropertyT("initialReplicationDetails"), out var __jsonInitialReplicationDetails) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InitialReplicationDetails.FromJson(__jsonInitialReplicationDetails) : InitialReplicationDetail;} + {_oSDetail = If( json?.PropertyT("oSDetails"), out var __jsonOSDetails) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.OSDetails.FromJson(__jsonOSDetails) : OSDetail;} + {_azureVMDiskDetail = If( json?.PropertyT("azureVmDiskDetails"), out var __jsonAzureVMDiskDetails) ? If( __jsonAzureVMDiskDetails as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureVMDiskDetails) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AzureVMDiskDetails.FromJson(__u) )) ))() : null : AzureVMDiskDetail;} + {_recoveryAzureVMName = If( json?.PropertyT("recoveryAzureVmName"), out var __jsonRecoveryAzureVMName) ? (string)__jsonRecoveryAzureVMName : (string)RecoveryAzureVMName;} + {_recoveryAzureVMSize = If( json?.PropertyT("recoveryAzureVMSize"), out var __jsonRecoveryAzureVMSize) ? (string)__jsonRecoveryAzureVMSize : (string)RecoveryAzureVMSize;} + {_recoveryAzureStorageAccount = If( json?.PropertyT("recoveryAzureStorageAccount"), out var __jsonRecoveryAzureStorageAccount) ? (string)__jsonRecoveryAzureStorageAccount : (string)RecoveryAzureStorageAccount;} + {_recoveryAzureLogStorageAccountId = If( json?.PropertyT("recoveryAzureLogStorageAccountId"), out var __jsonRecoveryAzureLogStorageAccountId) ? (string)__jsonRecoveryAzureLogStorageAccountId : (string)RecoveryAzureLogStorageAccountId;} + {_lastReplicatedTime = If( json?.PropertyT("lastReplicatedTime"), out var __jsonLastReplicatedTime) ? global::System.DateTime.TryParse((string)__jsonLastReplicatedTime, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonLastReplicatedTimeValue) ? __jsonLastReplicatedTimeValue : LastReplicatedTime : LastReplicatedTime;} + {_rpoInSecond = If( json?.PropertyT("rpoInSeconds"), out var __jsonRpoInSeconds) ? (long?)__jsonRpoInSeconds : RpoInSecond;} + {_lastRpoCalculatedTime = If( json?.PropertyT("lastRpoCalculatedTime"), out var __jsonLastRpoCalculatedTime) ? global::System.DateTime.TryParse((string)__jsonLastRpoCalculatedTime, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonLastRpoCalculatedTimeValue) ? __jsonLastRpoCalculatedTimeValue : LastRpoCalculatedTime : LastRpoCalculatedTime;} + {_vMId = If( json?.PropertyT("vmId"), out var __jsonVMId) ? (string)__jsonVMId : (string)VMId;} + {_vMProtectionState = If( json?.PropertyT("vmProtectionState"), out var __jsonVMProtectionState) ? (string)__jsonVMProtectionState : (string)VMProtectionState;} + {_vMProtectionStateDescription = If( json?.PropertyT("vmProtectionStateDescription"), out var __jsonVMProtectionStateDescription) ? (string)__jsonVMProtectionStateDescription : (string)VMProtectionStateDescription;} + {_vMNic = If( json?.PropertyT("vmNics"), out var __jsonVMNics) ? If( __jsonVMNics as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __q) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__q, (__p)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetails) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMNicDetails.FromJson(__p) )) ))() : null : VMNic;} + {_selectedRecoveryAzureNetworkId = If( json?.PropertyT("selectedRecoveryAzureNetworkId"), out var __jsonSelectedRecoveryAzureNetworkId) ? (string)__jsonSelectedRecoveryAzureNetworkId : (string)SelectedRecoveryAzureNetworkId;} + {_selectedSourceNicId = If( json?.PropertyT("selectedSourceNicId"), out var __jsonSelectedSourceNicId) ? (string)__jsonSelectedSourceNicId : (string)SelectedSourceNicId;} + {_encryption = If( json?.PropertyT("encryption"), out var __jsonEncryption) ? (string)__jsonEncryption : (string)Encryption;} + {_sourceVMRamSizeInMb = If( json?.PropertyT("sourceVmRamSizeInMB"), out var __jsonSourceVMRamSizeInMb) ? (int?)__jsonSourceVMRamSizeInMb : SourceVMRamSizeInMb;} + {_sourceVMCpuCount = If( json?.PropertyT("sourceVmCpuCount"), out var __jsonSourceVMCpuCount) ? (int?)__jsonSourceVMCpuCount : SourceVMCpuCount;} + {_enableRdpOnTargetOption = If( json?.PropertyT("enableRdpOnTargetOption"), out var __jsonEnableRdpOnTargetOption) ? (string)__jsonEnableRdpOnTargetOption : (string)EnableRdpOnTargetOption;} + {_recoveryAzureResourceGroupId = If( json?.PropertyT("recoveryAzureResourceGroupId"), out var __jsonRecoveryAzureResourceGroupId) ? (string)__jsonRecoveryAzureResourceGroupId : (string)RecoveryAzureResourceGroupId;} + {_recoveryAvailabilitySetId = If( json?.PropertyT("recoveryAvailabilitySetId"), out var __jsonRecoveryAvailabilitySetId) ? (string)__jsonRecoveryAvailabilitySetId : (string)RecoveryAvailabilitySetId;} + {_targetAvailabilityZone = If( json?.PropertyT("targetAvailabilityZone"), out var __jsonTargetAvailabilityZone) ? (string)__jsonTargetAvailabilityZone : (string)TargetAvailabilityZone;} + {_targetProximityPlacementGroupId = If( json?.PropertyT("targetProximityPlacementGroupId"), out var __jsonTargetProximityPlacementGroupId) ? (string)__jsonTargetProximityPlacementGroupId : (string)TargetProximityPlacementGroupId;} + {_useManagedDisk = If( json?.PropertyT("useManagedDisks"), out var __jsonUseManagedDisks) ? (string)__jsonUseManagedDisks : (string)UseManagedDisk;} + {_licenseType = If( json?.PropertyT("licenseType"), out var __jsonLicenseType) ? (string)__jsonLicenseType : (string)LicenseType;} + {_sqlServerLicenseType = If( json?.PropertyT("sqlServerLicenseType"), out var __jsonSqlServerLicenseType) ? (string)__jsonSqlServerLicenseType : (string)SqlServerLicenseType;} + {_lastRecoveryPointReceived = If( json?.PropertyT("lastRecoveryPointReceived"), out var __jsonLastRecoveryPointReceived) ? global::System.DateTime.TryParse((string)__jsonLastRecoveryPointReceived, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonLastRecoveryPointReceivedValue) ? __jsonLastRecoveryPointReceivedValue : LastRecoveryPointReceived : LastRecoveryPointReceived;} + {_targetVMTag = If( json?.PropertyT("targetVmTags"), out var __jsonTargetVMTags) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureReplicationDetailsTargetVmtags.FromJson(__jsonTargetVMTags) : TargetVMTag;} + {_seedManagedDiskTag = If( json?.PropertyT("seedManagedDiskTags"), out var __jsonSeedManagedDiskTags) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureReplicationDetailsSeedManagedDiskTags.FromJson(__jsonSeedManagedDiskTags) : SeedManagedDiskTag;} + {_targetManagedDiskTag = If( json?.PropertyT("targetManagedDiskTags"), out var __jsonTargetManagedDiskTags) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureReplicationDetailsTargetManagedDiskTags.FromJson(__jsonTargetManagedDiskTags) : TargetManagedDiskTag;} + {_targetNicTag = If( json?.PropertyT("targetNicTags"), out var __jsonTargetNicTags) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureReplicationDetailsTargetNicTags.FromJson(__jsonTargetNicTags) : TargetNicTag;} + {_protectedManagedDisk = If( json?.PropertyT("protectedManagedDisks"), out var __jsonProtectedManagedDisks) ? If( __jsonProtectedManagedDisks as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __l) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__l, (__k)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureManagedDiskDetails) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureManagedDiskDetails.FromJson(__k) )) ))() : null : ProtectedManagedDisk;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __replicationProviderSpecificSettings?.ToJson(container, serializationMode); + AddIf( null != this._initialReplicationDetail ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._initialReplicationDetail.ToJson(null,serializationMode) : null, "initialReplicationDetails" ,container.Add ); + AddIf( null != this._oSDetail ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._oSDetail.ToJson(null,serializationMode) : null, "oSDetails" ,container.Add ); + if (null != this._azureVMDiskDetail) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._azureVMDiskDetail ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("azureVmDiskDetails",__w); + } + AddIf( null != (((object)this._recoveryAzureVMName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryAzureVMName.ToString()) : null, "recoveryAzureVmName" ,container.Add ); + AddIf( null != (((object)this._recoveryAzureVMSize)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryAzureVMSize.ToString()) : null, "recoveryAzureVMSize" ,container.Add ); + AddIf( null != (((object)this._recoveryAzureStorageAccount)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryAzureStorageAccount.ToString()) : null, "recoveryAzureStorageAccount" ,container.Add ); + AddIf( null != (((object)this._recoveryAzureLogStorageAccountId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryAzureLogStorageAccountId.ToString()) : null, "recoveryAzureLogStorageAccountId" ,container.Add ); + AddIf( null != this._lastReplicatedTime ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._lastReplicatedTime?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "lastReplicatedTime" ,container.Add ); + AddIf( null != this._rpoInSecond ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((long)this._rpoInSecond) : null, "rpoInSeconds" ,container.Add ); + AddIf( null != this._lastRpoCalculatedTime ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._lastRpoCalculatedTime?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "lastRpoCalculatedTime" ,container.Add ); + AddIf( null != (((object)this._vMId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._vMId.ToString()) : null, "vmId" ,container.Add ); + AddIf( null != (((object)this._vMProtectionState)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._vMProtectionState.ToString()) : null, "vmProtectionState" ,container.Add ); + AddIf( null != (((object)this._vMProtectionStateDescription)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._vMProtectionStateDescription.ToString()) : null, "vmProtectionStateDescription" ,container.Add ); + if (null != this._vMNic) + { + var __r = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __s in this._vMNic ) + { + AddIf(__s?.ToJson(null, serializationMode) ,__r.Add); + } + container.Add("vmNics",__r); + } + AddIf( null != (((object)this._selectedRecoveryAzureNetworkId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._selectedRecoveryAzureNetworkId.ToString()) : null, "selectedRecoveryAzureNetworkId" ,container.Add ); + AddIf( null != (((object)this._selectedSourceNicId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._selectedSourceNicId.ToString()) : null, "selectedSourceNicId" ,container.Add ); + AddIf( null != (((object)this._encryption)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._encryption.ToString()) : null, "encryption" ,container.Add ); + AddIf( null != this._sourceVMRamSizeInMb ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._sourceVMRamSizeInMb) : null, "sourceVmRamSizeInMB" ,container.Add ); + AddIf( null != this._sourceVMCpuCount ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._sourceVMCpuCount) : null, "sourceVmCpuCount" ,container.Add ); + AddIf( null != (((object)this._enableRdpOnTargetOption)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._enableRdpOnTargetOption.ToString()) : null, "enableRdpOnTargetOption" ,container.Add ); + AddIf( null != (((object)this._recoveryAzureResourceGroupId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryAzureResourceGroupId.ToString()) : null, "recoveryAzureResourceGroupId" ,container.Add ); + AddIf( null != (((object)this._recoveryAvailabilitySetId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryAvailabilitySetId.ToString()) : null, "recoveryAvailabilitySetId" ,container.Add ); + AddIf( null != (((object)this._targetAvailabilityZone)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetAvailabilityZone.ToString()) : null, "targetAvailabilityZone" ,container.Add ); + AddIf( null != (((object)this._targetProximityPlacementGroupId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetProximityPlacementGroupId.ToString()) : null, "targetProximityPlacementGroupId" ,container.Add ); + AddIf( null != (((object)this._useManagedDisk)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._useManagedDisk.ToString()) : null, "useManagedDisks" ,container.Add ); + AddIf( null != (((object)this._licenseType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._licenseType.ToString()) : null, "licenseType" ,container.Add ); + AddIf( null != (((object)this._sqlServerLicenseType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._sqlServerLicenseType.ToString()) : null, "sqlServerLicenseType" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._lastRecoveryPointReceived ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._lastRecoveryPointReceived?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "lastRecoveryPointReceived" ,container.Add ); + } + AddIf( null != this._targetVMTag ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._targetVMTag.ToJson(null,serializationMode) : null, "targetVmTags" ,container.Add ); + AddIf( null != this._seedManagedDiskTag ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._seedManagedDiskTag.ToJson(null,serializationMode) : null, "seedManagedDiskTags" ,container.Add ); + AddIf( null != this._targetManagedDiskTag ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._targetManagedDiskTag.ToJson(null,serializationMode) : null, "targetManagedDiskTags" ,container.Add ); + AddIf( null != this._targetNicTag ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._targetNicTag.ToJson(null,serializationMode) : null, "targetNicTags" ,container.Add ); + if (null != this._protectedManagedDisk) + { + var __m = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __n in this._protectedManagedDisk ) + { + AddIf(__n?.ToJson(null, serializationMode) ,__m.Add); + } + container.Add("protectedManagedDisks",__m); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureReplicationDetailsSeedManagedDiskTags.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureReplicationDetailsSeedManagedDiskTags.PowerShell.cs new file mode 100644 index 000000000000..6919aaa98993 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureReplicationDetailsSeedManagedDiskTags.PowerShell.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// The tags for the seed managed disks. + [System.ComponentModel.TypeConverter(typeof(HyperVReplicaAzureReplicationDetailsSeedManagedDiskTagsTypeConverter))] + public partial class HyperVReplicaAzureReplicationDetailsSeedManagedDiskTags + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsSeedManagedDiskTags DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new HyperVReplicaAzureReplicationDetailsSeedManagedDiskTags(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsSeedManagedDiskTags DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new HyperVReplicaAzureReplicationDetailsSeedManagedDiskTags(content); + } + + /// + /// Creates a new instance of , deserializing the content + /// from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsSeedManagedDiskTags FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal HyperVReplicaAzureReplicationDetailsSeedManagedDiskTags(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal HyperVReplicaAzureReplicationDetailsSeedManagedDiskTags(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// The tags for the seed managed disks. + [System.ComponentModel.TypeConverter(typeof(HyperVReplicaAzureReplicationDetailsSeedManagedDiskTagsTypeConverter))] + public partial interface IHyperVReplicaAzureReplicationDetailsSeedManagedDiskTags + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureReplicationDetailsSeedManagedDiskTags.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureReplicationDetailsSeedManagedDiskTags.TypeConverter.cs new file mode 100644 index 000000000000..596d86a28e55 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureReplicationDetailsSeedManagedDiskTags.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class HyperVReplicaAzureReplicationDetailsSeedManagedDiskTagsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsSeedManagedDiskTags ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsSeedManagedDiskTags).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return HyperVReplicaAzureReplicationDetailsSeedManagedDiskTags.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return HyperVReplicaAzureReplicationDetailsSeedManagedDiskTags.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return HyperVReplicaAzureReplicationDetailsSeedManagedDiskTags.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureReplicationDetailsSeedManagedDiskTags.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureReplicationDetailsSeedManagedDiskTags.cs new file mode 100644 index 000000000000..d883879c114d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureReplicationDetailsSeedManagedDiskTags.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The tags for the seed managed disks. + public partial class HyperVReplicaAzureReplicationDetailsSeedManagedDiskTags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsSeedManagedDiskTags, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsSeedManagedDiskTagsInternal + { + + /// + /// Creates an new instance. + /// + public HyperVReplicaAzureReplicationDetailsSeedManagedDiskTags() + { + + } + } + /// The tags for the seed managed disks. + public partial interface IHyperVReplicaAzureReplicationDetailsSeedManagedDiskTags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray + { + + } + /// The tags for the seed managed disks. + internal partial interface IHyperVReplicaAzureReplicationDetailsSeedManagedDiskTagsInternal + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureReplicationDetailsSeedManagedDiskTags.dictionary.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureReplicationDetailsSeedManagedDiskTags.dictionary.cs new file mode 100644 index 000000000000..19962c78a913 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureReplicationDetailsSeedManagedDiskTags.dictionary.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + public partial class HyperVReplicaAzureReplicationDetailsSeedManagedDiskTags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray + { + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + + int Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Values { get => __additionalProperties.Values; } + + public string this[global::System.String index] { get => __additionalProperties[index]; set => __additionalProperties[index] = value; } + + /// + /// + public void Add(global::System.String key, string value) => __additionalProperties.Add( key, value); + + public void Clear() => __additionalProperties.Clear(); + + /// + public bool ContainsKey(global::System.String key) => __additionalProperties.ContainsKey( key); + + /// + public void CopyFrom(global::System.Collections.IDictionary source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public void CopyFrom(global::System.Management.Automation.PSObject source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public bool Remove(global::System.String key) => __additionalProperties.Remove( key); + + /// + /// + public bool TryGetValue(global::System.String key, out string value) => __additionalProperties.TryGetValue( key, out value); + + /// + + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureReplicationDetailsSeedManagedDiskTags source) => source.__additionalProperties; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureReplicationDetailsSeedManagedDiskTags.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureReplicationDetailsSeedManagedDiskTags.json.cs new file mode 100644 index 000000000000..c84a4deee407 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureReplicationDetailsSeedManagedDiskTags.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The tags for the seed managed disks. + public partial class HyperVReplicaAzureReplicationDetailsSeedManagedDiskTags + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsSeedManagedDiskTags. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsSeedManagedDiskTags. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsSeedManagedDiskTags FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new HyperVReplicaAzureReplicationDetailsSeedManagedDiskTags(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + /// + internal HyperVReplicaAzureReplicationDetailsSeedManagedDiskTags(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, global::System.Collections.Generic.HashSet exclusions = null) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray)this).AdditionalProperties, null ,exclusions ); + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray)this).AdditionalProperties, container); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureReplicationDetailsTargetManagedDiskTags.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureReplicationDetailsTargetManagedDiskTags.PowerShell.cs new file mode 100644 index 000000000000..f43907d84d09 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureReplicationDetailsTargetManagedDiskTags.PowerShell.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// The tags for the target managed disks. + [System.ComponentModel.TypeConverter(typeof(HyperVReplicaAzureReplicationDetailsTargetManagedDiskTagsTypeConverter))] + public partial class HyperVReplicaAzureReplicationDetailsTargetManagedDiskTags + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsTargetManagedDiskTags DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new HyperVReplicaAzureReplicationDetailsTargetManagedDiskTags(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsTargetManagedDiskTags DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new HyperVReplicaAzureReplicationDetailsTargetManagedDiskTags(content); + } + + /// + /// Creates a new instance of , deserializing the + /// content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsTargetManagedDiskTags FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal HyperVReplicaAzureReplicationDetailsTargetManagedDiskTags(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal HyperVReplicaAzureReplicationDetailsTargetManagedDiskTags(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// The tags for the target managed disks. + [System.ComponentModel.TypeConverter(typeof(HyperVReplicaAzureReplicationDetailsTargetManagedDiskTagsTypeConverter))] + public partial interface IHyperVReplicaAzureReplicationDetailsTargetManagedDiskTags + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureReplicationDetailsTargetManagedDiskTags.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureReplicationDetailsTargetManagedDiskTags.TypeConverter.cs new file mode 100644 index 000000000000..200a88984016 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureReplicationDetailsTargetManagedDiskTags.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class HyperVReplicaAzureReplicationDetailsTargetManagedDiskTagsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no + /// suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no + /// suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsTargetManagedDiskTags ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsTargetManagedDiskTags).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return HyperVReplicaAzureReplicationDetailsTargetManagedDiskTags.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return HyperVReplicaAzureReplicationDetailsTargetManagedDiskTags.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return HyperVReplicaAzureReplicationDetailsTargetManagedDiskTags.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureReplicationDetailsTargetManagedDiskTags.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureReplicationDetailsTargetManagedDiskTags.cs new file mode 100644 index 000000000000..b6bb9c37568d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureReplicationDetailsTargetManagedDiskTags.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The tags for the target managed disks. + public partial class HyperVReplicaAzureReplicationDetailsTargetManagedDiskTags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsTargetManagedDiskTags, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsTargetManagedDiskTagsInternal + { + + /// + /// Creates an new instance. + /// + public HyperVReplicaAzureReplicationDetailsTargetManagedDiskTags() + { + + } + } + /// The tags for the target managed disks. + public partial interface IHyperVReplicaAzureReplicationDetailsTargetManagedDiskTags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray + { + + } + /// The tags for the target managed disks. + internal partial interface IHyperVReplicaAzureReplicationDetailsTargetManagedDiskTagsInternal + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureReplicationDetailsTargetManagedDiskTags.dictionary.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureReplicationDetailsTargetManagedDiskTags.dictionary.cs new file mode 100644 index 000000000000..31b444378ca3 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureReplicationDetailsTargetManagedDiskTags.dictionary.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + public partial class HyperVReplicaAzureReplicationDetailsTargetManagedDiskTags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray + { + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + + int Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Values { get => __additionalProperties.Values; } + + public string this[global::System.String index] { get => __additionalProperties[index]; set => __additionalProperties[index] = value; } + + /// + /// + public void Add(global::System.String key, string value) => __additionalProperties.Add( key, value); + + public void Clear() => __additionalProperties.Clear(); + + /// + public bool ContainsKey(global::System.String key) => __additionalProperties.ContainsKey( key); + + /// + public void CopyFrom(global::System.Collections.IDictionary source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public void CopyFrom(global::System.Management.Automation.PSObject source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public bool Remove(global::System.String key) => __additionalProperties.Remove( key); + + /// + /// + public bool TryGetValue(global::System.String key, out string value) => __additionalProperties.TryGetValue( key, out value); + + /// + + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureReplicationDetailsTargetManagedDiskTags source) => source.__additionalProperties; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureReplicationDetailsTargetManagedDiskTags.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureReplicationDetailsTargetManagedDiskTags.json.cs new file mode 100644 index 000000000000..9ddd13a2b171 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureReplicationDetailsTargetManagedDiskTags.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The tags for the target managed disks. + public partial class HyperVReplicaAzureReplicationDetailsTargetManagedDiskTags + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsTargetManagedDiskTags. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsTargetManagedDiskTags. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsTargetManagedDiskTags FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new HyperVReplicaAzureReplicationDetailsTargetManagedDiskTags(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + /// + internal HyperVReplicaAzureReplicationDetailsTargetManagedDiskTags(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, global::System.Collections.Generic.HashSet exclusions = null) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray)this).AdditionalProperties, null ,exclusions ); + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray)this).AdditionalProperties, container); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureReplicationDetailsTargetNicTags.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureReplicationDetailsTargetNicTags.PowerShell.cs new file mode 100644 index 000000000000..fee7a746947a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureReplicationDetailsTargetNicTags.PowerShell.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// The tags for the target NICs. + [System.ComponentModel.TypeConverter(typeof(HyperVReplicaAzureReplicationDetailsTargetNicTagsTypeConverter))] + public partial class HyperVReplicaAzureReplicationDetailsTargetNicTags + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsTargetNicTags DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new HyperVReplicaAzureReplicationDetailsTargetNicTags(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsTargetNicTags DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new HyperVReplicaAzureReplicationDetailsTargetNicTags(content); + } + + /// + /// Creates a new instance of , deserializing the content + /// from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsTargetNicTags FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal HyperVReplicaAzureReplicationDetailsTargetNicTags(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal HyperVReplicaAzureReplicationDetailsTargetNicTags(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// The tags for the target NICs. + [System.ComponentModel.TypeConverter(typeof(HyperVReplicaAzureReplicationDetailsTargetNicTagsTypeConverter))] + public partial interface IHyperVReplicaAzureReplicationDetailsTargetNicTags + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureReplicationDetailsTargetNicTags.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureReplicationDetailsTargetNicTags.TypeConverter.cs new file mode 100644 index 000000000000..1b1d07a9864b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureReplicationDetailsTargetNicTags.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class HyperVReplicaAzureReplicationDetailsTargetNicTagsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, + /// otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsTargetNicTags ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsTargetNicTags).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return HyperVReplicaAzureReplicationDetailsTargetNicTags.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return HyperVReplicaAzureReplicationDetailsTargetNicTags.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return HyperVReplicaAzureReplicationDetailsTargetNicTags.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureReplicationDetailsTargetNicTags.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureReplicationDetailsTargetNicTags.cs new file mode 100644 index 000000000000..257be79ea26c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureReplicationDetailsTargetNicTags.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The tags for the target NICs. + public partial class HyperVReplicaAzureReplicationDetailsTargetNicTags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsTargetNicTags, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsTargetNicTagsInternal + { + + /// + /// Creates an new instance. + /// + public HyperVReplicaAzureReplicationDetailsTargetNicTags() + { + + } + } + /// The tags for the target NICs. + public partial interface IHyperVReplicaAzureReplicationDetailsTargetNicTags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray + { + + } + /// The tags for the target NICs. + internal partial interface IHyperVReplicaAzureReplicationDetailsTargetNicTagsInternal + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureReplicationDetailsTargetNicTags.dictionary.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureReplicationDetailsTargetNicTags.dictionary.cs new file mode 100644 index 000000000000..fe1e4992701c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureReplicationDetailsTargetNicTags.dictionary.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + public partial class HyperVReplicaAzureReplicationDetailsTargetNicTags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray + { + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + + int Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Values { get => __additionalProperties.Values; } + + public string this[global::System.String index] { get => __additionalProperties[index]; set => __additionalProperties[index] = value; } + + /// + /// + public void Add(global::System.String key, string value) => __additionalProperties.Add( key, value); + + public void Clear() => __additionalProperties.Clear(); + + /// + public bool ContainsKey(global::System.String key) => __additionalProperties.ContainsKey( key); + + /// + public void CopyFrom(global::System.Collections.IDictionary source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public void CopyFrom(global::System.Management.Automation.PSObject source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public bool Remove(global::System.String key) => __additionalProperties.Remove( key); + + /// + /// + public bool TryGetValue(global::System.String key, out string value) => __additionalProperties.TryGetValue( key, out value); + + /// + + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureReplicationDetailsTargetNicTags source) => source.__additionalProperties; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureReplicationDetailsTargetNicTags.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureReplicationDetailsTargetNicTags.json.cs new file mode 100644 index 000000000000..267d16e2ead5 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureReplicationDetailsTargetNicTags.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The tags for the target NICs. + public partial class HyperVReplicaAzureReplicationDetailsTargetNicTags + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsTargetNicTags. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsTargetNicTags. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsTargetNicTags FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new HyperVReplicaAzureReplicationDetailsTargetNicTags(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + /// + internal HyperVReplicaAzureReplicationDetailsTargetNicTags(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, global::System.Collections.Generic.HashSet exclusions = null) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray)this).AdditionalProperties, null ,exclusions ); + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray)this).AdditionalProperties, container); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureReplicationDetailsTargetVmtags.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureReplicationDetailsTargetVmtags.PowerShell.cs new file mode 100644 index 000000000000..96bd52abe471 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureReplicationDetailsTargetVmtags.PowerShell.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// The target VM tags. + [System.ComponentModel.TypeConverter(typeof(HyperVReplicaAzureReplicationDetailsTargetVmtagsTypeConverter))] + public partial class HyperVReplicaAzureReplicationDetailsTargetVmtags + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsTargetVmtags DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new HyperVReplicaAzureReplicationDetailsTargetVmtags(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsTargetVmtags DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new HyperVReplicaAzureReplicationDetailsTargetVmtags(content); + } + + /// + /// Creates a new instance of , deserializing the content from + /// a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsTargetVmtags FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal HyperVReplicaAzureReplicationDetailsTargetVmtags(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal HyperVReplicaAzureReplicationDetailsTargetVmtags(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// The target VM tags. + [System.ComponentModel.TypeConverter(typeof(HyperVReplicaAzureReplicationDetailsTargetVmtagsTypeConverter))] + public partial interface IHyperVReplicaAzureReplicationDetailsTargetVmtags + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureReplicationDetailsTargetVmtags.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureReplicationDetailsTargetVmtags.TypeConverter.cs new file mode 100644 index 000000000000..067cb34ee2e7 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureReplicationDetailsTargetVmtags.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class HyperVReplicaAzureReplicationDetailsTargetVmtagsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, + /// otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsTargetVmtags ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsTargetVmtags).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return HyperVReplicaAzureReplicationDetailsTargetVmtags.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return HyperVReplicaAzureReplicationDetailsTargetVmtags.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return HyperVReplicaAzureReplicationDetailsTargetVmtags.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureReplicationDetailsTargetVmtags.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureReplicationDetailsTargetVmtags.cs new file mode 100644 index 000000000000..a099ee924d4a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureReplicationDetailsTargetVmtags.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The target VM tags. + public partial class HyperVReplicaAzureReplicationDetailsTargetVmtags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsTargetVmtags, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsTargetVmtagsInternal + { + + /// + /// Creates an new instance. + /// + public HyperVReplicaAzureReplicationDetailsTargetVmtags() + { + + } + } + /// The target VM tags. + public partial interface IHyperVReplicaAzureReplicationDetailsTargetVmtags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray + { + + } + /// The target VM tags. + internal partial interface IHyperVReplicaAzureReplicationDetailsTargetVmtagsInternal + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureReplicationDetailsTargetVmtags.dictionary.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureReplicationDetailsTargetVmtags.dictionary.cs new file mode 100644 index 000000000000..b94a4425ed36 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureReplicationDetailsTargetVmtags.dictionary.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + public partial class HyperVReplicaAzureReplicationDetailsTargetVmtags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray + { + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + + int Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Values { get => __additionalProperties.Values; } + + public string this[global::System.String index] { get => __additionalProperties[index]; set => __additionalProperties[index] = value; } + + /// + /// + public void Add(global::System.String key, string value) => __additionalProperties.Add( key, value); + + public void Clear() => __additionalProperties.Clear(); + + /// + public bool ContainsKey(global::System.String key) => __additionalProperties.ContainsKey( key); + + /// + public void CopyFrom(global::System.Collections.IDictionary source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public void CopyFrom(global::System.Management.Automation.PSObject source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public bool Remove(global::System.String key) => __additionalProperties.Remove( key); + + /// + /// + public bool TryGetValue(global::System.String key, out string value) => __additionalProperties.TryGetValue( key, out value); + + /// + + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureReplicationDetailsTargetVmtags source) => source.__additionalProperties; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureReplicationDetailsTargetVmtags.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureReplicationDetailsTargetVmtags.json.cs new file mode 100644 index 000000000000..07e60f7aa7cf --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureReplicationDetailsTargetVmtags.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The target VM tags. + public partial class HyperVReplicaAzureReplicationDetailsTargetVmtags + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsTargetVmtags. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsTargetVmtags. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReplicationDetailsTargetVmtags FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new HyperVReplicaAzureReplicationDetailsTargetVmtags(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + /// + internal HyperVReplicaAzureReplicationDetailsTargetVmtags(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, global::System.Collections.Generic.HashSet exclusions = null) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray)this).AdditionalProperties, null ,exclusions ); + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray)this).AdditionalProperties, container); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureReprotectInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureReprotectInput.PowerShell.cs new file mode 100644 index 000000000000..3a30c304ec37 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureReprotectInput.PowerShell.cs @@ -0,0 +1,194 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Azure specific reprotect input. + [System.ComponentModel.TypeConverter(typeof(HyperVReplicaAzureReprotectInputTypeConverter))] + public partial class HyperVReplicaAzureReprotectInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReprotectInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new HyperVReplicaAzureReprotectInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReprotectInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new HyperVReplicaAzureReprotectInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReprotectInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal HyperVReplicaAzureReprotectInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("HvHostVMId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReprotectInputInternal)this).HvHostVMId = (string) content.GetValueForProperty("HvHostVMId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReprotectInputInternal)this).HvHostVMId, global::System.Convert.ToString); + } + if (content.Contains("VMName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReprotectInputInternal)this).VMName = (string) content.GetValueForProperty("VMName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReprotectInputInternal)this).VMName, global::System.Convert.ToString); + } + if (content.Contains("OSType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReprotectInputInternal)this).OSType = (string) content.GetValueForProperty("OSType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReprotectInputInternal)this).OSType, global::System.Convert.ToString); + } + if (content.Contains("VHdId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReprotectInputInternal)this).VHdId = (string) content.GetValueForProperty("VHdId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReprotectInputInternal)this).VHdId, global::System.Convert.ToString); + } + if (content.Contains("StorageAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReprotectInputInternal)this).StorageAccountId = (string) content.GetValueForProperty("StorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReprotectInputInternal)this).StorageAccountId, global::System.Convert.ToString); + } + if (content.Contains("LogStorageAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReprotectInputInternal)this).LogStorageAccountId = (string) content.GetValueForProperty("LogStorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReprotectInputInternal)this).LogStorageAccountId, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal HyperVReplicaAzureReprotectInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("HvHostVMId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReprotectInputInternal)this).HvHostVMId = (string) content.GetValueForProperty("HvHostVMId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReprotectInputInternal)this).HvHostVMId, global::System.Convert.ToString); + } + if (content.Contains("VMName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReprotectInputInternal)this).VMName = (string) content.GetValueForProperty("VMName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReprotectInputInternal)this).VMName, global::System.Convert.ToString); + } + if (content.Contains("OSType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReprotectInputInternal)this).OSType = (string) content.GetValueForProperty("OSType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReprotectInputInternal)this).OSType, global::System.Convert.ToString); + } + if (content.Contains("VHdId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReprotectInputInternal)this).VHdId = (string) content.GetValueForProperty("VHdId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReprotectInputInternal)this).VHdId, global::System.Convert.ToString); + } + if (content.Contains("StorageAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReprotectInputInternal)this).StorageAccountId = (string) content.GetValueForProperty("StorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReprotectInputInternal)this).StorageAccountId, global::System.Convert.ToString); + } + if (content.Contains("LogStorageAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReprotectInputInternal)this).LogStorageAccountId = (string) content.GetValueForProperty("LogStorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReprotectInputInternal)this).LogStorageAccountId, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Azure specific reprotect input. + [System.ComponentModel.TypeConverter(typeof(HyperVReplicaAzureReprotectInputTypeConverter))] + public partial interface IHyperVReplicaAzureReprotectInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureReprotectInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureReprotectInput.TypeConverter.cs new file mode 100644 index 000000000000..f2b2242b18f0 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureReprotectInput.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class HyperVReplicaAzureReprotectInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReprotectInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReprotectInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return HyperVReplicaAzureReprotectInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return HyperVReplicaAzureReprotectInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return HyperVReplicaAzureReprotectInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureReprotectInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureReprotectInput.cs new file mode 100644 index 000000000000..53de1f628f7b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureReprotectInput.cs @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Azure specific reprotect input. + public partial class HyperVReplicaAzureReprotectInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReprotectInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReprotectInputInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationProviderSpecificInput __reverseReplicationProviderSpecificInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReverseReplicationProviderSpecificInput(); + + /// Backing field for property. + private string _hvHostVMId; + + /// The Hyper-V host Vm Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string HvHostVMId { get => this._hvHostVMId; set => this._hvHostVMId = value; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationProviderSpecificInputInternal)__reverseReplicationProviderSpecificInput).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationProviderSpecificInputInternal)__reverseReplicationProviderSpecificInput).InstanceType = value ; } + + /// Backing field for property. + private string _logStorageAccountId; + + /// The storage account to be used for logging during replication. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string LogStorageAccountId { get => this._logStorageAccountId; set => this._logStorageAccountId = value; } + + /// Backing field for property. + private string _oSType; + + /// The OS type associated with vm. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string OSType { get => this._oSType; set => this._oSType = value; } + + /// Backing field for property. + private string _storageAccountId; + + /// The storage account name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string StorageAccountId { get => this._storageAccountId; set => this._storageAccountId = value; } + + /// Backing field for property. + private string _vHdId; + + /// The OS disk VHD id associated with vm. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string VHdId { get => this._vHdId; set => this._vHdId = value; } + + /// Backing field for property. + private string _vMName; + + /// The Vm Name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string VMName { get => this._vMName; set => this._vMName = value; } + + /// Creates an new instance. + public HyperVReplicaAzureReprotectInput() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__reverseReplicationProviderSpecificInput), __reverseReplicationProviderSpecificInput); + await eventListener.AssertObjectIsValid(nameof(__reverseReplicationProviderSpecificInput), __reverseReplicationProviderSpecificInput); + } + } + /// Azure specific reprotect input. + public partial interface IHyperVReplicaAzureReprotectInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationProviderSpecificInput + { + /// The Hyper-V host Vm Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Hyper-V host Vm Id.", + SerializedName = @"hvHostVmId", + PossibleTypes = new [] { typeof(string) })] + string HvHostVMId { get; set; } + /// The storage account to be used for logging during replication. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The storage account to be used for logging during replication.", + SerializedName = @"logStorageAccountId", + PossibleTypes = new [] { typeof(string) })] + string LogStorageAccountId { get; set; } + /// The OS type associated with vm. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The OS type associated with vm.", + SerializedName = @"osType", + PossibleTypes = new [] { typeof(string) })] + string OSType { get; set; } + /// The storage account name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The storage account name.", + SerializedName = @"storageAccountId", + PossibleTypes = new [] { typeof(string) })] + string StorageAccountId { get; set; } + /// The OS disk VHD id associated with vm. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The OS disk VHD id associated with vm.", + SerializedName = @"vHDId", + PossibleTypes = new [] { typeof(string) })] + string VHdId { get; set; } + /// The Vm Name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Vm Name.", + SerializedName = @"vmName", + PossibleTypes = new [] { typeof(string) })] + string VMName { get; set; } + + } + /// Azure specific reprotect input. + internal partial interface IHyperVReplicaAzureReprotectInputInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationProviderSpecificInputInternal + { + /// The Hyper-V host Vm Id. + string HvHostVMId { get; set; } + /// The storage account to be used for logging during replication. + string LogStorageAccountId { get; set; } + /// The OS type associated with vm. + string OSType { get; set; } + /// The storage account name. + string StorageAccountId { get; set; } + /// The OS disk VHD id associated with vm. + string VHdId { get; set; } + /// The Vm Name. + string VMName { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureReprotectInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureReprotectInput.json.cs new file mode 100644 index 000000000000..a0c47fe426db --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureReprotectInput.json.cs @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Azure specific reprotect input. + public partial class HyperVReplicaAzureReprotectInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReprotectInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReprotectInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureReprotectInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new HyperVReplicaAzureReprotectInput(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal HyperVReplicaAzureReprotectInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __reverseReplicationProviderSpecificInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReverseReplicationProviderSpecificInput(json); + {_hvHostVMId = If( json?.PropertyT("hvHostVmId"), out var __jsonHvHostVMId) ? (string)__jsonHvHostVMId : (string)HvHostVMId;} + {_vMName = If( json?.PropertyT("vmName"), out var __jsonVMName) ? (string)__jsonVMName : (string)VMName;} + {_oSType = If( json?.PropertyT("osType"), out var __jsonOSType) ? (string)__jsonOSType : (string)OSType;} + {_vHdId = If( json?.PropertyT("vHDId"), out var __jsonVHdId) ? (string)__jsonVHdId : (string)VHdId;} + {_storageAccountId = If( json?.PropertyT("storageAccountId"), out var __jsonStorageAccountId) ? (string)__jsonStorageAccountId : (string)StorageAccountId;} + {_logStorageAccountId = If( json?.PropertyT("logStorageAccountId"), out var __jsonLogStorageAccountId) ? (string)__jsonLogStorageAccountId : (string)LogStorageAccountId;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __reverseReplicationProviderSpecificInput?.ToJson(container, serializationMode); + AddIf( null != (((object)this._hvHostVMId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._hvHostVMId.ToString()) : null, "hvHostVmId" ,container.Add ); + AddIf( null != (((object)this._vMName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._vMName.ToString()) : null, "vmName" ,container.Add ); + AddIf( null != (((object)this._oSType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._oSType.ToString()) : null, "osType" ,container.Add ); + AddIf( null != (((object)this._vHdId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._vHdId.ToString()) : null, "vHDId" ,container.Add ); + AddIf( null != (((object)this._storageAccountId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._storageAccountId.ToString()) : null, "storageAccountId" ,container.Add ); + AddIf( null != (((object)this._logStorageAccountId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._logStorageAccountId.ToString()) : null, "logStorageAccountId" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureTestFailoverInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureTestFailoverInput.PowerShell.cs new file mode 100644 index 000000000000..16856b7fba3e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureTestFailoverInput.PowerShell.cs @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// HvrA provider specific input for test failover. + [System.ComponentModel.TypeConverter(typeof(HyperVReplicaAzureTestFailoverInputTypeConverter))] + public partial class HyperVReplicaAzureTestFailoverInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureTestFailoverInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new HyperVReplicaAzureTestFailoverInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureTestFailoverInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new HyperVReplicaAzureTestFailoverInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureTestFailoverInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal HyperVReplicaAzureTestFailoverInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("PrimaryKekCertificatePfx")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureTestFailoverInputInternal)this).PrimaryKekCertificatePfx = (string) content.GetValueForProperty("PrimaryKekCertificatePfx",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureTestFailoverInputInternal)this).PrimaryKekCertificatePfx, global::System.Convert.ToString); + } + if (content.Contains("SecondaryKekCertificatePfx")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureTestFailoverInputInternal)this).SecondaryKekCertificatePfx = (string) content.GetValueForProperty("SecondaryKekCertificatePfx",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureTestFailoverInputInternal)this).SecondaryKekCertificatePfx, global::System.Convert.ToString); + } + if (content.Contains("RecoveryPointId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureTestFailoverInputInternal)this).RecoveryPointId = (string) content.GetValueForProperty("RecoveryPointId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureTestFailoverInputInternal)this).RecoveryPointId, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal HyperVReplicaAzureTestFailoverInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("PrimaryKekCertificatePfx")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureTestFailoverInputInternal)this).PrimaryKekCertificatePfx = (string) content.GetValueForProperty("PrimaryKekCertificatePfx",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureTestFailoverInputInternal)this).PrimaryKekCertificatePfx, global::System.Convert.ToString); + } + if (content.Contains("SecondaryKekCertificatePfx")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureTestFailoverInputInternal)this).SecondaryKekCertificatePfx = (string) content.GetValueForProperty("SecondaryKekCertificatePfx",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureTestFailoverInputInternal)this).SecondaryKekCertificatePfx, global::System.Convert.ToString); + } + if (content.Contains("RecoveryPointId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureTestFailoverInputInternal)this).RecoveryPointId = (string) content.GetValueForProperty("RecoveryPointId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureTestFailoverInputInternal)this).RecoveryPointId, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// HvrA provider specific input for test failover. + [System.ComponentModel.TypeConverter(typeof(HyperVReplicaAzureTestFailoverInputTypeConverter))] + public partial interface IHyperVReplicaAzureTestFailoverInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureTestFailoverInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureTestFailoverInput.TypeConverter.cs new file mode 100644 index 000000000000..b25c9e9077cc --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureTestFailoverInput.TypeConverter.cs @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class HyperVReplicaAzureTestFailoverInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureTestFailoverInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureTestFailoverInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return HyperVReplicaAzureTestFailoverInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return HyperVReplicaAzureTestFailoverInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return HyperVReplicaAzureTestFailoverInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureTestFailoverInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureTestFailoverInput.cs new file mode 100644 index 000000000000..c5c76c629718 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureTestFailoverInput.cs @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// HvrA provider specific input for test failover. + public partial class HyperVReplicaAzureTestFailoverInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureTestFailoverInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureTestFailoverInputInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverProviderSpecificInput __testFailoverProviderSpecificInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.TestFailoverProviderSpecificInput(); + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverProviderSpecificInputInternal)__testFailoverProviderSpecificInput).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverProviderSpecificInputInternal)__testFailoverProviderSpecificInput).InstanceType = value ; } + + /// Backing field for property. + private string _primaryKekCertificatePfx; + + /// Primary kek certificate pfx. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string PrimaryKekCertificatePfx { get => this._primaryKekCertificatePfx; set => this._primaryKekCertificatePfx = value; } + + /// Backing field for property. + private string _recoveryPointId; + + /// + /// 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. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryPointId { get => this._recoveryPointId; set => this._recoveryPointId = value; } + + /// Backing field for property. + private string _secondaryKekCertificatePfx; + + /// Secondary kek certificate pfx. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string SecondaryKekCertificatePfx { get => this._secondaryKekCertificatePfx; set => this._secondaryKekCertificatePfx = value; } + + /// Creates an new instance. + public HyperVReplicaAzureTestFailoverInput() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__testFailoverProviderSpecificInput), __testFailoverProviderSpecificInput); + await eventListener.AssertObjectIsValid(nameof(__testFailoverProviderSpecificInput), __testFailoverProviderSpecificInput); + } + } + /// HvrA provider specific input for test failover. + public partial interface IHyperVReplicaAzureTestFailoverInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverProviderSpecificInput + { + /// Primary kek certificate pfx. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Primary kek certificate pfx.", + SerializedName = @"primaryKekCertificatePfx", + PossibleTypes = new [] { typeof(string) })] + string PrimaryKekCertificatePfx { get; set; } + /// + /// 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. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"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.", + SerializedName = @"recoveryPointId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryPointId { get; set; } + /// Secondary kek certificate pfx. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Secondary kek certificate pfx.", + SerializedName = @"secondaryKekCertificatePfx", + PossibleTypes = new [] { typeof(string) })] + string SecondaryKekCertificatePfx { get; set; } + + } + /// HvrA provider specific input for test failover. + internal partial interface IHyperVReplicaAzureTestFailoverInputInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverProviderSpecificInputInternal + { + /// Primary kek certificate pfx. + string PrimaryKekCertificatePfx { get; set; } + /// + /// 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. + /// + string RecoveryPointId { get; set; } + /// Secondary kek certificate pfx. + string SecondaryKekCertificatePfx { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureTestFailoverInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureTestFailoverInput.json.cs new file mode 100644 index 000000000000..31a081d43aa6 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureTestFailoverInput.json.cs @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// HvrA provider specific input for test failover. + public partial class HyperVReplicaAzureTestFailoverInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureTestFailoverInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureTestFailoverInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureTestFailoverInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new HyperVReplicaAzureTestFailoverInput(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal HyperVReplicaAzureTestFailoverInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __testFailoverProviderSpecificInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.TestFailoverProviderSpecificInput(json); + {_primaryKekCertificatePfx = If( json?.PropertyT("primaryKekCertificatePfx"), out var __jsonPrimaryKekCertificatePfx) ? (string)__jsonPrimaryKekCertificatePfx : (string)PrimaryKekCertificatePfx;} + {_secondaryKekCertificatePfx = If( json?.PropertyT("secondaryKekCertificatePfx"), out var __jsonSecondaryKekCertificatePfx) ? (string)__jsonSecondaryKekCertificatePfx : (string)SecondaryKekCertificatePfx;} + {_recoveryPointId = If( json?.PropertyT("recoveryPointId"), out var __jsonRecoveryPointId) ? (string)__jsonRecoveryPointId : (string)RecoveryPointId;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __testFailoverProviderSpecificInput?.ToJson(container, serializationMode); + AddIf( null != (((object)this._primaryKekCertificatePfx)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._primaryKekCertificatePfx.ToString()) : null, "primaryKekCertificatePfx" ,container.Add ); + AddIf( null != (((object)this._secondaryKekCertificatePfx)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._secondaryKekCertificatePfx.ToString()) : null, "secondaryKekCertificatePfx" ,container.Add ); + AddIf( null != (((object)this._recoveryPointId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryPointId.ToString()) : null, "recoveryPointId" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureUnplannedFailoverInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureUnplannedFailoverInput.PowerShell.cs new file mode 100644 index 000000000000..cd46029e1740 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureUnplannedFailoverInput.PowerShell.cs @@ -0,0 +1,173 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// HvrA provider specific input for unplanned failover. + [System.ComponentModel.TypeConverter(typeof(HyperVReplicaAzureUnplannedFailoverInputTypeConverter))] + public partial class HyperVReplicaAzureUnplannedFailoverInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUnplannedFailoverInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new HyperVReplicaAzureUnplannedFailoverInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUnplannedFailoverInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new HyperVReplicaAzureUnplannedFailoverInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json + /// string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUnplannedFailoverInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal HyperVReplicaAzureUnplannedFailoverInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("PrimaryKekCertificatePfx")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUnplannedFailoverInputInternal)this).PrimaryKekCertificatePfx = (string) content.GetValueForProperty("PrimaryKekCertificatePfx",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUnplannedFailoverInputInternal)this).PrimaryKekCertificatePfx, global::System.Convert.ToString); + } + if (content.Contains("SecondaryKekCertificatePfx")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUnplannedFailoverInputInternal)this).SecondaryKekCertificatePfx = (string) content.GetValueForProperty("SecondaryKekCertificatePfx",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUnplannedFailoverInputInternal)this).SecondaryKekCertificatePfx, global::System.Convert.ToString); + } + if (content.Contains("RecoveryPointId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUnplannedFailoverInputInternal)this).RecoveryPointId = (string) content.GetValueForProperty("RecoveryPointId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUnplannedFailoverInputInternal)this).RecoveryPointId, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal HyperVReplicaAzureUnplannedFailoverInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("PrimaryKekCertificatePfx")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUnplannedFailoverInputInternal)this).PrimaryKekCertificatePfx = (string) content.GetValueForProperty("PrimaryKekCertificatePfx",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUnplannedFailoverInputInternal)this).PrimaryKekCertificatePfx, global::System.Convert.ToString); + } + if (content.Contains("SecondaryKekCertificatePfx")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUnplannedFailoverInputInternal)this).SecondaryKekCertificatePfx = (string) content.GetValueForProperty("SecondaryKekCertificatePfx",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUnplannedFailoverInputInternal)this).SecondaryKekCertificatePfx, global::System.Convert.ToString); + } + if (content.Contains("RecoveryPointId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUnplannedFailoverInputInternal)this).RecoveryPointId = (string) content.GetValueForProperty("RecoveryPointId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUnplannedFailoverInputInternal)this).RecoveryPointId, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// HvrA provider specific input for unplanned failover. + [System.ComponentModel.TypeConverter(typeof(HyperVReplicaAzureUnplannedFailoverInputTypeConverter))] + public partial interface IHyperVReplicaAzureUnplannedFailoverInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureUnplannedFailoverInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureUnplannedFailoverInput.TypeConverter.cs new file mode 100644 index 000000000000..be6c969e7b6a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureUnplannedFailoverInput.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class HyperVReplicaAzureUnplannedFailoverInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUnplannedFailoverInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUnplannedFailoverInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return HyperVReplicaAzureUnplannedFailoverInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return HyperVReplicaAzureUnplannedFailoverInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return HyperVReplicaAzureUnplannedFailoverInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureUnplannedFailoverInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureUnplannedFailoverInput.cs new file mode 100644 index 000000000000..748122a57c03 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureUnplannedFailoverInput.cs @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// HvrA provider specific input for unplanned failover. + public partial class HyperVReplicaAzureUnplannedFailoverInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUnplannedFailoverInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUnplannedFailoverInputInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverProviderSpecificInput __unplannedFailoverProviderSpecificInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UnplannedFailoverProviderSpecificInput(); + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverProviderSpecificInputInternal)__unplannedFailoverProviderSpecificInput).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverProviderSpecificInputInternal)__unplannedFailoverProviderSpecificInput).InstanceType = value ; } + + /// Backing field for property. + private string _primaryKekCertificatePfx; + + /// Primary kek certificate pfx. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string PrimaryKekCertificatePfx { get => this._primaryKekCertificatePfx; set => this._primaryKekCertificatePfx = value; } + + /// Backing field for property. + private string _recoveryPointId; + + /// + /// The recovery point id to be passed to failover to a particular recovery point. In case of latest recovery point, null + /// should be passed. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryPointId { get => this._recoveryPointId; set => this._recoveryPointId = value; } + + /// Backing field for property. + private string _secondaryKekCertificatePfx; + + /// Secondary kek certificate pfx. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string SecondaryKekCertificatePfx { get => this._secondaryKekCertificatePfx; set => this._secondaryKekCertificatePfx = value; } + + /// + /// Creates an new instance. + /// + public HyperVReplicaAzureUnplannedFailoverInput() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__unplannedFailoverProviderSpecificInput), __unplannedFailoverProviderSpecificInput); + await eventListener.AssertObjectIsValid(nameof(__unplannedFailoverProviderSpecificInput), __unplannedFailoverProviderSpecificInput); + } + } + /// HvrA provider specific input for unplanned failover. + public partial interface IHyperVReplicaAzureUnplannedFailoverInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverProviderSpecificInput + { + /// Primary kek certificate pfx. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Primary kek certificate pfx.", + SerializedName = @"primaryKekCertificatePfx", + PossibleTypes = new [] { typeof(string) })] + string PrimaryKekCertificatePfx { get; set; } + /// + /// The recovery point id to be passed to failover to a particular recovery point. In case of latest recovery point, null + /// should be passed. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery point id to be passed to failover to a particular recovery point. In case of latest recovery point, null should be passed.", + SerializedName = @"recoveryPointId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryPointId { get; set; } + /// Secondary kek certificate pfx. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Secondary kek certificate pfx.", + SerializedName = @"secondaryKekCertificatePfx", + PossibleTypes = new [] { typeof(string) })] + string SecondaryKekCertificatePfx { get; set; } + + } + /// HvrA provider specific input for unplanned failover. + internal partial interface IHyperVReplicaAzureUnplannedFailoverInputInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverProviderSpecificInputInternal + { + /// Primary kek certificate pfx. + string PrimaryKekCertificatePfx { get; set; } + /// + /// The recovery point id to be passed to failover to a particular recovery point. In case of latest recovery point, null + /// should be passed. + /// + string RecoveryPointId { get; set; } + /// Secondary kek certificate pfx. + string SecondaryKekCertificatePfx { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureUnplannedFailoverInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureUnplannedFailoverInput.json.cs new file mode 100644 index 000000000000..792085f906e0 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureUnplannedFailoverInput.json.cs @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// HvrA provider specific input for unplanned failover. + public partial class HyperVReplicaAzureUnplannedFailoverInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUnplannedFailoverInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUnplannedFailoverInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUnplannedFailoverInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new HyperVReplicaAzureUnplannedFailoverInput(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal HyperVReplicaAzureUnplannedFailoverInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __unplannedFailoverProviderSpecificInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UnplannedFailoverProviderSpecificInput(json); + {_primaryKekCertificatePfx = If( json?.PropertyT("primaryKekCertificatePfx"), out var __jsonPrimaryKekCertificatePfx) ? (string)__jsonPrimaryKekCertificatePfx : (string)PrimaryKekCertificatePfx;} + {_secondaryKekCertificatePfx = If( json?.PropertyT("secondaryKekCertificatePfx"), out var __jsonSecondaryKekCertificatePfx) ? (string)__jsonSecondaryKekCertificatePfx : (string)SecondaryKekCertificatePfx;} + {_recoveryPointId = If( json?.PropertyT("recoveryPointId"), out var __jsonRecoveryPointId) ? (string)__jsonRecoveryPointId : (string)RecoveryPointId;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __unplannedFailoverProviderSpecificInput?.ToJson(container, serializationMode); + AddIf( null != (((object)this._primaryKekCertificatePfx)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._primaryKekCertificatePfx.ToString()) : null, "primaryKekCertificatePfx" ,container.Add ); + AddIf( null != (((object)this._secondaryKekCertificatePfx)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._secondaryKekCertificatePfx.ToString()) : null, "secondaryKekCertificatePfx" ,container.Add ); + AddIf( null != (((object)this._recoveryPointId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryPointId.ToString()) : null, "recoveryPointId" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureUpdateReplicationProtectedItemInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureUpdateReplicationProtectedItemInput.PowerShell.cs new file mode 100644 index 000000000000..4629aa1c3022 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureUpdateReplicationProtectedItemInput.PowerShell.cs @@ -0,0 +1,237 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// HyperV replica Azure input to update replication protected item. + [System.ComponentModel.TypeConverter(typeof(HyperVReplicaAzureUpdateReplicationProtectedItemInputTypeConverter))] + public partial class HyperVReplicaAzureUpdateReplicationProtectedItemInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new HyperVReplicaAzureUpdateReplicationProtectedItemInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new HyperVReplicaAzureUpdateReplicationProtectedItemInput(content); + } + + /// + /// Creates a new instance of , deserializing the content + /// from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal HyperVReplicaAzureUpdateReplicationProtectedItemInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("RecoveryAzureV1ResourceGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputInternal)this).RecoveryAzureV1ResourceGroupId = (string) content.GetValueForProperty("RecoveryAzureV1ResourceGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputInternal)this).RecoveryAzureV1ResourceGroupId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryAzureV2ResourceGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputInternal)this).RecoveryAzureV2ResourceGroupId = (string) content.GetValueForProperty("RecoveryAzureV2ResourceGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputInternal)this).RecoveryAzureV2ResourceGroupId, global::System.Convert.ToString); + } + if (content.Contains("UseManagedDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputInternal)this).UseManagedDisk = (string) content.GetValueForProperty("UseManagedDisk",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputInternal)this).UseManagedDisk, global::System.Convert.ToString); + } + if (content.Contains("DiskIdToDiskEncryptionMap")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputInternal)this).DiskIdToDiskEncryptionMap = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputDiskIdToDiskEncryptionMap) content.GetValueForProperty("DiskIdToDiskEncryptionMap",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputInternal)this).DiskIdToDiskEncryptionMap, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureUpdateReplicationProtectedItemInputDiskIdToDiskEncryptionMapTypeConverter.ConvertFrom); + } + if (content.Contains("TargetProximityPlacementGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputInternal)this).TargetProximityPlacementGroupId = (string) content.GetValueForProperty("TargetProximityPlacementGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputInternal)this).TargetProximityPlacementGroupId, global::System.Convert.ToString); + } + if (content.Contains("TargetAvailabilityZone")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputInternal)this).TargetAvailabilityZone = (string) content.GetValueForProperty("TargetAvailabilityZone",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputInternal)this).TargetAvailabilityZone, global::System.Convert.ToString); + } + if (content.Contains("TargetVMTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputInternal)this).TargetVMTag = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputTargetVmtags) content.GetValueForProperty("TargetVMTag",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputInternal)this).TargetVMTag, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetVmtagsTypeConverter.ConvertFrom); + } + if (content.Contains("TargetManagedDiskTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputInternal)this).TargetManagedDiskTag = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputTargetManagedDiskTags) content.GetValueForProperty("TargetManagedDiskTag",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputInternal)this).TargetManagedDiskTag, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetManagedDiskTagsTypeConverter.ConvertFrom); + } + if (content.Contains("TargetNicTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputInternal)this).TargetNicTag = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputTargetNicTags) content.GetValueForProperty("TargetNicTag",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputInternal)this).TargetNicTag, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetNicTagsTypeConverter.ConvertFrom); + } + if (content.Contains("SqlServerLicenseType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputInternal)this).SqlServerLicenseType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SqlServerLicenseType?) content.GetValueForProperty("SqlServerLicenseType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputInternal)this).SqlServerLicenseType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SqlServerLicenseType.CreateFrom); + } + if (content.Contains("VMDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputInternal)this).VMDisk = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateDiskInput[]) content.GetValueForProperty("VMDisk",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputInternal)this).VMDisk, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateDiskInputTypeConverter.ConvertFrom)); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemProviderInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemProviderInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal HyperVReplicaAzureUpdateReplicationProtectedItemInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("RecoveryAzureV1ResourceGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputInternal)this).RecoveryAzureV1ResourceGroupId = (string) content.GetValueForProperty("RecoveryAzureV1ResourceGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputInternal)this).RecoveryAzureV1ResourceGroupId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryAzureV2ResourceGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputInternal)this).RecoveryAzureV2ResourceGroupId = (string) content.GetValueForProperty("RecoveryAzureV2ResourceGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputInternal)this).RecoveryAzureV2ResourceGroupId, global::System.Convert.ToString); + } + if (content.Contains("UseManagedDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputInternal)this).UseManagedDisk = (string) content.GetValueForProperty("UseManagedDisk",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputInternal)this).UseManagedDisk, global::System.Convert.ToString); + } + if (content.Contains("DiskIdToDiskEncryptionMap")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputInternal)this).DiskIdToDiskEncryptionMap = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputDiskIdToDiskEncryptionMap) content.GetValueForProperty("DiskIdToDiskEncryptionMap",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputInternal)this).DiskIdToDiskEncryptionMap, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureUpdateReplicationProtectedItemInputDiskIdToDiskEncryptionMapTypeConverter.ConvertFrom); + } + if (content.Contains("TargetProximityPlacementGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputInternal)this).TargetProximityPlacementGroupId = (string) content.GetValueForProperty("TargetProximityPlacementGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputInternal)this).TargetProximityPlacementGroupId, global::System.Convert.ToString); + } + if (content.Contains("TargetAvailabilityZone")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputInternal)this).TargetAvailabilityZone = (string) content.GetValueForProperty("TargetAvailabilityZone",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputInternal)this).TargetAvailabilityZone, global::System.Convert.ToString); + } + if (content.Contains("TargetVMTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputInternal)this).TargetVMTag = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputTargetVmtags) content.GetValueForProperty("TargetVMTag",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputInternal)this).TargetVMTag, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetVmtagsTypeConverter.ConvertFrom); + } + if (content.Contains("TargetManagedDiskTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputInternal)this).TargetManagedDiskTag = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputTargetManagedDiskTags) content.GetValueForProperty("TargetManagedDiskTag",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputInternal)this).TargetManagedDiskTag, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetManagedDiskTagsTypeConverter.ConvertFrom); + } + if (content.Contains("TargetNicTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputInternal)this).TargetNicTag = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputTargetNicTags) content.GetValueForProperty("TargetNicTag",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputInternal)this).TargetNicTag, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetNicTagsTypeConverter.ConvertFrom); + } + if (content.Contains("SqlServerLicenseType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputInternal)this).SqlServerLicenseType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SqlServerLicenseType?) content.GetValueForProperty("SqlServerLicenseType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputInternal)this).SqlServerLicenseType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SqlServerLicenseType.CreateFrom); + } + if (content.Contains("VMDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputInternal)this).VMDisk = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateDiskInput[]) content.GetValueForProperty("VMDisk",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputInternal)this).VMDisk, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateDiskInputTypeConverter.ConvertFrom)); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemProviderInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemProviderInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// HyperV replica Azure input to update replication protected item. + [System.ComponentModel.TypeConverter(typeof(HyperVReplicaAzureUpdateReplicationProtectedItemInputTypeConverter))] + public partial interface IHyperVReplicaAzureUpdateReplicationProtectedItemInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureUpdateReplicationProtectedItemInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureUpdateReplicationProtectedItemInput.TypeConverter.cs new file mode 100644 index 000000000000..e63b555cff2b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureUpdateReplicationProtectedItemInput.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class HyperVReplicaAzureUpdateReplicationProtectedItemInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return HyperVReplicaAzureUpdateReplicationProtectedItemInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return HyperVReplicaAzureUpdateReplicationProtectedItemInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return HyperVReplicaAzureUpdateReplicationProtectedItemInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureUpdateReplicationProtectedItemInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureUpdateReplicationProtectedItemInput.cs new file mode 100644 index 000000000000..2fe2735691b4 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureUpdateReplicationProtectedItemInput.cs @@ -0,0 +1,246 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// HyperV replica Azure input to update replication protected item. + public partial class HyperVReplicaAzureUpdateReplicationProtectedItemInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemProviderInput __updateReplicationProtectedItemProviderInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateReplicationProtectedItemProviderInput(); + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputDiskIdToDiskEncryptionMap _diskIdToDiskEncryptionMap; + + /// The dictionary of disk resource Id to disk encryption set ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputDiskIdToDiskEncryptionMap DiskIdToDiskEncryptionMap { get => (this._diskIdToDiskEncryptionMap = this._diskIdToDiskEncryptionMap ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureUpdateReplicationProtectedItemInputDiskIdToDiskEncryptionMap()); set => this._diskIdToDiskEncryptionMap = value; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemProviderInputInternal)__updateReplicationProtectedItemProviderInput).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemProviderInputInternal)__updateReplicationProtectedItemProviderInput).InstanceType = value ; } + + /// Backing field for property. + private string _recoveryAzureV1ResourceGroupId; + + /// The recovery Azure resource group Id for classic deployment. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryAzureV1ResourceGroupId { get => this._recoveryAzureV1ResourceGroupId; set => this._recoveryAzureV1ResourceGroupId = value; } + + /// Backing field for property. + private string _recoveryAzureV2ResourceGroupId; + + /// The recovery Azure resource group Id for resource manager deployment. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryAzureV2ResourceGroupId { get => this._recoveryAzureV2ResourceGroupId; set => this._recoveryAzureV2ResourceGroupId = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SqlServerLicenseType? _sqlServerLicenseType; + + /// The SQL Server license type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SqlServerLicenseType? SqlServerLicenseType { get => this._sqlServerLicenseType; set => this._sqlServerLicenseType = value; } + + /// Backing field for property. + private string _targetAvailabilityZone; + + /// The target availability zone. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetAvailabilityZone { get => this._targetAvailabilityZone; set => this._targetAvailabilityZone = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputTargetManagedDiskTags _targetManagedDiskTag; + + /// The tags for the target managed disks. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputTargetManagedDiskTags TargetManagedDiskTag { get => (this._targetManagedDiskTag = this._targetManagedDiskTag ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetManagedDiskTags()); set => this._targetManagedDiskTag = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputTargetNicTags _targetNicTag; + + /// The tags for the target NICs. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputTargetNicTags TargetNicTag { get => (this._targetNicTag = this._targetNicTag ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetNicTags()); set => this._targetNicTag = value; } + + /// Backing field for property. + private string _targetProximityPlacementGroupId; + + /// The target proximity placement group Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetProximityPlacementGroupId { get => this._targetProximityPlacementGroupId; set => this._targetProximityPlacementGroupId = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputTargetVmtags _targetVMTag; + + /// The target VM tags. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputTargetVmtags TargetVMTag { get => (this._targetVMTag = this._targetVMTag ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetVmtags()); set => this._targetVMTag = value; } + + /// Backing field for property. + private string _useManagedDisk; + + /// A value indicating whether managed disks should be used during failover. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string UseManagedDisk { get => this._useManagedDisk; set => this._useManagedDisk = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateDiskInput[] _vMDisk; + + /// The list of disk update properties. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateDiskInput[] VMDisk { get => this._vMDisk; set => this._vMDisk = value; } + + /// + /// Creates an new instance. + /// + public HyperVReplicaAzureUpdateReplicationProtectedItemInput() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__updateReplicationProtectedItemProviderInput), __updateReplicationProtectedItemProviderInput); + await eventListener.AssertObjectIsValid(nameof(__updateReplicationProtectedItemProviderInput), __updateReplicationProtectedItemProviderInput); + } + } + /// HyperV replica Azure input to update replication protected item. + public partial interface IHyperVReplicaAzureUpdateReplicationProtectedItemInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemProviderInput + { + /// The dictionary of disk resource Id to disk encryption set ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The dictionary of disk resource Id to disk encryption set ARM Id.", + SerializedName = @"diskIdToDiskEncryptionMap", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputDiskIdToDiskEncryptionMap) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputDiskIdToDiskEncryptionMap DiskIdToDiskEncryptionMap { get; set; } + /// The recovery Azure resource group Id for classic deployment. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery Azure resource group Id for classic deployment.", + SerializedName = @"recoveryAzureV1ResourceGroupId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryAzureV1ResourceGroupId { get; set; } + /// The recovery Azure resource group Id for resource manager deployment. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery Azure resource group Id for resource manager deployment.", + SerializedName = @"recoveryAzureV2ResourceGroupId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryAzureV2ResourceGroupId { get; set; } + /// The SQL Server license type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The SQL Server license type.", + SerializedName = @"sqlServerLicenseType", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SqlServerLicenseType) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SqlServerLicenseType? SqlServerLicenseType { get; set; } + /// The target availability zone. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target availability zone.", + SerializedName = @"targetAvailabilityZone", + PossibleTypes = new [] { typeof(string) })] + string TargetAvailabilityZone { get; set; } + /// The tags for the target managed disks. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The tags for the target managed disks.", + SerializedName = @"targetManagedDiskTags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputTargetManagedDiskTags) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputTargetManagedDiskTags TargetManagedDiskTag { get; set; } + /// The tags for the target NICs. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The tags for the target NICs.", + SerializedName = @"targetNicTags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputTargetNicTags) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputTargetNicTags TargetNicTag { get; set; } + /// The target proximity placement group Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target proximity placement group Id.", + SerializedName = @"targetProximityPlacementGroupId", + PossibleTypes = new [] { typeof(string) })] + string TargetProximityPlacementGroupId { get; set; } + /// The target VM tags. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target VM tags.", + SerializedName = @"targetVmTags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputTargetVmtags) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputTargetVmtags TargetVMTag { get; set; } + /// A value indicating whether managed disks should be used during failover. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether managed disks should be used during failover.", + SerializedName = @"useManagedDisks", + PossibleTypes = new [] { typeof(string) })] + string UseManagedDisk { get; set; } + /// The list of disk update properties. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of disk update properties.", + SerializedName = @"vmDisks", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateDiskInput) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateDiskInput[] VMDisk { get; set; } + + } + /// HyperV replica Azure input to update replication protected item. + internal partial interface IHyperVReplicaAzureUpdateReplicationProtectedItemInputInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemProviderInputInternal + { + /// The dictionary of disk resource Id to disk encryption set ARM Id. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputDiskIdToDiskEncryptionMap DiskIdToDiskEncryptionMap { get; set; } + /// The recovery Azure resource group Id for classic deployment. + string RecoveryAzureV1ResourceGroupId { get; set; } + /// The recovery Azure resource group Id for resource manager deployment. + string RecoveryAzureV2ResourceGroupId { get; set; } + /// The SQL Server license type. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SqlServerLicenseType? SqlServerLicenseType { get; set; } + /// The target availability zone. + string TargetAvailabilityZone { get; set; } + /// The tags for the target managed disks. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputTargetManagedDiskTags TargetManagedDiskTag { get; set; } + /// The tags for the target NICs. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputTargetNicTags TargetNicTag { get; set; } + /// The target proximity placement group Id. + string TargetProximityPlacementGroupId { get; set; } + /// The target VM tags. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputTargetVmtags TargetVMTag { get; set; } + /// A value indicating whether managed disks should be used during failover. + string UseManagedDisk { get; set; } + /// The list of disk update properties. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateDiskInput[] VMDisk { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureUpdateReplicationProtectedItemInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureUpdateReplicationProtectedItemInput.json.cs new file mode 100644 index 000000000000..3556d7da2d28 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureUpdateReplicationProtectedItemInput.json.cs @@ -0,0 +1,141 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// HyperV replica Azure input to update replication protected item. + public partial class HyperVReplicaAzureUpdateReplicationProtectedItemInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new HyperVReplicaAzureUpdateReplicationProtectedItemInput(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal HyperVReplicaAzureUpdateReplicationProtectedItemInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __updateReplicationProtectedItemProviderInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateReplicationProtectedItemProviderInput(json); + {_recoveryAzureV1ResourceGroupId = If( json?.PropertyT("recoveryAzureV1ResourceGroupId"), out var __jsonRecoveryAzureV1ResourceGroupId) ? (string)__jsonRecoveryAzureV1ResourceGroupId : (string)RecoveryAzureV1ResourceGroupId;} + {_recoveryAzureV2ResourceGroupId = If( json?.PropertyT("recoveryAzureV2ResourceGroupId"), out var __jsonRecoveryAzureV2ResourceGroupId) ? (string)__jsonRecoveryAzureV2ResourceGroupId : (string)RecoveryAzureV2ResourceGroupId;} + {_useManagedDisk = If( json?.PropertyT("useManagedDisks"), out var __jsonUseManagedDisks) ? (string)__jsonUseManagedDisks : (string)UseManagedDisk;} + {_diskIdToDiskEncryptionMap = If( json?.PropertyT("diskIdToDiskEncryptionMap"), out var __jsonDiskIdToDiskEncryptionMap) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureUpdateReplicationProtectedItemInputDiskIdToDiskEncryptionMap.FromJson(__jsonDiskIdToDiskEncryptionMap) : DiskIdToDiskEncryptionMap;} + {_targetProximityPlacementGroupId = If( json?.PropertyT("targetProximityPlacementGroupId"), out var __jsonTargetProximityPlacementGroupId) ? (string)__jsonTargetProximityPlacementGroupId : (string)TargetProximityPlacementGroupId;} + {_targetAvailabilityZone = If( json?.PropertyT("targetAvailabilityZone"), out var __jsonTargetAvailabilityZone) ? (string)__jsonTargetAvailabilityZone : (string)TargetAvailabilityZone;} + {_targetVMTag = If( json?.PropertyT("targetVmTags"), out var __jsonTargetVMTags) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetVmtags.FromJson(__jsonTargetVMTags) : TargetVMTag;} + {_targetManagedDiskTag = If( json?.PropertyT("targetManagedDiskTags"), out var __jsonTargetManagedDiskTags) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetManagedDiskTags.FromJson(__jsonTargetManagedDiskTags) : TargetManagedDiskTag;} + {_targetNicTag = If( json?.PropertyT("targetNicTags"), out var __jsonTargetNicTags) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetNicTags.FromJson(__jsonTargetNicTags) : TargetNicTag;} + {_sqlServerLicenseType = If( json?.PropertyT("sqlServerLicenseType"), out var __jsonSqlServerLicenseType) ? (string)__jsonSqlServerLicenseType : (string)SqlServerLicenseType;} + {_vMDisk = If( json?.PropertyT("vmDisks"), out var __jsonVMDisks) ? If( __jsonVMDisks as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateDiskInput) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateDiskInput.FromJson(__u) )) ))() : null : VMDisk;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __updateReplicationProtectedItemProviderInput?.ToJson(container, serializationMode); + AddIf( null != (((object)this._recoveryAzureV1ResourceGroupId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryAzureV1ResourceGroupId.ToString()) : null, "recoveryAzureV1ResourceGroupId" ,container.Add ); + AddIf( null != (((object)this._recoveryAzureV2ResourceGroupId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryAzureV2ResourceGroupId.ToString()) : null, "recoveryAzureV2ResourceGroupId" ,container.Add ); + AddIf( null != (((object)this._useManagedDisk)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._useManagedDisk.ToString()) : null, "useManagedDisks" ,container.Add ); + AddIf( null != this._diskIdToDiskEncryptionMap ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._diskIdToDiskEncryptionMap.ToJson(null,serializationMode) : null, "diskIdToDiskEncryptionMap" ,container.Add ); + AddIf( null != (((object)this._targetProximityPlacementGroupId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetProximityPlacementGroupId.ToString()) : null, "targetProximityPlacementGroupId" ,container.Add ); + AddIf( null != (((object)this._targetAvailabilityZone)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetAvailabilityZone.ToString()) : null, "targetAvailabilityZone" ,container.Add ); + AddIf( null != this._targetVMTag ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._targetVMTag.ToJson(null,serializationMode) : null, "targetVmTags" ,container.Add ); + AddIf( null != this._targetManagedDiskTag ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._targetManagedDiskTag.ToJson(null,serializationMode) : null, "targetManagedDiskTags" ,container.Add ); + AddIf( null != this._targetNicTag ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._targetNicTag.ToJson(null,serializationMode) : null, "targetNicTags" ,container.Add ); + AddIf( null != (((object)this._sqlServerLicenseType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._sqlServerLicenseType.ToString()) : null, "sqlServerLicenseType" ,container.Add ); + if (null != this._vMDisk) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._vMDisk ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("vmDisks",__w); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureUpdateReplicationProtectedItemInputDiskIdToDiskEncryptionMap.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureUpdateReplicationProtectedItemInputDiskIdToDiskEncryptionMap.PowerShell.cs new file mode 100644 index 000000000000..0769f5787abe --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureUpdateReplicationProtectedItemInputDiskIdToDiskEncryptionMap.PowerShell.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// The dictionary of disk resource Id to disk encryption set ARM Id. + [System.ComponentModel.TypeConverter(typeof(HyperVReplicaAzureUpdateReplicationProtectedItemInputDiskIdToDiskEncryptionMapTypeConverter))] + public partial class HyperVReplicaAzureUpdateReplicationProtectedItemInputDiskIdToDiskEncryptionMap + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputDiskIdToDiskEncryptionMap DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new HyperVReplicaAzureUpdateReplicationProtectedItemInputDiskIdToDiskEncryptionMap(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputDiskIdToDiskEncryptionMap DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new HyperVReplicaAzureUpdateReplicationProtectedItemInputDiskIdToDiskEncryptionMap(content); + } + + /// + /// Creates a new instance of , + /// deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model + /// class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputDiskIdToDiskEncryptionMap FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal HyperVReplicaAzureUpdateReplicationProtectedItemInputDiskIdToDiskEncryptionMap(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal HyperVReplicaAzureUpdateReplicationProtectedItemInputDiskIdToDiskEncryptionMap(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// The dictionary of disk resource Id to disk encryption set ARM Id. + [System.ComponentModel.TypeConverter(typeof(HyperVReplicaAzureUpdateReplicationProtectedItemInputDiskIdToDiskEncryptionMapTypeConverter))] + public partial interface IHyperVReplicaAzureUpdateReplicationProtectedItemInputDiskIdToDiskEncryptionMap + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureUpdateReplicationProtectedItemInputDiskIdToDiskEncryptionMap.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureUpdateReplicationProtectedItemInputDiskIdToDiskEncryptionMap.TypeConverter.cs new file mode 100644 index 000000000000..75ae079bc8b2 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureUpdateReplicationProtectedItemInputDiskIdToDiskEncryptionMap.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class HyperVReplicaAzureUpdateReplicationProtectedItemInputDiskIdToDiskEncryptionMapTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null + /// if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null + /// if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputDiskIdToDiskEncryptionMap ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputDiskIdToDiskEncryptionMap).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return HyperVReplicaAzureUpdateReplicationProtectedItemInputDiskIdToDiskEncryptionMap.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return HyperVReplicaAzureUpdateReplicationProtectedItemInputDiskIdToDiskEncryptionMap.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return HyperVReplicaAzureUpdateReplicationProtectedItemInputDiskIdToDiskEncryptionMap.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureUpdateReplicationProtectedItemInputDiskIdToDiskEncryptionMap.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureUpdateReplicationProtectedItemInputDiskIdToDiskEncryptionMap.cs new file mode 100644 index 000000000000..006886721b0f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureUpdateReplicationProtectedItemInputDiskIdToDiskEncryptionMap.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The dictionary of disk resource Id to disk encryption set ARM Id. + public partial class HyperVReplicaAzureUpdateReplicationProtectedItemInputDiskIdToDiskEncryptionMap : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputDiskIdToDiskEncryptionMap, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputDiskIdToDiskEncryptionMapInternal + { + + /// + /// Creates an new instance. + /// + public HyperVReplicaAzureUpdateReplicationProtectedItemInputDiskIdToDiskEncryptionMap() + { + + } + } + /// The dictionary of disk resource Id to disk encryption set ARM Id. + public partial interface IHyperVReplicaAzureUpdateReplicationProtectedItemInputDiskIdToDiskEncryptionMap : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray + { + + } + /// The dictionary of disk resource Id to disk encryption set ARM Id. + internal partial interface IHyperVReplicaAzureUpdateReplicationProtectedItemInputDiskIdToDiskEncryptionMapInternal + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureUpdateReplicationProtectedItemInputDiskIdToDiskEncryptionMap.dictionary.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureUpdateReplicationProtectedItemInputDiskIdToDiskEncryptionMap.dictionary.cs new file mode 100644 index 000000000000..7bc04dd5d08e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureUpdateReplicationProtectedItemInputDiskIdToDiskEncryptionMap.dictionary.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + public partial class HyperVReplicaAzureUpdateReplicationProtectedItemInputDiskIdToDiskEncryptionMap : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray + { + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + + int Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Values { get => __additionalProperties.Values; } + + public string this[global::System.String index] { get => __additionalProperties[index]; set => __additionalProperties[index] = value; } + + /// + /// + public void Add(global::System.String key, string value) => __additionalProperties.Add( key, value); + + public void Clear() => __additionalProperties.Clear(); + + /// + public bool ContainsKey(global::System.String key) => __additionalProperties.ContainsKey( key); + + /// + public void CopyFrom(global::System.Collections.IDictionary source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public void CopyFrom(global::System.Management.Automation.PSObject source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public bool Remove(global::System.String key) => __additionalProperties.Remove( key); + + /// + /// + public bool TryGetValue(global::System.String key, out string value) => __additionalProperties.TryGetValue( key, out value); + + /// + + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureUpdateReplicationProtectedItemInputDiskIdToDiskEncryptionMap source) => source.__additionalProperties; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureUpdateReplicationProtectedItemInputDiskIdToDiskEncryptionMap.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureUpdateReplicationProtectedItemInputDiskIdToDiskEncryptionMap.json.cs new file mode 100644 index 000000000000..a243df7c2394 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureUpdateReplicationProtectedItemInputDiskIdToDiskEncryptionMap.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The dictionary of disk resource Id to disk encryption set ARM Id. + public partial class HyperVReplicaAzureUpdateReplicationProtectedItemInputDiskIdToDiskEncryptionMap + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputDiskIdToDiskEncryptionMap. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputDiskIdToDiskEncryptionMap. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputDiskIdToDiskEncryptionMap FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new HyperVReplicaAzureUpdateReplicationProtectedItemInputDiskIdToDiskEncryptionMap(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + /// + internal HyperVReplicaAzureUpdateReplicationProtectedItemInputDiskIdToDiskEncryptionMap(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, global::System.Collections.Generic.HashSet exclusions = null) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray)this).AdditionalProperties, null ,exclusions ); + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of + /// as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray)this).AdditionalProperties, container); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetManagedDiskTags.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetManagedDiskTags.PowerShell.cs new file mode 100644 index 000000000000..a884de39a8ec --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetManagedDiskTags.PowerShell.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// The tags for the target managed disks. + [System.ComponentModel.TypeConverter(typeof(HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetManagedDiskTagsTypeConverter))] + public partial class HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetManagedDiskTags + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputTargetManagedDiskTags DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetManagedDiskTags(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputTargetManagedDiskTags DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetManagedDiskTags(content); + } + + /// + /// Creates a new instance of , deserializing + /// the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputTargetManagedDiskTags FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetManagedDiskTags(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetManagedDiskTags(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// The tags for the target managed disks. + [System.ComponentModel.TypeConverter(typeof(HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetManagedDiskTagsTypeConverter))] + public partial interface IHyperVReplicaAzureUpdateReplicationProtectedItemInputTargetManagedDiskTags + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetManagedDiskTags.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetManagedDiskTags.TypeConverter.cs new file mode 100644 index 000000000000..4f98f1eb1d48 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetManagedDiskTags.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetManagedDiskTagsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null + /// if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null + /// if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputTargetManagedDiskTags ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputTargetManagedDiskTags).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetManagedDiskTags.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetManagedDiskTags.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetManagedDiskTags.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetManagedDiskTags.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetManagedDiskTags.cs new file mode 100644 index 000000000000..34c6ab86f5fb --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetManagedDiskTags.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The tags for the target managed disks. + public partial class HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetManagedDiskTags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputTargetManagedDiskTags, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputTargetManagedDiskTagsInternal + { + + /// + /// Creates an new instance. + /// + public HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetManagedDiskTags() + { + + } + } + /// The tags for the target managed disks. + public partial interface IHyperVReplicaAzureUpdateReplicationProtectedItemInputTargetManagedDiskTags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray + { + + } + /// The tags for the target managed disks. + internal partial interface IHyperVReplicaAzureUpdateReplicationProtectedItemInputTargetManagedDiskTagsInternal + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetManagedDiskTags.dictionary.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetManagedDiskTags.dictionary.cs new file mode 100644 index 000000000000..ad80fe18e75f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetManagedDiskTags.dictionary.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + public partial class HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetManagedDiskTags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray + { + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + + int Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Values { get => __additionalProperties.Values; } + + public string this[global::System.String index] { get => __additionalProperties[index]; set => __additionalProperties[index] = value; } + + /// + /// + public void Add(global::System.String key, string value) => __additionalProperties.Add( key, value); + + public void Clear() => __additionalProperties.Clear(); + + /// + public bool ContainsKey(global::System.String key) => __additionalProperties.ContainsKey( key); + + /// + public void CopyFrom(global::System.Collections.IDictionary source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public void CopyFrom(global::System.Management.Automation.PSObject source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public bool Remove(global::System.String key) => __additionalProperties.Remove( key); + + /// + /// + public bool TryGetValue(global::System.String key, out string value) => __additionalProperties.TryGetValue( key, out value); + + /// + + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetManagedDiskTags source) => source.__additionalProperties; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetManagedDiskTags.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetManagedDiskTags.json.cs new file mode 100644 index 000000000000..233b302309f7 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetManagedDiskTags.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The tags for the target managed disks. + public partial class HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetManagedDiskTags + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputTargetManagedDiskTags. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputTargetManagedDiskTags. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputTargetManagedDiskTags FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetManagedDiskTags(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + /// + internal HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetManagedDiskTags(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, global::System.Collections.Generic.HashSet exclusions = null) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray)this).AdditionalProperties, null ,exclusions ); + AfterFromJson(json); + } + + /// + /// Serializes this instance of + /// into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as + /// a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray)this).AdditionalProperties, container); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetNicTags.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetNicTags.PowerShell.cs new file mode 100644 index 000000000000..ffe02e019a32 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetNicTags.PowerShell.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// The tags for the target NICs. + [System.ComponentModel.TypeConverter(typeof(HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetNicTagsTypeConverter))] + public partial class HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetNicTags + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputTargetNicTags DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetNicTags(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputTargetNicTags DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetNicTags(content); + } + + /// + /// Creates a new instance of , deserializing + /// the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputTargetNicTags FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetNicTags(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetNicTags(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// The tags for the target NICs. + [System.ComponentModel.TypeConverter(typeof(HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetNicTagsTypeConverter))] + public partial interface IHyperVReplicaAzureUpdateReplicationProtectedItemInputTargetNicTags + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetNicTags.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetNicTags.TypeConverter.cs new file mode 100644 index 000000000000..47dec726662c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetNicTags.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetNicTagsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there + /// is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there + /// is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputTargetNicTags ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputTargetNicTags).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetNicTags.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetNicTags.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetNicTags.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetNicTags.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetNicTags.cs new file mode 100644 index 000000000000..6092a4e1edec --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetNicTags.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The tags for the target NICs. + public partial class HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetNicTags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputTargetNicTags, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputTargetNicTagsInternal + { + + /// + /// Creates an new instance. + /// + public HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetNicTags() + { + + } + } + /// The tags for the target NICs. + public partial interface IHyperVReplicaAzureUpdateReplicationProtectedItemInputTargetNicTags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray + { + + } + /// The tags for the target NICs. + internal partial interface IHyperVReplicaAzureUpdateReplicationProtectedItemInputTargetNicTagsInternal + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetNicTags.dictionary.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetNicTags.dictionary.cs new file mode 100644 index 000000000000..23eb71cdca78 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetNicTags.dictionary.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + public partial class HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetNicTags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray + { + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + + int Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Values { get => __additionalProperties.Values; } + + public string this[global::System.String index] { get => __additionalProperties[index]; set => __additionalProperties[index] = value; } + + /// + /// + public void Add(global::System.String key, string value) => __additionalProperties.Add( key, value); + + public void Clear() => __additionalProperties.Clear(); + + /// + public bool ContainsKey(global::System.String key) => __additionalProperties.ContainsKey( key); + + /// + public void CopyFrom(global::System.Collections.IDictionary source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public void CopyFrom(global::System.Management.Automation.PSObject source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public bool Remove(global::System.String key) => __additionalProperties.Remove( key); + + /// + /// + public bool TryGetValue(global::System.String key, out string value) => __additionalProperties.TryGetValue( key, out value); + + /// + + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetNicTags source) => source.__additionalProperties; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetNicTags.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetNicTags.json.cs new file mode 100644 index 000000000000..11dd50370381 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetNicTags.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The tags for the target NICs. + public partial class HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetNicTags + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputTargetNicTags. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputTargetNicTags. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputTargetNicTags FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetNicTags(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + /// + internal HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetNicTags(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, global::System.Collections.Generic.HashSet exclusions = null) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray)this).AdditionalProperties, null ,exclusions ); + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray)this).AdditionalProperties, container); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetVmtags.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetVmtags.PowerShell.cs new file mode 100644 index 000000000000..3e061960c5e1 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetVmtags.PowerShell.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// The target VM tags. + [System.ComponentModel.TypeConverter(typeof(HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetVmtagsTypeConverter))] + public partial class HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetVmtags + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputTargetVmtags DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetVmtags(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputTargetVmtags DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetVmtags(content); + } + + /// + /// Creates a new instance of , deserializing + /// the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputTargetVmtags FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetVmtags(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetVmtags(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// The target VM tags. + [System.ComponentModel.TypeConverter(typeof(HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetVmtagsTypeConverter))] + public partial interface IHyperVReplicaAzureUpdateReplicationProtectedItemInputTargetVmtags + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetVmtags.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetVmtags.TypeConverter.cs new file mode 100644 index 000000000000..0a2aac427cb9 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetVmtags.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetVmtagsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there + /// is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there + /// is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputTargetVmtags ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputTargetVmtags).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetVmtags.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetVmtags.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetVmtags.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetVmtags.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetVmtags.cs new file mode 100644 index 000000000000..5aeea3437ec5 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetVmtags.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The target VM tags. + public partial class HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetVmtags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputTargetVmtags, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputTargetVmtagsInternal + { + + /// + /// Creates an new instance. + /// + public HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetVmtags() + { + + } + } + /// The target VM tags. + public partial interface IHyperVReplicaAzureUpdateReplicationProtectedItemInputTargetVmtags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray + { + + } + /// The target VM tags. + internal partial interface IHyperVReplicaAzureUpdateReplicationProtectedItemInputTargetVmtagsInternal + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetVmtags.dictionary.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetVmtags.dictionary.cs new file mode 100644 index 000000000000..1e7584d2aa12 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetVmtags.dictionary.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + public partial class HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetVmtags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray + { + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + + int Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Values { get => __additionalProperties.Values; } + + public string this[global::System.String index] { get => __additionalProperties[index]; set => __additionalProperties[index] = value; } + + /// + /// + public void Add(global::System.String key, string value) => __additionalProperties.Add( key, value); + + public void Clear() => __additionalProperties.Clear(); + + /// + public bool ContainsKey(global::System.String key) => __additionalProperties.ContainsKey( key); + + /// + public void CopyFrom(global::System.Collections.IDictionary source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public void CopyFrom(global::System.Management.Automation.PSObject source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public bool Remove(global::System.String key) => __additionalProperties.Remove( key); + + /// + /// + public bool TryGetValue(global::System.String key, out string value) => __additionalProperties.TryGetValue( key, out value); + + /// + + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetVmtags source) => source.__additionalProperties; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetVmtags.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetVmtags.json.cs new file mode 100644 index 000000000000..4b6c7cc4315c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetVmtags.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The target VM tags. + public partial class HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetVmtags + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputTargetVmtags. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputTargetVmtags. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaAzureUpdateReplicationProtectedItemInputTargetVmtags FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetVmtags(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + /// + internal HyperVReplicaAzureUpdateReplicationProtectedItemInputTargetVmtags(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, global::System.Collections.Generic.HashSet exclusions = null) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray)this).AdditionalProperties, null ,exclusions ); + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray)this).AdditionalProperties, container); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaBaseEventDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaBaseEventDetails.PowerShell.cs new file mode 100644 index 000000000000..69d065fbac6b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaBaseEventDetails.PowerShell.cs @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Abstract model class for event details of a HyperVReplica E2E event. + [System.ComponentModel.TypeConverter(typeof(HyperVReplicaBaseEventDetailsTypeConverter))] + public partial class HyperVReplicaBaseEventDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBaseEventDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new HyperVReplicaBaseEventDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBaseEventDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new HyperVReplicaBaseEventDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBaseEventDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal HyperVReplicaBaseEventDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ContainerName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBaseEventDetailsInternal)this).ContainerName = (string) content.GetValueForProperty("ContainerName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBaseEventDetailsInternal)this).ContainerName, global::System.Convert.ToString); + } + if (content.Contains("FabricName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBaseEventDetailsInternal)this).FabricName = (string) content.GetValueForProperty("FabricName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBaseEventDetailsInternal)this).FabricName, global::System.Convert.ToString); + } + if (content.Contains("RemoteContainerName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBaseEventDetailsInternal)this).RemoteContainerName = (string) content.GetValueForProperty("RemoteContainerName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBaseEventDetailsInternal)this).RemoteContainerName, global::System.Convert.ToString); + } + if (content.Contains("RemoteFabricName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBaseEventDetailsInternal)this).RemoteFabricName = (string) content.GetValueForProperty("RemoteFabricName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBaseEventDetailsInternal)this).RemoteFabricName, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal HyperVReplicaBaseEventDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ContainerName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBaseEventDetailsInternal)this).ContainerName = (string) content.GetValueForProperty("ContainerName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBaseEventDetailsInternal)this).ContainerName, global::System.Convert.ToString); + } + if (content.Contains("FabricName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBaseEventDetailsInternal)this).FabricName = (string) content.GetValueForProperty("FabricName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBaseEventDetailsInternal)this).FabricName, global::System.Convert.ToString); + } + if (content.Contains("RemoteContainerName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBaseEventDetailsInternal)this).RemoteContainerName = (string) content.GetValueForProperty("RemoteContainerName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBaseEventDetailsInternal)this).RemoteContainerName, global::System.Convert.ToString); + } + if (content.Contains("RemoteFabricName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBaseEventDetailsInternal)this).RemoteFabricName = (string) content.GetValueForProperty("RemoteFabricName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBaseEventDetailsInternal)this).RemoteFabricName, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Abstract model class for event details of a HyperVReplica E2E event. + [System.ComponentModel.TypeConverter(typeof(HyperVReplicaBaseEventDetailsTypeConverter))] + public partial interface IHyperVReplicaBaseEventDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaBaseEventDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaBaseEventDetails.TypeConverter.cs new file mode 100644 index 000000000000..d0cc8eba3ffc --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaBaseEventDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class HyperVReplicaBaseEventDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBaseEventDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBaseEventDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return HyperVReplicaBaseEventDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return HyperVReplicaBaseEventDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return HyperVReplicaBaseEventDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaBaseEventDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaBaseEventDetails.cs new file mode 100644 index 000000000000..ccd5e1515a25 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaBaseEventDetails.cs @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Abstract model class for event details of a HyperVReplica E2E event. + public partial class HyperVReplicaBaseEventDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBaseEventDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBaseEventDetailsInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetails __eventProviderSpecificDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EventProviderSpecificDetails(); + + /// Backing field for property. + private string _containerName; + + /// The container friendly name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ContainerName { get => this._containerName; set => this._containerName = value; } + + /// Backing field for property. + private string _fabricName; + + /// The fabric friendly name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// Gets the class type. Overridden in derived classes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetailsInternal)__eventProviderSpecificDetails).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetailsInternal)__eventProviderSpecificDetails).InstanceType = value ; } + + /// Backing field for property. + private string _remoteContainerName; + + /// The remote container name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RemoteContainerName { get => this._remoteContainerName; set => this._remoteContainerName = value; } + + /// Backing field for property. + private string _remoteFabricName; + + /// The remote fabric name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RemoteFabricName { get => this._remoteFabricName; set => this._remoteFabricName = value; } + + /// Creates an new instance. + public HyperVReplicaBaseEventDetails() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__eventProviderSpecificDetails), __eventProviderSpecificDetails); + await eventListener.AssertObjectIsValid(nameof(__eventProviderSpecificDetails), __eventProviderSpecificDetails); + } + } + /// Abstract model class for event details of a HyperVReplica E2E event. + public partial interface IHyperVReplicaBaseEventDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetails + { + /// The container friendly name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The container friendly name.", + SerializedName = @"containerName", + PossibleTypes = new [] { typeof(string) })] + string ContainerName { get; set; } + /// The fabric friendly name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The fabric friendly name.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + string FabricName { get; set; } + /// The remote container name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The remote container name.", + SerializedName = @"remoteContainerName", + PossibleTypes = new [] { typeof(string) })] + string RemoteContainerName { get; set; } + /// The remote fabric name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The remote fabric name.", + SerializedName = @"remoteFabricName", + PossibleTypes = new [] { typeof(string) })] + string RemoteFabricName { get; set; } + + } + /// Abstract model class for event details of a HyperVReplica E2E event. + internal partial interface IHyperVReplicaBaseEventDetailsInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetailsInternal + { + /// The container friendly name. + string ContainerName { get; set; } + /// The fabric friendly name. + string FabricName { get; set; } + /// The remote container name. + string RemoteContainerName { get; set; } + /// The remote fabric name. + string RemoteFabricName { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaBaseEventDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaBaseEventDetails.json.cs new file mode 100644 index 000000000000..fa4c23ccd727 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaBaseEventDetails.json.cs @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Abstract model class for event details of a HyperVReplica E2E event. + public partial class HyperVReplicaBaseEventDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBaseEventDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBaseEventDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBaseEventDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new HyperVReplicaBaseEventDetails(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal HyperVReplicaBaseEventDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __eventProviderSpecificDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EventProviderSpecificDetails(json); + {_containerName = If( json?.PropertyT("containerName"), out var __jsonContainerName) ? (string)__jsonContainerName : (string)ContainerName;} + {_fabricName = If( json?.PropertyT("fabricName"), out var __jsonFabricName) ? (string)__jsonFabricName : (string)FabricName;} + {_remoteContainerName = If( json?.PropertyT("remoteContainerName"), out var __jsonRemoteContainerName) ? (string)__jsonRemoteContainerName : (string)RemoteContainerName;} + {_remoteFabricName = If( json?.PropertyT("remoteFabricName"), out var __jsonRemoteFabricName) ? (string)__jsonRemoteFabricName : (string)RemoteFabricName;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __eventProviderSpecificDetails?.ToJson(container, serializationMode); + AddIf( null != (((object)this._containerName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._containerName.ToString()) : null, "containerName" ,container.Add ); + AddIf( null != (((object)this._fabricName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._fabricName.ToString()) : null, "fabricName" ,container.Add ); + AddIf( null != (((object)this._remoteContainerName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._remoteContainerName.ToString()) : null, "remoteContainerName" ,container.Add ); + AddIf( null != (((object)this._remoteFabricName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._remoteFabricName.ToString()) : null, "remoteFabricName" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaBasePolicyDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaBasePolicyDetails.PowerShell.cs new file mode 100644 index 000000000000..1bdd8d6684c2 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaBasePolicyDetails.PowerShell.cs @@ -0,0 +1,226 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Base class for HyperVReplica policy details. + [System.ComponentModel.TypeConverter(typeof(HyperVReplicaBasePolicyDetailsTypeConverter))] + public partial class HyperVReplicaBasePolicyDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBasePolicyDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new HyperVReplicaBasePolicyDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBasePolicyDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new HyperVReplicaBasePolicyDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBasePolicyDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal HyperVReplicaBasePolicyDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("RecoveryPoint")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBasePolicyDetailsInternal)this).RecoveryPoint = (int?) content.GetValueForProperty("RecoveryPoint",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBasePolicyDetailsInternal)this).RecoveryPoint, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("ApplicationConsistentSnapshotFrequencyInHour")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBasePolicyDetailsInternal)this).ApplicationConsistentSnapshotFrequencyInHour = (int?) content.GetValueForProperty("ApplicationConsistentSnapshotFrequencyInHour",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBasePolicyDetailsInternal)this).ApplicationConsistentSnapshotFrequencyInHour, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("Compression")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBasePolicyDetailsInternal)this).Compression = (string) content.GetValueForProperty("Compression",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBasePolicyDetailsInternal)this).Compression, global::System.Convert.ToString); + } + if (content.Contains("InitialReplicationMethod")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBasePolicyDetailsInternal)this).InitialReplicationMethod = (string) content.GetValueForProperty("InitialReplicationMethod",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBasePolicyDetailsInternal)this).InitialReplicationMethod, global::System.Convert.ToString); + } + if (content.Contains("OnlineReplicationStartTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBasePolicyDetailsInternal)this).OnlineReplicationStartTime = (string) content.GetValueForProperty("OnlineReplicationStartTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBasePolicyDetailsInternal)this).OnlineReplicationStartTime, global::System.Convert.ToString); + } + if (content.Contains("OfflineReplicationImportPath")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBasePolicyDetailsInternal)this).OfflineReplicationImportPath = (string) content.GetValueForProperty("OfflineReplicationImportPath",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBasePolicyDetailsInternal)this).OfflineReplicationImportPath, global::System.Convert.ToString); + } + if (content.Contains("OfflineReplicationExportPath")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBasePolicyDetailsInternal)this).OfflineReplicationExportPath = (string) content.GetValueForProperty("OfflineReplicationExportPath",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBasePolicyDetailsInternal)this).OfflineReplicationExportPath, global::System.Convert.ToString); + } + if (content.Contains("ReplicationPort")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBasePolicyDetailsInternal)this).ReplicationPort = (int?) content.GetValueForProperty("ReplicationPort",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBasePolicyDetailsInternal)this).ReplicationPort, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("AllowedAuthenticationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBasePolicyDetailsInternal)this).AllowedAuthenticationType = (int?) content.GetValueForProperty("AllowedAuthenticationType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBasePolicyDetailsInternal)this).AllowedAuthenticationType, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("ReplicaDeletionOption")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBasePolicyDetailsInternal)this).ReplicaDeletionOption = (string) content.GetValueForProperty("ReplicaDeletionOption",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBasePolicyDetailsInternal)this).ReplicaDeletionOption, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal HyperVReplicaBasePolicyDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("RecoveryPoint")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBasePolicyDetailsInternal)this).RecoveryPoint = (int?) content.GetValueForProperty("RecoveryPoint",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBasePolicyDetailsInternal)this).RecoveryPoint, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("ApplicationConsistentSnapshotFrequencyInHour")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBasePolicyDetailsInternal)this).ApplicationConsistentSnapshotFrequencyInHour = (int?) content.GetValueForProperty("ApplicationConsistentSnapshotFrequencyInHour",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBasePolicyDetailsInternal)this).ApplicationConsistentSnapshotFrequencyInHour, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("Compression")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBasePolicyDetailsInternal)this).Compression = (string) content.GetValueForProperty("Compression",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBasePolicyDetailsInternal)this).Compression, global::System.Convert.ToString); + } + if (content.Contains("InitialReplicationMethod")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBasePolicyDetailsInternal)this).InitialReplicationMethod = (string) content.GetValueForProperty("InitialReplicationMethod",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBasePolicyDetailsInternal)this).InitialReplicationMethod, global::System.Convert.ToString); + } + if (content.Contains("OnlineReplicationStartTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBasePolicyDetailsInternal)this).OnlineReplicationStartTime = (string) content.GetValueForProperty("OnlineReplicationStartTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBasePolicyDetailsInternal)this).OnlineReplicationStartTime, global::System.Convert.ToString); + } + if (content.Contains("OfflineReplicationImportPath")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBasePolicyDetailsInternal)this).OfflineReplicationImportPath = (string) content.GetValueForProperty("OfflineReplicationImportPath",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBasePolicyDetailsInternal)this).OfflineReplicationImportPath, global::System.Convert.ToString); + } + if (content.Contains("OfflineReplicationExportPath")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBasePolicyDetailsInternal)this).OfflineReplicationExportPath = (string) content.GetValueForProperty("OfflineReplicationExportPath",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBasePolicyDetailsInternal)this).OfflineReplicationExportPath, global::System.Convert.ToString); + } + if (content.Contains("ReplicationPort")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBasePolicyDetailsInternal)this).ReplicationPort = (int?) content.GetValueForProperty("ReplicationPort",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBasePolicyDetailsInternal)this).ReplicationPort, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("AllowedAuthenticationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBasePolicyDetailsInternal)this).AllowedAuthenticationType = (int?) content.GetValueForProperty("AllowedAuthenticationType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBasePolicyDetailsInternal)this).AllowedAuthenticationType, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("ReplicaDeletionOption")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBasePolicyDetailsInternal)this).ReplicaDeletionOption = (string) content.GetValueForProperty("ReplicaDeletionOption",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBasePolicyDetailsInternal)this).ReplicaDeletionOption, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Base class for HyperVReplica policy details. + [System.ComponentModel.TypeConverter(typeof(HyperVReplicaBasePolicyDetailsTypeConverter))] + public partial interface IHyperVReplicaBasePolicyDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaBasePolicyDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaBasePolicyDetails.TypeConverter.cs new file mode 100644 index 000000000000..601af8c67064 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaBasePolicyDetails.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class HyperVReplicaBasePolicyDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBasePolicyDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBasePolicyDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return HyperVReplicaBasePolicyDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return HyperVReplicaBasePolicyDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return HyperVReplicaBasePolicyDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaBasePolicyDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaBasePolicyDetails.cs new file mode 100644 index 000000000000..0f0754ab16a9 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaBasePolicyDetails.cs @@ -0,0 +1,235 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Base class for HyperVReplica policy details. + public partial class HyperVReplicaBasePolicyDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBasePolicyDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBasePolicyDetailsInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetails __policyProviderSpecificDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PolicyProviderSpecificDetails(); + + /// Backing field for property. + private int? _allowedAuthenticationType; + + /// A value indicating the authentication type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? AllowedAuthenticationType { get => this._allowedAuthenticationType; set => this._allowedAuthenticationType = value; } + + /// + /// Backing field for property. + /// + private int? _applicationConsistentSnapshotFrequencyInHour; + + /// A value indicating the application consistent frequency. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? ApplicationConsistentSnapshotFrequencyInHour { get => this._applicationConsistentSnapshotFrequencyInHour; set => this._applicationConsistentSnapshotFrequencyInHour = value; } + + /// Backing field for property. + private string _compression; + + /// A value indicating whether compression has to be enabled. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Compression { get => this._compression; set => this._compression = value; } + + /// Backing field for property. + private string _initialReplicationMethod; + + /// A value indicating whether IR is online. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string InitialReplicationMethod { get => this._initialReplicationMethod; set => this._initialReplicationMethod = value; } + + /// Gets the class type. Overridden in derived classes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetailsInternal)__policyProviderSpecificDetails).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetailsInternal)__policyProviderSpecificDetails).InstanceType = value ; } + + /// Backing field for property. + private string _offlineReplicationExportPath; + + /// A value indicating the offline IR export path. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string OfflineReplicationExportPath { get => this._offlineReplicationExportPath; set => this._offlineReplicationExportPath = value; } + + /// Backing field for property. + private string _offlineReplicationImportPath; + + /// A value indicating the offline IR import path. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string OfflineReplicationImportPath { get => this._offlineReplicationImportPath; set => this._offlineReplicationImportPath = value; } + + /// Backing field for property. + private string _onlineReplicationStartTime; + + /// A value indicating the online IR start time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string OnlineReplicationStartTime { get => this._onlineReplicationStartTime; set => this._onlineReplicationStartTime = value; } + + /// Backing field for property. + private int? _recoveryPoint; + + /// A value indicating the number of recovery points. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? RecoveryPoint { get => this._recoveryPoint; set => this._recoveryPoint = value; } + + /// Backing field for property. + private string _replicaDeletionOption; + + /// + /// A value indicating whether the VM has to be auto deleted. Supported Values: String.Empty, None, OnRecoveryCloud. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ReplicaDeletionOption { get => this._replicaDeletionOption; set => this._replicaDeletionOption = value; } + + /// Backing field for property. + private int? _replicationPort; + + /// A value indicating the recovery HTTPS port. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? ReplicationPort { get => this._replicationPort; set => this._replicationPort = value; } + + /// Creates an new instance. + public HyperVReplicaBasePolicyDetails() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__policyProviderSpecificDetails), __policyProviderSpecificDetails); + await eventListener.AssertObjectIsValid(nameof(__policyProviderSpecificDetails), __policyProviderSpecificDetails); + } + } + /// Base class for HyperVReplica policy details. + public partial interface IHyperVReplicaBasePolicyDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetails + { + /// A value indicating the authentication type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating the authentication type.", + SerializedName = @"allowedAuthenticationType", + PossibleTypes = new [] { typeof(int) })] + int? AllowedAuthenticationType { get; set; } + /// A value indicating the application consistent frequency. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating the application consistent frequency.", + SerializedName = @"applicationConsistentSnapshotFrequencyInHours", + PossibleTypes = new [] { typeof(int) })] + int? ApplicationConsistentSnapshotFrequencyInHour { get; set; } + /// A value indicating whether compression has to be enabled. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether compression has to be enabled.", + SerializedName = @"compression", + PossibleTypes = new [] { typeof(string) })] + string Compression { get; set; } + /// A value indicating whether IR is online. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether IR is online.", + SerializedName = @"initialReplicationMethod", + PossibleTypes = new [] { typeof(string) })] + string InitialReplicationMethod { get; set; } + /// A value indicating the offline IR export path. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating the offline IR export path.", + SerializedName = @"offlineReplicationExportPath", + PossibleTypes = new [] { typeof(string) })] + string OfflineReplicationExportPath { get; set; } + /// A value indicating the offline IR import path. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating the offline IR import path.", + SerializedName = @"offlineReplicationImportPath", + PossibleTypes = new [] { typeof(string) })] + string OfflineReplicationImportPath { get; set; } + /// A value indicating the online IR start time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating the online IR start time.", + SerializedName = @"onlineReplicationStartTime", + PossibleTypes = new [] { typeof(string) })] + string OnlineReplicationStartTime { get; set; } + /// A value indicating the number of recovery points. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating the number of recovery points.", + SerializedName = @"recoveryPoints", + PossibleTypes = new [] { typeof(int) })] + int? RecoveryPoint { get; set; } + /// + /// A value indicating whether the VM has to be auto deleted. Supported Values: String.Empty, None, OnRecoveryCloud. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether the VM has to be auto deleted. Supported Values: String.Empty, None, OnRecoveryCloud.", + SerializedName = @"replicaDeletionOption", + PossibleTypes = new [] { typeof(string) })] + string ReplicaDeletionOption { get; set; } + /// A value indicating the recovery HTTPS port. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating the recovery HTTPS port.", + SerializedName = @"replicationPort", + PossibleTypes = new [] { typeof(int) })] + int? ReplicationPort { get; set; } + + } + /// Base class for HyperVReplica policy details. + internal partial interface IHyperVReplicaBasePolicyDetailsInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetailsInternal + { + /// A value indicating the authentication type. + int? AllowedAuthenticationType { get; set; } + /// A value indicating the application consistent frequency. + int? ApplicationConsistentSnapshotFrequencyInHour { get; set; } + /// A value indicating whether compression has to be enabled. + string Compression { get; set; } + /// A value indicating whether IR is online. + string InitialReplicationMethod { get; set; } + /// A value indicating the offline IR export path. + string OfflineReplicationExportPath { get; set; } + /// A value indicating the offline IR import path. + string OfflineReplicationImportPath { get; set; } + /// A value indicating the online IR start time. + string OnlineReplicationStartTime { get; set; } + /// A value indicating the number of recovery points. + int? RecoveryPoint { get; set; } + /// + /// A value indicating whether the VM has to be auto deleted. Supported Values: String.Empty, None, OnRecoveryCloud. + /// + string ReplicaDeletionOption { get; set; } + /// A value indicating the recovery HTTPS port. + int? ReplicationPort { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaBasePolicyDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaBasePolicyDetails.json.cs new file mode 100644 index 000000000000..7a91d1d5ae06 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaBasePolicyDetails.json.cs @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Base class for HyperVReplica policy details. + public partial class HyperVReplicaBasePolicyDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBasePolicyDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBasePolicyDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBasePolicyDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new HyperVReplicaBasePolicyDetails(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal HyperVReplicaBasePolicyDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __policyProviderSpecificDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PolicyProviderSpecificDetails(json); + {_recoveryPoint = If( json?.PropertyT("recoveryPoints"), out var __jsonRecoveryPoints) ? (int?)__jsonRecoveryPoints : RecoveryPoint;} + {_applicationConsistentSnapshotFrequencyInHour = If( json?.PropertyT("applicationConsistentSnapshotFrequencyInHours"), out var __jsonApplicationConsistentSnapshotFrequencyInHours) ? (int?)__jsonApplicationConsistentSnapshotFrequencyInHours : ApplicationConsistentSnapshotFrequencyInHour;} + {_compression = If( json?.PropertyT("compression"), out var __jsonCompression) ? (string)__jsonCompression : (string)Compression;} + {_initialReplicationMethod = If( json?.PropertyT("initialReplicationMethod"), out var __jsonInitialReplicationMethod) ? (string)__jsonInitialReplicationMethod : (string)InitialReplicationMethod;} + {_onlineReplicationStartTime = If( json?.PropertyT("onlineReplicationStartTime"), out var __jsonOnlineReplicationStartTime) ? (string)__jsonOnlineReplicationStartTime : (string)OnlineReplicationStartTime;} + {_offlineReplicationImportPath = If( json?.PropertyT("offlineReplicationImportPath"), out var __jsonOfflineReplicationImportPath) ? (string)__jsonOfflineReplicationImportPath : (string)OfflineReplicationImportPath;} + {_offlineReplicationExportPath = If( json?.PropertyT("offlineReplicationExportPath"), out var __jsonOfflineReplicationExportPath) ? (string)__jsonOfflineReplicationExportPath : (string)OfflineReplicationExportPath;} + {_replicationPort = If( json?.PropertyT("replicationPort"), out var __jsonReplicationPort) ? (int?)__jsonReplicationPort : ReplicationPort;} + {_allowedAuthenticationType = If( json?.PropertyT("allowedAuthenticationType"), out var __jsonAllowedAuthenticationType) ? (int?)__jsonAllowedAuthenticationType : AllowedAuthenticationType;} + {_replicaDeletionOption = If( json?.PropertyT("replicaDeletionOption"), out var __jsonReplicaDeletionOption) ? (string)__jsonReplicaDeletionOption : (string)ReplicaDeletionOption;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __policyProviderSpecificDetails?.ToJson(container, serializationMode); + AddIf( null != this._recoveryPoint ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._recoveryPoint) : null, "recoveryPoints" ,container.Add ); + AddIf( null != this._applicationConsistentSnapshotFrequencyInHour ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._applicationConsistentSnapshotFrequencyInHour) : null, "applicationConsistentSnapshotFrequencyInHours" ,container.Add ); + AddIf( null != (((object)this._compression)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._compression.ToString()) : null, "compression" ,container.Add ); + AddIf( null != (((object)this._initialReplicationMethod)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._initialReplicationMethod.ToString()) : null, "initialReplicationMethod" ,container.Add ); + AddIf( null != (((object)this._onlineReplicationStartTime)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._onlineReplicationStartTime.ToString()) : null, "onlineReplicationStartTime" ,container.Add ); + AddIf( null != (((object)this._offlineReplicationImportPath)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._offlineReplicationImportPath.ToString()) : null, "offlineReplicationImportPath" ,container.Add ); + AddIf( null != (((object)this._offlineReplicationExportPath)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._offlineReplicationExportPath.ToString()) : null, "offlineReplicationExportPath" ,container.Add ); + AddIf( null != this._replicationPort ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._replicationPort) : null, "replicationPort" ,container.Add ); + AddIf( null != this._allowedAuthenticationType ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._allowedAuthenticationType) : null, "allowedAuthenticationType" ,container.Add ); + AddIf( null != (((object)this._replicaDeletionOption)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._replicaDeletionOption.ToString()) : null, "replicaDeletionOption" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaBaseReplicationDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaBaseReplicationDetails.PowerShell.cs new file mode 100644 index 000000000000..78fc2f6e6aa8 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaBaseReplicationDetails.PowerShell.cs @@ -0,0 +1,220 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Hyper V replica provider specific settings base class. + [System.ComponentModel.TypeConverter(typeof(HyperVReplicaBaseReplicationDetailsTypeConverter))] + public partial class HyperVReplicaBaseReplicationDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBaseReplicationDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new HyperVReplicaBaseReplicationDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBaseReplicationDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new HyperVReplicaBaseReplicationDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBaseReplicationDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal HyperVReplicaBaseReplicationDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InitialReplicationDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBaseReplicationDetailsInternal)this).InitialReplicationDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInitialReplicationDetails) content.GetValueForProperty("InitialReplicationDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBaseReplicationDetailsInternal)this).InitialReplicationDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InitialReplicationDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("LastReplicatedTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBaseReplicationDetailsInternal)this).LastReplicatedTime = (global::System.DateTime?) content.GetValueForProperty("LastReplicatedTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBaseReplicationDetailsInternal)this).LastReplicatedTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("VMNic")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBaseReplicationDetailsInternal)this).VMNic = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetails[]) content.GetValueForProperty("VMNic",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBaseReplicationDetailsInternal)this).VMNic, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMNicDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("VMId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBaseReplicationDetailsInternal)this).VMId = (string) content.GetValueForProperty("VMId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBaseReplicationDetailsInternal)this).VMId, global::System.Convert.ToString); + } + if (content.Contains("VMProtectionState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBaseReplicationDetailsInternal)this).VMProtectionState = (string) content.GetValueForProperty("VMProtectionState",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBaseReplicationDetailsInternal)this).VMProtectionState, global::System.Convert.ToString); + } + if (content.Contains("VMProtectionStateDescription")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBaseReplicationDetailsInternal)this).VMProtectionStateDescription = (string) content.GetValueForProperty("VMProtectionStateDescription",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBaseReplicationDetailsInternal)this).VMProtectionStateDescription, global::System.Convert.ToString); + } + if (content.Contains("VMDiskDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBaseReplicationDetailsInternal)this).VMDiskDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskDetails[]) content.GetValueForProperty("VMDiskDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBaseReplicationDetailsInternal)this).VMDiskDetail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DiskDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettingsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettingsInternal)this).InstanceType, global::System.Convert.ToString); + } + if (content.Contains("InitialReplicationDetailInitialReplicationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBaseReplicationDetailsInternal)this).InitialReplicationDetailInitialReplicationType = (string) content.GetValueForProperty("InitialReplicationDetailInitialReplicationType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBaseReplicationDetailsInternal)this).InitialReplicationDetailInitialReplicationType, global::System.Convert.ToString); + } + if (content.Contains("InitialReplicationDetailInitialReplicationProgressPercentage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBaseReplicationDetailsInternal)this).InitialReplicationDetailInitialReplicationProgressPercentage = (string) content.GetValueForProperty("InitialReplicationDetailInitialReplicationProgressPercentage",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBaseReplicationDetailsInternal)this).InitialReplicationDetailInitialReplicationProgressPercentage, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal HyperVReplicaBaseReplicationDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InitialReplicationDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBaseReplicationDetailsInternal)this).InitialReplicationDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInitialReplicationDetails) content.GetValueForProperty("InitialReplicationDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBaseReplicationDetailsInternal)this).InitialReplicationDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InitialReplicationDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("LastReplicatedTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBaseReplicationDetailsInternal)this).LastReplicatedTime = (global::System.DateTime?) content.GetValueForProperty("LastReplicatedTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBaseReplicationDetailsInternal)this).LastReplicatedTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("VMNic")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBaseReplicationDetailsInternal)this).VMNic = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetails[]) content.GetValueForProperty("VMNic",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBaseReplicationDetailsInternal)this).VMNic, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMNicDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("VMId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBaseReplicationDetailsInternal)this).VMId = (string) content.GetValueForProperty("VMId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBaseReplicationDetailsInternal)this).VMId, global::System.Convert.ToString); + } + if (content.Contains("VMProtectionState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBaseReplicationDetailsInternal)this).VMProtectionState = (string) content.GetValueForProperty("VMProtectionState",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBaseReplicationDetailsInternal)this).VMProtectionState, global::System.Convert.ToString); + } + if (content.Contains("VMProtectionStateDescription")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBaseReplicationDetailsInternal)this).VMProtectionStateDescription = (string) content.GetValueForProperty("VMProtectionStateDescription",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBaseReplicationDetailsInternal)this).VMProtectionStateDescription, global::System.Convert.ToString); + } + if (content.Contains("VMDiskDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBaseReplicationDetailsInternal)this).VMDiskDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskDetails[]) content.GetValueForProperty("VMDiskDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBaseReplicationDetailsInternal)this).VMDiskDetail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DiskDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettingsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettingsInternal)this).InstanceType, global::System.Convert.ToString); + } + if (content.Contains("InitialReplicationDetailInitialReplicationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBaseReplicationDetailsInternal)this).InitialReplicationDetailInitialReplicationType = (string) content.GetValueForProperty("InitialReplicationDetailInitialReplicationType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBaseReplicationDetailsInternal)this).InitialReplicationDetailInitialReplicationType, global::System.Convert.ToString); + } + if (content.Contains("InitialReplicationDetailInitialReplicationProgressPercentage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBaseReplicationDetailsInternal)this).InitialReplicationDetailInitialReplicationProgressPercentage = (string) content.GetValueForProperty("InitialReplicationDetailInitialReplicationProgressPercentage",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBaseReplicationDetailsInternal)this).InitialReplicationDetailInitialReplicationProgressPercentage, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Hyper V replica provider specific settings base class. + [System.ComponentModel.TypeConverter(typeof(HyperVReplicaBaseReplicationDetailsTypeConverter))] + public partial interface IHyperVReplicaBaseReplicationDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaBaseReplicationDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaBaseReplicationDetails.TypeConverter.cs new file mode 100644 index 000000000000..916e5718cf8d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaBaseReplicationDetails.TypeConverter.cs @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class HyperVReplicaBaseReplicationDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBaseReplicationDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBaseReplicationDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return HyperVReplicaBaseReplicationDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return HyperVReplicaBaseReplicationDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return HyperVReplicaBaseReplicationDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaBaseReplicationDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaBaseReplicationDetails.cs new file mode 100644 index 000000000000..5a23722eda25 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaBaseReplicationDetails.cs @@ -0,0 +1,199 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Hyper V replica provider specific settings base class. + public partial class HyperVReplicaBaseReplicationDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBaseReplicationDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBaseReplicationDetailsInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettings __replicationProviderSpecificSettings = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProviderSpecificSettings(); + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInitialReplicationDetails _initialReplicationDetail; + + /// Initial replication details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInitialReplicationDetails InitialReplicationDetail { get => (this._initialReplicationDetail = this._initialReplicationDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InitialReplicationDetails()); set => this._initialReplicationDetail = value; } + + /// The initial replication progress percentage. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string InitialReplicationDetailInitialReplicationProgressPercentage { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInitialReplicationDetailsInternal)InitialReplicationDetail).InitialReplicationProgressPercentage; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInitialReplicationDetailsInternal)InitialReplicationDetail).InitialReplicationProgressPercentage = value ?? null; } + + /// Initial replication type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string InitialReplicationDetailInitialReplicationType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInitialReplicationDetailsInternal)InitialReplicationDetail).InitialReplicationType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInitialReplicationDetailsInternal)InitialReplicationDetail).InitialReplicationType = value ?? null; } + + /// Gets the Instance type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettingsInternal)__replicationProviderSpecificSettings).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettingsInternal)__replicationProviderSpecificSettings).InstanceType = value ; } + + /// Backing field for property. + private global::System.DateTime? _lastReplicatedTime; + + /// The Last replication time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public global::System.DateTime? LastReplicatedTime { get => this._lastReplicatedTime; set => this._lastReplicatedTime = value; } + + /// Internal Acessors for InitialReplicationDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInitialReplicationDetails Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBaseReplicationDetailsInternal.InitialReplicationDetail { get => (this._initialReplicationDetail = this._initialReplicationDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InitialReplicationDetails()); set { {_initialReplicationDetail = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskDetails[] _vMDiskDetail; + + /// VM disk details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskDetails[] VMDiskDetail { get => this._vMDiskDetail; set => this._vMDiskDetail = value; } + + /// Backing field for property. + private string _vMId; + + /// The virtual machine Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string VMId { get => this._vMId; set => this._vMId = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetails[] _vMNic; + + /// The PE Network details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetails[] VMNic { get => this._vMNic; set => this._vMNic = value; } + + /// Backing field for property. + private string _vMProtectionState; + + /// The protection state for the vm. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string VMProtectionState { get => this._vMProtectionState; set => this._vMProtectionState = value; } + + /// Backing field for property. + private string _vMProtectionStateDescription; + + /// The protection state description for the vm. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string VMProtectionStateDescription { get => this._vMProtectionStateDescription; set => this._vMProtectionStateDescription = value; } + + /// Creates an new instance. + public HyperVReplicaBaseReplicationDetails() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__replicationProviderSpecificSettings), __replicationProviderSpecificSettings); + await eventListener.AssertObjectIsValid(nameof(__replicationProviderSpecificSettings), __replicationProviderSpecificSettings); + } + } + /// Hyper V replica provider specific settings base class. + public partial interface IHyperVReplicaBaseReplicationDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettings + { + /// The initial replication progress percentage. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The initial replication progress percentage.", + SerializedName = @"initialReplicationProgressPercentage", + PossibleTypes = new [] { typeof(string) })] + string InitialReplicationDetailInitialReplicationProgressPercentage { get; set; } + /// Initial replication type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Initial replication type.", + SerializedName = @"initialReplicationType", + PossibleTypes = new [] { typeof(string) })] + string InitialReplicationDetailInitialReplicationType { get; set; } + /// The Last replication time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Last replication time.", + SerializedName = @"lastReplicatedTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? LastReplicatedTime { get; set; } + /// VM disk details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"VM disk details.", + SerializedName = @"vMDiskDetails", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskDetails) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskDetails[] VMDiskDetail { get; set; } + /// The virtual machine Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The virtual machine Id.", + SerializedName = @"vmId", + PossibleTypes = new [] { typeof(string) })] + string VMId { get; set; } + /// The PE Network details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The PE Network details.", + SerializedName = @"vmNics", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetails) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetails[] VMNic { get; set; } + /// The protection state for the vm. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The protection state for the vm.", + SerializedName = @"vmProtectionState", + PossibleTypes = new [] { typeof(string) })] + string VMProtectionState { get; set; } + /// The protection state description for the vm. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The protection state description for the vm.", + SerializedName = @"vmProtectionStateDescription", + PossibleTypes = new [] { typeof(string) })] + string VMProtectionStateDescription { get; set; } + + } + /// Hyper V replica provider specific settings base class. + internal partial interface IHyperVReplicaBaseReplicationDetailsInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettingsInternal + { + /// Initial replication details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInitialReplicationDetails InitialReplicationDetail { get; set; } + /// The initial replication progress percentage. + string InitialReplicationDetailInitialReplicationProgressPercentage { get; set; } + /// Initial replication type. + string InitialReplicationDetailInitialReplicationType { get; set; } + /// The Last replication time. + global::System.DateTime? LastReplicatedTime { get; set; } + /// VM disk details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskDetails[] VMDiskDetail { get; set; } + /// The virtual machine Id. + string VMId { get; set; } + /// The PE Network details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetails[] VMNic { get; set; } + /// The protection state for the vm. + string VMProtectionState { get; set; } + /// The protection state description for the vm. + string VMProtectionStateDescription { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaBaseReplicationDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaBaseReplicationDetails.json.cs new file mode 100644 index 000000000000..00f93259e5cb --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaBaseReplicationDetails.json.cs @@ -0,0 +1,139 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Hyper V replica provider specific settings base class. + public partial class HyperVReplicaBaseReplicationDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBaseReplicationDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBaseReplicationDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBaseReplicationDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new HyperVReplicaBaseReplicationDetails(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal HyperVReplicaBaseReplicationDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __replicationProviderSpecificSettings = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProviderSpecificSettings(json); + {_initialReplicationDetail = If( json?.PropertyT("initialReplicationDetails"), out var __jsonInitialReplicationDetails) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InitialReplicationDetails.FromJson(__jsonInitialReplicationDetails) : InitialReplicationDetail;} + {_lastReplicatedTime = If( json?.PropertyT("lastReplicatedTime"), out var __jsonLastReplicatedTime) ? global::System.DateTime.TryParse((string)__jsonLastReplicatedTime, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonLastReplicatedTimeValue) ? __jsonLastReplicatedTimeValue : LastReplicatedTime : LastReplicatedTime;} + {_vMNic = If( json?.PropertyT("vmNics"), out var __jsonVMNics) ? If( __jsonVMNics as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetails) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMNicDetails.FromJson(__u) )) ))() : null : VMNic;} + {_vMId = If( json?.PropertyT("vmId"), out var __jsonVMId) ? (string)__jsonVMId : (string)VMId;} + {_vMProtectionState = If( json?.PropertyT("vmProtectionState"), out var __jsonVMProtectionState) ? (string)__jsonVMProtectionState : (string)VMProtectionState;} + {_vMProtectionStateDescription = If( json?.PropertyT("vmProtectionStateDescription"), out var __jsonVMProtectionStateDescription) ? (string)__jsonVMProtectionStateDescription : (string)VMProtectionStateDescription;} + {_vMDiskDetail = If( json?.PropertyT("vMDiskDetails"), out var __jsonVMDiskDetails) ? If( __jsonVMDiskDetails as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __q) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__q, (__p)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskDetails) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DiskDetails.FromJson(__p) )) ))() : null : VMDiskDetail;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __replicationProviderSpecificSettings?.ToJson(container, serializationMode); + AddIf( null != this._initialReplicationDetail ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._initialReplicationDetail.ToJson(null,serializationMode) : null, "initialReplicationDetails" ,container.Add ); + AddIf( null != this._lastReplicatedTime ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._lastReplicatedTime?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "lastReplicatedTime" ,container.Add ); + if (null != this._vMNic) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._vMNic ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("vmNics",__w); + } + AddIf( null != (((object)this._vMId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._vMId.ToString()) : null, "vmId" ,container.Add ); + AddIf( null != (((object)this._vMProtectionState)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._vMProtectionState.ToString()) : null, "vmProtectionState" ,container.Add ); + AddIf( null != (((object)this._vMProtectionStateDescription)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._vMProtectionStateDescription.ToString()) : null, "vmProtectionStateDescription" ,container.Add ); + if (null != this._vMDiskDetail) + { + var __r = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __s in this._vMDiskDetail ) + { + AddIf(__s?.ToJson(null, serializationMode) ,__r.Add); + } + container.Add("vMDiskDetails",__r); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaBluePolicyDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaBluePolicyDetails.PowerShell.cs new file mode 100644 index 000000000000..b8350d8fc01d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaBluePolicyDetails.PowerShell.cs @@ -0,0 +1,234 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Hyper-V Replica Blue specific protection profile details. + [System.ComponentModel.TypeConverter(typeof(HyperVReplicaBluePolicyDetailsTypeConverter))] + public partial class HyperVReplicaBluePolicyDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBluePolicyDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new HyperVReplicaBluePolicyDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBluePolicyDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new HyperVReplicaBluePolicyDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBluePolicyDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal HyperVReplicaBluePolicyDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ReplicationFrequencyInSecond")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBluePolicyDetailsInternal)this).ReplicationFrequencyInSecond = (int?) content.GetValueForProperty("ReplicationFrequencyInSecond",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBluePolicyDetailsInternal)this).ReplicationFrequencyInSecond, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("RecoveryPoint")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBluePolicyDetailsInternal)this).RecoveryPoint = (int?) content.GetValueForProperty("RecoveryPoint",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBluePolicyDetailsInternal)this).RecoveryPoint, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("ApplicationConsistentSnapshotFrequencyInHour")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBluePolicyDetailsInternal)this).ApplicationConsistentSnapshotFrequencyInHour = (int?) content.GetValueForProperty("ApplicationConsistentSnapshotFrequencyInHour",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBluePolicyDetailsInternal)this).ApplicationConsistentSnapshotFrequencyInHour, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("Compression")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBluePolicyDetailsInternal)this).Compression = (string) content.GetValueForProperty("Compression",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBluePolicyDetailsInternal)this).Compression, global::System.Convert.ToString); + } + if (content.Contains("InitialReplicationMethod")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBluePolicyDetailsInternal)this).InitialReplicationMethod = (string) content.GetValueForProperty("InitialReplicationMethod",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBluePolicyDetailsInternal)this).InitialReplicationMethod, global::System.Convert.ToString); + } + if (content.Contains("OnlineReplicationStartTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBluePolicyDetailsInternal)this).OnlineReplicationStartTime = (string) content.GetValueForProperty("OnlineReplicationStartTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBluePolicyDetailsInternal)this).OnlineReplicationStartTime, global::System.Convert.ToString); + } + if (content.Contains("OfflineReplicationImportPath")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBluePolicyDetailsInternal)this).OfflineReplicationImportPath = (string) content.GetValueForProperty("OfflineReplicationImportPath",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBluePolicyDetailsInternal)this).OfflineReplicationImportPath, global::System.Convert.ToString); + } + if (content.Contains("OfflineReplicationExportPath")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBluePolicyDetailsInternal)this).OfflineReplicationExportPath = (string) content.GetValueForProperty("OfflineReplicationExportPath",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBluePolicyDetailsInternal)this).OfflineReplicationExportPath, global::System.Convert.ToString); + } + if (content.Contains("ReplicationPort")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBluePolicyDetailsInternal)this).ReplicationPort = (int?) content.GetValueForProperty("ReplicationPort",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBluePolicyDetailsInternal)this).ReplicationPort, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("AllowedAuthenticationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBluePolicyDetailsInternal)this).AllowedAuthenticationType = (int?) content.GetValueForProperty("AllowedAuthenticationType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBluePolicyDetailsInternal)this).AllowedAuthenticationType, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("ReplicaDeletionOption")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBluePolicyDetailsInternal)this).ReplicaDeletionOption = (string) content.GetValueForProperty("ReplicaDeletionOption",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBluePolicyDetailsInternal)this).ReplicaDeletionOption, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal HyperVReplicaBluePolicyDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ReplicationFrequencyInSecond")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBluePolicyDetailsInternal)this).ReplicationFrequencyInSecond = (int?) content.GetValueForProperty("ReplicationFrequencyInSecond",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBluePolicyDetailsInternal)this).ReplicationFrequencyInSecond, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("RecoveryPoint")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBluePolicyDetailsInternal)this).RecoveryPoint = (int?) content.GetValueForProperty("RecoveryPoint",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBluePolicyDetailsInternal)this).RecoveryPoint, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("ApplicationConsistentSnapshotFrequencyInHour")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBluePolicyDetailsInternal)this).ApplicationConsistentSnapshotFrequencyInHour = (int?) content.GetValueForProperty("ApplicationConsistentSnapshotFrequencyInHour",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBluePolicyDetailsInternal)this).ApplicationConsistentSnapshotFrequencyInHour, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("Compression")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBluePolicyDetailsInternal)this).Compression = (string) content.GetValueForProperty("Compression",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBluePolicyDetailsInternal)this).Compression, global::System.Convert.ToString); + } + if (content.Contains("InitialReplicationMethod")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBluePolicyDetailsInternal)this).InitialReplicationMethod = (string) content.GetValueForProperty("InitialReplicationMethod",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBluePolicyDetailsInternal)this).InitialReplicationMethod, global::System.Convert.ToString); + } + if (content.Contains("OnlineReplicationStartTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBluePolicyDetailsInternal)this).OnlineReplicationStartTime = (string) content.GetValueForProperty("OnlineReplicationStartTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBluePolicyDetailsInternal)this).OnlineReplicationStartTime, global::System.Convert.ToString); + } + if (content.Contains("OfflineReplicationImportPath")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBluePolicyDetailsInternal)this).OfflineReplicationImportPath = (string) content.GetValueForProperty("OfflineReplicationImportPath",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBluePolicyDetailsInternal)this).OfflineReplicationImportPath, global::System.Convert.ToString); + } + if (content.Contains("OfflineReplicationExportPath")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBluePolicyDetailsInternal)this).OfflineReplicationExportPath = (string) content.GetValueForProperty("OfflineReplicationExportPath",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBluePolicyDetailsInternal)this).OfflineReplicationExportPath, global::System.Convert.ToString); + } + if (content.Contains("ReplicationPort")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBluePolicyDetailsInternal)this).ReplicationPort = (int?) content.GetValueForProperty("ReplicationPort",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBluePolicyDetailsInternal)this).ReplicationPort, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("AllowedAuthenticationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBluePolicyDetailsInternal)this).AllowedAuthenticationType = (int?) content.GetValueForProperty("AllowedAuthenticationType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBluePolicyDetailsInternal)this).AllowedAuthenticationType, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("ReplicaDeletionOption")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBluePolicyDetailsInternal)this).ReplicaDeletionOption = (string) content.GetValueForProperty("ReplicaDeletionOption",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBluePolicyDetailsInternal)this).ReplicaDeletionOption, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Hyper-V Replica Blue specific protection profile details. + [System.ComponentModel.TypeConverter(typeof(HyperVReplicaBluePolicyDetailsTypeConverter))] + public partial interface IHyperVReplicaBluePolicyDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaBluePolicyDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaBluePolicyDetails.TypeConverter.cs new file mode 100644 index 000000000000..1c8c95eebc52 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaBluePolicyDetails.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class HyperVReplicaBluePolicyDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBluePolicyDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBluePolicyDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return HyperVReplicaBluePolicyDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return HyperVReplicaBluePolicyDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return HyperVReplicaBluePolicyDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaBluePolicyDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaBluePolicyDetails.cs new file mode 100644 index 000000000000..e5a9d3dda441 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaBluePolicyDetails.cs @@ -0,0 +1,252 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Hyper-V Replica Blue specific protection profile details. + public partial class HyperVReplicaBluePolicyDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBluePolicyDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBluePolicyDetailsInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetails __policyProviderSpecificDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PolicyProviderSpecificDetails(); + + /// Backing field for property. + private int? _allowedAuthenticationType; + + /// A value indicating the authentication type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? AllowedAuthenticationType { get => this._allowedAuthenticationType; set => this._allowedAuthenticationType = value; } + + /// + /// Backing field for property. + /// + private int? _applicationConsistentSnapshotFrequencyInHour; + + /// A value indicating the application consistent frequency. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? ApplicationConsistentSnapshotFrequencyInHour { get => this._applicationConsistentSnapshotFrequencyInHour; set => this._applicationConsistentSnapshotFrequencyInHour = value; } + + /// Backing field for property. + private string _compression; + + /// A value indicating whether compression has to be enabled. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Compression { get => this._compression; set => this._compression = value; } + + /// Backing field for property. + private string _initialReplicationMethod; + + /// A value indicating whether IR is online. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string InitialReplicationMethod { get => this._initialReplicationMethod; set => this._initialReplicationMethod = value; } + + /// Gets the class type. Overridden in derived classes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetailsInternal)__policyProviderSpecificDetails).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetailsInternal)__policyProviderSpecificDetails).InstanceType = value ; } + + /// Backing field for property. + private string _offlineReplicationExportPath; + + /// A value indicating the offline IR export path. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string OfflineReplicationExportPath { get => this._offlineReplicationExportPath; set => this._offlineReplicationExportPath = value; } + + /// Backing field for property. + private string _offlineReplicationImportPath; + + /// A value indicating the offline IR import path. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string OfflineReplicationImportPath { get => this._offlineReplicationImportPath; set => this._offlineReplicationImportPath = value; } + + /// Backing field for property. + private string _onlineReplicationStartTime; + + /// A value indicating the online IR start time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string OnlineReplicationStartTime { get => this._onlineReplicationStartTime; set => this._onlineReplicationStartTime = value; } + + /// Backing field for property. + private int? _recoveryPoint; + + /// A value indicating the number of recovery points. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? RecoveryPoint { get => this._recoveryPoint; set => this._recoveryPoint = value; } + + /// Backing field for property. + private string _replicaDeletionOption; + + /// + /// A value indicating whether the VM has to be auto deleted. Supported Values: String.Empty, None, OnRecoveryCloud + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ReplicaDeletionOption { get => this._replicaDeletionOption; set => this._replicaDeletionOption = value; } + + /// Backing field for property. + private int? _replicationFrequencyInSecond; + + /// A value indicating the replication interval. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? ReplicationFrequencyInSecond { get => this._replicationFrequencyInSecond; set => this._replicationFrequencyInSecond = value; } + + /// Backing field for property. + private int? _replicationPort; + + /// A value indicating the recovery HTTPS port. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? ReplicationPort { get => this._replicationPort; set => this._replicationPort = value; } + + /// Creates an new instance. + public HyperVReplicaBluePolicyDetails() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__policyProviderSpecificDetails), __policyProviderSpecificDetails); + await eventListener.AssertObjectIsValid(nameof(__policyProviderSpecificDetails), __policyProviderSpecificDetails); + } + } + /// Hyper-V Replica Blue specific protection profile details. + public partial interface IHyperVReplicaBluePolicyDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetails + { + /// A value indicating the authentication type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating the authentication type.", + SerializedName = @"allowedAuthenticationType", + PossibleTypes = new [] { typeof(int) })] + int? AllowedAuthenticationType { get; set; } + /// A value indicating the application consistent frequency. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating the application consistent frequency.", + SerializedName = @"applicationConsistentSnapshotFrequencyInHours", + PossibleTypes = new [] { typeof(int) })] + int? ApplicationConsistentSnapshotFrequencyInHour { get; set; } + /// A value indicating whether compression has to be enabled. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether compression has to be enabled.", + SerializedName = @"compression", + PossibleTypes = new [] { typeof(string) })] + string Compression { get; set; } + /// A value indicating whether IR is online. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether IR is online.", + SerializedName = @"initialReplicationMethod", + PossibleTypes = new [] { typeof(string) })] + string InitialReplicationMethod { get; set; } + /// A value indicating the offline IR export path. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating the offline IR export path.", + SerializedName = @"offlineReplicationExportPath", + PossibleTypes = new [] { typeof(string) })] + string OfflineReplicationExportPath { get; set; } + /// A value indicating the offline IR import path. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating the offline IR import path.", + SerializedName = @"offlineReplicationImportPath", + PossibleTypes = new [] { typeof(string) })] + string OfflineReplicationImportPath { get; set; } + /// A value indicating the online IR start time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating the online IR start time.", + SerializedName = @"onlineReplicationStartTime", + PossibleTypes = new [] { typeof(string) })] + string OnlineReplicationStartTime { get; set; } + /// A value indicating the number of recovery points. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating the number of recovery points.", + SerializedName = @"recoveryPoints", + PossibleTypes = new [] { typeof(int) })] + int? RecoveryPoint { get; set; } + /// + /// A value indicating whether the VM has to be auto deleted. Supported Values: String.Empty, None, OnRecoveryCloud + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether the VM has to be auto deleted. Supported Values: String.Empty, None, OnRecoveryCloud", + SerializedName = @"replicaDeletionOption", + PossibleTypes = new [] { typeof(string) })] + string ReplicaDeletionOption { get; set; } + /// A value indicating the replication interval. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating the replication interval.", + SerializedName = @"replicationFrequencyInSeconds", + PossibleTypes = new [] { typeof(int) })] + int? ReplicationFrequencyInSecond { get; set; } + /// A value indicating the recovery HTTPS port. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating the recovery HTTPS port.", + SerializedName = @"replicationPort", + PossibleTypes = new [] { typeof(int) })] + int? ReplicationPort { get; set; } + + } + /// Hyper-V Replica Blue specific protection profile details. + internal partial interface IHyperVReplicaBluePolicyDetailsInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetailsInternal + { + /// A value indicating the authentication type. + int? AllowedAuthenticationType { get; set; } + /// A value indicating the application consistent frequency. + int? ApplicationConsistentSnapshotFrequencyInHour { get; set; } + /// A value indicating whether compression has to be enabled. + string Compression { get; set; } + /// A value indicating whether IR is online. + string InitialReplicationMethod { get; set; } + /// A value indicating the offline IR export path. + string OfflineReplicationExportPath { get; set; } + /// A value indicating the offline IR import path. + string OfflineReplicationImportPath { get; set; } + /// A value indicating the online IR start time. + string OnlineReplicationStartTime { get; set; } + /// A value indicating the number of recovery points. + int? RecoveryPoint { get; set; } + /// + /// A value indicating whether the VM has to be auto deleted. Supported Values: String.Empty, None, OnRecoveryCloud + /// + string ReplicaDeletionOption { get; set; } + /// A value indicating the replication interval. + int? ReplicationFrequencyInSecond { get; set; } + /// A value indicating the recovery HTTPS port. + int? ReplicationPort { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaBluePolicyDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaBluePolicyDetails.json.cs new file mode 100644 index 000000000000..510b5f433969 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaBluePolicyDetails.json.cs @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Hyper-V Replica Blue specific protection profile details. + public partial class HyperVReplicaBluePolicyDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBluePolicyDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBluePolicyDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBluePolicyDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new HyperVReplicaBluePolicyDetails(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal HyperVReplicaBluePolicyDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __policyProviderSpecificDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PolicyProviderSpecificDetails(json); + {_replicationFrequencyInSecond = If( json?.PropertyT("replicationFrequencyInSeconds"), out var __jsonReplicationFrequencyInSeconds) ? (int?)__jsonReplicationFrequencyInSeconds : ReplicationFrequencyInSecond;} + {_recoveryPoint = If( json?.PropertyT("recoveryPoints"), out var __jsonRecoveryPoints) ? (int?)__jsonRecoveryPoints : RecoveryPoint;} + {_applicationConsistentSnapshotFrequencyInHour = If( json?.PropertyT("applicationConsistentSnapshotFrequencyInHours"), out var __jsonApplicationConsistentSnapshotFrequencyInHours) ? (int?)__jsonApplicationConsistentSnapshotFrequencyInHours : ApplicationConsistentSnapshotFrequencyInHour;} + {_compression = If( json?.PropertyT("compression"), out var __jsonCompression) ? (string)__jsonCompression : (string)Compression;} + {_initialReplicationMethod = If( json?.PropertyT("initialReplicationMethod"), out var __jsonInitialReplicationMethod) ? (string)__jsonInitialReplicationMethod : (string)InitialReplicationMethod;} + {_onlineReplicationStartTime = If( json?.PropertyT("onlineReplicationStartTime"), out var __jsonOnlineReplicationStartTime) ? (string)__jsonOnlineReplicationStartTime : (string)OnlineReplicationStartTime;} + {_offlineReplicationImportPath = If( json?.PropertyT("offlineReplicationImportPath"), out var __jsonOfflineReplicationImportPath) ? (string)__jsonOfflineReplicationImportPath : (string)OfflineReplicationImportPath;} + {_offlineReplicationExportPath = If( json?.PropertyT("offlineReplicationExportPath"), out var __jsonOfflineReplicationExportPath) ? (string)__jsonOfflineReplicationExportPath : (string)OfflineReplicationExportPath;} + {_replicationPort = If( json?.PropertyT("replicationPort"), out var __jsonReplicationPort) ? (int?)__jsonReplicationPort : ReplicationPort;} + {_allowedAuthenticationType = If( json?.PropertyT("allowedAuthenticationType"), out var __jsonAllowedAuthenticationType) ? (int?)__jsonAllowedAuthenticationType : AllowedAuthenticationType;} + {_replicaDeletionOption = If( json?.PropertyT("replicaDeletionOption"), out var __jsonReplicaDeletionOption) ? (string)__jsonReplicaDeletionOption : (string)ReplicaDeletionOption;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __policyProviderSpecificDetails?.ToJson(container, serializationMode); + AddIf( null != this._replicationFrequencyInSecond ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._replicationFrequencyInSecond) : null, "replicationFrequencyInSeconds" ,container.Add ); + AddIf( null != this._recoveryPoint ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._recoveryPoint) : null, "recoveryPoints" ,container.Add ); + AddIf( null != this._applicationConsistentSnapshotFrequencyInHour ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._applicationConsistentSnapshotFrequencyInHour) : null, "applicationConsistentSnapshotFrequencyInHours" ,container.Add ); + AddIf( null != (((object)this._compression)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._compression.ToString()) : null, "compression" ,container.Add ); + AddIf( null != (((object)this._initialReplicationMethod)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._initialReplicationMethod.ToString()) : null, "initialReplicationMethod" ,container.Add ); + AddIf( null != (((object)this._onlineReplicationStartTime)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._onlineReplicationStartTime.ToString()) : null, "onlineReplicationStartTime" ,container.Add ); + AddIf( null != (((object)this._offlineReplicationImportPath)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._offlineReplicationImportPath.ToString()) : null, "offlineReplicationImportPath" ,container.Add ); + AddIf( null != (((object)this._offlineReplicationExportPath)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._offlineReplicationExportPath.ToString()) : null, "offlineReplicationExportPath" ,container.Add ); + AddIf( null != this._replicationPort ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._replicationPort) : null, "replicationPort" ,container.Add ); + AddIf( null != this._allowedAuthenticationType ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._allowedAuthenticationType) : null, "allowedAuthenticationType" ,container.Add ); + AddIf( null != (((object)this._replicaDeletionOption)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._replicaDeletionOption.ToString()) : null, "replicaDeletionOption" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaBluePolicyInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaBluePolicyInput.PowerShell.cs new file mode 100644 index 000000000000..ee900086c357 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaBluePolicyInput.PowerShell.cs @@ -0,0 +1,234 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// HyperV Replica Blue policy input. + [System.ComponentModel.TypeConverter(typeof(HyperVReplicaBluePolicyInputTypeConverter))] + public partial class HyperVReplicaBluePolicyInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBluePolicyInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new HyperVReplicaBluePolicyInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBluePolicyInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new HyperVReplicaBluePolicyInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBluePolicyInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal HyperVReplicaBluePolicyInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ReplicationFrequencyInSecond")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBluePolicyInputInternal)this).ReplicationFrequencyInSecond = (int?) content.GetValueForProperty("ReplicationFrequencyInSecond",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBluePolicyInputInternal)this).ReplicationFrequencyInSecond, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + if (content.Contains("RecoveryPoint")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal)this).RecoveryPoint = (int?) content.GetValueForProperty("RecoveryPoint",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal)this).RecoveryPoint, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("ApplicationConsistentSnapshotFrequencyInHour")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal)this).ApplicationConsistentSnapshotFrequencyInHour = (int?) content.GetValueForProperty("ApplicationConsistentSnapshotFrequencyInHour",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal)this).ApplicationConsistentSnapshotFrequencyInHour, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("Compression")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal)this).Compression = (string) content.GetValueForProperty("Compression",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal)this).Compression, global::System.Convert.ToString); + } + if (content.Contains("InitialReplicationMethod")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal)this).InitialReplicationMethod = (string) content.GetValueForProperty("InitialReplicationMethod",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal)this).InitialReplicationMethod, global::System.Convert.ToString); + } + if (content.Contains("OnlineReplicationStartTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal)this).OnlineReplicationStartTime = (string) content.GetValueForProperty("OnlineReplicationStartTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal)this).OnlineReplicationStartTime, global::System.Convert.ToString); + } + if (content.Contains("OfflineReplicationImportPath")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal)this).OfflineReplicationImportPath = (string) content.GetValueForProperty("OfflineReplicationImportPath",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal)this).OfflineReplicationImportPath, global::System.Convert.ToString); + } + if (content.Contains("OfflineReplicationExportPath")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal)this).OfflineReplicationExportPath = (string) content.GetValueForProperty("OfflineReplicationExportPath",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal)this).OfflineReplicationExportPath, global::System.Convert.ToString); + } + if (content.Contains("ReplicationPort")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal)this).ReplicationPort = (int?) content.GetValueForProperty("ReplicationPort",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal)this).ReplicationPort, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("AllowedAuthenticationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal)this).AllowedAuthenticationType = (int?) content.GetValueForProperty("AllowedAuthenticationType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal)this).AllowedAuthenticationType, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("ReplicaDeletion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal)this).ReplicaDeletion = (string) content.GetValueForProperty("ReplicaDeletion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal)this).ReplicaDeletion, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal HyperVReplicaBluePolicyInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ReplicationFrequencyInSecond")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBluePolicyInputInternal)this).ReplicationFrequencyInSecond = (int?) content.GetValueForProperty("ReplicationFrequencyInSecond",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBluePolicyInputInternal)this).ReplicationFrequencyInSecond, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + if (content.Contains("RecoveryPoint")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal)this).RecoveryPoint = (int?) content.GetValueForProperty("RecoveryPoint",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal)this).RecoveryPoint, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("ApplicationConsistentSnapshotFrequencyInHour")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal)this).ApplicationConsistentSnapshotFrequencyInHour = (int?) content.GetValueForProperty("ApplicationConsistentSnapshotFrequencyInHour",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal)this).ApplicationConsistentSnapshotFrequencyInHour, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("Compression")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal)this).Compression = (string) content.GetValueForProperty("Compression",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal)this).Compression, global::System.Convert.ToString); + } + if (content.Contains("InitialReplicationMethod")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal)this).InitialReplicationMethod = (string) content.GetValueForProperty("InitialReplicationMethod",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal)this).InitialReplicationMethod, global::System.Convert.ToString); + } + if (content.Contains("OnlineReplicationStartTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal)this).OnlineReplicationStartTime = (string) content.GetValueForProperty("OnlineReplicationStartTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal)this).OnlineReplicationStartTime, global::System.Convert.ToString); + } + if (content.Contains("OfflineReplicationImportPath")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal)this).OfflineReplicationImportPath = (string) content.GetValueForProperty("OfflineReplicationImportPath",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal)this).OfflineReplicationImportPath, global::System.Convert.ToString); + } + if (content.Contains("OfflineReplicationExportPath")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal)this).OfflineReplicationExportPath = (string) content.GetValueForProperty("OfflineReplicationExportPath",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal)this).OfflineReplicationExportPath, global::System.Convert.ToString); + } + if (content.Contains("ReplicationPort")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal)this).ReplicationPort = (int?) content.GetValueForProperty("ReplicationPort",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal)this).ReplicationPort, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("AllowedAuthenticationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal)this).AllowedAuthenticationType = (int?) content.GetValueForProperty("AllowedAuthenticationType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal)this).AllowedAuthenticationType, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("ReplicaDeletion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal)this).ReplicaDeletion = (string) content.GetValueForProperty("ReplicaDeletion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal)this).ReplicaDeletion, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// HyperV Replica Blue policy input. + [System.ComponentModel.TypeConverter(typeof(HyperVReplicaBluePolicyInputTypeConverter))] + public partial interface IHyperVReplicaBluePolicyInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaBluePolicyInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaBluePolicyInput.TypeConverter.cs new file mode 100644 index 000000000000..eb16b6a14cd1 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaBluePolicyInput.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class HyperVReplicaBluePolicyInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBluePolicyInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBluePolicyInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return HyperVReplicaBluePolicyInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return HyperVReplicaBluePolicyInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return HyperVReplicaBluePolicyInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaBluePolicyInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaBluePolicyInput.cs new file mode 100644 index 000000000000..863735088223 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaBluePolicyInput.cs @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// HyperV Replica Blue policy input. + public partial class HyperVReplicaBluePolicyInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBluePolicyInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBluePolicyInputInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInput __hyperVReplicaPolicyInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaPolicyInput(); + + /// A value indicating the authentication type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public int? AllowedAuthenticationType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal)__hyperVReplicaPolicyInput).AllowedAuthenticationType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal)__hyperVReplicaPolicyInput).AllowedAuthenticationType = value ?? default(int); } + + /// A value indicating the application consistent frequency. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public int? ApplicationConsistentSnapshotFrequencyInHour { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal)__hyperVReplicaPolicyInput).ApplicationConsistentSnapshotFrequencyInHour; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal)__hyperVReplicaPolicyInput).ApplicationConsistentSnapshotFrequencyInHour = value ?? default(int); } + + /// A value indicating whether compression has to be enabled. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string Compression { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal)__hyperVReplicaPolicyInput).Compression; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal)__hyperVReplicaPolicyInput).Compression = value ?? null; } + + /// A value indicating whether IR is online. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InitialReplicationMethod { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal)__hyperVReplicaPolicyInput).InitialReplicationMethod; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal)__hyperVReplicaPolicyInput).InitialReplicationMethod = value ?? null; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInputInternal)__hyperVReplicaPolicyInput).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInputInternal)__hyperVReplicaPolicyInput).InstanceType = value ; } + + /// A value indicating the offline IR export path. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string OfflineReplicationExportPath { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal)__hyperVReplicaPolicyInput).OfflineReplicationExportPath; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal)__hyperVReplicaPolicyInput).OfflineReplicationExportPath = value ?? null; } + + /// A value indicating the offline IR import path. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string OfflineReplicationImportPath { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal)__hyperVReplicaPolicyInput).OfflineReplicationImportPath; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal)__hyperVReplicaPolicyInput).OfflineReplicationImportPath = value ?? null; } + + /// A value indicating the online IR start time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string OnlineReplicationStartTime { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal)__hyperVReplicaPolicyInput).OnlineReplicationStartTime; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal)__hyperVReplicaPolicyInput).OnlineReplicationStartTime = value ?? null; } + + /// A value indicating the number of recovery points. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public int? RecoveryPoint { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal)__hyperVReplicaPolicyInput).RecoveryPoint; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal)__hyperVReplicaPolicyInput).RecoveryPoint = value ?? default(int); } + + /// A value indicating whether the VM has to be auto deleted. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string ReplicaDeletion { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal)__hyperVReplicaPolicyInput).ReplicaDeletion; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal)__hyperVReplicaPolicyInput).ReplicaDeletion = value ?? null; } + + /// Backing field for property. + private int? _replicationFrequencyInSecond; + + /// A value indicating the replication interval. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? ReplicationFrequencyInSecond { get => this._replicationFrequencyInSecond; set => this._replicationFrequencyInSecond = value; } + + /// A value indicating the recovery HTTPS port. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public int? ReplicationPort { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal)__hyperVReplicaPolicyInput).ReplicationPort; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal)__hyperVReplicaPolicyInput).ReplicationPort = value ?? default(int); } + + /// Creates an new instance. + public HyperVReplicaBluePolicyInput() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__hyperVReplicaPolicyInput), __hyperVReplicaPolicyInput); + await eventListener.AssertObjectIsValid(nameof(__hyperVReplicaPolicyInput), __hyperVReplicaPolicyInput); + } + } + /// HyperV Replica Blue policy input. + public partial interface IHyperVReplicaBluePolicyInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInput + { + /// A value indicating the replication interval. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating the replication interval.", + SerializedName = @"replicationFrequencyInSeconds", + PossibleTypes = new [] { typeof(int) })] + int? ReplicationFrequencyInSecond { get; set; } + + } + /// HyperV Replica Blue policy input. + internal partial interface IHyperVReplicaBluePolicyInputInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal + { + /// A value indicating the replication interval. + int? ReplicationFrequencyInSecond { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaBluePolicyInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaBluePolicyInput.json.cs new file mode 100644 index 000000000000..c3f46fc01339 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaBluePolicyInput.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// HyperV Replica Blue policy input. + public partial class HyperVReplicaBluePolicyInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBluePolicyInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBluePolicyInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBluePolicyInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new HyperVReplicaBluePolicyInput(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal HyperVReplicaBluePolicyInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __hyperVReplicaPolicyInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVReplicaPolicyInput(json); + {_replicationFrequencyInSecond = If( json?.PropertyT("replicationFrequencyInSeconds"), out var __jsonReplicationFrequencyInSeconds) ? (int?)__jsonReplicationFrequencyInSeconds : ReplicationFrequencyInSecond;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __hyperVReplicaPolicyInput?.ToJson(container, serializationMode); + AddIf( null != this._replicationFrequencyInSecond ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._replicationFrequencyInSecond) : null, "replicationFrequencyInSeconds" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaBlueReplicationDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaBlueReplicationDetails.PowerShell.cs new file mode 100644 index 000000000000..30e1ff526199 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaBlueReplicationDetails.PowerShell.cs @@ -0,0 +1,220 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// HyperV replica 2012 R2 (Blue) replication details. + [System.ComponentModel.TypeConverter(typeof(HyperVReplicaBlueReplicationDetailsTypeConverter))] + public partial class HyperVReplicaBlueReplicationDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBlueReplicationDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new HyperVReplicaBlueReplicationDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBlueReplicationDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new HyperVReplicaBlueReplicationDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBlueReplicationDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal HyperVReplicaBlueReplicationDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InitialReplicationDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBlueReplicationDetailsInternal)this).InitialReplicationDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInitialReplicationDetails) content.GetValueForProperty("InitialReplicationDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBlueReplicationDetailsInternal)this).InitialReplicationDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InitialReplicationDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("LastReplicatedTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBlueReplicationDetailsInternal)this).LastReplicatedTime = (global::System.DateTime?) content.GetValueForProperty("LastReplicatedTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBlueReplicationDetailsInternal)this).LastReplicatedTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("VMNic")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBlueReplicationDetailsInternal)this).VMNic = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetails[]) content.GetValueForProperty("VMNic",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBlueReplicationDetailsInternal)this).VMNic, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMNicDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("VMId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBlueReplicationDetailsInternal)this).VMId = (string) content.GetValueForProperty("VMId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBlueReplicationDetailsInternal)this).VMId, global::System.Convert.ToString); + } + if (content.Contains("VMProtectionState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBlueReplicationDetailsInternal)this).VMProtectionState = (string) content.GetValueForProperty("VMProtectionState",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBlueReplicationDetailsInternal)this).VMProtectionState, global::System.Convert.ToString); + } + if (content.Contains("VMProtectionStateDescription")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBlueReplicationDetailsInternal)this).VMProtectionStateDescription = (string) content.GetValueForProperty("VMProtectionStateDescription",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBlueReplicationDetailsInternal)this).VMProtectionStateDescription, global::System.Convert.ToString); + } + if (content.Contains("VMDiskDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBlueReplicationDetailsInternal)this).VMDiskDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskDetails[]) content.GetValueForProperty("VMDiskDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBlueReplicationDetailsInternal)this).VMDiskDetail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DiskDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettingsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettingsInternal)this).InstanceType, global::System.Convert.ToString); + } + if (content.Contains("InitialReplicationDetailInitialReplicationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBlueReplicationDetailsInternal)this).InitialReplicationDetailInitialReplicationType = (string) content.GetValueForProperty("InitialReplicationDetailInitialReplicationType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBlueReplicationDetailsInternal)this).InitialReplicationDetailInitialReplicationType, global::System.Convert.ToString); + } + if (content.Contains("InitialReplicationDetailInitialReplicationProgressPercentage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBlueReplicationDetailsInternal)this).InitialReplicationDetailInitialReplicationProgressPercentage = (string) content.GetValueForProperty("InitialReplicationDetailInitialReplicationProgressPercentage",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBlueReplicationDetailsInternal)this).InitialReplicationDetailInitialReplicationProgressPercentage, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal HyperVReplicaBlueReplicationDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InitialReplicationDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBlueReplicationDetailsInternal)this).InitialReplicationDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInitialReplicationDetails) content.GetValueForProperty("InitialReplicationDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBlueReplicationDetailsInternal)this).InitialReplicationDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InitialReplicationDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("LastReplicatedTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBlueReplicationDetailsInternal)this).LastReplicatedTime = (global::System.DateTime?) content.GetValueForProperty("LastReplicatedTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBlueReplicationDetailsInternal)this).LastReplicatedTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("VMNic")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBlueReplicationDetailsInternal)this).VMNic = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetails[]) content.GetValueForProperty("VMNic",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBlueReplicationDetailsInternal)this).VMNic, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMNicDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("VMId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBlueReplicationDetailsInternal)this).VMId = (string) content.GetValueForProperty("VMId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBlueReplicationDetailsInternal)this).VMId, global::System.Convert.ToString); + } + if (content.Contains("VMProtectionState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBlueReplicationDetailsInternal)this).VMProtectionState = (string) content.GetValueForProperty("VMProtectionState",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBlueReplicationDetailsInternal)this).VMProtectionState, global::System.Convert.ToString); + } + if (content.Contains("VMProtectionStateDescription")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBlueReplicationDetailsInternal)this).VMProtectionStateDescription = (string) content.GetValueForProperty("VMProtectionStateDescription",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBlueReplicationDetailsInternal)this).VMProtectionStateDescription, global::System.Convert.ToString); + } + if (content.Contains("VMDiskDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBlueReplicationDetailsInternal)this).VMDiskDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskDetails[]) content.GetValueForProperty("VMDiskDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBlueReplicationDetailsInternal)this).VMDiskDetail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DiskDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettingsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettingsInternal)this).InstanceType, global::System.Convert.ToString); + } + if (content.Contains("InitialReplicationDetailInitialReplicationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBlueReplicationDetailsInternal)this).InitialReplicationDetailInitialReplicationType = (string) content.GetValueForProperty("InitialReplicationDetailInitialReplicationType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBlueReplicationDetailsInternal)this).InitialReplicationDetailInitialReplicationType, global::System.Convert.ToString); + } + if (content.Contains("InitialReplicationDetailInitialReplicationProgressPercentage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBlueReplicationDetailsInternal)this).InitialReplicationDetailInitialReplicationProgressPercentage = (string) content.GetValueForProperty("InitialReplicationDetailInitialReplicationProgressPercentage",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBlueReplicationDetailsInternal)this).InitialReplicationDetailInitialReplicationProgressPercentage, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// HyperV replica 2012 R2 (Blue) replication details. + [System.ComponentModel.TypeConverter(typeof(HyperVReplicaBlueReplicationDetailsTypeConverter))] + public partial interface IHyperVReplicaBlueReplicationDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaBlueReplicationDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaBlueReplicationDetails.TypeConverter.cs new file mode 100644 index 000000000000..bc8db53325e7 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaBlueReplicationDetails.TypeConverter.cs @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class HyperVReplicaBlueReplicationDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBlueReplicationDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBlueReplicationDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return HyperVReplicaBlueReplicationDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return HyperVReplicaBlueReplicationDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return HyperVReplicaBlueReplicationDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaBlueReplicationDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaBlueReplicationDetails.cs new file mode 100644 index 000000000000..b1a046d9ed66 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaBlueReplicationDetails.cs @@ -0,0 +1,199 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// HyperV replica 2012 R2 (Blue) replication details. + public partial class HyperVReplicaBlueReplicationDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBlueReplicationDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBlueReplicationDetailsInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettings __replicationProviderSpecificSettings = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProviderSpecificSettings(); + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInitialReplicationDetails _initialReplicationDetail; + + /// Initial replication details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInitialReplicationDetails InitialReplicationDetail { get => (this._initialReplicationDetail = this._initialReplicationDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InitialReplicationDetails()); set => this._initialReplicationDetail = value; } + + /// The initial replication progress percentage. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string InitialReplicationDetailInitialReplicationProgressPercentage { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInitialReplicationDetailsInternal)InitialReplicationDetail).InitialReplicationProgressPercentage; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInitialReplicationDetailsInternal)InitialReplicationDetail).InitialReplicationProgressPercentage = value ?? null; } + + /// Initial replication type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string InitialReplicationDetailInitialReplicationType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInitialReplicationDetailsInternal)InitialReplicationDetail).InitialReplicationType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInitialReplicationDetailsInternal)InitialReplicationDetail).InitialReplicationType = value ?? null; } + + /// Gets the Instance type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettingsInternal)__replicationProviderSpecificSettings).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettingsInternal)__replicationProviderSpecificSettings).InstanceType = value ; } + + /// Backing field for property. + private global::System.DateTime? _lastReplicatedTime; + + /// The Last replication time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public global::System.DateTime? LastReplicatedTime { get => this._lastReplicatedTime; set => this._lastReplicatedTime = value; } + + /// Internal Acessors for InitialReplicationDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInitialReplicationDetails Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBlueReplicationDetailsInternal.InitialReplicationDetail { get => (this._initialReplicationDetail = this._initialReplicationDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InitialReplicationDetails()); set { {_initialReplicationDetail = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskDetails[] _vMDiskDetail; + + /// VM disk details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskDetails[] VMDiskDetail { get => this._vMDiskDetail; set => this._vMDiskDetail = value; } + + /// Backing field for property. + private string _vMId; + + /// The virtual machine Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string VMId { get => this._vMId; set => this._vMId = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetails[] _vMNic; + + /// The PE Network details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetails[] VMNic { get => this._vMNic; set => this._vMNic = value; } + + /// Backing field for property. + private string _vMProtectionState; + + /// The protection state for the vm. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string VMProtectionState { get => this._vMProtectionState; set => this._vMProtectionState = value; } + + /// Backing field for property. + private string _vMProtectionStateDescription; + + /// The protection state description for the vm. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string VMProtectionStateDescription { get => this._vMProtectionStateDescription; set => this._vMProtectionStateDescription = value; } + + /// Creates an new instance. + public HyperVReplicaBlueReplicationDetails() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__replicationProviderSpecificSettings), __replicationProviderSpecificSettings); + await eventListener.AssertObjectIsValid(nameof(__replicationProviderSpecificSettings), __replicationProviderSpecificSettings); + } + } + /// HyperV replica 2012 R2 (Blue) replication details. + public partial interface IHyperVReplicaBlueReplicationDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettings + { + /// The initial replication progress percentage. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The initial replication progress percentage.", + SerializedName = @"initialReplicationProgressPercentage", + PossibleTypes = new [] { typeof(string) })] + string InitialReplicationDetailInitialReplicationProgressPercentage { get; set; } + /// Initial replication type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Initial replication type.", + SerializedName = @"initialReplicationType", + PossibleTypes = new [] { typeof(string) })] + string InitialReplicationDetailInitialReplicationType { get; set; } + /// The Last replication time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Last replication time.", + SerializedName = @"lastReplicatedTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? LastReplicatedTime { get; set; } + /// VM disk details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"VM disk details.", + SerializedName = @"vMDiskDetails", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskDetails) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskDetails[] VMDiskDetail { get; set; } + /// The virtual machine Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The virtual machine Id.", + SerializedName = @"vmId", + PossibleTypes = new [] { typeof(string) })] + string VMId { get; set; } + /// The PE Network details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The PE Network details.", + SerializedName = @"vmNics", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetails) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetails[] VMNic { get; set; } + /// The protection state for the vm. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The protection state for the vm.", + SerializedName = @"vmProtectionState", + PossibleTypes = new [] { typeof(string) })] + string VMProtectionState { get; set; } + /// The protection state description for the vm. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The protection state description for the vm.", + SerializedName = @"vmProtectionStateDescription", + PossibleTypes = new [] { typeof(string) })] + string VMProtectionStateDescription { get; set; } + + } + /// HyperV replica 2012 R2 (Blue) replication details. + internal partial interface IHyperVReplicaBlueReplicationDetailsInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettingsInternal + { + /// Initial replication details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInitialReplicationDetails InitialReplicationDetail { get; set; } + /// The initial replication progress percentage. + string InitialReplicationDetailInitialReplicationProgressPercentage { get; set; } + /// Initial replication type. + string InitialReplicationDetailInitialReplicationType { get; set; } + /// The Last replication time. + global::System.DateTime? LastReplicatedTime { get; set; } + /// VM disk details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskDetails[] VMDiskDetail { get; set; } + /// The virtual machine Id. + string VMId { get; set; } + /// The PE Network details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetails[] VMNic { get; set; } + /// The protection state for the vm. + string VMProtectionState { get; set; } + /// The protection state description for the vm. + string VMProtectionStateDescription { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaBlueReplicationDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaBlueReplicationDetails.json.cs new file mode 100644 index 000000000000..17bacda5f5ef --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaBlueReplicationDetails.json.cs @@ -0,0 +1,139 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// HyperV replica 2012 R2 (Blue) replication details. + public partial class HyperVReplicaBlueReplicationDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBlueReplicationDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBlueReplicationDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaBlueReplicationDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new HyperVReplicaBlueReplicationDetails(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal HyperVReplicaBlueReplicationDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __replicationProviderSpecificSettings = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProviderSpecificSettings(json); + {_initialReplicationDetail = If( json?.PropertyT("initialReplicationDetails"), out var __jsonInitialReplicationDetails) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InitialReplicationDetails.FromJson(__jsonInitialReplicationDetails) : InitialReplicationDetail;} + {_lastReplicatedTime = If( json?.PropertyT("lastReplicatedTime"), out var __jsonLastReplicatedTime) ? global::System.DateTime.TryParse((string)__jsonLastReplicatedTime, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonLastReplicatedTimeValue) ? __jsonLastReplicatedTimeValue : LastReplicatedTime : LastReplicatedTime;} + {_vMNic = If( json?.PropertyT("vmNics"), out var __jsonVMNics) ? If( __jsonVMNics as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetails) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMNicDetails.FromJson(__u) )) ))() : null : VMNic;} + {_vMId = If( json?.PropertyT("vmId"), out var __jsonVMId) ? (string)__jsonVMId : (string)VMId;} + {_vMProtectionState = If( json?.PropertyT("vmProtectionState"), out var __jsonVMProtectionState) ? (string)__jsonVMProtectionState : (string)VMProtectionState;} + {_vMProtectionStateDescription = If( json?.PropertyT("vmProtectionStateDescription"), out var __jsonVMProtectionStateDescription) ? (string)__jsonVMProtectionStateDescription : (string)VMProtectionStateDescription;} + {_vMDiskDetail = If( json?.PropertyT("vMDiskDetails"), out var __jsonVMDiskDetails) ? If( __jsonVMDiskDetails as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __q) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__q, (__p)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskDetails) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DiskDetails.FromJson(__p) )) ))() : null : VMDiskDetail;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __replicationProviderSpecificSettings?.ToJson(container, serializationMode); + AddIf( null != this._initialReplicationDetail ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._initialReplicationDetail.ToJson(null,serializationMode) : null, "initialReplicationDetails" ,container.Add ); + AddIf( null != this._lastReplicatedTime ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._lastReplicatedTime?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "lastReplicatedTime" ,container.Add ); + if (null != this._vMNic) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._vMNic ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("vmNics",__w); + } + AddIf( null != (((object)this._vMId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._vMId.ToString()) : null, "vmId" ,container.Add ); + AddIf( null != (((object)this._vMProtectionState)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._vMProtectionState.ToString()) : null, "vmProtectionState" ,container.Add ); + AddIf( null != (((object)this._vMProtectionStateDescription)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._vMProtectionStateDescription.ToString()) : null, "vmProtectionStateDescription" ,container.Add ); + if (null != this._vMDiskDetail) + { + var __r = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __s in this._vMDiskDetail ) + { + AddIf(__s?.ToJson(null, serializationMode) ,__r.Add); + } + container.Add("vMDiskDetails",__r); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaPolicyDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaPolicyDetails.PowerShell.cs new file mode 100644 index 000000000000..0c38f5595050 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaPolicyDetails.PowerShell.cs @@ -0,0 +1,226 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Hyper-V Replica Blue specific protection profile details. + [System.ComponentModel.TypeConverter(typeof(HyperVReplicaPolicyDetailsTypeConverter))] + public partial class HyperVReplicaPolicyDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new HyperVReplicaPolicyDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new HyperVReplicaPolicyDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal HyperVReplicaPolicyDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("RecoveryPoint")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyDetailsInternal)this).RecoveryPoint = (int?) content.GetValueForProperty("RecoveryPoint",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyDetailsInternal)this).RecoveryPoint, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("ApplicationConsistentSnapshotFrequencyInHour")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyDetailsInternal)this).ApplicationConsistentSnapshotFrequencyInHour = (int?) content.GetValueForProperty("ApplicationConsistentSnapshotFrequencyInHour",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyDetailsInternal)this).ApplicationConsistentSnapshotFrequencyInHour, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("Compression")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyDetailsInternal)this).Compression = (string) content.GetValueForProperty("Compression",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyDetailsInternal)this).Compression, global::System.Convert.ToString); + } + if (content.Contains("InitialReplicationMethod")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyDetailsInternal)this).InitialReplicationMethod = (string) content.GetValueForProperty("InitialReplicationMethod",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyDetailsInternal)this).InitialReplicationMethod, global::System.Convert.ToString); + } + if (content.Contains("OnlineReplicationStartTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyDetailsInternal)this).OnlineReplicationStartTime = (string) content.GetValueForProperty("OnlineReplicationStartTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyDetailsInternal)this).OnlineReplicationStartTime, global::System.Convert.ToString); + } + if (content.Contains("OfflineReplicationImportPath")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyDetailsInternal)this).OfflineReplicationImportPath = (string) content.GetValueForProperty("OfflineReplicationImportPath",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyDetailsInternal)this).OfflineReplicationImportPath, global::System.Convert.ToString); + } + if (content.Contains("OfflineReplicationExportPath")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyDetailsInternal)this).OfflineReplicationExportPath = (string) content.GetValueForProperty("OfflineReplicationExportPath",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyDetailsInternal)this).OfflineReplicationExportPath, global::System.Convert.ToString); + } + if (content.Contains("ReplicationPort")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyDetailsInternal)this).ReplicationPort = (int?) content.GetValueForProperty("ReplicationPort",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyDetailsInternal)this).ReplicationPort, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("AllowedAuthenticationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyDetailsInternal)this).AllowedAuthenticationType = (int?) content.GetValueForProperty("AllowedAuthenticationType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyDetailsInternal)this).AllowedAuthenticationType, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("ReplicaDeletionOption")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyDetailsInternal)this).ReplicaDeletionOption = (string) content.GetValueForProperty("ReplicaDeletionOption",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyDetailsInternal)this).ReplicaDeletionOption, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal HyperVReplicaPolicyDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("RecoveryPoint")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyDetailsInternal)this).RecoveryPoint = (int?) content.GetValueForProperty("RecoveryPoint",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyDetailsInternal)this).RecoveryPoint, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("ApplicationConsistentSnapshotFrequencyInHour")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyDetailsInternal)this).ApplicationConsistentSnapshotFrequencyInHour = (int?) content.GetValueForProperty("ApplicationConsistentSnapshotFrequencyInHour",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyDetailsInternal)this).ApplicationConsistentSnapshotFrequencyInHour, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("Compression")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyDetailsInternal)this).Compression = (string) content.GetValueForProperty("Compression",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyDetailsInternal)this).Compression, global::System.Convert.ToString); + } + if (content.Contains("InitialReplicationMethod")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyDetailsInternal)this).InitialReplicationMethod = (string) content.GetValueForProperty("InitialReplicationMethod",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyDetailsInternal)this).InitialReplicationMethod, global::System.Convert.ToString); + } + if (content.Contains("OnlineReplicationStartTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyDetailsInternal)this).OnlineReplicationStartTime = (string) content.GetValueForProperty("OnlineReplicationStartTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyDetailsInternal)this).OnlineReplicationStartTime, global::System.Convert.ToString); + } + if (content.Contains("OfflineReplicationImportPath")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyDetailsInternal)this).OfflineReplicationImportPath = (string) content.GetValueForProperty("OfflineReplicationImportPath",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyDetailsInternal)this).OfflineReplicationImportPath, global::System.Convert.ToString); + } + if (content.Contains("OfflineReplicationExportPath")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyDetailsInternal)this).OfflineReplicationExportPath = (string) content.GetValueForProperty("OfflineReplicationExportPath",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyDetailsInternal)this).OfflineReplicationExportPath, global::System.Convert.ToString); + } + if (content.Contains("ReplicationPort")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyDetailsInternal)this).ReplicationPort = (int?) content.GetValueForProperty("ReplicationPort",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyDetailsInternal)this).ReplicationPort, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("AllowedAuthenticationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyDetailsInternal)this).AllowedAuthenticationType = (int?) content.GetValueForProperty("AllowedAuthenticationType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyDetailsInternal)this).AllowedAuthenticationType, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("ReplicaDeletionOption")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyDetailsInternal)this).ReplicaDeletionOption = (string) content.GetValueForProperty("ReplicaDeletionOption",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyDetailsInternal)this).ReplicaDeletionOption, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Hyper-V Replica Blue specific protection profile details. + [System.ComponentModel.TypeConverter(typeof(HyperVReplicaPolicyDetailsTypeConverter))] + public partial interface IHyperVReplicaPolicyDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaPolicyDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaPolicyDetails.TypeConverter.cs new file mode 100644 index 000000000000..00cc36ab240c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaPolicyDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class HyperVReplicaPolicyDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return HyperVReplicaPolicyDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return HyperVReplicaPolicyDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return HyperVReplicaPolicyDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaPolicyDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaPolicyDetails.cs new file mode 100644 index 000000000000..2c71620408c1 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaPolicyDetails.cs @@ -0,0 +1,235 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Hyper-V Replica Blue specific protection profile details. + public partial class HyperVReplicaPolicyDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyDetailsInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetails __policyProviderSpecificDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PolicyProviderSpecificDetails(); + + /// Backing field for property. + private int? _allowedAuthenticationType; + + /// A value indicating the authentication type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? AllowedAuthenticationType { get => this._allowedAuthenticationType; set => this._allowedAuthenticationType = value; } + + /// + /// Backing field for property. + /// + private int? _applicationConsistentSnapshotFrequencyInHour; + + /// A value indicating the application consistent frequency. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? ApplicationConsistentSnapshotFrequencyInHour { get => this._applicationConsistentSnapshotFrequencyInHour; set => this._applicationConsistentSnapshotFrequencyInHour = value; } + + /// Backing field for property. + private string _compression; + + /// A value indicating whether compression has to be enabled. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Compression { get => this._compression; set => this._compression = value; } + + /// Backing field for property. + private string _initialReplicationMethod; + + /// A value indicating whether IR is online. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string InitialReplicationMethod { get => this._initialReplicationMethod; set => this._initialReplicationMethod = value; } + + /// Gets the class type. Overridden in derived classes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetailsInternal)__policyProviderSpecificDetails).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetailsInternal)__policyProviderSpecificDetails).InstanceType = value ; } + + /// Backing field for property. + private string _offlineReplicationExportPath; + + /// A value indicating the offline IR export path. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string OfflineReplicationExportPath { get => this._offlineReplicationExportPath; set => this._offlineReplicationExportPath = value; } + + /// Backing field for property. + private string _offlineReplicationImportPath; + + /// A value indicating the offline IR import path. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string OfflineReplicationImportPath { get => this._offlineReplicationImportPath; set => this._offlineReplicationImportPath = value; } + + /// Backing field for property. + private string _onlineReplicationStartTime; + + /// A value indicating the online IR start time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string OnlineReplicationStartTime { get => this._onlineReplicationStartTime; set => this._onlineReplicationStartTime = value; } + + /// Backing field for property. + private int? _recoveryPoint; + + /// A value indicating the number of recovery points. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? RecoveryPoint { get => this._recoveryPoint; set => this._recoveryPoint = value; } + + /// Backing field for property. + private string _replicaDeletionOption; + + /// + /// A value indicating whether the VM has to be auto deleted. Supported Values: String.Empty, None, OnRecoveryCloud + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ReplicaDeletionOption { get => this._replicaDeletionOption; set => this._replicaDeletionOption = value; } + + /// Backing field for property. + private int? _replicationPort; + + /// A value indicating the recovery HTTPS port. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? ReplicationPort { get => this._replicationPort; set => this._replicationPort = value; } + + /// Creates an new instance. + public HyperVReplicaPolicyDetails() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__policyProviderSpecificDetails), __policyProviderSpecificDetails); + await eventListener.AssertObjectIsValid(nameof(__policyProviderSpecificDetails), __policyProviderSpecificDetails); + } + } + /// Hyper-V Replica Blue specific protection profile details. + public partial interface IHyperVReplicaPolicyDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetails + { + /// A value indicating the authentication type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating the authentication type.", + SerializedName = @"allowedAuthenticationType", + PossibleTypes = new [] { typeof(int) })] + int? AllowedAuthenticationType { get; set; } + /// A value indicating the application consistent frequency. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating the application consistent frequency.", + SerializedName = @"applicationConsistentSnapshotFrequencyInHours", + PossibleTypes = new [] { typeof(int) })] + int? ApplicationConsistentSnapshotFrequencyInHour { get; set; } + /// A value indicating whether compression has to be enabled. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether compression has to be enabled.", + SerializedName = @"compression", + PossibleTypes = new [] { typeof(string) })] + string Compression { get; set; } + /// A value indicating whether IR is online. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether IR is online.", + SerializedName = @"initialReplicationMethod", + PossibleTypes = new [] { typeof(string) })] + string InitialReplicationMethod { get; set; } + /// A value indicating the offline IR export path. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating the offline IR export path.", + SerializedName = @"offlineReplicationExportPath", + PossibleTypes = new [] { typeof(string) })] + string OfflineReplicationExportPath { get; set; } + /// A value indicating the offline IR import path. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating the offline IR import path.", + SerializedName = @"offlineReplicationImportPath", + PossibleTypes = new [] { typeof(string) })] + string OfflineReplicationImportPath { get; set; } + /// A value indicating the online IR start time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating the online IR start time.", + SerializedName = @"onlineReplicationStartTime", + PossibleTypes = new [] { typeof(string) })] + string OnlineReplicationStartTime { get; set; } + /// A value indicating the number of recovery points. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating the number of recovery points.", + SerializedName = @"recoveryPoints", + PossibleTypes = new [] { typeof(int) })] + int? RecoveryPoint { get; set; } + /// + /// A value indicating whether the VM has to be auto deleted. Supported Values: String.Empty, None, OnRecoveryCloud + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether the VM has to be auto deleted. Supported Values: String.Empty, None, OnRecoveryCloud", + SerializedName = @"replicaDeletionOption", + PossibleTypes = new [] { typeof(string) })] + string ReplicaDeletionOption { get; set; } + /// A value indicating the recovery HTTPS port. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating the recovery HTTPS port.", + SerializedName = @"replicationPort", + PossibleTypes = new [] { typeof(int) })] + int? ReplicationPort { get; set; } + + } + /// Hyper-V Replica Blue specific protection profile details. + internal partial interface IHyperVReplicaPolicyDetailsInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetailsInternal + { + /// A value indicating the authentication type. + int? AllowedAuthenticationType { get; set; } + /// A value indicating the application consistent frequency. + int? ApplicationConsistentSnapshotFrequencyInHour { get; set; } + /// A value indicating whether compression has to be enabled. + string Compression { get; set; } + /// A value indicating whether IR is online. + string InitialReplicationMethod { get; set; } + /// A value indicating the offline IR export path. + string OfflineReplicationExportPath { get; set; } + /// A value indicating the offline IR import path. + string OfflineReplicationImportPath { get; set; } + /// A value indicating the online IR start time. + string OnlineReplicationStartTime { get; set; } + /// A value indicating the number of recovery points. + int? RecoveryPoint { get; set; } + /// + /// A value indicating whether the VM has to be auto deleted. Supported Values: String.Empty, None, OnRecoveryCloud + /// + string ReplicaDeletionOption { get; set; } + /// A value indicating the recovery HTTPS port. + int? ReplicationPort { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaPolicyDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaPolicyDetails.json.cs new file mode 100644 index 000000000000..677e7fa1ba68 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaPolicyDetails.json.cs @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Hyper-V Replica Blue specific protection profile details. + public partial class HyperVReplicaPolicyDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new HyperVReplicaPolicyDetails(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal HyperVReplicaPolicyDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __policyProviderSpecificDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PolicyProviderSpecificDetails(json); + {_recoveryPoint = If( json?.PropertyT("recoveryPoints"), out var __jsonRecoveryPoints) ? (int?)__jsonRecoveryPoints : RecoveryPoint;} + {_applicationConsistentSnapshotFrequencyInHour = If( json?.PropertyT("applicationConsistentSnapshotFrequencyInHours"), out var __jsonApplicationConsistentSnapshotFrequencyInHours) ? (int?)__jsonApplicationConsistentSnapshotFrequencyInHours : ApplicationConsistentSnapshotFrequencyInHour;} + {_compression = If( json?.PropertyT("compression"), out var __jsonCompression) ? (string)__jsonCompression : (string)Compression;} + {_initialReplicationMethod = If( json?.PropertyT("initialReplicationMethod"), out var __jsonInitialReplicationMethod) ? (string)__jsonInitialReplicationMethod : (string)InitialReplicationMethod;} + {_onlineReplicationStartTime = If( json?.PropertyT("onlineReplicationStartTime"), out var __jsonOnlineReplicationStartTime) ? (string)__jsonOnlineReplicationStartTime : (string)OnlineReplicationStartTime;} + {_offlineReplicationImportPath = If( json?.PropertyT("offlineReplicationImportPath"), out var __jsonOfflineReplicationImportPath) ? (string)__jsonOfflineReplicationImportPath : (string)OfflineReplicationImportPath;} + {_offlineReplicationExportPath = If( json?.PropertyT("offlineReplicationExportPath"), out var __jsonOfflineReplicationExportPath) ? (string)__jsonOfflineReplicationExportPath : (string)OfflineReplicationExportPath;} + {_replicationPort = If( json?.PropertyT("replicationPort"), out var __jsonReplicationPort) ? (int?)__jsonReplicationPort : ReplicationPort;} + {_allowedAuthenticationType = If( json?.PropertyT("allowedAuthenticationType"), out var __jsonAllowedAuthenticationType) ? (int?)__jsonAllowedAuthenticationType : AllowedAuthenticationType;} + {_replicaDeletionOption = If( json?.PropertyT("replicaDeletionOption"), out var __jsonReplicaDeletionOption) ? (string)__jsonReplicaDeletionOption : (string)ReplicaDeletionOption;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __policyProviderSpecificDetails?.ToJson(container, serializationMode); + AddIf( null != this._recoveryPoint ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._recoveryPoint) : null, "recoveryPoints" ,container.Add ); + AddIf( null != this._applicationConsistentSnapshotFrequencyInHour ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._applicationConsistentSnapshotFrequencyInHour) : null, "applicationConsistentSnapshotFrequencyInHours" ,container.Add ); + AddIf( null != (((object)this._compression)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._compression.ToString()) : null, "compression" ,container.Add ); + AddIf( null != (((object)this._initialReplicationMethod)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._initialReplicationMethod.ToString()) : null, "initialReplicationMethod" ,container.Add ); + AddIf( null != (((object)this._onlineReplicationStartTime)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._onlineReplicationStartTime.ToString()) : null, "onlineReplicationStartTime" ,container.Add ); + AddIf( null != (((object)this._offlineReplicationImportPath)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._offlineReplicationImportPath.ToString()) : null, "offlineReplicationImportPath" ,container.Add ); + AddIf( null != (((object)this._offlineReplicationExportPath)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._offlineReplicationExportPath.ToString()) : null, "offlineReplicationExportPath" ,container.Add ); + AddIf( null != this._replicationPort ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._replicationPort) : null, "replicationPort" ,container.Add ); + AddIf( null != this._allowedAuthenticationType ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._allowedAuthenticationType) : null, "allowedAuthenticationType" ,container.Add ); + AddIf( null != (((object)this._replicaDeletionOption)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._replicaDeletionOption.ToString()) : null, "replicaDeletionOption" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaPolicyInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaPolicyInput.PowerShell.cs new file mode 100644 index 000000000000..eefc531c460f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaPolicyInput.PowerShell.cs @@ -0,0 +1,226 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Hyper-V Replica specific policy Input. + [System.ComponentModel.TypeConverter(typeof(HyperVReplicaPolicyInputTypeConverter))] + public partial class HyperVReplicaPolicyInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new HyperVReplicaPolicyInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new HyperVReplicaPolicyInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal HyperVReplicaPolicyInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("RecoveryPoint")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal)this).RecoveryPoint = (int?) content.GetValueForProperty("RecoveryPoint",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal)this).RecoveryPoint, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("ApplicationConsistentSnapshotFrequencyInHour")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal)this).ApplicationConsistentSnapshotFrequencyInHour = (int?) content.GetValueForProperty("ApplicationConsistentSnapshotFrequencyInHour",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal)this).ApplicationConsistentSnapshotFrequencyInHour, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("Compression")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal)this).Compression = (string) content.GetValueForProperty("Compression",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal)this).Compression, global::System.Convert.ToString); + } + if (content.Contains("InitialReplicationMethod")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal)this).InitialReplicationMethod = (string) content.GetValueForProperty("InitialReplicationMethod",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal)this).InitialReplicationMethod, global::System.Convert.ToString); + } + if (content.Contains("OnlineReplicationStartTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal)this).OnlineReplicationStartTime = (string) content.GetValueForProperty("OnlineReplicationStartTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal)this).OnlineReplicationStartTime, global::System.Convert.ToString); + } + if (content.Contains("OfflineReplicationImportPath")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal)this).OfflineReplicationImportPath = (string) content.GetValueForProperty("OfflineReplicationImportPath",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal)this).OfflineReplicationImportPath, global::System.Convert.ToString); + } + if (content.Contains("OfflineReplicationExportPath")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal)this).OfflineReplicationExportPath = (string) content.GetValueForProperty("OfflineReplicationExportPath",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal)this).OfflineReplicationExportPath, global::System.Convert.ToString); + } + if (content.Contains("ReplicationPort")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal)this).ReplicationPort = (int?) content.GetValueForProperty("ReplicationPort",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal)this).ReplicationPort, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("AllowedAuthenticationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal)this).AllowedAuthenticationType = (int?) content.GetValueForProperty("AllowedAuthenticationType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal)this).AllowedAuthenticationType, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("ReplicaDeletion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal)this).ReplicaDeletion = (string) content.GetValueForProperty("ReplicaDeletion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal)this).ReplicaDeletion, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal HyperVReplicaPolicyInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("RecoveryPoint")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal)this).RecoveryPoint = (int?) content.GetValueForProperty("RecoveryPoint",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal)this).RecoveryPoint, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("ApplicationConsistentSnapshotFrequencyInHour")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal)this).ApplicationConsistentSnapshotFrequencyInHour = (int?) content.GetValueForProperty("ApplicationConsistentSnapshotFrequencyInHour",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal)this).ApplicationConsistentSnapshotFrequencyInHour, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("Compression")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal)this).Compression = (string) content.GetValueForProperty("Compression",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal)this).Compression, global::System.Convert.ToString); + } + if (content.Contains("InitialReplicationMethod")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal)this).InitialReplicationMethod = (string) content.GetValueForProperty("InitialReplicationMethod",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal)this).InitialReplicationMethod, global::System.Convert.ToString); + } + if (content.Contains("OnlineReplicationStartTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal)this).OnlineReplicationStartTime = (string) content.GetValueForProperty("OnlineReplicationStartTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal)this).OnlineReplicationStartTime, global::System.Convert.ToString); + } + if (content.Contains("OfflineReplicationImportPath")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal)this).OfflineReplicationImportPath = (string) content.GetValueForProperty("OfflineReplicationImportPath",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal)this).OfflineReplicationImportPath, global::System.Convert.ToString); + } + if (content.Contains("OfflineReplicationExportPath")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal)this).OfflineReplicationExportPath = (string) content.GetValueForProperty("OfflineReplicationExportPath",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal)this).OfflineReplicationExportPath, global::System.Convert.ToString); + } + if (content.Contains("ReplicationPort")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal)this).ReplicationPort = (int?) content.GetValueForProperty("ReplicationPort",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal)this).ReplicationPort, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("AllowedAuthenticationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal)this).AllowedAuthenticationType = (int?) content.GetValueForProperty("AllowedAuthenticationType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal)this).AllowedAuthenticationType, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("ReplicaDeletion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal)this).ReplicaDeletion = (string) content.GetValueForProperty("ReplicaDeletion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal)this).ReplicaDeletion, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Hyper-V Replica specific policy Input. + [System.ComponentModel.TypeConverter(typeof(HyperVReplicaPolicyInputTypeConverter))] + public partial interface IHyperVReplicaPolicyInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaPolicyInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaPolicyInput.TypeConverter.cs new file mode 100644 index 000000000000..144b20d5aad0 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaPolicyInput.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class HyperVReplicaPolicyInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return HyperVReplicaPolicyInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return HyperVReplicaPolicyInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return HyperVReplicaPolicyInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaPolicyInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaPolicyInput.cs new file mode 100644 index 000000000000..2f87918bab17 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaPolicyInput.cs @@ -0,0 +1,229 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Hyper-V Replica specific policy Input. + public partial class HyperVReplicaPolicyInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInputInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInput __policyProviderSpecificInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PolicyProviderSpecificInput(); + + /// Backing field for property. + private int? _allowedAuthenticationType; + + /// A value indicating the authentication type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? AllowedAuthenticationType { get => this._allowedAuthenticationType; set => this._allowedAuthenticationType = value; } + + /// + /// Backing field for property. + /// + private int? _applicationConsistentSnapshotFrequencyInHour; + + /// A value indicating the application consistent frequency. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? ApplicationConsistentSnapshotFrequencyInHour { get => this._applicationConsistentSnapshotFrequencyInHour; set => this._applicationConsistentSnapshotFrequencyInHour = value; } + + /// Backing field for property. + private string _compression; + + /// A value indicating whether compression has to be enabled. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Compression { get => this._compression; set => this._compression = value; } + + /// Backing field for property. + private string _initialReplicationMethod; + + /// A value indicating whether IR is online. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string InitialReplicationMethod { get => this._initialReplicationMethod; set => this._initialReplicationMethod = value; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInputInternal)__policyProviderSpecificInput).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInputInternal)__policyProviderSpecificInput).InstanceType = value ; } + + /// Backing field for property. + private string _offlineReplicationExportPath; + + /// A value indicating the offline IR export path. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string OfflineReplicationExportPath { get => this._offlineReplicationExportPath; set => this._offlineReplicationExportPath = value; } + + /// Backing field for property. + private string _offlineReplicationImportPath; + + /// A value indicating the offline IR import path. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string OfflineReplicationImportPath { get => this._offlineReplicationImportPath; set => this._offlineReplicationImportPath = value; } + + /// Backing field for property. + private string _onlineReplicationStartTime; + + /// A value indicating the online IR start time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string OnlineReplicationStartTime { get => this._onlineReplicationStartTime; set => this._onlineReplicationStartTime = value; } + + /// Backing field for property. + private int? _recoveryPoint; + + /// A value indicating the number of recovery points. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? RecoveryPoint { get => this._recoveryPoint; set => this._recoveryPoint = value; } + + /// Backing field for property. + private string _replicaDeletion; + + /// A value indicating whether the VM has to be auto deleted. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ReplicaDeletion { get => this._replicaDeletion; set => this._replicaDeletion = value; } + + /// Backing field for property. + private int? _replicationPort; + + /// A value indicating the recovery HTTPS port. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? ReplicationPort { get => this._replicationPort; set => this._replicationPort = value; } + + /// Creates an new instance. + public HyperVReplicaPolicyInput() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__policyProviderSpecificInput), __policyProviderSpecificInput); + await eventListener.AssertObjectIsValid(nameof(__policyProviderSpecificInput), __policyProviderSpecificInput); + } + } + /// Hyper-V Replica specific policy Input. + public partial interface IHyperVReplicaPolicyInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInput + { + /// A value indicating the authentication type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating the authentication type.", + SerializedName = @"allowedAuthenticationType", + PossibleTypes = new [] { typeof(int) })] + int? AllowedAuthenticationType { get; set; } + /// A value indicating the application consistent frequency. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating the application consistent frequency.", + SerializedName = @"applicationConsistentSnapshotFrequencyInHours", + PossibleTypes = new [] { typeof(int) })] + int? ApplicationConsistentSnapshotFrequencyInHour { get; set; } + /// A value indicating whether compression has to be enabled. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether compression has to be enabled.", + SerializedName = @"compression", + PossibleTypes = new [] { typeof(string) })] + string Compression { get; set; } + /// A value indicating whether IR is online. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether IR is online.", + SerializedName = @"initialReplicationMethod", + PossibleTypes = new [] { typeof(string) })] + string InitialReplicationMethod { get; set; } + /// A value indicating the offline IR export path. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating the offline IR export path.", + SerializedName = @"offlineReplicationExportPath", + PossibleTypes = new [] { typeof(string) })] + string OfflineReplicationExportPath { get; set; } + /// A value indicating the offline IR import path. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating the offline IR import path.", + SerializedName = @"offlineReplicationImportPath", + PossibleTypes = new [] { typeof(string) })] + string OfflineReplicationImportPath { get; set; } + /// A value indicating the online IR start time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating the online IR start time.", + SerializedName = @"onlineReplicationStartTime", + PossibleTypes = new [] { typeof(string) })] + string OnlineReplicationStartTime { get; set; } + /// A value indicating the number of recovery points. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating the number of recovery points.", + SerializedName = @"recoveryPoints", + PossibleTypes = new [] { typeof(int) })] + int? RecoveryPoint { get; set; } + /// A value indicating whether the VM has to be auto deleted. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether the VM has to be auto deleted.", + SerializedName = @"replicaDeletion", + PossibleTypes = new [] { typeof(string) })] + string ReplicaDeletion { get; set; } + /// A value indicating the recovery HTTPS port. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating the recovery HTTPS port.", + SerializedName = @"replicationPort", + PossibleTypes = new [] { typeof(int) })] + int? ReplicationPort { get; set; } + + } + /// Hyper-V Replica specific policy Input. + internal partial interface IHyperVReplicaPolicyInputInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInputInternal + { + /// A value indicating the authentication type. + int? AllowedAuthenticationType { get; set; } + /// A value indicating the application consistent frequency. + int? ApplicationConsistentSnapshotFrequencyInHour { get; set; } + /// A value indicating whether compression has to be enabled. + string Compression { get; set; } + /// A value indicating whether IR is online. + string InitialReplicationMethod { get; set; } + /// A value indicating the offline IR export path. + string OfflineReplicationExportPath { get; set; } + /// A value indicating the offline IR import path. + string OfflineReplicationImportPath { get; set; } + /// A value indicating the online IR start time. + string OnlineReplicationStartTime { get; set; } + /// A value indicating the number of recovery points. + int? RecoveryPoint { get; set; } + /// A value indicating whether the VM has to be auto deleted. + string ReplicaDeletion { get; set; } + /// A value indicating the recovery HTTPS port. + int? ReplicationPort { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaPolicyInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaPolicyInput.json.cs new file mode 100644 index 000000000000..20b5bfddfaa7 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaPolicyInput.json.cs @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Hyper-V Replica specific policy Input. + public partial class HyperVReplicaPolicyInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInput. + /// Note: the Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInput interface is polymorphic, + /// and the precise model class that will get deserialized is determined at runtime based on the payload. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaPolicyInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + if (!(node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json)) + { + return null; + } + // Polymorphic type -- select the appropriate constructor using the discriminator + + switch ( json.StringProperty("instanceType") ) + { + case "HyperVReplica2012R2": + { + return new HyperVReplicaBluePolicyInput(json); + } + } + return new HyperVReplicaPolicyInput(json); + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal HyperVReplicaPolicyInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __policyProviderSpecificInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PolicyProviderSpecificInput(json); + {_recoveryPoint = If( json?.PropertyT("recoveryPoints"), out var __jsonRecoveryPoints) ? (int?)__jsonRecoveryPoints : RecoveryPoint;} + {_applicationConsistentSnapshotFrequencyInHour = If( json?.PropertyT("applicationConsistentSnapshotFrequencyInHours"), out var __jsonApplicationConsistentSnapshotFrequencyInHours) ? (int?)__jsonApplicationConsistentSnapshotFrequencyInHours : ApplicationConsistentSnapshotFrequencyInHour;} + {_compression = If( json?.PropertyT("compression"), out var __jsonCompression) ? (string)__jsonCompression : (string)Compression;} + {_initialReplicationMethod = If( json?.PropertyT("initialReplicationMethod"), out var __jsonInitialReplicationMethod) ? (string)__jsonInitialReplicationMethod : (string)InitialReplicationMethod;} + {_onlineReplicationStartTime = If( json?.PropertyT("onlineReplicationStartTime"), out var __jsonOnlineReplicationStartTime) ? (string)__jsonOnlineReplicationStartTime : (string)OnlineReplicationStartTime;} + {_offlineReplicationImportPath = If( json?.PropertyT("offlineReplicationImportPath"), out var __jsonOfflineReplicationImportPath) ? (string)__jsonOfflineReplicationImportPath : (string)OfflineReplicationImportPath;} + {_offlineReplicationExportPath = If( json?.PropertyT("offlineReplicationExportPath"), out var __jsonOfflineReplicationExportPath) ? (string)__jsonOfflineReplicationExportPath : (string)OfflineReplicationExportPath;} + {_replicationPort = If( json?.PropertyT("replicationPort"), out var __jsonReplicationPort) ? (int?)__jsonReplicationPort : ReplicationPort;} + {_allowedAuthenticationType = If( json?.PropertyT("allowedAuthenticationType"), out var __jsonAllowedAuthenticationType) ? (int?)__jsonAllowedAuthenticationType : AllowedAuthenticationType;} + {_replicaDeletion = If( json?.PropertyT("replicaDeletion"), out var __jsonReplicaDeletion) ? (string)__jsonReplicaDeletion : (string)ReplicaDeletion;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __policyProviderSpecificInput?.ToJson(container, serializationMode); + AddIf( null != this._recoveryPoint ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._recoveryPoint) : null, "recoveryPoints" ,container.Add ); + AddIf( null != this._applicationConsistentSnapshotFrequencyInHour ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._applicationConsistentSnapshotFrequencyInHour) : null, "applicationConsistentSnapshotFrequencyInHours" ,container.Add ); + AddIf( null != (((object)this._compression)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._compression.ToString()) : null, "compression" ,container.Add ); + AddIf( null != (((object)this._initialReplicationMethod)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._initialReplicationMethod.ToString()) : null, "initialReplicationMethod" ,container.Add ); + AddIf( null != (((object)this._onlineReplicationStartTime)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._onlineReplicationStartTime.ToString()) : null, "onlineReplicationStartTime" ,container.Add ); + AddIf( null != (((object)this._offlineReplicationImportPath)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._offlineReplicationImportPath.ToString()) : null, "offlineReplicationImportPath" ,container.Add ); + AddIf( null != (((object)this._offlineReplicationExportPath)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._offlineReplicationExportPath.ToString()) : null, "offlineReplicationExportPath" ,container.Add ); + AddIf( null != this._replicationPort ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._replicationPort) : null, "replicationPort" ,container.Add ); + AddIf( null != this._allowedAuthenticationType ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._allowedAuthenticationType) : null, "allowedAuthenticationType" ,container.Add ); + AddIf( null != (((object)this._replicaDeletion)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._replicaDeletion.ToString()) : null, "replicaDeletion" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaReplicationDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaReplicationDetails.PowerShell.cs new file mode 100644 index 000000000000..7671648f910e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaReplicationDetails.PowerShell.cs @@ -0,0 +1,218 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// HyperV replica 2012 replication details. + [System.ComponentModel.TypeConverter(typeof(HyperVReplicaReplicationDetailsTypeConverter))] + public partial class HyperVReplicaReplicationDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaReplicationDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new HyperVReplicaReplicationDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaReplicationDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new HyperVReplicaReplicationDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaReplicationDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal HyperVReplicaReplicationDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InitialReplicationDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaReplicationDetailsInternal)this).InitialReplicationDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInitialReplicationDetails) content.GetValueForProperty("InitialReplicationDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaReplicationDetailsInternal)this).InitialReplicationDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InitialReplicationDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("LastReplicatedTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaReplicationDetailsInternal)this).LastReplicatedTime = (global::System.DateTime?) content.GetValueForProperty("LastReplicatedTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaReplicationDetailsInternal)this).LastReplicatedTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("VMNic")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaReplicationDetailsInternal)this).VMNic = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetails[]) content.GetValueForProperty("VMNic",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaReplicationDetailsInternal)this).VMNic, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMNicDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("VMId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaReplicationDetailsInternal)this).VMId = (string) content.GetValueForProperty("VMId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaReplicationDetailsInternal)this).VMId, global::System.Convert.ToString); + } + if (content.Contains("VMProtectionState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaReplicationDetailsInternal)this).VMProtectionState = (string) content.GetValueForProperty("VMProtectionState",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaReplicationDetailsInternal)this).VMProtectionState, global::System.Convert.ToString); + } + if (content.Contains("VMProtectionStateDescription")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaReplicationDetailsInternal)this).VMProtectionStateDescription = (string) content.GetValueForProperty("VMProtectionStateDescription",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaReplicationDetailsInternal)this).VMProtectionStateDescription, global::System.Convert.ToString); + } + if (content.Contains("VMDiskDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaReplicationDetailsInternal)this).VMDiskDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskDetails[]) content.GetValueForProperty("VMDiskDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaReplicationDetailsInternal)this).VMDiskDetail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DiskDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettingsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettingsInternal)this).InstanceType, global::System.Convert.ToString); + } + if (content.Contains("InitialReplicationDetailInitialReplicationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaReplicationDetailsInternal)this).InitialReplicationDetailInitialReplicationType = (string) content.GetValueForProperty("InitialReplicationDetailInitialReplicationType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaReplicationDetailsInternal)this).InitialReplicationDetailInitialReplicationType, global::System.Convert.ToString); + } + if (content.Contains("InitialReplicationDetailInitialReplicationProgressPercentage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaReplicationDetailsInternal)this).InitialReplicationDetailInitialReplicationProgressPercentage = (string) content.GetValueForProperty("InitialReplicationDetailInitialReplicationProgressPercentage",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaReplicationDetailsInternal)this).InitialReplicationDetailInitialReplicationProgressPercentage, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal HyperVReplicaReplicationDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InitialReplicationDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaReplicationDetailsInternal)this).InitialReplicationDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInitialReplicationDetails) content.GetValueForProperty("InitialReplicationDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaReplicationDetailsInternal)this).InitialReplicationDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InitialReplicationDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("LastReplicatedTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaReplicationDetailsInternal)this).LastReplicatedTime = (global::System.DateTime?) content.GetValueForProperty("LastReplicatedTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaReplicationDetailsInternal)this).LastReplicatedTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("VMNic")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaReplicationDetailsInternal)this).VMNic = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetails[]) content.GetValueForProperty("VMNic",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaReplicationDetailsInternal)this).VMNic, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMNicDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("VMId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaReplicationDetailsInternal)this).VMId = (string) content.GetValueForProperty("VMId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaReplicationDetailsInternal)this).VMId, global::System.Convert.ToString); + } + if (content.Contains("VMProtectionState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaReplicationDetailsInternal)this).VMProtectionState = (string) content.GetValueForProperty("VMProtectionState",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaReplicationDetailsInternal)this).VMProtectionState, global::System.Convert.ToString); + } + if (content.Contains("VMProtectionStateDescription")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaReplicationDetailsInternal)this).VMProtectionStateDescription = (string) content.GetValueForProperty("VMProtectionStateDescription",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaReplicationDetailsInternal)this).VMProtectionStateDescription, global::System.Convert.ToString); + } + if (content.Contains("VMDiskDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaReplicationDetailsInternal)this).VMDiskDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskDetails[]) content.GetValueForProperty("VMDiskDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaReplicationDetailsInternal)this).VMDiskDetail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DiskDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettingsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettingsInternal)this).InstanceType, global::System.Convert.ToString); + } + if (content.Contains("InitialReplicationDetailInitialReplicationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaReplicationDetailsInternal)this).InitialReplicationDetailInitialReplicationType = (string) content.GetValueForProperty("InitialReplicationDetailInitialReplicationType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaReplicationDetailsInternal)this).InitialReplicationDetailInitialReplicationType, global::System.Convert.ToString); + } + if (content.Contains("InitialReplicationDetailInitialReplicationProgressPercentage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaReplicationDetailsInternal)this).InitialReplicationDetailInitialReplicationProgressPercentage = (string) content.GetValueForProperty("InitialReplicationDetailInitialReplicationProgressPercentage",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaReplicationDetailsInternal)this).InitialReplicationDetailInitialReplicationProgressPercentage, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// HyperV replica 2012 replication details. + [System.ComponentModel.TypeConverter(typeof(HyperVReplicaReplicationDetailsTypeConverter))] + public partial interface IHyperVReplicaReplicationDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaReplicationDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaReplicationDetails.TypeConverter.cs new file mode 100644 index 000000000000..8fb3051fa2d4 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaReplicationDetails.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class HyperVReplicaReplicationDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaReplicationDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaReplicationDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return HyperVReplicaReplicationDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return HyperVReplicaReplicationDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return HyperVReplicaReplicationDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaReplicationDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaReplicationDetails.cs new file mode 100644 index 000000000000..66a32fc04dd5 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaReplicationDetails.cs @@ -0,0 +1,199 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// HyperV replica 2012 replication details. + public partial class HyperVReplicaReplicationDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaReplicationDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaReplicationDetailsInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettings __replicationProviderSpecificSettings = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProviderSpecificSettings(); + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInitialReplicationDetails _initialReplicationDetail; + + /// Initial replication details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInitialReplicationDetails InitialReplicationDetail { get => (this._initialReplicationDetail = this._initialReplicationDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InitialReplicationDetails()); set => this._initialReplicationDetail = value; } + + /// The initial replication progress percentage. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string InitialReplicationDetailInitialReplicationProgressPercentage { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInitialReplicationDetailsInternal)InitialReplicationDetail).InitialReplicationProgressPercentage; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInitialReplicationDetailsInternal)InitialReplicationDetail).InitialReplicationProgressPercentage = value ?? null; } + + /// Initial replication type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string InitialReplicationDetailInitialReplicationType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInitialReplicationDetailsInternal)InitialReplicationDetail).InitialReplicationType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInitialReplicationDetailsInternal)InitialReplicationDetail).InitialReplicationType = value ?? null; } + + /// Gets the Instance type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettingsInternal)__replicationProviderSpecificSettings).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettingsInternal)__replicationProviderSpecificSettings).InstanceType = value ; } + + /// Backing field for property. + private global::System.DateTime? _lastReplicatedTime; + + /// The Last replication time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public global::System.DateTime? LastReplicatedTime { get => this._lastReplicatedTime; set => this._lastReplicatedTime = value; } + + /// Internal Acessors for InitialReplicationDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInitialReplicationDetails Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaReplicationDetailsInternal.InitialReplicationDetail { get => (this._initialReplicationDetail = this._initialReplicationDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InitialReplicationDetails()); set { {_initialReplicationDetail = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskDetails[] _vMDiskDetail; + + /// VM disk details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskDetails[] VMDiskDetail { get => this._vMDiskDetail; set => this._vMDiskDetail = value; } + + /// Backing field for property. + private string _vMId; + + /// The virtual machine Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string VMId { get => this._vMId; set => this._vMId = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetails[] _vMNic; + + /// The PE Network details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetails[] VMNic { get => this._vMNic; set => this._vMNic = value; } + + /// Backing field for property. + private string _vMProtectionState; + + /// The protection state for the vm. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string VMProtectionState { get => this._vMProtectionState; set => this._vMProtectionState = value; } + + /// Backing field for property. + private string _vMProtectionStateDescription; + + /// The protection state description for the vm. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string VMProtectionStateDescription { get => this._vMProtectionStateDescription; set => this._vMProtectionStateDescription = value; } + + /// Creates an new instance. + public HyperVReplicaReplicationDetails() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__replicationProviderSpecificSettings), __replicationProviderSpecificSettings); + await eventListener.AssertObjectIsValid(nameof(__replicationProviderSpecificSettings), __replicationProviderSpecificSettings); + } + } + /// HyperV replica 2012 replication details. + public partial interface IHyperVReplicaReplicationDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettings + { + /// The initial replication progress percentage. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The initial replication progress percentage.", + SerializedName = @"initialReplicationProgressPercentage", + PossibleTypes = new [] { typeof(string) })] + string InitialReplicationDetailInitialReplicationProgressPercentage { get; set; } + /// Initial replication type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Initial replication type.", + SerializedName = @"initialReplicationType", + PossibleTypes = new [] { typeof(string) })] + string InitialReplicationDetailInitialReplicationType { get; set; } + /// The Last replication time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Last replication time.", + SerializedName = @"lastReplicatedTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? LastReplicatedTime { get; set; } + /// VM disk details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"VM disk details.", + SerializedName = @"vMDiskDetails", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskDetails) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskDetails[] VMDiskDetail { get; set; } + /// The virtual machine Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The virtual machine Id.", + SerializedName = @"vmId", + PossibleTypes = new [] { typeof(string) })] + string VMId { get; set; } + /// The PE Network details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The PE Network details.", + SerializedName = @"vmNics", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetails) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetails[] VMNic { get; set; } + /// The protection state for the vm. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The protection state for the vm.", + SerializedName = @"vmProtectionState", + PossibleTypes = new [] { typeof(string) })] + string VMProtectionState { get; set; } + /// The protection state description for the vm. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The protection state description for the vm.", + SerializedName = @"vmProtectionStateDescription", + PossibleTypes = new [] { typeof(string) })] + string VMProtectionStateDescription { get; set; } + + } + /// HyperV replica 2012 replication details. + internal partial interface IHyperVReplicaReplicationDetailsInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettingsInternal + { + /// Initial replication details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInitialReplicationDetails InitialReplicationDetail { get; set; } + /// The initial replication progress percentage. + string InitialReplicationDetailInitialReplicationProgressPercentage { get; set; } + /// Initial replication type. + string InitialReplicationDetailInitialReplicationType { get; set; } + /// The Last replication time. + global::System.DateTime? LastReplicatedTime { get; set; } + /// VM disk details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskDetails[] VMDiskDetail { get; set; } + /// The virtual machine Id. + string VMId { get; set; } + /// The PE Network details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetails[] VMNic { get; set; } + /// The protection state for the vm. + string VMProtectionState { get; set; } + /// The protection state description for the vm. + string VMProtectionStateDescription { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaReplicationDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaReplicationDetails.json.cs new file mode 100644 index 000000000000..ae25d270ae15 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVReplicaReplicationDetails.json.cs @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// HyperV replica 2012 replication details. + public partial class HyperVReplicaReplicationDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaReplicationDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaReplicationDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVReplicaReplicationDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new HyperVReplicaReplicationDetails(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal HyperVReplicaReplicationDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __replicationProviderSpecificSettings = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProviderSpecificSettings(json); + {_initialReplicationDetail = If( json?.PropertyT("initialReplicationDetails"), out var __jsonInitialReplicationDetails) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InitialReplicationDetails.FromJson(__jsonInitialReplicationDetails) : InitialReplicationDetail;} + {_lastReplicatedTime = If( json?.PropertyT("lastReplicatedTime"), out var __jsonLastReplicatedTime) ? global::System.DateTime.TryParse((string)__jsonLastReplicatedTime, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonLastReplicatedTimeValue) ? __jsonLastReplicatedTimeValue : LastReplicatedTime : LastReplicatedTime;} + {_vMNic = If( json?.PropertyT("vmNics"), out var __jsonVMNics) ? If( __jsonVMNics as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetails) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMNicDetails.FromJson(__u) )) ))() : null : VMNic;} + {_vMId = If( json?.PropertyT("vmId"), out var __jsonVMId) ? (string)__jsonVMId : (string)VMId;} + {_vMProtectionState = If( json?.PropertyT("vmProtectionState"), out var __jsonVMProtectionState) ? (string)__jsonVMProtectionState : (string)VMProtectionState;} + {_vMProtectionStateDescription = If( json?.PropertyT("vmProtectionStateDescription"), out var __jsonVMProtectionStateDescription) ? (string)__jsonVMProtectionStateDescription : (string)VMProtectionStateDescription;} + {_vMDiskDetail = If( json?.PropertyT("vMDiskDetails"), out var __jsonVMDiskDetails) ? If( __jsonVMDiskDetails as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __q) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__q, (__p)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskDetails) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DiskDetails.FromJson(__p) )) ))() : null : VMDiskDetail;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __replicationProviderSpecificSettings?.ToJson(container, serializationMode); + AddIf( null != this._initialReplicationDetail ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._initialReplicationDetail.ToJson(null,serializationMode) : null, "initialReplicationDetails" ,container.Add ); + AddIf( null != this._lastReplicatedTime ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._lastReplicatedTime?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "lastReplicatedTime" ,container.Add ); + if (null != this._vMNic) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._vMNic ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("vmNics",__w); + } + AddIf( null != (((object)this._vMId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._vMId.ToString()) : null, "vmId" ,container.Add ); + AddIf( null != (((object)this._vMProtectionState)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._vMProtectionState.ToString()) : null, "vmProtectionState" ,container.Add ); + AddIf( null != (((object)this._vMProtectionStateDescription)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._vMProtectionStateDescription.ToString()) : null, "vmProtectionStateDescription" ,container.Add ); + if (null != this._vMDiskDetail) + { + var __r = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __s in this._vMDiskDetail ) + { + AddIf(__s?.ToJson(null, serializationMode) ,__r.Add); + } + container.Add("vMDiskDetails",__r); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVSiteDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVSiteDetails.PowerShell.cs new file mode 100644 index 000000000000..1f6c360c7ef8 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVSiteDetails.PowerShell.cs @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// HyperVSite fabric specific details. + [System.ComponentModel.TypeConverter(typeof(HyperVSiteDetailsTypeConverter))] + public partial class HyperVSiteDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVSiteDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new HyperVSiteDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVSiteDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new HyperVSiteDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVSiteDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal HyperVSiteDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("HyperVHost")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVSiteDetailsInternal)this).HyperVHost = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVHostDetails[]) content.GetValueForProperty("HyperVHost",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVSiteDetailsInternal)this).HyperVHost, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVHostDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal HyperVSiteDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("HyperVHost")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVSiteDetailsInternal)this).HyperVHost = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVHostDetails[]) content.GetValueForProperty("HyperVHost",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVSiteDetailsInternal)this).HyperVHost, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVHostDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// HyperVSite fabric specific details. + [System.ComponentModel.TypeConverter(typeof(HyperVSiteDetailsTypeConverter))] + public partial interface IHyperVSiteDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVSiteDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVSiteDetails.TypeConverter.cs new file mode 100644 index 000000000000..6da90df1eb58 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVSiteDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class HyperVSiteDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVSiteDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVSiteDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return HyperVSiteDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return HyperVSiteDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return HyperVSiteDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVSiteDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVSiteDetails.cs new file mode 100644 index 000000000000..401e1f8639e5 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVSiteDetails.cs @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// HyperVSite fabric specific details. + public partial class HyperVSiteDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVSiteDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVSiteDetailsInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificDetails __fabricSpecificDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FabricSpecificDetails(); + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVHostDetails[] _hyperVHost; + + /// The list of Hyper-V hosts associated with the fabric. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVHostDetails[] HyperVHost { get => this._hyperVHost; set => this._hyperVHost = value; } + + /// Gets the class type. Overridden in derived classes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificDetailsInternal)__fabricSpecificDetails).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificDetailsInternal)__fabricSpecificDetails).InstanceType = value ; } + + /// Creates an new instance. + public HyperVSiteDetails() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__fabricSpecificDetails), __fabricSpecificDetails); + await eventListener.AssertObjectIsValid(nameof(__fabricSpecificDetails), __fabricSpecificDetails); + } + } + /// HyperVSite fabric specific details. + public partial interface IHyperVSiteDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificDetails + { + /// The list of Hyper-V hosts associated with the fabric. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of Hyper-V hosts associated with the fabric.", + SerializedName = @"hyperVHosts", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVHostDetails) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVHostDetails[] HyperVHost { get; set; } + + } + /// HyperVSite fabric specific details. + internal partial interface IHyperVSiteDetailsInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificDetailsInternal + { + /// The list of Hyper-V hosts associated with the fabric. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVHostDetails[] HyperVHost { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVSiteDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVSiteDetails.json.cs new file mode 100644 index 000000000000..7ed7d4abfb0c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVSiteDetails.json.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// HyperVSite fabric specific details. + public partial class HyperVSiteDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVSiteDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVSiteDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVSiteDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new HyperVSiteDetails(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal HyperVSiteDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __fabricSpecificDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FabricSpecificDetails(json); + {_hyperVHost = If( json?.PropertyT("hyperVHosts"), out var __jsonHyperVHosts) ? If( __jsonHyperVHosts as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVHostDetails) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVHostDetails.FromJson(__u) )) ))() : null : HyperVHost;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __fabricSpecificDetails?.ToJson(container, serializationMode); + if (null != this._hyperVHost) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._hyperVHost ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("hyperVHosts",__w); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVVirtualMachineDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVVirtualMachineDetails.PowerShell.cs new file mode 100644 index 000000000000..a4d47a8b93c5 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVVirtualMachineDetails.PowerShell.cs @@ -0,0 +1,258 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Single Host fabric provider specific VM settings. + [System.ComponentModel.TypeConverter(typeof(HyperVVirtualMachineDetailsTypeConverter))] + public partial class HyperVVirtualMachineDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new HyperVVirtualMachineDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new HyperVVirtualMachineDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal HyperVVirtualMachineDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("OSDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).OSDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDetails) content.GetValueForProperty("OSDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).OSDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.OSDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("SourceItemId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).SourceItemId = (string) content.GetValueForProperty("SourceItemId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).SourceItemId, global::System.Convert.ToString); + } + if (content.Contains("Generation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).Generation = (string) content.GetValueForProperty("Generation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).Generation, global::System.Convert.ToString); + } + if (content.Contains("DiskDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).DiskDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskDetails[]) content.GetValueForProperty("DiskDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).DiskDetail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DiskDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("HasPhysicalDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).HasPhysicalDisk = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PresenceStatus?) content.GetValueForProperty("HasPhysicalDisk",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).HasPhysicalDisk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PresenceStatus.CreateFrom); + } + if (content.Contains("HasFibreChannelAdapter")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).HasFibreChannelAdapter = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PresenceStatus?) content.GetValueForProperty("HasFibreChannelAdapter",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).HasFibreChannelAdapter, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PresenceStatus.CreateFrom); + } + if (content.Contains("HasSharedVhd")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).HasSharedVhd = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PresenceStatus?) content.GetValueForProperty("HasSharedVhd",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).HasSharedVhd, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PresenceStatus.CreateFrom); + } + if (content.Contains("HyperVHostId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).HyperVHostId = (string) content.GetValueForProperty("HyperVHostId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).HyperVHostId, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigurationSettingsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigurationSettingsInternal)this).InstanceType, global::System.Convert.ToString); + } + if (content.Contains("OSDetailOstype")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).OSDetailOstype = (string) content.GetValueForProperty("OSDetailOstype",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).OSDetailOstype, global::System.Convert.ToString); + } + if (content.Contains("OSDetailProductType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).OSDetailProductType = (string) content.GetValueForProperty("OSDetailProductType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).OSDetailProductType, global::System.Convert.ToString); + } + if (content.Contains("OSDetailOsedition")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).OSDetailOsedition = (string) content.GetValueForProperty("OSDetailOsedition",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).OSDetailOsedition, global::System.Convert.ToString); + } + if (content.Contains("OSDetailOsversion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).OSDetailOsversion = (string) content.GetValueForProperty("OSDetailOsversion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).OSDetailOsversion, global::System.Convert.ToString); + } + if (content.Contains("OSDetailOsmajorVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).OSDetailOsmajorVersion = (string) content.GetValueForProperty("OSDetailOsmajorVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).OSDetailOsmajorVersion, global::System.Convert.ToString); + } + if (content.Contains("OSDetailOsminorVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).OSDetailOsminorVersion = (string) content.GetValueForProperty("OSDetailOsminorVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).OSDetailOsminorVersion, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal HyperVVirtualMachineDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("OSDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).OSDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDetails) content.GetValueForProperty("OSDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).OSDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.OSDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("SourceItemId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).SourceItemId = (string) content.GetValueForProperty("SourceItemId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).SourceItemId, global::System.Convert.ToString); + } + if (content.Contains("Generation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).Generation = (string) content.GetValueForProperty("Generation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).Generation, global::System.Convert.ToString); + } + if (content.Contains("DiskDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).DiskDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskDetails[]) content.GetValueForProperty("DiskDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).DiskDetail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DiskDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("HasPhysicalDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).HasPhysicalDisk = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PresenceStatus?) content.GetValueForProperty("HasPhysicalDisk",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).HasPhysicalDisk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PresenceStatus.CreateFrom); + } + if (content.Contains("HasFibreChannelAdapter")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).HasFibreChannelAdapter = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PresenceStatus?) content.GetValueForProperty("HasFibreChannelAdapter",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).HasFibreChannelAdapter, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PresenceStatus.CreateFrom); + } + if (content.Contains("HasSharedVhd")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).HasSharedVhd = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PresenceStatus?) content.GetValueForProperty("HasSharedVhd",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).HasSharedVhd, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PresenceStatus.CreateFrom); + } + if (content.Contains("HyperVHostId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).HyperVHostId = (string) content.GetValueForProperty("HyperVHostId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).HyperVHostId, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigurationSettingsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigurationSettingsInternal)this).InstanceType, global::System.Convert.ToString); + } + if (content.Contains("OSDetailOstype")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).OSDetailOstype = (string) content.GetValueForProperty("OSDetailOstype",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).OSDetailOstype, global::System.Convert.ToString); + } + if (content.Contains("OSDetailProductType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).OSDetailProductType = (string) content.GetValueForProperty("OSDetailProductType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).OSDetailProductType, global::System.Convert.ToString); + } + if (content.Contains("OSDetailOsedition")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).OSDetailOsedition = (string) content.GetValueForProperty("OSDetailOsedition",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).OSDetailOsedition, global::System.Convert.ToString); + } + if (content.Contains("OSDetailOsversion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).OSDetailOsversion = (string) content.GetValueForProperty("OSDetailOsversion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).OSDetailOsversion, global::System.Convert.ToString); + } + if (content.Contains("OSDetailOsmajorVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).OSDetailOsmajorVersion = (string) content.GetValueForProperty("OSDetailOsmajorVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).OSDetailOsmajorVersion, global::System.Convert.ToString); + } + if (content.Contains("OSDetailOsminorVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).OSDetailOsminorVersion = (string) content.GetValueForProperty("OSDetailOsminorVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).OSDetailOsminorVersion, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Single Host fabric provider specific VM settings. + [System.ComponentModel.TypeConverter(typeof(HyperVVirtualMachineDetailsTypeConverter))] + public partial interface IHyperVVirtualMachineDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVVirtualMachineDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVVirtualMachineDetails.TypeConverter.cs new file mode 100644 index 000000000000..501c1ce8d5ac --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVVirtualMachineDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class HyperVVirtualMachineDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return HyperVVirtualMachineDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return HyperVVirtualMachineDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return HyperVVirtualMachineDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVVirtualMachineDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVVirtualMachineDetails.cs new file mode 100644 index 000000000000..c905b550c065 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVVirtualMachineDetails.cs @@ -0,0 +1,293 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Single Host fabric provider specific VM settings. + public partial class HyperVVirtualMachineDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigurationSettings __configurationSettings = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ConfigurationSettings(); + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskDetails[] _diskDetail; + + /// The Last successful failover time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskDetails[] DiskDetail { get => this._diskDetail; set => this._diskDetail = value; } + + /// Backing field for property. + private string _generation; + + /// The id of the object in fabric. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Generation { get => this._generation; set => this._generation = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PresenceStatus? _hasFibreChannelAdapter; + + /// + /// A value indicating whether the VM has a fibre channel adapter attached. String value of SrsDataContract.PresenceStatus + /// enum. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PresenceStatus? HasFibreChannelAdapter { get => this._hasFibreChannelAdapter; set => this._hasFibreChannelAdapter = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PresenceStatus? _hasPhysicalDisk; + + /// + /// A value indicating whether the VM has a physical disk attached. String value of SrsDataContract.PresenceStatus enum. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PresenceStatus? HasPhysicalDisk { get => this._hasPhysicalDisk; set => this._hasPhysicalDisk = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PresenceStatus? _hasSharedVhd; + + /// + /// A value indicating whether the VM has a shared VHD attached. String value of SrsDataContract.PresenceStatus enum. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PresenceStatus? HasSharedVhd { get => this._hasSharedVhd; set => this._hasSharedVhd = value; } + + /// Backing field for property. + private string _hyperVHostId; + + /// The Id of the hyper-v host in fabric. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string HyperVHostId { get => this._hyperVHostId; set => this._hyperVHostId = value; } + + /// Gets the class type. Overridden in derived classes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigurationSettingsInternal)__configurationSettings).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigurationSettingsInternal)__configurationSettings).InstanceType = value ; } + + /// Internal Acessors for OSDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDetails Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal.OSDetail { get => (this._oSDetail = this._oSDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.OSDetails()); set { {_oSDetail = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDetails _oSDetail; + + /// The Last replication time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDetails OSDetail { get => (this._oSDetail = this._oSDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.OSDetails()); set => this._oSDetail = value; } + + /// The OSEdition. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string OSDetailOsedition { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDetailsInternal)OSDetail).OSEdition; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDetailsInternal)OSDetail).OSEdition = value ?? null; } + + /// The OS Major Version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string OSDetailOsmajorVersion { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDetailsInternal)OSDetail).OSMajorVersion; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDetailsInternal)OSDetail).OSMajorVersion = value ?? null; } + + /// The OS Minor Version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string OSDetailOsminorVersion { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDetailsInternal)OSDetail).OSMinorVersion; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDetailsInternal)OSDetail).OSMinorVersion = value ?? null; } + + /// VM Disk details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string OSDetailOstype { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDetailsInternal)OSDetail).OSType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDetailsInternal)OSDetail).OSType = value ?? null; } + + /// The OS Version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string OSDetailOsversion { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDetailsInternal)OSDetail).OSVersion; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDetailsInternal)OSDetail).OSVersion = value ?? null; } + + /// Product type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string OSDetailProductType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDetailsInternal)OSDetail).ProductType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDetailsInternal)OSDetail).ProductType = value ?? null; } + + /// Backing field for property. + private string _sourceItemId; + + /// The source id of the object. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string SourceItemId { get => this._sourceItemId; set => this._sourceItemId = value; } + + /// Creates an new instance. + public HyperVVirtualMachineDetails() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__configurationSettings), __configurationSettings); + await eventListener.AssertObjectIsValid(nameof(__configurationSettings), __configurationSettings); + } + } + /// Single Host fabric provider specific VM settings. + public partial interface IHyperVVirtualMachineDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigurationSettings + { + /// The Last successful failover time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Last successful failover time.", + SerializedName = @"diskDetails", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskDetails) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskDetails[] DiskDetail { get; set; } + /// The id of the object in fabric. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The id of the object in fabric.", + SerializedName = @"generation", + PossibleTypes = new [] { typeof(string) })] + string Generation { get; set; } + /// + /// A value indicating whether the VM has a fibre channel adapter attached. String value of SrsDataContract.PresenceStatus + /// enum. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether the VM has a fibre channel adapter attached. String value of SrsDataContract.PresenceStatus enum.", + SerializedName = @"hasFibreChannelAdapter", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PresenceStatus) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PresenceStatus? HasFibreChannelAdapter { get; set; } + /// + /// A value indicating whether the VM has a physical disk attached. String value of SrsDataContract.PresenceStatus enum. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether the VM has a physical disk attached. String value of SrsDataContract.PresenceStatus enum.", + SerializedName = @"hasPhysicalDisk", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PresenceStatus) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PresenceStatus? HasPhysicalDisk { get; set; } + /// + /// A value indicating whether the VM has a shared VHD attached. String value of SrsDataContract.PresenceStatus enum. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether the VM has a shared VHD attached. String value of SrsDataContract.PresenceStatus enum.", + SerializedName = @"hasSharedVhd", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PresenceStatus) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PresenceStatus? HasSharedVhd { get; set; } + /// The Id of the hyper-v host in fabric. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Id of the hyper-v host in fabric.", + SerializedName = @"hyperVHostId", + PossibleTypes = new [] { typeof(string) })] + string HyperVHostId { get; set; } + /// The OSEdition. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The OSEdition.", + SerializedName = @"osEdition", + PossibleTypes = new [] { typeof(string) })] + string OSDetailOsedition { get; set; } + /// The OS Major Version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The OS Major Version.", + SerializedName = @"oSMajorVersion", + PossibleTypes = new [] { typeof(string) })] + string OSDetailOsmajorVersion { get; set; } + /// The OS Minor Version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The OS Minor Version.", + SerializedName = @"oSMinorVersion", + PossibleTypes = new [] { typeof(string) })] + string OSDetailOsminorVersion { get; set; } + /// VM Disk details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"VM Disk details.", + SerializedName = @"osType", + PossibleTypes = new [] { typeof(string) })] + string OSDetailOstype { get; set; } + /// The OS Version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The OS Version.", + SerializedName = @"oSVersion", + PossibleTypes = new [] { typeof(string) })] + string OSDetailOsversion { get; set; } + /// Product type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Product type.", + SerializedName = @"productType", + PossibleTypes = new [] { typeof(string) })] + string OSDetailProductType { get; set; } + /// The source id of the object. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The source id of the object.", + SerializedName = @"sourceItemId", + PossibleTypes = new [] { typeof(string) })] + string SourceItemId { get; set; } + + } + /// Single Host fabric provider specific VM settings. + internal partial interface IHyperVVirtualMachineDetailsInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigurationSettingsInternal + { + /// The Last successful failover time. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskDetails[] DiskDetail { get; set; } + /// The id of the object in fabric. + string Generation { get; set; } + /// + /// A value indicating whether the VM has a fibre channel adapter attached. String value of SrsDataContract.PresenceStatus + /// enum. + /// + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PresenceStatus? HasFibreChannelAdapter { get; set; } + /// + /// A value indicating whether the VM has a physical disk attached. String value of SrsDataContract.PresenceStatus enum. + /// + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PresenceStatus? HasPhysicalDisk { get; set; } + /// + /// A value indicating whether the VM has a shared VHD attached. String value of SrsDataContract.PresenceStatus enum. + /// + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PresenceStatus? HasSharedVhd { get; set; } + /// The Id of the hyper-v host in fabric. + string HyperVHostId { get; set; } + /// The Last replication time. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDetails OSDetail { get; set; } + /// The OSEdition. + string OSDetailOsedition { get; set; } + /// The OS Major Version. + string OSDetailOsmajorVersion { get; set; } + /// The OS Minor Version. + string OSDetailOsminorVersion { get; set; } + /// VM Disk details. + string OSDetailOstype { get; set; } + /// The OS Version. + string OSDetailOsversion { get; set; } + /// Product type. + string OSDetailProductType { get; set; } + /// The source id of the object. + string SourceItemId { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVVirtualMachineDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVVirtualMachineDetails.json.cs new file mode 100644 index 000000000000..0857a1290850 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/HyperVVirtualMachineDetails.json.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Single Host fabric provider specific VM settings. + public partial class HyperVVirtualMachineDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetails. + /// Note: the Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetails interface is polymorphic, + /// and the precise model class that will get deserialized is determined at runtime based on the payload. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + if (!(node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json)) + { + return null; + } + // Polymorphic type -- select the appropriate constructor using the discriminator + + switch ( json.StringProperty("instanceType") ) + { + case "VmmVirtualMachine": + { + return new VmmVirtualMachineDetails(json); + } + } + return new HyperVVirtualMachineDetails(json); + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal HyperVVirtualMachineDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __configurationSettings = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ConfigurationSettings(json); + {_oSDetail = If( json?.PropertyT("osDetails"), out var __jsonOSDetails) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.OSDetails.FromJson(__jsonOSDetails) : OSDetail;} + {_sourceItemId = If( json?.PropertyT("sourceItemId"), out var __jsonSourceItemId) ? (string)__jsonSourceItemId : (string)SourceItemId;} + {_generation = If( json?.PropertyT("generation"), out var __jsonGeneration) ? (string)__jsonGeneration : (string)Generation;} + {_diskDetail = If( json?.PropertyT("diskDetails"), out var __jsonDiskDetails) ? If( __jsonDiskDetails as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskDetails) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DiskDetails.FromJson(__u) )) ))() : null : DiskDetail;} + {_hasPhysicalDisk = If( json?.PropertyT("hasPhysicalDisk"), out var __jsonHasPhysicalDisk) ? (string)__jsonHasPhysicalDisk : (string)HasPhysicalDisk;} + {_hasFibreChannelAdapter = If( json?.PropertyT("hasFibreChannelAdapter"), out var __jsonHasFibreChannelAdapter) ? (string)__jsonHasFibreChannelAdapter : (string)HasFibreChannelAdapter;} + {_hasSharedVhd = If( json?.PropertyT("hasSharedVhd"), out var __jsonHasSharedVhd) ? (string)__jsonHasSharedVhd : (string)HasSharedVhd;} + {_hyperVHostId = If( json?.PropertyT("hyperVHostId"), out var __jsonHyperVHostId) ? (string)__jsonHyperVHostId : (string)HyperVHostId;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __configurationSettings?.ToJson(container, serializationMode); + AddIf( null != this._oSDetail ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._oSDetail.ToJson(null,serializationMode) : null, "osDetails" ,container.Add ); + AddIf( null != (((object)this._sourceItemId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._sourceItemId.ToString()) : null, "sourceItemId" ,container.Add ); + AddIf( null != (((object)this._generation)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._generation.ToString()) : null, "generation" ,container.Add ); + if (null != this._diskDetail) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._diskDetail ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("diskDetails",__w); + } + AddIf( null != (((object)this._hasPhysicalDisk)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._hasPhysicalDisk.ToString()) : null, "hasPhysicalDisk" ,container.Add ); + AddIf( null != (((object)this._hasFibreChannelAdapter)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._hasFibreChannelAdapter.ToString()) : null, "hasFibreChannelAdapter" ,container.Add ); + AddIf( null != (((object)this._hasSharedVhd)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._hasSharedVhd.ToString()) : null, "hasSharedVhd" ,container.Add ); + AddIf( null != (((object)this._hyperVHostId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._hyperVHostId.ToString()) : null, "hyperVHostId" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/IPConfigDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/IPConfigDetails.PowerShell.cs new file mode 100644 index 000000000000..49b8c3d278b4 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/IPConfigDetails.PowerShell.cs @@ -0,0 +1,254 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + [System.ComponentModel.TypeConverter(typeof(IPConfigDetailsTypeConverter))] + public partial class IPConfigDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new IPConfigDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new IPConfigDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal IPConfigDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigDetailsInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigDetailsInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("IsPrimary")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigDetailsInternal)this).IsPrimary = (bool?) content.GetValueForProperty("IsPrimary",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigDetailsInternal)this).IsPrimary, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("SubnetName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigDetailsInternal)this).SubnetName = (string) content.GetValueForProperty("SubnetName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigDetailsInternal)this).SubnetName, global::System.Convert.ToString); + } + if (content.Contains("StaticIPAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigDetailsInternal)this).StaticIPAddress = (string) content.GetValueForProperty("StaticIPAddress",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigDetailsInternal)this).StaticIPAddress, global::System.Convert.ToString); + } + if (content.Contains("IPAddressType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigDetailsInternal)this).IPAddressType = (string) content.GetValueForProperty("IPAddressType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigDetailsInternal)this).IPAddressType, global::System.Convert.ToString); + } + if (content.Contains("IsSeletedForFailover")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigDetailsInternal)this).IsSeletedForFailover = (bool?) content.GetValueForProperty("IsSeletedForFailover",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigDetailsInternal)this).IsSeletedForFailover, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("RecoverySubnetName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigDetailsInternal)this).RecoverySubnetName = (string) content.GetValueForProperty("RecoverySubnetName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigDetailsInternal)this).RecoverySubnetName, global::System.Convert.ToString); + } + if (content.Contains("RecoveryStaticIPAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigDetailsInternal)this).RecoveryStaticIPAddress = (string) content.GetValueForProperty("RecoveryStaticIPAddress",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigDetailsInternal)this).RecoveryStaticIPAddress, global::System.Convert.ToString); + } + if (content.Contains("RecoveryIPAddressType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigDetailsInternal)this).RecoveryIPAddressType = (string) content.GetValueForProperty("RecoveryIPAddressType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigDetailsInternal)this).RecoveryIPAddressType, global::System.Convert.ToString); + } + if (content.Contains("RecoveryPublicIPAddressId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigDetailsInternal)this).RecoveryPublicIPAddressId = (string) content.GetValueForProperty("RecoveryPublicIPAddressId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigDetailsInternal)this).RecoveryPublicIPAddressId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryLbBackendAddressPoolId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigDetailsInternal)this).RecoveryLbBackendAddressPoolId = (string[]) content.GetValueForProperty("RecoveryLbBackendAddressPoolId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigDetailsInternal)this).RecoveryLbBackendAddressPoolId, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("TfoSubnetName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigDetailsInternal)this).TfoSubnetName = (string) content.GetValueForProperty("TfoSubnetName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigDetailsInternal)this).TfoSubnetName, global::System.Convert.ToString); + } + if (content.Contains("TfoStaticIPAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigDetailsInternal)this).TfoStaticIPAddress = (string) content.GetValueForProperty("TfoStaticIPAddress",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigDetailsInternal)this).TfoStaticIPAddress, global::System.Convert.ToString); + } + if (content.Contains("TfoPublicIPAddressId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigDetailsInternal)this).TfoPublicIPAddressId = (string) content.GetValueForProperty("TfoPublicIPAddressId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigDetailsInternal)this).TfoPublicIPAddressId, global::System.Convert.ToString); + } + if (content.Contains("TfoLbBackendAddressPoolId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigDetailsInternal)this).TfoLbBackendAddressPoolId = (string[]) content.GetValueForProperty("TfoLbBackendAddressPoolId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigDetailsInternal)this).TfoLbBackendAddressPoolId, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal IPConfigDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigDetailsInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigDetailsInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("IsPrimary")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigDetailsInternal)this).IsPrimary = (bool?) content.GetValueForProperty("IsPrimary",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigDetailsInternal)this).IsPrimary, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("SubnetName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigDetailsInternal)this).SubnetName = (string) content.GetValueForProperty("SubnetName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigDetailsInternal)this).SubnetName, global::System.Convert.ToString); + } + if (content.Contains("StaticIPAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigDetailsInternal)this).StaticIPAddress = (string) content.GetValueForProperty("StaticIPAddress",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigDetailsInternal)this).StaticIPAddress, global::System.Convert.ToString); + } + if (content.Contains("IPAddressType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigDetailsInternal)this).IPAddressType = (string) content.GetValueForProperty("IPAddressType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigDetailsInternal)this).IPAddressType, global::System.Convert.ToString); + } + if (content.Contains("IsSeletedForFailover")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigDetailsInternal)this).IsSeletedForFailover = (bool?) content.GetValueForProperty("IsSeletedForFailover",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigDetailsInternal)this).IsSeletedForFailover, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("RecoverySubnetName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigDetailsInternal)this).RecoverySubnetName = (string) content.GetValueForProperty("RecoverySubnetName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigDetailsInternal)this).RecoverySubnetName, global::System.Convert.ToString); + } + if (content.Contains("RecoveryStaticIPAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigDetailsInternal)this).RecoveryStaticIPAddress = (string) content.GetValueForProperty("RecoveryStaticIPAddress",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigDetailsInternal)this).RecoveryStaticIPAddress, global::System.Convert.ToString); + } + if (content.Contains("RecoveryIPAddressType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigDetailsInternal)this).RecoveryIPAddressType = (string) content.GetValueForProperty("RecoveryIPAddressType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigDetailsInternal)this).RecoveryIPAddressType, global::System.Convert.ToString); + } + if (content.Contains("RecoveryPublicIPAddressId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigDetailsInternal)this).RecoveryPublicIPAddressId = (string) content.GetValueForProperty("RecoveryPublicIPAddressId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigDetailsInternal)this).RecoveryPublicIPAddressId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryLbBackendAddressPoolId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigDetailsInternal)this).RecoveryLbBackendAddressPoolId = (string[]) content.GetValueForProperty("RecoveryLbBackendAddressPoolId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigDetailsInternal)this).RecoveryLbBackendAddressPoolId, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("TfoSubnetName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigDetailsInternal)this).TfoSubnetName = (string) content.GetValueForProperty("TfoSubnetName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigDetailsInternal)this).TfoSubnetName, global::System.Convert.ToString); + } + if (content.Contains("TfoStaticIPAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigDetailsInternal)this).TfoStaticIPAddress = (string) content.GetValueForProperty("TfoStaticIPAddress",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigDetailsInternal)this).TfoStaticIPAddress, global::System.Convert.ToString); + } + if (content.Contains("TfoPublicIPAddressId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigDetailsInternal)this).TfoPublicIPAddressId = (string) content.GetValueForProperty("TfoPublicIPAddressId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigDetailsInternal)this).TfoPublicIPAddressId, global::System.Convert.ToString); + } + if (content.Contains("TfoLbBackendAddressPoolId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigDetailsInternal)this).TfoLbBackendAddressPoolId = (string[]) content.GetValueForProperty("TfoLbBackendAddressPoolId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigDetailsInternal)this).TfoLbBackendAddressPoolId, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + [System.ComponentModel.TypeConverter(typeof(IPConfigDetailsTypeConverter))] + public partial interface IIPConfigDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/IPConfigDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/IPConfigDetails.TypeConverter.cs new file mode 100644 index 000000000000..ef26d4f507ae --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/IPConfigDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class IPConfigDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return IPConfigDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return IPConfigDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return IPConfigDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/IPConfigDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/IPConfigDetails.cs new file mode 100644 index 000000000000..df0eb748f510 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/IPConfigDetails.cs @@ -0,0 +1,269 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + public partial class IPConfigDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigDetailsInternal + { + + /// Backing field for property. + private string _iPAddressType; + + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string IPAddressType { get => this._iPAddressType; set => this._iPAddressType = value; } + + /// Backing field for property. + private bool? _isPrimary; + + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public bool? IsPrimary { get => this._isPrimary; set => this._isPrimary = value; } + + /// Backing field for property. + private bool? _isSeletedForFailover; + + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public bool? IsSeletedForFailover { get => this._isSeletedForFailover; set => this._isSeletedForFailover = value; } + + /// Backing field for property. + private string _name; + + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Name { get => this._name; set => this._name = value; } + + /// Backing field for property. + private string _recoveryIPAddressType; + + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryIPAddressType { get => this._recoveryIPAddressType; set => this._recoveryIPAddressType = value; } + + /// Backing field for property. + private string[] _recoveryLbBackendAddressPoolId; + + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string[] RecoveryLbBackendAddressPoolId { get => this._recoveryLbBackendAddressPoolId; set => this._recoveryLbBackendAddressPoolId = value; } + + /// Backing field for property. + private string _recoveryPublicIPAddressId; + + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryPublicIPAddressId { get => this._recoveryPublicIPAddressId; set => this._recoveryPublicIPAddressId = value; } + + /// Backing field for property. + private string _recoveryStaticIPAddress; + + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryStaticIPAddress { get => this._recoveryStaticIPAddress; set => this._recoveryStaticIPAddress = value; } + + /// Backing field for property. + private string _recoverySubnetName; + + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoverySubnetName { get => this._recoverySubnetName; set => this._recoverySubnetName = value; } + + /// Backing field for property. + private string _staticIPAddress; + + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string StaticIPAddress { get => this._staticIPAddress; set => this._staticIPAddress = value; } + + /// Backing field for property. + private string _subnetName; + + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string SubnetName { get => this._subnetName; set => this._subnetName = value; } + + /// Backing field for property. + private string[] _tfoLbBackendAddressPoolId; + + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string[] TfoLbBackendAddressPoolId { get => this._tfoLbBackendAddressPoolId; set => this._tfoLbBackendAddressPoolId = value; } + + /// Backing field for property. + private string _tfoPublicIPAddressId; + + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TfoPublicIPAddressId { get => this._tfoPublicIPAddressId; set => this._tfoPublicIPAddressId = value; } + + /// Backing field for property. + private string _tfoStaticIPAddress; + + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TfoStaticIPAddress { get => this._tfoStaticIPAddress; set => this._tfoStaticIPAddress = value; } + + /// Backing field for property. + private string _tfoSubnetName; + + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TfoSubnetName { get => this._tfoSubnetName; set => this._tfoSubnetName = value; } + + /// Creates an new instance. + public IPConfigDetails() + { + + } + } + public partial interface IIPConfigDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"", + SerializedName = @"ipAddressType", + PossibleTypes = new [] { typeof(string) })] + string IPAddressType { get; set; } + + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"", + SerializedName = @"isPrimary", + PossibleTypes = new [] { typeof(bool) })] + bool? IsPrimary { get; set; } + + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"", + SerializedName = @"isSeletedForFailover", + PossibleTypes = new [] { typeof(bool) })] + bool? IsSeletedForFailover { get; set; } + + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string Name { get; set; } + + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"", + SerializedName = @"recoveryIPAddressType", + PossibleTypes = new [] { typeof(string) })] + string RecoveryIPAddressType { get; set; } + + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"", + SerializedName = @"recoveryLBBackendAddressPoolIds", + PossibleTypes = new [] { typeof(string) })] + string[] RecoveryLbBackendAddressPoolId { get; set; } + + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"", + SerializedName = @"recoveryPublicIPAddressId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryPublicIPAddressId { get; set; } + + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"", + SerializedName = @"recoveryStaticIPAddress", + PossibleTypes = new [] { typeof(string) })] + string RecoveryStaticIPAddress { get; set; } + + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"", + SerializedName = @"recoverySubnetName", + PossibleTypes = new [] { typeof(string) })] + string RecoverySubnetName { get; set; } + + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"", + SerializedName = @"staticIPAddress", + PossibleTypes = new [] { typeof(string) })] + string StaticIPAddress { get; set; } + + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"", + SerializedName = @"subnetName", + PossibleTypes = new [] { typeof(string) })] + string SubnetName { get; set; } + + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"", + SerializedName = @"tfoLBBackendAddressPoolIds", + PossibleTypes = new [] { typeof(string) })] + string[] TfoLbBackendAddressPoolId { get; set; } + + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"", + SerializedName = @"tfoPublicIPAddressId", + PossibleTypes = new [] { typeof(string) })] + string TfoPublicIPAddressId { get; set; } + + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"", + SerializedName = @"tfoStaticIPAddress", + PossibleTypes = new [] { typeof(string) })] + string TfoStaticIPAddress { get; set; } + + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"", + SerializedName = @"tfoSubnetName", + PossibleTypes = new [] { typeof(string) })] + string TfoSubnetName { get; set; } + + } + internal partial interface IIPConfigDetailsInternal + + { + string IPAddressType { get; set; } + + bool? IsPrimary { get; set; } + + bool? IsSeletedForFailover { get; set; } + + string Name { get; set; } + + string RecoveryIPAddressType { get; set; } + + string[] RecoveryLbBackendAddressPoolId { get; set; } + + string RecoveryPublicIPAddressId { get; set; } + + string RecoveryStaticIPAddress { get; set; } + + string RecoverySubnetName { get; set; } + + string StaticIPAddress { get; set; } + + string SubnetName { get; set; } + + string[] TfoLbBackendAddressPoolId { get; set; } + + string TfoPublicIPAddressId { get; set; } + + string TfoStaticIPAddress { get; set; } + + string TfoSubnetName { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/IPConfigDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/IPConfigDetails.json.cs new file mode 100644 index 000000000000..7fed29ec9603 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/IPConfigDetails.json.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + public partial class IPConfigDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new IPConfigDetails(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal IPConfigDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)Name;} + {_isPrimary = If( json?.PropertyT("isPrimary"), out var __jsonIsPrimary) ? (bool?)__jsonIsPrimary : IsPrimary;} + {_subnetName = If( json?.PropertyT("subnetName"), out var __jsonSubnetName) ? (string)__jsonSubnetName : (string)SubnetName;} + {_staticIPAddress = If( json?.PropertyT("staticIPAddress"), out var __jsonStaticIPAddress) ? (string)__jsonStaticIPAddress : (string)StaticIPAddress;} + {_iPAddressType = If( json?.PropertyT("ipAddressType"), out var __jsonIPAddressType) ? (string)__jsonIPAddressType : (string)IPAddressType;} + {_isSeletedForFailover = If( json?.PropertyT("isSeletedForFailover"), out var __jsonIsSeletedForFailover) ? (bool?)__jsonIsSeletedForFailover : IsSeletedForFailover;} + {_recoverySubnetName = If( json?.PropertyT("recoverySubnetName"), out var __jsonRecoverySubnetName) ? (string)__jsonRecoverySubnetName : (string)RecoverySubnetName;} + {_recoveryStaticIPAddress = If( json?.PropertyT("recoveryStaticIPAddress"), out var __jsonRecoveryStaticIPAddress) ? (string)__jsonRecoveryStaticIPAddress : (string)RecoveryStaticIPAddress;} + {_recoveryIPAddressType = If( json?.PropertyT("recoveryIPAddressType"), out var __jsonRecoveryIPAddressType) ? (string)__jsonRecoveryIPAddressType : (string)RecoveryIPAddressType;} + {_recoveryPublicIPAddressId = If( json?.PropertyT("recoveryPublicIPAddressId"), out var __jsonRecoveryPublicIPAddressId) ? (string)__jsonRecoveryPublicIPAddressId : (string)RecoveryPublicIPAddressId;} + {_recoveryLbBackendAddressPoolId = If( json?.PropertyT("recoveryLBBackendAddressPoolIds"), out var __jsonRecoveryLbBackendAddressPoolIds) ? If( __jsonRecoveryLbBackendAddressPoolIds as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(string) (__u is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : RecoveryLbBackendAddressPoolId;} + {_tfoSubnetName = If( json?.PropertyT("tfoSubnetName"), out var __jsonTfoSubnetName) ? (string)__jsonTfoSubnetName : (string)TfoSubnetName;} + {_tfoStaticIPAddress = If( json?.PropertyT("tfoStaticIPAddress"), out var __jsonTfoStaticIPAddress) ? (string)__jsonTfoStaticIPAddress : (string)TfoStaticIPAddress;} + {_tfoPublicIPAddressId = If( json?.PropertyT("tfoPublicIPAddressId"), out var __jsonTfoPublicIPAddressId) ? (string)__jsonTfoPublicIPAddressId : (string)TfoPublicIPAddressId;} + {_tfoLbBackendAddressPoolId = If( json?.PropertyT("tfoLBBackendAddressPoolIds"), out var __jsonTfoLbBackendAddressPoolIds) ? If( __jsonTfoLbBackendAddressPoolIds as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __q) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__q, (__p)=>(string) (__p is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString __o ? (string)(__o.ToString()) : null)) ))() : null : TfoLbBackendAddressPoolId;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); + AddIf( null != this._isPrimary ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonBoolean((bool)this._isPrimary) : null, "isPrimary" ,container.Add ); + AddIf( null != (((object)this._subnetName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._subnetName.ToString()) : null, "subnetName" ,container.Add ); + AddIf( null != (((object)this._staticIPAddress)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._staticIPAddress.ToString()) : null, "staticIPAddress" ,container.Add ); + AddIf( null != (((object)this._iPAddressType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._iPAddressType.ToString()) : null, "ipAddressType" ,container.Add ); + AddIf( null != this._isSeletedForFailover ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonBoolean((bool)this._isSeletedForFailover) : null, "isSeletedForFailover" ,container.Add ); + AddIf( null != (((object)this._recoverySubnetName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoverySubnetName.ToString()) : null, "recoverySubnetName" ,container.Add ); + AddIf( null != (((object)this._recoveryStaticIPAddress)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryStaticIPAddress.ToString()) : null, "recoveryStaticIPAddress" ,container.Add ); + AddIf( null != (((object)this._recoveryIPAddressType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryIPAddressType.ToString()) : null, "recoveryIPAddressType" ,container.Add ); + AddIf( null != (((object)this._recoveryPublicIPAddressId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryPublicIPAddressId.ToString()) : null, "recoveryPublicIPAddressId" ,container.Add ); + if (null != this._recoveryLbBackendAddressPoolId) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._recoveryLbBackendAddressPoolId ) + { + AddIf(null != (((object)__x)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(__x.ToString()) : null ,__w.Add); + } + container.Add("recoveryLBBackendAddressPoolIds",__w); + } + AddIf( null != (((object)this._tfoSubnetName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._tfoSubnetName.ToString()) : null, "tfoSubnetName" ,container.Add ); + AddIf( null != (((object)this._tfoStaticIPAddress)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._tfoStaticIPAddress.ToString()) : null, "tfoStaticIPAddress" ,container.Add ); + AddIf( null != (((object)this._tfoPublicIPAddressId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._tfoPublicIPAddressId.ToString()) : null, "tfoPublicIPAddressId" ,container.Add ); + if (null != this._tfoLbBackendAddressPoolId) + { + var __r = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __s in this._tfoLbBackendAddressPoolId ) + { + AddIf(null != (((object)__s)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(__s.ToString()) : null ,__r.Add); + } + container.Add("tfoLBBackendAddressPoolIds",__r); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/IPConfigInputDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/IPConfigInputDetails.PowerShell.cs new file mode 100644 index 000000000000..22d59b3463cd --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/IPConfigInputDetails.PowerShell.cs @@ -0,0 +1,222 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + [System.ComponentModel.TypeConverter(typeof(IPConfigInputDetailsTypeConverter))] + public partial class IPConfigInputDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigInputDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new IPConfigInputDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigInputDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new IPConfigInputDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigInputDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal IPConfigInputDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("IPConfigName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigInputDetailsInternal)this).IPConfigName = (string) content.GetValueForProperty("IPConfigName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigInputDetailsInternal)this).IPConfigName, global::System.Convert.ToString); + } + if (content.Contains("IsPrimary")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigInputDetailsInternal)this).IsPrimary = (bool?) content.GetValueForProperty("IsPrimary",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigInputDetailsInternal)this).IsPrimary, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("IsSeletedForFailover")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigInputDetailsInternal)this).IsSeletedForFailover = (bool?) content.GetValueForProperty("IsSeletedForFailover",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigInputDetailsInternal)this).IsSeletedForFailover, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("RecoverySubnetName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigInputDetailsInternal)this).RecoverySubnetName = (string) content.GetValueForProperty("RecoverySubnetName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigInputDetailsInternal)this).RecoverySubnetName, global::System.Convert.ToString); + } + if (content.Contains("RecoveryStaticIPAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigInputDetailsInternal)this).RecoveryStaticIPAddress = (string) content.GetValueForProperty("RecoveryStaticIPAddress",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigInputDetailsInternal)this).RecoveryStaticIPAddress, global::System.Convert.ToString); + } + if (content.Contains("RecoveryPublicIPAddressId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigInputDetailsInternal)this).RecoveryPublicIPAddressId = (string) content.GetValueForProperty("RecoveryPublicIPAddressId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigInputDetailsInternal)this).RecoveryPublicIPAddressId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryLbBackendAddressPoolId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigInputDetailsInternal)this).RecoveryLbBackendAddressPoolId = (string[]) content.GetValueForProperty("RecoveryLbBackendAddressPoolId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigInputDetailsInternal)this).RecoveryLbBackendAddressPoolId, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("TfoSubnetName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigInputDetailsInternal)this).TfoSubnetName = (string) content.GetValueForProperty("TfoSubnetName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigInputDetailsInternal)this).TfoSubnetName, global::System.Convert.ToString); + } + if (content.Contains("TfoStaticIPAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigInputDetailsInternal)this).TfoStaticIPAddress = (string) content.GetValueForProperty("TfoStaticIPAddress",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigInputDetailsInternal)this).TfoStaticIPAddress, global::System.Convert.ToString); + } + if (content.Contains("TfoPublicIPAddressId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigInputDetailsInternal)this).TfoPublicIPAddressId = (string) content.GetValueForProperty("TfoPublicIPAddressId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigInputDetailsInternal)this).TfoPublicIPAddressId, global::System.Convert.ToString); + } + if (content.Contains("TfoLbBackendAddressPoolId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigInputDetailsInternal)this).TfoLbBackendAddressPoolId = (string[]) content.GetValueForProperty("TfoLbBackendAddressPoolId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigInputDetailsInternal)this).TfoLbBackendAddressPoolId, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal IPConfigInputDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("IPConfigName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigInputDetailsInternal)this).IPConfigName = (string) content.GetValueForProperty("IPConfigName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigInputDetailsInternal)this).IPConfigName, global::System.Convert.ToString); + } + if (content.Contains("IsPrimary")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigInputDetailsInternal)this).IsPrimary = (bool?) content.GetValueForProperty("IsPrimary",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigInputDetailsInternal)this).IsPrimary, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("IsSeletedForFailover")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigInputDetailsInternal)this).IsSeletedForFailover = (bool?) content.GetValueForProperty("IsSeletedForFailover",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigInputDetailsInternal)this).IsSeletedForFailover, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("RecoverySubnetName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigInputDetailsInternal)this).RecoverySubnetName = (string) content.GetValueForProperty("RecoverySubnetName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigInputDetailsInternal)this).RecoverySubnetName, global::System.Convert.ToString); + } + if (content.Contains("RecoveryStaticIPAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigInputDetailsInternal)this).RecoveryStaticIPAddress = (string) content.GetValueForProperty("RecoveryStaticIPAddress",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigInputDetailsInternal)this).RecoveryStaticIPAddress, global::System.Convert.ToString); + } + if (content.Contains("RecoveryPublicIPAddressId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigInputDetailsInternal)this).RecoveryPublicIPAddressId = (string) content.GetValueForProperty("RecoveryPublicIPAddressId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigInputDetailsInternal)this).RecoveryPublicIPAddressId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryLbBackendAddressPoolId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigInputDetailsInternal)this).RecoveryLbBackendAddressPoolId = (string[]) content.GetValueForProperty("RecoveryLbBackendAddressPoolId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigInputDetailsInternal)this).RecoveryLbBackendAddressPoolId, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("TfoSubnetName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigInputDetailsInternal)this).TfoSubnetName = (string) content.GetValueForProperty("TfoSubnetName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigInputDetailsInternal)this).TfoSubnetName, global::System.Convert.ToString); + } + if (content.Contains("TfoStaticIPAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigInputDetailsInternal)this).TfoStaticIPAddress = (string) content.GetValueForProperty("TfoStaticIPAddress",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigInputDetailsInternal)this).TfoStaticIPAddress, global::System.Convert.ToString); + } + if (content.Contains("TfoPublicIPAddressId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigInputDetailsInternal)this).TfoPublicIPAddressId = (string) content.GetValueForProperty("TfoPublicIPAddressId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigInputDetailsInternal)this).TfoPublicIPAddressId, global::System.Convert.ToString); + } + if (content.Contains("TfoLbBackendAddressPoolId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigInputDetailsInternal)this).TfoLbBackendAddressPoolId = (string[]) content.GetValueForProperty("TfoLbBackendAddressPoolId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigInputDetailsInternal)this).TfoLbBackendAddressPoolId, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + [System.ComponentModel.TypeConverter(typeof(IPConfigInputDetailsTypeConverter))] + public partial interface IIPConfigInputDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/IPConfigInputDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/IPConfigInputDetails.TypeConverter.cs new file mode 100644 index 000000000000..c8363cf1ad95 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/IPConfigInputDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class IPConfigInputDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigInputDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigInputDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return IPConfigInputDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return IPConfigInputDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return IPConfigInputDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/IPConfigInputDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/IPConfigInputDetails.cs new file mode 100644 index 000000000000..a46ebbe27fbd --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/IPConfigInputDetails.cs @@ -0,0 +1,205 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + public partial class IPConfigInputDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigInputDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigInputDetailsInternal + { + + /// Backing field for property. + private string _iPConfigName; + + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string IPConfigName { get => this._iPConfigName; set => this._iPConfigName = value; } + + /// Backing field for property. + private bool? _isPrimary; + + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public bool? IsPrimary { get => this._isPrimary; set => this._isPrimary = value; } + + /// Backing field for property. + private bool? _isSeletedForFailover; + + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public bool? IsSeletedForFailover { get => this._isSeletedForFailover; set => this._isSeletedForFailover = value; } + + /// Backing field for property. + private string[] _recoveryLbBackendAddressPoolId; + + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string[] RecoveryLbBackendAddressPoolId { get => this._recoveryLbBackendAddressPoolId; set => this._recoveryLbBackendAddressPoolId = value; } + + /// Backing field for property. + private string _recoveryPublicIPAddressId; + + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryPublicIPAddressId { get => this._recoveryPublicIPAddressId; set => this._recoveryPublicIPAddressId = value; } + + /// Backing field for property. + private string _recoveryStaticIPAddress; + + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryStaticIPAddress { get => this._recoveryStaticIPAddress; set => this._recoveryStaticIPAddress = value; } + + /// Backing field for property. + private string _recoverySubnetName; + + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoverySubnetName { get => this._recoverySubnetName; set => this._recoverySubnetName = value; } + + /// Backing field for property. + private string[] _tfoLbBackendAddressPoolId; + + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string[] TfoLbBackendAddressPoolId { get => this._tfoLbBackendAddressPoolId; set => this._tfoLbBackendAddressPoolId = value; } + + /// Backing field for property. + private string _tfoPublicIPAddressId; + + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TfoPublicIPAddressId { get => this._tfoPublicIPAddressId; set => this._tfoPublicIPAddressId = value; } + + /// Backing field for property. + private string _tfoStaticIPAddress; + + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TfoStaticIPAddress { get => this._tfoStaticIPAddress; set => this._tfoStaticIPAddress = value; } + + /// Backing field for property. + private string _tfoSubnetName; + + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TfoSubnetName { get => this._tfoSubnetName; set => this._tfoSubnetName = value; } + + /// Creates an new instance. + public IPConfigInputDetails() + { + + } + } + public partial interface IIPConfigInputDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"", + SerializedName = @"ipConfigName", + PossibleTypes = new [] { typeof(string) })] + string IPConfigName { get; set; } + + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"", + SerializedName = @"isPrimary", + PossibleTypes = new [] { typeof(bool) })] + bool? IsPrimary { get; set; } + + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"", + SerializedName = @"isSeletedForFailover", + PossibleTypes = new [] { typeof(bool) })] + bool? IsSeletedForFailover { get; set; } + + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"", + SerializedName = @"recoveryLBBackendAddressPoolIds", + PossibleTypes = new [] { typeof(string) })] + string[] RecoveryLbBackendAddressPoolId { get; set; } + + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"", + SerializedName = @"recoveryPublicIPAddressId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryPublicIPAddressId { get; set; } + + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"", + SerializedName = @"recoveryStaticIPAddress", + PossibleTypes = new [] { typeof(string) })] + string RecoveryStaticIPAddress { get; set; } + + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"", + SerializedName = @"recoverySubnetName", + PossibleTypes = new [] { typeof(string) })] + string RecoverySubnetName { get; set; } + + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"", + SerializedName = @"tfoLBBackendAddressPoolIds", + PossibleTypes = new [] { typeof(string) })] + string[] TfoLbBackendAddressPoolId { get; set; } + + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"", + SerializedName = @"tfoPublicIPAddressId", + PossibleTypes = new [] { typeof(string) })] + string TfoPublicIPAddressId { get; set; } + + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"", + SerializedName = @"tfoStaticIPAddress", + PossibleTypes = new [] { typeof(string) })] + string TfoStaticIPAddress { get; set; } + + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"", + SerializedName = @"tfoSubnetName", + PossibleTypes = new [] { typeof(string) })] + string TfoSubnetName { get; set; } + + } + internal partial interface IIPConfigInputDetailsInternal + + { + string IPConfigName { get; set; } + + bool? IsPrimary { get; set; } + + bool? IsSeletedForFailover { get; set; } + + string[] RecoveryLbBackendAddressPoolId { get; set; } + + string RecoveryPublicIPAddressId { get; set; } + + string RecoveryStaticIPAddress { get; set; } + + string RecoverySubnetName { get; set; } + + string[] TfoLbBackendAddressPoolId { get; set; } + + string TfoPublicIPAddressId { get; set; } + + string TfoStaticIPAddress { get; set; } + + string TfoSubnetName { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/IPConfigInputDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/IPConfigInputDetails.json.cs new file mode 100644 index 000000000000..46d8b604994c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/IPConfigInputDetails.json.cs @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + public partial class IPConfigInputDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigInputDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigInputDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigInputDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new IPConfigInputDetails(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal IPConfigInputDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_iPConfigName = If( json?.PropertyT("ipConfigName"), out var __jsonIPConfigName) ? (string)__jsonIPConfigName : (string)IPConfigName;} + {_isPrimary = If( json?.PropertyT("isPrimary"), out var __jsonIsPrimary) ? (bool?)__jsonIsPrimary : IsPrimary;} + {_isSeletedForFailover = If( json?.PropertyT("isSeletedForFailover"), out var __jsonIsSeletedForFailover) ? (bool?)__jsonIsSeletedForFailover : IsSeletedForFailover;} + {_recoverySubnetName = If( json?.PropertyT("recoverySubnetName"), out var __jsonRecoverySubnetName) ? (string)__jsonRecoverySubnetName : (string)RecoverySubnetName;} + {_recoveryStaticIPAddress = If( json?.PropertyT("recoveryStaticIPAddress"), out var __jsonRecoveryStaticIPAddress) ? (string)__jsonRecoveryStaticIPAddress : (string)RecoveryStaticIPAddress;} + {_recoveryPublicIPAddressId = If( json?.PropertyT("recoveryPublicIPAddressId"), out var __jsonRecoveryPublicIPAddressId) ? (string)__jsonRecoveryPublicIPAddressId : (string)RecoveryPublicIPAddressId;} + {_recoveryLbBackendAddressPoolId = If( json?.PropertyT("recoveryLBBackendAddressPoolIds"), out var __jsonRecoveryLbBackendAddressPoolIds) ? If( __jsonRecoveryLbBackendAddressPoolIds as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(string) (__u is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : RecoveryLbBackendAddressPoolId;} + {_tfoSubnetName = If( json?.PropertyT("tfoSubnetName"), out var __jsonTfoSubnetName) ? (string)__jsonTfoSubnetName : (string)TfoSubnetName;} + {_tfoStaticIPAddress = If( json?.PropertyT("tfoStaticIPAddress"), out var __jsonTfoStaticIPAddress) ? (string)__jsonTfoStaticIPAddress : (string)TfoStaticIPAddress;} + {_tfoPublicIPAddressId = If( json?.PropertyT("tfoPublicIPAddressId"), out var __jsonTfoPublicIPAddressId) ? (string)__jsonTfoPublicIPAddressId : (string)TfoPublicIPAddressId;} + {_tfoLbBackendAddressPoolId = If( json?.PropertyT("tfoLBBackendAddressPoolIds"), out var __jsonTfoLbBackendAddressPoolIds) ? If( __jsonTfoLbBackendAddressPoolIds as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __q) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__q, (__p)=>(string) (__p is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString __o ? (string)(__o.ToString()) : null)) ))() : null : TfoLbBackendAddressPoolId;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._iPConfigName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._iPConfigName.ToString()) : null, "ipConfigName" ,container.Add ); + AddIf( null != this._isPrimary ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonBoolean((bool)this._isPrimary) : null, "isPrimary" ,container.Add ); + AddIf( null != this._isSeletedForFailover ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonBoolean((bool)this._isSeletedForFailover) : null, "isSeletedForFailover" ,container.Add ); + AddIf( null != (((object)this._recoverySubnetName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoverySubnetName.ToString()) : null, "recoverySubnetName" ,container.Add ); + AddIf( null != (((object)this._recoveryStaticIPAddress)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryStaticIPAddress.ToString()) : null, "recoveryStaticIPAddress" ,container.Add ); + AddIf( null != (((object)this._recoveryPublicIPAddressId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryPublicIPAddressId.ToString()) : null, "recoveryPublicIPAddressId" ,container.Add ); + if (null != this._recoveryLbBackendAddressPoolId) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._recoveryLbBackendAddressPoolId ) + { + AddIf(null != (((object)__x)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(__x.ToString()) : null ,__w.Add); + } + container.Add("recoveryLBBackendAddressPoolIds",__w); + } + AddIf( null != (((object)this._tfoSubnetName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._tfoSubnetName.ToString()) : null, "tfoSubnetName" ,container.Add ); + AddIf( null != (((object)this._tfoStaticIPAddress)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._tfoStaticIPAddress.ToString()) : null, "tfoStaticIPAddress" ,container.Add ); + AddIf( null != (((object)this._tfoPublicIPAddressId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._tfoPublicIPAddressId.ToString()) : null, "tfoPublicIPAddressId" ,container.Add ); + if (null != this._tfoLbBackendAddressPoolId) + { + var __r = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __s in this._tfoLbBackendAddressPoolId ) + { + AddIf(null != (((object)__s)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(__s.ToString()) : null ,__r.Add); + } + container.Add("tfoLBBackendAddressPoolIds",__r); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/IdentityProviderDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/IdentityProviderDetails.PowerShell.cs new file mode 100644 index 000000000000..2bf23709041e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/IdentityProviderDetails.PowerShell.cs @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Identity provider details. + [System.ComponentModel.TypeConverter(typeof(IdentityProviderDetailsTypeConverter))] + public partial class IdentityProviderDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new IdentityProviderDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new IdentityProviderDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal IdentityProviderDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("TenantId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetailsInternal)this).TenantId = (string) content.GetValueForProperty("TenantId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetailsInternal)this).TenantId, global::System.Convert.ToString); + } + if (content.Contains("ApplicationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetailsInternal)this).ApplicationId = (string) content.GetValueForProperty("ApplicationId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetailsInternal)this).ApplicationId, global::System.Convert.ToString); + } + if (content.Contains("ObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetailsInternal)this).ObjectId = (string) content.GetValueForProperty("ObjectId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetailsInternal)this).ObjectId, global::System.Convert.ToString); + } + if (content.Contains("Audience")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetailsInternal)this).Audience = (string) content.GetValueForProperty("Audience",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetailsInternal)this).Audience, global::System.Convert.ToString); + } + if (content.Contains("AadAuthority")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetailsInternal)this).AadAuthority = (string) content.GetValueForProperty("AadAuthority",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetailsInternal)this).AadAuthority, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal IdentityProviderDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("TenantId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetailsInternal)this).TenantId = (string) content.GetValueForProperty("TenantId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetailsInternal)this).TenantId, global::System.Convert.ToString); + } + if (content.Contains("ApplicationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetailsInternal)this).ApplicationId = (string) content.GetValueForProperty("ApplicationId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetailsInternal)this).ApplicationId, global::System.Convert.ToString); + } + if (content.Contains("ObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetailsInternal)this).ObjectId = (string) content.GetValueForProperty("ObjectId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetailsInternal)this).ObjectId, global::System.Convert.ToString); + } + if (content.Contains("Audience")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetailsInternal)this).Audience = (string) content.GetValueForProperty("Audience",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetailsInternal)this).Audience, global::System.Convert.ToString); + } + if (content.Contains("AadAuthority")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetailsInternal)this).AadAuthority = (string) content.GetValueForProperty("AadAuthority",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetailsInternal)this).AadAuthority, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Identity provider details. + [System.ComponentModel.TypeConverter(typeof(IdentityProviderDetailsTypeConverter))] + public partial interface IIdentityProviderDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/IdentityProviderDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/IdentityProviderDetails.TypeConverter.cs new file mode 100644 index 000000000000..0b0ed8d7ab0e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/IdentityProviderDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class IdentityProviderDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return IdentityProviderDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return IdentityProviderDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return IdentityProviderDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/IdentityProviderDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/IdentityProviderDetails.cs new file mode 100644 index 000000000000..8d24f444eac5 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/IdentityProviderDetails.cs @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Identity provider details. + public partial class IdentityProviderDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetailsInternal + { + + /// Backing field for property. + private string _aadAuthority; + + /// The base authority for Azure Active Directory authentication. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string AadAuthority { get => this._aadAuthority; set => this._aadAuthority = value; } + + /// Backing field for property. + private string _applicationId; + + /// + /// The application/client Id for the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ApplicationId { get => this._applicationId; set => this._applicationId = value; } + + /// Backing field for property. + private string _audience; + + /// + /// The intended Audience of the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Audience { get => this._audience; set => this._audience = value; } + + /// Backing field for property. + private string _objectId; + + /// + /// The object Id of the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ObjectId { get => this._objectId; set => this._objectId = value; } + + /// Backing field for property. + private string _tenantId; + + /// + /// The tenant Id for the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TenantId { get => this._tenantId; set => this._tenantId = value; } + + /// Creates an new instance. + public IdentityProviderDetails() + { + + } + } + /// Identity provider details. + public partial interface IIdentityProviderDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The base authority for Azure Active Directory authentication. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The base authority for Azure Active Directory authentication.", + SerializedName = @"aadAuthority", + PossibleTypes = new [] { typeof(string) })] + string AadAuthority { get; set; } + /// + /// The application/client Id for the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The application/client Id for the service principal with which the on-premise management/data plane components would communicate with our Azure services.", + SerializedName = @"applicationId", + PossibleTypes = new [] { typeof(string) })] + string ApplicationId { get; set; } + /// + /// The intended Audience of the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The intended Audience of the service principal with which the on-premise management/data plane components would communicate with our Azure services.", + SerializedName = @"audience", + PossibleTypes = new [] { typeof(string) })] + string Audience { get; set; } + /// + /// The object Id of the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The object Id of the service principal with which the on-premise management/data plane components would communicate with our Azure services.", + SerializedName = @"objectId", + PossibleTypes = new [] { typeof(string) })] + string ObjectId { get; set; } + /// + /// The tenant Id for the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The tenant Id for the service principal with which the on-premise management/data plane components would communicate with our Azure services.", + SerializedName = @"tenantId", + PossibleTypes = new [] { typeof(string) })] + string TenantId { get; set; } + + } + /// Identity provider details. + internal partial interface IIdentityProviderDetailsInternal + + { + /// The base authority for Azure Active Directory authentication. + string AadAuthority { get; set; } + /// + /// The application/client Id for the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + string ApplicationId { get; set; } + /// + /// The intended Audience of the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + string Audience { get; set; } + /// + /// The object Id of the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + string ObjectId { get; set; } + /// + /// The tenant Id for the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + string TenantId { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/IdentityProviderDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/IdentityProviderDetails.json.cs new file mode 100644 index 000000000000..3015e0253c10 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/IdentityProviderDetails.json.cs @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Identity provider details. + public partial class IdentityProviderDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new IdentityProviderDetails(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal IdentityProviderDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_tenantId = If( json?.PropertyT("tenantId"), out var __jsonTenantId) ? (string)__jsonTenantId : (string)TenantId;} + {_applicationId = If( json?.PropertyT("applicationId"), out var __jsonApplicationId) ? (string)__jsonApplicationId : (string)ApplicationId;} + {_objectId = If( json?.PropertyT("objectId"), out var __jsonObjectId) ? (string)__jsonObjectId : (string)ObjectId;} + {_audience = If( json?.PropertyT("audience"), out var __jsonAudience) ? (string)__jsonAudience : (string)Audience;} + {_aadAuthority = If( json?.PropertyT("aadAuthority"), out var __jsonAadAuthority) ? (string)__jsonAadAuthority : (string)AadAuthority;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._tenantId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._tenantId.ToString()) : null, "tenantId" ,container.Add ); + AddIf( null != (((object)this._applicationId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._applicationId.ToString()) : null, "applicationId" ,container.Add ); + AddIf( null != (((object)this._objectId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._objectId.ToString()) : null, "objectId" ,container.Add ); + AddIf( null != (((object)this._audience)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._audience.ToString()) : null, "audience" ,container.Add ); + AddIf( null != (((object)this._aadAuthority)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._aadAuthority.ToString()) : null, "aadAuthority" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/IdentityProviderInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/IdentityProviderInput.PowerShell.cs new file mode 100644 index 000000000000..56e67b1e25fd --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/IdentityProviderInput.PowerShell.cs @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Identity provider input. + [System.ComponentModel.TypeConverter(typeof(IdentityProviderInputTypeConverter))] + public partial class IdentityProviderInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new IdentityProviderInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new IdentityProviderInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal IdentityProviderInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("TenantId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInputInternal)this).TenantId = (string) content.GetValueForProperty("TenantId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInputInternal)this).TenantId, global::System.Convert.ToString); + } + if (content.Contains("ApplicationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInputInternal)this).ApplicationId = (string) content.GetValueForProperty("ApplicationId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInputInternal)this).ApplicationId, global::System.Convert.ToString); + } + if (content.Contains("ObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInputInternal)this).ObjectId = (string) content.GetValueForProperty("ObjectId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInputInternal)this).ObjectId, global::System.Convert.ToString); + } + if (content.Contains("Audience")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInputInternal)this).Audience = (string) content.GetValueForProperty("Audience",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInputInternal)this).Audience, global::System.Convert.ToString); + } + if (content.Contains("AadAuthority")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInputInternal)this).AadAuthority = (string) content.GetValueForProperty("AadAuthority",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInputInternal)this).AadAuthority, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal IdentityProviderInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("TenantId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInputInternal)this).TenantId = (string) content.GetValueForProperty("TenantId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInputInternal)this).TenantId, global::System.Convert.ToString); + } + if (content.Contains("ApplicationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInputInternal)this).ApplicationId = (string) content.GetValueForProperty("ApplicationId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInputInternal)this).ApplicationId, global::System.Convert.ToString); + } + if (content.Contains("ObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInputInternal)this).ObjectId = (string) content.GetValueForProperty("ObjectId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInputInternal)this).ObjectId, global::System.Convert.ToString); + } + if (content.Contains("Audience")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInputInternal)this).Audience = (string) content.GetValueForProperty("Audience",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInputInternal)this).Audience, global::System.Convert.ToString); + } + if (content.Contains("AadAuthority")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInputInternal)this).AadAuthority = (string) content.GetValueForProperty("AadAuthority",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInputInternal)this).AadAuthority, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Identity provider input. + [System.ComponentModel.TypeConverter(typeof(IdentityProviderInputTypeConverter))] + public partial interface IIdentityProviderInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/IdentityProviderInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/IdentityProviderInput.TypeConverter.cs new file mode 100644 index 000000000000..8de6bb954c38 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/IdentityProviderInput.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class IdentityProviderInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return IdentityProviderInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return IdentityProviderInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return IdentityProviderInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/IdentityProviderInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/IdentityProviderInput.cs new file mode 100644 index 000000000000..d4a086ff3d39 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/IdentityProviderInput.cs @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Identity provider input. + public partial class IdentityProviderInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInputInternal + { + + /// Backing field for property. + private string _aadAuthority; + + /// The base authority for Azure Active Directory authentication. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string AadAuthority { get => this._aadAuthority; set => this._aadAuthority = value; } + + /// Backing field for property. + private string _applicationId; + + /// + /// The application/client Id for the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ApplicationId { get => this._applicationId; set => this._applicationId = value; } + + /// Backing field for property. + private string _audience; + + /// + /// The intended Audience of the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Audience { get => this._audience; set => this._audience = value; } + + /// Backing field for property. + private string _objectId; + + /// + /// The object Id of the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ObjectId { get => this._objectId; set => this._objectId = value; } + + /// Backing field for property. + private string _tenantId; + + /// + /// The tenant Id for the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TenantId { get => this._tenantId; set => this._tenantId = value; } + + /// Creates an new instance. + public IdentityProviderInput() + { + + } + } + /// Identity provider input. + public partial interface IIdentityProviderInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The base authority for Azure Active Directory authentication. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The base authority for Azure Active Directory authentication.", + SerializedName = @"aadAuthority", + PossibleTypes = new [] { typeof(string) })] + string AadAuthority { get; set; } + /// + /// The application/client Id for the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The application/client Id for the service principal with which the on-premise management/data plane components would communicate with our Azure services.", + SerializedName = @"applicationId", + PossibleTypes = new [] { typeof(string) })] + string ApplicationId { get; set; } + /// + /// The intended Audience of the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The intended Audience of the service principal with which the on-premise management/data plane components would communicate with our Azure services.", + SerializedName = @"audience", + PossibleTypes = new [] { typeof(string) })] + string Audience { get; set; } + /// + /// The object Id of the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The object Id of the service principal with which the on-premise management/data plane components would communicate with our Azure services.", + SerializedName = @"objectId", + PossibleTypes = new [] { typeof(string) })] + string ObjectId { get; set; } + /// + /// The tenant Id for the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The tenant Id for the service principal with which the on-premise management/data plane components would communicate with our Azure services.", + SerializedName = @"tenantId", + PossibleTypes = new [] { typeof(string) })] + string TenantId { get; set; } + + } + /// Identity provider input. + internal partial interface IIdentityProviderInputInternal + + { + /// The base authority for Azure Active Directory authentication. + string AadAuthority { get; set; } + /// + /// The application/client Id for the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + string ApplicationId { get; set; } + /// + /// The intended Audience of the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + string Audience { get; set; } + /// + /// The object Id of the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + string ObjectId { get; set; } + /// + /// The tenant Id for the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + string TenantId { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/IdentityProviderInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/IdentityProviderInput.json.cs new file mode 100644 index 000000000000..fc53e01221da --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/IdentityProviderInput.json.cs @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Identity provider input. + public partial class IdentityProviderInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new IdentityProviderInput(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal IdentityProviderInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_tenantId = If( json?.PropertyT("tenantId"), out var __jsonTenantId) ? (string)__jsonTenantId : (string)TenantId;} + {_applicationId = If( json?.PropertyT("applicationId"), out var __jsonApplicationId) ? (string)__jsonApplicationId : (string)ApplicationId;} + {_objectId = If( json?.PropertyT("objectId"), out var __jsonObjectId) ? (string)__jsonObjectId : (string)ObjectId;} + {_audience = If( json?.PropertyT("audience"), out var __jsonAudience) ? (string)__jsonAudience : (string)Audience;} + {_aadAuthority = If( json?.PropertyT("aadAuthority"), out var __jsonAadAuthority) ? (string)__jsonAadAuthority : (string)AadAuthority;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._tenantId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._tenantId.ToString()) : null, "tenantId" ,container.Add ); + AddIf( null != (((object)this._applicationId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._applicationId.ToString()) : null, "applicationId" ,container.Add ); + AddIf( null != (((object)this._objectId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._objectId.ToString()) : null, "objectId" ,container.Add ); + AddIf( null != (((object)this._audience)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._audience.ToString()) : null, "audience" ,container.Add ); + AddIf( null != (((object)this._aadAuthority)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._aadAuthority.ToString()) : null, "aadAuthority" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAgentDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAgentDetails.PowerShell.cs new file mode 100644 index 000000000000..37c019a37baf --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAgentDetails.PowerShell.cs @@ -0,0 +1,168 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// The details of the InMage agent. + [System.ComponentModel.TypeConverter(typeof(InMageAgentDetailsTypeConverter))] + public partial class InMageAgentDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAgentDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InMageAgentDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAgentDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InMageAgentDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAgentDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InMageAgentDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("AgentVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAgentDetailsInternal)this).AgentVersion = (string) content.GetValueForProperty("AgentVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAgentDetailsInternal)this).AgentVersion, global::System.Convert.ToString); + } + if (content.Contains("AgentUpdateStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAgentDetailsInternal)this).AgentUpdateStatus = (string) content.GetValueForProperty("AgentUpdateStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAgentDetailsInternal)this).AgentUpdateStatus, global::System.Convert.ToString); + } + if (content.Contains("PostUpdateRebootStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAgentDetailsInternal)this).PostUpdateRebootStatus = (string) content.GetValueForProperty("PostUpdateRebootStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAgentDetailsInternal)this).PostUpdateRebootStatus, global::System.Convert.ToString); + } + if (content.Contains("AgentExpiryDate")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAgentDetailsInternal)this).AgentExpiryDate = (global::System.DateTime?) content.GetValueForProperty("AgentExpiryDate",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAgentDetailsInternal)this).AgentExpiryDate, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InMageAgentDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("AgentVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAgentDetailsInternal)this).AgentVersion = (string) content.GetValueForProperty("AgentVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAgentDetailsInternal)this).AgentVersion, global::System.Convert.ToString); + } + if (content.Contains("AgentUpdateStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAgentDetailsInternal)this).AgentUpdateStatus = (string) content.GetValueForProperty("AgentUpdateStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAgentDetailsInternal)this).AgentUpdateStatus, global::System.Convert.ToString); + } + if (content.Contains("PostUpdateRebootStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAgentDetailsInternal)this).PostUpdateRebootStatus = (string) content.GetValueForProperty("PostUpdateRebootStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAgentDetailsInternal)this).PostUpdateRebootStatus, global::System.Convert.ToString); + } + if (content.Contains("AgentExpiryDate")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAgentDetailsInternal)this).AgentExpiryDate = (global::System.DateTime?) content.GetValueForProperty("AgentExpiryDate",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAgentDetailsInternal)this).AgentExpiryDate, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// The details of the InMage agent. + [System.ComponentModel.TypeConverter(typeof(InMageAgentDetailsTypeConverter))] + public partial interface IInMageAgentDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAgentDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAgentDetails.TypeConverter.cs new file mode 100644 index 000000000000..a15b3f8e6fef --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAgentDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InMageAgentDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAgentDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAgentDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InMageAgentDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InMageAgentDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InMageAgentDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAgentDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAgentDetails.cs new file mode 100644 index 000000000000..6458381e4cb1 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAgentDetails.cs @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The details of the InMage agent. + public partial class InMageAgentDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAgentDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAgentDetailsInternal + { + + /// Backing field for property. + private global::System.DateTime? _agentExpiryDate; + + /// Agent expiry date. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public global::System.DateTime? AgentExpiryDate { get => this._agentExpiryDate; set => this._agentExpiryDate = value; } + + /// Backing field for property. + private string _agentUpdateStatus; + + /// A value indicating whether installed agent needs to be updated. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string AgentUpdateStatus { get => this._agentUpdateStatus; set => this._agentUpdateStatus = value; } + + /// Backing field for property. + private string _agentVersion; + + /// The agent version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string AgentVersion { get => this._agentVersion; set => this._agentVersion = value; } + + /// Backing field for property. + private string _postUpdateRebootStatus; + + /// A value indicating whether reboot is required after update is applied. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string PostUpdateRebootStatus { get => this._postUpdateRebootStatus; set => this._postUpdateRebootStatus = value; } + + /// Creates an new instance. + public InMageAgentDetails() + { + + } + } + /// The details of the InMage agent. + public partial interface IInMageAgentDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// Agent expiry date. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Agent expiry date.", + SerializedName = @"agentExpiryDate", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? AgentExpiryDate { get; set; } + /// A value indicating whether installed agent needs to be updated. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether installed agent needs to be updated.", + SerializedName = @"agentUpdateStatus", + PossibleTypes = new [] { typeof(string) })] + string AgentUpdateStatus { get; set; } + /// The agent version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The agent version.", + SerializedName = @"agentVersion", + PossibleTypes = new [] { typeof(string) })] + string AgentVersion { get; set; } + /// A value indicating whether reboot is required after update is applied. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether reboot is required after update is applied.", + SerializedName = @"postUpdateRebootStatus", + PossibleTypes = new [] { typeof(string) })] + string PostUpdateRebootStatus { get; set; } + + } + /// The details of the InMage agent. + internal partial interface IInMageAgentDetailsInternal + + { + /// Agent expiry date. + global::System.DateTime? AgentExpiryDate { get; set; } + /// A value indicating whether installed agent needs to be updated. + string AgentUpdateStatus { get; set; } + /// The agent version. + string AgentVersion { get; set; } + /// A value indicating whether reboot is required after update is applied. + string PostUpdateRebootStatus { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAgentDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAgentDetails.json.cs new file mode 100644 index 000000000000..57b216fe49a7 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAgentDetails.json.cs @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The details of the InMage agent. + public partial class InMageAgentDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAgentDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAgentDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAgentDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new InMageAgentDetails(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal InMageAgentDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_agentVersion = If( json?.PropertyT("agentVersion"), out var __jsonAgentVersion) ? (string)__jsonAgentVersion : (string)AgentVersion;} + {_agentUpdateStatus = If( json?.PropertyT("agentUpdateStatus"), out var __jsonAgentUpdateStatus) ? (string)__jsonAgentUpdateStatus : (string)AgentUpdateStatus;} + {_postUpdateRebootStatus = If( json?.PropertyT("postUpdateRebootStatus"), out var __jsonPostUpdateRebootStatus) ? (string)__jsonPostUpdateRebootStatus : (string)PostUpdateRebootStatus;} + {_agentExpiryDate = If( json?.PropertyT("agentExpiryDate"), out var __jsonAgentExpiryDate) ? global::System.DateTime.TryParse((string)__jsonAgentExpiryDate, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonAgentExpiryDateValue) ? __jsonAgentExpiryDateValue : AgentExpiryDate : AgentExpiryDate;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._agentVersion)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._agentVersion.ToString()) : null, "agentVersion" ,container.Add ); + AddIf( null != (((object)this._agentUpdateStatus)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._agentUpdateStatus.ToString()) : null, "agentUpdateStatus" ,container.Add ); + AddIf( null != (((object)this._postUpdateRebootStatus)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._postUpdateRebootStatus.ToString()) : null, "postUpdateRebootStatus" ,container.Add ); + AddIf( null != this._agentExpiryDate ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._agentExpiryDate?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "agentExpiryDate" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ApplyRecoveryPointInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ApplyRecoveryPointInput.PowerShell.cs new file mode 100644 index 000000000000..04c6fc9866a8 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ApplyRecoveryPointInput.PowerShell.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// ApplyRecoveryPoint input specific to InMageAzureV2 provider. + [System.ComponentModel.TypeConverter(typeof(InMageAzureV2ApplyRecoveryPointInputTypeConverter))] + public partial class InMageAzureV2ApplyRecoveryPointInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ApplyRecoveryPointInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InMageAzureV2ApplyRecoveryPointInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ApplyRecoveryPointInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InMageAzureV2ApplyRecoveryPointInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ApplyRecoveryPointInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InMageAzureV2ApplyRecoveryPointInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InMageAzureV2ApplyRecoveryPointInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// ApplyRecoveryPoint input specific to InMageAzureV2 provider. + [System.ComponentModel.TypeConverter(typeof(InMageAzureV2ApplyRecoveryPointInputTypeConverter))] + public partial interface IInMageAzureV2ApplyRecoveryPointInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ApplyRecoveryPointInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ApplyRecoveryPointInput.TypeConverter.cs new file mode 100644 index 000000000000..aecf8b5b3a25 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ApplyRecoveryPointInput.TypeConverter.cs @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InMageAzureV2ApplyRecoveryPointInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ApplyRecoveryPointInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ApplyRecoveryPointInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InMageAzureV2ApplyRecoveryPointInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InMageAzureV2ApplyRecoveryPointInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InMageAzureV2ApplyRecoveryPointInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ApplyRecoveryPointInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ApplyRecoveryPointInput.cs new file mode 100644 index 000000000000..0b134528bfa3 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ApplyRecoveryPointInput.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// ApplyRecoveryPoint input specific to InMageAzureV2 provider. + public partial class InMageAzureV2ApplyRecoveryPointInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ApplyRecoveryPointInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ApplyRecoveryPointInputInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointProviderSpecificInput __applyRecoveryPointProviderSpecificInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ApplyRecoveryPointProviderSpecificInput(); + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointProviderSpecificInputInternal)__applyRecoveryPointProviderSpecificInput).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointProviderSpecificInputInternal)__applyRecoveryPointProviderSpecificInput).InstanceType = value ; } + + /// Creates an new instance. + public InMageAzureV2ApplyRecoveryPointInput() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__applyRecoveryPointProviderSpecificInput), __applyRecoveryPointProviderSpecificInput); + await eventListener.AssertObjectIsValid(nameof(__applyRecoveryPointProviderSpecificInput), __applyRecoveryPointProviderSpecificInput); + } + } + /// ApplyRecoveryPoint input specific to InMageAzureV2 provider. + public partial interface IInMageAzureV2ApplyRecoveryPointInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointProviderSpecificInput + { + + } + /// ApplyRecoveryPoint input specific to InMageAzureV2 provider. + internal partial interface IInMageAzureV2ApplyRecoveryPointInputInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointProviderSpecificInputInternal + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ApplyRecoveryPointInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ApplyRecoveryPointInput.json.cs new file mode 100644 index 000000000000..941073803ff1 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ApplyRecoveryPointInput.json.cs @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// ApplyRecoveryPoint input specific to InMageAzureV2 provider. + public partial class InMageAzureV2ApplyRecoveryPointInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ApplyRecoveryPointInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ApplyRecoveryPointInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ApplyRecoveryPointInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new InMageAzureV2ApplyRecoveryPointInput(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal InMageAzureV2ApplyRecoveryPointInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __applyRecoveryPointProviderSpecificInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ApplyRecoveryPointProviderSpecificInput(json); + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __applyRecoveryPointProviderSpecificInput?.ToJson(container, serializationMode); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2DiskInputDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2DiskInputDetails.PowerShell.cs new file mode 100644 index 000000000000..881da3b27bb4 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2DiskInputDetails.PowerShell.cs @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Disk input details. + [System.ComponentModel.TypeConverter(typeof(InMageAzureV2DiskInputDetailsTypeConverter))] + public partial class InMageAzureV2DiskInputDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2DiskInputDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InMageAzureV2DiskInputDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2DiskInputDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InMageAzureV2DiskInputDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2DiskInputDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InMageAzureV2DiskInputDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DiskId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2DiskInputDetailsInternal)this).DiskId = (string) content.GetValueForProperty("DiskId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2DiskInputDetailsInternal)this).DiskId, global::System.Convert.ToString); + } + if (content.Contains("LogStorageAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2DiskInputDetailsInternal)this).LogStorageAccountId = (string) content.GetValueForProperty("LogStorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2DiskInputDetailsInternal)this).LogStorageAccountId, global::System.Convert.ToString); + } + if (content.Contains("DiskType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2DiskInputDetailsInternal)this).DiskType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskAccountType?) content.GetValueForProperty("DiskType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2DiskInputDetailsInternal)this).DiskType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskAccountType.CreateFrom); + } + if (content.Contains("DiskEncryptionSetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2DiskInputDetailsInternal)this).DiskEncryptionSetId = (string) content.GetValueForProperty("DiskEncryptionSetId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2DiskInputDetailsInternal)this).DiskEncryptionSetId, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InMageAzureV2DiskInputDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DiskId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2DiskInputDetailsInternal)this).DiskId = (string) content.GetValueForProperty("DiskId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2DiskInputDetailsInternal)this).DiskId, global::System.Convert.ToString); + } + if (content.Contains("LogStorageAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2DiskInputDetailsInternal)this).LogStorageAccountId = (string) content.GetValueForProperty("LogStorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2DiskInputDetailsInternal)this).LogStorageAccountId, global::System.Convert.ToString); + } + if (content.Contains("DiskType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2DiskInputDetailsInternal)this).DiskType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskAccountType?) content.GetValueForProperty("DiskType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2DiskInputDetailsInternal)this).DiskType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskAccountType.CreateFrom); + } + if (content.Contains("DiskEncryptionSetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2DiskInputDetailsInternal)this).DiskEncryptionSetId = (string) content.GetValueForProperty("DiskEncryptionSetId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2DiskInputDetailsInternal)this).DiskEncryptionSetId, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Disk input details. + [System.ComponentModel.TypeConverter(typeof(InMageAzureV2DiskInputDetailsTypeConverter))] + public partial interface IInMageAzureV2DiskInputDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2DiskInputDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2DiskInputDetails.TypeConverter.cs new file mode 100644 index 000000000000..08418ca1f8ea --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2DiskInputDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InMageAzureV2DiskInputDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2DiskInputDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2DiskInputDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InMageAzureV2DiskInputDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InMageAzureV2DiskInputDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InMageAzureV2DiskInputDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2DiskInputDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2DiskInputDetails.cs new file mode 100644 index 000000000000..79594a570e83 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2DiskInputDetails.cs @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Disk input details. + public partial class InMageAzureV2DiskInputDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2DiskInputDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2DiskInputDetailsInternal + { + + /// Backing field for property. + private string _diskEncryptionSetId; + + /// The DiskEncryptionSet ARM ID. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string DiskEncryptionSetId { get => this._diskEncryptionSetId; set => this._diskEncryptionSetId = value; } + + /// Backing field for property. + private string _diskId; + + /// The DiskId. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string DiskId { get => this._diskId; set => this._diskId = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskAccountType? _diskType; + + /// The DiskType. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskAccountType? DiskType { get => this._diskType; set => this._diskType = value; } + + /// Backing field for property. + private string _logStorageAccountId; + + /// The LogStorageAccountId. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string LogStorageAccountId { get => this._logStorageAccountId; set => this._logStorageAccountId = value; } + + /// Creates an new instance. + public InMageAzureV2DiskInputDetails() + { + + } + } + /// Disk input details. + public partial interface IInMageAzureV2DiskInputDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The DiskEncryptionSet ARM ID. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The DiskEncryptionSet ARM ID.", + SerializedName = @"diskEncryptionSetId", + PossibleTypes = new [] { typeof(string) })] + string DiskEncryptionSetId { get; set; } + /// The DiskId. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The DiskId.", + SerializedName = @"diskId", + PossibleTypes = new [] { typeof(string) })] + string DiskId { get; set; } + /// The DiskType. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The DiskType.", + SerializedName = @"diskType", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskAccountType) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskAccountType? DiskType { get; set; } + /// The LogStorageAccountId. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The LogStorageAccountId.", + SerializedName = @"logStorageAccountId", + PossibleTypes = new [] { typeof(string) })] + string LogStorageAccountId { get; set; } + + } + /// Disk input details. + internal partial interface IInMageAzureV2DiskInputDetailsInternal + + { + /// The DiskEncryptionSet ARM ID. + string DiskEncryptionSetId { get; set; } + /// The DiskId. + string DiskId { get; set; } + /// The DiskType. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskAccountType? DiskType { get; set; } + /// The LogStorageAccountId. + string LogStorageAccountId { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2DiskInputDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2DiskInputDetails.json.cs new file mode 100644 index 000000000000..e75c832aa741 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2DiskInputDetails.json.cs @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Disk input details. + public partial class InMageAzureV2DiskInputDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2DiskInputDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2DiskInputDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2DiskInputDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new InMageAzureV2DiskInputDetails(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal InMageAzureV2DiskInputDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_diskId = If( json?.PropertyT("diskId"), out var __jsonDiskId) ? (string)__jsonDiskId : (string)DiskId;} + {_logStorageAccountId = If( json?.PropertyT("logStorageAccountId"), out var __jsonLogStorageAccountId) ? (string)__jsonLogStorageAccountId : (string)LogStorageAccountId;} + {_diskType = If( json?.PropertyT("diskType"), out var __jsonDiskType) ? (string)__jsonDiskType : (string)DiskType;} + {_diskEncryptionSetId = If( json?.PropertyT("diskEncryptionSetId"), out var __jsonDiskEncryptionSetId) ? (string)__jsonDiskEncryptionSetId : (string)DiskEncryptionSetId;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._diskId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._diskId.ToString()) : null, "diskId" ,container.Add ); + AddIf( null != (((object)this._logStorageAccountId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._logStorageAccountId.ToString()) : null, "logStorageAccountId" ,container.Add ); + AddIf( null != (((object)this._diskType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._diskType.ToString()) : null, "diskType" ,container.Add ); + AddIf( null != (((object)this._diskEncryptionSetId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._diskEncryptionSetId.ToString()) : null, "diskEncryptionSetId" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2EnableProtectionInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2EnableProtectionInput.PowerShell.cs new file mode 100644 index 000000000000..268c1a71de54 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2EnableProtectionInput.PowerShell.cs @@ -0,0 +1,356 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// VMware Azure specific enable protection input. + [System.ComponentModel.TypeConverter(typeof(InMageAzureV2EnableProtectionInputTypeConverter))] + public partial class InMageAzureV2EnableProtectionInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InMageAzureV2EnableProtectionInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InMageAzureV2EnableProtectionInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InMageAzureV2EnableProtectionInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("MasterTargetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).MasterTargetId = (string) content.GetValueForProperty("MasterTargetId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).MasterTargetId, global::System.Convert.ToString); + } + if (content.Contains("ProcessServerId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).ProcessServerId = (string) content.GetValueForProperty("ProcessServerId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).ProcessServerId, global::System.Convert.ToString); + } + if (content.Contains("StorageAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).StorageAccountId = (string) content.GetValueForProperty("StorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).StorageAccountId, global::System.Convert.ToString); + } + if (content.Contains("RunAsAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).RunAsAccountId = (string) content.GetValueForProperty("RunAsAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).RunAsAccountId, global::System.Convert.ToString); + } + if (content.Contains("MultiVMGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).MultiVMGroupId = (string) content.GetValueForProperty("MultiVMGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).MultiVMGroupId, global::System.Convert.ToString); + } + if (content.Contains("MultiVMGroupName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).MultiVMGroupName = (string) content.GetValueForProperty("MultiVMGroupName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).MultiVMGroupName, global::System.Convert.ToString); + } + if (content.Contains("DisksToInclude")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).DisksToInclude = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2DiskInputDetails[]) content.GetValueForProperty("DisksToInclude",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).DisksToInclude, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2DiskInputDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("TargetAzureNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).TargetAzureNetworkId = (string) content.GetValueForProperty("TargetAzureNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).TargetAzureNetworkId, global::System.Convert.ToString); + } + if (content.Contains("TargetAzureSubnetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).TargetAzureSubnetId = (string) content.GetValueForProperty("TargetAzureSubnetId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).TargetAzureSubnetId, global::System.Convert.ToString); + } + if (content.Contains("EnableRdpOnTargetOption")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).EnableRdpOnTargetOption = (string) content.GetValueForProperty("EnableRdpOnTargetOption",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).EnableRdpOnTargetOption, global::System.Convert.ToString); + } + if (content.Contains("TargetAzureVMName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).TargetAzureVMName = (string) content.GetValueForProperty("TargetAzureVMName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).TargetAzureVMName, global::System.Convert.ToString); + } + if (content.Contains("LogStorageAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).LogStorageAccountId = (string) content.GetValueForProperty("LogStorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).LogStorageAccountId, global::System.Convert.ToString); + } + if (content.Contains("TargetAzureV1ResourceGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).TargetAzureV1ResourceGroupId = (string) content.GetValueForProperty("TargetAzureV1ResourceGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).TargetAzureV1ResourceGroupId, global::System.Convert.ToString); + } + if (content.Contains("TargetAzureV2ResourceGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).TargetAzureV2ResourceGroupId = (string) content.GetValueForProperty("TargetAzureV2ResourceGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).TargetAzureV2ResourceGroupId, global::System.Convert.ToString); + } + if (content.Contains("DiskType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).DiskType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskAccountType?) content.GetValueForProperty("DiskType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).DiskType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskAccountType.CreateFrom); + } + if (content.Contains("TargetAvailabilitySetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).TargetAvailabilitySetId = (string) content.GetValueForProperty("TargetAvailabilitySetId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).TargetAvailabilitySetId, global::System.Convert.ToString); + } + if (content.Contains("TargetAvailabilityZone")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).TargetAvailabilityZone = (string) content.GetValueForProperty("TargetAvailabilityZone",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).TargetAvailabilityZone, global::System.Convert.ToString); + } + if (content.Contains("TargetProximityPlacementGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).TargetProximityPlacementGroupId = (string) content.GetValueForProperty("TargetProximityPlacementGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).TargetProximityPlacementGroupId, global::System.Convert.ToString); + } + if (content.Contains("LicenseType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).LicenseType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.LicenseType?) content.GetValueForProperty("LicenseType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).LicenseType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.LicenseType.CreateFrom); + } + if (content.Contains("SqlServerLicenseType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).SqlServerLicenseType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SqlServerLicenseType?) content.GetValueForProperty("SqlServerLicenseType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).SqlServerLicenseType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SqlServerLicenseType.CreateFrom); + } + if (content.Contains("TargetVMSize")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).TargetVMSize = (string) content.GetValueForProperty("TargetVMSize",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).TargetVMSize, global::System.Convert.ToString); + } + if (content.Contains("DiskEncryptionSetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).DiskEncryptionSetId = (string) content.GetValueForProperty("DiskEncryptionSetId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).DiskEncryptionSetId, global::System.Convert.ToString); + } + if (content.Contains("TargetVMTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).TargetVMTag = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputTargetVMTags) content.GetValueForProperty("TargetVMTag",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).TargetVMTag, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2EnableProtectionInputTargetVMTagsTypeConverter.ConvertFrom); + } + if (content.Contains("SeedManagedDiskTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).SeedManagedDiskTag = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputSeedManagedDiskTags) content.GetValueForProperty("SeedManagedDiskTag",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).SeedManagedDiskTag, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2EnableProtectionInputSeedManagedDiskTagsTypeConverter.ConvertFrom); + } + if (content.Contains("TargetManagedDiskTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).TargetManagedDiskTag = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputTargetManagedDiskTags) content.GetValueForProperty("TargetManagedDiskTag",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).TargetManagedDiskTag, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2EnableProtectionInputTargetManagedDiskTagsTypeConverter.ConvertFrom); + } + if (content.Contains("TargetNicTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).TargetNicTag = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputTargetNicTags) content.GetValueForProperty("TargetNicTag",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).TargetNicTag, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2EnableProtectionInputTargetNicTagsTypeConverter.ConvertFrom); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InMageAzureV2EnableProtectionInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("MasterTargetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).MasterTargetId = (string) content.GetValueForProperty("MasterTargetId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).MasterTargetId, global::System.Convert.ToString); + } + if (content.Contains("ProcessServerId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).ProcessServerId = (string) content.GetValueForProperty("ProcessServerId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).ProcessServerId, global::System.Convert.ToString); + } + if (content.Contains("StorageAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).StorageAccountId = (string) content.GetValueForProperty("StorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).StorageAccountId, global::System.Convert.ToString); + } + if (content.Contains("RunAsAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).RunAsAccountId = (string) content.GetValueForProperty("RunAsAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).RunAsAccountId, global::System.Convert.ToString); + } + if (content.Contains("MultiVMGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).MultiVMGroupId = (string) content.GetValueForProperty("MultiVMGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).MultiVMGroupId, global::System.Convert.ToString); + } + if (content.Contains("MultiVMGroupName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).MultiVMGroupName = (string) content.GetValueForProperty("MultiVMGroupName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).MultiVMGroupName, global::System.Convert.ToString); + } + if (content.Contains("DisksToInclude")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).DisksToInclude = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2DiskInputDetails[]) content.GetValueForProperty("DisksToInclude",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).DisksToInclude, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2DiskInputDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("TargetAzureNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).TargetAzureNetworkId = (string) content.GetValueForProperty("TargetAzureNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).TargetAzureNetworkId, global::System.Convert.ToString); + } + if (content.Contains("TargetAzureSubnetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).TargetAzureSubnetId = (string) content.GetValueForProperty("TargetAzureSubnetId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).TargetAzureSubnetId, global::System.Convert.ToString); + } + if (content.Contains("EnableRdpOnTargetOption")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).EnableRdpOnTargetOption = (string) content.GetValueForProperty("EnableRdpOnTargetOption",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).EnableRdpOnTargetOption, global::System.Convert.ToString); + } + if (content.Contains("TargetAzureVMName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).TargetAzureVMName = (string) content.GetValueForProperty("TargetAzureVMName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).TargetAzureVMName, global::System.Convert.ToString); + } + if (content.Contains("LogStorageAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).LogStorageAccountId = (string) content.GetValueForProperty("LogStorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).LogStorageAccountId, global::System.Convert.ToString); + } + if (content.Contains("TargetAzureV1ResourceGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).TargetAzureV1ResourceGroupId = (string) content.GetValueForProperty("TargetAzureV1ResourceGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).TargetAzureV1ResourceGroupId, global::System.Convert.ToString); + } + if (content.Contains("TargetAzureV2ResourceGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).TargetAzureV2ResourceGroupId = (string) content.GetValueForProperty("TargetAzureV2ResourceGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).TargetAzureV2ResourceGroupId, global::System.Convert.ToString); + } + if (content.Contains("DiskType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).DiskType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskAccountType?) content.GetValueForProperty("DiskType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).DiskType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskAccountType.CreateFrom); + } + if (content.Contains("TargetAvailabilitySetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).TargetAvailabilitySetId = (string) content.GetValueForProperty("TargetAvailabilitySetId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).TargetAvailabilitySetId, global::System.Convert.ToString); + } + if (content.Contains("TargetAvailabilityZone")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).TargetAvailabilityZone = (string) content.GetValueForProperty("TargetAvailabilityZone",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).TargetAvailabilityZone, global::System.Convert.ToString); + } + if (content.Contains("TargetProximityPlacementGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).TargetProximityPlacementGroupId = (string) content.GetValueForProperty("TargetProximityPlacementGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).TargetProximityPlacementGroupId, global::System.Convert.ToString); + } + if (content.Contains("LicenseType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).LicenseType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.LicenseType?) content.GetValueForProperty("LicenseType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).LicenseType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.LicenseType.CreateFrom); + } + if (content.Contains("SqlServerLicenseType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).SqlServerLicenseType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SqlServerLicenseType?) content.GetValueForProperty("SqlServerLicenseType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).SqlServerLicenseType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SqlServerLicenseType.CreateFrom); + } + if (content.Contains("TargetVMSize")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).TargetVMSize = (string) content.GetValueForProperty("TargetVMSize",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).TargetVMSize, global::System.Convert.ToString); + } + if (content.Contains("DiskEncryptionSetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).DiskEncryptionSetId = (string) content.GetValueForProperty("DiskEncryptionSetId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).DiskEncryptionSetId, global::System.Convert.ToString); + } + if (content.Contains("TargetVMTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).TargetVMTag = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputTargetVMTags) content.GetValueForProperty("TargetVMTag",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).TargetVMTag, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2EnableProtectionInputTargetVMTagsTypeConverter.ConvertFrom); + } + if (content.Contains("SeedManagedDiskTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).SeedManagedDiskTag = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputSeedManagedDiskTags) content.GetValueForProperty("SeedManagedDiskTag",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).SeedManagedDiskTag, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2EnableProtectionInputSeedManagedDiskTagsTypeConverter.ConvertFrom); + } + if (content.Contains("TargetManagedDiskTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).TargetManagedDiskTag = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputTargetManagedDiskTags) content.GetValueForProperty("TargetManagedDiskTag",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).TargetManagedDiskTag, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2EnableProtectionInputTargetManagedDiskTagsTypeConverter.ConvertFrom); + } + if (content.Contains("TargetNicTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).TargetNicTag = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputTargetNicTags) content.GetValueForProperty("TargetNicTag",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal)this).TargetNicTag, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2EnableProtectionInputTargetNicTagsTypeConverter.ConvertFrom); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// VMware Azure specific enable protection input. + [System.ComponentModel.TypeConverter(typeof(InMageAzureV2EnableProtectionInputTypeConverter))] + public partial interface IInMageAzureV2EnableProtectionInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2EnableProtectionInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2EnableProtectionInput.TypeConverter.cs new file mode 100644 index 000000000000..4bf640232c67 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2EnableProtectionInput.TypeConverter.cs @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InMageAzureV2EnableProtectionInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InMageAzureV2EnableProtectionInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InMageAzureV2EnableProtectionInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InMageAzureV2EnableProtectionInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2EnableProtectionInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2EnableProtectionInput.cs new file mode 100644 index 000000000000..2f1f4d5f3daf --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2EnableProtectionInput.cs @@ -0,0 +1,520 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// VMware Azure specific enable protection input. + public partial class InMageAzureV2EnableProtectionInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionProviderSpecificInput __enableProtectionProviderSpecificInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EnableProtectionProviderSpecificInput(); + + /// Backing field for property. + private string _diskEncryptionSetId; + + /// The DiskEncryptionSet ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string DiskEncryptionSetId { get => this._diskEncryptionSetId; set => this._diskEncryptionSetId = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskAccountType? _diskType; + + /// The DiskType. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskAccountType? DiskType { get => this._diskType; set => this._diskType = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2DiskInputDetails[] _disksToInclude; + + /// The disks to include list. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2DiskInputDetails[] DisksToInclude { get => this._disksToInclude; set => this._disksToInclude = value; } + + /// Backing field for property. + private string _enableRdpOnTargetOption; + + /// + /// The selected option to enable RDP\SSH on target VM after failover. String value of SrsDataContract.EnableRDPOnTargetOption + /// enum. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string EnableRdpOnTargetOption { get => this._enableRdpOnTargetOption; set => this._enableRdpOnTargetOption = value; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionProviderSpecificInputInternal)__enableProtectionProviderSpecificInput).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionProviderSpecificInputInternal)__enableProtectionProviderSpecificInput).InstanceType = value ; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.LicenseType? _licenseType; + + /// License type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.LicenseType? LicenseType { get => this._licenseType; set => this._licenseType = value; } + + /// Backing field for property. + private string _logStorageAccountId; + + /// The storage account to be used for logging during replication. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string LogStorageAccountId { get => this._logStorageAccountId; set => this._logStorageAccountId = value; } + + /// Backing field for property. + private string _masterTargetId; + + /// The Master target Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string MasterTargetId { get => this._masterTargetId; set => this._masterTargetId = value; } + + /// Backing field for property. + private string _multiVMGroupId; + + /// The multi VM group Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string MultiVMGroupId { get => this._multiVMGroupId; set => this._multiVMGroupId = value; } + + /// Backing field for property. + private string _multiVMGroupName; + + /// The multi VM group name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string MultiVMGroupName { get => this._multiVMGroupName; set => this._multiVMGroupName = value; } + + /// Backing field for property. + private string _processServerId; + + /// The Process Server Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ProcessServerId { get => this._processServerId; set => this._processServerId = value; } + + /// Backing field for property. + private string _runAsAccountId; + + /// The CS account Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RunAsAccountId { get => this._runAsAccountId; set => this._runAsAccountId = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputSeedManagedDiskTags _seedManagedDiskTag; + + /// The tags for the seed managed disks. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputSeedManagedDiskTags SeedManagedDiskTag { get => (this._seedManagedDiskTag = this._seedManagedDiskTag ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2EnableProtectionInputSeedManagedDiskTags()); set => this._seedManagedDiskTag = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SqlServerLicenseType? _sqlServerLicenseType; + + /// The SQL Server license type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SqlServerLicenseType? SqlServerLicenseType { get => this._sqlServerLicenseType; set => this._sqlServerLicenseType = value; } + + /// Backing field for property. + private string _storageAccountId; + + /// The storage account Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string StorageAccountId { get => this._storageAccountId; set => this._storageAccountId = value; } + + /// Backing field for property. + private string _targetAvailabilitySetId; + + /// The target availability set ARM Id for resource manager deployment. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetAvailabilitySetId { get => this._targetAvailabilitySetId; set => this._targetAvailabilitySetId = value; } + + /// Backing field for property. + private string _targetAvailabilityZone; + + /// The target availability zone. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetAvailabilityZone { get => this._targetAvailabilityZone; set => this._targetAvailabilityZone = value; } + + /// Backing field for property. + private string _targetAzureNetworkId; + + /// The selected target Azure network Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetAzureNetworkId { get => this._targetAzureNetworkId; set => this._targetAzureNetworkId = value; } + + /// Backing field for property. + private string _targetAzureSubnetId; + + /// The selected target Azure subnet Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetAzureSubnetId { get => this._targetAzureSubnetId; set => this._targetAzureSubnetId = value; } + + /// Backing field for property. + private string _targetAzureV1ResourceGroupId; + + /// + /// The Id of the target resource group (for classic deployment) in which the failover VM is to be created. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetAzureV1ResourceGroupId { get => this._targetAzureV1ResourceGroupId; set => this._targetAzureV1ResourceGroupId = value; } + + /// Backing field for property. + private string _targetAzureV2ResourceGroupId; + + /// + /// The Id of the target resource group (for resource manager deployment) in which the failover VM is to be created. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetAzureV2ResourceGroupId { get => this._targetAzureV2ResourceGroupId; set => this._targetAzureV2ResourceGroupId = value; } + + /// Backing field for property. + private string _targetAzureVMName; + + /// The target azure VM Name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetAzureVMName { get => this._targetAzureVMName; set => this._targetAzureVMName = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputTargetManagedDiskTags _targetManagedDiskTag; + + /// The tags for the target managed disks. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputTargetManagedDiskTags TargetManagedDiskTag { get => (this._targetManagedDiskTag = this._targetManagedDiskTag ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2EnableProtectionInputTargetManagedDiskTags()); set => this._targetManagedDiskTag = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputTargetNicTags _targetNicTag; + + /// The tags for the target NICs. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputTargetNicTags TargetNicTag { get => (this._targetNicTag = this._targetNicTag ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2EnableProtectionInputTargetNicTags()); set => this._targetNicTag = value; } + + /// Backing field for property. + private string _targetProximityPlacementGroupId; + + /// The proximity placement group ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetProximityPlacementGroupId { get => this._targetProximityPlacementGroupId; set => this._targetProximityPlacementGroupId = value; } + + /// Backing field for property. + private string _targetVMSize; + + /// The target VM size. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetVMSize { get => this._targetVMSize; set => this._targetVMSize = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputTargetVMTags _targetVMTag; + + /// The target VM tags. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputTargetVMTags TargetVMTag { get => (this._targetVMTag = this._targetVMTag ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2EnableProtectionInputTargetVMTags()); set => this._targetVMTag = value; } + + /// Creates an new instance. + public InMageAzureV2EnableProtectionInput() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__enableProtectionProviderSpecificInput), __enableProtectionProviderSpecificInput); + await eventListener.AssertObjectIsValid(nameof(__enableProtectionProviderSpecificInput), __enableProtectionProviderSpecificInput); + } + } + /// VMware Azure specific enable protection input. + public partial interface IInMageAzureV2EnableProtectionInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionProviderSpecificInput + { + /// The DiskEncryptionSet ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The DiskEncryptionSet ARM Id.", + SerializedName = @"diskEncryptionSetId", + PossibleTypes = new [] { typeof(string) })] + string DiskEncryptionSetId { get; set; } + /// The DiskType. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The DiskType.", + SerializedName = @"diskType", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskAccountType) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskAccountType? DiskType { get; set; } + /// The disks to include list. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The disks to include list.", + SerializedName = @"disksToInclude", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2DiskInputDetails) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2DiskInputDetails[] DisksToInclude { get; set; } + /// + /// The selected option to enable RDP\SSH on target VM after failover. String value of SrsDataContract.EnableRDPOnTargetOption + /// enum. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The selected option to enable RDP\SSH on target VM after failover. String value of SrsDataContract.EnableRDPOnTargetOption enum.", + SerializedName = @"enableRdpOnTargetOption", + PossibleTypes = new [] { typeof(string) })] + string EnableRdpOnTargetOption { get; set; } + /// License type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"License type.", + SerializedName = @"licenseType", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.LicenseType) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.LicenseType? LicenseType { get; set; } + /// The storage account to be used for logging during replication. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The storage account to be used for logging during replication.", + SerializedName = @"logStorageAccountId", + PossibleTypes = new [] { typeof(string) })] + string LogStorageAccountId { get; set; } + /// The Master target Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Master target Id.", + SerializedName = @"masterTargetId", + PossibleTypes = new [] { typeof(string) })] + string MasterTargetId { get; set; } + /// The multi VM group Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The multi VM group Id.", + SerializedName = @"multiVmGroupId", + PossibleTypes = new [] { typeof(string) })] + string MultiVMGroupId { get; set; } + /// The multi VM group name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The multi VM group name.", + SerializedName = @"multiVmGroupName", + PossibleTypes = new [] { typeof(string) })] + string MultiVMGroupName { get; set; } + /// The Process Server Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Process Server Id.", + SerializedName = @"processServerId", + PossibleTypes = new [] { typeof(string) })] + string ProcessServerId { get; set; } + /// The CS account Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The CS account Id.", + SerializedName = @"runAsAccountId", + PossibleTypes = new [] { typeof(string) })] + string RunAsAccountId { get; set; } + /// The tags for the seed managed disks. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The tags for the seed managed disks.", + SerializedName = @"seedManagedDiskTags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputSeedManagedDiskTags) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputSeedManagedDiskTags SeedManagedDiskTag { get; set; } + /// The SQL Server license type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The SQL Server license type.", + SerializedName = @"sqlServerLicenseType", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SqlServerLicenseType) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SqlServerLicenseType? SqlServerLicenseType { get; set; } + /// The storage account Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The storage account Id.", + SerializedName = @"storageAccountId", + PossibleTypes = new [] { typeof(string) })] + string StorageAccountId { get; set; } + /// The target availability set ARM Id for resource manager deployment. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target availability set ARM Id for resource manager deployment.", + SerializedName = @"targetAvailabilitySetId", + PossibleTypes = new [] { typeof(string) })] + string TargetAvailabilitySetId { get; set; } + /// The target availability zone. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target availability zone.", + SerializedName = @"targetAvailabilityZone", + PossibleTypes = new [] { typeof(string) })] + string TargetAvailabilityZone { get; set; } + /// The selected target Azure network Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The selected target Azure network Id.", + SerializedName = @"targetAzureNetworkId", + PossibleTypes = new [] { typeof(string) })] + string TargetAzureNetworkId { get; set; } + /// The selected target Azure subnet Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The selected target Azure subnet Id.", + SerializedName = @"targetAzureSubnetId", + PossibleTypes = new [] { typeof(string) })] + string TargetAzureSubnetId { get; set; } + /// + /// The Id of the target resource group (for classic deployment) in which the failover VM is to be created. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Id of the target resource group (for classic deployment) in which the failover VM is to be created.", + SerializedName = @"targetAzureV1ResourceGroupId", + PossibleTypes = new [] { typeof(string) })] + string TargetAzureV1ResourceGroupId { get; set; } + /// + /// The Id of the target resource group (for resource manager deployment) in which the failover VM is to be created. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Id of the target resource group (for resource manager deployment) in which the failover VM is to be created.", + SerializedName = @"targetAzureV2ResourceGroupId", + PossibleTypes = new [] { typeof(string) })] + string TargetAzureV2ResourceGroupId { get; set; } + /// The target azure VM Name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target azure VM Name.", + SerializedName = @"targetAzureVmName", + PossibleTypes = new [] { typeof(string) })] + string TargetAzureVMName { get; set; } + /// The tags for the target managed disks. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The tags for the target managed disks.", + SerializedName = @"targetManagedDiskTags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputTargetManagedDiskTags) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputTargetManagedDiskTags TargetManagedDiskTag { get; set; } + /// The tags for the target NICs. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The tags for the target NICs.", + SerializedName = @"targetNicTags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputTargetNicTags) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputTargetNicTags TargetNicTag { get; set; } + /// The proximity placement group ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The proximity placement group ARM Id.", + SerializedName = @"targetProximityPlacementGroupId", + PossibleTypes = new [] { typeof(string) })] + string TargetProximityPlacementGroupId { get; set; } + /// The target VM size. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target VM size.", + SerializedName = @"targetVmSize", + PossibleTypes = new [] { typeof(string) })] + string TargetVMSize { get; set; } + /// The target VM tags. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target VM tags.", + SerializedName = @"targetVmTags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputTargetVMTags) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputTargetVMTags TargetVMTag { get; set; } + + } + /// VMware Azure specific enable protection input. + internal partial interface IInMageAzureV2EnableProtectionInputInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionProviderSpecificInputInternal + { + /// The DiskEncryptionSet ARM Id. + string DiskEncryptionSetId { get; set; } + /// The DiskType. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskAccountType? DiskType { get; set; } + /// The disks to include list. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2DiskInputDetails[] DisksToInclude { get; set; } + /// + /// The selected option to enable RDP\SSH on target VM after failover. String value of SrsDataContract.EnableRDPOnTargetOption + /// enum. + /// + string EnableRdpOnTargetOption { get; set; } + /// License type. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.LicenseType? LicenseType { get; set; } + /// The storage account to be used for logging during replication. + string LogStorageAccountId { get; set; } + /// The Master target Id. + string MasterTargetId { get; set; } + /// The multi VM group Id. + string MultiVMGroupId { get; set; } + /// The multi VM group name. + string MultiVMGroupName { get; set; } + /// The Process Server Id. + string ProcessServerId { get; set; } + /// The CS account Id. + string RunAsAccountId { get; set; } + /// The tags for the seed managed disks. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputSeedManagedDiskTags SeedManagedDiskTag { get; set; } + /// The SQL Server license type. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SqlServerLicenseType? SqlServerLicenseType { get; set; } + /// The storage account Id. + string StorageAccountId { get; set; } + /// The target availability set ARM Id for resource manager deployment. + string TargetAvailabilitySetId { get; set; } + /// The target availability zone. + string TargetAvailabilityZone { get; set; } + /// The selected target Azure network Id. + string TargetAzureNetworkId { get; set; } + /// The selected target Azure subnet Id. + string TargetAzureSubnetId { get; set; } + /// + /// The Id of the target resource group (for classic deployment) in which the failover VM is to be created. + /// + string TargetAzureV1ResourceGroupId { get; set; } + /// + /// The Id of the target resource group (for resource manager deployment) in which the failover VM is to be created. + /// + string TargetAzureV2ResourceGroupId { get; set; } + /// The target azure VM Name. + string TargetAzureVMName { get; set; } + /// The tags for the target managed disks. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputTargetManagedDiskTags TargetManagedDiskTag { get; set; } + /// The tags for the target NICs. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputTargetNicTags TargetNicTag { get; set; } + /// The proximity placement group ARM Id. + string TargetProximityPlacementGroupId { get; set; } + /// The target VM size. + string TargetVMSize { get; set; } + /// The target VM tags. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputTargetVMTags TargetVMTag { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2EnableProtectionInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2EnableProtectionInput.json.cs new file mode 100644 index 000000000000..aaab08f075c7 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2EnableProtectionInput.json.cs @@ -0,0 +1,169 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// VMware Azure specific enable protection input. + public partial class InMageAzureV2EnableProtectionInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new InMageAzureV2EnableProtectionInput(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal InMageAzureV2EnableProtectionInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __enableProtectionProviderSpecificInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EnableProtectionProviderSpecificInput(json); + {_masterTargetId = If( json?.PropertyT("masterTargetId"), out var __jsonMasterTargetId) ? (string)__jsonMasterTargetId : (string)MasterTargetId;} + {_processServerId = If( json?.PropertyT("processServerId"), out var __jsonProcessServerId) ? (string)__jsonProcessServerId : (string)ProcessServerId;} + {_storageAccountId = If( json?.PropertyT("storageAccountId"), out var __jsonStorageAccountId) ? (string)__jsonStorageAccountId : (string)StorageAccountId;} + {_runAsAccountId = If( json?.PropertyT("runAsAccountId"), out var __jsonRunAsAccountId) ? (string)__jsonRunAsAccountId : (string)RunAsAccountId;} + {_multiVMGroupId = If( json?.PropertyT("multiVmGroupId"), out var __jsonMultiVMGroupId) ? (string)__jsonMultiVMGroupId : (string)MultiVMGroupId;} + {_multiVMGroupName = If( json?.PropertyT("multiVmGroupName"), out var __jsonMultiVMGroupName) ? (string)__jsonMultiVMGroupName : (string)MultiVMGroupName;} + {_disksToInclude = If( json?.PropertyT("disksToInclude"), out var __jsonDisksToInclude) ? If( __jsonDisksToInclude as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2DiskInputDetails) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2DiskInputDetails.FromJson(__u) )) ))() : null : DisksToInclude;} + {_targetAzureNetworkId = If( json?.PropertyT("targetAzureNetworkId"), out var __jsonTargetAzureNetworkId) ? (string)__jsonTargetAzureNetworkId : (string)TargetAzureNetworkId;} + {_targetAzureSubnetId = If( json?.PropertyT("targetAzureSubnetId"), out var __jsonTargetAzureSubnetId) ? (string)__jsonTargetAzureSubnetId : (string)TargetAzureSubnetId;} + {_enableRdpOnTargetOption = If( json?.PropertyT("enableRdpOnTargetOption"), out var __jsonEnableRdpOnTargetOption) ? (string)__jsonEnableRdpOnTargetOption : (string)EnableRdpOnTargetOption;} + {_targetAzureVMName = If( json?.PropertyT("targetAzureVmName"), out var __jsonTargetAzureVMName) ? (string)__jsonTargetAzureVMName : (string)TargetAzureVMName;} + {_logStorageAccountId = If( json?.PropertyT("logStorageAccountId"), out var __jsonLogStorageAccountId) ? (string)__jsonLogStorageAccountId : (string)LogStorageAccountId;} + {_targetAzureV1ResourceGroupId = If( json?.PropertyT("targetAzureV1ResourceGroupId"), out var __jsonTargetAzureV1ResourceGroupId) ? (string)__jsonTargetAzureV1ResourceGroupId : (string)TargetAzureV1ResourceGroupId;} + {_targetAzureV2ResourceGroupId = If( json?.PropertyT("targetAzureV2ResourceGroupId"), out var __jsonTargetAzureV2ResourceGroupId) ? (string)__jsonTargetAzureV2ResourceGroupId : (string)TargetAzureV2ResourceGroupId;} + {_diskType = If( json?.PropertyT("diskType"), out var __jsonDiskType) ? (string)__jsonDiskType : (string)DiskType;} + {_targetAvailabilitySetId = If( json?.PropertyT("targetAvailabilitySetId"), out var __jsonTargetAvailabilitySetId) ? (string)__jsonTargetAvailabilitySetId : (string)TargetAvailabilitySetId;} + {_targetAvailabilityZone = If( json?.PropertyT("targetAvailabilityZone"), out var __jsonTargetAvailabilityZone) ? (string)__jsonTargetAvailabilityZone : (string)TargetAvailabilityZone;} + {_targetProximityPlacementGroupId = If( json?.PropertyT("targetProximityPlacementGroupId"), out var __jsonTargetProximityPlacementGroupId) ? (string)__jsonTargetProximityPlacementGroupId : (string)TargetProximityPlacementGroupId;} + {_licenseType = If( json?.PropertyT("licenseType"), out var __jsonLicenseType) ? (string)__jsonLicenseType : (string)LicenseType;} + {_sqlServerLicenseType = If( json?.PropertyT("sqlServerLicenseType"), out var __jsonSqlServerLicenseType) ? (string)__jsonSqlServerLicenseType : (string)SqlServerLicenseType;} + {_targetVMSize = If( json?.PropertyT("targetVmSize"), out var __jsonTargetVMSize) ? (string)__jsonTargetVMSize : (string)TargetVMSize;} + {_diskEncryptionSetId = If( json?.PropertyT("diskEncryptionSetId"), out var __jsonDiskEncryptionSetId) ? (string)__jsonDiskEncryptionSetId : (string)DiskEncryptionSetId;} + {_targetVMTag = If( json?.PropertyT("targetVmTags"), out var __jsonTargetVMTags) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2EnableProtectionInputTargetVMTags.FromJson(__jsonTargetVMTags) : TargetVMTag;} + {_seedManagedDiskTag = If( json?.PropertyT("seedManagedDiskTags"), out var __jsonSeedManagedDiskTags) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2EnableProtectionInputSeedManagedDiskTags.FromJson(__jsonSeedManagedDiskTags) : SeedManagedDiskTag;} + {_targetManagedDiskTag = If( json?.PropertyT("targetManagedDiskTags"), out var __jsonTargetManagedDiskTags) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2EnableProtectionInputTargetManagedDiskTags.FromJson(__jsonTargetManagedDiskTags) : TargetManagedDiskTag;} + {_targetNicTag = If( json?.PropertyT("targetNicTags"), out var __jsonTargetNicTags) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2EnableProtectionInputTargetNicTags.FromJson(__jsonTargetNicTags) : TargetNicTag;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __enableProtectionProviderSpecificInput?.ToJson(container, serializationMode); + AddIf( null != (((object)this._masterTargetId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._masterTargetId.ToString()) : null, "masterTargetId" ,container.Add ); + AddIf( null != (((object)this._processServerId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._processServerId.ToString()) : null, "processServerId" ,container.Add ); + AddIf( null != (((object)this._storageAccountId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._storageAccountId.ToString()) : null, "storageAccountId" ,container.Add ); + AddIf( null != (((object)this._runAsAccountId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._runAsAccountId.ToString()) : null, "runAsAccountId" ,container.Add ); + AddIf( null != (((object)this._multiVMGroupId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._multiVMGroupId.ToString()) : null, "multiVmGroupId" ,container.Add ); + AddIf( null != (((object)this._multiVMGroupName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._multiVMGroupName.ToString()) : null, "multiVmGroupName" ,container.Add ); + if (null != this._disksToInclude) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._disksToInclude ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("disksToInclude",__w); + } + AddIf( null != (((object)this._targetAzureNetworkId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetAzureNetworkId.ToString()) : null, "targetAzureNetworkId" ,container.Add ); + AddIf( null != (((object)this._targetAzureSubnetId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetAzureSubnetId.ToString()) : null, "targetAzureSubnetId" ,container.Add ); + AddIf( null != (((object)this._enableRdpOnTargetOption)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._enableRdpOnTargetOption.ToString()) : null, "enableRdpOnTargetOption" ,container.Add ); + AddIf( null != (((object)this._targetAzureVMName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetAzureVMName.ToString()) : null, "targetAzureVmName" ,container.Add ); + AddIf( null != (((object)this._logStorageAccountId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._logStorageAccountId.ToString()) : null, "logStorageAccountId" ,container.Add ); + AddIf( null != (((object)this._targetAzureV1ResourceGroupId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetAzureV1ResourceGroupId.ToString()) : null, "targetAzureV1ResourceGroupId" ,container.Add ); + AddIf( null != (((object)this._targetAzureV2ResourceGroupId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetAzureV2ResourceGroupId.ToString()) : null, "targetAzureV2ResourceGroupId" ,container.Add ); + AddIf( null != (((object)this._diskType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._diskType.ToString()) : null, "diskType" ,container.Add ); + AddIf( null != (((object)this._targetAvailabilitySetId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetAvailabilitySetId.ToString()) : null, "targetAvailabilitySetId" ,container.Add ); + AddIf( null != (((object)this._targetAvailabilityZone)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetAvailabilityZone.ToString()) : null, "targetAvailabilityZone" ,container.Add ); + AddIf( null != (((object)this._targetProximityPlacementGroupId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetProximityPlacementGroupId.ToString()) : null, "targetProximityPlacementGroupId" ,container.Add ); + AddIf( null != (((object)this._licenseType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._licenseType.ToString()) : null, "licenseType" ,container.Add ); + AddIf( null != (((object)this._sqlServerLicenseType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._sqlServerLicenseType.ToString()) : null, "sqlServerLicenseType" ,container.Add ); + AddIf( null != (((object)this._targetVMSize)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetVMSize.ToString()) : null, "targetVmSize" ,container.Add ); + AddIf( null != (((object)this._diskEncryptionSetId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._diskEncryptionSetId.ToString()) : null, "diskEncryptionSetId" ,container.Add ); + AddIf( null != this._targetVMTag ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._targetVMTag.ToJson(null,serializationMode) : null, "targetVmTags" ,container.Add ); + AddIf( null != this._seedManagedDiskTag ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._seedManagedDiskTag.ToJson(null,serializationMode) : null, "seedManagedDiskTags" ,container.Add ); + AddIf( null != this._targetManagedDiskTag ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._targetManagedDiskTag.ToJson(null,serializationMode) : null, "targetManagedDiskTags" ,container.Add ); + AddIf( null != this._targetNicTag ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._targetNicTag.ToJson(null,serializationMode) : null, "targetNicTags" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2EnableProtectionInputSeedManagedDiskTags.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2EnableProtectionInputSeedManagedDiskTags.PowerShell.cs new file mode 100644 index 000000000000..9707125ff140 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2EnableProtectionInputSeedManagedDiskTags.PowerShell.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// The tags for the seed managed disks. + [System.ComponentModel.TypeConverter(typeof(InMageAzureV2EnableProtectionInputSeedManagedDiskTagsTypeConverter))] + public partial class InMageAzureV2EnableProtectionInputSeedManagedDiskTags + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputSeedManagedDiskTags DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InMageAzureV2EnableProtectionInputSeedManagedDiskTags(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputSeedManagedDiskTags DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InMageAzureV2EnableProtectionInputSeedManagedDiskTags(content); + } + + /// + /// Creates a new instance of , deserializing the content + /// from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputSeedManagedDiskTags FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InMageAzureV2EnableProtectionInputSeedManagedDiskTags(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InMageAzureV2EnableProtectionInputSeedManagedDiskTags(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// The tags for the seed managed disks. + [System.ComponentModel.TypeConverter(typeof(InMageAzureV2EnableProtectionInputSeedManagedDiskTagsTypeConverter))] + public partial interface IInMageAzureV2EnableProtectionInputSeedManagedDiskTags + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2EnableProtectionInputSeedManagedDiskTags.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2EnableProtectionInputSeedManagedDiskTags.TypeConverter.cs new file mode 100644 index 000000000000..ebb1b29b07fb --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2EnableProtectionInputSeedManagedDiskTags.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InMageAzureV2EnableProtectionInputSeedManagedDiskTagsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputSeedManagedDiskTags ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputSeedManagedDiskTags).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InMageAzureV2EnableProtectionInputSeedManagedDiskTags.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InMageAzureV2EnableProtectionInputSeedManagedDiskTags.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InMageAzureV2EnableProtectionInputSeedManagedDiskTags.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2EnableProtectionInputSeedManagedDiskTags.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2EnableProtectionInputSeedManagedDiskTags.cs new file mode 100644 index 000000000000..9f0b33c265d9 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2EnableProtectionInputSeedManagedDiskTags.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The tags for the seed managed disks. + public partial class InMageAzureV2EnableProtectionInputSeedManagedDiskTags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputSeedManagedDiskTags, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputSeedManagedDiskTagsInternal + { + + /// + /// Creates an new instance. + /// + public InMageAzureV2EnableProtectionInputSeedManagedDiskTags() + { + + } + } + /// The tags for the seed managed disks. + public partial interface IInMageAzureV2EnableProtectionInputSeedManagedDiskTags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray + { + + } + /// The tags for the seed managed disks. + internal partial interface IInMageAzureV2EnableProtectionInputSeedManagedDiskTagsInternal + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2EnableProtectionInputSeedManagedDiskTags.dictionary.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2EnableProtectionInputSeedManagedDiskTags.dictionary.cs new file mode 100644 index 000000000000..dc232b2b3ee0 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2EnableProtectionInputSeedManagedDiskTags.dictionary.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + public partial class InMageAzureV2EnableProtectionInputSeedManagedDiskTags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray + { + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + + int Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Values { get => __additionalProperties.Values; } + + public string this[global::System.String index] { get => __additionalProperties[index]; set => __additionalProperties[index] = value; } + + /// + /// + public void Add(global::System.String key, string value) => __additionalProperties.Add( key, value); + + public void Clear() => __additionalProperties.Clear(); + + /// + public bool ContainsKey(global::System.String key) => __additionalProperties.ContainsKey( key); + + /// + public void CopyFrom(global::System.Collections.IDictionary source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public void CopyFrom(global::System.Management.Automation.PSObject source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public bool Remove(global::System.String key) => __additionalProperties.Remove( key); + + /// + /// + public bool TryGetValue(global::System.String key, out string value) => __additionalProperties.TryGetValue( key, out value); + + /// + + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2EnableProtectionInputSeedManagedDiskTags source) => source.__additionalProperties; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2EnableProtectionInputSeedManagedDiskTags.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2EnableProtectionInputSeedManagedDiskTags.json.cs new file mode 100644 index 000000000000..9dac9a6ef056 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2EnableProtectionInputSeedManagedDiskTags.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The tags for the seed managed disks. + public partial class InMageAzureV2EnableProtectionInputSeedManagedDiskTags + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputSeedManagedDiskTags. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputSeedManagedDiskTags. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputSeedManagedDiskTags FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new InMageAzureV2EnableProtectionInputSeedManagedDiskTags(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + /// + internal InMageAzureV2EnableProtectionInputSeedManagedDiskTags(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, global::System.Collections.Generic.HashSet exclusions = null) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray)this).AdditionalProperties, null ,exclusions ); + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray)this).AdditionalProperties, container); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2EnableProtectionInputTargetManagedDiskTags.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2EnableProtectionInputTargetManagedDiskTags.PowerShell.cs new file mode 100644 index 000000000000..8c67cef6bf20 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2EnableProtectionInputTargetManagedDiskTags.PowerShell.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// The tags for the target managed disks. + [System.ComponentModel.TypeConverter(typeof(InMageAzureV2EnableProtectionInputTargetManagedDiskTagsTypeConverter))] + public partial class InMageAzureV2EnableProtectionInputTargetManagedDiskTags + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputTargetManagedDiskTags DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InMageAzureV2EnableProtectionInputTargetManagedDiskTags(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputTargetManagedDiskTags DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InMageAzureV2EnableProtectionInputTargetManagedDiskTags(content); + } + + /// + /// Creates a new instance of , deserializing the content + /// from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputTargetManagedDiskTags FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InMageAzureV2EnableProtectionInputTargetManagedDiskTags(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InMageAzureV2EnableProtectionInputTargetManagedDiskTags(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// The tags for the target managed disks. + [System.ComponentModel.TypeConverter(typeof(InMageAzureV2EnableProtectionInputTargetManagedDiskTagsTypeConverter))] + public partial interface IInMageAzureV2EnableProtectionInputTargetManagedDiskTags + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2EnableProtectionInputTargetManagedDiskTags.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2EnableProtectionInputTargetManagedDiskTags.TypeConverter.cs new file mode 100644 index 000000000000..bbd9fa8236b4 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2EnableProtectionInputTargetManagedDiskTags.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InMageAzureV2EnableProtectionInputTargetManagedDiskTagsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputTargetManagedDiskTags ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputTargetManagedDiskTags).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InMageAzureV2EnableProtectionInputTargetManagedDiskTags.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InMageAzureV2EnableProtectionInputTargetManagedDiskTags.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InMageAzureV2EnableProtectionInputTargetManagedDiskTags.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2EnableProtectionInputTargetManagedDiskTags.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2EnableProtectionInputTargetManagedDiskTags.cs new file mode 100644 index 000000000000..94cc705f1ff4 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2EnableProtectionInputTargetManagedDiskTags.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The tags for the target managed disks. + public partial class InMageAzureV2EnableProtectionInputTargetManagedDiskTags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputTargetManagedDiskTags, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputTargetManagedDiskTagsInternal + { + + /// + /// Creates an new instance. + /// + public InMageAzureV2EnableProtectionInputTargetManagedDiskTags() + { + + } + } + /// The tags for the target managed disks. + public partial interface IInMageAzureV2EnableProtectionInputTargetManagedDiskTags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray + { + + } + /// The tags for the target managed disks. + internal partial interface IInMageAzureV2EnableProtectionInputTargetManagedDiskTagsInternal + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2EnableProtectionInputTargetManagedDiskTags.dictionary.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2EnableProtectionInputTargetManagedDiskTags.dictionary.cs new file mode 100644 index 000000000000..aa96fa539219 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2EnableProtectionInputTargetManagedDiskTags.dictionary.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + public partial class InMageAzureV2EnableProtectionInputTargetManagedDiskTags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray + { + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + + int Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Values { get => __additionalProperties.Values; } + + public string this[global::System.String index] { get => __additionalProperties[index]; set => __additionalProperties[index] = value; } + + /// + /// + public void Add(global::System.String key, string value) => __additionalProperties.Add( key, value); + + public void Clear() => __additionalProperties.Clear(); + + /// + public bool ContainsKey(global::System.String key) => __additionalProperties.ContainsKey( key); + + /// + public void CopyFrom(global::System.Collections.IDictionary source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public void CopyFrom(global::System.Management.Automation.PSObject source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public bool Remove(global::System.String key) => __additionalProperties.Remove( key); + + /// + /// + public bool TryGetValue(global::System.String key, out string value) => __additionalProperties.TryGetValue( key, out value); + + /// + + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2EnableProtectionInputTargetManagedDiskTags source) => source.__additionalProperties; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2EnableProtectionInputTargetManagedDiskTags.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2EnableProtectionInputTargetManagedDiskTags.json.cs new file mode 100644 index 000000000000..2601b0609a10 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2EnableProtectionInputTargetManagedDiskTags.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The tags for the target managed disks. + public partial class InMageAzureV2EnableProtectionInputTargetManagedDiskTags + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputTargetManagedDiskTags. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputTargetManagedDiskTags. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputTargetManagedDiskTags FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new InMageAzureV2EnableProtectionInputTargetManagedDiskTags(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + /// + internal InMageAzureV2EnableProtectionInputTargetManagedDiskTags(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, global::System.Collections.Generic.HashSet exclusions = null) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray)this).AdditionalProperties, null ,exclusions ); + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray)this).AdditionalProperties, container); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2EnableProtectionInputTargetNicTags.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2EnableProtectionInputTargetNicTags.PowerShell.cs new file mode 100644 index 000000000000..891160c29200 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2EnableProtectionInputTargetNicTags.PowerShell.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// The tags for the target NICs. + [System.ComponentModel.TypeConverter(typeof(InMageAzureV2EnableProtectionInputTargetNicTagsTypeConverter))] + public partial class InMageAzureV2EnableProtectionInputTargetNicTags + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputTargetNicTags DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InMageAzureV2EnableProtectionInputTargetNicTags(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputTargetNicTags DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InMageAzureV2EnableProtectionInputTargetNicTags(content); + } + + /// + /// Creates a new instance of , deserializing the content from + /// a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputTargetNicTags FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InMageAzureV2EnableProtectionInputTargetNicTags(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InMageAzureV2EnableProtectionInputTargetNicTags(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// The tags for the target NICs. + [System.ComponentModel.TypeConverter(typeof(InMageAzureV2EnableProtectionInputTargetNicTagsTypeConverter))] + public partial interface IInMageAzureV2EnableProtectionInputTargetNicTags + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2EnableProtectionInputTargetNicTags.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2EnableProtectionInputTargetNicTags.TypeConverter.cs new file mode 100644 index 000000000000..aee209c3f9a1 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2EnableProtectionInputTargetNicTags.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InMageAzureV2EnableProtectionInputTargetNicTagsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, + /// otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputTargetNicTags ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputTargetNicTags).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InMageAzureV2EnableProtectionInputTargetNicTags.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InMageAzureV2EnableProtectionInputTargetNicTags.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InMageAzureV2EnableProtectionInputTargetNicTags.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2EnableProtectionInputTargetNicTags.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2EnableProtectionInputTargetNicTags.cs new file mode 100644 index 000000000000..f40e007354e7 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2EnableProtectionInputTargetNicTags.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The tags for the target NICs. + public partial class InMageAzureV2EnableProtectionInputTargetNicTags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputTargetNicTags, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputTargetNicTagsInternal + { + + /// + /// Creates an new instance. + /// + public InMageAzureV2EnableProtectionInputTargetNicTags() + { + + } + } + /// The tags for the target NICs. + public partial interface IInMageAzureV2EnableProtectionInputTargetNicTags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray + { + + } + /// The tags for the target NICs. + internal partial interface IInMageAzureV2EnableProtectionInputTargetNicTagsInternal + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2EnableProtectionInputTargetNicTags.dictionary.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2EnableProtectionInputTargetNicTags.dictionary.cs new file mode 100644 index 000000000000..970972ec5678 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2EnableProtectionInputTargetNicTags.dictionary.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + public partial class InMageAzureV2EnableProtectionInputTargetNicTags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray + { + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + + int Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Values { get => __additionalProperties.Values; } + + public string this[global::System.String index] { get => __additionalProperties[index]; set => __additionalProperties[index] = value; } + + /// + /// + public void Add(global::System.String key, string value) => __additionalProperties.Add( key, value); + + public void Clear() => __additionalProperties.Clear(); + + /// + public bool ContainsKey(global::System.String key) => __additionalProperties.ContainsKey( key); + + /// + public void CopyFrom(global::System.Collections.IDictionary source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public void CopyFrom(global::System.Management.Automation.PSObject source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public bool Remove(global::System.String key) => __additionalProperties.Remove( key); + + /// + /// + public bool TryGetValue(global::System.String key, out string value) => __additionalProperties.TryGetValue( key, out value); + + /// + + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2EnableProtectionInputTargetNicTags source) => source.__additionalProperties; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2EnableProtectionInputTargetNicTags.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2EnableProtectionInputTargetNicTags.json.cs new file mode 100644 index 000000000000..3f487e72c24b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2EnableProtectionInputTargetNicTags.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The tags for the target NICs. + public partial class InMageAzureV2EnableProtectionInputTargetNicTags + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputTargetNicTags. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputTargetNicTags. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputTargetNicTags FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new InMageAzureV2EnableProtectionInputTargetNicTags(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + /// + internal InMageAzureV2EnableProtectionInputTargetNicTags(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, global::System.Collections.Generic.HashSet exclusions = null) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray)this).AdditionalProperties, null ,exclusions ); + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray)this).AdditionalProperties, container); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2EnableProtectionInputTargetVMTags.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2EnableProtectionInputTargetVMTags.PowerShell.cs new file mode 100644 index 000000000000..92f3ef94d582 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2EnableProtectionInputTargetVMTags.PowerShell.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// The target VM tags. + [System.ComponentModel.TypeConverter(typeof(InMageAzureV2EnableProtectionInputTargetVMTagsTypeConverter))] + public partial class InMageAzureV2EnableProtectionInputTargetVMTags + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputTargetVMTags DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InMageAzureV2EnableProtectionInputTargetVMTags(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputTargetVMTags DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InMageAzureV2EnableProtectionInputTargetVMTags(content); + } + + /// + /// Creates a new instance of , deserializing the content from + /// a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputTargetVMTags FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InMageAzureV2EnableProtectionInputTargetVMTags(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InMageAzureV2EnableProtectionInputTargetVMTags(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// The target VM tags. + [System.ComponentModel.TypeConverter(typeof(InMageAzureV2EnableProtectionInputTargetVMTagsTypeConverter))] + public partial interface IInMageAzureV2EnableProtectionInputTargetVMTags + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2EnableProtectionInputTargetVMTags.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2EnableProtectionInputTargetVMTags.TypeConverter.cs new file mode 100644 index 000000000000..ad540134e35d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2EnableProtectionInputTargetVMTags.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InMageAzureV2EnableProtectionInputTargetVMTagsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, + /// otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputTargetVMTags ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputTargetVMTags).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InMageAzureV2EnableProtectionInputTargetVMTags.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InMageAzureV2EnableProtectionInputTargetVMTags.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InMageAzureV2EnableProtectionInputTargetVMTags.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2EnableProtectionInputTargetVMTags.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2EnableProtectionInputTargetVMTags.cs new file mode 100644 index 000000000000..f4f4b4cec064 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2EnableProtectionInputTargetVMTags.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The target VM tags. + public partial class InMageAzureV2EnableProtectionInputTargetVMTags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputTargetVMTags, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputTargetVMTagsInternal + { + + /// + /// Creates an new instance. + /// + public InMageAzureV2EnableProtectionInputTargetVMTags() + { + + } + } + /// The target VM tags. + public partial interface IInMageAzureV2EnableProtectionInputTargetVMTags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray + { + + } + /// The target VM tags. + internal partial interface IInMageAzureV2EnableProtectionInputTargetVMTagsInternal + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2EnableProtectionInputTargetVMTags.dictionary.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2EnableProtectionInputTargetVMTags.dictionary.cs new file mode 100644 index 000000000000..a584438c3f33 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2EnableProtectionInputTargetVMTags.dictionary.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + public partial class InMageAzureV2EnableProtectionInputTargetVMTags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray + { + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + + int Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Values { get => __additionalProperties.Values; } + + public string this[global::System.String index] { get => __additionalProperties[index]; set => __additionalProperties[index] = value; } + + /// + /// + public void Add(global::System.String key, string value) => __additionalProperties.Add( key, value); + + public void Clear() => __additionalProperties.Clear(); + + /// + public bool ContainsKey(global::System.String key) => __additionalProperties.ContainsKey( key); + + /// + public void CopyFrom(global::System.Collections.IDictionary source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public void CopyFrom(global::System.Management.Automation.PSObject source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public bool Remove(global::System.String key) => __additionalProperties.Remove( key); + + /// + /// + public bool TryGetValue(global::System.String key, out string value) => __additionalProperties.TryGetValue( key, out value); + + /// + + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2EnableProtectionInputTargetVMTags source) => source.__additionalProperties; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2EnableProtectionInputTargetVMTags.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2EnableProtectionInputTargetVMTags.json.cs new file mode 100644 index 000000000000..6ed983683775 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2EnableProtectionInputTargetVMTags.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The target VM tags. + public partial class InMageAzureV2EnableProtectionInputTargetVMTags + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputTargetVMTags. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputTargetVMTags. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EnableProtectionInputTargetVMTags FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new InMageAzureV2EnableProtectionInputTargetVMTags(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + /// + internal InMageAzureV2EnableProtectionInputTargetVMTags(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, global::System.Collections.Generic.HashSet exclusions = null) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray)this).AdditionalProperties, null ,exclusions ); + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray)this).AdditionalProperties, container); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2EventDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2EventDetails.PowerShell.cs new file mode 100644 index 000000000000..2fe02b5c7d83 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2EventDetails.PowerShell.cs @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Model class for event details of a VMwareAzureV2 event. + [System.ComponentModel.TypeConverter(typeof(InMageAzureV2EventDetailsTypeConverter))] + public partial class InMageAzureV2EventDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EventDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InMageAzureV2EventDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EventDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InMageAzureV2EventDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EventDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InMageAzureV2EventDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("EventType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EventDetailsInternal)this).EventType = (string) content.GetValueForProperty("EventType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EventDetailsInternal)this).EventType, global::System.Convert.ToString); + } + if (content.Contains("Category")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EventDetailsInternal)this).Category = (string) content.GetValueForProperty("Category",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EventDetailsInternal)this).Category, global::System.Convert.ToString); + } + if (content.Contains("Component")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EventDetailsInternal)this).Component = (string) content.GetValueForProperty("Component",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EventDetailsInternal)this).Component, global::System.Convert.ToString); + } + if (content.Contains("CorrectiveAction")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EventDetailsInternal)this).CorrectiveAction = (string) content.GetValueForProperty("CorrectiveAction",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EventDetailsInternal)this).CorrectiveAction, global::System.Convert.ToString); + } + if (content.Contains("Detail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EventDetailsInternal)this).Detail = (string) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EventDetailsInternal)this).Detail, global::System.Convert.ToString); + } + if (content.Contains("Summary")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EventDetailsInternal)this).Summary = (string) content.GetValueForProperty("Summary",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EventDetailsInternal)this).Summary, global::System.Convert.ToString); + } + if (content.Contains("SiteName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EventDetailsInternal)this).SiteName = (string) content.GetValueForProperty("SiteName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EventDetailsInternal)this).SiteName, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InMageAzureV2EventDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("EventType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EventDetailsInternal)this).EventType = (string) content.GetValueForProperty("EventType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EventDetailsInternal)this).EventType, global::System.Convert.ToString); + } + if (content.Contains("Category")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EventDetailsInternal)this).Category = (string) content.GetValueForProperty("Category",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EventDetailsInternal)this).Category, global::System.Convert.ToString); + } + if (content.Contains("Component")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EventDetailsInternal)this).Component = (string) content.GetValueForProperty("Component",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EventDetailsInternal)this).Component, global::System.Convert.ToString); + } + if (content.Contains("CorrectiveAction")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EventDetailsInternal)this).CorrectiveAction = (string) content.GetValueForProperty("CorrectiveAction",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EventDetailsInternal)this).CorrectiveAction, global::System.Convert.ToString); + } + if (content.Contains("Detail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EventDetailsInternal)this).Detail = (string) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EventDetailsInternal)this).Detail, global::System.Convert.ToString); + } + if (content.Contains("Summary")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EventDetailsInternal)this).Summary = (string) content.GetValueForProperty("Summary",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EventDetailsInternal)this).Summary, global::System.Convert.ToString); + } + if (content.Contains("SiteName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EventDetailsInternal)this).SiteName = (string) content.GetValueForProperty("SiteName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EventDetailsInternal)this).SiteName, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Model class for event details of a VMwareAzureV2 event. + [System.ComponentModel.TypeConverter(typeof(InMageAzureV2EventDetailsTypeConverter))] + public partial interface IInMageAzureV2EventDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2EventDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2EventDetails.TypeConverter.cs new file mode 100644 index 000000000000..4933fd82c7eb --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2EventDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InMageAzureV2EventDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EventDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EventDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InMageAzureV2EventDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InMageAzureV2EventDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InMageAzureV2EventDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2EventDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2EventDetails.cs new file mode 100644 index 000000000000..d9cb5610d0fb --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2EventDetails.cs @@ -0,0 +1,182 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Model class for event details of a VMwareAzureV2 event. + public partial class InMageAzureV2EventDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EventDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EventDetailsInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetails __eventProviderSpecificDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EventProviderSpecificDetails(); + + /// Backing field for property. + private string _category; + + /// InMage Event Category. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Category { get => this._category; set => this._category = value; } + + /// Backing field for property. + private string _component; + + /// InMage Event Component. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Component { get => this._component; set => this._component = value; } + + /// Backing field for property. + private string _correctiveAction; + + /// Corrective Action string for the event. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string CorrectiveAction { get => this._correctiveAction; set => this._correctiveAction = value; } + + /// Backing field for property. + private string _detail; + + /// InMage Event Details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Detail { get => this._detail; set => this._detail = value; } + + /// Backing field for property. + private string _eventType; + + /// + /// InMage Event type. Takes one of the values of InMageDataContract.InMageMonitoringEventType. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string EventType { get => this._eventType; set => this._eventType = value; } + + /// Gets the class type. Overridden in derived classes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetailsInternal)__eventProviderSpecificDetails).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetailsInternal)__eventProviderSpecificDetails).InstanceType = value ; } + + /// Backing field for property. + private string _siteName; + + /// VMware Site name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string SiteName { get => this._siteName; set => this._siteName = value; } + + /// Backing field for property. + private string _summary; + + /// InMage Event Summary. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Summary { get => this._summary; set => this._summary = value; } + + /// Creates an new instance. + public InMageAzureV2EventDetails() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__eventProviderSpecificDetails), __eventProviderSpecificDetails); + await eventListener.AssertObjectIsValid(nameof(__eventProviderSpecificDetails), __eventProviderSpecificDetails); + } + } + /// Model class for event details of a VMwareAzureV2 event. + public partial interface IInMageAzureV2EventDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetails + { + /// InMage Event Category. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"InMage Event Category.", + SerializedName = @"category", + PossibleTypes = new [] { typeof(string) })] + string Category { get; set; } + /// InMage Event Component. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"InMage Event Component.", + SerializedName = @"component", + PossibleTypes = new [] { typeof(string) })] + string Component { get; set; } + /// Corrective Action string for the event. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Corrective Action string for the event.", + SerializedName = @"correctiveAction", + PossibleTypes = new [] { typeof(string) })] + string CorrectiveAction { get; set; } + /// InMage Event Details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"InMage Event Details.", + SerializedName = @"details", + PossibleTypes = new [] { typeof(string) })] + string Detail { get; set; } + /// + /// InMage Event type. Takes one of the values of InMageDataContract.InMageMonitoringEventType. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"InMage Event type. Takes one of the values of InMageDataContract.InMageMonitoringEventType.", + SerializedName = @"eventType", + PossibleTypes = new [] { typeof(string) })] + string EventType { get; set; } + /// VMware Site name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"VMware Site name.", + SerializedName = @"siteName", + PossibleTypes = new [] { typeof(string) })] + string SiteName { get; set; } + /// InMage Event Summary. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"InMage Event Summary.", + SerializedName = @"summary", + PossibleTypes = new [] { typeof(string) })] + string Summary { get; set; } + + } + /// Model class for event details of a VMwareAzureV2 event. + internal partial interface IInMageAzureV2EventDetailsInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetailsInternal + { + /// InMage Event Category. + string Category { get; set; } + /// InMage Event Component. + string Component { get; set; } + /// Corrective Action string for the event. + string CorrectiveAction { get; set; } + /// InMage Event Details. + string Detail { get; set; } + /// + /// InMage Event type. Takes one of the values of InMageDataContract.InMageMonitoringEventType. + /// + string EventType { get; set; } + /// VMware Site name. + string SiteName { get; set; } + /// InMage Event Summary. + string Summary { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2EventDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2EventDetails.json.cs new file mode 100644 index 000000000000..12637b8a79ba --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2EventDetails.json.cs @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Model class for event details of a VMwareAzureV2 event. + public partial class InMageAzureV2EventDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EventDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EventDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2EventDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new InMageAzureV2EventDetails(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal InMageAzureV2EventDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __eventProviderSpecificDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EventProviderSpecificDetails(json); + {_eventType = If( json?.PropertyT("eventType"), out var __jsonEventType) ? (string)__jsonEventType : (string)EventType;} + {_category = If( json?.PropertyT("category"), out var __jsonCategory) ? (string)__jsonCategory : (string)Category;} + {_component = If( json?.PropertyT("component"), out var __jsonComponent) ? (string)__jsonComponent : (string)Component;} + {_correctiveAction = If( json?.PropertyT("correctiveAction"), out var __jsonCorrectiveAction) ? (string)__jsonCorrectiveAction : (string)CorrectiveAction;} + {_detail = If( json?.PropertyT("details"), out var __jsonDetails) ? (string)__jsonDetails : (string)Detail;} + {_summary = If( json?.PropertyT("summary"), out var __jsonSummary) ? (string)__jsonSummary : (string)Summary;} + {_siteName = If( json?.PropertyT("siteName"), out var __jsonSiteName) ? (string)__jsonSiteName : (string)SiteName;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __eventProviderSpecificDetails?.ToJson(container, serializationMode); + AddIf( null != (((object)this._eventType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._eventType.ToString()) : null, "eventType" ,container.Add ); + AddIf( null != (((object)this._category)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._category.ToString()) : null, "category" ,container.Add ); + AddIf( null != (((object)this._component)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._component.ToString()) : null, "component" ,container.Add ); + AddIf( null != (((object)this._correctiveAction)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._correctiveAction.ToString()) : null, "correctiveAction" ,container.Add ); + AddIf( null != (((object)this._detail)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._detail.ToString()) : null, "details" ,container.Add ); + AddIf( null != (((object)this._summary)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._summary.ToString()) : null, "summary" ,container.Add ); + AddIf( null != (((object)this._siteName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._siteName.ToString()) : null, "siteName" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ManagedDiskDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ManagedDiskDetails.PowerShell.cs new file mode 100644 index 000000000000..cf04b0c8b030 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ManagedDiskDetails.PowerShell.cs @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// InMageAzureV2 Managed disk details. + [System.ComponentModel.TypeConverter(typeof(InMageAzureV2ManagedDiskDetailsTypeConverter))] + public partial class InMageAzureV2ManagedDiskDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ManagedDiskDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InMageAzureV2ManagedDiskDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ManagedDiskDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InMageAzureV2ManagedDiskDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ManagedDiskDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InMageAzureV2ManagedDiskDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DiskId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ManagedDiskDetailsInternal)this).DiskId = (string) content.GetValueForProperty("DiskId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ManagedDiskDetailsInternal)this).DiskId, global::System.Convert.ToString); + } + if (content.Contains("SeedManagedDiskId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ManagedDiskDetailsInternal)this).SeedManagedDiskId = (string) content.GetValueForProperty("SeedManagedDiskId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ManagedDiskDetailsInternal)this).SeedManagedDiskId, global::System.Convert.ToString); + } + if (content.Contains("ReplicaDiskType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ManagedDiskDetailsInternal)this).ReplicaDiskType = (string) content.GetValueForProperty("ReplicaDiskType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ManagedDiskDetailsInternal)this).ReplicaDiskType, global::System.Convert.ToString); + } + if (content.Contains("DiskEncryptionSetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ManagedDiskDetailsInternal)this).DiskEncryptionSetId = (string) content.GetValueForProperty("DiskEncryptionSetId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ManagedDiskDetailsInternal)this).DiskEncryptionSetId, global::System.Convert.ToString); + } + if (content.Contains("TargetDiskName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ManagedDiskDetailsInternal)this).TargetDiskName = (string) content.GetValueForProperty("TargetDiskName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ManagedDiskDetailsInternal)this).TargetDiskName, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InMageAzureV2ManagedDiskDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DiskId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ManagedDiskDetailsInternal)this).DiskId = (string) content.GetValueForProperty("DiskId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ManagedDiskDetailsInternal)this).DiskId, global::System.Convert.ToString); + } + if (content.Contains("SeedManagedDiskId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ManagedDiskDetailsInternal)this).SeedManagedDiskId = (string) content.GetValueForProperty("SeedManagedDiskId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ManagedDiskDetailsInternal)this).SeedManagedDiskId, global::System.Convert.ToString); + } + if (content.Contains("ReplicaDiskType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ManagedDiskDetailsInternal)this).ReplicaDiskType = (string) content.GetValueForProperty("ReplicaDiskType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ManagedDiskDetailsInternal)this).ReplicaDiskType, global::System.Convert.ToString); + } + if (content.Contains("DiskEncryptionSetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ManagedDiskDetailsInternal)this).DiskEncryptionSetId = (string) content.GetValueForProperty("DiskEncryptionSetId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ManagedDiskDetailsInternal)this).DiskEncryptionSetId, global::System.Convert.ToString); + } + if (content.Contains("TargetDiskName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ManagedDiskDetailsInternal)this).TargetDiskName = (string) content.GetValueForProperty("TargetDiskName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ManagedDiskDetailsInternal)this).TargetDiskName, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// InMageAzureV2 Managed disk details. + [System.ComponentModel.TypeConverter(typeof(InMageAzureV2ManagedDiskDetailsTypeConverter))] + public partial interface IInMageAzureV2ManagedDiskDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ManagedDiskDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ManagedDiskDetails.TypeConverter.cs new file mode 100644 index 000000000000..1d84bd65fce2 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ManagedDiskDetails.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InMageAzureV2ManagedDiskDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ManagedDiskDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ManagedDiskDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InMageAzureV2ManagedDiskDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InMageAzureV2ManagedDiskDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InMageAzureV2ManagedDiskDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ManagedDiskDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ManagedDiskDetails.cs new file mode 100644 index 000000000000..ee914190cee8 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ManagedDiskDetails.cs @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMageAzureV2 Managed disk details. + public partial class InMageAzureV2ManagedDiskDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ManagedDiskDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ManagedDiskDetailsInternal + { + + /// Backing field for property. + private string _diskEncryptionSetId; + + /// The DiskEncryptionSet ARM ID. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string DiskEncryptionSetId { get => this._diskEncryptionSetId; set => this._diskEncryptionSetId = value; } + + /// Backing field for property. + private string _diskId; + + /// The disk id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string DiskId { get => this._diskId; set => this._diskId = value; } + + /// Backing field for property. + private string _replicaDiskType; + + /// The replica disk type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ReplicaDiskType { get => this._replicaDiskType; set => this._replicaDiskType = value; } + + /// Backing field for property. + private string _seedManagedDiskId; + + /// Seed managed disk Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string SeedManagedDiskId { get => this._seedManagedDiskId; set => this._seedManagedDiskId = value; } + + /// Backing field for property. + private string _targetDiskName; + + /// The target disk name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetDiskName { get => this._targetDiskName; set => this._targetDiskName = value; } + + /// Creates an new instance. + public InMageAzureV2ManagedDiskDetails() + { + + } + } + /// InMageAzureV2 Managed disk details. + public partial interface IInMageAzureV2ManagedDiskDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The DiskEncryptionSet ARM ID. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The DiskEncryptionSet ARM ID.", + SerializedName = @"diskEncryptionSetId", + PossibleTypes = new [] { typeof(string) })] + string DiskEncryptionSetId { get; set; } + /// The disk id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The disk id.", + SerializedName = @"diskId", + PossibleTypes = new [] { typeof(string) })] + string DiskId { get; set; } + /// The replica disk type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The replica disk type.", + SerializedName = @"replicaDiskType", + PossibleTypes = new [] { typeof(string) })] + string ReplicaDiskType { get; set; } + /// Seed managed disk Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Seed managed disk Id.", + SerializedName = @"seedManagedDiskId", + PossibleTypes = new [] { typeof(string) })] + string SeedManagedDiskId { get; set; } + /// The target disk name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target disk name.", + SerializedName = @"targetDiskName", + PossibleTypes = new [] { typeof(string) })] + string TargetDiskName { get; set; } + + } + /// InMageAzureV2 Managed disk details. + internal partial interface IInMageAzureV2ManagedDiskDetailsInternal + + { + /// The DiskEncryptionSet ARM ID. + string DiskEncryptionSetId { get; set; } + /// The disk id. + string DiskId { get; set; } + /// The replica disk type. + string ReplicaDiskType { get; set; } + /// Seed managed disk Id. + string SeedManagedDiskId { get; set; } + /// The target disk name. + string TargetDiskName { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ManagedDiskDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ManagedDiskDetails.json.cs new file mode 100644 index 000000000000..70af4347ea56 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ManagedDiskDetails.json.cs @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMageAzureV2 Managed disk details. + public partial class InMageAzureV2ManagedDiskDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ManagedDiskDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ManagedDiskDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ManagedDiskDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new InMageAzureV2ManagedDiskDetails(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal InMageAzureV2ManagedDiskDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_diskId = If( json?.PropertyT("diskId"), out var __jsonDiskId) ? (string)__jsonDiskId : (string)DiskId;} + {_seedManagedDiskId = If( json?.PropertyT("seedManagedDiskId"), out var __jsonSeedManagedDiskId) ? (string)__jsonSeedManagedDiskId : (string)SeedManagedDiskId;} + {_replicaDiskType = If( json?.PropertyT("replicaDiskType"), out var __jsonReplicaDiskType) ? (string)__jsonReplicaDiskType : (string)ReplicaDiskType;} + {_diskEncryptionSetId = If( json?.PropertyT("diskEncryptionSetId"), out var __jsonDiskEncryptionSetId) ? (string)__jsonDiskEncryptionSetId : (string)DiskEncryptionSetId;} + {_targetDiskName = If( json?.PropertyT("targetDiskName"), out var __jsonTargetDiskName) ? (string)__jsonTargetDiskName : (string)TargetDiskName;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._diskId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._diskId.ToString()) : null, "diskId" ,container.Add ); + AddIf( null != (((object)this._seedManagedDiskId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._seedManagedDiskId.ToString()) : null, "seedManagedDiskId" ,container.Add ); + AddIf( null != (((object)this._replicaDiskType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._replicaDiskType.ToString()) : null, "replicaDiskType" ,container.Add ); + AddIf( null != (((object)this._diskEncryptionSetId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._diskEncryptionSetId.ToString()) : null, "diskEncryptionSetId" ,container.Add ); + AddIf( null != (((object)this._targetDiskName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetDiskName.ToString()) : null, "targetDiskName" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2PolicyDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2PolicyDetails.PowerShell.cs new file mode 100644 index 000000000000..b8a39c92c56a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2PolicyDetails.PowerShell.cs @@ -0,0 +1,186 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// InMage Azure v2 specific protection profile details. + [System.ComponentModel.TypeConverter(typeof(InMageAzureV2PolicyDetailsTypeConverter))] + public partial class InMageAzureV2PolicyDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2PolicyDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InMageAzureV2PolicyDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2PolicyDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InMageAzureV2PolicyDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2PolicyDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InMageAzureV2PolicyDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CrashConsistentFrequencyInMinute")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2PolicyDetailsInternal)this).CrashConsistentFrequencyInMinute = (int?) content.GetValueForProperty("CrashConsistentFrequencyInMinute",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2PolicyDetailsInternal)this).CrashConsistentFrequencyInMinute, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("RecoveryPointThresholdInMinute")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2PolicyDetailsInternal)this).RecoveryPointThresholdInMinute = (int?) content.GetValueForProperty("RecoveryPointThresholdInMinute",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2PolicyDetailsInternal)this).RecoveryPointThresholdInMinute, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("RecoveryPointHistory")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2PolicyDetailsInternal)this).RecoveryPointHistory = (int?) content.GetValueForProperty("RecoveryPointHistory",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2PolicyDetailsInternal)this).RecoveryPointHistory, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("AppConsistentFrequencyInMinute")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2PolicyDetailsInternal)this).AppConsistentFrequencyInMinute = (int?) content.GetValueForProperty("AppConsistentFrequencyInMinute",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2PolicyDetailsInternal)this).AppConsistentFrequencyInMinute, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("MultiVMSyncStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2PolicyDetailsInternal)this).MultiVMSyncStatus = (string) content.GetValueForProperty("MultiVMSyncStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2PolicyDetailsInternal)this).MultiVMSyncStatus, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InMageAzureV2PolicyDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CrashConsistentFrequencyInMinute")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2PolicyDetailsInternal)this).CrashConsistentFrequencyInMinute = (int?) content.GetValueForProperty("CrashConsistentFrequencyInMinute",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2PolicyDetailsInternal)this).CrashConsistentFrequencyInMinute, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("RecoveryPointThresholdInMinute")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2PolicyDetailsInternal)this).RecoveryPointThresholdInMinute = (int?) content.GetValueForProperty("RecoveryPointThresholdInMinute",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2PolicyDetailsInternal)this).RecoveryPointThresholdInMinute, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("RecoveryPointHistory")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2PolicyDetailsInternal)this).RecoveryPointHistory = (int?) content.GetValueForProperty("RecoveryPointHistory",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2PolicyDetailsInternal)this).RecoveryPointHistory, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("AppConsistentFrequencyInMinute")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2PolicyDetailsInternal)this).AppConsistentFrequencyInMinute = (int?) content.GetValueForProperty("AppConsistentFrequencyInMinute",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2PolicyDetailsInternal)this).AppConsistentFrequencyInMinute, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("MultiVMSyncStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2PolicyDetailsInternal)this).MultiVMSyncStatus = (string) content.GetValueForProperty("MultiVMSyncStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2PolicyDetailsInternal)this).MultiVMSyncStatus, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// InMage Azure v2 specific protection profile details. + [System.ComponentModel.TypeConverter(typeof(InMageAzureV2PolicyDetailsTypeConverter))] + public partial interface IInMageAzureV2PolicyDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2PolicyDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2PolicyDetails.TypeConverter.cs new file mode 100644 index 000000000000..bdafdde8cf67 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2PolicyDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InMageAzureV2PolicyDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2PolicyDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2PolicyDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InMageAzureV2PolicyDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InMageAzureV2PolicyDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InMageAzureV2PolicyDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2PolicyDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2PolicyDetails.cs new file mode 100644 index 000000000000..60fcdafa6939 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2PolicyDetails.cs @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMage Azure v2 specific protection profile details. + public partial class InMageAzureV2PolicyDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2PolicyDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2PolicyDetailsInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetails __policyProviderSpecificDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PolicyProviderSpecificDetails(); + + /// Backing field for property. + private int? _appConsistentFrequencyInMinute; + + /// The app consistent snapshot frequency in minutes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? AppConsistentFrequencyInMinute { get => this._appConsistentFrequencyInMinute; set => this._appConsistentFrequencyInMinute = value; } + + /// Backing field for property. + private int? _crashConsistentFrequencyInMinute; + + /// The crash consistent snapshot frequency in minutes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? CrashConsistentFrequencyInMinute { get => this._crashConsistentFrequencyInMinute; set => this._crashConsistentFrequencyInMinute = value; } + + /// Gets the class type. Overridden in derived classes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetailsInternal)__policyProviderSpecificDetails).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetailsInternal)__policyProviderSpecificDetails).InstanceType = value ; } + + /// Backing field for property. + private string _multiVMSyncStatus; + + /// A value indicating whether multi-VM sync has to be enabled. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string MultiVMSyncStatus { get => this._multiVMSyncStatus; set => this._multiVMSyncStatus = value; } + + /// Backing field for property. + private int? _recoveryPointHistory; + + /// The duration in minutes until which the recovery points need to be stored. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? RecoveryPointHistory { get => this._recoveryPointHistory; set => this._recoveryPointHistory = value; } + + /// Backing field for property. + private int? _recoveryPointThresholdInMinute; + + /// The recovery point threshold in minutes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? RecoveryPointThresholdInMinute { get => this._recoveryPointThresholdInMinute; set => this._recoveryPointThresholdInMinute = value; } + + /// Creates an new instance. + public InMageAzureV2PolicyDetails() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__policyProviderSpecificDetails), __policyProviderSpecificDetails); + await eventListener.AssertObjectIsValid(nameof(__policyProviderSpecificDetails), __policyProviderSpecificDetails); + } + } + /// InMage Azure v2 specific protection profile details. + public partial interface IInMageAzureV2PolicyDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetails + { + /// The app consistent snapshot frequency in minutes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The app consistent snapshot frequency in minutes.", + SerializedName = @"appConsistentFrequencyInMinutes", + PossibleTypes = new [] { typeof(int) })] + int? AppConsistentFrequencyInMinute { get; set; } + /// The crash consistent snapshot frequency in minutes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The crash consistent snapshot frequency in minutes.", + SerializedName = @"crashConsistentFrequencyInMinutes", + PossibleTypes = new [] { typeof(int) })] + int? CrashConsistentFrequencyInMinute { get; set; } + /// A value indicating whether multi-VM sync has to be enabled. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether multi-VM sync has to be enabled.", + SerializedName = @"multiVmSyncStatus", + PossibleTypes = new [] { typeof(string) })] + string MultiVMSyncStatus { get; set; } + /// The duration in minutes until which the recovery points need to be stored. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The duration in minutes until which the recovery points need to be stored.", + SerializedName = @"recoveryPointHistory", + PossibleTypes = new [] { typeof(int) })] + int? RecoveryPointHistory { get; set; } + /// The recovery point threshold in minutes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery point threshold in minutes.", + SerializedName = @"recoveryPointThresholdInMinutes", + PossibleTypes = new [] { typeof(int) })] + int? RecoveryPointThresholdInMinute { get; set; } + + } + /// InMage Azure v2 specific protection profile details. + internal partial interface IInMageAzureV2PolicyDetailsInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetailsInternal + { + /// The app consistent snapshot frequency in minutes. + int? AppConsistentFrequencyInMinute { get; set; } + /// The crash consistent snapshot frequency in minutes. + int? CrashConsistentFrequencyInMinute { get; set; } + /// A value indicating whether multi-VM sync has to be enabled. + string MultiVMSyncStatus { get; set; } + /// The duration in minutes until which the recovery points need to be stored. + int? RecoveryPointHistory { get; set; } + /// The recovery point threshold in minutes. + int? RecoveryPointThresholdInMinute { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2PolicyDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2PolicyDetails.json.cs new file mode 100644 index 000000000000..5ed9cf899eb4 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2PolicyDetails.json.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMage Azure v2 specific protection profile details. + public partial class InMageAzureV2PolicyDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2PolicyDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2PolicyDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2PolicyDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new InMageAzureV2PolicyDetails(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal InMageAzureV2PolicyDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __policyProviderSpecificDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PolicyProviderSpecificDetails(json); + {_crashConsistentFrequencyInMinute = If( json?.PropertyT("crashConsistentFrequencyInMinutes"), out var __jsonCrashConsistentFrequencyInMinutes) ? (int?)__jsonCrashConsistentFrequencyInMinutes : CrashConsistentFrequencyInMinute;} + {_recoveryPointThresholdInMinute = If( json?.PropertyT("recoveryPointThresholdInMinutes"), out var __jsonRecoveryPointThresholdInMinutes) ? (int?)__jsonRecoveryPointThresholdInMinutes : RecoveryPointThresholdInMinute;} + {_recoveryPointHistory = If( json?.PropertyT("recoveryPointHistory"), out var __jsonRecoveryPointHistory) ? (int?)__jsonRecoveryPointHistory : RecoveryPointHistory;} + {_appConsistentFrequencyInMinute = If( json?.PropertyT("appConsistentFrequencyInMinutes"), out var __jsonAppConsistentFrequencyInMinutes) ? (int?)__jsonAppConsistentFrequencyInMinutes : AppConsistentFrequencyInMinute;} + {_multiVMSyncStatus = If( json?.PropertyT("multiVmSyncStatus"), out var __jsonMultiVMSyncStatus) ? (string)__jsonMultiVMSyncStatus : (string)MultiVMSyncStatus;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __policyProviderSpecificDetails?.ToJson(container, serializationMode); + AddIf( null != this._crashConsistentFrequencyInMinute ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._crashConsistentFrequencyInMinute) : null, "crashConsistentFrequencyInMinutes" ,container.Add ); + AddIf( null != this._recoveryPointThresholdInMinute ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._recoveryPointThresholdInMinute) : null, "recoveryPointThresholdInMinutes" ,container.Add ); + AddIf( null != this._recoveryPointHistory ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._recoveryPointHistory) : null, "recoveryPointHistory" ,container.Add ); + AddIf( null != this._appConsistentFrequencyInMinute ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._appConsistentFrequencyInMinute) : null, "appConsistentFrequencyInMinutes" ,container.Add ); + AddIf( null != (((object)this._multiVMSyncStatus)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._multiVMSyncStatus.ToString()) : null, "multiVmSyncStatus" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2PolicyInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2PolicyInput.PowerShell.cs new file mode 100644 index 000000000000..f40a07a73fa0 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2PolicyInput.PowerShell.cs @@ -0,0 +1,186 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// VMWare Azure specific policy Input. + [System.ComponentModel.TypeConverter(typeof(InMageAzureV2PolicyInputTypeConverter))] + public partial class InMageAzureV2PolicyInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2PolicyInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InMageAzureV2PolicyInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2PolicyInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InMageAzureV2PolicyInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2PolicyInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InMageAzureV2PolicyInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("RecoveryPointThresholdInMinute")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2PolicyInputInternal)this).RecoveryPointThresholdInMinute = (int?) content.GetValueForProperty("RecoveryPointThresholdInMinute",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2PolicyInputInternal)this).RecoveryPointThresholdInMinute, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("RecoveryPointHistory")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2PolicyInputInternal)this).RecoveryPointHistory = (int?) content.GetValueForProperty("RecoveryPointHistory",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2PolicyInputInternal)this).RecoveryPointHistory, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("CrashConsistentFrequencyInMinute")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2PolicyInputInternal)this).CrashConsistentFrequencyInMinute = (int?) content.GetValueForProperty("CrashConsistentFrequencyInMinute",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2PolicyInputInternal)this).CrashConsistentFrequencyInMinute, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("AppConsistentFrequencyInMinute")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2PolicyInputInternal)this).AppConsistentFrequencyInMinute = (int?) content.GetValueForProperty("AppConsistentFrequencyInMinute",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2PolicyInputInternal)this).AppConsistentFrequencyInMinute, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("MultiVMSyncStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2PolicyInputInternal)this).MultiVMSyncStatus = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SetMultiVMSyncStatus) content.GetValueForProperty("MultiVMSyncStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2PolicyInputInternal)this).MultiVMSyncStatus, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SetMultiVMSyncStatus.CreateFrom); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InMageAzureV2PolicyInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("RecoveryPointThresholdInMinute")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2PolicyInputInternal)this).RecoveryPointThresholdInMinute = (int?) content.GetValueForProperty("RecoveryPointThresholdInMinute",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2PolicyInputInternal)this).RecoveryPointThresholdInMinute, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("RecoveryPointHistory")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2PolicyInputInternal)this).RecoveryPointHistory = (int?) content.GetValueForProperty("RecoveryPointHistory",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2PolicyInputInternal)this).RecoveryPointHistory, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("CrashConsistentFrequencyInMinute")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2PolicyInputInternal)this).CrashConsistentFrequencyInMinute = (int?) content.GetValueForProperty("CrashConsistentFrequencyInMinute",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2PolicyInputInternal)this).CrashConsistentFrequencyInMinute, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("AppConsistentFrequencyInMinute")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2PolicyInputInternal)this).AppConsistentFrequencyInMinute = (int?) content.GetValueForProperty("AppConsistentFrequencyInMinute",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2PolicyInputInternal)this).AppConsistentFrequencyInMinute, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("MultiVMSyncStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2PolicyInputInternal)this).MultiVMSyncStatus = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SetMultiVMSyncStatus) content.GetValueForProperty("MultiVMSyncStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2PolicyInputInternal)this).MultiVMSyncStatus, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SetMultiVMSyncStatus.CreateFrom); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// VMWare Azure specific policy Input. + [System.ComponentModel.TypeConverter(typeof(InMageAzureV2PolicyInputTypeConverter))] + public partial interface IInMageAzureV2PolicyInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2PolicyInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2PolicyInput.TypeConverter.cs new file mode 100644 index 000000000000..2dbbf7bc1b07 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2PolicyInput.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InMageAzureV2PolicyInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2PolicyInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2PolicyInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InMageAzureV2PolicyInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InMageAzureV2PolicyInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InMageAzureV2PolicyInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2PolicyInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2PolicyInput.cs new file mode 100644 index 000000000000..285c6696a661 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2PolicyInput.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// VMWare Azure specific policy Input. + public partial class InMageAzureV2PolicyInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2PolicyInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2PolicyInputInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInput __policyProviderSpecificInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PolicyProviderSpecificInput(); + + /// Backing field for property. + private int? _appConsistentFrequencyInMinute; + + /// The app consistent snapshot frequency (in minutes). + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? AppConsistentFrequencyInMinute { get => this._appConsistentFrequencyInMinute; set => this._appConsistentFrequencyInMinute = value; } + + /// Backing field for property. + private int? _crashConsistentFrequencyInMinute; + + /// The crash consistent snapshot frequency (in minutes). + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? CrashConsistentFrequencyInMinute { get => this._crashConsistentFrequencyInMinute; set => this._crashConsistentFrequencyInMinute = value; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInputInternal)__policyProviderSpecificInput).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInputInternal)__policyProviderSpecificInput).InstanceType = value ; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SetMultiVMSyncStatus _multiVMSyncStatus; + + /// + /// A value indicating whether multi-VM sync has to be enabled. Value should be 'Enabled' or 'Disabled'. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SetMultiVMSyncStatus MultiVMSyncStatus { get => this._multiVMSyncStatus; set => this._multiVMSyncStatus = value; } + + /// Backing field for property. + private int? _recoveryPointHistory; + + /// The duration in minutes until which the recovery points need to be stored. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? RecoveryPointHistory { get => this._recoveryPointHistory; set => this._recoveryPointHistory = value; } + + /// Backing field for property. + private int? _recoveryPointThresholdInMinute; + + /// The recovery point threshold in minutes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? RecoveryPointThresholdInMinute { get => this._recoveryPointThresholdInMinute; set => this._recoveryPointThresholdInMinute = value; } + + /// Creates an new instance. + public InMageAzureV2PolicyInput() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__policyProviderSpecificInput), __policyProviderSpecificInput); + await eventListener.AssertObjectIsValid(nameof(__policyProviderSpecificInput), __policyProviderSpecificInput); + } + } + /// VMWare Azure specific policy Input. + public partial interface IInMageAzureV2PolicyInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInput + { + /// The app consistent snapshot frequency (in minutes). + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The app consistent snapshot frequency (in minutes).", + SerializedName = @"appConsistentFrequencyInMinutes", + PossibleTypes = new [] { typeof(int) })] + int? AppConsistentFrequencyInMinute { get; set; } + /// The crash consistent snapshot frequency (in minutes). + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The crash consistent snapshot frequency (in minutes).", + SerializedName = @"crashConsistentFrequencyInMinutes", + PossibleTypes = new [] { typeof(int) })] + int? CrashConsistentFrequencyInMinute { get; set; } + /// + /// A value indicating whether multi-VM sync has to be enabled. Value should be 'Enabled' or 'Disabled'. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"A value indicating whether multi-VM sync has to be enabled. Value should be 'Enabled' or 'Disabled'.", + SerializedName = @"multiVmSyncStatus", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SetMultiVMSyncStatus) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SetMultiVMSyncStatus MultiVMSyncStatus { get; set; } + /// The duration in minutes until which the recovery points need to be stored. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The duration in minutes until which the recovery points need to be stored.", + SerializedName = @"recoveryPointHistory", + PossibleTypes = new [] { typeof(int) })] + int? RecoveryPointHistory { get; set; } + /// The recovery point threshold in minutes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery point threshold in minutes.", + SerializedName = @"recoveryPointThresholdInMinutes", + PossibleTypes = new [] { typeof(int) })] + int? RecoveryPointThresholdInMinute { get; set; } + + } + /// VMWare Azure specific policy Input. + internal partial interface IInMageAzureV2PolicyInputInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInputInternal + { + /// The app consistent snapshot frequency (in minutes). + int? AppConsistentFrequencyInMinute { get; set; } + /// The crash consistent snapshot frequency (in minutes). + int? CrashConsistentFrequencyInMinute { get; set; } + /// + /// A value indicating whether multi-VM sync has to be enabled. Value should be 'Enabled' or 'Disabled'. + /// + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SetMultiVMSyncStatus MultiVMSyncStatus { get; set; } + /// The duration in minutes until which the recovery points need to be stored. + int? RecoveryPointHistory { get; set; } + /// The recovery point threshold in minutes. + int? RecoveryPointThresholdInMinute { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2PolicyInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2PolicyInput.json.cs new file mode 100644 index 000000000000..0ec8eeb6b9e5 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2PolicyInput.json.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// VMWare Azure specific policy Input. + public partial class InMageAzureV2PolicyInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2PolicyInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2PolicyInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2PolicyInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new InMageAzureV2PolicyInput(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal InMageAzureV2PolicyInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __policyProviderSpecificInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PolicyProviderSpecificInput(json); + {_recoveryPointThresholdInMinute = If( json?.PropertyT("recoveryPointThresholdInMinutes"), out var __jsonRecoveryPointThresholdInMinutes) ? (int?)__jsonRecoveryPointThresholdInMinutes : RecoveryPointThresholdInMinute;} + {_recoveryPointHistory = If( json?.PropertyT("recoveryPointHistory"), out var __jsonRecoveryPointHistory) ? (int?)__jsonRecoveryPointHistory : RecoveryPointHistory;} + {_crashConsistentFrequencyInMinute = If( json?.PropertyT("crashConsistentFrequencyInMinutes"), out var __jsonCrashConsistentFrequencyInMinutes) ? (int?)__jsonCrashConsistentFrequencyInMinutes : CrashConsistentFrequencyInMinute;} + {_appConsistentFrequencyInMinute = If( json?.PropertyT("appConsistentFrequencyInMinutes"), out var __jsonAppConsistentFrequencyInMinutes) ? (int?)__jsonAppConsistentFrequencyInMinutes : AppConsistentFrequencyInMinute;} + {_multiVMSyncStatus = If( json?.PropertyT("multiVmSyncStatus"), out var __jsonMultiVMSyncStatus) ? (string)__jsonMultiVMSyncStatus : (string)MultiVMSyncStatus;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __policyProviderSpecificInput?.ToJson(container, serializationMode); + AddIf( null != this._recoveryPointThresholdInMinute ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._recoveryPointThresholdInMinute) : null, "recoveryPointThresholdInMinutes" ,container.Add ); + AddIf( null != this._recoveryPointHistory ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._recoveryPointHistory) : null, "recoveryPointHistory" ,container.Add ); + AddIf( null != this._crashConsistentFrequencyInMinute ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._crashConsistentFrequencyInMinute) : null, "crashConsistentFrequencyInMinutes" ,container.Add ); + AddIf( null != this._appConsistentFrequencyInMinute ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._appConsistentFrequencyInMinute) : null, "appConsistentFrequencyInMinutes" ,container.Add ); + AddIf( null != (((object)this._multiVMSyncStatus)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._multiVMSyncStatus.ToString()) : null, "multiVmSyncStatus" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ProtectedDiskDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ProtectedDiskDetails.PowerShell.cs new file mode 100644 index 000000000000..e84c216b2c15 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ProtectedDiskDetails.PowerShell.cs @@ -0,0 +1,324 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// InMageAzureV2 protected disk details. + [System.ComponentModel.TypeConverter(typeof(InMageAzureV2ProtectedDiskDetailsTypeConverter))] + public partial class InMageAzureV2ProtectedDiskDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InMageAzureV2ProtectedDiskDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InMageAzureV2ProtectedDiskDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InMageAzureV2ProtectedDiskDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DiskId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetailsInternal)this).DiskId = (string) content.GetValueForProperty("DiskId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetailsInternal)this).DiskId, global::System.Convert.ToString); + } + if (content.Contains("DiskName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetailsInternal)this).DiskName = (string) content.GetValueForProperty("DiskName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetailsInternal)this).DiskName, global::System.Convert.ToString); + } + if (content.Contains("ProtectionStage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetailsInternal)this).ProtectionStage = (string) content.GetValueForProperty("ProtectionStage",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetailsInternal)this).ProtectionStage, global::System.Convert.ToString); + } + if (content.Contains("HealthErrorCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetailsInternal)this).HealthErrorCode = (string) content.GetValueForProperty("HealthErrorCode",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetailsInternal)this).HealthErrorCode, global::System.Convert.ToString); + } + if (content.Contains("RpoInSecond")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetailsInternal)this).RpoInSecond = (long?) content.GetValueForProperty("RpoInSecond",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetailsInternal)this).RpoInSecond, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("ResyncRequired")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetailsInternal)this).ResyncRequired = (string) content.GetValueForProperty("ResyncRequired",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetailsInternal)this).ResyncRequired, global::System.Convert.ToString); + } + if (content.Contains("ResyncProgressPercentage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetailsInternal)this).ResyncProgressPercentage = (int?) content.GetValueForProperty("ResyncProgressPercentage",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetailsInternal)this).ResyncProgressPercentage, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("ResyncDurationInSecond")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetailsInternal)this).ResyncDurationInSecond = (long?) content.GetValueForProperty("ResyncDurationInSecond",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetailsInternal)this).ResyncDurationInSecond, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("DiskCapacityInByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetailsInternal)this).DiskCapacityInByte = (long?) content.GetValueForProperty("DiskCapacityInByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetailsInternal)this).DiskCapacityInByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("FileSystemCapacityInByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetailsInternal)this).FileSystemCapacityInByte = (long?) content.GetValueForProperty("FileSystemCapacityInByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetailsInternal)this).FileSystemCapacityInByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("SourceDataInMegaByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetailsInternal)this).SourceDataInMegaByte = (double?) content.GetValueForProperty("SourceDataInMegaByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetailsInternal)this).SourceDataInMegaByte, (__y)=> (double) global::System.Convert.ChangeType(__y, typeof(double))); + } + if (content.Contains("PsDataInMegaByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetailsInternal)this).PsDataInMegaByte = (double?) content.GetValueForProperty("PsDataInMegaByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetailsInternal)this).PsDataInMegaByte, (__y)=> (double) global::System.Convert.ChangeType(__y, typeof(double))); + } + if (content.Contains("TargetDataInMegaByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetailsInternal)this).TargetDataInMegaByte = (double?) content.GetValueForProperty("TargetDataInMegaByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetailsInternal)this).TargetDataInMegaByte, (__y)=> (double) global::System.Convert.ChangeType(__y, typeof(double))); + } + if (content.Contains("DiskResized")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetailsInternal)this).DiskResized = (string) content.GetValueForProperty("DiskResized",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetailsInternal)this).DiskResized, global::System.Convert.ToString); + } + if (content.Contains("LastRpoCalculatedTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetailsInternal)this).LastRpoCalculatedTime = (global::System.DateTime?) content.GetValueForProperty("LastRpoCalculatedTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetailsInternal)this).LastRpoCalculatedTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ResyncProcessedByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetailsInternal)this).ResyncProcessedByte = (long?) content.GetValueForProperty("ResyncProcessedByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetailsInternal)this).ResyncProcessedByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("ResyncTotalTransferredByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetailsInternal)this).ResyncTotalTransferredByte = (long?) content.GetValueForProperty("ResyncTotalTransferredByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetailsInternal)this).ResyncTotalTransferredByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("ResyncLast15MinutesTransferredByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetailsInternal)this).ResyncLast15MinutesTransferredByte = (long?) content.GetValueForProperty("ResyncLast15MinutesTransferredByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetailsInternal)this).ResyncLast15MinutesTransferredByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("ResyncLastDataTransferTimeUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetailsInternal)this).ResyncLastDataTransferTimeUtc = (global::System.DateTime?) content.GetValueForProperty("ResyncLastDataTransferTimeUtc",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetailsInternal)this).ResyncLastDataTransferTimeUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ResyncStartTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetailsInternal)this).ResyncStartTime = (global::System.DateTime?) content.GetValueForProperty("ResyncStartTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetailsInternal)this).ResyncStartTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ProgressHealth")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetailsInternal)this).ProgressHealth = (string) content.GetValueForProperty("ProgressHealth",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetailsInternal)this).ProgressHealth, global::System.Convert.ToString); + } + if (content.Contains("ProgressStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetailsInternal)this).ProgressStatus = (string) content.GetValueForProperty("ProgressStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetailsInternal)this).ProgressStatus, global::System.Convert.ToString); + } + if (content.Contains("SecondsToTakeSwitchProvider")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetailsInternal)this).SecondsToTakeSwitchProvider = (long?) content.GetValueForProperty("SecondsToTakeSwitchProvider",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetailsInternal)this).SecondsToTakeSwitchProvider, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InMageAzureV2ProtectedDiskDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DiskId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetailsInternal)this).DiskId = (string) content.GetValueForProperty("DiskId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetailsInternal)this).DiskId, global::System.Convert.ToString); + } + if (content.Contains("DiskName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetailsInternal)this).DiskName = (string) content.GetValueForProperty("DiskName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetailsInternal)this).DiskName, global::System.Convert.ToString); + } + if (content.Contains("ProtectionStage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetailsInternal)this).ProtectionStage = (string) content.GetValueForProperty("ProtectionStage",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetailsInternal)this).ProtectionStage, global::System.Convert.ToString); + } + if (content.Contains("HealthErrorCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetailsInternal)this).HealthErrorCode = (string) content.GetValueForProperty("HealthErrorCode",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetailsInternal)this).HealthErrorCode, global::System.Convert.ToString); + } + if (content.Contains("RpoInSecond")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetailsInternal)this).RpoInSecond = (long?) content.GetValueForProperty("RpoInSecond",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetailsInternal)this).RpoInSecond, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("ResyncRequired")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetailsInternal)this).ResyncRequired = (string) content.GetValueForProperty("ResyncRequired",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetailsInternal)this).ResyncRequired, global::System.Convert.ToString); + } + if (content.Contains("ResyncProgressPercentage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetailsInternal)this).ResyncProgressPercentage = (int?) content.GetValueForProperty("ResyncProgressPercentage",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetailsInternal)this).ResyncProgressPercentage, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("ResyncDurationInSecond")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetailsInternal)this).ResyncDurationInSecond = (long?) content.GetValueForProperty("ResyncDurationInSecond",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetailsInternal)this).ResyncDurationInSecond, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("DiskCapacityInByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetailsInternal)this).DiskCapacityInByte = (long?) content.GetValueForProperty("DiskCapacityInByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetailsInternal)this).DiskCapacityInByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("FileSystemCapacityInByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetailsInternal)this).FileSystemCapacityInByte = (long?) content.GetValueForProperty("FileSystemCapacityInByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetailsInternal)this).FileSystemCapacityInByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("SourceDataInMegaByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetailsInternal)this).SourceDataInMegaByte = (double?) content.GetValueForProperty("SourceDataInMegaByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetailsInternal)this).SourceDataInMegaByte, (__y)=> (double) global::System.Convert.ChangeType(__y, typeof(double))); + } + if (content.Contains("PsDataInMegaByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetailsInternal)this).PsDataInMegaByte = (double?) content.GetValueForProperty("PsDataInMegaByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetailsInternal)this).PsDataInMegaByte, (__y)=> (double) global::System.Convert.ChangeType(__y, typeof(double))); + } + if (content.Contains("TargetDataInMegaByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetailsInternal)this).TargetDataInMegaByte = (double?) content.GetValueForProperty("TargetDataInMegaByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetailsInternal)this).TargetDataInMegaByte, (__y)=> (double) global::System.Convert.ChangeType(__y, typeof(double))); + } + if (content.Contains("DiskResized")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetailsInternal)this).DiskResized = (string) content.GetValueForProperty("DiskResized",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetailsInternal)this).DiskResized, global::System.Convert.ToString); + } + if (content.Contains("LastRpoCalculatedTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetailsInternal)this).LastRpoCalculatedTime = (global::System.DateTime?) content.GetValueForProperty("LastRpoCalculatedTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetailsInternal)this).LastRpoCalculatedTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ResyncProcessedByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetailsInternal)this).ResyncProcessedByte = (long?) content.GetValueForProperty("ResyncProcessedByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetailsInternal)this).ResyncProcessedByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("ResyncTotalTransferredByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetailsInternal)this).ResyncTotalTransferredByte = (long?) content.GetValueForProperty("ResyncTotalTransferredByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetailsInternal)this).ResyncTotalTransferredByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("ResyncLast15MinutesTransferredByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetailsInternal)this).ResyncLast15MinutesTransferredByte = (long?) content.GetValueForProperty("ResyncLast15MinutesTransferredByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetailsInternal)this).ResyncLast15MinutesTransferredByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("ResyncLastDataTransferTimeUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetailsInternal)this).ResyncLastDataTransferTimeUtc = (global::System.DateTime?) content.GetValueForProperty("ResyncLastDataTransferTimeUtc",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetailsInternal)this).ResyncLastDataTransferTimeUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ResyncStartTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetailsInternal)this).ResyncStartTime = (global::System.DateTime?) content.GetValueForProperty("ResyncStartTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetailsInternal)this).ResyncStartTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ProgressHealth")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetailsInternal)this).ProgressHealth = (string) content.GetValueForProperty("ProgressHealth",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetailsInternal)this).ProgressHealth, global::System.Convert.ToString); + } + if (content.Contains("ProgressStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetailsInternal)this).ProgressStatus = (string) content.GetValueForProperty("ProgressStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetailsInternal)this).ProgressStatus, global::System.Convert.ToString); + } + if (content.Contains("SecondsToTakeSwitchProvider")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetailsInternal)this).SecondsToTakeSwitchProvider = (long?) content.GetValueForProperty("SecondsToTakeSwitchProvider",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetailsInternal)this).SecondsToTakeSwitchProvider, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// InMageAzureV2 protected disk details. + [System.ComponentModel.TypeConverter(typeof(InMageAzureV2ProtectedDiskDetailsTypeConverter))] + public partial interface IInMageAzureV2ProtectedDiskDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ProtectedDiskDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ProtectedDiskDetails.TypeConverter.cs new file mode 100644 index 000000000000..e33d219cbb2e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ProtectedDiskDetails.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InMageAzureV2ProtectedDiskDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InMageAzureV2ProtectedDiskDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InMageAzureV2ProtectedDiskDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InMageAzureV2ProtectedDiskDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ProtectedDiskDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ProtectedDiskDetails.cs new file mode 100644 index 000000000000..7b117d1a3831 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ProtectedDiskDetails.cs @@ -0,0 +1,425 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMageAzureV2 protected disk details. + public partial class InMageAzureV2ProtectedDiskDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetailsInternal + { + + /// Backing field for property. + private long? _diskCapacityInByte; + + /// The disk capacity in bytes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public long? DiskCapacityInByte { get => this._diskCapacityInByte; set => this._diskCapacityInByte = value; } + + /// Backing field for property. + private string _diskId; + + /// The disk id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string DiskId { get => this._diskId; set => this._diskId = value; } + + /// Backing field for property. + private string _diskName; + + /// The disk name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string DiskName { get => this._diskName; set => this._diskName = value; } + + /// Backing field for property. + private string _diskResized; + + /// A value indicating whether disk is resized. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string DiskResized { get => this._diskResized; set => this._diskResized = value; } + + /// Backing field for property. + private long? _fileSystemCapacityInByte; + + /// The disk file system capacity in bytes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public long? FileSystemCapacityInByte { get => this._fileSystemCapacityInByte; set => this._fileSystemCapacityInByte = value; } + + /// Backing field for property. + private string _healthErrorCode; + + /// The health error code for the disk. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string HealthErrorCode { get => this._healthErrorCode; set => this._healthErrorCode = value; } + + /// Backing field for property. + private global::System.DateTime? _lastRpoCalculatedTime; + + /// The last RPO calculated time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public global::System.DateTime? LastRpoCalculatedTime { get => this._lastRpoCalculatedTime; set => this._lastRpoCalculatedTime = value; } + + /// Backing field for property. + private string _progressHealth; + + /// The Progress Health. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ProgressHealth { get => this._progressHealth; set => this._progressHealth = value; } + + /// Backing field for property. + private string _progressStatus; + + /// The Progress Status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ProgressStatus { get => this._progressStatus; set => this._progressStatus = value; } + + /// Backing field for property. + private string _protectionStage; + + /// The protection stage. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ProtectionStage { get => this._protectionStage; set => this._protectionStage = value; } + + /// Backing field for property. + private double? _psDataInMegaByte; + + /// The PS data transit in MB. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public double? PsDataInMegaByte { get => this._psDataInMegaByte; set => this._psDataInMegaByte = value; } + + /// Backing field for property. + private long? _resyncDurationInSecond; + + /// The resync duration in seconds. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public long? ResyncDurationInSecond { get => this._resyncDurationInSecond; set => this._resyncDurationInSecond = value; } + + /// Backing field for property. + private long? _resyncLast15MinutesTransferredByte; + + /// The resync last 15 minutes transferred bytes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public long? ResyncLast15MinutesTransferredByte { get => this._resyncLast15MinutesTransferredByte; set => this._resyncLast15MinutesTransferredByte = value; } + + /// Backing field for property. + private global::System.DateTime? _resyncLastDataTransferTimeUtc; + + /// The last data transfer time in UTC. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public global::System.DateTime? ResyncLastDataTransferTimeUtc { get => this._resyncLastDataTransferTimeUtc; set => this._resyncLastDataTransferTimeUtc = value; } + + /// Backing field for property. + private long? _resyncProcessedByte; + + /// The resync processed bytes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public long? ResyncProcessedByte { get => this._resyncProcessedByte; set => this._resyncProcessedByte = value; } + + /// Backing field for property. + private int? _resyncProgressPercentage; + + /// The resync progress percentage. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? ResyncProgressPercentage { get => this._resyncProgressPercentage; set => this._resyncProgressPercentage = value; } + + /// Backing field for property. + private string _resyncRequired; + + /// A value indicating whether resync is required for this disk. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ResyncRequired { get => this._resyncRequired; set => this._resyncRequired = value; } + + /// Backing field for property. + private global::System.DateTime? _resyncStartTime; + + /// The resync start time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public global::System.DateTime? ResyncStartTime { get => this._resyncStartTime; set => this._resyncStartTime = value; } + + /// Backing field for property. + private long? _resyncTotalTransferredByte; + + /// The resync total transferred bytes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public long? ResyncTotalTransferredByte { get => this._resyncTotalTransferredByte; set => this._resyncTotalTransferredByte = value; } + + /// Backing field for property. + private long? _rpoInSecond; + + /// The RPO in seconds. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public long? RpoInSecond { get => this._rpoInSecond; set => this._rpoInSecond = value; } + + /// Backing field for property. + private long? _secondsToTakeSwitchProvider; + + /// The seconds to take for switch provider. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public long? SecondsToTakeSwitchProvider { get => this._secondsToTakeSwitchProvider; set => this._secondsToTakeSwitchProvider = value; } + + /// Backing field for property. + private double? _sourceDataInMegaByte; + + /// The source data transit in MB. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public double? SourceDataInMegaByte { get => this._sourceDataInMegaByte; set => this._sourceDataInMegaByte = value; } + + /// Backing field for property. + private double? _targetDataInMegaByte; + + /// The target data transit in MB. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public double? TargetDataInMegaByte { get => this._targetDataInMegaByte; set => this._targetDataInMegaByte = value; } + + /// Creates an new instance. + public InMageAzureV2ProtectedDiskDetails() + { + + } + } + /// InMageAzureV2 protected disk details. + public partial interface IInMageAzureV2ProtectedDiskDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The disk capacity in bytes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The disk capacity in bytes.", + SerializedName = @"diskCapacityInBytes", + PossibleTypes = new [] { typeof(long) })] + long? DiskCapacityInByte { get; set; } + /// The disk id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The disk id.", + SerializedName = @"diskId", + PossibleTypes = new [] { typeof(string) })] + string DiskId { get; set; } + /// The disk name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The disk name.", + SerializedName = @"diskName", + PossibleTypes = new [] { typeof(string) })] + string DiskName { get; set; } + /// A value indicating whether disk is resized. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether disk is resized.", + SerializedName = @"diskResized", + PossibleTypes = new [] { typeof(string) })] + string DiskResized { get; set; } + /// The disk file system capacity in bytes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The disk file system capacity in bytes.", + SerializedName = @"fileSystemCapacityInBytes", + PossibleTypes = new [] { typeof(long) })] + long? FileSystemCapacityInByte { get; set; } + /// The health error code for the disk. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The health error code for the disk.", + SerializedName = @"healthErrorCode", + PossibleTypes = new [] { typeof(string) })] + string HealthErrorCode { get; set; } + /// The last RPO calculated time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The last RPO calculated time.", + SerializedName = @"lastRpoCalculatedTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? LastRpoCalculatedTime { get; set; } + /// The Progress Health. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Progress Health.", + SerializedName = @"progressHealth", + PossibleTypes = new [] { typeof(string) })] + string ProgressHealth { get; set; } + /// The Progress Status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Progress Status.", + SerializedName = @"progressStatus", + PossibleTypes = new [] { typeof(string) })] + string ProgressStatus { get; set; } + /// The protection stage. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The protection stage.", + SerializedName = @"protectionStage", + PossibleTypes = new [] { typeof(string) })] + string ProtectionStage { get; set; } + /// The PS data transit in MB. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The PS data transit in MB.", + SerializedName = @"psDataInMegaBytes", + PossibleTypes = new [] { typeof(double) })] + double? PsDataInMegaByte { get; set; } + /// The resync duration in seconds. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The resync duration in seconds.", + SerializedName = @"resyncDurationInSeconds", + PossibleTypes = new [] { typeof(long) })] + long? ResyncDurationInSecond { get; set; } + /// The resync last 15 minutes transferred bytes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The resync last 15 minutes transferred bytes.", + SerializedName = @"resyncLast15MinutesTransferredBytes", + PossibleTypes = new [] { typeof(long) })] + long? ResyncLast15MinutesTransferredByte { get; set; } + /// The last data transfer time in UTC. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The last data transfer time in UTC.", + SerializedName = @"resyncLastDataTransferTimeUTC", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? ResyncLastDataTransferTimeUtc { get; set; } + /// The resync processed bytes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The resync processed bytes.", + SerializedName = @"resyncProcessedBytes", + PossibleTypes = new [] { typeof(long) })] + long? ResyncProcessedByte { get; set; } + /// The resync progress percentage. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The resync progress percentage.", + SerializedName = @"resyncProgressPercentage", + PossibleTypes = new [] { typeof(int) })] + int? ResyncProgressPercentage { get; set; } + /// A value indicating whether resync is required for this disk. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether resync is required for this disk.", + SerializedName = @"resyncRequired", + PossibleTypes = new [] { typeof(string) })] + string ResyncRequired { get; set; } + /// The resync start time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The resync start time.", + SerializedName = @"resyncStartTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? ResyncStartTime { get; set; } + /// The resync total transferred bytes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The resync total transferred bytes.", + SerializedName = @"resyncTotalTransferredBytes", + PossibleTypes = new [] { typeof(long) })] + long? ResyncTotalTransferredByte { get; set; } + /// The RPO in seconds. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The RPO in seconds.", + SerializedName = @"rpoInSeconds", + PossibleTypes = new [] { typeof(long) })] + long? RpoInSecond { get; set; } + /// The seconds to take for switch provider. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The seconds to take for switch provider.", + SerializedName = @"secondsToTakeSwitchProvider", + PossibleTypes = new [] { typeof(long) })] + long? SecondsToTakeSwitchProvider { get; set; } + /// The source data transit in MB. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The source data transit in MB.", + SerializedName = @"sourceDataInMegaBytes", + PossibleTypes = new [] { typeof(double) })] + double? SourceDataInMegaByte { get; set; } + /// The target data transit in MB. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target data transit in MB.", + SerializedName = @"targetDataInMegaBytes", + PossibleTypes = new [] { typeof(double) })] + double? TargetDataInMegaByte { get; set; } + + } + /// InMageAzureV2 protected disk details. + internal partial interface IInMageAzureV2ProtectedDiskDetailsInternal + + { + /// The disk capacity in bytes. + long? DiskCapacityInByte { get; set; } + /// The disk id. + string DiskId { get; set; } + /// The disk name. + string DiskName { get; set; } + /// A value indicating whether disk is resized. + string DiskResized { get; set; } + /// The disk file system capacity in bytes. + long? FileSystemCapacityInByte { get; set; } + /// The health error code for the disk. + string HealthErrorCode { get; set; } + /// The last RPO calculated time. + global::System.DateTime? LastRpoCalculatedTime { get; set; } + /// The Progress Health. + string ProgressHealth { get; set; } + /// The Progress Status. + string ProgressStatus { get; set; } + /// The protection stage. + string ProtectionStage { get; set; } + /// The PS data transit in MB. + double? PsDataInMegaByte { get; set; } + /// The resync duration in seconds. + long? ResyncDurationInSecond { get; set; } + /// The resync last 15 minutes transferred bytes. + long? ResyncLast15MinutesTransferredByte { get; set; } + /// The last data transfer time in UTC. + global::System.DateTime? ResyncLastDataTransferTimeUtc { get; set; } + /// The resync processed bytes. + long? ResyncProcessedByte { get; set; } + /// The resync progress percentage. + int? ResyncProgressPercentage { get; set; } + /// A value indicating whether resync is required for this disk. + string ResyncRequired { get; set; } + /// The resync start time. + global::System.DateTime? ResyncStartTime { get; set; } + /// The resync total transferred bytes. + long? ResyncTotalTransferredByte { get; set; } + /// The RPO in seconds. + long? RpoInSecond { get; set; } + /// The seconds to take for switch provider. + long? SecondsToTakeSwitchProvider { get; set; } + /// The source data transit in MB. + double? SourceDataInMegaByte { get; set; } + /// The target data transit in MB. + double? TargetDataInMegaByte { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ProtectedDiskDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ProtectedDiskDetails.json.cs new file mode 100644 index 000000000000..c464222590c0 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ProtectedDiskDetails.json.cs @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMageAzureV2 protected disk details. + public partial class InMageAzureV2ProtectedDiskDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new InMageAzureV2ProtectedDiskDetails(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal InMageAzureV2ProtectedDiskDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_diskId = If( json?.PropertyT("diskId"), out var __jsonDiskId) ? (string)__jsonDiskId : (string)DiskId;} + {_diskName = If( json?.PropertyT("diskName"), out var __jsonDiskName) ? (string)__jsonDiskName : (string)DiskName;} + {_protectionStage = If( json?.PropertyT("protectionStage"), out var __jsonProtectionStage) ? (string)__jsonProtectionStage : (string)ProtectionStage;} + {_healthErrorCode = If( json?.PropertyT("healthErrorCode"), out var __jsonHealthErrorCode) ? (string)__jsonHealthErrorCode : (string)HealthErrorCode;} + {_rpoInSecond = If( json?.PropertyT("rpoInSeconds"), out var __jsonRpoInSeconds) ? (long?)__jsonRpoInSeconds : RpoInSecond;} + {_resyncRequired = If( json?.PropertyT("resyncRequired"), out var __jsonResyncRequired) ? (string)__jsonResyncRequired : (string)ResyncRequired;} + {_resyncProgressPercentage = If( json?.PropertyT("resyncProgressPercentage"), out var __jsonResyncProgressPercentage) ? (int?)__jsonResyncProgressPercentage : ResyncProgressPercentage;} + {_resyncDurationInSecond = If( json?.PropertyT("resyncDurationInSeconds"), out var __jsonResyncDurationInSeconds) ? (long?)__jsonResyncDurationInSeconds : ResyncDurationInSecond;} + {_diskCapacityInByte = If( json?.PropertyT("diskCapacityInBytes"), out var __jsonDiskCapacityInBytes) ? (long?)__jsonDiskCapacityInBytes : DiskCapacityInByte;} + {_fileSystemCapacityInByte = If( json?.PropertyT("fileSystemCapacityInBytes"), out var __jsonFileSystemCapacityInBytes) ? (long?)__jsonFileSystemCapacityInBytes : FileSystemCapacityInByte;} + {_sourceDataInMegaByte = If( json?.PropertyT("sourceDataInMegaBytes"), out var __jsonSourceDataInMegaBytes) ? (double?)__jsonSourceDataInMegaBytes : SourceDataInMegaByte;} + {_psDataInMegaByte = If( json?.PropertyT("psDataInMegaBytes"), out var __jsonPsDataInMegaBytes) ? (double?)__jsonPsDataInMegaBytes : PsDataInMegaByte;} + {_targetDataInMegaByte = If( json?.PropertyT("targetDataInMegaBytes"), out var __jsonTargetDataInMegaBytes) ? (double?)__jsonTargetDataInMegaBytes : TargetDataInMegaByte;} + {_diskResized = If( json?.PropertyT("diskResized"), out var __jsonDiskResized) ? (string)__jsonDiskResized : (string)DiskResized;} + {_lastRpoCalculatedTime = If( json?.PropertyT("lastRpoCalculatedTime"), out var __jsonLastRpoCalculatedTime) ? global::System.DateTime.TryParse((string)__jsonLastRpoCalculatedTime, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonLastRpoCalculatedTimeValue) ? __jsonLastRpoCalculatedTimeValue : LastRpoCalculatedTime : LastRpoCalculatedTime;} + {_resyncProcessedByte = If( json?.PropertyT("resyncProcessedBytes"), out var __jsonResyncProcessedBytes) ? (long?)__jsonResyncProcessedBytes : ResyncProcessedByte;} + {_resyncTotalTransferredByte = If( json?.PropertyT("resyncTotalTransferredBytes"), out var __jsonResyncTotalTransferredBytes) ? (long?)__jsonResyncTotalTransferredBytes : ResyncTotalTransferredByte;} + {_resyncLast15MinutesTransferredByte = If( json?.PropertyT("resyncLast15MinutesTransferredBytes"), out var __jsonResyncLast15MinutesTransferredBytes) ? (long?)__jsonResyncLast15MinutesTransferredBytes : ResyncLast15MinutesTransferredByte;} + {_resyncLastDataTransferTimeUtc = If( json?.PropertyT("resyncLastDataTransferTimeUTC"), out var __jsonResyncLastDataTransferTimeUtc) ? global::System.DateTime.TryParse((string)__jsonResyncLastDataTransferTimeUtc, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonResyncLastDataTransferTimeUtcValue) ? __jsonResyncLastDataTransferTimeUtcValue : ResyncLastDataTransferTimeUtc : ResyncLastDataTransferTimeUtc;} + {_resyncStartTime = If( json?.PropertyT("resyncStartTime"), out var __jsonResyncStartTime) ? global::System.DateTime.TryParse((string)__jsonResyncStartTime, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonResyncStartTimeValue) ? __jsonResyncStartTimeValue : ResyncStartTime : ResyncStartTime;} + {_progressHealth = If( json?.PropertyT("progressHealth"), out var __jsonProgressHealth) ? (string)__jsonProgressHealth : (string)ProgressHealth;} + {_progressStatus = If( json?.PropertyT("progressStatus"), out var __jsonProgressStatus) ? (string)__jsonProgressStatus : (string)ProgressStatus;} + {_secondsToTakeSwitchProvider = If( json?.PropertyT("secondsToTakeSwitchProvider"), out var __jsonSecondsToTakeSwitchProvider) ? (long?)__jsonSecondsToTakeSwitchProvider : SecondsToTakeSwitchProvider;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._diskId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._diskId.ToString()) : null, "diskId" ,container.Add ); + AddIf( null != (((object)this._diskName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._diskName.ToString()) : null, "diskName" ,container.Add ); + AddIf( null != (((object)this._protectionStage)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._protectionStage.ToString()) : null, "protectionStage" ,container.Add ); + AddIf( null != (((object)this._healthErrorCode)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._healthErrorCode.ToString()) : null, "healthErrorCode" ,container.Add ); + AddIf( null != this._rpoInSecond ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((long)this._rpoInSecond) : null, "rpoInSeconds" ,container.Add ); + AddIf( null != (((object)this._resyncRequired)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._resyncRequired.ToString()) : null, "resyncRequired" ,container.Add ); + AddIf( null != this._resyncProgressPercentage ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._resyncProgressPercentage) : null, "resyncProgressPercentage" ,container.Add ); + AddIf( null != this._resyncDurationInSecond ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((long)this._resyncDurationInSecond) : null, "resyncDurationInSeconds" ,container.Add ); + AddIf( null != this._diskCapacityInByte ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((long)this._diskCapacityInByte) : null, "diskCapacityInBytes" ,container.Add ); + AddIf( null != this._fileSystemCapacityInByte ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((long)this._fileSystemCapacityInByte) : null, "fileSystemCapacityInBytes" ,container.Add ); + AddIf( null != this._sourceDataInMegaByte ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((double)this._sourceDataInMegaByte) : null, "sourceDataInMegaBytes" ,container.Add ); + AddIf( null != this._psDataInMegaByte ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((double)this._psDataInMegaByte) : null, "psDataInMegaBytes" ,container.Add ); + AddIf( null != this._targetDataInMegaByte ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((double)this._targetDataInMegaByte) : null, "targetDataInMegaBytes" ,container.Add ); + AddIf( null != (((object)this._diskResized)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._diskResized.ToString()) : null, "diskResized" ,container.Add ); + AddIf( null != this._lastRpoCalculatedTime ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._lastRpoCalculatedTime?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "lastRpoCalculatedTime" ,container.Add ); + AddIf( null != this._resyncProcessedByte ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((long)this._resyncProcessedByte) : null, "resyncProcessedBytes" ,container.Add ); + AddIf( null != this._resyncTotalTransferredByte ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((long)this._resyncTotalTransferredByte) : null, "resyncTotalTransferredBytes" ,container.Add ); + AddIf( null != this._resyncLast15MinutesTransferredByte ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((long)this._resyncLast15MinutesTransferredByte) : null, "resyncLast15MinutesTransferredBytes" ,container.Add ); + AddIf( null != this._resyncLastDataTransferTimeUtc ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._resyncLastDataTransferTimeUtc?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "resyncLastDataTransferTimeUTC" ,container.Add ); + AddIf( null != this._resyncStartTime ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._resyncStartTime?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "resyncStartTime" ,container.Add ); + AddIf( null != (((object)this._progressHealth)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._progressHealth.ToString()) : null, "progressHealth" ,container.Add ); + AddIf( null != (((object)this._progressStatus)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._progressStatus.ToString()) : null, "progressStatus" ,container.Add ); + AddIf( null != this._secondsToTakeSwitchProvider ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((long)this._secondsToTakeSwitchProvider) : null, "secondsToTakeSwitchProvider" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2RecoveryPointDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2RecoveryPointDetails.PowerShell.cs new file mode 100644 index 000000000000..61211a99aa55 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2RecoveryPointDetails.PowerShell.cs @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// InMage Azure V2 provider specific recovery point details. + [System.ComponentModel.TypeConverter(typeof(InMageAzureV2RecoveryPointDetailsTypeConverter))] + public partial class InMageAzureV2RecoveryPointDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2RecoveryPointDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InMageAzureV2RecoveryPointDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2RecoveryPointDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InMageAzureV2RecoveryPointDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2RecoveryPointDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InMageAzureV2RecoveryPointDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("IsMultiVMSyncPoint")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2RecoveryPointDetailsInternal)this).IsMultiVMSyncPoint = (string) content.GetValueForProperty("IsMultiVMSyncPoint",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2RecoveryPointDetailsInternal)this).IsMultiVMSyncPoint, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProviderSpecificRecoveryPointDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProviderSpecificRecoveryPointDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InMageAzureV2RecoveryPointDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("IsMultiVMSyncPoint")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2RecoveryPointDetailsInternal)this).IsMultiVMSyncPoint = (string) content.GetValueForProperty("IsMultiVMSyncPoint",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2RecoveryPointDetailsInternal)this).IsMultiVMSyncPoint, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProviderSpecificRecoveryPointDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProviderSpecificRecoveryPointDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// InMage Azure V2 provider specific recovery point details. + [System.ComponentModel.TypeConverter(typeof(InMageAzureV2RecoveryPointDetailsTypeConverter))] + public partial interface IInMageAzureV2RecoveryPointDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2RecoveryPointDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2RecoveryPointDetails.TypeConverter.cs new file mode 100644 index 000000000000..bb19504eb354 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2RecoveryPointDetails.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InMageAzureV2RecoveryPointDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2RecoveryPointDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2RecoveryPointDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InMageAzureV2RecoveryPointDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InMageAzureV2RecoveryPointDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InMageAzureV2RecoveryPointDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2RecoveryPointDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2RecoveryPointDetails.cs new file mode 100644 index 000000000000..a8281fd69cf1 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2RecoveryPointDetails.cs @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMage Azure V2 provider specific recovery point details. + public partial class InMageAzureV2RecoveryPointDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2RecoveryPointDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2RecoveryPointDetailsInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProviderSpecificRecoveryPointDetails __providerSpecificRecoveryPointDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProviderSpecificRecoveryPointDetails(); + + /// Gets the provider type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProviderSpecificRecoveryPointDetailsInternal)__providerSpecificRecoveryPointDetails).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProviderSpecificRecoveryPointDetailsInternal)__providerSpecificRecoveryPointDetails).InstanceType = value ; } + + /// Backing field for property. + private string _isMultiVMSyncPoint; + + /// A value indicating whether the recovery point is multi VM consistent. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string IsMultiVMSyncPoint { get => this._isMultiVMSyncPoint; set => this._isMultiVMSyncPoint = value; } + + /// Creates an new instance. + public InMageAzureV2RecoveryPointDetails() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__providerSpecificRecoveryPointDetails), __providerSpecificRecoveryPointDetails); + await eventListener.AssertObjectIsValid(nameof(__providerSpecificRecoveryPointDetails), __providerSpecificRecoveryPointDetails); + } + } + /// InMage Azure V2 provider specific recovery point details. + public partial interface IInMageAzureV2RecoveryPointDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProviderSpecificRecoveryPointDetails + { + /// A value indicating whether the recovery point is multi VM consistent. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether the recovery point is multi VM consistent.", + SerializedName = @"isMultiVmSyncPoint", + PossibleTypes = new [] { typeof(string) })] + string IsMultiVMSyncPoint { get; set; } + + } + /// InMage Azure V2 provider specific recovery point details. + internal partial interface IInMageAzureV2RecoveryPointDetailsInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProviderSpecificRecoveryPointDetailsInternal + { + /// A value indicating whether the recovery point is multi VM consistent. + string IsMultiVMSyncPoint { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2RecoveryPointDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2RecoveryPointDetails.json.cs new file mode 100644 index 000000000000..44cc49c21561 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2RecoveryPointDetails.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMage Azure V2 provider specific recovery point details. + public partial class InMageAzureV2RecoveryPointDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2RecoveryPointDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2RecoveryPointDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2RecoveryPointDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new InMageAzureV2RecoveryPointDetails(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal InMageAzureV2RecoveryPointDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __providerSpecificRecoveryPointDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProviderSpecificRecoveryPointDetails(json); + {_isMultiVMSyncPoint = If( json?.PropertyT("isMultiVmSyncPoint"), out var __jsonIsMultiVMSyncPoint) ? (string)__jsonIsMultiVMSyncPoint : (string)IsMultiVMSyncPoint;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __providerSpecificRecoveryPointDetails?.ToJson(container, serializationMode); + AddIf( null != (((object)this._isMultiVMSyncPoint)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._isMultiVMSyncPoint.ToString()) : null, "isMultiVmSyncPoint" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ReplicationDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ReplicationDetails.PowerShell.cs new file mode 100644 index 000000000000..77548c648fbf --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ReplicationDetails.PowerShell.cs @@ -0,0 +1,714 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// InMageAzureV2 provider specific settings. + [System.ComponentModel.TypeConverter(typeof(InMageAzureV2ReplicationDetailsTypeConverter))] + public partial class InMageAzureV2ReplicationDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InMageAzureV2ReplicationDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InMageAzureV2ReplicationDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InMageAzureV2ReplicationDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SwitchProviderDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).SwitchProviderDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderDetails) content.GetValueForProperty("SwitchProviderDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).SwitchProviderDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2SwitchProviderDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("InfrastructureVMId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).InfrastructureVMId = (string) content.GetValueForProperty("InfrastructureVMId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).InfrastructureVMId, global::System.Convert.ToString); + } + if (content.Contains("VCenterInfrastructureId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).VCenterInfrastructureId = (string) content.GetValueForProperty("VCenterInfrastructureId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).VCenterInfrastructureId, global::System.Convert.ToString); + } + if (content.Contains("ProtectionStage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).ProtectionStage = (string) content.GetValueForProperty("ProtectionStage",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).ProtectionStage, global::System.Convert.ToString); + } + if (content.Contains("VMId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).VMId = (string) content.GetValueForProperty("VMId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).VMId, global::System.Convert.ToString); + } + if (content.Contains("VMProtectionState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).VMProtectionState = (string) content.GetValueForProperty("VMProtectionState",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).VMProtectionState, global::System.Convert.ToString); + } + if (content.Contains("VMProtectionStateDescription")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).VMProtectionStateDescription = (string) content.GetValueForProperty("VMProtectionStateDescription",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).VMProtectionStateDescription, global::System.Convert.ToString); + } + if (content.Contains("ResyncProgressPercentage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).ResyncProgressPercentage = (int?) content.GetValueForProperty("ResyncProgressPercentage",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).ResyncProgressPercentage, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("RpoInSecond")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).RpoInSecond = (long?) content.GetValueForProperty("RpoInSecond",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).RpoInSecond, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("CompressedDataRateInMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).CompressedDataRateInMb = (double?) content.GetValueForProperty("CompressedDataRateInMb",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).CompressedDataRateInMb, (__y)=> (double) global::System.Convert.ChangeType(__y, typeof(double))); + } + if (content.Contains("UncompressedDataRateInMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).UncompressedDataRateInMb = (double?) content.GetValueForProperty("UncompressedDataRateInMb",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).UncompressedDataRateInMb, (__y)=> (double) global::System.Convert.ChangeType(__y, typeof(double))); + } + if (content.Contains("IPAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).IPAddress = (string) content.GetValueForProperty("IPAddress",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).IPAddress, global::System.Convert.ToString); + } + if (content.Contains("AgentVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).AgentVersion = (string) content.GetValueForProperty("AgentVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).AgentVersion, global::System.Convert.ToString); + } + if (content.Contains("AgentExpiryDate")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).AgentExpiryDate = (global::System.DateTime?) content.GetValueForProperty("AgentExpiryDate",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).AgentExpiryDate, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("IsAgentUpdateRequired")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).IsAgentUpdateRequired = (string) content.GetValueForProperty("IsAgentUpdateRequired",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).IsAgentUpdateRequired, global::System.Convert.ToString); + } + if (content.Contains("IsRebootAfterUpdateRequired")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).IsRebootAfterUpdateRequired = (string) content.GetValueForProperty("IsRebootAfterUpdateRequired",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).IsRebootAfterUpdateRequired, global::System.Convert.ToString); + } + if (content.Contains("LastHeartbeat")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).LastHeartbeat = (global::System.DateTime?) content.GetValueForProperty("LastHeartbeat",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).LastHeartbeat, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ProcessServerId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).ProcessServerId = (string) content.GetValueForProperty("ProcessServerId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).ProcessServerId, global::System.Convert.ToString); + } + if (content.Contains("ProcessServerName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).ProcessServerName = (string) content.GetValueForProperty("ProcessServerName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).ProcessServerName, global::System.Convert.ToString); + } + if (content.Contains("MultiVMGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).MultiVMGroupId = (string) content.GetValueForProperty("MultiVMGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).MultiVMGroupId, global::System.Convert.ToString); + } + if (content.Contains("MultiVMGroupName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).MultiVMGroupName = (string) content.GetValueForProperty("MultiVMGroupName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).MultiVMGroupName, global::System.Convert.ToString); + } + if (content.Contains("MultiVMSyncStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).MultiVMSyncStatus = (string) content.GetValueForProperty("MultiVMSyncStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).MultiVMSyncStatus, global::System.Convert.ToString); + } + if (content.Contains("ProtectedDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).ProtectedDisk = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetails[]) content.GetValueForProperty("ProtectedDisk",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).ProtectedDisk, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2ProtectedDiskDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("DiskResized")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).DiskResized = (string) content.GetValueForProperty("DiskResized",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).DiskResized, global::System.Convert.ToString); + } + if (content.Contains("MasterTargetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).MasterTargetId = (string) content.GetValueForProperty("MasterTargetId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).MasterTargetId, global::System.Convert.ToString); + } + if (content.Contains("SourceVMCpuCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).SourceVMCpuCount = (int?) content.GetValueForProperty("SourceVMCpuCount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).SourceVMCpuCount, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("SourceVMRamSizeInMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).SourceVMRamSizeInMb = (int?) content.GetValueForProperty("SourceVMRamSizeInMb",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).SourceVMRamSizeInMb, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("OSType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).OSType = (string) content.GetValueForProperty("OSType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).OSType, global::System.Convert.ToString); + } + if (content.Contains("VhdName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).VhdName = (string) content.GetValueForProperty("VhdName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).VhdName, global::System.Convert.ToString); + } + if (content.Contains("OSDiskId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).OSDiskId = (string) content.GetValueForProperty("OSDiskId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).OSDiskId, global::System.Convert.ToString); + } + if (content.Contains("AzureVMDiskDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).AzureVMDiskDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureVMDiskDetails[]) content.GetValueForProperty("AzureVMDiskDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).AzureVMDiskDetail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AzureVMDiskDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("RecoveryAzureVMName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).RecoveryAzureVMName = (string) content.GetValueForProperty("RecoveryAzureVMName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).RecoveryAzureVMName, global::System.Convert.ToString); + } + if (content.Contains("RecoveryAzureVMSize")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).RecoveryAzureVMSize = (string) content.GetValueForProperty("RecoveryAzureVMSize",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).RecoveryAzureVMSize, global::System.Convert.ToString); + } + if (content.Contains("RecoveryAzureStorageAccount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).RecoveryAzureStorageAccount = (string) content.GetValueForProperty("RecoveryAzureStorageAccount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).RecoveryAzureStorageAccount, global::System.Convert.ToString); + } + if (content.Contains("RecoveryAzureLogStorageAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).RecoveryAzureLogStorageAccountId = (string) content.GetValueForProperty("RecoveryAzureLogStorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).RecoveryAzureLogStorageAccountId, global::System.Convert.ToString); + } + if (content.Contains("VMNic")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).VMNic = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetails[]) content.GetValueForProperty("VMNic",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).VMNic, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMNicDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("SelectedRecoveryAzureNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).SelectedRecoveryAzureNetworkId = (string) content.GetValueForProperty("SelectedRecoveryAzureNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).SelectedRecoveryAzureNetworkId, global::System.Convert.ToString); + } + if (content.Contains("SelectedTfoAzureNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).SelectedTfoAzureNetworkId = (string) content.GetValueForProperty("SelectedTfoAzureNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).SelectedTfoAzureNetworkId, global::System.Convert.ToString); + } + if (content.Contains("SelectedSourceNicId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).SelectedSourceNicId = (string) content.GetValueForProperty("SelectedSourceNicId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).SelectedSourceNicId, global::System.Convert.ToString); + } + if (content.Contains("DiscoveryType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).DiscoveryType = (string) content.GetValueForProperty("DiscoveryType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).DiscoveryType, global::System.Convert.ToString); + } + if (content.Contains("EnableRdpOnTargetOption")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).EnableRdpOnTargetOption = (string) content.GetValueForProperty("EnableRdpOnTargetOption",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).EnableRdpOnTargetOption, global::System.Convert.ToString); + } + if (content.Contains("Datastore")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).Datastore = (string[]) content.GetValueForProperty("Datastore",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).Datastore, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("TargetVMId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).TargetVMId = (string) content.GetValueForProperty("TargetVMId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).TargetVMId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryAzureResourceGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).RecoveryAzureResourceGroupId = (string) content.GetValueForProperty("RecoveryAzureResourceGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).RecoveryAzureResourceGroupId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryAvailabilitySetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).RecoveryAvailabilitySetId = (string) content.GetValueForProperty("RecoveryAvailabilitySetId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).RecoveryAvailabilitySetId, global::System.Convert.ToString); + } + if (content.Contains("TargetAvailabilityZone")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).TargetAvailabilityZone = (string) content.GetValueForProperty("TargetAvailabilityZone",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).TargetAvailabilityZone, global::System.Convert.ToString); + } + if (content.Contains("TargetProximityPlacementGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).TargetProximityPlacementGroupId = (string) content.GetValueForProperty("TargetProximityPlacementGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).TargetProximityPlacementGroupId, global::System.Convert.ToString); + } + if (content.Contains("UseManagedDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).UseManagedDisk = (string) content.GetValueForProperty("UseManagedDisk",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).UseManagedDisk, global::System.Convert.ToString); + } + if (content.Contains("LicenseType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).LicenseType = (string) content.GetValueForProperty("LicenseType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).LicenseType, global::System.Convert.ToString); + } + if (content.Contains("SqlServerLicenseType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).SqlServerLicenseType = (string) content.GetValueForProperty("SqlServerLicenseType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).SqlServerLicenseType, global::System.Convert.ToString); + } + if (content.Contains("ValidationError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).ValidationError = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[]) content.GetValueForProperty("ValidationError",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).ValidationError, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("LastRpoCalculatedTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).LastRpoCalculatedTime = (global::System.DateTime?) content.GetValueForProperty("LastRpoCalculatedTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).LastRpoCalculatedTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("LastUpdateReceivedTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).LastUpdateReceivedTime = (global::System.DateTime?) content.GetValueForProperty("LastUpdateReceivedTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).LastUpdateReceivedTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ReplicaId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).ReplicaId = (string) content.GetValueForProperty("ReplicaId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).ReplicaId, global::System.Convert.ToString); + } + if (content.Contains("OSVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).OSVersion = (string) content.GetValueForProperty("OSVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).OSVersion, global::System.Convert.ToString); + } + if (content.Contains("ProtectedManagedDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).ProtectedManagedDisk = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ManagedDiskDetails[]) content.GetValueForProperty("ProtectedManagedDisk",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).ProtectedManagedDisk, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2ManagedDiskDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("LastRecoveryPointReceived")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).LastRecoveryPointReceived = (global::System.DateTime?) content.GetValueForProperty("LastRecoveryPointReceived",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).LastRecoveryPointReceived, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("FirmwareType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).FirmwareType = (string) content.GetValueForProperty("FirmwareType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).FirmwareType, global::System.Convert.ToString); + } + if (content.Contains("AzureVMGeneration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).AzureVMGeneration = (string) content.GetValueForProperty("AzureVMGeneration",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).AzureVMGeneration, global::System.Convert.ToString); + } + if (content.Contains("IsAdditionalStatsAvailable")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).IsAdditionalStatsAvailable = (bool?) content.GetValueForProperty("IsAdditionalStatsAvailable",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).IsAdditionalStatsAvailable, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("TotalDataTransferred")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).TotalDataTransferred = (long?) content.GetValueForProperty("TotalDataTransferred",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).TotalDataTransferred, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("TotalProgressHealth")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).TotalProgressHealth = (string) content.GetValueForProperty("TotalProgressHealth",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).TotalProgressHealth, global::System.Convert.ToString); + } + if (content.Contains("TargetVMTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).TargetVMTag = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsTargetVMTags) content.GetValueForProperty("TargetVMTag",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).TargetVMTag, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2ReplicationDetailsTargetVMTagsTypeConverter.ConvertFrom); + } + if (content.Contains("SeedManagedDiskTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).SeedManagedDiskTag = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsSeedManagedDiskTags) content.GetValueForProperty("SeedManagedDiskTag",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).SeedManagedDiskTag, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2ReplicationDetailsSeedManagedDiskTagsTypeConverter.ConvertFrom); + } + if (content.Contains("TargetManagedDiskTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).TargetManagedDiskTag = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsTargetManagedDiskTags) content.GetValueForProperty("TargetManagedDiskTag",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).TargetManagedDiskTag, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2ReplicationDetailsTargetManagedDiskTagsTypeConverter.ConvertFrom); + } + if (content.Contains("TargetNicTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).TargetNicTag = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsTargetNicTags) content.GetValueForProperty("TargetNicTag",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).TargetNicTag, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2ReplicationDetailsTargetNicTagsTypeConverter.ConvertFrom); + } + if (content.Contains("SwitchProviderBlockingErrorDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).SwitchProviderBlockingErrorDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderBlockingErrorDetails[]) content.GetValueForProperty("SwitchProviderBlockingErrorDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).SwitchProviderBlockingErrorDetail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2SwitchProviderBlockingErrorDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettingsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettingsInternal)this).InstanceType, global::System.Convert.ToString); + } + if (content.Contains("SwitchProviderDetailTargetVaultId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).SwitchProviderDetailTargetVaultId = (string) content.GetValueForProperty("SwitchProviderDetailTargetVaultId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).SwitchProviderDetailTargetVaultId, global::System.Convert.ToString); + } + if (content.Contains("SwitchProviderDetailTargetResourceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).SwitchProviderDetailTargetResourceId = (string) content.GetValueForProperty("SwitchProviderDetailTargetResourceId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).SwitchProviderDetailTargetResourceId, global::System.Convert.ToString); + } + if (content.Contains("SwitchProviderDetailTargetFabricId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).SwitchProviderDetailTargetFabricId = (string) content.GetValueForProperty("SwitchProviderDetailTargetFabricId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).SwitchProviderDetailTargetFabricId, global::System.Convert.ToString); + } + if (content.Contains("SwitchProviderDetailTargetApplianceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).SwitchProviderDetailTargetApplianceId = (string) content.GetValueForProperty("SwitchProviderDetailTargetApplianceId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).SwitchProviderDetailTargetApplianceId, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InMageAzureV2ReplicationDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SwitchProviderDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).SwitchProviderDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderDetails) content.GetValueForProperty("SwitchProviderDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).SwitchProviderDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2SwitchProviderDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("InfrastructureVMId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).InfrastructureVMId = (string) content.GetValueForProperty("InfrastructureVMId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).InfrastructureVMId, global::System.Convert.ToString); + } + if (content.Contains("VCenterInfrastructureId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).VCenterInfrastructureId = (string) content.GetValueForProperty("VCenterInfrastructureId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).VCenterInfrastructureId, global::System.Convert.ToString); + } + if (content.Contains("ProtectionStage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).ProtectionStage = (string) content.GetValueForProperty("ProtectionStage",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).ProtectionStage, global::System.Convert.ToString); + } + if (content.Contains("VMId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).VMId = (string) content.GetValueForProperty("VMId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).VMId, global::System.Convert.ToString); + } + if (content.Contains("VMProtectionState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).VMProtectionState = (string) content.GetValueForProperty("VMProtectionState",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).VMProtectionState, global::System.Convert.ToString); + } + if (content.Contains("VMProtectionStateDescription")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).VMProtectionStateDescription = (string) content.GetValueForProperty("VMProtectionStateDescription",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).VMProtectionStateDescription, global::System.Convert.ToString); + } + if (content.Contains("ResyncProgressPercentage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).ResyncProgressPercentage = (int?) content.GetValueForProperty("ResyncProgressPercentage",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).ResyncProgressPercentage, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("RpoInSecond")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).RpoInSecond = (long?) content.GetValueForProperty("RpoInSecond",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).RpoInSecond, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("CompressedDataRateInMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).CompressedDataRateInMb = (double?) content.GetValueForProperty("CompressedDataRateInMb",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).CompressedDataRateInMb, (__y)=> (double) global::System.Convert.ChangeType(__y, typeof(double))); + } + if (content.Contains("UncompressedDataRateInMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).UncompressedDataRateInMb = (double?) content.GetValueForProperty("UncompressedDataRateInMb",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).UncompressedDataRateInMb, (__y)=> (double) global::System.Convert.ChangeType(__y, typeof(double))); + } + if (content.Contains("IPAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).IPAddress = (string) content.GetValueForProperty("IPAddress",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).IPAddress, global::System.Convert.ToString); + } + if (content.Contains("AgentVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).AgentVersion = (string) content.GetValueForProperty("AgentVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).AgentVersion, global::System.Convert.ToString); + } + if (content.Contains("AgentExpiryDate")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).AgentExpiryDate = (global::System.DateTime?) content.GetValueForProperty("AgentExpiryDate",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).AgentExpiryDate, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("IsAgentUpdateRequired")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).IsAgentUpdateRequired = (string) content.GetValueForProperty("IsAgentUpdateRequired",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).IsAgentUpdateRequired, global::System.Convert.ToString); + } + if (content.Contains("IsRebootAfterUpdateRequired")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).IsRebootAfterUpdateRequired = (string) content.GetValueForProperty("IsRebootAfterUpdateRequired",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).IsRebootAfterUpdateRequired, global::System.Convert.ToString); + } + if (content.Contains("LastHeartbeat")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).LastHeartbeat = (global::System.DateTime?) content.GetValueForProperty("LastHeartbeat",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).LastHeartbeat, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ProcessServerId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).ProcessServerId = (string) content.GetValueForProperty("ProcessServerId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).ProcessServerId, global::System.Convert.ToString); + } + if (content.Contains("ProcessServerName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).ProcessServerName = (string) content.GetValueForProperty("ProcessServerName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).ProcessServerName, global::System.Convert.ToString); + } + if (content.Contains("MultiVMGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).MultiVMGroupId = (string) content.GetValueForProperty("MultiVMGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).MultiVMGroupId, global::System.Convert.ToString); + } + if (content.Contains("MultiVMGroupName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).MultiVMGroupName = (string) content.GetValueForProperty("MultiVMGroupName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).MultiVMGroupName, global::System.Convert.ToString); + } + if (content.Contains("MultiVMSyncStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).MultiVMSyncStatus = (string) content.GetValueForProperty("MultiVMSyncStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).MultiVMSyncStatus, global::System.Convert.ToString); + } + if (content.Contains("ProtectedDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).ProtectedDisk = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetails[]) content.GetValueForProperty("ProtectedDisk",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).ProtectedDisk, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2ProtectedDiskDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("DiskResized")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).DiskResized = (string) content.GetValueForProperty("DiskResized",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).DiskResized, global::System.Convert.ToString); + } + if (content.Contains("MasterTargetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).MasterTargetId = (string) content.GetValueForProperty("MasterTargetId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).MasterTargetId, global::System.Convert.ToString); + } + if (content.Contains("SourceVMCpuCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).SourceVMCpuCount = (int?) content.GetValueForProperty("SourceVMCpuCount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).SourceVMCpuCount, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("SourceVMRamSizeInMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).SourceVMRamSizeInMb = (int?) content.GetValueForProperty("SourceVMRamSizeInMb",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).SourceVMRamSizeInMb, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("OSType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).OSType = (string) content.GetValueForProperty("OSType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).OSType, global::System.Convert.ToString); + } + if (content.Contains("VhdName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).VhdName = (string) content.GetValueForProperty("VhdName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).VhdName, global::System.Convert.ToString); + } + if (content.Contains("OSDiskId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).OSDiskId = (string) content.GetValueForProperty("OSDiskId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).OSDiskId, global::System.Convert.ToString); + } + if (content.Contains("AzureVMDiskDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).AzureVMDiskDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureVMDiskDetails[]) content.GetValueForProperty("AzureVMDiskDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).AzureVMDiskDetail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AzureVMDiskDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("RecoveryAzureVMName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).RecoveryAzureVMName = (string) content.GetValueForProperty("RecoveryAzureVMName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).RecoveryAzureVMName, global::System.Convert.ToString); + } + if (content.Contains("RecoveryAzureVMSize")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).RecoveryAzureVMSize = (string) content.GetValueForProperty("RecoveryAzureVMSize",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).RecoveryAzureVMSize, global::System.Convert.ToString); + } + if (content.Contains("RecoveryAzureStorageAccount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).RecoveryAzureStorageAccount = (string) content.GetValueForProperty("RecoveryAzureStorageAccount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).RecoveryAzureStorageAccount, global::System.Convert.ToString); + } + if (content.Contains("RecoveryAzureLogStorageAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).RecoveryAzureLogStorageAccountId = (string) content.GetValueForProperty("RecoveryAzureLogStorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).RecoveryAzureLogStorageAccountId, global::System.Convert.ToString); + } + if (content.Contains("VMNic")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).VMNic = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetails[]) content.GetValueForProperty("VMNic",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).VMNic, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMNicDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("SelectedRecoveryAzureNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).SelectedRecoveryAzureNetworkId = (string) content.GetValueForProperty("SelectedRecoveryAzureNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).SelectedRecoveryAzureNetworkId, global::System.Convert.ToString); + } + if (content.Contains("SelectedTfoAzureNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).SelectedTfoAzureNetworkId = (string) content.GetValueForProperty("SelectedTfoAzureNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).SelectedTfoAzureNetworkId, global::System.Convert.ToString); + } + if (content.Contains("SelectedSourceNicId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).SelectedSourceNicId = (string) content.GetValueForProperty("SelectedSourceNicId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).SelectedSourceNicId, global::System.Convert.ToString); + } + if (content.Contains("DiscoveryType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).DiscoveryType = (string) content.GetValueForProperty("DiscoveryType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).DiscoveryType, global::System.Convert.ToString); + } + if (content.Contains("EnableRdpOnTargetOption")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).EnableRdpOnTargetOption = (string) content.GetValueForProperty("EnableRdpOnTargetOption",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).EnableRdpOnTargetOption, global::System.Convert.ToString); + } + if (content.Contains("Datastore")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).Datastore = (string[]) content.GetValueForProperty("Datastore",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).Datastore, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("TargetVMId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).TargetVMId = (string) content.GetValueForProperty("TargetVMId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).TargetVMId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryAzureResourceGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).RecoveryAzureResourceGroupId = (string) content.GetValueForProperty("RecoveryAzureResourceGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).RecoveryAzureResourceGroupId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryAvailabilitySetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).RecoveryAvailabilitySetId = (string) content.GetValueForProperty("RecoveryAvailabilitySetId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).RecoveryAvailabilitySetId, global::System.Convert.ToString); + } + if (content.Contains("TargetAvailabilityZone")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).TargetAvailabilityZone = (string) content.GetValueForProperty("TargetAvailabilityZone",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).TargetAvailabilityZone, global::System.Convert.ToString); + } + if (content.Contains("TargetProximityPlacementGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).TargetProximityPlacementGroupId = (string) content.GetValueForProperty("TargetProximityPlacementGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).TargetProximityPlacementGroupId, global::System.Convert.ToString); + } + if (content.Contains("UseManagedDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).UseManagedDisk = (string) content.GetValueForProperty("UseManagedDisk",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).UseManagedDisk, global::System.Convert.ToString); + } + if (content.Contains("LicenseType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).LicenseType = (string) content.GetValueForProperty("LicenseType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).LicenseType, global::System.Convert.ToString); + } + if (content.Contains("SqlServerLicenseType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).SqlServerLicenseType = (string) content.GetValueForProperty("SqlServerLicenseType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).SqlServerLicenseType, global::System.Convert.ToString); + } + if (content.Contains("ValidationError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).ValidationError = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[]) content.GetValueForProperty("ValidationError",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).ValidationError, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("LastRpoCalculatedTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).LastRpoCalculatedTime = (global::System.DateTime?) content.GetValueForProperty("LastRpoCalculatedTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).LastRpoCalculatedTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("LastUpdateReceivedTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).LastUpdateReceivedTime = (global::System.DateTime?) content.GetValueForProperty("LastUpdateReceivedTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).LastUpdateReceivedTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ReplicaId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).ReplicaId = (string) content.GetValueForProperty("ReplicaId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).ReplicaId, global::System.Convert.ToString); + } + if (content.Contains("OSVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).OSVersion = (string) content.GetValueForProperty("OSVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).OSVersion, global::System.Convert.ToString); + } + if (content.Contains("ProtectedManagedDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).ProtectedManagedDisk = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ManagedDiskDetails[]) content.GetValueForProperty("ProtectedManagedDisk",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).ProtectedManagedDisk, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2ManagedDiskDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("LastRecoveryPointReceived")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).LastRecoveryPointReceived = (global::System.DateTime?) content.GetValueForProperty("LastRecoveryPointReceived",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).LastRecoveryPointReceived, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("FirmwareType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).FirmwareType = (string) content.GetValueForProperty("FirmwareType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).FirmwareType, global::System.Convert.ToString); + } + if (content.Contains("AzureVMGeneration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).AzureVMGeneration = (string) content.GetValueForProperty("AzureVMGeneration",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).AzureVMGeneration, global::System.Convert.ToString); + } + if (content.Contains("IsAdditionalStatsAvailable")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).IsAdditionalStatsAvailable = (bool?) content.GetValueForProperty("IsAdditionalStatsAvailable",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).IsAdditionalStatsAvailable, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("TotalDataTransferred")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).TotalDataTransferred = (long?) content.GetValueForProperty("TotalDataTransferred",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).TotalDataTransferred, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("TotalProgressHealth")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).TotalProgressHealth = (string) content.GetValueForProperty("TotalProgressHealth",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).TotalProgressHealth, global::System.Convert.ToString); + } + if (content.Contains("TargetVMTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).TargetVMTag = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsTargetVMTags) content.GetValueForProperty("TargetVMTag",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).TargetVMTag, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2ReplicationDetailsTargetVMTagsTypeConverter.ConvertFrom); + } + if (content.Contains("SeedManagedDiskTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).SeedManagedDiskTag = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsSeedManagedDiskTags) content.GetValueForProperty("SeedManagedDiskTag",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).SeedManagedDiskTag, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2ReplicationDetailsSeedManagedDiskTagsTypeConverter.ConvertFrom); + } + if (content.Contains("TargetManagedDiskTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).TargetManagedDiskTag = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsTargetManagedDiskTags) content.GetValueForProperty("TargetManagedDiskTag",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).TargetManagedDiskTag, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2ReplicationDetailsTargetManagedDiskTagsTypeConverter.ConvertFrom); + } + if (content.Contains("TargetNicTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).TargetNicTag = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsTargetNicTags) content.GetValueForProperty("TargetNicTag",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).TargetNicTag, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2ReplicationDetailsTargetNicTagsTypeConverter.ConvertFrom); + } + if (content.Contains("SwitchProviderBlockingErrorDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).SwitchProviderBlockingErrorDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderBlockingErrorDetails[]) content.GetValueForProperty("SwitchProviderBlockingErrorDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).SwitchProviderBlockingErrorDetail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2SwitchProviderBlockingErrorDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettingsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettingsInternal)this).InstanceType, global::System.Convert.ToString); + } + if (content.Contains("SwitchProviderDetailTargetVaultId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).SwitchProviderDetailTargetVaultId = (string) content.GetValueForProperty("SwitchProviderDetailTargetVaultId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).SwitchProviderDetailTargetVaultId, global::System.Convert.ToString); + } + if (content.Contains("SwitchProviderDetailTargetResourceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).SwitchProviderDetailTargetResourceId = (string) content.GetValueForProperty("SwitchProviderDetailTargetResourceId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).SwitchProviderDetailTargetResourceId, global::System.Convert.ToString); + } + if (content.Contains("SwitchProviderDetailTargetFabricId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).SwitchProviderDetailTargetFabricId = (string) content.GetValueForProperty("SwitchProviderDetailTargetFabricId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).SwitchProviderDetailTargetFabricId, global::System.Convert.ToString); + } + if (content.Contains("SwitchProviderDetailTargetApplianceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).SwitchProviderDetailTargetApplianceId = (string) content.GetValueForProperty("SwitchProviderDetailTargetApplianceId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal)this).SwitchProviderDetailTargetApplianceId, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// InMageAzureV2 provider specific settings. + [System.ComponentModel.TypeConverter(typeof(InMageAzureV2ReplicationDetailsTypeConverter))] + public partial interface IInMageAzureV2ReplicationDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ReplicationDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ReplicationDetails.TypeConverter.cs new file mode 100644 index 000000000000..fade0104d344 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ReplicationDetails.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InMageAzureV2ReplicationDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InMageAzureV2ReplicationDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InMageAzureV2ReplicationDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InMageAzureV2ReplicationDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ReplicationDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ReplicationDetails.cs new file mode 100644 index 000000000000..80258bea90f6 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ReplicationDetails.cs @@ -0,0 +1,1313 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMageAzureV2 provider specific settings. + public partial class InMageAzureV2ReplicationDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettings __replicationProviderSpecificSettings = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProviderSpecificSettings(); + + /// Backing field for property. + private global::System.DateTime? _agentExpiryDate; + + /// Agent expiry date. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public global::System.DateTime? AgentExpiryDate { get => this._agentExpiryDate; set => this._agentExpiryDate = value; } + + /// Backing field for property. + private string _agentVersion; + + /// The agent version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string AgentVersion { get => this._agentVersion; set => this._agentVersion = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureVMDiskDetails[] _azureVMDiskDetail; + + /// Azure VM Disk details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureVMDiskDetails[] AzureVMDiskDetail { get => this._azureVMDiskDetail; set => this._azureVMDiskDetail = value; } + + /// Backing field for property. + private string _azureVMGeneration; + + /// The target generation for this protected item. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string AzureVMGeneration { get => this._azureVMGeneration; set => this._azureVMGeneration = value; } + + /// Backing field for property. + private double? _compressedDataRateInMb; + + /// The compressed data change rate in MB. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public double? CompressedDataRateInMb { get => this._compressedDataRateInMb; set => this._compressedDataRateInMb = value; } + + /// Backing field for property. + private string[] _datastore; + + /// + /// The datastores of the on-premise machine. Value can be list of strings that contain datastore names. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string[] Datastore { get => this._datastore; set => this._datastore = value; } + + /// Backing field for property. + private string _discoveryType; + + /// + /// A value indicating the discovery type of the machine. Value can be vCenter or physical. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string DiscoveryType { get => this._discoveryType; set => this._discoveryType = value; } + + /// Backing field for property. + private string _diskResized; + + /// A value indicating whether any disk is resized for this VM. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string DiskResized { get => this._diskResized; set => this._diskResized = value; } + + /// Backing field for property. + private string _enableRdpOnTargetOption; + + /// + /// The selected option to enable RDP\SSH on target vm after failover. String value of SrsDataContract.EnableRDPOnTargetOption + /// enum. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string EnableRdpOnTargetOption { get => this._enableRdpOnTargetOption; set => this._enableRdpOnTargetOption = value; } + + /// Backing field for property. + private string _firmwareType; + + /// The firmware type of this protected item. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string FirmwareType { get => this._firmwareType; set => this._firmwareType = value; } + + /// Backing field for property. + private string _iPAddress; + + /// The source IP address. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string IPAddress { get => this._iPAddress; set => this._iPAddress = value; } + + /// Backing field for property. + private string _infrastructureVMId; + + /// The infrastructure VM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string InfrastructureVMId { get => this._infrastructureVMId; set => this._infrastructureVMId = value; } + + /// Gets the Instance type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettingsInternal)__replicationProviderSpecificSettings).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettingsInternal)__replicationProviderSpecificSettings).InstanceType = value ; } + + /// Backing field for property. + private bool? _isAdditionalStatsAvailable; + + /// A value indicating whether additional IR stats are available or not. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public bool? IsAdditionalStatsAvailable { get => this._isAdditionalStatsAvailable; set => this._isAdditionalStatsAvailable = value; } + + /// Backing field for property. + private string _isAgentUpdateRequired; + + /// A value indicating whether installed agent needs to be updated. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string IsAgentUpdateRequired { get => this._isAgentUpdateRequired; set => this._isAgentUpdateRequired = value; } + + /// Backing field for property. + private string _isRebootAfterUpdateRequired; + + /// A value indicating whether the source server requires a restart after update. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string IsRebootAfterUpdateRequired { get => this._isRebootAfterUpdateRequired; set => this._isRebootAfterUpdateRequired = value; } + + /// Backing field for property. + private global::System.DateTime? _lastHeartbeat; + + /// The last heartbeat received from the source server. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public global::System.DateTime? LastHeartbeat { get => this._lastHeartbeat; set => this._lastHeartbeat = value; } + + /// Backing field for property. + private global::System.DateTime? _lastRecoveryPointReceived; + + /// The last recovery point received time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public global::System.DateTime? LastRecoveryPointReceived { get => this._lastRecoveryPointReceived; } + + /// Backing field for property. + private global::System.DateTime? _lastRpoCalculatedTime; + + /// The last RPO calculated time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public global::System.DateTime? LastRpoCalculatedTime { get => this._lastRpoCalculatedTime; set => this._lastRpoCalculatedTime = value; } + + /// Backing field for property. + private global::System.DateTime? _lastUpdateReceivedTime; + + /// The last update time received from on-prem components. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public global::System.DateTime? LastUpdateReceivedTime { get => this._lastUpdateReceivedTime; set => this._lastUpdateReceivedTime = value; } + + /// Backing field for property. + private string _licenseType; + + /// License Type of the VM to be used. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string LicenseType { get => this._licenseType; set => this._licenseType = value; } + + /// Backing field for property. + private string _masterTargetId; + + /// The master target Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string MasterTargetId { get => this._masterTargetId; set => this._masterTargetId = value; } + + /// Internal Acessors for LastRecoveryPointReceived + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal.LastRecoveryPointReceived { get => this._lastRecoveryPointReceived; set { {_lastRecoveryPointReceived = value;} } } + + /// Internal Acessors for SwitchProviderDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderDetails Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal.SwitchProviderDetail { get => (this._switchProviderDetail = this._switchProviderDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2SwitchProviderDetails()); set { {_switchProviderDetail = value;} } } + + /// Internal Acessors for SwitchProviderDetailTargetApplianceId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal.SwitchProviderDetailTargetApplianceId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderDetailsInternal)SwitchProviderDetail).TargetApplianceId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderDetailsInternal)SwitchProviderDetail).TargetApplianceId = value; } + + /// Internal Acessors for SwitchProviderDetailTargetFabricId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal.SwitchProviderDetailTargetFabricId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderDetailsInternal)SwitchProviderDetail).TargetFabricId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderDetailsInternal)SwitchProviderDetail).TargetFabricId = value; } + + /// Internal Acessors for SwitchProviderDetailTargetResourceId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal.SwitchProviderDetailTargetResourceId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderDetailsInternal)SwitchProviderDetail).TargetResourceId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderDetailsInternal)SwitchProviderDetail).TargetResourceId = value; } + + /// Internal Acessors for SwitchProviderDetailTargetVaultId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsInternal.SwitchProviderDetailTargetVaultId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderDetailsInternal)SwitchProviderDetail).TargetVaultId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderDetailsInternal)SwitchProviderDetail).TargetVaultId = value; } + + /// Backing field for property. + private string _multiVMGroupId; + + /// The multi vm group Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string MultiVMGroupId { get => this._multiVMGroupId; set => this._multiVMGroupId = value; } + + /// Backing field for property. + private string _multiVMGroupName; + + /// The multi vm group name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string MultiVMGroupName { get => this._multiVMGroupName; set => this._multiVMGroupName = value; } + + /// Backing field for property. + private string _multiVMSyncStatus; + + /// A value indicating whether multi vm sync is enabled or disabled. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string MultiVMSyncStatus { get => this._multiVMSyncStatus; set => this._multiVMSyncStatus = value; } + + /// Backing field for property. + private string _oSDiskId; + + /// The id of the disk containing the OS. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string OSDiskId { get => this._oSDiskId; set => this._oSDiskId = value; } + + /// Backing field for property. + private string _oSType; + + /// The type of the OS on the VM. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string OSType { get => this._oSType; set => this._oSType = value; } + + /// Backing field for property. + private string _oSVersion; + + /// The OS Version of the protected item. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string OSVersion { get => this._oSVersion; set => this._oSVersion = value; } + + /// Backing field for property. + private string _processServerId; + + /// The process server Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ProcessServerId { get => this._processServerId; set => this._processServerId = value; } + + /// Backing field for property. + private string _processServerName; + + /// The process server name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ProcessServerName { get => this._processServerName; set => this._processServerName = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetails[] _protectedDisk; + + /// The list of protected disks. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetails[] ProtectedDisk { get => this._protectedDisk; set => this._protectedDisk = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ManagedDiskDetails[] _protectedManagedDisk; + + /// The list of protected managed disks. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ManagedDiskDetails[] ProtectedManagedDisk { get => this._protectedManagedDisk; set => this._protectedManagedDisk = value; } + + /// Backing field for property. + private string _protectionStage; + + /// The protection stage. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ProtectionStage { get => this._protectionStage; set => this._protectionStage = value; } + + /// Backing field for property. + private string _recoveryAvailabilitySetId; + + /// The recovery availability set Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryAvailabilitySetId { get => this._recoveryAvailabilitySetId; set => this._recoveryAvailabilitySetId = value; } + + /// Backing field for property. + private string _recoveryAzureLogStorageAccountId; + + /// + /// 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. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryAzureLogStorageAccountId { get => this._recoveryAzureLogStorageAccountId; set => this._recoveryAzureLogStorageAccountId = value; } + + /// Backing field for property. + private string _recoveryAzureResourceGroupId; + + /// The target resource group Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryAzureResourceGroupId { get => this._recoveryAzureResourceGroupId; set => this._recoveryAzureResourceGroupId = value; } + + /// Backing field for property. + private string _recoveryAzureStorageAccount; + + /// The recovery Azure storage account. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryAzureStorageAccount { get => this._recoveryAzureStorageAccount; set => this._recoveryAzureStorageAccount = value; } + + /// Backing field for property. + private string _recoveryAzureVMName; + + /// Recovery Azure given name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryAzureVMName { get => this._recoveryAzureVMName; set => this._recoveryAzureVMName = value; } + + /// Backing field for property. + private string _recoveryAzureVMSize; + + /// The Recovery Azure VM size. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryAzureVMSize { get => this._recoveryAzureVMSize; set => this._recoveryAzureVMSize = value; } + + /// Backing field for property. + private string _replicaId; + + /// The replica id of the protected item. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ReplicaId { get => this._replicaId; set => this._replicaId = value; } + + /// Backing field for property. + private int? _resyncProgressPercentage; + + /// The resync progress percentage. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? ResyncProgressPercentage { get => this._resyncProgressPercentage; set => this._resyncProgressPercentage = value; } + + /// Backing field for property. + private long? _rpoInSecond; + + /// The RPO in seconds. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public long? RpoInSecond { get => this._rpoInSecond; set => this._rpoInSecond = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsSeedManagedDiskTags _seedManagedDiskTag; + + /// The tags for the seed managed disks. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsSeedManagedDiskTags SeedManagedDiskTag { get => (this._seedManagedDiskTag = this._seedManagedDiskTag ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2ReplicationDetailsSeedManagedDiskTags()); set => this._seedManagedDiskTag = value; } + + /// Backing field for property. + private string _selectedRecoveryAzureNetworkId; + + /// The selected recovery azure network Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string SelectedRecoveryAzureNetworkId { get => this._selectedRecoveryAzureNetworkId; set => this._selectedRecoveryAzureNetworkId = value; } + + /// Backing field for property. + private string _selectedSourceNicId; + + /// + /// The selected source nic Id which will be used as the primary nic during failover. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string SelectedSourceNicId { get => this._selectedSourceNicId; set => this._selectedSourceNicId = value; } + + /// Backing field for property. + private string _selectedTfoAzureNetworkId; + + /// The test failover virtual network. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string SelectedTfoAzureNetworkId { get => this._selectedTfoAzureNetworkId; set => this._selectedTfoAzureNetworkId = value; } + + /// Backing field for property. + private int? _sourceVMCpuCount; + + /// The CPU count of the VM on the primary side. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? SourceVMCpuCount { get => this._sourceVMCpuCount; set => this._sourceVMCpuCount = value; } + + /// Backing field for property. + private int? _sourceVMRamSizeInMb; + + /// The RAM size of the VM on the primary side. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? SourceVMRamSizeInMb { get => this._sourceVMRamSizeInMb; set => this._sourceVMRamSizeInMb = value; } + + /// Backing field for property. + private string _sqlServerLicenseType; + + /// The SQL Server license type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string SqlServerLicenseType { get => this._sqlServerLicenseType; set => this._sqlServerLicenseType = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderBlockingErrorDetails[] _switchProviderBlockingErrorDetail; + + /// The switch provider blocking error information. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderBlockingErrorDetails[] SwitchProviderBlockingErrorDetail { get => this._switchProviderBlockingErrorDetail; set => this._switchProviderBlockingErrorDetail = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderDetails _switchProviderDetail; + + /// The switch provider blocking error information. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderDetails SwitchProviderDetail { get => (this._switchProviderDetail = this._switchProviderDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2SwitchProviderDetails()); set => this._switchProviderDetail = value; } + + /// The target appliance Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string SwitchProviderDetailTargetApplianceId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderDetailsInternal)SwitchProviderDetail).TargetApplianceId; } + + /// The target fabric Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string SwitchProviderDetailTargetFabricId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderDetailsInternal)SwitchProviderDetail).TargetFabricId; } + + /// The target resource Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string SwitchProviderDetailTargetResourceId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderDetailsInternal)SwitchProviderDetail).TargetResourceId; } + + /// The target vault Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string SwitchProviderDetailTargetVaultId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderDetailsInternal)SwitchProviderDetail).TargetVaultId; } + + /// Backing field for property. + private string _targetAvailabilityZone; + + /// The target availability zone. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetAvailabilityZone { get => this._targetAvailabilityZone; set => this._targetAvailabilityZone = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsTargetManagedDiskTags _targetManagedDiskTag; + + /// The tags for the target managed disks. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsTargetManagedDiskTags TargetManagedDiskTag { get => (this._targetManagedDiskTag = this._targetManagedDiskTag ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2ReplicationDetailsTargetManagedDiskTags()); set => this._targetManagedDiskTag = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsTargetNicTags _targetNicTag; + + /// The tags for the target NICs. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsTargetNicTags TargetNicTag { get => (this._targetNicTag = this._targetNicTag ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2ReplicationDetailsTargetNicTags()); set => this._targetNicTag = value; } + + /// Backing field for property. + private string _targetProximityPlacementGroupId; + + /// The target proximity placement group Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetProximityPlacementGroupId { get => this._targetProximityPlacementGroupId; set => this._targetProximityPlacementGroupId = value; } + + /// Backing field for property. + private string _targetVMId; + + /// + /// 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. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetVMId { get => this._targetVMId; set => this._targetVMId = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsTargetVMTags _targetVMTag; + + /// The target VM tags. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsTargetVMTags TargetVMTag { get => (this._targetVMTag = this._targetVMTag ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2ReplicationDetailsTargetVMTags()); set => this._targetVMTag = value; } + + /// Backing field for property. + private long? _totalDataTransferred; + + /// The total transferred data in bytes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public long? TotalDataTransferred { get => this._totalDataTransferred; set => this._totalDataTransferred = value; } + + /// Backing field for property. + private string _totalProgressHealth; + + /// The progress health. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TotalProgressHealth { get => this._totalProgressHealth; set => this._totalProgressHealth = value; } + + /// Backing field for property. + private double? _uncompressedDataRateInMb; + + /// The uncompressed data change rate in MB. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public double? UncompressedDataRateInMb { get => this._uncompressedDataRateInMb; set => this._uncompressedDataRateInMb = value; } + + /// Backing field for property. + private string _useManagedDisk; + + /// A value indicating whether managed disks should be used during failover. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string UseManagedDisk { get => this._useManagedDisk; set => this._useManagedDisk = value; } + + /// Backing field for property. + private string _vCenterInfrastructureId; + + /// The vCenter infrastructure Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string VCenterInfrastructureId { get => this._vCenterInfrastructureId; set => this._vCenterInfrastructureId = value; } + + /// Backing field for property. + private string _vMId; + + /// The virtual machine Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string VMId { get => this._vMId; set => this._vMId = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetails[] _vMNic; + + /// The PE Network details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetails[] VMNic { get => this._vMNic; set => this._vMNic = value; } + + /// Backing field for property. + private string _vMProtectionState; + + /// The protection state for the vm. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string VMProtectionState { get => this._vMProtectionState; set => this._vMProtectionState = value; } + + /// Backing field for property. + private string _vMProtectionStateDescription; + + /// The protection state description for the vm. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string VMProtectionStateDescription { get => this._vMProtectionStateDescription; set => this._vMProtectionStateDescription = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] _validationError; + + /// + /// The validation errors of the on-premise machine Value can be list of validation errors. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] ValidationError { get => this._validationError; set => this._validationError = value; } + + /// Backing field for property. + private string _vhdName; + + /// The OS disk VHD name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string VhdName { get => this._vhdName; set => this._vhdName = value; } + + /// Creates an new instance. + public InMageAzureV2ReplicationDetails() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__replicationProviderSpecificSettings), __replicationProviderSpecificSettings); + await eventListener.AssertObjectIsValid(nameof(__replicationProviderSpecificSettings), __replicationProviderSpecificSettings); + } + } + /// InMageAzureV2 provider specific settings. + public partial interface IInMageAzureV2ReplicationDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettings + { + /// Agent expiry date. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Agent expiry date.", + SerializedName = @"agentExpiryDate", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? AgentExpiryDate { get; set; } + /// The agent version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The agent version.", + SerializedName = @"agentVersion", + PossibleTypes = new [] { typeof(string) })] + string AgentVersion { get; set; } + /// Azure VM Disk details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Azure VM Disk details.", + SerializedName = @"azureVMDiskDetails", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureVMDiskDetails) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureVMDiskDetails[] AzureVMDiskDetail { get; set; } + /// The target generation for this protected item. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target generation for this protected item.", + SerializedName = @"azureVmGeneration", + PossibleTypes = new [] { typeof(string) })] + string AzureVMGeneration { get; set; } + /// The compressed data change rate in MB. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The compressed data change rate in MB.", + SerializedName = @"compressedDataRateInMB", + PossibleTypes = new [] { typeof(double) })] + double? CompressedDataRateInMb { get; set; } + /// + /// The datastores of the on-premise machine. Value can be list of strings that contain datastore names. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The datastores of the on-premise machine. Value can be list of strings that contain datastore names.", + SerializedName = @"datastores", + PossibleTypes = new [] { typeof(string) })] + string[] Datastore { get; set; } + /// + /// A value indicating the discovery type of the machine. Value can be vCenter or physical. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating the discovery type of the machine. Value can be vCenter or physical.", + SerializedName = @"discoveryType", + PossibleTypes = new [] { typeof(string) })] + string DiscoveryType { get; set; } + /// A value indicating whether any disk is resized for this VM. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether any disk is resized for this VM.", + SerializedName = @"diskResized", + PossibleTypes = new [] { typeof(string) })] + string DiskResized { get; set; } + /// + /// The selected option to enable RDP\SSH on target vm after failover. String value of SrsDataContract.EnableRDPOnTargetOption + /// enum. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The selected option to enable RDP\SSH on target vm after failover. String value of SrsDataContract.EnableRDPOnTargetOption enum.", + SerializedName = @"enableRdpOnTargetOption", + PossibleTypes = new [] { typeof(string) })] + string EnableRdpOnTargetOption { get; set; } + /// The firmware type of this protected item. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The firmware type of this protected item.", + SerializedName = @"firmwareType", + PossibleTypes = new [] { typeof(string) })] + string FirmwareType { get; set; } + /// The source IP address. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The source IP address.", + SerializedName = @"ipAddress", + PossibleTypes = new [] { typeof(string) })] + string IPAddress { get; set; } + /// The infrastructure VM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The infrastructure VM Id.", + SerializedName = @"infrastructureVmId", + PossibleTypes = new [] { typeof(string) })] + string InfrastructureVMId { get; set; } + /// A value indicating whether additional IR stats are available or not. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether additional IR stats are available or not.", + SerializedName = @"isAdditionalStatsAvailable", + PossibleTypes = new [] { typeof(bool) })] + bool? IsAdditionalStatsAvailable { get; set; } + /// A value indicating whether installed agent needs to be updated. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether installed agent needs to be updated.", + SerializedName = @"isAgentUpdateRequired", + PossibleTypes = new [] { typeof(string) })] + string IsAgentUpdateRequired { get; set; } + /// A value indicating whether the source server requires a restart after update. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether the source server requires a restart after update.", + SerializedName = @"isRebootAfterUpdateRequired", + PossibleTypes = new [] { typeof(string) })] + string IsRebootAfterUpdateRequired { get; set; } + /// The last heartbeat received from the source server. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The last heartbeat received from the source server.", + SerializedName = @"lastHeartbeat", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? LastHeartbeat { get; set; } + /// The last recovery point received time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The last recovery point received time.", + SerializedName = @"lastRecoveryPointReceived", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? LastRecoveryPointReceived { get; } + /// The last RPO calculated time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The last RPO calculated time.", + SerializedName = @"lastRpoCalculatedTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? LastRpoCalculatedTime { get; set; } + /// The last update time received from on-prem components. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The last update time received from on-prem components.", + SerializedName = @"lastUpdateReceivedTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? LastUpdateReceivedTime { get; set; } + /// License Type of the VM to be used. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"License Type of the VM to be used.", + SerializedName = @"licenseType", + PossibleTypes = new [] { typeof(string) })] + string LicenseType { get; set; } + /// The master target Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The master target Id.", + SerializedName = @"masterTargetId", + PossibleTypes = new [] { typeof(string) })] + string MasterTargetId { get; set; } + /// The multi vm group Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The multi vm group Id.", + SerializedName = @"multiVmGroupId", + PossibleTypes = new [] { typeof(string) })] + string MultiVMGroupId { get; set; } + /// The multi vm group name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The multi vm group name.", + SerializedName = @"multiVmGroupName", + PossibleTypes = new [] { typeof(string) })] + string MultiVMGroupName { get; set; } + /// A value indicating whether multi vm sync is enabled or disabled. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether multi vm sync is enabled or disabled.", + SerializedName = @"multiVmSyncStatus", + PossibleTypes = new [] { typeof(string) })] + string MultiVMSyncStatus { get; set; } + /// The id of the disk containing the OS. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The id of the disk containing the OS.", + SerializedName = @"osDiskId", + PossibleTypes = new [] { typeof(string) })] + string OSDiskId { get; set; } + /// The type of the OS on the VM. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The type of the OS on the VM.", + SerializedName = @"osType", + PossibleTypes = new [] { typeof(string) })] + string OSType { get; set; } + /// The OS Version of the protected item. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The OS Version of the protected item.", + SerializedName = @"osVersion", + PossibleTypes = new [] { typeof(string) })] + string OSVersion { get; set; } + /// The process server Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The process server Id.", + SerializedName = @"processServerId", + PossibleTypes = new [] { typeof(string) })] + string ProcessServerId { get; set; } + /// The process server name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The process server name.", + SerializedName = @"processServerName", + PossibleTypes = new [] { typeof(string) })] + string ProcessServerName { get; set; } + /// The list of protected disks. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of protected disks.", + SerializedName = @"protectedDisks", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetails) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetails[] ProtectedDisk { get; set; } + /// The list of protected managed disks. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of protected managed disks.", + SerializedName = @"protectedManagedDisks", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ManagedDiskDetails) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ManagedDiskDetails[] ProtectedManagedDisk { get; set; } + /// The protection stage. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The protection stage.", + SerializedName = @"protectionStage", + PossibleTypes = new [] { typeof(string) })] + string ProtectionStage { get; set; } + /// The recovery availability set Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery availability set Id.", + SerializedName = @"recoveryAvailabilitySetId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryAvailabilitySetId { get; set; } + /// + /// 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. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"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.", + SerializedName = @"recoveryAzureLogStorageAccountId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryAzureLogStorageAccountId { get; set; } + /// The target resource group Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target resource group Id.", + SerializedName = @"recoveryAzureResourceGroupId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryAzureResourceGroupId { get; set; } + /// The recovery Azure storage account. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery Azure storage account.", + SerializedName = @"recoveryAzureStorageAccount", + PossibleTypes = new [] { typeof(string) })] + string RecoveryAzureStorageAccount { get; set; } + /// Recovery Azure given name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Recovery Azure given name.", + SerializedName = @"recoveryAzureVMName", + PossibleTypes = new [] { typeof(string) })] + string RecoveryAzureVMName { get; set; } + /// The Recovery Azure VM size. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Recovery Azure VM size.", + SerializedName = @"recoveryAzureVMSize", + PossibleTypes = new [] { typeof(string) })] + string RecoveryAzureVMSize { get; set; } + /// The replica id of the protected item. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The replica id of the protected item.", + SerializedName = @"replicaId", + PossibleTypes = new [] { typeof(string) })] + string ReplicaId { get; set; } + /// The resync progress percentage. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The resync progress percentage.", + SerializedName = @"resyncProgressPercentage", + PossibleTypes = new [] { typeof(int) })] + int? ResyncProgressPercentage { get; set; } + /// The RPO in seconds. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The RPO in seconds.", + SerializedName = @"rpoInSeconds", + PossibleTypes = new [] { typeof(long) })] + long? RpoInSecond { get; set; } + /// The tags for the seed managed disks. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The tags for the seed managed disks.", + SerializedName = @"seedManagedDiskTags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsSeedManagedDiskTags) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsSeedManagedDiskTags SeedManagedDiskTag { get; set; } + /// The selected recovery azure network Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The selected recovery azure network Id.", + SerializedName = @"selectedRecoveryAzureNetworkId", + PossibleTypes = new [] { typeof(string) })] + string SelectedRecoveryAzureNetworkId { get; set; } + /// + /// The selected source nic Id which will be used as the primary nic during failover. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The selected source nic Id which will be used as the primary nic during failover.", + SerializedName = @"selectedSourceNicId", + PossibleTypes = new [] { typeof(string) })] + string SelectedSourceNicId { get; set; } + /// The test failover virtual network. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The test failover virtual network.", + SerializedName = @"selectedTfoAzureNetworkId", + PossibleTypes = new [] { typeof(string) })] + string SelectedTfoAzureNetworkId { get; set; } + /// The CPU count of the VM on the primary side. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The CPU count of the VM on the primary side.", + SerializedName = @"sourceVmCpuCount", + PossibleTypes = new [] { typeof(int) })] + int? SourceVMCpuCount { get; set; } + /// The RAM size of the VM on the primary side. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The RAM size of the VM on the primary side.", + SerializedName = @"sourceVmRamSizeInMB", + PossibleTypes = new [] { typeof(int) })] + int? SourceVMRamSizeInMb { get; set; } + /// The SQL Server license type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The SQL Server license type.", + SerializedName = @"sqlServerLicenseType", + PossibleTypes = new [] { typeof(string) })] + string SqlServerLicenseType { get; set; } + /// The switch provider blocking error information. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The switch provider blocking error information.", + SerializedName = @"switchProviderBlockingErrorDetails", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderBlockingErrorDetails) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderBlockingErrorDetails[] SwitchProviderBlockingErrorDetail { get; set; } + /// The target appliance Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The target appliance Id.", + SerializedName = @"targetApplianceId", + PossibleTypes = new [] { typeof(string) })] + string SwitchProviderDetailTargetApplianceId { get; } + /// The target fabric Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The target fabric Id.", + SerializedName = @"targetFabricId", + PossibleTypes = new [] { typeof(string) })] + string SwitchProviderDetailTargetFabricId { get; } + /// The target resource Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The target resource Id.", + SerializedName = @"targetResourceId", + PossibleTypes = new [] { typeof(string) })] + string SwitchProviderDetailTargetResourceId { get; } + /// The target vault Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The target vault Id.", + SerializedName = @"targetVaultId", + PossibleTypes = new [] { typeof(string) })] + string SwitchProviderDetailTargetVaultId { get; } + /// The target availability zone. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target availability zone.", + SerializedName = @"targetAvailabilityZone", + PossibleTypes = new [] { typeof(string) })] + string TargetAvailabilityZone { get; set; } + /// The tags for the target managed disks. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The tags for the target managed disks.", + SerializedName = @"targetManagedDiskTags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsTargetManagedDiskTags) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsTargetManagedDiskTags TargetManagedDiskTag { get; set; } + /// The tags for the target NICs. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The tags for the target NICs.", + SerializedName = @"targetNicTags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsTargetNicTags) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsTargetNicTags TargetNicTag { get; set; } + /// The target proximity placement group Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target proximity placement group Id.", + SerializedName = @"targetProximityPlacementGroupId", + PossibleTypes = new [] { typeof(string) })] + string TargetProximityPlacementGroupId { get; set; } + /// + /// 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. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"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.", + SerializedName = @"targetVmId", + PossibleTypes = new [] { typeof(string) })] + string TargetVMId { get; set; } + /// The target VM tags. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target VM tags.", + SerializedName = @"targetVmTags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsTargetVMTags) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsTargetVMTags TargetVMTag { get; set; } + /// The total transferred data in bytes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The total transferred data in bytes.", + SerializedName = @"totalDataTransferred", + PossibleTypes = new [] { typeof(long) })] + long? TotalDataTransferred { get; set; } + /// The progress health. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The progress health.", + SerializedName = @"totalProgressHealth", + PossibleTypes = new [] { typeof(string) })] + string TotalProgressHealth { get; set; } + /// The uncompressed data change rate in MB. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The uncompressed data change rate in MB.", + SerializedName = @"uncompressedDataRateInMB", + PossibleTypes = new [] { typeof(double) })] + double? UncompressedDataRateInMb { get; set; } + /// A value indicating whether managed disks should be used during failover. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether managed disks should be used during failover.", + SerializedName = @"useManagedDisks", + PossibleTypes = new [] { typeof(string) })] + string UseManagedDisk { get; set; } + /// The vCenter infrastructure Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The vCenter infrastructure Id.", + SerializedName = @"vCenterInfrastructureId", + PossibleTypes = new [] { typeof(string) })] + string VCenterInfrastructureId { get; set; } + /// The virtual machine Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The virtual machine Id.", + SerializedName = @"vmId", + PossibleTypes = new [] { typeof(string) })] + string VMId { get; set; } + /// The PE Network details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The PE Network details.", + SerializedName = @"vmNics", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetails) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetails[] VMNic { get; set; } + /// The protection state for the vm. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The protection state for the vm.", + SerializedName = @"vmProtectionState", + PossibleTypes = new [] { typeof(string) })] + string VMProtectionState { get; set; } + /// The protection state description for the vm. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The protection state description for the vm.", + SerializedName = @"vmProtectionStateDescription", + PossibleTypes = new [] { typeof(string) })] + string VMProtectionStateDescription { get; set; } + /// + /// The validation errors of the on-premise machine Value can be list of validation errors. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The validation errors of the on-premise machine Value can be list of validation errors.", + SerializedName = @"validationErrors", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] ValidationError { get; set; } + /// The OS disk VHD name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The OS disk VHD name.", + SerializedName = @"vhdName", + PossibleTypes = new [] { typeof(string) })] + string VhdName { get; set; } + + } + /// InMageAzureV2 provider specific settings. + internal partial interface IInMageAzureV2ReplicationDetailsInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettingsInternal + { + /// Agent expiry date. + global::System.DateTime? AgentExpiryDate { get; set; } + /// The agent version. + string AgentVersion { get; set; } + /// Azure VM Disk details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureVMDiskDetails[] AzureVMDiskDetail { get; set; } + /// The target generation for this protected item. + string AzureVMGeneration { get; set; } + /// The compressed data change rate in MB. + double? CompressedDataRateInMb { get; set; } + /// + /// The datastores of the on-premise machine. Value can be list of strings that contain datastore names. + /// + string[] Datastore { get; set; } + /// + /// A value indicating the discovery type of the machine. Value can be vCenter or physical. + /// + string DiscoveryType { get; set; } + /// A value indicating whether any disk is resized for this VM. + string DiskResized { get; set; } + /// + /// The selected option to enable RDP\SSH on target vm after failover. String value of SrsDataContract.EnableRDPOnTargetOption + /// enum. + /// + string EnableRdpOnTargetOption { get; set; } + /// The firmware type of this protected item. + string FirmwareType { get; set; } + /// The source IP address. + string IPAddress { get; set; } + /// The infrastructure VM Id. + string InfrastructureVMId { get; set; } + /// A value indicating whether additional IR stats are available or not. + bool? IsAdditionalStatsAvailable { get; set; } + /// A value indicating whether installed agent needs to be updated. + string IsAgentUpdateRequired { get; set; } + /// A value indicating whether the source server requires a restart after update. + string IsRebootAfterUpdateRequired { get; set; } + /// The last heartbeat received from the source server. + global::System.DateTime? LastHeartbeat { get; set; } + /// The last recovery point received time. + global::System.DateTime? LastRecoveryPointReceived { get; set; } + /// The last RPO calculated time. + global::System.DateTime? LastRpoCalculatedTime { get; set; } + /// The last update time received from on-prem components. + global::System.DateTime? LastUpdateReceivedTime { get; set; } + /// License Type of the VM to be used. + string LicenseType { get; set; } + /// The master target Id. + string MasterTargetId { get; set; } + /// The multi vm group Id. + string MultiVMGroupId { get; set; } + /// The multi vm group name. + string MultiVMGroupName { get; set; } + /// A value indicating whether multi vm sync is enabled or disabled. + string MultiVMSyncStatus { get; set; } + /// The id of the disk containing the OS. + string OSDiskId { get; set; } + /// The type of the OS on the VM. + string OSType { get; set; } + /// The OS Version of the protected item. + string OSVersion { get; set; } + /// The process server Id. + string ProcessServerId { get; set; } + /// The process server name. + string ProcessServerName { get; set; } + /// The list of protected disks. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetails[] ProtectedDisk { get; set; } + /// The list of protected managed disks. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ManagedDiskDetails[] ProtectedManagedDisk { get; set; } + /// The protection stage. + string ProtectionStage { get; set; } + /// The recovery availability set Id. + string RecoveryAvailabilitySetId { get; set; } + /// + /// 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. + /// + string RecoveryAzureLogStorageAccountId { get; set; } + /// The target resource group Id. + string RecoveryAzureResourceGroupId { get; set; } + /// The recovery Azure storage account. + string RecoveryAzureStorageAccount { get; set; } + /// Recovery Azure given name. + string RecoveryAzureVMName { get; set; } + /// The Recovery Azure VM size. + string RecoveryAzureVMSize { get; set; } + /// The replica id of the protected item. + string ReplicaId { get; set; } + /// The resync progress percentage. + int? ResyncProgressPercentage { get; set; } + /// The RPO in seconds. + long? RpoInSecond { get; set; } + /// The tags for the seed managed disks. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsSeedManagedDiskTags SeedManagedDiskTag { get; set; } + /// The selected recovery azure network Id. + string SelectedRecoveryAzureNetworkId { get; set; } + /// + /// The selected source nic Id which will be used as the primary nic during failover. + /// + string SelectedSourceNicId { get; set; } + /// The test failover virtual network. + string SelectedTfoAzureNetworkId { get; set; } + /// The CPU count of the VM on the primary side. + int? SourceVMCpuCount { get; set; } + /// The RAM size of the VM on the primary side. + int? SourceVMRamSizeInMb { get; set; } + /// The SQL Server license type. + string SqlServerLicenseType { get; set; } + /// The switch provider blocking error information. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderBlockingErrorDetails[] SwitchProviderBlockingErrorDetail { get; set; } + /// The switch provider blocking error information. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderDetails SwitchProviderDetail { get; set; } + /// The target appliance Id. + string SwitchProviderDetailTargetApplianceId { get; set; } + /// The target fabric Id. + string SwitchProviderDetailTargetFabricId { get; set; } + /// The target resource Id. + string SwitchProviderDetailTargetResourceId { get; set; } + /// The target vault Id. + string SwitchProviderDetailTargetVaultId { get; set; } + /// The target availability zone. + string TargetAvailabilityZone { get; set; } + /// The tags for the target managed disks. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsTargetManagedDiskTags TargetManagedDiskTag { get; set; } + /// The tags for the target NICs. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsTargetNicTags TargetNicTag { get; set; } + /// The target proximity placement group Id. + string TargetProximityPlacementGroupId { get; set; } + /// + /// 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. + /// + string TargetVMId { get; set; } + /// The target VM tags. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsTargetVMTags TargetVMTag { get; set; } + /// The total transferred data in bytes. + long? TotalDataTransferred { get; set; } + /// The progress health. + string TotalProgressHealth { get; set; } + /// The uncompressed data change rate in MB. + double? UncompressedDataRateInMb { get; set; } + /// A value indicating whether managed disks should be used during failover. + string UseManagedDisk { get; set; } + /// The vCenter infrastructure Id. + string VCenterInfrastructureId { get; set; } + /// The virtual machine Id. + string VMId { get; set; } + /// The PE Network details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetails[] VMNic { get; set; } + /// The protection state for the vm. + string VMProtectionState { get; set; } + /// The protection state description for the vm. + string VMProtectionStateDescription { get; set; } + /// + /// The validation errors of the on-premise machine Value can be list of validation errors. + /// + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] ValidationError { get; set; } + /// The OS disk VHD name. + string VhdName { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ReplicationDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ReplicationDetails.json.cs new file mode 100644 index 000000000000..a4000c019c36 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ReplicationDetails.json.cs @@ -0,0 +1,301 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMageAzureV2 provider specific settings. + public partial class InMageAzureV2ReplicationDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new InMageAzureV2ReplicationDetails(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal InMageAzureV2ReplicationDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __replicationProviderSpecificSettings = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProviderSpecificSettings(json); + {_switchProviderDetail = If( json?.PropertyT("switchProviderDetails"), out var __jsonSwitchProviderDetails) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2SwitchProviderDetails.FromJson(__jsonSwitchProviderDetails) : SwitchProviderDetail;} + {_infrastructureVMId = If( json?.PropertyT("infrastructureVmId"), out var __jsonInfrastructureVMId) ? (string)__jsonInfrastructureVMId : (string)InfrastructureVMId;} + {_vCenterInfrastructureId = If( json?.PropertyT("vCenterInfrastructureId"), out var __jsonVCenterInfrastructureId) ? (string)__jsonVCenterInfrastructureId : (string)VCenterInfrastructureId;} + {_protectionStage = If( json?.PropertyT("protectionStage"), out var __jsonProtectionStage) ? (string)__jsonProtectionStage : (string)ProtectionStage;} + {_vMId = If( json?.PropertyT("vmId"), out var __jsonVMId) ? (string)__jsonVMId : (string)VMId;} + {_vMProtectionState = If( json?.PropertyT("vmProtectionState"), out var __jsonVMProtectionState) ? (string)__jsonVMProtectionState : (string)VMProtectionState;} + {_vMProtectionStateDescription = If( json?.PropertyT("vmProtectionStateDescription"), out var __jsonVMProtectionStateDescription) ? (string)__jsonVMProtectionStateDescription : (string)VMProtectionStateDescription;} + {_resyncProgressPercentage = If( json?.PropertyT("resyncProgressPercentage"), out var __jsonResyncProgressPercentage) ? (int?)__jsonResyncProgressPercentage : ResyncProgressPercentage;} + {_rpoInSecond = If( json?.PropertyT("rpoInSeconds"), out var __jsonRpoInSeconds) ? (long?)__jsonRpoInSeconds : RpoInSecond;} + {_compressedDataRateInMb = If( json?.PropertyT("compressedDataRateInMB"), out var __jsonCompressedDataRateInMb) ? (double?)__jsonCompressedDataRateInMb : CompressedDataRateInMb;} + {_uncompressedDataRateInMb = If( json?.PropertyT("uncompressedDataRateInMB"), out var __jsonUncompressedDataRateInMb) ? (double?)__jsonUncompressedDataRateInMb : UncompressedDataRateInMb;} + {_iPAddress = If( json?.PropertyT("ipAddress"), out var __jsonIPAddress) ? (string)__jsonIPAddress : (string)IPAddress;} + {_agentVersion = If( json?.PropertyT("agentVersion"), out var __jsonAgentVersion) ? (string)__jsonAgentVersion : (string)AgentVersion;} + {_agentExpiryDate = If( json?.PropertyT("agentExpiryDate"), out var __jsonAgentExpiryDate) ? global::System.DateTime.TryParse((string)__jsonAgentExpiryDate, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonAgentExpiryDateValue) ? __jsonAgentExpiryDateValue : AgentExpiryDate : AgentExpiryDate;} + {_isAgentUpdateRequired = If( json?.PropertyT("isAgentUpdateRequired"), out var __jsonIsAgentUpdateRequired) ? (string)__jsonIsAgentUpdateRequired : (string)IsAgentUpdateRequired;} + {_isRebootAfterUpdateRequired = If( json?.PropertyT("isRebootAfterUpdateRequired"), out var __jsonIsRebootAfterUpdateRequired) ? (string)__jsonIsRebootAfterUpdateRequired : (string)IsRebootAfterUpdateRequired;} + {_lastHeartbeat = If( json?.PropertyT("lastHeartbeat"), out var __jsonLastHeartbeat) ? global::System.DateTime.TryParse((string)__jsonLastHeartbeat, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonLastHeartbeatValue) ? __jsonLastHeartbeatValue : LastHeartbeat : LastHeartbeat;} + {_processServerId = If( json?.PropertyT("processServerId"), out var __jsonProcessServerId) ? (string)__jsonProcessServerId : (string)ProcessServerId;} + {_processServerName = If( json?.PropertyT("processServerName"), out var __jsonProcessServerName) ? (string)__jsonProcessServerName : (string)ProcessServerName;} + {_multiVMGroupId = If( json?.PropertyT("multiVmGroupId"), out var __jsonMultiVMGroupId) ? (string)__jsonMultiVMGroupId : (string)MultiVMGroupId;} + {_multiVMGroupName = If( json?.PropertyT("multiVmGroupName"), out var __jsonMultiVMGroupName) ? (string)__jsonMultiVMGroupName : (string)MultiVMGroupName;} + {_multiVMSyncStatus = If( json?.PropertyT("multiVmSyncStatus"), out var __jsonMultiVMSyncStatus) ? (string)__jsonMultiVMSyncStatus : (string)MultiVMSyncStatus;} + {_protectedDisk = If( json?.PropertyT("protectedDisks"), out var __jsonProtectedDisks) ? If( __jsonProtectedDisks as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ProtectedDiskDetails) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2ProtectedDiskDetails.FromJson(__u) )) ))() : null : ProtectedDisk;} + {_diskResized = If( json?.PropertyT("diskResized"), out var __jsonDiskResized) ? (string)__jsonDiskResized : (string)DiskResized;} + {_masterTargetId = If( json?.PropertyT("masterTargetId"), out var __jsonMasterTargetId) ? (string)__jsonMasterTargetId : (string)MasterTargetId;} + {_sourceVMCpuCount = If( json?.PropertyT("sourceVmCpuCount"), out var __jsonSourceVMCpuCount) ? (int?)__jsonSourceVMCpuCount : SourceVMCpuCount;} + {_sourceVMRamSizeInMb = If( json?.PropertyT("sourceVmRamSizeInMB"), out var __jsonSourceVMRamSizeInMb) ? (int?)__jsonSourceVMRamSizeInMb : SourceVMRamSizeInMb;} + {_oSType = If( json?.PropertyT("osType"), out var __jsonOSType) ? (string)__jsonOSType : (string)OSType;} + {_vhdName = If( json?.PropertyT("vhdName"), out var __jsonVhdName) ? (string)__jsonVhdName : (string)VhdName;} + {_oSDiskId = If( json?.PropertyT("osDiskId"), out var __jsonOSDiskId) ? (string)__jsonOSDiskId : (string)OSDiskId;} + {_azureVMDiskDetail = If( json?.PropertyT("azureVMDiskDetails"), out var __jsonAzureVMDiskDetails) ? If( __jsonAzureVMDiskDetails as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __q) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__q, (__p)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAzureVMDiskDetails) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AzureVMDiskDetails.FromJson(__p) )) ))() : null : AzureVMDiskDetail;} + {_recoveryAzureVMName = If( json?.PropertyT("recoveryAzureVMName"), out var __jsonRecoveryAzureVMName) ? (string)__jsonRecoveryAzureVMName : (string)RecoveryAzureVMName;} + {_recoveryAzureVMSize = If( json?.PropertyT("recoveryAzureVMSize"), out var __jsonRecoveryAzureVMSize) ? (string)__jsonRecoveryAzureVMSize : (string)RecoveryAzureVMSize;} + {_recoveryAzureStorageAccount = If( json?.PropertyT("recoveryAzureStorageAccount"), out var __jsonRecoveryAzureStorageAccount) ? (string)__jsonRecoveryAzureStorageAccount : (string)RecoveryAzureStorageAccount;} + {_recoveryAzureLogStorageAccountId = If( json?.PropertyT("recoveryAzureLogStorageAccountId"), out var __jsonRecoveryAzureLogStorageAccountId) ? (string)__jsonRecoveryAzureLogStorageAccountId : (string)RecoveryAzureLogStorageAccountId;} + {_vMNic = If( json?.PropertyT("vmNics"), out var __jsonVMNics) ? If( __jsonVMNics as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __l) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__l, (__k)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetails) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMNicDetails.FromJson(__k) )) ))() : null : VMNic;} + {_selectedRecoveryAzureNetworkId = If( json?.PropertyT("selectedRecoveryAzureNetworkId"), out var __jsonSelectedRecoveryAzureNetworkId) ? (string)__jsonSelectedRecoveryAzureNetworkId : (string)SelectedRecoveryAzureNetworkId;} + {_selectedTfoAzureNetworkId = If( json?.PropertyT("selectedTfoAzureNetworkId"), out var __jsonSelectedTfoAzureNetworkId) ? (string)__jsonSelectedTfoAzureNetworkId : (string)SelectedTfoAzureNetworkId;} + {_selectedSourceNicId = If( json?.PropertyT("selectedSourceNicId"), out var __jsonSelectedSourceNicId) ? (string)__jsonSelectedSourceNicId : (string)SelectedSourceNicId;} + {_discoveryType = If( json?.PropertyT("discoveryType"), out var __jsonDiscoveryType) ? (string)__jsonDiscoveryType : (string)DiscoveryType;} + {_enableRdpOnTargetOption = If( json?.PropertyT("enableRdpOnTargetOption"), out var __jsonEnableRdpOnTargetOption) ? (string)__jsonEnableRdpOnTargetOption : (string)EnableRdpOnTargetOption;} + {_datastore = If( json?.PropertyT("datastores"), out var __jsonDatastores) ? If( __jsonDatastores as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __g) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__g, (__f)=>(string) (__f is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString __e ? (string)(__e.ToString()) : null)) ))() : null : Datastore;} + {_targetVMId = If( json?.PropertyT("targetVmId"), out var __jsonTargetVMId) ? (string)__jsonTargetVMId : (string)TargetVMId;} + {_recoveryAzureResourceGroupId = If( json?.PropertyT("recoveryAzureResourceGroupId"), out var __jsonRecoveryAzureResourceGroupId) ? (string)__jsonRecoveryAzureResourceGroupId : (string)RecoveryAzureResourceGroupId;} + {_recoveryAvailabilitySetId = If( json?.PropertyT("recoveryAvailabilitySetId"), out var __jsonRecoveryAvailabilitySetId) ? (string)__jsonRecoveryAvailabilitySetId : (string)RecoveryAvailabilitySetId;} + {_targetAvailabilityZone = If( json?.PropertyT("targetAvailabilityZone"), out var __jsonTargetAvailabilityZone) ? (string)__jsonTargetAvailabilityZone : (string)TargetAvailabilityZone;} + {_targetProximityPlacementGroupId = If( json?.PropertyT("targetProximityPlacementGroupId"), out var __jsonTargetProximityPlacementGroupId) ? (string)__jsonTargetProximityPlacementGroupId : (string)TargetProximityPlacementGroupId;} + {_useManagedDisk = If( json?.PropertyT("useManagedDisks"), out var __jsonUseManagedDisks) ? (string)__jsonUseManagedDisks : (string)UseManagedDisk;} + {_licenseType = If( json?.PropertyT("licenseType"), out var __jsonLicenseType) ? (string)__jsonLicenseType : (string)LicenseType;} + {_sqlServerLicenseType = If( json?.PropertyT("sqlServerLicenseType"), out var __jsonSqlServerLicenseType) ? (string)__jsonSqlServerLicenseType : (string)SqlServerLicenseType;} + {_validationError = If( json?.PropertyT("validationErrors"), out var __jsonValidationErrors) ? If( __jsonValidationErrors as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __b) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__b, (__a)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthError.FromJson(__a) )) ))() : null : ValidationError;} + {_lastRpoCalculatedTime = If( json?.PropertyT("lastRpoCalculatedTime"), out var __jsonLastRpoCalculatedTime) ? global::System.DateTime.TryParse((string)__jsonLastRpoCalculatedTime, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonLastRpoCalculatedTimeValue) ? __jsonLastRpoCalculatedTimeValue : LastRpoCalculatedTime : LastRpoCalculatedTime;} + {_lastUpdateReceivedTime = If( json?.PropertyT("lastUpdateReceivedTime"), out var __jsonLastUpdateReceivedTime) ? global::System.DateTime.TryParse((string)__jsonLastUpdateReceivedTime, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonLastUpdateReceivedTimeValue) ? __jsonLastUpdateReceivedTimeValue : LastUpdateReceivedTime : LastUpdateReceivedTime;} + {_replicaId = If( json?.PropertyT("replicaId"), out var __jsonReplicaId) ? (string)__jsonReplicaId : (string)ReplicaId;} + {_oSVersion = If( json?.PropertyT("osVersion"), out var __jsonOSVersion) ? (string)__jsonOSVersion : (string)OSVersion;} + {_protectedManagedDisk = If( json?.PropertyT("protectedManagedDisks"), out var __jsonProtectedManagedDisks) ? If( __jsonProtectedManagedDisks as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var ___w) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(___w, (___v)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ManagedDiskDetails) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2ManagedDiskDetails.FromJson(___v) )) ))() : null : ProtectedManagedDisk;} + {_lastRecoveryPointReceived = If( json?.PropertyT("lastRecoveryPointReceived"), out var __jsonLastRecoveryPointReceived) ? global::System.DateTime.TryParse((string)__jsonLastRecoveryPointReceived, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonLastRecoveryPointReceivedValue) ? __jsonLastRecoveryPointReceivedValue : LastRecoveryPointReceived : LastRecoveryPointReceived;} + {_firmwareType = If( json?.PropertyT("firmwareType"), out var __jsonFirmwareType) ? (string)__jsonFirmwareType : (string)FirmwareType;} + {_azureVMGeneration = If( json?.PropertyT("azureVmGeneration"), out var __jsonAzureVMGeneration) ? (string)__jsonAzureVMGeneration : (string)AzureVMGeneration;} + {_isAdditionalStatsAvailable = If( json?.PropertyT("isAdditionalStatsAvailable"), out var __jsonIsAdditionalStatsAvailable) ? (bool?)__jsonIsAdditionalStatsAvailable : IsAdditionalStatsAvailable;} + {_totalDataTransferred = If( json?.PropertyT("totalDataTransferred"), out var __jsonTotalDataTransferred) ? (long?)__jsonTotalDataTransferred : TotalDataTransferred;} + {_totalProgressHealth = If( json?.PropertyT("totalProgressHealth"), out var __jsonTotalProgressHealth) ? (string)__jsonTotalProgressHealth : (string)TotalProgressHealth;} + {_targetVMTag = If( json?.PropertyT("targetVmTags"), out var __jsonTargetVMTags) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2ReplicationDetailsTargetVMTags.FromJson(__jsonTargetVMTags) : TargetVMTag;} + {_seedManagedDiskTag = If( json?.PropertyT("seedManagedDiskTags"), out var __jsonSeedManagedDiskTags) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2ReplicationDetailsSeedManagedDiskTags.FromJson(__jsonSeedManagedDiskTags) : SeedManagedDiskTag;} + {_targetManagedDiskTag = If( json?.PropertyT("targetManagedDiskTags"), out var __jsonTargetManagedDiskTags) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2ReplicationDetailsTargetManagedDiskTags.FromJson(__jsonTargetManagedDiskTags) : TargetManagedDiskTag;} + {_targetNicTag = If( json?.PropertyT("targetNicTags"), out var __jsonTargetNicTags) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2ReplicationDetailsTargetNicTags.FromJson(__jsonTargetNicTags) : TargetNicTag;} + {_switchProviderBlockingErrorDetail = If( json?.PropertyT("switchProviderBlockingErrorDetails"), out var __jsonSwitchProviderBlockingErrorDetails) ? If( __jsonSwitchProviderBlockingErrorDetails as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var ___r) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(___r, (___q)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderBlockingErrorDetails) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2SwitchProviderBlockingErrorDetails.FromJson(___q) )) ))() : null : SwitchProviderBlockingErrorDetail;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __replicationProviderSpecificSettings?.ToJson(container, serializationMode); + AddIf( null != this._switchProviderDetail ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._switchProviderDetail.ToJson(null,serializationMode) : null, "switchProviderDetails" ,container.Add ); + AddIf( null != (((object)this._infrastructureVMId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._infrastructureVMId.ToString()) : null, "infrastructureVmId" ,container.Add ); + AddIf( null != (((object)this._vCenterInfrastructureId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._vCenterInfrastructureId.ToString()) : null, "vCenterInfrastructureId" ,container.Add ); + AddIf( null != (((object)this._protectionStage)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._protectionStage.ToString()) : null, "protectionStage" ,container.Add ); + AddIf( null != (((object)this._vMId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._vMId.ToString()) : null, "vmId" ,container.Add ); + AddIf( null != (((object)this._vMProtectionState)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._vMProtectionState.ToString()) : null, "vmProtectionState" ,container.Add ); + AddIf( null != (((object)this._vMProtectionStateDescription)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._vMProtectionStateDescription.ToString()) : null, "vmProtectionStateDescription" ,container.Add ); + AddIf( null != this._resyncProgressPercentage ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._resyncProgressPercentage) : null, "resyncProgressPercentage" ,container.Add ); + AddIf( null != this._rpoInSecond ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((long)this._rpoInSecond) : null, "rpoInSeconds" ,container.Add ); + AddIf( null != this._compressedDataRateInMb ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((double)this._compressedDataRateInMb) : null, "compressedDataRateInMB" ,container.Add ); + AddIf( null != this._uncompressedDataRateInMb ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((double)this._uncompressedDataRateInMb) : null, "uncompressedDataRateInMB" ,container.Add ); + AddIf( null != (((object)this._iPAddress)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._iPAddress.ToString()) : null, "ipAddress" ,container.Add ); + AddIf( null != (((object)this._agentVersion)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._agentVersion.ToString()) : null, "agentVersion" ,container.Add ); + AddIf( null != this._agentExpiryDate ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._agentExpiryDate?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "agentExpiryDate" ,container.Add ); + AddIf( null != (((object)this._isAgentUpdateRequired)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._isAgentUpdateRequired.ToString()) : null, "isAgentUpdateRequired" ,container.Add ); + AddIf( null != (((object)this._isRebootAfterUpdateRequired)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._isRebootAfterUpdateRequired.ToString()) : null, "isRebootAfterUpdateRequired" ,container.Add ); + AddIf( null != this._lastHeartbeat ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._lastHeartbeat?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "lastHeartbeat" ,container.Add ); + AddIf( null != (((object)this._processServerId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._processServerId.ToString()) : null, "processServerId" ,container.Add ); + AddIf( null != (((object)this._processServerName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._processServerName.ToString()) : null, "processServerName" ,container.Add ); + AddIf( null != (((object)this._multiVMGroupId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._multiVMGroupId.ToString()) : null, "multiVmGroupId" ,container.Add ); + AddIf( null != (((object)this._multiVMGroupName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._multiVMGroupName.ToString()) : null, "multiVmGroupName" ,container.Add ); + AddIf( null != (((object)this._multiVMSyncStatus)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._multiVMSyncStatus.ToString()) : null, "multiVmSyncStatus" ,container.Add ); + if (null != this._protectedDisk) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._protectedDisk ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("protectedDisks",__w); + } + AddIf( null != (((object)this._diskResized)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._diskResized.ToString()) : null, "diskResized" ,container.Add ); + AddIf( null != (((object)this._masterTargetId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._masterTargetId.ToString()) : null, "masterTargetId" ,container.Add ); + AddIf( null != this._sourceVMCpuCount ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._sourceVMCpuCount) : null, "sourceVmCpuCount" ,container.Add ); + AddIf( null != this._sourceVMRamSizeInMb ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._sourceVMRamSizeInMb) : null, "sourceVmRamSizeInMB" ,container.Add ); + AddIf( null != (((object)this._oSType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._oSType.ToString()) : null, "osType" ,container.Add ); + AddIf( null != (((object)this._vhdName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._vhdName.ToString()) : null, "vhdName" ,container.Add ); + AddIf( null != (((object)this._oSDiskId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._oSDiskId.ToString()) : null, "osDiskId" ,container.Add ); + if (null != this._azureVMDiskDetail) + { + var __r = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __s in this._azureVMDiskDetail ) + { + AddIf(__s?.ToJson(null, serializationMode) ,__r.Add); + } + container.Add("azureVMDiskDetails",__r); + } + AddIf( null != (((object)this._recoveryAzureVMName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryAzureVMName.ToString()) : null, "recoveryAzureVMName" ,container.Add ); + AddIf( null != (((object)this._recoveryAzureVMSize)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryAzureVMSize.ToString()) : null, "recoveryAzureVMSize" ,container.Add ); + AddIf( null != (((object)this._recoveryAzureStorageAccount)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryAzureStorageAccount.ToString()) : null, "recoveryAzureStorageAccount" ,container.Add ); + AddIf( null != (((object)this._recoveryAzureLogStorageAccountId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryAzureLogStorageAccountId.ToString()) : null, "recoveryAzureLogStorageAccountId" ,container.Add ); + if (null != this._vMNic) + { + var __m = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __n in this._vMNic ) + { + AddIf(__n?.ToJson(null, serializationMode) ,__m.Add); + } + container.Add("vmNics",__m); + } + AddIf( null != (((object)this._selectedRecoveryAzureNetworkId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._selectedRecoveryAzureNetworkId.ToString()) : null, "selectedRecoveryAzureNetworkId" ,container.Add ); + AddIf( null != (((object)this._selectedTfoAzureNetworkId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._selectedTfoAzureNetworkId.ToString()) : null, "selectedTfoAzureNetworkId" ,container.Add ); + AddIf( null != (((object)this._selectedSourceNicId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._selectedSourceNicId.ToString()) : null, "selectedSourceNicId" ,container.Add ); + AddIf( null != (((object)this._discoveryType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._discoveryType.ToString()) : null, "discoveryType" ,container.Add ); + AddIf( null != (((object)this._enableRdpOnTargetOption)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._enableRdpOnTargetOption.ToString()) : null, "enableRdpOnTargetOption" ,container.Add ); + if (null != this._datastore) + { + var __h = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __i in this._datastore ) + { + AddIf(null != (((object)__i)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(__i.ToString()) : null ,__h.Add); + } + container.Add("datastores",__h); + } + AddIf( null != (((object)this._targetVMId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetVMId.ToString()) : null, "targetVmId" ,container.Add ); + AddIf( null != (((object)this._recoveryAzureResourceGroupId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryAzureResourceGroupId.ToString()) : null, "recoveryAzureResourceGroupId" ,container.Add ); + AddIf( null != (((object)this._recoveryAvailabilitySetId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryAvailabilitySetId.ToString()) : null, "recoveryAvailabilitySetId" ,container.Add ); + AddIf( null != (((object)this._targetAvailabilityZone)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetAvailabilityZone.ToString()) : null, "targetAvailabilityZone" ,container.Add ); + AddIf( null != (((object)this._targetProximityPlacementGroupId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetProximityPlacementGroupId.ToString()) : null, "targetProximityPlacementGroupId" ,container.Add ); + AddIf( null != (((object)this._useManagedDisk)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._useManagedDisk.ToString()) : null, "useManagedDisks" ,container.Add ); + AddIf( null != (((object)this._licenseType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._licenseType.ToString()) : null, "licenseType" ,container.Add ); + AddIf( null != (((object)this._sqlServerLicenseType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._sqlServerLicenseType.ToString()) : null, "sqlServerLicenseType" ,container.Add ); + if (null != this._validationError) + { + var __c = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __d in this._validationError ) + { + AddIf(__d?.ToJson(null, serializationMode) ,__c.Add); + } + container.Add("validationErrors",__c); + } + AddIf( null != this._lastRpoCalculatedTime ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._lastRpoCalculatedTime?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "lastRpoCalculatedTime" ,container.Add ); + AddIf( null != this._lastUpdateReceivedTime ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._lastUpdateReceivedTime?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "lastUpdateReceivedTime" ,container.Add ); + AddIf( null != (((object)this._replicaId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._replicaId.ToString()) : null, "replicaId" ,container.Add ); + AddIf( null != (((object)this._oSVersion)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._oSVersion.ToString()) : null, "osVersion" ,container.Add ); + if (null != this._protectedManagedDisk) + { + var ___x = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var ___y in this._protectedManagedDisk ) + { + AddIf(___y?.ToJson(null, serializationMode) ,___x.Add); + } + container.Add("protectedManagedDisks",___x); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._lastRecoveryPointReceived ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._lastRecoveryPointReceived?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "lastRecoveryPointReceived" ,container.Add ); + } + AddIf( null != (((object)this._firmwareType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._firmwareType.ToString()) : null, "firmwareType" ,container.Add ); + AddIf( null != (((object)this._azureVMGeneration)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._azureVMGeneration.ToString()) : null, "azureVmGeneration" ,container.Add ); + AddIf( null != this._isAdditionalStatsAvailable ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonBoolean((bool)this._isAdditionalStatsAvailable) : null, "isAdditionalStatsAvailable" ,container.Add ); + AddIf( null != this._totalDataTransferred ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((long)this._totalDataTransferred) : null, "totalDataTransferred" ,container.Add ); + AddIf( null != (((object)this._totalProgressHealth)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._totalProgressHealth.ToString()) : null, "totalProgressHealth" ,container.Add ); + AddIf( null != this._targetVMTag ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._targetVMTag.ToJson(null,serializationMode) : null, "targetVmTags" ,container.Add ); + AddIf( null != this._seedManagedDiskTag ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._seedManagedDiskTag.ToJson(null,serializationMode) : null, "seedManagedDiskTags" ,container.Add ); + AddIf( null != this._targetManagedDiskTag ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._targetManagedDiskTag.ToJson(null,serializationMode) : null, "targetManagedDiskTags" ,container.Add ); + AddIf( null != this._targetNicTag ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._targetNicTag.ToJson(null,serializationMode) : null, "targetNicTags" ,container.Add ); + if (null != this._switchProviderBlockingErrorDetail) + { + var ___s = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var ___t in this._switchProviderBlockingErrorDetail ) + { + AddIf(___t?.ToJson(null, serializationMode) ,___s.Add); + } + container.Add("switchProviderBlockingErrorDetails",___s); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ReplicationDetailsSeedManagedDiskTags.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ReplicationDetailsSeedManagedDiskTags.PowerShell.cs new file mode 100644 index 000000000000..bf8426edcc43 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ReplicationDetailsSeedManagedDiskTags.PowerShell.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// The tags for the seed managed disks. + [System.ComponentModel.TypeConverter(typeof(InMageAzureV2ReplicationDetailsSeedManagedDiskTagsTypeConverter))] + public partial class InMageAzureV2ReplicationDetailsSeedManagedDiskTags + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsSeedManagedDiskTags DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InMageAzureV2ReplicationDetailsSeedManagedDiskTags(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsSeedManagedDiskTags DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InMageAzureV2ReplicationDetailsSeedManagedDiskTags(content); + } + + /// + /// Creates a new instance of , deserializing the content + /// from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsSeedManagedDiskTags FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InMageAzureV2ReplicationDetailsSeedManagedDiskTags(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InMageAzureV2ReplicationDetailsSeedManagedDiskTags(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// The tags for the seed managed disks. + [System.ComponentModel.TypeConverter(typeof(InMageAzureV2ReplicationDetailsSeedManagedDiskTagsTypeConverter))] + public partial interface IInMageAzureV2ReplicationDetailsSeedManagedDiskTags + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ReplicationDetailsSeedManagedDiskTags.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ReplicationDetailsSeedManagedDiskTags.TypeConverter.cs new file mode 100644 index 000000000000..c1170022c962 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ReplicationDetailsSeedManagedDiskTags.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InMageAzureV2ReplicationDetailsSeedManagedDiskTagsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a + /// type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsSeedManagedDiskTags ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsSeedManagedDiskTags).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InMageAzureV2ReplicationDetailsSeedManagedDiskTags.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InMageAzureV2ReplicationDetailsSeedManagedDiskTags.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InMageAzureV2ReplicationDetailsSeedManagedDiskTags.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ReplicationDetailsSeedManagedDiskTags.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ReplicationDetailsSeedManagedDiskTags.cs new file mode 100644 index 000000000000..b6a0a09457d7 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ReplicationDetailsSeedManagedDiskTags.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The tags for the seed managed disks. + public partial class InMageAzureV2ReplicationDetailsSeedManagedDiskTags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsSeedManagedDiskTags, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsSeedManagedDiskTagsInternal + { + + /// + /// Creates an new instance. + /// + public InMageAzureV2ReplicationDetailsSeedManagedDiskTags() + { + + } + } + /// The tags for the seed managed disks. + public partial interface IInMageAzureV2ReplicationDetailsSeedManagedDiskTags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray + { + + } + /// The tags for the seed managed disks. + internal partial interface IInMageAzureV2ReplicationDetailsSeedManagedDiskTagsInternal + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ReplicationDetailsSeedManagedDiskTags.dictionary.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ReplicationDetailsSeedManagedDiskTags.dictionary.cs new file mode 100644 index 000000000000..0e52b40dc22c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ReplicationDetailsSeedManagedDiskTags.dictionary.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + public partial class InMageAzureV2ReplicationDetailsSeedManagedDiskTags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray + { + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + + int Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Values { get => __additionalProperties.Values; } + + public string this[global::System.String index] { get => __additionalProperties[index]; set => __additionalProperties[index] = value; } + + /// + /// + public void Add(global::System.String key, string value) => __additionalProperties.Add( key, value); + + public void Clear() => __additionalProperties.Clear(); + + /// + public bool ContainsKey(global::System.String key) => __additionalProperties.ContainsKey( key); + + /// + public void CopyFrom(global::System.Collections.IDictionary source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public void CopyFrom(global::System.Management.Automation.PSObject source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public bool Remove(global::System.String key) => __additionalProperties.Remove( key); + + /// + /// + public bool TryGetValue(global::System.String key, out string value) => __additionalProperties.TryGetValue( key, out value); + + /// + + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2ReplicationDetailsSeedManagedDiskTags source) => source.__additionalProperties; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ReplicationDetailsSeedManagedDiskTags.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ReplicationDetailsSeedManagedDiskTags.json.cs new file mode 100644 index 000000000000..5ff4776ddf6a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ReplicationDetailsSeedManagedDiskTags.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The tags for the seed managed disks. + public partial class InMageAzureV2ReplicationDetailsSeedManagedDiskTags + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsSeedManagedDiskTags. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsSeedManagedDiskTags. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsSeedManagedDiskTags FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new InMageAzureV2ReplicationDetailsSeedManagedDiskTags(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + /// + internal InMageAzureV2ReplicationDetailsSeedManagedDiskTags(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, global::System.Collections.Generic.HashSet exclusions = null) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray)this).AdditionalProperties, null ,exclusions ); + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray)this).AdditionalProperties, container); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ReplicationDetailsTargetManagedDiskTags.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ReplicationDetailsTargetManagedDiskTags.PowerShell.cs new file mode 100644 index 000000000000..1eb934fee5ec --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ReplicationDetailsTargetManagedDiskTags.PowerShell.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// The tags for the target managed disks. + [System.ComponentModel.TypeConverter(typeof(InMageAzureV2ReplicationDetailsTargetManagedDiskTagsTypeConverter))] + public partial class InMageAzureV2ReplicationDetailsTargetManagedDiskTags + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsTargetManagedDiskTags DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InMageAzureV2ReplicationDetailsTargetManagedDiskTags(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsTargetManagedDiskTags DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InMageAzureV2ReplicationDetailsTargetManagedDiskTags(content); + } + + /// + /// Creates a new instance of , deserializing the content + /// from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsTargetManagedDiskTags FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InMageAzureV2ReplicationDetailsTargetManagedDiskTags(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InMageAzureV2ReplicationDetailsTargetManagedDiskTags(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// The tags for the target managed disks. + [System.ComponentModel.TypeConverter(typeof(InMageAzureV2ReplicationDetailsTargetManagedDiskTagsTypeConverter))] + public partial interface IInMageAzureV2ReplicationDetailsTargetManagedDiskTags + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ReplicationDetailsTargetManagedDiskTags.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ReplicationDetailsTargetManagedDiskTags.TypeConverter.cs new file mode 100644 index 000000000000..abcb4992e9e1 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ReplicationDetailsTargetManagedDiskTags.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InMageAzureV2ReplicationDetailsTargetManagedDiskTagsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a + /// type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsTargetManagedDiskTags ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsTargetManagedDiskTags).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InMageAzureV2ReplicationDetailsTargetManagedDiskTags.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InMageAzureV2ReplicationDetailsTargetManagedDiskTags.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InMageAzureV2ReplicationDetailsTargetManagedDiskTags.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ReplicationDetailsTargetManagedDiskTags.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ReplicationDetailsTargetManagedDiskTags.cs new file mode 100644 index 000000000000..7769fc5a6225 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ReplicationDetailsTargetManagedDiskTags.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The tags for the target managed disks. + public partial class InMageAzureV2ReplicationDetailsTargetManagedDiskTags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsTargetManagedDiskTags, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsTargetManagedDiskTagsInternal + { + + /// + /// Creates an new instance. + /// + public InMageAzureV2ReplicationDetailsTargetManagedDiskTags() + { + + } + } + /// The tags for the target managed disks. + public partial interface IInMageAzureV2ReplicationDetailsTargetManagedDiskTags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray + { + + } + /// The tags for the target managed disks. + internal partial interface IInMageAzureV2ReplicationDetailsTargetManagedDiskTagsInternal + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ReplicationDetailsTargetManagedDiskTags.dictionary.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ReplicationDetailsTargetManagedDiskTags.dictionary.cs new file mode 100644 index 000000000000..8ad919d2a90d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ReplicationDetailsTargetManagedDiskTags.dictionary.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + public partial class InMageAzureV2ReplicationDetailsTargetManagedDiskTags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray + { + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + + int Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Values { get => __additionalProperties.Values; } + + public string this[global::System.String index] { get => __additionalProperties[index]; set => __additionalProperties[index] = value; } + + /// + /// + public void Add(global::System.String key, string value) => __additionalProperties.Add( key, value); + + public void Clear() => __additionalProperties.Clear(); + + /// + public bool ContainsKey(global::System.String key) => __additionalProperties.ContainsKey( key); + + /// + public void CopyFrom(global::System.Collections.IDictionary source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public void CopyFrom(global::System.Management.Automation.PSObject source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public bool Remove(global::System.String key) => __additionalProperties.Remove( key); + + /// + /// + public bool TryGetValue(global::System.String key, out string value) => __additionalProperties.TryGetValue( key, out value); + + /// + + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2ReplicationDetailsTargetManagedDiskTags source) => source.__additionalProperties; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ReplicationDetailsTargetManagedDiskTags.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ReplicationDetailsTargetManagedDiskTags.json.cs new file mode 100644 index 000000000000..43b4e118cd8f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ReplicationDetailsTargetManagedDiskTags.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The tags for the target managed disks. + public partial class InMageAzureV2ReplicationDetailsTargetManagedDiskTags + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsTargetManagedDiskTags. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsTargetManagedDiskTags. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsTargetManagedDiskTags FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new InMageAzureV2ReplicationDetailsTargetManagedDiskTags(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + /// + internal InMageAzureV2ReplicationDetailsTargetManagedDiskTags(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, global::System.Collections.Generic.HashSet exclusions = null) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray)this).AdditionalProperties, null ,exclusions ); + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray)this).AdditionalProperties, container); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ReplicationDetailsTargetNicTags.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ReplicationDetailsTargetNicTags.PowerShell.cs new file mode 100644 index 000000000000..944a2741e18b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ReplicationDetailsTargetNicTags.PowerShell.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// The tags for the target NICs. + [System.ComponentModel.TypeConverter(typeof(InMageAzureV2ReplicationDetailsTargetNicTagsTypeConverter))] + public partial class InMageAzureV2ReplicationDetailsTargetNicTags + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsTargetNicTags DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InMageAzureV2ReplicationDetailsTargetNicTags(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsTargetNicTags DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InMageAzureV2ReplicationDetailsTargetNicTags(content); + } + + /// + /// Creates a new instance of , deserializing the content from + /// a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsTargetNicTags FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InMageAzureV2ReplicationDetailsTargetNicTags(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InMageAzureV2ReplicationDetailsTargetNicTags(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// The tags for the target NICs. + [System.ComponentModel.TypeConverter(typeof(InMageAzureV2ReplicationDetailsTargetNicTagsTypeConverter))] + public partial interface IInMageAzureV2ReplicationDetailsTargetNicTags + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ReplicationDetailsTargetNicTags.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ReplicationDetailsTargetNicTags.TypeConverter.cs new file mode 100644 index 000000000000..49599670e84e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ReplicationDetailsTargetNicTags.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InMageAzureV2ReplicationDetailsTargetNicTagsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, + /// otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsTargetNicTags ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsTargetNicTags).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InMageAzureV2ReplicationDetailsTargetNicTags.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InMageAzureV2ReplicationDetailsTargetNicTags.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InMageAzureV2ReplicationDetailsTargetNicTags.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ReplicationDetailsTargetNicTags.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ReplicationDetailsTargetNicTags.cs new file mode 100644 index 000000000000..12493a6b809e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ReplicationDetailsTargetNicTags.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The tags for the target NICs. + public partial class InMageAzureV2ReplicationDetailsTargetNicTags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsTargetNicTags, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsTargetNicTagsInternal + { + + /// + /// Creates an new instance. + /// + public InMageAzureV2ReplicationDetailsTargetNicTags() + { + + } + } + /// The tags for the target NICs. + public partial interface IInMageAzureV2ReplicationDetailsTargetNicTags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray + { + + } + /// The tags for the target NICs. + internal partial interface IInMageAzureV2ReplicationDetailsTargetNicTagsInternal + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ReplicationDetailsTargetNicTags.dictionary.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ReplicationDetailsTargetNicTags.dictionary.cs new file mode 100644 index 000000000000..5bf7f95943ed --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ReplicationDetailsTargetNicTags.dictionary.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + public partial class InMageAzureV2ReplicationDetailsTargetNicTags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray + { + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + + int Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Values { get => __additionalProperties.Values; } + + public string this[global::System.String index] { get => __additionalProperties[index]; set => __additionalProperties[index] = value; } + + /// + /// + public void Add(global::System.String key, string value) => __additionalProperties.Add( key, value); + + public void Clear() => __additionalProperties.Clear(); + + /// + public bool ContainsKey(global::System.String key) => __additionalProperties.ContainsKey( key); + + /// + public void CopyFrom(global::System.Collections.IDictionary source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public void CopyFrom(global::System.Management.Automation.PSObject source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public bool Remove(global::System.String key) => __additionalProperties.Remove( key); + + /// + /// + public bool TryGetValue(global::System.String key, out string value) => __additionalProperties.TryGetValue( key, out value); + + /// + + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2ReplicationDetailsTargetNicTags source) => source.__additionalProperties; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ReplicationDetailsTargetNicTags.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ReplicationDetailsTargetNicTags.json.cs new file mode 100644 index 000000000000..58f3ccf9f419 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ReplicationDetailsTargetNicTags.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The tags for the target NICs. + public partial class InMageAzureV2ReplicationDetailsTargetNicTags + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsTargetNicTags. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsTargetNicTags. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsTargetNicTags FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new InMageAzureV2ReplicationDetailsTargetNicTags(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + /// + internal InMageAzureV2ReplicationDetailsTargetNicTags(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, global::System.Collections.Generic.HashSet exclusions = null) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray)this).AdditionalProperties, null ,exclusions ); + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray)this).AdditionalProperties, container); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ReplicationDetailsTargetVMTags.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ReplicationDetailsTargetVMTags.PowerShell.cs new file mode 100644 index 000000000000..f5ead8d9089e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ReplicationDetailsTargetVMTags.PowerShell.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// The target VM tags. + [System.ComponentModel.TypeConverter(typeof(InMageAzureV2ReplicationDetailsTargetVMTagsTypeConverter))] + public partial class InMageAzureV2ReplicationDetailsTargetVMTags + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsTargetVMTags DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InMageAzureV2ReplicationDetailsTargetVMTags(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsTargetVMTags DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InMageAzureV2ReplicationDetailsTargetVMTags(content); + } + + /// + /// Creates a new instance of , deserializing the content from a + /// json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsTargetVMTags FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InMageAzureV2ReplicationDetailsTargetVMTags(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InMageAzureV2ReplicationDetailsTargetVMTags(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// The target VM tags. + [System.ComponentModel.TypeConverter(typeof(InMageAzureV2ReplicationDetailsTargetVMTagsTypeConverter))] + public partial interface IInMageAzureV2ReplicationDetailsTargetVMTags + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ReplicationDetailsTargetVMTags.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ReplicationDetailsTargetVMTags.TypeConverter.cs new file mode 100644 index 000000000000..0f15106332d7 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ReplicationDetailsTargetVMTags.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InMageAzureV2ReplicationDetailsTargetVMTagsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsTargetVMTags ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsTargetVMTags).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InMageAzureV2ReplicationDetailsTargetVMTags.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InMageAzureV2ReplicationDetailsTargetVMTags.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InMageAzureV2ReplicationDetailsTargetVMTags.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ReplicationDetailsTargetVMTags.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ReplicationDetailsTargetVMTags.cs new file mode 100644 index 000000000000..7b30523f1b5c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ReplicationDetailsTargetVMTags.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The target VM tags. + public partial class InMageAzureV2ReplicationDetailsTargetVMTags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsTargetVMTags, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsTargetVMTagsInternal + { + + /// + /// Creates an new instance. + /// + public InMageAzureV2ReplicationDetailsTargetVMTags() + { + + } + } + /// The target VM tags. + public partial interface IInMageAzureV2ReplicationDetailsTargetVMTags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray + { + + } + /// The target VM tags. + internal partial interface IInMageAzureV2ReplicationDetailsTargetVMTagsInternal + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ReplicationDetailsTargetVMTags.dictionary.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ReplicationDetailsTargetVMTags.dictionary.cs new file mode 100644 index 000000000000..045a118c1d31 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ReplicationDetailsTargetVMTags.dictionary.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + public partial class InMageAzureV2ReplicationDetailsTargetVMTags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray + { + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + + int Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Values { get => __additionalProperties.Values; } + + public string this[global::System.String index] { get => __additionalProperties[index]; set => __additionalProperties[index] = value; } + + /// + /// + public void Add(global::System.String key, string value) => __additionalProperties.Add( key, value); + + public void Clear() => __additionalProperties.Clear(); + + /// + public bool ContainsKey(global::System.String key) => __additionalProperties.ContainsKey( key); + + /// + public void CopyFrom(global::System.Collections.IDictionary source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public void CopyFrom(global::System.Management.Automation.PSObject source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public bool Remove(global::System.String key) => __additionalProperties.Remove( key); + + /// + /// + public bool TryGetValue(global::System.String key, out string value) => __additionalProperties.TryGetValue( key, out value); + + /// + + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2ReplicationDetailsTargetVMTags source) => source.__additionalProperties; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ReplicationDetailsTargetVMTags.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ReplicationDetailsTargetVMTags.json.cs new file mode 100644 index 000000000000..6e6534846eee --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ReplicationDetailsTargetVMTags.json.cs @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The target VM tags. + public partial class InMageAzureV2ReplicationDetailsTargetVMTags + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsTargetVMTags. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsTargetVMTags. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReplicationDetailsTargetVMTags FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new InMageAzureV2ReplicationDetailsTargetVMTags(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + /// + internal InMageAzureV2ReplicationDetailsTargetVMTags(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, global::System.Collections.Generic.HashSet exclusions = null) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray)this).AdditionalProperties, null ,exclusions ); + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray)this).AdditionalProperties, container); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ReprotectInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ReprotectInput.PowerShell.cs new file mode 100644 index 000000000000..1a8d5a8750cd --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ReprotectInput.PowerShell.cs @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// InMageAzureV2 specific provider input. + [System.ComponentModel.TypeConverter(typeof(InMageAzureV2ReprotectInputTypeConverter))] + public partial class InMageAzureV2ReprotectInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReprotectInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InMageAzureV2ReprotectInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReprotectInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InMageAzureV2ReprotectInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReprotectInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InMageAzureV2ReprotectInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("MasterTargetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReprotectInputInternal)this).MasterTargetId = (string) content.GetValueForProperty("MasterTargetId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReprotectInputInternal)this).MasterTargetId, global::System.Convert.ToString); + } + if (content.Contains("ProcessServerId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReprotectInputInternal)this).ProcessServerId = (string) content.GetValueForProperty("ProcessServerId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReprotectInputInternal)this).ProcessServerId, global::System.Convert.ToString); + } + if (content.Contains("StorageAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReprotectInputInternal)this).StorageAccountId = (string) content.GetValueForProperty("StorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReprotectInputInternal)this).StorageAccountId, global::System.Convert.ToString); + } + if (content.Contains("RunAsAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReprotectInputInternal)this).RunAsAccountId = (string) content.GetValueForProperty("RunAsAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReprotectInputInternal)this).RunAsAccountId, global::System.Convert.ToString); + } + if (content.Contains("PolicyId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReprotectInputInternal)this).PolicyId = (string) content.GetValueForProperty("PolicyId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReprotectInputInternal)this).PolicyId, global::System.Convert.ToString); + } + if (content.Contains("LogStorageAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReprotectInputInternal)this).LogStorageAccountId = (string) content.GetValueForProperty("LogStorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReprotectInputInternal)this).LogStorageAccountId, global::System.Convert.ToString); + } + if (content.Contains("DisksToInclude")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReprotectInputInternal)this).DisksToInclude = (string[]) content.GetValueForProperty("DisksToInclude",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReprotectInputInternal)this).DisksToInclude, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InMageAzureV2ReprotectInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("MasterTargetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReprotectInputInternal)this).MasterTargetId = (string) content.GetValueForProperty("MasterTargetId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReprotectInputInternal)this).MasterTargetId, global::System.Convert.ToString); + } + if (content.Contains("ProcessServerId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReprotectInputInternal)this).ProcessServerId = (string) content.GetValueForProperty("ProcessServerId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReprotectInputInternal)this).ProcessServerId, global::System.Convert.ToString); + } + if (content.Contains("StorageAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReprotectInputInternal)this).StorageAccountId = (string) content.GetValueForProperty("StorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReprotectInputInternal)this).StorageAccountId, global::System.Convert.ToString); + } + if (content.Contains("RunAsAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReprotectInputInternal)this).RunAsAccountId = (string) content.GetValueForProperty("RunAsAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReprotectInputInternal)this).RunAsAccountId, global::System.Convert.ToString); + } + if (content.Contains("PolicyId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReprotectInputInternal)this).PolicyId = (string) content.GetValueForProperty("PolicyId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReprotectInputInternal)this).PolicyId, global::System.Convert.ToString); + } + if (content.Contains("LogStorageAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReprotectInputInternal)this).LogStorageAccountId = (string) content.GetValueForProperty("LogStorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReprotectInputInternal)this).LogStorageAccountId, global::System.Convert.ToString); + } + if (content.Contains("DisksToInclude")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReprotectInputInternal)this).DisksToInclude = (string[]) content.GetValueForProperty("DisksToInclude",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReprotectInputInternal)this).DisksToInclude, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// InMageAzureV2 specific provider input. + [System.ComponentModel.TypeConverter(typeof(InMageAzureV2ReprotectInputTypeConverter))] + public partial interface IInMageAzureV2ReprotectInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ReprotectInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ReprotectInput.TypeConverter.cs new file mode 100644 index 000000000000..27a693702fa4 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ReprotectInput.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InMageAzureV2ReprotectInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReprotectInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReprotectInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InMageAzureV2ReprotectInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InMageAzureV2ReprotectInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InMageAzureV2ReprotectInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ReprotectInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ReprotectInput.cs new file mode 100644 index 000000000000..7fc3b373ac47 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ReprotectInput.cs @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMageAzureV2 specific provider input. + public partial class InMageAzureV2ReprotectInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReprotectInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReprotectInputInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationProviderSpecificInput __reverseReplicationProviderSpecificInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReverseReplicationProviderSpecificInput(); + + /// Backing field for property. + private string[] _disksToInclude; + + /// The disks to include list. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string[] DisksToInclude { get => this._disksToInclude; set => this._disksToInclude = value; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationProviderSpecificInputInternal)__reverseReplicationProviderSpecificInput).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationProviderSpecificInputInternal)__reverseReplicationProviderSpecificInput).InstanceType = value ; } + + /// Backing field for property. + private string _logStorageAccountId; + + /// The storage account to be used for logging during replication. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string LogStorageAccountId { get => this._logStorageAccountId; set => this._logStorageAccountId = value; } + + /// Backing field for property. + private string _masterTargetId; + + /// The Master target Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string MasterTargetId { get => this._masterTargetId; set => this._masterTargetId = value; } + + /// Backing field for property. + private string _policyId; + + /// The Policy Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string PolicyId { get => this._policyId; set => this._policyId = value; } + + /// Backing field for property. + private string _processServerId; + + /// The Process Server Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ProcessServerId { get => this._processServerId; set => this._processServerId = value; } + + /// Backing field for property. + private string _runAsAccountId; + + /// The CS account Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RunAsAccountId { get => this._runAsAccountId; set => this._runAsAccountId = value; } + + /// Backing field for property. + private string _storageAccountId; + + /// The storage account id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string StorageAccountId { get => this._storageAccountId; set => this._storageAccountId = value; } + + /// Creates an new instance. + public InMageAzureV2ReprotectInput() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__reverseReplicationProviderSpecificInput), __reverseReplicationProviderSpecificInput); + await eventListener.AssertObjectIsValid(nameof(__reverseReplicationProviderSpecificInput), __reverseReplicationProviderSpecificInput); + } + } + /// InMageAzureV2 specific provider input. + public partial interface IInMageAzureV2ReprotectInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationProviderSpecificInput + { + /// The disks to include list. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The disks to include list.", + SerializedName = @"disksToInclude", + PossibleTypes = new [] { typeof(string) })] + string[] DisksToInclude { get; set; } + /// The storage account to be used for logging during replication. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The storage account to be used for logging during replication.", + SerializedName = @"logStorageAccountId", + PossibleTypes = new [] { typeof(string) })] + string LogStorageAccountId { get; set; } + /// The Master target Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Master target Id.", + SerializedName = @"masterTargetId", + PossibleTypes = new [] { typeof(string) })] + string MasterTargetId { get; set; } + /// The Policy Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Policy Id.", + SerializedName = @"policyId", + PossibleTypes = new [] { typeof(string) })] + string PolicyId { get; set; } + /// The Process Server Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Process Server Id.", + SerializedName = @"processServerId", + PossibleTypes = new [] { typeof(string) })] + string ProcessServerId { get; set; } + /// The CS account Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The CS account Id.", + SerializedName = @"runAsAccountId", + PossibleTypes = new [] { typeof(string) })] + string RunAsAccountId { get; set; } + /// The storage account id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The storage account id.", + SerializedName = @"storageAccountId", + PossibleTypes = new [] { typeof(string) })] + string StorageAccountId { get; set; } + + } + /// InMageAzureV2 specific provider input. + internal partial interface IInMageAzureV2ReprotectInputInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationProviderSpecificInputInternal + { + /// The disks to include list. + string[] DisksToInclude { get; set; } + /// The storage account to be used for logging during replication. + string LogStorageAccountId { get; set; } + /// The Master target Id. + string MasterTargetId { get; set; } + /// The Policy Id. + string PolicyId { get; set; } + /// The Process Server Id. + string ProcessServerId { get; set; } + /// The CS account Id. + string RunAsAccountId { get; set; } + /// The storage account id. + string StorageAccountId { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ReprotectInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ReprotectInput.json.cs new file mode 100644 index 000000000000..d91f5c310b80 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2ReprotectInput.json.cs @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMageAzureV2 specific provider input. + public partial class InMageAzureV2ReprotectInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReprotectInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReprotectInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2ReprotectInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new InMageAzureV2ReprotectInput(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal InMageAzureV2ReprotectInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __reverseReplicationProviderSpecificInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReverseReplicationProviderSpecificInput(json); + {_masterTargetId = If( json?.PropertyT("masterTargetId"), out var __jsonMasterTargetId) ? (string)__jsonMasterTargetId : (string)MasterTargetId;} + {_processServerId = If( json?.PropertyT("processServerId"), out var __jsonProcessServerId) ? (string)__jsonProcessServerId : (string)ProcessServerId;} + {_storageAccountId = If( json?.PropertyT("storageAccountId"), out var __jsonStorageAccountId) ? (string)__jsonStorageAccountId : (string)StorageAccountId;} + {_runAsAccountId = If( json?.PropertyT("runAsAccountId"), out var __jsonRunAsAccountId) ? (string)__jsonRunAsAccountId : (string)RunAsAccountId;} + {_policyId = If( json?.PropertyT("policyId"), out var __jsonPolicyId) ? (string)__jsonPolicyId : (string)PolicyId;} + {_logStorageAccountId = If( json?.PropertyT("logStorageAccountId"), out var __jsonLogStorageAccountId) ? (string)__jsonLogStorageAccountId : (string)LogStorageAccountId;} + {_disksToInclude = If( json?.PropertyT("disksToInclude"), out var __jsonDisksToInclude) ? If( __jsonDisksToInclude as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(string) (__u is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : DisksToInclude;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __reverseReplicationProviderSpecificInput?.ToJson(container, serializationMode); + AddIf( null != (((object)this._masterTargetId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._masterTargetId.ToString()) : null, "masterTargetId" ,container.Add ); + AddIf( null != (((object)this._processServerId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._processServerId.ToString()) : null, "processServerId" ,container.Add ); + AddIf( null != (((object)this._storageAccountId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._storageAccountId.ToString()) : null, "storageAccountId" ,container.Add ); + AddIf( null != (((object)this._runAsAccountId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._runAsAccountId.ToString()) : null, "runAsAccountId" ,container.Add ); + AddIf( null != (((object)this._policyId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._policyId.ToString()) : null, "policyId" ,container.Add ); + AddIf( null != (((object)this._logStorageAccountId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._logStorageAccountId.ToString()) : null, "logStorageAccountId" ,container.Add ); + if (null != this._disksToInclude) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._disksToInclude ) + { + AddIf(null != (((object)__x)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(__x.ToString()) : null ,__w.Add); + } + container.Add("disksToInclude",__w); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2SwitchProviderBlockingErrorDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2SwitchProviderBlockingErrorDetails.PowerShell.cs new file mode 100644 index 000000000000..53fe71037d7b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2SwitchProviderBlockingErrorDetails.PowerShell.cs @@ -0,0 +1,189 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// InMageAzureV2 switch provider blocking error details. + [System.ComponentModel.TypeConverter(typeof(InMageAzureV2SwitchProviderBlockingErrorDetailsTypeConverter))] + public partial class InMageAzureV2SwitchProviderBlockingErrorDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderBlockingErrorDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InMageAzureV2SwitchProviderBlockingErrorDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderBlockingErrorDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InMageAzureV2SwitchProviderBlockingErrorDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from + /// a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderBlockingErrorDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InMageAzureV2SwitchProviderBlockingErrorDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ErrorCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderBlockingErrorDetailsInternal)this).ErrorCode = (string) content.GetValueForProperty("ErrorCode",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderBlockingErrorDetailsInternal)this).ErrorCode, global::System.Convert.ToString); + } + if (content.Contains("ErrorMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderBlockingErrorDetailsInternal)this).ErrorMessage = (string) content.GetValueForProperty("ErrorMessage",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderBlockingErrorDetailsInternal)this).ErrorMessage, global::System.Convert.ToString); + } + if (content.Contains("PossibleCaus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderBlockingErrorDetailsInternal)this).PossibleCaus = (string) content.GetValueForProperty("PossibleCaus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderBlockingErrorDetailsInternal)this).PossibleCaus, global::System.Convert.ToString); + } + if (content.Contains("RecommendedAction")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderBlockingErrorDetailsInternal)this).RecommendedAction = (string) content.GetValueForProperty("RecommendedAction",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderBlockingErrorDetailsInternal)this).RecommendedAction, global::System.Convert.ToString); + } + if (content.Contains("ErrorMessageParameter")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderBlockingErrorDetailsInternal)this).ErrorMessageParameter = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderBlockingErrorDetailsErrorMessageParameters) content.GetValueForProperty("ErrorMessageParameter",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderBlockingErrorDetailsInternal)this).ErrorMessageParameter, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2SwitchProviderBlockingErrorDetailsErrorMessageParametersTypeConverter.ConvertFrom); + } + if (content.Contains("ErrorTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderBlockingErrorDetailsInternal)this).ErrorTag = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderBlockingErrorDetailsErrorTags) content.GetValueForProperty("ErrorTag",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderBlockingErrorDetailsInternal)this).ErrorTag, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2SwitchProviderBlockingErrorDetailsErrorTagsTypeConverter.ConvertFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InMageAzureV2SwitchProviderBlockingErrorDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ErrorCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderBlockingErrorDetailsInternal)this).ErrorCode = (string) content.GetValueForProperty("ErrorCode",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderBlockingErrorDetailsInternal)this).ErrorCode, global::System.Convert.ToString); + } + if (content.Contains("ErrorMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderBlockingErrorDetailsInternal)this).ErrorMessage = (string) content.GetValueForProperty("ErrorMessage",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderBlockingErrorDetailsInternal)this).ErrorMessage, global::System.Convert.ToString); + } + if (content.Contains("PossibleCaus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderBlockingErrorDetailsInternal)this).PossibleCaus = (string) content.GetValueForProperty("PossibleCaus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderBlockingErrorDetailsInternal)this).PossibleCaus, global::System.Convert.ToString); + } + if (content.Contains("RecommendedAction")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderBlockingErrorDetailsInternal)this).RecommendedAction = (string) content.GetValueForProperty("RecommendedAction",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderBlockingErrorDetailsInternal)this).RecommendedAction, global::System.Convert.ToString); + } + if (content.Contains("ErrorMessageParameter")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderBlockingErrorDetailsInternal)this).ErrorMessageParameter = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderBlockingErrorDetailsErrorMessageParameters) content.GetValueForProperty("ErrorMessageParameter",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderBlockingErrorDetailsInternal)this).ErrorMessageParameter, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2SwitchProviderBlockingErrorDetailsErrorMessageParametersTypeConverter.ConvertFrom); + } + if (content.Contains("ErrorTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderBlockingErrorDetailsInternal)this).ErrorTag = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderBlockingErrorDetailsErrorTags) content.GetValueForProperty("ErrorTag",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderBlockingErrorDetailsInternal)this).ErrorTag, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2SwitchProviderBlockingErrorDetailsErrorTagsTypeConverter.ConvertFrom); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// InMageAzureV2 switch provider blocking error details. + [System.ComponentModel.TypeConverter(typeof(InMageAzureV2SwitchProviderBlockingErrorDetailsTypeConverter))] + public partial interface IInMageAzureV2SwitchProviderBlockingErrorDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2SwitchProviderBlockingErrorDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2SwitchProviderBlockingErrorDetails.TypeConverter.cs new file mode 100644 index 000000000000..d4d34a0b5914 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2SwitchProviderBlockingErrorDetails.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InMageAzureV2SwitchProviderBlockingErrorDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, + /// otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderBlockingErrorDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderBlockingErrorDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InMageAzureV2SwitchProviderBlockingErrorDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InMageAzureV2SwitchProviderBlockingErrorDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InMageAzureV2SwitchProviderBlockingErrorDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2SwitchProviderBlockingErrorDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2SwitchProviderBlockingErrorDetails.cs new file mode 100644 index 000000000000..3a8d435b3490 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2SwitchProviderBlockingErrorDetails.cs @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMageAzureV2 switch provider blocking error details. + public partial class InMageAzureV2SwitchProviderBlockingErrorDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderBlockingErrorDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderBlockingErrorDetailsInternal + { + + /// Backing field for property. + private string _errorCode; + + /// The error code. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ErrorCode { get => this._errorCode; } + + /// Backing field for property. + private string _errorMessage; + + /// The error message. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ErrorMessage { get => this._errorMessage; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderBlockingErrorDetailsErrorMessageParameters _errorMessageParameter; + + /// The error message parameters. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderBlockingErrorDetailsErrorMessageParameters ErrorMessageParameter { get => (this._errorMessageParameter = this._errorMessageParameter ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2SwitchProviderBlockingErrorDetailsErrorMessageParameters()); } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderBlockingErrorDetailsErrorTags _errorTag; + + /// The error tags. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderBlockingErrorDetailsErrorTags ErrorTag { get => (this._errorTag = this._errorTag ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2SwitchProviderBlockingErrorDetailsErrorTags()); } + + /// Internal Acessors for ErrorCode + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderBlockingErrorDetailsInternal.ErrorCode { get => this._errorCode; set { {_errorCode = value;} } } + + /// Internal Acessors for ErrorMessage + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderBlockingErrorDetailsInternal.ErrorMessage { get => this._errorMessage; set { {_errorMessage = value;} } } + + /// Internal Acessors for ErrorMessageParameter + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderBlockingErrorDetailsErrorMessageParameters Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderBlockingErrorDetailsInternal.ErrorMessageParameter { get => (this._errorMessageParameter = this._errorMessageParameter ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2SwitchProviderBlockingErrorDetailsErrorMessageParameters()); set { {_errorMessageParameter = value;} } } + + /// Internal Acessors for ErrorTag + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderBlockingErrorDetailsErrorTags Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderBlockingErrorDetailsInternal.ErrorTag { get => (this._errorTag = this._errorTag ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2SwitchProviderBlockingErrorDetailsErrorTags()); set { {_errorTag = value;} } } + + /// Internal Acessors for PossibleCaus + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderBlockingErrorDetailsInternal.PossibleCaus { get => this._possibleCaus; set { {_possibleCaus = value;} } } + + /// Internal Acessors for RecommendedAction + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderBlockingErrorDetailsInternal.RecommendedAction { get => this._recommendedAction; set { {_recommendedAction = value;} } } + + /// Backing field for property. + private string _possibleCaus; + + /// The possible causes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string PossibleCaus { get => this._possibleCaus; } + + /// Backing field for property. + private string _recommendedAction; + + /// The recommended action. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecommendedAction { get => this._recommendedAction; } + + /// + /// Creates an new instance. + /// + public InMageAzureV2SwitchProviderBlockingErrorDetails() + { + + } + } + /// InMageAzureV2 switch provider blocking error details. + public partial interface IInMageAzureV2SwitchProviderBlockingErrorDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The error code. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The error code.", + SerializedName = @"errorCode", + PossibleTypes = new [] { typeof(string) })] + string ErrorCode { get; } + /// The error message. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The error message.", + SerializedName = @"errorMessage", + PossibleTypes = new [] { typeof(string) })] + string ErrorMessage { get; } + /// The error message parameters. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The error message parameters.", + SerializedName = @"errorMessageParameters", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderBlockingErrorDetailsErrorMessageParameters) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderBlockingErrorDetailsErrorMessageParameters ErrorMessageParameter { get; } + /// The error tags. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The error tags.", + SerializedName = @"errorTags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderBlockingErrorDetailsErrorTags) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderBlockingErrorDetailsErrorTags ErrorTag { get; } + /// The possible causes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The possible causes.", + SerializedName = @"possibleCauses", + PossibleTypes = new [] { typeof(string) })] + string PossibleCaus { get; } + /// The recommended action. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The recommended action.", + SerializedName = @"recommendedAction", + PossibleTypes = new [] { typeof(string) })] + string RecommendedAction { get; } + + } + /// InMageAzureV2 switch provider blocking error details. + internal partial interface IInMageAzureV2SwitchProviderBlockingErrorDetailsInternal + + { + /// The error code. + string ErrorCode { get; set; } + /// The error message. + string ErrorMessage { get; set; } + /// The error message parameters. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderBlockingErrorDetailsErrorMessageParameters ErrorMessageParameter { get; set; } + /// The error tags. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderBlockingErrorDetailsErrorTags ErrorTag { get; set; } + /// The possible causes. + string PossibleCaus { get; set; } + /// The recommended action. + string RecommendedAction { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2SwitchProviderBlockingErrorDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2SwitchProviderBlockingErrorDetails.json.cs new file mode 100644 index 000000000000..fa26f72e3d35 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2SwitchProviderBlockingErrorDetails.json.cs @@ -0,0 +1,139 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMageAzureV2 switch provider blocking error details. + public partial class InMageAzureV2SwitchProviderBlockingErrorDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderBlockingErrorDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderBlockingErrorDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderBlockingErrorDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new InMageAzureV2SwitchProviderBlockingErrorDetails(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal InMageAzureV2SwitchProviderBlockingErrorDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_errorCode = If( json?.PropertyT("errorCode"), out var __jsonErrorCode) ? (string)__jsonErrorCode : (string)ErrorCode;} + {_errorMessage = If( json?.PropertyT("errorMessage"), out var __jsonErrorMessage) ? (string)__jsonErrorMessage : (string)ErrorMessage;} + {_possibleCaus = If( json?.PropertyT("possibleCauses"), out var __jsonPossibleCauses) ? (string)__jsonPossibleCauses : (string)PossibleCaus;} + {_recommendedAction = If( json?.PropertyT("recommendedAction"), out var __jsonRecommendedAction) ? (string)__jsonRecommendedAction : (string)RecommendedAction;} + {_errorMessageParameter = If( json?.PropertyT("errorMessageParameters"), out var __jsonErrorMessageParameters) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2SwitchProviderBlockingErrorDetailsErrorMessageParameters.FromJson(__jsonErrorMessageParameters) : ErrorMessageParameter;} + {_errorTag = If( json?.PropertyT("errorTags"), out var __jsonErrorTags) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2SwitchProviderBlockingErrorDetailsErrorTags.FromJson(__jsonErrorTags) : ErrorTag;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._errorCode)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._errorCode.ToString()) : null, "errorCode" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._errorMessage)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._errorMessage.ToString()) : null, "errorMessage" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._possibleCaus)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._possibleCaus.ToString()) : null, "possibleCauses" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._recommendedAction)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recommendedAction.ToString()) : null, "recommendedAction" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._errorMessageParameter ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._errorMessageParameter.ToJson(null,serializationMode) : null, "errorMessageParameters" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._errorTag ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._errorTag.ToJson(null,serializationMode) : null, "errorTags" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2SwitchProviderBlockingErrorDetailsErrorMessageParameters.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2SwitchProviderBlockingErrorDetailsErrorMessageParameters.PowerShell.cs new file mode 100644 index 000000000000..fa3762a97d73 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2SwitchProviderBlockingErrorDetailsErrorMessageParameters.PowerShell.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// The error message parameters. + [System.ComponentModel.TypeConverter(typeof(InMageAzureV2SwitchProviderBlockingErrorDetailsErrorMessageParametersTypeConverter))] + public partial class InMageAzureV2SwitchProviderBlockingErrorDetailsErrorMessageParameters + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderBlockingErrorDetailsErrorMessageParameters DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InMageAzureV2SwitchProviderBlockingErrorDetailsErrorMessageParameters(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderBlockingErrorDetailsErrorMessageParameters DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InMageAzureV2SwitchProviderBlockingErrorDetailsErrorMessageParameters(content); + } + + /// + /// Creates a new instance of , deserializing + /// the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderBlockingErrorDetailsErrorMessageParameters FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InMageAzureV2SwitchProviderBlockingErrorDetailsErrorMessageParameters(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InMageAzureV2SwitchProviderBlockingErrorDetailsErrorMessageParameters(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// The error message parameters. + [System.ComponentModel.TypeConverter(typeof(InMageAzureV2SwitchProviderBlockingErrorDetailsErrorMessageParametersTypeConverter))] + public partial interface IInMageAzureV2SwitchProviderBlockingErrorDetailsErrorMessageParameters + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2SwitchProviderBlockingErrorDetailsErrorMessageParameters.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2SwitchProviderBlockingErrorDetailsErrorMessageParameters.TypeConverter.cs new file mode 100644 index 000000000000..2af912455d0f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2SwitchProviderBlockingErrorDetailsErrorMessageParameters.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InMageAzureV2SwitchProviderBlockingErrorDetailsErrorMessageParametersTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if + /// there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if + /// there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderBlockingErrorDetailsErrorMessageParameters ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderBlockingErrorDetailsErrorMessageParameters).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InMageAzureV2SwitchProviderBlockingErrorDetailsErrorMessageParameters.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InMageAzureV2SwitchProviderBlockingErrorDetailsErrorMessageParameters.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InMageAzureV2SwitchProviderBlockingErrorDetailsErrorMessageParameters.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2SwitchProviderBlockingErrorDetailsErrorMessageParameters.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2SwitchProviderBlockingErrorDetailsErrorMessageParameters.cs new file mode 100644 index 000000000000..41a7fd0c186d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2SwitchProviderBlockingErrorDetailsErrorMessageParameters.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The error message parameters. + public partial class InMageAzureV2SwitchProviderBlockingErrorDetailsErrorMessageParameters : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderBlockingErrorDetailsErrorMessageParameters, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderBlockingErrorDetailsErrorMessageParametersInternal + { + + /// + /// Creates an new instance. + /// + public InMageAzureV2SwitchProviderBlockingErrorDetailsErrorMessageParameters() + { + + } + } + /// The error message parameters. + public partial interface IInMageAzureV2SwitchProviderBlockingErrorDetailsErrorMessageParameters : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray + { + + } + /// The error message parameters. + internal partial interface IInMageAzureV2SwitchProviderBlockingErrorDetailsErrorMessageParametersInternal + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2SwitchProviderBlockingErrorDetailsErrorMessageParameters.dictionary.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2SwitchProviderBlockingErrorDetailsErrorMessageParameters.dictionary.cs new file mode 100644 index 000000000000..b04b08f73d69 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2SwitchProviderBlockingErrorDetailsErrorMessageParameters.dictionary.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + public partial class InMageAzureV2SwitchProviderBlockingErrorDetailsErrorMessageParameters : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray + { + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + + int Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Values { get => __additionalProperties.Values; } + + public string this[global::System.String index] { get => __additionalProperties[index]; set => __additionalProperties[index] = value; } + + /// + /// + public void Add(global::System.String key, string value) => __additionalProperties.Add( key, value); + + public void Clear() => __additionalProperties.Clear(); + + /// + public bool ContainsKey(global::System.String key) => __additionalProperties.ContainsKey( key); + + /// + public void CopyFrom(global::System.Collections.IDictionary source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public void CopyFrom(global::System.Management.Automation.PSObject source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public bool Remove(global::System.String key) => __additionalProperties.Remove( key); + + /// + /// + public bool TryGetValue(global::System.String key, out string value) => __additionalProperties.TryGetValue( key, out value); + + /// + + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2SwitchProviderBlockingErrorDetailsErrorMessageParameters source) => source.__additionalProperties; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2SwitchProviderBlockingErrorDetailsErrorMessageParameters.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2SwitchProviderBlockingErrorDetailsErrorMessageParameters.json.cs new file mode 100644 index 000000000000..cd87a89fdc16 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2SwitchProviderBlockingErrorDetailsErrorMessageParameters.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The error message parameters. + public partial class InMageAzureV2SwitchProviderBlockingErrorDetailsErrorMessageParameters + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderBlockingErrorDetailsErrorMessageParameters. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderBlockingErrorDetailsErrorMessageParameters. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderBlockingErrorDetailsErrorMessageParameters FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new InMageAzureV2SwitchProviderBlockingErrorDetailsErrorMessageParameters(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + /// + internal InMageAzureV2SwitchProviderBlockingErrorDetailsErrorMessageParameters(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, global::System.Collections.Generic.HashSet exclusions = null) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray)this).AdditionalProperties, null ,exclusions ); + AfterFromJson(json); + } + + /// + /// Serializes this instance of into + /// a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray)this).AdditionalProperties, container); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2SwitchProviderBlockingErrorDetailsErrorTags.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2SwitchProviderBlockingErrorDetailsErrorTags.PowerShell.cs new file mode 100644 index 000000000000..b49f859c4f48 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2SwitchProviderBlockingErrorDetailsErrorTags.PowerShell.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// The error tags. + [System.ComponentModel.TypeConverter(typeof(InMageAzureV2SwitchProviderBlockingErrorDetailsErrorTagsTypeConverter))] + public partial class InMageAzureV2SwitchProviderBlockingErrorDetailsErrorTags + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderBlockingErrorDetailsErrorTags DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InMageAzureV2SwitchProviderBlockingErrorDetailsErrorTags(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderBlockingErrorDetailsErrorTags DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InMageAzureV2SwitchProviderBlockingErrorDetailsErrorTags(content); + } + + /// + /// Creates a new instance of , deserializing the content + /// from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderBlockingErrorDetailsErrorTags FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InMageAzureV2SwitchProviderBlockingErrorDetailsErrorTags(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InMageAzureV2SwitchProviderBlockingErrorDetailsErrorTags(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// The error tags. + [System.ComponentModel.TypeConverter(typeof(InMageAzureV2SwitchProviderBlockingErrorDetailsErrorTagsTypeConverter))] + public partial interface IInMageAzureV2SwitchProviderBlockingErrorDetailsErrorTags + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2SwitchProviderBlockingErrorDetailsErrorTags.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2SwitchProviderBlockingErrorDetailsErrorTags.TypeConverter.cs new file mode 100644 index 000000000000..d4578913ec44 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2SwitchProviderBlockingErrorDetailsErrorTags.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InMageAzureV2SwitchProviderBlockingErrorDetailsErrorTagsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no + /// suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no + /// suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderBlockingErrorDetailsErrorTags ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderBlockingErrorDetailsErrorTags).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InMageAzureV2SwitchProviderBlockingErrorDetailsErrorTags.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InMageAzureV2SwitchProviderBlockingErrorDetailsErrorTags.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InMageAzureV2SwitchProviderBlockingErrorDetailsErrorTags.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2SwitchProviderBlockingErrorDetailsErrorTags.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2SwitchProviderBlockingErrorDetailsErrorTags.cs new file mode 100644 index 000000000000..c436bc787159 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2SwitchProviderBlockingErrorDetailsErrorTags.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The error tags. + public partial class InMageAzureV2SwitchProviderBlockingErrorDetailsErrorTags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderBlockingErrorDetailsErrorTags, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderBlockingErrorDetailsErrorTagsInternal + { + + /// + /// Creates an new instance. + /// + public InMageAzureV2SwitchProviderBlockingErrorDetailsErrorTags() + { + + } + } + /// The error tags. + public partial interface IInMageAzureV2SwitchProviderBlockingErrorDetailsErrorTags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray + { + + } + /// The error tags. + internal partial interface IInMageAzureV2SwitchProviderBlockingErrorDetailsErrorTagsInternal + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2SwitchProviderBlockingErrorDetailsErrorTags.dictionary.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2SwitchProviderBlockingErrorDetailsErrorTags.dictionary.cs new file mode 100644 index 000000000000..88bafd293241 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2SwitchProviderBlockingErrorDetailsErrorTags.dictionary.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + public partial class InMageAzureV2SwitchProviderBlockingErrorDetailsErrorTags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray + { + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + + int Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Values { get => __additionalProperties.Values; } + + public string this[global::System.String index] { get => __additionalProperties[index]; set => __additionalProperties[index] = value; } + + /// + /// + public void Add(global::System.String key, string value) => __additionalProperties.Add( key, value); + + public void Clear() => __additionalProperties.Clear(); + + /// + public bool ContainsKey(global::System.String key) => __additionalProperties.ContainsKey( key); + + /// + public void CopyFrom(global::System.Collections.IDictionary source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public void CopyFrom(global::System.Management.Automation.PSObject source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public bool Remove(global::System.String key) => __additionalProperties.Remove( key); + + /// + /// + public bool TryGetValue(global::System.String key, out string value) => __additionalProperties.TryGetValue( key, out value); + + /// + + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2SwitchProviderBlockingErrorDetailsErrorTags source) => source.__additionalProperties; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2SwitchProviderBlockingErrorDetailsErrorTags.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2SwitchProviderBlockingErrorDetailsErrorTags.json.cs new file mode 100644 index 000000000000..4f36a2f464f7 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2SwitchProviderBlockingErrorDetailsErrorTags.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The error tags. + public partial class InMageAzureV2SwitchProviderBlockingErrorDetailsErrorTags + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderBlockingErrorDetailsErrorTags. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderBlockingErrorDetailsErrorTags. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderBlockingErrorDetailsErrorTags FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new InMageAzureV2SwitchProviderBlockingErrorDetailsErrorTags(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + /// + internal InMageAzureV2SwitchProviderBlockingErrorDetailsErrorTags(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, global::System.Collections.Generic.HashSet exclusions = null) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray)this).AdditionalProperties, null ,exclusions ); + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray)this).AdditionalProperties, container); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2SwitchProviderDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2SwitchProviderDetails.PowerShell.cs new file mode 100644 index 000000000000..21e3d5e2cac9 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2SwitchProviderDetails.PowerShell.cs @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// InMageAzureV2 switch provider details. + [System.ComponentModel.TypeConverter(typeof(InMageAzureV2SwitchProviderDetailsTypeConverter))] + public partial class InMageAzureV2SwitchProviderDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InMageAzureV2SwitchProviderDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InMageAzureV2SwitchProviderDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InMageAzureV2SwitchProviderDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("TargetVaultId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderDetailsInternal)this).TargetVaultId = (string) content.GetValueForProperty("TargetVaultId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderDetailsInternal)this).TargetVaultId, global::System.Convert.ToString); + } + if (content.Contains("TargetResourceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderDetailsInternal)this).TargetResourceId = (string) content.GetValueForProperty("TargetResourceId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderDetailsInternal)this).TargetResourceId, global::System.Convert.ToString); + } + if (content.Contains("TargetFabricId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderDetailsInternal)this).TargetFabricId = (string) content.GetValueForProperty("TargetFabricId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderDetailsInternal)this).TargetFabricId, global::System.Convert.ToString); + } + if (content.Contains("TargetApplianceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderDetailsInternal)this).TargetApplianceId = (string) content.GetValueForProperty("TargetApplianceId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderDetailsInternal)this).TargetApplianceId, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InMageAzureV2SwitchProviderDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("TargetVaultId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderDetailsInternal)this).TargetVaultId = (string) content.GetValueForProperty("TargetVaultId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderDetailsInternal)this).TargetVaultId, global::System.Convert.ToString); + } + if (content.Contains("TargetResourceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderDetailsInternal)this).TargetResourceId = (string) content.GetValueForProperty("TargetResourceId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderDetailsInternal)this).TargetResourceId, global::System.Convert.ToString); + } + if (content.Contains("TargetFabricId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderDetailsInternal)this).TargetFabricId = (string) content.GetValueForProperty("TargetFabricId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderDetailsInternal)this).TargetFabricId, global::System.Convert.ToString); + } + if (content.Contains("TargetApplianceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderDetailsInternal)this).TargetApplianceId = (string) content.GetValueForProperty("TargetApplianceId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderDetailsInternal)this).TargetApplianceId, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// InMageAzureV2 switch provider details. + [System.ComponentModel.TypeConverter(typeof(InMageAzureV2SwitchProviderDetailsTypeConverter))] + public partial interface IInMageAzureV2SwitchProviderDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2SwitchProviderDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2SwitchProviderDetails.TypeConverter.cs new file mode 100644 index 000000000000..da2b044c9bd5 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2SwitchProviderDetails.TypeConverter.cs @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InMageAzureV2SwitchProviderDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InMageAzureV2SwitchProviderDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InMageAzureV2SwitchProviderDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InMageAzureV2SwitchProviderDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2SwitchProviderDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2SwitchProviderDetails.cs new file mode 100644 index 000000000000..a2f8dce45313 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2SwitchProviderDetails.cs @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMageAzureV2 switch provider details. + public partial class InMageAzureV2SwitchProviderDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderDetailsInternal + { + + /// Internal Acessors for TargetApplianceId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderDetailsInternal.TargetApplianceId { get => this._targetApplianceId; set { {_targetApplianceId = value;} } } + + /// Internal Acessors for TargetFabricId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderDetailsInternal.TargetFabricId { get => this._targetFabricId; set { {_targetFabricId = value;} } } + + /// Internal Acessors for TargetResourceId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderDetailsInternal.TargetResourceId { get => this._targetResourceId; set { {_targetResourceId = value;} } } + + /// Internal Acessors for TargetVaultId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderDetailsInternal.TargetVaultId { get => this._targetVaultId; set { {_targetVaultId = value;} } } + + /// Backing field for property. + private string _targetApplianceId; + + /// The target appliance Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetApplianceId { get => this._targetApplianceId; } + + /// Backing field for property. + private string _targetFabricId; + + /// The target fabric Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetFabricId { get => this._targetFabricId; } + + /// Backing field for property. + private string _targetResourceId; + + /// The target resource Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetResourceId { get => this._targetResourceId; } + + /// Backing field for property. + private string _targetVaultId; + + /// The target vault Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetVaultId { get => this._targetVaultId; } + + /// Creates an new instance. + public InMageAzureV2SwitchProviderDetails() + { + + } + } + /// InMageAzureV2 switch provider details. + public partial interface IInMageAzureV2SwitchProviderDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The target appliance Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The target appliance Id.", + SerializedName = @"targetApplianceId", + PossibleTypes = new [] { typeof(string) })] + string TargetApplianceId { get; } + /// The target fabric Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The target fabric Id.", + SerializedName = @"targetFabricId", + PossibleTypes = new [] { typeof(string) })] + string TargetFabricId { get; } + /// The target resource Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The target resource Id.", + SerializedName = @"targetResourceId", + PossibleTypes = new [] { typeof(string) })] + string TargetResourceId { get; } + /// The target vault Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The target vault Id.", + SerializedName = @"targetVaultId", + PossibleTypes = new [] { typeof(string) })] + string TargetVaultId { get; } + + } + /// InMageAzureV2 switch provider details. + internal partial interface IInMageAzureV2SwitchProviderDetailsInternal + + { + /// The target appliance Id. + string TargetApplianceId { get; set; } + /// The target fabric Id. + string TargetFabricId { get; set; } + /// The target resource Id. + string TargetResourceId { get; set; } + /// The target vault Id. + string TargetVaultId { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2SwitchProviderDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2SwitchProviderDetails.json.cs new file mode 100644 index 000000000000..e747cb27c06c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2SwitchProviderDetails.json.cs @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMageAzureV2 switch provider details. + public partial class InMageAzureV2SwitchProviderDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new InMageAzureV2SwitchProviderDetails(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal InMageAzureV2SwitchProviderDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_targetVaultId = If( json?.PropertyT("targetVaultId"), out var __jsonTargetVaultId) ? (string)__jsonTargetVaultId : (string)TargetVaultId;} + {_targetResourceId = If( json?.PropertyT("targetResourceId"), out var __jsonTargetResourceId) ? (string)__jsonTargetResourceId : (string)TargetResourceId;} + {_targetFabricId = If( json?.PropertyT("targetFabricId"), out var __jsonTargetFabricId) ? (string)__jsonTargetFabricId : (string)TargetFabricId;} + {_targetApplianceId = If( json?.PropertyT("targetApplianceId"), out var __jsonTargetApplianceId) ? (string)__jsonTargetApplianceId : (string)TargetApplianceId;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._targetVaultId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetVaultId.ToString()) : null, "targetVaultId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._targetResourceId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetResourceId.ToString()) : null, "targetResourceId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._targetFabricId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetFabricId.ToString()) : null, "targetFabricId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._targetApplianceId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetApplianceId.ToString()) : null, "targetApplianceId" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2SwitchProviderInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2SwitchProviderInput.PowerShell.cs new file mode 100644 index 000000000000..e8d9bef17069 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2SwitchProviderInput.PowerShell.cs @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Provider specific input for InMageAzureV2 switch provider. + [System.ComponentModel.TypeConverter(typeof(InMageAzureV2SwitchProviderInputTypeConverter))] + public partial class InMageAzureV2SwitchProviderInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InMageAzureV2SwitchProviderInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InMageAzureV2SwitchProviderInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InMageAzureV2SwitchProviderInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("TargetVaultId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderInputInternal)this).TargetVaultId = (string) content.GetValueForProperty("TargetVaultId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderInputInternal)this).TargetVaultId, global::System.Convert.ToString); + } + if (content.Contains("TargetFabricId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderInputInternal)this).TargetFabricId = (string) content.GetValueForProperty("TargetFabricId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderInputInternal)this).TargetFabricId, global::System.Convert.ToString); + } + if (content.Contains("TargetApplianceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderInputInternal)this).TargetApplianceId = (string) content.GetValueForProperty("TargetApplianceId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderInputInternal)this).TargetApplianceId, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InMageAzureV2SwitchProviderInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("TargetVaultId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderInputInternal)this).TargetVaultId = (string) content.GetValueForProperty("TargetVaultId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderInputInternal)this).TargetVaultId, global::System.Convert.ToString); + } + if (content.Contains("TargetFabricId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderInputInternal)this).TargetFabricId = (string) content.GetValueForProperty("TargetFabricId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderInputInternal)this).TargetFabricId, global::System.Convert.ToString); + } + if (content.Contains("TargetApplianceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderInputInternal)this).TargetApplianceId = (string) content.GetValueForProperty("TargetApplianceId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderInputInternal)this).TargetApplianceId, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Provider specific input for InMageAzureV2 switch provider. + [System.ComponentModel.TypeConverter(typeof(InMageAzureV2SwitchProviderInputTypeConverter))] + public partial interface IInMageAzureV2SwitchProviderInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2SwitchProviderInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2SwitchProviderInput.TypeConverter.cs new file mode 100644 index 000000000000..4d2b284eabdf --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2SwitchProviderInput.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InMageAzureV2SwitchProviderInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InMageAzureV2SwitchProviderInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InMageAzureV2SwitchProviderInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InMageAzureV2SwitchProviderInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2SwitchProviderInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2SwitchProviderInput.cs new file mode 100644 index 000000000000..08053bf3567b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2SwitchProviderInput.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Provider specific input for InMageAzureV2 switch provider. + public partial class InMageAzureV2SwitchProviderInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderInputInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderSpecificInput __switchProviderSpecificInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.SwitchProviderSpecificInput(); + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderSpecificInputInternal)__switchProviderSpecificInput).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderSpecificInputInternal)__switchProviderSpecificInput).InstanceType = value ; } + + /// Backing field for property. + private string _targetApplianceId; + + /// The target appliance Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetApplianceId { get => this._targetApplianceId; set => this._targetApplianceId = value; } + + /// Backing field for property. + private string _targetFabricId; + + /// The target fabric Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetFabricId { get => this._targetFabricId; set => this._targetFabricId = value; } + + /// Backing field for property. + private string _targetVaultId; + + /// The target vault Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetVaultId { get => this._targetVaultId; set => this._targetVaultId = value; } + + /// Creates an new instance. + public InMageAzureV2SwitchProviderInput() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__switchProviderSpecificInput), __switchProviderSpecificInput); + await eventListener.AssertObjectIsValid(nameof(__switchProviderSpecificInput), __switchProviderSpecificInput); + } + } + /// Provider specific input for InMageAzureV2 switch provider. + public partial interface IInMageAzureV2SwitchProviderInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderSpecificInput + { + /// The target appliance Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The target appliance Id.", + SerializedName = @"targetApplianceID", + PossibleTypes = new [] { typeof(string) })] + string TargetApplianceId { get; set; } + /// The target fabric Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The target fabric Id.", + SerializedName = @"targetFabricID", + PossibleTypes = new [] { typeof(string) })] + string TargetFabricId { get; set; } + /// The target vault Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The target vault Id.", + SerializedName = @"targetVaultID", + PossibleTypes = new [] { typeof(string) })] + string TargetVaultId { get; set; } + + } + /// Provider specific input for InMageAzureV2 switch provider. + internal partial interface IInMageAzureV2SwitchProviderInputInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderSpecificInputInternal + { + /// The target appliance Id. + string TargetApplianceId { get; set; } + /// The target fabric Id. + string TargetFabricId { get; set; } + /// The target vault Id. + string TargetVaultId { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2SwitchProviderInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2SwitchProviderInput.json.cs new file mode 100644 index 000000000000..9501d688fb6d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2SwitchProviderInput.json.cs @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Provider specific input for InMageAzureV2 switch provider. + public partial class InMageAzureV2SwitchProviderInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2SwitchProviderInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new InMageAzureV2SwitchProviderInput(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal InMageAzureV2SwitchProviderInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __switchProviderSpecificInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.SwitchProviderSpecificInput(json); + {_targetVaultId = If( json?.PropertyT("targetVaultID"), out var __jsonTargetVaultId) ? (string)__jsonTargetVaultId : (string)TargetVaultId;} + {_targetFabricId = If( json?.PropertyT("targetFabricID"), out var __jsonTargetFabricId) ? (string)__jsonTargetFabricId : (string)TargetFabricId;} + {_targetApplianceId = If( json?.PropertyT("targetApplianceID"), out var __jsonTargetApplianceId) ? (string)__jsonTargetApplianceId : (string)TargetApplianceId;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __switchProviderSpecificInput?.ToJson(container, serializationMode); + AddIf( null != (((object)this._targetVaultId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetVaultId.ToString()) : null, "targetVaultID" ,container.Add ); + AddIf( null != (((object)this._targetFabricId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetFabricId.ToString()) : null, "targetFabricID" ,container.Add ); + AddIf( null != (((object)this._targetApplianceId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetApplianceId.ToString()) : null, "targetApplianceID" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2TestFailoverInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2TestFailoverInput.PowerShell.cs new file mode 100644 index 000000000000..007b616294b5 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2TestFailoverInput.PowerShell.cs @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// InMageAzureV2 provider specific input for test failover. + [System.ComponentModel.TypeConverter(typeof(InMageAzureV2TestFailoverInputTypeConverter))] + public partial class InMageAzureV2TestFailoverInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2TestFailoverInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InMageAzureV2TestFailoverInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2TestFailoverInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InMageAzureV2TestFailoverInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2TestFailoverInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InMageAzureV2TestFailoverInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("RecoveryPointId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2TestFailoverInputInternal)this).RecoveryPointId = (string) content.GetValueForProperty("RecoveryPointId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2TestFailoverInputInternal)this).RecoveryPointId, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InMageAzureV2TestFailoverInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("RecoveryPointId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2TestFailoverInputInternal)this).RecoveryPointId = (string) content.GetValueForProperty("RecoveryPointId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2TestFailoverInputInternal)this).RecoveryPointId, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// InMageAzureV2 provider specific input for test failover. + [System.ComponentModel.TypeConverter(typeof(InMageAzureV2TestFailoverInputTypeConverter))] + public partial interface IInMageAzureV2TestFailoverInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2TestFailoverInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2TestFailoverInput.TypeConverter.cs new file mode 100644 index 000000000000..191783230d9d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2TestFailoverInput.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InMageAzureV2TestFailoverInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2TestFailoverInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2TestFailoverInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InMageAzureV2TestFailoverInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InMageAzureV2TestFailoverInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InMageAzureV2TestFailoverInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2TestFailoverInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2TestFailoverInput.cs new file mode 100644 index 000000000000..3f00db813f0b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2TestFailoverInput.cs @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMageAzureV2 provider specific input for test failover. + public partial class InMageAzureV2TestFailoverInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2TestFailoverInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2TestFailoverInputInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverProviderSpecificInput __testFailoverProviderSpecificInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.TestFailoverProviderSpecificInput(); + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverProviderSpecificInputInternal)__testFailoverProviderSpecificInput).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverProviderSpecificInputInternal)__testFailoverProviderSpecificInput).InstanceType = value ; } + + /// Backing field for property. + private string _recoveryPointId; + + /// + /// 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. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryPointId { get => this._recoveryPointId; set => this._recoveryPointId = value; } + + /// Creates an new instance. + public InMageAzureV2TestFailoverInput() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__testFailoverProviderSpecificInput), __testFailoverProviderSpecificInput); + await eventListener.AssertObjectIsValid(nameof(__testFailoverProviderSpecificInput), __testFailoverProviderSpecificInput); + } + } + /// InMageAzureV2 provider specific input for test failover. + public partial interface IInMageAzureV2TestFailoverInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverProviderSpecificInput + { + /// + /// 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. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"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.", + SerializedName = @"recoveryPointId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryPointId { get; set; } + + } + /// InMageAzureV2 provider specific input for test failover. + internal partial interface IInMageAzureV2TestFailoverInputInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverProviderSpecificInputInternal + { + /// + /// 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. + /// + string RecoveryPointId { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2TestFailoverInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2TestFailoverInput.json.cs new file mode 100644 index 000000000000..a61b7c014960 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2TestFailoverInput.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMageAzureV2 provider specific input for test failover. + public partial class InMageAzureV2TestFailoverInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2TestFailoverInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2TestFailoverInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2TestFailoverInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new InMageAzureV2TestFailoverInput(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal InMageAzureV2TestFailoverInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __testFailoverProviderSpecificInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.TestFailoverProviderSpecificInput(json); + {_recoveryPointId = If( json?.PropertyT("recoveryPointId"), out var __jsonRecoveryPointId) ? (string)__jsonRecoveryPointId : (string)RecoveryPointId;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __testFailoverProviderSpecificInput?.ToJson(container, serializationMode); + AddIf( null != (((object)this._recoveryPointId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryPointId.ToString()) : null, "recoveryPointId" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2UnplannedFailoverInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2UnplannedFailoverInput.PowerShell.cs new file mode 100644 index 000000000000..6997102a9796 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2UnplannedFailoverInput.PowerShell.cs @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// InMageAzureV2 provider specific input for unplanned failover. + [System.ComponentModel.TypeConverter(typeof(InMageAzureV2UnplannedFailoverInputTypeConverter))] + public partial class InMageAzureV2UnplannedFailoverInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UnplannedFailoverInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InMageAzureV2UnplannedFailoverInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UnplannedFailoverInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InMageAzureV2UnplannedFailoverInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UnplannedFailoverInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InMageAzureV2UnplannedFailoverInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("RecoveryPointId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UnplannedFailoverInputInternal)this).RecoveryPointId = (string) content.GetValueForProperty("RecoveryPointId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UnplannedFailoverInputInternal)this).RecoveryPointId, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InMageAzureV2UnplannedFailoverInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("RecoveryPointId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UnplannedFailoverInputInternal)this).RecoveryPointId = (string) content.GetValueForProperty("RecoveryPointId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UnplannedFailoverInputInternal)this).RecoveryPointId, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// InMageAzureV2 provider specific input for unplanned failover. + [System.ComponentModel.TypeConverter(typeof(InMageAzureV2UnplannedFailoverInputTypeConverter))] + public partial interface IInMageAzureV2UnplannedFailoverInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2UnplannedFailoverInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2UnplannedFailoverInput.TypeConverter.cs new file mode 100644 index 000000000000..9ecaad41d4c6 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2UnplannedFailoverInput.TypeConverter.cs @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InMageAzureV2UnplannedFailoverInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UnplannedFailoverInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UnplannedFailoverInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InMageAzureV2UnplannedFailoverInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InMageAzureV2UnplannedFailoverInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InMageAzureV2UnplannedFailoverInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2UnplannedFailoverInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2UnplannedFailoverInput.cs new file mode 100644 index 000000000000..7888bd98198f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2UnplannedFailoverInput.cs @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMageAzureV2 provider specific input for unplanned failover. + public partial class InMageAzureV2UnplannedFailoverInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UnplannedFailoverInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UnplannedFailoverInputInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverProviderSpecificInput __unplannedFailoverProviderSpecificInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UnplannedFailoverProviderSpecificInput(); + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverProviderSpecificInputInternal)__unplannedFailoverProviderSpecificInput).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverProviderSpecificInputInternal)__unplannedFailoverProviderSpecificInput).InstanceType = value ; } + + /// Backing field for property. + private string _recoveryPointId; + + /// + /// The recovery point id to be passed to failover to a particular recovery point. In case of latest recovery point, null + /// should be passed. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryPointId { get => this._recoveryPointId; set => this._recoveryPointId = value; } + + /// Creates an new instance. + public InMageAzureV2UnplannedFailoverInput() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__unplannedFailoverProviderSpecificInput), __unplannedFailoverProviderSpecificInput); + await eventListener.AssertObjectIsValid(nameof(__unplannedFailoverProviderSpecificInput), __unplannedFailoverProviderSpecificInput); + } + } + /// InMageAzureV2 provider specific input for unplanned failover. + public partial interface IInMageAzureV2UnplannedFailoverInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverProviderSpecificInput + { + /// + /// The recovery point id to be passed to failover to a particular recovery point. In case of latest recovery point, null + /// should be passed. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery point id to be passed to failover to a particular recovery point. In case of latest recovery point, null should be passed.", + SerializedName = @"recoveryPointId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryPointId { get; set; } + + } + /// InMageAzureV2 provider specific input for unplanned failover. + internal partial interface IInMageAzureV2UnplannedFailoverInputInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverProviderSpecificInputInternal + { + /// + /// The recovery point id to be passed to failover to a particular recovery point. In case of latest recovery point, null + /// should be passed. + /// + string RecoveryPointId { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2UnplannedFailoverInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2UnplannedFailoverInput.json.cs new file mode 100644 index 000000000000..c75385558ade --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2UnplannedFailoverInput.json.cs @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMageAzureV2 provider specific input for unplanned failover. + public partial class InMageAzureV2UnplannedFailoverInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UnplannedFailoverInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UnplannedFailoverInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UnplannedFailoverInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new InMageAzureV2UnplannedFailoverInput(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal InMageAzureV2UnplannedFailoverInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __unplannedFailoverProviderSpecificInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UnplannedFailoverProviderSpecificInput(json); + {_recoveryPointId = If( json?.PropertyT("recoveryPointId"), out var __jsonRecoveryPointId) ? (string)__jsonRecoveryPointId : (string)RecoveryPointId;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __unplannedFailoverProviderSpecificInput?.ToJson(container, serializationMode); + AddIf( null != (((object)this._recoveryPointId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryPointId.ToString()) : null, "recoveryPointId" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2UpdateReplicationProtectedItemInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2UpdateReplicationProtectedItemInput.PowerShell.cs new file mode 100644 index 000000000000..c9067469f51b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2UpdateReplicationProtectedItemInput.PowerShell.cs @@ -0,0 +1,229 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// InMage Azure V2 input to update replication protected item. + [System.ComponentModel.TypeConverter(typeof(InMageAzureV2UpdateReplicationProtectedItemInputTypeConverter))] + public partial class InMageAzureV2UpdateReplicationProtectedItemInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UpdateReplicationProtectedItemInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InMageAzureV2UpdateReplicationProtectedItemInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UpdateReplicationProtectedItemInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InMageAzureV2UpdateReplicationProtectedItemInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from + /// a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UpdateReplicationProtectedItemInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InMageAzureV2UpdateReplicationProtectedItemInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("RecoveryAzureV1ResourceGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UpdateReplicationProtectedItemInputInternal)this).RecoveryAzureV1ResourceGroupId = (string) content.GetValueForProperty("RecoveryAzureV1ResourceGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UpdateReplicationProtectedItemInputInternal)this).RecoveryAzureV1ResourceGroupId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryAzureV2ResourceGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UpdateReplicationProtectedItemInputInternal)this).RecoveryAzureV2ResourceGroupId = (string) content.GetValueForProperty("RecoveryAzureV2ResourceGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UpdateReplicationProtectedItemInputInternal)this).RecoveryAzureV2ResourceGroupId, global::System.Convert.ToString); + } + if (content.Contains("UseManagedDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UpdateReplicationProtectedItemInputInternal)this).UseManagedDisk = (string) content.GetValueForProperty("UseManagedDisk",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UpdateReplicationProtectedItemInputInternal)this).UseManagedDisk, global::System.Convert.ToString); + } + if (content.Contains("TargetProximityPlacementGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UpdateReplicationProtectedItemInputInternal)this).TargetProximityPlacementGroupId = (string) content.GetValueForProperty("TargetProximityPlacementGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UpdateReplicationProtectedItemInputInternal)this).TargetProximityPlacementGroupId, global::System.Convert.ToString); + } + if (content.Contains("TargetAvailabilityZone")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UpdateReplicationProtectedItemInputInternal)this).TargetAvailabilityZone = (string) content.GetValueForProperty("TargetAvailabilityZone",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UpdateReplicationProtectedItemInputInternal)this).TargetAvailabilityZone, global::System.Convert.ToString); + } + if (content.Contains("TargetVMTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UpdateReplicationProtectedItemInputInternal)this).TargetVMTag = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UpdateReplicationProtectedItemInputTargetVMTags) content.GetValueForProperty("TargetVMTag",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UpdateReplicationProtectedItemInputInternal)this).TargetVMTag, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2UpdateReplicationProtectedItemInputTargetVMTagsTypeConverter.ConvertFrom); + } + if (content.Contains("TargetManagedDiskTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UpdateReplicationProtectedItemInputInternal)this).TargetManagedDiskTag = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UpdateReplicationProtectedItemInputTargetManagedDiskTags) content.GetValueForProperty("TargetManagedDiskTag",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UpdateReplicationProtectedItemInputInternal)this).TargetManagedDiskTag, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2UpdateReplicationProtectedItemInputTargetManagedDiskTagsTypeConverter.ConvertFrom); + } + if (content.Contains("TargetNicTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UpdateReplicationProtectedItemInputInternal)this).TargetNicTag = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UpdateReplicationProtectedItemInputTargetNicTags) content.GetValueForProperty("TargetNicTag",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UpdateReplicationProtectedItemInputInternal)this).TargetNicTag, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2UpdateReplicationProtectedItemInputTargetNicTagsTypeConverter.ConvertFrom); + } + if (content.Contains("SqlServerLicenseType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UpdateReplicationProtectedItemInputInternal)this).SqlServerLicenseType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SqlServerLicenseType?) content.GetValueForProperty("SqlServerLicenseType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UpdateReplicationProtectedItemInputInternal)this).SqlServerLicenseType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SqlServerLicenseType.CreateFrom); + } + if (content.Contains("VMDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UpdateReplicationProtectedItemInputInternal)this).VMDisk = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateDiskInput[]) content.GetValueForProperty("VMDisk",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UpdateReplicationProtectedItemInputInternal)this).VMDisk, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateDiskInputTypeConverter.ConvertFrom)); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemProviderInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemProviderInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InMageAzureV2UpdateReplicationProtectedItemInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("RecoveryAzureV1ResourceGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UpdateReplicationProtectedItemInputInternal)this).RecoveryAzureV1ResourceGroupId = (string) content.GetValueForProperty("RecoveryAzureV1ResourceGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UpdateReplicationProtectedItemInputInternal)this).RecoveryAzureV1ResourceGroupId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryAzureV2ResourceGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UpdateReplicationProtectedItemInputInternal)this).RecoveryAzureV2ResourceGroupId = (string) content.GetValueForProperty("RecoveryAzureV2ResourceGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UpdateReplicationProtectedItemInputInternal)this).RecoveryAzureV2ResourceGroupId, global::System.Convert.ToString); + } + if (content.Contains("UseManagedDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UpdateReplicationProtectedItemInputInternal)this).UseManagedDisk = (string) content.GetValueForProperty("UseManagedDisk",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UpdateReplicationProtectedItemInputInternal)this).UseManagedDisk, global::System.Convert.ToString); + } + if (content.Contains("TargetProximityPlacementGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UpdateReplicationProtectedItemInputInternal)this).TargetProximityPlacementGroupId = (string) content.GetValueForProperty("TargetProximityPlacementGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UpdateReplicationProtectedItemInputInternal)this).TargetProximityPlacementGroupId, global::System.Convert.ToString); + } + if (content.Contains("TargetAvailabilityZone")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UpdateReplicationProtectedItemInputInternal)this).TargetAvailabilityZone = (string) content.GetValueForProperty("TargetAvailabilityZone",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UpdateReplicationProtectedItemInputInternal)this).TargetAvailabilityZone, global::System.Convert.ToString); + } + if (content.Contains("TargetVMTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UpdateReplicationProtectedItemInputInternal)this).TargetVMTag = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UpdateReplicationProtectedItemInputTargetVMTags) content.GetValueForProperty("TargetVMTag",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UpdateReplicationProtectedItemInputInternal)this).TargetVMTag, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2UpdateReplicationProtectedItemInputTargetVMTagsTypeConverter.ConvertFrom); + } + if (content.Contains("TargetManagedDiskTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UpdateReplicationProtectedItemInputInternal)this).TargetManagedDiskTag = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UpdateReplicationProtectedItemInputTargetManagedDiskTags) content.GetValueForProperty("TargetManagedDiskTag",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UpdateReplicationProtectedItemInputInternal)this).TargetManagedDiskTag, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2UpdateReplicationProtectedItemInputTargetManagedDiskTagsTypeConverter.ConvertFrom); + } + if (content.Contains("TargetNicTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UpdateReplicationProtectedItemInputInternal)this).TargetNicTag = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UpdateReplicationProtectedItemInputTargetNicTags) content.GetValueForProperty("TargetNicTag",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UpdateReplicationProtectedItemInputInternal)this).TargetNicTag, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2UpdateReplicationProtectedItemInputTargetNicTagsTypeConverter.ConvertFrom); + } + if (content.Contains("SqlServerLicenseType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UpdateReplicationProtectedItemInputInternal)this).SqlServerLicenseType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SqlServerLicenseType?) content.GetValueForProperty("SqlServerLicenseType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UpdateReplicationProtectedItemInputInternal)this).SqlServerLicenseType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SqlServerLicenseType.CreateFrom); + } + if (content.Contains("VMDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UpdateReplicationProtectedItemInputInternal)this).VMDisk = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateDiskInput[]) content.GetValueForProperty("VMDisk",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UpdateReplicationProtectedItemInputInternal)this).VMDisk, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateDiskInputTypeConverter.ConvertFrom)); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemProviderInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemProviderInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// InMage Azure V2 input to update replication protected item. + [System.ComponentModel.TypeConverter(typeof(InMageAzureV2UpdateReplicationProtectedItemInputTypeConverter))] + public partial interface IInMageAzureV2UpdateReplicationProtectedItemInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2UpdateReplicationProtectedItemInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2UpdateReplicationProtectedItemInput.TypeConverter.cs new file mode 100644 index 000000000000..15dc379b319b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2UpdateReplicationProtectedItemInput.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InMageAzureV2UpdateReplicationProtectedItemInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, + /// otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UpdateReplicationProtectedItemInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UpdateReplicationProtectedItemInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InMageAzureV2UpdateReplicationProtectedItemInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InMageAzureV2UpdateReplicationProtectedItemInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InMageAzureV2UpdateReplicationProtectedItemInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2UpdateReplicationProtectedItemInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2UpdateReplicationProtectedItemInput.cs new file mode 100644 index 000000000000..a152758a1b99 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2UpdateReplicationProtectedItemInput.cs @@ -0,0 +1,229 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMage Azure V2 input to update replication protected item. + public partial class InMageAzureV2UpdateReplicationProtectedItemInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UpdateReplicationProtectedItemInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UpdateReplicationProtectedItemInputInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemProviderInput __updateReplicationProtectedItemProviderInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateReplicationProtectedItemProviderInput(); + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemProviderInputInternal)__updateReplicationProtectedItemProviderInput).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemProviderInputInternal)__updateReplicationProtectedItemProviderInput).InstanceType = value ; } + + /// Backing field for property. + private string _recoveryAzureV1ResourceGroupId; + + /// The recovery Azure resource group Id for classic deployment. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryAzureV1ResourceGroupId { get => this._recoveryAzureV1ResourceGroupId; set => this._recoveryAzureV1ResourceGroupId = value; } + + /// Backing field for property. + private string _recoveryAzureV2ResourceGroupId; + + /// The recovery Azure resource group Id for resource manager deployment. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryAzureV2ResourceGroupId { get => this._recoveryAzureV2ResourceGroupId; set => this._recoveryAzureV2ResourceGroupId = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SqlServerLicenseType? _sqlServerLicenseType; + + /// The SQL Server license type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SqlServerLicenseType? SqlServerLicenseType { get => this._sqlServerLicenseType; set => this._sqlServerLicenseType = value; } + + /// Backing field for property. + private string _targetAvailabilityZone; + + /// The target availability zone. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetAvailabilityZone { get => this._targetAvailabilityZone; set => this._targetAvailabilityZone = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UpdateReplicationProtectedItemInputTargetManagedDiskTags _targetManagedDiskTag; + + /// The tags for the target managed disks. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UpdateReplicationProtectedItemInputTargetManagedDiskTags TargetManagedDiskTag { get => (this._targetManagedDiskTag = this._targetManagedDiskTag ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2UpdateReplicationProtectedItemInputTargetManagedDiskTags()); set => this._targetManagedDiskTag = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UpdateReplicationProtectedItemInputTargetNicTags _targetNicTag; + + /// The tags for the target NICs. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UpdateReplicationProtectedItemInputTargetNicTags TargetNicTag { get => (this._targetNicTag = this._targetNicTag ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2UpdateReplicationProtectedItemInputTargetNicTags()); set => this._targetNicTag = value; } + + /// Backing field for property. + private string _targetProximityPlacementGroupId; + + /// The target proximity placement group Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetProximityPlacementGroupId { get => this._targetProximityPlacementGroupId; set => this._targetProximityPlacementGroupId = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UpdateReplicationProtectedItemInputTargetVMTags _targetVMTag; + + /// The target VM tags. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UpdateReplicationProtectedItemInputTargetVMTags TargetVMTag { get => (this._targetVMTag = this._targetVMTag ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2UpdateReplicationProtectedItemInputTargetVMTags()); set => this._targetVMTag = value; } + + /// Backing field for property. + private string _useManagedDisk; + + /// A value indicating whether managed disks should be used during failover. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string UseManagedDisk { get => this._useManagedDisk; set => this._useManagedDisk = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateDiskInput[] _vMDisk; + + /// The list of disk update properties. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateDiskInput[] VMDisk { get => this._vMDisk; set => this._vMDisk = value; } + + /// + /// Creates an new instance. + /// + public InMageAzureV2UpdateReplicationProtectedItemInput() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__updateReplicationProtectedItemProviderInput), __updateReplicationProtectedItemProviderInput); + await eventListener.AssertObjectIsValid(nameof(__updateReplicationProtectedItemProviderInput), __updateReplicationProtectedItemProviderInput); + } + } + /// InMage Azure V2 input to update replication protected item. + public partial interface IInMageAzureV2UpdateReplicationProtectedItemInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemProviderInput + { + /// The recovery Azure resource group Id for classic deployment. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery Azure resource group Id for classic deployment.", + SerializedName = @"recoveryAzureV1ResourceGroupId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryAzureV1ResourceGroupId { get; set; } + /// The recovery Azure resource group Id for resource manager deployment. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery Azure resource group Id for resource manager deployment.", + SerializedName = @"recoveryAzureV2ResourceGroupId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryAzureV2ResourceGroupId { get; set; } + /// The SQL Server license type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The SQL Server license type.", + SerializedName = @"sqlServerLicenseType", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SqlServerLicenseType) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SqlServerLicenseType? SqlServerLicenseType { get; set; } + /// The target availability zone. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target availability zone.", + SerializedName = @"targetAvailabilityZone", + PossibleTypes = new [] { typeof(string) })] + string TargetAvailabilityZone { get; set; } + /// The tags for the target managed disks. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The tags for the target managed disks.", + SerializedName = @"targetManagedDiskTags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UpdateReplicationProtectedItemInputTargetManagedDiskTags) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UpdateReplicationProtectedItemInputTargetManagedDiskTags TargetManagedDiskTag { get; set; } + /// The tags for the target NICs. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The tags for the target NICs.", + SerializedName = @"targetNicTags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UpdateReplicationProtectedItemInputTargetNicTags) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UpdateReplicationProtectedItemInputTargetNicTags TargetNicTag { get; set; } + /// The target proximity placement group Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target proximity placement group Id.", + SerializedName = @"targetProximityPlacementGroupId", + PossibleTypes = new [] { typeof(string) })] + string TargetProximityPlacementGroupId { get; set; } + /// The target VM tags. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target VM tags.", + SerializedName = @"targetVmTags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UpdateReplicationProtectedItemInputTargetVMTags) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UpdateReplicationProtectedItemInputTargetVMTags TargetVMTag { get; set; } + /// A value indicating whether managed disks should be used during failover. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether managed disks should be used during failover.", + SerializedName = @"useManagedDisks", + PossibleTypes = new [] { typeof(string) })] + string UseManagedDisk { get; set; } + /// The list of disk update properties. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of disk update properties.", + SerializedName = @"vmDisks", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateDiskInput) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateDiskInput[] VMDisk { get; set; } + + } + /// InMage Azure V2 input to update replication protected item. + internal partial interface IInMageAzureV2UpdateReplicationProtectedItemInputInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemProviderInputInternal + { + /// The recovery Azure resource group Id for classic deployment. + string RecoveryAzureV1ResourceGroupId { get; set; } + /// The recovery Azure resource group Id for resource manager deployment. + string RecoveryAzureV2ResourceGroupId { get; set; } + /// The SQL Server license type. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SqlServerLicenseType? SqlServerLicenseType { get; set; } + /// The target availability zone. + string TargetAvailabilityZone { get; set; } + /// The tags for the target managed disks. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UpdateReplicationProtectedItemInputTargetManagedDiskTags TargetManagedDiskTag { get; set; } + /// The tags for the target NICs. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UpdateReplicationProtectedItemInputTargetNicTags TargetNicTag { get; set; } + /// The target proximity placement group Id. + string TargetProximityPlacementGroupId { get; set; } + /// The target VM tags. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UpdateReplicationProtectedItemInputTargetVMTags TargetVMTag { get; set; } + /// A value indicating whether managed disks should be used during failover. + string UseManagedDisk { get; set; } + /// The list of disk update properties. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateDiskInput[] VMDisk { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2UpdateReplicationProtectedItemInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2UpdateReplicationProtectedItemInput.json.cs new file mode 100644 index 000000000000..4f38db30ac1b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2UpdateReplicationProtectedItemInput.json.cs @@ -0,0 +1,139 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMage Azure V2 input to update replication protected item. + public partial class InMageAzureV2UpdateReplicationProtectedItemInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UpdateReplicationProtectedItemInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UpdateReplicationProtectedItemInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UpdateReplicationProtectedItemInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new InMageAzureV2UpdateReplicationProtectedItemInput(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal InMageAzureV2UpdateReplicationProtectedItemInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __updateReplicationProtectedItemProviderInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateReplicationProtectedItemProviderInput(json); + {_recoveryAzureV1ResourceGroupId = If( json?.PropertyT("recoveryAzureV1ResourceGroupId"), out var __jsonRecoveryAzureV1ResourceGroupId) ? (string)__jsonRecoveryAzureV1ResourceGroupId : (string)RecoveryAzureV1ResourceGroupId;} + {_recoveryAzureV2ResourceGroupId = If( json?.PropertyT("recoveryAzureV2ResourceGroupId"), out var __jsonRecoveryAzureV2ResourceGroupId) ? (string)__jsonRecoveryAzureV2ResourceGroupId : (string)RecoveryAzureV2ResourceGroupId;} + {_useManagedDisk = If( json?.PropertyT("useManagedDisks"), out var __jsonUseManagedDisks) ? (string)__jsonUseManagedDisks : (string)UseManagedDisk;} + {_targetProximityPlacementGroupId = If( json?.PropertyT("targetProximityPlacementGroupId"), out var __jsonTargetProximityPlacementGroupId) ? (string)__jsonTargetProximityPlacementGroupId : (string)TargetProximityPlacementGroupId;} + {_targetAvailabilityZone = If( json?.PropertyT("targetAvailabilityZone"), out var __jsonTargetAvailabilityZone) ? (string)__jsonTargetAvailabilityZone : (string)TargetAvailabilityZone;} + {_targetVMTag = If( json?.PropertyT("targetVmTags"), out var __jsonTargetVMTags) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2UpdateReplicationProtectedItemInputTargetVMTags.FromJson(__jsonTargetVMTags) : TargetVMTag;} + {_targetManagedDiskTag = If( json?.PropertyT("targetManagedDiskTags"), out var __jsonTargetManagedDiskTags) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2UpdateReplicationProtectedItemInputTargetManagedDiskTags.FromJson(__jsonTargetManagedDiskTags) : TargetManagedDiskTag;} + {_targetNicTag = If( json?.PropertyT("targetNicTags"), out var __jsonTargetNicTags) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2UpdateReplicationProtectedItemInputTargetNicTags.FromJson(__jsonTargetNicTags) : TargetNicTag;} + {_sqlServerLicenseType = If( json?.PropertyT("sqlServerLicenseType"), out var __jsonSqlServerLicenseType) ? (string)__jsonSqlServerLicenseType : (string)SqlServerLicenseType;} + {_vMDisk = If( json?.PropertyT("vmDisks"), out var __jsonVMDisks) ? If( __jsonVMDisks as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateDiskInput) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateDiskInput.FromJson(__u) )) ))() : null : VMDisk;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __updateReplicationProtectedItemProviderInput?.ToJson(container, serializationMode); + AddIf( null != (((object)this._recoveryAzureV1ResourceGroupId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryAzureV1ResourceGroupId.ToString()) : null, "recoveryAzureV1ResourceGroupId" ,container.Add ); + AddIf( null != (((object)this._recoveryAzureV2ResourceGroupId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryAzureV2ResourceGroupId.ToString()) : null, "recoveryAzureV2ResourceGroupId" ,container.Add ); + AddIf( null != (((object)this._useManagedDisk)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._useManagedDisk.ToString()) : null, "useManagedDisks" ,container.Add ); + AddIf( null != (((object)this._targetProximityPlacementGroupId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetProximityPlacementGroupId.ToString()) : null, "targetProximityPlacementGroupId" ,container.Add ); + AddIf( null != (((object)this._targetAvailabilityZone)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetAvailabilityZone.ToString()) : null, "targetAvailabilityZone" ,container.Add ); + AddIf( null != this._targetVMTag ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._targetVMTag.ToJson(null,serializationMode) : null, "targetVmTags" ,container.Add ); + AddIf( null != this._targetManagedDiskTag ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._targetManagedDiskTag.ToJson(null,serializationMode) : null, "targetManagedDiskTags" ,container.Add ); + AddIf( null != this._targetNicTag ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._targetNicTag.ToJson(null,serializationMode) : null, "targetNicTags" ,container.Add ); + AddIf( null != (((object)this._sqlServerLicenseType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._sqlServerLicenseType.ToString()) : null, "sqlServerLicenseType" ,container.Add ); + if (null != this._vMDisk) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._vMDisk ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("vmDisks",__w); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2UpdateReplicationProtectedItemInputTargetManagedDiskTags.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2UpdateReplicationProtectedItemInputTargetManagedDiskTags.PowerShell.cs new file mode 100644 index 000000000000..75b39e8aac8d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2UpdateReplicationProtectedItemInputTargetManagedDiskTags.PowerShell.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// The tags for the target managed disks. + [System.ComponentModel.TypeConverter(typeof(InMageAzureV2UpdateReplicationProtectedItemInputTargetManagedDiskTagsTypeConverter))] + public partial class InMageAzureV2UpdateReplicationProtectedItemInputTargetManagedDiskTags + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UpdateReplicationProtectedItemInputTargetManagedDiskTags DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InMageAzureV2UpdateReplicationProtectedItemInputTargetManagedDiskTags(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UpdateReplicationProtectedItemInputTargetManagedDiskTags DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InMageAzureV2UpdateReplicationProtectedItemInputTargetManagedDiskTags(content); + } + + /// + /// Creates a new instance of , deserializing + /// the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UpdateReplicationProtectedItemInputTargetManagedDiskTags FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InMageAzureV2UpdateReplicationProtectedItemInputTargetManagedDiskTags(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InMageAzureV2UpdateReplicationProtectedItemInputTargetManagedDiskTags(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// The tags for the target managed disks. + [System.ComponentModel.TypeConverter(typeof(InMageAzureV2UpdateReplicationProtectedItemInputTargetManagedDiskTagsTypeConverter))] + public partial interface IInMageAzureV2UpdateReplicationProtectedItemInputTargetManagedDiskTags + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2UpdateReplicationProtectedItemInputTargetManagedDiskTags.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2UpdateReplicationProtectedItemInputTargetManagedDiskTags.TypeConverter.cs new file mode 100644 index 000000000000..617f9b283990 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2UpdateReplicationProtectedItemInputTargetManagedDiskTags.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InMageAzureV2UpdateReplicationProtectedItemInputTargetManagedDiskTagsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if + /// there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if + /// there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UpdateReplicationProtectedItemInputTargetManagedDiskTags ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UpdateReplicationProtectedItemInputTargetManagedDiskTags).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InMageAzureV2UpdateReplicationProtectedItemInputTargetManagedDiskTags.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InMageAzureV2UpdateReplicationProtectedItemInputTargetManagedDiskTags.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InMageAzureV2UpdateReplicationProtectedItemInputTargetManagedDiskTags.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2UpdateReplicationProtectedItemInputTargetManagedDiskTags.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2UpdateReplicationProtectedItemInputTargetManagedDiskTags.cs new file mode 100644 index 000000000000..67966bfbefec --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2UpdateReplicationProtectedItemInputTargetManagedDiskTags.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The tags for the target managed disks. + public partial class InMageAzureV2UpdateReplicationProtectedItemInputTargetManagedDiskTags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UpdateReplicationProtectedItemInputTargetManagedDiskTags, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UpdateReplicationProtectedItemInputTargetManagedDiskTagsInternal + { + + /// + /// Creates an new instance. + /// + public InMageAzureV2UpdateReplicationProtectedItemInputTargetManagedDiskTags() + { + + } + } + /// The tags for the target managed disks. + public partial interface IInMageAzureV2UpdateReplicationProtectedItemInputTargetManagedDiskTags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray + { + + } + /// The tags for the target managed disks. + internal partial interface IInMageAzureV2UpdateReplicationProtectedItemInputTargetManagedDiskTagsInternal + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2UpdateReplicationProtectedItemInputTargetManagedDiskTags.dictionary.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2UpdateReplicationProtectedItemInputTargetManagedDiskTags.dictionary.cs new file mode 100644 index 000000000000..5e54b981a94d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2UpdateReplicationProtectedItemInputTargetManagedDiskTags.dictionary.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + public partial class InMageAzureV2UpdateReplicationProtectedItemInputTargetManagedDiskTags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray + { + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + + int Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Values { get => __additionalProperties.Values; } + + public string this[global::System.String index] { get => __additionalProperties[index]; set => __additionalProperties[index] = value; } + + /// + /// + public void Add(global::System.String key, string value) => __additionalProperties.Add( key, value); + + public void Clear() => __additionalProperties.Clear(); + + /// + public bool ContainsKey(global::System.String key) => __additionalProperties.ContainsKey( key); + + /// + public void CopyFrom(global::System.Collections.IDictionary source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public void CopyFrom(global::System.Management.Automation.PSObject source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public bool Remove(global::System.String key) => __additionalProperties.Remove( key); + + /// + /// + public bool TryGetValue(global::System.String key, out string value) => __additionalProperties.TryGetValue( key, out value); + + /// + + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2UpdateReplicationProtectedItemInputTargetManagedDiskTags source) => source.__additionalProperties; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2UpdateReplicationProtectedItemInputTargetManagedDiskTags.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2UpdateReplicationProtectedItemInputTargetManagedDiskTags.json.cs new file mode 100644 index 000000000000..ee6bdde188d0 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2UpdateReplicationProtectedItemInputTargetManagedDiskTags.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The tags for the target managed disks. + public partial class InMageAzureV2UpdateReplicationProtectedItemInputTargetManagedDiskTags + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UpdateReplicationProtectedItemInputTargetManagedDiskTags. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UpdateReplicationProtectedItemInputTargetManagedDiskTags. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UpdateReplicationProtectedItemInputTargetManagedDiskTags FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new InMageAzureV2UpdateReplicationProtectedItemInputTargetManagedDiskTags(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + /// + internal InMageAzureV2UpdateReplicationProtectedItemInputTargetManagedDiskTags(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, global::System.Collections.Generic.HashSet exclusions = null) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray)this).AdditionalProperties, null ,exclusions ); + AfterFromJson(json); + } + + /// + /// Serializes this instance of into + /// a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray)this).AdditionalProperties, container); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2UpdateReplicationProtectedItemInputTargetNicTags.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2UpdateReplicationProtectedItemInputTargetNicTags.PowerShell.cs new file mode 100644 index 000000000000..5113bde5d9e8 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2UpdateReplicationProtectedItemInputTargetNicTags.PowerShell.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// The tags for the target NICs. + [System.ComponentModel.TypeConverter(typeof(InMageAzureV2UpdateReplicationProtectedItemInputTargetNicTagsTypeConverter))] + public partial class InMageAzureV2UpdateReplicationProtectedItemInputTargetNicTags + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UpdateReplicationProtectedItemInputTargetNicTags DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InMageAzureV2UpdateReplicationProtectedItemInputTargetNicTags(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UpdateReplicationProtectedItemInputTargetNicTags DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InMageAzureV2UpdateReplicationProtectedItemInputTargetNicTags(content); + } + + /// + /// Creates a new instance of , deserializing + /// the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UpdateReplicationProtectedItemInputTargetNicTags FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InMageAzureV2UpdateReplicationProtectedItemInputTargetNicTags(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InMageAzureV2UpdateReplicationProtectedItemInputTargetNicTags(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// The tags for the target NICs. + [System.ComponentModel.TypeConverter(typeof(InMageAzureV2UpdateReplicationProtectedItemInputTargetNicTagsTypeConverter))] + public partial interface IInMageAzureV2UpdateReplicationProtectedItemInputTargetNicTags + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2UpdateReplicationProtectedItemInputTargetNicTags.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2UpdateReplicationProtectedItemInputTargetNicTags.TypeConverter.cs new file mode 100644 index 000000000000..2e442a9b96c4 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2UpdateReplicationProtectedItemInputTargetNicTags.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InMageAzureV2UpdateReplicationProtectedItemInputTargetNicTagsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is + /// no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is + /// no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UpdateReplicationProtectedItemInputTargetNicTags ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UpdateReplicationProtectedItemInputTargetNicTags).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InMageAzureV2UpdateReplicationProtectedItemInputTargetNicTags.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InMageAzureV2UpdateReplicationProtectedItemInputTargetNicTags.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InMageAzureV2UpdateReplicationProtectedItemInputTargetNicTags.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2UpdateReplicationProtectedItemInputTargetNicTags.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2UpdateReplicationProtectedItemInputTargetNicTags.cs new file mode 100644 index 000000000000..eb61ae710a82 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2UpdateReplicationProtectedItemInputTargetNicTags.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The tags for the target NICs. + public partial class InMageAzureV2UpdateReplicationProtectedItemInputTargetNicTags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UpdateReplicationProtectedItemInputTargetNicTags, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UpdateReplicationProtectedItemInputTargetNicTagsInternal + { + + /// + /// Creates an new instance. + /// + public InMageAzureV2UpdateReplicationProtectedItemInputTargetNicTags() + { + + } + } + /// The tags for the target NICs. + public partial interface IInMageAzureV2UpdateReplicationProtectedItemInputTargetNicTags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray + { + + } + /// The tags for the target NICs. + internal partial interface IInMageAzureV2UpdateReplicationProtectedItemInputTargetNicTagsInternal + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2UpdateReplicationProtectedItemInputTargetNicTags.dictionary.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2UpdateReplicationProtectedItemInputTargetNicTags.dictionary.cs new file mode 100644 index 000000000000..cb87c1c32db2 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2UpdateReplicationProtectedItemInputTargetNicTags.dictionary.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + public partial class InMageAzureV2UpdateReplicationProtectedItemInputTargetNicTags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray + { + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + + int Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Values { get => __additionalProperties.Values; } + + public string this[global::System.String index] { get => __additionalProperties[index]; set => __additionalProperties[index] = value; } + + /// + /// + public void Add(global::System.String key, string value) => __additionalProperties.Add( key, value); + + public void Clear() => __additionalProperties.Clear(); + + /// + public bool ContainsKey(global::System.String key) => __additionalProperties.ContainsKey( key); + + /// + public void CopyFrom(global::System.Collections.IDictionary source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public void CopyFrom(global::System.Management.Automation.PSObject source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public bool Remove(global::System.String key) => __additionalProperties.Remove( key); + + /// + /// + public bool TryGetValue(global::System.String key, out string value) => __additionalProperties.TryGetValue( key, out value); + + /// + + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2UpdateReplicationProtectedItemInputTargetNicTags source) => source.__additionalProperties; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2UpdateReplicationProtectedItemInputTargetNicTags.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2UpdateReplicationProtectedItemInputTargetNicTags.json.cs new file mode 100644 index 000000000000..02a951279191 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2UpdateReplicationProtectedItemInputTargetNicTags.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The tags for the target NICs. + public partial class InMageAzureV2UpdateReplicationProtectedItemInputTargetNicTags + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UpdateReplicationProtectedItemInputTargetNicTags. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UpdateReplicationProtectedItemInputTargetNicTags. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UpdateReplicationProtectedItemInputTargetNicTags FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new InMageAzureV2UpdateReplicationProtectedItemInputTargetNicTags(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + /// + internal InMageAzureV2UpdateReplicationProtectedItemInputTargetNicTags(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, global::System.Collections.Generic.HashSet exclusions = null) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray)this).AdditionalProperties, null ,exclusions ); + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray)this).AdditionalProperties, container); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2UpdateReplicationProtectedItemInputTargetVMTags.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2UpdateReplicationProtectedItemInputTargetVMTags.PowerShell.cs new file mode 100644 index 000000000000..0fcf2b2e3c28 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2UpdateReplicationProtectedItemInputTargetVMTags.PowerShell.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// The target VM tags. + [System.ComponentModel.TypeConverter(typeof(InMageAzureV2UpdateReplicationProtectedItemInputTargetVMTagsTypeConverter))] + public partial class InMageAzureV2UpdateReplicationProtectedItemInputTargetVMTags + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UpdateReplicationProtectedItemInputTargetVMTags DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InMageAzureV2UpdateReplicationProtectedItemInputTargetVMTags(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UpdateReplicationProtectedItemInputTargetVMTags DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InMageAzureV2UpdateReplicationProtectedItemInputTargetVMTags(content); + } + + /// + /// Creates a new instance of , deserializing the + /// content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UpdateReplicationProtectedItemInputTargetVMTags FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InMageAzureV2UpdateReplicationProtectedItemInputTargetVMTags(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InMageAzureV2UpdateReplicationProtectedItemInputTargetVMTags(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// The target VM tags. + [System.ComponentModel.TypeConverter(typeof(InMageAzureV2UpdateReplicationProtectedItemInputTargetVMTagsTypeConverter))] + public partial interface IInMageAzureV2UpdateReplicationProtectedItemInputTargetVMTags + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2UpdateReplicationProtectedItemInputTargetVMTags.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2UpdateReplicationProtectedItemInputTargetVMTags.TypeConverter.cs new file mode 100644 index 000000000000..2e54721de287 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2UpdateReplicationProtectedItemInputTargetVMTags.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InMageAzureV2UpdateReplicationProtectedItemInputTargetVMTagsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is + /// no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is + /// no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UpdateReplicationProtectedItemInputTargetVMTags ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UpdateReplicationProtectedItemInputTargetVMTags).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InMageAzureV2UpdateReplicationProtectedItemInputTargetVMTags.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InMageAzureV2UpdateReplicationProtectedItemInputTargetVMTags.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InMageAzureV2UpdateReplicationProtectedItemInputTargetVMTags.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2UpdateReplicationProtectedItemInputTargetVMTags.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2UpdateReplicationProtectedItemInputTargetVMTags.cs new file mode 100644 index 000000000000..c03f2c41ab92 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2UpdateReplicationProtectedItemInputTargetVMTags.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The target VM tags. + public partial class InMageAzureV2UpdateReplicationProtectedItemInputTargetVMTags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UpdateReplicationProtectedItemInputTargetVMTags, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UpdateReplicationProtectedItemInputTargetVMTagsInternal + { + + /// + /// Creates an new instance. + /// + public InMageAzureV2UpdateReplicationProtectedItemInputTargetVMTags() + { + + } + } + /// The target VM tags. + public partial interface IInMageAzureV2UpdateReplicationProtectedItemInputTargetVMTags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray + { + + } + /// The target VM tags. + internal partial interface IInMageAzureV2UpdateReplicationProtectedItemInputTargetVMTagsInternal + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2UpdateReplicationProtectedItemInputTargetVMTags.dictionary.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2UpdateReplicationProtectedItemInputTargetVMTags.dictionary.cs new file mode 100644 index 000000000000..e8ec6814a160 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2UpdateReplicationProtectedItemInputTargetVMTags.dictionary.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + public partial class InMageAzureV2UpdateReplicationProtectedItemInputTargetVMTags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray + { + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + + int Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Values { get => __additionalProperties.Values; } + + public string this[global::System.String index] { get => __additionalProperties[index]; set => __additionalProperties[index] = value; } + + /// + /// + public void Add(global::System.String key, string value) => __additionalProperties.Add( key, value); + + public void Clear() => __additionalProperties.Clear(); + + /// + public bool ContainsKey(global::System.String key) => __additionalProperties.ContainsKey( key); + + /// + public void CopyFrom(global::System.Collections.IDictionary source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public void CopyFrom(global::System.Management.Automation.PSObject source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public bool Remove(global::System.String key) => __additionalProperties.Remove( key); + + /// + /// + public bool TryGetValue(global::System.String key, out string value) => __additionalProperties.TryGetValue( key, out value); + + /// + + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAzureV2UpdateReplicationProtectedItemInputTargetVMTags source) => source.__additionalProperties; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2UpdateReplicationProtectedItemInputTargetVMTags.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2UpdateReplicationProtectedItemInputTargetVMTags.json.cs new file mode 100644 index 000000000000..48062c561067 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageAzureV2UpdateReplicationProtectedItemInputTargetVMTags.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The target VM tags. + public partial class InMageAzureV2UpdateReplicationProtectedItemInputTargetVMTags + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UpdateReplicationProtectedItemInputTargetVMTags. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UpdateReplicationProtectedItemInputTargetVMTags. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAzureV2UpdateReplicationProtectedItemInputTargetVMTags FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new InMageAzureV2UpdateReplicationProtectedItemInputTargetVMTags(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + /// + internal InMageAzureV2UpdateReplicationProtectedItemInputTargetVMTags(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, global::System.Collections.Generic.HashSet exclusions = null) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray)this).AdditionalProperties, null ,exclusions ); + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray)this).AdditionalProperties, container); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageBasePolicyDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageBasePolicyDetails.PowerShell.cs new file mode 100644 index 000000000000..baf45c8f40e1 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageBasePolicyDetails.PowerShell.cs @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Base class for the policies of providers using InMage replication. + [System.ComponentModel.TypeConverter(typeof(InMageBasePolicyDetailsTypeConverter))] + public partial class InMageBasePolicyDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageBasePolicyDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InMageBasePolicyDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageBasePolicyDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InMageBasePolicyDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageBasePolicyDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InMageBasePolicyDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("RecoveryPointThresholdInMinute")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageBasePolicyDetailsInternal)this).RecoveryPointThresholdInMinute = (int?) content.GetValueForProperty("RecoveryPointThresholdInMinute",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageBasePolicyDetailsInternal)this).RecoveryPointThresholdInMinute, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("RecoveryPointHistory")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageBasePolicyDetailsInternal)this).RecoveryPointHistory = (int?) content.GetValueForProperty("RecoveryPointHistory",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageBasePolicyDetailsInternal)this).RecoveryPointHistory, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("AppConsistentFrequencyInMinute")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageBasePolicyDetailsInternal)this).AppConsistentFrequencyInMinute = (int?) content.GetValueForProperty("AppConsistentFrequencyInMinute",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageBasePolicyDetailsInternal)this).AppConsistentFrequencyInMinute, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("MultiVMSyncStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageBasePolicyDetailsInternal)this).MultiVMSyncStatus = (string) content.GetValueForProperty("MultiVMSyncStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageBasePolicyDetailsInternal)this).MultiVMSyncStatus, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InMageBasePolicyDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("RecoveryPointThresholdInMinute")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageBasePolicyDetailsInternal)this).RecoveryPointThresholdInMinute = (int?) content.GetValueForProperty("RecoveryPointThresholdInMinute",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageBasePolicyDetailsInternal)this).RecoveryPointThresholdInMinute, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("RecoveryPointHistory")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageBasePolicyDetailsInternal)this).RecoveryPointHistory = (int?) content.GetValueForProperty("RecoveryPointHistory",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageBasePolicyDetailsInternal)this).RecoveryPointHistory, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("AppConsistentFrequencyInMinute")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageBasePolicyDetailsInternal)this).AppConsistentFrequencyInMinute = (int?) content.GetValueForProperty("AppConsistentFrequencyInMinute",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageBasePolicyDetailsInternal)this).AppConsistentFrequencyInMinute, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("MultiVMSyncStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageBasePolicyDetailsInternal)this).MultiVMSyncStatus = (string) content.GetValueForProperty("MultiVMSyncStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageBasePolicyDetailsInternal)this).MultiVMSyncStatus, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Base class for the policies of providers using InMage replication. + [System.ComponentModel.TypeConverter(typeof(InMageBasePolicyDetailsTypeConverter))] + public partial interface IInMageBasePolicyDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageBasePolicyDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageBasePolicyDetails.TypeConverter.cs new file mode 100644 index 000000000000..3d0c4230e7f2 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageBasePolicyDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InMageBasePolicyDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageBasePolicyDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageBasePolicyDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InMageBasePolicyDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InMageBasePolicyDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InMageBasePolicyDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageBasePolicyDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageBasePolicyDetails.cs new file mode 100644 index 000000000000..643f9599d58a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageBasePolicyDetails.cs @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Base class for the policies of providers using InMage replication. + public partial class InMageBasePolicyDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageBasePolicyDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageBasePolicyDetailsInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetails __policyProviderSpecificDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PolicyProviderSpecificDetails(); + + /// Backing field for property. + private int? _appConsistentFrequencyInMinute; + + /// The app consistent snapshot frequency in minutes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? AppConsistentFrequencyInMinute { get => this._appConsistentFrequencyInMinute; set => this._appConsistentFrequencyInMinute = value; } + + /// Gets the class type. Overridden in derived classes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetailsInternal)__policyProviderSpecificDetails).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetailsInternal)__policyProviderSpecificDetails).InstanceType = value ; } + + /// Backing field for property. + private string _multiVMSyncStatus; + + /// A value indicating whether multi-VM sync has to be enabled. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string MultiVMSyncStatus { get => this._multiVMSyncStatus; set => this._multiVMSyncStatus = value; } + + /// Backing field for property. + private int? _recoveryPointHistory; + + /// The duration in minutes until which the recovery points need to be stored. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? RecoveryPointHistory { get => this._recoveryPointHistory; set => this._recoveryPointHistory = value; } + + /// Backing field for property. + private int? _recoveryPointThresholdInMinute; + + /// The recovery point threshold in minutes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? RecoveryPointThresholdInMinute { get => this._recoveryPointThresholdInMinute; set => this._recoveryPointThresholdInMinute = value; } + + /// Creates an new instance. + public InMageBasePolicyDetails() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__policyProviderSpecificDetails), __policyProviderSpecificDetails); + await eventListener.AssertObjectIsValid(nameof(__policyProviderSpecificDetails), __policyProviderSpecificDetails); + } + } + /// Base class for the policies of providers using InMage replication. + public partial interface IInMageBasePolicyDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetails + { + /// The app consistent snapshot frequency in minutes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The app consistent snapshot frequency in minutes.", + SerializedName = @"appConsistentFrequencyInMinutes", + PossibleTypes = new [] { typeof(int) })] + int? AppConsistentFrequencyInMinute { get; set; } + /// A value indicating whether multi-VM sync has to be enabled. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether multi-VM sync has to be enabled.", + SerializedName = @"multiVmSyncStatus", + PossibleTypes = new [] { typeof(string) })] + string MultiVMSyncStatus { get; set; } + /// The duration in minutes until which the recovery points need to be stored. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The duration in minutes until which the recovery points need to be stored.", + SerializedName = @"recoveryPointHistory", + PossibleTypes = new [] { typeof(int) })] + int? RecoveryPointHistory { get; set; } + /// The recovery point threshold in minutes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery point threshold in minutes.", + SerializedName = @"recoveryPointThresholdInMinutes", + PossibleTypes = new [] { typeof(int) })] + int? RecoveryPointThresholdInMinute { get; set; } + + } + /// Base class for the policies of providers using InMage replication. + internal partial interface IInMageBasePolicyDetailsInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetailsInternal + { + /// The app consistent snapshot frequency in minutes. + int? AppConsistentFrequencyInMinute { get; set; } + /// A value indicating whether multi-VM sync has to be enabled. + string MultiVMSyncStatus { get; set; } + /// The duration in minutes until which the recovery points need to be stored. + int? RecoveryPointHistory { get; set; } + /// The recovery point threshold in minutes. + int? RecoveryPointThresholdInMinute { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageBasePolicyDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageBasePolicyDetails.json.cs new file mode 100644 index 000000000000..7ad1962514d7 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageBasePolicyDetails.json.cs @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Base class for the policies of providers using InMage replication. + public partial class InMageBasePolicyDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageBasePolicyDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageBasePolicyDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageBasePolicyDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new InMageBasePolicyDetails(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal InMageBasePolicyDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __policyProviderSpecificDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PolicyProviderSpecificDetails(json); + {_recoveryPointThresholdInMinute = If( json?.PropertyT("recoveryPointThresholdInMinutes"), out var __jsonRecoveryPointThresholdInMinutes) ? (int?)__jsonRecoveryPointThresholdInMinutes : RecoveryPointThresholdInMinute;} + {_recoveryPointHistory = If( json?.PropertyT("recoveryPointHistory"), out var __jsonRecoveryPointHistory) ? (int?)__jsonRecoveryPointHistory : RecoveryPointHistory;} + {_appConsistentFrequencyInMinute = If( json?.PropertyT("appConsistentFrequencyInMinutes"), out var __jsonAppConsistentFrequencyInMinutes) ? (int?)__jsonAppConsistentFrequencyInMinutes : AppConsistentFrequencyInMinute;} + {_multiVMSyncStatus = If( json?.PropertyT("multiVmSyncStatus"), out var __jsonMultiVMSyncStatus) ? (string)__jsonMultiVMSyncStatus : (string)MultiVMSyncStatus;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __policyProviderSpecificDetails?.ToJson(container, serializationMode); + AddIf( null != this._recoveryPointThresholdInMinute ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._recoveryPointThresholdInMinute) : null, "recoveryPointThresholdInMinutes" ,container.Add ); + AddIf( null != this._recoveryPointHistory ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._recoveryPointHistory) : null, "recoveryPointHistory" ,container.Add ); + AddIf( null != this._appConsistentFrequencyInMinute ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._appConsistentFrequencyInMinute) : null, "appConsistentFrequencyInMinutes" ,container.Add ); + AddIf( null != (((object)this._multiVMSyncStatus)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._multiVMSyncStatus.ToString()) : null, "multiVmSyncStatus" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageDisableProtectionProviderSpecificInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageDisableProtectionProviderSpecificInput.PowerShell.cs new file mode 100644 index 000000000000..3bc2cea22cb0 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageDisableProtectionProviderSpecificInput.PowerShell.cs @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// InMage disable protection provider specific input. + [System.ComponentModel.TypeConverter(typeof(InMageDisableProtectionProviderSpecificInputTypeConverter))] + public partial class InMageDisableProtectionProviderSpecificInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDisableProtectionProviderSpecificInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InMageDisableProtectionProviderSpecificInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDisableProtectionProviderSpecificInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InMageDisableProtectionProviderSpecificInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from + /// a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDisableProtectionProviderSpecificInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InMageDisableProtectionProviderSpecificInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ReplicaVMDeletionStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDisableProtectionProviderSpecificInputInternal)this).ReplicaVMDeletionStatus = (string) content.GetValueForProperty("ReplicaVMDeletionStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDisableProtectionProviderSpecificInputInternal)this).ReplicaVMDeletionStatus, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InMageDisableProtectionProviderSpecificInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ReplicaVMDeletionStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDisableProtectionProviderSpecificInputInternal)this).ReplicaVMDeletionStatus = (string) content.GetValueForProperty("ReplicaVMDeletionStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDisableProtectionProviderSpecificInputInternal)this).ReplicaVMDeletionStatus, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// InMage disable protection provider specific input. + [System.ComponentModel.TypeConverter(typeof(InMageDisableProtectionProviderSpecificInputTypeConverter))] + public partial interface IInMageDisableProtectionProviderSpecificInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageDisableProtectionProviderSpecificInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageDisableProtectionProviderSpecificInput.TypeConverter.cs new file mode 100644 index 000000000000..ccdc2d35af85 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageDisableProtectionProviderSpecificInput.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InMageDisableProtectionProviderSpecificInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, + /// otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDisableProtectionProviderSpecificInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDisableProtectionProviderSpecificInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InMageDisableProtectionProviderSpecificInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InMageDisableProtectionProviderSpecificInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InMageDisableProtectionProviderSpecificInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageDisableProtectionProviderSpecificInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageDisableProtectionProviderSpecificInput.cs new file mode 100644 index 000000000000..2c980e65abc4 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageDisableProtectionProviderSpecificInput.cs @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMage disable protection provider specific input. + public partial class InMageDisableProtectionProviderSpecificInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDisableProtectionProviderSpecificInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDisableProtectionProviderSpecificInputInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionProviderSpecificInput __disableProtectionProviderSpecificInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DisableProtectionProviderSpecificInput(); + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionProviderSpecificInputInternal)__disableProtectionProviderSpecificInput).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionProviderSpecificInputInternal)__disableProtectionProviderSpecificInput).InstanceType = value ; } + + /// Backing field for property. + private string _replicaVMDeletionStatus; + + /// + /// A value indicating whether the replica VM should be destroyed or retained. Values from Delete and Retain. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ReplicaVMDeletionStatus { get => this._replicaVMDeletionStatus; set => this._replicaVMDeletionStatus = value; } + + /// + /// Creates an new instance. + /// + public InMageDisableProtectionProviderSpecificInput() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__disableProtectionProviderSpecificInput), __disableProtectionProviderSpecificInput); + await eventListener.AssertObjectIsValid(nameof(__disableProtectionProviderSpecificInput), __disableProtectionProviderSpecificInput); + } + } + /// InMage disable protection provider specific input. + public partial interface IInMageDisableProtectionProviderSpecificInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionProviderSpecificInput + { + /// + /// A value indicating whether the replica VM should be destroyed or retained. Values from Delete and Retain. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether the replica VM should be destroyed or retained. Values from Delete and Retain.", + SerializedName = @"replicaVmDeletionStatus", + PossibleTypes = new [] { typeof(string) })] + string ReplicaVMDeletionStatus { get; set; } + + } + /// InMage disable protection provider specific input. + internal partial interface IInMageDisableProtectionProviderSpecificInputInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionProviderSpecificInputInternal + { + /// + /// A value indicating whether the replica VM should be destroyed or retained. Values from Delete and Retain. + /// + string ReplicaVMDeletionStatus { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageDisableProtectionProviderSpecificInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageDisableProtectionProviderSpecificInput.json.cs new file mode 100644 index 000000000000..c53247a49f48 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageDisableProtectionProviderSpecificInput.json.cs @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMage disable protection provider specific input. + public partial class InMageDisableProtectionProviderSpecificInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDisableProtectionProviderSpecificInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDisableProtectionProviderSpecificInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDisableProtectionProviderSpecificInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new InMageDisableProtectionProviderSpecificInput(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal InMageDisableProtectionProviderSpecificInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __disableProtectionProviderSpecificInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DisableProtectionProviderSpecificInput(json); + {_replicaVMDeletionStatus = If( json?.PropertyT("replicaVmDeletionStatus"), out var __jsonReplicaVMDeletionStatus) ? (string)__jsonReplicaVMDeletionStatus : (string)ReplicaVMDeletionStatus;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __disableProtectionProviderSpecificInput?.ToJson(container, serializationMode); + AddIf( null != (((object)this._replicaVMDeletionStatus)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._replicaVMDeletionStatus.ToString()) : null, "replicaVmDeletionStatus" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageDiskDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageDiskDetails.PowerShell.cs new file mode 100644 index 000000000000..7f8e54960c8d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageDiskDetails.PowerShell.cs @@ -0,0 +1,184 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// VMware/Physical specific Disk Details. + [System.ComponentModel.TypeConverter(typeof(InMageDiskDetailsTypeConverter))] + public partial class InMageDiskDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InMageDiskDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InMageDiskDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InMageDiskDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DiskId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskDetailsInternal)this).DiskId = (string) content.GetValueForProperty("DiskId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskDetailsInternal)this).DiskId, global::System.Convert.ToString); + } + if (content.Contains("DiskName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskDetailsInternal)this).DiskName = (string) content.GetValueForProperty("DiskName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskDetailsInternal)this).DiskName, global::System.Convert.ToString); + } + if (content.Contains("DiskSizeInMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskDetailsInternal)this).DiskSizeInMb = (string) content.GetValueForProperty("DiskSizeInMb",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskDetailsInternal)this).DiskSizeInMb, global::System.Convert.ToString); + } + if (content.Contains("DiskType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskDetailsInternal)this).DiskType = (string) content.GetValueForProperty("DiskType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskDetailsInternal)this).DiskType, global::System.Convert.ToString); + } + if (content.Contains("DiskConfiguration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskDetailsInternal)this).DiskConfiguration = (string) content.GetValueForProperty("DiskConfiguration",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskDetailsInternal)this).DiskConfiguration, global::System.Convert.ToString); + } + if (content.Contains("VolumeList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskDetailsInternal)this).VolumeList = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskVolumeDetails[]) content.GetValueForProperty("VolumeList",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskDetailsInternal)this).VolumeList, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DiskVolumeDetailsTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InMageDiskDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DiskId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskDetailsInternal)this).DiskId = (string) content.GetValueForProperty("DiskId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskDetailsInternal)this).DiskId, global::System.Convert.ToString); + } + if (content.Contains("DiskName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskDetailsInternal)this).DiskName = (string) content.GetValueForProperty("DiskName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskDetailsInternal)this).DiskName, global::System.Convert.ToString); + } + if (content.Contains("DiskSizeInMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskDetailsInternal)this).DiskSizeInMb = (string) content.GetValueForProperty("DiskSizeInMb",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskDetailsInternal)this).DiskSizeInMb, global::System.Convert.ToString); + } + if (content.Contains("DiskType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskDetailsInternal)this).DiskType = (string) content.GetValueForProperty("DiskType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskDetailsInternal)this).DiskType, global::System.Convert.ToString); + } + if (content.Contains("DiskConfiguration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskDetailsInternal)this).DiskConfiguration = (string) content.GetValueForProperty("DiskConfiguration",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskDetailsInternal)this).DiskConfiguration, global::System.Convert.ToString); + } + if (content.Contains("VolumeList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskDetailsInternal)this).VolumeList = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskVolumeDetails[]) content.GetValueForProperty("VolumeList",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskDetailsInternal)this).VolumeList, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DiskVolumeDetailsTypeConverter.ConvertFrom)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// VMware/Physical specific Disk Details. + [System.ComponentModel.TypeConverter(typeof(InMageDiskDetailsTypeConverter))] + public partial interface IInMageDiskDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageDiskDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageDiskDetails.TypeConverter.cs new file mode 100644 index 000000000000..139eda97f43b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageDiskDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InMageDiskDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InMageDiskDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InMageDiskDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InMageDiskDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageDiskDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageDiskDetails.cs new file mode 100644 index 000000000000..8cadc214e8cf --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageDiskDetails.cs @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// VMware/Physical specific Disk Details. + public partial class InMageDiskDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskDetailsInternal + { + + /// Backing field for property. + private string _diskConfiguration; + + /// Whether disk is dynamic disk or basic disk. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string DiskConfiguration { get => this._diskConfiguration; set => this._diskConfiguration = value; } + + /// Backing field for property. + private string _diskId; + + /// The disk Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string DiskId { get => this._diskId; set => this._diskId = value; } + + /// Backing field for property. + private string _diskName; + + /// The disk name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string DiskName { get => this._diskName; set => this._diskName = value; } + + /// Backing field for property. + private string _diskSizeInMb; + + /// The disk size in MB. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string DiskSizeInMb { get => this._diskSizeInMb; set => this._diskSizeInMb = value; } + + /// Backing field for property. + private string _diskType; + + /// Whether disk is system disk or data disk. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string DiskType { get => this._diskType; set => this._diskType = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskVolumeDetails[] _volumeList; + + /// Volumes of the disk. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskVolumeDetails[] VolumeList { get => this._volumeList; set => this._volumeList = value; } + + /// Creates an new instance. + public InMageDiskDetails() + { + + } + } + /// VMware/Physical specific Disk Details. + public partial interface IInMageDiskDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// Whether disk is dynamic disk or basic disk. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Whether disk is dynamic disk or basic disk.", + SerializedName = @"diskConfiguration", + PossibleTypes = new [] { typeof(string) })] + string DiskConfiguration { get; set; } + /// The disk Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The disk Id.", + SerializedName = @"diskId", + PossibleTypes = new [] { typeof(string) })] + string DiskId { get; set; } + /// The disk name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The disk name.", + SerializedName = @"diskName", + PossibleTypes = new [] { typeof(string) })] + string DiskName { get; set; } + /// The disk size in MB. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The disk size in MB.", + SerializedName = @"diskSizeInMB", + PossibleTypes = new [] { typeof(string) })] + string DiskSizeInMb { get; set; } + /// Whether disk is system disk or data disk. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Whether disk is system disk or data disk.", + SerializedName = @"diskType", + PossibleTypes = new [] { typeof(string) })] + string DiskType { get; set; } + /// Volumes of the disk. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Volumes of the disk.", + SerializedName = @"volumeList", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskVolumeDetails) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskVolumeDetails[] VolumeList { get; set; } + + } + /// VMware/Physical specific Disk Details. + internal partial interface IInMageDiskDetailsInternal + + { + /// Whether disk is dynamic disk or basic disk. + string DiskConfiguration { get; set; } + /// The disk Id. + string DiskId { get; set; } + /// The disk name. + string DiskName { get; set; } + /// The disk size in MB. + string DiskSizeInMb { get; set; } + /// Whether disk is system disk or data disk. + string DiskType { get; set; } + /// Volumes of the disk. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskVolumeDetails[] VolumeList { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageDiskDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageDiskDetails.json.cs new file mode 100644 index 000000000000..9c73d315d6be --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageDiskDetails.json.cs @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// VMware/Physical specific Disk Details. + public partial class InMageDiskDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new InMageDiskDetails(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal InMageDiskDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_diskId = If( json?.PropertyT("diskId"), out var __jsonDiskId) ? (string)__jsonDiskId : (string)DiskId;} + {_diskName = If( json?.PropertyT("diskName"), out var __jsonDiskName) ? (string)__jsonDiskName : (string)DiskName;} + {_diskSizeInMb = If( json?.PropertyT("diskSizeInMB"), out var __jsonDiskSizeInMb) ? (string)__jsonDiskSizeInMb : (string)DiskSizeInMb;} + {_diskType = If( json?.PropertyT("diskType"), out var __jsonDiskType) ? (string)__jsonDiskType : (string)DiskType;} + {_diskConfiguration = If( json?.PropertyT("diskConfiguration"), out var __jsonDiskConfiguration) ? (string)__jsonDiskConfiguration : (string)DiskConfiguration;} + {_volumeList = If( json?.PropertyT("volumeList"), out var __jsonVolumeList) ? If( __jsonVolumeList as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskVolumeDetails) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DiskVolumeDetails.FromJson(__u) )) ))() : null : VolumeList;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._diskId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._diskId.ToString()) : null, "diskId" ,container.Add ); + AddIf( null != (((object)this._diskName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._diskName.ToString()) : null, "diskName" ,container.Add ); + AddIf( null != (((object)this._diskSizeInMb)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._diskSizeInMb.ToString()) : null, "diskSizeInMB" ,container.Add ); + AddIf( null != (((object)this._diskType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._diskType.ToString()) : null, "diskType" ,container.Add ); + AddIf( null != (((object)this._diskConfiguration)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._diskConfiguration.ToString()) : null, "diskConfiguration" ,container.Add ); + if (null != this._volumeList) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._volumeList ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("volumeList",__w); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageDiskExclusionInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageDiskExclusionInput.PowerShell.cs new file mode 100644 index 000000000000..9ccd771710be --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageDiskExclusionInput.PowerShell.cs @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// DiskExclusionInput when doing enable protection of virtual machine in InMage provider. + /// + [System.ComponentModel.TypeConverter(typeof(InMageDiskExclusionInputTypeConverter))] + public partial class InMageDiskExclusionInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskExclusionInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InMageDiskExclusionInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskExclusionInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InMageDiskExclusionInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskExclusionInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InMageDiskExclusionInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("VolumeOption")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskExclusionInputInternal)this).VolumeOption = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageVolumeExclusionOptions[]) content.GetValueForProperty("VolumeOption",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskExclusionInputInternal)this).VolumeOption, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageVolumeExclusionOptionsTypeConverter.ConvertFrom)); + } + if (content.Contains("DiskSignatureOption")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskExclusionInputInternal)this).DiskSignatureOption = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskSignatureExclusionOptions[]) content.GetValueForProperty("DiskSignatureOption",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskExclusionInputInternal)this).DiskSignatureOption, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageDiskSignatureExclusionOptionsTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InMageDiskExclusionInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("VolumeOption")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskExclusionInputInternal)this).VolumeOption = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageVolumeExclusionOptions[]) content.GetValueForProperty("VolumeOption",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskExclusionInputInternal)this).VolumeOption, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageVolumeExclusionOptionsTypeConverter.ConvertFrom)); + } + if (content.Contains("DiskSignatureOption")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskExclusionInputInternal)this).DiskSignatureOption = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskSignatureExclusionOptions[]) content.GetValueForProperty("DiskSignatureOption",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskExclusionInputInternal)this).DiskSignatureOption, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageDiskSignatureExclusionOptionsTypeConverter.ConvertFrom)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// DiskExclusionInput when doing enable protection of virtual machine in InMage provider. + [System.ComponentModel.TypeConverter(typeof(InMageDiskExclusionInputTypeConverter))] + public partial interface IInMageDiskExclusionInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageDiskExclusionInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageDiskExclusionInput.TypeConverter.cs new file mode 100644 index 000000000000..cc79e0d34585 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageDiskExclusionInput.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InMageDiskExclusionInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskExclusionInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskExclusionInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InMageDiskExclusionInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InMageDiskExclusionInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InMageDiskExclusionInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageDiskExclusionInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageDiskExclusionInput.cs new file mode 100644 index 000000000000..11af39d37741 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageDiskExclusionInput.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// + /// DiskExclusionInput when doing enable protection of virtual machine in InMage provider. + /// + public partial class InMageDiskExclusionInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskExclusionInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskExclusionInputInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskSignatureExclusionOptions[] _diskSignatureOption; + + /// The guest disk signature based option for disk exclusion. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskSignatureExclusionOptions[] DiskSignatureOption { get => this._diskSignatureOption; set => this._diskSignatureOption = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageVolumeExclusionOptions[] _volumeOption; + + /// The volume label based option for disk exclusion. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageVolumeExclusionOptions[] VolumeOption { get => this._volumeOption; set => this._volumeOption = value; } + + /// Creates an new instance. + public InMageDiskExclusionInput() + { + + } + } + /// DiskExclusionInput when doing enable protection of virtual machine in InMage provider. + public partial interface IInMageDiskExclusionInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The guest disk signature based option for disk exclusion. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The guest disk signature based option for disk exclusion.", + SerializedName = @"diskSignatureOptions", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskSignatureExclusionOptions) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskSignatureExclusionOptions[] DiskSignatureOption { get; set; } + /// The volume label based option for disk exclusion. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The volume label based option for disk exclusion.", + SerializedName = @"volumeOptions", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageVolumeExclusionOptions) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageVolumeExclusionOptions[] VolumeOption { get; set; } + + } + /// DiskExclusionInput when doing enable protection of virtual machine in InMage provider. + internal partial interface IInMageDiskExclusionInputInternal + + { + /// The guest disk signature based option for disk exclusion. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskSignatureExclusionOptions[] DiskSignatureOption { get; set; } + /// The volume label based option for disk exclusion. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageVolumeExclusionOptions[] VolumeOption { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageDiskExclusionInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageDiskExclusionInput.json.cs new file mode 100644 index 000000000000..c7d78ff54825 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageDiskExclusionInput.json.cs @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// + /// DiskExclusionInput when doing enable protection of virtual machine in InMage provider. + /// + public partial class InMageDiskExclusionInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskExclusionInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskExclusionInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskExclusionInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new InMageDiskExclusionInput(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal InMageDiskExclusionInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_volumeOption = If( json?.PropertyT("volumeOptions"), out var __jsonVolumeOptions) ? If( __jsonVolumeOptions as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageVolumeExclusionOptions) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageVolumeExclusionOptions.FromJson(__u) )) ))() : null : VolumeOption;} + {_diskSignatureOption = If( json?.PropertyT("diskSignatureOptions"), out var __jsonDiskSignatureOptions) ? If( __jsonDiskSignatureOptions as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __q) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__q, (__p)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskSignatureExclusionOptions) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageDiskSignatureExclusionOptions.FromJson(__p) )) ))() : null : DiskSignatureOption;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._volumeOption) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._volumeOption ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("volumeOptions",__w); + } + if (null != this._diskSignatureOption) + { + var __r = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __s in this._diskSignatureOption ) + { + AddIf(__s?.ToJson(null, serializationMode) ,__r.Add); + } + container.Add("diskSignatureOptions",__r); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageDiskSignatureExclusionOptions.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageDiskSignatureExclusionOptions.PowerShell.cs new file mode 100644 index 000000000000..e6becf699914 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageDiskSignatureExclusionOptions.PowerShell.cs @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// Guest disk signature based disk exclusion option when doing enable protection of virtual machine in InMage provider. + /// + [System.ComponentModel.TypeConverter(typeof(InMageDiskSignatureExclusionOptionsTypeConverter))] + public partial class InMageDiskSignatureExclusionOptions + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskSignatureExclusionOptions DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InMageDiskSignatureExclusionOptions(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskSignatureExclusionOptions DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InMageDiskSignatureExclusionOptions(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskSignatureExclusionOptions FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InMageDiskSignatureExclusionOptions(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DiskSignature")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskSignatureExclusionOptionsInternal)this).DiskSignature = (string) content.GetValueForProperty("DiskSignature",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskSignatureExclusionOptionsInternal)this).DiskSignature, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InMageDiskSignatureExclusionOptions(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DiskSignature")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskSignatureExclusionOptionsInternal)this).DiskSignature = (string) content.GetValueForProperty("DiskSignature",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskSignatureExclusionOptionsInternal)this).DiskSignature, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Guest disk signature based disk exclusion option when doing enable protection of virtual machine in InMage provider. + [System.ComponentModel.TypeConverter(typeof(InMageDiskSignatureExclusionOptionsTypeConverter))] + public partial interface IInMageDiskSignatureExclusionOptions + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageDiskSignatureExclusionOptions.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageDiskSignatureExclusionOptions.TypeConverter.cs new file mode 100644 index 000000000000..cae46c442bc4 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageDiskSignatureExclusionOptions.TypeConverter.cs @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InMageDiskSignatureExclusionOptionsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskSignatureExclusionOptions ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskSignatureExclusionOptions).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InMageDiskSignatureExclusionOptions.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InMageDiskSignatureExclusionOptions.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InMageDiskSignatureExclusionOptions.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageDiskSignatureExclusionOptions.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageDiskSignatureExclusionOptions.cs new file mode 100644 index 000000000000..686ffe1a3220 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageDiskSignatureExclusionOptions.cs @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// + /// Guest disk signature based disk exclusion option when doing enable protection of virtual machine in InMage provider. + /// + public partial class InMageDiskSignatureExclusionOptions : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskSignatureExclusionOptions, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskSignatureExclusionOptionsInternal + { + + /// Backing field for property. + private string _diskSignature; + + /// The guest signature of disk to be excluded from replication. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string DiskSignature { get => this._diskSignature; set => this._diskSignature = value; } + + /// Creates an new instance. + public InMageDiskSignatureExclusionOptions() + { + + } + } + /// Guest disk signature based disk exclusion option when doing enable protection of virtual machine in InMage provider. + public partial interface IInMageDiskSignatureExclusionOptions : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The guest signature of disk to be excluded from replication. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The guest signature of disk to be excluded from replication.", + SerializedName = @"diskSignature", + PossibleTypes = new [] { typeof(string) })] + string DiskSignature { get; set; } + + } + /// Guest disk signature based disk exclusion option when doing enable protection of virtual machine in InMage provider. + internal partial interface IInMageDiskSignatureExclusionOptionsInternal + + { + /// The guest signature of disk to be excluded from replication. + string DiskSignature { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageDiskSignatureExclusionOptions.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageDiskSignatureExclusionOptions.json.cs new file mode 100644 index 000000000000..f1a456c8d2e7 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageDiskSignatureExclusionOptions.json.cs @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// + /// Guest disk signature based disk exclusion option when doing enable protection of virtual machine in InMage provider. + /// + public partial class InMageDiskSignatureExclusionOptions + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskSignatureExclusionOptions. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskSignatureExclusionOptions. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskSignatureExclusionOptions FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new InMageDiskSignatureExclusionOptions(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal InMageDiskSignatureExclusionOptions(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_diskSignature = If( json?.PropertyT("diskSignature"), out var __jsonDiskSignature) ? (string)__jsonDiskSignature : (string)DiskSignature;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._diskSignature)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._diskSignature.ToString()) : null, "diskSignature" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageEnableProtectionInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageEnableProtectionInput.PowerShell.cs new file mode 100644 index 000000000000..57b3dbb34526 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageEnableProtectionInput.PowerShell.cs @@ -0,0 +1,242 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// VMware Azure specific enable protection input. + [System.ComponentModel.TypeConverter(typeof(InMageEnableProtectionInputTypeConverter))] + public partial class InMageEnableProtectionInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageEnableProtectionInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InMageEnableProtectionInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageEnableProtectionInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InMageEnableProtectionInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageEnableProtectionInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InMageEnableProtectionInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DiskExclusionInput")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageEnableProtectionInputInternal)this).DiskExclusionInput = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskExclusionInput) content.GetValueForProperty("DiskExclusionInput",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageEnableProtectionInputInternal)this).DiskExclusionInput, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageDiskExclusionInputTypeConverter.ConvertFrom); + } + if (content.Contains("VMFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageEnableProtectionInputInternal)this).VMFriendlyName = (string) content.GetValueForProperty("VMFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageEnableProtectionInputInternal)this).VMFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("MasterTargetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageEnableProtectionInputInternal)this).MasterTargetId = (string) content.GetValueForProperty("MasterTargetId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageEnableProtectionInputInternal)this).MasterTargetId, global::System.Convert.ToString); + } + if (content.Contains("ProcessServerId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageEnableProtectionInputInternal)this).ProcessServerId = (string) content.GetValueForProperty("ProcessServerId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageEnableProtectionInputInternal)this).ProcessServerId, global::System.Convert.ToString); + } + if (content.Contains("RetentionDrive")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageEnableProtectionInputInternal)this).RetentionDrive = (string) content.GetValueForProperty("RetentionDrive",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageEnableProtectionInputInternal)this).RetentionDrive, global::System.Convert.ToString); + } + if (content.Contains("RunAsAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageEnableProtectionInputInternal)this).RunAsAccountId = (string) content.GetValueForProperty("RunAsAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageEnableProtectionInputInternal)this).RunAsAccountId, global::System.Convert.ToString); + } + if (content.Contains("MultiVMGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageEnableProtectionInputInternal)this).MultiVMGroupId = (string) content.GetValueForProperty("MultiVMGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageEnableProtectionInputInternal)this).MultiVMGroupId, global::System.Convert.ToString); + } + if (content.Contains("MultiVMGroupName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageEnableProtectionInputInternal)this).MultiVMGroupName = (string) content.GetValueForProperty("MultiVMGroupName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageEnableProtectionInputInternal)this).MultiVMGroupName, global::System.Convert.ToString); + } + if (content.Contains("DatastoreName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageEnableProtectionInputInternal)this).DatastoreName = (string) content.GetValueForProperty("DatastoreName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageEnableProtectionInputInternal)this).DatastoreName, global::System.Convert.ToString); + } + if (content.Contains("DisksToInclude")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageEnableProtectionInputInternal)this).DisksToInclude = (string[]) content.GetValueForProperty("DisksToInclude",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageEnableProtectionInputInternal)this).DisksToInclude, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + if (content.Contains("DiskExclusionInputVolumeOption")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageEnableProtectionInputInternal)this).DiskExclusionInputVolumeOption = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageVolumeExclusionOptions[]) content.GetValueForProperty("DiskExclusionInputVolumeOption",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageEnableProtectionInputInternal)this).DiskExclusionInputVolumeOption, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageVolumeExclusionOptionsTypeConverter.ConvertFrom)); + } + if (content.Contains("DiskExclusionInputDiskSignatureOption")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageEnableProtectionInputInternal)this).DiskExclusionInputDiskSignatureOption = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskSignatureExclusionOptions[]) content.GetValueForProperty("DiskExclusionInputDiskSignatureOption",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageEnableProtectionInputInternal)this).DiskExclusionInputDiskSignatureOption, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageDiskSignatureExclusionOptionsTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InMageEnableProtectionInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DiskExclusionInput")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageEnableProtectionInputInternal)this).DiskExclusionInput = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskExclusionInput) content.GetValueForProperty("DiskExclusionInput",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageEnableProtectionInputInternal)this).DiskExclusionInput, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageDiskExclusionInputTypeConverter.ConvertFrom); + } + if (content.Contains("VMFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageEnableProtectionInputInternal)this).VMFriendlyName = (string) content.GetValueForProperty("VMFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageEnableProtectionInputInternal)this).VMFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("MasterTargetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageEnableProtectionInputInternal)this).MasterTargetId = (string) content.GetValueForProperty("MasterTargetId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageEnableProtectionInputInternal)this).MasterTargetId, global::System.Convert.ToString); + } + if (content.Contains("ProcessServerId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageEnableProtectionInputInternal)this).ProcessServerId = (string) content.GetValueForProperty("ProcessServerId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageEnableProtectionInputInternal)this).ProcessServerId, global::System.Convert.ToString); + } + if (content.Contains("RetentionDrive")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageEnableProtectionInputInternal)this).RetentionDrive = (string) content.GetValueForProperty("RetentionDrive",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageEnableProtectionInputInternal)this).RetentionDrive, global::System.Convert.ToString); + } + if (content.Contains("RunAsAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageEnableProtectionInputInternal)this).RunAsAccountId = (string) content.GetValueForProperty("RunAsAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageEnableProtectionInputInternal)this).RunAsAccountId, global::System.Convert.ToString); + } + if (content.Contains("MultiVMGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageEnableProtectionInputInternal)this).MultiVMGroupId = (string) content.GetValueForProperty("MultiVMGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageEnableProtectionInputInternal)this).MultiVMGroupId, global::System.Convert.ToString); + } + if (content.Contains("MultiVMGroupName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageEnableProtectionInputInternal)this).MultiVMGroupName = (string) content.GetValueForProperty("MultiVMGroupName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageEnableProtectionInputInternal)this).MultiVMGroupName, global::System.Convert.ToString); + } + if (content.Contains("DatastoreName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageEnableProtectionInputInternal)this).DatastoreName = (string) content.GetValueForProperty("DatastoreName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageEnableProtectionInputInternal)this).DatastoreName, global::System.Convert.ToString); + } + if (content.Contains("DisksToInclude")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageEnableProtectionInputInternal)this).DisksToInclude = (string[]) content.GetValueForProperty("DisksToInclude",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageEnableProtectionInputInternal)this).DisksToInclude, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + if (content.Contains("DiskExclusionInputVolumeOption")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageEnableProtectionInputInternal)this).DiskExclusionInputVolumeOption = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageVolumeExclusionOptions[]) content.GetValueForProperty("DiskExclusionInputVolumeOption",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageEnableProtectionInputInternal)this).DiskExclusionInputVolumeOption, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageVolumeExclusionOptionsTypeConverter.ConvertFrom)); + } + if (content.Contains("DiskExclusionInputDiskSignatureOption")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageEnableProtectionInputInternal)this).DiskExclusionInputDiskSignatureOption = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskSignatureExclusionOptions[]) content.GetValueForProperty("DiskExclusionInputDiskSignatureOption",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageEnableProtectionInputInternal)this).DiskExclusionInputDiskSignatureOption, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageDiskSignatureExclusionOptionsTypeConverter.ConvertFrom)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// VMware Azure specific enable protection input. + [System.ComponentModel.TypeConverter(typeof(InMageEnableProtectionInputTypeConverter))] + public partial interface IInMageEnableProtectionInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageEnableProtectionInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageEnableProtectionInput.TypeConverter.cs new file mode 100644 index 000000000000..e0c722b5ee7f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageEnableProtectionInput.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InMageEnableProtectionInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageEnableProtectionInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageEnableProtectionInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InMageEnableProtectionInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InMageEnableProtectionInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InMageEnableProtectionInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageEnableProtectionInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageEnableProtectionInput.cs new file mode 100644 index 000000000000..931a09f65cdf --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageEnableProtectionInput.cs @@ -0,0 +1,250 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// VMware Azure specific enable protection input. + public partial class InMageEnableProtectionInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageEnableProtectionInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageEnableProtectionInputInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionProviderSpecificInput __enableProtectionProviderSpecificInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EnableProtectionProviderSpecificInput(); + + /// Backing field for property. + private string _datastoreName; + + /// The target datastore name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string DatastoreName { get => this._datastoreName; set => this._datastoreName = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskExclusionInput _diskExclusionInput; + + /// The enable disk exclusion input. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskExclusionInput DiskExclusionInput { get => (this._diskExclusionInput = this._diskExclusionInput ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageDiskExclusionInput()); set => this._diskExclusionInput = value; } + + /// The guest disk signature based option for disk exclusion. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskSignatureExclusionOptions[] DiskExclusionInputDiskSignatureOption { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskExclusionInputInternal)DiskExclusionInput).DiskSignatureOption; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskExclusionInputInternal)DiskExclusionInput).DiskSignatureOption = value ?? null /* arrayOf */; } + + /// The volume label based option for disk exclusion. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageVolumeExclusionOptions[] DiskExclusionInputVolumeOption { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskExclusionInputInternal)DiskExclusionInput).VolumeOption; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskExclusionInputInternal)DiskExclusionInput).VolumeOption = value ?? null /* arrayOf */; } + + /// Backing field for property. + private string[] _disksToInclude; + + /// The disks to include list. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string[] DisksToInclude { get => this._disksToInclude; set => this._disksToInclude = value; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionProviderSpecificInputInternal)__enableProtectionProviderSpecificInput).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionProviderSpecificInputInternal)__enableProtectionProviderSpecificInput).InstanceType = value ; } + + /// Backing field for property. + private string _masterTargetId; + + /// The Master Target Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string MasterTargetId { get => this._masterTargetId; set => this._masterTargetId = value; } + + /// Internal Acessors for DiskExclusionInput + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskExclusionInput Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageEnableProtectionInputInternal.DiskExclusionInput { get => (this._diskExclusionInput = this._diskExclusionInput ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageDiskExclusionInput()); set { {_diskExclusionInput = value;} } } + + /// Backing field for property. + private string _multiVMGroupId; + + /// The multi VM group Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string MultiVMGroupId { get => this._multiVMGroupId; set => this._multiVMGroupId = value; } + + /// Backing field for property. + private string _multiVMGroupName; + + /// The multi VM group name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string MultiVMGroupName { get => this._multiVMGroupName; set => this._multiVMGroupName = value; } + + /// Backing field for property. + private string _processServerId; + + /// The Process Server Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ProcessServerId { get => this._processServerId; set => this._processServerId = value; } + + /// Backing field for property. + private string _retentionDrive; + + /// The retention drive to use on the MT. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RetentionDrive { get => this._retentionDrive; set => this._retentionDrive = value; } + + /// Backing field for property. + private string _runAsAccountId; + + /// The CS account Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RunAsAccountId { get => this._runAsAccountId; set => this._runAsAccountId = value; } + + /// Backing field for property. + private string _vMFriendlyName; + + /// The VM Name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string VMFriendlyName { get => this._vMFriendlyName; set => this._vMFriendlyName = value; } + + /// Creates an new instance. + public InMageEnableProtectionInput() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__enableProtectionProviderSpecificInput), __enableProtectionProviderSpecificInput); + await eventListener.AssertObjectIsValid(nameof(__enableProtectionProviderSpecificInput), __enableProtectionProviderSpecificInput); + } + } + /// VMware Azure specific enable protection input. + public partial interface IInMageEnableProtectionInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionProviderSpecificInput + { + /// The target datastore name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target datastore name.", + SerializedName = @"datastoreName", + PossibleTypes = new [] { typeof(string) })] + string DatastoreName { get; set; } + /// The guest disk signature based option for disk exclusion. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The guest disk signature based option for disk exclusion.", + SerializedName = @"diskSignatureOptions", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskSignatureExclusionOptions) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskSignatureExclusionOptions[] DiskExclusionInputDiskSignatureOption { get; set; } + /// The volume label based option for disk exclusion. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The volume label based option for disk exclusion.", + SerializedName = @"volumeOptions", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageVolumeExclusionOptions) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageVolumeExclusionOptions[] DiskExclusionInputVolumeOption { get; set; } + /// The disks to include list. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The disks to include list.", + SerializedName = @"disksToInclude", + PossibleTypes = new [] { typeof(string) })] + string[] DisksToInclude { get; set; } + /// The Master Target Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The Master Target Id.", + SerializedName = @"masterTargetId", + PossibleTypes = new [] { typeof(string) })] + string MasterTargetId { get; set; } + /// The multi VM group Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The multi VM group Id.", + SerializedName = @"multiVmGroupId", + PossibleTypes = new [] { typeof(string) })] + string MultiVMGroupId { get; set; } + /// The multi VM group name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The multi VM group name.", + SerializedName = @"multiVmGroupName", + PossibleTypes = new [] { typeof(string) })] + string MultiVMGroupName { get; set; } + /// The Process Server Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The Process Server Id.", + SerializedName = @"processServerId", + PossibleTypes = new [] { typeof(string) })] + string ProcessServerId { get; set; } + /// The retention drive to use on the MT. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The retention drive to use on the MT.", + SerializedName = @"retentionDrive", + PossibleTypes = new [] { typeof(string) })] + string RetentionDrive { get; set; } + /// The CS account Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The CS account Id.", + SerializedName = @"runAsAccountId", + PossibleTypes = new [] { typeof(string) })] + string RunAsAccountId { get; set; } + /// The VM Name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The VM Name.", + SerializedName = @"vmFriendlyName", + PossibleTypes = new [] { typeof(string) })] + string VMFriendlyName { get; set; } + + } + /// VMware Azure specific enable protection input. + internal partial interface IInMageEnableProtectionInputInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionProviderSpecificInputInternal + { + /// The target datastore name. + string DatastoreName { get; set; } + /// The enable disk exclusion input. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskExclusionInput DiskExclusionInput { get; set; } + /// The guest disk signature based option for disk exclusion. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskSignatureExclusionOptions[] DiskExclusionInputDiskSignatureOption { get; set; } + /// The volume label based option for disk exclusion. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageVolumeExclusionOptions[] DiskExclusionInputVolumeOption { get; set; } + /// The disks to include list. + string[] DisksToInclude { get; set; } + /// The Master Target Id. + string MasterTargetId { get; set; } + /// The multi VM group Id. + string MultiVMGroupId { get; set; } + /// The multi VM group name. + string MultiVMGroupName { get; set; } + /// The Process Server Id. + string ProcessServerId { get; set; } + /// The retention drive to use on the MT. + string RetentionDrive { get; set; } + /// The CS account Id. + string RunAsAccountId { get; set; } + /// The VM Name. + string VMFriendlyName { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageEnableProtectionInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageEnableProtectionInput.json.cs new file mode 100644 index 000000000000..78fbf91956cc --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageEnableProtectionInput.json.cs @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// VMware Azure specific enable protection input. + public partial class InMageEnableProtectionInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageEnableProtectionInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageEnableProtectionInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageEnableProtectionInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new InMageEnableProtectionInput(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal InMageEnableProtectionInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __enableProtectionProviderSpecificInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EnableProtectionProviderSpecificInput(json); + {_diskExclusionInput = If( json?.PropertyT("diskExclusionInput"), out var __jsonDiskExclusionInput) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageDiskExclusionInput.FromJson(__jsonDiskExclusionInput) : DiskExclusionInput;} + {_vMFriendlyName = If( json?.PropertyT("vmFriendlyName"), out var __jsonVMFriendlyName) ? (string)__jsonVMFriendlyName : (string)VMFriendlyName;} + {_masterTargetId = If( json?.PropertyT("masterTargetId"), out var __jsonMasterTargetId) ? (string)__jsonMasterTargetId : (string)MasterTargetId;} + {_processServerId = If( json?.PropertyT("processServerId"), out var __jsonProcessServerId) ? (string)__jsonProcessServerId : (string)ProcessServerId;} + {_retentionDrive = If( json?.PropertyT("retentionDrive"), out var __jsonRetentionDrive) ? (string)__jsonRetentionDrive : (string)RetentionDrive;} + {_runAsAccountId = If( json?.PropertyT("runAsAccountId"), out var __jsonRunAsAccountId) ? (string)__jsonRunAsAccountId : (string)RunAsAccountId;} + {_multiVMGroupId = If( json?.PropertyT("multiVmGroupId"), out var __jsonMultiVMGroupId) ? (string)__jsonMultiVMGroupId : (string)MultiVMGroupId;} + {_multiVMGroupName = If( json?.PropertyT("multiVmGroupName"), out var __jsonMultiVMGroupName) ? (string)__jsonMultiVMGroupName : (string)MultiVMGroupName;} + {_datastoreName = If( json?.PropertyT("datastoreName"), out var __jsonDatastoreName) ? (string)__jsonDatastoreName : (string)DatastoreName;} + {_disksToInclude = If( json?.PropertyT("disksToInclude"), out var __jsonDisksToInclude) ? If( __jsonDisksToInclude as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(string) (__u is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : DisksToInclude;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __enableProtectionProviderSpecificInput?.ToJson(container, serializationMode); + AddIf( null != this._diskExclusionInput ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._diskExclusionInput.ToJson(null,serializationMode) : null, "diskExclusionInput" ,container.Add ); + AddIf( null != (((object)this._vMFriendlyName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._vMFriendlyName.ToString()) : null, "vmFriendlyName" ,container.Add ); + AddIf( null != (((object)this._masterTargetId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._masterTargetId.ToString()) : null, "masterTargetId" ,container.Add ); + AddIf( null != (((object)this._processServerId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._processServerId.ToString()) : null, "processServerId" ,container.Add ); + AddIf( null != (((object)this._retentionDrive)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._retentionDrive.ToString()) : null, "retentionDrive" ,container.Add ); + AddIf( null != (((object)this._runAsAccountId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._runAsAccountId.ToString()) : null, "runAsAccountId" ,container.Add ); + AddIf( null != (((object)this._multiVMGroupId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._multiVMGroupId.ToString()) : null, "multiVmGroupId" ,container.Add ); + AddIf( null != (((object)this._multiVMGroupName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._multiVMGroupName.ToString()) : null, "multiVmGroupName" ,container.Add ); + AddIf( null != (((object)this._datastoreName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._datastoreName.ToString()) : null, "datastoreName" ,container.Add ); + if (null != this._disksToInclude) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._disksToInclude ) + { + AddIf(null != (((object)__x)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(__x.ToString()) : null ,__w.Add); + } + container.Add("disksToInclude",__w); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageFabricSwitchProviderBlockingErrorDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageFabricSwitchProviderBlockingErrorDetails.PowerShell.cs new file mode 100644 index 000000000000..90ca5cc10c3b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageFabricSwitchProviderBlockingErrorDetails.PowerShell.cs @@ -0,0 +1,189 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// InMageFabric switch provider blocking error details. + [System.ComponentModel.TypeConverter(typeof(InMageFabricSwitchProviderBlockingErrorDetailsTypeConverter))] + public partial class InMageFabricSwitchProviderBlockingErrorDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageFabricSwitchProviderBlockingErrorDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InMageFabricSwitchProviderBlockingErrorDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageFabricSwitchProviderBlockingErrorDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InMageFabricSwitchProviderBlockingErrorDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from + /// a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageFabricSwitchProviderBlockingErrorDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InMageFabricSwitchProviderBlockingErrorDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ErrorCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageFabricSwitchProviderBlockingErrorDetailsInternal)this).ErrorCode = (string) content.GetValueForProperty("ErrorCode",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageFabricSwitchProviderBlockingErrorDetailsInternal)this).ErrorCode, global::System.Convert.ToString); + } + if (content.Contains("ErrorMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageFabricSwitchProviderBlockingErrorDetailsInternal)this).ErrorMessage = (string) content.GetValueForProperty("ErrorMessage",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageFabricSwitchProviderBlockingErrorDetailsInternal)this).ErrorMessage, global::System.Convert.ToString); + } + if (content.Contains("PossibleCaus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageFabricSwitchProviderBlockingErrorDetailsInternal)this).PossibleCaus = (string) content.GetValueForProperty("PossibleCaus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageFabricSwitchProviderBlockingErrorDetailsInternal)this).PossibleCaus, global::System.Convert.ToString); + } + if (content.Contains("RecommendedAction")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageFabricSwitchProviderBlockingErrorDetailsInternal)this).RecommendedAction = (string) content.GetValueForProperty("RecommendedAction",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageFabricSwitchProviderBlockingErrorDetailsInternal)this).RecommendedAction, global::System.Convert.ToString); + } + if (content.Contains("ErrorMessageParameter")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageFabricSwitchProviderBlockingErrorDetailsInternal)this).ErrorMessageParameter = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters) content.GetValueForProperty("ErrorMessageParameter",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageFabricSwitchProviderBlockingErrorDetailsInternal)this).ErrorMessageParameter, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageFabricSwitchProviderBlockingErrorDetailsErrorMessageParametersTypeConverter.ConvertFrom); + } + if (content.Contains("ErrorTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageFabricSwitchProviderBlockingErrorDetailsInternal)this).ErrorTag = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageFabricSwitchProviderBlockingErrorDetailsErrorTags) content.GetValueForProperty("ErrorTag",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageFabricSwitchProviderBlockingErrorDetailsInternal)this).ErrorTag, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageFabricSwitchProviderBlockingErrorDetailsErrorTagsTypeConverter.ConvertFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InMageFabricSwitchProviderBlockingErrorDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ErrorCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageFabricSwitchProviderBlockingErrorDetailsInternal)this).ErrorCode = (string) content.GetValueForProperty("ErrorCode",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageFabricSwitchProviderBlockingErrorDetailsInternal)this).ErrorCode, global::System.Convert.ToString); + } + if (content.Contains("ErrorMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageFabricSwitchProviderBlockingErrorDetailsInternal)this).ErrorMessage = (string) content.GetValueForProperty("ErrorMessage",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageFabricSwitchProviderBlockingErrorDetailsInternal)this).ErrorMessage, global::System.Convert.ToString); + } + if (content.Contains("PossibleCaus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageFabricSwitchProviderBlockingErrorDetailsInternal)this).PossibleCaus = (string) content.GetValueForProperty("PossibleCaus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageFabricSwitchProviderBlockingErrorDetailsInternal)this).PossibleCaus, global::System.Convert.ToString); + } + if (content.Contains("RecommendedAction")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageFabricSwitchProviderBlockingErrorDetailsInternal)this).RecommendedAction = (string) content.GetValueForProperty("RecommendedAction",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageFabricSwitchProviderBlockingErrorDetailsInternal)this).RecommendedAction, global::System.Convert.ToString); + } + if (content.Contains("ErrorMessageParameter")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageFabricSwitchProviderBlockingErrorDetailsInternal)this).ErrorMessageParameter = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters) content.GetValueForProperty("ErrorMessageParameter",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageFabricSwitchProviderBlockingErrorDetailsInternal)this).ErrorMessageParameter, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageFabricSwitchProviderBlockingErrorDetailsErrorMessageParametersTypeConverter.ConvertFrom); + } + if (content.Contains("ErrorTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageFabricSwitchProviderBlockingErrorDetailsInternal)this).ErrorTag = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageFabricSwitchProviderBlockingErrorDetailsErrorTags) content.GetValueForProperty("ErrorTag",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageFabricSwitchProviderBlockingErrorDetailsInternal)this).ErrorTag, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageFabricSwitchProviderBlockingErrorDetailsErrorTagsTypeConverter.ConvertFrom); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// InMageFabric switch provider blocking error details. + [System.ComponentModel.TypeConverter(typeof(InMageFabricSwitchProviderBlockingErrorDetailsTypeConverter))] + public partial interface IInMageFabricSwitchProviderBlockingErrorDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageFabricSwitchProviderBlockingErrorDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageFabricSwitchProviderBlockingErrorDetails.TypeConverter.cs new file mode 100644 index 000000000000..0ab41641c5ea --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageFabricSwitchProviderBlockingErrorDetails.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InMageFabricSwitchProviderBlockingErrorDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, + /// otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageFabricSwitchProviderBlockingErrorDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageFabricSwitchProviderBlockingErrorDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InMageFabricSwitchProviderBlockingErrorDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InMageFabricSwitchProviderBlockingErrorDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InMageFabricSwitchProviderBlockingErrorDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageFabricSwitchProviderBlockingErrorDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageFabricSwitchProviderBlockingErrorDetails.cs new file mode 100644 index 000000000000..a526bd406403 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageFabricSwitchProviderBlockingErrorDetails.cs @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMageFabric switch provider blocking error details. + public partial class InMageFabricSwitchProviderBlockingErrorDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageFabricSwitchProviderBlockingErrorDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageFabricSwitchProviderBlockingErrorDetailsInternal + { + + /// Backing field for property. + private string _errorCode; + + /// The error code. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ErrorCode { get => this._errorCode; } + + /// Backing field for property. + private string _errorMessage; + + /// The error message. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ErrorMessage { get => this._errorMessage; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters _errorMessageParameter; + + /// The error message parameters. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters ErrorMessageParameter { get => (this._errorMessageParameter = this._errorMessageParameter ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters()); } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageFabricSwitchProviderBlockingErrorDetailsErrorTags _errorTag; + + /// The error tags. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageFabricSwitchProviderBlockingErrorDetailsErrorTags ErrorTag { get => (this._errorTag = this._errorTag ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageFabricSwitchProviderBlockingErrorDetailsErrorTags()); } + + /// Internal Acessors for ErrorCode + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageFabricSwitchProviderBlockingErrorDetailsInternal.ErrorCode { get => this._errorCode; set { {_errorCode = value;} } } + + /// Internal Acessors for ErrorMessage + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageFabricSwitchProviderBlockingErrorDetailsInternal.ErrorMessage { get => this._errorMessage; set { {_errorMessage = value;} } } + + /// Internal Acessors for ErrorMessageParameter + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageFabricSwitchProviderBlockingErrorDetailsInternal.ErrorMessageParameter { get => (this._errorMessageParameter = this._errorMessageParameter ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters()); set { {_errorMessageParameter = value;} } } + + /// Internal Acessors for ErrorTag + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageFabricSwitchProviderBlockingErrorDetailsErrorTags Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageFabricSwitchProviderBlockingErrorDetailsInternal.ErrorTag { get => (this._errorTag = this._errorTag ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageFabricSwitchProviderBlockingErrorDetailsErrorTags()); set { {_errorTag = value;} } } + + /// Internal Acessors for PossibleCaus + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageFabricSwitchProviderBlockingErrorDetailsInternal.PossibleCaus { get => this._possibleCaus; set { {_possibleCaus = value;} } } + + /// Internal Acessors for RecommendedAction + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageFabricSwitchProviderBlockingErrorDetailsInternal.RecommendedAction { get => this._recommendedAction; set { {_recommendedAction = value;} } } + + /// Backing field for property. + private string _possibleCaus; + + /// The possible causes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string PossibleCaus { get => this._possibleCaus; } + + /// Backing field for property. + private string _recommendedAction; + + /// The recommended action. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecommendedAction { get => this._recommendedAction; } + + /// + /// Creates an new instance. + /// + public InMageFabricSwitchProviderBlockingErrorDetails() + { + + } + } + /// InMageFabric switch provider blocking error details. + public partial interface IInMageFabricSwitchProviderBlockingErrorDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The error code. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The error code.", + SerializedName = @"errorCode", + PossibleTypes = new [] { typeof(string) })] + string ErrorCode { get; } + /// The error message. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The error message.", + SerializedName = @"errorMessage", + PossibleTypes = new [] { typeof(string) })] + string ErrorMessage { get; } + /// The error message parameters. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The error message parameters.", + SerializedName = @"errorMessageParameters", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters ErrorMessageParameter { get; } + /// The error tags. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The error tags.", + SerializedName = @"errorTags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageFabricSwitchProviderBlockingErrorDetailsErrorTags) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageFabricSwitchProviderBlockingErrorDetailsErrorTags ErrorTag { get; } + /// The possible causes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The possible causes.", + SerializedName = @"possibleCauses", + PossibleTypes = new [] { typeof(string) })] + string PossibleCaus { get; } + /// The recommended action. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The recommended action.", + SerializedName = @"recommendedAction", + PossibleTypes = new [] { typeof(string) })] + string RecommendedAction { get; } + + } + /// InMageFabric switch provider blocking error details. + internal partial interface IInMageFabricSwitchProviderBlockingErrorDetailsInternal + + { + /// The error code. + string ErrorCode { get; set; } + /// The error message. + string ErrorMessage { get; set; } + /// The error message parameters. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters ErrorMessageParameter { get; set; } + /// The error tags. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageFabricSwitchProviderBlockingErrorDetailsErrorTags ErrorTag { get; set; } + /// The possible causes. + string PossibleCaus { get; set; } + /// The recommended action. + string RecommendedAction { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageFabricSwitchProviderBlockingErrorDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageFabricSwitchProviderBlockingErrorDetails.json.cs new file mode 100644 index 000000000000..3a752cf3b0da --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageFabricSwitchProviderBlockingErrorDetails.json.cs @@ -0,0 +1,139 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMageFabric switch provider blocking error details. + public partial class InMageFabricSwitchProviderBlockingErrorDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageFabricSwitchProviderBlockingErrorDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageFabricSwitchProviderBlockingErrorDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageFabricSwitchProviderBlockingErrorDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new InMageFabricSwitchProviderBlockingErrorDetails(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal InMageFabricSwitchProviderBlockingErrorDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_errorCode = If( json?.PropertyT("errorCode"), out var __jsonErrorCode) ? (string)__jsonErrorCode : (string)ErrorCode;} + {_errorMessage = If( json?.PropertyT("errorMessage"), out var __jsonErrorMessage) ? (string)__jsonErrorMessage : (string)ErrorMessage;} + {_possibleCaus = If( json?.PropertyT("possibleCauses"), out var __jsonPossibleCauses) ? (string)__jsonPossibleCauses : (string)PossibleCaus;} + {_recommendedAction = If( json?.PropertyT("recommendedAction"), out var __jsonRecommendedAction) ? (string)__jsonRecommendedAction : (string)RecommendedAction;} + {_errorMessageParameter = If( json?.PropertyT("errorMessageParameters"), out var __jsonErrorMessageParameters) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters.FromJson(__jsonErrorMessageParameters) : ErrorMessageParameter;} + {_errorTag = If( json?.PropertyT("errorTags"), out var __jsonErrorTags) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageFabricSwitchProviderBlockingErrorDetailsErrorTags.FromJson(__jsonErrorTags) : ErrorTag;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._errorCode)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._errorCode.ToString()) : null, "errorCode" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._errorMessage)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._errorMessage.ToString()) : null, "errorMessage" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._possibleCaus)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._possibleCaus.ToString()) : null, "possibleCauses" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._recommendedAction)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recommendedAction.ToString()) : null, "recommendedAction" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._errorMessageParameter ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._errorMessageParameter.ToJson(null,serializationMode) : null, "errorMessageParameters" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._errorTag ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._errorTag.ToJson(null,serializationMode) : null, "errorTags" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters.PowerShell.cs new file mode 100644 index 000000000000..193edc286155 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters.PowerShell.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// The error message parameters. + [System.ComponentModel.TypeConverter(typeof(InMageFabricSwitchProviderBlockingErrorDetailsErrorMessageParametersTypeConverter))] + public partial class InMageFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InMageFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InMageFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters(content); + } + + /// + /// Creates a new instance of , deserializing + /// the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InMageFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InMageFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// The error message parameters. + [System.ComponentModel.TypeConverter(typeof(InMageFabricSwitchProviderBlockingErrorDetailsErrorMessageParametersTypeConverter))] + public partial interface IInMageFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters.TypeConverter.cs new file mode 100644 index 000000000000..941c2c0f4854 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InMageFabricSwitchProviderBlockingErrorDetailsErrorMessageParametersTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if + /// there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if + /// there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InMageFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InMageFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InMageFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters.cs new file mode 100644 index 000000000000..a21fb16e589a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The error message parameters. + public partial class InMageFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageFabricSwitchProviderBlockingErrorDetailsErrorMessageParametersInternal + { + + /// + /// Creates an new instance. + /// + public InMageFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters() + { + + } + } + /// The error message parameters. + public partial interface IInMageFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray + { + + } + /// The error message parameters. + internal partial interface IInMageFabricSwitchProviderBlockingErrorDetailsErrorMessageParametersInternal + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters.dictionary.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters.dictionary.cs new file mode 100644 index 000000000000..97dc2d883975 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters.dictionary.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + public partial class InMageFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray + { + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + + int Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Values { get => __additionalProperties.Values; } + + public string this[global::System.String index] { get => __additionalProperties[index]; set => __additionalProperties[index] = value; } + + /// + /// + public void Add(global::System.String key, string value) => __additionalProperties.Add( key, value); + + public void Clear() => __additionalProperties.Clear(); + + /// + public bool ContainsKey(global::System.String key) => __additionalProperties.ContainsKey( key); + + /// + public void CopyFrom(global::System.Collections.IDictionary source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public void CopyFrom(global::System.Management.Automation.PSObject source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public bool Remove(global::System.String key) => __additionalProperties.Remove( key); + + /// + /// + public bool TryGetValue(global::System.String key, out string value) => __additionalProperties.TryGetValue( key, out value); + + /// + + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters source) => source.__additionalProperties; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters.json.cs new file mode 100644 index 000000000000..289818e6f55d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The error message parameters. + public partial class InMageFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new InMageFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + /// + internal InMageFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, global::System.Collections.Generic.HashSet exclusions = null) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray)this).AdditionalProperties, null ,exclusions ); + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a + /// . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray)this).AdditionalProperties, container); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageFabricSwitchProviderBlockingErrorDetailsErrorTags.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageFabricSwitchProviderBlockingErrorDetailsErrorTags.PowerShell.cs new file mode 100644 index 000000000000..b0e14677cc76 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageFabricSwitchProviderBlockingErrorDetailsErrorTags.PowerShell.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// The error tags. + [System.ComponentModel.TypeConverter(typeof(InMageFabricSwitchProviderBlockingErrorDetailsErrorTagsTypeConverter))] + public partial class InMageFabricSwitchProviderBlockingErrorDetailsErrorTags + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageFabricSwitchProviderBlockingErrorDetailsErrorTags DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InMageFabricSwitchProviderBlockingErrorDetailsErrorTags(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageFabricSwitchProviderBlockingErrorDetailsErrorTags DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InMageFabricSwitchProviderBlockingErrorDetailsErrorTags(content); + } + + /// + /// Creates a new instance of , deserializing the content + /// from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageFabricSwitchProviderBlockingErrorDetailsErrorTags FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InMageFabricSwitchProviderBlockingErrorDetailsErrorTags(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InMageFabricSwitchProviderBlockingErrorDetailsErrorTags(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// The error tags. + [System.ComponentModel.TypeConverter(typeof(InMageFabricSwitchProviderBlockingErrorDetailsErrorTagsTypeConverter))] + public partial interface IInMageFabricSwitchProviderBlockingErrorDetailsErrorTags + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageFabricSwitchProviderBlockingErrorDetailsErrorTags.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageFabricSwitchProviderBlockingErrorDetailsErrorTags.TypeConverter.cs new file mode 100644 index 000000000000..bcc0e518860a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageFabricSwitchProviderBlockingErrorDetailsErrorTags.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InMageFabricSwitchProviderBlockingErrorDetailsErrorTagsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageFabricSwitchProviderBlockingErrorDetailsErrorTags ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageFabricSwitchProviderBlockingErrorDetailsErrorTags).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InMageFabricSwitchProviderBlockingErrorDetailsErrorTags.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InMageFabricSwitchProviderBlockingErrorDetailsErrorTags.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InMageFabricSwitchProviderBlockingErrorDetailsErrorTags.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageFabricSwitchProviderBlockingErrorDetailsErrorTags.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageFabricSwitchProviderBlockingErrorDetailsErrorTags.cs new file mode 100644 index 000000000000..3e3ee4b4462c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageFabricSwitchProviderBlockingErrorDetailsErrorTags.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The error tags. + public partial class InMageFabricSwitchProviderBlockingErrorDetailsErrorTags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageFabricSwitchProviderBlockingErrorDetailsErrorTags, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageFabricSwitchProviderBlockingErrorDetailsErrorTagsInternal + { + + /// + /// Creates an new instance. + /// + public InMageFabricSwitchProviderBlockingErrorDetailsErrorTags() + { + + } + } + /// The error tags. + public partial interface IInMageFabricSwitchProviderBlockingErrorDetailsErrorTags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray + { + + } + /// The error tags. + internal partial interface IInMageFabricSwitchProviderBlockingErrorDetailsErrorTagsInternal + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageFabricSwitchProviderBlockingErrorDetailsErrorTags.dictionary.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageFabricSwitchProviderBlockingErrorDetailsErrorTags.dictionary.cs new file mode 100644 index 000000000000..985b77d388bd --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageFabricSwitchProviderBlockingErrorDetailsErrorTags.dictionary.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + public partial class InMageFabricSwitchProviderBlockingErrorDetailsErrorTags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray + { + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + + int Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Values { get => __additionalProperties.Values; } + + public string this[global::System.String index] { get => __additionalProperties[index]; set => __additionalProperties[index] = value; } + + /// + /// + public void Add(global::System.String key, string value) => __additionalProperties.Add( key, value); + + public void Clear() => __additionalProperties.Clear(); + + /// + public bool ContainsKey(global::System.String key) => __additionalProperties.ContainsKey( key); + + /// + public void CopyFrom(global::System.Collections.IDictionary source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public void CopyFrom(global::System.Management.Automation.PSObject source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public bool Remove(global::System.String key) => __additionalProperties.Remove( key); + + /// + /// + public bool TryGetValue(global::System.String key, out string value) => __additionalProperties.TryGetValue( key, out value); + + /// + + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageFabricSwitchProviderBlockingErrorDetailsErrorTags source) => source.__additionalProperties; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageFabricSwitchProviderBlockingErrorDetailsErrorTags.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageFabricSwitchProviderBlockingErrorDetailsErrorTags.json.cs new file mode 100644 index 000000000000..d07e0efc6fc7 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageFabricSwitchProviderBlockingErrorDetailsErrorTags.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The error tags. + public partial class InMageFabricSwitchProviderBlockingErrorDetailsErrorTags + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageFabricSwitchProviderBlockingErrorDetailsErrorTags. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageFabricSwitchProviderBlockingErrorDetailsErrorTags. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageFabricSwitchProviderBlockingErrorDetailsErrorTags FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new InMageFabricSwitchProviderBlockingErrorDetailsErrorTags(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + /// + internal InMageFabricSwitchProviderBlockingErrorDetailsErrorTags(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, global::System.Collections.Generic.HashSet exclusions = null) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray)this).AdditionalProperties, null ,exclusions ); + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray)this).AdditionalProperties, container); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMagePolicyDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMagePolicyDetails.PowerShell.cs new file mode 100644 index 000000000000..06244479d8a3 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMagePolicyDetails.PowerShell.cs @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// InMage specific protection profile details. + [System.ComponentModel.TypeConverter(typeof(InMagePolicyDetailsTypeConverter))] + public partial class InMagePolicyDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMagePolicyDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InMagePolicyDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMagePolicyDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InMagePolicyDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMagePolicyDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InMagePolicyDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("RecoveryPointThresholdInMinute")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMagePolicyDetailsInternal)this).RecoveryPointThresholdInMinute = (int?) content.GetValueForProperty("RecoveryPointThresholdInMinute",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMagePolicyDetailsInternal)this).RecoveryPointThresholdInMinute, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("RecoveryPointHistory")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMagePolicyDetailsInternal)this).RecoveryPointHistory = (int?) content.GetValueForProperty("RecoveryPointHistory",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMagePolicyDetailsInternal)this).RecoveryPointHistory, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("AppConsistentFrequencyInMinute")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMagePolicyDetailsInternal)this).AppConsistentFrequencyInMinute = (int?) content.GetValueForProperty("AppConsistentFrequencyInMinute",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMagePolicyDetailsInternal)this).AppConsistentFrequencyInMinute, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("MultiVMSyncStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMagePolicyDetailsInternal)this).MultiVMSyncStatus = (string) content.GetValueForProperty("MultiVMSyncStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMagePolicyDetailsInternal)this).MultiVMSyncStatus, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InMagePolicyDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("RecoveryPointThresholdInMinute")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMagePolicyDetailsInternal)this).RecoveryPointThresholdInMinute = (int?) content.GetValueForProperty("RecoveryPointThresholdInMinute",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMagePolicyDetailsInternal)this).RecoveryPointThresholdInMinute, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("RecoveryPointHistory")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMagePolicyDetailsInternal)this).RecoveryPointHistory = (int?) content.GetValueForProperty("RecoveryPointHistory",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMagePolicyDetailsInternal)this).RecoveryPointHistory, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("AppConsistentFrequencyInMinute")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMagePolicyDetailsInternal)this).AppConsistentFrequencyInMinute = (int?) content.GetValueForProperty("AppConsistentFrequencyInMinute",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMagePolicyDetailsInternal)this).AppConsistentFrequencyInMinute, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("MultiVMSyncStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMagePolicyDetailsInternal)this).MultiVMSyncStatus = (string) content.GetValueForProperty("MultiVMSyncStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMagePolicyDetailsInternal)this).MultiVMSyncStatus, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// InMage specific protection profile details. + [System.ComponentModel.TypeConverter(typeof(InMagePolicyDetailsTypeConverter))] + public partial interface IInMagePolicyDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMagePolicyDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMagePolicyDetails.TypeConverter.cs new file mode 100644 index 000000000000..4bae014b1140 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMagePolicyDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InMagePolicyDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMagePolicyDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMagePolicyDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InMagePolicyDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InMagePolicyDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InMagePolicyDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMagePolicyDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMagePolicyDetails.cs new file mode 100644 index 000000000000..48613d2926eb --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMagePolicyDetails.cs @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMage specific protection profile details. + public partial class InMagePolicyDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMagePolicyDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMagePolicyDetailsInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetails __policyProviderSpecificDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PolicyProviderSpecificDetails(); + + /// Backing field for property. + private int? _appConsistentFrequencyInMinute; + + /// The app consistent snapshot frequency in minutes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? AppConsistentFrequencyInMinute { get => this._appConsistentFrequencyInMinute; set => this._appConsistentFrequencyInMinute = value; } + + /// Gets the class type. Overridden in derived classes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetailsInternal)__policyProviderSpecificDetails).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetailsInternal)__policyProviderSpecificDetails).InstanceType = value ; } + + /// Backing field for property. + private string _multiVMSyncStatus; + + /// A value indicating whether multi-VM sync has to be enabled. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string MultiVMSyncStatus { get => this._multiVMSyncStatus; set => this._multiVMSyncStatus = value; } + + /// Backing field for property. + private int? _recoveryPointHistory; + + /// The duration in minutes until which the recovery points need to be stored. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? RecoveryPointHistory { get => this._recoveryPointHistory; set => this._recoveryPointHistory = value; } + + /// Backing field for property. + private int? _recoveryPointThresholdInMinute; + + /// The recovery point threshold in minutes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? RecoveryPointThresholdInMinute { get => this._recoveryPointThresholdInMinute; set => this._recoveryPointThresholdInMinute = value; } + + /// Creates an new instance. + public InMagePolicyDetails() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__policyProviderSpecificDetails), __policyProviderSpecificDetails); + await eventListener.AssertObjectIsValid(nameof(__policyProviderSpecificDetails), __policyProviderSpecificDetails); + } + } + /// InMage specific protection profile details. + public partial interface IInMagePolicyDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetails + { + /// The app consistent snapshot frequency in minutes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The app consistent snapshot frequency in minutes.", + SerializedName = @"appConsistentFrequencyInMinutes", + PossibleTypes = new [] { typeof(int) })] + int? AppConsistentFrequencyInMinute { get; set; } + /// A value indicating whether multi-VM sync has to be enabled. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether multi-VM sync has to be enabled.", + SerializedName = @"multiVmSyncStatus", + PossibleTypes = new [] { typeof(string) })] + string MultiVMSyncStatus { get; set; } + /// The duration in minutes until which the recovery points need to be stored. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The duration in minutes until which the recovery points need to be stored.", + SerializedName = @"recoveryPointHistory", + PossibleTypes = new [] { typeof(int) })] + int? RecoveryPointHistory { get; set; } + /// The recovery point threshold in minutes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery point threshold in minutes.", + SerializedName = @"recoveryPointThresholdInMinutes", + PossibleTypes = new [] { typeof(int) })] + int? RecoveryPointThresholdInMinute { get; set; } + + } + /// InMage specific protection profile details. + internal partial interface IInMagePolicyDetailsInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetailsInternal + { + /// The app consistent snapshot frequency in minutes. + int? AppConsistentFrequencyInMinute { get; set; } + /// A value indicating whether multi-VM sync has to be enabled. + string MultiVMSyncStatus { get; set; } + /// The duration in minutes until which the recovery points need to be stored. + int? RecoveryPointHistory { get; set; } + /// The recovery point threshold in minutes. + int? RecoveryPointThresholdInMinute { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMagePolicyDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMagePolicyDetails.json.cs new file mode 100644 index 000000000000..d30576c7a463 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMagePolicyDetails.json.cs @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMage specific protection profile details. + public partial class InMagePolicyDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMagePolicyDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMagePolicyDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMagePolicyDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new InMagePolicyDetails(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal InMagePolicyDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __policyProviderSpecificDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PolicyProviderSpecificDetails(json); + {_recoveryPointThresholdInMinute = If( json?.PropertyT("recoveryPointThresholdInMinutes"), out var __jsonRecoveryPointThresholdInMinutes) ? (int?)__jsonRecoveryPointThresholdInMinutes : RecoveryPointThresholdInMinute;} + {_recoveryPointHistory = If( json?.PropertyT("recoveryPointHistory"), out var __jsonRecoveryPointHistory) ? (int?)__jsonRecoveryPointHistory : RecoveryPointHistory;} + {_appConsistentFrequencyInMinute = If( json?.PropertyT("appConsistentFrequencyInMinutes"), out var __jsonAppConsistentFrequencyInMinutes) ? (int?)__jsonAppConsistentFrequencyInMinutes : AppConsistentFrequencyInMinute;} + {_multiVMSyncStatus = If( json?.PropertyT("multiVmSyncStatus"), out var __jsonMultiVMSyncStatus) ? (string)__jsonMultiVMSyncStatus : (string)MultiVMSyncStatus;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __policyProviderSpecificDetails?.ToJson(container, serializationMode); + AddIf( null != this._recoveryPointThresholdInMinute ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._recoveryPointThresholdInMinute) : null, "recoveryPointThresholdInMinutes" ,container.Add ); + AddIf( null != this._recoveryPointHistory ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._recoveryPointHistory) : null, "recoveryPointHistory" ,container.Add ); + AddIf( null != this._appConsistentFrequencyInMinute ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._appConsistentFrequencyInMinute) : null, "appConsistentFrequencyInMinutes" ,container.Add ); + AddIf( null != (((object)this._multiVMSyncStatus)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._multiVMSyncStatus.ToString()) : null, "multiVmSyncStatus" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMagePolicyInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMagePolicyInput.PowerShell.cs new file mode 100644 index 000000000000..e9f1e1d78826 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMagePolicyInput.PowerShell.cs @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// VMWare Azure specific protection profile Input. + [System.ComponentModel.TypeConverter(typeof(InMagePolicyInputTypeConverter))] + public partial class InMagePolicyInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMagePolicyInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InMagePolicyInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMagePolicyInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InMagePolicyInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMagePolicyInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InMagePolicyInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("RecoveryPointThresholdInMinute")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMagePolicyInputInternal)this).RecoveryPointThresholdInMinute = (int?) content.GetValueForProperty("RecoveryPointThresholdInMinute",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMagePolicyInputInternal)this).RecoveryPointThresholdInMinute, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("RecoveryPointHistory")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMagePolicyInputInternal)this).RecoveryPointHistory = (int?) content.GetValueForProperty("RecoveryPointHistory",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMagePolicyInputInternal)this).RecoveryPointHistory, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("AppConsistentFrequencyInMinute")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMagePolicyInputInternal)this).AppConsistentFrequencyInMinute = (int?) content.GetValueForProperty("AppConsistentFrequencyInMinute",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMagePolicyInputInternal)this).AppConsistentFrequencyInMinute, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("MultiVMSyncStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMagePolicyInputInternal)this).MultiVMSyncStatus = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SetMultiVMSyncStatus) content.GetValueForProperty("MultiVMSyncStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMagePolicyInputInternal)this).MultiVMSyncStatus, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SetMultiVMSyncStatus.CreateFrom); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InMagePolicyInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("RecoveryPointThresholdInMinute")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMagePolicyInputInternal)this).RecoveryPointThresholdInMinute = (int?) content.GetValueForProperty("RecoveryPointThresholdInMinute",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMagePolicyInputInternal)this).RecoveryPointThresholdInMinute, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("RecoveryPointHistory")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMagePolicyInputInternal)this).RecoveryPointHistory = (int?) content.GetValueForProperty("RecoveryPointHistory",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMagePolicyInputInternal)this).RecoveryPointHistory, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("AppConsistentFrequencyInMinute")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMagePolicyInputInternal)this).AppConsistentFrequencyInMinute = (int?) content.GetValueForProperty("AppConsistentFrequencyInMinute",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMagePolicyInputInternal)this).AppConsistentFrequencyInMinute, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("MultiVMSyncStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMagePolicyInputInternal)this).MultiVMSyncStatus = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SetMultiVMSyncStatus) content.GetValueForProperty("MultiVMSyncStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMagePolicyInputInternal)this).MultiVMSyncStatus, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SetMultiVMSyncStatus.CreateFrom); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// VMWare Azure specific protection profile Input. + [System.ComponentModel.TypeConverter(typeof(InMagePolicyInputTypeConverter))] + public partial interface IInMagePolicyInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMagePolicyInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMagePolicyInput.TypeConverter.cs new file mode 100644 index 000000000000..6531a3fd1b66 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMagePolicyInput.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InMagePolicyInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMagePolicyInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMagePolicyInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InMagePolicyInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InMagePolicyInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InMagePolicyInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMagePolicyInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMagePolicyInput.cs new file mode 100644 index 000000000000..59333e55f895 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMagePolicyInput.cs @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// VMWare Azure specific protection profile Input. + public partial class InMagePolicyInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMagePolicyInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMagePolicyInputInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInput __policyProviderSpecificInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PolicyProviderSpecificInput(); + + /// Backing field for property. + private int? _appConsistentFrequencyInMinute; + + /// The app consistent snapshot frequency (in minutes). + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? AppConsistentFrequencyInMinute { get => this._appConsistentFrequencyInMinute; set => this._appConsistentFrequencyInMinute = value; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInputInternal)__policyProviderSpecificInput).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInputInternal)__policyProviderSpecificInput).InstanceType = value ; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SetMultiVMSyncStatus _multiVMSyncStatus; + + /// + /// A value indicating whether multi-VM sync has to be enabled. Value should be 'Enabled' or 'Disabled'. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SetMultiVMSyncStatus MultiVMSyncStatus { get => this._multiVMSyncStatus; set => this._multiVMSyncStatus = value; } + + /// Backing field for property. + private int? _recoveryPointHistory; + + /// The duration in minutes until which the recovery points need to be stored. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? RecoveryPointHistory { get => this._recoveryPointHistory; set => this._recoveryPointHistory = value; } + + /// Backing field for property. + private int? _recoveryPointThresholdInMinute; + + /// The recovery point threshold in minutes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? RecoveryPointThresholdInMinute { get => this._recoveryPointThresholdInMinute; set => this._recoveryPointThresholdInMinute = value; } + + /// Creates an new instance. + public InMagePolicyInput() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__policyProviderSpecificInput), __policyProviderSpecificInput); + await eventListener.AssertObjectIsValid(nameof(__policyProviderSpecificInput), __policyProviderSpecificInput); + } + } + /// VMWare Azure specific protection profile Input. + public partial interface IInMagePolicyInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInput + { + /// The app consistent snapshot frequency (in minutes). + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The app consistent snapshot frequency (in minutes).", + SerializedName = @"appConsistentFrequencyInMinutes", + PossibleTypes = new [] { typeof(int) })] + int? AppConsistentFrequencyInMinute { get; set; } + /// + /// A value indicating whether multi-VM sync has to be enabled. Value should be 'Enabled' or 'Disabled'. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"A value indicating whether multi-VM sync has to be enabled. Value should be 'Enabled' or 'Disabled'.", + SerializedName = @"multiVmSyncStatus", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SetMultiVMSyncStatus) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SetMultiVMSyncStatus MultiVMSyncStatus { get; set; } + /// The duration in minutes until which the recovery points need to be stored. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The duration in minutes until which the recovery points need to be stored.", + SerializedName = @"recoveryPointHistory", + PossibleTypes = new [] { typeof(int) })] + int? RecoveryPointHistory { get; set; } + /// The recovery point threshold in minutes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery point threshold in minutes.", + SerializedName = @"recoveryPointThresholdInMinutes", + PossibleTypes = new [] { typeof(int) })] + int? RecoveryPointThresholdInMinute { get; set; } + + } + /// VMWare Azure specific protection profile Input. + internal partial interface IInMagePolicyInputInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInputInternal + { + /// The app consistent snapshot frequency (in minutes). + int? AppConsistentFrequencyInMinute { get; set; } + /// + /// A value indicating whether multi-VM sync has to be enabled. Value should be 'Enabled' or 'Disabled'. + /// + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SetMultiVMSyncStatus MultiVMSyncStatus { get; set; } + /// The duration in minutes until which the recovery points need to be stored. + int? RecoveryPointHistory { get; set; } + /// The recovery point threshold in minutes. + int? RecoveryPointThresholdInMinute { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMagePolicyInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMagePolicyInput.json.cs new file mode 100644 index 000000000000..3b428efa42aa --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMagePolicyInput.json.cs @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// VMWare Azure specific protection profile Input. + public partial class InMagePolicyInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMagePolicyInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMagePolicyInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMagePolicyInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new InMagePolicyInput(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal InMagePolicyInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __policyProviderSpecificInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PolicyProviderSpecificInput(json); + {_recoveryPointThresholdInMinute = If( json?.PropertyT("recoveryPointThresholdInMinutes"), out var __jsonRecoveryPointThresholdInMinutes) ? (int?)__jsonRecoveryPointThresholdInMinutes : RecoveryPointThresholdInMinute;} + {_recoveryPointHistory = If( json?.PropertyT("recoveryPointHistory"), out var __jsonRecoveryPointHistory) ? (int?)__jsonRecoveryPointHistory : RecoveryPointHistory;} + {_appConsistentFrequencyInMinute = If( json?.PropertyT("appConsistentFrequencyInMinutes"), out var __jsonAppConsistentFrequencyInMinutes) ? (int?)__jsonAppConsistentFrequencyInMinutes : AppConsistentFrequencyInMinute;} + {_multiVMSyncStatus = If( json?.PropertyT("multiVmSyncStatus"), out var __jsonMultiVMSyncStatus) ? (string)__jsonMultiVMSyncStatus : (string)MultiVMSyncStatus;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __policyProviderSpecificInput?.ToJson(container, serializationMode); + AddIf( null != this._recoveryPointThresholdInMinute ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._recoveryPointThresholdInMinute) : null, "recoveryPointThresholdInMinutes" ,container.Add ); + AddIf( null != this._recoveryPointHistory ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._recoveryPointHistory) : null, "recoveryPointHistory" ,container.Add ); + AddIf( null != this._appConsistentFrequencyInMinute ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._appConsistentFrequencyInMinute) : null, "appConsistentFrequencyInMinutes" ,container.Add ); + AddIf( null != (((object)this._multiVMSyncStatus)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._multiVMSyncStatus.ToString()) : null, "multiVmSyncStatus" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageProtectedDiskDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageProtectedDiskDetails.PowerShell.cs new file mode 100644 index 000000000000..7b12fb624183 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageProtectedDiskDetails.PowerShell.cs @@ -0,0 +1,314 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// InMage protected disk details. + [System.ComponentModel.TypeConverter(typeof(InMageProtectedDiskDetailsTypeConverter))] + public partial class InMageProtectedDiskDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InMageProtectedDiskDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InMageProtectedDiskDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InMageProtectedDiskDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DiskId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetailsInternal)this).DiskId = (string) content.GetValueForProperty("DiskId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetailsInternal)this).DiskId, global::System.Convert.ToString); + } + if (content.Contains("DiskName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetailsInternal)this).DiskName = (string) content.GetValueForProperty("DiskName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetailsInternal)this).DiskName, global::System.Convert.ToString); + } + if (content.Contains("ProtectionStage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetailsInternal)this).ProtectionStage = (string) content.GetValueForProperty("ProtectionStage",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetailsInternal)this).ProtectionStage, global::System.Convert.ToString); + } + if (content.Contains("HealthErrorCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetailsInternal)this).HealthErrorCode = (string) content.GetValueForProperty("HealthErrorCode",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetailsInternal)this).HealthErrorCode, global::System.Convert.ToString); + } + if (content.Contains("RpoInSecond")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetailsInternal)this).RpoInSecond = (long?) content.GetValueForProperty("RpoInSecond",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetailsInternal)this).RpoInSecond, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("ResyncRequired")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetailsInternal)this).ResyncRequired = (string) content.GetValueForProperty("ResyncRequired",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetailsInternal)this).ResyncRequired, global::System.Convert.ToString); + } + if (content.Contains("ResyncProgressPercentage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetailsInternal)this).ResyncProgressPercentage = (int?) content.GetValueForProperty("ResyncProgressPercentage",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetailsInternal)this).ResyncProgressPercentage, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("ResyncDurationInSecond")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetailsInternal)this).ResyncDurationInSecond = (long?) content.GetValueForProperty("ResyncDurationInSecond",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetailsInternal)this).ResyncDurationInSecond, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("DiskCapacityInByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetailsInternal)this).DiskCapacityInByte = (long?) content.GetValueForProperty("DiskCapacityInByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetailsInternal)this).DiskCapacityInByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("FileSystemCapacityInByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetailsInternal)this).FileSystemCapacityInByte = (long?) content.GetValueForProperty("FileSystemCapacityInByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetailsInternal)this).FileSystemCapacityInByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("SourceDataInMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetailsInternal)this).SourceDataInMb = (double?) content.GetValueForProperty("SourceDataInMb",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetailsInternal)this).SourceDataInMb, (__y)=> (double) global::System.Convert.ChangeType(__y, typeof(double))); + } + if (content.Contains("PsDataInMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetailsInternal)this).PsDataInMb = (double?) content.GetValueForProperty("PsDataInMb",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetailsInternal)this).PsDataInMb, (__y)=> (double) global::System.Convert.ChangeType(__y, typeof(double))); + } + if (content.Contains("TargetDataInMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetailsInternal)this).TargetDataInMb = (double?) content.GetValueForProperty("TargetDataInMb",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetailsInternal)this).TargetDataInMb, (__y)=> (double) global::System.Convert.ChangeType(__y, typeof(double))); + } + if (content.Contains("DiskResized")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetailsInternal)this).DiskResized = (string) content.GetValueForProperty("DiskResized",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetailsInternal)this).DiskResized, global::System.Convert.ToString); + } + if (content.Contains("LastRpoCalculatedTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetailsInternal)this).LastRpoCalculatedTime = (global::System.DateTime?) content.GetValueForProperty("LastRpoCalculatedTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetailsInternal)this).LastRpoCalculatedTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ResyncProcessedByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetailsInternal)this).ResyncProcessedByte = (long?) content.GetValueForProperty("ResyncProcessedByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetailsInternal)this).ResyncProcessedByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("ResyncTotalTransferredByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetailsInternal)this).ResyncTotalTransferredByte = (long?) content.GetValueForProperty("ResyncTotalTransferredByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetailsInternal)this).ResyncTotalTransferredByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("ResyncLast15MinutesTransferredByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetailsInternal)this).ResyncLast15MinutesTransferredByte = (long?) content.GetValueForProperty("ResyncLast15MinutesTransferredByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetailsInternal)this).ResyncLast15MinutesTransferredByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("ResyncLastDataTransferTimeUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetailsInternal)this).ResyncLastDataTransferTimeUtc = (global::System.DateTime?) content.GetValueForProperty("ResyncLastDataTransferTimeUtc",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetailsInternal)this).ResyncLastDataTransferTimeUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ResyncStartTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetailsInternal)this).ResyncStartTime = (global::System.DateTime?) content.GetValueForProperty("ResyncStartTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetailsInternal)this).ResyncStartTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ProgressHealth")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetailsInternal)this).ProgressHealth = (string) content.GetValueForProperty("ProgressHealth",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetailsInternal)this).ProgressHealth, global::System.Convert.ToString); + } + if (content.Contains("ProgressStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetailsInternal)this).ProgressStatus = (string) content.GetValueForProperty("ProgressStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetailsInternal)this).ProgressStatus, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InMageProtectedDiskDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DiskId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetailsInternal)this).DiskId = (string) content.GetValueForProperty("DiskId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetailsInternal)this).DiskId, global::System.Convert.ToString); + } + if (content.Contains("DiskName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetailsInternal)this).DiskName = (string) content.GetValueForProperty("DiskName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetailsInternal)this).DiskName, global::System.Convert.ToString); + } + if (content.Contains("ProtectionStage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetailsInternal)this).ProtectionStage = (string) content.GetValueForProperty("ProtectionStage",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetailsInternal)this).ProtectionStage, global::System.Convert.ToString); + } + if (content.Contains("HealthErrorCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetailsInternal)this).HealthErrorCode = (string) content.GetValueForProperty("HealthErrorCode",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetailsInternal)this).HealthErrorCode, global::System.Convert.ToString); + } + if (content.Contains("RpoInSecond")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetailsInternal)this).RpoInSecond = (long?) content.GetValueForProperty("RpoInSecond",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetailsInternal)this).RpoInSecond, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("ResyncRequired")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetailsInternal)this).ResyncRequired = (string) content.GetValueForProperty("ResyncRequired",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetailsInternal)this).ResyncRequired, global::System.Convert.ToString); + } + if (content.Contains("ResyncProgressPercentage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetailsInternal)this).ResyncProgressPercentage = (int?) content.GetValueForProperty("ResyncProgressPercentage",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetailsInternal)this).ResyncProgressPercentage, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("ResyncDurationInSecond")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetailsInternal)this).ResyncDurationInSecond = (long?) content.GetValueForProperty("ResyncDurationInSecond",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetailsInternal)this).ResyncDurationInSecond, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("DiskCapacityInByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetailsInternal)this).DiskCapacityInByte = (long?) content.GetValueForProperty("DiskCapacityInByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetailsInternal)this).DiskCapacityInByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("FileSystemCapacityInByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetailsInternal)this).FileSystemCapacityInByte = (long?) content.GetValueForProperty("FileSystemCapacityInByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetailsInternal)this).FileSystemCapacityInByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("SourceDataInMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetailsInternal)this).SourceDataInMb = (double?) content.GetValueForProperty("SourceDataInMb",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetailsInternal)this).SourceDataInMb, (__y)=> (double) global::System.Convert.ChangeType(__y, typeof(double))); + } + if (content.Contains("PsDataInMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetailsInternal)this).PsDataInMb = (double?) content.GetValueForProperty("PsDataInMb",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetailsInternal)this).PsDataInMb, (__y)=> (double) global::System.Convert.ChangeType(__y, typeof(double))); + } + if (content.Contains("TargetDataInMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetailsInternal)this).TargetDataInMb = (double?) content.GetValueForProperty("TargetDataInMb",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetailsInternal)this).TargetDataInMb, (__y)=> (double) global::System.Convert.ChangeType(__y, typeof(double))); + } + if (content.Contains("DiskResized")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetailsInternal)this).DiskResized = (string) content.GetValueForProperty("DiskResized",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetailsInternal)this).DiskResized, global::System.Convert.ToString); + } + if (content.Contains("LastRpoCalculatedTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetailsInternal)this).LastRpoCalculatedTime = (global::System.DateTime?) content.GetValueForProperty("LastRpoCalculatedTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetailsInternal)this).LastRpoCalculatedTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ResyncProcessedByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetailsInternal)this).ResyncProcessedByte = (long?) content.GetValueForProperty("ResyncProcessedByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetailsInternal)this).ResyncProcessedByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("ResyncTotalTransferredByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetailsInternal)this).ResyncTotalTransferredByte = (long?) content.GetValueForProperty("ResyncTotalTransferredByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetailsInternal)this).ResyncTotalTransferredByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("ResyncLast15MinutesTransferredByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetailsInternal)this).ResyncLast15MinutesTransferredByte = (long?) content.GetValueForProperty("ResyncLast15MinutesTransferredByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetailsInternal)this).ResyncLast15MinutesTransferredByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("ResyncLastDataTransferTimeUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetailsInternal)this).ResyncLastDataTransferTimeUtc = (global::System.DateTime?) content.GetValueForProperty("ResyncLastDataTransferTimeUtc",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetailsInternal)this).ResyncLastDataTransferTimeUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ResyncStartTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetailsInternal)this).ResyncStartTime = (global::System.DateTime?) content.GetValueForProperty("ResyncStartTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetailsInternal)this).ResyncStartTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ProgressHealth")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetailsInternal)this).ProgressHealth = (string) content.GetValueForProperty("ProgressHealth",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetailsInternal)this).ProgressHealth, global::System.Convert.ToString); + } + if (content.Contains("ProgressStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetailsInternal)this).ProgressStatus = (string) content.GetValueForProperty("ProgressStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetailsInternal)this).ProgressStatus, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// InMage protected disk details. + [System.ComponentModel.TypeConverter(typeof(InMageProtectedDiskDetailsTypeConverter))] + public partial interface IInMageProtectedDiskDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageProtectedDiskDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageProtectedDiskDetails.TypeConverter.cs new file mode 100644 index 000000000000..5d85a6097f0c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageProtectedDiskDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InMageProtectedDiskDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InMageProtectedDiskDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InMageProtectedDiskDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InMageProtectedDiskDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageProtectedDiskDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageProtectedDiskDetails.cs new file mode 100644 index 000000000000..8d893f57bafe --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageProtectedDiskDetails.cs @@ -0,0 +1,408 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMage protected disk details. + public partial class InMageProtectedDiskDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetailsInternal + { + + /// Backing field for property. + private long? _diskCapacityInByte; + + /// The disk capacity in bytes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public long? DiskCapacityInByte { get => this._diskCapacityInByte; set => this._diskCapacityInByte = value; } + + /// Backing field for property. + private string _diskId; + + /// The disk id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string DiskId { get => this._diskId; set => this._diskId = value; } + + /// Backing field for property. + private string _diskName; + + /// The disk name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string DiskName { get => this._diskName; set => this._diskName = value; } + + /// Backing field for property. + private string _diskResized; + + /// A value indicating whether disk is resized. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string DiskResized { get => this._diskResized; set => this._diskResized = value; } + + /// Backing field for property. + private long? _fileSystemCapacityInByte; + + /// The file system capacity in bytes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public long? FileSystemCapacityInByte { get => this._fileSystemCapacityInByte; set => this._fileSystemCapacityInByte = value; } + + /// Backing field for property. + private string _healthErrorCode; + + /// The health error code for the disk. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string HealthErrorCode { get => this._healthErrorCode; set => this._healthErrorCode = value; } + + /// Backing field for property. + private global::System.DateTime? _lastRpoCalculatedTime; + + /// The last RPO calculated time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public global::System.DateTime? LastRpoCalculatedTime { get => this._lastRpoCalculatedTime; set => this._lastRpoCalculatedTime = value; } + + /// Backing field for property. + private string _progressHealth; + + /// The Progress Health. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ProgressHealth { get => this._progressHealth; set => this._progressHealth = value; } + + /// Backing field for property. + private string _progressStatus; + + /// The Progress Status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ProgressStatus { get => this._progressStatus; set => this._progressStatus = value; } + + /// Backing field for property. + private string _protectionStage; + + /// The protection stage. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ProtectionStage { get => this._protectionStage; set => this._protectionStage = value; } + + /// Backing field for property. + private double? _psDataInMb; + + /// The PS data transit in MB. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public double? PsDataInMb { get => this._psDataInMb; set => this._psDataInMb = value; } + + /// Backing field for property. + private long? _resyncDurationInSecond; + + /// The resync duration in seconds. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public long? ResyncDurationInSecond { get => this._resyncDurationInSecond; set => this._resyncDurationInSecond = value; } + + /// Backing field for property. + private long? _resyncLast15MinutesTransferredByte; + + /// The resync last 15 minutes transferred bytes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public long? ResyncLast15MinutesTransferredByte { get => this._resyncLast15MinutesTransferredByte; set => this._resyncLast15MinutesTransferredByte = value; } + + /// Backing field for property. + private global::System.DateTime? _resyncLastDataTransferTimeUtc; + + /// The last data transfer time in UTC. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public global::System.DateTime? ResyncLastDataTransferTimeUtc { get => this._resyncLastDataTransferTimeUtc; set => this._resyncLastDataTransferTimeUtc = value; } + + /// Backing field for property. + private long? _resyncProcessedByte; + + /// The resync processed bytes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public long? ResyncProcessedByte { get => this._resyncProcessedByte; set => this._resyncProcessedByte = value; } + + /// Backing field for property. + private int? _resyncProgressPercentage; + + /// The resync progress percentage. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? ResyncProgressPercentage { get => this._resyncProgressPercentage; set => this._resyncProgressPercentage = value; } + + /// Backing field for property. + private string _resyncRequired; + + /// A value indicating whether resync is required for this disk. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ResyncRequired { get => this._resyncRequired; set => this._resyncRequired = value; } + + /// Backing field for property. + private global::System.DateTime? _resyncStartTime; + + /// The resync start time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public global::System.DateTime? ResyncStartTime { get => this._resyncStartTime; set => this._resyncStartTime = value; } + + /// Backing field for property. + private long? _resyncTotalTransferredByte; + + /// The resync total transferred bytes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public long? ResyncTotalTransferredByte { get => this._resyncTotalTransferredByte; set => this._resyncTotalTransferredByte = value; } + + /// Backing field for property. + private long? _rpoInSecond; + + /// The RPO in seconds. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public long? RpoInSecond { get => this._rpoInSecond; set => this._rpoInSecond = value; } + + /// Backing field for property. + private double? _sourceDataInMb; + + /// The source data transit in MB. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public double? SourceDataInMb { get => this._sourceDataInMb; set => this._sourceDataInMb = value; } + + /// Backing field for property. + private double? _targetDataInMb; + + /// The target data transit in MB. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public double? TargetDataInMb { get => this._targetDataInMb; set => this._targetDataInMb = value; } + + /// Creates an new instance. + public InMageProtectedDiskDetails() + { + + } + } + /// InMage protected disk details. + public partial interface IInMageProtectedDiskDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The disk capacity in bytes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The disk capacity in bytes.", + SerializedName = @"diskCapacityInBytes", + PossibleTypes = new [] { typeof(long) })] + long? DiskCapacityInByte { get; set; } + /// The disk id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The disk id.", + SerializedName = @"diskId", + PossibleTypes = new [] { typeof(string) })] + string DiskId { get; set; } + /// The disk name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The disk name.", + SerializedName = @"diskName", + PossibleTypes = new [] { typeof(string) })] + string DiskName { get; set; } + /// A value indicating whether disk is resized. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether disk is resized.", + SerializedName = @"diskResized", + PossibleTypes = new [] { typeof(string) })] + string DiskResized { get; set; } + /// The file system capacity in bytes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The file system capacity in bytes.", + SerializedName = @"fileSystemCapacityInBytes", + PossibleTypes = new [] { typeof(long) })] + long? FileSystemCapacityInByte { get; set; } + /// The health error code for the disk. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The health error code for the disk.", + SerializedName = @"healthErrorCode", + PossibleTypes = new [] { typeof(string) })] + string HealthErrorCode { get; set; } + /// The last RPO calculated time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The last RPO calculated time.", + SerializedName = @"lastRpoCalculatedTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? LastRpoCalculatedTime { get; set; } + /// The Progress Health. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Progress Health.", + SerializedName = @"progressHealth", + PossibleTypes = new [] { typeof(string) })] + string ProgressHealth { get; set; } + /// The Progress Status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Progress Status.", + SerializedName = @"progressStatus", + PossibleTypes = new [] { typeof(string) })] + string ProgressStatus { get; set; } + /// The protection stage. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The protection stage.", + SerializedName = @"protectionStage", + PossibleTypes = new [] { typeof(string) })] + string ProtectionStage { get; set; } + /// The PS data transit in MB. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The PS data transit in MB.", + SerializedName = @"psDataInMB", + PossibleTypes = new [] { typeof(double) })] + double? PsDataInMb { get; set; } + /// The resync duration in seconds. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The resync duration in seconds.", + SerializedName = @"resyncDurationInSeconds", + PossibleTypes = new [] { typeof(long) })] + long? ResyncDurationInSecond { get; set; } + /// The resync last 15 minutes transferred bytes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The resync last 15 minutes transferred bytes.", + SerializedName = @"resyncLast15MinutesTransferredBytes", + PossibleTypes = new [] { typeof(long) })] + long? ResyncLast15MinutesTransferredByte { get; set; } + /// The last data transfer time in UTC. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The last data transfer time in UTC.", + SerializedName = @"resyncLastDataTransferTimeUTC", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? ResyncLastDataTransferTimeUtc { get; set; } + /// The resync processed bytes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The resync processed bytes.", + SerializedName = @"resyncProcessedBytes", + PossibleTypes = new [] { typeof(long) })] + long? ResyncProcessedByte { get; set; } + /// The resync progress percentage. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The resync progress percentage.", + SerializedName = @"resyncProgressPercentage", + PossibleTypes = new [] { typeof(int) })] + int? ResyncProgressPercentage { get; set; } + /// A value indicating whether resync is required for this disk. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether resync is required for this disk.", + SerializedName = @"resyncRequired", + PossibleTypes = new [] { typeof(string) })] + string ResyncRequired { get; set; } + /// The resync start time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The resync start time.", + SerializedName = @"resyncStartTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? ResyncStartTime { get; set; } + /// The resync total transferred bytes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The resync total transferred bytes.", + SerializedName = @"resyncTotalTransferredBytes", + PossibleTypes = new [] { typeof(long) })] + long? ResyncTotalTransferredByte { get; set; } + /// The RPO in seconds. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The RPO in seconds.", + SerializedName = @"rpoInSeconds", + PossibleTypes = new [] { typeof(long) })] + long? RpoInSecond { get; set; } + /// The source data transit in MB. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The source data transit in MB.", + SerializedName = @"sourceDataInMB", + PossibleTypes = new [] { typeof(double) })] + double? SourceDataInMb { get; set; } + /// The target data transit in MB. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target data transit in MB.", + SerializedName = @"targetDataInMB", + PossibleTypes = new [] { typeof(double) })] + double? TargetDataInMb { get; set; } + + } + /// InMage protected disk details. + internal partial interface IInMageProtectedDiskDetailsInternal + + { + /// The disk capacity in bytes. + long? DiskCapacityInByte { get; set; } + /// The disk id. + string DiskId { get; set; } + /// The disk name. + string DiskName { get; set; } + /// A value indicating whether disk is resized. + string DiskResized { get; set; } + /// The file system capacity in bytes. + long? FileSystemCapacityInByte { get; set; } + /// The health error code for the disk. + string HealthErrorCode { get; set; } + /// The last RPO calculated time. + global::System.DateTime? LastRpoCalculatedTime { get; set; } + /// The Progress Health. + string ProgressHealth { get; set; } + /// The Progress Status. + string ProgressStatus { get; set; } + /// The protection stage. + string ProtectionStage { get; set; } + /// The PS data transit in MB. + double? PsDataInMb { get; set; } + /// The resync duration in seconds. + long? ResyncDurationInSecond { get; set; } + /// The resync last 15 minutes transferred bytes. + long? ResyncLast15MinutesTransferredByte { get; set; } + /// The last data transfer time in UTC. + global::System.DateTime? ResyncLastDataTransferTimeUtc { get; set; } + /// The resync processed bytes. + long? ResyncProcessedByte { get; set; } + /// The resync progress percentage. + int? ResyncProgressPercentage { get; set; } + /// A value indicating whether resync is required for this disk. + string ResyncRequired { get; set; } + /// The resync start time. + global::System.DateTime? ResyncStartTime { get; set; } + /// The resync total transferred bytes. + long? ResyncTotalTransferredByte { get; set; } + /// The RPO in seconds. + long? RpoInSecond { get; set; } + /// The source data transit in MB. + double? SourceDataInMb { get; set; } + /// The target data transit in MB. + double? TargetDataInMb { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageProtectedDiskDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageProtectedDiskDetails.json.cs new file mode 100644 index 000000000000..d001e3c34b2f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageProtectedDiskDetails.json.cs @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMage protected disk details. + public partial class InMageProtectedDiskDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new InMageProtectedDiskDetails(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal InMageProtectedDiskDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_diskId = If( json?.PropertyT("diskId"), out var __jsonDiskId) ? (string)__jsonDiskId : (string)DiskId;} + {_diskName = If( json?.PropertyT("diskName"), out var __jsonDiskName) ? (string)__jsonDiskName : (string)DiskName;} + {_protectionStage = If( json?.PropertyT("protectionStage"), out var __jsonProtectionStage) ? (string)__jsonProtectionStage : (string)ProtectionStage;} + {_healthErrorCode = If( json?.PropertyT("healthErrorCode"), out var __jsonHealthErrorCode) ? (string)__jsonHealthErrorCode : (string)HealthErrorCode;} + {_rpoInSecond = If( json?.PropertyT("rpoInSeconds"), out var __jsonRpoInSeconds) ? (long?)__jsonRpoInSeconds : RpoInSecond;} + {_resyncRequired = If( json?.PropertyT("resyncRequired"), out var __jsonResyncRequired) ? (string)__jsonResyncRequired : (string)ResyncRequired;} + {_resyncProgressPercentage = If( json?.PropertyT("resyncProgressPercentage"), out var __jsonResyncProgressPercentage) ? (int?)__jsonResyncProgressPercentage : ResyncProgressPercentage;} + {_resyncDurationInSecond = If( json?.PropertyT("resyncDurationInSeconds"), out var __jsonResyncDurationInSeconds) ? (long?)__jsonResyncDurationInSeconds : ResyncDurationInSecond;} + {_diskCapacityInByte = If( json?.PropertyT("diskCapacityInBytes"), out var __jsonDiskCapacityInBytes) ? (long?)__jsonDiskCapacityInBytes : DiskCapacityInByte;} + {_fileSystemCapacityInByte = If( json?.PropertyT("fileSystemCapacityInBytes"), out var __jsonFileSystemCapacityInBytes) ? (long?)__jsonFileSystemCapacityInBytes : FileSystemCapacityInByte;} + {_sourceDataInMb = If( json?.PropertyT("sourceDataInMB"), out var __jsonSourceDataInMb) ? (double?)__jsonSourceDataInMb : SourceDataInMb;} + {_psDataInMb = If( json?.PropertyT("psDataInMB"), out var __jsonPsDataInMb) ? (double?)__jsonPsDataInMb : PsDataInMb;} + {_targetDataInMb = If( json?.PropertyT("targetDataInMB"), out var __jsonTargetDataInMb) ? (double?)__jsonTargetDataInMb : TargetDataInMb;} + {_diskResized = If( json?.PropertyT("diskResized"), out var __jsonDiskResized) ? (string)__jsonDiskResized : (string)DiskResized;} + {_lastRpoCalculatedTime = If( json?.PropertyT("lastRpoCalculatedTime"), out var __jsonLastRpoCalculatedTime) ? global::System.DateTime.TryParse((string)__jsonLastRpoCalculatedTime, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonLastRpoCalculatedTimeValue) ? __jsonLastRpoCalculatedTimeValue : LastRpoCalculatedTime : LastRpoCalculatedTime;} + {_resyncProcessedByte = If( json?.PropertyT("resyncProcessedBytes"), out var __jsonResyncProcessedBytes) ? (long?)__jsonResyncProcessedBytes : ResyncProcessedByte;} + {_resyncTotalTransferredByte = If( json?.PropertyT("resyncTotalTransferredBytes"), out var __jsonResyncTotalTransferredBytes) ? (long?)__jsonResyncTotalTransferredBytes : ResyncTotalTransferredByte;} + {_resyncLast15MinutesTransferredByte = If( json?.PropertyT("resyncLast15MinutesTransferredBytes"), out var __jsonResyncLast15MinutesTransferredBytes) ? (long?)__jsonResyncLast15MinutesTransferredBytes : ResyncLast15MinutesTransferredByte;} + {_resyncLastDataTransferTimeUtc = If( json?.PropertyT("resyncLastDataTransferTimeUTC"), out var __jsonResyncLastDataTransferTimeUtc) ? global::System.DateTime.TryParse((string)__jsonResyncLastDataTransferTimeUtc, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonResyncLastDataTransferTimeUtcValue) ? __jsonResyncLastDataTransferTimeUtcValue : ResyncLastDataTransferTimeUtc : ResyncLastDataTransferTimeUtc;} + {_resyncStartTime = If( json?.PropertyT("resyncStartTime"), out var __jsonResyncStartTime) ? global::System.DateTime.TryParse((string)__jsonResyncStartTime, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonResyncStartTimeValue) ? __jsonResyncStartTimeValue : ResyncStartTime : ResyncStartTime;} + {_progressHealth = If( json?.PropertyT("progressHealth"), out var __jsonProgressHealth) ? (string)__jsonProgressHealth : (string)ProgressHealth;} + {_progressStatus = If( json?.PropertyT("progressStatus"), out var __jsonProgressStatus) ? (string)__jsonProgressStatus : (string)ProgressStatus;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._diskId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._diskId.ToString()) : null, "diskId" ,container.Add ); + AddIf( null != (((object)this._diskName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._diskName.ToString()) : null, "diskName" ,container.Add ); + AddIf( null != (((object)this._protectionStage)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._protectionStage.ToString()) : null, "protectionStage" ,container.Add ); + AddIf( null != (((object)this._healthErrorCode)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._healthErrorCode.ToString()) : null, "healthErrorCode" ,container.Add ); + AddIf( null != this._rpoInSecond ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((long)this._rpoInSecond) : null, "rpoInSeconds" ,container.Add ); + AddIf( null != (((object)this._resyncRequired)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._resyncRequired.ToString()) : null, "resyncRequired" ,container.Add ); + AddIf( null != this._resyncProgressPercentage ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._resyncProgressPercentage) : null, "resyncProgressPercentage" ,container.Add ); + AddIf( null != this._resyncDurationInSecond ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((long)this._resyncDurationInSecond) : null, "resyncDurationInSeconds" ,container.Add ); + AddIf( null != this._diskCapacityInByte ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((long)this._diskCapacityInByte) : null, "diskCapacityInBytes" ,container.Add ); + AddIf( null != this._fileSystemCapacityInByte ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((long)this._fileSystemCapacityInByte) : null, "fileSystemCapacityInBytes" ,container.Add ); + AddIf( null != this._sourceDataInMb ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((double)this._sourceDataInMb) : null, "sourceDataInMB" ,container.Add ); + AddIf( null != this._psDataInMb ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((double)this._psDataInMb) : null, "psDataInMB" ,container.Add ); + AddIf( null != this._targetDataInMb ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((double)this._targetDataInMb) : null, "targetDataInMB" ,container.Add ); + AddIf( null != (((object)this._diskResized)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._diskResized.ToString()) : null, "diskResized" ,container.Add ); + AddIf( null != this._lastRpoCalculatedTime ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._lastRpoCalculatedTime?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "lastRpoCalculatedTime" ,container.Add ); + AddIf( null != this._resyncProcessedByte ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((long)this._resyncProcessedByte) : null, "resyncProcessedBytes" ,container.Add ); + AddIf( null != this._resyncTotalTransferredByte ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((long)this._resyncTotalTransferredByte) : null, "resyncTotalTransferredBytes" ,container.Add ); + AddIf( null != this._resyncLast15MinutesTransferredByte ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((long)this._resyncLast15MinutesTransferredByte) : null, "resyncLast15MinutesTransferredBytes" ,container.Add ); + AddIf( null != this._resyncLastDataTransferTimeUtc ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._resyncLastDataTransferTimeUtc?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "resyncLastDataTransferTimeUTC" ,container.Add ); + AddIf( null != this._resyncStartTime ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._resyncStartTime?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "resyncStartTime" ,container.Add ); + AddIf( null != (((object)this._progressHealth)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._progressHealth.ToString()) : null, "progressHealth" ,container.Add ); + AddIf( null != (((object)this._progressStatus)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._progressStatus.ToString()) : null, "progressStatus" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmAgentUpgradeBlockingErrorDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmAgentUpgradeBlockingErrorDetails.PowerShell.cs new file mode 100644 index 000000000000..0d99004f8832 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmAgentUpgradeBlockingErrorDetails.PowerShell.cs @@ -0,0 +1,189 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// InMageRcm source agent upgrade blocking error details. + [System.ComponentModel.TypeConverter(typeof(InMageRcmAgentUpgradeBlockingErrorDetailsTypeConverter))] + public partial class InMageRcmAgentUpgradeBlockingErrorDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmAgentUpgradeBlockingErrorDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InMageRcmAgentUpgradeBlockingErrorDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmAgentUpgradeBlockingErrorDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InMageRcmAgentUpgradeBlockingErrorDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json + /// string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmAgentUpgradeBlockingErrorDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InMageRcmAgentUpgradeBlockingErrorDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ErrorCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmAgentUpgradeBlockingErrorDetailsInternal)this).ErrorCode = (string) content.GetValueForProperty("ErrorCode",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmAgentUpgradeBlockingErrorDetailsInternal)this).ErrorCode, global::System.Convert.ToString); + } + if (content.Contains("ErrorMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmAgentUpgradeBlockingErrorDetailsInternal)this).ErrorMessage = (string) content.GetValueForProperty("ErrorMessage",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmAgentUpgradeBlockingErrorDetailsInternal)this).ErrorMessage, global::System.Convert.ToString); + } + if (content.Contains("PossibleCaus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmAgentUpgradeBlockingErrorDetailsInternal)this).PossibleCaus = (string) content.GetValueForProperty("PossibleCaus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmAgentUpgradeBlockingErrorDetailsInternal)this).PossibleCaus, global::System.Convert.ToString); + } + if (content.Contains("RecommendedAction")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmAgentUpgradeBlockingErrorDetailsInternal)this).RecommendedAction = (string) content.GetValueForProperty("RecommendedAction",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmAgentUpgradeBlockingErrorDetailsInternal)this).RecommendedAction, global::System.Convert.ToString); + } + if (content.Contains("ErrorMessageParameter")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmAgentUpgradeBlockingErrorDetailsInternal)this).ErrorMessageParameter = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmAgentUpgradeBlockingErrorDetailsErrorMessageParameters) content.GetValueForProperty("ErrorMessageParameter",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmAgentUpgradeBlockingErrorDetailsInternal)this).ErrorMessageParameter, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmAgentUpgradeBlockingErrorDetailsErrorMessageParametersTypeConverter.ConvertFrom); + } + if (content.Contains("ErrorTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmAgentUpgradeBlockingErrorDetailsInternal)this).ErrorTag = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmAgentUpgradeBlockingErrorDetailsErrorTags) content.GetValueForProperty("ErrorTag",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmAgentUpgradeBlockingErrorDetailsInternal)this).ErrorTag, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmAgentUpgradeBlockingErrorDetailsErrorTagsTypeConverter.ConvertFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InMageRcmAgentUpgradeBlockingErrorDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ErrorCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmAgentUpgradeBlockingErrorDetailsInternal)this).ErrorCode = (string) content.GetValueForProperty("ErrorCode",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmAgentUpgradeBlockingErrorDetailsInternal)this).ErrorCode, global::System.Convert.ToString); + } + if (content.Contains("ErrorMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmAgentUpgradeBlockingErrorDetailsInternal)this).ErrorMessage = (string) content.GetValueForProperty("ErrorMessage",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmAgentUpgradeBlockingErrorDetailsInternal)this).ErrorMessage, global::System.Convert.ToString); + } + if (content.Contains("PossibleCaus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmAgentUpgradeBlockingErrorDetailsInternal)this).PossibleCaus = (string) content.GetValueForProperty("PossibleCaus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmAgentUpgradeBlockingErrorDetailsInternal)this).PossibleCaus, global::System.Convert.ToString); + } + if (content.Contains("RecommendedAction")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmAgentUpgradeBlockingErrorDetailsInternal)this).RecommendedAction = (string) content.GetValueForProperty("RecommendedAction",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmAgentUpgradeBlockingErrorDetailsInternal)this).RecommendedAction, global::System.Convert.ToString); + } + if (content.Contains("ErrorMessageParameter")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmAgentUpgradeBlockingErrorDetailsInternal)this).ErrorMessageParameter = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmAgentUpgradeBlockingErrorDetailsErrorMessageParameters) content.GetValueForProperty("ErrorMessageParameter",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmAgentUpgradeBlockingErrorDetailsInternal)this).ErrorMessageParameter, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmAgentUpgradeBlockingErrorDetailsErrorMessageParametersTypeConverter.ConvertFrom); + } + if (content.Contains("ErrorTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmAgentUpgradeBlockingErrorDetailsInternal)this).ErrorTag = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmAgentUpgradeBlockingErrorDetailsErrorTags) content.GetValueForProperty("ErrorTag",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmAgentUpgradeBlockingErrorDetailsInternal)this).ErrorTag, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmAgentUpgradeBlockingErrorDetailsErrorTagsTypeConverter.ConvertFrom); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// InMageRcm source agent upgrade blocking error details. + [System.ComponentModel.TypeConverter(typeof(InMageRcmAgentUpgradeBlockingErrorDetailsTypeConverter))] + public partial interface IInMageRcmAgentUpgradeBlockingErrorDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmAgentUpgradeBlockingErrorDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmAgentUpgradeBlockingErrorDetails.TypeConverter.cs new file mode 100644 index 000000000000..a0d813cac736 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmAgentUpgradeBlockingErrorDetails.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InMageRcmAgentUpgradeBlockingErrorDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmAgentUpgradeBlockingErrorDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmAgentUpgradeBlockingErrorDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InMageRcmAgentUpgradeBlockingErrorDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InMageRcmAgentUpgradeBlockingErrorDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InMageRcmAgentUpgradeBlockingErrorDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmAgentUpgradeBlockingErrorDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmAgentUpgradeBlockingErrorDetails.cs new file mode 100644 index 000000000000..c72a9c95fd53 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmAgentUpgradeBlockingErrorDetails.cs @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMageRcm source agent upgrade blocking error details. + public partial class InMageRcmAgentUpgradeBlockingErrorDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmAgentUpgradeBlockingErrorDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmAgentUpgradeBlockingErrorDetailsInternal + { + + /// Backing field for property. + private string _errorCode; + + /// The error code. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ErrorCode { get => this._errorCode; } + + /// Backing field for property. + private string _errorMessage; + + /// The error message. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ErrorMessage { get => this._errorMessage; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmAgentUpgradeBlockingErrorDetailsErrorMessageParameters _errorMessageParameter; + + /// The error message parameters. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmAgentUpgradeBlockingErrorDetailsErrorMessageParameters ErrorMessageParameter { get => (this._errorMessageParameter = this._errorMessageParameter ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmAgentUpgradeBlockingErrorDetailsErrorMessageParameters()); } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmAgentUpgradeBlockingErrorDetailsErrorTags _errorTag; + + /// The error tags. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmAgentUpgradeBlockingErrorDetailsErrorTags ErrorTag { get => (this._errorTag = this._errorTag ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmAgentUpgradeBlockingErrorDetailsErrorTags()); } + + /// Internal Acessors for ErrorCode + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmAgentUpgradeBlockingErrorDetailsInternal.ErrorCode { get => this._errorCode; set { {_errorCode = value;} } } + + /// Internal Acessors for ErrorMessage + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmAgentUpgradeBlockingErrorDetailsInternal.ErrorMessage { get => this._errorMessage; set { {_errorMessage = value;} } } + + /// Internal Acessors for ErrorMessageParameter + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmAgentUpgradeBlockingErrorDetailsErrorMessageParameters Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmAgentUpgradeBlockingErrorDetailsInternal.ErrorMessageParameter { get => (this._errorMessageParameter = this._errorMessageParameter ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmAgentUpgradeBlockingErrorDetailsErrorMessageParameters()); set { {_errorMessageParameter = value;} } } + + /// Internal Acessors for ErrorTag + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmAgentUpgradeBlockingErrorDetailsErrorTags Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmAgentUpgradeBlockingErrorDetailsInternal.ErrorTag { get => (this._errorTag = this._errorTag ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmAgentUpgradeBlockingErrorDetailsErrorTags()); set { {_errorTag = value;} } } + + /// Internal Acessors for PossibleCaus + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmAgentUpgradeBlockingErrorDetailsInternal.PossibleCaus { get => this._possibleCaus; set { {_possibleCaus = value;} } } + + /// Internal Acessors for RecommendedAction + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmAgentUpgradeBlockingErrorDetailsInternal.RecommendedAction { get => this._recommendedAction; set { {_recommendedAction = value;} } } + + /// Backing field for property. + private string _possibleCaus; + + /// The possible causes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string PossibleCaus { get => this._possibleCaus; } + + /// Backing field for property. + private string _recommendedAction; + + /// The recommended action. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecommendedAction { get => this._recommendedAction; } + + /// + /// Creates an new instance. + /// + public InMageRcmAgentUpgradeBlockingErrorDetails() + { + + } + } + /// InMageRcm source agent upgrade blocking error details. + public partial interface IInMageRcmAgentUpgradeBlockingErrorDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The error code. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The error code.", + SerializedName = @"errorCode", + PossibleTypes = new [] { typeof(string) })] + string ErrorCode { get; } + /// The error message. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The error message.", + SerializedName = @"errorMessage", + PossibleTypes = new [] { typeof(string) })] + string ErrorMessage { get; } + /// The error message parameters. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The error message parameters.", + SerializedName = @"errorMessageParameters", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmAgentUpgradeBlockingErrorDetailsErrorMessageParameters) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmAgentUpgradeBlockingErrorDetailsErrorMessageParameters ErrorMessageParameter { get; } + /// The error tags. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The error tags.", + SerializedName = @"errorTags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmAgentUpgradeBlockingErrorDetailsErrorTags) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmAgentUpgradeBlockingErrorDetailsErrorTags ErrorTag { get; } + /// The possible causes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The possible causes.", + SerializedName = @"possibleCauses", + PossibleTypes = new [] { typeof(string) })] + string PossibleCaus { get; } + /// The recommended action. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The recommended action.", + SerializedName = @"recommendedAction", + PossibleTypes = new [] { typeof(string) })] + string RecommendedAction { get; } + + } + /// InMageRcm source agent upgrade blocking error details. + internal partial interface IInMageRcmAgentUpgradeBlockingErrorDetailsInternal + + { + /// The error code. + string ErrorCode { get; set; } + /// The error message. + string ErrorMessage { get; set; } + /// The error message parameters. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmAgentUpgradeBlockingErrorDetailsErrorMessageParameters ErrorMessageParameter { get; set; } + /// The error tags. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmAgentUpgradeBlockingErrorDetailsErrorTags ErrorTag { get; set; } + /// The possible causes. + string PossibleCaus { get; set; } + /// The recommended action. + string RecommendedAction { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmAgentUpgradeBlockingErrorDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmAgentUpgradeBlockingErrorDetails.json.cs new file mode 100644 index 000000000000..bfa6b6a6fdb0 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmAgentUpgradeBlockingErrorDetails.json.cs @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMageRcm source agent upgrade blocking error details. + public partial class InMageRcmAgentUpgradeBlockingErrorDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmAgentUpgradeBlockingErrorDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmAgentUpgradeBlockingErrorDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmAgentUpgradeBlockingErrorDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new InMageRcmAgentUpgradeBlockingErrorDetails(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal InMageRcmAgentUpgradeBlockingErrorDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_errorCode = If( json?.PropertyT("errorCode"), out var __jsonErrorCode) ? (string)__jsonErrorCode : (string)ErrorCode;} + {_errorMessage = If( json?.PropertyT("errorMessage"), out var __jsonErrorMessage) ? (string)__jsonErrorMessage : (string)ErrorMessage;} + {_possibleCaus = If( json?.PropertyT("possibleCauses"), out var __jsonPossibleCauses) ? (string)__jsonPossibleCauses : (string)PossibleCaus;} + {_recommendedAction = If( json?.PropertyT("recommendedAction"), out var __jsonRecommendedAction) ? (string)__jsonRecommendedAction : (string)RecommendedAction;} + {_errorMessageParameter = If( json?.PropertyT("errorMessageParameters"), out var __jsonErrorMessageParameters) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmAgentUpgradeBlockingErrorDetailsErrorMessageParameters.FromJson(__jsonErrorMessageParameters) : ErrorMessageParameter;} + {_errorTag = If( json?.PropertyT("errorTags"), out var __jsonErrorTags) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmAgentUpgradeBlockingErrorDetailsErrorTags.FromJson(__jsonErrorTags) : ErrorTag;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._errorCode)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._errorCode.ToString()) : null, "errorCode" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._errorMessage)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._errorMessage.ToString()) : null, "errorMessage" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._possibleCaus)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._possibleCaus.ToString()) : null, "possibleCauses" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._recommendedAction)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recommendedAction.ToString()) : null, "recommendedAction" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._errorMessageParameter ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._errorMessageParameter.ToJson(null,serializationMode) : null, "errorMessageParameters" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._errorTag ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._errorTag.ToJson(null,serializationMode) : null, "errorTags" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmAgentUpgradeBlockingErrorDetailsErrorMessageParameters.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmAgentUpgradeBlockingErrorDetailsErrorMessageParameters.PowerShell.cs new file mode 100644 index 000000000000..5e9ef05d9258 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmAgentUpgradeBlockingErrorDetailsErrorMessageParameters.PowerShell.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// The error message parameters. + [System.ComponentModel.TypeConverter(typeof(InMageRcmAgentUpgradeBlockingErrorDetailsErrorMessageParametersTypeConverter))] + public partial class InMageRcmAgentUpgradeBlockingErrorDetailsErrorMessageParameters + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmAgentUpgradeBlockingErrorDetailsErrorMessageParameters DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InMageRcmAgentUpgradeBlockingErrorDetailsErrorMessageParameters(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmAgentUpgradeBlockingErrorDetailsErrorMessageParameters DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InMageRcmAgentUpgradeBlockingErrorDetailsErrorMessageParameters(content); + } + + /// + /// Creates a new instance of , deserializing + /// the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmAgentUpgradeBlockingErrorDetailsErrorMessageParameters FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InMageRcmAgentUpgradeBlockingErrorDetailsErrorMessageParameters(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InMageRcmAgentUpgradeBlockingErrorDetailsErrorMessageParameters(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// The error message parameters. + [System.ComponentModel.TypeConverter(typeof(InMageRcmAgentUpgradeBlockingErrorDetailsErrorMessageParametersTypeConverter))] + public partial interface IInMageRcmAgentUpgradeBlockingErrorDetailsErrorMessageParameters + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmAgentUpgradeBlockingErrorDetailsErrorMessageParameters.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmAgentUpgradeBlockingErrorDetailsErrorMessageParameters.TypeConverter.cs new file mode 100644 index 000000000000..180ff34e1d25 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmAgentUpgradeBlockingErrorDetailsErrorMessageParameters.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InMageRcmAgentUpgradeBlockingErrorDetailsErrorMessageParametersTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there + /// is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there + /// is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmAgentUpgradeBlockingErrorDetailsErrorMessageParameters ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmAgentUpgradeBlockingErrorDetailsErrorMessageParameters).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InMageRcmAgentUpgradeBlockingErrorDetailsErrorMessageParameters.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InMageRcmAgentUpgradeBlockingErrorDetailsErrorMessageParameters.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InMageRcmAgentUpgradeBlockingErrorDetailsErrorMessageParameters.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmAgentUpgradeBlockingErrorDetailsErrorMessageParameters.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmAgentUpgradeBlockingErrorDetailsErrorMessageParameters.cs new file mode 100644 index 000000000000..94adff76ba0b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmAgentUpgradeBlockingErrorDetailsErrorMessageParameters.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The error message parameters. + public partial class InMageRcmAgentUpgradeBlockingErrorDetailsErrorMessageParameters : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmAgentUpgradeBlockingErrorDetailsErrorMessageParameters, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmAgentUpgradeBlockingErrorDetailsErrorMessageParametersInternal + { + + /// + /// Creates an new instance. + /// + public InMageRcmAgentUpgradeBlockingErrorDetailsErrorMessageParameters() + { + + } + } + /// The error message parameters. + public partial interface IInMageRcmAgentUpgradeBlockingErrorDetailsErrorMessageParameters : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray + { + + } + /// The error message parameters. + internal partial interface IInMageRcmAgentUpgradeBlockingErrorDetailsErrorMessageParametersInternal + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmAgentUpgradeBlockingErrorDetailsErrorMessageParameters.dictionary.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmAgentUpgradeBlockingErrorDetailsErrorMessageParameters.dictionary.cs new file mode 100644 index 000000000000..31220cc75135 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmAgentUpgradeBlockingErrorDetailsErrorMessageParameters.dictionary.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + public partial class InMageRcmAgentUpgradeBlockingErrorDetailsErrorMessageParameters : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray + { + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + + int Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Values { get => __additionalProperties.Values; } + + public string this[global::System.String index] { get => __additionalProperties[index]; set => __additionalProperties[index] = value; } + + /// + /// + public void Add(global::System.String key, string value) => __additionalProperties.Add( key, value); + + public void Clear() => __additionalProperties.Clear(); + + /// + public bool ContainsKey(global::System.String key) => __additionalProperties.ContainsKey( key); + + /// + public void CopyFrom(global::System.Collections.IDictionary source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public void CopyFrom(global::System.Management.Automation.PSObject source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public bool Remove(global::System.String key) => __additionalProperties.Remove( key); + + /// + /// + public bool TryGetValue(global::System.String key, out string value) => __additionalProperties.TryGetValue( key, out value); + + /// + + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmAgentUpgradeBlockingErrorDetailsErrorMessageParameters source) => source.__additionalProperties; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmAgentUpgradeBlockingErrorDetailsErrorMessageParameters.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmAgentUpgradeBlockingErrorDetailsErrorMessageParameters.json.cs new file mode 100644 index 000000000000..e7f7386d9cc7 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmAgentUpgradeBlockingErrorDetailsErrorMessageParameters.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The error message parameters. + public partial class InMageRcmAgentUpgradeBlockingErrorDetailsErrorMessageParameters + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmAgentUpgradeBlockingErrorDetailsErrorMessageParameters. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmAgentUpgradeBlockingErrorDetailsErrorMessageParameters. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmAgentUpgradeBlockingErrorDetailsErrorMessageParameters FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new InMageRcmAgentUpgradeBlockingErrorDetailsErrorMessageParameters(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + /// + internal InMageRcmAgentUpgradeBlockingErrorDetailsErrorMessageParameters(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, global::System.Collections.Generic.HashSet exclusions = null) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray)this).AdditionalProperties, null ,exclusions ); + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray)this).AdditionalProperties, container); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmAgentUpgradeBlockingErrorDetailsErrorTags.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmAgentUpgradeBlockingErrorDetailsErrorTags.PowerShell.cs new file mode 100644 index 000000000000..529cdd52fe63 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmAgentUpgradeBlockingErrorDetailsErrorTags.PowerShell.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// The error tags. + [System.ComponentModel.TypeConverter(typeof(InMageRcmAgentUpgradeBlockingErrorDetailsErrorTagsTypeConverter))] + public partial class InMageRcmAgentUpgradeBlockingErrorDetailsErrorTags + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmAgentUpgradeBlockingErrorDetailsErrorTags DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InMageRcmAgentUpgradeBlockingErrorDetailsErrorTags(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmAgentUpgradeBlockingErrorDetailsErrorTags DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InMageRcmAgentUpgradeBlockingErrorDetailsErrorTags(content); + } + + /// + /// Creates a new instance of , deserializing the content + /// from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmAgentUpgradeBlockingErrorDetailsErrorTags FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InMageRcmAgentUpgradeBlockingErrorDetailsErrorTags(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InMageRcmAgentUpgradeBlockingErrorDetailsErrorTags(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// The error tags. + [System.ComponentModel.TypeConverter(typeof(InMageRcmAgentUpgradeBlockingErrorDetailsErrorTagsTypeConverter))] + public partial interface IInMageRcmAgentUpgradeBlockingErrorDetailsErrorTags + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmAgentUpgradeBlockingErrorDetailsErrorTags.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmAgentUpgradeBlockingErrorDetailsErrorTags.TypeConverter.cs new file mode 100644 index 000000000000..9ada29c0d54f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmAgentUpgradeBlockingErrorDetailsErrorTags.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InMageRcmAgentUpgradeBlockingErrorDetailsErrorTagsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a + /// type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmAgentUpgradeBlockingErrorDetailsErrorTags ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmAgentUpgradeBlockingErrorDetailsErrorTags).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InMageRcmAgentUpgradeBlockingErrorDetailsErrorTags.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InMageRcmAgentUpgradeBlockingErrorDetailsErrorTags.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InMageRcmAgentUpgradeBlockingErrorDetailsErrorTags.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmAgentUpgradeBlockingErrorDetailsErrorTags.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmAgentUpgradeBlockingErrorDetailsErrorTags.cs new file mode 100644 index 000000000000..ede1c1b6c3ff --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmAgentUpgradeBlockingErrorDetailsErrorTags.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The error tags. + public partial class InMageRcmAgentUpgradeBlockingErrorDetailsErrorTags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmAgentUpgradeBlockingErrorDetailsErrorTags, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmAgentUpgradeBlockingErrorDetailsErrorTagsInternal + { + + /// + /// Creates an new instance. + /// + public InMageRcmAgentUpgradeBlockingErrorDetailsErrorTags() + { + + } + } + /// The error tags. + public partial interface IInMageRcmAgentUpgradeBlockingErrorDetailsErrorTags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray + { + + } + /// The error tags. + internal partial interface IInMageRcmAgentUpgradeBlockingErrorDetailsErrorTagsInternal + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmAgentUpgradeBlockingErrorDetailsErrorTags.dictionary.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmAgentUpgradeBlockingErrorDetailsErrorTags.dictionary.cs new file mode 100644 index 000000000000..02ca35438c8f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmAgentUpgradeBlockingErrorDetailsErrorTags.dictionary.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + public partial class InMageRcmAgentUpgradeBlockingErrorDetailsErrorTags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray + { + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + + int Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Values { get => __additionalProperties.Values; } + + public string this[global::System.String index] { get => __additionalProperties[index]; set => __additionalProperties[index] = value; } + + /// + /// + public void Add(global::System.String key, string value) => __additionalProperties.Add( key, value); + + public void Clear() => __additionalProperties.Clear(); + + /// + public bool ContainsKey(global::System.String key) => __additionalProperties.ContainsKey( key); + + /// + public void CopyFrom(global::System.Collections.IDictionary source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public void CopyFrom(global::System.Management.Automation.PSObject source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public bool Remove(global::System.String key) => __additionalProperties.Remove( key); + + /// + /// + public bool TryGetValue(global::System.String key, out string value) => __additionalProperties.TryGetValue( key, out value); + + /// + + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmAgentUpgradeBlockingErrorDetailsErrorTags source) => source.__additionalProperties; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmAgentUpgradeBlockingErrorDetailsErrorTags.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmAgentUpgradeBlockingErrorDetailsErrorTags.json.cs new file mode 100644 index 000000000000..b13cdb1773fc --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmAgentUpgradeBlockingErrorDetailsErrorTags.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The error tags. + public partial class InMageRcmAgentUpgradeBlockingErrorDetailsErrorTags + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmAgentUpgradeBlockingErrorDetailsErrorTags. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmAgentUpgradeBlockingErrorDetailsErrorTags. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmAgentUpgradeBlockingErrorDetailsErrorTags FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new InMageRcmAgentUpgradeBlockingErrorDetailsErrorTags(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + /// + internal InMageRcmAgentUpgradeBlockingErrorDetailsErrorTags(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, global::System.Collections.Generic.HashSet exclusions = null) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray)this).AdditionalProperties, null ,exclusions ); + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray)this).AdditionalProperties, container); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmApplianceDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmApplianceDetails.PowerShell.cs new file mode 100644 index 000000000000..eb7f599d38ad --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmApplianceDetails.PowerShell.cs @@ -0,0 +1,698 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// InMageRcm appliance details. + [System.ComponentModel.TypeConverter(typeof(InMageRcmApplianceDetailsTypeConverter))] + public partial class InMageRcmApplianceDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InMageRcmApplianceDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InMageRcmApplianceDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InMageRcmApplianceDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("RcmProxy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).RcmProxy = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetails) content.GetValueForProperty("RcmProxy",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).RcmProxy, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RcmProxyDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("PushInstaller")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).PushInstaller = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPushInstallerDetails) content.GetValueForProperty("PushInstaller",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).PushInstaller, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PushInstallerDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("ReplicationAgent")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).ReplicationAgent = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAgentDetails) content.GetValueForProperty("ReplicationAgent",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).ReplicationAgent, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationAgentDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("ReprotectAgent")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).ReprotectAgent = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetails) content.GetValueForProperty("ReprotectAgent",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).ReprotectAgent, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReprotectAgentDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("MarsAgent")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).MarsAgent = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMarsAgentDetails) content.GetValueForProperty("MarsAgent",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).MarsAgent, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.MarsAgentDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("Dra")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).Dra = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDraDetails) content.GetValueForProperty("Dra",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).Dra, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DraDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("FabricArmId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).FabricArmId = (string) content.GetValueForProperty("FabricArmId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).FabricArmId, global::System.Convert.ToString); + } + if (content.Contains("SwitchProviderBlockingErrorDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).SwitchProviderBlockingErrorDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSwitchProviderBlockingErrorDetails[]) content.GetValueForProperty("SwitchProviderBlockingErrorDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).SwitchProviderBlockingErrorDetail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmFabricSwitchProviderBlockingErrorDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("ProcessServer")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).ProcessServer = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetails) content.GetValueForProperty("ProcessServer",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).ProcessServer, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProcessServerDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("RcmProxyId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).RcmProxyId = (string) content.GetValueForProperty("RcmProxyId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).RcmProxyId, global::System.Convert.ToString); + } + if (content.Contains("RcmProxyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).RcmProxyName = (string) content.GetValueForProperty("RcmProxyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).RcmProxyName, global::System.Convert.ToString); + } + if (content.Contains("RcmProxyBiosId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).RcmProxyBiosId = (string) content.GetValueForProperty("RcmProxyBiosId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).RcmProxyBiosId, global::System.Convert.ToString); + } + if (content.Contains("RcmProxyFabricObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).RcmProxyFabricObjectId = (string) content.GetValueForProperty("RcmProxyFabricObjectId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).RcmProxyFabricObjectId, global::System.Convert.ToString); + } + if (content.Contains("RcmProxyFqdn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).RcmProxyFqdn = (string) content.GetValueForProperty("RcmProxyFqdn",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).RcmProxyFqdn, global::System.Convert.ToString); + } + if (content.Contains("RcmProxyClientAuthenticationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).RcmProxyClientAuthenticationType = (string) content.GetValueForProperty("RcmProxyClientAuthenticationType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).RcmProxyClientAuthenticationType, global::System.Convert.ToString); + } + if (content.Contains("RcmProxyVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).RcmProxyVersion = (string) content.GetValueForProperty("RcmProxyVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).RcmProxyVersion, global::System.Convert.ToString); + } + if (content.Contains("RcmProxyLastHeartbeatUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).RcmProxyLastHeartbeatUtc = (global::System.DateTime?) content.GetValueForProperty("RcmProxyLastHeartbeatUtc",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).RcmProxyLastHeartbeatUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("RcmProxyHealth")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).RcmProxyHealth = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth?) content.GetValueForProperty("RcmProxyHealth",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).RcmProxyHealth, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth.CreateFrom); + } + if (content.Contains("RcmProxyHealthError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).RcmProxyHealthError = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[]) content.GetValueForProperty("RcmProxyHealthError",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).RcmProxyHealthError, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("PushInstallerId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).PushInstallerId = (string) content.GetValueForProperty("PushInstallerId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).PushInstallerId, global::System.Convert.ToString); + } + if (content.Contains("PushInstallerName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).PushInstallerName = (string) content.GetValueForProperty("PushInstallerName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).PushInstallerName, global::System.Convert.ToString); + } + if (content.Contains("PushInstallerBiosId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).PushInstallerBiosId = (string) content.GetValueForProperty("PushInstallerBiosId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).PushInstallerBiosId, global::System.Convert.ToString); + } + if (content.Contains("PushInstallerFabricObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).PushInstallerFabricObjectId = (string) content.GetValueForProperty("PushInstallerFabricObjectId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).PushInstallerFabricObjectId, global::System.Convert.ToString); + } + if (content.Contains("PushInstallerFqdn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).PushInstallerFqdn = (string) content.GetValueForProperty("PushInstallerFqdn",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).PushInstallerFqdn, global::System.Convert.ToString); + } + if (content.Contains("PushInstallerVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).PushInstallerVersion = (string) content.GetValueForProperty("PushInstallerVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).PushInstallerVersion, global::System.Convert.ToString); + } + if (content.Contains("PushInstallerLastHeartbeatUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).PushInstallerLastHeartbeatUtc = (global::System.DateTime?) content.GetValueForProperty("PushInstallerLastHeartbeatUtc",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).PushInstallerLastHeartbeatUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("PushInstallerHealth")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).PushInstallerHealth = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth?) content.GetValueForProperty("PushInstallerHealth",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).PushInstallerHealth, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth.CreateFrom); + } + if (content.Contains("PushInstallerHealthError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).PushInstallerHealthError = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[]) content.GetValueForProperty("PushInstallerHealthError",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).PushInstallerHealthError, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("ReplicationAgentId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).ReplicationAgentId = (string) content.GetValueForProperty("ReplicationAgentId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).ReplicationAgentId, global::System.Convert.ToString); + } + if (content.Contains("ReplicationAgentName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).ReplicationAgentName = (string) content.GetValueForProperty("ReplicationAgentName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).ReplicationAgentName, global::System.Convert.ToString); + } + if (content.Contains("ReplicationAgentBiosId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).ReplicationAgentBiosId = (string) content.GetValueForProperty("ReplicationAgentBiosId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).ReplicationAgentBiosId, global::System.Convert.ToString); + } + if (content.Contains("ReplicationAgentFabricObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).ReplicationAgentFabricObjectId = (string) content.GetValueForProperty("ReplicationAgentFabricObjectId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).ReplicationAgentFabricObjectId, global::System.Convert.ToString); + } + if (content.Contains("ReplicationAgentFqdn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).ReplicationAgentFqdn = (string) content.GetValueForProperty("ReplicationAgentFqdn",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).ReplicationAgentFqdn, global::System.Convert.ToString); + } + if (content.Contains("ReplicationAgentVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).ReplicationAgentVersion = (string) content.GetValueForProperty("ReplicationAgentVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).ReplicationAgentVersion, global::System.Convert.ToString); + } + if (content.Contains("ReplicationAgentLastHeartbeatUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).ReplicationAgentLastHeartbeatUtc = (global::System.DateTime?) content.GetValueForProperty("ReplicationAgentLastHeartbeatUtc",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).ReplicationAgentLastHeartbeatUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ReplicationAgentHealth")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).ReplicationAgentHealth = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth?) content.GetValueForProperty("ReplicationAgentHealth",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).ReplicationAgentHealth, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth.CreateFrom); + } + if (content.Contains("ReplicationAgentHealthError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).ReplicationAgentHealthError = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[]) content.GetValueForProperty("ReplicationAgentHealthError",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).ReplicationAgentHealthError, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("ReprotectAgentId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).ReprotectAgentId = (string) content.GetValueForProperty("ReprotectAgentId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).ReprotectAgentId, global::System.Convert.ToString); + } + if (content.Contains("ReprotectAgentName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).ReprotectAgentName = (string) content.GetValueForProperty("ReprotectAgentName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).ReprotectAgentName, global::System.Convert.ToString); + } + if (content.Contains("ReprotectAgentBiosId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).ReprotectAgentBiosId = (string) content.GetValueForProperty("ReprotectAgentBiosId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).ReprotectAgentBiosId, global::System.Convert.ToString); + } + if (content.Contains("ReprotectAgentFabricObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).ReprotectAgentFabricObjectId = (string) content.GetValueForProperty("ReprotectAgentFabricObjectId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).ReprotectAgentFabricObjectId, global::System.Convert.ToString); + } + if (content.Contains("ReprotectAgentFqdn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).ReprotectAgentFqdn = (string) content.GetValueForProperty("ReprotectAgentFqdn",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).ReprotectAgentFqdn, global::System.Convert.ToString); + } + if (content.Contains("ReprotectAgentVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).ReprotectAgentVersion = (string) content.GetValueForProperty("ReprotectAgentVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).ReprotectAgentVersion, global::System.Convert.ToString); + } + if (content.Contains("ReprotectAgentLastHeartbeatUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).ReprotectAgentLastHeartbeatUtc = (global::System.DateTime?) content.GetValueForProperty("ReprotectAgentLastHeartbeatUtc",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).ReprotectAgentLastHeartbeatUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ReprotectAgentHealth")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).ReprotectAgentHealth = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth?) content.GetValueForProperty("ReprotectAgentHealth",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).ReprotectAgentHealth, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth.CreateFrom); + } + if (content.Contains("ReprotectAgentHealthError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).ReprotectAgentHealthError = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[]) content.GetValueForProperty("ReprotectAgentHealthError",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).ReprotectAgentHealthError, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("ReprotectAgentProtectedItemCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).ReprotectAgentProtectedItemCount = (int?) content.GetValueForProperty("ReprotectAgentProtectedItemCount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).ReprotectAgentProtectedItemCount, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("ReprotectAgentAccessibleDatastore")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).ReprotectAgentAccessibleDatastore = (string[]) content.GetValueForProperty("ReprotectAgentAccessibleDatastore",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).ReprotectAgentAccessibleDatastore, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("ReprotectAgentVcenterId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).ReprotectAgentVcenterId = (string) content.GetValueForProperty("ReprotectAgentVcenterId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).ReprotectAgentVcenterId, global::System.Convert.ToString); + } + if (content.Contains("ReprotectAgentLastDiscoveryInUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).ReprotectAgentLastDiscoveryInUtc = (global::System.DateTime?) content.GetValueForProperty("ReprotectAgentLastDiscoveryInUtc",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).ReprotectAgentLastDiscoveryInUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("MarAgentId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).MarAgentId = (string) content.GetValueForProperty("MarAgentId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).MarAgentId, global::System.Convert.ToString); + } + if (content.Contains("MarAgentName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).MarAgentName = (string) content.GetValueForProperty("MarAgentName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).MarAgentName, global::System.Convert.ToString); + } + if (content.Contains("MarAgentBiosId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).MarAgentBiosId = (string) content.GetValueForProperty("MarAgentBiosId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).MarAgentBiosId, global::System.Convert.ToString); + } + if (content.Contains("MarAgentFabricObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).MarAgentFabricObjectId = (string) content.GetValueForProperty("MarAgentFabricObjectId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).MarAgentFabricObjectId, global::System.Convert.ToString); + } + if (content.Contains("MarAgentFqdn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).MarAgentFqdn = (string) content.GetValueForProperty("MarAgentFqdn",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).MarAgentFqdn, global::System.Convert.ToString); + } + if (content.Contains("MarAgentVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).MarAgentVersion = (string) content.GetValueForProperty("MarAgentVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).MarAgentVersion, global::System.Convert.ToString); + } + if (content.Contains("MarAgentLastHeartbeatUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).MarAgentLastHeartbeatUtc = (global::System.DateTime?) content.GetValueForProperty("MarAgentLastHeartbeatUtc",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).MarAgentLastHeartbeatUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("MarAgentHealth")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).MarAgentHealth = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth?) content.GetValueForProperty("MarAgentHealth",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).MarAgentHealth, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth.CreateFrom); + } + if (content.Contains("MarAgentHealthError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).MarAgentHealthError = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[]) content.GetValueForProperty("MarAgentHealthError",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).MarAgentHealthError, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("DraId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).DraId = (string) content.GetValueForProperty("DraId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).DraId, global::System.Convert.ToString); + } + if (content.Contains("DraName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).DraName = (string) content.GetValueForProperty("DraName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).DraName, global::System.Convert.ToString); + } + if (content.Contains("DraBiosId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).DraBiosId = (string) content.GetValueForProperty("DraBiosId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).DraBiosId, global::System.Convert.ToString); + } + if (content.Contains("DraVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).DraVersion = (string) content.GetValueForProperty("DraVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).DraVersion, global::System.Convert.ToString); + } + if (content.Contains("DraLastHeartbeatUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).DraLastHeartbeatUtc = (global::System.DateTime?) content.GetValueForProperty("DraLastHeartbeatUtc",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).DraLastHeartbeatUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("DraHealth")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).DraHealth = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth?) content.GetValueForProperty("DraHealth",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).DraHealth, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth.CreateFrom); + } + if (content.Contains("DraHealthError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).DraHealthError = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[]) content.GetValueForProperty("DraHealthError",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).DraHealthError, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("DraForwardProtectedItemCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).DraForwardProtectedItemCount = (int?) content.GetValueForProperty("DraForwardProtectedItemCount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).DraForwardProtectedItemCount, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("DraReverseProtectedItemCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).DraReverseProtectedItemCount = (int?) content.GetValueForProperty("DraReverseProtectedItemCount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).DraReverseProtectedItemCount, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InMageRcmApplianceDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("RcmProxy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).RcmProxy = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetails) content.GetValueForProperty("RcmProxy",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).RcmProxy, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RcmProxyDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("PushInstaller")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).PushInstaller = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPushInstallerDetails) content.GetValueForProperty("PushInstaller",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).PushInstaller, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PushInstallerDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("ReplicationAgent")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).ReplicationAgent = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAgentDetails) content.GetValueForProperty("ReplicationAgent",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).ReplicationAgent, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationAgentDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("ReprotectAgent")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).ReprotectAgent = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetails) content.GetValueForProperty("ReprotectAgent",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).ReprotectAgent, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReprotectAgentDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("MarsAgent")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).MarsAgent = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMarsAgentDetails) content.GetValueForProperty("MarsAgent",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).MarsAgent, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.MarsAgentDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("Dra")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).Dra = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDraDetails) content.GetValueForProperty("Dra",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).Dra, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DraDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("FabricArmId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).FabricArmId = (string) content.GetValueForProperty("FabricArmId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).FabricArmId, global::System.Convert.ToString); + } + if (content.Contains("SwitchProviderBlockingErrorDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).SwitchProviderBlockingErrorDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSwitchProviderBlockingErrorDetails[]) content.GetValueForProperty("SwitchProviderBlockingErrorDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).SwitchProviderBlockingErrorDetail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmFabricSwitchProviderBlockingErrorDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("ProcessServer")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).ProcessServer = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetails) content.GetValueForProperty("ProcessServer",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).ProcessServer, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProcessServerDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("RcmProxyId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).RcmProxyId = (string) content.GetValueForProperty("RcmProxyId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).RcmProxyId, global::System.Convert.ToString); + } + if (content.Contains("RcmProxyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).RcmProxyName = (string) content.GetValueForProperty("RcmProxyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).RcmProxyName, global::System.Convert.ToString); + } + if (content.Contains("RcmProxyBiosId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).RcmProxyBiosId = (string) content.GetValueForProperty("RcmProxyBiosId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).RcmProxyBiosId, global::System.Convert.ToString); + } + if (content.Contains("RcmProxyFabricObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).RcmProxyFabricObjectId = (string) content.GetValueForProperty("RcmProxyFabricObjectId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).RcmProxyFabricObjectId, global::System.Convert.ToString); + } + if (content.Contains("RcmProxyFqdn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).RcmProxyFqdn = (string) content.GetValueForProperty("RcmProxyFqdn",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).RcmProxyFqdn, global::System.Convert.ToString); + } + if (content.Contains("RcmProxyClientAuthenticationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).RcmProxyClientAuthenticationType = (string) content.GetValueForProperty("RcmProxyClientAuthenticationType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).RcmProxyClientAuthenticationType, global::System.Convert.ToString); + } + if (content.Contains("RcmProxyVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).RcmProxyVersion = (string) content.GetValueForProperty("RcmProxyVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).RcmProxyVersion, global::System.Convert.ToString); + } + if (content.Contains("RcmProxyLastHeartbeatUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).RcmProxyLastHeartbeatUtc = (global::System.DateTime?) content.GetValueForProperty("RcmProxyLastHeartbeatUtc",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).RcmProxyLastHeartbeatUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("RcmProxyHealth")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).RcmProxyHealth = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth?) content.GetValueForProperty("RcmProxyHealth",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).RcmProxyHealth, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth.CreateFrom); + } + if (content.Contains("RcmProxyHealthError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).RcmProxyHealthError = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[]) content.GetValueForProperty("RcmProxyHealthError",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).RcmProxyHealthError, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("PushInstallerId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).PushInstallerId = (string) content.GetValueForProperty("PushInstallerId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).PushInstallerId, global::System.Convert.ToString); + } + if (content.Contains("PushInstallerName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).PushInstallerName = (string) content.GetValueForProperty("PushInstallerName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).PushInstallerName, global::System.Convert.ToString); + } + if (content.Contains("PushInstallerBiosId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).PushInstallerBiosId = (string) content.GetValueForProperty("PushInstallerBiosId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).PushInstallerBiosId, global::System.Convert.ToString); + } + if (content.Contains("PushInstallerFabricObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).PushInstallerFabricObjectId = (string) content.GetValueForProperty("PushInstallerFabricObjectId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).PushInstallerFabricObjectId, global::System.Convert.ToString); + } + if (content.Contains("PushInstallerFqdn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).PushInstallerFqdn = (string) content.GetValueForProperty("PushInstallerFqdn",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).PushInstallerFqdn, global::System.Convert.ToString); + } + if (content.Contains("PushInstallerVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).PushInstallerVersion = (string) content.GetValueForProperty("PushInstallerVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).PushInstallerVersion, global::System.Convert.ToString); + } + if (content.Contains("PushInstallerLastHeartbeatUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).PushInstallerLastHeartbeatUtc = (global::System.DateTime?) content.GetValueForProperty("PushInstallerLastHeartbeatUtc",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).PushInstallerLastHeartbeatUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("PushInstallerHealth")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).PushInstallerHealth = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth?) content.GetValueForProperty("PushInstallerHealth",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).PushInstallerHealth, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth.CreateFrom); + } + if (content.Contains("PushInstallerHealthError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).PushInstallerHealthError = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[]) content.GetValueForProperty("PushInstallerHealthError",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).PushInstallerHealthError, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("ReplicationAgentId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).ReplicationAgentId = (string) content.GetValueForProperty("ReplicationAgentId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).ReplicationAgentId, global::System.Convert.ToString); + } + if (content.Contains("ReplicationAgentName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).ReplicationAgentName = (string) content.GetValueForProperty("ReplicationAgentName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).ReplicationAgentName, global::System.Convert.ToString); + } + if (content.Contains("ReplicationAgentBiosId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).ReplicationAgentBiosId = (string) content.GetValueForProperty("ReplicationAgentBiosId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).ReplicationAgentBiosId, global::System.Convert.ToString); + } + if (content.Contains("ReplicationAgentFabricObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).ReplicationAgentFabricObjectId = (string) content.GetValueForProperty("ReplicationAgentFabricObjectId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).ReplicationAgentFabricObjectId, global::System.Convert.ToString); + } + if (content.Contains("ReplicationAgentFqdn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).ReplicationAgentFqdn = (string) content.GetValueForProperty("ReplicationAgentFqdn",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).ReplicationAgentFqdn, global::System.Convert.ToString); + } + if (content.Contains("ReplicationAgentVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).ReplicationAgentVersion = (string) content.GetValueForProperty("ReplicationAgentVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).ReplicationAgentVersion, global::System.Convert.ToString); + } + if (content.Contains("ReplicationAgentLastHeartbeatUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).ReplicationAgentLastHeartbeatUtc = (global::System.DateTime?) content.GetValueForProperty("ReplicationAgentLastHeartbeatUtc",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).ReplicationAgentLastHeartbeatUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ReplicationAgentHealth")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).ReplicationAgentHealth = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth?) content.GetValueForProperty("ReplicationAgentHealth",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).ReplicationAgentHealth, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth.CreateFrom); + } + if (content.Contains("ReplicationAgentHealthError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).ReplicationAgentHealthError = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[]) content.GetValueForProperty("ReplicationAgentHealthError",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).ReplicationAgentHealthError, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("ReprotectAgentId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).ReprotectAgentId = (string) content.GetValueForProperty("ReprotectAgentId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).ReprotectAgentId, global::System.Convert.ToString); + } + if (content.Contains("ReprotectAgentName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).ReprotectAgentName = (string) content.GetValueForProperty("ReprotectAgentName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).ReprotectAgentName, global::System.Convert.ToString); + } + if (content.Contains("ReprotectAgentBiosId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).ReprotectAgentBiosId = (string) content.GetValueForProperty("ReprotectAgentBiosId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).ReprotectAgentBiosId, global::System.Convert.ToString); + } + if (content.Contains("ReprotectAgentFabricObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).ReprotectAgentFabricObjectId = (string) content.GetValueForProperty("ReprotectAgentFabricObjectId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).ReprotectAgentFabricObjectId, global::System.Convert.ToString); + } + if (content.Contains("ReprotectAgentFqdn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).ReprotectAgentFqdn = (string) content.GetValueForProperty("ReprotectAgentFqdn",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).ReprotectAgentFqdn, global::System.Convert.ToString); + } + if (content.Contains("ReprotectAgentVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).ReprotectAgentVersion = (string) content.GetValueForProperty("ReprotectAgentVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).ReprotectAgentVersion, global::System.Convert.ToString); + } + if (content.Contains("ReprotectAgentLastHeartbeatUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).ReprotectAgentLastHeartbeatUtc = (global::System.DateTime?) content.GetValueForProperty("ReprotectAgentLastHeartbeatUtc",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).ReprotectAgentLastHeartbeatUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ReprotectAgentHealth")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).ReprotectAgentHealth = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth?) content.GetValueForProperty("ReprotectAgentHealth",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).ReprotectAgentHealth, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth.CreateFrom); + } + if (content.Contains("ReprotectAgentHealthError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).ReprotectAgentHealthError = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[]) content.GetValueForProperty("ReprotectAgentHealthError",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).ReprotectAgentHealthError, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("ReprotectAgentProtectedItemCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).ReprotectAgentProtectedItemCount = (int?) content.GetValueForProperty("ReprotectAgentProtectedItemCount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).ReprotectAgentProtectedItemCount, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("ReprotectAgentAccessibleDatastore")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).ReprotectAgentAccessibleDatastore = (string[]) content.GetValueForProperty("ReprotectAgentAccessibleDatastore",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).ReprotectAgentAccessibleDatastore, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("ReprotectAgentVcenterId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).ReprotectAgentVcenterId = (string) content.GetValueForProperty("ReprotectAgentVcenterId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).ReprotectAgentVcenterId, global::System.Convert.ToString); + } + if (content.Contains("ReprotectAgentLastDiscoveryInUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).ReprotectAgentLastDiscoveryInUtc = (global::System.DateTime?) content.GetValueForProperty("ReprotectAgentLastDiscoveryInUtc",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).ReprotectAgentLastDiscoveryInUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("MarAgentId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).MarAgentId = (string) content.GetValueForProperty("MarAgentId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).MarAgentId, global::System.Convert.ToString); + } + if (content.Contains("MarAgentName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).MarAgentName = (string) content.GetValueForProperty("MarAgentName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).MarAgentName, global::System.Convert.ToString); + } + if (content.Contains("MarAgentBiosId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).MarAgentBiosId = (string) content.GetValueForProperty("MarAgentBiosId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).MarAgentBiosId, global::System.Convert.ToString); + } + if (content.Contains("MarAgentFabricObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).MarAgentFabricObjectId = (string) content.GetValueForProperty("MarAgentFabricObjectId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).MarAgentFabricObjectId, global::System.Convert.ToString); + } + if (content.Contains("MarAgentFqdn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).MarAgentFqdn = (string) content.GetValueForProperty("MarAgentFqdn",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).MarAgentFqdn, global::System.Convert.ToString); + } + if (content.Contains("MarAgentVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).MarAgentVersion = (string) content.GetValueForProperty("MarAgentVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).MarAgentVersion, global::System.Convert.ToString); + } + if (content.Contains("MarAgentLastHeartbeatUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).MarAgentLastHeartbeatUtc = (global::System.DateTime?) content.GetValueForProperty("MarAgentLastHeartbeatUtc",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).MarAgentLastHeartbeatUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("MarAgentHealth")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).MarAgentHealth = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth?) content.GetValueForProperty("MarAgentHealth",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).MarAgentHealth, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth.CreateFrom); + } + if (content.Contains("MarAgentHealthError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).MarAgentHealthError = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[]) content.GetValueForProperty("MarAgentHealthError",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).MarAgentHealthError, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("DraId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).DraId = (string) content.GetValueForProperty("DraId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).DraId, global::System.Convert.ToString); + } + if (content.Contains("DraName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).DraName = (string) content.GetValueForProperty("DraName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).DraName, global::System.Convert.ToString); + } + if (content.Contains("DraBiosId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).DraBiosId = (string) content.GetValueForProperty("DraBiosId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).DraBiosId, global::System.Convert.ToString); + } + if (content.Contains("DraVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).DraVersion = (string) content.GetValueForProperty("DraVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).DraVersion, global::System.Convert.ToString); + } + if (content.Contains("DraLastHeartbeatUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).DraLastHeartbeatUtc = (global::System.DateTime?) content.GetValueForProperty("DraLastHeartbeatUtc",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).DraLastHeartbeatUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("DraHealth")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).DraHealth = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth?) content.GetValueForProperty("DraHealth",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).DraHealth, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth.CreateFrom); + } + if (content.Contains("DraHealthError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).DraHealthError = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[]) content.GetValueForProperty("DraHealthError",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).DraHealthError, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("DraForwardProtectedItemCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).DraForwardProtectedItemCount = (int?) content.GetValueForProperty("DraForwardProtectedItemCount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).DraForwardProtectedItemCount, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("DraReverseProtectedItemCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).DraReverseProtectedItemCount = (int?) content.GetValueForProperty("DraReverseProtectedItemCount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal)this).DraReverseProtectedItemCount, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// InMageRcm appliance details. + [System.ComponentModel.TypeConverter(typeof(InMageRcmApplianceDetailsTypeConverter))] + public partial interface IInMageRcmApplianceDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmApplianceDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmApplianceDetails.TypeConverter.cs new file mode 100644 index 000000000000..3e136c204f46 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmApplianceDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InMageRcmApplianceDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InMageRcmApplianceDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InMageRcmApplianceDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InMageRcmApplianceDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmApplianceDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmApplianceDetails.cs new file mode 100644 index 000000000000..8cae15ad2055 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmApplianceDetails.cs @@ -0,0 +1,1209 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMageRcm appliance details. + public partial class InMageRcmApplianceDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDraDetails _dra; + + /// The DRA. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDraDetails Dra { get => (this._dra = this._dra ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DraDetails()); } + + /// The DRA Bios Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string DraBiosId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDraDetailsInternal)Dra).BiosId; } + + /// The count of protected items which are protected in forward direction. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public int? DraForwardProtectedItemCount { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDraDetailsInternal)Dra).ForwardProtectedItemCount; } + + /// The health. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth? DraHealth { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDraDetailsInternal)Dra).Health; } + + /// The health errors. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] DraHealthError { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDraDetailsInternal)Dra).HealthError; } + + /// The DRA Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string DraId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDraDetailsInternal)Dra).Id; } + + /// The last heartbeat received from the DRA. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public global::System.DateTime? DraLastHeartbeatUtc { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDraDetailsInternal)Dra).LastHeartbeatUtc; } + + /// The DRA name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string DraName { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDraDetailsInternal)Dra).Name; } + + /// The count of protected items which are protected in reverse direction. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public int? DraReverseProtectedItemCount { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDraDetailsInternal)Dra).ReverseProtectedItemCount; } + + /// The version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string DraVersion { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDraDetailsInternal)Dra).Version; } + + /// Backing field for property. + private string _fabricArmId; + + /// The fabric ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string FabricArmId { get => this._fabricArmId; } + + /// Backing field for property. + private string _id; + + /// The appliance Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Id { get => this._id; } + + /// The Mars agent Bios Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string MarAgentBiosId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMarsAgentDetailsInternal)MarsAgent).BiosId; } + + /// The fabric object Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string MarAgentFabricObjectId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMarsAgentDetailsInternal)MarsAgent).FabricObjectId; } + + /// The Mars agent Fqdn. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string MarAgentFqdn { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMarsAgentDetailsInternal)MarsAgent).Fqdn; } + + /// The health of the Mars agent. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth? MarAgentHealth { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMarsAgentDetailsInternal)MarsAgent).Health; } + + /// The health errors. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] MarAgentHealthError { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMarsAgentDetailsInternal)MarsAgent).HealthError; } + + /// The Mars agent Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string MarAgentId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMarsAgentDetailsInternal)MarsAgent).Id; } + + /// The last heartbeat received from the Mars agent. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public global::System.DateTime? MarAgentLastHeartbeatUtc { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMarsAgentDetailsInternal)MarsAgent).LastHeartbeatUtc; } + + /// The Mars agent name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string MarAgentName { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMarsAgentDetailsInternal)MarsAgent).Name; } + + /// The version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string MarAgentVersion { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMarsAgentDetailsInternal)MarsAgent).Version; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMarsAgentDetails _marsAgent; + + /// The Mars agent. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMarsAgentDetails MarsAgent { get => (this._marsAgent = this._marsAgent ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.MarsAgentDetails()); } + + /// Internal Acessors for Dra + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDraDetails Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal.Dra { get => (this._dra = this._dra ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DraDetails()); set { {_dra = value;} } } + + /// Internal Acessors for DraBiosId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal.DraBiosId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDraDetailsInternal)Dra).BiosId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDraDetailsInternal)Dra).BiosId = value; } + + /// Internal Acessors for DraForwardProtectedItemCount + int? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal.DraForwardProtectedItemCount { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDraDetailsInternal)Dra).ForwardProtectedItemCount; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDraDetailsInternal)Dra).ForwardProtectedItemCount = value; } + + /// Internal Acessors for DraHealth + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal.DraHealth { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDraDetailsInternal)Dra).Health; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDraDetailsInternal)Dra).Health = value; } + + /// Internal Acessors for DraHealthError + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal.DraHealthError { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDraDetailsInternal)Dra).HealthError; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDraDetailsInternal)Dra).HealthError = value; } + + /// Internal Acessors for DraId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal.DraId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDraDetailsInternal)Dra).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDraDetailsInternal)Dra).Id = value; } + + /// Internal Acessors for DraLastHeartbeatUtc + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal.DraLastHeartbeatUtc { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDraDetailsInternal)Dra).LastHeartbeatUtc; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDraDetailsInternal)Dra).LastHeartbeatUtc = value; } + + /// Internal Acessors for DraName + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal.DraName { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDraDetailsInternal)Dra).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDraDetailsInternal)Dra).Name = value; } + + /// Internal Acessors for DraReverseProtectedItemCount + int? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal.DraReverseProtectedItemCount { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDraDetailsInternal)Dra).ReverseProtectedItemCount; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDraDetailsInternal)Dra).ReverseProtectedItemCount = value; } + + /// Internal Acessors for DraVersion + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal.DraVersion { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDraDetailsInternal)Dra).Version; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDraDetailsInternal)Dra).Version = value; } + + /// Internal Acessors for FabricArmId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal.FabricArmId { get => this._fabricArmId; set { {_fabricArmId = value;} } } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal.Id { get => this._id; set { {_id = value;} } } + + /// Internal Acessors for MarAgentBiosId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal.MarAgentBiosId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMarsAgentDetailsInternal)MarsAgent).BiosId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMarsAgentDetailsInternal)MarsAgent).BiosId = value; } + + /// Internal Acessors for MarAgentFabricObjectId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal.MarAgentFabricObjectId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMarsAgentDetailsInternal)MarsAgent).FabricObjectId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMarsAgentDetailsInternal)MarsAgent).FabricObjectId = value; } + + /// Internal Acessors for MarAgentFqdn + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal.MarAgentFqdn { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMarsAgentDetailsInternal)MarsAgent).Fqdn; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMarsAgentDetailsInternal)MarsAgent).Fqdn = value; } + + /// Internal Acessors for MarAgentHealth + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal.MarAgentHealth { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMarsAgentDetailsInternal)MarsAgent).Health; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMarsAgentDetailsInternal)MarsAgent).Health = value; } + + /// Internal Acessors for MarAgentHealthError + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal.MarAgentHealthError { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMarsAgentDetailsInternal)MarsAgent).HealthError; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMarsAgentDetailsInternal)MarsAgent).HealthError = value; } + + /// Internal Acessors for MarAgentId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal.MarAgentId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMarsAgentDetailsInternal)MarsAgent).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMarsAgentDetailsInternal)MarsAgent).Id = value; } + + /// Internal Acessors for MarAgentLastHeartbeatUtc + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal.MarAgentLastHeartbeatUtc { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMarsAgentDetailsInternal)MarsAgent).LastHeartbeatUtc; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMarsAgentDetailsInternal)MarsAgent).LastHeartbeatUtc = value; } + + /// Internal Acessors for MarAgentName + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal.MarAgentName { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMarsAgentDetailsInternal)MarsAgent).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMarsAgentDetailsInternal)MarsAgent).Name = value; } + + /// Internal Acessors for MarAgentVersion + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal.MarAgentVersion { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMarsAgentDetailsInternal)MarsAgent).Version; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMarsAgentDetailsInternal)MarsAgent).Version = value; } + + /// Internal Acessors for MarsAgent + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMarsAgentDetails Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal.MarsAgent { get => (this._marsAgent = this._marsAgent ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.MarsAgentDetails()); set { {_marsAgent = value;} } } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal.Name { get => this._name; set { {_name = value;} } } + + /// Internal Acessors for ProcessServer + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetails Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal.ProcessServer { get => (this._processServer = this._processServer ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProcessServerDetails()); set { {_processServer = value;} } } + + /// Internal Acessors for PushInstaller + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPushInstallerDetails Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal.PushInstaller { get => (this._pushInstaller = this._pushInstaller ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PushInstallerDetails()); set { {_pushInstaller = value;} } } + + /// Internal Acessors for PushInstallerBiosId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal.PushInstallerBiosId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPushInstallerDetailsInternal)PushInstaller).BiosId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPushInstallerDetailsInternal)PushInstaller).BiosId = value; } + + /// Internal Acessors for PushInstallerFabricObjectId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal.PushInstallerFabricObjectId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPushInstallerDetailsInternal)PushInstaller).FabricObjectId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPushInstallerDetailsInternal)PushInstaller).FabricObjectId = value; } + + /// Internal Acessors for PushInstallerFqdn + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal.PushInstallerFqdn { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPushInstallerDetailsInternal)PushInstaller).Fqdn; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPushInstallerDetailsInternal)PushInstaller).Fqdn = value; } + + /// Internal Acessors for PushInstallerHealth + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal.PushInstallerHealth { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPushInstallerDetailsInternal)PushInstaller).Health; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPushInstallerDetailsInternal)PushInstaller).Health = value; } + + /// Internal Acessors for PushInstallerHealthError + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal.PushInstallerHealthError { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPushInstallerDetailsInternal)PushInstaller).HealthError; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPushInstallerDetailsInternal)PushInstaller).HealthError = value; } + + /// Internal Acessors for PushInstallerId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal.PushInstallerId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPushInstallerDetailsInternal)PushInstaller).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPushInstallerDetailsInternal)PushInstaller).Id = value; } + + /// Internal Acessors for PushInstallerLastHeartbeatUtc + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal.PushInstallerLastHeartbeatUtc { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPushInstallerDetailsInternal)PushInstaller).LastHeartbeatUtc; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPushInstallerDetailsInternal)PushInstaller).LastHeartbeatUtc = value; } + + /// Internal Acessors for PushInstallerName + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal.PushInstallerName { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPushInstallerDetailsInternal)PushInstaller).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPushInstallerDetailsInternal)PushInstaller).Name = value; } + + /// Internal Acessors for PushInstallerVersion + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal.PushInstallerVersion { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPushInstallerDetailsInternal)PushInstaller).Version; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPushInstallerDetailsInternal)PushInstaller).Version = value; } + + /// Internal Acessors for RcmProxy + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetails Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal.RcmProxy { get => (this._rcmProxy = this._rcmProxy ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RcmProxyDetails()); set { {_rcmProxy = value;} } } + + /// Internal Acessors for RcmProxyBiosId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal.RcmProxyBiosId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetailsInternal)RcmProxy).BiosId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetailsInternal)RcmProxy).BiosId = value; } + + /// Internal Acessors for RcmProxyClientAuthenticationType + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal.RcmProxyClientAuthenticationType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetailsInternal)RcmProxy).ClientAuthenticationType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetailsInternal)RcmProxy).ClientAuthenticationType = value; } + + /// Internal Acessors for RcmProxyFabricObjectId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal.RcmProxyFabricObjectId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetailsInternal)RcmProxy).FabricObjectId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetailsInternal)RcmProxy).FabricObjectId = value; } + + /// Internal Acessors for RcmProxyFqdn + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal.RcmProxyFqdn { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetailsInternal)RcmProxy).Fqdn; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetailsInternal)RcmProxy).Fqdn = value; } + + /// Internal Acessors for RcmProxyHealth + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal.RcmProxyHealth { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetailsInternal)RcmProxy).Health; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetailsInternal)RcmProxy).Health = value; } + + /// Internal Acessors for RcmProxyHealthError + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal.RcmProxyHealthError { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetailsInternal)RcmProxy).HealthError; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetailsInternal)RcmProxy).HealthError = value; } + + /// Internal Acessors for RcmProxyId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal.RcmProxyId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetailsInternal)RcmProxy).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetailsInternal)RcmProxy).Id = value; } + + /// Internal Acessors for RcmProxyLastHeartbeatUtc + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal.RcmProxyLastHeartbeatUtc { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetailsInternal)RcmProxy).LastHeartbeatUtc; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetailsInternal)RcmProxy).LastHeartbeatUtc = value; } + + /// Internal Acessors for RcmProxyName + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal.RcmProxyName { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetailsInternal)RcmProxy).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetailsInternal)RcmProxy).Name = value; } + + /// Internal Acessors for RcmProxyVersion + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal.RcmProxyVersion { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetailsInternal)RcmProxy).Version; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetailsInternal)RcmProxy).Version = value; } + + /// Internal Acessors for ReplicationAgent + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAgentDetails Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal.ReplicationAgent { get => (this._replicationAgent = this._replicationAgent ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationAgentDetails()); set { {_replicationAgent = value;} } } + + /// Internal Acessors for ReplicationAgentBiosId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal.ReplicationAgentBiosId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAgentDetailsInternal)ReplicationAgent).BiosId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAgentDetailsInternal)ReplicationAgent).BiosId = value; } + + /// Internal Acessors for ReplicationAgentFabricObjectId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal.ReplicationAgentFabricObjectId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAgentDetailsInternal)ReplicationAgent).FabricObjectId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAgentDetailsInternal)ReplicationAgent).FabricObjectId = value; } + + /// Internal Acessors for ReplicationAgentFqdn + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal.ReplicationAgentFqdn { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAgentDetailsInternal)ReplicationAgent).Fqdn; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAgentDetailsInternal)ReplicationAgent).Fqdn = value; } + + /// Internal Acessors for ReplicationAgentHealth + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal.ReplicationAgentHealth { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAgentDetailsInternal)ReplicationAgent).Health; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAgentDetailsInternal)ReplicationAgent).Health = value; } + + /// Internal Acessors for ReplicationAgentHealthError + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal.ReplicationAgentHealthError { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAgentDetailsInternal)ReplicationAgent).HealthError; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAgentDetailsInternal)ReplicationAgent).HealthError = value; } + + /// Internal Acessors for ReplicationAgentId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal.ReplicationAgentId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAgentDetailsInternal)ReplicationAgent).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAgentDetailsInternal)ReplicationAgent).Id = value; } + + /// Internal Acessors for ReplicationAgentLastHeartbeatUtc + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal.ReplicationAgentLastHeartbeatUtc { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAgentDetailsInternal)ReplicationAgent).LastHeartbeatUtc; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAgentDetailsInternal)ReplicationAgent).LastHeartbeatUtc = value; } + + /// Internal Acessors for ReplicationAgentName + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal.ReplicationAgentName { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAgentDetailsInternal)ReplicationAgent).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAgentDetailsInternal)ReplicationAgent).Name = value; } + + /// Internal Acessors for ReplicationAgentVersion + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal.ReplicationAgentVersion { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAgentDetailsInternal)ReplicationAgent).Version; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAgentDetailsInternal)ReplicationAgent).Version = value; } + + /// Internal Acessors for ReprotectAgent + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetails Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal.ReprotectAgent { get => (this._reprotectAgent = this._reprotectAgent ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReprotectAgentDetails()); set { {_reprotectAgent = value;} } } + + /// Internal Acessors for ReprotectAgentAccessibleDatastore + string[] Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal.ReprotectAgentAccessibleDatastore { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal)ReprotectAgent).AccessibleDatastore; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal)ReprotectAgent).AccessibleDatastore = value; } + + /// Internal Acessors for ReprotectAgentBiosId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal.ReprotectAgentBiosId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal)ReprotectAgent).BiosId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal)ReprotectAgent).BiosId = value; } + + /// Internal Acessors for ReprotectAgentFabricObjectId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal.ReprotectAgentFabricObjectId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal)ReprotectAgent).FabricObjectId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal)ReprotectAgent).FabricObjectId = value; } + + /// Internal Acessors for ReprotectAgentFqdn + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal.ReprotectAgentFqdn { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal)ReprotectAgent).Fqdn; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal)ReprotectAgent).Fqdn = value; } + + /// Internal Acessors for ReprotectAgentHealth + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal.ReprotectAgentHealth { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal)ReprotectAgent).Health; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal)ReprotectAgent).Health = value; } + + /// Internal Acessors for ReprotectAgentHealthError + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal.ReprotectAgentHealthError { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal)ReprotectAgent).HealthError; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal)ReprotectAgent).HealthError = value; } + + /// Internal Acessors for ReprotectAgentId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal.ReprotectAgentId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal)ReprotectAgent).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal)ReprotectAgent).Id = value; } + + /// Internal Acessors for ReprotectAgentLastDiscoveryInUtc + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal.ReprotectAgentLastDiscoveryInUtc { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal)ReprotectAgent).LastDiscoveryInUtc; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal)ReprotectAgent).LastDiscoveryInUtc = value; } + + /// Internal Acessors for ReprotectAgentLastHeartbeatUtc + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal.ReprotectAgentLastHeartbeatUtc { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal)ReprotectAgent).LastHeartbeatUtc; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal)ReprotectAgent).LastHeartbeatUtc = value; } + + /// Internal Acessors for ReprotectAgentName + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal.ReprotectAgentName { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal)ReprotectAgent).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal)ReprotectAgent).Name = value; } + + /// Internal Acessors for ReprotectAgentProtectedItemCount + int? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal.ReprotectAgentProtectedItemCount { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal)ReprotectAgent).ProtectedItemCount; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal)ReprotectAgent).ProtectedItemCount = value; } + + /// Internal Acessors for ReprotectAgentVcenterId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal.ReprotectAgentVcenterId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal)ReprotectAgent).VcenterId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal)ReprotectAgent).VcenterId = value; } + + /// Internal Acessors for ReprotectAgentVersion + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal.ReprotectAgentVersion { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal)ReprotectAgent).Version; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal)ReprotectAgent).Version = value; } + + /// Internal Acessors for SwitchProviderBlockingErrorDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSwitchProviderBlockingErrorDetails[] Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetailsInternal.SwitchProviderBlockingErrorDetail { get => this._switchProviderBlockingErrorDetail; set { {_switchProviderBlockingErrorDetail = value;} } } + + /// Backing field for property. + private string _name; + + /// The appliance name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Name { get => this._name; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetails _processServer; + + /// The process server. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetails ProcessServer { get => (this._processServer = this._processServer ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProcessServerDetails()); } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPushInstallerDetails _pushInstaller; + + /// The push installer. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPushInstallerDetails PushInstaller { get => (this._pushInstaller = this._pushInstaller ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PushInstallerDetails()); } + + /// The push installer Bios Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string PushInstallerBiosId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPushInstallerDetailsInternal)PushInstaller).BiosId; } + + /// The fabric object Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string PushInstallerFabricObjectId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPushInstallerDetailsInternal)PushInstaller).FabricObjectId; } + + /// The push installer Fqdn. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string PushInstallerFqdn { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPushInstallerDetailsInternal)PushInstaller).Fqdn; } + + /// The health of the push installer. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth? PushInstallerHealth { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPushInstallerDetailsInternal)PushInstaller).Health; } + + /// The health errors. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] PushInstallerHealthError { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPushInstallerDetailsInternal)PushInstaller).HealthError; } + + /// The push installer Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string PushInstallerId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPushInstallerDetailsInternal)PushInstaller).Id; } + + /// The last heartbeat received from the push installer. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public global::System.DateTime? PushInstallerLastHeartbeatUtc { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPushInstallerDetailsInternal)PushInstaller).LastHeartbeatUtc; } + + /// The push installer name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string PushInstallerName { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPushInstallerDetailsInternal)PushInstaller).Name; } + + /// The version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string PushInstallerVersion { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPushInstallerDetailsInternal)PushInstaller).Version; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetails _rcmProxy; + + /// The of RCM proxy. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetails RcmProxy { get => (this._rcmProxy = this._rcmProxy ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RcmProxyDetails()); } + + /// The RCM proxy Bios Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string RcmProxyBiosId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetailsInternal)RcmProxy).BiosId; } + + /// The client authentication type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string RcmProxyClientAuthenticationType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetailsInternal)RcmProxy).ClientAuthenticationType; } + + /// The fabric object Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string RcmProxyFabricObjectId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetailsInternal)RcmProxy).FabricObjectId; } + + /// The RCM proxy Fqdn. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string RcmProxyFqdn { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetailsInternal)RcmProxy).Fqdn; } + + /// The health of the RCM proxy. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth? RcmProxyHealth { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetailsInternal)RcmProxy).Health; } + + /// The health errors. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] RcmProxyHealthError { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetailsInternal)RcmProxy).HealthError; } + + /// The RCM proxy Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string RcmProxyId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetailsInternal)RcmProxy).Id; } + + /// The last heartbeat received from the RCM proxy. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public global::System.DateTime? RcmProxyLastHeartbeatUtc { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetailsInternal)RcmProxy).LastHeartbeatUtc; } + + /// The RCM proxy name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string RcmProxyName { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetailsInternal)RcmProxy).Name; } + + /// The version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string RcmProxyVersion { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetailsInternal)RcmProxy).Version; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAgentDetails _replicationAgent; + + /// The replication agent. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAgentDetails ReplicationAgent { get => (this._replicationAgent = this._replicationAgent ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationAgentDetails()); } + + /// The replication agent Bios Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ReplicationAgentBiosId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAgentDetailsInternal)ReplicationAgent).BiosId; } + + /// The fabric object Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ReplicationAgentFabricObjectId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAgentDetailsInternal)ReplicationAgent).FabricObjectId; } + + /// The replication agent Fqdn. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ReplicationAgentFqdn { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAgentDetailsInternal)ReplicationAgent).Fqdn; } + + /// The health of the replication agent. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth? ReplicationAgentHealth { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAgentDetailsInternal)ReplicationAgent).Health; } + + /// The health errors. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] ReplicationAgentHealthError { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAgentDetailsInternal)ReplicationAgent).HealthError; } + + /// The replication agent Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ReplicationAgentId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAgentDetailsInternal)ReplicationAgent).Id; } + + /// The last heartbeat received from the replication agent. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public global::System.DateTime? ReplicationAgentLastHeartbeatUtc { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAgentDetailsInternal)ReplicationAgent).LastHeartbeatUtc; } + + /// The replication agent name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ReplicationAgentName { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAgentDetailsInternal)ReplicationAgent).Name; } + + /// The version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ReplicationAgentVersion { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAgentDetailsInternal)ReplicationAgent).Version; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetails _reprotectAgent; + + /// The reprotect agent. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetails ReprotectAgent { get => (this._reprotectAgent = this._reprotectAgent ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReprotectAgentDetails()); } + + /// The list of accessible datastores fetched from discovery. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string[] ReprotectAgentAccessibleDatastore { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal)ReprotectAgent).AccessibleDatastore; } + + /// The reprotect agent Bios Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ReprotectAgentBiosId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal)ReprotectAgent).BiosId; } + + /// The fabric object Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ReprotectAgentFabricObjectId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal)ReprotectAgent).FabricObjectId; } + + /// The reprotect agent Fqdn. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ReprotectAgentFqdn { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal)ReprotectAgent).Fqdn; } + + /// The health of the reprotect agent. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth? ReprotectAgentHealth { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal)ReprotectAgent).Health; } + + /// The health errors. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] ReprotectAgentHealthError { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal)ReprotectAgent).HealthError; } + + /// The reprotect agent Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ReprotectAgentId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal)ReprotectAgent).Id; } + + /// The last time when SDS information discovered in SRS. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public global::System.DateTime? ReprotectAgentLastDiscoveryInUtc { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal)ReprotectAgent).LastDiscoveryInUtc; } + + /// The last heartbeat received from the reprotect agent. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public global::System.DateTime? ReprotectAgentLastHeartbeatUtc { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal)ReprotectAgent).LastHeartbeatUtc; } + + /// The reprotect agent name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ReprotectAgentName { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal)ReprotectAgent).Name; } + + /// The protected item count. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public int? ReprotectAgentProtectedItemCount { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal)ReprotectAgent).ProtectedItemCount; } + + /// The Vcenter Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ReprotectAgentVcenterId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal)ReprotectAgent).VcenterId; } + + /// The version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ReprotectAgentVersion { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal)ReprotectAgent).Version; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSwitchProviderBlockingErrorDetails[] _switchProviderBlockingErrorDetail; + + /// The switch provider blocking error information. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSwitchProviderBlockingErrorDetails[] SwitchProviderBlockingErrorDetail { get => this._switchProviderBlockingErrorDetail; } + + /// Creates an new instance. + public InMageRcmApplianceDetails() + { + + } + } + /// InMageRcm appliance details. + public partial interface IInMageRcmApplianceDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The DRA Bios Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The DRA Bios Id.", + SerializedName = @"biosId", + PossibleTypes = new [] { typeof(string) })] + string DraBiosId { get; } + /// The count of protected items which are protected in forward direction. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The count of protected items which are protected in forward direction.", + SerializedName = @"forwardProtectedItemCount", + PossibleTypes = new [] { typeof(int) })] + int? DraForwardProtectedItemCount { get; } + /// The health. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The health.", + SerializedName = @"health", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth? DraHealth { get; } + /// The health errors. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The health errors.", + SerializedName = @"healthErrors", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] DraHealthError { get; } + /// The DRA Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The DRA Id.", + SerializedName = @"id", + PossibleTypes = new [] { typeof(string) })] + string DraId { get; } + /// The last heartbeat received from the DRA. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The last heartbeat received from the DRA.", + SerializedName = @"lastHeartbeatUtc", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? DraLastHeartbeatUtc { get; } + /// The DRA name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The DRA name.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string DraName { get; } + /// The count of protected items which are protected in reverse direction. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The count of protected items which are protected in reverse direction.", + SerializedName = @"reverseProtectedItemCount", + PossibleTypes = new [] { typeof(int) })] + int? DraReverseProtectedItemCount { get; } + /// The version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The version.", + SerializedName = @"version", + PossibleTypes = new [] { typeof(string) })] + string DraVersion { get; } + /// The fabric ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The fabric ARM Id.", + SerializedName = @"fabricArmId", + PossibleTypes = new [] { typeof(string) })] + string FabricArmId { get; } + /// The appliance Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The appliance Id.", + SerializedName = @"id", + PossibleTypes = new [] { typeof(string) })] + string Id { get; } + /// The Mars agent Bios Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The Mars agent Bios Id.", + SerializedName = @"biosId", + PossibleTypes = new [] { typeof(string) })] + string MarAgentBiosId { get; } + /// The fabric object Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The fabric object Id.", + SerializedName = @"fabricObjectId", + PossibleTypes = new [] { typeof(string) })] + string MarAgentFabricObjectId { get; } + /// The Mars agent Fqdn. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The Mars agent Fqdn.", + SerializedName = @"fqdn", + PossibleTypes = new [] { typeof(string) })] + string MarAgentFqdn { get; } + /// The health of the Mars agent. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The health of the Mars agent.", + SerializedName = @"health", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth? MarAgentHealth { get; } + /// The health errors. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The health errors.", + SerializedName = @"healthErrors", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] MarAgentHealthError { get; } + /// The Mars agent Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The Mars agent Id.", + SerializedName = @"id", + PossibleTypes = new [] { typeof(string) })] + string MarAgentId { get; } + /// The last heartbeat received from the Mars agent. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The last heartbeat received from the Mars agent.", + SerializedName = @"lastHeartbeatUtc", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? MarAgentLastHeartbeatUtc { get; } + /// The Mars agent name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The Mars agent name.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string MarAgentName { get; } + /// The version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The version.", + SerializedName = @"version", + PossibleTypes = new [] { typeof(string) })] + string MarAgentVersion { get; } + /// The appliance name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The appliance name.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string Name { get; } + /// The process server. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The process server.", + SerializedName = @"processServer", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetails) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetails ProcessServer { get; } + /// The push installer Bios Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The push installer Bios Id.", + SerializedName = @"biosId", + PossibleTypes = new [] { typeof(string) })] + string PushInstallerBiosId { get; } + /// The fabric object Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The fabric object Id.", + SerializedName = @"fabricObjectId", + PossibleTypes = new [] { typeof(string) })] + string PushInstallerFabricObjectId { get; } + /// The push installer Fqdn. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The push installer Fqdn.", + SerializedName = @"fqdn", + PossibleTypes = new [] { typeof(string) })] + string PushInstallerFqdn { get; } + /// The health of the push installer. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The health of the push installer.", + SerializedName = @"health", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth? PushInstallerHealth { get; } + /// The health errors. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The health errors.", + SerializedName = @"healthErrors", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] PushInstallerHealthError { get; } + /// The push installer Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The push installer Id.", + SerializedName = @"id", + PossibleTypes = new [] { typeof(string) })] + string PushInstallerId { get; } + /// The last heartbeat received from the push installer. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The last heartbeat received from the push installer.", + SerializedName = @"lastHeartbeatUtc", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? PushInstallerLastHeartbeatUtc { get; } + /// The push installer name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The push installer name.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string PushInstallerName { get; } + /// The version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The version.", + SerializedName = @"version", + PossibleTypes = new [] { typeof(string) })] + string PushInstallerVersion { get; } + /// The RCM proxy Bios Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The RCM proxy Bios Id.", + SerializedName = @"biosId", + PossibleTypes = new [] { typeof(string) })] + string RcmProxyBiosId { get; } + /// The client authentication type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The client authentication type.", + SerializedName = @"clientAuthenticationType", + PossibleTypes = new [] { typeof(string) })] + string RcmProxyClientAuthenticationType { get; } + /// The fabric object Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The fabric object Id.", + SerializedName = @"fabricObjectId", + PossibleTypes = new [] { typeof(string) })] + string RcmProxyFabricObjectId { get; } + /// The RCM proxy Fqdn. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The RCM proxy Fqdn.", + SerializedName = @"fqdn", + PossibleTypes = new [] { typeof(string) })] + string RcmProxyFqdn { get; } + /// The health of the RCM proxy. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The health of the RCM proxy.", + SerializedName = @"health", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth? RcmProxyHealth { get; } + /// The health errors. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The health errors.", + SerializedName = @"healthErrors", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] RcmProxyHealthError { get; } + /// The RCM proxy Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The RCM proxy Id.", + SerializedName = @"id", + PossibleTypes = new [] { typeof(string) })] + string RcmProxyId { get; } + /// The last heartbeat received from the RCM proxy. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The last heartbeat received from the RCM proxy.", + SerializedName = @"lastHeartbeatUtc", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? RcmProxyLastHeartbeatUtc { get; } + /// The RCM proxy name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The RCM proxy name.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string RcmProxyName { get; } + /// The version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The version.", + SerializedName = @"version", + PossibleTypes = new [] { typeof(string) })] + string RcmProxyVersion { get; } + /// The replication agent Bios Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The replication agent Bios Id.", + SerializedName = @"biosId", + PossibleTypes = new [] { typeof(string) })] + string ReplicationAgentBiosId { get; } + /// The fabric object Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The fabric object Id.", + SerializedName = @"fabricObjectId", + PossibleTypes = new [] { typeof(string) })] + string ReplicationAgentFabricObjectId { get; } + /// The replication agent Fqdn. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The replication agent Fqdn.", + SerializedName = @"fqdn", + PossibleTypes = new [] { typeof(string) })] + string ReplicationAgentFqdn { get; } + /// The health of the replication agent. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The health of the replication agent.", + SerializedName = @"health", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth? ReplicationAgentHealth { get; } + /// The health errors. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The health errors.", + SerializedName = @"healthErrors", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] ReplicationAgentHealthError { get; } + /// The replication agent Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The replication agent Id.", + SerializedName = @"id", + PossibleTypes = new [] { typeof(string) })] + string ReplicationAgentId { get; } + /// The last heartbeat received from the replication agent. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The last heartbeat received from the replication agent.", + SerializedName = @"lastHeartbeatUtc", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? ReplicationAgentLastHeartbeatUtc { get; } + /// The replication agent name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The replication agent name.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string ReplicationAgentName { get; } + /// The version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The version.", + SerializedName = @"version", + PossibleTypes = new [] { typeof(string) })] + string ReplicationAgentVersion { get; } + /// The list of accessible datastores fetched from discovery. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The list of accessible datastores fetched from discovery.", + SerializedName = @"accessibleDatastores", + PossibleTypes = new [] { typeof(string) })] + string[] ReprotectAgentAccessibleDatastore { get; } + /// The reprotect agent Bios Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The reprotect agent Bios Id.", + SerializedName = @"biosId", + PossibleTypes = new [] { typeof(string) })] + string ReprotectAgentBiosId { get; } + /// The fabric object Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The fabric object Id.", + SerializedName = @"fabricObjectId", + PossibleTypes = new [] { typeof(string) })] + string ReprotectAgentFabricObjectId { get; } + /// The reprotect agent Fqdn. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The reprotect agent Fqdn.", + SerializedName = @"fqdn", + PossibleTypes = new [] { typeof(string) })] + string ReprotectAgentFqdn { get; } + /// The health of the reprotect agent. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The health of the reprotect agent.", + SerializedName = @"health", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth? ReprotectAgentHealth { get; } + /// The health errors. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The health errors.", + SerializedName = @"healthErrors", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] ReprotectAgentHealthError { get; } + /// The reprotect agent Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The reprotect agent Id.", + SerializedName = @"id", + PossibleTypes = new [] { typeof(string) })] + string ReprotectAgentId { get; } + /// The last time when SDS information discovered in SRS. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The last time when SDS information discovered in SRS.", + SerializedName = @"lastDiscoveryInUtc", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? ReprotectAgentLastDiscoveryInUtc { get; } + /// The last heartbeat received from the reprotect agent. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The last heartbeat received from the reprotect agent.", + SerializedName = @"lastHeartbeatUtc", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? ReprotectAgentLastHeartbeatUtc { get; } + /// The reprotect agent name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The reprotect agent name.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string ReprotectAgentName { get; } + /// The protected item count. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The protected item count.", + SerializedName = @"protectedItemCount", + PossibleTypes = new [] { typeof(int) })] + int? ReprotectAgentProtectedItemCount { get; } + /// The Vcenter Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The Vcenter Id.", + SerializedName = @"vcenterId", + PossibleTypes = new [] { typeof(string) })] + string ReprotectAgentVcenterId { get; } + /// The version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The version.", + SerializedName = @"version", + PossibleTypes = new [] { typeof(string) })] + string ReprotectAgentVersion { get; } + /// The switch provider blocking error information. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The switch provider blocking error information.", + SerializedName = @"switchProviderBlockingErrorDetails", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSwitchProviderBlockingErrorDetails) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSwitchProviderBlockingErrorDetails[] SwitchProviderBlockingErrorDetail { get; } + + } + /// InMageRcm appliance details. + internal partial interface IInMageRcmApplianceDetailsInternal + + { + /// The DRA. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDraDetails Dra { get; set; } + /// The DRA Bios Id. + string DraBiosId { get; set; } + /// The count of protected items which are protected in forward direction. + int? DraForwardProtectedItemCount { get; set; } + /// The health. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth? DraHealth { get; set; } + /// The health errors. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] DraHealthError { get; set; } + /// The DRA Id. + string DraId { get; set; } + /// The last heartbeat received from the DRA. + global::System.DateTime? DraLastHeartbeatUtc { get; set; } + /// The DRA name. + string DraName { get; set; } + /// The count of protected items which are protected in reverse direction. + int? DraReverseProtectedItemCount { get; set; } + /// The version. + string DraVersion { get; set; } + /// The fabric ARM Id. + string FabricArmId { get; set; } + /// The appliance Id. + string Id { get; set; } + /// The Mars agent Bios Id. + string MarAgentBiosId { get; set; } + /// The fabric object Id. + string MarAgentFabricObjectId { get; set; } + /// The Mars agent Fqdn. + string MarAgentFqdn { get; set; } + /// The health of the Mars agent. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth? MarAgentHealth { get; set; } + /// The health errors. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] MarAgentHealthError { get; set; } + /// The Mars agent Id. + string MarAgentId { get; set; } + /// The last heartbeat received from the Mars agent. + global::System.DateTime? MarAgentLastHeartbeatUtc { get; set; } + /// The Mars agent name. + string MarAgentName { get; set; } + /// The version. + string MarAgentVersion { get; set; } + /// The Mars agent. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMarsAgentDetails MarsAgent { get; set; } + /// The appliance name. + string Name { get; set; } + /// The process server. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetails ProcessServer { get; set; } + /// The push installer. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPushInstallerDetails PushInstaller { get; set; } + /// The push installer Bios Id. + string PushInstallerBiosId { get; set; } + /// The fabric object Id. + string PushInstallerFabricObjectId { get; set; } + /// The push installer Fqdn. + string PushInstallerFqdn { get; set; } + /// The health of the push installer. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth? PushInstallerHealth { get; set; } + /// The health errors. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] PushInstallerHealthError { get; set; } + /// The push installer Id. + string PushInstallerId { get; set; } + /// The last heartbeat received from the push installer. + global::System.DateTime? PushInstallerLastHeartbeatUtc { get; set; } + /// The push installer name. + string PushInstallerName { get; set; } + /// The version. + string PushInstallerVersion { get; set; } + /// The of RCM proxy. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetails RcmProxy { get; set; } + /// The RCM proxy Bios Id. + string RcmProxyBiosId { get; set; } + /// The client authentication type. + string RcmProxyClientAuthenticationType { get; set; } + /// The fabric object Id. + string RcmProxyFabricObjectId { get; set; } + /// The RCM proxy Fqdn. + string RcmProxyFqdn { get; set; } + /// The health of the RCM proxy. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth? RcmProxyHealth { get; set; } + /// The health errors. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] RcmProxyHealthError { get; set; } + /// The RCM proxy Id. + string RcmProxyId { get; set; } + /// The last heartbeat received from the RCM proxy. + global::System.DateTime? RcmProxyLastHeartbeatUtc { get; set; } + /// The RCM proxy name. + string RcmProxyName { get; set; } + /// The version. + string RcmProxyVersion { get; set; } + /// The replication agent. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAgentDetails ReplicationAgent { get; set; } + /// The replication agent Bios Id. + string ReplicationAgentBiosId { get; set; } + /// The fabric object Id. + string ReplicationAgentFabricObjectId { get; set; } + /// The replication agent Fqdn. + string ReplicationAgentFqdn { get; set; } + /// The health of the replication agent. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth? ReplicationAgentHealth { get; set; } + /// The health errors. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] ReplicationAgentHealthError { get; set; } + /// The replication agent Id. + string ReplicationAgentId { get; set; } + /// The last heartbeat received from the replication agent. + global::System.DateTime? ReplicationAgentLastHeartbeatUtc { get; set; } + /// The replication agent name. + string ReplicationAgentName { get; set; } + /// The version. + string ReplicationAgentVersion { get; set; } + /// The reprotect agent. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetails ReprotectAgent { get; set; } + /// The list of accessible datastores fetched from discovery. + string[] ReprotectAgentAccessibleDatastore { get; set; } + /// The reprotect agent Bios Id. + string ReprotectAgentBiosId { get; set; } + /// The fabric object Id. + string ReprotectAgentFabricObjectId { get; set; } + /// The reprotect agent Fqdn. + string ReprotectAgentFqdn { get; set; } + /// The health of the reprotect agent. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth? ReprotectAgentHealth { get; set; } + /// The health errors. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] ReprotectAgentHealthError { get; set; } + /// The reprotect agent Id. + string ReprotectAgentId { get; set; } + /// The last time when SDS information discovered in SRS. + global::System.DateTime? ReprotectAgentLastDiscoveryInUtc { get; set; } + /// The last heartbeat received from the reprotect agent. + global::System.DateTime? ReprotectAgentLastHeartbeatUtc { get; set; } + /// The reprotect agent name. + string ReprotectAgentName { get; set; } + /// The protected item count. + int? ReprotectAgentProtectedItemCount { get; set; } + /// The Vcenter Id. + string ReprotectAgentVcenterId { get; set; } + /// The version. + string ReprotectAgentVersion { get; set; } + /// The switch provider blocking error information. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSwitchProviderBlockingErrorDetails[] SwitchProviderBlockingErrorDetail { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmApplianceDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmApplianceDetails.json.cs new file mode 100644 index 000000000000..b446593f7dfd --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmApplianceDetails.json.cs @@ -0,0 +1,169 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMageRcm appliance details. + public partial class InMageRcmApplianceDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new InMageRcmApplianceDetails(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal InMageRcmApplianceDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_rcmProxy = If( json?.PropertyT("rcmProxy"), out var __jsonRcmProxy) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RcmProxyDetails.FromJson(__jsonRcmProxy) : RcmProxy;} + {_pushInstaller = If( json?.PropertyT("pushInstaller"), out var __jsonPushInstaller) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PushInstallerDetails.FromJson(__jsonPushInstaller) : PushInstaller;} + {_replicationAgent = If( json?.PropertyT("replicationAgent"), out var __jsonReplicationAgent) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationAgentDetails.FromJson(__jsonReplicationAgent) : ReplicationAgent;} + {_reprotectAgent = If( json?.PropertyT("reprotectAgent"), out var __jsonReprotectAgent) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReprotectAgentDetails.FromJson(__jsonReprotectAgent) : ReprotectAgent;} + {_marsAgent = If( json?.PropertyT("marsAgent"), out var __jsonMarsAgent) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.MarsAgentDetails.FromJson(__jsonMarsAgent) : MarsAgent;} + {_dra = If( json?.PropertyT("dra"), out var __jsonDra) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DraDetails.FromJson(__jsonDra) : Dra;} + {_id = If( json?.PropertyT("id"), out var __jsonId) ? (string)__jsonId : (string)Id;} + {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)Name;} + {_fabricArmId = If( json?.PropertyT("fabricArmId"), out var __jsonFabricArmId) ? (string)__jsonFabricArmId : (string)FabricArmId;} + {_switchProviderBlockingErrorDetail = If( json?.PropertyT("switchProviderBlockingErrorDetails"), out var __jsonSwitchProviderBlockingErrorDetails) ? If( __jsonSwitchProviderBlockingErrorDetails as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSwitchProviderBlockingErrorDetails) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmFabricSwitchProviderBlockingErrorDetails.FromJson(__u) )) ))() : null : SwitchProviderBlockingErrorDetail;} + {_processServer = If( json?.PropertyT("processServer"), out var __jsonProcessServer) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProcessServerDetails.FromJson(__jsonProcessServer) : ProcessServer;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._rcmProxy ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._rcmProxy.ToJson(null,serializationMode) : null, "rcmProxy" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._pushInstaller ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._pushInstaller.ToJson(null,serializationMode) : null, "pushInstaller" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._replicationAgent ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._replicationAgent.ToJson(null,serializationMode) : null, "replicationAgent" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._reprotectAgent ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._reprotectAgent.ToJson(null,serializationMode) : null, "reprotectAgent" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._marsAgent ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._marsAgent.ToJson(null,serializationMode) : null, "marsAgent" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._dra ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._dra.ToJson(null,serializationMode) : null, "dra" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._id)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._id.ToString()) : null, "id" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._fabricArmId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._fabricArmId.ToString()) : null, "fabricArmId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + if (null != this._switchProviderBlockingErrorDetail) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._switchProviderBlockingErrorDetail ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("switchProviderBlockingErrorDetails",__w); + } + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._processServer ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._processServer.ToJson(null,serializationMode) : null, "processServer" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmApplianceSpecificDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmApplianceSpecificDetails.PowerShell.cs new file mode 100644 index 000000000000..0cf051973272 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmApplianceSpecificDetails.PowerShell.cs @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// InMageRcm appliance specific details. + [System.ComponentModel.TypeConverter(typeof(InMageRcmApplianceSpecificDetailsTypeConverter))] + public partial class InMageRcmApplianceSpecificDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceSpecificDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InMageRcmApplianceSpecificDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceSpecificDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InMageRcmApplianceSpecificDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceSpecificDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InMageRcmApplianceSpecificDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Appliance")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceSpecificDetailsInternal)this).Appliance = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetails[]) content.GetValueForProperty("Appliance",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceSpecificDetailsInternal)this).Appliance, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmApplianceDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplianceSpecificDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplianceSpecificDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InMageRcmApplianceSpecificDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Appliance")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceSpecificDetailsInternal)this).Appliance = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetails[]) content.GetValueForProperty("Appliance",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceSpecificDetailsInternal)this).Appliance, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmApplianceDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplianceSpecificDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplianceSpecificDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// InMageRcm appliance specific details. + [System.ComponentModel.TypeConverter(typeof(InMageRcmApplianceSpecificDetailsTypeConverter))] + public partial interface IInMageRcmApplianceSpecificDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmApplianceSpecificDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmApplianceSpecificDetails.TypeConverter.cs new file mode 100644 index 000000000000..d34d6f7e4a76 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmApplianceSpecificDetails.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InMageRcmApplianceSpecificDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceSpecificDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceSpecificDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InMageRcmApplianceSpecificDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InMageRcmApplianceSpecificDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InMageRcmApplianceSpecificDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmApplianceSpecificDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmApplianceSpecificDetails.cs new file mode 100644 index 000000000000..b20e598e6ace --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmApplianceSpecificDetails.cs @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMageRcm appliance specific details. + public partial class InMageRcmApplianceSpecificDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceSpecificDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceSpecificDetailsInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplianceSpecificDetails __applianceSpecificDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ApplianceSpecificDetails(); + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetails[] _appliance; + + /// The list of appliances. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetails[] Appliance { get => this._appliance; } + + /// Gets the class type. Overridden in derived classes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplianceSpecificDetailsInternal)__applianceSpecificDetails).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplianceSpecificDetailsInternal)__applianceSpecificDetails).InstanceType = value ; } + + /// Internal Acessors for Appliance + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetails[] Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceSpecificDetailsInternal.Appliance { get => this._appliance; set { {_appliance = value;} } } + + /// Creates an new instance. + public InMageRcmApplianceSpecificDetails() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__applianceSpecificDetails), __applianceSpecificDetails); + await eventListener.AssertObjectIsValid(nameof(__applianceSpecificDetails), __applianceSpecificDetails); + } + } + /// InMageRcm appliance specific details. + public partial interface IInMageRcmApplianceSpecificDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplianceSpecificDetails + { + /// The list of appliances. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The list of appliances.", + SerializedName = @"appliances", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetails) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetails[] Appliance { get; } + + } + /// InMageRcm appliance specific details. + internal partial interface IInMageRcmApplianceSpecificDetailsInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplianceSpecificDetailsInternal + { + /// The list of appliances. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetails[] Appliance { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmApplianceSpecificDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmApplianceSpecificDetails.json.cs new file mode 100644 index 000000000000..8ffa08933ce0 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmApplianceSpecificDetails.json.cs @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMageRcm appliance specific details. + public partial class InMageRcmApplianceSpecificDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceSpecificDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceSpecificDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceSpecificDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new InMageRcmApplianceSpecificDetails(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal InMageRcmApplianceSpecificDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __applianceSpecificDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ApplianceSpecificDetails(json); + {_appliance = If( json?.PropertyT("appliances"), out var __jsonAppliances) ? If( __jsonAppliances as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplianceDetails) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmApplianceDetails.FromJson(__u) )) ))() : null : Appliance;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __applianceSpecificDetails?.ToJson(container, serializationMode); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + if (null != this._appliance) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._appliance ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("appliances",__w); + } + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmApplyRecoveryPointInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmApplyRecoveryPointInput.PowerShell.cs new file mode 100644 index 000000000000..823e612da11a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmApplyRecoveryPointInput.PowerShell.cs @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// ApplyRecoveryPoint input specific to InMageRcm provider. + [System.ComponentModel.TypeConverter(typeof(InMageRcmApplyRecoveryPointInputTypeConverter))] + public partial class InMageRcmApplyRecoveryPointInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplyRecoveryPointInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InMageRcmApplyRecoveryPointInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplyRecoveryPointInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InMageRcmApplyRecoveryPointInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplyRecoveryPointInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InMageRcmApplyRecoveryPointInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("RecoveryPointId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplyRecoveryPointInputInternal)this).RecoveryPointId = (string) content.GetValueForProperty("RecoveryPointId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplyRecoveryPointInputInternal)this).RecoveryPointId, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InMageRcmApplyRecoveryPointInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("RecoveryPointId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplyRecoveryPointInputInternal)this).RecoveryPointId = (string) content.GetValueForProperty("RecoveryPointId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplyRecoveryPointInputInternal)this).RecoveryPointId, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// ApplyRecoveryPoint input specific to InMageRcm provider. + [System.ComponentModel.TypeConverter(typeof(InMageRcmApplyRecoveryPointInputTypeConverter))] + public partial interface IInMageRcmApplyRecoveryPointInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmApplyRecoveryPointInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmApplyRecoveryPointInput.TypeConverter.cs new file mode 100644 index 000000000000..6ada21d0a5c6 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmApplyRecoveryPointInput.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InMageRcmApplyRecoveryPointInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplyRecoveryPointInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplyRecoveryPointInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InMageRcmApplyRecoveryPointInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InMageRcmApplyRecoveryPointInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InMageRcmApplyRecoveryPointInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmApplyRecoveryPointInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmApplyRecoveryPointInput.cs new file mode 100644 index 000000000000..2d920efd7dd5 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmApplyRecoveryPointInput.cs @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// ApplyRecoveryPoint input specific to InMageRcm provider. + public partial class InMageRcmApplyRecoveryPointInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplyRecoveryPointInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplyRecoveryPointInputInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointProviderSpecificInput __applyRecoveryPointProviderSpecificInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ApplyRecoveryPointProviderSpecificInput(); + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointProviderSpecificInputInternal)__applyRecoveryPointProviderSpecificInput).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointProviderSpecificInputInternal)__applyRecoveryPointProviderSpecificInput).InstanceType = value ; } + + /// Backing field for property. + private string _recoveryPointId; + + /// The recovery point Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryPointId { get => this._recoveryPointId; set => this._recoveryPointId = value; } + + /// Creates an new instance. + public InMageRcmApplyRecoveryPointInput() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__applyRecoveryPointProviderSpecificInput), __applyRecoveryPointProviderSpecificInput); + await eventListener.AssertObjectIsValid(nameof(__applyRecoveryPointProviderSpecificInput), __applyRecoveryPointProviderSpecificInput); + } + } + /// ApplyRecoveryPoint input specific to InMageRcm provider. + public partial interface IInMageRcmApplyRecoveryPointInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointProviderSpecificInput + { + /// The recovery point Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The recovery point Id.", + SerializedName = @"recoveryPointId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryPointId { get; set; } + + } + /// ApplyRecoveryPoint input specific to InMageRcm provider. + internal partial interface IInMageRcmApplyRecoveryPointInputInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointProviderSpecificInputInternal + { + /// The recovery point Id. + string RecoveryPointId { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmApplyRecoveryPointInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmApplyRecoveryPointInput.json.cs new file mode 100644 index 000000000000..361413930823 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmApplyRecoveryPointInput.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// ApplyRecoveryPoint input specific to InMageRcm provider. + public partial class InMageRcmApplyRecoveryPointInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplyRecoveryPointInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplyRecoveryPointInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmApplyRecoveryPointInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new InMageRcmApplyRecoveryPointInput(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal InMageRcmApplyRecoveryPointInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __applyRecoveryPointProviderSpecificInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ApplyRecoveryPointProviderSpecificInput(json); + {_recoveryPointId = If( json?.PropertyT("recoveryPointId"), out var __jsonRecoveryPointId) ? (string)__jsonRecoveryPointId : (string)RecoveryPointId;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __applyRecoveryPointProviderSpecificInput?.ToJson(container, serializationMode); + AddIf( null != (((object)this._recoveryPointId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryPointId.ToString()) : null, "recoveryPointId" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmDiscoveredProtectedVMDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmDiscoveredProtectedVMDetails.PowerShell.cs new file mode 100644 index 000000000000..552966b9f40a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmDiscoveredProtectedVMDetails.PowerShell.cs @@ -0,0 +1,237 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// InMageRcm discovered protected VM details. + [System.ComponentModel.TypeConverter(typeof(InMageRcmDiscoveredProtectedVMDetailsTypeConverter))] + public partial class InMageRcmDiscoveredProtectedVMDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InMageRcmDiscoveredProtectedVMDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InMageRcmDiscoveredProtectedVMDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json + /// string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InMageRcmDiscoveredProtectedVMDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("VCenterId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetailsInternal)this).VCenterId = (string) content.GetValueForProperty("VCenterId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetailsInternal)this).VCenterId, global::System.Convert.ToString); + } + if (content.Contains("VCenterFqdn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetailsInternal)this).VCenterFqdn = (string) content.GetValueForProperty("VCenterFqdn",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetailsInternal)this).VCenterFqdn, global::System.Convert.ToString); + } + if (content.Contains("Datastore")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetailsInternal)this).Datastore = (string[]) content.GetValueForProperty("Datastore",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetailsInternal)this).Datastore, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("IPAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetailsInternal)this).IPAddress = (string[]) content.GetValueForProperty("IPAddress",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetailsInternal)this).IPAddress, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("VmwareToolsStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetailsInternal)this).VmwareToolsStatus = (string) content.GetValueForProperty("VmwareToolsStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetailsInternal)this).VmwareToolsStatus, global::System.Convert.ToString); + } + if (content.Contains("PowerStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetailsInternal)this).PowerStatus = (string) content.GetValueForProperty("PowerStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetailsInternal)this).PowerStatus, global::System.Convert.ToString); + } + if (content.Contains("VMFqdn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetailsInternal)this).VMFqdn = (string) content.GetValueForProperty("VMFqdn",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetailsInternal)this).VMFqdn, global::System.Convert.ToString); + } + if (content.Contains("OSName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetailsInternal)this).OSName = (string) content.GetValueForProperty("OSName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetailsInternal)this).OSName, global::System.Convert.ToString); + } + if (content.Contains("CreatedTimestamp")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetailsInternal)this).CreatedTimestamp = (global::System.DateTime?) content.GetValueForProperty("CreatedTimestamp",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetailsInternal)this).CreatedTimestamp, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("UpdatedTimestamp")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetailsInternal)this).UpdatedTimestamp = (global::System.DateTime?) content.GetValueForProperty("UpdatedTimestamp",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetailsInternal)this).UpdatedTimestamp, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("IsDeleted")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetailsInternal)this).IsDeleted = (bool?) content.GetValueForProperty("IsDeleted",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetailsInternal)this).IsDeleted, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("LastDiscoveryTimeInUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetailsInternal)this).LastDiscoveryTimeInUtc = (global::System.DateTime?) content.GetValueForProperty("LastDiscoveryTimeInUtc",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetailsInternal)this).LastDiscoveryTimeInUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InMageRcmDiscoveredProtectedVMDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("VCenterId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetailsInternal)this).VCenterId = (string) content.GetValueForProperty("VCenterId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetailsInternal)this).VCenterId, global::System.Convert.ToString); + } + if (content.Contains("VCenterFqdn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetailsInternal)this).VCenterFqdn = (string) content.GetValueForProperty("VCenterFqdn",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetailsInternal)this).VCenterFqdn, global::System.Convert.ToString); + } + if (content.Contains("Datastore")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetailsInternal)this).Datastore = (string[]) content.GetValueForProperty("Datastore",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetailsInternal)this).Datastore, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("IPAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetailsInternal)this).IPAddress = (string[]) content.GetValueForProperty("IPAddress",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetailsInternal)this).IPAddress, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("VmwareToolsStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetailsInternal)this).VmwareToolsStatus = (string) content.GetValueForProperty("VmwareToolsStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetailsInternal)this).VmwareToolsStatus, global::System.Convert.ToString); + } + if (content.Contains("PowerStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetailsInternal)this).PowerStatus = (string) content.GetValueForProperty("PowerStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetailsInternal)this).PowerStatus, global::System.Convert.ToString); + } + if (content.Contains("VMFqdn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetailsInternal)this).VMFqdn = (string) content.GetValueForProperty("VMFqdn",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetailsInternal)this).VMFqdn, global::System.Convert.ToString); + } + if (content.Contains("OSName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetailsInternal)this).OSName = (string) content.GetValueForProperty("OSName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetailsInternal)this).OSName, global::System.Convert.ToString); + } + if (content.Contains("CreatedTimestamp")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetailsInternal)this).CreatedTimestamp = (global::System.DateTime?) content.GetValueForProperty("CreatedTimestamp",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetailsInternal)this).CreatedTimestamp, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("UpdatedTimestamp")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetailsInternal)this).UpdatedTimestamp = (global::System.DateTime?) content.GetValueForProperty("UpdatedTimestamp",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetailsInternal)this).UpdatedTimestamp, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("IsDeleted")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetailsInternal)this).IsDeleted = (bool?) content.GetValueForProperty("IsDeleted",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetailsInternal)this).IsDeleted, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("LastDiscoveryTimeInUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetailsInternal)this).LastDiscoveryTimeInUtc = (global::System.DateTime?) content.GetValueForProperty("LastDiscoveryTimeInUtc",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetailsInternal)this).LastDiscoveryTimeInUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// InMageRcm discovered protected VM details. + [System.ComponentModel.TypeConverter(typeof(InMageRcmDiscoveredProtectedVMDetailsTypeConverter))] + public partial interface IInMageRcmDiscoveredProtectedVMDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmDiscoveredProtectedVMDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmDiscoveredProtectedVMDetails.TypeConverter.cs new file mode 100644 index 000000000000..55263dc2f31b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmDiscoveredProtectedVMDetails.TypeConverter.cs @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InMageRcmDiscoveredProtectedVMDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InMageRcmDiscoveredProtectedVMDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InMageRcmDiscoveredProtectedVMDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InMageRcmDiscoveredProtectedVMDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmDiscoveredProtectedVMDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmDiscoveredProtectedVMDetails.cs new file mode 100644 index 000000000000..b1488cd53285 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmDiscoveredProtectedVMDetails.cs @@ -0,0 +1,274 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMageRcm discovered protected VM details. + public partial class InMageRcmDiscoveredProtectedVMDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetailsInternal + { + + /// Backing field for property. + private global::System.DateTime? _createdTimestamp; + + /// The SDS created timestamp. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public global::System.DateTime? CreatedTimestamp { get => this._createdTimestamp; } + + /// Backing field for property. + private string[] _datastore; + + /// The list of datastores. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string[] Datastore { get => this._datastore; } + + /// Backing field for property. + private string[] _iPAddress; + + /// The list of IP addresses. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string[] IPAddress { get => this._iPAddress; } + + /// Backing field for property. + private bool? _isDeleted; + + /// A value indicating whether the VM is deleted. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public bool? IsDeleted { get => this._isDeleted; } + + /// Backing field for property. + private global::System.DateTime? _lastDiscoveryTimeInUtc; + + /// The last time when SDS information discovered in SRS. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public global::System.DateTime? LastDiscoveryTimeInUtc { get => this._lastDiscoveryTimeInUtc; } + + /// Internal Acessors for CreatedTimestamp + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetailsInternal.CreatedTimestamp { get => this._createdTimestamp; set { {_createdTimestamp = value;} } } + + /// Internal Acessors for Datastore + string[] Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetailsInternal.Datastore { get => this._datastore; set { {_datastore = value;} } } + + /// Internal Acessors for IPAddress + string[] Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetailsInternal.IPAddress { get => this._iPAddress; set { {_iPAddress = value;} } } + + /// Internal Acessors for IsDeleted + bool? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetailsInternal.IsDeleted { get => this._isDeleted; set { {_isDeleted = value;} } } + + /// Internal Acessors for LastDiscoveryTimeInUtc + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetailsInternal.LastDiscoveryTimeInUtc { get => this._lastDiscoveryTimeInUtc; set { {_lastDiscoveryTimeInUtc = value;} } } + + /// Internal Acessors for OSName + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetailsInternal.OSName { get => this._oSName; set { {_oSName = value;} } } + + /// Internal Acessors for PowerStatus + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetailsInternal.PowerStatus { get => this._powerStatus; set { {_powerStatus = value;} } } + + /// Internal Acessors for UpdatedTimestamp + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetailsInternal.UpdatedTimestamp { get => this._updatedTimestamp; set { {_updatedTimestamp = value;} } } + + /// Internal Acessors for VCenterFqdn + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetailsInternal.VCenterFqdn { get => this._vCenterFqdn; set { {_vCenterFqdn = value;} } } + + /// Internal Acessors for VCenterId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetailsInternal.VCenterId { get => this._vCenterId; set { {_vCenterId = value;} } } + + /// Internal Acessors for VMFqdn + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetailsInternal.VMFqdn { get => this._vMFqdn; set { {_vMFqdn = value;} } } + + /// Internal Acessors for VmwareToolsStatus + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetailsInternal.VmwareToolsStatus { get => this._vmwareToolsStatus; set { {_vmwareToolsStatus = value;} } } + + /// Backing field for property. + private string _oSName; + + /// The VM's OS name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string OSName { get => this._oSName; } + + /// Backing field for property. + private string _powerStatus; + + /// The VM power status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string PowerStatus { get => this._powerStatus; } + + /// Backing field for property. + private global::System.DateTime? _updatedTimestamp; + + /// The SDS updated timestamp. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public global::System.DateTime? UpdatedTimestamp { get => this._updatedTimestamp; } + + /// Backing field for property. + private string _vCenterFqdn; + + /// The VCenter fqdn. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string VCenterFqdn { get => this._vCenterFqdn; } + + /// Backing field for property. + private string _vCenterId; + + /// The VCenter Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string VCenterId { get => this._vCenterId; } + + /// Backing field for property. + private string _vMFqdn; + + /// The VM fqdn. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string VMFqdn { get => this._vMFqdn; } + + /// Backing field for property. + private string _vmwareToolsStatus; + + /// The VMware tools status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string VmwareToolsStatus { get => this._vmwareToolsStatus; } + + /// Creates an new instance. + public InMageRcmDiscoveredProtectedVMDetails() + { + + } + } + /// InMageRcm discovered protected VM details. + public partial interface IInMageRcmDiscoveredProtectedVMDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The SDS created timestamp. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The SDS created timestamp.", + SerializedName = @"createdTimestamp", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? CreatedTimestamp { get; } + /// The list of datastores. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The list of datastores.", + SerializedName = @"datastores", + PossibleTypes = new [] { typeof(string) })] + string[] Datastore { get; } + /// The list of IP addresses. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The list of IP addresses.", + SerializedName = @"ipAddresses", + PossibleTypes = new [] { typeof(string) })] + string[] IPAddress { get; } + /// A value indicating whether the VM is deleted. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"A value indicating whether the VM is deleted.", + SerializedName = @"isDeleted", + PossibleTypes = new [] { typeof(bool) })] + bool? IsDeleted { get; } + /// The last time when SDS information discovered in SRS. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The last time when SDS information discovered in SRS.", + SerializedName = @"lastDiscoveryTimeInUtc", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? LastDiscoveryTimeInUtc { get; } + /// The VM's OS name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The VM's OS name.", + SerializedName = @"osName", + PossibleTypes = new [] { typeof(string) })] + string OSName { get; } + /// The VM power status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The VM power status.", + SerializedName = @"powerStatus", + PossibleTypes = new [] { typeof(string) })] + string PowerStatus { get; } + /// The SDS updated timestamp. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The SDS updated timestamp.", + SerializedName = @"updatedTimestamp", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? UpdatedTimestamp { get; } + /// The VCenter fqdn. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The VCenter fqdn.", + SerializedName = @"vCenterFqdn", + PossibleTypes = new [] { typeof(string) })] + string VCenterFqdn { get; } + /// The VCenter Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The VCenter Id.", + SerializedName = @"vCenterId", + PossibleTypes = new [] { typeof(string) })] + string VCenterId { get; } + /// The VM fqdn. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The VM fqdn.", + SerializedName = @"vmFqdn", + PossibleTypes = new [] { typeof(string) })] + string VMFqdn { get; } + /// The VMware tools status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The VMware tools status.", + SerializedName = @"vmwareToolsStatus", + PossibleTypes = new [] { typeof(string) })] + string VmwareToolsStatus { get; } + + } + /// InMageRcm discovered protected VM details. + internal partial interface IInMageRcmDiscoveredProtectedVMDetailsInternal + + { + /// The SDS created timestamp. + global::System.DateTime? CreatedTimestamp { get; set; } + /// The list of datastores. + string[] Datastore { get; set; } + /// The list of IP addresses. + string[] IPAddress { get; set; } + /// A value indicating whether the VM is deleted. + bool? IsDeleted { get; set; } + /// The last time when SDS information discovered in SRS. + global::System.DateTime? LastDiscoveryTimeInUtc { get; set; } + /// The VM's OS name. + string OSName { get; set; } + /// The VM power status. + string PowerStatus { get; set; } + /// The SDS updated timestamp. + global::System.DateTime? UpdatedTimestamp { get; set; } + /// The VCenter fqdn. + string VCenterFqdn { get; set; } + /// The VCenter Id. + string VCenterId { get; set; } + /// The VM fqdn. + string VMFqdn { get; set; } + /// The VMware tools status. + string VmwareToolsStatus { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmDiscoveredProtectedVMDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmDiscoveredProtectedVMDetails.json.cs new file mode 100644 index 000000000000..15acacfd5de2 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmDiscoveredProtectedVMDetails.json.cs @@ -0,0 +1,183 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMageRcm discovered protected VM details. + public partial class InMageRcmDiscoveredProtectedVMDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new InMageRcmDiscoveredProtectedVMDetails(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal InMageRcmDiscoveredProtectedVMDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_vCenterId = If( json?.PropertyT("vCenterId"), out var __jsonVCenterId) ? (string)__jsonVCenterId : (string)VCenterId;} + {_vCenterFqdn = If( json?.PropertyT("vCenterFqdn"), out var __jsonVCenterFqdn) ? (string)__jsonVCenterFqdn : (string)VCenterFqdn;} + {_datastore = If( json?.PropertyT("datastores"), out var __jsonDatastores) ? If( __jsonDatastores as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(string) (__u is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : Datastore;} + {_iPAddress = If( json?.PropertyT("ipAddresses"), out var __jsonIPAddresses) ? If( __jsonIPAddresses as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __q) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__q, (__p)=>(string) (__p is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString __o ? (string)(__o.ToString()) : null)) ))() : null : IPAddress;} + {_vmwareToolsStatus = If( json?.PropertyT("vmwareToolsStatus"), out var __jsonVmwareToolsStatus) ? (string)__jsonVmwareToolsStatus : (string)VmwareToolsStatus;} + {_powerStatus = If( json?.PropertyT("powerStatus"), out var __jsonPowerStatus) ? (string)__jsonPowerStatus : (string)PowerStatus;} + {_vMFqdn = If( json?.PropertyT("vmFqdn"), out var __jsonVMFqdn) ? (string)__jsonVMFqdn : (string)VMFqdn;} + {_oSName = If( json?.PropertyT("osName"), out var __jsonOSName) ? (string)__jsonOSName : (string)OSName;} + {_createdTimestamp = If( json?.PropertyT("createdTimestamp"), out var __jsonCreatedTimestamp) ? global::System.DateTime.TryParse((string)__jsonCreatedTimestamp, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonCreatedTimestampValue) ? __jsonCreatedTimestampValue : CreatedTimestamp : CreatedTimestamp;} + {_updatedTimestamp = If( json?.PropertyT("updatedTimestamp"), out var __jsonUpdatedTimestamp) ? global::System.DateTime.TryParse((string)__jsonUpdatedTimestamp, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonUpdatedTimestampValue) ? __jsonUpdatedTimestampValue : UpdatedTimestamp : UpdatedTimestamp;} + {_isDeleted = If( json?.PropertyT("isDeleted"), out var __jsonIsDeleted) ? (bool?)__jsonIsDeleted : IsDeleted;} + {_lastDiscoveryTimeInUtc = If( json?.PropertyT("lastDiscoveryTimeInUtc"), out var __jsonLastDiscoveryTimeInUtc) ? global::System.DateTime.TryParse((string)__jsonLastDiscoveryTimeInUtc, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonLastDiscoveryTimeInUtcValue) ? __jsonLastDiscoveryTimeInUtcValue : LastDiscoveryTimeInUtc : LastDiscoveryTimeInUtc;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._vCenterId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._vCenterId.ToString()) : null, "vCenterId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._vCenterFqdn)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._vCenterFqdn.ToString()) : null, "vCenterFqdn" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + if (null != this._datastore) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._datastore ) + { + AddIf(null != (((object)__x)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(__x.ToString()) : null ,__w.Add); + } + container.Add("datastores",__w); + } + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + if (null != this._iPAddress) + { + var __r = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __s in this._iPAddress ) + { + AddIf(null != (((object)__s)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(__s.ToString()) : null ,__r.Add); + } + container.Add("ipAddresses",__r); + } + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._vmwareToolsStatus)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._vmwareToolsStatus.ToString()) : null, "vmwareToolsStatus" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._powerStatus)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._powerStatus.ToString()) : null, "powerStatus" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._vMFqdn)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._vMFqdn.ToString()) : null, "vmFqdn" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._oSName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._oSName.ToString()) : null, "osName" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._createdTimestamp ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._createdTimestamp?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "createdTimestamp" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._updatedTimestamp ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._updatedTimestamp?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "updatedTimestamp" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._isDeleted ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonBoolean((bool)this._isDeleted) : null, "isDeleted" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._lastDiscoveryTimeInUtc ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._lastDiscoveryTimeInUtc?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "lastDiscoveryTimeInUtc" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmDiskInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmDiskInput.PowerShell.cs new file mode 100644 index 000000000000..99e05249a2c0 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmDiskInput.PowerShell.cs @@ -0,0 +1,168 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// InMageRcm disk input. + [System.ComponentModel.TypeConverter(typeof(InMageRcmDiskInputTypeConverter))] + public partial class InMageRcmDiskInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiskInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InMageRcmDiskInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiskInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InMageRcmDiskInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiskInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InMageRcmDiskInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DiskId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiskInputInternal)this).DiskId = (string) content.GetValueForProperty("DiskId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiskInputInternal)this).DiskId, global::System.Convert.ToString); + } + if (content.Contains("LogStorageAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiskInputInternal)this).LogStorageAccountId = (string) content.GetValueForProperty("LogStorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiskInputInternal)this).LogStorageAccountId, global::System.Convert.ToString); + } + if (content.Contains("DiskType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiskInputInternal)this).DiskType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskAccountType) content.GetValueForProperty("DiskType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiskInputInternal)this).DiskType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskAccountType.CreateFrom); + } + if (content.Contains("DiskEncryptionSetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiskInputInternal)this).DiskEncryptionSetId = (string) content.GetValueForProperty("DiskEncryptionSetId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiskInputInternal)this).DiskEncryptionSetId, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InMageRcmDiskInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DiskId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiskInputInternal)this).DiskId = (string) content.GetValueForProperty("DiskId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiskInputInternal)this).DiskId, global::System.Convert.ToString); + } + if (content.Contains("LogStorageAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiskInputInternal)this).LogStorageAccountId = (string) content.GetValueForProperty("LogStorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiskInputInternal)this).LogStorageAccountId, global::System.Convert.ToString); + } + if (content.Contains("DiskType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiskInputInternal)this).DiskType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskAccountType) content.GetValueForProperty("DiskType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiskInputInternal)this).DiskType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskAccountType.CreateFrom); + } + if (content.Contains("DiskEncryptionSetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiskInputInternal)this).DiskEncryptionSetId = (string) content.GetValueForProperty("DiskEncryptionSetId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiskInputInternal)this).DiskEncryptionSetId, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// InMageRcm disk input. + [System.ComponentModel.TypeConverter(typeof(InMageRcmDiskInputTypeConverter))] + public partial interface IInMageRcmDiskInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmDiskInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmDiskInput.TypeConverter.cs new file mode 100644 index 000000000000..d98cb4a556ba --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmDiskInput.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InMageRcmDiskInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiskInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiskInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InMageRcmDiskInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InMageRcmDiskInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InMageRcmDiskInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmDiskInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmDiskInput.cs new file mode 100644 index 000000000000..f89d8c2f298a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmDiskInput.cs @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMageRcm disk input. + public partial class InMageRcmDiskInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiskInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiskInputInternal + { + + /// Backing field for property. + private string _diskEncryptionSetId; + + /// The DiskEncryptionSet ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string DiskEncryptionSetId { get => this._diskEncryptionSetId; set => this._diskEncryptionSetId = value; } + + /// Backing field for property. + private string _diskId; + + /// The disk Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string DiskId { get => this._diskId; set => this._diskId = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskAccountType _diskType; + + /// The disk type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskAccountType DiskType { get => this._diskType; set => this._diskType = value; } + + /// Backing field for property. + private string _logStorageAccountId; + + /// The log storage account ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string LogStorageAccountId { get => this._logStorageAccountId; set => this._logStorageAccountId = value; } + + /// Creates an new instance. + public InMageRcmDiskInput() + { + + } + } + /// InMageRcm disk input. + public partial interface IInMageRcmDiskInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The DiskEncryptionSet ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The DiskEncryptionSet ARM Id.", + SerializedName = @"diskEncryptionSetId", + PossibleTypes = new [] { typeof(string) })] + string DiskEncryptionSetId { get; set; } + /// The disk Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The disk Id.", + SerializedName = @"diskId", + PossibleTypes = new [] { typeof(string) })] + string DiskId { get; set; } + /// The disk type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The disk type.", + SerializedName = @"diskType", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskAccountType) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskAccountType DiskType { get; set; } + /// The log storage account ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The log storage account ARM Id.", + SerializedName = @"logStorageAccountId", + PossibleTypes = new [] { typeof(string) })] + string LogStorageAccountId { get; set; } + + } + /// InMageRcm disk input. + internal partial interface IInMageRcmDiskInputInternal + + { + /// The DiskEncryptionSet ARM Id. + string DiskEncryptionSetId { get; set; } + /// The disk Id. + string DiskId { get; set; } + /// The disk type. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskAccountType DiskType { get; set; } + /// The log storage account ARM Id. + string LogStorageAccountId { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmDiskInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmDiskInput.json.cs new file mode 100644 index 000000000000..a167b631eae8 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmDiskInput.json.cs @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMageRcm disk input. + public partial class InMageRcmDiskInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiskInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiskInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiskInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new InMageRcmDiskInput(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal InMageRcmDiskInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_diskId = If( json?.PropertyT("diskId"), out var __jsonDiskId) ? (string)__jsonDiskId : (string)DiskId;} + {_logStorageAccountId = If( json?.PropertyT("logStorageAccountId"), out var __jsonLogStorageAccountId) ? (string)__jsonLogStorageAccountId : (string)LogStorageAccountId;} + {_diskType = If( json?.PropertyT("diskType"), out var __jsonDiskType) ? (string)__jsonDiskType : (string)DiskType;} + {_diskEncryptionSetId = If( json?.PropertyT("diskEncryptionSetId"), out var __jsonDiskEncryptionSetId) ? (string)__jsonDiskEncryptionSetId : (string)DiskEncryptionSetId;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._diskId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._diskId.ToString()) : null, "diskId" ,container.Add ); + AddIf( null != (((object)this._logStorageAccountId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._logStorageAccountId.ToString()) : null, "logStorageAccountId" ,container.Add ); + AddIf( null != (((object)this._diskType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._diskType.ToString()) : null, "diskType" ,container.Add ); + AddIf( null != (((object)this._diskEncryptionSetId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._diskEncryptionSetId.ToString()) : null, "diskEncryptionSetId" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmDisksDefaultInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmDisksDefaultInput.PowerShell.cs new file mode 100644 index 000000000000..0ec99fcca170 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmDisksDefaultInput.PowerShell.cs @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// InMageRcm disk input. + [System.ComponentModel.TypeConverter(typeof(InMageRcmDisksDefaultInputTypeConverter))] + public partial class InMageRcmDisksDefaultInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDisksDefaultInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InMageRcmDisksDefaultInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDisksDefaultInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InMageRcmDisksDefaultInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDisksDefaultInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InMageRcmDisksDefaultInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("LogStorageAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDisksDefaultInputInternal)this).LogStorageAccountId = (string) content.GetValueForProperty("LogStorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDisksDefaultInputInternal)this).LogStorageAccountId, global::System.Convert.ToString); + } + if (content.Contains("DiskType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDisksDefaultInputInternal)this).DiskType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskAccountType) content.GetValueForProperty("DiskType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDisksDefaultInputInternal)this).DiskType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskAccountType.CreateFrom); + } + if (content.Contains("DiskEncryptionSetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDisksDefaultInputInternal)this).DiskEncryptionSetId = (string) content.GetValueForProperty("DiskEncryptionSetId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDisksDefaultInputInternal)this).DiskEncryptionSetId, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InMageRcmDisksDefaultInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("LogStorageAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDisksDefaultInputInternal)this).LogStorageAccountId = (string) content.GetValueForProperty("LogStorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDisksDefaultInputInternal)this).LogStorageAccountId, global::System.Convert.ToString); + } + if (content.Contains("DiskType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDisksDefaultInputInternal)this).DiskType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskAccountType) content.GetValueForProperty("DiskType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDisksDefaultInputInternal)this).DiskType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskAccountType.CreateFrom); + } + if (content.Contains("DiskEncryptionSetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDisksDefaultInputInternal)this).DiskEncryptionSetId = (string) content.GetValueForProperty("DiskEncryptionSetId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDisksDefaultInputInternal)this).DiskEncryptionSetId, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// InMageRcm disk input. + [System.ComponentModel.TypeConverter(typeof(InMageRcmDisksDefaultInputTypeConverter))] + public partial interface IInMageRcmDisksDefaultInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmDisksDefaultInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmDisksDefaultInput.TypeConverter.cs new file mode 100644 index 000000000000..7f203205515a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmDisksDefaultInput.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InMageRcmDisksDefaultInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDisksDefaultInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDisksDefaultInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InMageRcmDisksDefaultInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InMageRcmDisksDefaultInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InMageRcmDisksDefaultInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmDisksDefaultInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmDisksDefaultInput.cs new file mode 100644 index 000000000000..f8f83cf17510 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmDisksDefaultInput.cs @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMageRcm disk input. + public partial class InMageRcmDisksDefaultInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDisksDefaultInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDisksDefaultInputInternal + { + + /// Backing field for property. + private string _diskEncryptionSetId; + + /// The DiskEncryptionSet ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string DiskEncryptionSetId { get => this._diskEncryptionSetId; set => this._diskEncryptionSetId = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskAccountType _diskType; + + /// The disk type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskAccountType DiskType { get => this._diskType; set => this._diskType = value; } + + /// Backing field for property. + private string _logStorageAccountId; + + /// The log storage account ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string LogStorageAccountId { get => this._logStorageAccountId; set => this._logStorageAccountId = value; } + + /// Creates an new instance. + public InMageRcmDisksDefaultInput() + { + + } + } + /// InMageRcm disk input. + public partial interface IInMageRcmDisksDefaultInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The DiskEncryptionSet ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The DiskEncryptionSet ARM Id.", + SerializedName = @"diskEncryptionSetId", + PossibleTypes = new [] { typeof(string) })] + string DiskEncryptionSetId { get; set; } + /// The disk type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The disk type.", + SerializedName = @"diskType", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskAccountType) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskAccountType DiskType { get; set; } + /// The log storage account ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The log storage account ARM Id.", + SerializedName = @"logStorageAccountId", + PossibleTypes = new [] { typeof(string) })] + string LogStorageAccountId { get; set; } + + } + /// InMageRcm disk input. + internal partial interface IInMageRcmDisksDefaultInputInternal + + { + /// The DiskEncryptionSet ARM Id. + string DiskEncryptionSetId { get; set; } + /// The disk type. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskAccountType DiskType { get; set; } + /// The log storage account ARM Id. + string LogStorageAccountId { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmDisksDefaultInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmDisksDefaultInput.json.cs new file mode 100644 index 000000000000..08e8b43fee81 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmDisksDefaultInput.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMageRcm disk input. + public partial class InMageRcmDisksDefaultInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDisksDefaultInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDisksDefaultInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDisksDefaultInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new InMageRcmDisksDefaultInput(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal InMageRcmDisksDefaultInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_logStorageAccountId = If( json?.PropertyT("logStorageAccountId"), out var __jsonLogStorageAccountId) ? (string)__jsonLogStorageAccountId : (string)LogStorageAccountId;} + {_diskType = If( json?.PropertyT("diskType"), out var __jsonDiskType) ? (string)__jsonDiskType : (string)DiskType;} + {_diskEncryptionSetId = If( json?.PropertyT("diskEncryptionSetId"), out var __jsonDiskEncryptionSetId) ? (string)__jsonDiskEncryptionSetId : (string)DiskEncryptionSetId;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._logStorageAccountId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._logStorageAccountId.ToString()) : null, "logStorageAccountId" ,container.Add ); + AddIf( null != (((object)this._diskType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._diskType.ToString()) : null, "diskType" ,container.Add ); + AddIf( null != (((object)this._diskEncryptionSetId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._diskEncryptionSetId.ToString()) : null, "diskEncryptionSetId" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmEnableProtectionInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmEnableProtectionInput.PowerShell.cs new file mode 100644 index 000000000000..45b51399a210 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmEnableProtectionInput.PowerShell.cs @@ -0,0 +1,314 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// InMageRcm specific enable protection input. + [System.ComponentModel.TypeConverter(typeof(InMageRcmEnableProtectionInputTypeConverter))] + public partial class InMageRcmEnableProtectionInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEnableProtectionInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InMageRcmEnableProtectionInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEnableProtectionInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InMageRcmEnableProtectionInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEnableProtectionInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InMageRcmEnableProtectionInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DisksDefault")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEnableProtectionInputInternal)this).DisksDefault = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDisksDefaultInput) content.GetValueForProperty("DisksDefault",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEnableProtectionInputInternal)this).DisksDefault, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmDisksDefaultInputTypeConverter.ConvertFrom); + } + if (content.Contains("FabricDiscoveryMachineId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEnableProtectionInputInternal)this).FabricDiscoveryMachineId = (string) content.GetValueForProperty("FabricDiscoveryMachineId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEnableProtectionInputInternal)this).FabricDiscoveryMachineId, global::System.Convert.ToString); + } + if (content.Contains("DisksToInclude")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEnableProtectionInputInternal)this).DisksToInclude = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiskInput[]) content.GetValueForProperty("DisksToInclude",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEnableProtectionInputInternal)this).DisksToInclude, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmDiskInputTypeConverter.ConvertFrom)); + } + if (content.Contains("TargetResourceGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEnableProtectionInputInternal)this).TargetResourceGroupId = (string) content.GetValueForProperty("TargetResourceGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEnableProtectionInputInternal)this).TargetResourceGroupId, global::System.Convert.ToString); + } + if (content.Contains("TargetNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEnableProtectionInputInternal)this).TargetNetworkId = (string) content.GetValueForProperty("TargetNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEnableProtectionInputInternal)this).TargetNetworkId, global::System.Convert.ToString); + } + if (content.Contains("TestNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEnableProtectionInputInternal)this).TestNetworkId = (string) content.GetValueForProperty("TestNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEnableProtectionInputInternal)this).TestNetworkId, global::System.Convert.ToString); + } + if (content.Contains("TargetSubnetName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEnableProtectionInputInternal)this).TargetSubnetName = (string) content.GetValueForProperty("TargetSubnetName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEnableProtectionInputInternal)this).TargetSubnetName, global::System.Convert.ToString); + } + if (content.Contains("TestSubnetName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEnableProtectionInputInternal)this).TestSubnetName = (string) content.GetValueForProperty("TestSubnetName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEnableProtectionInputInternal)this).TestSubnetName, global::System.Convert.ToString); + } + if (content.Contains("TargetVMName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEnableProtectionInputInternal)this).TargetVMName = (string) content.GetValueForProperty("TargetVMName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEnableProtectionInputInternal)this).TargetVMName, global::System.Convert.ToString); + } + if (content.Contains("TargetVMSize")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEnableProtectionInputInternal)this).TargetVMSize = (string) content.GetValueForProperty("TargetVMSize",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEnableProtectionInputInternal)this).TargetVMSize, global::System.Convert.ToString); + } + if (content.Contains("LicenseType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEnableProtectionInputInternal)this).LicenseType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.LicenseType?) content.GetValueForProperty("LicenseType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEnableProtectionInputInternal)this).LicenseType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.LicenseType.CreateFrom); + } + if (content.Contains("TargetAvailabilitySetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEnableProtectionInputInternal)this).TargetAvailabilitySetId = (string) content.GetValueForProperty("TargetAvailabilitySetId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEnableProtectionInputInternal)this).TargetAvailabilitySetId, global::System.Convert.ToString); + } + if (content.Contains("TargetAvailabilityZone")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEnableProtectionInputInternal)this).TargetAvailabilityZone = (string) content.GetValueForProperty("TargetAvailabilityZone",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEnableProtectionInputInternal)this).TargetAvailabilityZone, global::System.Convert.ToString); + } + if (content.Contains("TargetProximityPlacementGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEnableProtectionInputInternal)this).TargetProximityPlacementGroupId = (string) content.GetValueForProperty("TargetProximityPlacementGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEnableProtectionInputInternal)this).TargetProximityPlacementGroupId, global::System.Convert.ToString); + } + if (content.Contains("TargetBootDiagnosticsStorageAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEnableProtectionInputInternal)this).TargetBootDiagnosticsStorageAccountId = (string) content.GetValueForProperty("TargetBootDiagnosticsStorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEnableProtectionInputInternal)this).TargetBootDiagnosticsStorageAccountId, global::System.Convert.ToString); + } + if (content.Contains("RunAsAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEnableProtectionInputInternal)this).RunAsAccountId = (string) content.GetValueForProperty("RunAsAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEnableProtectionInputInternal)this).RunAsAccountId, global::System.Convert.ToString); + } + if (content.Contains("ProcessServerId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEnableProtectionInputInternal)this).ProcessServerId = (string) content.GetValueForProperty("ProcessServerId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEnableProtectionInputInternal)this).ProcessServerId, global::System.Convert.ToString); + } + if (content.Contains("MultiVMGroupName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEnableProtectionInputInternal)this).MultiVMGroupName = (string) content.GetValueForProperty("MultiVMGroupName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEnableProtectionInputInternal)this).MultiVMGroupName, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + if (content.Contains("DiskDefaultLogStorageAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEnableProtectionInputInternal)this).DiskDefaultLogStorageAccountId = (string) content.GetValueForProperty("DiskDefaultLogStorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEnableProtectionInputInternal)this).DiskDefaultLogStorageAccountId, global::System.Convert.ToString); + } + if (content.Contains("DiskDefaultDiskType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEnableProtectionInputInternal)this).DiskDefaultDiskType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskAccountType) content.GetValueForProperty("DiskDefaultDiskType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEnableProtectionInputInternal)this).DiskDefaultDiskType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskAccountType.CreateFrom); + } + if (content.Contains("DiskDefaultDiskEncryptionSetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEnableProtectionInputInternal)this).DiskDefaultDiskEncryptionSetId = (string) content.GetValueForProperty("DiskDefaultDiskEncryptionSetId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEnableProtectionInputInternal)this).DiskDefaultDiskEncryptionSetId, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InMageRcmEnableProtectionInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DisksDefault")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEnableProtectionInputInternal)this).DisksDefault = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDisksDefaultInput) content.GetValueForProperty("DisksDefault",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEnableProtectionInputInternal)this).DisksDefault, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmDisksDefaultInputTypeConverter.ConvertFrom); + } + if (content.Contains("FabricDiscoveryMachineId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEnableProtectionInputInternal)this).FabricDiscoveryMachineId = (string) content.GetValueForProperty("FabricDiscoveryMachineId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEnableProtectionInputInternal)this).FabricDiscoveryMachineId, global::System.Convert.ToString); + } + if (content.Contains("DisksToInclude")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEnableProtectionInputInternal)this).DisksToInclude = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiskInput[]) content.GetValueForProperty("DisksToInclude",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEnableProtectionInputInternal)this).DisksToInclude, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmDiskInputTypeConverter.ConvertFrom)); + } + if (content.Contains("TargetResourceGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEnableProtectionInputInternal)this).TargetResourceGroupId = (string) content.GetValueForProperty("TargetResourceGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEnableProtectionInputInternal)this).TargetResourceGroupId, global::System.Convert.ToString); + } + if (content.Contains("TargetNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEnableProtectionInputInternal)this).TargetNetworkId = (string) content.GetValueForProperty("TargetNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEnableProtectionInputInternal)this).TargetNetworkId, global::System.Convert.ToString); + } + if (content.Contains("TestNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEnableProtectionInputInternal)this).TestNetworkId = (string) content.GetValueForProperty("TestNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEnableProtectionInputInternal)this).TestNetworkId, global::System.Convert.ToString); + } + if (content.Contains("TargetSubnetName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEnableProtectionInputInternal)this).TargetSubnetName = (string) content.GetValueForProperty("TargetSubnetName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEnableProtectionInputInternal)this).TargetSubnetName, global::System.Convert.ToString); + } + if (content.Contains("TestSubnetName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEnableProtectionInputInternal)this).TestSubnetName = (string) content.GetValueForProperty("TestSubnetName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEnableProtectionInputInternal)this).TestSubnetName, global::System.Convert.ToString); + } + if (content.Contains("TargetVMName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEnableProtectionInputInternal)this).TargetVMName = (string) content.GetValueForProperty("TargetVMName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEnableProtectionInputInternal)this).TargetVMName, global::System.Convert.ToString); + } + if (content.Contains("TargetVMSize")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEnableProtectionInputInternal)this).TargetVMSize = (string) content.GetValueForProperty("TargetVMSize",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEnableProtectionInputInternal)this).TargetVMSize, global::System.Convert.ToString); + } + if (content.Contains("LicenseType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEnableProtectionInputInternal)this).LicenseType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.LicenseType?) content.GetValueForProperty("LicenseType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEnableProtectionInputInternal)this).LicenseType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.LicenseType.CreateFrom); + } + if (content.Contains("TargetAvailabilitySetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEnableProtectionInputInternal)this).TargetAvailabilitySetId = (string) content.GetValueForProperty("TargetAvailabilitySetId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEnableProtectionInputInternal)this).TargetAvailabilitySetId, global::System.Convert.ToString); + } + if (content.Contains("TargetAvailabilityZone")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEnableProtectionInputInternal)this).TargetAvailabilityZone = (string) content.GetValueForProperty("TargetAvailabilityZone",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEnableProtectionInputInternal)this).TargetAvailabilityZone, global::System.Convert.ToString); + } + if (content.Contains("TargetProximityPlacementGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEnableProtectionInputInternal)this).TargetProximityPlacementGroupId = (string) content.GetValueForProperty("TargetProximityPlacementGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEnableProtectionInputInternal)this).TargetProximityPlacementGroupId, global::System.Convert.ToString); + } + if (content.Contains("TargetBootDiagnosticsStorageAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEnableProtectionInputInternal)this).TargetBootDiagnosticsStorageAccountId = (string) content.GetValueForProperty("TargetBootDiagnosticsStorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEnableProtectionInputInternal)this).TargetBootDiagnosticsStorageAccountId, global::System.Convert.ToString); + } + if (content.Contains("RunAsAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEnableProtectionInputInternal)this).RunAsAccountId = (string) content.GetValueForProperty("RunAsAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEnableProtectionInputInternal)this).RunAsAccountId, global::System.Convert.ToString); + } + if (content.Contains("ProcessServerId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEnableProtectionInputInternal)this).ProcessServerId = (string) content.GetValueForProperty("ProcessServerId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEnableProtectionInputInternal)this).ProcessServerId, global::System.Convert.ToString); + } + if (content.Contains("MultiVMGroupName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEnableProtectionInputInternal)this).MultiVMGroupName = (string) content.GetValueForProperty("MultiVMGroupName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEnableProtectionInputInternal)this).MultiVMGroupName, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + if (content.Contains("DiskDefaultLogStorageAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEnableProtectionInputInternal)this).DiskDefaultLogStorageAccountId = (string) content.GetValueForProperty("DiskDefaultLogStorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEnableProtectionInputInternal)this).DiskDefaultLogStorageAccountId, global::System.Convert.ToString); + } + if (content.Contains("DiskDefaultDiskType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEnableProtectionInputInternal)this).DiskDefaultDiskType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskAccountType) content.GetValueForProperty("DiskDefaultDiskType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEnableProtectionInputInternal)this).DiskDefaultDiskType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskAccountType.CreateFrom); + } + if (content.Contains("DiskDefaultDiskEncryptionSetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEnableProtectionInputInternal)this).DiskDefaultDiskEncryptionSetId = (string) content.GetValueForProperty("DiskDefaultDiskEncryptionSetId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEnableProtectionInputInternal)this).DiskDefaultDiskEncryptionSetId, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// InMageRcm specific enable protection input. + [System.ComponentModel.TypeConverter(typeof(InMageRcmEnableProtectionInputTypeConverter))] + public partial interface IInMageRcmEnableProtectionInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmEnableProtectionInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmEnableProtectionInput.TypeConverter.cs new file mode 100644 index 000000000000..d448f3ca361c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmEnableProtectionInput.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InMageRcmEnableProtectionInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEnableProtectionInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEnableProtectionInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InMageRcmEnableProtectionInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InMageRcmEnableProtectionInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InMageRcmEnableProtectionInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmEnableProtectionInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmEnableProtectionInput.cs new file mode 100644 index 000000000000..1b8aeda86286 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmEnableProtectionInput.cs @@ -0,0 +1,402 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMageRcm specific enable protection input. + public partial class InMageRcmEnableProtectionInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEnableProtectionInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEnableProtectionInputInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionProviderSpecificInput __enableProtectionProviderSpecificInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EnableProtectionProviderSpecificInput(); + + /// The DiskEncryptionSet ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string DiskDefaultDiskEncryptionSetId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDisksDefaultInputInternal)DisksDefault).DiskEncryptionSetId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDisksDefaultInputInternal)DisksDefault).DiskEncryptionSetId = value ?? null; } + + /// The disk type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskAccountType? DiskDefaultDiskType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDisksDefaultInputInternal)DisksDefault).DiskType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDisksDefaultInputInternal)DisksDefault).DiskType = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskAccountType)""); } + + /// The log storage account ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string DiskDefaultLogStorageAccountId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDisksDefaultInputInternal)DisksDefault).LogStorageAccountId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDisksDefaultInputInternal)DisksDefault).LogStorageAccountId = value ?? null; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDisksDefaultInput _disksDefault; + + /// The default disk input. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDisksDefaultInput DisksDefault { get => (this._disksDefault = this._disksDefault ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmDisksDefaultInput()); set => this._disksDefault = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiskInput[] _disksToInclude; + + /// The disks to include list. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiskInput[] DisksToInclude { get => this._disksToInclude; set => this._disksToInclude = value; } + + /// Backing field for property. + private string _fabricDiscoveryMachineId; + + /// The ARM Id of discovered machine. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string FabricDiscoveryMachineId { get => this._fabricDiscoveryMachineId; set => this._fabricDiscoveryMachineId = value; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionProviderSpecificInputInternal)__enableProtectionProviderSpecificInput).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionProviderSpecificInputInternal)__enableProtectionProviderSpecificInput).InstanceType = value ; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.LicenseType? _licenseType; + + /// The license type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.LicenseType? LicenseType { get => this._licenseType; set => this._licenseType = value; } + + /// Internal Acessors for DisksDefault + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDisksDefaultInput Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEnableProtectionInputInternal.DisksDefault { get => (this._disksDefault = this._disksDefault ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmDisksDefaultInput()); set { {_disksDefault = value;} } } + + /// Backing field for property. + private string _multiVMGroupName; + + /// The multi VM group name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string MultiVMGroupName { get => this._multiVMGroupName; set => this._multiVMGroupName = value; } + + /// Backing field for property. + private string _processServerId; + + /// The process server Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ProcessServerId { get => this._processServerId; set => this._processServerId = value; } + + /// Backing field for property. + private string _runAsAccountId; + + /// The run-as account Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RunAsAccountId { get => this._runAsAccountId; set => this._runAsAccountId = value; } + + /// Backing field for property. + private string _targetAvailabilitySetId; + + /// The target availability set ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetAvailabilitySetId { get => this._targetAvailabilitySetId; set => this._targetAvailabilitySetId = value; } + + /// Backing field for property. + private string _targetAvailabilityZone; + + /// The target availability zone. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetAvailabilityZone { get => this._targetAvailabilityZone; set => this._targetAvailabilityZone = value; } + + /// + /// Backing field for property. + /// + private string _targetBootDiagnosticsStorageAccountId; + + /// The target boot diagnostics storage account ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetBootDiagnosticsStorageAccountId { get => this._targetBootDiagnosticsStorageAccountId; set => this._targetBootDiagnosticsStorageAccountId = value; } + + /// Backing field for property. + private string _targetNetworkId; + + /// The selected target network ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetNetworkId { get => this._targetNetworkId; set => this._targetNetworkId = value; } + + /// Backing field for property. + private string _targetProximityPlacementGroupId; + + /// The target proximity placement group Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetProximityPlacementGroupId { get => this._targetProximityPlacementGroupId; set => this._targetProximityPlacementGroupId = value; } + + /// Backing field for property. + private string _targetResourceGroupId; + + /// The target resource group ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetResourceGroupId { get => this._targetResourceGroupId; set => this._targetResourceGroupId = value; } + + /// Backing field for property. + private string _targetSubnetName; + + /// The selected target subnet name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetSubnetName { get => this._targetSubnetName; set => this._targetSubnetName = value; } + + /// Backing field for property. + private string _targetVMName; + + /// The target VM name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetVMName { get => this._targetVMName; set => this._targetVMName = value; } + + /// Backing field for property. + private string _targetVMSize; + + /// The target VM size. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetVMSize { get => this._targetVMSize; set => this._targetVMSize = value; } + + /// Backing field for property. + private string _testNetworkId; + + /// The selected test network ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TestNetworkId { get => this._testNetworkId; set => this._testNetworkId = value; } + + /// Backing field for property. + private string _testSubnetName; + + /// The selected test subnet name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TestSubnetName { get => this._testSubnetName; set => this._testSubnetName = value; } + + /// Creates an new instance. + public InMageRcmEnableProtectionInput() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__enableProtectionProviderSpecificInput), __enableProtectionProviderSpecificInput); + await eventListener.AssertObjectIsValid(nameof(__enableProtectionProviderSpecificInput), __enableProtectionProviderSpecificInput); + } + } + /// InMageRcm specific enable protection input. + public partial interface IInMageRcmEnableProtectionInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionProviderSpecificInput + { + /// The DiskEncryptionSet ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The DiskEncryptionSet ARM Id.", + SerializedName = @"diskEncryptionSetId", + PossibleTypes = new [] { typeof(string) })] + string DiskDefaultDiskEncryptionSetId { get; set; } + /// The disk type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The disk type.", + SerializedName = @"diskType", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskAccountType) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskAccountType? DiskDefaultDiskType { get; set; } + /// The log storage account ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The log storage account ARM Id.", + SerializedName = @"logStorageAccountId", + PossibleTypes = new [] { typeof(string) })] + string DiskDefaultLogStorageAccountId { get; set; } + /// The disks to include list. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The disks to include list.", + SerializedName = @"disksToInclude", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiskInput) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiskInput[] DisksToInclude { get; set; } + /// The ARM Id of discovered machine. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ARM Id of discovered machine.", + SerializedName = @"fabricDiscoveryMachineId", + PossibleTypes = new [] { typeof(string) })] + string FabricDiscoveryMachineId { get; set; } + /// The license type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The license type.", + SerializedName = @"licenseType", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.LicenseType) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.LicenseType? LicenseType { get; set; } + /// The multi VM group name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The multi VM group name.", + SerializedName = @"multiVmGroupName", + PossibleTypes = new [] { typeof(string) })] + string MultiVMGroupName { get; set; } + /// The process server Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The process server Id.", + SerializedName = @"processServerId", + PossibleTypes = new [] { typeof(string) })] + string ProcessServerId { get; set; } + /// The run-as account Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The run-as account Id.", + SerializedName = @"runAsAccountId", + PossibleTypes = new [] { typeof(string) })] + string RunAsAccountId { get; set; } + /// The target availability set ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target availability set ARM Id.", + SerializedName = @"targetAvailabilitySetId", + PossibleTypes = new [] { typeof(string) })] + string TargetAvailabilitySetId { get; set; } + /// The target availability zone. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target availability zone.", + SerializedName = @"targetAvailabilityZone", + PossibleTypes = new [] { typeof(string) })] + string TargetAvailabilityZone { get; set; } + /// The target boot diagnostics storage account ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target boot diagnostics storage account ARM Id.", + SerializedName = @"targetBootDiagnosticsStorageAccountId", + PossibleTypes = new [] { typeof(string) })] + string TargetBootDiagnosticsStorageAccountId { get; set; } + /// The selected target network ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The selected target network ARM Id.", + SerializedName = @"targetNetworkId", + PossibleTypes = new [] { typeof(string) })] + string TargetNetworkId { get; set; } + /// The target proximity placement group Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target proximity placement group Id.", + SerializedName = @"targetProximityPlacementGroupId", + PossibleTypes = new [] { typeof(string) })] + string TargetProximityPlacementGroupId { get; set; } + /// The target resource group ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The target resource group ARM Id.", + SerializedName = @"targetResourceGroupId", + PossibleTypes = new [] { typeof(string) })] + string TargetResourceGroupId { get; set; } + /// The selected target subnet name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The selected target subnet name.", + SerializedName = @"targetSubnetName", + PossibleTypes = new [] { typeof(string) })] + string TargetSubnetName { get; set; } + /// The target VM name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target VM name.", + SerializedName = @"targetVmName", + PossibleTypes = new [] { typeof(string) })] + string TargetVMName { get; set; } + /// The target VM size. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target VM size.", + SerializedName = @"targetVmSize", + PossibleTypes = new [] { typeof(string) })] + string TargetVMSize { get; set; } + /// The selected test network ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The selected test network ARM Id.", + SerializedName = @"testNetworkId", + PossibleTypes = new [] { typeof(string) })] + string TestNetworkId { get; set; } + /// The selected test subnet name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The selected test subnet name.", + SerializedName = @"testSubnetName", + PossibleTypes = new [] { typeof(string) })] + string TestSubnetName { get; set; } + + } + /// InMageRcm specific enable protection input. + internal partial interface IInMageRcmEnableProtectionInputInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionProviderSpecificInputInternal + { + /// The DiskEncryptionSet ARM Id. + string DiskDefaultDiskEncryptionSetId { get; set; } + /// The disk type. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskAccountType? DiskDefaultDiskType { get; set; } + /// The log storage account ARM Id. + string DiskDefaultLogStorageAccountId { get; set; } + /// The default disk input. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDisksDefaultInput DisksDefault { get; set; } + /// The disks to include list. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiskInput[] DisksToInclude { get; set; } + /// The ARM Id of discovered machine. + string FabricDiscoveryMachineId { get; set; } + /// The license type. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.LicenseType? LicenseType { get; set; } + /// The multi VM group name. + string MultiVMGroupName { get; set; } + /// The process server Id. + string ProcessServerId { get; set; } + /// The run-as account Id. + string RunAsAccountId { get; set; } + /// The target availability set ARM Id. + string TargetAvailabilitySetId { get; set; } + /// The target availability zone. + string TargetAvailabilityZone { get; set; } + /// The target boot diagnostics storage account ARM Id. + string TargetBootDiagnosticsStorageAccountId { get; set; } + /// The selected target network ARM Id. + string TargetNetworkId { get; set; } + /// The target proximity placement group Id. + string TargetProximityPlacementGroupId { get; set; } + /// The target resource group ARM Id. + string TargetResourceGroupId { get; set; } + /// The selected target subnet name. + string TargetSubnetName { get; set; } + /// The target VM name. + string TargetVMName { get; set; } + /// The target VM size. + string TargetVMSize { get; set; } + /// The selected test network ARM Id. + string TestNetworkId { get; set; } + /// The selected test subnet name. + string TestSubnetName { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmEnableProtectionInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmEnableProtectionInput.json.cs new file mode 100644 index 000000000000..d8f154915216 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmEnableProtectionInput.json.cs @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMageRcm specific enable protection input. + public partial class InMageRcmEnableProtectionInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEnableProtectionInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEnableProtectionInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEnableProtectionInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new InMageRcmEnableProtectionInput(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal InMageRcmEnableProtectionInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __enableProtectionProviderSpecificInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EnableProtectionProviderSpecificInput(json); + {_disksDefault = If( json?.PropertyT("disksDefault"), out var __jsonDisksDefault) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmDisksDefaultInput.FromJson(__jsonDisksDefault) : DisksDefault;} + {_fabricDiscoveryMachineId = If( json?.PropertyT("fabricDiscoveryMachineId"), out var __jsonFabricDiscoveryMachineId) ? (string)__jsonFabricDiscoveryMachineId : (string)FabricDiscoveryMachineId;} + {_disksToInclude = If( json?.PropertyT("disksToInclude"), out var __jsonDisksToInclude) ? If( __jsonDisksToInclude as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiskInput) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmDiskInput.FromJson(__u) )) ))() : null : DisksToInclude;} + {_targetResourceGroupId = If( json?.PropertyT("targetResourceGroupId"), out var __jsonTargetResourceGroupId) ? (string)__jsonTargetResourceGroupId : (string)TargetResourceGroupId;} + {_targetNetworkId = If( json?.PropertyT("targetNetworkId"), out var __jsonTargetNetworkId) ? (string)__jsonTargetNetworkId : (string)TargetNetworkId;} + {_testNetworkId = If( json?.PropertyT("testNetworkId"), out var __jsonTestNetworkId) ? (string)__jsonTestNetworkId : (string)TestNetworkId;} + {_targetSubnetName = If( json?.PropertyT("targetSubnetName"), out var __jsonTargetSubnetName) ? (string)__jsonTargetSubnetName : (string)TargetSubnetName;} + {_testSubnetName = If( json?.PropertyT("testSubnetName"), out var __jsonTestSubnetName) ? (string)__jsonTestSubnetName : (string)TestSubnetName;} + {_targetVMName = If( json?.PropertyT("targetVmName"), out var __jsonTargetVMName) ? (string)__jsonTargetVMName : (string)TargetVMName;} + {_targetVMSize = If( json?.PropertyT("targetVmSize"), out var __jsonTargetVMSize) ? (string)__jsonTargetVMSize : (string)TargetVMSize;} + {_licenseType = If( json?.PropertyT("licenseType"), out var __jsonLicenseType) ? (string)__jsonLicenseType : (string)LicenseType;} + {_targetAvailabilitySetId = If( json?.PropertyT("targetAvailabilitySetId"), out var __jsonTargetAvailabilitySetId) ? (string)__jsonTargetAvailabilitySetId : (string)TargetAvailabilitySetId;} + {_targetAvailabilityZone = If( json?.PropertyT("targetAvailabilityZone"), out var __jsonTargetAvailabilityZone) ? (string)__jsonTargetAvailabilityZone : (string)TargetAvailabilityZone;} + {_targetProximityPlacementGroupId = If( json?.PropertyT("targetProximityPlacementGroupId"), out var __jsonTargetProximityPlacementGroupId) ? (string)__jsonTargetProximityPlacementGroupId : (string)TargetProximityPlacementGroupId;} + {_targetBootDiagnosticsStorageAccountId = If( json?.PropertyT("targetBootDiagnosticsStorageAccountId"), out var __jsonTargetBootDiagnosticsStorageAccountId) ? (string)__jsonTargetBootDiagnosticsStorageAccountId : (string)TargetBootDiagnosticsStorageAccountId;} + {_runAsAccountId = If( json?.PropertyT("runAsAccountId"), out var __jsonRunAsAccountId) ? (string)__jsonRunAsAccountId : (string)RunAsAccountId;} + {_processServerId = If( json?.PropertyT("processServerId"), out var __jsonProcessServerId) ? (string)__jsonProcessServerId : (string)ProcessServerId;} + {_multiVMGroupName = If( json?.PropertyT("multiVmGroupName"), out var __jsonMultiVMGroupName) ? (string)__jsonMultiVMGroupName : (string)MultiVMGroupName;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __enableProtectionProviderSpecificInput?.ToJson(container, serializationMode); + AddIf( null != this._disksDefault ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._disksDefault.ToJson(null,serializationMode) : null, "disksDefault" ,container.Add ); + AddIf( null != (((object)this._fabricDiscoveryMachineId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._fabricDiscoveryMachineId.ToString()) : null, "fabricDiscoveryMachineId" ,container.Add ); + if (null != this._disksToInclude) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._disksToInclude ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("disksToInclude",__w); + } + AddIf( null != (((object)this._targetResourceGroupId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetResourceGroupId.ToString()) : null, "targetResourceGroupId" ,container.Add ); + AddIf( null != (((object)this._targetNetworkId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetNetworkId.ToString()) : null, "targetNetworkId" ,container.Add ); + AddIf( null != (((object)this._testNetworkId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._testNetworkId.ToString()) : null, "testNetworkId" ,container.Add ); + AddIf( null != (((object)this._targetSubnetName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetSubnetName.ToString()) : null, "targetSubnetName" ,container.Add ); + AddIf( null != (((object)this._testSubnetName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._testSubnetName.ToString()) : null, "testSubnetName" ,container.Add ); + AddIf( null != (((object)this._targetVMName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetVMName.ToString()) : null, "targetVmName" ,container.Add ); + AddIf( null != (((object)this._targetVMSize)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetVMSize.ToString()) : null, "targetVmSize" ,container.Add ); + AddIf( null != (((object)this._licenseType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._licenseType.ToString()) : null, "licenseType" ,container.Add ); + AddIf( null != (((object)this._targetAvailabilitySetId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetAvailabilitySetId.ToString()) : null, "targetAvailabilitySetId" ,container.Add ); + AddIf( null != (((object)this._targetAvailabilityZone)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetAvailabilityZone.ToString()) : null, "targetAvailabilityZone" ,container.Add ); + AddIf( null != (((object)this._targetProximityPlacementGroupId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetProximityPlacementGroupId.ToString()) : null, "targetProximityPlacementGroupId" ,container.Add ); + AddIf( null != (((object)this._targetBootDiagnosticsStorageAccountId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetBootDiagnosticsStorageAccountId.ToString()) : null, "targetBootDiagnosticsStorageAccountId" ,container.Add ); + AddIf( null != (((object)this._runAsAccountId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._runAsAccountId.ToString()) : null, "runAsAccountId" ,container.Add ); + AddIf( null != (((object)this._processServerId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._processServerId.ToString()) : null, "processServerId" ,container.Add ); + AddIf( null != (((object)this._multiVMGroupName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._multiVMGroupName.ToString()) : null, "multiVmGroupName" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmEventDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmEventDetails.PowerShell.cs new file mode 100644 index 000000000000..334cb620b3eb --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmEventDetails.PowerShell.cs @@ -0,0 +1,208 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Event details for InMageRcm provider. + [System.ComponentModel.TypeConverter(typeof(InMageRcmEventDetailsTypeConverter))] + public partial class InMageRcmEventDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEventDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InMageRcmEventDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEventDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InMageRcmEventDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEventDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InMageRcmEventDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProtectedItemName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEventDetailsInternal)this).ProtectedItemName = (string) content.GetValueForProperty("ProtectedItemName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEventDetailsInternal)this).ProtectedItemName, global::System.Convert.ToString); + } + if (content.Contains("VMName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEventDetailsInternal)this).VMName = (string) content.GetValueForProperty("VMName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEventDetailsInternal)this).VMName, global::System.Convert.ToString); + } + if (content.Contains("LatestAgentVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEventDetailsInternal)this).LatestAgentVersion = (string) content.GetValueForProperty("LatestAgentVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEventDetailsInternal)this).LatestAgentVersion, global::System.Convert.ToString); + } + if (content.Contains("JobId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEventDetailsInternal)this).JobId = (string) content.GetValueForProperty("JobId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEventDetailsInternal)this).JobId, global::System.Convert.ToString); + } + if (content.Contains("FabricName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEventDetailsInternal)this).FabricName = (string) content.GetValueForProperty("FabricName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEventDetailsInternal)this).FabricName, global::System.Convert.ToString); + } + if (content.Contains("ApplianceName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEventDetailsInternal)this).ApplianceName = (string) content.GetValueForProperty("ApplianceName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEventDetailsInternal)this).ApplianceName, global::System.Convert.ToString); + } + if (content.Contains("ServerType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEventDetailsInternal)this).ServerType = (string) content.GetValueForProperty("ServerType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEventDetailsInternal)this).ServerType, global::System.Convert.ToString); + } + if (content.Contains("ComponentDisplayName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEventDetailsInternal)this).ComponentDisplayName = (string) content.GetValueForProperty("ComponentDisplayName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEventDetailsInternal)this).ComponentDisplayName, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InMageRcmEventDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProtectedItemName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEventDetailsInternal)this).ProtectedItemName = (string) content.GetValueForProperty("ProtectedItemName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEventDetailsInternal)this).ProtectedItemName, global::System.Convert.ToString); + } + if (content.Contains("VMName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEventDetailsInternal)this).VMName = (string) content.GetValueForProperty("VMName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEventDetailsInternal)this).VMName, global::System.Convert.ToString); + } + if (content.Contains("LatestAgentVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEventDetailsInternal)this).LatestAgentVersion = (string) content.GetValueForProperty("LatestAgentVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEventDetailsInternal)this).LatestAgentVersion, global::System.Convert.ToString); + } + if (content.Contains("JobId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEventDetailsInternal)this).JobId = (string) content.GetValueForProperty("JobId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEventDetailsInternal)this).JobId, global::System.Convert.ToString); + } + if (content.Contains("FabricName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEventDetailsInternal)this).FabricName = (string) content.GetValueForProperty("FabricName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEventDetailsInternal)this).FabricName, global::System.Convert.ToString); + } + if (content.Contains("ApplianceName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEventDetailsInternal)this).ApplianceName = (string) content.GetValueForProperty("ApplianceName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEventDetailsInternal)this).ApplianceName, global::System.Convert.ToString); + } + if (content.Contains("ServerType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEventDetailsInternal)this).ServerType = (string) content.GetValueForProperty("ServerType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEventDetailsInternal)this).ServerType, global::System.Convert.ToString); + } + if (content.Contains("ComponentDisplayName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEventDetailsInternal)this).ComponentDisplayName = (string) content.GetValueForProperty("ComponentDisplayName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEventDetailsInternal)this).ComponentDisplayName, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Event details for InMageRcm provider. + [System.ComponentModel.TypeConverter(typeof(InMageRcmEventDetailsTypeConverter))] + public partial interface IInMageRcmEventDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmEventDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmEventDetails.TypeConverter.cs new file mode 100644 index 000000000000..4de99b4ad854 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmEventDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InMageRcmEventDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEventDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEventDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InMageRcmEventDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InMageRcmEventDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InMageRcmEventDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmEventDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmEventDetails.cs new file mode 100644 index 000000000000..2078bf050cb4 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmEventDetails.cs @@ -0,0 +1,217 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Event details for InMageRcm provider. + public partial class InMageRcmEventDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEventDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEventDetailsInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetails __eventProviderSpecificDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EventProviderSpecificDetails(); + + /// Backing field for property. + private string _applianceName; + + /// The appliance name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ApplianceName { get => this._applianceName; } + + /// Backing field for property. + private string _componentDisplayName; + + /// The component display name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ComponentDisplayName { get => this._componentDisplayName; } + + /// Backing field for property. + private string _fabricName; + + /// The fabric name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string FabricName { get => this._fabricName; } + + /// Gets the class type. Overridden in derived classes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetailsInternal)__eventProviderSpecificDetails).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetailsInternal)__eventProviderSpecificDetails).InstanceType = value ; } + + /// Backing field for property. + private string _jobId; + + /// The job Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string JobId { get => this._jobId; } + + /// Backing field for property. + private string _latestAgentVersion; + + /// The latest agent version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string LatestAgentVersion { get => this._latestAgentVersion; } + + /// Internal Acessors for ApplianceName + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEventDetailsInternal.ApplianceName { get => this._applianceName; set { {_applianceName = value;} } } + + /// Internal Acessors for ComponentDisplayName + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEventDetailsInternal.ComponentDisplayName { get => this._componentDisplayName; set { {_componentDisplayName = value;} } } + + /// Internal Acessors for FabricName + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEventDetailsInternal.FabricName { get => this._fabricName; set { {_fabricName = value;} } } + + /// Internal Acessors for JobId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEventDetailsInternal.JobId { get => this._jobId; set { {_jobId = value;} } } + + /// Internal Acessors for LatestAgentVersion + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEventDetailsInternal.LatestAgentVersion { get => this._latestAgentVersion; set { {_latestAgentVersion = value;} } } + + /// Internal Acessors for ProtectedItemName + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEventDetailsInternal.ProtectedItemName { get => this._protectedItemName; set { {_protectedItemName = value;} } } + + /// Internal Acessors for ServerType + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEventDetailsInternal.ServerType { get => this._serverType; set { {_serverType = value;} } } + + /// Internal Acessors for VMName + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEventDetailsInternal.VMName { get => this._vMName; set { {_vMName = value;} } } + + /// Backing field for property. + private string _protectedItemName; + + /// The protected item name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ProtectedItemName { get => this._protectedItemName; } + + /// Backing field for property. + private string _serverType; + + /// The server type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ServerType { get => this._serverType; } + + /// Backing field for property. + private string _vMName; + + /// The protected item name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string VMName { get => this._vMName; } + + /// Creates an new instance. + public InMageRcmEventDetails() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__eventProviderSpecificDetails), __eventProviderSpecificDetails); + await eventListener.AssertObjectIsValid(nameof(__eventProviderSpecificDetails), __eventProviderSpecificDetails); + } + } + /// Event details for InMageRcm provider. + public partial interface IInMageRcmEventDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetails + { + /// The appliance name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The appliance name.", + SerializedName = @"applianceName", + PossibleTypes = new [] { typeof(string) })] + string ApplianceName { get; } + /// The component display name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The component display name.", + SerializedName = @"componentDisplayName", + PossibleTypes = new [] { typeof(string) })] + string ComponentDisplayName { get; } + /// The fabric name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The fabric name.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + string FabricName { get; } + /// The job Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The job Id.", + SerializedName = @"jobId", + PossibleTypes = new [] { typeof(string) })] + string JobId { get; } + /// The latest agent version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The latest agent version.", + SerializedName = @"latestAgentVersion", + PossibleTypes = new [] { typeof(string) })] + string LatestAgentVersion { get; } + /// The protected item name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The protected item name.", + SerializedName = @"protectedItemName", + PossibleTypes = new [] { typeof(string) })] + string ProtectedItemName { get; } + /// The server type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The server type.", + SerializedName = @"serverType", + PossibleTypes = new [] { typeof(string) })] + string ServerType { get; } + /// The protected item name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The protected item name.", + SerializedName = @"vmName", + PossibleTypes = new [] { typeof(string) })] + string VMName { get; } + + } + /// Event details for InMageRcm provider. + internal partial interface IInMageRcmEventDetailsInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetailsInternal + { + /// The appliance name. + string ApplianceName { get; set; } + /// The component display name. + string ComponentDisplayName { get; set; } + /// The fabric name. + string FabricName { get; set; } + /// The job Id. + string JobId { get; set; } + /// The latest agent version. + string LatestAgentVersion { get; set; } + /// The protected item name. + string ProtectedItemName { get; set; } + /// The server type. + string ServerType { get; set; } + /// The protected item name. + string VMName { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmEventDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmEventDetails.json.cs new file mode 100644 index 000000000000..8da7a5d2fb20 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmEventDetails.json.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Event details for InMageRcm provider. + public partial class InMageRcmEventDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEventDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEventDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmEventDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new InMageRcmEventDetails(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal InMageRcmEventDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __eventProviderSpecificDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EventProviderSpecificDetails(json); + {_protectedItemName = If( json?.PropertyT("protectedItemName"), out var __jsonProtectedItemName) ? (string)__jsonProtectedItemName : (string)ProtectedItemName;} + {_vMName = If( json?.PropertyT("vmName"), out var __jsonVMName) ? (string)__jsonVMName : (string)VMName;} + {_latestAgentVersion = If( json?.PropertyT("latestAgentVersion"), out var __jsonLatestAgentVersion) ? (string)__jsonLatestAgentVersion : (string)LatestAgentVersion;} + {_jobId = If( json?.PropertyT("jobId"), out var __jsonJobId) ? (string)__jsonJobId : (string)JobId;} + {_fabricName = If( json?.PropertyT("fabricName"), out var __jsonFabricName) ? (string)__jsonFabricName : (string)FabricName;} + {_applianceName = If( json?.PropertyT("applianceName"), out var __jsonApplianceName) ? (string)__jsonApplianceName : (string)ApplianceName;} + {_serverType = If( json?.PropertyT("serverType"), out var __jsonServerType) ? (string)__jsonServerType : (string)ServerType;} + {_componentDisplayName = If( json?.PropertyT("componentDisplayName"), out var __jsonComponentDisplayName) ? (string)__jsonComponentDisplayName : (string)ComponentDisplayName;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __eventProviderSpecificDetails?.ToJson(container, serializationMode); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._protectedItemName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._protectedItemName.ToString()) : null, "protectedItemName" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._vMName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._vMName.ToString()) : null, "vmName" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._latestAgentVersion)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._latestAgentVersion.ToString()) : null, "latestAgentVersion" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._jobId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._jobId.ToString()) : null, "jobId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._fabricName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._fabricName.ToString()) : null, "fabricName" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._applianceName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._applianceName.ToString()) : null, "applianceName" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._serverType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._serverType.ToString()) : null, "serverType" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._componentDisplayName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._componentDisplayName.ToString()) : null, "componentDisplayName" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFabricCreationInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFabricCreationInput.PowerShell.cs new file mode 100644 index 000000000000..d563be4cf53f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFabricCreationInput.PowerShell.cs @@ -0,0 +1,210 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// InMageRcm fabric provider specific settings. + [System.ComponentModel.TypeConverter(typeof(InMageRcmFabricCreationInputTypeConverter))] + public partial class InMageRcmFabricCreationInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricCreationInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InMageRcmFabricCreationInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricCreationInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InMageRcmFabricCreationInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricCreationInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InMageRcmFabricCreationInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SourceAgentIdentity")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricCreationInputInternal)this).SourceAgentIdentity = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInput) content.GetValueForProperty("SourceAgentIdentity",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricCreationInputInternal)this).SourceAgentIdentity, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IdentityProviderInputTypeConverter.ConvertFrom); + } + if (content.Contains("VmwareSiteId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricCreationInputInternal)this).VmwareSiteId = (string) content.GetValueForProperty("VmwareSiteId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricCreationInputInternal)this).VmwareSiteId, global::System.Convert.ToString); + } + if (content.Contains("PhysicalSiteId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricCreationInputInternal)this).PhysicalSiteId = (string) content.GetValueForProperty("PhysicalSiteId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricCreationInputInternal)this).PhysicalSiteId, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreationInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreationInputInternal)this).InstanceType, global::System.Convert.ToString); + } + if (content.Contains("SourceAgentIdentityTenantId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricCreationInputInternal)this).SourceAgentIdentityTenantId = (string) content.GetValueForProperty("SourceAgentIdentityTenantId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricCreationInputInternal)this).SourceAgentIdentityTenantId, global::System.Convert.ToString); + } + if (content.Contains("SourceAgentIdentityApplicationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricCreationInputInternal)this).SourceAgentIdentityApplicationId = (string) content.GetValueForProperty("SourceAgentIdentityApplicationId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricCreationInputInternal)this).SourceAgentIdentityApplicationId, global::System.Convert.ToString); + } + if (content.Contains("SourceAgentIdentityObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricCreationInputInternal)this).SourceAgentIdentityObjectId = (string) content.GetValueForProperty("SourceAgentIdentityObjectId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricCreationInputInternal)this).SourceAgentIdentityObjectId, global::System.Convert.ToString); + } + if (content.Contains("SourceAgentIdentityAudience")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricCreationInputInternal)this).SourceAgentIdentityAudience = (string) content.GetValueForProperty("SourceAgentIdentityAudience",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricCreationInputInternal)this).SourceAgentIdentityAudience, global::System.Convert.ToString); + } + if (content.Contains("SourceAgentIdentityAadAuthority")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricCreationInputInternal)this).SourceAgentIdentityAadAuthority = (string) content.GetValueForProperty("SourceAgentIdentityAadAuthority",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricCreationInputInternal)this).SourceAgentIdentityAadAuthority, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InMageRcmFabricCreationInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SourceAgentIdentity")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricCreationInputInternal)this).SourceAgentIdentity = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInput) content.GetValueForProperty("SourceAgentIdentity",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricCreationInputInternal)this).SourceAgentIdentity, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IdentityProviderInputTypeConverter.ConvertFrom); + } + if (content.Contains("VmwareSiteId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricCreationInputInternal)this).VmwareSiteId = (string) content.GetValueForProperty("VmwareSiteId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricCreationInputInternal)this).VmwareSiteId, global::System.Convert.ToString); + } + if (content.Contains("PhysicalSiteId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricCreationInputInternal)this).PhysicalSiteId = (string) content.GetValueForProperty("PhysicalSiteId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricCreationInputInternal)this).PhysicalSiteId, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreationInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreationInputInternal)this).InstanceType, global::System.Convert.ToString); + } + if (content.Contains("SourceAgentIdentityTenantId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricCreationInputInternal)this).SourceAgentIdentityTenantId = (string) content.GetValueForProperty("SourceAgentIdentityTenantId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricCreationInputInternal)this).SourceAgentIdentityTenantId, global::System.Convert.ToString); + } + if (content.Contains("SourceAgentIdentityApplicationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricCreationInputInternal)this).SourceAgentIdentityApplicationId = (string) content.GetValueForProperty("SourceAgentIdentityApplicationId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricCreationInputInternal)this).SourceAgentIdentityApplicationId, global::System.Convert.ToString); + } + if (content.Contains("SourceAgentIdentityObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricCreationInputInternal)this).SourceAgentIdentityObjectId = (string) content.GetValueForProperty("SourceAgentIdentityObjectId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricCreationInputInternal)this).SourceAgentIdentityObjectId, global::System.Convert.ToString); + } + if (content.Contains("SourceAgentIdentityAudience")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricCreationInputInternal)this).SourceAgentIdentityAudience = (string) content.GetValueForProperty("SourceAgentIdentityAudience",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricCreationInputInternal)this).SourceAgentIdentityAudience, global::System.Convert.ToString); + } + if (content.Contains("SourceAgentIdentityAadAuthority")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricCreationInputInternal)this).SourceAgentIdentityAadAuthority = (string) content.GetValueForProperty("SourceAgentIdentityAadAuthority",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricCreationInputInternal)this).SourceAgentIdentityAadAuthority, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// InMageRcm fabric provider specific settings. + [System.ComponentModel.TypeConverter(typeof(InMageRcmFabricCreationInputTypeConverter))] + public partial interface IInMageRcmFabricCreationInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFabricCreationInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFabricCreationInput.TypeConverter.cs new file mode 100644 index 000000000000..05643992ddbd --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFabricCreationInput.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InMageRcmFabricCreationInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricCreationInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricCreationInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InMageRcmFabricCreationInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InMageRcmFabricCreationInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InMageRcmFabricCreationInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFabricCreationInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFabricCreationInput.cs new file mode 100644 index 000000000000..24e1b20e57bf --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFabricCreationInput.cs @@ -0,0 +1,209 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMageRcm fabric provider specific settings. + public partial class InMageRcmFabricCreationInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricCreationInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricCreationInputInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreationInput __fabricSpecificCreationInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FabricSpecificCreationInput(); + + /// Gets the class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreationInputInternal)__fabricSpecificCreationInput).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreationInputInternal)__fabricSpecificCreationInput).InstanceType = value ; } + + /// Internal Acessors for SourceAgentIdentity + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInput Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricCreationInputInternal.SourceAgentIdentity { get => (this._sourceAgentIdentity = this._sourceAgentIdentity ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IdentityProviderInput()); set { {_sourceAgentIdentity = value;} } } + + /// Backing field for property. + private string _physicalSiteId; + + /// The ARM Id of the physical site. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string PhysicalSiteId { get => this._physicalSiteId; set => this._physicalSiteId = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInput _sourceAgentIdentity; + + /// The identity provider input for source agent authentication. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInput SourceAgentIdentity { get => (this._sourceAgentIdentity = this._sourceAgentIdentity ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IdentityProviderInput()); set => this._sourceAgentIdentity = value; } + + /// The base authority for Azure Active Directory authentication. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string SourceAgentIdentityAadAuthority { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInputInternal)SourceAgentIdentity).AadAuthority; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInputInternal)SourceAgentIdentity).AadAuthority = value ; } + + /// + /// The application/client Id for the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string SourceAgentIdentityApplicationId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInputInternal)SourceAgentIdentity).ApplicationId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInputInternal)SourceAgentIdentity).ApplicationId = value ; } + + /// + /// The intended Audience of the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string SourceAgentIdentityAudience { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInputInternal)SourceAgentIdentity).Audience; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInputInternal)SourceAgentIdentity).Audience = value ; } + + /// + /// The object Id of the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string SourceAgentIdentityObjectId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInputInternal)SourceAgentIdentity).ObjectId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInputInternal)SourceAgentIdentity).ObjectId = value ; } + + /// + /// The tenant Id for the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string SourceAgentIdentityTenantId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInputInternal)SourceAgentIdentity).TenantId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInputInternal)SourceAgentIdentity).TenantId = value ; } + + /// Backing field for property. + private string _vmwareSiteId; + + /// The ARM Id of the VMware site. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string VmwareSiteId { get => this._vmwareSiteId; set => this._vmwareSiteId = value; } + + /// Creates an new instance. + public InMageRcmFabricCreationInput() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__fabricSpecificCreationInput), __fabricSpecificCreationInput); + await eventListener.AssertObjectIsValid(nameof(__fabricSpecificCreationInput), __fabricSpecificCreationInput); + } + } + /// InMageRcm fabric provider specific settings. + public partial interface IInMageRcmFabricCreationInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreationInput + { + /// The ARM Id of the physical site. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ARM Id of the physical site.", + SerializedName = @"physicalSiteId", + PossibleTypes = new [] { typeof(string) })] + string PhysicalSiteId { get; set; } + /// The base authority for Azure Active Directory authentication. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The base authority for Azure Active Directory authentication.", + SerializedName = @"aadAuthority", + PossibleTypes = new [] { typeof(string) })] + string SourceAgentIdentityAadAuthority { get; set; } + /// + /// The application/client Id for the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The application/client Id for the service principal with which the on-premise management/data plane components would communicate with our Azure services.", + SerializedName = @"applicationId", + PossibleTypes = new [] { typeof(string) })] + string SourceAgentIdentityApplicationId { get; set; } + /// + /// The intended Audience of the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The intended Audience of the service principal with which the on-premise management/data plane components would communicate with our Azure services.", + SerializedName = @"audience", + PossibleTypes = new [] { typeof(string) })] + string SourceAgentIdentityAudience { get; set; } + /// + /// The object Id of the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The object Id of the service principal with which the on-premise management/data plane components would communicate with our Azure services.", + SerializedName = @"objectId", + PossibleTypes = new [] { typeof(string) })] + string SourceAgentIdentityObjectId { get; set; } + /// + /// The tenant Id for the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The tenant Id for the service principal with which the on-premise management/data plane components would communicate with our Azure services.", + SerializedName = @"tenantId", + PossibleTypes = new [] { typeof(string) })] + string SourceAgentIdentityTenantId { get; set; } + /// The ARM Id of the VMware site. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ARM Id of the VMware site.", + SerializedName = @"vmwareSiteId", + PossibleTypes = new [] { typeof(string) })] + string VmwareSiteId { get; set; } + + } + /// InMageRcm fabric provider specific settings. + internal partial interface IInMageRcmFabricCreationInputInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreationInputInternal + { + /// The ARM Id of the physical site. + string PhysicalSiteId { get; set; } + /// The identity provider input for source agent authentication. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderInput SourceAgentIdentity { get; set; } + /// The base authority for Azure Active Directory authentication. + string SourceAgentIdentityAadAuthority { get; set; } + /// + /// The application/client Id for the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + string SourceAgentIdentityApplicationId { get; set; } + /// + /// The intended Audience of the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + string SourceAgentIdentityAudience { get; set; } + /// + /// The object Id of the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + string SourceAgentIdentityObjectId { get; set; } + /// + /// The tenant Id for the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + string SourceAgentIdentityTenantId { get; set; } + /// The ARM Id of the VMware site. + string VmwareSiteId { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFabricCreationInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFabricCreationInput.json.cs new file mode 100644 index 000000000000..3ee5d9bc9fff --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFabricCreationInput.json.cs @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMageRcm fabric provider specific settings. + public partial class InMageRcmFabricCreationInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricCreationInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricCreationInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricCreationInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new InMageRcmFabricCreationInput(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal InMageRcmFabricCreationInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __fabricSpecificCreationInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FabricSpecificCreationInput(json); + {_sourceAgentIdentity = If( json?.PropertyT("sourceAgentIdentity"), out var __jsonSourceAgentIdentity) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IdentityProviderInput.FromJson(__jsonSourceAgentIdentity) : SourceAgentIdentity;} + {_vmwareSiteId = If( json?.PropertyT("vmwareSiteId"), out var __jsonVmwareSiteId) ? (string)__jsonVmwareSiteId : (string)VmwareSiteId;} + {_physicalSiteId = If( json?.PropertyT("physicalSiteId"), out var __jsonPhysicalSiteId) ? (string)__jsonPhysicalSiteId : (string)PhysicalSiteId;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __fabricSpecificCreationInput?.ToJson(container, serializationMode); + AddIf( null != this._sourceAgentIdentity ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._sourceAgentIdentity.ToJson(null,serializationMode) : null, "sourceAgentIdentity" ,container.Add ); + AddIf( null != (((object)this._vmwareSiteId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._vmwareSiteId.ToString()) : null, "vmwareSiteId" ,container.Add ); + AddIf( null != (((object)this._physicalSiteId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._physicalSiteId.ToString()) : null, "physicalSiteId" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFabricSpecificDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFabricSpecificDetails.PowerShell.cs new file mode 100644 index 000000000000..9e0da5cae5ae --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFabricSpecificDetails.PowerShell.cs @@ -0,0 +1,314 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// InMageRcm fabric specific details. + [System.ComponentModel.TypeConverter(typeof(InMageRcmFabricSpecificDetailsTypeConverter))] + public partial class InMageRcmFabricSpecificDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InMageRcmFabricSpecificDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InMageRcmFabricSpecificDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InMageRcmFabricSpecificDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SourceAgentIdentityDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetailsInternal)this).SourceAgentIdentityDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetails) content.GetValueForProperty("SourceAgentIdentityDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetailsInternal)this).SourceAgentIdentityDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IdentityProviderDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("VmwareSiteId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetailsInternal)this).VmwareSiteId = (string) content.GetValueForProperty("VmwareSiteId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetailsInternal)this).VmwareSiteId, global::System.Convert.ToString); + } + if (content.Contains("PhysicalSiteId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetailsInternal)this).PhysicalSiteId = (string) content.GetValueForProperty("PhysicalSiteId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetailsInternal)this).PhysicalSiteId, global::System.Convert.ToString); + } + if (content.Contains("ServiceEndpoint")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetailsInternal)this).ServiceEndpoint = (string) content.GetValueForProperty("ServiceEndpoint",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetailsInternal)this).ServiceEndpoint, global::System.Convert.ToString); + } + if (content.Contains("ServiceResourceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetailsInternal)this).ServiceResourceId = (string) content.GetValueForProperty("ServiceResourceId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetailsInternal)this).ServiceResourceId, global::System.Convert.ToString); + } + if (content.Contains("ServiceContainerId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetailsInternal)this).ServiceContainerId = (string) content.GetValueForProperty("ServiceContainerId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetailsInternal)this).ServiceContainerId, global::System.Convert.ToString); + } + if (content.Contains("DataPlaneUri")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetailsInternal)this).DataPlaneUri = (string) content.GetValueForProperty("DataPlaneUri",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetailsInternal)this).DataPlaneUri, global::System.Convert.ToString); + } + if (content.Contains("ControlPlaneUri")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetailsInternal)this).ControlPlaneUri = (string) content.GetValueForProperty("ControlPlaneUri",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetailsInternal)this).ControlPlaneUri, global::System.Convert.ToString); + } + if (content.Contains("ProcessServer")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetailsInternal)this).ProcessServer = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetails[]) content.GetValueForProperty("ProcessServer",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetailsInternal)this).ProcessServer, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProcessServerDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("RcmProxy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetailsInternal)this).RcmProxy = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetails[]) content.GetValueForProperty("RcmProxy",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetailsInternal)this).RcmProxy, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RcmProxyDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("PushInstaller")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetailsInternal)this).PushInstaller = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPushInstallerDetails[]) content.GetValueForProperty("PushInstaller",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetailsInternal)this).PushInstaller, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PushInstallerDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("ReplicationAgent")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetailsInternal)this).ReplicationAgent = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAgentDetails[]) content.GetValueForProperty("ReplicationAgent",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetailsInternal)this).ReplicationAgent, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationAgentDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("ReprotectAgent")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetailsInternal)this).ReprotectAgent = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetails[]) content.GetValueForProperty("ReprotectAgent",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetailsInternal)this).ReprotectAgent, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReprotectAgentDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("MarsAgent")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetailsInternal)this).MarsAgent = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMarsAgentDetails[]) content.GetValueForProperty("MarsAgent",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetailsInternal)this).MarsAgent, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.MarsAgentDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("Dra")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetailsInternal)this).Dra = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDraDetails[]) content.GetValueForProperty("Dra",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetailsInternal)this).Dra, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DraDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("AgentDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetailsInternal)this).AgentDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAgentDetails[]) content.GetValueForProperty("AgentDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetailsInternal)this).AgentDetail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AgentDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + if (content.Contains("SourceAgentIdentityDetailTenantId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetailsInternal)this).SourceAgentIdentityDetailTenantId = (string) content.GetValueForProperty("SourceAgentIdentityDetailTenantId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetailsInternal)this).SourceAgentIdentityDetailTenantId, global::System.Convert.ToString); + } + if (content.Contains("SourceAgentIdentityDetailApplicationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetailsInternal)this).SourceAgentIdentityDetailApplicationId = (string) content.GetValueForProperty("SourceAgentIdentityDetailApplicationId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetailsInternal)this).SourceAgentIdentityDetailApplicationId, global::System.Convert.ToString); + } + if (content.Contains("SourceAgentIdentityDetailObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetailsInternal)this).SourceAgentIdentityDetailObjectId = (string) content.GetValueForProperty("SourceAgentIdentityDetailObjectId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetailsInternal)this).SourceAgentIdentityDetailObjectId, global::System.Convert.ToString); + } + if (content.Contains("SourceAgentIdentityDetailAudience")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetailsInternal)this).SourceAgentIdentityDetailAudience = (string) content.GetValueForProperty("SourceAgentIdentityDetailAudience",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetailsInternal)this).SourceAgentIdentityDetailAudience, global::System.Convert.ToString); + } + if (content.Contains("SourceAgentIdentityDetailAadAuthority")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetailsInternal)this).SourceAgentIdentityDetailAadAuthority = (string) content.GetValueForProperty("SourceAgentIdentityDetailAadAuthority",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetailsInternal)this).SourceAgentIdentityDetailAadAuthority, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InMageRcmFabricSpecificDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SourceAgentIdentityDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetailsInternal)this).SourceAgentIdentityDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetails) content.GetValueForProperty("SourceAgentIdentityDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetailsInternal)this).SourceAgentIdentityDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IdentityProviderDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("VmwareSiteId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetailsInternal)this).VmwareSiteId = (string) content.GetValueForProperty("VmwareSiteId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetailsInternal)this).VmwareSiteId, global::System.Convert.ToString); + } + if (content.Contains("PhysicalSiteId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetailsInternal)this).PhysicalSiteId = (string) content.GetValueForProperty("PhysicalSiteId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetailsInternal)this).PhysicalSiteId, global::System.Convert.ToString); + } + if (content.Contains("ServiceEndpoint")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetailsInternal)this).ServiceEndpoint = (string) content.GetValueForProperty("ServiceEndpoint",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetailsInternal)this).ServiceEndpoint, global::System.Convert.ToString); + } + if (content.Contains("ServiceResourceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetailsInternal)this).ServiceResourceId = (string) content.GetValueForProperty("ServiceResourceId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetailsInternal)this).ServiceResourceId, global::System.Convert.ToString); + } + if (content.Contains("ServiceContainerId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetailsInternal)this).ServiceContainerId = (string) content.GetValueForProperty("ServiceContainerId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetailsInternal)this).ServiceContainerId, global::System.Convert.ToString); + } + if (content.Contains("DataPlaneUri")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetailsInternal)this).DataPlaneUri = (string) content.GetValueForProperty("DataPlaneUri",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetailsInternal)this).DataPlaneUri, global::System.Convert.ToString); + } + if (content.Contains("ControlPlaneUri")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetailsInternal)this).ControlPlaneUri = (string) content.GetValueForProperty("ControlPlaneUri",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetailsInternal)this).ControlPlaneUri, global::System.Convert.ToString); + } + if (content.Contains("ProcessServer")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetailsInternal)this).ProcessServer = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetails[]) content.GetValueForProperty("ProcessServer",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetailsInternal)this).ProcessServer, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProcessServerDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("RcmProxy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetailsInternal)this).RcmProxy = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetails[]) content.GetValueForProperty("RcmProxy",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetailsInternal)this).RcmProxy, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RcmProxyDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("PushInstaller")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetailsInternal)this).PushInstaller = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPushInstallerDetails[]) content.GetValueForProperty("PushInstaller",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetailsInternal)this).PushInstaller, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PushInstallerDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("ReplicationAgent")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetailsInternal)this).ReplicationAgent = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAgentDetails[]) content.GetValueForProperty("ReplicationAgent",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetailsInternal)this).ReplicationAgent, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationAgentDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("ReprotectAgent")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetailsInternal)this).ReprotectAgent = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetails[]) content.GetValueForProperty("ReprotectAgent",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetailsInternal)this).ReprotectAgent, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReprotectAgentDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("MarsAgent")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetailsInternal)this).MarsAgent = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMarsAgentDetails[]) content.GetValueForProperty("MarsAgent",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetailsInternal)this).MarsAgent, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.MarsAgentDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("Dra")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetailsInternal)this).Dra = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDraDetails[]) content.GetValueForProperty("Dra",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetailsInternal)this).Dra, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DraDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("AgentDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetailsInternal)this).AgentDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAgentDetails[]) content.GetValueForProperty("AgentDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetailsInternal)this).AgentDetail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AgentDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + if (content.Contains("SourceAgentIdentityDetailTenantId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetailsInternal)this).SourceAgentIdentityDetailTenantId = (string) content.GetValueForProperty("SourceAgentIdentityDetailTenantId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetailsInternal)this).SourceAgentIdentityDetailTenantId, global::System.Convert.ToString); + } + if (content.Contains("SourceAgentIdentityDetailApplicationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetailsInternal)this).SourceAgentIdentityDetailApplicationId = (string) content.GetValueForProperty("SourceAgentIdentityDetailApplicationId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetailsInternal)this).SourceAgentIdentityDetailApplicationId, global::System.Convert.ToString); + } + if (content.Contains("SourceAgentIdentityDetailObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetailsInternal)this).SourceAgentIdentityDetailObjectId = (string) content.GetValueForProperty("SourceAgentIdentityDetailObjectId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetailsInternal)this).SourceAgentIdentityDetailObjectId, global::System.Convert.ToString); + } + if (content.Contains("SourceAgentIdentityDetailAudience")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetailsInternal)this).SourceAgentIdentityDetailAudience = (string) content.GetValueForProperty("SourceAgentIdentityDetailAudience",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetailsInternal)this).SourceAgentIdentityDetailAudience, global::System.Convert.ToString); + } + if (content.Contains("SourceAgentIdentityDetailAadAuthority")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetailsInternal)this).SourceAgentIdentityDetailAadAuthority = (string) content.GetValueForProperty("SourceAgentIdentityDetailAadAuthority",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetailsInternal)this).SourceAgentIdentityDetailAadAuthority, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// InMageRcm fabric specific details. + [System.ComponentModel.TypeConverter(typeof(InMageRcmFabricSpecificDetailsTypeConverter))] + public partial interface IInMageRcmFabricSpecificDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFabricSpecificDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFabricSpecificDetails.TypeConverter.cs new file mode 100644 index 000000000000..dc2577a966d8 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFabricSpecificDetails.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InMageRcmFabricSpecificDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InMageRcmFabricSpecificDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InMageRcmFabricSpecificDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InMageRcmFabricSpecificDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFabricSpecificDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFabricSpecificDetails.cs new file mode 100644 index 000000000000..9a027f97eff5 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFabricSpecificDetails.cs @@ -0,0 +1,475 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMageRcm fabric specific details. + public partial class InMageRcmFabricSpecificDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetailsInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificDetails __fabricSpecificDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FabricSpecificDetails(); + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAgentDetails[] _agentDetail; + + /// The list of agent details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAgentDetails[] AgentDetail { get => this._agentDetail; } + + /// Backing field for property. + private string _controlPlaneUri; + + /// The control plane Uri. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ControlPlaneUri { get => this._controlPlaneUri; } + + /// Backing field for property. + private string _dataPlaneUri; + + /// The data plane Uri. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string DataPlaneUri { get => this._dataPlaneUri; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDraDetails[] _dra; + + /// The list of DRAs. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDraDetails[] Dra { get => this._dra; } + + /// Gets the class type. Overridden in derived classes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificDetailsInternal)__fabricSpecificDetails).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificDetailsInternal)__fabricSpecificDetails).InstanceType = value ; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMarsAgentDetails[] _marsAgent; + + /// The list of Mars agents. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMarsAgentDetails[] MarsAgent { get => this._marsAgent; } + + /// Internal Acessors for AgentDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAgentDetails[] Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetailsInternal.AgentDetail { get => this._agentDetail; set { {_agentDetail = value;} } } + + /// Internal Acessors for ControlPlaneUri + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetailsInternal.ControlPlaneUri { get => this._controlPlaneUri; set { {_controlPlaneUri = value;} } } + + /// Internal Acessors for DataPlaneUri + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetailsInternal.DataPlaneUri { get => this._dataPlaneUri; set { {_dataPlaneUri = value;} } } + + /// Internal Acessors for Dra + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDraDetails[] Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetailsInternal.Dra { get => this._dra; set { {_dra = value;} } } + + /// Internal Acessors for MarsAgent + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMarsAgentDetails[] Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetailsInternal.MarsAgent { get => this._marsAgent; set { {_marsAgent = value;} } } + + /// Internal Acessors for PhysicalSiteId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetailsInternal.PhysicalSiteId { get => this._physicalSiteId; set { {_physicalSiteId = value;} } } + + /// Internal Acessors for ProcessServer + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetails[] Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetailsInternal.ProcessServer { get => this._processServer; set { {_processServer = value;} } } + + /// Internal Acessors for PushInstaller + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPushInstallerDetails[] Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetailsInternal.PushInstaller { get => this._pushInstaller; set { {_pushInstaller = value;} } } + + /// Internal Acessors for RcmProxy + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetails[] Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetailsInternal.RcmProxy { get => this._rcmProxy; set { {_rcmProxy = value;} } } + + /// Internal Acessors for ReplicationAgent + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAgentDetails[] Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetailsInternal.ReplicationAgent { get => this._replicationAgent; set { {_replicationAgent = value;} } } + + /// Internal Acessors for ReprotectAgent + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetails[] Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetailsInternal.ReprotectAgent { get => this._reprotectAgent; set { {_reprotectAgent = value;} } } + + /// Internal Acessors for ServiceContainerId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetailsInternal.ServiceContainerId { get => this._serviceContainerId; set { {_serviceContainerId = value;} } } + + /// Internal Acessors for ServiceEndpoint + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetailsInternal.ServiceEndpoint { get => this._serviceEndpoint; set { {_serviceEndpoint = value;} } } + + /// Internal Acessors for ServiceResourceId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetailsInternal.ServiceResourceId { get => this._serviceResourceId; set { {_serviceResourceId = value;} } } + + /// Internal Acessors for SourceAgentIdentityDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetails Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetailsInternal.SourceAgentIdentityDetail { get => (this._sourceAgentIdentityDetail = this._sourceAgentIdentityDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IdentityProviderDetails()); set { {_sourceAgentIdentityDetail = value;} } } + + /// Internal Acessors for VmwareSiteId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetailsInternal.VmwareSiteId { get => this._vmwareSiteId; set { {_vmwareSiteId = value;} } } + + /// Backing field for property. + private string _physicalSiteId; + + /// The ARM Id of the physical site. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string PhysicalSiteId { get => this._physicalSiteId; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetails[] _processServer; + + /// The list of process servers. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetails[] ProcessServer { get => this._processServer; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPushInstallerDetails[] _pushInstaller; + + /// The list of push installers. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPushInstallerDetails[] PushInstaller { get => this._pushInstaller; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetails[] _rcmProxy; + + /// The list of RCM proxies. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetails[] RcmProxy { get => this._rcmProxy; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAgentDetails[] _replicationAgent; + + /// The list of replication agents. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAgentDetails[] ReplicationAgent { get => this._replicationAgent; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetails[] _reprotectAgent; + + /// The list of reprotect agents. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetails[] ReprotectAgent { get => this._reprotectAgent; } + + /// Backing field for property. + private string _serviceContainerId; + + /// The service container Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ServiceContainerId { get => this._serviceContainerId; } + + /// Backing field for property. + private string _serviceEndpoint; + + /// The service endpoint. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ServiceEndpoint { get => this._serviceEndpoint; } + + /// Backing field for property. + private string _serviceResourceId; + + /// The service resource Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ServiceResourceId { get => this._serviceResourceId; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetails _sourceAgentIdentityDetail; + + /// The source agent identity details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetails SourceAgentIdentityDetail { get => (this._sourceAgentIdentityDetail = this._sourceAgentIdentityDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IdentityProviderDetails()); set => this._sourceAgentIdentityDetail = value; } + + /// The base authority for Azure Active Directory authentication. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string SourceAgentIdentityDetailAadAuthority { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetailsInternal)SourceAgentIdentityDetail).AadAuthority; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetailsInternal)SourceAgentIdentityDetail).AadAuthority = value ?? null; } + + /// + /// The application/client Id for the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string SourceAgentIdentityDetailApplicationId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetailsInternal)SourceAgentIdentityDetail).ApplicationId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetailsInternal)SourceAgentIdentityDetail).ApplicationId = value ?? null; } + + /// + /// The intended Audience of the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string SourceAgentIdentityDetailAudience { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetailsInternal)SourceAgentIdentityDetail).Audience; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetailsInternal)SourceAgentIdentityDetail).Audience = value ?? null; } + + /// + /// The object Id of the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string SourceAgentIdentityDetailObjectId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetailsInternal)SourceAgentIdentityDetail).ObjectId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetailsInternal)SourceAgentIdentityDetail).ObjectId = value ?? null; } + + /// + /// The tenant Id for the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string SourceAgentIdentityDetailTenantId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetailsInternal)SourceAgentIdentityDetail).TenantId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetailsInternal)SourceAgentIdentityDetail).TenantId = value ?? null; } + + /// Backing field for property. + private string _vmwareSiteId; + + /// The ARM Id of the VMware site. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string VmwareSiteId { get => this._vmwareSiteId; } + + /// Creates an new instance. + public InMageRcmFabricSpecificDetails() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__fabricSpecificDetails), __fabricSpecificDetails); + await eventListener.AssertObjectIsValid(nameof(__fabricSpecificDetails), __fabricSpecificDetails); + } + } + /// InMageRcm fabric specific details. + public partial interface IInMageRcmFabricSpecificDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificDetails + { + /// The list of agent details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The list of agent details.", + SerializedName = @"agentDetails", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAgentDetails) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAgentDetails[] AgentDetail { get; } + /// The control plane Uri. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The control plane Uri.", + SerializedName = @"controlPlaneUri", + PossibleTypes = new [] { typeof(string) })] + string ControlPlaneUri { get; } + /// The data plane Uri. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The data plane Uri.", + SerializedName = @"dataPlaneUri", + PossibleTypes = new [] { typeof(string) })] + string DataPlaneUri { get; } + /// The list of DRAs. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The list of DRAs.", + SerializedName = @"dras", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDraDetails) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDraDetails[] Dra { get; } + /// The list of Mars agents. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The list of Mars agents.", + SerializedName = @"marsAgents", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMarsAgentDetails) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMarsAgentDetails[] MarsAgent { get; } + /// The ARM Id of the physical site. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The ARM Id of the physical site.", + SerializedName = @"physicalSiteId", + PossibleTypes = new [] { typeof(string) })] + string PhysicalSiteId { get; } + /// The list of process servers. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The list of process servers.", + SerializedName = @"processServers", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetails) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetails[] ProcessServer { get; } + /// The list of push installers. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The list of push installers.", + SerializedName = @"pushInstallers", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPushInstallerDetails) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPushInstallerDetails[] PushInstaller { get; } + /// The list of RCM proxies. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The list of RCM proxies.", + SerializedName = @"rcmProxies", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetails) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetails[] RcmProxy { get; } + /// The list of replication agents. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The list of replication agents.", + SerializedName = @"replicationAgents", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAgentDetails) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAgentDetails[] ReplicationAgent { get; } + /// The list of reprotect agents. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The list of reprotect agents.", + SerializedName = @"reprotectAgents", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetails) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetails[] ReprotectAgent { get; } + /// The service container Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The service container Id.", + SerializedName = @"serviceContainerId", + PossibleTypes = new [] { typeof(string) })] + string ServiceContainerId { get; } + /// The service endpoint. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The service endpoint.", + SerializedName = @"serviceEndpoint", + PossibleTypes = new [] { typeof(string) })] + string ServiceEndpoint { get; } + /// The service resource Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The service resource Id.", + SerializedName = @"serviceResourceId", + PossibleTypes = new [] { typeof(string) })] + string ServiceResourceId { get; } + /// The base authority for Azure Active Directory authentication. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The base authority for Azure Active Directory authentication.", + SerializedName = @"aadAuthority", + PossibleTypes = new [] { typeof(string) })] + string SourceAgentIdentityDetailAadAuthority { get; set; } + /// + /// The application/client Id for the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The application/client Id for the service principal with which the on-premise management/data plane components would communicate with our Azure services.", + SerializedName = @"applicationId", + PossibleTypes = new [] { typeof(string) })] + string SourceAgentIdentityDetailApplicationId { get; set; } + /// + /// The intended Audience of the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The intended Audience of the service principal with which the on-premise management/data plane components would communicate with our Azure services.", + SerializedName = @"audience", + PossibleTypes = new [] { typeof(string) })] + string SourceAgentIdentityDetailAudience { get; set; } + /// + /// The object Id of the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The object Id of the service principal with which the on-premise management/data plane components would communicate with our Azure services.", + SerializedName = @"objectId", + PossibleTypes = new [] { typeof(string) })] + string SourceAgentIdentityDetailObjectId { get; set; } + /// + /// The tenant Id for the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The tenant Id for the service principal with which the on-premise management/data plane components would communicate with our Azure services.", + SerializedName = @"tenantId", + PossibleTypes = new [] { typeof(string) })] + string SourceAgentIdentityDetailTenantId { get; set; } + /// The ARM Id of the VMware site. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The ARM Id of the VMware site.", + SerializedName = @"vmwareSiteId", + PossibleTypes = new [] { typeof(string) })] + string VmwareSiteId { get; } + + } + /// InMageRcm fabric specific details. + internal partial interface IInMageRcmFabricSpecificDetailsInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificDetailsInternal + { + /// The list of agent details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAgentDetails[] AgentDetail { get; set; } + /// The control plane Uri. + string ControlPlaneUri { get; set; } + /// The data plane Uri. + string DataPlaneUri { get; set; } + /// The list of DRAs. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDraDetails[] Dra { get; set; } + /// The list of Mars agents. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMarsAgentDetails[] MarsAgent { get; set; } + /// The ARM Id of the physical site. + string PhysicalSiteId { get; set; } + /// The list of process servers. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetails[] ProcessServer { get; set; } + /// The list of push installers. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPushInstallerDetails[] PushInstaller { get; set; } + /// The list of RCM proxies. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetails[] RcmProxy { get; set; } + /// The list of replication agents. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAgentDetails[] ReplicationAgent { get; set; } + /// The list of reprotect agents. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetails[] ReprotectAgent { get; set; } + /// The service container Id. + string ServiceContainerId { get; set; } + /// The service endpoint. + string ServiceEndpoint { get; set; } + /// The service resource Id. + string ServiceResourceId { get; set; } + /// The source agent identity details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetails SourceAgentIdentityDetail { get; set; } + /// The base authority for Azure Active Directory authentication. + string SourceAgentIdentityDetailAadAuthority { get; set; } + /// + /// The application/client Id for the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + string SourceAgentIdentityDetailApplicationId { get; set; } + /// + /// The intended Audience of the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + string SourceAgentIdentityDetailAudience { get; set; } + /// + /// The object Id of the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + string SourceAgentIdentityDetailObjectId { get; set; } + /// + /// The tenant Id for the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + string SourceAgentIdentityDetailTenantId { get; set; } + /// The ARM Id of the VMware site. + string VmwareSiteId { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFabricSpecificDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFabricSpecificDetails.json.cs new file mode 100644 index 000000000000..97f0e9dce10a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFabricSpecificDetails.json.cs @@ -0,0 +1,249 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMageRcm fabric specific details. + public partial class InMageRcmFabricSpecificDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSpecificDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new InMageRcmFabricSpecificDetails(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal InMageRcmFabricSpecificDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __fabricSpecificDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FabricSpecificDetails(json); + {_sourceAgentIdentityDetail = If( json?.PropertyT("sourceAgentIdentityDetails"), out var __jsonSourceAgentIdentityDetails) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IdentityProviderDetails.FromJson(__jsonSourceAgentIdentityDetails) : SourceAgentIdentityDetail;} + {_vmwareSiteId = If( json?.PropertyT("vmwareSiteId"), out var __jsonVmwareSiteId) ? (string)__jsonVmwareSiteId : (string)VmwareSiteId;} + {_physicalSiteId = If( json?.PropertyT("physicalSiteId"), out var __jsonPhysicalSiteId) ? (string)__jsonPhysicalSiteId : (string)PhysicalSiteId;} + {_serviceEndpoint = If( json?.PropertyT("serviceEndpoint"), out var __jsonServiceEndpoint) ? (string)__jsonServiceEndpoint : (string)ServiceEndpoint;} + {_serviceResourceId = If( json?.PropertyT("serviceResourceId"), out var __jsonServiceResourceId) ? (string)__jsonServiceResourceId : (string)ServiceResourceId;} + {_serviceContainerId = If( json?.PropertyT("serviceContainerId"), out var __jsonServiceContainerId) ? (string)__jsonServiceContainerId : (string)ServiceContainerId;} + {_dataPlaneUri = If( json?.PropertyT("dataPlaneUri"), out var __jsonDataPlaneUri) ? (string)__jsonDataPlaneUri : (string)DataPlaneUri;} + {_controlPlaneUri = If( json?.PropertyT("controlPlaneUri"), out var __jsonControlPlaneUri) ? (string)__jsonControlPlaneUri : (string)ControlPlaneUri;} + {_processServer = If( json?.PropertyT("processServers"), out var __jsonProcessServers) ? If( __jsonProcessServers as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetails) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProcessServerDetails.FromJson(__u) )) ))() : null : ProcessServer;} + {_rcmProxy = If( json?.PropertyT("rcmProxies"), out var __jsonRcmProxies) ? If( __jsonRcmProxies as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __q) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__q, (__p)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetails) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RcmProxyDetails.FromJson(__p) )) ))() : null : RcmProxy;} + {_pushInstaller = If( json?.PropertyT("pushInstallers"), out var __jsonPushInstallers) ? If( __jsonPushInstallers as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __l) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__l, (__k)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPushInstallerDetails) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PushInstallerDetails.FromJson(__k) )) ))() : null : PushInstaller;} + {_replicationAgent = If( json?.PropertyT("replicationAgents"), out var __jsonReplicationAgents) ? If( __jsonReplicationAgents as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __g) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__g, (__f)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAgentDetails) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationAgentDetails.FromJson(__f) )) ))() : null : ReplicationAgent;} + {_reprotectAgent = If( json?.PropertyT("reprotectAgents"), out var __jsonReprotectAgents) ? If( __jsonReprotectAgents as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __b) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__b, (__a)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetails) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReprotectAgentDetails.FromJson(__a) )) ))() : null : ReprotectAgent;} + {_marsAgent = If( json?.PropertyT("marsAgents"), out var __jsonMarsAgents) ? If( __jsonMarsAgents as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var ___w) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(___w, (___v)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMarsAgentDetails) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.MarsAgentDetails.FromJson(___v) )) ))() : null : MarsAgent;} + {_dra = If( json?.PropertyT("dras"), out var __jsonDras) ? If( __jsonDras as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var ___r) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(___r, (___q)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDraDetails) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DraDetails.FromJson(___q) )) ))() : null : Dra;} + {_agentDetail = If( json?.PropertyT("agentDetails"), out var __jsonAgentDetails) ? If( __jsonAgentDetails as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var ___m) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(___m, (___l)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAgentDetails) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AgentDetails.FromJson(___l) )) ))() : null : AgentDetail;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __fabricSpecificDetails?.ToJson(container, serializationMode); + AddIf( null != this._sourceAgentIdentityDetail ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._sourceAgentIdentityDetail.ToJson(null,serializationMode) : null, "sourceAgentIdentityDetails" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._vmwareSiteId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._vmwareSiteId.ToString()) : null, "vmwareSiteId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._physicalSiteId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._physicalSiteId.ToString()) : null, "physicalSiteId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._serviceEndpoint)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._serviceEndpoint.ToString()) : null, "serviceEndpoint" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._serviceResourceId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._serviceResourceId.ToString()) : null, "serviceResourceId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._serviceContainerId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._serviceContainerId.ToString()) : null, "serviceContainerId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._dataPlaneUri)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._dataPlaneUri.ToString()) : null, "dataPlaneUri" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._controlPlaneUri)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._controlPlaneUri.ToString()) : null, "controlPlaneUri" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + if (null != this._processServer) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._processServer ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("processServers",__w); + } + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + if (null != this._rcmProxy) + { + var __r = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __s in this._rcmProxy ) + { + AddIf(__s?.ToJson(null, serializationMode) ,__r.Add); + } + container.Add("rcmProxies",__r); + } + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + if (null != this._pushInstaller) + { + var __m = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __n in this._pushInstaller ) + { + AddIf(__n?.ToJson(null, serializationMode) ,__m.Add); + } + container.Add("pushInstallers",__m); + } + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + if (null != this._replicationAgent) + { + var __h = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __i in this._replicationAgent ) + { + AddIf(__i?.ToJson(null, serializationMode) ,__h.Add); + } + container.Add("replicationAgents",__h); + } + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + if (null != this._reprotectAgent) + { + var __c = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __d in this._reprotectAgent ) + { + AddIf(__d?.ToJson(null, serializationMode) ,__c.Add); + } + container.Add("reprotectAgents",__c); + } + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + if (null != this._marsAgent) + { + var ___x = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var ___y in this._marsAgent ) + { + AddIf(___y?.ToJson(null, serializationMode) ,___x.Add); + } + container.Add("marsAgents",___x); + } + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + if (null != this._dra) + { + var ___s = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var ___t in this._dra ) + { + AddIf(___t?.ToJson(null, serializationMode) ,___s.Add); + } + container.Add("dras",___s); + } + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + if (null != this._agentDetail) + { + var ___n = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var ___o in this._agentDetail ) + { + AddIf(___o?.ToJson(null, serializationMode) ,___n.Add); + } + container.Add("agentDetails",___n); + } + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFabricSwitchProviderBlockingErrorDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFabricSwitchProviderBlockingErrorDetails.PowerShell.cs new file mode 100644 index 000000000000..b32fabf0b998 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFabricSwitchProviderBlockingErrorDetails.PowerShell.cs @@ -0,0 +1,189 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// InMageRcmFabric switch provider blocking error details. + [System.ComponentModel.TypeConverter(typeof(InMageRcmFabricSwitchProviderBlockingErrorDetailsTypeConverter))] + public partial class InMageRcmFabricSwitchProviderBlockingErrorDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSwitchProviderBlockingErrorDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InMageRcmFabricSwitchProviderBlockingErrorDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSwitchProviderBlockingErrorDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InMageRcmFabricSwitchProviderBlockingErrorDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content + /// from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSwitchProviderBlockingErrorDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InMageRcmFabricSwitchProviderBlockingErrorDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ErrorCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSwitchProviderBlockingErrorDetailsInternal)this).ErrorCode = (string) content.GetValueForProperty("ErrorCode",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSwitchProviderBlockingErrorDetailsInternal)this).ErrorCode, global::System.Convert.ToString); + } + if (content.Contains("ErrorMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSwitchProviderBlockingErrorDetailsInternal)this).ErrorMessage = (string) content.GetValueForProperty("ErrorMessage",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSwitchProviderBlockingErrorDetailsInternal)this).ErrorMessage, global::System.Convert.ToString); + } + if (content.Contains("PossibleCaus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSwitchProviderBlockingErrorDetailsInternal)this).PossibleCaus = (string) content.GetValueForProperty("PossibleCaus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSwitchProviderBlockingErrorDetailsInternal)this).PossibleCaus, global::System.Convert.ToString); + } + if (content.Contains("RecommendedAction")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSwitchProviderBlockingErrorDetailsInternal)this).RecommendedAction = (string) content.GetValueForProperty("RecommendedAction",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSwitchProviderBlockingErrorDetailsInternal)this).RecommendedAction, global::System.Convert.ToString); + } + if (content.Contains("ErrorMessageParameter")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSwitchProviderBlockingErrorDetailsInternal)this).ErrorMessageParameter = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters) content.GetValueForProperty("ErrorMessageParameter",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSwitchProviderBlockingErrorDetailsInternal)this).ErrorMessageParameter, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmFabricSwitchProviderBlockingErrorDetailsErrorMessageParametersTypeConverter.ConvertFrom); + } + if (content.Contains("ErrorTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSwitchProviderBlockingErrorDetailsInternal)this).ErrorTag = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSwitchProviderBlockingErrorDetailsErrorTags) content.GetValueForProperty("ErrorTag",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSwitchProviderBlockingErrorDetailsInternal)this).ErrorTag, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmFabricSwitchProviderBlockingErrorDetailsErrorTagsTypeConverter.ConvertFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InMageRcmFabricSwitchProviderBlockingErrorDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ErrorCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSwitchProviderBlockingErrorDetailsInternal)this).ErrorCode = (string) content.GetValueForProperty("ErrorCode",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSwitchProviderBlockingErrorDetailsInternal)this).ErrorCode, global::System.Convert.ToString); + } + if (content.Contains("ErrorMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSwitchProviderBlockingErrorDetailsInternal)this).ErrorMessage = (string) content.GetValueForProperty("ErrorMessage",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSwitchProviderBlockingErrorDetailsInternal)this).ErrorMessage, global::System.Convert.ToString); + } + if (content.Contains("PossibleCaus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSwitchProviderBlockingErrorDetailsInternal)this).PossibleCaus = (string) content.GetValueForProperty("PossibleCaus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSwitchProviderBlockingErrorDetailsInternal)this).PossibleCaus, global::System.Convert.ToString); + } + if (content.Contains("RecommendedAction")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSwitchProviderBlockingErrorDetailsInternal)this).RecommendedAction = (string) content.GetValueForProperty("RecommendedAction",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSwitchProviderBlockingErrorDetailsInternal)this).RecommendedAction, global::System.Convert.ToString); + } + if (content.Contains("ErrorMessageParameter")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSwitchProviderBlockingErrorDetailsInternal)this).ErrorMessageParameter = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters) content.GetValueForProperty("ErrorMessageParameter",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSwitchProviderBlockingErrorDetailsInternal)this).ErrorMessageParameter, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmFabricSwitchProviderBlockingErrorDetailsErrorMessageParametersTypeConverter.ConvertFrom); + } + if (content.Contains("ErrorTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSwitchProviderBlockingErrorDetailsInternal)this).ErrorTag = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSwitchProviderBlockingErrorDetailsErrorTags) content.GetValueForProperty("ErrorTag",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSwitchProviderBlockingErrorDetailsInternal)this).ErrorTag, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmFabricSwitchProviderBlockingErrorDetailsErrorTagsTypeConverter.ConvertFrom); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// InMageRcmFabric switch provider blocking error details. + [System.ComponentModel.TypeConverter(typeof(InMageRcmFabricSwitchProviderBlockingErrorDetailsTypeConverter))] + public partial interface IInMageRcmFabricSwitchProviderBlockingErrorDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFabricSwitchProviderBlockingErrorDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFabricSwitchProviderBlockingErrorDetails.TypeConverter.cs new file mode 100644 index 000000000000..da0420333356 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFabricSwitchProviderBlockingErrorDetails.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InMageRcmFabricSwitchProviderBlockingErrorDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, + /// otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSwitchProviderBlockingErrorDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSwitchProviderBlockingErrorDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InMageRcmFabricSwitchProviderBlockingErrorDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InMageRcmFabricSwitchProviderBlockingErrorDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InMageRcmFabricSwitchProviderBlockingErrorDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFabricSwitchProviderBlockingErrorDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFabricSwitchProviderBlockingErrorDetails.cs new file mode 100644 index 000000000000..2c65aa7b3697 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFabricSwitchProviderBlockingErrorDetails.cs @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMageRcmFabric switch provider blocking error details. + public partial class InMageRcmFabricSwitchProviderBlockingErrorDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSwitchProviderBlockingErrorDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSwitchProviderBlockingErrorDetailsInternal + { + + /// Backing field for property. + private string _errorCode; + + /// The error code. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ErrorCode { get => this._errorCode; } + + /// Backing field for property. + private string _errorMessage; + + /// The error message. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ErrorMessage { get => this._errorMessage; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters _errorMessageParameter; + + /// The error message parameters. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters ErrorMessageParameter { get => (this._errorMessageParameter = this._errorMessageParameter ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters()); } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSwitchProviderBlockingErrorDetailsErrorTags _errorTag; + + /// The error tags. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSwitchProviderBlockingErrorDetailsErrorTags ErrorTag { get => (this._errorTag = this._errorTag ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmFabricSwitchProviderBlockingErrorDetailsErrorTags()); } + + /// Internal Acessors for ErrorCode + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSwitchProviderBlockingErrorDetailsInternal.ErrorCode { get => this._errorCode; set { {_errorCode = value;} } } + + /// Internal Acessors for ErrorMessage + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSwitchProviderBlockingErrorDetailsInternal.ErrorMessage { get => this._errorMessage; set { {_errorMessage = value;} } } + + /// Internal Acessors for ErrorMessageParameter + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSwitchProviderBlockingErrorDetailsInternal.ErrorMessageParameter { get => (this._errorMessageParameter = this._errorMessageParameter ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters()); set { {_errorMessageParameter = value;} } } + + /// Internal Acessors for ErrorTag + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSwitchProviderBlockingErrorDetailsErrorTags Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSwitchProviderBlockingErrorDetailsInternal.ErrorTag { get => (this._errorTag = this._errorTag ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmFabricSwitchProviderBlockingErrorDetailsErrorTags()); set { {_errorTag = value;} } } + + /// Internal Acessors for PossibleCaus + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSwitchProviderBlockingErrorDetailsInternal.PossibleCaus { get => this._possibleCaus; set { {_possibleCaus = value;} } } + + /// Internal Acessors for RecommendedAction + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSwitchProviderBlockingErrorDetailsInternal.RecommendedAction { get => this._recommendedAction; set { {_recommendedAction = value;} } } + + /// Backing field for property. + private string _possibleCaus; + + /// The possible causes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string PossibleCaus { get => this._possibleCaus; } + + /// Backing field for property. + private string _recommendedAction; + + /// The recommended action. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecommendedAction { get => this._recommendedAction; } + + /// + /// Creates an new instance. + /// + public InMageRcmFabricSwitchProviderBlockingErrorDetails() + { + + } + } + /// InMageRcmFabric switch provider blocking error details. + public partial interface IInMageRcmFabricSwitchProviderBlockingErrorDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The error code. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The error code.", + SerializedName = @"errorCode", + PossibleTypes = new [] { typeof(string) })] + string ErrorCode { get; } + /// The error message. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The error message.", + SerializedName = @"errorMessage", + PossibleTypes = new [] { typeof(string) })] + string ErrorMessage { get; } + /// The error message parameters. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The error message parameters.", + SerializedName = @"errorMessageParameters", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters ErrorMessageParameter { get; } + /// The error tags. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The error tags.", + SerializedName = @"errorTags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSwitchProviderBlockingErrorDetailsErrorTags) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSwitchProviderBlockingErrorDetailsErrorTags ErrorTag { get; } + /// The possible causes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The possible causes.", + SerializedName = @"possibleCauses", + PossibleTypes = new [] { typeof(string) })] + string PossibleCaus { get; } + /// The recommended action. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The recommended action.", + SerializedName = @"recommendedAction", + PossibleTypes = new [] { typeof(string) })] + string RecommendedAction { get; } + + } + /// InMageRcmFabric switch provider blocking error details. + internal partial interface IInMageRcmFabricSwitchProviderBlockingErrorDetailsInternal + + { + /// The error code. + string ErrorCode { get; set; } + /// The error message. + string ErrorMessage { get; set; } + /// The error message parameters. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters ErrorMessageParameter { get; set; } + /// The error tags. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSwitchProviderBlockingErrorDetailsErrorTags ErrorTag { get; set; } + /// The possible causes. + string PossibleCaus { get; set; } + /// The recommended action. + string RecommendedAction { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFabricSwitchProviderBlockingErrorDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFabricSwitchProviderBlockingErrorDetails.json.cs new file mode 100644 index 000000000000..3edf8dea8e24 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFabricSwitchProviderBlockingErrorDetails.json.cs @@ -0,0 +1,139 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMageRcmFabric switch provider blocking error details. + public partial class InMageRcmFabricSwitchProviderBlockingErrorDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSwitchProviderBlockingErrorDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSwitchProviderBlockingErrorDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSwitchProviderBlockingErrorDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new InMageRcmFabricSwitchProviderBlockingErrorDetails(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal InMageRcmFabricSwitchProviderBlockingErrorDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_errorCode = If( json?.PropertyT("errorCode"), out var __jsonErrorCode) ? (string)__jsonErrorCode : (string)ErrorCode;} + {_errorMessage = If( json?.PropertyT("errorMessage"), out var __jsonErrorMessage) ? (string)__jsonErrorMessage : (string)ErrorMessage;} + {_possibleCaus = If( json?.PropertyT("possibleCauses"), out var __jsonPossibleCauses) ? (string)__jsonPossibleCauses : (string)PossibleCaus;} + {_recommendedAction = If( json?.PropertyT("recommendedAction"), out var __jsonRecommendedAction) ? (string)__jsonRecommendedAction : (string)RecommendedAction;} + {_errorMessageParameter = If( json?.PropertyT("errorMessageParameters"), out var __jsonErrorMessageParameters) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters.FromJson(__jsonErrorMessageParameters) : ErrorMessageParameter;} + {_errorTag = If( json?.PropertyT("errorTags"), out var __jsonErrorTags) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmFabricSwitchProviderBlockingErrorDetailsErrorTags.FromJson(__jsonErrorTags) : ErrorTag;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._errorCode)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._errorCode.ToString()) : null, "errorCode" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._errorMessage)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._errorMessage.ToString()) : null, "errorMessage" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._possibleCaus)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._possibleCaus.ToString()) : null, "possibleCauses" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._recommendedAction)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recommendedAction.ToString()) : null, "recommendedAction" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._errorMessageParameter ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._errorMessageParameter.ToJson(null,serializationMode) : null, "errorMessageParameters" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._errorTag ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._errorTag.ToJson(null,serializationMode) : null, "errorTags" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters.PowerShell.cs new file mode 100644 index 000000000000..e9effb433b53 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters.PowerShell.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// The error message parameters. + [System.ComponentModel.TypeConverter(typeof(InMageRcmFabricSwitchProviderBlockingErrorDetailsErrorMessageParametersTypeConverter))] + public partial class InMageRcmFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InMageRcmFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InMageRcmFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters(content); + } + + /// + /// Creates a new instance of , deserializing + /// the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InMageRcmFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InMageRcmFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// The error message parameters. + [System.ComponentModel.TypeConverter(typeof(InMageRcmFabricSwitchProviderBlockingErrorDetailsErrorMessageParametersTypeConverter))] + public partial interface IInMageRcmFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters.TypeConverter.cs new file mode 100644 index 000000000000..508f58707e2b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InMageRcmFabricSwitchProviderBlockingErrorDetailsErrorMessageParametersTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null + /// if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null + /// if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InMageRcmFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InMageRcmFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InMageRcmFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters.cs new file mode 100644 index 000000000000..a08d13f8cf61 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The error message parameters. + public partial class InMageRcmFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSwitchProviderBlockingErrorDetailsErrorMessageParametersInternal + { + + /// + /// Creates an new instance. + /// + public InMageRcmFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters() + { + + } + } + /// The error message parameters. + public partial interface IInMageRcmFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray + { + + } + /// The error message parameters. + internal partial interface IInMageRcmFabricSwitchProviderBlockingErrorDetailsErrorMessageParametersInternal + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters.dictionary.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters.dictionary.cs new file mode 100644 index 000000000000..18906bc8e413 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters.dictionary.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + public partial class InMageRcmFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray + { + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + + int Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Values { get => __additionalProperties.Values; } + + public string this[global::System.String index] { get => __additionalProperties[index]; set => __additionalProperties[index] = value; } + + /// + /// + public void Add(global::System.String key, string value) => __additionalProperties.Add( key, value); + + public void Clear() => __additionalProperties.Clear(); + + /// + public bool ContainsKey(global::System.String key) => __additionalProperties.ContainsKey( key); + + /// + public void CopyFrom(global::System.Collections.IDictionary source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public void CopyFrom(global::System.Management.Automation.PSObject source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public bool Remove(global::System.String key) => __additionalProperties.Remove( key); + + /// + /// + public bool TryGetValue(global::System.String key, out string value) => __additionalProperties.TryGetValue( key, out value); + + /// + + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters source) => source.__additionalProperties; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters.json.cs new file mode 100644 index 000000000000..e56ba0b658f6 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The error message parameters. + public partial class InMageRcmFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new InMageRcmFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + /// + internal InMageRcmFabricSwitchProviderBlockingErrorDetailsErrorMessageParameters(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, global::System.Collections.Generic.HashSet exclusions = null) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray)this).AdditionalProperties, null ,exclusions ); + AfterFromJson(json); + } + + /// + /// Serializes this instance of into + /// a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray)this).AdditionalProperties, container); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFabricSwitchProviderBlockingErrorDetailsErrorTags.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFabricSwitchProviderBlockingErrorDetailsErrorTags.PowerShell.cs new file mode 100644 index 000000000000..9928c22bd0e3 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFabricSwitchProviderBlockingErrorDetailsErrorTags.PowerShell.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// The error tags. + [System.ComponentModel.TypeConverter(typeof(InMageRcmFabricSwitchProviderBlockingErrorDetailsErrorTagsTypeConverter))] + public partial class InMageRcmFabricSwitchProviderBlockingErrorDetailsErrorTags + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSwitchProviderBlockingErrorDetailsErrorTags DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InMageRcmFabricSwitchProviderBlockingErrorDetailsErrorTags(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSwitchProviderBlockingErrorDetailsErrorTags DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InMageRcmFabricSwitchProviderBlockingErrorDetailsErrorTags(content); + } + + /// + /// Creates a new instance of , deserializing the + /// content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSwitchProviderBlockingErrorDetailsErrorTags FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InMageRcmFabricSwitchProviderBlockingErrorDetailsErrorTags(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InMageRcmFabricSwitchProviderBlockingErrorDetailsErrorTags(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// The error tags. + [System.ComponentModel.TypeConverter(typeof(InMageRcmFabricSwitchProviderBlockingErrorDetailsErrorTagsTypeConverter))] + public partial interface IInMageRcmFabricSwitchProviderBlockingErrorDetailsErrorTags + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFabricSwitchProviderBlockingErrorDetailsErrorTags.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFabricSwitchProviderBlockingErrorDetailsErrorTags.TypeConverter.cs new file mode 100644 index 000000000000..cbfcb98ecfbb --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFabricSwitchProviderBlockingErrorDetailsErrorTags.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InMageRcmFabricSwitchProviderBlockingErrorDetailsErrorTagsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no + /// suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no + /// suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSwitchProviderBlockingErrorDetailsErrorTags ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSwitchProviderBlockingErrorDetailsErrorTags).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InMageRcmFabricSwitchProviderBlockingErrorDetailsErrorTags.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InMageRcmFabricSwitchProviderBlockingErrorDetailsErrorTags.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InMageRcmFabricSwitchProviderBlockingErrorDetailsErrorTags.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFabricSwitchProviderBlockingErrorDetailsErrorTags.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFabricSwitchProviderBlockingErrorDetailsErrorTags.cs new file mode 100644 index 000000000000..1e137d3c930c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFabricSwitchProviderBlockingErrorDetailsErrorTags.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The error tags. + public partial class InMageRcmFabricSwitchProviderBlockingErrorDetailsErrorTags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSwitchProviderBlockingErrorDetailsErrorTags, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSwitchProviderBlockingErrorDetailsErrorTagsInternal + { + + /// + /// Creates an new instance. + /// + public InMageRcmFabricSwitchProviderBlockingErrorDetailsErrorTags() + { + + } + } + /// The error tags. + public partial interface IInMageRcmFabricSwitchProviderBlockingErrorDetailsErrorTags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray + { + + } + /// The error tags. + internal partial interface IInMageRcmFabricSwitchProviderBlockingErrorDetailsErrorTagsInternal + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFabricSwitchProviderBlockingErrorDetailsErrorTags.dictionary.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFabricSwitchProviderBlockingErrorDetailsErrorTags.dictionary.cs new file mode 100644 index 000000000000..8fc36ac849fa --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFabricSwitchProviderBlockingErrorDetailsErrorTags.dictionary.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + public partial class InMageRcmFabricSwitchProviderBlockingErrorDetailsErrorTags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray + { + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + + int Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Values { get => __additionalProperties.Values; } + + public string this[global::System.String index] { get => __additionalProperties[index]; set => __additionalProperties[index] = value; } + + /// + /// + public void Add(global::System.String key, string value) => __additionalProperties.Add( key, value); + + public void Clear() => __additionalProperties.Clear(); + + /// + public bool ContainsKey(global::System.String key) => __additionalProperties.ContainsKey( key); + + /// + public void CopyFrom(global::System.Collections.IDictionary source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public void CopyFrom(global::System.Management.Automation.PSObject source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public bool Remove(global::System.String key) => __additionalProperties.Remove( key); + + /// + /// + public bool TryGetValue(global::System.String key, out string value) => __additionalProperties.TryGetValue( key, out value); + + /// + + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmFabricSwitchProviderBlockingErrorDetailsErrorTags source) => source.__additionalProperties; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFabricSwitchProviderBlockingErrorDetailsErrorTags.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFabricSwitchProviderBlockingErrorDetailsErrorTags.json.cs new file mode 100644 index 000000000000..0147b249383c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFabricSwitchProviderBlockingErrorDetailsErrorTags.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The error tags. + public partial class InMageRcmFabricSwitchProviderBlockingErrorDetailsErrorTags + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSwitchProviderBlockingErrorDetailsErrorTags. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSwitchProviderBlockingErrorDetailsErrorTags. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFabricSwitchProviderBlockingErrorDetailsErrorTags FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new InMageRcmFabricSwitchProviderBlockingErrorDetailsErrorTags(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + /// + internal InMageRcmFabricSwitchProviderBlockingErrorDetailsErrorTags(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, global::System.Collections.Generic.HashSet exclusions = null) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray)this).AdditionalProperties, null ,exclusions ); + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray)this).AdditionalProperties, container); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackDiscoveredProtectedVMDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackDiscoveredProtectedVMDetails.PowerShell.cs new file mode 100644 index 000000000000..81b0a8c10dc2 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackDiscoveredProtectedVMDetails.PowerShell.cs @@ -0,0 +1,237 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// InMageRcmFailback discovered VM details. + [System.ComponentModel.TypeConverter(typeof(InMageRcmFailbackDiscoveredProtectedVMDetailsTypeConverter))] + public partial class InMageRcmFailbackDiscoveredProtectedVMDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InMageRcmFailbackDiscoveredProtectedVMDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InMageRcmFailbackDiscoveredProtectedVMDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from + /// a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InMageRcmFailbackDiscoveredProtectedVMDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("VCenterId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetailsInternal)this).VCenterId = (string) content.GetValueForProperty("VCenterId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetailsInternal)this).VCenterId, global::System.Convert.ToString); + } + if (content.Contains("VCenterFqdn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetailsInternal)this).VCenterFqdn = (string) content.GetValueForProperty("VCenterFqdn",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetailsInternal)this).VCenterFqdn, global::System.Convert.ToString); + } + if (content.Contains("Datastore")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetailsInternal)this).Datastore = (string[]) content.GetValueForProperty("Datastore",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetailsInternal)this).Datastore, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("IPAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetailsInternal)this).IPAddress = (string[]) content.GetValueForProperty("IPAddress",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetailsInternal)this).IPAddress, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("VmwareToolsStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetailsInternal)this).VmwareToolsStatus = (string) content.GetValueForProperty("VmwareToolsStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetailsInternal)this).VmwareToolsStatus, global::System.Convert.ToString); + } + if (content.Contains("PowerStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetailsInternal)this).PowerStatus = (string) content.GetValueForProperty("PowerStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetailsInternal)this).PowerStatus, global::System.Convert.ToString); + } + if (content.Contains("VMFqdn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetailsInternal)this).VMFqdn = (string) content.GetValueForProperty("VMFqdn",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetailsInternal)this).VMFqdn, global::System.Convert.ToString); + } + if (content.Contains("OSName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetailsInternal)this).OSName = (string) content.GetValueForProperty("OSName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetailsInternal)this).OSName, global::System.Convert.ToString); + } + if (content.Contains("CreatedTimestamp")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetailsInternal)this).CreatedTimestamp = (global::System.DateTime?) content.GetValueForProperty("CreatedTimestamp",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetailsInternal)this).CreatedTimestamp, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("UpdatedTimestamp")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetailsInternal)this).UpdatedTimestamp = (global::System.DateTime?) content.GetValueForProperty("UpdatedTimestamp",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetailsInternal)this).UpdatedTimestamp, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("IsDeleted")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetailsInternal)this).IsDeleted = (bool?) content.GetValueForProperty("IsDeleted",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetailsInternal)this).IsDeleted, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("LastDiscoveryTimeInUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetailsInternal)this).LastDiscoveryTimeInUtc = (global::System.DateTime?) content.GetValueForProperty("LastDiscoveryTimeInUtc",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetailsInternal)this).LastDiscoveryTimeInUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InMageRcmFailbackDiscoveredProtectedVMDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("VCenterId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetailsInternal)this).VCenterId = (string) content.GetValueForProperty("VCenterId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetailsInternal)this).VCenterId, global::System.Convert.ToString); + } + if (content.Contains("VCenterFqdn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetailsInternal)this).VCenterFqdn = (string) content.GetValueForProperty("VCenterFqdn",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetailsInternal)this).VCenterFqdn, global::System.Convert.ToString); + } + if (content.Contains("Datastore")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetailsInternal)this).Datastore = (string[]) content.GetValueForProperty("Datastore",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetailsInternal)this).Datastore, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("IPAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetailsInternal)this).IPAddress = (string[]) content.GetValueForProperty("IPAddress",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetailsInternal)this).IPAddress, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("VmwareToolsStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetailsInternal)this).VmwareToolsStatus = (string) content.GetValueForProperty("VmwareToolsStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetailsInternal)this).VmwareToolsStatus, global::System.Convert.ToString); + } + if (content.Contains("PowerStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetailsInternal)this).PowerStatus = (string) content.GetValueForProperty("PowerStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetailsInternal)this).PowerStatus, global::System.Convert.ToString); + } + if (content.Contains("VMFqdn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetailsInternal)this).VMFqdn = (string) content.GetValueForProperty("VMFqdn",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetailsInternal)this).VMFqdn, global::System.Convert.ToString); + } + if (content.Contains("OSName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetailsInternal)this).OSName = (string) content.GetValueForProperty("OSName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetailsInternal)this).OSName, global::System.Convert.ToString); + } + if (content.Contains("CreatedTimestamp")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetailsInternal)this).CreatedTimestamp = (global::System.DateTime?) content.GetValueForProperty("CreatedTimestamp",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetailsInternal)this).CreatedTimestamp, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("UpdatedTimestamp")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetailsInternal)this).UpdatedTimestamp = (global::System.DateTime?) content.GetValueForProperty("UpdatedTimestamp",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetailsInternal)this).UpdatedTimestamp, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("IsDeleted")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetailsInternal)this).IsDeleted = (bool?) content.GetValueForProperty("IsDeleted",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetailsInternal)this).IsDeleted, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("LastDiscoveryTimeInUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetailsInternal)this).LastDiscoveryTimeInUtc = (global::System.DateTime?) content.GetValueForProperty("LastDiscoveryTimeInUtc",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetailsInternal)this).LastDiscoveryTimeInUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// InMageRcmFailback discovered VM details. + [System.ComponentModel.TypeConverter(typeof(InMageRcmFailbackDiscoveredProtectedVMDetailsTypeConverter))] + public partial interface IInMageRcmFailbackDiscoveredProtectedVMDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackDiscoveredProtectedVMDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackDiscoveredProtectedVMDetails.TypeConverter.cs new file mode 100644 index 000000000000..0bffb1a146b4 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackDiscoveredProtectedVMDetails.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InMageRcmFailbackDiscoveredProtectedVMDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, + /// otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InMageRcmFailbackDiscoveredProtectedVMDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InMageRcmFailbackDiscoveredProtectedVMDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InMageRcmFailbackDiscoveredProtectedVMDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackDiscoveredProtectedVMDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackDiscoveredProtectedVMDetails.cs new file mode 100644 index 000000000000..015a120ed015 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackDiscoveredProtectedVMDetails.cs @@ -0,0 +1,276 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMageRcmFailback discovered VM details. + public partial class InMageRcmFailbackDiscoveredProtectedVMDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetailsInternal + { + + /// Backing field for property. + private global::System.DateTime? _createdTimestamp; + + /// The SDS created timestamp. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public global::System.DateTime? CreatedTimestamp { get => this._createdTimestamp; } + + /// Backing field for property. + private string[] _datastore; + + /// The list of datastores. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string[] Datastore { get => this._datastore; } + + /// Backing field for property. + private string[] _iPAddress; + + /// The list of IP addresses. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string[] IPAddress { get => this._iPAddress; } + + /// Backing field for property. + private bool? _isDeleted; + + /// A value indicating whether the VM is deleted. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public bool? IsDeleted { get => this._isDeleted; } + + /// Backing field for property. + private global::System.DateTime? _lastDiscoveryTimeInUtc; + + /// The last time when SDS information discovered in SRS. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public global::System.DateTime? LastDiscoveryTimeInUtc { get => this._lastDiscoveryTimeInUtc; } + + /// Internal Acessors for CreatedTimestamp + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetailsInternal.CreatedTimestamp { get => this._createdTimestamp; set { {_createdTimestamp = value;} } } + + /// Internal Acessors for Datastore + string[] Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetailsInternal.Datastore { get => this._datastore; set { {_datastore = value;} } } + + /// Internal Acessors for IPAddress + string[] Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetailsInternal.IPAddress { get => this._iPAddress; set { {_iPAddress = value;} } } + + /// Internal Acessors for IsDeleted + bool? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetailsInternal.IsDeleted { get => this._isDeleted; set { {_isDeleted = value;} } } + + /// Internal Acessors for LastDiscoveryTimeInUtc + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetailsInternal.LastDiscoveryTimeInUtc { get => this._lastDiscoveryTimeInUtc; set { {_lastDiscoveryTimeInUtc = value;} } } + + /// Internal Acessors for OSName + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetailsInternal.OSName { get => this._oSName; set { {_oSName = value;} } } + + /// Internal Acessors for PowerStatus + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetailsInternal.PowerStatus { get => this._powerStatus; set { {_powerStatus = value;} } } + + /// Internal Acessors for UpdatedTimestamp + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetailsInternal.UpdatedTimestamp { get => this._updatedTimestamp; set { {_updatedTimestamp = value;} } } + + /// Internal Acessors for VCenterFqdn + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetailsInternal.VCenterFqdn { get => this._vCenterFqdn; set { {_vCenterFqdn = value;} } } + + /// Internal Acessors for VCenterId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetailsInternal.VCenterId { get => this._vCenterId; set { {_vCenterId = value;} } } + + /// Internal Acessors for VMFqdn + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetailsInternal.VMFqdn { get => this._vMFqdn; set { {_vMFqdn = value;} } } + + /// Internal Acessors for VmwareToolsStatus + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetailsInternal.VmwareToolsStatus { get => this._vmwareToolsStatus; set { {_vmwareToolsStatus = value;} } } + + /// Backing field for property. + private string _oSName; + + /// The VM's OS name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string OSName { get => this._oSName; } + + /// Backing field for property. + private string _powerStatus; + + /// The VM power status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string PowerStatus { get => this._powerStatus; } + + /// Backing field for property. + private global::System.DateTime? _updatedTimestamp; + + /// The SDS updated timestamp. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public global::System.DateTime? UpdatedTimestamp { get => this._updatedTimestamp; } + + /// Backing field for property. + private string _vCenterFqdn; + + /// The VCenter fqdn. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string VCenterFqdn { get => this._vCenterFqdn; } + + /// Backing field for property. + private string _vCenterId; + + /// The VCenter Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string VCenterId { get => this._vCenterId; } + + /// Backing field for property. + private string _vMFqdn; + + /// The VM fqdn. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string VMFqdn { get => this._vMFqdn; } + + /// Backing field for property. + private string _vmwareToolsStatus; + + /// The VMware tools status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string VmwareToolsStatus { get => this._vmwareToolsStatus; } + + /// + /// Creates an new instance. + /// + public InMageRcmFailbackDiscoveredProtectedVMDetails() + { + + } + } + /// InMageRcmFailback discovered VM details. + public partial interface IInMageRcmFailbackDiscoveredProtectedVMDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The SDS created timestamp. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The SDS created timestamp.", + SerializedName = @"createdTimestamp", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? CreatedTimestamp { get; } + /// The list of datastores. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The list of datastores.", + SerializedName = @"datastores", + PossibleTypes = new [] { typeof(string) })] + string[] Datastore { get; } + /// The list of IP addresses. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The list of IP addresses.", + SerializedName = @"ipAddresses", + PossibleTypes = new [] { typeof(string) })] + string[] IPAddress { get; } + /// A value indicating whether the VM is deleted. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"A value indicating whether the VM is deleted.", + SerializedName = @"isDeleted", + PossibleTypes = new [] { typeof(bool) })] + bool? IsDeleted { get; } + /// The last time when SDS information discovered in SRS. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The last time when SDS information discovered in SRS.", + SerializedName = @"lastDiscoveryTimeInUtc", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? LastDiscoveryTimeInUtc { get; } + /// The VM's OS name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The VM's OS name.", + SerializedName = @"osName", + PossibleTypes = new [] { typeof(string) })] + string OSName { get; } + /// The VM power status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The VM power status.", + SerializedName = @"powerStatus", + PossibleTypes = new [] { typeof(string) })] + string PowerStatus { get; } + /// The SDS updated timestamp. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The SDS updated timestamp.", + SerializedName = @"updatedTimestamp", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? UpdatedTimestamp { get; } + /// The VCenter fqdn. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The VCenter fqdn.", + SerializedName = @"vCenterFqdn", + PossibleTypes = new [] { typeof(string) })] + string VCenterFqdn { get; } + /// The VCenter Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The VCenter Id.", + SerializedName = @"vCenterId", + PossibleTypes = new [] { typeof(string) })] + string VCenterId { get; } + /// The VM fqdn. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The VM fqdn.", + SerializedName = @"vmFqdn", + PossibleTypes = new [] { typeof(string) })] + string VMFqdn { get; } + /// The VMware tools status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The VMware tools status.", + SerializedName = @"vmwareToolsStatus", + PossibleTypes = new [] { typeof(string) })] + string VmwareToolsStatus { get; } + + } + /// InMageRcmFailback discovered VM details. + internal partial interface IInMageRcmFailbackDiscoveredProtectedVMDetailsInternal + + { + /// The SDS created timestamp. + global::System.DateTime? CreatedTimestamp { get; set; } + /// The list of datastores. + string[] Datastore { get; set; } + /// The list of IP addresses. + string[] IPAddress { get; set; } + /// A value indicating whether the VM is deleted. + bool? IsDeleted { get; set; } + /// The last time when SDS information discovered in SRS. + global::System.DateTime? LastDiscoveryTimeInUtc { get; set; } + /// The VM's OS name. + string OSName { get; set; } + /// The VM power status. + string PowerStatus { get; set; } + /// The SDS updated timestamp. + global::System.DateTime? UpdatedTimestamp { get; set; } + /// The VCenter fqdn. + string VCenterFqdn { get; set; } + /// The VCenter Id. + string VCenterId { get; set; } + /// The VM fqdn. + string VMFqdn { get; set; } + /// The VMware tools status. + string VmwareToolsStatus { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackDiscoveredProtectedVMDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackDiscoveredProtectedVMDetails.json.cs new file mode 100644 index 000000000000..02bab93728bd --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackDiscoveredProtectedVMDetails.json.cs @@ -0,0 +1,185 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMageRcmFailback discovered VM details. + public partial class InMageRcmFailbackDiscoveredProtectedVMDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new InMageRcmFailbackDiscoveredProtectedVMDetails(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal InMageRcmFailbackDiscoveredProtectedVMDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_vCenterId = If( json?.PropertyT("vCenterId"), out var __jsonVCenterId) ? (string)__jsonVCenterId : (string)VCenterId;} + {_vCenterFqdn = If( json?.PropertyT("vCenterFqdn"), out var __jsonVCenterFqdn) ? (string)__jsonVCenterFqdn : (string)VCenterFqdn;} + {_datastore = If( json?.PropertyT("datastores"), out var __jsonDatastores) ? If( __jsonDatastores as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(string) (__u is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : Datastore;} + {_iPAddress = If( json?.PropertyT("ipAddresses"), out var __jsonIPAddresses) ? If( __jsonIPAddresses as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __q) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__q, (__p)=>(string) (__p is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString __o ? (string)(__o.ToString()) : null)) ))() : null : IPAddress;} + {_vmwareToolsStatus = If( json?.PropertyT("vmwareToolsStatus"), out var __jsonVmwareToolsStatus) ? (string)__jsonVmwareToolsStatus : (string)VmwareToolsStatus;} + {_powerStatus = If( json?.PropertyT("powerStatus"), out var __jsonPowerStatus) ? (string)__jsonPowerStatus : (string)PowerStatus;} + {_vMFqdn = If( json?.PropertyT("vmFqdn"), out var __jsonVMFqdn) ? (string)__jsonVMFqdn : (string)VMFqdn;} + {_oSName = If( json?.PropertyT("osName"), out var __jsonOSName) ? (string)__jsonOSName : (string)OSName;} + {_createdTimestamp = If( json?.PropertyT("createdTimestamp"), out var __jsonCreatedTimestamp) ? global::System.DateTime.TryParse((string)__jsonCreatedTimestamp, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonCreatedTimestampValue) ? __jsonCreatedTimestampValue : CreatedTimestamp : CreatedTimestamp;} + {_updatedTimestamp = If( json?.PropertyT("updatedTimestamp"), out var __jsonUpdatedTimestamp) ? global::System.DateTime.TryParse((string)__jsonUpdatedTimestamp, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonUpdatedTimestampValue) ? __jsonUpdatedTimestampValue : UpdatedTimestamp : UpdatedTimestamp;} + {_isDeleted = If( json?.PropertyT("isDeleted"), out var __jsonIsDeleted) ? (bool?)__jsonIsDeleted : IsDeleted;} + {_lastDiscoveryTimeInUtc = If( json?.PropertyT("lastDiscoveryTimeInUtc"), out var __jsonLastDiscoveryTimeInUtc) ? global::System.DateTime.TryParse((string)__jsonLastDiscoveryTimeInUtc, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonLastDiscoveryTimeInUtcValue) ? __jsonLastDiscoveryTimeInUtcValue : LastDiscoveryTimeInUtc : LastDiscoveryTimeInUtc;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._vCenterId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._vCenterId.ToString()) : null, "vCenterId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._vCenterFqdn)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._vCenterFqdn.ToString()) : null, "vCenterFqdn" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + if (null != this._datastore) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._datastore ) + { + AddIf(null != (((object)__x)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(__x.ToString()) : null ,__w.Add); + } + container.Add("datastores",__w); + } + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + if (null != this._iPAddress) + { + var __r = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __s in this._iPAddress ) + { + AddIf(null != (((object)__s)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(__s.ToString()) : null ,__r.Add); + } + container.Add("ipAddresses",__r); + } + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._vmwareToolsStatus)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._vmwareToolsStatus.ToString()) : null, "vmwareToolsStatus" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._powerStatus)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._powerStatus.ToString()) : null, "powerStatus" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._vMFqdn)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._vMFqdn.ToString()) : null, "vmFqdn" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._oSName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._oSName.ToString()) : null, "osName" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._createdTimestamp ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._createdTimestamp?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "createdTimestamp" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._updatedTimestamp ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._updatedTimestamp?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "updatedTimestamp" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._isDeleted ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonBoolean((bool)this._isDeleted) : null, "isDeleted" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._lastDiscoveryTimeInUtc ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._lastDiscoveryTimeInUtc?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "lastDiscoveryTimeInUtc" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackEventDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackEventDetails.PowerShell.cs new file mode 100644 index 000000000000..302607d2c0be --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackEventDetails.PowerShell.cs @@ -0,0 +1,186 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Event details for InMageRcmFailback provider. + [System.ComponentModel.TypeConverter(typeof(InMageRcmFailbackEventDetailsTypeConverter))] + public partial class InMageRcmFailbackEventDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackEventDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InMageRcmFailbackEventDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackEventDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InMageRcmFailbackEventDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackEventDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InMageRcmFailbackEventDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProtectedItemName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackEventDetailsInternal)this).ProtectedItemName = (string) content.GetValueForProperty("ProtectedItemName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackEventDetailsInternal)this).ProtectedItemName, global::System.Convert.ToString); + } + if (content.Contains("VMName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackEventDetailsInternal)this).VMName = (string) content.GetValueForProperty("VMName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackEventDetailsInternal)this).VMName, global::System.Convert.ToString); + } + if (content.Contains("ApplianceName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackEventDetailsInternal)this).ApplianceName = (string) content.GetValueForProperty("ApplianceName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackEventDetailsInternal)this).ApplianceName, global::System.Convert.ToString); + } + if (content.Contains("ServerType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackEventDetailsInternal)this).ServerType = (string) content.GetValueForProperty("ServerType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackEventDetailsInternal)this).ServerType, global::System.Convert.ToString); + } + if (content.Contains("ComponentDisplayName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackEventDetailsInternal)this).ComponentDisplayName = (string) content.GetValueForProperty("ComponentDisplayName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackEventDetailsInternal)this).ComponentDisplayName, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InMageRcmFailbackEventDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProtectedItemName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackEventDetailsInternal)this).ProtectedItemName = (string) content.GetValueForProperty("ProtectedItemName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackEventDetailsInternal)this).ProtectedItemName, global::System.Convert.ToString); + } + if (content.Contains("VMName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackEventDetailsInternal)this).VMName = (string) content.GetValueForProperty("VMName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackEventDetailsInternal)this).VMName, global::System.Convert.ToString); + } + if (content.Contains("ApplianceName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackEventDetailsInternal)this).ApplianceName = (string) content.GetValueForProperty("ApplianceName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackEventDetailsInternal)this).ApplianceName, global::System.Convert.ToString); + } + if (content.Contains("ServerType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackEventDetailsInternal)this).ServerType = (string) content.GetValueForProperty("ServerType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackEventDetailsInternal)this).ServerType, global::System.Convert.ToString); + } + if (content.Contains("ComponentDisplayName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackEventDetailsInternal)this).ComponentDisplayName = (string) content.GetValueForProperty("ComponentDisplayName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackEventDetailsInternal)this).ComponentDisplayName, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Event details for InMageRcmFailback provider. + [System.ComponentModel.TypeConverter(typeof(InMageRcmFailbackEventDetailsTypeConverter))] + public partial interface IInMageRcmFailbackEventDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackEventDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackEventDetails.TypeConverter.cs new file mode 100644 index 000000000000..7d538d2eb28f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackEventDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InMageRcmFailbackEventDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackEventDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackEventDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InMageRcmFailbackEventDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InMageRcmFailbackEventDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InMageRcmFailbackEventDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackEventDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackEventDetails.cs new file mode 100644 index 000000000000..98720c4de9c3 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackEventDetails.cs @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Event details for InMageRcmFailback provider. + public partial class InMageRcmFailbackEventDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackEventDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackEventDetailsInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetails __eventProviderSpecificDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EventProviderSpecificDetails(); + + /// Backing field for property. + private string _applianceName; + + /// The appliance name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ApplianceName { get => this._applianceName; } + + /// Backing field for property. + private string _componentDisplayName; + + /// The component display name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ComponentDisplayName { get => this._componentDisplayName; } + + /// Gets the class type. Overridden in derived classes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetailsInternal)__eventProviderSpecificDetails).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetailsInternal)__eventProviderSpecificDetails).InstanceType = value ; } + + /// Internal Acessors for ApplianceName + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackEventDetailsInternal.ApplianceName { get => this._applianceName; set { {_applianceName = value;} } } + + /// Internal Acessors for ComponentDisplayName + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackEventDetailsInternal.ComponentDisplayName { get => this._componentDisplayName; set { {_componentDisplayName = value;} } } + + /// Internal Acessors for ProtectedItemName + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackEventDetailsInternal.ProtectedItemName { get => this._protectedItemName; set { {_protectedItemName = value;} } } + + /// Internal Acessors for ServerType + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackEventDetailsInternal.ServerType { get => this._serverType; set { {_serverType = value;} } } + + /// Internal Acessors for VMName + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackEventDetailsInternal.VMName { get => this._vMName; set { {_vMName = value;} } } + + /// Backing field for property. + private string _protectedItemName; + + /// The protected item name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ProtectedItemName { get => this._protectedItemName; } + + /// Backing field for property. + private string _serverType; + + /// The server type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ServerType { get => this._serverType; } + + /// Backing field for property. + private string _vMName; + + /// The protected item name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string VMName { get => this._vMName; } + + /// Creates an new instance. + public InMageRcmFailbackEventDetails() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__eventProviderSpecificDetails), __eventProviderSpecificDetails); + await eventListener.AssertObjectIsValid(nameof(__eventProviderSpecificDetails), __eventProviderSpecificDetails); + } + } + /// Event details for InMageRcmFailback provider. + public partial interface IInMageRcmFailbackEventDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetails + { + /// The appliance name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The appliance name.", + SerializedName = @"applianceName", + PossibleTypes = new [] { typeof(string) })] + string ApplianceName { get; } + /// The component display name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The component display name.", + SerializedName = @"componentDisplayName", + PossibleTypes = new [] { typeof(string) })] + string ComponentDisplayName { get; } + /// The protected item name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The protected item name.", + SerializedName = @"protectedItemName", + PossibleTypes = new [] { typeof(string) })] + string ProtectedItemName { get; } + /// The server type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The server type.", + SerializedName = @"serverType", + PossibleTypes = new [] { typeof(string) })] + string ServerType { get; } + /// The protected item name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The protected item name.", + SerializedName = @"vmName", + PossibleTypes = new [] { typeof(string) })] + string VMName { get; } + + } + /// Event details for InMageRcmFailback provider. + internal partial interface IInMageRcmFailbackEventDetailsInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetailsInternal + { + /// The appliance name. + string ApplianceName { get; set; } + /// The component display name. + string ComponentDisplayName { get; set; } + /// The protected item name. + string ProtectedItemName { get; set; } + /// The server type. + string ServerType { get; set; } + /// The protected item name. + string VMName { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackEventDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackEventDetails.json.cs new file mode 100644 index 000000000000..3ea80eceeb81 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackEventDetails.json.cs @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Event details for InMageRcmFailback provider. + public partial class InMageRcmFailbackEventDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackEventDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackEventDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackEventDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new InMageRcmFailbackEventDetails(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal InMageRcmFailbackEventDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __eventProviderSpecificDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EventProviderSpecificDetails(json); + {_protectedItemName = If( json?.PropertyT("protectedItemName"), out var __jsonProtectedItemName) ? (string)__jsonProtectedItemName : (string)ProtectedItemName;} + {_vMName = If( json?.PropertyT("vmName"), out var __jsonVMName) ? (string)__jsonVMName : (string)VMName;} + {_applianceName = If( json?.PropertyT("applianceName"), out var __jsonApplianceName) ? (string)__jsonApplianceName : (string)ApplianceName;} + {_serverType = If( json?.PropertyT("serverType"), out var __jsonServerType) ? (string)__jsonServerType : (string)ServerType;} + {_componentDisplayName = If( json?.PropertyT("componentDisplayName"), out var __jsonComponentDisplayName) ? (string)__jsonComponentDisplayName : (string)ComponentDisplayName;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __eventProviderSpecificDetails?.ToJson(container, serializationMode); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._protectedItemName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._protectedItemName.ToString()) : null, "protectedItemName" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._vMName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._vMName.ToString()) : null, "vmName" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._applianceName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._applianceName.ToString()) : null, "applianceName" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._serverType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._serverType.ToString()) : null, "serverType" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._componentDisplayName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._componentDisplayName.ToString()) : null, "componentDisplayName" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackMobilityAgentDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackMobilityAgentDetails.PowerShell.cs new file mode 100644 index 000000000000..d9ae9ccab838 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackMobilityAgentDetails.PowerShell.cs @@ -0,0 +1,213 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// InMageRcmFailback mobility agent details. + [System.ComponentModel.TypeConverter(typeof(InMageRcmFailbackMobilityAgentDetailsTypeConverter))] + public partial class InMageRcmFailbackMobilityAgentDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackMobilityAgentDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InMageRcmFailbackMobilityAgentDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackMobilityAgentDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InMageRcmFailbackMobilityAgentDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json + /// string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackMobilityAgentDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InMageRcmFailbackMobilityAgentDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Version")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackMobilityAgentDetailsInternal)this).Version = (string) content.GetValueForProperty("Version",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackMobilityAgentDetailsInternal)this).Version, global::System.Convert.ToString); + } + if (content.Contains("LatestVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackMobilityAgentDetailsInternal)this).LatestVersion = (string) content.GetValueForProperty("LatestVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackMobilityAgentDetailsInternal)this).LatestVersion, global::System.Convert.ToString); + } + if (content.Contains("DriverVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackMobilityAgentDetailsInternal)this).DriverVersion = (string) content.GetValueForProperty("DriverVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackMobilityAgentDetailsInternal)this).DriverVersion, global::System.Convert.ToString); + } + if (content.Contains("LatestUpgradableVersionWithoutReboot")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackMobilityAgentDetailsInternal)this).LatestUpgradableVersionWithoutReboot = (string) content.GetValueForProperty("LatestUpgradableVersionWithoutReboot",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackMobilityAgentDetailsInternal)this).LatestUpgradableVersionWithoutReboot, global::System.Convert.ToString); + } + if (content.Contains("AgentVersionExpiryDate")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackMobilityAgentDetailsInternal)this).AgentVersionExpiryDate = (global::System.DateTime?) content.GetValueForProperty("AgentVersionExpiryDate",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackMobilityAgentDetailsInternal)this).AgentVersionExpiryDate, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("DriverVersionExpiryDate")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackMobilityAgentDetailsInternal)this).DriverVersionExpiryDate = (global::System.DateTime?) content.GetValueForProperty("DriverVersionExpiryDate",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackMobilityAgentDetailsInternal)this).DriverVersionExpiryDate, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("LastHeartbeatUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackMobilityAgentDetailsInternal)this).LastHeartbeatUtc = (global::System.DateTime?) content.GetValueForProperty("LastHeartbeatUtc",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackMobilityAgentDetailsInternal)this).LastHeartbeatUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ReasonsBlockingUpgrade")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackMobilityAgentDetailsInternal)this).ReasonsBlockingUpgrade = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentUpgradeBlockedReason[]) content.GetValueForProperty("ReasonsBlockingUpgrade",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackMobilityAgentDetailsInternal)this).ReasonsBlockingUpgrade, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentUpgradeBlockedReason.CreateFrom)); + } + if (content.Contains("IsUpgradeable")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackMobilityAgentDetailsInternal)this).IsUpgradeable = (string) content.GetValueForProperty("IsUpgradeable",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackMobilityAgentDetailsInternal)this).IsUpgradeable, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InMageRcmFailbackMobilityAgentDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Version")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackMobilityAgentDetailsInternal)this).Version = (string) content.GetValueForProperty("Version",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackMobilityAgentDetailsInternal)this).Version, global::System.Convert.ToString); + } + if (content.Contains("LatestVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackMobilityAgentDetailsInternal)this).LatestVersion = (string) content.GetValueForProperty("LatestVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackMobilityAgentDetailsInternal)this).LatestVersion, global::System.Convert.ToString); + } + if (content.Contains("DriverVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackMobilityAgentDetailsInternal)this).DriverVersion = (string) content.GetValueForProperty("DriverVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackMobilityAgentDetailsInternal)this).DriverVersion, global::System.Convert.ToString); + } + if (content.Contains("LatestUpgradableVersionWithoutReboot")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackMobilityAgentDetailsInternal)this).LatestUpgradableVersionWithoutReboot = (string) content.GetValueForProperty("LatestUpgradableVersionWithoutReboot",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackMobilityAgentDetailsInternal)this).LatestUpgradableVersionWithoutReboot, global::System.Convert.ToString); + } + if (content.Contains("AgentVersionExpiryDate")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackMobilityAgentDetailsInternal)this).AgentVersionExpiryDate = (global::System.DateTime?) content.GetValueForProperty("AgentVersionExpiryDate",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackMobilityAgentDetailsInternal)this).AgentVersionExpiryDate, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("DriverVersionExpiryDate")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackMobilityAgentDetailsInternal)this).DriverVersionExpiryDate = (global::System.DateTime?) content.GetValueForProperty("DriverVersionExpiryDate",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackMobilityAgentDetailsInternal)this).DriverVersionExpiryDate, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("LastHeartbeatUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackMobilityAgentDetailsInternal)this).LastHeartbeatUtc = (global::System.DateTime?) content.GetValueForProperty("LastHeartbeatUtc",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackMobilityAgentDetailsInternal)this).LastHeartbeatUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ReasonsBlockingUpgrade")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackMobilityAgentDetailsInternal)this).ReasonsBlockingUpgrade = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentUpgradeBlockedReason[]) content.GetValueForProperty("ReasonsBlockingUpgrade",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackMobilityAgentDetailsInternal)this).ReasonsBlockingUpgrade, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentUpgradeBlockedReason.CreateFrom)); + } + if (content.Contains("IsUpgradeable")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackMobilityAgentDetailsInternal)this).IsUpgradeable = (string) content.GetValueForProperty("IsUpgradeable",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackMobilityAgentDetailsInternal)this).IsUpgradeable, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// InMageRcmFailback mobility agent details. + [System.ComponentModel.TypeConverter(typeof(InMageRcmFailbackMobilityAgentDetailsTypeConverter))] + public partial interface IInMageRcmFailbackMobilityAgentDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackMobilityAgentDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackMobilityAgentDetails.TypeConverter.cs new file mode 100644 index 000000000000..256f41b3e4b1 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackMobilityAgentDetails.TypeConverter.cs @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InMageRcmFailbackMobilityAgentDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackMobilityAgentDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackMobilityAgentDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InMageRcmFailbackMobilityAgentDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InMageRcmFailbackMobilityAgentDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InMageRcmFailbackMobilityAgentDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackMobilityAgentDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackMobilityAgentDetails.cs new file mode 100644 index 000000000000..6cdc779762cb --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackMobilityAgentDetails.cs @@ -0,0 +1,214 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMageRcmFailback mobility agent details. + public partial class InMageRcmFailbackMobilityAgentDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackMobilityAgentDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackMobilityAgentDetailsInternal + { + + /// Backing field for property. + private global::System.DateTime? _agentVersionExpiryDate; + + /// The agent version expiry date. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public global::System.DateTime? AgentVersionExpiryDate { get => this._agentVersionExpiryDate; } + + /// Backing field for property. + private string _driverVersion; + + /// The driver version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string DriverVersion { get => this._driverVersion; } + + /// Backing field for property. + private global::System.DateTime? _driverVersionExpiryDate; + + /// The driver version expiry date. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public global::System.DateTime? DriverVersionExpiryDate { get => this._driverVersionExpiryDate; } + + /// Backing field for property. + private string _isUpgradeable; + + /// A value indicating whether agent is upgradeable or not. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string IsUpgradeable { get => this._isUpgradeable; } + + /// Backing field for property. + private global::System.DateTime? _lastHeartbeatUtc; + + /// The time of the last heartbeat received from the agent. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public global::System.DateTime? LastHeartbeatUtc { get => this._lastHeartbeatUtc; } + + /// Backing field for property. + private string _latestUpgradableVersionWithoutReboot; + + /// The latest upgradeable version available without reboot. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string LatestUpgradableVersionWithoutReboot { get => this._latestUpgradableVersionWithoutReboot; } + + /// Backing field for property. + private string _latestVersion; + + /// The latest agent version available. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string LatestVersion { get => this._latestVersion; } + + /// Internal Acessors for AgentVersionExpiryDate + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackMobilityAgentDetailsInternal.AgentVersionExpiryDate { get => this._agentVersionExpiryDate; set { {_agentVersionExpiryDate = value;} } } + + /// Internal Acessors for DriverVersion + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackMobilityAgentDetailsInternal.DriverVersion { get => this._driverVersion; set { {_driverVersion = value;} } } + + /// Internal Acessors for DriverVersionExpiryDate + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackMobilityAgentDetailsInternal.DriverVersionExpiryDate { get => this._driverVersionExpiryDate; set { {_driverVersionExpiryDate = value;} } } + + /// Internal Acessors for IsUpgradeable + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackMobilityAgentDetailsInternal.IsUpgradeable { get => this._isUpgradeable; set { {_isUpgradeable = value;} } } + + /// Internal Acessors for LastHeartbeatUtc + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackMobilityAgentDetailsInternal.LastHeartbeatUtc { get => this._lastHeartbeatUtc; set { {_lastHeartbeatUtc = value;} } } + + /// Internal Acessors for LatestUpgradableVersionWithoutReboot + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackMobilityAgentDetailsInternal.LatestUpgradableVersionWithoutReboot { get => this._latestUpgradableVersionWithoutReboot; set { {_latestUpgradableVersionWithoutReboot = value;} } } + + /// Internal Acessors for LatestVersion + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackMobilityAgentDetailsInternal.LatestVersion { get => this._latestVersion; set { {_latestVersion = value;} } } + + /// Internal Acessors for ReasonsBlockingUpgrade + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentUpgradeBlockedReason[] Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackMobilityAgentDetailsInternal.ReasonsBlockingUpgrade { get => this._reasonsBlockingUpgrade; set { {_reasonsBlockingUpgrade = value;} } } + + /// Internal Acessors for Version + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackMobilityAgentDetailsInternal.Version { get => this._version; set { {_version = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentUpgradeBlockedReason[] _reasonsBlockingUpgrade; + + /// The whether update is possible or not. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentUpgradeBlockedReason[] ReasonsBlockingUpgrade { get => this._reasonsBlockingUpgrade; } + + /// Backing field for property. + private string _version; + + /// The agent version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Version { get => this._version; } + + /// Creates an new instance. + public InMageRcmFailbackMobilityAgentDetails() + { + + } + } + /// InMageRcmFailback mobility agent details. + public partial interface IInMageRcmFailbackMobilityAgentDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The agent version expiry date. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The agent version expiry date.", + SerializedName = @"agentVersionExpiryDate", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? AgentVersionExpiryDate { get; } + /// The driver version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The driver version.", + SerializedName = @"driverVersion", + PossibleTypes = new [] { typeof(string) })] + string DriverVersion { get; } + /// The driver version expiry date. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The driver version expiry date.", + SerializedName = @"driverVersionExpiryDate", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? DriverVersionExpiryDate { get; } + /// A value indicating whether agent is upgradeable or not. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"A value indicating whether agent is upgradeable or not.", + SerializedName = @"isUpgradeable", + PossibleTypes = new [] { typeof(string) })] + string IsUpgradeable { get; } + /// The time of the last heartbeat received from the agent. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The time of the last heartbeat received from the agent.", + SerializedName = @"lastHeartbeatUtc", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? LastHeartbeatUtc { get; } + /// The latest upgradeable version available without reboot. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The latest upgradeable version available without reboot.", + SerializedName = @"latestUpgradableVersionWithoutReboot", + PossibleTypes = new [] { typeof(string) })] + string LatestUpgradableVersionWithoutReboot { get; } + /// The latest agent version available. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The latest agent version available.", + SerializedName = @"latestVersion", + PossibleTypes = new [] { typeof(string) })] + string LatestVersion { get; } + /// The whether update is possible or not. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The whether update is possible or not.", + SerializedName = @"reasonsBlockingUpgrade", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentUpgradeBlockedReason) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentUpgradeBlockedReason[] ReasonsBlockingUpgrade { get; } + /// The agent version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The agent version.", + SerializedName = @"version", + PossibleTypes = new [] { typeof(string) })] + string Version { get; } + + } + /// InMageRcmFailback mobility agent details. + internal partial interface IInMageRcmFailbackMobilityAgentDetailsInternal + + { + /// The agent version expiry date. + global::System.DateTime? AgentVersionExpiryDate { get; set; } + /// The driver version. + string DriverVersion { get; set; } + /// The driver version expiry date. + global::System.DateTime? DriverVersionExpiryDate { get; set; } + /// A value indicating whether agent is upgradeable or not. + string IsUpgradeable { get; set; } + /// The time of the last heartbeat received from the agent. + global::System.DateTime? LastHeartbeatUtc { get; set; } + /// The latest upgradeable version available without reboot. + string LatestUpgradableVersionWithoutReboot { get; set; } + /// The latest agent version available. + string LatestVersion { get; set; } + /// The whether update is possible or not. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentUpgradeBlockedReason[] ReasonsBlockingUpgrade { get; set; } + /// The agent version. + string Version { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackMobilityAgentDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackMobilityAgentDetails.json.cs new file mode 100644 index 000000000000..692d867aedfd --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackMobilityAgentDetails.json.cs @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMageRcmFailback mobility agent details. + public partial class InMageRcmFailbackMobilityAgentDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackMobilityAgentDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackMobilityAgentDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackMobilityAgentDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new InMageRcmFailbackMobilityAgentDetails(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal InMageRcmFailbackMobilityAgentDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_version = If( json?.PropertyT("version"), out var __jsonVersion) ? (string)__jsonVersion : (string)Version;} + {_latestVersion = If( json?.PropertyT("latestVersion"), out var __jsonLatestVersion) ? (string)__jsonLatestVersion : (string)LatestVersion;} + {_driverVersion = If( json?.PropertyT("driverVersion"), out var __jsonDriverVersion) ? (string)__jsonDriverVersion : (string)DriverVersion;} + {_latestUpgradableVersionWithoutReboot = If( json?.PropertyT("latestUpgradableVersionWithoutReboot"), out var __jsonLatestUpgradableVersionWithoutReboot) ? (string)__jsonLatestUpgradableVersionWithoutReboot : (string)LatestUpgradableVersionWithoutReboot;} + {_agentVersionExpiryDate = If( json?.PropertyT("agentVersionExpiryDate"), out var __jsonAgentVersionExpiryDate) ? global::System.DateTime.TryParse((string)__jsonAgentVersionExpiryDate, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonAgentVersionExpiryDateValue) ? __jsonAgentVersionExpiryDateValue : AgentVersionExpiryDate : AgentVersionExpiryDate;} + {_driverVersionExpiryDate = If( json?.PropertyT("driverVersionExpiryDate"), out var __jsonDriverVersionExpiryDate) ? global::System.DateTime.TryParse((string)__jsonDriverVersionExpiryDate, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonDriverVersionExpiryDateValue) ? __jsonDriverVersionExpiryDateValue : DriverVersionExpiryDate : DriverVersionExpiryDate;} + {_lastHeartbeatUtc = If( json?.PropertyT("lastHeartbeatUtc"), out var __jsonLastHeartbeatUtc) ? global::System.DateTime.TryParse((string)__jsonLastHeartbeatUtc, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonLastHeartbeatUtcValue) ? __jsonLastHeartbeatUtcValue : LastHeartbeatUtc : LastHeartbeatUtc;} + {_reasonsBlockingUpgrade = If( json?.PropertyT("reasonsBlockingUpgrade"), out var __jsonReasonsBlockingUpgrade) ? If( __jsonReasonsBlockingUpgrade as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentUpgradeBlockedReason) (__u is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString __t ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentUpgradeBlockedReason)(__t.ToString()) : ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentUpgradeBlockedReason)""))) ))() : null : ReasonsBlockingUpgrade;} + {_isUpgradeable = If( json?.PropertyT("isUpgradeable"), out var __jsonIsUpgradeable) ? (string)__jsonIsUpgradeable : (string)IsUpgradeable;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._version)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._version.ToString()) : null, "version" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._latestVersion)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._latestVersion.ToString()) : null, "latestVersion" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._driverVersion)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._driverVersion.ToString()) : null, "driverVersion" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._latestUpgradableVersionWithoutReboot)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._latestUpgradableVersionWithoutReboot.ToString()) : null, "latestUpgradableVersionWithoutReboot" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._agentVersionExpiryDate ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._agentVersionExpiryDate?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "agentVersionExpiryDate" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._driverVersionExpiryDate ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._driverVersionExpiryDate?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "driverVersionExpiryDate" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._lastHeartbeatUtc ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._lastHeartbeatUtc?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "lastHeartbeatUtc" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + if (null != this._reasonsBlockingUpgrade) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._reasonsBlockingUpgrade ) + { + AddIf(null != (((object)__x)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(__x.ToString()) : null ,__w.Add); + } + container.Add("reasonsBlockingUpgrade",__w); + } + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._isUpgradeable)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._isUpgradeable.ToString()) : null, "isUpgradeable" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackNicDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackNicDetails.PowerShell.cs new file mode 100644 index 000000000000..aedad9a48192 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackNicDetails.PowerShell.cs @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// InMageRcmFailback NIC details. + [System.ComponentModel.TypeConverter(typeof(InMageRcmFailbackNicDetailsTypeConverter))] + public partial class InMageRcmFailbackNicDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackNicDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InMageRcmFailbackNicDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackNicDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InMageRcmFailbackNicDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackNicDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InMageRcmFailbackNicDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("MacAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackNicDetailsInternal)this).MacAddress = (string) content.GetValueForProperty("MacAddress",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackNicDetailsInternal)this).MacAddress, global::System.Convert.ToString); + } + if (content.Contains("NetworkName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackNicDetailsInternal)this).NetworkName = (string) content.GetValueForProperty("NetworkName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackNicDetailsInternal)this).NetworkName, global::System.Convert.ToString); + } + if (content.Contains("AdapterType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackNicDetailsInternal)this).AdapterType = (string) content.GetValueForProperty("AdapterType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackNicDetailsInternal)this).AdapterType, global::System.Convert.ToString); + } + if (content.Contains("SourceIPAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackNicDetailsInternal)this).SourceIPAddress = (string) content.GetValueForProperty("SourceIPAddress",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackNicDetailsInternal)this).SourceIPAddress, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InMageRcmFailbackNicDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("MacAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackNicDetailsInternal)this).MacAddress = (string) content.GetValueForProperty("MacAddress",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackNicDetailsInternal)this).MacAddress, global::System.Convert.ToString); + } + if (content.Contains("NetworkName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackNicDetailsInternal)this).NetworkName = (string) content.GetValueForProperty("NetworkName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackNicDetailsInternal)this).NetworkName, global::System.Convert.ToString); + } + if (content.Contains("AdapterType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackNicDetailsInternal)this).AdapterType = (string) content.GetValueForProperty("AdapterType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackNicDetailsInternal)this).AdapterType, global::System.Convert.ToString); + } + if (content.Contains("SourceIPAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackNicDetailsInternal)this).SourceIPAddress = (string) content.GetValueForProperty("SourceIPAddress",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackNicDetailsInternal)this).SourceIPAddress, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// InMageRcmFailback NIC details. + [System.ComponentModel.TypeConverter(typeof(InMageRcmFailbackNicDetailsTypeConverter))] + public partial interface IInMageRcmFailbackNicDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackNicDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackNicDetails.TypeConverter.cs new file mode 100644 index 000000000000..1e9967cffa4b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackNicDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InMageRcmFailbackNicDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackNicDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackNicDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InMageRcmFailbackNicDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InMageRcmFailbackNicDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InMageRcmFailbackNicDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackNicDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackNicDetails.cs new file mode 100644 index 000000000000..f3fc8113700e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackNicDetails.cs @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMageRcmFailback NIC details. + public partial class InMageRcmFailbackNicDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackNicDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackNicDetailsInternal + { + + /// Backing field for property. + private string _adapterType; + + /// The adapter type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string AdapterType { get => this._adapterType; } + + /// Backing field for property. + private string _macAddress; + + /// The mac address. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string MacAddress { get => this._macAddress; } + + /// Internal Acessors for AdapterType + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackNicDetailsInternal.AdapterType { get => this._adapterType; set { {_adapterType = value;} } } + + /// Internal Acessors for MacAddress + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackNicDetailsInternal.MacAddress { get => this._macAddress; set { {_macAddress = value;} } } + + /// Internal Acessors for NetworkName + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackNicDetailsInternal.NetworkName { get => this._networkName; set { {_networkName = value;} } } + + /// Internal Acessors for SourceIPAddress + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackNicDetailsInternal.SourceIPAddress { get => this._sourceIPAddress; set { {_sourceIPAddress = value;} } } + + /// Backing field for property. + private string _networkName; + + /// The network name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string NetworkName { get => this._networkName; } + + /// Backing field for property. + private string _sourceIPAddress; + + /// The IP address. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string SourceIPAddress { get => this._sourceIPAddress; } + + /// Creates an new instance. + public InMageRcmFailbackNicDetails() + { + + } + } + /// InMageRcmFailback NIC details. + public partial interface IInMageRcmFailbackNicDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The adapter type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The adapter type.", + SerializedName = @"adapterType", + PossibleTypes = new [] { typeof(string) })] + string AdapterType { get; } + /// The mac address. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The mac address.", + SerializedName = @"macAddress", + PossibleTypes = new [] { typeof(string) })] + string MacAddress { get; } + /// The network name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The network name.", + SerializedName = @"networkName", + PossibleTypes = new [] { typeof(string) })] + string NetworkName { get; } + /// The IP address. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The IP address.", + SerializedName = @"sourceIpAddress", + PossibleTypes = new [] { typeof(string) })] + string SourceIPAddress { get; } + + } + /// InMageRcmFailback NIC details. + internal partial interface IInMageRcmFailbackNicDetailsInternal + + { + /// The adapter type. + string AdapterType { get; set; } + /// The mac address. + string MacAddress { get; set; } + /// The network name. + string NetworkName { get; set; } + /// The IP address. + string SourceIPAddress { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackNicDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackNicDetails.json.cs new file mode 100644 index 000000000000..e636a9910d1b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackNicDetails.json.cs @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMageRcmFailback NIC details. + public partial class InMageRcmFailbackNicDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackNicDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackNicDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackNicDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new InMageRcmFailbackNicDetails(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal InMageRcmFailbackNicDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_macAddress = If( json?.PropertyT("macAddress"), out var __jsonMacAddress) ? (string)__jsonMacAddress : (string)MacAddress;} + {_networkName = If( json?.PropertyT("networkName"), out var __jsonNetworkName) ? (string)__jsonNetworkName : (string)NetworkName;} + {_adapterType = If( json?.PropertyT("adapterType"), out var __jsonAdapterType) ? (string)__jsonAdapterType : (string)AdapterType;} + {_sourceIPAddress = If( json?.PropertyT("sourceIpAddress"), out var __jsonSourceIPAddress) ? (string)__jsonSourceIPAddress : (string)SourceIPAddress;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._macAddress)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._macAddress.ToString()) : null, "macAddress" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._networkName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._networkName.ToString()) : null, "networkName" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._adapterType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._adapterType.ToString()) : null, "adapterType" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._sourceIPAddress)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._sourceIPAddress.ToString()) : null, "sourceIpAddress" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackPlannedFailoverProviderInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackPlannedFailoverProviderInput.PowerShell.cs new file mode 100644 index 000000000000..684878dd238a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackPlannedFailoverProviderInput.PowerShell.cs @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Provider specific input for InMageRcmFailback failover. + [System.ComponentModel.TypeConverter(typeof(InMageRcmFailbackPlannedFailoverProviderInputTypeConverter))] + public partial class InMageRcmFailbackPlannedFailoverProviderInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackPlannedFailoverProviderInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InMageRcmFailbackPlannedFailoverProviderInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackPlannedFailoverProviderInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InMageRcmFailbackPlannedFailoverProviderInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from + /// a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackPlannedFailoverProviderInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InMageRcmFailbackPlannedFailoverProviderInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("RecoveryPointType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackPlannedFailoverProviderInputInternal)this).RecoveryPointType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.InMageRcmFailbackRecoveryPointType) content.GetValueForProperty("RecoveryPointType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackPlannedFailoverProviderInputInternal)this).RecoveryPointType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.InMageRcmFailbackRecoveryPointType.CreateFrom); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverProviderSpecificFailoverInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverProviderSpecificFailoverInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InMageRcmFailbackPlannedFailoverProviderInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("RecoveryPointType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackPlannedFailoverProviderInputInternal)this).RecoveryPointType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.InMageRcmFailbackRecoveryPointType) content.GetValueForProperty("RecoveryPointType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackPlannedFailoverProviderInputInternal)this).RecoveryPointType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.InMageRcmFailbackRecoveryPointType.CreateFrom); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverProviderSpecificFailoverInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverProviderSpecificFailoverInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Provider specific input for InMageRcmFailback failover. + [System.ComponentModel.TypeConverter(typeof(InMageRcmFailbackPlannedFailoverProviderInputTypeConverter))] + public partial interface IInMageRcmFailbackPlannedFailoverProviderInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackPlannedFailoverProviderInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackPlannedFailoverProviderInput.TypeConverter.cs new file mode 100644 index 000000000000..4356e64fafdb --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackPlannedFailoverProviderInput.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InMageRcmFailbackPlannedFailoverProviderInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, + /// otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackPlannedFailoverProviderInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackPlannedFailoverProviderInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InMageRcmFailbackPlannedFailoverProviderInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InMageRcmFailbackPlannedFailoverProviderInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InMageRcmFailbackPlannedFailoverProviderInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackPlannedFailoverProviderInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackPlannedFailoverProviderInput.cs new file mode 100644 index 000000000000..6c35b90ae21d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackPlannedFailoverProviderInput.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Provider specific input for InMageRcmFailback failover. + public partial class InMageRcmFailbackPlannedFailoverProviderInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackPlannedFailoverProviderInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackPlannedFailoverProviderInputInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverProviderSpecificFailoverInput __plannedFailoverProviderSpecificFailoverInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PlannedFailoverProviderSpecificFailoverInput(); + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverProviderSpecificFailoverInputInternal)__plannedFailoverProviderSpecificFailoverInput).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverProviderSpecificFailoverInputInternal)__plannedFailoverProviderSpecificFailoverInput).InstanceType = value ; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.InMageRcmFailbackRecoveryPointType _recoveryPointType; + + /// The recovery point type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.InMageRcmFailbackRecoveryPointType RecoveryPointType { get => this._recoveryPointType; set => this._recoveryPointType = value; } + + /// + /// Creates an new instance. + /// + public InMageRcmFailbackPlannedFailoverProviderInput() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__plannedFailoverProviderSpecificFailoverInput), __plannedFailoverProviderSpecificFailoverInput); + await eventListener.AssertObjectIsValid(nameof(__plannedFailoverProviderSpecificFailoverInput), __plannedFailoverProviderSpecificFailoverInput); + } + } + /// Provider specific input for InMageRcmFailback failover. + public partial interface IInMageRcmFailbackPlannedFailoverProviderInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverProviderSpecificFailoverInput + { + /// The recovery point type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The recovery point type.", + SerializedName = @"recoveryPointType", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.InMageRcmFailbackRecoveryPointType) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.InMageRcmFailbackRecoveryPointType RecoveryPointType { get; set; } + + } + /// Provider specific input for InMageRcmFailback failover. + internal partial interface IInMageRcmFailbackPlannedFailoverProviderInputInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverProviderSpecificFailoverInputInternal + { + /// The recovery point type. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.InMageRcmFailbackRecoveryPointType RecoveryPointType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackPlannedFailoverProviderInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackPlannedFailoverProviderInput.json.cs new file mode 100644 index 000000000000..ae23491079a4 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackPlannedFailoverProviderInput.json.cs @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Provider specific input for InMageRcmFailback failover. + public partial class InMageRcmFailbackPlannedFailoverProviderInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackPlannedFailoverProviderInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackPlannedFailoverProviderInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackPlannedFailoverProviderInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new InMageRcmFailbackPlannedFailoverProviderInput(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal InMageRcmFailbackPlannedFailoverProviderInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __plannedFailoverProviderSpecificFailoverInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PlannedFailoverProviderSpecificFailoverInput(json); + {_recoveryPointType = If( json?.PropertyT("recoveryPointType"), out var __jsonRecoveryPointType) ? (string)__jsonRecoveryPointType : (string)RecoveryPointType;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __plannedFailoverProviderSpecificFailoverInput?.ToJson(container, serializationMode); + AddIf( null != (((object)this._recoveryPointType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryPointType.ToString()) : null, "recoveryPointType" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackPolicyCreationInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackPolicyCreationInput.PowerShell.cs new file mode 100644 index 000000000000..4dab9eef4fb2 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackPolicyCreationInput.PowerShell.cs @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// InMageRcmFailback policy creation input. + [System.ComponentModel.TypeConverter(typeof(InMageRcmFailbackPolicyCreationInputTypeConverter))] + public partial class InMageRcmFailbackPolicyCreationInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackPolicyCreationInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InMageRcmFailbackPolicyCreationInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackPolicyCreationInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InMageRcmFailbackPolicyCreationInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackPolicyCreationInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InMageRcmFailbackPolicyCreationInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CrashConsistentFrequencyInMinute")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackPolicyCreationInputInternal)this).CrashConsistentFrequencyInMinute = (int?) content.GetValueForProperty("CrashConsistentFrequencyInMinute",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackPolicyCreationInputInternal)this).CrashConsistentFrequencyInMinute, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("AppConsistentFrequencyInMinute")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackPolicyCreationInputInternal)this).AppConsistentFrequencyInMinute = (int?) content.GetValueForProperty("AppConsistentFrequencyInMinute",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackPolicyCreationInputInternal)this).AppConsistentFrequencyInMinute, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InMageRcmFailbackPolicyCreationInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CrashConsistentFrequencyInMinute")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackPolicyCreationInputInternal)this).CrashConsistentFrequencyInMinute = (int?) content.GetValueForProperty("CrashConsistentFrequencyInMinute",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackPolicyCreationInputInternal)this).CrashConsistentFrequencyInMinute, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("AppConsistentFrequencyInMinute")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackPolicyCreationInputInternal)this).AppConsistentFrequencyInMinute = (int?) content.GetValueForProperty("AppConsistentFrequencyInMinute",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackPolicyCreationInputInternal)this).AppConsistentFrequencyInMinute, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// InMageRcmFailback policy creation input. + [System.ComponentModel.TypeConverter(typeof(InMageRcmFailbackPolicyCreationInputTypeConverter))] + public partial interface IInMageRcmFailbackPolicyCreationInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackPolicyCreationInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackPolicyCreationInput.TypeConverter.cs new file mode 100644 index 000000000000..0b21b01cae64 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackPolicyCreationInput.TypeConverter.cs @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InMageRcmFailbackPolicyCreationInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackPolicyCreationInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackPolicyCreationInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InMageRcmFailbackPolicyCreationInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InMageRcmFailbackPolicyCreationInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InMageRcmFailbackPolicyCreationInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackPolicyCreationInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackPolicyCreationInput.cs new file mode 100644 index 000000000000..cf870f9b1883 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackPolicyCreationInput.cs @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMageRcmFailback policy creation input. + public partial class InMageRcmFailbackPolicyCreationInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackPolicyCreationInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackPolicyCreationInputInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInput __policyProviderSpecificInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PolicyProviderSpecificInput(); + + /// Backing field for property. + private int? _appConsistentFrequencyInMinute; + + /// The app consistent snapshot frequency (in minutes). + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? AppConsistentFrequencyInMinute { get => this._appConsistentFrequencyInMinute; set => this._appConsistentFrequencyInMinute = value; } + + /// Backing field for property. + private int? _crashConsistentFrequencyInMinute; + + /// The crash consistent snapshot frequency (in minutes). + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? CrashConsistentFrequencyInMinute { get => this._crashConsistentFrequencyInMinute; set => this._crashConsistentFrequencyInMinute = value; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInputInternal)__policyProviderSpecificInput).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInputInternal)__policyProviderSpecificInput).InstanceType = value ; } + + /// Creates an new instance. + public InMageRcmFailbackPolicyCreationInput() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__policyProviderSpecificInput), __policyProviderSpecificInput); + await eventListener.AssertObjectIsValid(nameof(__policyProviderSpecificInput), __policyProviderSpecificInput); + } + } + /// InMageRcmFailback policy creation input. + public partial interface IInMageRcmFailbackPolicyCreationInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInput + { + /// The app consistent snapshot frequency (in minutes). + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The app consistent snapshot frequency (in minutes).", + SerializedName = @"appConsistentFrequencyInMinutes", + PossibleTypes = new [] { typeof(int) })] + int? AppConsistentFrequencyInMinute { get; set; } + /// The crash consistent snapshot frequency (in minutes). + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The crash consistent snapshot frequency (in minutes).", + SerializedName = @"crashConsistentFrequencyInMinutes", + PossibleTypes = new [] { typeof(int) })] + int? CrashConsistentFrequencyInMinute { get; set; } + + } + /// InMageRcmFailback policy creation input. + internal partial interface IInMageRcmFailbackPolicyCreationInputInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInputInternal + { + /// The app consistent snapshot frequency (in minutes). + int? AppConsistentFrequencyInMinute { get; set; } + /// The crash consistent snapshot frequency (in minutes). + int? CrashConsistentFrequencyInMinute { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackPolicyCreationInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackPolicyCreationInput.json.cs new file mode 100644 index 000000000000..dec48aa97aa2 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackPolicyCreationInput.json.cs @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMageRcmFailback policy creation input. + public partial class InMageRcmFailbackPolicyCreationInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackPolicyCreationInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackPolicyCreationInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackPolicyCreationInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new InMageRcmFailbackPolicyCreationInput(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal InMageRcmFailbackPolicyCreationInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __policyProviderSpecificInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PolicyProviderSpecificInput(json); + {_crashConsistentFrequencyInMinute = If( json?.PropertyT("crashConsistentFrequencyInMinutes"), out var __jsonCrashConsistentFrequencyInMinutes) ? (int?)__jsonCrashConsistentFrequencyInMinutes : CrashConsistentFrequencyInMinute;} + {_appConsistentFrequencyInMinute = If( json?.PropertyT("appConsistentFrequencyInMinutes"), out var __jsonAppConsistentFrequencyInMinutes) ? (int?)__jsonAppConsistentFrequencyInMinutes : AppConsistentFrequencyInMinute;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __policyProviderSpecificInput?.ToJson(container, serializationMode); + AddIf( null != this._crashConsistentFrequencyInMinute ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._crashConsistentFrequencyInMinute) : null, "crashConsistentFrequencyInMinutes" ,container.Add ); + AddIf( null != this._appConsistentFrequencyInMinute ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._appConsistentFrequencyInMinute) : null, "appConsistentFrequencyInMinutes" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackPolicyDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackPolicyDetails.PowerShell.cs new file mode 100644 index 000000000000..531adcadc09e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackPolicyDetails.PowerShell.cs @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// InMageRcm failback specific policy details. + [System.ComponentModel.TypeConverter(typeof(InMageRcmFailbackPolicyDetailsTypeConverter))] + public partial class InMageRcmFailbackPolicyDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackPolicyDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InMageRcmFailbackPolicyDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackPolicyDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InMageRcmFailbackPolicyDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackPolicyDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InMageRcmFailbackPolicyDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("AppConsistentFrequencyInMinute")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackPolicyDetailsInternal)this).AppConsistentFrequencyInMinute = (int?) content.GetValueForProperty("AppConsistentFrequencyInMinute",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackPolicyDetailsInternal)this).AppConsistentFrequencyInMinute, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("CrashConsistentFrequencyInMinute")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackPolicyDetailsInternal)this).CrashConsistentFrequencyInMinute = (int?) content.GetValueForProperty("CrashConsistentFrequencyInMinute",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackPolicyDetailsInternal)this).CrashConsistentFrequencyInMinute, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InMageRcmFailbackPolicyDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("AppConsistentFrequencyInMinute")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackPolicyDetailsInternal)this).AppConsistentFrequencyInMinute = (int?) content.GetValueForProperty("AppConsistentFrequencyInMinute",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackPolicyDetailsInternal)this).AppConsistentFrequencyInMinute, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("CrashConsistentFrequencyInMinute")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackPolicyDetailsInternal)this).CrashConsistentFrequencyInMinute = (int?) content.GetValueForProperty("CrashConsistentFrequencyInMinute",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackPolicyDetailsInternal)this).CrashConsistentFrequencyInMinute, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// InMageRcm failback specific policy details. + [System.ComponentModel.TypeConverter(typeof(InMageRcmFailbackPolicyDetailsTypeConverter))] + public partial interface IInMageRcmFailbackPolicyDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackPolicyDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackPolicyDetails.TypeConverter.cs new file mode 100644 index 000000000000..5bda9e853a05 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackPolicyDetails.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InMageRcmFailbackPolicyDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackPolicyDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackPolicyDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InMageRcmFailbackPolicyDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InMageRcmFailbackPolicyDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InMageRcmFailbackPolicyDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackPolicyDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackPolicyDetails.cs new file mode 100644 index 000000000000..e01a53377a30 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackPolicyDetails.cs @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMageRcm failback specific policy details. + public partial class InMageRcmFailbackPolicyDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackPolicyDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackPolicyDetailsInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetails __policyProviderSpecificDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PolicyProviderSpecificDetails(); + + /// Backing field for property. + private int? _appConsistentFrequencyInMinute; + + /// The app consistent snapshot frequency in minutes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? AppConsistentFrequencyInMinute { get => this._appConsistentFrequencyInMinute; set => this._appConsistentFrequencyInMinute = value; } + + /// Backing field for property. + private int? _crashConsistentFrequencyInMinute; + + /// The crash consistent snapshot frequency in minutes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? CrashConsistentFrequencyInMinute { get => this._crashConsistentFrequencyInMinute; set => this._crashConsistentFrequencyInMinute = value; } + + /// Gets the class type. Overridden in derived classes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetailsInternal)__policyProviderSpecificDetails).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetailsInternal)__policyProviderSpecificDetails).InstanceType = value ; } + + /// Creates an new instance. + public InMageRcmFailbackPolicyDetails() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__policyProviderSpecificDetails), __policyProviderSpecificDetails); + await eventListener.AssertObjectIsValid(nameof(__policyProviderSpecificDetails), __policyProviderSpecificDetails); + } + } + /// InMageRcm failback specific policy details. + public partial interface IInMageRcmFailbackPolicyDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetails + { + /// The app consistent snapshot frequency in minutes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The app consistent snapshot frequency in minutes.", + SerializedName = @"appConsistentFrequencyInMinutes", + PossibleTypes = new [] { typeof(int) })] + int? AppConsistentFrequencyInMinute { get; set; } + /// The crash consistent snapshot frequency in minutes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The crash consistent snapshot frequency in minutes.", + SerializedName = @"crashConsistentFrequencyInMinutes", + PossibleTypes = new [] { typeof(int) })] + int? CrashConsistentFrequencyInMinute { get; set; } + + } + /// InMageRcm failback specific policy details. + internal partial interface IInMageRcmFailbackPolicyDetailsInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetailsInternal + { + /// The app consistent snapshot frequency in minutes. + int? AppConsistentFrequencyInMinute { get; set; } + /// The crash consistent snapshot frequency in minutes. + int? CrashConsistentFrequencyInMinute { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackPolicyDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackPolicyDetails.json.cs new file mode 100644 index 000000000000..c2229f30c1cf --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackPolicyDetails.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMageRcm failback specific policy details. + public partial class InMageRcmFailbackPolicyDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackPolicyDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackPolicyDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackPolicyDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new InMageRcmFailbackPolicyDetails(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal InMageRcmFailbackPolicyDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __policyProviderSpecificDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PolicyProviderSpecificDetails(json); + {_appConsistentFrequencyInMinute = If( json?.PropertyT("appConsistentFrequencyInMinutes"), out var __jsonAppConsistentFrequencyInMinutes) ? (int?)__jsonAppConsistentFrequencyInMinutes : AppConsistentFrequencyInMinute;} + {_crashConsistentFrequencyInMinute = If( json?.PropertyT("crashConsistentFrequencyInMinutes"), out var __jsonCrashConsistentFrequencyInMinutes) ? (int?)__jsonCrashConsistentFrequencyInMinutes : CrashConsistentFrequencyInMinute;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __policyProviderSpecificDetails?.ToJson(container, serializationMode); + AddIf( null != this._appConsistentFrequencyInMinute ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._appConsistentFrequencyInMinute) : null, "appConsistentFrequencyInMinutes" ,container.Add ); + AddIf( null != this._crashConsistentFrequencyInMinute ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._crashConsistentFrequencyInMinute) : null, "crashConsistentFrequencyInMinutes" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackProtectedDiskDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackProtectedDiskDetails.PowerShell.cs new file mode 100644 index 000000000000..c71d37636355 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackProtectedDiskDetails.PowerShell.cs @@ -0,0 +1,357 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// InMageRcmFailback protected disk details. + [System.ComponentModel.TypeConverter(typeof(InMageRcmFailbackProtectedDiskDetailsTypeConverter))] + public partial class InMageRcmFailbackProtectedDiskDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InMageRcmFailbackProtectedDiskDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InMageRcmFailbackProtectedDiskDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json + /// string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InMageRcmFailbackProtectedDiskDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("IrDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).IrDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetails) content.GetValueForProperty("IrDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).IrDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmFailbackSyncDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("ResyncDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).ResyncDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetails) content.GetValueForProperty("ResyncDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).ResyncDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmFailbackSyncDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("DiskId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).DiskId = (string) content.GetValueForProperty("DiskId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).DiskId, global::System.Convert.ToString); + } + if (content.Contains("DiskName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).DiskName = (string) content.GetValueForProperty("DiskName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).DiskName, global::System.Convert.ToString); + } + if (content.Contains("IsOSDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).IsOSDisk = (string) content.GetValueForProperty("IsOSDisk",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).IsOSDisk, global::System.Convert.ToString); + } + if (content.Contains("CapacityInByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).CapacityInByte = (long?) content.GetValueForProperty("CapacityInByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).CapacityInByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("DiskUuid")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).DiskUuid = (string) content.GetValueForProperty("DiskUuid",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).DiskUuid, global::System.Convert.ToString); + } + if (content.Contains("DataPendingInLogDataStoreInMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).DataPendingInLogDataStoreInMb = (double?) content.GetValueForProperty("DataPendingInLogDataStoreInMb",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).DataPendingInLogDataStoreInMb, (__y)=> (double) global::System.Convert.ChangeType(__y, typeof(double))); + } + if (content.Contains("DataPendingAtSourceAgentInMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).DataPendingAtSourceAgentInMb = (double?) content.GetValueForProperty("DataPendingAtSourceAgentInMb",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).DataPendingAtSourceAgentInMb, (__y)=> (double) global::System.Convert.ChangeType(__y, typeof(double))); + } + if (content.Contains("IsInitialReplicationComplete")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).IsInitialReplicationComplete = (string) content.GetValueForProperty("IsInitialReplicationComplete",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).IsInitialReplicationComplete, global::System.Convert.ToString); + } + if (content.Contains("LastSyncTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).LastSyncTime = (global::System.DateTime?) content.GetValueForProperty("LastSyncTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).LastSyncTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("IrDetailProgressHealth")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).IrDetailProgressHealth = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskReplicationProgressHealth?) content.GetValueForProperty("IrDetailProgressHealth",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).IrDetailProgressHealth, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskReplicationProgressHealth.CreateFrom); + } + if (content.Contains("IrDetailTransferredByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).IrDetailTransferredByte = (long?) content.GetValueForProperty("IrDetailTransferredByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).IrDetailTransferredByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("IrDetailLast15MinutesTransferredByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).IrDetailLast15MinutesTransferredByte = (long?) content.GetValueForProperty("IrDetailLast15MinutesTransferredByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).IrDetailLast15MinutesTransferredByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("IrDetailLastDataTransferTimeUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).IrDetailLastDataTransferTimeUtc = (string) content.GetValueForProperty("IrDetailLastDataTransferTimeUtc",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).IrDetailLastDataTransferTimeUtc, global::System.Convert.ToString); + } + if (content.Contains("IrDetailProcessedByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).IrDetailProcessedByte = (long?) content.GetValueForProperty("IrDetailProcessedByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).IrDetailProcessedByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("IrDetailStartTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).IrDetailStartTime = (string) content.GetValueForProperty("IrDetailStartTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).IrDetailStartTime, global::System.Convert.ToString); + } + if (content.Contains("IrDetailLastRefreshTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).IrDetailLastRefreshTime = (string) content.GetValueForProperty("IrDetailLastRefreshTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).IrDetailLastRefreshTime, global::System.Convert.ToString); + } + if (content.Contains("IrDetailProgressPercentage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).IrDetailProgressPercentage = (int?) content.GetValueForProperty("IrDetailProgressPercentage",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).IrDetailProgressPercentage, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("ResyncDetailProgressHealth")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).ResyncDetailProgressHealth = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskReplicationProgressHealth?) content.GetValueForProperty("ResyncDetailProgressHealth",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).ResyncDetailProgressHealth, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskReplicationProgressHealth.CreateFrom); + } + if (content.Contains("ResyncDetailTransferredByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).ResyncDetailTransferredByte = (long?) content.GetValueForProperty("ResyncDetailTransferredByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).ResyncDetailTransferredByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("ResyncDetailLast15MinutesTransferredByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).ResyncDetailLast15MinutesTransferredByte = (long?) content.GetValueForProperty("ResyncDetailLast15MinutesTransferredByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).ResyncDetailLast15MinutesTransferredByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("ResyncDetailLastDataTransferTimeUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).ResyncDetailLastDataTransferTimeUtc = (string) content.GetValueForProperty("ResyncDetailLastDataTransferTimeUtc",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).ResyncDetailLastDataTransferTimeUtc, global::System.Convert.ToString); + } + if (content.Contains("ResyncDetailProcessedByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).ResyncDetailProcessedByte = (long?) content.GetValueForProperty("ResyncDetailProcessedByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).ResyncDetailProcessedByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("ResyncDetailStartTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).ResyncDetailStartTime = (string) content.GetValueForProperty("ResyncDetailStartTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).ResyncDetailStartTime, global::System.Convert.ToString); + } + if (content.Contains("ResyncDetailLastRefreshTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).ResyncDetailLastRefreshTime = (string) content.GetValueForProperty("ResyncDetailLastRefreshTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).ResyncDetailLastRefreshTime, global::System.Convert.ToString); + } + if (content.Contains("ResyncDetailProgressPercentage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).ResyncDetailProgressPercentage = (int?) content.GetValueForProperty("ResyncDetailProgressPercentage",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).ResyncDetailProgressPercentage, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InMageRcmFailbackProtectedDiskDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("IrDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).IrDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetails) content.GetValueForProperty("IrDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).IrDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmFailbackSyncDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("ResyncDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).ResyncDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetails) content.GetValueForProperty("ResyncDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).ResyncDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmFailbackSyncDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("DiskId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).DiskId = (string) content.GetValueForProperty("DiskId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).DiskId, global::System.Convert.ToString); + } + if (content.Contains("DiskName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).DiskName = (string) content.GetValueForProperty("DiskName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).DiskName, global::System.Convert.ToString); + } + if (content.Contains("IsOSDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).IsOSDisk = (string) content.GetValueForProperty("IsOSDisk",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).IsOSDisk, global::System.Convert.ToString); + } + if (content.Contains("CapacityInByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).CapacityInByte = (long?) content.GetValueForProperty("CapacityInByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).CapacityInByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("DiskUuid")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).DiskUuid = (string) content.GetValueForProperty("DiskUuid",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).DiskUuid, global::System.Convert.ToString); + } + if (content.Contains("DataPendingInLogDataStoreInMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).DataPendingInLogDataStoreInMb = (double?) content.GetValueForProperty("DataPendingInLogDataStoreInMb",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).DataPendingInLogDataStoreInMb, (__y)=> (double) global::System.Convert.ChangeType(__y, typeof(double))); + } + if (content.Contains("DataPendingAtSourceAgentInMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).DataPendingAtSourceAgentInMb = (double?) content.GetValueForProperty("DataPendingAtSourceAgentInMb",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).DataPendingAtSourceAgentInMb, (__y)=> (double) global::System.Convert.ChangeType(__y, typeof(double))); + } + if (content.Contains("IsInitialReplicationComplete")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).IsInitialReplicationComplete = (string) content.GetValueForProperty("IsInitialReplicationComplete",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).IsInitialReplicationComplete, global::System.Convert.ToString); + } + if (content.Contains("LastSyncTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).LastSyncTime = (global::System.DateTime?) content.GetValueForProperty("LastSyncTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).LastSyncTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("IrDetailProgressHealth")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).IrDetailProgressHealth = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskReplicationProgressHealth?) content.GetValueForProperty("IrDetailProgressHealth",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).IrDetailProgressHealth, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskReplicationProgressHealth.CreateFrom); + } + if (content.Contains("IrDetailTransferredByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).IrDetailTransferredByte = (long?) content.GetValueForProperty("IrDetailTransferredByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).IrDetailTransferredByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("IrDetailLast15MinutesTransferredByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).IrDetailLast15MinutesTransferredByte = (long?) content.GetValueForProperty("IrDetailLast15MinutesTransferredByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).IrDetailLast15MinutesTransferredByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("IrDetailLastDataTransferTimeUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).IrDetailLastDataTransferTimeUtc = (string) content.GetValueForProperty("IrDetailLastDataTransferTimeUtc",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).IrDetailLastDataTransferTimeUtc, global::System.Convert.ToString); + } + if (content.Contains("IrDetailProcessedByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).IrDetailProcessedByte = (long?) content.GetValueForProperty("IrDetailProcessedByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).IrDetailProcessedByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("IrDetailStartTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).IrDetailStartTime = (string) content.GetValueForProperty("IrDetailStartTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).IrDetailStartTime, global::System.Convert.ToString); + } + if (content.Contains("IrDetailLastRefreshTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).IrDetailLastRefreshTime = (string) content.GetValueForProperty("IrDetailLastRefreshTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).IrDetailLastRefreshTime, global::System.Convert.ToString); + } + if (content.Contains("IrDetailProgressPercentage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).IrDetailProgressPercentage = (int?) content.GetValueForProperty("IrDetailProgressPercentage",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).IrDetailProgressPercentage, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("ResyncDetailProgressHealth")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).ResyncDetailProgressHealth = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskReplicationProgressHealth?) content.GetValueForProperty("ResyncDetailProgressHealth",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).ResyncDetailProgressHealth, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskReplicationProgressHealth.CreateFrom); + } + if (content.Contains("ResyncDetailTransferredByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).ResyncDetailTransferredByte = (long?) content.GetValueForProperty("ResyncDetailTransferredByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).ResyncDetailTransferredByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("ResyncDetailLast15MinutesTransferredByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).ResyncDetailLast15MinutesTransferredByte = (long?) content.GetValueForProperty("ResyncDetailLast15MinutesTransferredByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).ResyncDetailLast15MinutesTransferredByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("ResyncDetailLastDataTransferTimeUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).ResyncDetailLastDataTransferTimeUtc = (string) content.GetValueForProperty("ResyncDetailLastDataTransferTimeUtc",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).ResyncDetailLastDataTransferTimeUtc, global::System.Convert.ToString); + } + if (content.Contains("ResyncDetailProcessedByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).ResyncDetailProcessedByte = (long?) content.GetValueForProperty("ResyncDetailProcessedByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).ResyncDetailProcessedByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("ResyncDetailStartTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).ResyncDetailStartTime = (string) content.GetValueForProperty("ResyncDetailStartTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).ResyncDetailStartTime, global::System.Convert.ToString); + } + if (content.Contains("ResyncDetailLastRefreshTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).ResyncDetailLastRefreshTime = (string) content.GetValueForProperty("ResyncDetailLastRefreshTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).ResyncDetailLastRefreshTime, global::System.Convert.ToString); + } + if (content.Contains("ResyncDetailProgressPercentage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).ResyncDetailProgressPercentage = (int?) content.GetValueForProperty("ResyncDetailProgressPercentage",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal)this).ResyncDetailProgressPercentage, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// InMageRcmFailback protected disk details. + [System.ComponentModel.TypeConverter(typeof(InMageRcmFailbackProtectedDiskDetailsTypeConverter))] + public partial interface IInMageRcmFailbackProtectedDiskDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackProtectedDiskDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackProtectedDiskDetails.TypeConverter.cs new file mode 100644 index 000000000000..bae4464d6449 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackProtectedDiskDetails.TypeConverter.cs @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InMageRcmFailbackProtectedDiskDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InMageRcmFailbackProtectedDiskDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InMageRcmFailbackProtectedDiskDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InMageRcmFailbackProtectedDiskDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackProtectedDiskDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackProtectedDiskDetails.cs new file mode 100644 index 000000000000..4a32e74c02de --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackProtectedDiskDetails.cs @@ -0,0 +1,534 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMageRcmFailback protected disk details. + public partial class InMageRcmFailbackProtectedDiskDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal + { + + /// Backing field for property. + private long? _capacityInByte; + + /// The disk capacity in bytes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public long? CapacityInByte { get => this._capacityInByte; } + + /// Backing field for property. + private double? _dataPendingAtSourceAgentInMb; + + /// The data pending at source agent in MB. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public double? DataPendingAtSourceAgentInMb { get => this._dataPendingAtSourceAgentInMb; } + + /// Backing field for property. + private double? _dataPendingInLogDataStoreInMb; + + /// The data pending in log data store in MB. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public double? DataPendingInLogDataStoreInMb { get => this._dataPendingInLogDataStoreInMb; } + + /// Backing field for property. + private string _diskId; + + /// The disk Id (reported by source agent). + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string DiskId { get => this._diskId; } + + /// Backing field for property. + private string _diskName; + + /// The disk name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string DiskName { get => this._diskName; } + + /// Backing field for property. + private string _diskUuid; + + /// The disk Uuid (reported by vCenter). + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string DiskUuid { get => this._diskUuid; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetails _irDetail; + + /// The initial replication details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetails IrDetail { get => (this._irDetail = this._irDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmFailbackSyncDetails()); set => this._irDetail = value; } + + /// The bytes transferred in last 15 minutes from source VM to target. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public long? IrDetailLast15MinutesTransferredByte { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetailsInternal)IrDetail).Last15MinutesTransferredByte; } + + /// The time of the last data transfer from source VM to target. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string IrDetailLastDataTransferTimeUtc { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetailsInternal)IrDetail).LastDataTransferTimeUtc; } + + /// The last refresh time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string IrDetailLastRefreshTime { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetailsInternal)IrDetail).LastRefreshTime; } + + /// + /// The total processed bytes. This includes bytes that are transferred from source VM to target and matched bytes. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public long? IrDetailProcessedByte { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetailsInternal)IrDetail).ProcessedByte; } + + /// The progress health. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskReplicationProgressHealth? IrDetailProgressHealth { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetailsInternal)IrDetail).ProgressHealth; } + + /// + /// Progress in percentage. Progress percentage is calculated based on processed bytes. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public int? IrDetailProgressPercentage { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetailsInternal)IrDetail).ProgressPercentage; } + + /// The start time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string IrDetailStartTime { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetailsInternal)IrDetail).StartTime; } + + /// The transferred bytes from source VM to azure for the disk. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public long? IrDetailTransferredByte { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetailsInternal)IrDetail).TransferredByte; } + + /// Backing field for property. + private string _isInitialReplicationComplete; + + /// A value indicating whether initial replication is complete or not. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string IsInitialReplicationComplete { get => this._isInitialReplicationComplete; } + + /// Backing field for property. + private string _isOSDisk; + + /// A value indicating whether the disk is the OS disk. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string IsOSDisk { get => this._isOSDisk; } + + /// Backing field for property. + private global::System.DateTime? _lastSyncTime; + + /// The last sync time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public global::System.DateTime? LastSyncTime { get => this._lastSyncTime; } + + /// Internal Acessors for CapacityInByte + long? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal.CapacityInByte { get => this._capacityInByte; set { {_capacityInByte = value;} } } + + /// Internal Acessors for DataPendingAtSourceAgentInMb + double? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal.DataPendingAtSourceAgentInMb { get => this._dataPendingAtSourceAgentInMb; set { {_dataPendingAtSourceAgentInMb = value;} } } + + /// Internal Acessors for DataPendingInLogDataStoreInMb + double? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal.DataPendingInLogDataStoreInMb { get => this._dataPendingInLogDataStoreInMb; set { {_dataPendingInLogDataStoreInMb = value;} } } + + /// Internal Acessors for DiskId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal.DiskId { get => this._diskId; set { {_diskId = value;} } } + + /// Internal Acessors for DiskName + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal.DiskName { get => this._diskName; set { {_diskName = value;} } } + + /// Internal Acessors for DiskUuid + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal.DiskUuid { get => this._diskUuid; set { {_diskUuid = value;} } } + + /// Internal Acessors for IrDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetails Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal.IrDetail { get => (this._irDetail = this._irDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmFailbackSyncDetails()); set { {_irDetail = value;} } } + + /// Internal Acessors for IrDetailLast15MinutesTransferredByte + long? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal.IrDetailLast15MinutesTransferredByte { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetailsInternal)IrDetail).Last15MinutesTransferredByte; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetailsInternal)IrDetail).Last15MinutesTransferredByte = value; } + + /// Internal Acessors for IrDetailLastDataTransferTimeUtc + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal.IrDetailLastDataTransferTimeUtc { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetailsInternal)IrDetail).LastDataTransferTimeUtc; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetailsInternal)IrDetail).LastDataTransferTimeUtc = value; } + + /// Internal Acessors for IrDetailLastRefreshTime + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal.IrDetailLastRefreshTime { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetailsInternal)IrDetail).LastRefreshTime; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetailsInternal)IrDetail).LastRefreshTime = value; } + + /// Internal Acessors for IrDetailProcessedByte + long? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal.IrDetailProcessedByte { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetailsInternal)IrDetail).ProcessedByte; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetailsInternal)IrDetail).ProcessedByte = value; } + + /// Internal Acessors for IrDetailProgressHealth + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskReplicationProgressHealth? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal.IrDetailProgressHealth { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetailsInternal)IrDetail).ProgressHealth; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetailsInternal)IrDetail).ProgressHealth = value; } + + /// Internal Acessors for IrDetailProgressPercentage + int? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal.IrDetailProgressPercentage { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetailsInternal)IrDetail).ProgressPercentage; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetailsInternal)IrDetail).ProgressPercentage = value; } + + /// Internal Acessors for IrDetailStartTime + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal.IrDetailStartTime { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetailsInternal)IrDetail).StartTime; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetailsInternal)IrDetail).StartTime = value; } + + /// Internal Acessors for IrDetailTransferredByte + long? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal.IrDetailTransferredByte { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetailsInternal)IrDetail).TransferredByte; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetailsInternal)IrDetail).TransferredByte = value; } + + /// Internal Acessors for IsInitialReplicationComplete + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal.IsInitialReplicationComplete { get => this._isInitialReplicationComplete; set { {_isInitialReplicationComplete = value;} } } + + /// Internal Acessors for IsOSDisk + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal.IsOSDisk { get => this._isOSDisk; set { {_isOSDisk = value;} } } + + /// Internal Acessors for LastSyncTime + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal.LastSyncTime { get => this._lastSyncTime; set { {_lastSyncTime = value;} } } + + /// Internal Acessors for ResyncDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetails Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal.ResyncDetail { get => (this._resyncDetail = this._resyncDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmFailbackSyncDetails()); set { {_resyncDetail = value;} } } + + /// Internal Acessors for ResyncDetailLast15MinutesTransferredByte + long? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal.ResyncDetailLast15MinutesTransferredByte { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetailsInternal)ResyncDetail).Last15MinutesTransferredByte; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetailsInternal)ResyncDetail).Last15MinutesTransferredByte = value; } + + /// Internal Acessors for ResyncDetailLastDataTransferTimeUtc + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal.ResyncDetailLastDataTransferTimeUtc { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetailsInternal)ResyncDetail).LastDataTransferTimeUtc; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetailsInternal)ResyncDetail).LastDataTransferTimeUtc = value; } + + /// Internal Acessors for ResyncDetailLastRefreshTime + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal.ResyncDetailLastRefreshTime { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetailsInternal)ResyncDetail).LastRefreshTime; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetailsInternal)ResyncDetail).LastRefreshTime = value; } + + /// Internal Acessors for ResyncDetailProcessedByte + long? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal.ResyncDetailProcessedByte { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetailsInternal)ResyncDetail).ProcessedByte; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetailsInternal)ResyncDetail).ProcessedByte = value; } + + /// Internal Acessors for ResyncDetailProgressHealth + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskReplicationProgressHealth? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal.ResyncDetailProgressHealth { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetailsInternal)ResyncDetail).ProgressHealth; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetailsInternal)ResyncDetail).ProgressHealth = value; } + + /// Internal Acessors for ResyncDetailProgressPercentage + int? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal.ResyncDetailProgressPercentage { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetailsInternal)ResyncDetail).ProgressPercentage; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetailsInternal)ResyncDetail).ProgressPercentage = value; } + + /// Internal Acessors for ResyncDetailStartTime + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal.ResyncDetailStartTime { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetailsInternal)ResyncDetail).StartTime; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetailsInternal)ResyncDetail).StartTime = value; } + + /// Internal Acessors for ResyncDetailTransferredByte + long? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetailsInternal.ResyncDetailTransferredByte { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetailsInternal)ResyncDetail).TransferredByte; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetailsInternal)ResyncDetail).TransferredByte = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetails _resyncDetail; + + /// The resync details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetails ResyncDetail { get => (this._resyncDetail = this._resyncDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmFailbackSyncDetails()); set => this._resyncDetail = value; } + + /// The bytes transferred in last 15 minutes from source VM to target. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public long? ResyncDetailLast15MinutesTransferredByte { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetailsInternal)ResyncDetail).Last15MinutesTransferredByte; } + + /// The time of the last data transfer from source VM to target. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ResyncDetailLastDataTransferTimeUtc { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetailsInternal)ResyncDetail).LastDataTransferTimeUtc; } + + /// The last refresh time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ResyncDetailLastRefreshTime { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetailsInternal)ResyncDetail).LastRefreshTime; } + + /// + /// The total processed bytes. This includes bytes that are transferred from source VM to target and matched bytes. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public long? ResyncDetailProcessedByte { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetailsInternal)ResyncDetail).ProcessedByte; } + + /// The progress health. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskReplicationProgressHealth? ResyncDetailProgressHealth { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetailsInternal)ResyncDetail).ProgressHealth; } + + /// + /// Progress in percentage. Progress percentage is calculated based on processed bytes. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public int? ResyncDetailProgressPercentage { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetailsInternal)ResyncDetail).ProgressPercentage; } + + /// The start time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ResyncDetailStartTime { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetailsInternal)ResyncDetail).StartTime; } + + /// The transferred bytes from source VM to azure for the disk. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public long? ResyncDetailTransferredByte { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetailsInternal)ResyncDetail).TransferredByte; } + + /// Creates an new instance. + public InMageRcmFailbackProtectedDiskDetails() + { + + } + } + /// InMageRcmFailback protected disk details. + public partial interface IInMageRcmFailbackProtectedDiskDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The disk capacity in bytes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The disk capacity in bytes.", + SerializedName = @"capacityInBytes", + PossibleTypes = new [] { typeof(long) })] + long? CapacityInByte { get; } + /// The data pending at source agent in MB. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The data pending at source agent in MB.", + SerializedName = @"dataPendingAtSourceAgentInMB", + PossibleTypes = new [] { typeof(double) })] + double? DataPendingAtSourceAgentInMb { get; } + /// The data pending in log data store in MB. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The data pending in log data store in MB.", + SerializedName = @"dataPendingInLogDataStoreInMB", + PossibleTypes = new [] { typeof(double) })] + double? DataPendingInLogDataStoreInMb { get; } + /// The disk Id (reported by source agent). + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The disk Id (reported by source agent).", + SerializedName = @"diskId", + PossibleTypes = new [] { typeof(string) })] + string DiskId { get; } + /// The disk name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The disk name.", + SerializedName = @"diskName", + PossibleTypes = new [] { typeof(string) })] + string DiskName { get; } + /// The disk Uuid (reported by vCenter). + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The disk Uuid (reported by vCenter).", + SerializedName = @"diskUuid", + PossibleTypes = new [] { typeof(string) })] + string DiskUuid { get; } + /// The bytes transferred in last 15 minutes from source VM to target. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The bytes transferred in last 15 minutes from source VM to target.", + SerializedName = @"last15MinutesTransferredBytes", + PossibleTypes = new [] { typeof(long) })] + long? IrDetailLast15MinutesTransferredByte { get; } + /// The time of the last data transfer from source VM to target. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The time of the last data transfer from source VM to target.", + SerializedName = @"lastDataTransferTimeUtc", + PossibleTypes = new [] { typeof(string) })] + string IrDetailLastDataTransferTimeUtc { get; } + /// The last refresh time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The last refresh time.", + SerializedName = @"lastRefreshTime", + PossibleTypes = new [] { typeof(string) })] + string IrDetailLastRefreshTime { get; } + /// + /// The total processed bytes. This includes bytes that are transferred from source VM to target and matched bytes. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The total processed bytes. This includes bytes that are transferred from source VM to target and matched bytes.", + SerializedName = @"processedBytes", + PossibleTypes = new [] { typeof(long) })] + long? IrDetailProcessedByte { get; } + /// The progress health. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The progress health.", + SerializedName = @"progressHealth", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskReplicationProgressHealth) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskReplicationProgressHealth? IrDetailProgressHealth { get; } + /// + /// Progress in percentage. Progress percentage is calculated based on processed bytes. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Progress in percentage. Progress percentage is calculated based on processed bytes.", + SerializedName = @"progressPercentage", + PossibleTypes = new [] { typeof(int) })] + int? IrDetailProgressPercentage { get; } + /// The start time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The start time.", + SerializedName = @"startTime", + PossibleTypes = new [] { typeof(string) })] + string IrDetailStartTime { get; } + /// The transferred bytes from source VM to azure for the disk. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The transferred bytes from source VM to azure for the disk.", + SerializedName = @"transferredBytes", + PossibleTypes = new [] { typeof(long) })] + long? IrDetailTransferredByte { get; } + /// A value indicating whether initial replication is complete or not. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"A value indicating whether initial replication is complete or not.", + SerializedName = @"isInitialReplicationComplete", + PossibleTypes = new [] { typeof(string) })] + string IsInitialReplicationComplete { get; } + /// A value indicating whether the disk is the OS disk. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"A value indicating whether the disk is the OS disk.", + SerializedName = @"isOSDisk", + PossibleTypes = new [] { typeof(string) })] + string IsOSDisk { get; } + /// The last sync time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The last sync time.", + SerializedName = @"lastSyncTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? LastSyncTime { get; } + /// The bytes transferred in last 15 minutes from source VM to target. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The bytes transferred in last 15 minutes from source VM to target.", + SerializedName = @"last15MinutesTransferredBytes", + PossibleTypes = new [] { typeof(long) })] + long? ResyncDetailLast15MinutesTransferredByte { get; } + /// The time of the last data transfer from source VM to target. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The time of the last data transfer from source VM to target.", + SerializedName = @"lastDataTransferTimeUtc", + PossibleTypes = new [] { typeof(string) })] + string ResyncDetailLastDataTransferTimeUtc { get; } + /// The last refresh time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The last refresh time.", + SerializedName = @"lastRefreshTime", + PossibleTypes = new [] { typeof(string) })] + string ResyncDetailLastRefreshTime { get; } + /// + /// The total processed bytes. This includes bytes that are transferred from source VM to target and matched bytes. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The total processed bytes. This includes bytes that are transferred from source VM to target and matched bytes.", + SerializedName = @"processedBytes", + PossibleTypes = new [] { typeof(long) })] + long? ResyncDetailProcessedByte { get; } + /// The progress health. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The progress health.", + SerializedName = @"progressHealth", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskReplicationProgressHealth) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskReplicationProgressHealth? ResyncDetailProgressHealth { get; } + /// + /// Progress in percentage. Progress percentage is calculated based on processed bytes. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Progress in percentage. Progress percentage is calculated based on processed bytes.", + SerializedName = @"progressPercentage", + PossibleTypes = new [] { typeof(int) })] + int? ResyncDetailProgressPercentage { get; } + /// The start time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The start time.", + SerializedName = @"startTime", + PossibleTypes = new [] { typeof(string) })] + string ResyncDetailStartTime { get; } + /// The transferred bytes from source VM to azure for the disk. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The transferred bytes from source VM to azure for the disk.", + SerializedName = @"transferredBytes", + PossibleTypes = new [] { typeof(long) })] + long? ResyncDetailTransferredByte { get; } + + } + /// InMageRcmFailback protected disk details. + internal partial interface IInMageRcmFailbackProtectedDiskDetailsInternal + + { + /// The disk capacity in bytes. + long? CapacityInByte { get; set; } + /// The data pending at source agent in MB. + double? DataPendingAtSourceAgentInMb { get; set; } + /// The data pending in log data store in MB. + double? DataPendingInLogDataStoreInMb { get; set; } + /// The disk Id (reported by source agent). + string DiskId { get; set; } + /// The disk name. + string DiskName { get; set; } + /// The disk Uuid (reported by vCenter). + string DiskUuid { get; set; } + /// The initial replication details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetails IrDetail { get; set; } + /// The bytes transferred in last 15 minutes from source VM to target. + long? IrDetailLast15MinutesTransferredByte { get; set; } + /// The time of the last data transfer from source VM to target. + string IrDetailLastDataTransferTimeUtc { get; set; } + /// The last refresh time. + string IrDetailLastRefreshTime { get; set; } + /// + /// The total processed bytes. This includes bytes that are transferred from source VM to target and matched bytes. + /// + long? IrDetailProcessedByte { get; set; } + /// The progress health. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskReplicationProgressHealth? IrDetailProgressHealth { get; set; } + /// + /// Progress in percentage. Progress percentage is calculated based on processed bytes. + /// + int? IrDetailProgressPercentage { get; set; } + /// The start time. + string IrDetailStartTime { get; set; } + /// The transferred bytes from source VM to azure for the disk. + long? IrDetailTransferredByte { get; set; } + /// A value indicating whether initial replication is complete or not. + string IsInitialReplicationComplete { get; set; } + /// A value indicating whether the disk is the OS disk. + string IsOSDisk { get; set; } + /// The last sync time. + global::System.DateTime? LastSyncTime { get; set; } + /// The resync details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetails ResyncDetail { get; set; } + /// The bytes transferred in last 15 minutes from source VM to target. + long? ResyncDetailLast15MinutesTransferredByte { get; set; } + /// The time of the last data transfer from source VM to target. + string ResyncDetailLastDataTransferTimeUtc { get; set; } + /// The last refresh time. + string ResyncDetailLastRefreshTime { get; set; } + /// + /// The total processed bytes. This includes bytes that are transferred from source VM to target and matched bytes. + /// + long? ResyncDetailProcessedByte { get; set; } + /// The progress health. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskReplicationProgressHealth? ResyncDetailProgressHealth { get; set; } + /// + /// Progress in percentage. Progress percentage is calculated based on processed bytes. + /// + int? ResyncDetailProgressPercentage { get; set; } + /// The start time. + string ResyncDetailStartTime { get; set; } + /// The transferred bytes from source VM to azure for the disk. + long? ResyncDetailTransferredByte { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackProtectedDiskDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackProtectedDiskDetails.json.cs new file mode 100644 index 000000000000..857266490197 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackProtectedDiskDetails.json.cs @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMageRcmFailback protected disk details. + public partial class InMageRcmFailbackProtectedDiskDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new InMageRcmFailbackProtectedDiskDetails(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal InMageRcmFailbackProtectedDiskDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_irDetail = If( json?.PropertyT("irDetails"), out var __jsonIrDetails) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmFailbackSyncDetails.FromJson(__jsonIrDetails) : IrDetail;} + {_resyncDetail = If( json?.PropertyT("resyncDetails"), out var __jsonResyncDetails) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmFailbackSyncDetails.FromJson(__jsonResyncDetails) : ResyncDetail;} + {_diskId = If( json?.PropertyT("diskId"), out var __jsonDiskId) ? (string)__jsonDiskId : (string)DiskId;} + {_diskName = If( json?.PropertyT("diskName"), out var __jsonDiskName) ? (string)__jsonDiskName : (string)DiskName;} + {_isOSDisk = If( json?.PropertyT("isOSDisk"), out var __jsonIsOSDisk) ? (string)__jsonIsOSDisk : (string)IsOSDisk;} + {_capacityInByte = If( json?.PropertyT("capacityInBytes"), out var __jsonCapacityInBytes) ? (long?)__jsonCapacityInBytes : CapacityInByte;} + {_diskUuid = If( json?.PropertyT("diskUuid"), out var __jsonDiskUuid) ? (string)__jsonDiskUuid : (string)DiskUuid;} + {_dataPendingInLogDataStoreInMb = If( json?.PropertyT("dataPendingInLogDataStoreInMB"), out var __jsonDataPendingInLogDataStoreInMb) ? (double?)__jsonDataPendingInLogDataStoreInMb : DataPendingInLogDataStoreInMb;} + {_dataPendingAtSourceAgentInMb = If( json?.PropertyT("dataPendingAtSourceAgentInMB"), out var __jsonDataPendingAtSourceAgentInMb) ? (double?)__jsonDataPendingAtSourceAgentInMb : DataPendingAtSourceAgentInMb;} + {_isInitialReplicationComplete = If( json?.PropertyT("isInitialReplicationComplete"), out var __jsonIsInitialReplicationComplete) ? (string)__jsonIsInitialReplicationComplete : (string)IsInitialReplicationComplete;} + {_lastSyncTime = If( json?.PropertyT("lastSyncTime"), out var __jsonLastSyncTime) ? global::System.DateTime.TryParse((string)__jsonLastSyncTime, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonLastSyncTimeValue) ? __jsonLastSyncTimeValue : LastSyncTime : LastSyncTime;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._irDetail ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._irDetail.ToJson(null,serializationMode) : null, "irDetails" ,container.Add ); + AddIf( null != this._resyncDetail ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._resyncDetail.ToJson(null,serializationMode) : null, "resyncDetails" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._diskId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._diskId.ToString()) : null, "diskId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._diskName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._diskName.ToString()) : null, "diskName" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._isOSDisk)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._isOSDisk.ToString()) : null, "isOSDisk" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._capacityInByte ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((long)this._capacityInByte) : null, "capacityInBytes" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._diskUuid)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._diskUuid.ToString()) : null, "diskUuid" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._dataPendingInLogDataStoreInMb ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((double)this._dataPendingInLogDataStoreInMb) : null, "dataPendingInLogDataStoreInMB" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._dataPendingAtSourceAgentInMb ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((double)this._dataPendingAtSourceAgentInMb) : null, "dataPendingAtSourceAgentInMB" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._isInitialReplicationComplete)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._isInitialReplicationComplete.ToString()) : null, "isInitialReplicationComplete" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._lastSyncTime ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._lastSyncTime?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "lastSyncTime" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackReplicationDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackReplicationDetails.PowerShell.cs new file mode 100644 index 000000000000..7672d663070b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackReplicationDetails.PowerShell.cs @@ -0,0 +1,548 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// InMageRcmFailback provider specific details. + [System.ComponentModel.TypeConverter(typeof(InMageRcmFailbackReplicationDetailsTypeConverter))] + public partial class InMageRcmFailbackReplicationDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InMageRcmFailbackReplicationDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InMageRcmFailbackReplicationDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InMageRcmFailbackReplicationDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("MobilityAgentDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).MobilityAgentDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackMobilityAgentDetails) content.GetValueForProperty("MobilityAgentDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).MobilityAgentDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmFailbackMobilityAgentDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("DiscoveredVMDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).DiscoveredVMDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetails) content.GetValueForProperty("DiscoveredVMDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).DiscoveredVMDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmFailbackDiscoveredProtectedVMDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("InternalIdentifier")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).InternalIdentifier = (string) content.GetValueForProperty("InternalIdentifier",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).InternalIdentifier, global::System.Convert.ToString); + } + if (content.Contains("AzureVirtualMachineId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).AzureVirtualMachineId = (string) content.GetValueForProperty("AzureVirtualMachineId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).AzureVirtualMachineId, global::System.Convert.ToString); + } + if (content.Contains("MultiVMGroupName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).MultiVMGroupName = (string) content.GetValueForProperty("MultiVMGroupName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).MultiVMGroupName, global::System.Convert.ToString); + } + if (content.Contains("ReprotectAgentId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).ReprotectAgentId = (string) content.GetValueForProperty("ReprotectAgentId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).ReprotectAgentId, global::System.Convert.ToString); + } + if (content.Contains("ReprotectAgentName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).ReprotectAgentName = (string) content.GetValueForProperty("ReprotectAgentName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).ReprotectAgentName, global::System.Convert.ToString); + } + if (content.Contains("OSType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).OSType = (string) content.GetValueForProperty("OSType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).OSType, global::System.Convert.ToString); + } + if (content.Contains("LogStorageAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).LogStorageAccountId = (string) content.GetValueForProperty("LogStorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).LogStorageAccountId, global::System.Convert.ToString); + } + if (content.Contains("TargetvCenterId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).TargetvCenterId = (string) content.GetValueForProperty("TargetvCenterId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).TargetvCenterId, global::System.Convert.ToString); + } + if (content.Contains("TargetDataStoreName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).TargetDataStoreName = (string) content.GetValueForProperty("TargetDataStoreName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).TargetDataStoreName, global::System.Convert.ToString); + } + if (content.Contains("TargetVMName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).TargetVMName = (string) content.GetValueForProperty("TargetVMName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).TargetVMName, global::System.Convert.ToString); + } + if (content.Contains("InitialReplicationProgressPercentage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).InitialReplicationProgressPercentage = (int?) content.GetValueForProperty("InitialReplicationProgressPercentage",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).InitialReplicationProgressPercentage, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("InitialReplicationProcessedByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).InitialReplicationProcessedByte = (long?) content.GetValueForProperty("InitialReplicationProcessedByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).InitialReplicationProcessedByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("InitialReplicationTransferredByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).InitialReplicationTransferredByte = (long?) content.GetValueForProperty("InitialReplicationTransferredByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).InitialReplicationTransferredByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("InitialReplicationProgressHealth")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).InitialReplicationProgressHealth = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.VMReplicationProgressHealth?) content.GetValueForProperty("InitialReplicationProgressHealth",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).InitialReplicationProgressHealth, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.VMReplicationProgressHealth.CreateFrom); + } + if (content.Contains("ResyncProgressPercentage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).ResyncProgressPercentage = (int?) content.GetValueForProperty("ResyncProgressPercentage",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).ResyncProgressPercentage, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("ResyncProcessedByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).ResyncProcessedByte = (long?) content.GetValueForProperty("ResyncProcessedByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).ResyncProcessedByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("ResyncTransferredByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).ResyncTransferredByte = (long?) content.GetValueForProperty("ResyncTransferredByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).ResyncTransferredByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("ResyncProgressHealth")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).ResyncProgressHealth = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.VMReplicationProgressHealth?) content.GetValueForProperty("ResyncProgressHealth",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).ResyncProgressHealth, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.VMReplicationProgressHealth.CreateFrom); + } + if (content.Contains("ResyncRequired")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).ResyncRequired = (string) content.GetValueForProperty("ResyncRequired",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).ResyncRequired, global::System.Convert.ToString); + } + if (content.Contains("ResyncState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).ResyncState = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ResyncState?) content.GetValueForProperty("ResyncState",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).ResyncState, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ResyncState.CreateFrom); + } + if (content.Contains("ProtectedDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).ProtectedDisk = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetails[]) content.GetValueForProperty("ProtectedDisk",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).ProtectedDisk, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmFailbackProtectedDiskDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("VMNic")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).VMNic = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackNicDetails[]) content.GetValueForProperty("VMNic",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).VMNic, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmFailbackNicDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("LastPlannedFailoverStartTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).LastPlannedFailoverStartTime = (global::System.DateTime?) content.GetValueForProperty("LastPlannedFailoverStartTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).LastPlannedFailoverStartTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("LastPlannedFailoverStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).LastPlannedFailoverStatus = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PlannedFailoverStatus?) content.GetValueForProperty("LastPlannedFailoverStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).LastPlannedFailoverStatus, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PlannedFailoverStatus.CreateFrom); + } + if (content.Contains("LastUsedPolicyId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).LastUsedPolicyId = (string) content.GetValueForProperty("LastUsedPolicyId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).LastUsedPolicyId, global::System.Convert.ToString); + } + if (content.Contains("LastUsedPolicyFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).LastUsedPolicyFriendlyName = (string) content.GetValueForProperty("LastUsedPolicyFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).LastUsedPolicyFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("IsAgentRegistrationSuccessfulAfterFailover")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).IsAgentRegistrationSuccessfulAfterFailover = (bool?) content.GetValueForProperty("IsAgentRegistrationSuccessfulAfterFailover",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).IsAgentRegistrationSuccessfulAfterFailover, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettingsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettingsInternal)this).InstanceType, global::System.Convert.ToString); + } + if (content.Contains("MobilityAgentDetailVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).MobilityAgentDetailVersion = (string) content.GetValueForProperty("MobilityAgentDetailVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).MobilityAgentDetailVersion, global::System.Convert.ToString); + } + if (content.Contains("MobilityAgentDetailLatestVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).MobilityAgentDetailLatestVersion = (string) content.GetValueForProperty("MobilityAgentDetailLatestVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).MobilityAgentDetailLatestVersion, global::System.Convert.ToString); + } + if (content.Contains("MobilityAgentDetailDriverVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).MobilityAgentDetailDriverVersion = (string) content.GetValueForProperty("MobilityAgentDetailDriverVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).MobilityAgentDetailDriverVersion, global::System.Convert.ToString); + } + if (content.Contains("MobilityAgentDetailLatestUpgradableVersionWithoutReboot")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).MobilityAgentDetailLatestUpgradableVersionWithoutReboot = (string) content.GetValueForProperty("MobilityAgentDetailLatestUpgradableVersionWithoutReboot",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).MobilityAgentDetailLatestUpgradableVersionWithoutReboot, global::System.Convert.ToString); + } + if (content.Contains("MobilityAgentDetailAgentVersionExpiryDate")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).MobilityAgentDetailAgentVersionExpiryDate = (global::System.DateTime?) content.GetValueForProperty("MobilityAgentDetailAgentVersionExpiryDate",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).MobilityAgentDetailAgentVersionExpiryDate, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("MobilityAgentDetailDriverVersionExpiryDate")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).MobilityAgentDetailDriverVersionExpiryDate = (global::System.DateTime?) content.GetValueForProperty("MobilityAgentDetailDriverVersionExpiryDate",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).MobilityAgentDetailDriverVersionExpiryDate, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("MobilityAgentDetailLastHeartbeatUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).MobilityAgentDetailLastHeartbeatUtc = (global::System.DateTime?) content.GetValueForProperty("MobilityAgentDetailLastHeartbeatUtc",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).MobilityAgentDetailLastHeartbeatUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("MobilityAgentDetailReasonsBlockingUpgrade")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).MobilityAgentDetailReasonsBlockingUpgrade = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentUpgradeBlockedReason[]) content.GetValueForProperty("MobilityAgentDetailReasonsBlockingUpgrade",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).MobilityAgentDetailReasonsBlockingUpgrade, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentUpgradeBlockedReason.CreateFrom)); + } + if (content.Contains("MobilityAgentDetailIsUpgradeable")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).MobilityAgentDetailIsUpgradeable = (string) content.GetValueForProperty("MobilityAgentDetailIsUpgradeable",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).MobilityAgentDetailIsUpgradeable, global::System.Convert.ToString); + } + if (content.Contains("DiscoveredVMDetailVcenterId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).DiscoveredVMDetailVcenterId = (string) content.GetValueForProperty("DiscoveredVMDetailVcenterId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).DiscoveredVMDetailVcenterId, global::System.Convert.ToString); + } + if (content.Contains("DiscoveredVMDetailVcenterFqdn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).DiscoveredVMDetailVcenterFqdn = (string) content.GetValueForProperty("DiscoveredVMDetailVcenterFqdn",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).DiscoveredVMDetailVcenterFqdn, global::System.Convert.ToString); + } + if (content.Contains("DiscoveredVMDetailDatastore")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).DiscoveredVMDetailDatastore = (string[]) content.GetValueForProperty("DiscoveredVMDetailDatastore",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).DiscoveredVMDetailDatastore, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("DiscoveredVMDetailIpaddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).DiscoveredVMDetailIpaddress = (string[]) content.GetValueForProperty("DiscoveredVMDetailIpaddress",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).DiscoveredVMDetailIpaddress, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("DiscoveredVMDetailVmwareToolsStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).DiscoveredVMDetailVmwareToolsStatus = (string) content.GetValueForProperty("DiscoveredVMDetailVmwareToolsStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).DiscoveredVMDetailVmwareToolsStatus, global::System.Convert.ToString); + } + if (content.Contains("DiscoveredVMDetailPowerStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).DiscoveredVMDetailPowerStatus = (string) content.GetValueForProperty("DiscoveredVMDetailPowerStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).DiscoveredVMDetailPowerStatus, global::System.Convert.ToString); + } + if (content.Contains("DiscoveredVMDetailVmfqdn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).DiscoveredVMDetailVmfqdn = (string) content.GetValueForProperty("DiscoveredVMDetailVmfqdn",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).DiscoveredVMDetailVmfqdn, global::System.Convert.ToString); + } + if (content.Contains("DiscoveredVMDetailOsname")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).DiscoveredVMDetailOsname = (string) content.GetValueForProperty("DiscoveredVMDetailOsname",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).DiscoveredVMDetailOsname, global::System.Convert.ToString); + } + if (content.Contains("DiscoveredVMDetailCreatedTimestamp")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).DiscoveredVMDetailCreatedTimestamp = (global::System.DateTime?) content.GetValueForProperty("DiscoveredVMDetailCreatedTimestamp",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).DiscoveredVMDetailCreatedTimestamp, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("DiscoveredVMDetailUpdatedTimestamp")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).DiscoveredVMDetailUpdatedTimestamp = (global::System.DateTime?) content.GetValueForProperty("DiscoveredVMDetailUpdatedTimestamp",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).DiscoveredVMDetailUpdatedTimestamp, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("DiscoveredVMDetailIsDeleted")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).DiscoveredVMDetailIsDeleted = (bool?) content.GetValueForProperty("DiscoveredVMDetailIsDeleted",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).DiscoveredVMDetailIsDeleted, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("DiscoveredVMDetailLastDiscoveryTimeInUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).DiscoveredVMDetailLastDiscoveryTimeInUtc = (global::System.DateTime?) content.GetValueForProperty("DiscoveredVMDetailLastDiscoveryTimeInUtc",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).DiscoveredVMDetailLastDiscoveryTimeInUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InMageRcmFailbackReplicationDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("MobilityAgentDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).MobilityAgentDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackMobilityAgentDetails) content.GetValueForProperty("MobilityAgentDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).MobilityAgentDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmFailbackMobilityAgentDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("DiscoveredVMDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).DiscoveredVMDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetails) content.GetValueForProperty("DiscoveredVMDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).DiscoveredVMDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmFailbackDiscoveredProtectedVMDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("InternalIdentifier")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).InternalIdentifier = (string) content.GetValueForProperty("InternalIdentifier",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).InternalIdentifier, global::System.Convert.ToString); + } + if (content.Contains("AzureVirtualMachineId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).AzureVirtualMachineId = (string) content.GetValueForProperty("AzureVirtualMachineId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).AzureVirtualMachineId, global::System.Convert.ToString); + } + if (content.Contains("MultiVMGroupName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).MultiVMGroupName = (string) content.GetValueForProperty("MultiVMGroupName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).MultiVMGroupName, global::System.Convert.ToString); + } + if (content.Contains("ReprotectAgentId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).ReprotectAgentId = (string) content.GetValueForProperty("ReprotectAgentId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).ReprotectAgentId, global::System.Convert.ToString); + } + if (content.Contains("ReprotectAgentName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).ReprotectAgentName = (string) content.GetValueForProperty("ReprotectAgentName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).ReprotectAgentName, global::System.Convert.ToString); + } + if (content.Contains("OSType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).OSType = (string) content.GetValueForProperty("OSType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).OSType, global::System.Convert.ToString); + } + if (content.Contains("LogStorageAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).LogStorageAccountId = (string) content.GetValueForProperty("LogStorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).LogStorageAccountId, global::System.Convert.ToString); + } + if (content.Contains("TargetvCenterId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).TargetvCenterId = (string) content.GetValueForProperty("TargetvCenterId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).TargetvCenterId, global::System.Convert.ToString); + } + if (content.Contains("TargetDataStoreName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).TargetDataStoreName = (string) content.GetValueForProperty("TargetDataStoreName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).TargetDataStoreName, global::System.Convert.ToString); + } + if (content.Contains("TargetVMName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).TargetVMName = (string) content.GetValueForProperty("TargetVMName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).TargetVMName, global::System.Convert.ToString); + } + if (content.Contains("InitialReplicationProgressPercentage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).InitialReplicationProgressPercentage = (int?) content.GetValueForProperty("InitialReplicationProgressPercentage",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).InitialReplicationProgressPercentage, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("InitialReplicationProcessedByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).InitialReplicationProcessedByte = (long?) content.GetValueForProperty("InitialReplicationProcessedByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).InitialReplicationProcessedByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("InitialReplicationTransferredByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).InitialReplicationTransferredByte = (long?) content.GetValueForProperty("InitialReplicationTransferredByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).InitialReplicationTransferredByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("InitialReplicationProgressHealth")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).InitialReplicationProgressHealth = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.VMReplicationProgressHealth?) content.GetValueForProperty("InitialReplicationProgressHealth",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).InitialReplicationProgressHealth, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.VMReplicationProgressHealth.CreateFrom); + } + if (content.Contains("ResyncProgressPercentage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).ResyncProgressPercentage = (int?) content.GetValueForProperty("ResyncProgressPercentage",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).ResyncProgressPercentage, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("ResyncProcessedByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).ResyncProcessedByte = (long?) content.GetValueForProperty("ResyncProcessedByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).ResyncProcessedByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("ResyncTransferredByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).ResyncTransferredByte = (long?) content.GetValueForProperty("ResyncTransferredByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).ResyncTransferredByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("ResyncProgressHealth")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).ResyncProgressHealth = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.VMReplicationProgressHealth?) content.GetValueForProperty("ResyncProgressHealth",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).ResyncProgressHealth, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.VMReplicationProgressHealth.CreateFrom); + } + if (content.Contains("ResyncRequired")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).ResyncRequired = (string) content.GetValueForProperty("ResyncRequired",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).ResyncRequired, global::System.Convert.ToString); + } + if (content.Contains("ResyncState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).ResyncState = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ResyncState?) content.GetValueForProperty("ResyncState",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).ResyncState, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ResyncState.CreateFrom); + } + if (content.Contains("ProtectedDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).ProtectedDisk = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetails[]) content.GetValueForProperty("ProtectedDisk",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).ProtectedDisk, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmFailbackProtectedDiskDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("VMNic")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).VMNic = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackNicDetails[]) content.GetValueForProperty("VMNic",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).VMNic, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmFailbackNicDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("LastPlannedFailoverStartTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).LastPlannedFailoverStartTime = (global::System.DateTime?) content.GetValueForProperty("LastPlannedFailoverStartTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).LastPlannedFailoverStartTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("LastPlannedFailoverStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).LastPlannedFailoverStatus = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PlannedFailoverStatus?) content.GetValueForProperty("LastPlannedFailoverStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).LastPlannedFailoverStatus, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PlannedFailoverStatus.CreateFrom); + } + if (content.Contains("LastUsedPolicyId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).LastUsedPolicyId = (string) content.GetValueForProperty("LastUsedPolicyId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).LastUsedPolicyId, global::System.Convert.ToString); + } + if (content.Contains("LastUsedPolicyFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).LastUsedPolicyFriendlyName = (string) content.GetValueForProperty("LastUsedPolicyFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).LastUsedPolicyFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("IsAgentRegistrationSuccessfulAfterFailover")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).IsAgentRegistrationSuccessfulAfterFailover = (bool?) content.GetValueForProperty("IsAgentRegistrationSuccessfulAfterFailover",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).IsAgentRegistrationSuccessfulAfterFailover, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettingsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettingsInternal)this).InstanceType, global::System.Convert.ToString); + } + if (content.Contains("MobilityAgentDetailVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).MobilityAgentDetailVersion = (string) content.GetValueForProperty("MobilityAgentDetailVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).MobilityAgentDetailVersion, global::System.Convert.ToString); + } + if (content.Contains("MobilityAgentDetailLatestVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).MobilityAgentDetailLatestVersion = (string) content.GetValueForProperty("MobilityAgentDetailLatestVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).MobilityAgentDetailLatestVersion, global::System.Convert.ToString); + } + if (content.Contains("MobilityAgentDetailDriverVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).MobilityAgentDetailDriverVersion = (string) content.GetValueForProperty("MobilityAgentDetailDriverVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).MobilityAgentDetailDriverVersion, global::System.Convert.ToString); + } + if (content.Contains("MobilityAgentDetailLatestUpgradableVersionWithoutReboot")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).MobilityAgentDetailLatestUpgradableVersionWithoutReboot = (string) content.GetValueForProperty("MobilityAgentDetailLatestUpgradableVersionWithoutReboot",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).MobilityAgentDetailLatestUpgradableVersionWithoutReboot, global::System.Convert.ToString); + } + if (content.Contains("MobilityAgentDetailAgentVersionExpiryDate")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).MobilityAgentDetailAgentVersionExpiryDate = (global::System.DateTime?) content.GetValueForProperty("MobilityAgentDetailAgentVersionExpiryDate",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).MobilityAgentDetailAgentVersionExpiryDate, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("MobilityAgentDetailDriverVersionExpiryDate")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).MobilityAgentDetailDriverVersionExpiryDate = (global::System.DateTime?) content.GetValueForProperty("MobilityAgentDetailDriverVersionExpiryDate",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).MobilityAgentDetailDriverVersionExpiryDate, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("MobilityAgentDetailLastHeartbeatUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).MobilityAgentDetailLastHeartbeatUtc = (global::System.DateTime?) content.GetValueForProperty("MobilityAgentDetailLastHeartbeatUtc",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).MobilityAgentDetailLastHeartbeatUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("MobilityAgentDetailReasonsBlockingUpgrade")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).MobilityAgentDetailReasonsBlockingUpgrade = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentUpgradeBlockedReason[]) content.GetValueForProperty("MobilityAgentDetailReasonsBlockingUpgrade",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).MobilityAgentDetailReasonsBlockingUpgrade, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentUpgradeBlockedReason.CreateFrom)); + } + if (content.Contains("MobilityAgentDetailIsUpgradeable")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).MobilityAgentDetailIsUpgradeable = (string) content.GetValueForProperty("MobilityAgentDetailIsUpgradeable",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).MobilityAgentDetailIsUpgradeable, global::System.Convert.ToString); + } + if (content.Contains("DiscoveredVMDetailVcenterId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).DiscoveredVMDetailVcenterId = (string) content.GetValueForProperty("DiscoveredVMDetailVcenterId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).DiscoveredVMDetailVcenterId, global::System.Convert.ToString); + } + if (content.Contains("DiscoveredVMDetailVcenterFqdn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).DiscoveredVMDetailVcenterFqdn = (string) content.GetValueForProperty("DiscoveredVMDetailVcenterFqdn",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).DiscoveredVMDetailVcenterFqdn, global::System.Convert.ToString); + } + if (content.Contains("DiscoveredVMDetailDatastore")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).DiscoveredVMDetailDatastore = (string[]) content.GetValueForProperty("DiscoveredVMDetailDatastore",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).DiscoveredVMDetailDatastore, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("DiscoveredVMDetailIpaddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).DiscoveredVMDetailIpaddress = (string[]) content.GetValueForProperty("DiscoveredVMDetailIpaddress",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).DiscoveredVMDetailIpaddress, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("DiscoveredVMDetailVmwareToolsStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).DiscoveredVMDetailVmwareToolsStatus = (string) content.GetValueForProperty("DiscoveredVMDetailVmwareToolsStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).DiscoveredVMDetailVmwareToolsStatus, global::System.Convert.ToString); + } + if (content.Contains("DiscoveredVMDetailPowerStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).DiscoveredVMDetailPowerStatus = (string) content.GetValueForProperty("DiscoveredVMDetailPowerStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).DiscoveredVMDetailPowerStatus, global::System.Convert.ToString); + } + if (content.Contains("DiscoveredVMDetailVmfqdn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).DiscoveredVMDetailVmfqdn = (string) content.GetValueForProperty("DiscoveredVMDetailVmfqdn",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).DiscoveredVMDetailVmfqdn, global::System.Convert.ToString); + } + if (content.Contains("DiscoveredVMDetailOsname")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).DiscoveredVMDetailOsname = (string) content.GetValueForProperty("DiscoveredVMDetailOsname",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).DiscoveredVMDetailOsname, global::System.Convert.ToString); + } + if (content.Contains("DiscoveredVMDetailCreatedTimestamp")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).DiscoveredVMDetailCreatedTimestamp = (global::System.DateTime?) content.GetValueForProperty("DiscoveredVMDetailCreatedTimestamp",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).DiscoveredVMDetailCreatedTimestamp, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("DiscoveredVMDetailUpdatedTimestamp")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).DiscoveredVMDetailUpdatedTimestamp = (global::System.DateTime?) content.GetValueForProperty("DiscoveredVMDetailUpdatedTimestamp",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).DiscoveredVMDetailUpdatedTimestamp, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("DiscoveredVMDetailIsDeleted")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).DiscoveredVMDetailIsDeleted = (bool?) content.GetValueForProperty("DiscoveredVMDetailIsDeleted",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).DiscoveredVMDetailIsDeleted, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("DiscoveredVMDetailLastDiscoveryTimeInUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).DiscoveredVMDetailLastDiscoveryTimeInUtc = (global::System.DateTime?) content.GetValueForProperty("DiscoveredVMDetailLastDiscoveryTimeInUtc",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal)this).DiscoveredVMDetailLastDiscoveryTimeInUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// InMageRcmFailback provider specific details. + [System.ComponentModel.TypeConverter(typeof(InMageRcmFailbackReplicationDetailsTypeConverter))] + public partial interface IInMageRcmFailbackReplicationDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackReplicationDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackReplicationDetails.TypeConverter.cs new file mode 100644 index 000000000000..53f46e1736a2 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackReplicationDetails.TypeConverter.cs @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InMageRcmFailbackReplicationDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InMageRcmFailbackReplicationDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InMageRcmFailbackReplicationDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InMageRcmFailbackReplicationDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackReplicationDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackReplicationDetails.cs new file mode 100644 index 000000000000..1db850378a6c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackReplicationDetails.cs @@ -0,0 +1,1004 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMageRcmFailback provider specific details. + public partial class InMageRcmFailbackReplicationDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettings __replicationProviderSpecificSettings = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProviderSpecificSettings(); + + /// Backing field for property. + private string _azureVirtualMachineId; + + /// The ARM Id of the azure VM. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string AzureVirtualMachineId { get => this._azureVirtualMachineId; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetails _discoveredVMDetail; + + /// The discovered VM information. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetails DiscoveredVMDetail { get => (this._discoveredVMDetail = this._discoveredVMDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmFailbackDiscoveredProtectedVMDetails()); set => this._discoveredVMDetail = value; } + + /// The SDS created timestamp. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public global::System.DateTime? DiscoveredVMDetailCreatedTimestamp { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetailsInternal)DiscoveredVMDetail).CreatedTimestamp; } + + /// The list of datastores. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string[] DiscoveredVMDetailDatastore { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetailsInternal)DiscoveredVMDetail).Datastore; } + + /// The list of IP addresses. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string[] DiscoveredVMDetailIpaddress { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetailsInternal)DiscoveredVMDetail).IPAddress; } + + /// A value indicating whether the VM is deleted. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public bool? DiscoveredVMDetailIsDeleted { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetailsInternal)DiscoveredVMDetail).IsDeleted; } + + /// The last time when SDS information discovered in SRS. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public global::System.DateTime? DiscoveredVMDetailLastDiscoveryTimeInUtc { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetailsInternal)DiscoveredVMDetail).LastDiscoveryTimeInUtc; } + + /// The VM's OS name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string DiscoveredVMDetailOsname { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetailsInternal)DiscoveredVMDetail).OSName; } + + /// The VM power status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string DiscoveredVMDetailPowerStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetailsInternal)DiscoveredVMDetail).PowerStatus; } + + /// The SDS updated timestamp. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public global::System.DateTime? DiscoveredVMDetailUpdatedTimestamp { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetailsInternal)DiscoveredVMDetail).UpdatedTimestamp; } + + /// The VCenter fqdn. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string DiscoveredVMDetailVcenterFqdn { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetailsInternal)DiscoveredVMDetail).VCenterFqdn; } + + /// The VCenter Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string DiscoveredVMDetailVcenterId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetailsInternal)DiscoveredVMDetail).VCenterId; } + + /// The VM fqdn. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string DiscoveredVMDetailVmfqdn { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetailsInternal)DiscoveredVMDetail).VMFqdn; } + + /// The VMware tools status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string DiscoveredVMDetailVmwareToolsStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetailsInternal)DiscoveredVMDetail).VmwareToolsStatus; } + + /// Backing field for property. + private long? _initialReplicationProcessedByte; + + /// + /// The initial replication processed bytes. This includes sum of total bytes transferred and matched bytes on all selected + /// disks in source VM. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public long? InitialReplicationProcessedByte { get => this._initialReplicationProcessedByte; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.VMReplicationProgressHealth? _initialReplicationProgressHealth; + + /// The initial replication progress health. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.VMReplicationProgressHealth? InitialReplicationProgressHealth { get => this._initialReplicationProgressHealth; } + + /// Backing field for property. + private int? _initialReplicationProgressPercentage; + + /// The initial replication progress percentage. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? InitialReplicationProgressPercentage { get => this._initialReplicationProgressPercentage; } + + /// Backing field for property. + private long? _initialReplicationTransferredByte; + + /// + /// The initial replication transferred bytes from source VM to target for all selected disks on source VM. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public long? InitialReplicationTransferredByte { get => this._initialReplicationTransferredByte; } + + /// Gets the Instance type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettingsInternal)__replicationProviderSpecificSettings).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettingsInternal)__replicationProviderSpecificSettings).InstanceType = value ; } + + /// Backing field for property. + private string _internalIdentifier; + + /// The virtual machine internal identifier. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string InternalIdentifier { get => this._internalIdentifier; } + + /// + /// Backing field for property. + /// + private bool? _isAgentRegistrationSuccessfulAfterFailover; + + /// A value indicating whether agent registration was successful after failover. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public bool? IsAgentRegistrationSuccessfulAfterFailover { get => this._isAgentRegistrationSuccessfulAfterFailover; } + + /// Backing field for property. + private global::System.DateTime? _lastPlannedFailoverStartTime; + + /// The last planned failover start time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public global::System.DateTime? LastPlannedFailoverStartTime { get => this._lastPlannedFailoverStartTime; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PlannedFailoverStatus? _lastPlannedFailoverStatus; + + /// The last planned failover status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PlannedFailoverStatus? LastPlannedFailoverStatus { get => this._lastPlannedFailoverStatus; } + + /// Backing field for property. + private string _lastUsedPolicyFriendlyName; + + /// The policy friendly name used by the forward replication. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string LastUsedPolicyFriendlyName { get => this._lastUsedPolicyFriendlyName; } + + /// Backing field for property. + private string _lastUsedPolicyId; + + /// The policy Id used by the forward replication. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string LastUsedPolicyId { get => this._lastUsedPolicyId; } + + /// Backing field for property. + private string _logStorageAccountId; + + /// The log storage account ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string LogStorageAccountId { get => this._logStorageAccountId; } + + /// Internal Acessors for AzureVirtualMachineId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal.AzureVirtualMachineId { get => this._azureVirtualMachineId; set { {_azureVirtualMachineId = value;} } } + + /// Internal Acessors for DiscoveredVMDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetails Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal.DiscoveredVMDetail { get => (this._discoveredVMDetail = this._discoveredVMDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmFailbackDiscoveredProtectedVMDetails()); set { {_discoveredVMDetail = value;} } } + + /// Internal Acessors for DiscoveredVMDetailCreatedTimestamp + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal.DiscoveredVMDetailCreatedTimestamp { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetailsInternal)DiscoveredVMDetail).CreatedTimestamp; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetailsInternal)DiscoveredVMDetail).CreatedTimestamp = value; } + + /// Internal Acessors for DiscoveredVMDetailDatastore + string[] Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal.DiscoveredVMDetailDatastore { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetailsInternal)DiscoveredVMDetail).Datastore; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetailsInternal)DiscoveredVMDetail).Datastore = value; } + + /// Internal Acessors for DiscoveredVMDetailIpaddress + string[] Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal.DiscoveredVMDetailIpaddress { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetailsInternal)DiscoveredVMDetail).IPAddress; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetailsInternal)DiscoveredVMDetail).IPAddress = value; } + + /// Internal Acessors for DiscoveredVMDetailIsDeleted + bool? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal.DiscoveredVMDetailIsDeleted { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetailsInternal)DiscoveredVMDetail).IsDeleted; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetailsInternal)DiscoveredVMDetail).IsDeleted = value; } + + /// Internal Acessors for DiscoveredVMDetailLastDiscoveryTimeInUtc + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal.DiscoveredVMDetailLastDiscoveryTimeInUtc { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetailsInternal)DiscoveredVMDetail).LastDiscoveryTimeInUtc; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetailsInternal)DiscoveredVMDetail).LastDiscoveryTimeInUtc = value; } + + /// Internal Acessors for DiscoveredVMDetailOsname + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal.DiscoveredVMDetailOsname { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetailsInternal)DiscoveredVMDetail).OSName; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetailsInternal)DiscoveredVMDetail).OSName = value; } + + /// Internal Acessors for DiscoveredVMDetailPowerStatus + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal.DiscoveredVMDetailPowerStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetailsInternal)DiscoveredVMDetail).PowerStatus; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetailsInternal)DiscoveredVMDetail).PowerStatus = value; } + + /// Internal Acessors for DiscoveredVMDetailUpdatedTimestamp + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal.DiscoveredVMDetailUpdatedTimestamp { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetailsInternal)DiscoveredVMDetail).UpdatedTimestamp; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetailsInternal)DiscoveredVMDetail).UpdatedTimestamp = value; } + + /// Internal Acessors for DiscoveredVMDetailVcenterFqdn + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal.DiscoveredVMDetailVcenterFqdn { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetailsInternal)DiscoveredVMDetail).VCenterFqdn; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetailsInternal)DiscoveredVMDetail).VCenterFqdn = value; } + + /// Internal Acessors for DiscoveredVMDetailVcenterId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal.DiscoveredVMDetailVcenterId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetailsInternal)DiscoveredVMDetail).VCenterId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetailsInternal)DiscoveredVMDetail).VCenterId = value; } + + /// Internal Acessors for DiscoveredVMDetailVmfqdn + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal.DiscoveredVMDetailVmfqdn { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetailsInternal)DiscoveredVMDetail).VMFqdn; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetailsInternal)DiscoveredVMDetail).VMFqdn = value; } + + /// Internal Acessors for DiscoveredVMDetailVmwareToolsStatus + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal.DiscoveredVMDetailVmwareToolsStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetailsInternal)DiscoveredVMDetail).VmwareToolsStatus; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetailsInternal)DiscoveredVMDetail).VmwareToolsStatus = value; } + + /// Internal Acessors for InitialReplicationProcessedByte + long? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal.InitialReplicationProcessedByte { get => this._initialReplicationProcessedByte; set { {_initialReplicationProcessedByte = value;} } } + + /// Internal Acessors for InitialReplicationProgressHealth + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.VMReplicationProgressHealth? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal.InitialReplicationProgressHealth { get => this._initialReplicationProgressHealth; set { {_initialReplicationProgressHealth = value;} } } + + /// Internal Acessors for InitialReplicationProgressPercentage + int? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal.InitialReplicationProgressPercentage { get => this._initialReplicationProgressPercentage; set { {_initialReplicationProgressPercentage = value;} } } + + /// Internal Acessors for InitialReplicationTransferredByte + long? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal.InitialReplicationTransferredByte { get => this._initialReplicationTransferredByte; set { {_initialReplicationTransferredByte = value;} } } + + /// Internal Acessors for InternalIdentifier + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal.InternalIdentifier { get => this._internalIdentifier; set { {_internalIdentifier = value;} } } + + /// Internal Acessors for IsAgentRegistrationSuccessfulAfterFailover + bool? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal.IsAgentRegistrationSuccessfulAfterFailover { get => this._isAgentRegistrationSuccessfulAfterFailover; set { {_isAgentRegistrationSuccessfulAfterFailover = value;} } } + + /// Internal Acessors for LastPlannedFailoverStartTime + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal.LastPlannedFailoverStartTime { get => this._lastPlannedFailoverStartTime; set { {_lastPlannedFailoverStartTime = value;} } } + + /// Internal Acessors for LastPlannedFailoverStatus + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PlannedFailoverStatus? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal.LastPlannedFailoverStatus { get => this._lastPlannedFailoverStatus; set { {_lastPlannedFailoverStatus = value;} } } + + /// Internal Acessors for LastUsedPolicyFriendlyName + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal.LastUsedPolicyFriendlyName { get => this._lastUsedPolicyFriendlyName; set { {_lastUsedPolicyFriendlyName = value;} } } + + /// Internal Acessors for LastUsedPolicyId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal.LastUsedPolicyId { get => this._lastUsedPolicyId; set { {_lastUsedPolicyId = value;} } } + + /// Internal Acessors for LogStorageAccountId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal.LogStorageAccountId { get => this._logStorageAccountId; set { {_logStorageAccountId = value;} } } + + /// Internal Acessors for MobilityAgentDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackMobilityAgentDetails Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal.MobilityAgentDetail { get => (this._mobilityAgentDetail = this._mobilityAgentDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmFailbackMobilityAgentDetails()); set { {_mobilityAgentDetail = value;} } } + + /// Internal Acessors for MobilityAgentDetailAgentVersionExpiryDate + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal.MobilityAgentDetailAgentVersionExpiryDate { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackMobilityAgentDetailsInternal)MobilityAgentDetail).AgentVersionExpiryDate; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackMobilityAgentDetailsInternal)MobilityAgentDetail).AgentVersionExpiryDate = value; } + + /// Internal Acessors for MobilityAgentDetailDriverVersion + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal.MobilityAgentDetailDriverVersion { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackMobilityAgentDetailsInternal)MobilityAgentDetail).DriverVersion; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackMobilityAgentDetailsInternal)MobilityAgentDetail).DriverVersion = value; } + + /// Internal Acessors for MobilityAgentDetailDriverVersionExpiryDate + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal.MobilityAgentDetailDriverVersionExpiryDate { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackMobilityAgentDetailsInternal)MobilityAgentDetail).DriverVersionExpiryDate; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackMobilityAgentDetailsInternal)MobilityAgentDetail).DriverVersionExpiryDate = value; } + + /// Internal Acessors for MobilityAgentDetailIsUpgradeable + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal.MobilityAgentDetailIsUpgradeable { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackMobilityAgentDetailsInternal)MobilityAgentDetail).IsUpgradeable; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackMobilityAgentDetailsInternal)MobilityAgentDetail).IsUpgradeable = value; } + + /// Internal Acessors for MobilityAgentDetailLastHeartbeatUtc + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal.MobilityAgentDetailLastHeartbeatUtc { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackMobilityAgentDetailsInternal)MobilityAgentDetail).LastHeartbeatUtc; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackMobilityAgentDetailsInternal)MobilityAgentDetail).LastHeartbeatUtc = value; } + + /// Internal Acessors for MobilityAgentDetailLatestUpgradableVersionWithoutReboot + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal.MobilityAgentDetailLatestUpgradableVersionWithoutReboot { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackMobilityAgentDetailsInternal)MobilityAgentDetail).LatestUpgradableVersionWithoutReboot; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackMobilityAgentDetailsInternal)MobilityAgentDetail).LatestUpgradableVersionWithoutReboot = value; } + + /// Internal Acessors for MobilityAgentDetailLatestVersion + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal.MobilityAgentDetailLatestVersion { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackMobilityAgentDetailsInternal)MobilityAgentDetail).LatestVersion; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackMobilityAgentDetailsInternal)MobilityAgentDetail).LatestVersion = value; } + + /// Internal Acessors for MobilityAgentDetailReasonsBlockingUpgrade + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentUpgradeBlockedReason[] Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal.MobilityAgentDetailReasonsBlockingUpgrade { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackMobilityAgentDetailsInternal)MobilityAgentDetail).ReasonsBlockingUpgrade; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackMobilityAgentDetailsInternal)MobilityAgentDetail).ReasonsBlockingUpgrade = value; } + + /// Internal Acessors for MobilityAgentDetailVersion + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal.MobilityAgentDetailVersion { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackMobilityAgentDetailsInternal)MobilityAgentDetail).Version; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackMobilityAgentDetailsInternal)MobilityAgentDetail).Version = value; } + + /// Internal Acessors for MultiVMGroupName + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal.MultiVMGroupName { get => this._multiVMGroupName; set { {_multiVMGroupName = value;} } } + + /// Internal Acessors for OSType + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal.OSType { get => this._oSType; set { {_oSType = value;} } } + + /// Internal Acessors for ReprotectAgentId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal.ReprotectAgentId { get => this._reprotectAgentId; set { {_reprotectAgentId = value;} } } + + /// Internal Acessors for ReprotectAgentName + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal.ReprotectAgentName { get => this._reprotectAgentName; set { {_reprotectAgentName = value;} } } + + /// Internal Acessors for ResyncProcessedByte + long? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal.ResyncProcessedByte { get => this._resyncProcessedByte; set { {_resyncProcessedByte = value;} } } + + /// Internal Acessors for ResyncProgressHealth + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.VMReplicationProgressHealth? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal.ResyncProgressHealth { get => this._resyncProgressHealth; set { {_resyncProgressHealth = value;} } } + + /// Internal Acessors for ResyncProgressPercentage + int? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal.ResyncProgressPercentage { get => this._resyncProgressPercentage; set { {_resyncProgressPercentage = value;} } } + + /// Internal Acessors for ResyncRequired + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal.ResyncRequired { get => this._resyncRequired; set { {_resyncRequired = value;} } } + + /// Internal Acessors for ResyncState + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ResyncState? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal.ResyncState { get => this._resyncState; set { {_resyncState = value;} } } + + /// Internal Acessors for ResyncTransferredByte + long? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal.ResyncTransferredByte { get => this._resyncTransferredByte; set { {_resyncTransferredByte = value;} } } + + /// Internal Acessors for TargetDataStoreName + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal.TargetDataStoreName { get => this._targetDataStoreName; set { {_targetDataStoreName = value;} } } + + /// Internal Acessors for TargetVMName + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal.TargetVMName { get => this._targetVMName; set { {_targetVMName = value;} } } + + /// Internal Acessors for TargetvCenterId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetailsInternal.TargetvCenterId { get => this._targetvCenterId; set { {_targetvCenterId = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackMobilityAgentDetails _mobilityAgentDetail; + + /// The mobility agent information. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackMobilityAgentDetails MobilityAgentDetail { get => (this._mobilityAgentDetail = this._mobilityAgentDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmFailbackMobilityAgentDetails()); set => this._mobilityAgentDetail = value; } + + /// The agent version expiry date. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public global::System.DateTime? MobilityAgentDetailAgentVersionExpiryDate { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackMobilityAgentDetailsInternal)MobilityAgentDetail).AgentVersionExpiryDate; } + + /// The driver version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string MobilityAgentDetailDriverVersion { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackMobilityAgentDetailsInternal)MobilityAgentDetail).DriverVersion; } + + /// The driver version expiry date. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public global::System.DateTime? MobilityAgentDetailDriverVersionExpiryDate { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackMobilityAgentDetailsInternal)MobilityAgentDetail).DriverVersionExpiryDate; } + + /// A value indicating whether agent is upgradeable or not. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string MobilityAgentDetailIsUpgradeable { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackMobilityAgentDetailsInternal)MobilityAgentDetail).IsUpgradeable; } + + /// The time of the last heartbeat received from the agent. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public global::System.DateTime? MobilityAgentDetailLastHeartbeatUtc { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackMobilityAgentDetailsInternal)MobilityAgentDetail).LastHeartbeatUtc; } + + /// The latest upgradeable version available without reboot. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string MobilityAgentDetailLatestUpgradableVersionWithoutReboot { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackMobilityAgentDetailsInternal)MobilityAgentDetail).LatestUpgradableVersionWithoutReboot; } + + /// The latest agent version available. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string MobilityAgentDetailLatestVersion { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackMobilityAgentDetailsInternal)MobilityAgentDetail).LatestVersion; } + + /// The whether update is possible or not. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentUpgradeBlockedReason[] MobilityAgentDetailReasonsBlockingUpgrade { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackMobilityAgentDetailsInternal)MobilityAgentDetail).ReasonsBlockingUpgrade; } + + /// The agent version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string MobilityAgentDetailVersion { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackMobilityAgentDetailsInternal)MobilityAgentDetail).Version; } + + /// Backing field for property. + private string _multiVMGroupName; + + /// The multi VM group name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string MultiVMGroupName { get => this._multiVMGroupName; } + + /// Backing field for property. + private string _oSType; + + /// The type of the OS on the VM. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string OSType { get => this._oSType; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetails[] _protectedDisk; + + /// The list of protected disks. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetails[] ProtectedDisk { get => this._protectedDisk; set => this._protectedDisk = value; } + + /// Backing field for property. + private string _reprotectAgentId; + + /// The reprotect agent Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ReprotectAgentId { get => this._reprotectAgentId; } + + /// Backing field for property. + private string _reprotectAgentName; + + /// The reprotect agent name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ReprotectAgentName { get => this._reprotectAgentName; } + + /// Backing field for property. + private long? _resyncProcessedByte; + + /// + /// The resync processed bytes. This includes sum of total bytes transferred and matched bytes on all selected disks in source + /// VM. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public long? ResyncProcessedByte { get => this._resyncProcessedByte; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.VMReplicationProgressHealth? _resyncProgressHealth; + + /// The resync progress health. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.VMReplicationProgressHealth? ResyncProgressHealth { get => this._resyncProgressHealth; } + + /// Backing field for property. + private int? _resyncProgressPercentage; + + /// The resync progress percentage. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? ResyncProgressPercentage { get => this._resyncProgressPercentage; } + + /// Backing field for property. + private string _resyncRequired; + + /// A value indicating whether resync is required. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ResyncRequired { get => this._resyncRequired; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ResyncState? _resyncState; + + /// The resync state. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ResyncState? ResyncState { get => this._resyncState; } + + /// Backing field for property. + private long? _resyncTransferredByte; + + /// + /// The resync transferred bytes from source VM to target for all selected disks on source VM. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public long? ResyncTransferredByte { get => this._resyncTransferredByte; } + + /// Backing field for property. + private string _targetDataStoreName; + + /// The target datastore name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetDataStoreName { get => this._targetDataStoreName; } + + /// Backing field for property. + private string _targetVMName; + + /// The target VM name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetVMName { get => this._targetVMName; } + + /// Backing field for property. + private string _targetvCenterId; + + /// The target vCenter Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetvCenterId { get => this._targetvCenterId; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackNicDetails[] _vMNic; + + /// The network details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackNicDetails[] VMNic { get => this._vMNic; set => this._vMNic = value; } + + /// Creates an new instance. + public InMageRcmFailbackReplicationDetails() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__replicationProviderSpecificSettings), __replicationProviderSpecificSettings); + await eventListener.AssertObjectIsValid(nameof(__replicationProviderSpecificSettings), __replicationProviderSpecificSettings); + } + } + /// InMageRcmFailback provider specific details. + public partial interface IInMageRcmFailbackReplicationDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettings + { + /// The ARM Id of the azure VM. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The ARM Id of the azure VM.", + SerializedName = @"azureVirtualMachineId", + PossibleTypes = new [] { typeof(string) })] + string AzureVirtualMachineId { get; } + /// The SDS created timestamp. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The SDS created timestamp.", + SerializedName = @"createdTimestamp", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? DiscoveredVMDetailCreatedTimestamp { get; } + /// The list of datastores. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The list of datastores.", + SerializedName = @"datastores", + PossibleTypes = new [] { typeof(string) })] + string[] DiscoveredVMDetailDatastore { get; } + /// The list of IP addresses. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The list of IP addresses.", + SerializedName = @"ipAddresses", + PossibleTypes = new [] { typeof(string) })] + string[] DiscoveredVMDetailIpaddress { get; } + /// A value indicating whether the VM is deleted. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"A value indicating whether the VM is deleted.", + SerializedName = @"isDeleted", + PossibleTypes = new [] { typeof(bool) })] + bool? DiscoveredVMDetailIsDeleted { get; } + /// The last time when SDS information discovered in SRS. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The last time when SDS information discovered in SRS.", + SerializedName = @"lastDiscoveryTimeInUtc", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? DiscoveredVMDetailLastDiscoveryTimeInUtc { get; } + /// The VM's OS name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The VM's OS name.", + SerializedName = @"osName", + PossibleTypes = new [] { typeof(string) })] + string DiscoveredVMDetailOsname { get; } + /// The VM power status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The VM power status.", + SerializedName = @"powerStatus", + PossibleTypes = new [] { typeof(string) })] + string DiscoveredVMDetailPowerStatus { get; } + /// The SDS updated timestamp. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The SDS updated timestamp.", + SerializedName = @"updatedTimestamp", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? DiscoveredVMDetailUpdatedTimestamp { get; } + /// The VCenter fqdn. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The VCenter fqdn.", + SerializedName = @"vCenterFqdn", + PossibleTypes = new [] { typeof(string) })] + string DiscoveredVMDetailVcenterFqdn { get; } + /// The VCenter Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The VCenter Id.", + SerializedName = @"vCenterId", + PossibleTypes = new [] { typeof(string) })] + string DiscoveredVMDetailVcenterId { get; } + /// The VM fqdn. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The VM fqdn.", + SerializedName = @"vmFqdn", + PossibleTypes = new [] { typeof(string) })] + string DiscoveredVMDetailVmfqdn { get; } + /// The VMware tools status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The VMware tools status.", + SerializedName = @"vmwareToolsStatus", + PossibleTypes = new [] { typeof(string) })] + string DiscoveredVMDetailVmwareToolsStatus { get; } + /// + /// The initial replication processed bytes. This includes sum of total bytes transferred and matched bytes on all selected + /// disks in source VM. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The initial replication processed bytes. This includes sum of total bytes transferred and matched bytes on all selected disks in source VM.", + SerializedName = @"initialReplicationProcessedBytes", + PossibleTypes = new [] { typeof(long) })] + long? InitialReplicationProcessedByte { get; } + /// The initial replication progress health. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The initial replication progress health.", + SerializedName = @"initialReplicationProgressHealth", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.VMReplicationProgressHealth) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.VMReplicationProgressHealth? InitialReplicationProgressHealth { get; } + /// The initial replication progress percentage. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The initial replication progress percentage.", + SerializedName = @"initialReplicationProgressPercentage", + PossibleTypes = new [] { typeof(int) })] + int? InitialReplicationProgressPercentage { get; } + /// + /// The initial replication transferred bytes from source VM to target for all selected disks on source VM. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The initial replication transferred bytes from source VM to target for all selected disks on source VM.", + SerializedName = @"initialReplicationTransferredBytes", + PossibleTypes = new [] { typeof(long) })] + long? InitialReplicationTransferredByte { get; } + /// The virtual machine internal identifier. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The virtual machine internal identifier.", + SerializedName = @"internalIdentifier", + PossibleTypes = new [] { typeof(string) })] + string InternalIdentifier { get; } + /// A value indicating whether agent registration was successful after failover. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"A value indicating whether agent registration was successful after failover.", + SerializedName = @"isAgentRegistrationSuccessfulAfterFailover", + PossibleTypes = new [] { typeof(bool) })] + bool? IsAgentRegistrationSuccessfulAfterFailover { get; } + /// The last planned failover start time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The last planned failover start time.", + SerializedName = @"lastPlannedFailoverStartTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? LastPlannedFailoverStartTime { get; } + /// The last planned failover status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The last planned failover status.", + SerializedName = @"lastPlannedFailoverStatus", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PlannedFailoverStatus) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PlannedFailoverStatus? LastPlannedFailoverStatus { get; } + /// The policy friendly name used by the forward replication. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The policy friendly name used by the forward replication.", + SerializedName = @"lastUsedPolicyFriendlyName", + PossibleTypes = new [] { typeof(string) })] + string LastUsedPolicyFriendlyName { get; } + /// The policy Id used by the forward replication. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The policy Id used by the forward replication.", + SerializedName = @"lastUsedPolicyId", + PossibleTypes = new [] { typeof(string) })] + string LastUsedPolicyId { get; } + /// The log storage account ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The log storage account ARM Id.", + SerializedName = @"logStorageAccountId", + PossibleTypes = new [] { typeof(string) })] + string LogStorageAccountId { get; } + /// The agent version expiry date. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The agent version expiry date.", + SerializedName = @"agentVersionExpiryDate", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? MobilityAgentDetailAgentVersionExpiryDate { get; } + /// The driver version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The driver version.", + SerializedName = @"driverVersion", + PossibleTypes = new [] { typeof(string) })] + string MobilityAgentDetailDriverVersion { get; } + /// The driver version expiry date. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The driver version expiry date.", + SerializedName = @"driverVersionExpiryDate", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? MobilityAgentDetailDriverVersionExpiryDate { get; } + /// A value indicating whether agent is upgradeable or not. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"A value indicating whether agent is upgradeable or not.", + SerializedName = @"isUpgradeable", + PossibleTypes = new [] { typeof(string) })] + string MobilityAgentDetailIsUpgradeable { get; } + /// The time of the last heartbeat received from the agent. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The time of the last heartbeat received from the agent.", + SerializedName = @"lastHeartbeatUtc", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? MobilityAgentDetailLastHeartbeatUtc { get; } + /// The latest upgradeable version available without reboot. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The latest upgradeable version available without reboot.", + SerializedName = @"latestUpgradableVersionWithoutReboot", + PossibleTypes = new [] { typeof(string) })] + string MobilityAgentDetailLatestUpgradableVersionWithoutReboot { get; } + /// The latest agent version available. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The latest agent version available.", + SerializedName = @"latestVersion", + PossibleTypes = new [] { typeof(string) })] + string MobilityAgentDetailLatestVersion { get; } + /// The whether update is possible or not. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The whether update is possible or not.", + SerializedName = @"reasonsBlockingUpgrade", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentUpgradeBlockedReason) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentUpgradeBlockedReason[] MobilityAgentDetailReasonsBlockingUpgrade { get; } + /// The agent version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The agent version.", + SerializedName = @"version", + PossibleTypes = new [] { typeof(string) })] + string MobilityAgentDetailVersion { get; } + /// The multi VM group name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The multi VM group name.", + SerializedName = @"multiVmGroupName", + PossibleTypes = new [] { typeof(string) })] + string MultiVMGroupName { get; } + /// The type of the OS on the VM. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The type of the OS on the VM.", + SerializedName = @"osType", + PossibleTypes = new [] { typeof(string) })] + string OSType { get; } + /// The list of protected disks. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of protected disks.", + SerializedName = @"protectedDisks", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetails) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetails[] ProtectedDisk { get; set; } + /// The reprotect agent Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The reprotect agent Id.", + SerializedName = @"reprotectAgentId", + PossibleTypes = new [] { typeof(string) })] + string ReprotectAgentId { get; } + /// The reprotect agent name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The reprotect agent name.", + SerializedName = @"reprotectAgentName", + PossibleTypes = new [] { typeof(string) })] + string ReprotectAgentName { get; } + /// + /// The resync processed bytes. This includes sum of total bytes transferred and matched bytes on all selected disks in source + /// VM. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The resync processed bytes. This includes sum of total bytes transferred and matched bytes on all selected disks in source VM.", + SerializedName = @"resyncProcessedBytes", + PossibleTypes = new [] { typeof(long) })] + long? ResyncProcessedByte { get; } + /// The resync progress health. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The resync progress health.", + SerializedName = @"resyncProgressHealth", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.VMReplicationProgressHealth) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.VMReplicationProgressHealth? ResyncProgressHealth { get; } + /// The resync progress percentage. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The resync progress percentage.", + SerializedName = @"resyncProgressPercentage", + PossibleTypes = new [] { typeof(int) })] + int? ResyncProgressPercentage { get; } + /// A value indicating whether resync is required. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"A value indicating whether resync is required.", + SerializedName = @"resyncRequired", + PossibleTypes = new [] { typeof(string) })] + string ResyncRequired { get; } + /// The resync state. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The resync state.", + SerializedName = @"resyncState", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ResyncState) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ResyncState? ResyncState { get; } + /// + /// The resync transferred bytes from source VM to target for all selected disks on source VM. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The resync transferred bytes from source VM to target for all selected disks on source VM.", + SerializedName = @"resyncTransferredBytes", + PossibleTypes = new [] { typeof(long) })] + long? ResyncTransferredByte { get; } + /// The target datastore name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The target datastore name.", + SerializedName = @"targetDataStoreName", + PossibleTypes = new [] { typeof(string) })] + string TargetDataStoreName { get; } + /// The target VM name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The target VM name.", + SerializedName = @"targetVmName", + PossibleTypes = new [] { typeof(string) })] + string TargetVMName { get; } + /// The target vCenter Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The target vCenter Id.", + SerializedName = @"targetvCenterId", + PossibleTypes = new [] { typeof(string) })] + string TargetvCenterId { get; } + /// The network details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The network details.", + SerializedName = @"vmNics", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackNicDetails) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackNicDetails[] VMNic { get; set; } + + } + /// InMageRcmFailback provider specific details. + internal partial interface IInMageRcmFailbackReplicationDetailsInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettingsInternal + { + /// The ARM Id of the azure VM. + string AzureVirtualMachineId { get; set; } + /// The discovered VM information. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackDiscoveredProtectedVMDetails DiscoveredVMDetail { get; set; } + /// The SDS created timestamp. + global::System.DateTime? DiscoveredVMDetailCreatedTimestamp { get; set; } + /// The list of datastores. + string[] DiscoveredVMDetailDatastore { get; set; } + /// The list of IP addresses. + string[] DiscoveredVMDetailIpaddress { get; set; } + /// A value indicating whether the VM is deleted. + bool? DiscoveredVMDetailIsDeleted { get; set; } + /// The last time when SDS information discovered in SRS. + global::System.DateTime? DiscoveredVMDetailLastDiscoveryTimeInUtc { get; set; } + /// The VM's OS name. + string DiscoveredVMDetailOsname { get; set; } + /// The VM power status. + string DiscoveredVMDetailPowerStatus { get; set; } + /// The SDS updated timestamp. + global::System.DateTime? DiscoveredVMDetailUpdatedTimestamp { get; set; } + /// The VCenter fqdn. + string DiscoveredVMDetailVcenterFqdn { get; set; } + /// The VCenter Id. + string DiscoveredVMDetailVcenterId { get; set; } + /// The VM fqdn. + string DiscoveredVMDetailVmfqdn { get; set; } + /// The VMware tools status. + string DiscoveredVMDetailVmwareToolsStatus { get; set; } + /// + /// The initial replication processed bytes. This includes sum of total bytes transferred and matched bytes on all selected + /// disks in source VM. + /// + long? InitialReplicationProcessedByte { get; set; } + /// The initial replication progress health. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.VMReplicationProgressHealth? InitialReplicationProgressHealth { get; set; } + /// The initial replication progress percentage. + int? InitialReplicationProgressPercentage { get; set; } + /// + /// The initial replication transferred bytes from source VM to target for all selected disks on source VM. + /// + long? InitialReplicationTransferredByte { get; set; } + /// The virtual machine internal identifier. + string InternalIdentifier { get; set; } + /// A value indicating whether agent registration was successful after failover. + bool? IsAgentRegistrationSuccessfulAfterFailover { get; set; } + /// The last planned failover start time. + global::System.DateTime? LastPlannedFailoverStartTime { get; set; } + /// The last planned failover status. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PlannedFailoverStatus? LastPlannedFailoverStatus { get; set; } + /// The policy friendly name used by the forward replication. + string LastUsedPolicyFriendlyName { get; set; } + /// The policy Id used by the forward replication. + string LastUsedPolicyId { get; set; } + /// The log storage account ARM Id. + string LogStorageAccountId { get; set; } + /// The mobility agent information. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackMobilityAgentDetails MobilityAgentDetail { get; set; } + /// The agent version expiry date. + global::System.DateTime? MobilityAgentDetailAgentVersionExpiryDate { get; set; } + /// The driver version. + string MobilityAgentDetailDriverVersion { get; set; } + /// The driver version expiry date. + global::System.DateTime? MobilityAgentDetailDriverVersionExpiryDate { get; set; } + /// A value indicating whether agent is upgradeable or not. + string MobilityAgentDetailIsUpgradeable { get; set; } + /// The time of the last heartbeat received from the agent. + global::System.DateTime? MobilityAgentDetailLastHeartbeatUtc { get; set; } + /// The latest upgradeable version available without reboot. + string MobilityAgentDetailLatestUpgradableVersionWithoutReboot { get; set; } + /// The latest agent version available. + string MobilityAgentDetailLatestVersion { get; set; } + /// The whether update is possible or not. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentUpgradeBlockedReason[] MobilityAgentDetailReasonsBlockingUpgrade { get; set; } + /// The agent version. + string MobilityAgentDetailVersion { get; set; } + /// The multi VM group name. + string MultiVMGroupName { get; set; } + /// The type of the OS on the VM. + string OSType { get; set; } + /// The list of protected disks. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetails[] ProtectedDisk { get; set; } + /// The reprotect agent Id. + string ReprotectAgentId { get; set; } + /// The reprotect agent name. + string ReprotectAgentName { get; set; } + /// + /// The resync processed bytes. This includes sum of total bytes transferred and matched bytes on all selected disks in source + /// VM. + /// + long? ResyncProcessedByte { get; set; } + /// The resync progress health. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.VMReplicationProgressHealth? ResyncProgressHealth { get; set; } + /// The resync progress percentage. + int? ResyncProgressPercentage { get; set; } + /// A value indicating whether resync is required. + string ResyncRequired { get; set; } + /// The resync state. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ResyncState? ResyncState { get; set; } + /// + /// The resync transferred bytes from source VM to target for all selected disks on source VM. + /// + long? ResyncTransferredByte { get; set; } + /// The target datastore name. + string TargetDataStoreName { get; set; } + /// The target VM name. + string TargetVMName { get; set; } + /// The target vCenter Id. + string TargetvCenterId { get; set; } + /// The network details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackNicDetails[] VMNic { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackReplicationDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackReplicationDetails.json.cs new file mode 100644 index 000000000000..ae8bcb436172 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackReplicationDetails.json.cs @@ -0,0 +1,258 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMageRcmFailback provider specific details. + public partial class InMageRcmFailbackReplicationDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReplicationDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new InMageRcmFailbackReplicationDetails(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal InMageRcmFailbackReplicationDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __replicationProviderSpecificSettings = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProviderSpecificSettings(json); + {_mobilityAgentDetail = If( json?.PropertyT("mobilityAgentDetails"), out var __jsonMobilityAgentDetails) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmFailbackMobilityAgentDetails.FromJson(__jsonMobilityAgentDetails) : MobilityAgentDetail;} + {_discoveredVMDetail = If( json?.PropertyT("discoveredVmDetails"), out var __jsonDiscoveredVMDetails) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmFailbackDiscoveredProtectedVMDetails.FromJson(__jsonDiscoveredVMDetails) : DiscoveredVMDetail;} + {_internalIdentifier = If( json?.PropertyT("internalIdentifier"), out var __jsonInternalIdentifier) ? (string)__jsonInternalIdentifier : (string)InternalIdentifier;} + {_azureVirtualMachineId = If( json?.PropertyT("azureVirtualMachineId"), out var __jsonAzureVirtualMachineId) ? (string)__jsonAzureVirtualMachineId : (string)AzureVirtualMachineId;} + {_multiVMGroupName = If( json?.PropertyT("multiVmGroupName"), out var __jsonMultiVMGroupName) ? (string)__jsonMultiVMGroupName : (string)MultiVMGroupName;} + {_reprotectAgentId = If( json?.PropertyT("reprotectAgentId"), out var __jsonReprotectAgentId) ? (string)__jsonReprotectAgentId : (string)ReprotectAgentId;} + {_reprotectAgentName = If( json?.PropertyT("reprotectAgentName"), out var __jsonReprotectAgentName) ? (string)__jsonReprotectAgentName : (string)ReprotectAgentName;} + {_oSType = If( json?.PropertyT("osType"), out var __jsonOSType) ? (string)__jsonOSType : (string)OSType;} + {_logStorageAccountId = If( json?.PropertyT("logStorageAccountId"), out var __jsonLogStorageAccountId) ? (string)__jsonLogStorageAccountId : (string)LogStorageAccountId;} + {_targetvCenterId = If( json?.PropertyT("targetvCenterId"), out var __jsonTargetvCenterId) ? (string)__jsonTargetvCenterId : (string)TargetvCenterId;} + {_targetDataStoreName = If( json?.PropertyT("targetDataStoreName"), out var __jsonTargetDataStoreName) ? (string)__jsonTargetDataStoreName : (string)TargetDataStoreName;} + {_targetVMName = If( json?.PropertyT("targetVmName"), out var __jsonTargetVMName) ? (string)__jsonTargetVMName : (string)TargetVMName;} + {_initialReplicationProgressPercentage = If( json?.PropertyT("initialReplicationProgressPercentage"), out var __jsonInitialReplicationProgressPercentage) ? (int?)__jsonInitialReplicationProgressPercentage : InitialReplicationProgressPercentage;} + {_initialReplicationProcessedByte = If( json?.PropertyT("initialReplicationProcessedBytes"), out var __jsonInitialReplicationProcessedBytes) ? (long?)__jsonInitialReplicationProcessedBytes : InitialReplicationProcessedByte;} + {_initialReplicationTransferredByte = If( json?.PropertyT("initialReplicationTransferredBytes"), out var __jsonInitialReplicationTransferredBytes) ? (long?)__jsonInitialReplicationTransferredBytes : InitialReplicationTransferredByte;} + {_initialReplicationProgressHealth = If( json?.PropertyT("initialReplicationProgressHealth"), out var __jsonInitialReplicationProgressHealth) ? (string)__jsonInitialReplicationProgressHealth : (string)InitialReplicationProgressHealth;} + {_resyncProgressPercentage = If( json?.PropertyT("resyncProgressPercentage"), out var __jsonResyncProgressPercentage) ? (int?)__jsonResyncProgressPercentage : ResyncProgressPercentage;} + {_resyncProcessedByte = If( json?.PropertyT("resyncProcessedBytes"), out var __jsonResyncProcessedBytes) ? (long?)__jsonResyncProcessedBytes : ResyncProcessedByte;} + {_resyncTransferredByte = If( json?.PropertyT("resyncTransferredBytes"), out var __jsonResyncTransferredBytes) ? (long?)__jsonResyncTransferredBytes : ResyncTransferredByte;} + {_resyncProgressHealth = If( json?.PropertyT("resyncProgressHealth"), out var __jsonResyncProgressHealth) ? (string)__jsonResyncProgressHealth : (string)ResyncProgressHealth;} + {_resyncRequired = If( json?.PropertyT("resyncRequired"), out var __jsonResyncRequired) ? (string)__jsonResyncRequired : (string)ResyncRequired;} + {_resyncState = If( json?.PropertyT("resyncState"), out var __jsonResyncState) ? (string)__jsonResyncState : (string)ResyncState;} + {_protectedDisk = If( json?.PropertyT("protectedDisks"), out var __jsonProtectedDisks) ? If( __jsonProtectedDisks as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackProtectedDiskDetails) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmFailbackProtectedDiskDetails.FromJson(__u) )) ))() : null : ProtectedDisk;} + {_vMNic = If( json?.PropertyT("vmNics"), out var __jsonVMNics) ? If( __jsonVMNics as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __q) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__q, (__p)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackNicDetails) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmFailbackNicDetails.FromJson(__p) )) ))() : null : VMNic;} + {_lastPlannedFailoverStartTime = If( json?.PropertyT("lastPlannedFailoverStartTime"), out var __jsonLastPlannedFailoverStartTime) ? global::System.DateTime.TryParse((string)__jsonLastPlannedFailoverStartTime, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonLastPlannedFailoverStartTimeValue) ? __jsonLastPlannedFailoverStartTimeValue : LastPlannedFailoverStartTime : LastPlannedFailoverStartTime;} + {_lastPlannedFailoverStatus = If( json?.PropertyT("lastPlannedFailoverStatus"), out var __jsonLastPlannedFailoverStatus) ? (string)__jsonLastPlannedFailoverStatus : (string)LastPlannedFailoverStatus;} + {_lastUsedPolicyId = If( json?.PropertyT("lastUsedPolicyId"), out var __jsonLastUsedPolicyId) ? (string)__jsonLastUsedPolicyId : (string)LastUsedPolicyId;} + {_lastUsedPolicyFriendlyName = If( json?.PropertyT("lastUsedPolicyFriendlyName"), out var __jsonLastUsedPolicyFriendlyName) ? (string)__jsonLastUsedPolicyFriendlyName : (string)LastUsedPolicyFriendlyName;} + {_isAgentRegistrationSuccessfulAfterFailover = If( json?.PropertyT("isAgentRegistrationSuccessfulAfterFailover"), out var __jsonIsAgentRegistrationSuccessfulAfterFailover) ? (bool?)__jsonIsAgentRegistrationSuccessfulAfterFailover : IsAgentRegistrationSuccessfulAfterFailover;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __replicationProviderSpecificSettings?.ToJson(container, serializationMode); + AddIf( null != this._mobilityAgentDetail ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._mobilityAgentDetail.ToJson(null,serializationMode) : null, "mobilityAgentDetails" ,container.Add ); + AddIf( null != this._discoveredVMDetail ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._discoveredVMDetail.ToJson(null,serializationMode) : null, "discoveredVmDetails" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._internalIdentifier)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._internalIdentifier.ToString()) : null, "internalIdentifier" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._azureVirtualMachineId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._azureVirtualMachineId.ToString()) : null, "azureVirtualMachineId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._multiVMGroupName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._multiVMGroupName.ToString()) : null, "multiVmGroupName" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._reprotectAgentId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._reprotectAgentId.ToString()) : null, "reprotectAgentId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._reprotectAgentName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._reprotectAgentName.ToString()) : null, "reprotectAgentName" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._oSType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._oSType.ToString()) : null, "osType" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._logStorageAccountId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._logStorageAccountId.ToString()) : null, "logStorageAccountId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._targetvCenterId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetvCenterId.ToString()) : null, "targetvCenterId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._targetDataStoreName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetDataStoreName.ToString()) : null, "targetDataStoreName" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._targetVMName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetVMName.ToString()) : null, "targetVmName" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._initialReplicationProgressPercentage ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._initialReplicationProgressPercentage) : null, "initialReplicationProgressPercentage" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._initialReplicationProcessedByte ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((long)this._initialReplicationProcessedByte) : null, "initialReplicationProcessedBytes" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._initialReplicationTransferredByte ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((long)this._initialReplicationTransferredByte) : null, "initialReplicationTransferredBytes" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._initialReplicationProgressHealth)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._initialReplicationProgressHealth.ToString()) : null, "initialReplicationProgressHealth" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._resyncProgressPercentage ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._resyncProgressPercentage) : null, "resyncProgressPercentage" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._resyncProcessedByte ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((long)this._resyncProcessedByte) : null, "resyncProcessedBytes" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._resyncTransferredByte ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((long)this._resyncTransferredByte) : null, "resyncTransferredBytes" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._resyncProgressHealth)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._resyncProgressHealth.ToString()) : null, "resyncProgressHealth" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._resyncRequired)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._resyncRequired.ToString()) : null, "resyncRequired" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._resyncState)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._resyncState.ToString()) : null, "resyncState" ,container.Add ); + } + if (null != this._protectedDisk) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._protectedDisk ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("protectedDisks",__w); + } + if (null != this._vMNic) + { + var __r = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __s in this._vMNic ) + { + AddIf(__s?.ToJson(null, serializationMode) ,__r.Add); + } + container.Add("vmNics",__r); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._lastPlannedFailoverStartTime ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._lastPlannedFailoverStartTime?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "lastPlannedFailoverStartTime" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._lastPlannedFailoverStatus)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._lastPlannedFailoverStatus.ToString()) : null, "lastPlannedFailoverStatus" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._lastUsedPolicyId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._lastUsedPolicyId.ToString()) : null, "lastUsedPolicyId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._lastUsedPolicyFriendlyName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._lastUsedPolicyFriendlyName.ToString()) : null, "lastUsedPolicyFriendlyName" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._isAgentRegistrationSuccessfulAfterFailover ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonBoolean((bool)this._isAgentRegistrationSuccessfulAfterFailover) : null, "isAgentRegistrationSuccessfulAfterFailover" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackReprotectInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackReprotectInput.PowerShell.cs new file mode 100644 index 000000000000..47015079903f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackReprotectInput.PowerShell.cs @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// InMageRcmFailback specific provider input. + [System.ComponentModel.TypeConverter(typeof(InMageRcmFailbackReprotectInputTypeConverter))] + public partial class InMageRcmFailbackReprotectInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReprotectInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InMageRcmFailbackReprotectInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReprotectInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InMageRcmFailbackReprotectInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReprotectInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InMageRcmFailbackReprotectInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProcessServerId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReprotectInputInternal)this).ProcessServerId = (string) content.GetValueForProperty("ProcessServerId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReprotectInputInternal)this).ProcessServerId, global::System.Convert.ToString); + } + if (content.Contains("RunAsAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReprotectInputInternal)this).RunAsAccountId = (string) content.GetValueForProperty("RunAsAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReprotectInputInternal)this).RunAsAccountId, global::System.Convert.ToString); + } + if (content.Contains("PolicyId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReprotectInputInternal)this).PolicyId = (string) content.GetValueForProperty("PolicyId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReprotectInputInternal)this).PolicyId, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InMageRcmFailbackReprotectInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProcessServerId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReprotectInputInternal)this).ProcessServerId = (string) content.GetValueForProperty("ProcessServerId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReprotectInputInternal)this).ProcessServerId, global::System.Convert.ToString); + } + if (content.Contains("RunAsAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReprotectInputInternal)this).RunAsAccountId = (string) content.GetValueForProperty("RunAsAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReprotectInputInternal)this).RunAsAccountId, global::System.Convert.ToString); + } + if (content.Contains("PolicyId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReprotectInputInternal)this).PolicyId = (string) content.GetValueForProperty("PolicyId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReprotectInputInternal)this).PolicyId, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// InMageRcmFailback specific provider input. + [System.ComponentModel.TypeConverter(typeof(InMageRcmFailbackReprotectInputTypeConverter))] + public partial interface IInMageRcmFailbackReprotectInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackReprotectInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackReprotectInput.TypeConverter.cs new file mode 100644 index 000000000000..3629157ea76b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackReprotectInput.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InMageRcmFailbackReprotectInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReprotectInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReprotectInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InMageRcmFailbackReprotectInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InMageRcmFailbackReprotectInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InMageRcmFailbackReprotectInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackReprotectInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackReprotectInput.cs new file mode 100644 index 000000000000..e6ab881332c9 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackReprotectInput.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMageRcmFailback specific provider input. + public partial class InMageRcmFailbackReprotectInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReprotectInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReprotectInputInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationProviderSpecificInput __reverseReplicationProviderSpecificInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReverseReplicationProviderSpecificInput(); + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationProviderSpecificInputInternal)__reverseReplicationProviderSpecificInput).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationProviderSpecificInputInternal)__reverseReplicationProviderSpecificInput).InstanceType = value ; } + + /// Backing field for property. + private string _policyId; + + /// The Policy Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string PolicyId { get => this._policyId; set => this._policyId = value; } + + /// Backing field for property. + private string _processServerId; + + /// The process server Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ProcessServerId { get => this._processServerId; set => this._processServerId = value; } + + /// Backing field for property. + private string _runAsAccountId; + + /// The run as account Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RunAsAccountId { get => this._runAsAccountId; set => this._runAsAccountId = value; } + + /// Creates an new instance. + public InMageRcmFailbackReprotectInput() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__reverseReplicationProviderSpecificInput), __reverseReplicationProviderSpecificInput); + await eventListener.AssertObjectIsValid(nameof(__reverseReplicationProviderSpecificInput), __reverseReplicationProviderSpecificInput); + } + } + /// InMageRcmFailback specific provider input. + public partial interface IInMageRcmFailbackReprotectInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationProviderSpecificInput + { + /// The Policy Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The Policy Id.", + SerializedName = @"policyId", + PossibleTypes = new [] { typeof(string) })] + string PolicyId { get; set; } + /// The process server Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The process server Id.", + SerializedName = @"processServerId", + PossibleTypes = new [] { typeof(string) })] + string ProcessServerId { get; set; } + /// The run as account Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The run as account Id.", + SerializedName = @"runAsAccountId", + PossibleTypes = new [] { typeof(string) })] + string RunAsAccountId { get; set; } + + } + /// InMageRcmFailback specific provider input. + internal partial interface IInMageRcmFailbackReprotectInputInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationProviderSpecificInputInternal + { + /// The Policy Id. + string PolicyId { get; set; } + /// The process server Id. + string ProcessServerId { get; set; } + /// The run as account Id. + string RunAsAccountId { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackReprotectInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackReprotectInput.json.cs new file mode 100644 index 000000000000..e5e494cbc3d1 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackReprotectInput.json.cs @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMageRcmFailback specific provider input. + public partial class InMageRcmFailbackReprotectInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReprotectInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReprotectInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackReprotectInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new InMageRcmFailbackReprotectInput(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal InMageRcmFailbackReprotectInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __reverseReplicationProviderSpecificInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReverseReplicationProviderSpecificInput(json); + {_processServerId = If( json?.PropertyT("processServerId"), out var __jsonProcessServerId) ? (string)__jsonProcessServerId : (string)ProcessServerId;} + {_runAsAccountId = If( json?.PropertyT("runAsAccountId"), out var __jsonRunAsAccountId) ? (string)__jsonRunAsAccountId : (string)RunAsAccountId;} + {_policyId = If( json?.PropertyT("policyId"), out var __jsonPolicyId) ? (string)__jsonPolicyId : (string)PolicyId;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __reverseReplicationProviderSpecificInput?.ToJson(container, serializationMode); + AddIf( null != (((object)this._processServerId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._processServerId.ToString()) : null, "processServerId" ,container.Add ); + AddIf( null != (((object)this._runAsAccountId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._runAsAccountId.ToString()) : null, "runAsAccountId" ,container.Add ); + AddIf( null != (((object)this._policyId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._policyId.ToString()) : null, "policyId" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackSyncDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackSyncDetails.PowerShell.cs new file mode 100644 index 000000000000..3bf6d4e33649 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackSyncDetails.PowerShell.cs @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// InMageRcmFailback disk level sync details. + [System.ComponentModel.TypeConverter(typeof(InMageRcmFailbackSyncDetailsTypeConverter))] + public partial class InMageRcmFailbackSyncDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InMageRcmFailbackSyncDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InMageRcmFailbackSyncDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InMageRcmFailbackSyncDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProgressHealth")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetailsInternal)this).ProgressHealth = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskReplicationProgressHealth?) content.GetValueForProperty("ProgressHealth",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetailsInternal)this).ProgressHealth, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskReplicationProgressHealth.CreateFrom); + } + if (content.Contains("TransferredByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetailsInternal)this).TransferredByte = (long?) content.GetValueForProperty("TransferredByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetailsInternal)this).TransferredByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("Last15MinutesTransferredByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetailsInternal)this).Last15MinutesTransferredByte = (long?) content.GetValueForProperty("Last15MinutesTransferredByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetailsInternal)this).Last15MinutesTransferredByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("LastDataTransferTimeUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetailsInternal)this).LastDataTransferTimeUtc = (string) content.GetValueForProperty("LastDataTransferTimeUtc",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetailsInternal)this).LastDataTransferTimeUtc, global::System.Convert.ToString); + } + if (content.Contains("ProcessedByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetailsInternal)this).ProcessedByte = (long?) content.GetValueForProperty("ProcessedByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetailsInternal)this).ProcessedByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("StartTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetailsInternal)this).StartTime = (string) content.GetValueForProperty("StartTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetailsInternal)this).StartTime, global::System.Convert.ToString); + } + if (content.Contains("LastRefreshTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetailsInternal)this).LastRefreshTime = (string) content.GetValueForProperty("LastRefreshTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetailsInternal)this).LastRefreshTime, global::System.Convert.ToString); + } + if (content.Contains("ProgressPercentage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetailsInternal)this).ProgressPercentage = (int?) content.GetValueForProperty("ProgressPercentage",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetailsInternal)this).ProgressPercentage, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InMageRcmFailbackSyncDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProgressHealth")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetailsInternal)this).ProgressHealth = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskReplicationProgressHealth?) content.GetValueForProperty("ProgressHealth",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetailsInternal)this).ProgressHealth, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskReplicationProgressHealth.CreateFrom); + } + if (content.Contains("TransferredByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetailsInternal)this).TransferredByte = (long?) content.GetValueForProperty("TransferredByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetailsInternal)this).TransferredByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("Last15MinutesTransferredByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetailsInternal)this).Last15MinutesTransferredByte = (long?) content.GetValueForProperty("Last15MinutesTransferredByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetailsInternal)this).Last15MinutesTransferredByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("LastDataTransferTimeUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetailsInternal)this).LastDataTransferTimeUtc = (string) content.GetValueForProperty("LastDataTransferTimeUtc",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetailsInternal)this).LastDataTransferTimeUtc, global::System.Convert.ToString); + } + if (content.Contains("ProcessedByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetailsInternal)this).ProcessedByte = (long?) content.GetValueForProperty("ProcessedByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetailsInternal)this).ProcessedByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("StartTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetailsInternal)this).StartTime = (string) content.GetValueForProperty("StartTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetailsInternal)this).StartTime, global::System.Convert.ToString); + } + if (content.Contains("LastRefreshTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetailsInternal)this).LastRefreshTime = (string) content.GetValueForProperty("LastRefreshTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetailsInternal)this).LastRefreshTime, global::System.Convert.ToString); + } + if (content.Contains("ProgressPercentage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetailsInternal)this).ProgressPercentage = (int?) content.GetValueForProperty("ProgressPercentage",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetailsInternal)this).ProgressPercentage, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// InMageRcmFailback disk level sync details. + [System.ComponentModel.TypeConverter(typeof(InMageRcmFailbackSyncDetailsTypeConverter))] + public partial interface IInMageRcmFailbackSyncDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackSyncDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackSyncDetails.TypeConverter.cs new file mode 100644 index 000000000000..d36a8796563a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackSyncDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InMageRcmFailbackSyncDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InMageRcmFailbackSyncDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InMageRcmFailbackSyncDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InMageRcmFailbackSyncDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackSyncDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackSyncDetails.cs new file mode 100644 index 000000000000..f54f2db882ed --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackSyncDetails.cs @@ -0,0 +1,206 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMageRcmFailback disk level sync details. + public partial class InMageRcmFailbackSyncDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetailsInternal + { + + /// Backing field for property. + private long? _last15MinutesTransferredByte; + + /// The bytes transferred in last 15 minutes from source VM to target. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public long? Last15MinutesTransferredByte { get => this._last15MinutesTransferredByte; } + + /// Backing field for property. + private string _lastDataTransferTimeUtc; + + /// The time of the last data transfer from source VM to target. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string LastDataTransferTimeUtc { get => this._lastDataTransferTimeUtc; } + + /// Backing field for property. + private string _lastRefreshTime; + + /// The last refresh time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string LastRefreshTime { get => this._lastRefreshTime; } + + /// Internal Acessors for Last15MinutesTransferredByte + long? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetailsInternal.Last15MinutesTransferredByte { get => this._last15MinutesTransferredByte; set { {_last15MinutesTransferredByte = value;} } } + + /// Internal Acessors for LastDataTransferTimeUtc + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetailsInternal.LastDataTransferTimeUtc { get => this._lastDataTransferTimeUtc; set { {_lastDataTransferTimeUtc = value;} } } + + /// Internal Acessors for LastRefreshTime + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetailsInternal.LastRefreshTime { get => this._lastRefreshTime; set { {_lastRefreshTime = value;} } } + + /// Internal Acessors for ProcessedByte + long? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetailsInternal.ProcessedByte { get => this._processedByte; set { {_processedByte = value;} } } + + /// Internal Acessors for ProgressHealth + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskReplicationProgressHealth? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetailsInternal.ProgressHealth { get => this._progressHealth; set { {_progressHealth = value;} } } + + /// Internal Acessors for ProgressPercentage + int? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetailsInternal.ProgressPercentage { get => this._progressPercentage; set { {_progressPercentage = value;} } } + + /// Internal Acessors for StartTime + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetailsInternal.StartTime { get => this._startTime; set { {_startTime = value;} } } + + /// Internal Acessors for TransferredByte + long? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetailsInternal.TransferredByte { get => this._transferredByte; set { {_transferredByte = value;} } } + + /// Backing field for property. + private long? _processedByte; + + /// + /// The total processed bytes. This includes bytes that are transferred from source VM to target and matched bytes. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public long? ProcessedByte { get => this._processedByte; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskReplicationProgressHealth? _progressHealth; + + /// The progress health. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskReplicationProgressHealth? ProgressHealth { get => this._progressHealth; } + + /// Backing field for property. + private int? _progressPercentage; + + /// + /// Progress in percentage. Progress percentage is calculated based on processed bytes. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? ProgressPercentage { get => this._progressPercentage; } + + /// Backing field for property. + private string _startTime; + + /// The start time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string StartTime { get => this._startTime; } + + /// Backing field for property. + private long? _transferredByte; + + /// The transferred bytes from source VM to azure for the disk. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public long? TransferredByte { get => this._transferredByte; } + + /// Creates an new instance. + public InMageRcmFailbackSyncDetails() + { + + } + } + /// InMageRcmFailback disk level sync details. + public partial interface IInMageRcmFailbackSyncDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The bytes transferred in last 15 minutes from source VM to target. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The bytes transferred in last 15 minutes from source VM to target.", + SerializedName = @"last15MinutesTransferredBytes", + PossibleTypes = new [] { typeof(long) })] + long? Last15MinutesTransferredByte { get; } + /// The time of the last data transfer from source VM to target. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The time of the last data transfer from source VM to target.", + SerializedName = @"lastDataTransferTimeUtc", + PossibleTypes = new [] { typeof(string) })] + string LastDataTransferTimeUtc { get; } + /// The last refresh time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The last refresh time.", + SerializedName = @"lastRefreshTime", + PossibleTypes = new [] { typeof(string) })] + string LastRefreshTime { get; } + /// + /// The total processed bytes. This includes bytes that are transferred from source VM to target and matched bytes. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The total processed bytes. This includes bytes that are transferred from source VM to target and matched bytes.", + SerializedName = @"processedBytes", + PossibleTypes = new [] { typeof(long) })] + long? ProcessedByte { get; } + /// The progress health. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The progress health.", + SerializedName = @"progressHealth", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskReplicationProgressHealth) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskReplicationProgressHealth? ProgressHealth { get; } + /// + /// Progress in percentage. Progress percentage is calculated based on processed bytes. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Progress in percentage. Progress percentage is calculated based on processed bytes.", + SerializedName = @"progressPercentage", + PossibleTypes = new [] { typeof(int) })] + int? ProgressPercentage { get; } + /// The start time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The start time.", + SerializedName = @"startTime", + PossibleTypes = new [] { typeof(string) })] + string StartTime { get; } + /// The transferred bytes from source VM to azure for the disk. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The transferred bytes from source VM to azure for the disk.", + SerializedName = @"transferredBytes", + PossibleTypes = new [] { typeof(long) })] + long? TransferredByte { get; } + + } + /// InMageRcmFailback disk level sync details. + internal partial interface IInMageRcmFailbackSyncDetailsInternal + + { + /// The bytes transferred in last 15 minutes from source VM to target. + long? Last15MinutesTransferredByte { get; set; } + /// The time of the last data transfer from source VM to target. + string LastDataTransferTimeUtc { get; set; } + /// The last refresh time. + string LastRefreshTime { get; set; } + /// + /// The total processed bytes. This includes bytes that are transferred from source VM to target and matched bytes. + /// + long? ProcessedByte { get; set; } + /// The progress health. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskReplicationProgressHealth? ProgressHealth { get; set; } + /// + /// Progress in percentage. Progress percentage is calculated based on processed bytes. + /// + int? ProgressPercentage { get; set; } + /// The start time. + string StartTime { get; set; } + /// The transferred bytes from source VM to azure for the disk. + long? TransferredByte { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackSyncDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackSyncDetails.json.cs new file mode 100644 index 000000000000..d6df1a2dadbf --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmFailbackSyncDetails.json.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMageRcmFailback disk level sync details. + public partial class InMageRcmFailbackSyncDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmFailbackSyncDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new InMageRcmFailbackSyncDetails(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal InMageRcmFailbackSyncDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_progressHealth = If( json?.PropertyT("progressHealth"), out var __jsonProgressHealth) ? (string)__jsonProgressHealth : (string)ProgressHealth;} + {_transferredByte = If( json?.PropertyT("transferredBytes"), out var __jsonTransferredBytes) ? (long?)__jsonTransferredBytes : TransferredByte;} + {_last15MinutesTransferredByte = If( json?.PropertyT("last15MinutesTransferredBytes"), out var __jsonLast15MinutesTransferredBytes) ? (long?)__jsonLast15MinutesTransferredBytes : Last15MinutesTransferredByte;} + {_lastDataTransferTimeUtc = If( json?.PropertyT("lastDataTransferTimeUtc"), out var __jsonLastDataTransferTimeUtc) ? (string)__jsonLastDataTransferTimeUtc : (string)LastDataTransferTimeUtc;} + {_processedByte = If( json?.PropertyT("processedBytes"), out var __jsonProcessedBytes) ? (long?)__jsonProcessedBytes : ProcessedByte;} + {_startTime = If( json?.PropertyT("startTime"), out var __jsonStartTime) ? (string)__jsonStartTime : (string)StartTime;} + {_lastRefreshTime = If( json?.PropertyT("lastRefreshTime"), out var __jsonLastRefreshTime) ? (string)__jsonLastRefreshTime : (string)LastRefreshTime;} + {_progressPercentage = If( json?.PropertyT("progressPercentage"), out var __jsonProgressPercentage) ? (int?)__jsonProgressPercentage : ProgressPercentage;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._progressHealth)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._progressHealth.ToString()) : null, "progressHealth" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._transferredByte ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((long)this._transferredByte) : null, "transferredBytes" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._last15MinutesTransferredByte ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((long)this._last15MinutesTransferredByte) : null, "last15MinutesTransferredBytes" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._lastDataTransferTimeUtc)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._lastDataTransferTimeUtc.ToString()) : null, "lastDataTransferTimeUtc" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._processedByte ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((long)this._processedByte) : null, "processedBytes" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._startTime)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._startTime.ToString()) : null, "startTime" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._lastRefreshTime)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._lastRefreshTime.ToString()) : null, "lastRefreshTime" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._progressPercentage ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._progressPercentage) : null, "progressPercentage" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmLastAgentUpgradeErrorDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmLastAgentUpgradeErrorDetails.PowerShell.cs new file mode 100644 index 000000000000..9caa2dbed3a2 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmLastAgentUpgradeErrorDetails.PowerShell.cs @@ -0,0 +1,189 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// InMageRcm last source agent upgrade error details. + [System.ComponentModel.TypeConverter(typeof(InMageRcmLastAgentUpgradeErrorDetailsTypeConverter))] + public partial class InMageRcmLastAgentUpgradeErrorDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmLastAgentUpgradeErrorDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InMageRcmLastAgentUpgradeErrorDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmLastAgentUpgradeErrorDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InMageRcmLastAgentUpgradeErrorDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json + /// string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmLastAgentUpgradeErrorDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InMageRcmLastAgentUpgradeErrorDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ErrorCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmLastAgentUpgradeErrorDetailsInternal)this).ErrorCode = (string) content.GetValueForProperty("ErrorCode",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmLastAgentUpgradeErrorDetailsInternal)this).ErrorCode, global::System.Convert.ToString); + } + if (content.Contains("ErrorMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmLastAgentUpgradeErrorDetailsInternal)this).ErrorMessage = (string) content.GetValueForProperty("ErrorMessage",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmLastAgentUpgradeErrorDetailsInternal)this).ErrorMessage, global::System.Convert.ToString); + } + if (content.Contains("PossibleCaus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmLastAgentUpgradeErrorDetailsInternal)this).PossibleCaus = (string) content.GetValueForProperty("PossibleCaus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmLastAgentUpgradeErrorDetailsInternal)this).PossibleCaus, global::System.Convert.ToString); + } + if (content.Contains("RecommendedAction")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmLastAgentUpgradeErrorDetailsInternal)this).RecommendedAction = (string) content.GetValueForProperty("RecommendedAction",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmLastAgentUpgradeErrorDetailsInternal)this).RecommendedAction, global::System.Convert.ToString); + } + if (content.Contains("ErrorMessageParameter")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmLastAgentUpgradeErrorDetailsInternal)this).ErrorMessageParameter = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmLastAgentUpgradeErrorDetailsErrorMessageParameters) content.GetValueForProperty("ErrorMessageParameter",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmLastAgentUpgradeErrorDetailsInternal)this).ErrorMessageParameter, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmLastAgentUpgradeErrorDetailsErrorMessageParametersTypeConverter.ConvertFrom); + } + if (content.Contains("ErrorTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmLastAgentUpgradeErrorDetailsInternal)this).ErrorTag = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmLastAgentUpgradeErrorDetailsErrorTags) content.GetValueForProperty("ErrorTag",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmLastAgentUpgradeErrorDetailsInternal)this).ErrorTag, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmLastAgentUpgradeErrorDetailsErrorTagsTypeConverter.ConvertFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InMageRcmLastAgentUpgradeErrorDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ErrorCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmLastAgentUpgradeErrorDetailsInternal)this).ErrorCode = (string) content.GetValueForProperty("ErrorCode",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmLastAgentUpgradeErrorDetailsInternal)this).ErrorCode, global::System.Convert.ToString); + } + if (content.Contains("ErrorMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmLastAgentUpgradeErrorDetailsInternal)this).ErrorMessage = (string) content.GetValueForProperty("ErrorMessage",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmLastAgentUpgradeErrorDetailsInternal)this).ErrorMessage, global::System.Convert.ToString); + } + if (content.Contains("PossibleCaus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmLastAgentUpgradeErrorDetailsInternal)this).PossibleCaus = (string) content.GetValueForProperty("PossibleCaus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmLastAgentUpgradeErrorDetailsInternal)this).PossibleCaus, global::System.Convert.ToString); + } + if (content.Contains("RecommendedAction")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmLastAgentUpgradeErrorDetailsInternal)this).RecommendedAction = (string) content.GetValueForProperty("RecommendedAction",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmLastAgentUpgradeErrorDetailsInternal)this).RecommendedAction, global::System.Convert.ToString); + } + if (content.Contains("ErrorMessageParameter")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmLastAgentUpgradeErrorDetailsInternal)this).ErrorMessageParameter = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmLastAgentUpgradeErrorDetailsErrorMessageParameters) content.GetValueForProperty("ErrorMessageParameter",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmLastAgentUpgradeErrorDetailsInternal)this).ErrorMessageParameter, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmLastAgentUpgradeErrorDetailsErrorMessageParametersTypeConverter.ConvertFrom); + } + if (content.Contains("ErrorTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmLastAgentUpgradeErrorDetailsInternal)this).ErrorTag = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmLastAgentUpgradeErrorDetailsErrorTags) content.GetValueForProperty("ErrorTag",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmLastAgentUpgradeErrorDetailsInternal)this).ErrorTag, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmLastAgentUpgradeErrorDetailsErrorTagsTypeConverter.ConvertFrom); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// InMageRcm last source agent upgrade error details. + [System.ComponentModel.TypeConverter(typeof(InMageRcmLastAgentUpgradeErrorDetailsTypeConverter))] + public partial interface IInMageRcmLastAgentUpgradeErrorDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmLastAgentUpgradeErrorDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmLastAgentUpgradeErrorDetails.TypeConverter.cs new file mode 100644 index 000000000000..de7c8dcefed7 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmLastAgentUpgradeErrorDetails.TypeConverter.cs @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InMageRcmLastAgentUpgradeErrorDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmLastAgentUpgradeErrorDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmLastAgentUpgradeErrorDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InMageRcmLastAgentUpgradeErrorDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InMageRcmLastAgentUpgradeErrorDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InMageRcmLastAgentUpgradeErrorDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmLastAgentUpgradeErrorDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmLastAgentUpgradeErrorDetails.cs new file mode 100644 index 000000000000..cf0f5225b848 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmLastAgentUpgradeErrorDetails.cs @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMageRcm last source agent upgrade error details. + public partial class InMageRcmLastAgentUpgradeErrorDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmLastAgentUpgradeErrorDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmLastAgentUpgradeErrorDetailsInternal + { + + /// Backing field for property. + private string _errorCode; + + /// The error code. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ErrorCode { get => this._errorCode; } + + /// Backing field for property. + private string _errorMessage; + + /// The error message. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ErrorMessage { get => this._errorMessage; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmLastAgentUpgradeErrorDetailsErrorMessageParameters _errorMessageParameter; + + /// The error message parameters. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmLastAgentUpgradeErrorDetailsErrorMessageParameters ErrorMessageParameter { get => (this._errorMessageParameter = this._errorMessageParameter ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmLastAgentUpgradeErrorDetailsErrorMessageParameters()); } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmLastAgentUpgradeErrorDetailsErrorTags _errorTag; + + /// The error tags. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmLastAgentUpgradeErrorDetailsErrorTags ErrorTag { get => (this._errorTag = this._errorTag ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmLastAgentUpgradeErrorDetailsErrorTags()); } + + /// Internal Acessors for ErrorCode + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmLastAgentUpgradeErrorDetailsInternal.ErrorCode { get => this._errorCode; set { {_errorCode = value;} } } + + /// Internal Acessors for ErrorMessage + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmLastAgentUpgradeErrorDetailsInternal.ErrorMessage { get => this._errorMessage; set { {_errorMessage = value;} } } + + /// Internal Acessors for ErrorMessageParameter + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmLastAgentUpgradeErrorDetailsErrorMessageParameters Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmLastAgentUpgradeErrorDetailsInternal.ErrorMessageParameter { get => (this._errorMessageParameter = this._errorMessageParameter ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmLastAgentUpgradeErrorDetailsErrorMessageParameters()); set { {_errorMessageParameter = value;} } } + + /// Internal Acessors for ErrorTag + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmLastAgentUpgradeErrorDetailsErrorTags Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmLastAgentUpgradeErrorDetailsInternal.ErrorTag { get => (this._errorTag = this._errorTag ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmLastAgentUpgradeErrorDetailsErrorTags()); set { {_errorTag = value;} } } + + /// Internal Acessors for PossibleCaus + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmLastAgentUpgradeErrorDetailsInternal.PossibleCaus { get => this._possibleCaus; set { {_possibleCaus = value;} } } + + /// Internal Acessors for RecommendedAction + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmLastAgentUpgradeErrorDetailsInternal.RecommendedAction { get => this._recommendedAction; set { {_recommendedAction = value;} } } + + /// Backing field for property. + private string _possibleCaus; + + /// The possible causes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string PossibleCaus { get => this._possibleCaus; } + + /// Backing field for property. + private string _recommendedAction; + + /// The recommended action. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecommendedAction { get => this._recommendedAction; } + + /// Creates an new instance. + public InMageRcmLastAgentUpgradeErrorDetails() + { + + } + } + /// InMageRcm last source agent upgrade error details. + public partial interface IInMageRcmLastAgentUpgradeErrorDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The error code. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The error code.", + SerializedName = @"errorCode", + PossibleTypes = new [] { typeof(string) })] + string ErrorCode { get; } + /// The error message. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The error message.", + SerializedName = @"errorMessage", + PossibleTypes = new [] { typeof(string) })] + string ErrorMessage { get; } + /// The error message parameters. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The error message parameters.", + SerializedName = @"errorMessageParameters", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmLastAgentUpgradeErrorDetailsErrorMessageParameters) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmLastAgentUpgradeErrorDetailsErrorMessageParameters ErrorMessageParameter { get; } + /// The error tags. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The error tags.", + SerializedName = @"errorTags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmLastAgentUpgradeErrorDetailsErrorTags) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmLastAgentUpgradeErrorDetailsErrorTags ErrorTag { get; } + /// The possible causes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The possible causes.", + SerializedName = @"possibleCauses", + PossibleTypes = new [] { typeof(string) })] + string PossibleCaus { get; } + /// The recommended action. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The recommended action.", + SerializedName = @"recommendedAction", + PossibleTypes = new [] { typeof(string) })] + string RecommendedAction { get; } + + } + /// InMageRcm last source agent upgrade error details. + internal partial interface IInMageRcmLastAgentUpgradeErrorDetailsInternal + + { + /// The error code. + string ErrorCode { get; set; } + /// The error message. + string ErrorMessage { get; set; } + /// The error message parameters. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmLastAgentUpgradeErrorDetailsErrorMessageParameters ErrorMessageParameter { get; set; } + /// The error tags. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmLastAgentUpgradeErrorDetailsErrorTags ErrorTag { get; set; } + /// The possible causes. + string PossibleCaus { get; set; } + /// The recommended action. + string RecommendedAction { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmLastAgentUpgradeErrorDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmLastAgentUpgradeErrorDetails.json.cs new file mode 100644 index 000000000000..1be5b3962ed5 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmLastAgentUpgradeErrorDetails.json.cs @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMageRcm last source agent upgrade error details. + public partial class InMageRcmLastAgentUpgradeErrorDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmLastAgentUpgradeErrorDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmLastAgentUpgradeErrorDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmLastAgentUpgradeErrorDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new InMageRcmLastAgentUpgradeErrorDetails(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal InMageRcmLastAgentUpgradeErrorDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_errorCode = If( json?.PropertyT("errorCode"), out var __jsonErrorCode) ? (string)__jsonErrorCode : (string)ErrorCode;} + {_errorMessage = If( json?.PropertyT("errorMessage"), out var __jsonErrorMessage) ? (string)__jsonErrorMessage : (string)ErrorMessage;} + {_possibleCaus = If( json?.PropertyT("possibleCauses"), out var __jsonPossibleCauses) ? (string)__jsonPossibleCauses : (string)PossibleCaus;} + {_recommendedAction = If( json?.PropertyT("recommendedAction"), out var __jsonRecommendedAction) ? (string)__jsonRecommendedAction : (string)RecommendedAction;} + {_errorMessageParameter = If( json?.PropertyT("errorMessageParameters"), out var __jsonErrorMessageParameters) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmLastAgentUpgradeErrorDetailsErrorMessageParameters.FromJson(__jsonErrorMessageParameters) : ErrorMessageParameter;} + {_errorTag = If( json?.PropertyT("errorTags"), out var __jsonErrorTags) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmLastAgentUpgradeErrorDetailsErrorTags.FromJson(__jsonErrorTags) : ErrorTag;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._errorCode)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._errorCode.ToString()) : null, "errorCode" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._errorMessage)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._errorMessage.ToString()) : null, "errorMessage" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._possibleCaus)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._possibleCaus.ToString()) : null, "possibleCauses" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._recommendedAction)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recommendedAction.ToString()) : null, "recommendedAction" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._errorMessageParameter ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._errorMessageParameter.ToJson(null,serializationMode) : null, "errorMessageParameters" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._errorTag ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._errorTag.ToJson(null,serializationMode) : null, "errorTags" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmLastAgentUpgradeErrorDetailsErrorMessageParameters.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmLastAgentUpgradeErrorDetailsErrorMessageParameters.PowerShell.cs new file mode 100644 index 000000000000..877bccebbb7c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmLastAgentUpgradeErrorDetailsErrorMessageParameters.PowerShell.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// The error message parameters. + [System.ComponentModel.TypeConverter(typeof(InMageRcmLastAgentUpgradeErrorDetailsErrorMessageParametersTypeConverter))] + public partial class InMageRcmLastAgentUpgradeErrorDetailsErrorMessageParameters + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmLastAgentUpgradeErrorDetailsErrorMessageParameters DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InMageRcmLastAgentUpgradeErrorDetailsErrorMessageParameters(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmLastAgentUpgradeErrorDetailsErrorMessageParameters DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InMageRcmLastAgentUpgradeErrorDetailsErrorMessageParameters(content); + } + + /// + /// Creates a new instance of , deserializing the + /// content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmLastAgentUpgradeErrorDetailsErrorMessageParameters FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InMageRcmLastAgentUpgradeErrorDetailsErrorMessageParameters(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InMageRcmLastAgentUpgradeErrorDetailsErrorMessageParameters(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// The error message parameters. + [System.ComponentModel.TypeConverter(typeof(InMageRcmLastAgentUpgradeErrorDetailsErrorMessageParametersTypeConverter))] + public partial interface IInMageRcmLastAgentUpgradeErrorDetailsErrorMessageParameters + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmLastAgentUpgradeErrorDetailsErrorMessageParameters.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmLastAgentUpgradeErrorDetailsErrorMessageParameters.TypeConverter.cs new file mode 100644 index 000000000000..22723199d090 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmLastAgentUpgradeErrorDetailsErrorMessageParameters.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InMageRcmLastAgentUpgradeErrorDetailsErrorMessageParametersTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is + /// no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is + /// no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmLastAgentUpgradeErrorDetailsErrorMessageParameters ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmLastAgentUpgradeErrorDetailsErrorMessageParameters).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InMageRcmLastAgentUpgradeErrorDetailsErrorMessageParameters.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InMageRcmLastAgentUpgradeErrorDetailsErrorMessageParameters.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InMageRcmLastAgentUpgradeErrorDetailsErrorMessageParameters.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmLastAgentUpgradeErrorDetailsErrorMessageParameters.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmLastAgentUpgradeErrorDetailsErrorMessageParameters.cs new file mode 100644 index 000000000000..2ee8e180e0ce --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmLastAgentUpgradeErrorDetailsErrorMessageParameters.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The error message parameters. + public partial class InMageRcmLastAgentUpgradeErrorDetailsErrorMessageParameters : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmLastAgentUpgradeErrorDetailsErrorMessageParameters, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmLastAgentUpgradeErrorDetailsErrorMessageParametersInternal + { + + /// + /// Creates an new instance. + /// + public InMageRcmLastAgentUpgradeErrorDetailsErrorMessageParameters() + { + + } + } + /// The error message parameters. + public partial interface IInMageRcmLastAgentUpgradeErrorDetailsErrorMessageParameters : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray + { + + } + /// The error message parameters. + internal partial interface IInMageRcmLastAgentUpgradeErrorDetailsErrorMessageParametersInternal + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmLastAgentUpgradeErrorDetailsErrorMessageParameters.dictionary.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmLastAgentUpgradeErrorDetailsErrorMessageParameters.dictionary.cs new file mode 100644 index 000000000000..79f13354c093 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmLastAgentUpgradeErrorDetailsErrorMessageParameters.dictionary.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + public partial class InMageRcmLastAgentUpgradeErrorDetailsErrorMessageParameters : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray + { + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + + int Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Values { get => __additionalProperties.Values; } + + public string this[global::System.String index] { get => __additionalProperties[index]; set => __additionalProperties[index] = value; } + + /// + /// + public void Add(global::System.String key, string value) => __additionalProperties.Add( key, value); + + public void Clear() => __additionalProperties.Clear(); + + /// + public bool ContainsKey(global::System.String key) => __additionalProperties.ContainsKey( key); + + /// + public void CopyFrom(global::System.Collections.IDictionary source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public void CopyFrom(global::System.Management.Automation.PSObject source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public bool Remove(global::System.String key) => __additionalProperties.Remove( key); + + /// + /// + public bool TryGetValue(global::System.String key, out string value) => __additionalProperties.TryGetValue( key, out value); + + /// + + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmLastAgentUpgradeErrorDetailsErrorMessageParameters source) => source.__additionalProperties; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmLastAgentUpgradeErrorDetailsErrorMessageParameters.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmLastAgentUpgradeErrorDetailsErrorMessageParameters.json.cs new file mode 100644 index 000000000000..1bee99020b6a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmLastAgentUpgradeErrorDetailsErrorMessageParameters.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The error message parameters. + public partial class InMageRcmLastAgentUpgradeErrorDetailsErrorMessageParameters + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmLastAgentUpgradeErrorDetailsErrorMessageParameters. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmLastAgentUpgradeErrorDetailsErrorMessageParameters. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmLastAgentUpgradeErrorDetailsErrorMessageParameters FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new InMageRcmLastAgentUpgradeErrorDetailsErrorMessageParameters(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + /// + internal InMageRcmLastAgentUpgradeErrorDetailsErrorMessageParameters(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, global::System.Collections.Generic.HashSet exclusions = null) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray)this).AdditionalProperties, null ,exclusions ); + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray)this).AdditionalProperties, container); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmLastAgentUpgradeErrorDetailsErrorTags.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmLastAgentUpgradeErrorDetailsErrorTags.PowerShell.cs new file mode 100644 index 000000000000..77b373559b79 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmLastAgentUpgradeErrorDetailsErrorTags.PowerShell.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// The error tags. + [System.ComponentModel.TypeConverter(typeof(InMageRcmLastAgentUpgradeErrorDetailsErrorTagsTypeConverter))] + public partial class InMageRcmLastAgentUpgradeErrorDetailsErrorTags + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmLastAgentUpgradeErrorDetailsErrorTags DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InMageRcmLastAgentUpgradeErrorDetailsErrorTags(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmLastAgentUpgradeErrorDetailsErrorTags DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InMageRcmLastAgentUpgradeErrorDetailsErrorTags(content); + } + + /// + /// Creates a new instance of , deserializing the content from + /// a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmLastAgentUpgradeErrorDetailsErrorTags FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InMageRcmLastAgentUpgradeErrorDetailsErrorTags(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InMageRcmLastAgentUpgradeErrorDetailsErrorTags(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// The error tags. + [System.ComponentModel.TypeConverter(typeof(InMageRcmLastAgentUpgradeErrorDetailsErrorTagsTypeConverter))] + public partial interface IInMageRcmLastAgentUpgradeErrorDetailsErrorTags + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmLastAgentUpgradeErrorDetailsErrorTags.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmLastAgentUpgradeErrorDetailsErrorTags.TypeConverter.cs new file mode 100644 index 000000000000..d1542fb6b674 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmLastAgentUpgradeErrorDetailsErrorTags.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InMageRcmLastAgentUpgradeErrorDetailsErrorTagsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, + /// otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmLastAgentUpgradeErrorDetailsErrorTags ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmLastAgentUpgradeErrorDetailsErrorTags).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InMageRcmLastAgentUpgradeErrorDetailsErrorTags.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InMageRcmLastAgentUpgradeErrorDetailsErrorTags.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InMageRcmLastAgentUpgradeErrorDetailsErrorTags.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmLastAgentUpgradeErrorDetailsErrorTags.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmLastAgentUpgradeErrorDetailsErrorTags.cs new file mode 100644 index 000000000000..26fd8649628a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmLastAgentUpgradeErrorDetailsErrorTags.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The error tags. + public partial class InMageRcmLastAgentUpgradeErrorDetailsErrorTags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmLastAgentUpgradeErrorDetailsErrorTags, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmLastAgentUpgradeErrorDetailsErrorTagsInternal + { + + /// + /// Creates an new instance. + /// + public InMageRcmLastAgentUpgradeErrorDetailsErrorTags() + { + + } + } + /// The error tags. + public partial interface IInMageRcmLastAgentUpgradeErrorDetailsErrorTags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray + { + + } + /// The error tags. + internal partial interface IInMageRcmLastAgentUpgradeErrorDetailsErrorTagsInternal + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmLastAgentUpgradeErrorDetailsErrorTags.dictionary.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmLastAgentUpgradeErrorDetailsErrorTags.dictionary.cs new file mode 100644 index 000000000000..9c0895a0ce7c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmLastAgentUpgradeErrorDetailsErrorTags.dictionary.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + public partial class InMageRcmLastAgentUpgradeErrorDetailsErrorTags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray + { + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + + int Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Values { get => __additionalProperties.Values; } + + public string this[global::System.String index] { get => __additionalProperties[index]; set => __additionalProperties[index] = value; } + + /// + /// + public void Add(global::System.String key, string value) => __additionalProperties.Add( key, value); + + public void Clear() => __additionalProperties.Clear(); + + /// + public bool ContainsKey(global::System.String key) => __additionalProperties.ContainsKey( key); + + /// + public void CopyFrom(global::System.Collections.IDictionary source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public void CopyFrom(global::System.Management.Automation.PSObject source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public bool Remove(global::System.String key) => __additionalProperties.Remove( key); + + /// + /// + public bool TryGetValue(global::System.String key, out string value) => __additionalProperties.TryGetValue( key, out value); + + /// + + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmLastAgentUpgradeErrorDetailsErrorTags source) => source.__additionalProperties; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmLastAgentUpgradeErrorDetailsErrorTags.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmLastAgentUpgradeErrorDetailsErrorTags.json.cs new file mode 100644 index 000000000000..a2f28ee5628d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmLastAgentUpgradeErrorDetailsErrorTags.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The error tags. + public partial class InMageRcmLastAgentUpgradeErrorDetailsErrorTags + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmLastAgentUpgradeErrorDetailsErrorTags. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmLastAgentUpgradeErrorDetailsErrorTags. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmLastAgentUpgradeErrorDetailsErrorTags FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new InMageRcmLastAgentUpgradeErrorDetailsErrorTags(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + /// + internal InMageRcmLastAgentUpgradeErrorDetailsErrorTags(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, global::System.Collections.Generic.HashSet exclusions = null) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray)this).AdditionalProperties, null ,exclusions ); + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray)this).AdditionalProperties, container); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmMobilityAgentDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmMobilityAgentDetails.PowerShell.cs new file mode 100644 index 000000000000..9765ee0e487d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmMobilityAgentDetails.PowerShell.cs @@ -0,0 +1,218 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// InMageRcm mobility agent details. + [System.ComponentModel.TypeConverter(typeof(InMageRcmMobilityAgentDetailsTypeConverter))] + public partial class InMageRcmMobilityAgentDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmMobilityAgentDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InMageRcmMobilityAgentDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmMobilityAgentDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InMageRcmMobilityAgentDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmMobilityAgentDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InMageRcmMobilityAgentDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Version")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmMobilityAgentDetailsInternal)this).Version = (string) content.GetValueForProperty("Version",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmMobilityAgentDetailsInternal)this).Version, global::System.Convert.ToString); + } + if (content.Contains("LatestVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmMobilityAgentDetailsInternal)this).LatestVersion = (string) content.GetValueForProperty("LatestVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmMobilityAgentDetailsInternal)this).LatestVersion, global::System.Convert.ToString); + } + if (content.Contains("LatestAgentReleaseDate")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmMobilityAgentDetailsInternal)this).LatestAgentReleaseDate = (string) content.GetValueForProperty("LatestAgentReleaseDate",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmMobilityAgentDetailsInternal)this).LatestAgentReleaseDate, global::System.Convert.ToString); + } + if (content.Contains("DriverVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmMobilityAgentDetailsInternal)this).DriverVersion = (string) content.GetValueForProperty("DriverVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmMobilityAgentDetailsInternal)this).DriverVersion, global::System.Convert.ToString); + } + if (content.Contains("LatestUpgradableVersionWithoutReboot")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmMobilityAgentDetailsInternal)this).LatestUpgradableVersionWithoutReboot = (string) content.GetValueForProperty("LatestUpgradableVersionWithoutReboot",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmMobilityAgentDetailsInternal)this).LatestUpgradableVersionWithoutReboot, global::System.Convert.ToString); + } + if (content.Contains("AgentVersionExpiryDate")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmMobilityAgentDetailsInternal)this).AgentVersionExpiryDate = (global::System.DateTime?) content.GetValueForProperty("AgentVersionExpiryDate",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmMobilityAgentDetailsInternal)this).AgentVersionExpiryDate, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("DriverVersionExpiryDate")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmMobilityAgentDetailsInternal)this).DriverVersionExpiryDate = (global::System.DateTime?) content.GetValueForProperty("DriverVersionExpiryDate",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmMobilityAgentDetailsInternal)this).DriverVersionExpiryDate, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("LastHeartbeatUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmMobilityAgentDetailsInternal)this).LastHeartbeatUtc = (global::System.DateTime?) content.GetValueForProperty("LastHeartbeatUtc",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmMobilityAgentDetailsInternal)this).LastHeartbeatUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ReasonsBlockingUpgrade")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmMobilityAgentDetailsInternal)this).ReasonsBlockingUpgrade = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentUpgradeBlockedReason[]) content.GetValueForProperty("ReasonsBlockingUpgrade",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmMobilityAgentDetailsInternal)this).ReasonsBlockingUpgrade, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentUpgradeBlockedReason.CreateFrom)); + } + if (content.Contains("IsUpgradeable")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmMobilityAgentDetailsInternal)this).IsUpgradeable = (string) content.GetValueForProperty("IsUpgradeable",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmMobilityAgentDetailsInternal)this).IsUpgradeable, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InMageRcmMobilityAgentDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Version")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmMobilityAgentDetailsInternal)this).Version = (string) content.GetValueForProperty("Version",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmMobilityAgentDetailsInternal)this).Version, global::System.Convert.ToString); + } + if (content.Contains("LatestVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmMobilityAgentDetailsInternal)this).LatestVersion = (string) content.GetValueForProperty("LatestVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmMobilityAgentDetailsInternal)this).LatestVersion, global::System.Convert.ToString); + } + if (content.Contains("LatestAgentReleaseDate")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmMobilityAgentDetailsInternal)this).LatestAgentReleaseDate = (string) content.GetValueForProperty("LatestAgentReleaseDate",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmMobilityAgentDetailsInternal)this).LatestAgentReleaseDate, global::System.Convert.ToString); + } + if (content.Contains("DriverVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmMobilityAgentDetailsInternal)this).DriverVersion = (string) content.GetValueForProperty("DriverVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmMobilityAgentDetailsInternal)this).DriverVersion, global::System.Convert.ToString); + } + if (content.Contains("LatestUpgradableVersionWithoutReboot")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmMobilityAgentDetailsInternal)this).LatestUpgradableVersionWithoutReboot = (string) content.GetValueForProperty("LatestUpgradableVersionWithoutReboot",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmMobilityAgentDetailsInternal)this).LatestUpgradableVersionWithoutReboot, global::System.Convert.ToString); + } + if (content.Contains("AgentVersionExpiryDate")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmMobilityAgentDetailsInternal)this).AgentVersionExpiryDate = (global::System.DateTime?) content.GetValueForProperty("AgentVersionExpiryDate",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmMobilityAgentDetailsInternal)this).AgentVersionExpiryDate, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("DriverVersionExpiryDate")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmMobilityAgentDetailsInternal)this).DriverVersionExpiryDate = (global::System.DateTime?) content.GetValueForProperty("DriverVersionExpiryDate",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmMobilityAgentDetailsInternal)this).DriverVersionExpiryDate, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("LastHeartbeatUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmMobilityAgentDetailsInternal)this).LastHeartbeatUtc = (global::System.DateTime?) content.GetValueForProperty("LastHeartbeatUtc",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmMobilityAgentDetailsInternal)this).LastHeartbeatUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ReasonsBlockingUpgrade")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmMobilityAgentDetailsInternal)this).ReasonsBlockingUpgrade = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentUpgradeBlockedReason[]) content.GetValueForProperty("ReasonsBlockingUpgrade",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmMobilityAgentDetailsInternal)this).ReasonsBlockingUpgrade, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentUpgradeBlockedReason.CreateFrom)); + } + if (content.Contains("IsUpgradeable")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmMobilityAgentDetailsInternal)this).IsUpgradeable = (string) content.GetValueForProperty("IsUpgradeable",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmMobilityAgentDetailsInternal)this).IsUpgradeable, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// InMageRcm mobility agent details. + [System.ComponentModel.TypeConverter(typeof(InMageRcmMobilityAgentDetailsTypeConverter))] + public partial interface IInMageRcmMobilityAgentDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmMobilityAgentDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmMobilityAgentDetails.TypeConverter.cs new file mode 100644 index 000000000000..9fdc9dae3aae --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmMobilityAgentDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InMageRcmMobilityAgentDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmMobilityAgentDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmMobilityAgentDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InMageRcmMobilityAgentDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InMageRcmMobilityAgentDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InMageRcmMobilityAgentDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmMobilityAgentDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmMobilityAgentDetails.cs new file mode 100644 index 000000000000..ad078f3e0b1c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmMobilityAgentDetails.cs @@ -0,0 +1,234 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMageRcm mobility agent details. + public partial class InMageRcmMobilityAgentDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmMobilityAgentDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmMobilityAgentDetailsInternal + { + + /// Backing field for property. + private global::System.DateTime? _agentVersionExpiryDate; + + /// The agent version expiry date. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public global::System.DateTime? AgentVersionExpiryDate { get => this._agentVersionExpiryDate; } + + /// Backing field for property. + private string _driverVersion; + + /// The driver version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string DriverVersion { get => this._driverVersion; } + + /// Backing field for property. + private global::System.DateTime? _driverVersionExpiryDate; + + /// The driver version expiry date. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public global::System.DateTime? DriverVersionExpiryDate { get => this._driverVersionExpiryDate; } + + /// Backing field for property. + private string _isUpgradeable; + + /// A value indicating whether agent is upgradeable or not. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string IsUpgradeable { get => this._isUpgradeable; } + + /// Backing field for property. + private global::System.DateTime? _lastHeartbeatUtc; + + /// The time of the last heartbeat received from the agent. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public global::System.DateTime? LastHeartbeatUtc { get => this._lastHeartbeatUtc; } + + /// Backing field for property. + private string _latestAgentReleaseDate; + + /// The latest agent version release date. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string LatestAgentReleaseDate { get => this._latestAgentReleaseDate; } + + /// Backing field for property. + private string _latestUpgradableVersionWithoutReboot; + + /// The latest upgradeable version available without reboot. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string LatestUpgradableVersionWithoutReboot { get => this._latestUpgradableVersionWithoutReboot; } + + /// Backing field for property. + private string _latestVersion; + + /// The latest agent version available. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string LatestVersion { get => this._latestVersion; } + + /// Internal Acessors for AgentVersionExpiryDate + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmMobilityAgentDetailsInternal.AgentVersionExpiryDate { get => this._agentVersionExpiryDate; set { {_agentVersionExpiryDate = value;} } } + + /// Internal Acessors for DriverVersion + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmMobilityAgentDetailsInternal.DriverVersion { get => this._driverVersion; set { {_driverVersion = value;} } } + + /// Internal Acessors for DriverVersionExpiryDate + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmMobilityAgentDetailsInternal.DriverVersionExpiryDate { get => this._driverVersionExpiryDate; set { {_driverVersionExpiryDate = value;} } } + + /// Internal Acessors for IsUpgradeable + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmMobilityAgentDetailsInternal.IsUpgradeable { get => this._isUpgradeable; set { {_isUpgradeable = value;} } } + + /// Internal Acessors for LastHeartbeatUtc + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmMobilityAgentDetailsInternal.LastHeartbeatUtc { get => this._lastHeartbeatUtc; set { {_lastHeartbeatUtc = value;} } } + + /// Internal Acessors for LatestAgentReleaseDate + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmMobilityAgentDetailsInternal.LatestAgentReleaseDate { get => this._latestAgentReleaseDate; set { {_latestAgentReleaseDate = value;} } } + + /// Internal Acessors for LatestUpgradableVersionWithoutReboot + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmMobilityAgentDetailsInternal.LatestUpgradableVersionWithoutReboot { get => this._latestUpgradableVersionWithoutReboot; set { {_latestUpgradableVersionWithoutReboot = value;} } } + + /// Internal Acessors for LatestVersion + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmMobilityAgentDetailsInternal.LatestVersion { get => this._latestVersion; set { {_latestVersion = value;} } } + + /// Internal Acessors for ReasonsBlockingUpgrade + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentUpgradeBlockedReason[] Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmMobilityAgentDetailsInternal.ReasonsBlockingUpgrade { get => this._reasonsBlockingUpgrade; set { {_reasonsBlockingUpgrade = value;} } } + + /// Internal Acessors for Version + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmMobilityAgentDetailsInternal.Version { get => this._version; set { {_version = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentUpgradeBlockedReason[] _reasonsBlockingUpgrade; + + /// The whether update is possible or not. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentUpgradeBlockedReason[] ReasonsBlockingUpgrade { get => this._reasonsBlockingUpgrade; } + + /// Backing field for property. + private string _version; + + /// The agent version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Version { get => this._version; } + + /// Creates an new instance. + public InMageRcmMobilityAgentDetails() + { + + } + } + /// InMageRcm mobility agent details. + public partial interface IInMageRcmMobilityAgentDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The agent version expiry date. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The agent version expiry date.", + SerializedName = @"agentVersionExpiryDate", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? AgentVersionExpiryDate { get; } + /// The driver version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The driver version.", + SerializedName = @"driverVersion", + PossibleTypes = new [] { typeof(string) })] + string DriverVersion { get; } + /// The driver version expiry date. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The driver version expiry date.", + SerializedName = @"driverVersionExpiryDate", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? DriverVersionExpiryDate { get; } + /// A value indicating whether agent is upgradeable or not. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"A value indicating whether agent is upgradeable or not.", + SerializedName = @"isUpgradeable", + PossibleTypes = new [] { typeof(string) })] + string IsUpgradeable { get; } + /// The time of the last heartbeat received from the agent. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The time of the last heartbeat received from the agent.", + SerializedName = @"lastHeartbeatUtc", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? LastHeartbeatUtc { get; } + /// The latest agent version release date. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The latest agent version release date.", + SerializedName = @"latestAgentReleaseDate", + PossibleTypes = new [] { typeof(string) })] + string LatestAgentReleaseDate { get; } + /// The latest upgradeable version available without reboot. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The latest upgradeable version available without reboot.", + SerializedName = @"latestUpgradableVersionWithoutReboot", + PossibleTypes = new [] { typeof(string) })] + string LatestUpgradableVersionWithoutReboot { get; } + /// The latest agent version available. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The latest agent version available.", + SerializedName = @"latestVersion", + PossibleTypes = new [] { typeof(string) })] + string LatestVersion { get; } + /// The whether update is possible or not. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The whether update is possible or not.", + SerializedName = @"reasonsBlockingUpgrade", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentUpgradeBlockedReason) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentUpgradeBlockedReason[] ReasonsBlockingUpgrade { get; } + /// The agent version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The agent version.", + SerializedName = @"version", + PossibleTypes = new [] { typeof(string) })] + string Version { get; } + + } + /// InMageRcm mobility agent details. + internal partial interface IInMageRcmMobilityAgentDetailsInternal + + { + /// The agent version expiry date. + global::System.DateTime? AgentVersionExpiryDate { get; set; } + /// The driver version. + string DriverVersion { get; set; } + /// The driver version expiry date. + global::System.DateTime? DriverVersionExpiryDate { get; set; } + /// A value indicating whether agent is upgradeable or not. + string IsUpgradeable { get; set; } + /// The time of the last heartbeat received from the agent. + global::System.DateTime? LastHeartbeatUtc { get; set; } + /// The latest agent version release date. + string LatestAgentReleaseDate { get; set; } + /// The latest upgradeable version available without reboot. + string LatestUpgradableVersionWithoutReboot { get; set; } + /// The latest agent version available. + string LatestVersion { get; set; } + /// The whether update is possible or not. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentUpgradeBlockedReason[] ReasonsBlockingUpgrade { get; set; } + /// The agent version. + string Version { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmMobilityAgentDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmMobilityAgentDetails.json.cs new file mode 100644 index 000000000000..08f2288046ea --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmMobilityAgentDetails.json.cs @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMageRcm mobility agent details. + public partial class InMageRcmMobilityAgentDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmMobilityAgentDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmMobilityAgentDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmMobilityAgentDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new InMageRcmMobilityAgentDetails(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal InMageRcmMobilityAgentDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_version = If( json?.PropertyT("version"), out var __jsonVersion) ? (string)__jsonVersion : (string)Version;} + {_latestVersion = If( json?.PropertyT("latestVersion"), out var __jsonLatestVersion) ? (string)__jsonLatestVersion : (string)LatestVersion;} + {_latestAgentReleaseDate = If( json?.PropertyT("latestAgentReleaseDate"), out var __jsonLatestAgentReleaseDate) ? (string)__jsonLatestAgentReleaseDate : (string)LatestAgentReleaseDate;} + {_driverVersion = If( json?.PropertyT("driverVersion"), out var __jsonDriverVersion) ? (string)__jsonDriverVersion : (string)DriverVersion;} + {_latestUpgradableVersionWithoutReboot = If( json?.PropertyT("latestUpgradableVersionWithoutReboot"), out var __jsonLatestUpgradableVersionWithoutReboot) ? (string)__jsonLatestUpgradableVersionWithoutReboot : (string)LatestUpgradableVersionWithoutReboot;} + {_agentVersionExpiryDate = If( json?.PropertyT("agentVersionExpiryDate"), out var __jsonAgentVersionExpiryDate) ? global::System.DateTime.TryParse((string)__jsonAgentVersionExpiryDate, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonAgentVersionExpiryDateValue) ? __jsonAgentVersionExpiryDateValue : AgentVersionExpiryDate : AgentVersionExpiryDate;} + {_driverVersionExpiryDate = If( json?.PropertyT("driverVersionExpiryDate"), out var __jsonDriverVersionExpiryDate) ? global::System.DateTime.TryParse((string)__jsonDriverVersionExpiryDate, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonDriverVersionExpiryDateValue) ? __jsonDriverVersionExpiryDateValue : DriverVersionExpiryDate : DriverVersionExpiryDate;} + {_lastHeartbeatUtc = If( json?.PropertyT("lastHeartbeatUtc"), out var __jsonLastHeartbeatUtc) ? global::System.DateTime.TryParse((string)__jsonLastHeartbeatUtc, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonLastHeartbeatUtcValue) ? __jsonLastHeartbeatUtcValue : LastHeartbeatUtc : LastHeartbeatUtc;} + {_reasonsBlockingUpgrade = If( json?.PropertyT("reasonsBlockingUpgrade"), out var __jsonReasonsBlockingUpgrade) ? If( __jsonReasonsBlockingUpgrade as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentUpgradeBlockedReason) (__u is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString __t ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentUpgradeBlockedReason)(__t.ToString()) : ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentUpgradeBlockedReason)""))) ))() : null : ReasonsBlockingUpgrade;} + {_isUpgradeable = If( json?.PropertyT("isUpgradeable"), out var __jsonIsUpgradeable) ? (string)__jsonIsUpgradeable : (string)IsUpgradeable;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._version)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._version.ToString()) : null, "version" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._latestVersion)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._latestVersion.ToString()) : null, "latestVersion" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._latestAgentReleaseDate)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._latestAgentReleaseDate.ToString()) : null, "latestAgentReleaseDate" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._driverVersion)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._driverVersion.ToString()) : null, "driverVersion" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._latestUpgradableVersionWithoutReboot)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._latestUpgradableVersionWithoutReboot.ToString()) : null, "latestUpgradableVersionWithoutReboot" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._agentVersionExpiryDate ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._agentVersionExpiryDate?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "agentVersionExpiryDate" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._driverVersionExpiryDate ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._driverVersionExpiryDate?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "driverVersionExpiryDate" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._lastHeartbeatUtc ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._lastHeartbeatUtc?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "lastHeartbeatUtc" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + if (null != this._reasonsBlockingUpgrade) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._reasonsBlockingUpgrade ) + { + AddIf(null != (((object)__x)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(__x.ToString()) : null ,__w.Add); + } + container.Add("reasonsBlockingUpgrade",__w); + } + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._isUpgradeable)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._isUpgradeable.ToString()) : null, "isUpgradeable" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmNicDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmNicDetails.PowerShell.cs new file mode 100644 index 000000000000..9e70b2b278b3 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmNicDetails.PowerShell.cs @@ -0,0 +1,240 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// InMageRcm NIC details. + [System.ComponentModel.TypeConverter(typeof(InMageRcmNicDetailsTypeConverter))] + public partial class InMageRcmNicDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InMageRcmNicDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InMageRcmNicDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InMageRcmNicDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("NicId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicDetailsInternal)this).NicId = (string) content.GetValueForProperty("NicId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicDetailsInternal)this).NicId, global::System.Convert.ToString); + } + if (content.Contains("IsPrimaryNic")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicDetailsInternal)this).IsPrimaryNic = (string) content.GetValueForProperty("IsPrimaryNic",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicDetailsInternal)this).IsPrimaryNic, global::System.Convert.ToString); + } + if (content.Contains("IsSelectedForFailover")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicDetailsInternal)this).IsSelectedForFailover = (string) content.GetValueForProperty("IsSelectedForFailover",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicDetailsInternal)this).IsSelectedForFailover, global::System.Convert.ToString); + } + if (content.Contains("SourceIPAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicDetailsInternal)this).SourceIPAddress = (string) content.GetValueForProperty("SourceIPAddress",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicDetailsInternal)this).SourceIPAddress, global::System.Convert.ToString); + } + if (content.Contains("SourceIPAddressType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicDetailsInternal)this).SourceIPAddressType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.EthernetAddressType?) content.GetValueForProperty("SourceIPAddressType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicDetailsInternal)this).SourceIPAddressType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.EthernetAddressType.CreateFrom); + } + if (content.Contains("SourceNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicDetailsInternal)this).SourceNetworkId = (string) content.GetValueForProperty("SourceNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicDetailsInternal)this).SourceNetworkId, global::System.Convert.ToString); + } + if (content.Contains("SourceSubnetName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicDetailsInternal)this).SourceSubnetName = (string) content.GetValueForProperty("SourceSubnetName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicDetailsInternal)this).SourceSubnetName, global::System.Convert.ToString); + } + if (content.Contains("TargetIPAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicDetailsInternal)this).TargetIPAddress = (string) content.GetValueForProperty("TargetIPAddress",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicDetailsInternal)this).TargetIPAddress, global::System.Convert.ToString); + } + if (content.Contains("TargetIPAddressType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicDetailsInternal)this).TargetIPAddressType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.EthernetAddressType?) content.GetValueForProperty("TargetIPAddressType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicDetailsInternal)this).TargetIPAddressType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.EthernetAddressType.CreateFrom); + } + if (content.Contains("TargetSubnetName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicDetailsInternal)this).TargetSubnetName = (string) content.GetValueForProperty("TargetSubnetName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicDetailsInternal)this).TargetSubnetName, global::System.Convert.ToString); + } + if (content.Contains("TestSubnetName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicDetailsInternal)this).TestSubnetName = (string) content.GetValueForProperty("TestSubnetName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicDetailsInternal)this).TestSubnetName, global::System.Convert.ToString); + } + if (content.Contains("TestIPAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicDetailsInternal)this).TestIPAddress = (string) content.GetValueForProperty("TestIPAddress",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicDetailsInternal)this).TestIPAddress, global::System.Convert.ToString); + } + if (content.Contains("TestIPAddressType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicDetailsInternal)this).TestIPAddressType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.EthernetAddressType?) content.GetValueForProperty("TestIPAddressType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicDetailsInternal)this).TestIPAddressType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.EthernetAddressType.CreateFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InMageRcmNicDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("NicId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicDetailsInternal)this).NicId = (string) content.GetValueForProperty("NicId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicDetailsInternal)this).NicId, global::System.Convert.ToString); + } + if (content.Contains("IsPrimaryNic")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicDetailsInternal)this).IsPrimaryNic = (string) content.GetValueForProperty("IsPrimaryNic",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicDetailsInternal)this).IsPrimaryNic, global::System.Convert.ToString); + } + if (content.Contains("IsSelectedForFailover")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicDetailsInternal)this).IsSelectedForFailover = (string) content.GetValueForProperty("IsSelectedForFailover",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicDetailsInternal)this).IsSelectedForFailover, global::System.Convert.ToString); + } + if (content.Contains("SourceIPAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicDetailsInternal)this).SourceIPAddress = (string) content.GetValueForProperty("SourceIPAddress",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicDetailsInternal)this).SourceIPAddress, global::System.Convert.ToString); + } + if (content.Contains("SourceIPAddressType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicDetailsInternal)this).SourceIPAddressType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.EthernetAddressType?) content.GetValueForProperty("SourceIPAddressType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicDetailsInternal)this).SourceIPAddressType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.EthernetAddressType.CreateFrom); + } + if (content.Contains("SourceNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicDetailsInternal)this).SourceNetworkId = (string) content.GetValueForProperty("SourceNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicDetailsInternal)this).SourceNetworkId, global::System.Convert.ToString); + } + if (content.Contains("SourceSubnetName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicDetailsInternal)this).SourceSubnetName = (string) content.GetValueForProperty("SourceSubnetName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicDetailsInternal)this).SourceSubnetName, global::System.Convert.ToString); + } + if (content.Contains("TargetIPAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicDetailsInternal)this).TargetIPAddress = (string) content.GetValueForProperty("TargetIPAddress",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicDetailsInternal)this).TargetIPAddress, global::System.Convert.ToString); + } + if (content.Contains("TargetIPAddressType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicDetailsInternal)this).TargetIPAddressType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.EthernetAddressType?) content.GetValueForProperty("TargetIPAddressType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicDetailsInternal)this).TargetIPAddressType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.EthernetAddressType.CreateFrom); + } + if (content.Contains("TargetSubnetName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicDetailsInternal)this).TargetSubnetName = (string) content.GetValueForProperty("TargetSubnetName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicDetailsInternal)this).TargetSubnetName, global::System.Convert.ToString); + } + if (content.Contains("TestSubnetName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicDetailsInternal)this).TestSubnetName = (string) content.GetValueForProperty("TestSubnetName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicDetailsInternal)this).TestSubnetName, global::System.Convert.ToString); + } + if (content.Contains("TestIPAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicDetailsInternal)this).TestIPAddress = (string) content.GetValueForProperty("TestIPAddress",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicDetailsInternal)this).TestIPAddress, global::System.Convert.ToString); + } + if (content.Contains("TestIPAddressType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicDetailsInternal)this).TestIPAddressType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.EthernetAddressType?) content.GetValueForProperty("TestIPAddressType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicDetailsInternal)this).TestIPAddressType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.EthernetAddressType.CreateFrom); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// InMageRcm NIC details. + [System.ComponentModel.TypeConverter(typeof(InMageRcmNicDetailsTypeConverter))] + public partial interface IInMageRcmNicDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmNicDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmNicDetails.TypeConverter.cs new file mode 100644 index 000000000000..c8ffe5d0a243 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmNicDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InMageRcmNicDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InMageRcmNicDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InMageRcmNicDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InMageRcmNicDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmNicDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmNicDetails.cs new file mode 100644 index 000000000000..2316158d1863 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmNicDetails.cs @@ -0,0 +1,270 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMageRcm NIC details. + public partial class InMageRcmNicDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicDetailsInternal + { + + /// Backing field for property. + private string _isPrimaryNic; + + /// A value indicating whether this is the primary NIC. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string IsPrimaryNic { get => this._isPrimaryNic; set => this._isPrimaryNic = value; } + + /// Backing field for property. + private string _isSelectedForFailover; + + /// A value indicating whether this NIC is selected for failover. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string IsSelectedForFailover { get => this._isSelectedForFailover; set => this._isSelectedForFailover = value; } + + /// Internal Acessors for NicId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicDetailsInternal.NicId { get => this._nicId; set { {_nicId = value;} } } + + /// Internal Acessors for SourceIPAddress + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicDetailsInternal.SourceIPAddress { get => this._sourceIPAddress; set { {_sourceIPAddress = value;} } } + + /// Internal Acessors for SourceIPAddressType + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.EthernetAddressType? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicDetailsInternal.SourceIPAddressType { get => this._sourceIPAddressType; set { {_sourceIPAddressType = value;} } } + + /// Internal Acessors for SourceNetworkId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicDetailsInternal.SourceNetworkId { get => this._sourceNetworkId; set { {_sourceNetworkId = value;} } } + + /// Internal Acessors for SourceSubnetName + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicDetailsInternal.SourceSubnetName { get => this._sourceSubnetName; set { {_sourceSubnetName = value;} } } + + /// Backing field for property. + private string _nicId; + + /// The NIC Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string NicId { get => this._nicId; } + + /// Backing field for property. + private string _sourceIPAddress; + + /// The source IP address. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string SourceIPAddress { get => this._sourceIPAddress; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.EthernetAddressType? _sourceIPAddressType; + + /// The source IP address type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.EthernetAddressType? SourceIPAddressType { get => this._sourceIPAddressType; } + + /// Backing field for property. + private string _sourceNetworkId; + + /// Source network Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string SourceNetworkId { get => this._sourceNetworkId; } + + /// Backing field for property. + private string _sourceSubnetName; + + /// Source subnet name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string SourceSubnetName { get => this._sourceSubnetName; } + + /// Backing field for property. + private string _targetIPAddress; + + /// The target IP address. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetIPAddress { get => this._targetIPAddress; set => this._targetIPAddress = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.EthernetAddressType? _targetIPAddressType; + + /// The target IP address type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.EthernetAddressType? TargetIPAddressType { get => this._targetIPAddressType; set => this._targetIPAddressType = value; } + + /// Backing field for property. + private string _targetSubnetName; + + /// Target subnet name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetSubnetName { get => this._targetSubnetName; set => this._targetSubnetName = value; } + + /// Backing field for property. + private string _testIPAddress; + + /// The test IP address. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TestIPAddress { get => this._testIPAddress; set => this._testIPAddress = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.EthernetAddressType? _testIPAddressType; + + /// The test IP address type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.EthernetAddressType? TestIPAddressType { get => this._testIPAddressType; set => this._testIPAddressType = value; } + + /// Backing field for property. + private string _testSubnetName; + + /// Test subnet name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TestSubnetName { get => this._testSubnetName; set => this._testSubnetName = value; } + + /// Creates an new instance. + public InMageRcmNicDetails() + { + + } + } + /// InMageRcm NIC details. + public partial interface IInMageRcmNicDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// A value indicating whether this is the primary NIC. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether this is the primary NIC.", + SerializedName = @"isPrimaryNic", + PossibleTypes = new [] { typeof(string) })] + string IsPrimaryNic { get; set; } + /// A value indicating whether this NIC is selected for failover. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether this NIC is selected for failover.", + SerializedName = @"isSelectedForFailover", + PossibleTypes = new [] { typeof(string) })] + string IsSelectedForFailover { get; set; } + /// The NIC Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The NIC Id.", + SerializedName = @"nicId", + PossibleTypes = new [] { typeof(string) })] + string NicId { get; } + /// The source IP address. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The source IP address.", + SerializedName = @"sourceIPAddress", + PossibleTypes = new [] { typeof(string) })] + string SourceIPAddress { get; } + /// The source IP address type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The source IP address type.", + SerializedName = @"sourceIPAddressType", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.EthernetAddressType) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.EthernetAddressType? SourceIPAddressType { get; } + /// Source network Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Source network Id.", + SerializedName = @"sourceNetworkId", + PossibleTypes = new [] { typeof(string) })] + string SourceNetworkId { get; } + /// Source subnet name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Source subnet name.", + SerializedName = @"sourceSubnetName", + PossibleTypes = new [] { typeof(string) })] + string SourceSubnetName { get; } + /// The target IP address. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target IP address.", + SerializedName = @"targetIPAddress", + PossibleTypes = new [] { typeof(string) })] + string TargetIPAddress { get; set; } + /// The target IP address type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target IP address type.", + SerializedName = @"targetIPAddressType", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.EthernetAddressType) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.EthernetAddressType? TargetIPAddressType { get; set; } + /// Target subnet name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Target subnet name.", + SerializedName = @"targetSubnetName", + PossibleTypes = new [] { typeof(string) })] + string TargetSubnetName { get; set; } + /// The test IP address. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The test IP address.", + SerializedName = @"testIPAddress", + PossibleTypes = new [] { typeof(string) })] + string TestIPAddress { get; set; } + /// The test IP address type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The test IP address type.", + SerializedName = @"testIPAddressType", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.EthernetAddressType) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.EthernetAddressType? TestIPAddressType { get; set; } + /// Test subnet name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Test subnet name.", + SerializedName = @"testSubnetName", + PossibleTypes = new [] { typeof(string) })] + string TestSubnetName { get; set; } + + } + /// InMageRcm NIC details. + internal partial interface IInMageRcmNicDetailsInternal + + { + /// A value indicating whether this is the primary NIC. + string IsPrimaryNic { get; set; } + /// A value indicating whether this NIC is selected for failover. + string IsSelectedForFailover { get; set; } + /// The NIC Id. + string NicId { get; set; } + /// The source IP address. + string SourceIPAddress { get; set; } + /// The source IP address type. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.EthernetAddressType? SourceIPAddressType { get; set; } + /// Source network Id. + string SourceNetworkId { get; set; } + /// Source subnet name. + string SourceSubnetName { get; set; } + /// The target IP address. + string TargetIPAddress { get; set; } + /// The target IP address type. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.EthernetAddressType? TargetIPAddressType { get; set; } + /// Target subnet name. + string TargetSubnetName { get; set; } + /// The test IP address. + string TestIPAddress { get; set; } + /// The test IP address type. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.EthernetAddressType? TestIPAddressType { get; set; } + /// Test subnet name. + string TestSubnetName { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmNicDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmNicDetails.json.cs new file mode 100644 index 000000000000..5826db137dc0 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmNicDetails.json.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMageRcm NIC details. + public partial class InMageRcmNicDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new InMageRcmNicDetails(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal InMageRcmNicDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_nicId = If( json?.PropertyT("nicId"), out var __jsonNicId) ? (string)__jsonNicId : (string)NicId;} + {_isPrimaryNic = If( json?.PropertyT("isPrimaryNic"), out var __jsonIsPrimaryNic) ? (string)__jsonIsPrimaryNic : (string)IsPrimaryNic;} + {_isSelectedForFailover = If( json?.PropertyT("isSelectedForFailover"), out var __jsonIsSelectedForFailover) ? (string)__jsonIsSelectedForFailover : (string)IsSelectedForFailover;} + {_sourceIPAddress = If( json?.PropertyT("sourceIPAddress"), out var __jsonSourceIPAddress) ? (string)__jsonSourceIPAddress : (string)SourceIPAddress;} + {_sourceIPAddressType = If( json?.PropertyT("sourceIPAddressType"), out var __jsonSourceIPAddressType) ? (string)__jsonSourceIPAddressType : (string)SourceIPAddressType;} + {_sourceNetworkId = If( json?.PropertyT("sourceNetworkId"), out var __jsonSourceNetworkId) ? (string)__jsonSourceNetworkId : (string)SourceNetworkId;} + {_sourceSubnetName = If( json?.PropertyT("sourceSubnetName"), out var __jsonSourceSubnetName) ? (string)__jsonSourceSubnetName : (string)SourceSubnetName;} + {_targetIPAddress = If( json?.PropertyT("targetIPAddress"), out var __jsonTargetIPAddress) ? (string)__jsonTargetIPAddress : (string)TargetIPAddress;} + {_targetIPAddressType = If( json?.PropertyT("targetIPAddressType"), out var __jsonTargetIPAddressType) ? (string)__jsonTargetIPAddressType : (string)TargetIPAddressType;} + {_targetSubnetName = If( json?.PropertyT("targetSubnetName"), out var __jsonTargetSubnetName) ? (string)__jsonTargetSubnetName : (string)TargetSubnetName;} + {_testSubnetName = If( json?.PropertyT("testSubnetName"), out var __jsonTestSubnetName) ? (string)__jsonTestSubnetName : (string)TestSubnetName;} + {_testIPAddress = If( json?.PropertyT("testIPAddress"), out var __jsonTestIPAddress) ? (string)__jsonTestIPAddress : (string)TestIPAddress;} + {_testIPAddressType = If( json?.PropertyT("testIPAddressType"), out var __jsonTestIPAddressType) ? (string)__jsonTestIPAddressType : (string)TestIPAddressType;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._nicId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._nicId.ToString()) : null, "nicId" ,container.Add ); + } + AddIf( null != (((object)this._isPrimaryNic)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._isPrimaryNic.ToString()) : null, "isPrimaryNic" ,container.Add ); + AddIf( null != (((object)this._isSelectedForFailover)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._isSelectedForFailover.ToString()) : null, "isSelectedForFailover" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._sourceIPAddress)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._sourceIPAddress.ToString()) : null, "sourceIPAddress" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._sourceIPAddressType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._sourceIPAddressType.ToString()) : null, "sourceIPAddressType" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._sourceNetworkId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._sourceNetworkId.ToString()) : null, "sourceNetworkId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._sourceSubnetName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._sourceSubnetName.ToString()) : null, "sourceSubnetName" ,container.Add ); + } + AddIf( null != (((object)this._targetIPAddress)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetIPAddress.ToString()) : null, "targetIPAddress" ,container.Add ); + AddIf( null != (((object)this._targetIPAddressType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetIPAddressType.ToString()) : null, "targetIPAddressType" ,container.Add ); + AddIf( null != (((object)this._targetSubnetName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetSubnetName.ToString()) : null, "targetSubnetName" ,container.Add ); + AddIf( null != (((object)this._testSubnetName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._testSubnetName.ToString()) : null, "testSubnetName" ,container.Add ); + AddIf( null != (((object)this._testIPAddress)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._testIPAddress.ToString()) : null, "testIPAddress" ,container.Add ); + AddIf( null != (((object)this._testIPAddressType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._testIPAddressType.ToString()) : null, "testIPAddressType" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmNicInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmNicInput.PowerShell.cs new file mode 100644 index 000000000000..8db42f06b90a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmNicInput.PowerShell.cs @@ -0,0 +1,192 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// InMageRcm NIC input. + [System.ComponentModel.TypeConverter(typeof(InMageRcmNicInputTypeConverter))] + public partial class InMageRcmNicInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InMageRcmNicInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InMageRcmNicInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InMageRcmNicInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("NicId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicInputInternal)this).NicId = (string) content.GetValueForProperty("NicId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicInputInternal)this).NicId, global::System.Convert.ToString); + } + if (content.Contains("IsPrimaryNic")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicInputInternal)this).IsPrimaryNic = (string) content.GetValueForProperty("IsPrimaryNic",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicInputInternal)this).IsPrimaryNic, global::System.Convert.ToString); + } + if (content.Contains("IsSelectedForFailover")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicInputInternal)this).IsSelectedForFailover = (string) content.GetValueForProperty("IsSelectedForFailover",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicInputInternal)this).IsSelectedForFailover, global::System.Convert.ToString); + } + if (content.Contains("TargetSubnetName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicInputInternal)this).TargetSubnetName = (string) content.GetValueForProperty("TargetSubnetName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicInputInternal)this).TargetSubnetName, global::System.Convert.ToString); + } + if (content.Contains("TargetStaticIPAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicInputInternal)this).TargetStaticIPAddress = (string) content.GetValueForProperty("TargetStaticIPAddress",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicInputInternal)this).TargetStaticIPAddress, global::System.Convert.ToString); + } + if (content.Contains("TestSubnetName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicInputInternal)this).TestSubnetName = (string) content.GetValueForProperty("TestSubnetName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicInputInternal)this).TestSubnetName, global::System.Convert.ToString); + } + if (content.Contains("TestStaticIPAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicInputInternal)this).TestStaticIPAddress = (string) content.GetValueForProperty("TestStaticIPAddress",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicInputInternal)this).TestStaticIPAddress, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InMageRcmNicInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("NicId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicInputInternal)this).NicId = (string) content.GetValueForProperty("NicId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicInputInternal)this).NicId, global::System.Convert.ToString); + } + if (content.Contains("IsPrimaryNic")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicInputInternal)this).IsPrimaryNic = (string) content.GetValueForProperty("IsPrimaryNic",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicInputInternal)this).IsPrimaryNic, global::System.Convert.ToString); + } + if (content.Contains("IsSelectedForFailover")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicInputInternal)this).IsSelectedForFailover = (string) content.GetValueForProperty("IsSelectedForFailover",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicInputInternal)this).IsSelectedForFailover, global::System.Convert.ToString); + } + if (content.Contains("TargetSubnetName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicInputInternal)this).TargetSubnetName = (string) content.GetValueForProperty("TargetSubnetName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicInputInternal)this).TargetSubnetName, global::System.Convert.ToString); + } + if (content.Contains("TargetStaticIPAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicInputInternal)this).TargetStaticIPAddress = (string) content.GetValueForProperty("TargetStaticIPAddress",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicInputInternal)this).TargetStaticIPAddress, global::System.Convert.ToString); + } + if (content.Contains("TestSubnetName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicInputInternal)this).TestSubnetName = (string) content.GetValueForProperty("TestSubnetName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicInputInternal)this).TestSubnetName, global::System.Convert.ToString); + } + if (content.Contains("TestStaticIPAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicInputInternal)this).TestStaticIPAddress = (string) content.GetValueForProperty("TestStaticIPAddress",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicInputInternal)this).TestStaticIPAddress, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// InMageRcm NIC input. + [System.ComponentModel.TypeConverter(typeof(InMageRcmNicInputTypeConverter))] + public partial interface IInMageRcmNicInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmNicInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmNicInput.TypeConverter.cs new file mode 100644 index 000000000000..d935c7d12799 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmNicInput.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InMageRcmNicInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InMageRcmNicInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InMageRcmNicInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InMageRcmNicInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmNicInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmNicInput.cs new file mode 100644 index 000000000000..3a2a4496ef63 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmNicInput.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMageRcm NIC input. + public partial class InMageRcmNicInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicInputInternal + { + + /// Backing field for property. + private string _isPrimaryNic; + + /// A value indicating whether this is the primary NIC. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string IsPrimaryNic { get => this._isPrimaryNic; set => this._isPrimaryNic = value; } + + /// Backing field for property. + private string _isSelectedForFailover; + + /// A value indicating whether this NIC is selected for failover. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string IsSelectedForFailover { get => this._isSelectedForFailover; set => this._isSelectedForFailover = value; } + + /// Backing field for property. + private string _nicId; + + /// The NIC Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string NicId { get => this._nicId; set => this._nicId = value; } + + /// Backing field for property. + private string _targetStaticIPAddress; + + /// The target static IP address. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetStaticIPAddress { get => this._targetStaticIPAddress; set => this._targetStaticIPAddress = value; } + + /// Backing field for property. + private string _targetSubnetName; + + /// Target subnet name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetSubnetName { get => this._targetSubnetName; set => this._targetSubnetName = value; } + + /// Backing field for property. + private string _testStaticIPAddress; + + /// The test static IP address. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TestStaticIPAddress { get => this._testStaticIPAddress; set => this._testStaticIPAddress = value; } + + /// Backing field for property. + private string _testSubnetName; + + /// The test subnet name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TestSubnetName { get => this._testSubnetName; set => this._testSubnetName = value; } + + /// Creates an new instance. + public InMageRcmNicInput() + { + + } + } + /// InMageRcm NIC input. + public partial interface IInMageRcmNicInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// A value indicating whether this is the primary NIC. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"A value indicating whether this is the primary NIC.", + SerializedName = @"isPrimaryNic", + PossibleTypes = new [] { typeof(string) })] + string IsPrimaryNic { get; set; } + /// A value indicating whether this NIC is selected for failover. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether this NIC is selected for failover.", + SerializedName = @"isSelectedForFailover", + PossibleTypes = new [] { typeof(string) })] + string IsSelectedForFailover { get; set; } + /// The NIC Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The NIC Id.", + SerializedName = @"nicId", + PossibleTypes = new [] { typeof(string) })] + string NicId { get; set; } + /// The target static IP address. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target static IP address.", + SerializedName = @"targetStaticIPAddress", + PossibleTypes = new [] { typeof(string) })] + string TargetStaticIPAddress { get; set; } + /// Target subnet name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Target subnet name.", + SerializedName = @"targetSubnetName", + PossibleTypes = new [] { typeof(string) })] + string TargetSubnetName { get; set; } + /// The test static IP address. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The test static IP address.", + SerializedName = @"testStaticIPAddress", + PossibleTypes = new [] { typeof(string) })] + string TestStaticIPAddress { get; set; } + /// The test subnet name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The test subnet name.", + SerializedName = @"testSubnetName", + PossibleTypes = new [] { typeof(string) })] + string TestSubnetName { get; set; } + + } + /// InMageRcm NIC input. + internal partial interface IInMageRcmNicInputInternal + + { + /// A value indicating whether this is the primary NIC. + string IsPrimaryNic { get; set; } + /// A value indicating whether this NIC is selected for failover. + string IsSelectedForFailover { get; set; } + /// The NIC Id. + string NicId { get; set; } + /// The target static IP address. + string TargetStaticIPAddress { get; set; } + /// Target subnet name. + string TargetSubnetName { get; set; } + /// The test static IP address. + string TestStaticIPAddress { get; set; } + /// The test subnet name. + string TestSubnetName { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmNicInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmNicInput.json.cs new file mode 100644 index 000000000000..4fabd9465316 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmNicInput.json.cs @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMageRcm NIC input. + public partial class InMageRcmNicInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new InMageRcmNicInput(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal InMageRcmNicInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_nicId = If( json?.PropertyT("nicId"), out var __jsonNicId) ? (string)__jsonNicId : (string)NicId;} + {_isPrimaryNic = If( json?.PropertyT("isPrimaryNic"), out var __jsonIsPrimaryNic) ? (string)__jsonIsPrimaryNic : (string)IsPrimaryNic;} + {_isSelectedForFailover = If( json?.PropertyT("isSelectedForFailover"), out var __jsonIsSelectedForFailover) ? (string)__jsonIsSelectedForFailover : (string)IsSelectedForFailover;} + {_targetSubnetName = If( json?.PropertyT("targetSubnetName"), out var __jsonTargetSubnetName) ? (string)__jsonTargetSubnetName : (string)TargetSubnetName;} + {_targetStaticIPAddress = If( json?.PropertyT("targetStaticIPAddress"), out var __jsonTargetStaticIPAddress) ? (string)__jsonTargetStaticIPAddress : (string)TargetStaticIPAddress;} + {_testSubnetName = If( json?.PropertyT("testSubnetName"), out var __jsonTestSubnetName) ? (string)__jsonTestSubnetName : (string)TestSubnetName;} + {_testStaticIPAddress = If( json?.PropertyT("testStaticIPAddress"), out var __jsonTestStaticIPAddress) ? (string)__jsonTestStaticIPAddress : (string)TestStaticIPAddress;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._nicId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._nicId.ToString()) : null, "nicId" ,container.Add ); + AddIf( null != (((object)this._isPrimaryNic)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._isPrimaryNic.ToString()) : null, "isPrimaryNic" ,container.Add ); + AddIf( null != (((object)this._isSelectedForFailover)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._isSelectedForFailover.ToString()) : null, "isSelectedForFailover" ,container.Add ); + AddIf( null != (((object)this._targetSubnetName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetSubnetName.ToString()) : null, "targetSubnetName" ,container.Add ); + AddIf( null != (((object)this._targetStaticIPAddress)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetStaticIPAddress.ToString()) : null, "targetStaticIPAddress" ,container.Add ); + AddIf( null != (((object)this._testSubnetName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._testSubnetName.ToString()) : null, "testSubnetName" ,container.Add ); + AddIf( null != (((object)this._testStaticIPAddress)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._testStaticIPAddress.ToString()) : null, "testStaticIPAddress" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmPolicyCreationInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmPolicyCreationInput.PowerShell.cs new file mode 100644 index 000000000000..cc7c7234daf1 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmPolicyCreationInput.PowerShell.cs @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// InMageRcm policy creation input. + [System.ComponentModel.TypeConverter(typeof(InMageRcmPolicyCreationInputTypeConverter))] + public partial class InMageRcmPolicyCreationInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmPolicyCreationInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InMageRcmPolicyCreationInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmPolicyCreationInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InMageRcmPolicyCreationInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmPolicyCreationInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InMageRcmPolicyCreationInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("RecoveryPointHistoryInMinute")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmPolicyCreationInputInternal)this).RecoveryPointHistoryInMinute = (int?) content.GetValueForProperty("RecoveryPointHistoryInMinute",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmPolicyCreationInputInternal)this).RecoveryPointHistoryInMinute, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("CrashConsistentFrequencyInMinute")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmPolicyCreationInputInternal)this).CrashConsistentFrequencyInMinute = (int?) content.GetValueForProperty("CrashConsistentFrequencyInMinute",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmPolicyCreationInputInternal)this).CrashConsistentFrequencyInMinute, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("AppConsistentFrequencyInMinute")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmPolicyCreationInputInternal)this).AppConsistentFrequencyInMinute = (int?) content.GetValueForProperty("AppConsistentFrequencyInMinute",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmPolicyCreationInputInternal)this).AppConsistentFrequencyInMinute, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("EnableMultiVMSync")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmPolicyCreationInputInternal)this).EnableMultiVMSync = (string) content.GetValueForProperty("EnableMultiVMSync",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmPolicyCreationInputInternal)this).EnableMultiVMSync, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InMageRcmPolicyCreationInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("RecoveryPointHistoryInMinute")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmPolicyCreationInputInternal)this).RecoveryPointHistoryInMinute = (int?) content.GetValueForProperty("RecoveryPointHistoryInMinute",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmPolicyCreationInputInternal)this).RecoveryPointHistoryInMinute, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("CrashConsistentFrequencyInMinute")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmPolicyCreationInputInternal)this).CrashConsistentFrequencyInMinute = (int?) content.GetValueForProperty("CrashConsistentFrequencyInMinute",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmPolicyCreationInputInternal)this).CrashConsistentFrequencyInMinute, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("AppConsistentFrequencyInMinute")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmPolicyCreationInputInternal)this).AppConsistentFrequencyInMinute = (int?) content.GetValueForProperty("AppConsistentFrequencyInMinute",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmPolicyCreationInputInternal)this).AppConsistentFrequencyInMinute, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("EnableMultiVMSync")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmPolicyCreationInputInternal)this).EnableMultiVMSync = (string) content.GetValueForProperty("EnableMultiVMSync",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmPolicyCreationInputInternal)this).EnableMultiVMSync, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// InMageRcm policy creation input. + [System.ComponentModel.TypeConverter(typeof(InMageRcmPolicyCreationInputTypeConverter))] + public partial interface IInMageRcmPolicyCreationInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmPolicyCreationInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmPolicyCreationInput.TypeConverter.cs new file mode 100644 index 000000000000..9df094b7f90c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmPolicyCreationInput.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InMageRcmPolicyCreationInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmPolicyCreationInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmPolicyCreationInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InMageRcmPolicyCreationInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InMageRcmPolicyCreationInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InMageRcmPolicyCreationInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmPolicyCreationInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmPolicyCreationInput.cs new file mode 100644 index 000000000000..5438431936af --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmPolicyCreationInput.cs @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMageRcm policy creation input. + public partial class InMageRcmPolicyCreationInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmPolicyCreationInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmPolicyCreationInputInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInput __policyProviderSpecificInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PolicyProviderSpecificInput(); + + /// Backing field for property. + private int? _appConsistentFrequencyInMinute; + + /// The app consistent snapshot frequency (in minutes). + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? AppConsistentFrequencyInMinute { get => this._appConsistentFrequencyInMinute; set => this._appConsistentFrequencyInMinute = value; } + + /// Backing field for property. + private int? _crashConsistentFrequencyInMinute; + + /// The crash consistent snapshot frequency (in minutes). + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? CrashConsistentFrequencyInMinute { get => this._crashConsistentFrequencyInMinute; set => this._crashConsistentFrequencyInMinute = value; } + + /// Backing field for property. + private string _enableMultiVMSync; + + /// A value indicating whether multi-VM sync has to be enabled. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string EnableMultiVMSync { get => this._enableMultiVMSync; set => this._enableMultiVMSync = value; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInputInternal)__policyProviderSpecificInput).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInputInternal)__policyProviderSpecificInput).InstanceType = value ; } + + /// Backing field for property. + private int? _recoveryPointHistoryInMinute; + + /// The duration in minutes until which the recovery points need to be stored. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? RecoveryPointHistoryInMinute { get => this._recoveryPointHistoryInMinute; set => this._recoveryPointHistoryInMinute = value; } + + /// Creates an new instance. + public InMageRcmPolicyCreationInput() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__policyProviderSpecificInput), __policyProviderSpecificInput); + await eventListener.AssertObjectIsValid(nameof(__policyProviderSpecificInput), __policyProviderSpecificInput); + } + } + /// InMageRcm policy creation input. + public partial interface IInMageRcmPolicyCreationInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInput + { + /// The app consistent snapshot frequency (in minutes). + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The app consistent snapshot frequency (in minutes).", + SerializedName = @"appConsistentFrequencyInMinutes", + PossibleTypes = new [] { typeof(int) })] + int? AppConsistentFrequencyInMinute { get; set; } + /// The crash consistent snapshot frequency (in minutes). + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The crash consistent snapshot frequency (in minutes).", + SerializedName = @"crashConsistentFrequencyInMinutes", + PossibleTypes = new [] { typeof(int) })] + int? CrashConsistentFrequencyInMinute { get; set; } + /// A value indicating whether multi-VM sync has to be enabled. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether multi-VM sync has to be enabled.", + SerializedName = @"enableMultiVmSync", + PossibleTypes = new [] { typeof(string) })] + string EnableMultiVMSync { get; set; } + /// The duration in minutes until which the recovery points need to be stored. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The duration in minutes until which the recovery points need to be stored.", + SerializedName = @"recoveryPointHistoryInMinutes", + PossibleTypes = new [] { typeof(int) })] + int? RecoveryPointHistoryInMinute { get; set; } + + } + /// InMageRcm policy creation input. + internal partial interface IInMageRcmPolicyCreationInputInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInputInternal + { + /// The app consistent snapshot frequency (in minutes). + int? AppConsistentFrequencyInMinute { get; set; } + /// The crash consistent snapshot frequency (in minutes). + int? CrashConsistentFrequencyInMinute { get; set; } + /// A value indicating whether multi-VM sync has to be enabled. + string EnableMultiVMSync { get; set; } + /// The duration in minutes until which the recovery points need to be stored. + int? RecoveryPointHistoryInMinute { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmPolicyCreationInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmPolicyCreationInput.json.cs new file mode 100644 index 000000000000..60d806f8e027 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmPolicyCreationInput.json.cs @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMageRcm policy creation input. + public partial class InMageRcmPolicyCreationInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmPolicyCreationInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmPolicyCreationInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmPolicyCreationInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new InMageRcmPolicyCreationInput(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal InMageRcmPolicyCreationInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __policyProviderSpecificInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PolicyProviderSpecificInput(json); + {_recoveryPointHistoryInMinute = If( json?.PropertyT("recoveryPointHistoryInMinutes"), out var __jsonRecoveryPointHistoryInMinutes) ? (int?)__jsonRecoveryPointHistoryInMinutes : RecoveryPointHistoryInMinute;} + {_crashConsistentFrequencyInMinute = If( json?.PropertyT("crashConsistentFrequencyInMinutes"), out var __jsonCrashConsistentFrequencyInMinutes) ? (int?)__jsonCrashConsistentFrequencyInMinutes : CrashConsistentFrequencyInMinute;} + {_appConsistentFrequencyInMinute = If( json?.PropertyT("appConsistentFrequencyInMinutes"), out var __jsonAppConsistentFrequencyInMinutes) ? (int?)__jsonAppConsistentFrequencyInMinutes : AppConsistentFrequencyInMinute;} + {_enableMultiVMSync = If( json?.PropertyT("enableMultiVmSync"), out var __jsonEnableMultiVMSync) ? (string)__jsonEnableMultiVMSync : (string)EnableMultiVMSync;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __policyProviderSpecificInput?.ToJson(container, serializationMode); + AddIf( null != this._recoveryPointHistoryInMinute ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._recoveryPointHistoryInMinute) : null, "recoveryPointHistoryInMinutes" ,container.Add ); + AddIf( null != this._crashConsistentFrequencyInMinute ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._crashConsistentFrequencyInMinute) : null, "crashConsistentFrequencyInMinutes" ,container.Add ); + AddIf( null != this._appConsistentFrequencyInMinute ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._appConsistentFrequencyInMinute) : null, "appConsistentFrequencyInMinutes" ,container.Add ); + AddIf( null != (((object)this._enableMultiVMSync)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._enableMultiVMSync.ToString()) : null, "enableMultiVmSync" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmPolicyDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmPolicyDetails.PowerShell.cs new file mode 100644 index 000000000000..41215c4e03fc --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmPolicyDetails.PowerShell.cs @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// InMageRcm specific policy details. + [System.ComponentModel.TypeConverter(typeof(InMageRcmPolicyDetailsTypeConverter))] + public partial class InMageRcmPolicyDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmPolicyDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InMageRcmPolicyDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmPolicyDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InMageRcmPolicyDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmPolicyDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InMageRcmPolicyDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("RecoveryPointHistoryInMinute")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmPolicyDetailsInternal)this).RecoveryPointHistoryInMinute = (int?) content.GetValueForProperty("RecoveryPointHistoryInMinute",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmPolicyDetailsInternal)this).RecoveryPointHistoryInMinute, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("AppConsistentFrequencyInMinute")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmPolicyDetailsInternal)this).AppConsistentFrequencyInMinute = (int?) content.GetValueForProperty("AppConsistentFrequencyInMinute",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmPolicyDetailsInternal)this).AppConsistentFrequencyInMinute, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("CrashConsistentFrequencyInMinute")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmPolicyDetailsInternal)this).CrashConsistentFrequencyInMinute = (int?) content.GetValueForProperty("CrashConsistentFrequencyInMinute",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmPolicyDetailsInternal)this).CrashConsistentFrequencyInMinute, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("EnableMultiVMSync")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmPolicyDetailsInternal)this).EnableMultiVMSync = (string) content.GetValueForProperty("EnableMultiVMSync",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmPolicyDetailsInternal)this).EnableMultiVMSync, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InMageRcmPolicyDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("RecoveryPointHistoryInMinute")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmPolicyDetailsInternal)this).RecoveryPointHistoryInMinute = (int?) content.GetValueForProperty("RecoveryPointHistoryInMinute",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmPolicyDetailsInternal)this).RecoveryPointHistoryInMinute, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("AppConsistentFrequencyInMinute")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmPolicyDetailsInternal)this).AppConsistentFrequencyInMinute = (int?) content.GetValueForProperty("AppConsistentFrequencyInMinute",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmPolicyDetailsInternal)this).AppConsistentFrequencyInMinute, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("CrashConsistentFrequencyInMinute")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmPolicyDetailsInternal)this).CrashConsistentFrequencyInMinute = (int?) content.GetValueForProperty("CrashConsistentFrequencyInMinute",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmPolicyDetailsInternal)this).CrashConsistentFrequencyInMinute, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("EnableMultiVMSync")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmPolicyDetailsInternal)this).EnableMultiVMSync = (string) content.GetValueForProperty("EnableMultiVMSync",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmPolicyDetailsInternal)this).EnableMultiVMSync, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// InMageRcm specific policy details. + [System.ComponentModel.TypeConverter(typeof(InMageRcmPolicyDetailsTypeConverter))] + public partial interface IInMageRcmPolicyDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmPolicyDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmPolicyDetails.TypeConverter.cs new file mode 100644 index 000000000000..a1871d8ef99d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmPolicyDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InMageRcmPolicyDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmPolicyDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmPolicyDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InMageRcmPolicyDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InMageRcmPolicyDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InMageRcmPolicyDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmPolicyDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmPolicyDetails.cs new file mode 100644 index 000000000000..9be176b13665 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmPolicyDetails.cs @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMageRcm specific policy details. + public partial class InMageRcmPolicyDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmPolicyDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmPolicyDetailsInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetails __policyProviderSpecificDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PolicyProviderSpecificDetails(); + + /// Backing field for property. + private int? _appConsistentFrequencyInMinute; + + /// The app consistent snapshot frequency in minutes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? AppConsistentFrequencyInMinute { get => this._appConsistentFrequencyInMinute; set => this._appConsistentFrequencyInMinute = value; } + + /// Backing field for property. + private int? _crashConsistentFrequencyInMinute; + + /// The crash consistent snapshot frequency in minutes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? CrashConsistentFrequencyInMinute { get => this._crashConsistentFrequencyInMinute; set => this._crashConsistentFrequencyInMinute = value; } + + /// Backing field for property. + private string _enableMultiVMSync; + + /// A value indicating whether multi-VM sync has to be enabled. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string EnableMultiVMSync { get => this._enableMultiVMSync; set => this._enableMultiVMSync = value; } + + /// Gets the class type. Overridden in derived classes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetailsInternal)__policyProviderSpecificDetails).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetailsInternal)__policyProviderSpecificDetails).InstanceType = value ; } + + /// Backing field for property. + private int? _recoveryPointHistoryInMinute; + + /// The duration in minutes until which the recovery points need to be stored. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? RecoveryPointHistoryInMinute { get => this._recoveryPointHistoryInMinute; set => this._recoveryPointHistoryInMinute = value; } + + /// Creates an new instance. + public InMageRcmPolicyDetails() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__policyProviderSpecificDetails), __policyProviderSpecificDetails); + await eventListener.AssertObjectIsValid(nameof(__policyProviderSpecificDetails), __policyProviderSpecificDetails); + } + } + /// InMageRcm specific policy details. + public partial interface IInMageRcmPolicyDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetails + { + /// The app consistent snapshot frequency in minutes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The app consistent snapshot frequency in minutes.", + SerializedName = @"appConsistentFrequencyInMinutes", + PossibleTypes = new [] { typeof(int) })] + int? AppConsistentFrequencyInMinute { get; set; } + /// The crash consistent snapshot frequency in minutes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The crash consistent snapshot frequency in minutes.", + SerializedName = @"crashConsistentFrequencyInMinutes", + PossibleTypes = new [] { typeof(int) })] + int? CrashConsistentFrequencyInMinute { get; set; } + /// A value indicating whether multi-VM sync has to be enabled. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether multi-VM sync has to be enabled.", + SerializedName = @"enableMultiVmSync", + PossibleTypes = new [] { typeof(string) })] + string EnableMultiVMSync { get; set; } + /// The duration in minutes until which the recovery points need to be stored. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The duration in minutes until which the recovery points need to be stored.", + SerializedName = @"recoveryPointHistoryInMinutes", + PossibleTypes = new [] { typeof(int) })] + int? RecoveryPointHistoryInMinute { get; set; } + + } + /// InMageRcm specific policy details. + internal partial interface IInMageRcmPolicyDetailsInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetailsInternal + { + /// The app consistent snapshot frequency in minutes. + int? AppConsistentFrequencyInMinute { get; set; } + /// The crash consistent snapshot frequency in minutes. + int? CrashConsistentFrequencyInMinute { get; set; } + /// A value indicating whether multi-VM sync has to be enabled. + string EnableMultiVMSync { get; set; } + /// The duration in minutes until which the recovery points need to be stored. + int? RecoveryPointHistoryInMinute { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmPolicyDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmPolicyDetails.json.cs new file mode 100644 index 000000000000..4a3b2e87d141 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmPolicyDetails.json.cs @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMageRcm specific policy details. + public partial class InMageRcmPolicyDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmPolicyDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmPolicyDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmPolicyDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new InMageRcmPolicyDetails(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal InMageRcmPolicyDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __policyProviderSpecificDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PolicyProviderSpecificDetails(json); + {_recoveryPointHistoryInMinute = If( json?.PropertyT("recoveryPointHistoryInMinutes"), out var __jsonRecoveryPointHistoryInMinutes) ? (int?)__jsonRecoveryPointHistoryInMinutes : RecoveryPointHistoryInMinute;} + {_appConsistentFrequencyInMinute = If( json?.PropertyT("appConsistentFrequencyInMinutes"), out var __jsonAppConsistentFrequencyInMinutes) ? (int?)__jsonAppConsistentFrequencyInMinutes : AppConsistentFrequencyInMinute;} + {_crashConsistentFrequencyInMinute = If( json?.PropertyT("crashConsistentFrequencyInMinutes"), out var __jsonCrashConsistentFrequencyInMinutes) ? (int?)__jsonCrashConsistentFrequencyInMinutes : CrashConsistentFrequencyInMinute;} + {_enableMultiVMSync = If( json?.PropertyT("enableMultiVmSync"), out var __jsonEnableMultiVMSync) ? (string)__jsonEnableMultiVMSync : (string)EnableMultiVMSync;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __policyProviderSpecificDetails?.ToJson(container, serializationMode); + AddIf( null != this._recoveryPointHistoryInMinute ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._recoveryPointHistoryInMinute) : null, "recoveryPointHistoryInMinutes" ,container.Add ); + AddIf( null != this._appConsistentFrequencyInMinute ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._appConsistentFrequencyInMinute) : null, "appConsistentFrequencyInMinutes" ,container.Add ); + AddIf( null != this._crashConsistentFrequencyInMinute ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._crashConsistentFrequencyInMinute) : null, "crashConsistentFrequencyInMinutes" ,container.Add ); + AddIf( null != (((object)this._enableMultiVMSync)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._enableMultiVMSync.ToString()) : null, "enableMultiVmSync" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmProtectedDiskDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmProtectedDiskDetails.PowerShell.cs new file mode 100644 index 000000000000..7a785cab78e8 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmProtectedDiskDetails.PowerShell.cs @@ -0,0 +1,386 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// InMageRcm protected disk details. + [System.ComponentModel.TypeConverter(typeof(InMageRcmProtectedDiskDetailsTypeConverter))] + public partial class InMageRcmProtectedDiskDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InMageRcmProtectedDiskDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InMageRcmProtectedDiskDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InMageRcmProtectedDiskDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("IrDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).IrDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetails) content.GetValueForProperty("IrDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).IrDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmSyncDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("ResyncDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).ResyncDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetails) content.GetValueForProperty("ResyncDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).ResyncDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmSyncDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("DiskId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).DiskId = (string) content.GetValueForProperty("DiskId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).DiskId, global::System.Convert.ToString); + } + if (content.Contains("DiskName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).DiskName = (string) content.GetValueForProperty("DiskName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).DiskName, global::System.Convert.ToString); + } + if (content.Contains("IsOSDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).IsOSDisk = (string) content.GetValueForProperty("IsOSDisk",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).IsOSDisk, global::System.Convert.ToString); + } + if (content.Contains("CapacityInByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).CapacityInByte = (long?) content.GetValueForProperty("CapacityInByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).CapacityInByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("LogStorageAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).LogStorageAccountId = (string) content.GetValueForProperty("LogStorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).LogStorageAccountId, global::System.Convert.ToString); + } + if (content.Contains("DiskEncryptionSetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).DiskEncryptionSetId = (string) content.GetValueForProperty("DiskEncryptionSetId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).DiskEncryptionSetId, global::System.Convert.ToString); + } + if (content.Contains("SeedManagedDiskId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).SeedManagedDiskId = (string) content.GetValueForProperty("SeedManagedDiskId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).SeedManagedDiskId, global::System.Convert.ToString); + } + if (content.Contains("SeedBlobUri")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).SeedBlobUri = (string) content.GetValueForProperty("SeedBlobUri",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).SeedBlobUri, global::System.Convert.ToString); + } + if (content.Contains("TargetManagedDiskId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).TargetManagedDiskId = (string) content.GetValueForProperty("TargetManagedDiskId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).TargetManagedDiskId, global::System.Convert.ToString); + } + if (content.Contains("DiskType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).DiskType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskAccountType?) content.GetValueForProperty("DiskType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).DiskType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskAccountType.CreateFrom); + } + if (content.Contains("DataPendingInLogDataStoreInMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).DataPendingInLogDataStoreInMb = (double?) content.GetValueForProperty("DataPendingInLogDataStoreInMb",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).DataPendingInLogDataStoreInMb, (__y)=> (double) global::System.Convert.ChangeType(__y, typeof(double))); + } + if (content.Contains("DataPendingAtSourceAgentInMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).DataPendingAtSourceAgentInMb = (double?) content.GetValueForProperty("DataPendingAtSourceAgentInMb",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).DataPendingAtSourceAgentInMb, (__y)=> (double) global::System.Convert.ChangeType(__y, typeof(double))); + } + if (content.Contains("IsInitialReplicationComplete")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).IsInitialReplicationComplete = (string) content.GetValueForProperty("IsInitialReplicationComplete",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).IsInitialReplicationComplete, global::System.Convert.ToString); + } + if (content.Contains("IrDetailProgressHealth")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).IrDetailProgressHealth = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskReplicationProgressHealth?) content.GetValueForProperty("IrDetailProgressHealth",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).IrDetailProgressHealth, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskReplicationProgressHealth.CreateFrom); + } + if (content.Contains("IrDetailTransferredByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).IrDetailTransferredByte = (long?) content.GetValueForProperty("IrDetailTransferredByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).IrDetailTransferredByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("IrDetailLast15MinutesTransferredByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).IrDetailLast15MinutesTransferredByte = (long?) content.GetValueForProperty("IrDetailLast15MinutesTransferredByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).IrDetailLast15MinutesTransferredByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("IrDetailLastDataTransferTimeUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).IrDetailLastDataTransferTimeUtc = (string) content.GetValueForProperty("IrDetailLastDataTransferTimeUtc",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).IrDetailLastDataTransferTimeUtc, global::System.Convert.ToString); + } + if (content.Contains("IrDetailProcessedByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).IrDetailProcessedByte = (long?) content.GetValueForProperty("IrDetailProcessedByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).IrDetailProcessedByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("IrDetailStartTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).IrDetailStartTime = (string) content.GetValueForProperty("IrDetailStartTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).IrDetailStartTime, global::System.Convert.ToString); + } + if (content.Contains("IrDetailLastRefreshTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).IrDetailLastRefreshTime = (string) content.GetValueForProperty("IrDetailLastRefreshTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).IrDetailLastRefreshTime, global::System.Convert.ToString); + } + if (content.Contains("IrDetailProgressPercentage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).IrDetailProgressPercentage = (int?) content.GetValueForProperty("IrDetailProgressPercentage",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).IrDetailProgressPercentage, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("ResyncDetailProgressHealth")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).ResyncDetailProgressHealth = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskReplicationProgressHealth?) content.GetValueForProperty("ResyncDetailProgressHealth",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).ResyncDetailProgressHealth, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskReplicationProgressHealth.CreateFrom); + } + if (content.Contains("ResyncDetailTransferredByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).ResyncDetailTransferredByte = (long?) content.GetValueForProperty("ResyncDetailTransferredByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).ResyncDetailTransferredByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("ResyncDetailLast15MinutesTransferredByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).ResyncDetailLast15MinutesTransferredByte = (long?) content.GetValueForProperty("ResyncDetailLast15MinutesTransferredByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).ResyncDetailLast15MinutesTransferredByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("ResyncDetailLastDataTransferTimeUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).ResyncDetailLastDataTransferTimeUtc = (string) content.GetValueForProperty("ResyncDetailLastDataTransferTimeUtc",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).ResyncDetailLastDataTransferTimeUtc, global::System.Convert.ToString); + } + if (content.Contains("ResyncDetailProcessedByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).ResyncDetailProcessedByte = (long?) content.GetValueForProperty("ResyncDetailProcessedByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).ResyncDetailProcessedByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("ResyncDetailStartTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).ResyncDetailStartTime = (string) content.GetValueForProperty("ResyncDetailStartTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).ResyncDetailStartTime, global::System.Convert.ToString); + } + if (content.Contains("ResyncDetailLastRefreshTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).ResyncDetailLastRefreshTime = (string) content.GetValueForProperty("ResyncDetailLastRefreshTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).ResyncDetailLastRefreshTime, global::System.Convert.ToString); + } + if (content.Contains("ResyncDetailProgressPercentage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).ResyncDetailProgressPercentage = (int?) content.GetValueForProperty("ResyncDetailProgressPercentage",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).ResyncDetailProgressPercentage, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InMageRcmProtectedDiskDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("IrDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).IrDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetails) content.GetValueForProperty("IrDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).IrDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmSyncDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("ResyncDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).ResyncDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetails) content.GetValueForProperty("ResyncDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).ResyncDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmSyncDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("DiskId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).DiskId = (string) content.GetValueForProperty("DiskId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).DiskId, global::System.Convert.ToString); + } + if (content.Contains("DiskName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).DiskName = (string) content.GetValueForProperty("DiskName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).DiskName, global::System.Convert.ToString); + } + if (content.Contains("IsOSDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).IsOSDisk = (string) content.GetValueForProperty("IsOSDisk",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).IsOSDisk, global::System.Convert.ToString); + } + if (content.Contains("CapacityInByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).CapacityInByte = (long?) content.GetValueForProperty("CapacityInByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).CapacityInByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("LogStorageAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).LogStorageAccountId = (string) content.GetValueForProperty("LogStorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).LogStorageAccountId, global::System.Convert.ToString); + } + if (content.Contains("DiskEncryptionSetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).DiskEncryptionSetId = (string) content.GetValueForProperty("DiskEncryptionSetId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).DiskEncryptionSetId, global::System.Convert.ToString); + } + if (content.Contains("SeedManagedDiskId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).SeedManagedDiskId = (string) content.GetValueForProperty("SeedManagedDiskId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).SeedManagedDiskId, global::System.Convert.ToString); + } + if (content.Contains("SeedBlobUri")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).SeedBlobUri = (string) content.GetValueForProperty("SeedBlobUri",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).SeedBlobUri, global::System.Convert.ToString); + } + if (content.Contains("TargetManagedDiskId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).TargetManagedDiskId = (string) content.GetValueForProperty("TargetManagedDiskId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).TargetManagedDiskId, global::System.Convert.ToString); + } + if (content.Contains("DiskType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).DiskType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskAccountType?) content.GetValueForProperty("DiskType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).DiskType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskAccountType.CreateFrom); + } + if (content.Contains("DataPendingInLogDataStoreInMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).DataPendingInLogDataStoreInMb = (double?) content.GetValueForProperty("DataPendingInLogDataStoreInMb",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).DataPendingInLogDataStoreInMb, (__y)=> (double) global::System.Convert.ChangeType(__y, typeof(double))); + } + if (content.Contains("DataPendingAtSourceAgentInMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).DataPendingAtSourceAgentInMb = (double?) content.GetValueForProperty("DataPendingAtSourceAgentInMb",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).DataPendingAtSourceAgentInMb, (__y)=> (double) global::System.Convert.ChangeType(__y, typeof(double))); + } + if (content.Contains("IsInitialReplicationComplete")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).IsInitialReplicationComplete = (string) content.GetValueForProperty("IsInitialReplicationComplete",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).IsInitialReplicationComplete, global::System.Convert.ToString); + } + if (content.Contains("IrDetailProgressHealth")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).IrDetailProgressHealth = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskReplicationProgressHealth?) content.GetValueForProperty("IrDetailProgressHealth",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).IrDetailProgressHealth, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskReplicationProgressHealth.CreateFrom); + } + if (content.Contains("IrDetailTransferredByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).IrDetailTransferredByte = (long?) content.GetValueForProperty("IrDetailTransferredByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).IrDetailTransferredByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("IrDetailLast15MinutesTransferredByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).IrDetailLast15MinutesTransferredByte = (long?) content.GetValueForProperty("IrDetailLast15MinutesTransferredByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).IrDetailLast15MinutesTransferredByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("IrDetailLastDataTransferTimeUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).IrDetailLastDataTransferTimeUtc = (string) content.GetValueForProperty("IrDetailLastDataTransferTimeUtc",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).IrDetailLastDataTransferTimeUtc, global::System.Convert.ToString); + } + if (content.Contains("IrDetailProcessedByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).IrDetailProcessedByte = (long?) content.GetValueForProperty("IrDetailProcessedByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).IrDetailProcessedByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("IrDetailStartTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).IrDetailStartTime = (string) content.GetValueForProperty("IrDetailStartTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).IrDetailStartTime, global::System.Convert.ToString); + } + if (content.Contains("IrDetailLastRefreshTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).IrDetailLastRefreshTime = (string) content.GetValueForProperty("IrDetailLastRefreshTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).IrDetailLastRefreshTime, global::System.Convert.ToString); + } + if (content.Contains("IrDetailProgressPercentage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).IrDetailProgressPercentage = (int?) content.GetValueForProperty("IrDetailProgressPercentage",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).IrDetailProgressPercentage, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("ResyncDetailProgressHealth")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).ResyncDetailProgressHealth = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskReplicationProgressHealth?) content.GetValueForProperty("ResyncDetailProgressHealth",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).ResyncDetailProgressHealth, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskReplicationProgressHealth.CreateFrom); + } + if (content.Contains("ResyncDetailTransferredByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).ResyncDetailTransferredByte = (long?) content.GetValueForProperty("ResyncDetailTransferredByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).ResyncDetailTransferredByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("ResyncDetailLast15MinutesTransferredByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).ResyncDetailLast15MinutesTransferredByte = (long?) content.GetValueForProperty("ResyncDetailLast15MinutesTransferredByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).ResyncDetailLast15MinutesTransferredByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("ResyncDetailLastDataTransferTimeUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).ResyncDetailLastDataTransferTimeUtc = (string) content.GetValueForProperty("ResyncDetailLastDataTransferTimeUtc",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).ResyncDetailLastDataTransferTimeUtc, global::System.Convert.ToString); + } + if (content.Contains("ResyncDetailProcessedByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).ResyncDetailProcessedByte = (long?) content.GetValueForProperty("ResyncDetailProcessedByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).ResyncDetailProcessedByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("ResyncDetailStartTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).ResyncDetailStartTime = (string) content.GetValueForProperty("ResyncDetailStartTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).ResyncDetailStartTime, global::System.Convert.ToString); + } + if (content.Contains("ResyncDetailLastRefreshTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).ResyncDetailLastRefreshTime = (string) content.GetValueForProperty("ResyncDetailLastRefreshTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).ResyncDetailLastRefreshTime, global::System.Convert.ToString); + } + if (content.Contains("ResyncDetailProgressPercentage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).ResyncDetailProgressPercentage = (int?) content.GetValueForProperty("ResyncDetailProgressPercentage",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal)this).ResyncDetailProgressPercentage, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// InMageRcm protected disk details. + [System.ComponentModel.TypeConverter(typeof(InMageRcmProtectedDiskDetailsTypeConverter))] + public partial interface IInMageRcmProtectedDiskDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmProtectedDiskDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmProtectedDiskDetails.TypeConverter.cs new file mode 100644 index 000000000000..efedc2e9753f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmProtectedDiskDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InMageRcmProtectedDiskDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InMageRcmProtectedDiskDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InMageRcmProtectedDiskDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InMageRcmProtectedDiskDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmProtectedDiskDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmProtectedDiskDetails.cs new file mode 100644 index 000000000000..c1504a485899 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmProtectedDiskDetails.cs @@ -0,0 +1,611 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMageRcm protected disk details. + public partial class InMageRcmProtectedDiskDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal + { + + /// Backing field for property. + private long? _capacityInByte; + + /// The disk capacity in bytes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public long? CapacityInByte { get => this._capacityInByte; } + + /// Backing field for property. + private double? _dataPendingAtSourceAgentInMb; + + /// The data pending at source agent in MB. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public double? DataPendingAtSourceAgentInMb { get => this._dataPendingAtSourceAgentInMb; } + + /// Backing field for property. + private double? _dataPendingInLogDataStoreInMb; + + /// The data pending in log data store in MB. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public double? DataPendingInLogDataStoreInMb { get => this._dataPendingInLogDataStoreInMb; } + + /// Backing field for property. + private string _diskEncryptionSetId; + + /// The DiskEncryptionSet ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string DiskEncryptionSetId { get => this._diskEncryptionSetId; } + + /// Backing field for property. + private string _diskId; + + /// The disk Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string DiskId { get => this._diskId; } + + /// Backing field for property. + private string _diskName; + + /// The disk name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string DiskName { get => this._diskName; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskAccountType? _diskType; + + /// The disk type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskAccountType? DiskType { get => this._diskType; set => this._diskType = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetails _irDetail; + + /// The initial replication details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetails IrDetail { get => (this._irDetail = this._irDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmSyncDetails()); set => this._irDetail = value; } + + /// The bytes transferred in last 15 minutes from source VM to azure. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public long? IrDetailLast15MinutesTransferredByte { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetailsInternal)IrDetail).Last15MinutesTransferredByte; } + + /// The time of the last data transfer from source VM to azure. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string IrDetailLastDataTransferTimeUtc { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetailsInternal)IrDetail).LastDataTransferTimeUtc; } + + /// The last refresh time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string IrDetailLastRefreshTime { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetailsInternal)IrDetail).LastRefreshTime; } + + /// + /// The total processed bytes. This includes bytes that are transferred from source VM to azure and matched bytes. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public long? IrDetailProcessedByte { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetailsInternal)IrDetail).ProcessedByte; } + + /// The progress health. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskReplicationProgressHealth? IrDetailProgressHealth { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetailsInternal)IrDetail).ProgressHealth; } + + /// + /// Progress in percentage. Progress percentage is calculated based on processed bytes. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public int? IrDetailProgressPercentage { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetailsInternal)IrDetail).ProgressPercentage; } + + /// The start time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string IrDetailStartTime { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetailsInternal)IrDetail).StartTime; } + + /// The transferred bytes from source VM to azure for the disk. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public long? IrDetailTransferredByte { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetailsInternal)IrDetail).TransferredByte; } + + /// Backing field for property. + private string _isInitialReplicationComplete; + + /// A value indicating whether initial replication is complete or not. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string IsInitialReplicationComplete { get => this._isInitialReplicationComplete; } + + /// Backing field for property. + private string _isOSDisk; + + /// A value indicating whether the disk is the OS disk. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string IsOSDisk { get => this._isOSDisk; } + + /// Backing field for property. + private string _logStorageAccountId; + + /// The log storage account ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string LogStorageAccountId { get => this._logStorageAccountId; } + + /// Internal Acessors for CapacityInByte + long? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal.CapacityInByte { get => this._capacityInByte; set { {_capacityInByte = value;} } } + + /// Internal Acessors for DataPendingAtSourceAgentInMb + double? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal.DataPendingAtSourceAgentInMb { get => this._dataPendingAtSourceAgentInMb; set { {_dataPendingAtSourceAgentInMb = value;} } } + + /// Internal Acessors for DataPendingInLogDataStoreInMb + double? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal.DataPendingInLogDataStoreInMb { get => this._dataPendingInLogDataStoreInMb; set { {_dataPendingInLogDataStoreInMb = value;} } } + + /// Internal Acessors for DiskEncryptionSetId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal.DiskEncryptionSetId { get => this._diskEncryptionSetId; set { {_diskEncryptionSetId = value;} } } + + /// Internal Acessors for DiskId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal.DiskId { get => this._diskId; set { {_diskId = value;} } } + + /// Internal Acessors for DiskName + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal.DiskName { get => this._diskName; set { {_diskName = value;} } } + + /// Internal Acessors for IrDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetails Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal.IrDetail { get => (this._irDetail = this._irDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmSyncDetails()); set { {_irDetail = value;} } } + + /// Internal Acessors for IrDetailLast15MinutesTransferredByte + long? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal.IrDetailLast15MinutesTransferredByte { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetailsInternal)IrDetail).Last15MinutesTransferredByte; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetailsInternal)IrDetail).Last15MinutesTransferredByte = value; } + + /// Internal Acessors for IrDetailLastDataTransferTimeUtc + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal.IrDetailLastDataTransferTimeUtc { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetailsInternal)IrDetail).LastDataTransferTimeUtc; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetailsInternal)IrDetail).LastDataTransferTimeUtc = value; } + + /// Internal Acessors for IrDetailLastRefreshTime + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal.IrDetailLastRefreshTime { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetailsInternal)IrDetail).LastRefreshTime; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetailsInternal)IrDetail).LastRefreshTime = value; } + + /// Internal Acessors for IrDetailProcessedByte + long? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal.IrDetailProcessedByte { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetailsInternal)IrDetail).ProcessedByte; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetailsInternal)IrDetail).ProcessedByte = value; } + + /// Internal Acessors for IrDetailProgressHealth + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskReplicationProgressHealth? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal.IrDetailProgressHealth { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetailsInternal)IrDetail).ProgressHealth; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetailsInternal)IrDetail).ProgressHealth = value; } + + /// Internal Acessors for IrDetailProgressPercentage + int? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal.IrDetailProgressPercentage { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetailsInternal)IrDetail).ProgressPercentage; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetailsInternal)IrDetail).ProgressPercentage = value; } + + /// Internal Acessors for IrDetailStartTime + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal.IrDetailStartTime { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetailsInternal)IrDetail).StartTime; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetailsInternal)IrDetail).StartTime = value; } + + /// Internal Acessors for IrDetailTransferredByte + long? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal.IrDetailTransferredByte { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetailsInternal)IrDetail).TransferredByte; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetailsInternal)IrDetail).TransferredByte = value; } + + /// Internal Acessors for IsInitialReplicationComplete + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal.IsInitialReplicationComplete { get => this._isInitialReplicationComplete; set { {_isInitialReplicationComplete = value;} } } + + /// Internal Acessors for IsOSDisk + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal.IsOSDisk { get => this._isOSDisk; set { {_isOSDisk = value;} } } + + /// Internal Acessors for LogStorageAccountId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal.LogStorageAccountId { get => this._logStorageAccountId; set { {_logStorageAccountId = value;} } } + + /// Internal Acessors for ResyncDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetails Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal.ResyncDetail { get => (this._resyncDetail = this._resyncDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmSyncDetails()); set { {_resyncDetail = value;} } } + + /// Internal Acessors for ResyncDetailLast15MinutesTransferredByte + long? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal.ResyncDetailLast15MinutesTransferredByte { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetailsInternal)ResyncDetail).Last15MinutesTransferredByte; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetailsInternal)ResyncDetail).Last15MinutesTransferredByte = value; } + + /// Internal Acessors for ResyncDetailLastDataTransferTimeUtc + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal.ResyncDetailLastDataTransferTimeUtc { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetailsInternal)ResyncDetail).LastDataTransferTimeUtc; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetailsInternal)ResyncDetail).LastDataTransferTimeUtc = value; } + + /// Internal Acessors for ResyncDetailLastRefreshTime + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal.ResyncDetailLastRefreshTime { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetailsInternal)ResyncDetail).LastRefreshTime; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetailsInternal)ResyncDetail).LastRefreshTime = value; } + + /// Internal Acessors for ResyncDetailProcessedByte + long? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal.ResyncDetailProcessedByte { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetailsInternal)ResyncDetail).ProcessedByte; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetailsInternal)ResyncDetail).ProcessedByte = value; } + + /// Internal Acessors for ResyncDetailProgressHealth + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskReplicationProgressHealth? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal.ResyncDetailProgressHealth { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetailsInternal)ResyncDetail).ProgressHealth; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetailsInternal)ResyncDetail).ProgressHealth = value; } + + /// Internal Acessors for ResyncDetailProgressPercentage + int? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal.ResyncDetailProgressPercentage { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetailsInternal)ResyncDetail).ProgressPercentage; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetailsInternal)ResyncDetail).ProgressPercentage = value; } + + /// Internal Acessors for ResyncDetailStartTime + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal.ResyncDetailStartTime { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetailsInternal)ResyncDetail).StartTime; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetailsInternal)ResyncDetail).StartTime = value; } + + /// Internal Acessors for ResyncDetailTransferredByte + long? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal.ResyncDetailTransferredByte { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetailsInternal)ResyncDetail).TransferredByte; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetailsInternal)ResyncDetail).TransferredByte = value; } + + /// Internal Acessors for SeedBlobUri + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal.SeedBlobUri { get => this._seedBlobUri; set { {_seedBlobUri = value;} } } + + /// Internal Acessors for SeedManagedDiskId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal.SeedManagedDiskId { get => this._seedManagedDiskId; set { {_seedManagedDiskId = value;} } } + + /// Internal Acessors for TargetManagedDiskId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetailsInternal.TargetManagedDiskId { get => this._targetManagedDiskId; set { {_targetManagedDiskId = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetails _resyncDetail; + + /// The resync details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetails ResyncDetail { get => (this._resyncDetail = this._resyncDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmSyncDetails()); set => this._resyncDetail = value; } + + /// The bytes transferred in last 15 minutes from source VM to azure. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public long? ResyncDetailLast15MinutesTransferredByte { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetailsInternal)ResyncDetail).Last15MinutesTransferredByte; } + + /// The time of the last data transfer from source VM to azure. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ResyncDetailLastDataTransferTimeUtc { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetailsInternal)ResyncDetail).LastDataTransferTimeUtc; } + + /// The last refresh time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ResyncDetailLastRefreshTime { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetailsInternal)ResyncDetail).LastRefreshTime; } + + /// + /// The total processed bytes. This includes bytes that are transferred from source VM to azure and matched bytes. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public long? ResyncDetailProcessedByte { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetailsInternal)ResyncDetail).ProcessedByte; } + + /// The progress health. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskReplicationProgressHealth? ResyncDetailProgressHealth { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetailsInternal)ResyncDetail).ProgressHealth; } + + /// + /// Progress in percentage. Progress percentage is calculated based on processed bytes. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public int? ResyncDetailProgressPercentage { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetailsInternal)ResyncDetail).ProgressPercentage; } + + /// The start time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ResyncDetailStartTime { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetailsInternal)ResyncDetail).StartTime; } + + /// The transferred bytes from source VM to azure for the disk. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public long? ResyncDetailTransferredByte { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetailsInternal)ResyncDetail).TransferredByte; } + + /// Backing field for property. + private string _seedBlobUri; + + /// The uri of the seed blob. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string SeedBlobUri { get => this._seedBlobUri; } + + /// Backing field for property. + private string _seedManagedDiskId; + + /// The ARM Id of the seed managed disk. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string SeedManagedDiskId { get => this._seedManagedDiskId; } + + /// Backing field for property. + private string _targetManagedDiskId; + + /// The ARM Id of the target managed disk. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetManagedDiskId { get => this._targetManagedDiskId; } + + /// Creates an new instance. + public InMageRcmProtectedDiskDetails() + { + + } + } + /// InMageRcm protected disk details. + public partial interface IInMageRcmProtectedDiskDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The disk capacity in bytes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The disk capacity in bytes.", + SerializedName = @"capacityInBytes", + PossibleTypes = new [] { typeof(long) })] + long? CapacityInByte { get; } + /// The data pending at source agent in MB. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The data pending at source agent in MB.", + SerializedName = @"dataPendingAtSourceAgentInMB", + PossibleTypes = new [] { typeof(double) })] + double? DataPendingAtSourceAgentInMb { get; } + /// The data pending in log data store in MB. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The data pending in log data store in MB.", + SerializedName = @"dataPendingInLogDataStoreInMB", + PossibleTypes = new [] { typeof(double) })] + double? DataPendingInLogDataStoreInMb { get; } + /// The DiskEncryptionSet ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The DiskEncryptionSet ARM Id.", + SerializedName = @"diskEncryptionSetId", + PossibleTypes = new [] { typeof(string) })] + string DiskEncryptionSetId { get; } + /// The disk Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The disk Id.", + SerializedName = @"diskId", + PossibleTypes = new [] { typeof(string) })] + string DiskId { get; } + /// The disk name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The disk name.", + SerializedName = @"diskName", + PossibleTypes = new [] { typeof(string) })] + string DiskName { get; } + /// The disk type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The disk type.", + SerializedName = @"diskType", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskAccountType) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskAccountType? DiskType { get; set; } + /// The bytes transferred in last 15 minutes from source VM to azure. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The bytes transferred in last 15 minutes from source VM to azure.", + SerializedName = @"last15MinutesTransferredBytes", + PossibleTypes = new [] { typeof(long) })] + long? IrDetailLast15MinutesTransferredByte { get; } + /// The time of the last data transfer from source VM to azure. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The time of the last data transfer from source VM to azure.", + SerializedName = @"lastDataTransferTimeUtc", + PossibleTypes = new [] { typeof(string) })] + string IrDetailLastDataTransferTimeUtc { get; } + /// The last refresh time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The last refresh time.", + SerializedName = @"lastRefreshTime", + PossibleTypes = new [] { typeof(string) })] + string IrDetailLastRefreshTime { get; } + /// + /// The total processed bytes. This includes bytes that are transferred from source VM to azure and matched bytes. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The total processed bytes. This includes bytes that are transferred from source VM to azure and matched bytes.", + SerializedName = @"processedBytes", + PossibleTypes = new [] { typeof(long) })] + long? IrDetailProcessedByte { get; } + /// The progress health. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The progress health.", + SerializedName = @"progressHealth", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskReplicationProgressHealth) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskReplicationProgressHealth? IrDetailProgressHealth { get; } + /// + /// Progress in percentage. Progress percentage is calculated based on processed bytes. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Progress in percentage. Progress percentage is calculated based on processed bytes.", + SerializedName = @"progressPercentage", + PossibleTypes = new [] { typeof(int) })] + int? IrDetailProgressPercentage { get; } + /// The start time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The start time.", + SerializedName = @"startTime", + PossibleTypes = new [] { typeof(string) })] + string IrDetailStartTime { get; } + /// The transferred bytes from source VM to azure for the disk. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The transferred bytes from source VM to azure for the disk.", + SerializedName = @"transferredBytes", + PossibleTypes = new [] { typeof(long) })] + long? IrDetailTransferredByte { get; } + /// A value indicating whether initial replication is complete or not. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"A value indicating whether initial replication is complete or not.", + SerializedName = @"isInitialReplicationComplete", + PossibleTypes = new [] { typeof(string) })] + string IsInitialReplicationComplete { get; } + /// A value indicating whether the disk is the OS disk. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"A value indicating whether the disk is the OS disk.", + SerializedName = @"isOSDisk", + PossibleTypes = new [] { typeof(string) })] + string IsOSDisk { get; } + /// The log storage account ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The log storage account ARM Id.", + SerializedName = @"logStorageAccountId", + PossibleTypes = new [] { typeof(string) })] + string LogStorageAccountId { get; } + /// The bytes transferred in last 15 minutes from source VM to azure. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The bytes transferred in last 15 minutes from source VM to azure.", + SerializedName = @"last15MinutesTransferredBytes", + PossibleTypes = new [] { typeof(long) })] + long? ResyncDetailLast15MinutesTransferredByte { get; } + /// The time of the last data transfer from source VM to azure. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The time of the last data transfer from source VM to azure.", + SerializedName = @"lastDataTransferTimeUtc", + PossibleTypes = new [] { typeof(string) })] + string ResyncDetailLastDataTransferTimeUtc { get; } + /// The last refresh time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The last refresh time.", + SerializedName = @"lastRefreshTime", + PossibleTypes = new [] { typeof(string) })] + string ResyncDetailLastRefreshTime { get; } + /// + /// The total processed bytes. This includes bytes that are transferred from source VM to azure and matched bytes. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The total processed bytes. This includes bytes that are transferred from source VM to azure and matched bytes.", + SerializedName = @"processedBytes", + PossibleTypes = new [] { typeof(long) })] + long? ResyncDetailProcessedByte { get; } + /// The progress health. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The progress health.", + SerializedName = @"progressHealth", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskReplicationProgressHealth) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskReplicationProgressHealth? ResyncDetailProgressHealth { get; } + /// + /// Progress in percentage. Progress percentage is calculated based on processed bytes. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Progress in percentage. Progress percentage is calculated based on processed bytes.", + SerializedName = @"progressPercentage", + PossibleTypes = new [] { typeof(int) })] + int? ResyncDetailProgressPercentage { get; } + /// The start time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The start time.", + SerializedName = @"startTime", + PossibleTypes = new [] { typeof(string) })] + string ResyncDetailStartTime { get; } + /// The transferred bytes from source VM to azure for the disk. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The transferred bytes from source VM to azure for the disk.", + SerializedName = @"transferredBytes", + PossibleTypes = new [] { typeof(long) })] + long? ResyncDetailTransferredByte { get; } + /// The uri of the seed blob. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The uri of the seed blob.", + SerializedName = @"seedBlobUri", + PossibleTypes = new [] { typeof(string) })] + string SeedBlobUri { get; } + /// The ARM Id of the seed managed disk. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The ARM Id of the seed managed disk.", + SerializedName = @"seedManagedDiskId", + PossibleTypes = new [] { typeof(string) })] + string SeedManagedDiskId { get; } + /// The ARM Id of the target managed disk. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The ARM Id of the target managed disk.", + SerializedName = @"targetManagedDiskId", + PossibleTypes = new [] { typeof(string) })] + string TargetManagedDiskId { get; } + + } + /// InMageRcm protected disk details. + internal partial interface IInMageRcmProtectedDiskDetailsInternal + + { + /// The disk capacity in bytes. + long? CapacityInByte { get; set; } + /// The data pending at source agent in MB. + double? DataPendingAtSourceAgentInMb { get; set; } + /// The data pending in log data store in MB. + double? DataPendingInLogDataStoreInMb { get; set; } + /// The DiskEncryptionSet ARM Id. + string DiskEncryptionSetId { get; set; } + /// The disk Id. + string DiskId { get; set; } + /// The disk name. + string DiskName { get; set; } + /// The disk type. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskAccountType? DiskType { get; set; } + /// The initial replication details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetails IrDetail { get; set; } + /// The bytes transferred in last 15 minutes from source VM to azure. + long? IrDetailLast15MinutesTransferredByte { get; set; } + /// The time of the last data transfer from source VM to azure. + string IrDetailLastDataTransferTimeUtc { get; set; } + /// The last refresh time. + string IrDetailLastRefreshTime { get; set; } + /// + /// The total processed bytes. This includes bytes that are transferred from source VM to azure and matched bytes. + /// + long? IrDetailProcessedByte { get; set; } + /// The progress health. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskReplicationProgressHealth? IrDetailProgressHealth { get; set; } + /// + /// Progress in percentage. Progress percentage is calculated based on processed bytes. + /// + int? IrDetailProgressPercentage { get; set; } + /// The start time. + string IrDetailStartTime { get; set; } + /// The transferred bytes from source VM to azure for the disk. + long? IrDetailTransferredByte { get; set; } + /// A value indicating whether initial replication is complete or not. + string IsInitialReplicationComplete { get; set; } + /// A value indicating whether the disk is the OS disk. + string IsOSDisk { get; set; } + /// The log storage account ARM Id. + string LogStorageAccountId { get; set; } + /// The resync details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetails ResyncDetail { get; set; } + /// The bytes transferred in last 15 minutes from source VM to azure. + long? ResyncDetailLast15MinutesTransferredByte { get; set; } + /// The time of the last data transfer from source VM to azure. + string ResyncDetailLastDataTransferTimeUtc { get; set; } + /// The last refresh time. + string ResyncDetailLastRefreshTime { get; set; } + /// + /// The total processed bytes. This includes bytes that are transferred from source VM to azure and matched bytes. + /// + long? ResyncDetailProcessedByte { get; set; } + /// The progress health. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskReplicationProgressHealth? ResyncDetailProgressHealth { get; set; } + /// + /// Progress in percentage. Progress percentage is calculated based on processed bytes. + /// + int? ResyncDetailProgressPercentage { get; set; } + /// The start time. + string ResyncDetailStartTime { get; set; } + /// The transferred bytes from source VM to azure for the disk. + long? ResyncDetailTransferredByte { get; set; } + /// The uri of the seed blob. + string SeedBlobUri { get; set; } + /// The ARM Id of the seed managed disk. + string SeedManagedDiskId { get; set; } + /// The ARM Id of the target managed disk. + string TargetManagedDiskId { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmProtectedDiskDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmProtectedDiskDetails.json.cs new file mode 100644 index 000000000000..b92de9bdeacb --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmProtectedDiskDetails.json.cs @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMageRcm protected disk details. + public partial class InMageRcmProtectedDiskDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new InMageRcmProtectedDiskDetails(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal InMageRcmProtectedDiskDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_irDetail = If( json?.PropertyT("irDetails"), out var __jsonIrDetails) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmSyncDetails.FromJson(__jsonIrDetails) : IrDetail;} + {_resyncDetail = If( json?.PropertyT("resyncDetails"), out var __jsonResyncDetails) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmSyncDetails.FromJson(__jsonResyncDetails) : ResyncDetail;} + {_diskId = If( json?.PropertyT("diskId"), out var __jsonDiskId) ? (string)__jsonDiskId : (string)DiskId;} + {_diskName = If( json?.PropertyT("diskName"), out var __jsonDiskName) ? (string)__jsonDiskName : (string)DiskName;} + {_isOSDisk = If( json?.PropertyT("isOSDisk"), out var __jsonIsOSDisk) ? (string)__jsonIsOSDisk : (string)IsOSDisk;} + {_capacityInByte = If( json?.PropertyT("capacityInBytes"), out var __jsonCapacityInBytes) ? (long?)__jsonCapacityInBytes : CapacityInByte;} + {_logStorageAccountId = If( json?.PropertyT("logStorageAccountId"), out var __jsonLogStorageAccountId) ? (string)__jsonLogStorageAccountId : (string)LogStorageAccountId;} + {_diskEncryptionSetId = If( json?.PropertyT("diskEncryptionSetId"), out var __jsonDiskEncryptionSetId) ? (string)__jsonDiskEncryptionSetId : (string)DiskEncryptionSetId;} + {_seedManagedDiskId = If( json?.PropertyT("seedManagedDiskId"), out var __jsonSeedManagedDiskId) ? (string)__jsonSeedManagedDiskId : (string)SeedManagedDiskId;} + {_seedBlobUri = If( json?.PropertyT("seedBlobUri"), out var __jsonSeedBlobUri) ? (string)__jsonSeedBlobUri : (string)SeedBlobUri;} + {_targetManagedDiskId = If( json?.PropertyT("targetManagedDiskId"), out var __jsonTargetManagedDiskId) ? (string)__jsonTargetManagedDiskId : (string)TargetManagedDiskId;} + {_diskType = If( json?.PropertyT("diskType"), out var __jsonDiskType) ? (string)__jsonDiskType : (string)DiskType;} + {_dataPendingInLogDataStoreInMb = If( json?.PropertyT("dataPendingInLogDataStoreInMB"), out var __jsonDataPendingInLogDataStoreInMb) ? (double?)__jsonDataPendingInLogDataStoreInMb : DataPendingInLogDataStoreInMb;} + {_dataPendingAtSourceAgentInMb = If( json?.PropertyT("dataPendingAtSourceAgentInMB"), out var __jsonDataPendingAtSourceAgentInMb) ? (double?)__jsonDataPendingAtSourceAgentInMb : DataPendingAtSourceAgentInMb;} + {_isInitialReplicationComplete = If( json?.PropertyT("isInitialReplicationComplete"), out var __jsonIsInitialReplicationComplete) ? (string)__jsonIsInitialReplicationComplete : (string)IsInitialReplicationComplete;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._irDetail ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._irDetail.ToJson(null,serializationMode) : null, "irDetails" ,container.Add ); + AddIf( null != this._resyncDetail ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._resyncDetail.ToJson(null,serializationMode) : null, "resyncDetails" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._diskId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._diskId.ToString()) : null, "diskId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._diskName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._diskName.ToString()) : null, "diskName" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._isOSDisk)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._isOSDisk.ToString()) : null, "isOSDisk" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._capacityInByte ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((long)this._capacityInByte) : null, "capacityInBytes" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._logStorageAccountId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._logStorageAccountId.ToString()) : null, "logStorageAccountId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._diskEncryptionSetId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._diskEncryptionSetId.ToString()) : null, "diskEncryptionSetId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._seedManagedDiskId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._seedManagedDiskId.ToString()) : null, "seedManagedDiskId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._seedBlobUri)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._seedBlobUri.ToString()) : null, "seedBlobUri" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._targetManagedDiskId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetManagedDiskId.ToString()) : null, "targetManagedDiskId" ,container.Add ); + } + AddIf( null != (((object)this._diskType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._diskType.ToString()) : null, "diskType" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._dataPendingInLogDataStoreInMb ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((double)this._dataPendingInLogDataStoreInMb) : null, "dataPendingInLogDataStoreInMB" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._dataPendingAtSourceAgentInMb ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((double)this._dataPendingAtSourceAgentInMb) : null, "dataPendingAtSourceAgentInMB" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._isInitialReplicationComplete)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._isInitialReplicationComplete.ToString()) : null, "isInitialReplicationComplete" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmProtectionContainerMappingDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmProtectionContainerMappingDetails.PowerShell.cs new file mode 100644 index 000000000000..a49fcedcf485 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmProtectionContainerMappingDetails.PowerShell.cs @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// InMageRcm provider specific container mapping details. + [System.ComponentModel.TypeConverter(typeof(InMageRcmProtectionContainerMappingDetailsTypeConverter))] + public partial class InMageRcmProtectionContainerMappingDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectionContainerMappingDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InMageRcmProtectionContainerMappingDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectionContainerMappingDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InMageRcmProtectionContainerMappingDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a + /// json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectionContainerMappingDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InMageRcmProtectionContainerMappingDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("EnableAgentAutoUpgrade")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectionContainerMappingDetailsInternal)this).EnableAgentAutoUpgrade = (string) content.GetValueForProperty("EnableAgentAutoUpgrade",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectionContainerMappingDetailsInternal)this).EnableAgentAutoUpgrade, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingProviderSpecificDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingProviderSpecificDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InMageRcmProtectionContainerMappingDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("EnableAgentAutoUpgrade")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectionContainerMappingDetailsInternal)this).EnableAgentAutoUpgrade = (string) content.GetValueForProperty("EnableAgentAutoUpgrade",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectionContainerMappingDetailsInternal)this).EnableAgentAutoUpgrade, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingProviderSpecificDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingProviderSpecificDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// InMageRcm provider specific container mapping details. + [System.ComponentModel.TypeConverter(typeof(InMageRcmProtectionContainerMappingDetailsTypeConverter))] + public partial interface IInMageRcmProtectionContainerMappingDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmProtectionContainerMappingDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmProtectionContainerMappingDetails.TypeConverter.cs new file mode 100644 index 000000000000..2ac3acc08fe3 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmProtectionContainerMappingDetails.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InMageRcmProtectionContainerMappingDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectionContainerMappingDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectionContainerMappingDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InMageRcmProtectionContainerMappingDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InMageRcmProtectionContainerMappingDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InMageRcmProtectionContainerMappingDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmProtectionContainerMappingDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmProtectionContainerMappingDetails.cs new file mode 100644 index 000000000000..d9ab9b1c3e27 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmProtectionContainerMappingDetails.cs @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMageRcm provider specific container mapping details. + public partial class InMageRcmProtectionContainerMappingDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectionContainerMappingDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectionContainerMappingDetailsInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingProviderSpecificDetails __protectionContainerMappingProviderSpecificDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProtectionContainerMappingProviderSpecificDetails(); + + /// Backing field for property. + private string _enableAgentAutoUpgrade; + + /// A value indicating whether the flag for enable agent auto upgrade. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string EnableAgentAutoUpgrade { get => this._enableAgentAutoUpgrade; } + + /// Gets the class type. Overridden in derived classes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingProviderSpecificDetailsInternal)__protectionContainerMappingProviderSpecificDetails).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingProviderSpecificDetailsInternal)__protectionContainerMappingProviderSpecificDetails).InstanceType = value ; } + + /// Internal Acessors for EnableAgentAutoUpgrade + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectionContainerMappingDetailsInternal.EnableAgentAutoUpgrade { get => this._enableAgentAutoUpgrade; set { {_enableAgentAutoUpgrade = value;} } } + + /// + /// Creates an new instance. + /// + public InMageRcmProtectionContainerMappingDetails() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__protectionContainerMappingProviderSpecificDetails), __protectionContainerMappingProviderSpecificDetails); + await eventListener.AssertObjectIsValid(nameof(__protectionContainerMappingProviderSpecificDetails), __protectionContainerMappingProviderSpecificDetails); + } + } + /// InMageRcm provider specific container mapping details. + public partial interface IInMageRcmProtectionContainerMappingDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingProviderSpecificDetails + { + /// A value indicating whether the flag for enable agent auto upgrade. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"A value indicating whether the flag for enable agent auto upgrade.", + SerializedName = @"enableAgentAutoUpgrade", + PossibleTypes = new [] { typeof(string) })] + string EnableAgentAutoUpgrade { get; } + + } + /// InMageRcm provider specific container mapping details. + internal partial interface IInMageRcmProtectionContainerMappingDetailsInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingProviderSpecificDetailsInternal + { + /// A value indicating whether the flag for enable agent auto upgrade. + string EnableAgentAutoUpgrade { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmProtectionContainerMappingDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmProtectionContainerMappingDetails.json.cs new file mode 100644 index 000000000000..c79d67ade6ed --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmProtectionContainerMappingDetails.json.cs @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMageRcm provider specific container mapping details. + public partial class InMageRcmProtectionContainerMappingDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectionContainerMappingDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectionContainerMappingDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectionContainerMappingDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new InMageRcmProtectionContainerMappingDetails(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal InMageRcmProtectionContainerMappingDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __protectionContainerMappingProviderSpecificDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProtectionContainerMappingProviderSpecificDetails(json); + {_enableAgentAutoUpgrade = If( json?.PropertyT("enableAgentAutoUpgrade"), out var __jsonEnableAgentAutoUpgrade) ? (string)__jsonEnableAgentAutoUpgrade : (string)EnableAgentAutoUpgrade;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __protectionContainerMappingProviderSpecificDetails?.ToJson(container, serializationMode); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._enableAgentAutoUpgrade)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._enableAgentAutoUpgrade.ToString()) : null, "enableAgentAutoUpgrade" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmRecoveryPointDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmRecoveryPointDetails.PowerShell.cs new file mode 100644 index 000000000000..f5085a926525 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmRecoveryPointDetails.PowerShell.cs @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// InMageRcm provider specific recovery point details. + [System.ComponentModel.TypeConverter(typeof(InMageRcmRecoveryPointDetailsTypeConverter))] + public partial class InMageRcmRecoveryPointDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmRecoveryPointDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InMageRcmRecoveryPointDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmRecoveryPointDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InMageRcmRecoveryPointDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmRecoveryPointDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InMageRcmRecoveryPointDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("IsMultiVMSyncPoint")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmRecoveryPointDetailsInternal)this).IsMultiVMSyncPoint = (string) content.GetValueForProperty("IsMultiVMSyncPoint",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmRecoveryPointDetailsInternal)this).IsMultiVMSyncPoint, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProviderSpecificRecoveryPointDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProviderSpecificRecoveryPointDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InMageRcmRecoveryPointDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("IsMultiVMSyncPoint")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmRecoveryPointDetailsInternal)this).IsMultiVMSyncPoint = (string) content.GetValueForProperty("IsMultiVMSyncPoint",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmRecoveryPointDetailsInternal)this).IsMultiVMSyncPoint, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProviderSpecificRecoveryPointDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProviderSpecificRecoveryPointDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// InMageRcm provider specific recovery point details. + [System.ComponentModel.TypeConverter(typeof(InMageRcmRecoveryPointDetailsTypeConverter))] + public partial interface IInMageRcmRecoveryPointDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmRecoveryPointDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmRecoveryPointDetails.TypeConverter.cs new file mode 100644 index 000000000000..0120722776fe --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmRecoveryPointDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InMageRcmRecoveryPointDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmRecoveryPointDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmRecoveryPointDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InMageRcmRecoveryPointDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InMageRcmRecoveryPointDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InMageRcmRecoveryPointDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmRecoveryPointDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmRecoveryPointDetails.cs new file mode 100644 index 000000000000..f65eff274d56 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmRecoveryPointDetails.cs @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMageRcm provider specific recovery point details. + public partial class InMageRcmRecoveryPointDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmRecoveryPointDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmRecoveryPointDetailsInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProviderSpecificRecoveryPointDetails __providerSpecificRecoveryPointDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProviderSpecificRecoveryPointDetails(); + + /// Gets the provider type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProviderSpecificRecoveryPointDetailsInternal)__providerSpecificRecoveryPointDetails).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProviderSpecificRecoveryPointDetailsInternal)__providerSpecificRecoveryPointDetails).InstanceType = value ; } + + /// Backing field for property. + private string _isMultiVMSyncPoint; + + /// A value indicating whether the recovery point is multi VM consistent. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string IsMultiVMSyncPoint { get => this._isMultiVMSyncPoint; } + + /// Internal Acessors for IsMultiVMSyncPoint + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmRecoveryPointDetailsInternal.IsMultiVMSyncPoint { get => this._isMultiVMSyncPoint; set { {_isMultiVMSyncPoint = value;} } } + + /// Creates an new instance. + public InMageRcmRecoveryPointDetails() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__providerSpecificRecoveryPointDetails), __providerSpecificRecoveryPointDetails); + await eventListener.AssertObjectIsValid(nameof(__providerSpecificRecoveryPointDetails), __providerSpecificRecoveryPointDetails); + } + } + /// InMageRcm provider specific recovery point details. + public partial interface IInMageRcmRecoveryPointDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProviderSpecificRecoveryPointDetails + { + /// A value indicating whether the recovery point is multi VM consistent. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"A value indicating whether the recovery point is multi VM consistent.", + SerializedName = @"isMultiVmSyncPoint", + PossibleTypes = new [] { typeof(string) })] + string IsMultiVMSyncPoint { get; } + + } + /// InMageRcm provider specific recovery point details. + internal partial interface IInMageRcmRecoveryPointDetailsInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProviderSpecificRecoveryPointDetailsInternal + { + /// A value indicating whether the recovery point is multi VM consistent. + string IsMultiVMSyncPoint { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmRecoveryPointDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmRecoveryPointDetails.json.cs new file mode 100644 index 000000000000..5e9e30f2f3e6 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmRecoveryPointDetails.json.cs @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMageRcm provider specific recovery point details. + public partial class InMageRcmRecoveryPointDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmRecoveryPointDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmRecoveryPointDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmRecoveryPointDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new InMageRcmRecoveryPointDetails(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal InMageRcmRecoveryPointDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __providerSpecificRecoveryPointDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProviderSpecificRecoveryPointDetails(json); + {_isMultiVMSyncPoint = If( json?.PropertyT("isMultiVmSyncPoint"), out var __jsonIsMultiVMSyncPoint) ? (string)__jsonIsMultiVMSyncPoint : (string)IsMultiVMSyncPoint;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __providerSpecificRecoveryPointDetails?.ToJson(container, serializationMode); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._isMultiVMSyncPoint)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._isMultiVMSyncPoint.ToString()) : null, "isMultiVmSyncPoint" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmReplicationDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmReplicationDetails.PowerShell.cs new file mode 100644 index 000000000000..34036c827734 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmReplicationDetails.PowerShell.cs @@ -0,0 +1,738 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// InMageRcm provider specific details. + [System.ComponentModel.TypeConverter(typeof(InMageRcmReplicationDetailsTypeConverter))] + public partial class InMageRcmReplicationDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InMageRcmReplicationDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InMageRcmReplicationDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InMageRcmReplicationDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("MobilityAgentDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).MobilityAgentDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmMobilityAgentDetails) content.GetValueForProperty("MobilityAgentDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).MobilityAgentDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmMobilityAgentDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("DiscoveredVMDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).DiscoveredVMDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetails) content.GetValueForProperty("DiscoveredVMDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).DiscoveredVMDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmDiscoveredProtectedVMDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("InternalIdentifier")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).InternalIdentifier = (string) content.GetValueForProperty("InternalIdentifier",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).InternalIdentifier, global::System.Convert.ToString); + } + if (content.Contains("FabricDiscoveryMachineId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).FabricDiscoveryMachineId = (string) content.GetValueForProperty("FabricDiscoveryMachineId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).FabricDiscoveryMachineId, global::System.Convert.ToString); + } + if (content.Contains("MultiVMGroupName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).MultiVMGroupName = (string) content.GetValueForProperty("MultiVMGroupName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).MultiVMGroupName, global::System.Convert.ToString); + } + if (content.Contains("DiscoveryType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).DiscoveryType = (string) content.GetValueForProperty("DiscoveryType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).DiscoveryType, global::System.Convert.ToString); + } + if (content.Contains("ProcessServerId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).ProcessServerId = (string) content.GetValueForProperty("ProcessServerId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).ProcessServerId, global::System.Convert.ToString); + } + if (content.Contains("ProcessorCoreCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).ProcessorCoreCount = (int?) content.GetValueForProperty("ProcessorCoreCount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).ProcessorCoreCount, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("AllocatedMemoryInMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).AllocatedMemoryInMb = (double?) content.GetValueForProperty("AllocatedMemoryInMb",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).AllocatedMemoryInMb, (__y)=> (double) global::System.Convert.ChangeType(__y, typeof(double))); + } + if (content.Contains("ProcessServerName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).ProcessServerName = (string) content.GetValueForProperty("ProcessServerName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).ProcessServerName, global::System.Convert.ToString); + } + if (content.Contains("RunAsAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).RunAsAccountId = (string) content.GetValueForProperty("RunAsAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).RunAsAccountId, global::System.Convert.ToString); + } + if (content.Contains("OSType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).OSType = (string) content.GetValueForProperty("OSType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).OSType, global::System.Convert.ToString); + } + if (content.Contains("FirmwareType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).FirmwareType = (string) content.GetValueForProperty("FirmwareType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).FirmwareType, global::System.Convert.ToString); + } + if (content.Contains("PrimaryNicIPAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).PrimaryNicIPAddress = (string) content.GetValueForProperty("PrimaryNicIPAddress",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).PrimaryNicIPAddress, global::System.Convert.ToString); + } + if (content.Contains("TargetGeneration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).TargetGeneration = (string) content.GetValueForProperty("TargetGeneration",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).TargetGeneration, global::System.Convert.ToString); + } + if (content.Contains("LicenseType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).LicenseType = (string) content.GetValueForProperty("LicenseType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).LicenseType, global::System.Convert.ToString); + } + if (content.Contains("StorageAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).StorageAccountId = (string) content.GetValueForProperty("StorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).StorageAccountId, global::System.Convert.ToString); + } + if (content.Contains("TargetVMName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).TargetVMName = (string) content.GetValueForProperty("TargetVMName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).TargetVMName, global::System.Convert.ToString); + } + if (content.Contains("TargetVMSize")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).TargetVMSize = (string) content.GetValueForProperty("TargetVMSize",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).TargetVMSize, global::System.Convert.ToString); + } + if (content.Contains("TargetResourceGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).TargetResourceGroupId = (string) content.GetValueForProperty("TargetResourceGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).TargetResourceGroupId, global::System.Convert.ToString); + } + if (content.Contains("TargetLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).TargetLocation = (string) content.GetValueForProperty("TargetLocation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).TargetLocation, global::System.Convert.ToString); + } + if (content.Contains("TargetAvailabilitySetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).TargetAvailabilitySetId = (string) content.GetValueForProperty("TargetAvailabilitySetId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).TargetAvailabilitySetId, global::System.Convert.ToString); + } + if (content.Contains("TargetAvailabilityZone")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).TargetAvailabilityZone = (string) content.GetValueForProperty("TargetAvailabilityZone",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).TargetAvailabilityZone, global::System.Convert.ToString); + } + if (content.Contains("TargetProximityPlacementGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).TargetProximityPlacementGroupId = (string) content.GetValueForProperty("TargetProximityPlacementGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).TargetProximityPlacementGroupId, global::System.Convert.ToString); + } + if (content.Contains("TargetBootDiagnosticsStorageAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).TargetBootDiagnosticsStorageAccountId = (string) content.GetValueForProperty("TargetBootDiagnosticsStorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).TargetBootDiagnosticsStorageAccountId, global::System.Convert.ToString); + } + if (content.Contains("TargetNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).TargetNetworkId = (string) content.GetValueForProperty("TargetNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).TargetNetworkId, global::System.Convert.ToString); + } + if (content.Contains("TestNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).TestNetworkId = (string) content.GetValueForProperty("TestNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).TestNetworkId, global::System.Convert.ToString); + } + if (content.Contains("FailoverRecoveryPointId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).FailoverRecoveryPointId = (string) content.GetValueForProperty("FailoverRecoveryPointId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).FailoverRecoveryPointId, global::System.Convert.ToString); + } + if (content.Contains("LastRecoveryPointReceived")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).LastRecoveryPointReceived = (global::System.DateTime?) content.GetValueForProperty("LastRecoveryPointReceived",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).LastRecoveryPointReceived, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("LastRpoInSecond")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).LastRpoInSecond = (long?) content.GetValueForProperty("LastRpoInSecond",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).LastRpoInSecond, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("LastRpoCalculatedTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).LastRpoCalculatedTime = (global::System.DateTime?) content.GetValueForProperty("LastRpoCalculatedTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).LastRpoCalculatedTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("LastRecoveryPointId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).LastRecoveryPointId = (string) content.GetValueForProperty("LastRecoveryPointId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).LastRecoveryPointId, global::System.Convert.ToString); + } + if (content.Contains("InitialReplicationProgressPercentage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).InitialReplicationProgressPercentage = (int?) content.GetValueForProperty("InitialReplicationProgressPercentage",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).InitialReplicationProgressPercentage, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("InitialReplicationProcessedByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).InitialReplicationProcessedByte = (long?) content.GetValueForProperty("InitialReplicationProcessedByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).InitialReplicationProcessedByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("InitialReplicationTransferredByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).InitialReplicationTransferredByte = (long?) content.GetValueForProperty("InitialReplicationTransferredByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).InitialReplicationTransferredByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("InitialReplicationProgressHealth")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).InitialReplicationProgressHealth = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.VMReplicationProgressHealth?) content.GetValueForProperty("InitialReplicationProgressHealth",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).InitialReplicationProgressHealth, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.VMReplicationProgressHealth.CreateFrom); + } + if (content.Contains("ResyncProgressPercentage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).ResyncProgressPercentage = (int?) content.GetValueForProperty("ResyncProgressPercentage",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).ResyncProgressPercentage, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("ResyncProcessedByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).ResyncProcessedByte = (long?) content.GetValueForProperty("ResyncProcessedByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).ResyncProcessedByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("ResyncTransferredByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).ResyncTransferredByte = (long?) content.GetValueForProperty("ResyncTransferredByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).ResyncTransferredByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("ResyncProgressHealth")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).ResyncProgressHealth = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.VMReplicationProgressHealth?) content.GetValueForProperty("ResyncProgressHealth",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).ResyncProgressHealth, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.VMReplicationProgressHealth.CreateFrom); + } + if (content.Contains("ResyncRequired")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).ResyncRequired = (string) content.GetValueForProperty("ResyncRequired",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).ResyncRequired, global::System.Convert.ToString); + } + if (content.Contains("ResyncState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).ResyncState = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ResyncState?) content.GetValueForProperty("ResyncState",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).ResyncState, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ResyncState.CreateFrom); + } + if (content.Contains("AgentUpgradeState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).AgentUpgradeState = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MobilityAgentUpgradeState?) content.GetValueForProperty("AgentUpgradeState",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).AgentUpgradeState, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MobilityAgentUpgradeState.CreateFrom); + } + if (content.Contains("LastAgentUpgradeType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).LastAgentUpgradeType = (string) content.GetValueForProperty("LastAgentUpgradeType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).LastAgentUpgradeType, global::System.Convert.ToString); + } + if (content.Contains("AgentUpgradeJobId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).AgentUpgradeJobId = (string) content.GetValueForProperty("AgentUpgradeJobId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).AgentUpgradeJobId, global::System.Convert.ToString); + } + if (content.Contains("AgentUpgradeAttemptToVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).AgentUpgradeAttemptToVersion = (string) content.GetValueForProperty("AgentUpgradeAttemptToVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).AgentUpgradeAttemptToVersion, global::System.Convert.ToString); + } + if (content.Contains("ProtectedDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).ProtectedDisk = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetails[]) content.GetValueForProperty("ProtectedDisk",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).ProtectedDisk, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmProtectedDiskDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("IsLastUpgradeSuccessful")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).IsLastUpgradeSuccessful = (string) content.GetValueForProperty("IsLastUpgradeSuccessful",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).IsLastUpgradeSuccessful, global::System.Convert.ToString); + } + if (content.Contains("IsAgentRegistrationSuccessfulAfterFailover")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).IsAgentRegistrationSuccessfulAfterFailover = (bool?) content.GetValueForProperty("IsAgentRegistrationSuccessfulAfterFailover",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).IsAgentRegistrationSuccessfulAfterFailover, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("LastAgentUpgradeErrorDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).LastAgentUpgradeErrorDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmLastAgentUpgradeErrorDetails[]) content.GetValueForProperty("LastAgentUpgradeErrorDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).LastAgentUpgradeErrorDetail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmLastAgentUpgradeErrorDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("AgentUpgradeBlockingErrorDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).AgentUpgradeBlockingErrorDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmAgentUpgradeBlockingErrorDetails[]) content.GetValueForProperty("AgentUpgradeBlockingErrorDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).AgentUpgradeBlockingErrorDetail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmAgentUpgradeBlockingErrorDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("VMNic")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).VMNic = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicDetails[]) content.GetValueForProperty("VMNic",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).VMNic, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmNicDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettingsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettingsInternal)this).InstanceType, global::System.Convert.ToString); + } + if (content.Contains("MobilityAgentDetailVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).MobilityAgentDetailVersion = (string) content.GetValueForProperty("MobilityAgentDetailVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).MobilityAgentDetailVersion, global::System.Convert.ToString); + } + if (content.Contains("MobilityAgentDetailLatestVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).MobilityAgentDetailLatestVersion = (string) content.GetValueForProperty("MobilityAgentDetailLatestVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).MobilityAgentDetailLatestVersion, global::System.Convert.ToString); + } + if (content.Contains("MobilityAgentDetailLatestAgentReleaseDate")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).MobilityAgentDetailLatestAgentReleaseDate = (string) content.GetValueForProperty("MobilityAgentDetailLatestAgentReleaseDate",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).MobilityAgentDetailLatestAgentReleaseDate, global::System.Convert.ToString); + } + if (content.Contains("MobilityAgentDetailDriverVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).MobilityAgentDetailDriverVersion = (string) content.GetValueForProperty("MobilityAgentDetailDriverVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).MobilityAgentDetailDriverVersion, global::System.Convert.ToString); + } + if (content.Contains("MobilityAgentDetailLatestUpgradableVersionWithoutReboot")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).MobilityAgentDetailLatestUpgradableVersionWithoutReboot = (string) content.GetValueForProperty("MobilityAgentDetailLatestUpgradableVersionWithoutReboot",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).MobilityAgentDetailLatestUpgradableVersionWithoutReboot, global::System.Convert.ToString); + } + if (content.Contains("MobilityAgentDetailAgentVersionExpiryDate")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).MobilityAgentDetailAgentVersionExpiryDate = (global::System.DateTime?) content.GetValueForProperty("MobilityAgentDetailAgentVersionExpiryDate",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).MobilityAgentDetailAgentVersionExpiryDate, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("MobilityAgentDetailDriverVersionExpiryDate")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).MobilityAgentDetailDriverVersionExpiryDate = (global::System.DateTime?) content.GetValueForProperty("MobilityAgentDetailDriverVersionExpiryDate",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).MobilityAgentDetailDriverVersionExpiryDate, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("MobilityAgentDetailLastHeartbeatUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).MobilityAgentDetailLastHeartbeatUtc = (global::System.DateTime?) content.GetValueForProperty("MobilityAgentDetailLastHeartbeatUtc",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).MobilityAgentDetailLastHeartbeatUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("MobilityAgentDetailReasonsBlockingUpgrade")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).MobilityAgentDetailReasonsBlockingUpgrade = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentUpgradeBlockedReason[]) content.GetValueForProperty("MobilityAgentDetailReasonsBlockingUpgrade",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).MobilityAgentDetailReasonsBlockingUpgrade, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentUpgradeBlockedReason.CreateFrom)); + } + if (content.Contains("MobilityAgentDetailIsUpgradeable")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).MobilityAgentDetailIsUpgradeable = (string) content.GetValueForProperty("MobilityAgentDetailIsUpgradeable",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).MobilityAgentDetailIsUpgradeable, global::System.Convert.ToString); + } + if (content.Contains("DiscoveredVMDetailVcenterId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).DiscoveredVMDetailVcenterId = (string) content.GetValueForProperty("DiscoveredVMDetailVcenterId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).DiscoveredVMDetailVcenterId, global::System.Convert.ToString); + } + if (content.Contains("DiscoveredVMDetailVcenterFqdn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).DiscoveredVMDetailVcenterFqdn = (string) content.GetValueForProperty("DiscoveredVMDetailVcenterFqdn",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).DiscoveredVMDetailVcenterFqdn, global::System.Convert.ToString); + } + if (content.Contains("DiscoveredVMDetailDatastore")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).DiscoveredVMDetailDatastore = (string[]) content.GetValueForProperty("DiscoveredVMDetailDatastore",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).DiscoveredVMDetailDatastore, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("DiscoveredVMDetailIpaddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).DiscoveredVMDetailIpaddress = (string[]) content.GetValueForProperty("DiscoveredVMDetailIpaddress",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).DiscoveredVMDetailIpaddress, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("DiscoveredVMDetailVmwareToolsStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).DiscoveredVMDetailVmwareToolsStatus = (string) content.GetValueForProperty("DiscoveredVMDetailVmwareToolsStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).DiscoveredVMDetailVmwareToolsStatus, global::System.Convert.ToString); + } + if (content.Contains("DiscoveredVMDetailPowerStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).DiscoveredVMDetailPowerStatus = (string) content.GetValueForProperty("DiscoveredVMDetailPowerStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).DiscoveredVMDetailPowerStatus, global::System.Convert.ToString); + } + if (content.Contains("DiscoveredVMDetailVmfqdn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).DiscoveredVMDetailVmfqdn = (string) content.GetValueForProperty("DiscoveredVMDetailVmfqdn",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).DiscoveredVMDetailVmfqdn, global::System.Convert.ToString); + } + if (content.Contains("DiscoveredVMDetailOsname")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).DiscoveredVMDetailOsname = (string) content.GetValueForProperty("DiscoveredVMDetailOsname",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).DiscoveredVMDetailOsname, global::System.Convert.ToString); + } + if (content.Contains("DiscoveredVMDetailCreatedTimestamp")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).DiscoveredVMDetailCreatedTimestamp = (global::System.DateTime?) content.GetValueForProperty("DiscoveredVMDetailCreatedTimestamp",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).DiscoveredVMDetailCreatedTimestamp, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("DiscoveredVMDetailUpdatedTimestamp")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).DiscoveredVMDetailUpdatedTimestamp = (global::System.DateTime?) content.GetValueForProperty("DiscoveredVMDetailUpdatedTimestamp",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).DiscoveredVMDetailUpdatedTimestamp, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("DiscoveredVMDetailIsDeleted")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).DiscoveredVMDetailIsDeleted = (bool?) content.GetValueForProperty("DiscoveredVMDetailIsDeleted",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).DiscoveredVMDetailIsDeleted, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("DiscoveredVMDetailLastDiscoveryTimeInUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).DiscoveredVMDetailLastDiscoveryTimeInUtc = (global::System.DateTime?) content.GetValueForProperty("DiscoveredVMDetailLastDiscoveryTimeInUtc",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).DiscoveredVMDetailLastDiscoveryTimeInUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InMageRcmReplicationDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("MobilityAgentDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).MobilityAgentDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmMobilityAgentDetails) content.GetValueForProperty("MobilityAgentDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).MobilityAgentDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmMobilityAgentDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("DiscoveredVMDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).DiscoveredVMDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetails) content.GetValueForProperty("DiscoveredVMDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).DiscoveredVMDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmDiscoveredProtectedVMDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("InternalIdentifier")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).InternalIdentifier = (string) content.GetValueForProperty("InternalIdentifier",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).InternalIdentifier, global::System.Convert.ToString); + } + if (content.Contains("FabricDiscoveryMachineId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).FabricDiscoveryMachineId = (string) content.GetValueForProperty("FabricDiscoveryMachineId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).FabricDiscoveryMachineId, global::System.Convert.ToString); + } + if (content.Contains("MultiVMGroupName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).MultiVMGroupName = (string) content.GetValueForProperty("MultiVMGroupName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).MultiVMGroupName, global::System.Convert.ToString); + } + if (content.Contains("DiscoveryType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).DiscoveryType = (string) content.GetValueForProperty("DiscoveryType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).DiscoveryType, global::System.Convert.ToString); + } + if (content.Contains("ProcessServerId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).ProcessServerId = (string) content.GetValueForProperty("ProcessServerId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).ProcessServerId, global::System.Convert.ToString); + } + if (content.Contains("ProcessorCoreCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).ProcessorCoreCount = (int?) content.GetValueForProperty("ProcessorCoreCount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).ProcessorCoreCount, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("AllocatedMemoryInMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).AllocatedMemoryInMb = (double?) content.GetValueForProperty("AllocatedMemoryInMb",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).AllocatedMemoryInMb, (__y)=> (double) global::System.Convert.ChangeType(__y, typeof(double))); + } + if (content.Contains("ProcessServerName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).ProcessServerName = (string) content.GetValueForProperty("ProcessServerName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).ProcessServerName, global::System.Convert.ToString); + } + if (content.Contains("RunAsAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).RunAsAccountId = (string) content.GetValueForProperty("RunAsAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).RunAsAccountId, global::System.Convert.ToString); + } + if (content.Contains("OSType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).OSType = (string) content.GetValueForProperty("OSType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).OSType, global::System.Convert.ToString); + } + if (content.Contains("FirmwareType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).FirmwareType = (string) content.GetValueForProperty("FirmwareType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).FirmwareType, global::System.Convert.ToString); + } + if (content.Contains("PrimaryNicIPAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).PrimaryNicIPAddress = (string) content.GetValueForProperty("PrimaryNicIPAddress",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).PrimaryNicIPAddress, global::System.Convert.ToString); + } + if (content.Contains("TargetGeneration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).TargetGeneration = (string) content.GetValueForProperty("TargetGeneration",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).TargetGeneration, global::System.Convert.ToString); + } + if (content.Contains("LicenseType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).LicenseType = (string) content.GetValueForProperty("LicenseType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).LicenseType, global::System.Convert.ToString); + } + if (content.Contains("StorageAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).StorageAccountId = (string) content.GetValueForProperty("StorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).StorageAccountId, global::System.Convert.ToString); + } + if (content.Contains("TargetVMName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).TargetVMName = (string) content.GetValueForProperty("TargetVMName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).TargetVMName, global::System.Convert.ToString); + } + if (content.Contains("TargetVMSize")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).TargetVMSize = (string) content.GetValueForProperty("TargetVMSize",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).TargetVMSize, global::System.Convert.ToString); + } + if (content.Contains("TargetResourceGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).TargetResourceGroupId = (string) content.GetValueForProperty("TargetResourceGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).TargetResourceGroupId, global::System.Convert.ToString); + } + if (content.Contains("TargetLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).TargetLocation = (string) content.GetValueForProperty("TargetLocation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).TargetLocation, global::System.Convert.ToString); + } + if (content.Contains("TargetAvailabilitySetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).TargetAvailabilitySetId = (string) content.GetValueForProperty("TargetAvailabilitySetId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).TargetAvailabilitySetId, global::System.Convert.ToString); + } + if (content.Contains("TargetAvailabilityZone")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).TargetAvailabilityZone = (string) content.GetValueForProperty("TargetAvailabilityZone",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).TargetAvailabilityZone, global::System.Convert.ToString); + } + if (content.Contains("TargetProximityPlacementGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).TargetProximityPlacementGroupId = (string) content.GetValueForProperty("TargetProximityPlacementGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).TargetProximityPlacementGroupId, global::System.Convert.ToString); + } + if (content.Contains("TargetBootDiagnosticsStorageAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).TargetBootDiagnosticsStorageAccountId = (string) content.GetValueForProperty("TargetBootDiagnosticsStorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).TargetBootDiagnosticsStorageAccountId, global::System.Convert.ToString); + } + if (content.Contains("TargetNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).TargetNetworkId = (string) content.GetValueForProperty("TargetNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).TargetNetworkId, global::System.Convert.ToString); + } + if (content.Contains("TestNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).TestNetworkId = (string) content.GetValueForProperty("TestNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).TestNetworkId, global::System.Convert.ToString); + } + if (content.Contains("FailoverRecoveryPointId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).FailoverRecoveryPointId = (string) content.GetValueForProperty("FailoverRecoveryPointId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).FailoverRecoveryPointId, global::System.Convert.ToString); + } + if (content.Contains("LastRecoveryPointReceived")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).LastRecoveryPointReceived = (global::System.DateTime?) content.GetValueForProperty("LastRecoveryPointReceived",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).LastRecoveryPointReceived, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("LastRpoInSecond")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).LastRpoInSecond = (long?) content.GetValueForProperty("LastRpoInSecond",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).LastRpoInSecond, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("LastRpoCalculatedTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).LastRpoCalculatedTime = (global::System.DateTime?) content.GetValueForProperty("LastRpoCalculatedTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).LastRpoCalculatedTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("LastRecoveryPointId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).LastRecoveryPointId = (string) content.GetValueForProperty("LastRecoveryPointId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).LastRecoveryPointId, global::System.Convert.ToString); + } + if (content.Contains("InitialReplicationProgressPercentage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).InitialReplicationProgressPercentage = (int?) content.GetValueForProperty("InitialReplicationProgressPercentage",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).InitialReplicationProgressPercentage, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("InitialReplicationProcessedByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).InitialReplicationProcessedByte = (long?) content.GetValueForProperty("InitialReplicationProcessedByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).InitialReplicationProcessedByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("InitialReplicationTransferredByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).InitialReplicationTransferredByte = (long?) content.GetValueForProperty("InitialReplicationTransferredByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).InitialReplicationTransferredByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("InitialReplicationProgressHealth")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).InitialReplicationProgressHealth = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.VMReplicationProgressHealth?) content.GetValueForProperty("InitialReplicationProgressHealth",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).InitialReplicationProgressHealth, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.VMReplicationProgressHealth.CreateFrom); + } + if (content.Contains("ResyncProgressPercentage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).ResyncProgressPercentage = (int?) content.GetValueForProperty("ResyncProgressPercentage",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).ResyncProgressPercentage, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("ResyncProcessedByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).ResyncProcessedByte = (long?) content.GetValueForProperty("ResyncProcessedByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).ResyncProcessedByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("ResyncTransferredByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).ResyncTransferredByte = (long?) content.GetValueForProperty("ResyncTransferredByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).ResyncTransferredByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("ResyncProgressHealth")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).ResyncProgressHealth = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.VMReplicationProgressHealth?) content.GetValueForProperty("ResyncProgressHealth",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).ResyncProgressHealth, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.VMReplicationProgressHealth.CreateFrom); + } + if (content.Contains("ResyncRequired")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).ResyncRequired = (string) content.GetValueForProperty("ResyncRequired",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).ResyncRequired, global::System.Convert.ToString); + } + if (content.Contains("ResyncState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).ResyncState = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ResyncState?) content.GetValueForProperty("ResyncState",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).ResyncState, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ResyncState.CreateFrom); + } + if (content.Contains("AgentUpgradeState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).AgentUpgradeState = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MobilityAgentUpgradeState?) content.GetValueForProperty("AgentUpgradeState",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).AgentUpgradeState, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MobilityAgentUpgradeState.CreateFrom); + } + if (content.Contains("LastAgentUpgradeType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).LastAgentUpgradeType = (string) content.GetValueForProperty("LastAgentUpgradeType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).LastAgentUpgradeType, global::System.Convert.ToString); + } + if (content.Contains("AgentUpgradeJobId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).AgentUpgradeJobId = (string) content.GetValueForProperty("AgentUpgradeJobId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).AgentUpgradeJobId, global::System.Convert.ToString); + } + if (content.Contains("AgentUpgradeAttemptToVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).AgentUpgradeAttemptToVersion = (string) content.GetValueForProperty("AgentUpgradeAttemptToVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).AgentUpgradeAttemptToVersion, global::System.Convert.ToString); + } + if (content.Contains("ProtectedDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).ProtectedDisk = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetails[]) content.GetValueForProperty("ProtectedDisk",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).ProtectedDisk, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmProtectedDiskDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("IsLastUpgradeSuccessful")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).IsLastUpgradeSuccessful = (string) content.GetValueForProperty("IsLastUpgradeSuccessful",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).IsLastUpgradeSuccessful, global::System.Convert.ToString); + } + if (content.Contains("IsAgentRegistrationSuccessfulAfterFailover")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).IsAgentRegistrationSuccessfulAfterFailover = (bool?) content.GetValueForProperty("IsAgentRegistrationSuccessfulAfterFailover",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).IsAgentRegistrationSuccessfulAfterFailover, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("LastAgentUpgradeErrorDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).LastAgentUpgradeErrorDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmLastAgentUpgradeErrorDetails[]) content.GetValueForProperty("LastAgentUpgradeErrorDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).LastAgentUpgradeErrorDetail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmLastAgentUpgradeErrorDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("AgentUpgradeBlockingErrorDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).AgentUpgradeBlockingErrorDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmAgentUpgradeBlockingErrorDetails[]) content.GetValueForProperty("AgentUpgradeBlockingErrorDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).AgentUpgradeBlockingErrorDetail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmAgentUpgradeBlockingErrorDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("VMNic")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).VMNic = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicDetails[]) content.GetValueForProperty("VMNic",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).VMNic, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmNicDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettingsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettingsInternal)this).InstanceType, global::System.Convert.ToString); + } + if (content.Contains("MobilityAgentDetailVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).MobilityAgentDetailVersion = (string) content.GetValueForProperty("MobilityAgentDetailVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).MobilityAgentDetailVersion, global::System.Convert.ToString); + } + if (content.Contains("MobilityAgentDetailLatestVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).MobilityAgentDetailLatestVersion = (string) content.GetValueForProperty("MobilityAgentDetailLatestVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).MobilityAgentDetailLatestVersion, global::System.Convert.ToString); + } + if (content.Contains("MobilityAgentDetailLatestAgentReleaseDate")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).MobilityAgentDetailLatestAgentReleaseDate = (string) content.GetValueForProperty("MobilityAgentDetailLatestAgentReleaseDate",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).MobilityAgentDetailLatestAgentReleaseDate, global::System.Convert.ToString); + } + if (content.Contains("MobilityAgentDetailDriverVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).MobilityAgentDetailDriverVersion = (string) content.GetValueForProperty("MobilityAgentDetailDriverVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).MobilityAgentDetailDriverVersion, global::System.Convert.ToString); + } + if (content.Contains("MobilityAgentDetailLatestUpgradableVersionWithoutReboot")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).MobilityAgentDetailLatestUpgradableVersionWithoutReboot = (string) content.GetValueForProperty("MobilityAgentDetailLatestUpgradableVersionWithoutReboot",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).MobilityAgentDetailLatestUpgradableVersionWithoutReboot, global::System.Convert.ToString); + } + if (content.Contains("MobilityAgentDetailAgentVersionExpiryDate")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).MobilityAgentDetailAgentVersionExpiryDate = (global::System.DateTime?) content.GetValueForProperty("MobilityAgentDetailAgentVersionExpiryDate",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).MobilityAgentDetailAgentVersionExpiryDate, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("MobilityAgentDetailDriverVersionExpiryDate")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).MobilityAgentDetailDriverVersionExpiryDate = (global::System.DateTime?) content.GetValueForProperty("MobilityAgentDetailDriverVersionExpiryDate",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).MobilityAgentDetailDriverVersionExpiryDate, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("MobilityAgentDetailLastHeartbeatUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).MobilityAgentDetailLastHeartbeatUtc = (global::System.DateTime?) content.GetValueForProperty("MobilityAgentDetailLastHeartbeatUtc",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).MobilityAgentDetailLastHeartbeatUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("MobilityAgentDetailReasonsBlockingUpgrade")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).MobilityAgentDetailReasonsBlockingUpgrade = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentUpgradeBlockedReason[]) content.GetValueForProperty("MobilityAgentDetailReasonsBlockingUpgrade",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).MobilityAgentDetailReasonsBlockingUpgrade, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentUpgradeBlockedReason.CreateFrom)); + } + if (content.Contains("MobilityAgentDetailIsUpgradeable")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).MobilityAgentDetailIsUpgradeable = (string) content.GetValueForProperty("MobilityAgentDetailIsUpgradeable",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).MobilityAgentDetailIsUpgradeable, global::System.Convert.ToString); + } + if (content.Contains("DiscoveredVMDetailVcenterId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).DiscoveredVMDetailVcenterId = (string) content.GetValueForProperty("DiscoveredVMDetailVcenterId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).DiscoveredVMDetailVcenterId, global::System.Convert.ToString); + } + if (content.Contains("DiscoveredVMDetailVcenterFqdn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).DiscoveredVMDetailVcenterFqdn = (string) content.GetValueForProperty("DiscoveredVMDetailVcenterFqdn",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).DiscoveredVMDetailVcenterFqdn, global::System.Convert.ToString); + } + if (content.Contains("DiscoveredVMDetailDatastore")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).DiscoveredVMDetailDatastore = (string[]) content.GetValueForProperty("DiscoveredVMDetailDatastore",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).DiscoveredVMDetailDatastore, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("DiscoveredVMDetailIpaddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).DiscoveredVMDetailIpaddress = (string[]) content.GetValueForProperty("DiscoveredVMDetailIpaddress",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).DiscoveredVMDetailIpaddress, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("DiscoveredVMDetailVmwareToolsStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).DiscoveredVMDetailVmwareToolsStatus = (string) content.GetValueForProperty("DiscoveredVMDetailVmwareToolsStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).DiscoveredVMDetailVmwareToolsStatus, global::System.Convert.ToString); + } + if (content.Contains("DiscoveredVMDetailPowerStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).DiscoveredVMDetailPowerStatus = (string) content.GetValueForProperty("DiscoveredVMDetailPowerStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).DiscoveredVMDetailPowerStatus, global::System.Convert.ToString); + } + if (content.Contains("DiscoveredVMDetailVmfqdn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).DiscoveredVMDetailVmfqdn = (string) content.GetValueForProperty("DiscoveredVMDetailVmfqdn",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).DiscoveredVMDetailVmfqdn, global::System.Convert.ToString); + } + if (content.Contains("DiscoveredVMDetailOsname")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).DiscoveredVMDetailOsname = (string) content.GetValueForProperty("DiscoveredVMDetailOsname",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).DiscoveredVMDetailOsname, global::System.Convert.ToString); + } + if (content.Contains("DiscoveredVMDetailCreatedTimestamp")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).DiscoveredVMDetailCreatedTimestamp = (global::System.DateTime?) content.GetValueForProperty("DiscoveredVMDetailCreatedTimestamp",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).DiscoveredVMDetailCreatedTimestamp, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("DiscoveredVMDetailUpdatedTimestamp")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).DiscoveredVMDetailUpdatedTimestamp = (global::System.DateTime?) content.GetValueForProperty("DiscoveredVMDetailUpdatedTimestamp",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).DiscoveredVMDetailUpdatedTimestamp, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("DiscoveredVMDetailIsDeleted")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).DiscoveredVMDetailIsDeleted = (bool?) content.GetValueForProperty("DiscoveredVMDetailIsDeleted",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).DiscoveredVMDetailIsDeleted, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("DiscoveredVMDetailLastDiscoveryTimeInUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).DiscoveredVMDetailLastDiscoveryTimeInUtc = (global::System.DateTime?) content.GetValueForProperty("DiscoveredVMDetailLastDiscoveryTimeInUtc",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal)this).DiscoveredVMDetailLastDiscoveryTimeInUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// InMageRcm provider specific details. + [System.ComponentModel.TypeConverter(typeof(InMageRcmReplicationDetailsTypeConverter))] + public partial interface IInMageRcmReplicationDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmReplicationDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmReplicationDetails.TypeConverter.cs new file mode 100644 index 000000000000..49a4992ba640 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmReplicationDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InMageRcmReplicationDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InMageRcmReplicationDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InMageRcmReplicationDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InMageRcmReplicationDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmReplicationDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmReplicationDetails.cs new file mode 100644 index 000000000000..538a9ed3a941 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmReplicationDetails.cs @@ -0,0 +1,1465 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMageRcm provider specific details. + public partial class InMageRcmReplicationDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettings __replicationProviderSpecificSettings = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProviderSpecificSettings(); + + /// Backing field for property. + private string _agentUpgradeAttemptToVersion; + + /// The agent version to which last agent upgrade was attempted. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string AgentUpgradeAttemptToVersion { get => this._agentUpgradeAttemptToVersion; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmAgentUpgradeBlockingErrorDetails[] _agentUpgradeBlockingErrorDetail; + + /// The agent upgrade blocking error information. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmAgentUpgradeBlockingErrorDetails[] AgentUpgradeBlockingErrorDetail { get => this._agentUpgradeBlockingErrorDetail; set => this._agentUpgradeBlockingErrorDetail = value; } + + /// Backing field for property. + private string _agentUpgradeJobId; + + /// The agent upgrade job Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string AgentUpgradeJobId { get => this._agentUpgradeJobId; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MobilityAgentUpgradeState? _agentUpgradeState; + + /// The agent auto upgrade state. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MobilityAgentUpgradeState? AgentUpgradeState { get => this._agentUpgradeState; } + + /// Backing field for property. + private double? _allocatedMemoryInMb; + + /// The allocated memory in MB. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public double? AllocatedMemoryInMb { get => this._allocatedMemoryInMb; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetails _discoveredVMDetail; + + /// The discovered VM details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetails DiscoveredVMDetail { get => (this._discoveredVMDetail = this._discoveredVMDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmDiscoveredProtectedVMDetails()); set => this._discoveredVMDetail = value; } + + /// The SDS created timestamp. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public global::System.DateTime? DiscoveredVMDetailCreatedTimestamp { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetailsInternal)DiscoveredVMDetail).CreatedTimestamp; } + + /// The list of datastores. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string[] DiscoveredVMDetailDatastore { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetailsInternal)DiscoveredVMDetail).Datastore; } + + /// The list of IP addresses. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string[] DiscoveredVMDetailIpaddress { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetailsInternal)DiscoveredVMDetail).IPAddress; } + + /// A value indicating whether the VM is deleted. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public bool? DiscoveredVMDetailIsDeleted { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetailsInternal)DiscoveredVMDetail).IsDeleted; } + + /// The last time when SDS information discovered in SRS. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public global::System.DateTime? DiscoveredVMDetailLastDiscoveryTimeInUtc { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetailsInternal)DiscoveredVMDetail).LastDiscoveryTimeInUtc; } + + /// The VM's OS name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string DiscoveredVMDetailOsname { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetailsInternal)DiscoveredVMDetail).OSName; } + + /// The VM power status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string DiscoveredVMDetailPowerStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetailsInternal)DiscoveredVMDetail).PowerStatus; } + + /// The SDS updated timestamp. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public global::System.DateTime? DiscoveredVMDetailUpdatedTimestamp { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetailsInternal)DiscoveredVMDetail).UpdatedTimestamp; } + + /// The VCenter fqdn. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string DiscoveredVMDetailVcenterFqdn { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetailsInternal)DiscoveredVMDetail).VCenterFqdn; } + + /// The VCenter Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string DiscoveredVMDetailVcenterId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetailsInternal)DiscoveredVMDetail).VCenterId; } + + /// The VM fqdn. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string DiscoveredVMDetailVmfqdn { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetailsInternal)DiscoveredVMDetail).VMFqdn; } + + /// The VMware tools status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string DiscoveredVMDetailVmwareToolsStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetailsInternal)DiscoveredVMDetail).VmwareToolsStatus; } + + /// Backing field for property. + private string _discoveryType; + + /// The type of the discovered VM. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string DiscoveryType { get => this._discoveryType; } + + /// Backing field for property. + private string _fabricDiscoveryMachineId; + + /// The ARM Id of the discovered VM. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string FabricDiscoveryMachineId { get => this._fabricDiscoveryMachineId; } + + /// Backing field for property. + private string _failoverRecoveryPointId; + + /// The recovery point Id to which the VM was failed over. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string FailoverRecoveryPointId { get => this._failoverRecoveryPointId; } + + /// Backing field for property. + private string _firmwareType; + + /// The firmware type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string FirmwareType { get => this._firmwareType; } + + /// Backing field for property. + private long? _initialReplicationProcessedByte; + + /// + /// The initial replication processed bytes. This includes sum of total bytes transferred and matched bytes on all selected + /// disks in source VM. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public long? InitialReplicationProcessedByte { get => this._initialReplicationProcessedByte; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.VMReplicationProgressHealth? _initialReplicationProgressHealth; + + /// The initial replication progress health. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.VMReplicationProgressHealth? InitialReplicationProgressHealth { get => this._initialReplicationProgressHealth; } + + /// Backing field for property. + private int? _initialReplicationProgressPercentage; + + /// + /// The initial replication progress percentage. This is calculated based on total bytes processed for all disks in the source + /// VM. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? InitialReplicationProgressPercentage { get => this._initialReplicationProgressPercentage; } + + /// Backing field for property. + private long? _initialReplicationTransferredByte; + + /// + /// The initial replication transferred bytes from source VM to azure for all selected disks on source VM. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public long? InitialReplicationTransferredByte { get => this._initialReplicationTransferredByte; } + + /// Gets the Instance type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettingsInternal)__replicationProviderSpecificSettings).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettingsInternal)__replicationProviderSpecificSettings).InstanceType = value ; } + + /// Backing field for property. + private string _internalIdentifier; + + /// The virtual machine internal identifier. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string InternalIdentifier { get => this._internalIdentifier; } + + /// + /// Backing field for property. + /// + private bool? _isAgentRegistrationSuccessfulAfterFailover; + + /// A value indicating whether agent registration was successful after failover. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public bool? IsAgentRegistrationSuccessfulAfterFailover { get => this._isAgentRegistrationSuccessfulAfterFailover; } + + /// Backing field for property. + private string _isLastUpgradeSuccessful; + + /// A value indicating whether last agent upgrade was successful or not. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string IsLastUpgradeSuccessful { get => this._isLastUpgradeSuccessful; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmLastAgentUpgradeErrorDetails[] _lastAgentUpgradeErrorDetail; + + /// The last agent upgrade error information. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmLastAgentUpgradeErrorDetails[] LastAgentUpgradeErrorDetail { get => this._lastAgentUpgradeErrorDetail; set => this._lastAgentUpgradeErrorDetail = value; } + + /// Backing field for property. + private string _lastAgentUpgradeType; + + /// The last agent upgrade type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string LastAgentUpgradeType { get => this._lastAgentUpgradeType; } + + /// Backing field for property. + private string _lastRecoveryPointId; + + /// The last recovery point Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string LastRecoveryPointId { get => this._lastRecoveryPointId; } + + /// Backing field for property. + private global::System.DateTime? _lastRecoveryPointReceived; + + /// The last recovery point received time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public global::System.DateTime? LastRecoveryPointReceived { get => this._lastRecoveryPointReceived; } + + /// Backing field for property. + private global::System.DateTime? _lastRpoCalculatedTime; + + /// The last recovery point objective calculated time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public global::System.DateTime? LastRpoCalculatedTime { get => this._lastRpoCalculatedTime; } + + /// Backing field for property. + private long? _lastRpoInSecond; + + /// The last recovery point objective value. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public long? LastRpoInSecond { get => this._lastRpoInSecond; } + + /// Backing field for property. + private string _licenseType; + + /// License Type of the VM to be used. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string LicenseType { get => this._licenseType; set => this._licenseType = value; } + + /// Internal Acessors for AgentUpgradeAttemptToVersion + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal.AgentUpgradeAttemptToVersion { get => this._agentUpgradeAttemptToVersion; set { {_agentUpgradeAttemptToVersion = value;} } } + + /// Internal Acessors for AgentUpgradeJobId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal.AgentUpgradeJobId { get => this._agentUpgradeJobId; set { {_agentUpgradeJobId = value;} } } + + /// Internal Acessors for AgentUpgradeState + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MobilityAgentUpgradeState? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal.AgentUpgradeState { get => this._agentUpgradeState; set { {_agentUpgradeState = value;} } } + + /// Internal Acessors for AllocatedMemoryInMb + double? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal.AllocatedMemoryInMb { get => this._allocatedMemoryInMb; set { {_allocatedMemoryInMb = value;} } } + + /// Internal Acessors for DiscoveredVMDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetails Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal.DiscoveredVMDetail { get => (this._discoveredVMDetail = this._discoveredVMDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmDiscoveredProtectedVMDetails()); set { {_discoveredVMDetail = value;} } } + + /// Internal Acessors for DiscoveredVMDetailCreatedTimestamp + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal.DiscoveredVMDetailCreatedTimestamp { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetailsInternal)DiscoveredVMDetail).CreatedTimestamp; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetailsInternal)DiscoveredVMDetail).CreatedTimestamp = value; } + + /// Internal Acessors for DiscoveredVMDetailDatastore + string[] Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal.DiscoveredVMDetailDatastore { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetailsInternal)DiscoveredVMDetail).Datastore; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetailsInternal)DiscoveredVMDetail).Datastore = value; } + + /// Internal Acessors for DiscoveredVMDetailIpaddress + string[] Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal.DiscoveredVMDetailIpaddress { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetailsInternal)DiscoveredVMDetail).IPAddress; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetailsInternal)DiscoveredVMDetail).IPAddress = value; } + + /// Internal Acessors for DiscoveredVMDetailIsDeleted + bool? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal.DiscoveredVMDetailIsDeleted { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetailsInternal)DiscoveredVMDetail).IsDeleted; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetailsInternal)DiscoveredVMDetail).IsDeleted = value; } + + /// Internal Acessors for DiscoveredVMDetailLastDiscoveryTimeInUtc + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal.DiscoveredVMDetailLastDiscoveryTimeInUtc { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetailsInternal)DiscoveredVMDetail).LastDiscoveryTimeInUtc; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetailsInternal)DiscoveredVMDetail).LastDiscoveryTimeInUtc = value; } + + /// Internal Acessors for DiscoveredVMDetailOsname + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal.DiscoveredVMDetailOsname { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetailsInternal)DiscoveredVMDetail).OSName; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetailsInternal)DiscoveredVMDetail).OSName = value; } + + /// Internal Acessors for DiscoveredVMDetailPowerStatus + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal.DiscoveredVMDetailPowerStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetailsInternal)DiscoveredVMDetail).PowerStatus; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetailsInternal)DiscoveredVMDetail).PowerStatus = value; } + + /// Internal Acessors for DiscoveredVMDetailUpdatedTimestamp + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal.DiscoveredVMDetailUpdatedTimestamp { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetailsInternal)DiscoveredVMDetail).UpdatedTimestamp; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetailsInternal)DiscoveredVMDetail).UpdatedTimestamp = value; } + + /// Internal Acessors for DiscoveredVMDetailVcenterFqdn + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal.DiscoveredVMDetailVcenterFqdn { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetailsInternal)DiscoveredVMDetail).VCenterFqdn; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetailsInternal)DiscoveredVMDetail).VCenterFqdn = value; } + + /// Internal Acessors for DiscoveredVMDetailVcenterId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal.DiscoveredVMDetailVcenterId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetailsInternal)DiscoveredVMDetail).VCenterId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetailsInternal)DiscoveredVMDetail).VCenterId = value; } + + /// Internal Acessors for DiscoveredVMDetailVmfqdn + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal.DiscoveredVMDetailVmfqdn { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetailsInternal)DiscoveredVMDetail).VMFqdn; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetailsInternal)DiscoveredVMDetail).VMFqdn = value; } + + /// Internal Acessors for DiscoveredVMDetailVmwareToolsStatus + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal.DiscoveredVMDetailVmwareToolsStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetailsInternal)DiscoveredVMDetail).VmwareToolsStatus; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetailsInternal)DiscoveredVMDetail).VmwareToolsStatus = value; } + + /// Internal Acessors for DiscoveryType + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal.DiscoveryType { get => this._discoveryType; set { {_discoveryType = value;} } } + + /// Internal Acessors for FabricDiscoveryMachineId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal.FabricDiscoveryMachineId { get => this._fabricDiscoveryMachineId; set { {_fabricDiscoveryMachineId = value;} } } + + /// Internal Acessors for FailoverRecoveryPointId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal.FailoverRecoveryPointId { get => this._failoverRecoveryPointId; set { {_failoverRecoveryPointId = value;} } } + + /// Internal Acessors for FirmwareType + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal.FirmwareType { get => this._firmwareType; set { {_firmwareType = value;} } } + + /// Internal Acessors for InitialReplicationProcessedByte + long? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal.InitialReplicationProcessedByte { get => this._initialReplicationProcessedByte; set { {_initialReplicationProcessedByte = value;} } } + + /// Internal Acessors for InitialReplicationProgressHealth + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.VMReplicationProgressHealth? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal.InitialReplicationProgressHealth { get => this._initialReplicationProgressHealth; set { {_initialReplicationProgressHealth = value;} } } + + /// Internal Acessors for InitialReplicationProgressPercentage + int? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal.InitialReplicationProgressPercentage { get => this._initialReplicationProgressPercentage; set { {_initialReplicationProgressPercentage = value;} } } + + /// Internal Acessors for InitialReplicationTransferredByte + long? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal.InitialReplicationTransferredByte { get => this._initialReplicationTransferredByte; set { {_initialReplicationTransferredByte = value;} } } + + /// Internal Acessors for InternalIdentifier + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal.InternalIdentifier { get => this._internalIdentifier; set { {_internalIdentifier = value;} } } + + /// Internal Acessors for IsAgentRegistrationSuccessfulAfterFailover + bool? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal.IsAgentRegistrationSuccessfulAfterFailover { get => this._isAgentRegistrationSuccessfulAfterFailover; set { {_isAgentRegistrationSuccessfulAfterFailover = value;} } } + + /// Internal Acessors for IsLastUpgradeSuccessful + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal.IsLastUpgradeSuccessful { get => this._isLastUpgradeSuccessful; set { {_isLastUpgradeSuccessful = value;} } } + + /// Internal Acessors for LastAgentUpgradeType + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal.LastAgentUpgradeType { get => this._lastAgentUpgradeType; set { {_lastAgentUpgradeType = value;} } } + + /// Internal Acessors for LastRecoveryPointId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal.LastRecoveryPointId { get => this._lastRecoveryPointId; set { {_lastRecoveryPointId = value;} } } + + /// Internal Acessors for LastRecoveryPointReceived + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal.LastRecoveryPointReceived { get => this._lastRecoveryPointReceived; set { {_lastRecoveryPointReceived = value;} } } + + /// Internal Acessors for LastRpoCalculatedTime + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal.LastRpoCalculatedTime { get => this._lastRpoCalculatedTime; set { {_lastRpoCalculatedTime = value;} } } + + /// Internal Acessors for LastRpoInSecond + long? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal.LastRpoInSecond { get => this._lastRpoInSecond; set { {_lastRpoInSecond = value;} } } + + /// Internal Acessors for MobilityAgentDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmMobilityAgentDetails Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal.MobilityAgentDetail { get => (this._mobilityAgentDetail = this._mobilityAgentDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmMobilityAgentDetails()); set { {_mobilityAgentDetail = value;} } } + + /// Internal Acessors for MobilityAgentDetailAgentVersionExpiryDate + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal.MobilityAgentDetailAgentVersionExpiryDate { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmMobilityAgentDetailsInternal)MobilityAgentDetail).AgentVersionExpiryDate; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmMobilityAgentDetailsInternal)MobilityAgentDetail).AgentVersionExpiryDate = value; } + + /// Internal Acessors for MobilityAgentDetailDriverVersion + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal.MobilityAgentDetailDriverVersion { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmMobilityAgentDetailsInternal)MobilityAgentDetail).DriverVersion; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmMobilityAgentDetailsInternal)MobilityAgentDetail).DriverVersion = value; } + + /// Internal Acessors for MobilityAgentDetailDriverVersionExpiryDate + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal.MobilityAgentDetailDriverVersionExpiryDate { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmMobilityAgentDetailsInternal)MobilityAgentDetail).DriverVersionExpiryDate; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmMobilityAgentDetailsInternal)MobilityAgentDetail).DriverVersionExpiryDate = value; } + + /// Internal Acessors for MobilityAgentDetailIsUpgradeable + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal.MobilityAgentDetailIsUpgradeable { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmMobilityAgentDetailsInternal)MobilityAgentDetail).IsUpgradeable; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmMobilityAgentDetailsInternal)MobilityAgentDetail).IsUpgradeable = value; } + + /// Internal Acessors for MobilityAgentDetailLastHeartbeatUtc + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal.MobilityAgentDetailLastHeartbeatUtc { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmMobilityAgentDetailsInternal)MobilityAgentDetail).LastHeartbeatUtc; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmMobilityAgentDetailsInternal)MobilityAgentDetail).LastHeartbeatUtc = value; } + + /// Internal Acessors for MobilityAgentDetailLatestAgentReleaseDate + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal.MobilityAgentDetailLatestAgentReleaseDate { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmMobilityAgentDetailsInternal)MobilityAgentDetail).LatestAgentReleaseDate; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmMobilityAgentDetailsInternal)MobilityAgentDetail).LatestAgentReleaseDate = value; } + + /// Internal Acessors for MobilityAgentDetailLatestUpgradableVersionWithoutReboot + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal.MobilityAgentDetailLatestUpgradableVersionWithoutReboot { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmMobilityAgentDetailsInternal)MobilityAgentDetail).LatestUpgradableVersionWithoutReboot; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmMobilityAgentDetailsInternal)MobilityAgentDetail).LatestUpgradableVersionWithoutReboot = value; } + + /// Internal Acessors for MobilityAgentDetailLatestVersion + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal.MobilityAgentDetailLatestVersion { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmMobilityAgentDetailsInternal)MobilityAgentDetail).LatestVersion; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmMobilityAgentDetailsInternal)MobilityAgentDetail).LatestVersion = value; } + + /// Internal Acessors for MobilityAgentDetailReasonsBlockingUpgrade + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentUpgradeBlockedReason[] Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal.MobilityAgentDetailReasonsBlockingUpgrade { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmMobilityAgentDetailsInternal)MobilityAgentDetail).ReasonsBlockingUpgrade; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmMobilityAgentDetailsInternal)MobilityAgentDetail).ReasonsBlockingUpgrade = value; } + + /// Internal Acessors for MobilityAgentDetailVersion + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal.MobilityAgentDetailVersion { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmMobilityAgentDetailsInternal)MobilityAgentDetail).Version; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmMobilityAgentDetailsInternal)MobilityAgentDetail).Version = value; } + + /// Internal Acessors for MultiVMGroupName + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal.MultiVMGroupName { get => this._multiVMGroupName; set { {_multiVMGroupName = value;} } } + + /// Internal Acessors for OSType + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal.OSType { get => this._oSType; set { {_oSType = value;} } } + + /// Internal Acessors for PrimaryNicIPAddress + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal.PrimaryNicIPAddress { get => this._primaryNicIPAddress; set { {_primaryNicIPAddress = value;} } } + + /// Internal Acessors for ProcessServerId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal.ProcessServerId { get => this._processServerId; set { {_processServerId = value;} } } + + /// Internal Acessors for ProcessServerName + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal.ProcessServerName { get => this._processServerName; set { {_processServerName = value;} } } + + /// Internal Acessors for ProcessorCoreCount + int? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal.ProcessorCoreCount { get => this._processorCoreCount; set { {_processorCoreCount = value;} } } + + /// Internal Acessors for ResyncProcessedByte + long? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal.ResyncProcessedByte { get => this._resyncProcessedByte; set { {_resyncProcessedByte = value;} } } + + /// Internal Acessors for ResyncProgressHealth + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.VMReplicationProgressHealth? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal.ResyncProgressHealth { get => this._resyncProgressHealth; set { {_resyncProgressHealth = value;} } } + + /// Internal Acessors for ResyncProgressPercentage + int? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal.ResyncProgressPercentage { get => this._resyncProgressPercentage; set { {_resyncProgressPercentage = value;} } } + + /// Internal Acessors for ResyncRequired + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal.ResyncRequired { get => this._resyncRequired; set { {_resyncRequired = value;} } } + + /// Internal Acessors for ResyncState + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ResyncState? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal.ResyncState { get => this._resyncState; set { {_resyncState = value;} } } + + /// Internal Acessors for ResyncTransferredByte + long? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal.ResyncTransferredByte { get => this._resyncTransferredByte; set { {_resyncTransferredByte = value;} } } + + /// Internal Acessors for RunAsAccountId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal.RunAsAccountId { get => this._runAsAccountId; set { {_runAsAccountId = value;} } } + + /// Internal Acessors for StorageAccountId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal.StorageAccountId { get => this._storageAccountId; set { {_storageAccountId = value;} } } + + /// Internal Acessors for TargetGeneration + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetailsInternal.TargetGeneration { get => this._targetGeneration; set { {_targetGeneration = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmMobilityAgentDetails _mobilityAgentDetail; + + /// The mobility agent information. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmMobilityAgentDetails MobilityAgentDetail { get => (this._mobilityAgentDetail = this._mobilityAgentDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmMobilityAgentDetails()); set => this._mobilityAgentDetail = value; } + + /// The agent version expiry date. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public global::System.DateTime? MobilityAgentDetailAgentVersionExpiryDate { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmMobilityAgentDetailsInternal)MobilityAgentDetail).AgentVersionExpiryDate; } + + /// The driver version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string MobilityAgentDetailDriverVersion { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmMobilityAgentDetailsInternal)MobilityAgentDetail).DriverVersion; } + + /// The driver version expiry date. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public global::System.DateTime? MobilityAgentDetailDriverVersionExpiryDate { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmMobilityAgentDetailsInternal)MobilityAgentDetail).DriverVersionExpiryDate; } + + /// A value indicating whether agent is upgradeable or not. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string MobilityAgentDetailIsUpgradeable { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmMobilityAgentDetailsInternal)MobilityAgentDetail).IsUpgradeable; } + + /// The time of the last heartbeat received from the agent. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public global::System.DateTime? MobilityAgentDetailLastHeartbeatUtc { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmMobilityAgentDetailsInternal)MobilityAgentDetail).LastHeartbeatUtc; } + + /// The latest agent version release date. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string MobilityAgentDetailLatestAgentReleaseDate { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmMobilityAgentDetailsInternal)MobilityAgentDetail).LatestAgentReleaseDate; } + + /// The latest upgradeable version available without reboot. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string MobilityAgentDetailLatestUpgradableVersionWithoutReboot { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmMobilityAgentDetailsInternal)MobilityAgentDetail).LatestUpgradableVersionWithoutReboot; } + + /// The latest agent version available. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string MobilityAgentDetailLatestVersion { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmMobilityAgentDetailsInternal)MobilityAgentDetail).LatestVersion; } + + /// The whether update is possible or not. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentUpgradeBlockedReason[] MobilityAgentDetailReasonsBlockingUpgrade { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmMobilityAgentDetailsInternal)MobilityAgentDetail).ReasonsBlockingUpgrade; } + + /// The agent version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string MobilityAgentDetailVersion { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmMobilityAgentDetailsInternal)MobilityAgentDetail).Version; } + + /// Backing field for property. + private string _multiVMGroupName; + + /// The multi VM group name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string MultiVMGroupName { get => this._multiVMGroupName; } + + /// Backing field for property. + private string _oSType; + + /// The type of the OS on the VM. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string OSType { get => this._oSType; } + + /// Backing field for property. + private string _primaryNicIPAddress; + + /// The IP address of the primary network interface. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string PrimaryNicIPAddress { get => this._primaryNicIPAddress; } + + /// Backing field for property. + private string _processServerId; + + /// The process server Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ProcessServerId { get => this._processServerId; } + + /// Backing field for property. + private string _processServerName; + + /// The process server name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ProcessServerName { get => this._processServerName; } + + /// Backing field for property. + private int? _processorCoreCount; + + /// The processor core count. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? ProcessorCoreCount { get => this._processorCoreCount; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetails[] _protectedDisk; + + /// The list of protected disks. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetails[] ProtectedDisk { get => this._protectedDisk; set => this._protectedDisk = value; } + + /// Backing field for property. + private long? _resyncProcessedByte; + + /// + /// The resync processed bytes. This includes sum of total bytes transferred and matched bytes on all selected disks in source + /// VM. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public long? ResyncProcessedByte { get => this._resyncProcessedByte; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.VMReplicationProgressHealth? _resyncProgressHealth; + + /// The resync progress health. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.VMReplicationProgressHealth? ResyncProgressHealth { get => this._resyncProgressHealth; } + + /// Backing field for property. + private int? _resyncProgressPercentage; + + /// + /// The resync progress percentage. This is calculated based on total bytes processed for all disks in the source VM. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? ResyncProgressPercentage { get => this._resyncProgressPercentage; } + + /// Backing field for property. + private string _resyncRequired; + + /// A value indicating whether resync is required. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ResyncRequired { get => this._resyncRequired; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ResyncState? _resyncState; + + /// The resync state. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ResyncState? ResyncState { get => this._resyncState; } + + /// Backing field for property. + private long? _resyncTransferredByte; + + /// + /// The resync transferred bytes from source VM to azure for all selected disks on source VM. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public long? ResyncTransferredByte { get => this._resyncTransferredByte; } + + /// Backing field for property. + private string _runAsAccountId; + + /// The run-as account Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RunAsAccountId { get => this._runAsAccountId; } + + /// Backing field for property. + private string _storageAccountId; + + /// + /// The replication storage account ARM Id. This is applicable only for the blob based replication test hook. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string StorageAccountId { get => this._storageAccountId; } + + /// Backing field for property. + private string _targetAvailabilitySetId; + + /// The target availability set Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetAvailabilitySetId { get => this._targetAvailabilitySetId; set => this._targetAvailabilitySetId = value; } + + /// Backing field for property. + private string _targetAvailabilityZone; + + /// The target availability zone. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetAvailabilityZone { get => this._targetAvailabilityZone; set => this._targetAvailabilityZone = value; } + + /// + /// Backing field for property. + /// + private string _targetBootDiagnosticsStorageAccountId; + + /// The target boot diagnostics storage account ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetBootDiagnosticsStorageAccountId { get => this._targetBootDiagnosticsStorageAccountId; set => this._targetBootDiagnosticsStorageAccountId = value; } + + /// Backing field for property. + private string _targetGeneration; + + /// The target generation. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetGeneration { get => this._targetGeneration; } + + /// Backing field for property. + private string _targetLocation; + + /// The target location. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetLocation { get => this._targetLocation; set => this._targetLocation = value; } + + /// Backing field for property. + private string _targetNetworkId; + + /// The target network Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetNetworkId { get => this._targetNetworkId; set => this._targetNetworkId = value; } + + /// Backing field for property. + private string _targetProximityPlacementGroupId; + + /// The target proximity placement group Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetProximityPlacementGroupId { get => this._targetProximityPlacementGroupId; set => this._targetProximityPlacementGroupId = value; } + + /// Backing field for property. + private string _targetResourceGroupId; + + /// The target resource group Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetResourceGroupId { get => this._targetResourceGroupId; set => this._targetResourceGroupId = value; } + + /// Backing field for property. + private string _targetVMName; + + /// Target VM name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetVMName { get => this._targetVMName; set => this._targetVMName = value; } + + /// Backing field for property. + private string _targetVMSize; + + /// The target VM size. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetVMSize { get => this._targetVMSize; set => this._targetVMSize = value; } + + /// Backing field for property. + private string _testNetworkId; + + /// The test network Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TestNetworkId { get => this._testNetworkId; set => this._testNetworkId = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicDetails[] _vMNic; + + /// The network details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicDetails[] VMNic { get => this._vMNic; set => this._vMNic = value; } + + /// Creates an new instance. + public InMageRcmReplicationDetails() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__replicationProviderSpecificSettings), __replicationProviderSpecificSettings); + await eventListener.AssertObjectIsValid(nameof(__replicationProviderSpecificSettings), __replicationProviderSpecificSettings); + } + } + /// InMageRcm provider specific details. + public partial interface IInMageRcmReplicationDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettings + { + /// The agent version to which last agent upgrade was attempted. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The agent version to which last agent upgrade was attempted.", + SerializedName = @"agentUpgradeAttemptToVersion", + PossibleTypes = new [] { typeof(string) })] + string AgentUpgradeAttemptToVersion { get; } + /// The agent upgrade blocking error information. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The agent upgrade blocking error information.", + SerializedName = @"agentUpgradeBlockingErrorDetails", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmAgentUpgradeBlockingErrorDetails) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmAgentUpgradeBlockingErrorDetails[] AgentUpgradeBlockingErrorDetail { get; set; } + /// The agent upgrade job Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The agent upgrade job Id.", + SerializedName = @"agentUpgradeJobId", + PossibleTypes = new [] { typeof(string) })] + string AgentUpgradeJobId { get; } + /// The agent auto upgrade state. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The agent auto upgrade state.", + SerializedName = @"agentUpgradeState", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MobilityAgentUpgradeState) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MobilityAgentUpgradeState? AgentUpgradeState { get; } + /// The allocated memory in MB. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The allocated memory in MB.", + SerializedName = @"allocatedMemoryInMB", + PossibleTypes = new [] { typeof(double) })] + double? AllocatedMemoryInMb { get; } + /// The SDS created timestamp. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The SDS created timestamp.", + SerializedName = @"createdTimestamp", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? DiscoveredVMDetailCreatedTimestamp { get; } + /// The list of datastores. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The list of datastores.", + SerializedName = @"datastores", + PossibleTypes = new [] { typeof(string) })] + string[] DiscoveredVMDetailDatastore { get; } + /// The list of IP addresses. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The list of IP addresses.", + SerializedName = @"ipAddresses", + PossibleTypes = new [] { typeof(string) })] + string[] DiscoveredVMDetailIpaddress { get; } + /// A value indicating whether the VM is deleted. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"A value indicating whether the VM is deleted.", + SerializedName = @"isDeleted", + PossibleTypes = new [] { typeof(bool) })] + bool? DiscoveredVMDetailIsDeleted { get; } + /// The last time when SDS information discovered in SRS. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The last time when SDS information discovered in SRS.", + SerializedName = @"lastDiscoveryTimeInUtc", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? DiscoveredVMDetailLastDiscoveryTimeInUtc { get; } + /// The VM's OS name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The VM's OS name.", + SerializedName = @"osName", + PossibleTypes = new [] { typeof(string) })] + string DiscoveredVMDetailOsname { get; } + /// The VM power status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The VM power status.", + SerializedName = @"powerStatus", + PossibleTypes = new [] { typeof(string) })] + string DiscoveredVMDetailPowerStatus { get; } + /// The SDS updated timestamp. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The SDS updated timestamp.", + SerializedName = @"updatedTimestamp", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? DiscoveredVMDetailUpdatedTimestamp { get; } + /// The VCenter fqdn. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The VCenter fqdn.", + SerializedName = @"vCenterFqdn", + PossibleTypes = new [] { typeof(string) })] + string DiscoveredVMDetailVcenterFqdn { get; } + /// The VCenter Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The VCenter Id.", + SerializedName = @"vCenterId", + PossibleTypes = new [] { typeof(string) })] + string DiscoveredVMDetailVcenterId { get; } + /// The VM fqdn. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The VM fqdn.", + SerializedName = @"vmFqdn", + PossibleTypes = new [] { typeof(string) })] + string DiscoveredVMDetailVmfqdn { get; } + /// The VMware tools status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The VMware tools status.", + SerializedName = @"vmwareToolsStatus", + PossibleTypes = new [] { typeof(string) })] + string DiscoveredVMDetailVmwareToolsStatus { get; } + /// The type of the discovered VM. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The type of the discovered VM.", + SerializedName = @"discoveryType", + PossibleTypes = new [] { typeof(string) })] + string DiscoveryType { get; } + /// The ARM Id of the discovered VM. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The ARM Id of the discovered VM.", + SerializedName = @"fabricDiscoveryMachineId", + PossibleTypes = new [] { typeof(string) })] + string FabricDiscoveryMachineId { get; } + /// The recovery point Id to which the VM was failed over. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The recovery point Id to which the VM was failed over.", + SerializedName = @"failoverRecoveryPointId", + PossibleTypes = new [] { typeof(string) })] + string FailoverRecoveryPointId { get; } + /// The firmware type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The firmware type.", + SerializedName = @"firmwareType", + PossibleTypes = new [] { typeof(string) })] + string FirmwareType { get; } + /// + /// The initial replication processed bytes. This includes sum of total bytes transferred and matched bytes on all selected + /// disks in source VM. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The initial replication processed bytes. This includes sum of total bytes transferred and matched bytes on all selected disks in source VM.", + SerializedName = @"initialReplicationProcessedBytes", + PossibleTypes = new [] { typeof(long) })] + long? InitialReplicationProcessedByte { get; } + /// The initial replication progress health. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The initial replication progress health.", + SerializedName = @"initialReplicationProgressHealth", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.VMReplicationProgressHealth) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.VMReplicationProgressHealth? InitialReplicationProgressHealth { get; } + /// + /// The initial replication progress percentage. This is calculated based on total bytes processed for all disks in the source + /// VM. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The initial replication progress percentage. This is calculated based on total bytes processed for all disks in the source VM.", + SerializedName = @"initialReplicationProgressPercentage", + PossibleTypes = new [] { typeof(int) })] + int? InitialReplicationProgressPercentage { get; } + /// + /// The initial replication transferred bytes from source VM to azure for all selected disks on source VM. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The initial replication transferred bytes from source VM to azure for all selected disks on source VM.", + SerializedName = @"initialReplicationTransferredBytes", + PossibleTypes = new [] { typeof(long) })] + long? InitialReplicationTransferredByte { get; } + /// The virtual machine internal identifier. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The virtual machine internal identifier.", + SerializedName = @"internalIdentifier", + PossibleTypes = new [] { typeof(string) })] + string InternalIdentifier { get; } + /// A value indicating whether agent registration was successful after failover. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"A value indicating whether agent registration was successful after failover.", + SerializedName = @"isAgentRegistrationSuccessfulAfterFailover", + PossibleTypes = new [] { typeof(bool) })] + bool? IsAgentRegistrationSuccessfulAfterFailover { get; } + /// A value indicating whether last agent upgrade was successful or not. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"A value indicating whether last agent upgrade was successful or not.", + SerializedName = @"isLastUpgradeSuccessful", + PossibleTypes = new [] { typeof(string) })] + string IsLastUpgradeSuccessful { get; } + /// The last agent upgrade error information. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The last agent upgrade error information.", + SerializedName = @"lastAgentUpgradeErrorDetails", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmLastAgentUpgradeErrorDetails) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmLastAgentUpgradeErrorDetails[] LastAgentUpgradeErrorDetail { get; set; } + /// The last agent upgrade type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The last agent upgrade type.", + SerializedName = @"lastAgentUpgradeType", + PossibleTypes = new [] { typeof(string) })] + string LastAgentUpgradeType { get; } + /// The last recovery point Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The last recovery point Id.", + SerializedName = @"lastRecoveryPointId", + PossibleTypes = new [] { typeof(string) })] + string LastRecoveryPointId { get; } + /// The last recovery point received time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The last recovery point received time.", + SerializedName = @"lastRecoveryPointReceived", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? LastRecoveryPointReceived { get; } + /// The last recovery point objective calculated time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The last recovery point objective calculated time.", + SerializedName = @"lastRpoCalculatedTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? LastRpoCalculatedTime { get; } + /// The last recovery point objective value. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The last recovery point objective value.", + SerializedName = @"lastRpoInSeconds", + PossibleTypes = new [] { typeof(long) })] + long? LastRpoInSecond { get; } + /// License Type of the VM to be used. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"License Type of the VM to be used.", + SerializedName = @"licenseType", + PossibleTypes = new [] { typeof(string) })] + string LicenseType { get; set; } + /// The agent version expiry date. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The agent version expiry date.", + SerializedName = @"agentVersionExpiryDate", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? MobilityAgentDetailAgentVersionExpiryDate { get; } + /// The driver version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The driver version.", + SerializedName = @"driverVersion", + PossibleTypes = new [] { typeof(string) })] + string MobilityAgentDetailDriverVersion { get; } + /// The driver version expiry date. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The driver version expiry date.", + SerializedName = @"driverVersionExpiryDate", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? MobilityAgentDetailDriverVersionExpiryDate { get; } + /// A value indicating whether agent is upgradeable or not. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"A value indicating whether agent is upgradeable or not.", + SerializedName = @"isUpgradeable", + PossibleTypes = new [] { typeof(string) })] + string MobilityAgentDetailIsUpgradeable { get; } + /// The time of the last heartbeat received from the agent. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The time of the last heartbeat received from the agent.", + SerializedName = @"lastHeartbeatUtc", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? MobilityAgentDetailLastHeartbeatUtc { get; } + /// The latest agent version release date. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The latest agent version release date.", + SerializedName = @"latestAgentReleaseDate", + PossibleTypes = new [] { typeof(string) })] + string MobilityAgentDetailLatestAgentReleaseDate { get; } + /// The latest upgradeable version available without reboot. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The latest upgradeable version available without reboot.", + SerializedName = @"latestUpgradableVersionWithoutReboot", + PossibleTypes = new [] { typeof(string) })] + string MobilityAgentDetailLatestUpgradableVersionWithoutReboot { get; } + /// The latest agent version available. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The latest agent version available.", + SerializedName = @"latestVersion", + PossibleTypes = new [] { typeof(string) })] + string MobilityAgentDetailLatestVersion { get; } + /// The whether update is possible or not. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The whether update is possible or not.", + SerializedName = @"reasonsBlockingUpgrade", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentUpgradeBlockedReason) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentUpgradeBlockedReason[] MobilityAgentDetailReasonsBlockingUpgrade { get; } + /// The agent version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The agent version.", + SerializedName = @"version", + PossibleTypes = new [] { typeof(string) })] + string MobilityAgentDetailVersion { get; } + /// The multi VM group name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The multi VM group name.", + SerializedName = @"multiVmGroupName", + PossibleTypes = new [] { typeof(string) })] + string MultiVMGroupName { get; } + /// The type of the OS on the VM. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The type of the OS on the VM.", + SerializedName = @"osType", + PossibleTypes = new [] { typeof(string) })] + string OSType { get; } + /// The IP address of the primary network interface. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The IP address of the primary network interface.", + SerializedName = @"primaryNicIpAddress", + PossibleTypes = new [] { typeof(string) })] + string PrimaryNicIPAddress { get; } + /// The process server Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The process server Id.", + SerializedName = @"processServerId", + PossibleTypes = new [] { typeof(string) })] + string ProcessServerId { get; } + /// The process server name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The process server name.", + SerializedName = @"processServerName", + PossibleTypes = new [] { typeof(string) })] + string ProcessServerName { get; } + /// The processor core count. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The processor core count.", + SerializedName = @"processorCoreCount", + PossibleTypes = new [] { typeof(int) })] + int? ProcessorCoreCount { get; } + /// The list of protected disks. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of protected disks.", + SerializedName = @"protectedDisks", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetails) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetails[] ProtectedDisk { get; set; } + /// + /// The resync processed bytes. This includes sum of total bytes transferred and matched bytes on all selected disks in source + /// VM. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The resync processed bytes. This includes sum of total bytes transferred and matched bytes on all selected disks in source VM.", + SerializedName = @"resyncProcessedBytes", + PossibleTypes = new [] { typeof(long) })] + long? ResyncProcessedByte { get; } + /// The resync progress health. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The resync progress health.", + SerializedName = @"resyncProgressHealth", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.VMReplicationProgressHealth) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.VMReplicationProgressHealth? ResyncProgressHealth { get; } + /// + /// The resync progress percentage. This is calculated based on total bytes processed for all disks in the source VM. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The resync progress percentage. This is calculated based on total bytes processed for all disks in the source VM.", + SerializedName = @"resyncProgressPercentage", + PossibleTypes = new [] { typeof(int) })] + int? ResyncProgressPercentage { get; } + /// A value indicating whether resync is required. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"A value indicating whether resync is required.", + SerializedName = @"resyncRequired", + PossibleTypes = new [] { typeof(string) })] + string ResyncRequired { get; } + /// The resync state. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The resync state.", + SerializedName = @"resyncState", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ResyncState) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ResyncState? ResyncState { get; } + /// + /// The resync transferred bytes from source VM to azure for all selected disks on source VM. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The resync transferred bytes from source VM to azure for all selected disks on source VM.", + SerializedName = @"resyncTransferredBytes", + PossibleTypes = new [] { typeof(long) })] + long? ResyncTransferredByte { get; } + /// The run-as account Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The run-as account Id.", + SerializedName = @"runAsAccountId", + PossibleTypes = new [] { typeof(string) })] + string RunAsAccountId { get; } + /// + /// The replication storage account ARM Id. This is applicable only for the blob based replication test hook. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The replication storage account ARM Id. This is applicable only for the blob based replication test hook.", + SerializedName = @"storageAccountId", + PossibleTypes = new [] { typeof(string) })] + string StorageAccountId { get; } + /// The target availability set Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target availability set Id.", + SerializedName = @"targetAvailabilitySetId", + PossibleTypes = new [] { typeof(string) })] + string TargetAvailabilitySetId { get; set; } + /// The target availability zone. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target availability zone.", + SerializedName = @"targetAvailabilityZone", + PossibleTypes = new [] { typeof(string) })] + string TargetAvailabilityZone { get; set; } + /// The target boot diagnostics storage account ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target boot diagnostics storage account ARM Id.", + SerializedName = @"targetBootDiagnosticsStorageAccountId", + PossibleTypes = new [] { typeof(string) })] + string TargetBootDiagnosticsStorageAccountId { get; set; } + /// The target generation. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The target generation.", + SerializedName = @"targetGeneration", + PossibleTypes = new [] { typeof(string) })] + string TargetGeneration { get; } + /// The target location. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target location.", + SerializedName = @"targetLocation", + PossibleTypes = new [] { typeof(string) })] + string TargetLocation { get; set; } + /// The target network Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target network Id.", + SerializedName = @"targetNetworkId", + PossibleTypes = new [] { typeof(string) })] + string TargetNetworkId { get; set; } + /// The target proximity placement group Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target proximity placement group Id.", + SerializedName = @"targetProximityPlacementGroupId", + PossibleTypes = new [] { typeof(string) })] + string TargetProximityPlacementGroupId { get; set; } + /// The target resource group Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target resource group Id.", + SerializedName = @"targetResourceGroupId", + PossibleTypes = new [] { typeof(string) })] + string TargetResourceGroupId { get; set; } + /// Target VM name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Target VM name.", + SerializedName = @"targetVmName", + PossibleTypes = new [] { typeof(string) })] + string TargetVMName { get; set; } + /// The target VM size. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target VM size.", + SerializedName = @"targetVmSize", + PossibleTypes = new [] { typeof(string) })] + string TargetVMSize { get; set; } + /// The test network Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The test network Id.", + SerializedName = @"testNetworkId", + PossibleTypes = new [] { typeof(string) })] + string TestNetworkId { get; set; } + /// The network details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The network details.", + SerializedName = @"vmNics", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicDetails) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicDetails[] VMNic { get; set; } + + } + /// InMageRcm provider specific details. + internal partial interface IInMageRcmReplicationDetailsInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettingsInternal + { + /// The agent version to which last agent upgrade was attempted. + string AgentUpgradeAttemptToVersion { get; set; } + /// The agent upgrade blocking error information. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmAgentUpgradeBlockingErrorDetails[] AgentUpgradeBlockingErrorDetail { get; set; } + /// The agent upgrade job Id. + string AgentUpgradeJobId { get; set; } + /// The agent auto upgrade state. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MobilityAgentUpgradeState? AgentUpgradeState { get; set; } + /// The allocated memory in MB. + double? AllocatedMemoryInMb { get; set; } + /// The discovered VM details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmDiscoveredProtectedVMDetails DiscoveredVMDetail { get; set; } + /// The SDS created timestamp. + global::System.DateTime? DiscoveredVMDetailCreatedTimestamp { get; set; } + /// The list of datastores. + string[] DiscoveredVMDetailDatastore { get; set; } + /// The list of IP addresses. + string[] DiscoveredVMDetailIpaddress { get; set; } + /// A value indicating whether the VM is deleted. + bool? DiscoveredVMDetailIsDeleted { get; set; } + /// The last time when SDS information discovered in SRS. + global::System.DateTime? DiscoveredVMDetailLastDiscoveryTimeInUtc { get; set; } + /// The VM's OS name. + string DiscoveredVMDetailOsname { get; set; } + /// The VM power status. + string DiscoveredVMDetailPowerStatus { get; set; } + /// The SDS updated timestamp. + global::System.DateTime? DiscoveredVMDetailUpdatedTimestamp { get; set; } + /// The VCenter fqdn. + string DiscoveredVMDetailVcenterFqdn { get; set; } + /// The VCenter Id. + string DiscoveredVMDetailVcenterId { get; set; } + /// The VM fqdn. + string DiscoveredVMDetailVmfqdn { get; set; } + /// The VMware tools status. + string DiscoveredVMDetailVmwareToolsStatus { get; set; } + /// The type of the discovered VM. + string DiscoveryType { get; set; } + /// The ARM Id of the discovered VM. + string FabricDiscoveryMachineId { get; set; } + /// The recovery point Id to which the VM was failed over. + string FailoverRecoveryPointId { get; set; } + /// The firmware type. + string FirmwareType { get; set; } + /// + /// The initial replication processed bytes. This includes sum of total bytes transferred and matched bytes on all selected + /// disks in source VM. + /// + long? InitialReplicationProcessedByte { get; set; } + /// The initial replication progress health. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.VMReplicationProgressHealth? InitialReplicationProgressHealth { get; set; } + /// + /// The initial replication progress percentage. This is calculated based on total bytes processed for all disks in the source + /// VM. + /// + int? InitialReplicationProgressPercentage { get; set; } + /// + /// The initial replication transferred bytes from source VM to azure for all selected disks on source VM. + /// + long? InitialReplicationTransferredByte { get; set; } + /// The virtual machine internal identifier. + string InternalIdentifier { get; set; } + /// A value indicating whether agent registration was successful after failover. + bool? IsAgentRegistrationSuccessfulAfterFailover { get; set; } + /// A value indicating whether last agent upgrade was successful or not. + string IsLastUpgradeSuccessful { get; set; } + /// The last agent upgrade error information. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmLastAgentUpgradeErrorDetails[] LastAgentUpgradeErrorDetail { get; set; } + /// The last agent upgrade type. + string LastAgentUpgradeType { get; set; } + /// The last recovery point Id. + string LastRecoveryPointId { get; set; } + /// The last recovery point received time. + global::System.DateTime? LastRecoveryPointReceived { get; set; } + /// The last recovery point objective calculated time. + global::System.DateTime? LastRpoCalculatedTime { get; set; } + /// The last recovery point objective value. + long? LastRpoInSecond { get; set; } + /// License Type of the VM to be used. + string LicenseType { get; set; } + /// The mobility agent information. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmMobilityAgentDetails MobilityAgentDetail { get; set; } + /// The agent version expiry date. + global::System.DateTime? MobilityAgentDetailAgentVersionExpiryDate { get; set; } + /// The driver version. + string MobilityAgentDetailDriverVersion { get; set; } + /// The driver version expiry date. + global::System.DateTime? MobilityAgentDetailDriverVersionExpiryDate { get; set; } + /// A value indicating whether agent is upgradeable or not. + string MobilityAgentDetailIsUpgradeable { get; set; } + /// The time of the last heartbeat received from the agent. + global::System.DateTime? MobilityAgentDetailLastHeartbeatUtc { get; set; } + /// The latest agent version release date. + string MobilityAgentDetailLatestAgentReleaseDate { get; set; } + /// The latest upgradeable version available without reboot. + string MobilityAgentDetailLatestUpgradableVersionWithoutReboot { get; set; } + /// The latest agent version available. + string MobilityAgentDetailLatestVersion { get; set; } + /// The whether update is possible or not. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentUpgradeBlockedReason[] MobilityAgentDetailReasonsBlockingUpgrade { get; set; } + /// The agent version. + string MobilityAgentDetailVersion { get; set; } + /// The multi VM group name. + string MultiVMGroupName { get; set; } + /// The type of the OS on the VM. + string OSType { get; set; } + /// The IP address of the primary network interface. + string PrimaryNicIPAddress { get; set; } + /// The process server Id. + string ProcessServerId { get; set; } + /// The process server name. + string ProcessServerName { get; set; } + /// The processor core count. + int? ProcessorCoreCount { get; set; } + /// The list of protected disks. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetails[] ProtectedDisk { get; set; } + /// + /// The resync processed bytes. This includes sum of total bytes transferred and matched bytes on all selected disks in source + /// VM. + /// + long? ResyncProcessedByte { get; set; } + /// The resync progress health. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.VMReplicationProgressHealth? ResyncProgressHealth { get; set; } + /// + /// The resync progress percentage. This is calculated based on total bytes processed for all disks in the source VM. + /// + int? ResyncProgressPercentage { get; set; } + /// A value indicating whether resync is required. + string ResyncRequired { get; set; } + /// The resync state. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ResyncState? ResyncState { get; set; } + /// + /// The resync transferred bytes from source VM to azure for all selected disks on source VM. + /// + long? ResyncTransferredByte { get; set; } + /// The run-as account Id. + string RunAsAccountId { get; set; } + /// + /// The replication storage account ARM Id. This is applicable only for the blob based replication test hook. + /// + string StorageAccountId { get; set; } + /// The target availability set Id. + string TargetAvailabilitySetId { get; set; } + /// The target availability zone. + string TargetAvailabilityZone { get; set; } + /// The target boot diagnostics storage account ARM Id. + string TargetBootDiagnosticsStorageAccountId { get; set; } + /// The target generation. + string TargetGeneration { get; set; } + /// The target location. + string TargetLocation { get; set; } + /// The target network Id. + string TargetNetworkId { get; set; } + /// The target proximity placement group Id. + string TargetProximityPlacementGroupId { get; set; } + /// The target resource group Id. + string TargetResourceGroupId { get; set; } + /// Target VM name. + string TargetVMName { get; set; } + /// The target VM size. + string TargetVMSize { get; set; } + /// The test network Id. + string TestNetworkId { get; set; } + /// The network details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicDetails[] VMNic { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmReplicationDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmReplicationDetails.json.cs new file mode 100644 index 000000000000..880dfb3a9c39 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmReplicationDetails.json.cs @@ -0,0 +1,349 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMageRcm provider specific details. + public partial class InMageRcmReplicationDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReplicationDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new InMageRcmReplicationDetails(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal InMageRcmReplicationDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __replicationProviderSpecificSettings = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProviderSpecificSettings(json); + {_mobilityAgentDetail = If( json?.PropertyT("mobilityAgentDetails"), out var __jsonMobilityAgentDetails) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmMobilityAgentDetails.FromJson(__jsonMobilityAgentDetails) : MobilityAgentDetail;} + {_discoveredVMDetail = If( json?.PropertyT("discoveredVmDetails"), out var __jsonDiscoveredVMDetails) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmDiscoveredProtectedVMDetails.FromJson(__jsonDiscoveredVMDetails) : DiscoveredVMDetail;} + {_internalIdentifier = If( json?.PropertyT("internalIdentifier"), out var __jsonInternalIdentifier) ? (string)__jsonInternalIdentifier : (string)InternalIdentifier;} + {_fabricDiscoveryMachineId = If( json?.PropertyT("fabricDiscoveryMachineId"), out var __jsonFabricDiscoveryMachineId) ? (string)__jsonFabricDiscoveryMachineId : (string)FabricDiscoveryMachineId;} + {_multiVMGroupName = If( json?.PropertyT("multiVmGroupName"), out var __jsonMultiVMGroupName) ? (string)__jsonMultiVMGroupName : (string)MultiVMGroupName;} + {_discoveryType = If( json?.PropertyT("discoveryType"), out var __jsonDiscoveryType) ? (string)__jsonDiscoveryType : (string)DiscoveryType;} + {_processServerId = If( json?.PropertyT("processServerId"), out var __jsonProcessServerId) ? (string)__jsonProcessServerId : (string)ProcessServerId;} + {_processorCoreCount = If( json?.PropertyT("processorCoreCount"), out var __jsonProcessorCoreCount) ? (int?)__jsonProcessorCoreCount : ProcessorCoreCount;} + {_allocatedMemoryInMb = If( json?.PropertyT("allocatedMemoryInMB"), out var __jsonAllocatedMemoryInMb) ? (double?)__jsonAllocatedMemoryInMb : AllocatedMemoryInMb;} + {_processServerName = If( json?.PropertyT("processServerName"), out var __jsonProcessServerName) ? (string)__jsonProcessServerName : (string)ProcessServerName;} + {_runAsAccountId = If( json?.PropertyT("runAsAccountId"), out var __jsonRunAsAccountId) ? (string)__jsonRunAsAccountId : (string)RunAsAccountId;} + {_oSType = If( json?.PropertyT("osType"), out var __jsonOSType) ? (string)__jsonOSType : (string)OSType;} + {_firmwareType = If( json?.PropertyT("firmwareType"), out var __jsonFirmwareType) ? (string)__jsonFirmwareType : (string)FirmwareType;} + {_primaryNicIPAddress = If( json?.PropertyT("primaryNicIpAddress"), out var __jsonPrimaryNicIPAddress) ? (string)__jsonPrimaryNicIPAddress : (string)PrimaryNicIPAddress;} + {_targetGeneration = If( json?.PropertyT("targetGeneration"), out var __jsonTargetGeneration) ? (string)__jsonTargetGeneration : (string)TargetGeneration;} + {_licenseType = If( json?.PropertyT("licenseType"), out var __jsonLicenseType) ? (string)__jsonLicenseType : (string)LicenseType;} + {_storageAccountId = If( json?.PropertyT("storageAccountId"), out var __jsonStorageAccountId) ? (string)__jsonStorageAccountId : (string)StorageAccountId;} + {_targetVMName = If( json?.PropertyT("targetVmName"), out var __jsonTargetVMName) ? (string)__jsonTargetVMName : (string)TargetVMName;} + {_targetVMSize = If( json?.PropertyT("targetVmSize"), out var __jsonTargetVMSize) ? (string)__jsonTargetVMSize : (string)TargetVMSize;} + {_targetResourceGroupId = If( json?.PropertyT("targetResourceGroupId"), out var __jsonTargetResourceGroupId) ? (string)__jsonTargetResourceGroupId : (string)TargetResourceGroupId;} + {_targetLocation = If( json?.PropertyT("targetLocation"), out var __jsonTargetLocation) ? (string)__jsonTargetLocation : (string)TargetLocation;} + {_targetAvailabilitySetId = If( json?.PropertyT("targetAvailabilitySetId"), out var __jsonTargetAvailabilitySetId) ? (string)__jsonTargetAvailabilitySetId : (string)TargetAvailabilitySetId;} + {_targetAvailabilityZone = If( json?.PropertyT("targetAvailabilityZone"), out var __jsonTargetAvailabilityZone) ? (string)__jsonTargetAvailabilityZone : (string)TargetAvailabilityZone;} + {_targetProximityPlacementGroupId = If( json?.PropertyT("targetProximityPlacementGroupId"), out var __jsonTargetProximityPlacementGroupId) ? (string)__jsonTargetProximityPlacementGroupId : (string)TargetProximityPlacementGroupId;} + {_targetBootDiagnosticsStorageAccountId = If( json?.PropertyT("targetBootDiagnosticsStorageAccountId"), out var __jsonTargetBootDiagnosticsStorageAccountId) ? (string)__jsonTargetBootDiagnosticsStorageAccountId : (string)TargetBootDiagnosticsStorageAccountId;} + {_targetNetworkId = If( json?.PropertyT("targetNetworkId"), out var __jsonTargetNetworkId) ? (string)__jsonTargetNetworkId : (string)TargetNetworkId;} + {_testNetworkId = If( json?.PropertyT("testNetworkId"), out var __jsonTestNetworkId) ? (string)__jsonTestNetworkId : (string)TestNetworkId;} + {_failoverRecoveryPointId = If( json?.PropertyT("failoverRecoveryPointId"), out var __jsonFailoverRecoveryPointId) ? (string)__jsonFailoverRecoveryPointId : (string)FailoverRecoveryPointId;} + {_lastRecoveryPointReceived = If( json?.PropertyT("lastRecoveryPointReceived"), out var __jsonLastRecoveryPointReceived) ? global::System.DateTime.TryParse((string)__jsonLastRecoveryPointReceived, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonLastRecoveryPointReceivedValue) ? __jsonLastRecoveryPointReceivedValue : LastRecoveryPointReceived : LastRecoveryPointReceived;} + {_lastRpoInSecond = If( json?.PropertyT("lastRpoInSeconds"), out var __jsonLastRpoInSeconds) ? (long?)__jsonLastRpoInSeconds : LastRpoInSecond;} + {_lastRpoCalculatedTime = If( json?.PropertyT("lastRpoCalculatedTime"), out var __jsonLastRpoCalculatedTime) ? global::System.DateTime.TryParse((string)__jsonLastRpoCalculatedTime, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonLastRpoCalculatedTimeValue) ? __jsonLastRpoCalculatedTimeValue : LastRpoCalculatedTime : LastRpoCalculatedTime;} + {_lastRecoveryPointId = If( json?.PropertyT("lastRecoveryPointId"), out var __jsonLastRecoveryPointId) ? (string)__jsonLastRecoveryPointId : (string)LastRecoveryPointId;} + {_initialReplicationProgressPercentage = If( json?.PropertyT("initialReplicationProgressPercentage"), out var __jsonInitialReplicationProgressPercentage) ? (int?)__jsonInitialReplicationProgressPercentage : InitialReplicationProgressPercentage;} + {_initialReplicationProcessedByte = If( json?.PropertyT("initialReplicationProcessedBytes"), out var __jsonInitialReplicationProcessedBytes) ? (long?)__jsonInitialReplicationProcessedBytes : InitialReplicationProcessedByte;} + {_initialReplicationTransferredByte = If( json?.PropertyT("initialReplicationTransferredBytes"), out var __jsonInitialReplicationTransferredBytes) ? (long?)__jsonInitialReplicationTransferredBytes : InitialReplicationTransferredByte;} + {_initialReplicationProgressHealth = If( json?.PropertyT("initialReplicationProgressHealth"), out var __jsonInitialReplicationProgressHealth) ? (string)__jsonInitialReplicationProgressHealth : (string)InitialReplicationProgressHealth;} + {_resyncProgressPercentage = If( json?.PropertyT("resyncProgressPercentage"), out var __jsonResyncProgressPercentage) ? (int?)__jsonResyncProgressPercentage : ResyncProgressPercentage;} + {_resyncProcessedByte = If( json?.PropertyT("resyncProcessedBytes"), out var __jsonResyncProcessedBytes) ? (long?)__jsonResyncProcessedBytes : ResyncProcessedByte;} + {_resyncTransferredByte = If( json?.PropertyT("resyncTransferredBytes"), out var __jsonResyncTransferredBytes) ? (long?)__jsonResyncTransferredBytes : ResyncTransferredByte;} + {_resyncProgressHealth = If( json?.PropertyT("resyncProgressHealth"), out var __jsonResyncProgressHealth) ? (string)__jsonResyncProgressHealth : (string)ResyncProgressHealth;} + {_resyncRequired = If( json?.PropertyT("resyncRequired"), out var __jsonResyncRequired) ? (string)__jsonResyncRequired : (string)ResyncRequired;} + {_resyncState = If( json?.PropertyT("resyncState"), out var __jsonResyncState) ? (string)__jsonResyncState : (string)ResyncState;} + {_agentUpgradeState = If( json?.PropertyT("agentUpgradeState"), out var __jsonAgentUpgradeState) ? (string)__jsonAgentUpgradeState : (string)AgentUpgradeState;} + {_lastAgentUpgradeType = If( json?.PropertyT("lastAgentUpgradeType"), out var __jsonLastAgentUpgradeType) ? (string)__jsonLastAgentUpgradeType : (string)LastAgentUpgradeType;} + {_agentUpgradeJobId = If( json?.PropertyT("agentUpgradeJobId"), out var __jsonAgentUpgradeJobId) ? (string)__jsonAgentUpgradeJobId : (string)AgentUpgradeJobId;} + {_agentUpgradeAttemptToVersion = If( json?.PropertyT("agentUpgradeAttemptToVersion"), out var __jsonAgentUpgradeAttemptToVersion) ? (string)__jsonAgentUpgradeAttemptToVersion : (string)AgentUpgradeAttemptToVersion;} + {_protectedDisk = If( json?.PropertyT("protectedDisks"), out var __jsonProtectedDisks) ? If( __jsonProtectedDisks as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmProtectedDiskDetails) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmProtectedDiskDetails.FromJson(__u) )) ))() : null : ProtectedDisk;} + {_isLastUpgradeSuccessful = If( json?.PropertyT("isLastUpgradeSuccessful"), out var __jsonIsLastUpgradeSuccessful) ? (string)__jsonIsLastUpgradeSuccessful : (string)IsLastUpgradeSuccessful;} + {_isAgentRegistrationSuccessfulAfterFailover = If( json?.PropertyT("isAgentRegistrationSuccessfulAfterFailover"), out var __jsonIsAgentRegistrationSuccessfulAfterFailover) ? (bool?)__jsonIsAgentRegistrationSuccessfulAfterFailover : IsAgentRegistrationSuccessfulAfterFailover;} + {_lastAgentUpgradeErrorDetail = If( json?.PropertyT("lastAgentUpgradeErrorDetails"), out var __jsonLastAgentUpgradeErrorDetails) ? If( __jsonLastAgentUpgradeErrorDetails as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __q) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__q, (__p)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmLastAgentUpgradeErrorDetails) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmLastAgentUpgradeErrorDetails.FromJson(__p) )) ))() : null : LastAgentUpgradeErrorDetail;} + {_agentUpgradeBlockingErrorDetail = If( json?.PropertyT("agentUpgradeBlockingErrorDetails"), out var __jsonAgentUpgradeBlockingErrorDetails) ? If( __jsonAgentUpgradeBlockingErrorDetails as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __l) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__l, (__k)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmAgentUpgradeBlockingErrorDetails) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmAgentUpgradeBlockingErrorDetails.FromJson(__k) )) ))() : null : AgentUpgradeBlockingErrorDetail;} + {_vMNic = If( json?.PropertyT("vmNics"), out var __jsonVMNics) ? If( __jsonVMNics as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __g) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__g, (__f)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicDetails) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmNicDetails.FromJson(__f) )) ))() : null : VMNic;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __replicationProviderSpecificSettings?.ToJson(container, serializationMode); + AddIf( null != this._mobilityAgentDetail ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._mobilityAgentDetail.ToJson(null,serializationMode) : null, "mobilityAgentDetails" ,container.Add ); + AddIf( null != this._discoveredVMDetail ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._discoveredVMDetail.ToJson(null,serializationMode) : null, "discoveredVmDetails" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._internalIdentifier)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._internalIdentifier.ToString()) : null, "internalIdentifier" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._fabricDiscoveryMachineId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._fabricDiscoveryMachineId.ToString()) : null, "fabricDiscoveryMachineId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._multiVMGroupName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._multiVMGroupName.ToString()) : null, "multiVmGroupName" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._discoveryType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._discoveryType.ToString()) : null, "discoveryType" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._processServerId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._processServerId.ToString()) : null, "processServerId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._processorCoreCount ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._processorCoreCount) : null, "processorCoreCount" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._allocatedMemoryInMb ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((double)this._allocatedMemoryInMb) : null, "allocatedMemoryInMB" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._processServerName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._processServerName.ToString()) : null, "processServerName" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._runAsAccountId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._runAsAccountId.ToString()) : null, "runAsAccountId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._oSType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._oSType.ToString()) : null, "osType" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._firmwareType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._firmwareType.ToString()) : null, "firmwareType" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._primaryNicIPAddress)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._primaryNicIPAddress.ToString()) : null, "primaryNicIpAddress" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._targetGeneration)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetGeneration.ToString()) : null, "targetGeneration" ,container.Add ); + } + AddIf( null != (((object)this._licenseType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._licenseType.ToString()) : null, "licenseType" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._storageAccountId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._storageAccountId.ToString()) : null, "storageAccountId" ,container.Add ); + } + AddIf( null != (((object)this._targetVMName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetVMName.ToString()) : null, "targetVmName" ,container.Add ); + AddIf( null != (((object)this._targetVMSize)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetVMSize.ToString()) : null, "targetVmSize" ,container.Add ); + AddIf( null != (((object)this._targetResourceGroupId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetResourceGroupId.ToString()) : null, "targetResourceGroupId" ,container.Add ); + AddIf( null != (((object)this._targetLocation)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetLocation.ToString()) : null, "targetLocation" ,container.Add ); + AddIf( null != (((object)this._targetAvailabilitySetId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetAvailabilitySetId.ToString()) : null, "targetAvailabilitySetId" ,container.Add ); + AddIf( null != (((object)this._targetAvailabilityZone)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetAvailabilityZone.ToString()) : null, "targetAvailabilityZone" ,container.Add ); + AddIf( null != (((object)this._targetProximityPlacementGroupId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetProximityPlacementGroupId.ToString()) : null, "targetProximityPlacementGroupId" ,container.Add ); + AddIf( null != (((object)this._targetBootDiagnosticsStorageAccountId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetBootDiagnosticsStorageAccountId.ToString()) : null, "targetBootDiagnosticsStorageAccountId" ,container.Add ); + AddIf( null != (((object)this._targetNetworkId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetNetworkId.ToString()) : null, "targetNetworkId" ,container.Add ); + AddIf( null != (((object)this._testNetworkId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._testNetworkId.ToString()) : null, "testNetworkId" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._failoverRecoveryPointId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._failoverRecoveryPointId.ToString()) : null, "failoverRecoveryPointId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._lastRecoveryPointReceived ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._lastRecoveryPointReceived?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "lastRecoveryPointReceived" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._lastRpoInSecond ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((long)this._lastRpoInSecond) : null, "lastRpoInSeconds" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._lastRpoCalculatedTime ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._lastRpoCalculatedTime?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "lastRpoCalculatedTime" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._lastRecoveryPointId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._lastRecoveryPointId.ToString()) : null, "lastRecoveryPointId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._initialReplicationProgressPercentage ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._initialReplicationProgressPercentage) : null, "initialReplicationProgressPercentage" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._initialReplicationProcessedByte ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((long)this._initialReplicationProcessedByte) : null, "initialReplicationProcessedBytes" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._initialReplicationTransferredByte ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((long)this._initialReplicationTransferredByte) : null, "initialReplicationTransferredBytes" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._initialReplicationProgressHealth)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._initialReplicationProgressHealth.ToString()) : null, "initialReplicationProgressHealth" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._resyncProgressPercentage ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._resyncProgressPercentage) : null, "resyncProgressPercentage" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._resyncProcessedByte ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((long)this._resyncProcessedByte) : null, "resyncProcessedBytes" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._resyncTransferredByte ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((long)this._resyncTransferredByte) : null, "resyncTransferredBytes" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._resyncProgressHealth)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._resyncProgressHealth.ToString()) : null, "resyncProgressHealth" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._resyncRequired)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._resyncRequired.ToString()) : null, "resyncRequired" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._resyncState)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._resyncState.ToString()) : null, "resyncState" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._agentUpgradeState)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._agentUpgradeState.ToString()) : null, "agentUpgradeState" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._lastAgentUpgradeType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._lastAgentUpgradeType.ToString()) : null, "lastAgentUpgradeType" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._agentUpgradeJobId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._agentUpgradeJobId.ToString()) : null, "agentUpgradeJobId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._agentUpgradeAttemptToVersion)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._agentUpgradeAttemptToVersion.ToString()) : null, "agentUpgradeAttemptToVersion" ,container.Add ); + } + if (null != this._protectedDisk) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._protectedDisk ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("protectedDisks",__w); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._isLastUpgradeSuccessful)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._isLastUpgradeSuccessful.ToString()) : null, "isLastUpgradeSuccessful" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._isAgentRegistrationSuccessfulAfterFailover ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonBoolean((bool)this._isAgentRegistrationSuccessfulAfterFailover) : null, "isAgentRegistrationSuccessfulAfterFailover" ,container.Add ); + } + if (null != this._lastAgentUpgradeErrorDetail) + { + var __r = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __s in this._lastAgentUpgradeErrorDetail ) + { + AddIf(__s?.ToJson(null, serializationMode) ,__r.Add); + } + container.Add("lastAgentUpgradeErrorDetails",__r); + } + if (null != this._agentUpgradeBlockingErrorDetail) + { + var __m = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __n in this._agentUpgradeBlockingErrorDetail ) + { + AddIf(__n?.ToJson(null, serializationMode) ,__m.Add); + } + container.Add("agentUpgradeBlockingErrorDetails",__m); + } + if (null != this._vMNic) + { + var __h = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __i in this._vMNic ) + { + AddIf(__i?.ToJson(null, serializationMode) ,__h.Add); + } + container.Add("vmNics",__h); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmReprotectInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmReprotectInput.PowerShell.cs new file mode 100644 index 000000000000..ae0c5e3fa508 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmReprotectInput.PowerShell.cs @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// InMageRcm specific provider input. + [System.ComponentModel.TypeConverter(typeof(InMageRcmReprotectInputTypeConverter))] + public partial class InMageRcmReprotectInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReprotectInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InMageRcmReprotectInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReprotectInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InMageRcmReprotectInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReprotectInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InMageRcmReprotectInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ReprotectAgentId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReprotectInputInternal)this).ReprotectAgentId = (string) content.GetValueForProperty("ReprotectAgentId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReprotectInputInternal)this).ReprotectAgentId, global::System.Convert.ToString); + } + if (content.Contains("DatastoreName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReprotectInputInternal)this).DatastoreName = (string) content.GetValueForProperty("DatastoreName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReprotectInputInternal)this).DatastoreName, global::System.Convert.ToString); + } + if (content.Contains("LogStorageAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReprotectInputInternal)this).LogStorageAccountId = (string) content.GetValueForProperty("LogStorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReprotectInputInternal)this).LogStorageAccountId, global::System.Convert.ToString); + } + if (content.Contains("PolicyId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReprotectInputInternal)this).PolicyId = (string) content.GetValueForProperty("PolicyId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReprotectInputInternal)this).PolicyId, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InMageRcmReprotectInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ReprotectAgentId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReprotectInputInternal)this).ReprotectAgentId = (string) content.GetValueForProperty("ReprotectAgentId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReprotectInputInternal)this).ReprotectAgentId, global::System.Convert.ToString); + } + if (content.Contains("DatastoreName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReprotectInputInternal)this).DatastoreName = (string) content.GetValueForProperty("DatastoreName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReprotectInputInternal)this).DatastoreName, global::System.Convert.ToString); + } + if (content.Contains("LogStorageAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReprotectInputInternal)this).LogStorageAccountId = (string) content.GetValueForProperty("LogStorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReprotectInputInternal)this).LogStorageAccountId, global::System.Convert.ToString); + } + if (content.Contains("PolicyId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReprotectInputInternal)this).PolicyId = (string) content.GetValueForProperty("PolicyId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReprotectInputInternal)this).PolicyId, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// InMageRcm specific provider input. + [System.ComponentModel.TypeConverter(typeof(InMageRcmReprotectInputTypeConverter))] + public partial interface IInMageRcmReprotectInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmReprotectInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmReprotectInput.TypeConverter.cs new file mode 100644 index 000000000000..4a51409df745 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmReprotectInput.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InMageRcmReprotectInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReprotectInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReprotectInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InMageRcmReprotectInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InMageRcmReprotectInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InMageRcmReprotectInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmReprotectInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmReprotectInput.cs new file mode 100644 index 000000000000..1f90b37e9d3d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmReprotectInput.cs @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMageRcm specific provider input. + public partial class InMageRcmReprotectInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReprotectInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReprotectInputInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationProviderSpecificInput __reverseReplicationProviderSpecificInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReverseReplicationProviderSpecificInput(); + + /// Backing field for property. + private string _datastoreName; + + /// The target datastore name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string DatastoreName { get => this._datastoreName; set => this._datastoreName = value; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationProviderSpecificInputInternal)__reverseReplicationProviderSpecificInput).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationProviderSpecificInputInternal)__reverseReplicationProviderSpecificInput).InstanceType = value ; } + + /// Backing field for property. + private string _logStorageAccountId; + + /// The log storage account ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string LogStorageAccountId { get => this._logStorageAccountId; set => this._logStorageAccountId = value; } + + /// Backing field for property. + private string _policyId; + + /// The Policy Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string PolicyId { get => this._policyId; set => this._policyId = value; } + + /// Backing field for property. + private string _reprotectAgentId; + + /// The reprotect agent Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ReprotectAgentId { get => this._reprotectAgentId; set => this._reprotectAgentId = value; } + + /// Creates an new instance. + public InMageRcmReprotectInput() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__reverseReplicationProviderSpecificInput), __reverseReplicationProviderSpecificInput); + await eventListener.AssertObjectIsValid(nameof(__reverseReplicationProviderSpecificInput), __reverseReplicationProviderSpecificInput); + } + } + /// InMageRcm specific provider input. + public partial interface IInMageRcmReprotectInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationProviderSpecificInput + { + /// The target datastore name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The target datastore name.", + SerializedName = @"datastoreName", + PossibleTypes = new [] { typeof(string) })] + string DatastoreName { get; set; } + /// The log storage account ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The log storage account ARM Id.", + SerializedName = @"logStorageAccountId", + PossibleTypes = new [] { typeof(string) })] + string LogStorageAccountId { get; set; } + /// The Policy Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Policy Id.", + SerializedName = @"policyId", + PossibleTypes = new [] { typeof(string) })] + string PolicyId { get; set; } + /// The reprotect agent Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The reprotect agent Id.", + SerializedName = @"reprotectAgentId", + PossibleTypes = new [] { typeof(string) })] + string ReprotectAgentId { get; set; } + + } + /// InMageRcm specific provider input. + internal partial interface IInMageRcmReprotectInputInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationProviderSpecificInputInternal + { + /// The target datastore name. + string DatastoreName { get; set; } + /// The log storage account ARM Id. + string LogStorageAccountId { get; set; } + /// The Policy Id. + string PolicyId { get; set; } + /// The reprotect agent Id. + string ReprotectAgentId { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmReprotectInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmReprotectInput.json.cs new file mode 100644 index 000000000000..1c9e178735aa --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmReprotectInput.json.cs @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMageRcm specific provider input. + public partial class InMageRcmReprotectInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReprotectInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReprotectInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmReprotectInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new InMageRcmReprotectInput(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal InMageRcmReprotectInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __reverseReplicationProviderSpecificInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReverseReplicationProviderSpecificInput(json); + {_reprotectAgentId = If( json?.PropertyT("reprotectAgentId"), out var __jsonReprotectAgentId) ? (string)__jsonReprotectAgentId : (string)ReprotectAgentId;} + {_datastoreName = If( json?.PropertyT("datastoreName"), out var __jsonDatastoreName) ? (string)__jsonDatastoreName : (string)DatastoreName;} + {_logStorageAccountId = If( json?.PropertyT("logStorageAccountId"), out var __jsonLogStorageAccountId) ? (string)__jsonLogStorageAccountId : (string)LogStorageAccountId;} + {_policyId = If( json?.PropertyT("policyId"), out var __jsonPolicyId) ? (string)__jsonPolicyId : (string)PolicyId;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __reverseReplicationProviderSpecificInput?.ToJson(container, serializationMode); + AddIf( null != (((object)this._reprotectAgentId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._reprotectAgentId.ToString()) : null, "reprotectAgentId" ,container.Add ); + AddIf( null != (((object)this._datastoreName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._datastoreName.ToString()) : null, "datastoreName" ,container.Add ); + AddIf( null != (((object)this._logStorageAccountId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._logStorageAccountId.ToString()) : null, "logStorageAccountId" ,container.Add ); + AddIf( null != (((object)this._policyId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._policyId.ToString()) : null, "policyId" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmSyncDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmSyncDetails.PowerShell.cs new file mode 100644 index 000000000000..51776232965e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmSyncDetails.PowerShell.cs @@ -0,0 +1,200 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// InMageRcm disk level sync details. + [System.ComponentModel.TypeConverter(typeof(InMageRcmSyncDetailsTypeConverter))] + public partial class InMageRcmSyncDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InMageRcmSyncDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InMageRcmSyncDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InMageRcmSyncDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProgressHealth")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetailsInternal)this).ProgressHealth = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskReplicationProgressHealth?) content.GetValueForProperty("ProgressHealth",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetailsInternal)this).ProgressHealth, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskReplicationProgressHealth.CreateFrom); + } + if (content.Contains("TransferredByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetailsInternal)this).TransferredByte = (long?) content.GetValueForProperty("TransferredByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetailsInternal)this).TransferredByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("Last15MinutesTransferredByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetailsInternal)this).Last15MinutesTransferredByte = (long?) content.GetValueForProperty("Last15MinutesTransferredByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetailsInternal)this).Last15MinutesTransferredByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("LastDataTransferTimeUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetailsInternal)this).LastDataTransferTimeUtc = (string) content.GetValueForProperty("LastDataTransferTimeUtc",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetailsInternal)this).LastDataTransferTimeUtc, global::System.Convert.ToString); + } + if (content.Contains("ProcessedByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetailsInternal)this).ProcessedByte = (long?) content.GetValueForProperty("ProcessedByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetailsInternal)this).ProcessedByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("StartTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetailsInternal)this).StartTime = (string) content.GetValueForProperty("StartTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetailsInternal)this).StartTime, global::System.Convert.ToString); + } + if (content.Contains("LastRefreshTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetailsInternal)this).LastRefreshTime = (string) content.GetValueForProperty("LastRefreshTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetailsInternal)this).LastRefreshTime, global::System.Convert.ToString); + } + if (content.Contains("ProgressPercentage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetailsInternal)this).ProgressPercentage = (int?) content.GetValueForProperty("ProgressPercentage",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetailsInternal)this).ProgressPercentage, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InMageRcmSyncDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProgressHealth")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetailsInternal)this).ProgressHealth = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskReplicationProgressHealth?) content.GetValueForProperty("ProgressHealth",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetailsInternal)this).ProgressHealth, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskReplicationProgressHealth.CreateFrom); + } + if (content.Contains("TransferredByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetailsInternal)this).TransferredByte = (long?) content.GetValueForProperty("TransferredByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetailsInternal)this).TransferredByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("Last15MinutesTransferredByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetailsInternal)this).Last15MinutesTransferredByte = (long?) content.GetValueForProperty("Last15MinutesTransferredByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetailsInternal)this).Last15MinutesTransferredByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("LastDataTransferTimeUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetailsInternal)this).LastDataTransferTimeUtc = (string) content.GetValueForProperty("LastDataTransferTimeUtc",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetailsInternal)this).LastDataTransferTimeUtc, global::System.Convert.ToString); + } + if (content.Contains("ProcessedByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetailsInternal)this).ProcessedByte = (long?) content.GetValueForProperty("ProcessedByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetailsInternal)this).ProcessedByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("StartTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetailsInternal)this).StartTime = (string) content.GetValueForProperty("StartTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetailsInternal)this).StartTime, global::System.Convert.ToString); + } + if (content.Contains("LastRefreshTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetailsInternal)this).LastRefreshTime = (string) content.GetValueForProperty("LastRefreshTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetailsInternal)this).LastRefreshTime, global::System.Convert.ToString); + } + if (content.Contains("ProgressPercentage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetailsInternal)this).ProgressPercentage = (int?) content.GetValueForProperty("ProgressPercentage",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetailsInternal)this).ProgressPercentage, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// InMageRcm disk level sync details. + [System.ComponentModel.TypeConverter(typeof(InMageRcmSyncDetailsTypeConverter))] + public partial interface IInMageRcmSyncDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmSyncDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmSyncDetails.TypeConverter.cs new file mode 100644 index 000000000000..3b8e429d74de --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmSyncDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InMageRcmSyncDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InMageRcmSyncDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InMageRcmSyncDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InMageRcmSyncDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmSyncDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmSyncDetails.cs new file mode 100644 index 000000000000..e3e93676f636 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmSyncDetails.cs @@ -0,0 +1,206 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMageRcm disk level sync details. + public partial class InMageRcmSyncDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetailsInternal + { + + /// Backing field for property. + private long? _last15MinutesTransferredByte; + + /// The bytes transferred in last 15 minutes from source VM to azure. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public long? Last15MinutesTransferredByte { get => this._last15MinutesTransferredByte; } + + /// Backing field for property. + private string _lastDataTransferTimeUtc; + + /// The time of the last data transfer from source VM to azure. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string LastDataTransferTimeUtc { get => this._lastDataTransferTimeUtc; } + + /// Backing field for property. + private string _lastRefreshTime; + + /// The last refresh time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string LastRefreshTime { get => this._lastRefreshTime; } + + /// Internal Acessors for Last15MinutesTransferredByte + long? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetailsInternal.Last15MinutesTransferredByte { get => this._last15MinutesTransferredByte; set { {_last15MinutesTransferredByte = value;} } } + + /// Internal Acessors for LastDataTransferTimeUtc + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetailsInternal.LastDataTransferTimeUtc { get => this._lastDataTransferTimeUtc; set { {_lastDataTransferTimeUtc = value;} } } + + /// Internal Acessors for LastRefreshTime + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetailsInternal.LastRefreshTime { get => this._lastRefreshTime; set { {_lastRefreshTime = value;} } } + + /// Internal Acessors for ProcessedByte + long? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetailsInternal.ProcessedByte { get => this._processedByte; set { {_processedByte = value;} } } + + /// Internal Acessors for ProgressHealth + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskReplicationProgressHealth? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetailsInternal.ProgressHealth { get => this._progressHealth; set { {_progressHealth = value;} } } + + /// Internal Acessors for ProgressPercentage + int? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetailsInternal.ProgressPercentage { get => this._progressPercentage; set { {_progressPercentage = value;} } } + + /// Internal Acessors for StartTime + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetailsInternal.StartTime { get => this._startTime; set { {_startTime = value;} } } + + /// Internal Acessors for TransferredByte + long? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetailsInternal.TransferredByte { get => this._transferredByte; set { {_transferredByte = value;} } } + + /// Backing field for property. + private long? _processedByte; + + /// + /// The total processed bytes. This includes bytes that are transferred from source VM to azure and matched bytes. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public long? ProcessedByte { get => this._processedByte; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskReplicationProgressHealth? _progressHealth; + + /// The progress health. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskReplicationProgressHealth? ProgressHealth { get => this._progressHealth; } + + /// Backing field for property. + private int? _progressPercentage; + + /// + /// Progress in percentage. Progress percentage is calculated based on processed bytes. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? ProgressPercentage { get => this._progressPercentage; } + + /// Backing field for property. + private string _startTime; + + /// The start time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string StartTime { get => this._startTime; } + + /// Backing field for property. + private long? _transferredByte; + + /// The transferred bytes from source VM to azure for the disk. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public long? TransferredByte { get => this._transferredByte; } + + /// Creates an new instance. + public InMageRcmSyncDetails() + { + + } + } + /// InMageRcm disk level sync details. + public partial interface IInMageRcmSyncDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The bytes transferred in last 15 minutes from source VM to azure. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The bytes transferred in last 15 minutes from source VM to azure.", + SerializedName = @"last15MinutesTransferredBytes", + PossibleTypes = new [] { typeof(long) })] + long? Last15MinutesTransferredByte { get; } + /// The time of the last data transfer from source VM to azure. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The time of the last data transfer from source VM to azure.", + SerializedName = @"lastDataTransferTimeUtc", + PossibleTypes = new [] { typeof(string) })] + string LastDataTransferTimeUtc { get; } + /// The last refresh time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The last refresh time.", + SerializedName = @"lastRefreshTime", + PossibleTypes = new [] { typeof(string) })] + string LastRefreshTime { get; } + /// + /// The total processed bytes. This includes bytes that are transferred from source VM to azure and matched bytes. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The total processed bytes. This includes bytes that are transferred from source VM to azure and matched bytes.", + SerializedName = @"processedBytes", + PossibleTypes = new [] { typeof(long) })] + long? ProcessedByte { get; } + /// The progress health. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The progress health.", + SerializedName = @"progressHealth", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskReplicationProgressHealth) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskReplicationProgressHealth? ProgressHealth { get; } + /// + /// Progress in percentage. Progress percentage is calculated based on processed bytes. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Progress in percentage. Progress percentage is calculated based on processed bytes.", + SerializedName = @"progressPercentage", + PossibleTypes = new [] { typeof(int) })] + int? ProgressPercentage { get; } + /// The start time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The start time.", + SerializedName = @"startTime", + PossibleTypes = new [] { typeof(string) })] + string StartTime { get; } + /// The transferred bytes from source VM to azure for the disk. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The transferred bytes from source VM to azure for the disk.", + SerializedName = @"transferredBytes", + PossibleTypes = new [] { typeof(long) })] + long? TransferredByte { get; } + + } + /// InMageRcm disk level sync details. + internal partial interface IInMageRcmSyncDetailsInternal + + { + /// The bytes transferred in last 15 minutes from source VM to azure. + long? Last15MinutesTransferredByte { get; set; } + /// The time of the last data transfer from source VM to azure. + string LastDataTransferTimeUtc { get; set; } + /// The last refresh time. + string LastRefreshTime { get; set; } + /// + /// The total processed bytes. This includes bytes that are transferred from source VM to azure and matched bytes. + /// + long? ProcessedByte { get; set; } + /// The progress health. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskReplicationProgressHealth? ProgressHealth { get; set; } + /// + /// Progress in percentage. Progress percentage is calculated based on processed bytes. + /// + int? ProgressPercentage { get; set; } + /// The start time. + string StartTime { get; set; } + /// The transferred bytes from source VM to azure for the disk. + long? TransferredByte { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmSyncDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmSyncDetails.json.cs new file mode 100644 index 000000000000..209e0e6e90f9 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmSyncDetails.json.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMageRcm disk level sync details. + public partial class InMageRcmSyncDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmSyncDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new InMageRcmSyncDetails(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal InMageRcmSyncDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_progressHealth = If( json?.PropertyT("progressHealth"), out var __jsonProgressHealth) ? (string)__jsonProgressHealth : (string)ProgressHealth;} + {_transferredByte = If( json?.PropertyT("transferredBytes"), out var __jsonTransferredBytes) ? (long?)__jsonTransferredBytes : TransferredByte;} + {_last15MinutesTransferredByte = If( json?.PropertyT("last15MinutesTransferredBytes"), out var __jsonLast15MinutesTransferredBytes) ? (long?)__jsonLast15MinutesTransferredBytes : Last15MinutesTransferredByte;} + {_lastDataTransferTimeUtc = If( json?.PropertyT("lastDataTransferTimeUtc"), out var __jsonLastDataTransferTimeUtc) ? (string)__jsonLastDataTransferTimeUtc : (string)LastDataTransferTimeUtc;} + {_processedByte = If( json?.PropertyT("processedBytes"), out var __jsonProcessedBytes) ? (long?)__jsonProcessedBytes : ProcessedByte;} + {_startTime = If( json?.PropertyT("startTime"), out var __jsonStartTime) ? (string)__jsonStartTime : (string)StartTime;} + {_lastRefreshTime = If( json?.PropertyT("lastRefreshTime"), out var __jsonLastRefreshTime) ? (string)__jsonLastRefreshTime : (string)LastRefreshTime;} + {_progressPercentage = If( json?.PropertyT("progressPercentage"), out var __jsonProgressPercentage) ? (int?)__jsonProgressPercentage : ProgressPercentage;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._progressHealth)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._progressHealth.ToString()) : null, "progressHealth" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._transferredByte ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((long)this._transferredByte) : null, "transferredBytes" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._last15MinutesTransferredByte ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((long)this._last15MinutesTransferredByte) : null, "last15MinutesTransferredBytes" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._lastDataTransferTimeUtc)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._lastDataTransferTimeUtc.ToString()) : null, "lastDataTransferTimeUtc" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._processedByte ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((long)this._processedByte) : null, "processedBytes" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._startTime)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._startTime.ToString()) : null, "startTime" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._lastRefreshTime)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._lastRefreshTime.ToString()) : null, "lastRefreshTime" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._progressPercentage ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._progressPercentage) : null, "progressPercentage" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmTestFailoverInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmTestFailoverInput.PowerShell.cs new file mode 100644 index 000000000000..8e172d833468 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmTestFailoverInput.PowerShell.cs @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// InMageRcm provider specific input for test failover. + [System.ComponentModel.TypeConverter(typeof(InMageRcmTestFailoverInputTypeConverter))] + public partial class InMageRcmTestFailoverInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmTestFailoverInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InMageRcmTestFailoverInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmTestFailoverInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InMageRcmTestFailoverInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmTestFailoverInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InMageRcmTestFailoverInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("NetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmTestFailoverInputInternal)this).NetworkId = (string) content.GetValueForProperty("NetworkId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmTestFailoverInputInternal)this).NetworkId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryPointId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmTestFailoverInputInternal)this).RecoveryPointId = (string) content.GetValueForProperty("RecoveryPointId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmTestFailoverInputInternal)this).RecoveryPointId, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InMageRcmTestFailoverInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("NetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmTestFailoverInputInternal)this).NetworkId = (string) content.GetValueForProperty("NetworkId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmTestFailoverInputInternal)this).NetworkId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryPointId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmTestFailoverInputInternal)this).RecoveryPointId = (string) content.GetValueForProperty("RecoveryPointId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmTestFailoverInputInternal)this).RecoveryPointId, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// InMageRcm provider specific input for test failover. + [System.ComponentModel.TypeConverter(typeof(InMageRcmTestFailoverInputTypeConverter))] + public partial interface IInMageRcmTestFailoverInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmTestFailoverInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmTestFailoverInput.TypeConverter.cs new file mode 100644 index 000000000000..108f63104440 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmTestFailoverInput.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InMageRcmTestFailoverInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmTestFailoverInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmTestFailoverInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InMageRcmTestFailoverInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InMageRcmTestFailoverInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InMageRcmTestFailoverInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmTestFailoverInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmTestFailoverInput.cs new file mode 100644 index 000000000000..05f781363b98 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmTestFailoverInput.cs @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMageRcm provider specific input for test failover. + public partial class InMageRcmTestFailoverInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmTestFailoverInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmTestFailoverInputInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverProviderSpecificInput __testFailoverProviderSpecificInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.TestFailoverProviderSpecificInput(); + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverProviderSpecificInputInternal)__testFailoverProviderSpecificInput).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverProviderSpecificInputInternal)__testFailoverProviderSpecificInput).InstanceType = value ; } + + /// Backing field for property. + private string _networkId; + + /// The test network Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string NetworkId { get => this._networkId; set => this._networkId = value; } + + /// Backing field for property. + private string _recoveryPointId; + + /// + /// 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. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryPointId { get => this._recoveryPointId; set => this._recoveryPointId = value; } + + /// Creates an new instance. + public InMageRcmTestFailoverInput() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__testFailoverProviderSpecificInput), __testFailoverProviderSpecificInput); + await eventListener.AssertObjectIsValid(nameof(__testFailoverProviderSpecificInput), __testFailoverProviderSpecificInput); + } + } + /// InMageRcm provider specific input for test failover. + public partial interface IInMageRcmTestFailoverInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverProviderSpecificInput + { + /// The test network Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The test network Id.", + SerializedName = @"networkId", + PossibleTypes = new [] { typeof(string) })] + string NetworkId { get; set; } + /// + /// 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. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"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.", + SerializedName = @"recoveryPointId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryPointId { get; set; } + + } + /// InMageRcm provider specific input for test failover. + internal partial interface IInMageRcmTestFailoverInputInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverProviderSpecificInputInternal + { + /// The test network Id. + string NetworkId { get; set; } + /// + /// 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. + /// + string RecoveryPointId { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmTestFailoverInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmTestFailoverInput.json.cs new file mode 100644 index 000000000000..af83cb33b3d7 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmTestFailoverInput.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMageRcm provider specific input for test failover. + public partial class InMageRcmTestFailoverInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmTestFailoverInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmTestFailoverInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmTestFailoverInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new InMageRcmTestFailoverInput(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal InMageRcmTestFailoverInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __testFailoverProviderSpecificInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.TestFailoverProviderSpecificInput(json); + {_networkId = If( json?.PropertyT("networkId"), out var __jsonNetworkId) ? (string)__jsonNetworkId : (string)NetworkId;} + {_recoveryPointId = If( json?.PropertyT("recoveryPointId"), out var __jsonRecoveryPointId) ? (string)__jsonRecoveryPointId : (string)RecoveryPointId;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __testFailoverProviderSpecificInput?.ToJson(container, serializationMode); + AddIf( null != (((object)this._networkId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._networkId.ToString()) : null, "networkId" ,container.Add ); + AddIf( null != (((object)this._recoveryPointId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryPointId.ToString()) : null, "recoveryPointId" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmUnplannedFailoverInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmUnplannedFailoverInput.PowerShell.cs new file mode 100644 index 000000000000..41cd138ff76f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmUnplannedFailoverInput.PowerShell.cs @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// InMageRcm provider specific input for unplanned failover. + [System.ComponentModel.TypeConverter(typeof(InMageRcmUnplannedFailoverInputTypeConverter))] + public partial class InMageRcmUnplannedFailoverInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmUnplannedFailoverInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InMageRcmUnplannedFailoverInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmUnplannedFailoverInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InMageRcmUnplannedFailoverInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmUnplannedFailoverInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InMageRcmUnplannedFailoverInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("PerformShutdown")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmUnplannedFailoverInputInternal)this).PerformShutdown = (string) content.GetValueForProperty("PerformShutdown",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmUnplannedFailoverInputInternal)this).PerformShutdown, global::System.Convert.ToString); + } + if (content.Contains("RecoveryPointId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmUnplannedFailoverInputInternal)this).RecoveryPointId = (string) content.GetValueForProperty("RecoveryPointId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmUnplannedFailoverInputInternal)this).RecoveryPointId, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InMageRcmUnplannedFailoverInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("PerformShutdown")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmUnplannedFailoverInputInternal)this).PerformShutdown = (string) content.GetValueForProperty("PerformShutdown",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmUnplannedFailoverInputInternal)this).PerformShutdown, global::System.Convert.ToString); + } + if (content.Contains("RecoveryPointId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmUnplannedFailoverInputInternal)this).RecoveryPointId = (string) content.GetValueForProperty("RecoveryPointId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmUnplannedFailoverInputInternal)this).RecoveryPointId, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// InMageRcm provider specific input for unplanned failover. + [System.ComponentModel.TypeConverter(typeof(InMageRcmUnplannedFailoverInputTypeConverter))] + public partial interface IInMageRcmUnplannedFailoverInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmUnplannedFailoverInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmUnplannedFailoverInput.TypeConverter.cs new file mode 100644 index 000000000000..6a1c8c2997a0 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmUnplannedFailoverInput.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InMageRcmUnplannedFailoverInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmUnplannedFailoverInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmUnplannedFailoverInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InMageRcmUnplannedFailoverInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InMageRcmUnplannedFailoverInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InMageRcmUnplannedFailoverInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmUnplannedFailoverInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmUnplannedFailoverInput.cs new file mode 100644 index 000000000000..ed2b5cd780ae --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmUnplannedFailoverInput.cs @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMageRcm provider specific input for unplanned failover. + public partial class InMageRcmUnplannedFailoverInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmUnplannedFailoverInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmUnplannedFailoverInputInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverProviderSpecificInput __unplannedFailoverProviderSpecificInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UnplannedFailoverProviderSpecificInput(); + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverProviderSpecificInputInternal)__unplannedFailoverProviderSpecificInput).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverProviderSpecificInputInternal)__unplannedFailoverProviderSpecificInput).InstanceType = value ; } + + /// Backing field for property. + private string _performShutdown; + + /// A value indicating whether VM is to be shutdown. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string PerformShutdown { get => this._performShutdown; set => this._performShutdown = value; } + + /// Backing field for property. + private string _recoveryPointId; + + /// + /// The recovery point id to be passed to failover to a particular recovery point. In case of latest recovery point, null + /// should be passed. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryPointId { get => this._recoveryPointId; set => this._recoveryPointId = value; } + + /// Creates an new instance. + public InMageRcmUnplannedFailoverInput() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__unplannedFailoverProviderSpecificInput), __unplannedFailoverProviderSpecificInput); + await eventListener.AssertObjectIsValid(nameof(__unplannedFailoverProviderSpecificInput), __unplannedFailoverProviderSpecificInput); + } + } + /// InMageRcm provider specific input for unplanned failover. + public partial interface IInMageRcmUnplannedFailoverInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverProviderSpecificInput + { + /// A value indicating whether VM is to be shutdown. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"A value indicating whether VM is to be shutdown.", + SerializedName = @"performShutdown", + PossibleTypes = new [] { typeof(string) })] + string PerformShutdown { get; set; } + /// + /// The recovery point id to be passed to failover to a particular recovery point. In case of latest recovery point, null + /// should be passed. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery point id to be passed to failover to a particular recovery point. In case of latest recovery point, null should be passed.", + SerializedName = @"recoveryPointId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryPointId { get; set; } + + } + /// InMageRcm provider specific input for unplanned failover. + internal partial interface IInMageRcmUnplannedFailoverInputInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverProviderSpecificInputInternal + { + /// A value indicating whether VM is to be shutdown. + string PerformShutdown { get; set; } + /// + /// The recovery point id to be passed to failover to a particular recovery point. In case of latest recovery point, null + /// should be passed. + /// + string RecoveryPointId { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmUnplannedFailoverInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmUnplannedFailoverInput.json.cs new file mode 100644 index 000000000000..7bfbf7538974 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmUnplannedFailoverInput.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMageRcm provider specific input for unplanned failover. + public partial class InMageRcmUnplannedFailoverInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmUnplannedFailoverInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmUnplannedFailoverInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmUnplannedFailoverInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new InMageRcmUnplannedFailoverInput(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal InMageRcmUnplannedFailoverInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __unplannedFailoverProviderSpecificInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UnplannedFailoverProviderSpecificInput(json); + {_performShutdown = If( json?.PropertyT("performShutdown"), out var __jsonPerformShutdown) ? (string)__jsonPerformShutdown : (string)PerformShutdown;} + {_recoveryPointId = If( json?.PropertyT("recoveryPointId"), out var __jsonRecoveryPointId) ? (string)__jsonRecoveryPointId : (string)RecoveryPointId;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __unplannedFailoverProviderSpecificInput?.ToJson(container, serializationMode); + AddIf( null != (((object)this._performShutdown)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._performShutdown.ToString()) : null, "performShutdown" ,container.Add ); + AddIf( null != (((object)this._recoveryPointId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryPointId.ToString()) : null, "recoveryPointId" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmUpdateApplianceForReplicationProtectedItemInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmUpdateApplianceForReplicationProtectedItemInput.PowerShell.cs new file mode 100644 index 000000000000..2bdf56c65a9a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmUpdateApplianceForReplicationProtectedItemInput.PowerShell.cs @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// InMageRcm provider specific input to update appliance for replication protected item. + /// + [System.ComponentModel.TypeConverter(typeof(InMageRcmUpdateApplianceForReplicationProtectedItemInputTypeConverter))] + public partial class InMageRcmUpdateApplianceForReplicationProtectedItemInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmUpdateApplianceForReplicationProtectedItemInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InMageRcmUpdateApplianceForReplicationProtectedItemInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmUpdateApplianceForReplicationProtectedItemInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InMageRcmUpdateApplianceForReplicationProtectedItemInput(content); + } + + /// + /// Creates a new instance of , deserializing the content + /// from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmUpdateApplianceForReplicationProtectedItemInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InMageRcmUpdateApplianceForReplicationProtectedItemInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("RunAsAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmUpdateApplianceForReplicationProtectedItemInputInternal)this).RunAsAccountId = (string) content.GetValueForProperty("RunAsAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmUpdateApplianceForReplicationProtectedItemInputInternal)this).RunAsAccountId, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InMageRcmUpdateApplianceForReplicationProtectedItemInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("RunAsAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmUpdateApplianceForReplicationProtectedItemInputInternal)this).RunAsAccountId = (string) content.GetValueForProperty("RunAsAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmUpdateApplianceForReplicationProtectedItemInputInternal)this).RunAsAccountId, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// InMageRcm provider specific input to update appliance for replication protected item. + [System.ComponentModel.TypeConverter(typeof(InMageRcmUpdateApplianceForReplicationProtectedItemInputTypeConverter))] + public partial interface IInMageRcmUpdateApplianceForReplicationProtectedItemInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmUpdateApplianceForReplicationProtectedItemInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmUpdateApplianceForReplicationProtectedItemInput.TypeConverter.cs new file mode 100644 index 000000000000..4daf5a1807d4 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmUpdateApplianceForReplicationProtectedItemInput.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InMageRcmUpdateApplianceForReplicationProtectedItemInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no + /// suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no + /// suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmUpdateApplianceForReplicationProtectedItemInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmUpdateApplianceForReplicationProtectedItemInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InMageRcmUpdateApplianceForReplicationProtectedItemInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InMageRcmUpdateApplianceForReplicationProtectedItemInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InMageRcmUpdateApplianceForReplicationProtectedItemInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmUpdateApplianceForReplicationProtectedItemInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmUpdateApplianceForReplicationProtectedItemInput.cs new file mode 100644 index 000000000000..005639e01fd9 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmUpdateApplianceForReplicationProtectedItemInput.cs @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// + /// InMageRcm provider specific input to update appliance for replication protected item. + /// + public partial class InMageRcmUpdateApplianceForReplicationProtectedItemInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmUpdateApplianceForReplicationProtectedItemInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmUpdateApplianceForReplicationProtectedItemInputInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemProviderSpecificInput __updateApplianceForReplicationProtectedItemProviderSpecificInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateApplianceForReplicationProtectedItemProviderSpecificInput(); + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemProviderSpecificInputInternal)__updateApplianceForReplicationProtectedItemProviderSpecificInput).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemProviderSpecificInputInternal)__updateApplianceForReplicationProtectedItemProviderSpecificInput).InstanceType = value ; } + + /// Backing field for property. + private string _runAsAccountId; + + /// The run as account Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RunAsAccountId { get => this._runAsAccountId; set => this._runAsAccountId = value; } + + /// + /// Creates an new instance. + /// + public InMageRcmUpdateApplianceForReplicationProtectedItemInput() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__updateApplianceForReplicationProtectedItemProviderSpecificInput), __updateApplianceForReplicationProtectedItemProviderSpecificInput); + await eventListener.AssertObjectIsValid(nameof(__updateApplianceForReplicationProtectedItemProviderSpecificInput), __updateApplianceForReplicationProtectedItemProviderSpecificInput); + } + } + /// InMageRcm provider specific input to update appliance for replication protected item. + public partial interface IInMageRcmUpdateApplianceForReplicationProtectedItemInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemProviderSpecificInput + { + /// The run as account Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The run as account Id.", + SerializedName = @"runAsAccountId", + PossibleTypes = new [] { typeof(string) })] + string RunAsAccountId { get; set; } + + } + /// InMageRcm provider specific input to update appliance for replication protected item. + internal partial interface IInMageRcmUpdateApplianceForReplicationProtectedItemInputInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemProviderSpecificInputInternal + { + /// The run as account Id. + string RunAsAccountId { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmUpdateApplianceForReplicationProtectedItemInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmUpdateApplianceForReplicationProtectedItemInput.json.cs new file mode 100644 index 000000000000..3b162f22be94 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmUpdateApplianceForReplicationProtectedItemInput.json.cs @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// + /// InMageRcm provider specific input to update appliance for replication protected item. + /// + public partial class InMageRcmUpdateApplianceForReplicationProtectedItemInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmUpdateApplianceForReplicationProtectedItemInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmUpdateApplianceForReplicationProtectedItemInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmUpdateApplianceForReplicationProtectedItemInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new InMageRcmUpdateApplianceForReplicationProtectedItemInput(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal InMageRcmUpdateApplianceForReplicationProtectedItemInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __updateApplianceForReplicationProtectedItemProviderSpecificInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateApplianceForReplicationProtectedItemProviderSpecificInput(json); + {_runAsAccountId = If( json?.PropertyT("runAsAccountId"), out var __jsonRunAsAccountId) ? (string)__jsonRunAsAccountId : (string)RunAsAccountId;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __updateApplianceForReplicationProtectedItemProviderSpecificInput?.ToJson(container, serializationMode); + AddIf( null != (((object)this._runAsAccountId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._runAsAccountId.ToString()) : null, "runAsAccountId" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmUpdateContainerMappingInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmUpdateContainerMappingInput.PowerShell.cs new file mode 100644 index 000000000000..78ea04f02246 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmUpdateContainerMappingInput.PowerShell.cs @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// InMageRcm update protection container mapping. + [System.ComponentModel.TypeConverter(typeof(InMageRcmUpdateContainerMappingInputTypeConverter))] + public partial class InMageRcmUpdateContainerMappingInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmUpdateContainerMappingInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InMageRcmUpdateContainerMappingInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmUpdateContainerMappingInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InMageRcmUpdateContainerMappingInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmUpdateContainerMappingInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InMageRcmUpdateContainerMappingInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("EnableAgentAutoUpgrade")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmUpdateContainerMappingInputInternal)this).EnableAgentAutoUpgrade = (string) content.GetValueForProperty("EnableAgentAutoUpgrade",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmUpdateContainerMappingInputInternal)this).EnableAgentAutoUpgrade, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificUpdateContainerMappingInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificUpdateContainerMappingInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InMageRcmUpdateContainerMappingInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("EnableAgentAutoUpgrade")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmUpdateContainerMappingInputInternal)this).EnableAgentAutoUpgrade = (string) content.GetValueForProperty("EnableAgentAutoUpgrade",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmUpdateContainerMappingInputInternal)this).EnableAgentAutoUpgrade, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificUpdateContainerMappingInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificUpdateContainerMappingInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// InMageRcm update protection container mapping. + [System.ComponentModel.TypeConverter(typeof(InMageRcmUpdateContainerMappingInputTypeConverter))] + public partial interface IInMageRcmUpdateContainerMappingInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmUpdateContainerMappingInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmUpdateContainerMappingInput.TypeConverter.cs new file mode 100644 index 000000000000..c64842230acb --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmUpdateContainerMappingInput.TypeConverter.cs @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InMageRcmUpdateContainerMappingInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmUpdateContainerMappingInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmUpdateContainerMappingInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InMageRcmUpdateContainerMappingInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InMageRcmUpdateContainerMappingInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InMageRcmUpdateContainerMappingInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmUpdateContainerMappingInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmUpdateContainerMappingInput.cs new file mode 100644 index 000000000000..cfe028d7861b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmUpdateContainerMappingInput.cs @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMageRcm update protection container mapping. + public partial class InMageRcmUpdateContainerMappingInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmUpdateContainerMappingInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmUpdateContainerMappingInputInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificUpdateContainerMappingInput __replicationProviderSpecificUpdateContainerMappingInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProviderSpecificUpdateContainerMappingInput(); + + /// Backing field for property. + private string _enableAgentAutoUpgrade; + + /// A value indicating whether agent auto upgrade has to be enabled. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string EnableAgentAutoUpgrade { get => this._enableAgentAutoUpgrade; set => this._enableAgentAutoUpgrade = value; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificUpdateContainerMappingInputInternal)__replicationProviderSpecificUpdateContainerMappingInput).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificUpdateContainerMappingInputInternal)__replicationProviderSpecificUpdateContainerMappingInput).InstanceType = value ; } + + /// Creates an new instance. + public InMageRcmUpdateContainerMappingInput() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__replicationProviderSpecificUpdateContainerMappingInput), __replicationProviderSpecificUpdateContainerMappingInput); + await eventListener.AssertObjectIsValid(nameof(__replicationProviderSpecificUpdateContainerMappingInput), __replicationProviderSpecificUpdateContainerMappingInput); + } + } + /// InMageRcm update protection container mapping. + public partial interface IInMageRcmUpdateContainerMappingInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificUpdateContainerMappingInput + { + /// A value indicating whether agent auto upgrade has to be enabled. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"A value indicating whether agent auto upgrade has to be enabled.", + SerializedName = @"enableAgentAutoUpgrade", + PossibleTypes = new [] { typeof(string) })] + string EnableAgentAutoUpgrade { get; set; } + + } + /// InMageRcm update protection container mapping. + internal partial interface IInMageRcmUpdateContainerMappingInputInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificUpdateContainerMappingInputInternal + { + /// A value indicating whether agent auto upgrade has to be enabled. + string EnableAgentAutoUpgrade { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmUpdateContainerMappingInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmUpdateContainerMappingInput.json.cs new file mode 100644 index 000000000000..921af2c74da1 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmUpdateContainerMappingInput.json.cs @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMageRcm update protection container mapping. + public partial class InMageRcmUpdateContainerMappingInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmUpdateContainerMappingInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmUpdateContainerMappingInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmUpdateContainerMappingInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new InMageRcmUpdateContainerMappingInput(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal InMageRcmUpdateContainerMappingInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __replicationProviderSpecificUpdateContainerMappingInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProviderSpecificUpdateContainerMappingInput(json); + {_enableAgentAutoUpgrade = If( json?.PropertyT("enableAgentAutoUpgrade"), out var __jsonEnableAgentAutoUpgrade) ? (string)__jsonEnableAgentAutoUpgrade : (string)EnableAgentAutoUpgrade;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __replicationProviderSpecificUpdateContainerMappingInput?.ToJson(container, serializationMode); + AddIf( null != (((object)this._enableAgentAutoUpgrade)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._enableAgentAutoUpgrade.ToString()) : null, "enableAgentAutoUpgrade" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmUpdateReplicationProtectedItemInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmUpdateReplicationProtectedItemInput.PowerShell.cs new file mode 100644 index 000000000000..5d747dc6321a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmUpdateReplicationProtectedItemInput.PowerShell.cs @@ -0,0 +1,237 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// InMageRcm provider specific input to update replication protected item. + [System.ComponentModel.TypeConverter(typeof(InMageRcmUpdateReplicationProtectedItemInputTypeConverter))] + public partial class InMageRcmUpdateReplicationProtectedItemInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmUpdateReplicationProtectedItemInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InMageRcmUpdateReplicationProtectedItemInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmUpdateReplicationProtectedItemInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InMageRcmUpdateReplicationProtectedItemInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from + /// a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmUpdateReplicationProtectedItemInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InMageRcmUpdateReplicationProtectedItemInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("TargetVMName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmUpdateReplicationProtectedItemInputInternal)this).TargetVMName = (string) content.GetValueForProperty("TargetVMName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmUpdateReplicationProtectedItemInputInternal)this).TargetVMName, global::System.Convert.ToString); + } + if (content.Contains("TargetVMSize")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmUpdateReplicationProtectedItemInputInternal)this).TargetVMSize = (string) content.GetValueForProperty("TargetVMSize",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmUpdateReplicationProtectedItemInputInternal)this).TargetVMSize, global::System.Convert.ToString); + } + if (content.Contains("TargetResourceGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmUpdateReplicationProtectedItemInputInternal)this).TargetResourceGroupId = (string) content.GetValueForProperty("TargetResourceGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmUpdateReplicationProtectedItemInputInternal)this).TargetResourceGroupId, global::System.Convert.ToString); + } + if (content.Contains("TargetAvailabilitySetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmUpdateReplicationProtectedItemInputInternal)this).TargetAvailabilitySetId = (string) content.GetValueForProperty("TargetAvailabilitySetId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmUpdateReplicationProtectedItemInputInternal)this).TargetAvailabilitySetId, global::System.Convert.ToString); + } + if (content.Contains("TargetAvailabilityZone")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmUpdateReplicationProtectedItemInputInternal)this).TargetAvailabilityZone = (string) content.GetValueForProperty("TargetAvailabilityZone",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmUpdateReplicationProtectedItemInputInternal)this).TargetAvailabilityZone, global::System.Convert.ToString); + } + if (content.Contains("TargetProximityPlacementGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmUpdateReplicationProtectedItemInputInternal)this).TargetProximityPlacementGroupId = (string) content.GetValueForProperty("TargetProximityPlacementGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmUpdateReplicationProtectedItemInputInternal)this).TargetProximityPlacementGroupId, global::System.Convert.ToString); + } + if (content.Contains("TargetBootDiagnosticsStorageAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmUpdateReplicationProtectedItemInputInternal)this).TargetBootDiagnosticsStorageAccountId = (string) content.GetValueForProperty("TargetBootDiagnosticsStorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmUpdateReplicationProtectedItemInputInternal)this).TargetBootDiagnosticsStorageAccountId, global::System.Convert.ToString); + } + if (content.Contains("TargetNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmUpdateReplicationProtectedItemInputInternal)this).TargetNetworkId = (string) content.GetValueForProperty("TargetNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmUpdateReplicationProtectedItemInputInternal)this).TargetNetworkId, global::System.Convert.ToString); + } + if (content.Contains("TestNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmUpdateReplicationProtectedItemInputInternal)this).TestNetworkId = (string) content.GetValueForProperty("TestNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmUpdateReplicationProtectedItemInputInternal)this).TestNetworkId, global::System.Convert.ToString); + } + if (content.Contains("VMNic")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmUpdateReplicationProtectedItemInputInternal)this).VMNic = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicInput[]) content.GetValueForProperty("VMNic",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmUpdateReplicationProtectedItemInputInternal)this).VMNic, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmNicInputTypeConverter.ConvertFrom)); + } + if (content.Contains("LicenseType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmUpdateReplicationProtectedItemInputInternal)this).LicenseType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.LicenseType?) content.GetValueForProperty("LicenseType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmUpdateReplicationProtectedItemInputInternal)this).LicenseType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.LicenseType.CreateFrom); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemProviderInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemProviderInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InMageRcmUpdateReplicationProtectedItemInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("TargetVMName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmUpdateReplicationProtectedItemInputInternal)this).TargetVMName = (string) content.GetValueForProperty("TargetVMName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmUpdateReplicationProtectedItemInputInternal)this).TargetVMName, global::System.Convert.ToString); + } + if (content.Contains("TargetVMSize")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmUpdateReplicationProtectedItemInputInternal)this).TargetVMSize = (string) content.GetValueForProperty("TargetVMSize",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmUpdateReplicationProtectedItemInputInternal)this).TargetVMSize, global::System.Convert.ToString); + } + if (content.Contains("TargetResourceGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmUpdateReplicationProtectedItemInputInternal)this).TargetResourceGroupId = (string) content.GetValueForProperty("TargetResourceGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmUpdateReplicationProtectedItemInputInternal)this).TargetResourceGroupId, global::System.Convert.ToString); + } + if (content.Contains("TargetAvailabilitySetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmUpdateReplicationProtectedItemInputInternal)this).TargetAvailabilitySetId = (string) content.GetValueForProperty("TargetAvailabilitySetId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmUpdateReplicationProtectedItemInputInternal)this).TargetAvailabilitySetId, global::System.Convert.ToString); + } + if (content.Contains("TargetAvailabilityZone")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmUpdateReplicationProtectedItemInputInternal)this).TargetAvailabilityZone = (string) content.GetValueForProperty("TargetAvailabilityZone",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmUpdateReplicationProtectedItemInputInternal)this).TargetAvailabilityZone, global::System.Convert.ToString); + } + if (content.Contains("TargetProximityPlacementGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmUpdateReplicationProtectedItemInputInternal)this).TargetProximityPlacementGroupId = (string) content.GetValueForProperty("TargetProximityPlacementGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmUpdateReplicationProtectedItemInputInternal)this).TargetProximityPlacementGroupId, global::System.Convert.ToString); + } + if (content.Contains("TargetBootDiagnosticsStorageAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmUpdateReplicationProtectedItemInputInternal)this).TargetBootDiagnosticsStorageAccountId = (string) content.GetValueForProperty("TargetBootDiagnosticsStorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmUpdateReplicationProtectedItemInputInternal)this).TargetBootDiagnosticsStorageAccountId, global::System.Convert.ToString); + } + if (content.Contains("TargetNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmUpdateReplicationProtectedItemInputInternal)this).TargetNetworkId = (string) content.GetValueForProperty("TargetNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmUpdateReplicationProtectedItemInputInternal)this).TargetNetworkId, global::System.Convert.ToString); + } + if (content.Contains("TestNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmUpdateReplicationProtectedItemInputInternal)this).TestNetworkId = (string) content.GetValueForProperty("TestNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmUpdateReplicationProtectedItemInputInternal)this).TestNetworkId, global::System.Convert.ToString); + } + if (content.Contains("VMNic")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmUpdateReplicationProtectedItemInputInternal)this).VMNic = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicInput[]) content.GetValueForProperty("VMNic",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmUpdateReplicationProtectedItemInputInternal)this).VMNic, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmNicInputTypeConverter.ConvertFrom)); + } + if (content.Contains("LicenseType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmUpdateReplicationProtectedItemInputInternal)this).LicenseType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.LicenseType?) content.GetValueForProperty("LicenseType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmUpdateReplicationProtectedItemInputInternal)this).LicenseType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.LicenseType.CreateFrom); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemProviderInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemProviderInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// InMageRcm provider specific input to update replication protected item. + [System.ComponentModel.TypeConverter(typeof(InMageRcmUpdateReplicationProtectedItemInputTypeConverter))] + public partial interface IInMageRcmUpdateReplicationProtectedItemInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmUpdateReplicationProtectedItemInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmUpdateReplicationProtectedItemInput.TypeConverter.cs new file mode 100644 index 000000000000..c916e146b1c1 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmUpdateReplicationProtectedItemInput.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InMageRcmUpdateReplicationProtectedItemInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, + /// otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmUpdateReplicationProtectedItemInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmUpdateReplicationProtectedItemInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InMageRcmUpdateReplicationProtectedItemInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InMageRcmUpdateReplicationProtectedItemInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InMageRcmUpdateReplicationProtectedItemInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmUpdateReplicationProtectedItemInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmUpdateReplicationProtectedItemInput.cs new file mode 100644 index 000000000000..0fbef69656e2 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmUpdateReplicationProtectedItemInput.cs @@ -0,0 +1,248 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMageRcm provider specific input to update replication protected item. + public partial class InMageRcmUpdateReplicationProtectedItemInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmUpdateReplicationProtectedItemInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmUpdateReplicationProtectedItemInputInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemProviderInput __updateReplicationProtectedItemProviderInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateReplicationProtectedItemProviderInput(); + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemProviderInputInternal)__updateReplicationProtectedItemProviderInput).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemProviderInputInternal)__updateReplicationProtectedItemProviderInput).InstanceType = value ; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.LicenseType? _licenseType; + + /// The license type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.LicenseType? LicenseType { get => this._licenseType; set => this._licenseType = value; } + + /// Backing field for property. + private string _targetAvailabilitySetId; + + /// The target availability set ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetAvailabilitySetId { get => this._targetAvailabilitySetId; set => this._targetAvailabilitySetId = value; } + + /// Backing field for property. + private string _targetAvailabilityZone; + + /// The target availability zone. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetAvailabilityZone { get => this._targetAvailabilityZone; set => this._targetAvailabilityZone = value; } + + /// + /// Backing field for property. + /// + private string _targetBootDiagnosticsStorageAccountId; + + /// The target boot diagnostics storage account ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetBootDiagnosticsStorageAccountId { get => this._targetBootDiagnosticsStorageAccountId; set => this._targetBootDiagnosticsStorageAccountId = value; } + + /// Backing field for property. + private string _targetNetworkId; + + /// The target network ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetNetworkId { get => this._targetNetworkId; set => this._targetNetworkId = value; } + + /// Backing field for property. + private string _targetProximityPlacementGroupId; + + /// The target proximity placement group Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetProximityPlacementGroupId { get => this._targetProximityPlacementGroupId; set => this._targetProximityPlacementGroupId = value; } + + /// Backing field for property. + private string _targetResourceGroupId; + + /// The target resource group ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetResourceGroupId { get => this._targetResourceGroupId; set => this._targetResourceGroupId = value; } + + /// Backing field for property. + private string _targetVMName; + + /// The target VM name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetVMName { get => this._targetVMName; set => this._targetVMName = value; } + + /// Backing field for property. + private string _targetVMSize; + + /// The target VM size. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetVMSize { get => this._targetVMSize; set => this._targetVMSize = value; } + + /// Backing field for property. + private string _testNetworkId; + + /// The test network ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TestNetworkId { get => this._testNetworkId; set => this._testNetworkId = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicInput[] _vMNic; + + /// The list of NIC details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicInput[] VMNic { get => this._vMNic; set => this._vMNic = value; } + + /// + /// Creates an new instance. + /// + public InMageRcmUpdateReplicationProtectedItemInput() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__updateReplicationProtectedItemProviderInput), __updateReplicationProtectedItemProviderInput); + await eventListener.AssertObjectIsValid(nameof(__updateReplicationProtectedItemProviderInput), __updateReplicationProtectedItemProviderInput); + } + } + /// InMageRcm provider specific input to update replication protected item. + public partial interface IInMageRcmUpdateReplicationProtectedItemInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemProviderInput + { + /// The license type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The license type.", + SerializedName = @"licenseType", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.LicenseType) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.LicenseType? LicenseType { get; set; } + /// The target availability set ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target availability set ARM Id.", + SerializedName = @"targetAvailabilitySetId", + PossibleTypes = new [] { typeof(string) })] + string TargetAvailabilitySetId { get; set; } + /// The target availability zone. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target availability zone.", + SerializedName = @"targetAvailabilityZone", + PossibleTypes = new [] { typeof(string) })] + string TargetAvailabilityZone { get; set; } + /// The target boot diagnostics storage account ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target boot diagnostics storage account ARM Id.", + SerializedName = @"targetBootDiagnosticsStorageAccountId", + PossibleTypes = new [] { typeof(string) })] + string TargetBootDiagnosticsStorageAccountId { get; set; } + /// The target network ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target network ARM Id.", + SerializedName = @"targetNetworkId", + PossibleTypes = new [] { typeof(string) })] + string TargetNetworkId { get; set; } + /// The target proximity placement group Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target proximity placement group Id.", + SerializedName = @"targetProximityPlacementGroupId", + PossibleTypes = new [] { typeof(string) })] + string TargetProximityPlacementGroupId { get; set; } + /// The target resource group ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target resource group ARM Id.", + SerializedName = @"targetResourceGroupId", + PossibleTypes = new [] { typeof(string) })] + string TargetResourceGroupId { get; set; } + /// The target VM name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target VM name.", + SerializedName = @"targetVmName", + PossibleTypes = new [] { typeof(string) })] + string TargetVMName { get; set; } + /// The target VM size. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target VM size.", + SerializedName = @"targetVmSize", + PossibleTypes = new [] { typeof(string) })] + string TargetVMSize { get; set; } + /// The test network ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The test network ARM Id.", + SerializedName = @"testNetworkId", + PossibleTypes = new [] { typeof(string) })] + string TestNetworkId { get; set; } + /// The list of NIC details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of NIC details.", + SerializedName = @"vmNics", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicInput) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicInput[] VMNic { get; set; } + + } + /// InMageRcm provider specific input to update replication protected item. + internal partial interface IInMageRcmUpdateReplicationProtectedItemInputInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemProviderInputInternal + { + /// The license type. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.LicenseType? LicenseType { get; set; } + /// The target availability set ARM Id. + string TargetAvailabilitySetId { get; set; } + /// The target availability zone. + string TargetAvailabilityZone { get; set; } + /// The target boot diagnostics storage account ARM Id. + string TargetBootDiagnosticsStorageAccountId { get; set; } + /// The target network ARM Id. + string TargetNetworkId { get; set; } + /// The target proximity placement group Id. + string TargetProximityPlacementGroupId { get; set; } + /// The target resource group ARM Id. + string TargetResourceGroupId { get; set; } + /// The target VM name. + string TargetVMName { get; set; } + /// The target VM size. + string TargetVMSize { get; set; } + /// The test network ARM Id. + string TestNetworkId { get; set; } + /// The list of NIC details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicInput[] VMNic { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmUpdateReplicationProtectedItemInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmUpdateReplicationProtectedItemInput.json.cs new file mode 100644 index 000000000000..e58c5ac7967a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageRcmUpdateReplicationProtectedItemInput.json.cs @@ -0,0 +1,141 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMageRcm provider specific input to update replication protected item. + public partial class InMageRcmUpdateReplicationProtectedItemInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmUpdateReplicationProtectedItemInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmUpdateReplicationProtectedItemInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmUpdateReplicationProtectedItemInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new InMageRcmUpdateReplicationProtectedItemInput(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal InMageRcmUpdateReplicationProtectedItemInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __updateReplicationProtectedItemProviderInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateReplicationProtectedItemProviderInput(json); + {_targetVMName = If( json?.PropertyT("targetVmName"), out var __jsonTargetVMName) ? (string)__jsonTargetVMName : (string)TargetVMName;} + {_targetVMSize = If( json?.PropertyT("targetVmSize"), out var __jsonTargetVMSize) ? (string)__jsonTargetVMSize : (string)TargetVMSize;} + {_targetResourceGroupId = If( json?.PropertyT("targetResourceGroupId"), out var __jsonTargetResourceGroupId) ? (string)__jsonTargetResourceGroupId : (string)TargetResourceGroupId;} + {_targetAvailabilitySetId = If( json?.PropertyT("targetAvailabilitySetId"), out var __jsonTargetAvailabilitySetId) ? (string)__jsonTargetAvailabilitySetId : (string)TargetAvailabilitySetId;} + {_targetAvailabilityZone = If( json?.PropertyT("targetAvailabilityZone"), out var __jsonTargetAvailabilityZone) ? (string)__jsonTargetAvailabilityZone : (string)TargetAvailabilityZone;} + {_targetProximityPlacementGroupId = If( json?.PropertyT("targetProximityPlacementGroupId"), out var __jsonTargetProximityPlacementGroupId) ? (string)__jsonTargetProximityPlacementGroupId : (string)TargetProximityPlacementGroupId;} + {_targetBootDiagnosticsStorageAccountId = If( json?.PropertyT("targetBootDiagnosticsStorageAccountId"), out var __jsonTargetBootDiagnosticsStorageAccountId) ? (string)__jsonTargetBootDiagnosticsStorageAccountId : (string)TargetBootDiagnosticsStorageAccountId;} + {_targetNetworkId = If( json?.PropertyT("targetNetworkId"), out var __jsonTargetNetworkId) ? (string)__jsonTargetNetworkId : (string)TargetNetworkId;} + {_testNetworkId = If( json?.PropertyT("testNetworkId"), out var __jsonTestNetworkId) ? (string)__jsonTestNetworkId : (string)TestNetworkId;} + {_vMNic = If( json?.PropertyT("vmNics"), out var __jsonVMNics) ? If( __jsonVMNics as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageRcmNicInput) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageRcmNicInput.FromJson(__u) )) ))() : null : VMNic;} + {_licenseType = If( json?.PropertyT("licenseType"), out var __jsonLicenseType) ? (string)__jsonLicenseType : (string)LicenseType;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __updateReplicationProtectedItemProviderInput?.ToJson(container, serializationMode); + AddIf( null != (((object)this._targetVMName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetVMName.ToString()) : null, "targetVmName" ,container.Add ); + AddIf( null != (((object)this._targetVMSize)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetVMSize.ToString()) : null, "targetVmSize" ,container.Add ); + AddIf( null != (((object)this._targetResourceGroupId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetResourceGroupId.ToString()) : null, "targetResourceGroupId" ,container.Add ); + AddIf( null != (((object)this._targetAvailabilitySetId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetAvailabilitySetId.ToString()) : null, "targetAvailabilitySetId" ,container.Add ); + AddIf( null != (((object)this._targetAvailabilityZone)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetAvailabilityZone.ToString()) : null, "targetAvailabilityZone" ,container.Add ); + AddIf( null != (((object)this._targetProximityPlacementGroupId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetProximityPlacementGroupId.ToString()) : null, "targetProximityPlacementGroupId" ,container.Add ); + AddIf( null != (((object)this._targetBootDiagnosticsStorageAccountId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetBootDiagnosticsStorageAccountId.ToString()) : null, "targetBootDiagnosticsStorageAccountId" ,container.Add ); + AddIf( null != (((object)this._targetNetworkId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetNetworkId.ToString()) : null, "targetNetworkId" ,container.Add ); + AddIf( null != (((object)this._testNetworkId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._testNetworkId.ToString()) : null, "testNetworkId" ,container.Add ); + if (null != this._vMNic) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._vMNic ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("vmNics",__w); + } + AddIf( null != (((object)this._licenseType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._licenseType.ToString()) : null, "licenseType" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageReplicationDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageReplicationDetails.PowerShell.cs new file mode 100644 index 000000000000..34acd00cc298 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageReplicationDetails.PowerShell.cs @@ -0,0 +1,538 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// InMage provider specific settings. + [System.ComponentModel.TypeConverter(typeof(InMageReplicationDetailsTypeConverter))] + public partial class InMageReplicationDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InMageReplicationDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InMageReplicationDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InMageReplicationDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("OSDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).OSDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDiskDetails) content.GetValueForProperty("OSDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).OSDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.OSDiskDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("ResyncDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).ResyncDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInitialReplicationDetails) content.GetValueForProperty("ResyncDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).ResyncDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InitialReplicationDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("AgentDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).AgentDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAgentDetails) content.GetValueForProperty("AgentDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).AgentDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAgentDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("ActiveSiteType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).ActiveSiteType = (string) content.GetValueForProperty("ActiveSiteType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).ActiveSiteType, global::System.Convert.ToString); + } + if (content.Contains("SourceVMCpuCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).SourceVMCpuCount = (int?) content.GetValueForProperty("SourceVMCpuCount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).SourceVMCpuCount, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("SourceVMRamSizeInMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).SourceVMRamSizeInMb = (int?) content.GetValueForProperty("SourceVMRamSizeInMb",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).SourceVMRamSizeInMb, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("ProtectionStage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).ProtectionStage = (string) content.GetValueForProperty("ProtectionStage",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).ProtectionStage, global::System.Convert.ToString); + } + if (content.Contains("VMId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).VMId = (string) content.GetValueForProperty("VMId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).VMId, global::System.Convert.ToString); + } + if (content.Contains("VMProtectionState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).VMProtectionState = (string) content.GetValueForProperty("VMProtectionState",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).VMProtectionState, global::System.Convert.ToString); + } + if (content.Contains("VMProtectionStateDescription")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).VMProtectionStateDescription = (string) content.GetValueForProperty("VMProtectionStateDescription",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).VMProtectionStateDescription, global::System.Convert.ToString); + } + if (content.Contains("RetentionWindowStart")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).RetentionWindowStart = (global::System.DateTime?) content.GetValueForProperty("RetentionWindowStart",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).RetentionWindowStart, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("RetentionWindowEnd")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).RetentionWindowEnd = (global::System.DateTime?) content.GetValueForProperty("RetentionWindowEnd",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).RetentionWindowEnd, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("CompressedDataRateInMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).CompressedDataRateInMb = (double?) content.GetValueForProperty("CompressedDataRateInMb",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).CompressedDataRateInMb, (__y)=> (double) global::System.Convert.ChangeType(__y, typeof(double))); + } + if (content.Contains("UncompressedDataRateInMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).UncompressedDataRateInMb = (double?) content.GetValueForProperty("UncompressedDataRateInMb",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).UncompressedDataRateInMb, (__y)=> (double) global::System.Convert.ChangeType(__y, typeof(double))); + } + if (content.Contains("RpoInSecond")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).RpoInSecond = (long?) content.GetValueForProperty("RpoInSecond",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).RpoInSecond, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("ProtectedDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).ProtectedDisk = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetails[]) content.GetValueForProperty("ProtectedDisk",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).ProtectedDisk, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageProtectedDiskDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("IPAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).IPAddress = (string) content.GetValueForProperty("IPAddress",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).IPAddress, global::System.Convert.ToString); + } + if (content.Contains("LastHeartbeat")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).LastHeartbeat = (global::System.DateTime?) content.GetValueForProperty("LastHeartbeat",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).LastHeartbeat, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ProcessServerId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).ProcessServerId = (string) content.GetValueForProperty("ProcessServerId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).ProcessServerId, global::System.Convert.ToString); + } + if (content.Contains("MasterTargetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).MasterTargetId = (string) content.GetValueForProperty("MasterTargetId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).MasterTargetId, global::System.Convert.ToString); + } + if (content.Contains("ConsistencyPoint")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).ConsistencyPoint = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsConsistencyPoints) content.GetValueForProperty("ConsistencyPoint",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).ConsistencyPoint, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageReplicationDetailsConsistencyPointsTypeConverter.ConvertFrom); + } + if (content.Contains("DiskResized")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).DiskResized = (string) content.GetValueForProperty("DiskResized",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).DiskResized, global::System.Convert.ToString); + } + if (content.Contains("RebootAfterUpdateStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).RebootAfterUpdateStatus = (string) content.GetValueForProperty("RebootAfterUpdateStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).RebootAfterUpdateStatus, global::System.Convert.ToString); + } + if (content.Contains("MultiVMGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).MultiVMGroupId = (string) content.GetValueForProperty("MultiVMGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).MultiVMGroupId, global::System.Convert.ToString); + } + if (content.Contains("MultiVMGroupName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).MultiVMGroupName = (string) content.GetValueForProperty("MultiVMGroupName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).MultiVMGroupName, global::System.Convert.ToString); + } + if (content.Contains("MultiVMSyncStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).MultiVMSyncStatus = (string) content.GetValueForProperty("MultiVMSyncStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).MultiVMSyncStatus, global::System.Convert.ToString); + } + if (content.Contains("VCenterInfrastructureId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).VCenterInfrastructureId = (string) content.GetValueForProperty("VCenterInfrastructureId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).VCenterInfrastructureId, global::System.Convert.ToString); + } + if (content.Contains("InfrastructureVMId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).InfrastructureVMId = (string) content.GetValueForProperty("InfrastructureVMId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).InfrastructureVMId, global::System.Convert.ToString); + } + if (content.Contains("VMNic")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).VMNic = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetails[]) content.GetValueForProperty("VMNic",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).VMNic, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMNicDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("DiscoveryType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).DiscoveryType = (string) content.GetValueForProperty("DiscoveryType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).DiscoveryType, global::System.Convert.ToString); + } + if (content.Contains("AzureStorageAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).AzureStorageAccountId = (string) content.GetValueForProperty("AzureStorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).AzureStorageAccountId, global::System.Convert.ToString); + } + if (content.Contains("Datastore")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).Datastore = (string[]) content.GetValueForProperty("Datastore",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).Datastore, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("ValidationError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).ValidationError = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[]) content.GetValueForProperty("ValidationError",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).ValidationError, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("LastRpoCalculatedTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).LastRpoCalculatedTime = (global::System.DateTime?) content.GetValueForProperty("LastRpoCalculatedTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).LastRpoCalculatedTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("LastUpdateReceivedTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).LastUpdateReceivedTime = (global::System.DateTime?) content.GetValueForProperty("LastUpdateReceivedTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).LastUpdateReceivedTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ReplicaId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).ReplicaId = (string) content.GetValueForProperty("ReplicaId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).ReplicaId, global::System.Convert.ToString); + } + if (content.Contains("OSVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).OSVersion = (string) content.GetValueForProperty("OSVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).OSVersion, global::System.Convert.ToString); + } + if (content.Contains("IsAdditionalStatsAvailable")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).IsAdditionalStatsAvailable = (bool?) content.GetValueForProperty("IsAdditionalStatsAvailable",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).IsAdditionalStatsAvailable, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("TotalDataTransferred")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).TotalDataTransferred = (long?) content.GetValueForProperty("TotalDataTransferred",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).TotalDataTransferred, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("TotalProgressHealth")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).TotalProgressHealth = (string) content.GetValueForProperty("TotalProgressHealth",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).TotalProgressHealth, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettingsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettingsInternal)this).InstanceType, global::System.Convert.ToString); + } + if (content.Contains("OSDetailOsvhdId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).OSDetailOsvhdId = (string) content.GetValueForProperty("OSDetailOsvhdId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).OSDetailOsvhdId, global::System.Convert.ToString); + } + if (content.Contains("OSDetailOstype")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).OSDetailOstype = (string) content.GetValueForProperty("OSDetailOstype",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).OSDetailOstype, global::System.Convert.ToString); + } + if (content.Contains("OSDetailVhdName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).OSDetailVhdName = (string) content.GetValueForProperty("OSDetailVhdName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).OSDetailVhdName, global::System.Convert.ToString); + } + if (content.Contains("ResyncDetailInitialReplicationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).ResyncDetailInitialReplicationType = (string) content.GetValueForProperty("ResyncDetailInitialReplicationType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).ResyncDetailInitialReplicationType, global::System.Convert.ToString); + } + if (content.Contains("ResyncDetailInitialReplicationProgressPercentage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).ResyncDetailInitialReplicationProgressPercentage = (string) content.GetValueForProperty("ResyncDetailInitialReplicationProgressPercentage",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).ResyncDetailInitialReplicationProgressPercentage, global::System.Convert.ToString); + } + if (content.Contains("AgentDetailAgentVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).AgentDetailAgentVersion = (string) content.GetValueForProperty("AgentDetailAgentVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).AgentDetailAgentVersion, global::System.Convert.ToString); + } + if (content.Contains("AgentDetailAgentUpdateStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).AgentDetailAgentUpdateStatus = (string) content.GetValueForProperty("AgentDetailAgentUpdateStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).AgentDetailAgentUpdateStatus, global::System.Convert.ToString); + } + if (content.Contains("AgentDetailPostUpdateRebootStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).AgentDetailPostUpdateRebootStatus = (string) content.GetValueForProperty("AgentDetailPostUpdateRebootStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).AgentDetailPostUpdateRebootStatus, global::System.Convert.ToString); + } + if (content.Contains("AgentDetailAgentExpiryDate")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).AgentDetailAgentExpiryDate = (global::System.DateTime?) content.GetValueForProperty("AgentDetailAgentExpiryDate",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).AgentDetailAgentExpiryDate, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InMageReplicationDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("OSDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).OSDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDiskDetails) content.GetValueForProperty("OSDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).OSDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.OSDiskDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("ResyncDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).ResyncDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInitialReplicationDetails) content.GetValueForProperty("ResyncDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).ResyncDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InitialReplicationDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("AgentDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).AgentDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAgentDetails) content.GetValueForProperty("AgentDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).AgentDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAgentDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("ActiveSiteType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).ActiveSiteType = (string) content.GetValueForProperty("ActiveSiteType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).ActiveSiteType, global::System.Convert.ToString); + } + if (content.Contains("SourceVMCpuCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).SourceVMCpuCount = (int?) content.GetValueForProperty("SourceVMCpuCount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).SourceVMCpuCount, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("SourceVMRamSizeInMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).SourceVMRamSizeInMb = (int?) content.GetValueForProperty("SourceVMRamSizeInMb",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).SourceVMRamSizeInMb, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("ProtectionStage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).ProtectionStage = (string) content.GetValueForProperty("ProtectionStage",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).ProtectionStage, global::System.Convert.ToString); + } + if (content.Contains("VMId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).VMId = (string) content.GetValueForProperty("VMId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).VMId, global::System.Convert.ToString); + } + if (content.Contains("VMProtectionState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).VMProtectionState = (string) content.GetValueForProperty("VMProtectionState",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).VMProtectionState, global::System.Convert.ToString); + } + if (content.Contains("VMProtectionStateDescription")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).VMProtectionStateDescription = (string) content.GetValueForProperty("VMProtectionStateDescription",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).VMProtectionStateDescription, global::System.Convert.ToString); + } + if (content.Contains("RetentionWindowStart")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).RetentionWindowStart = (global::System.DateTime?) content.GetValueForProperty("RetentionWindowStart",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).RetentionWindowStart, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("RetentionWindowEnd")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).RetentionWindowEnd = (global::System.DateTime?) content.GetValueForProperty("RetentionWindowEnd",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).RetentionWindowEnd, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("CompressedDataRateInMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).CompressedDataRateInMb = (double?) content.GetValueForProperty("CompressedDataRateInMb",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).CompressedDataRateInMb, (__y)=> (double) global::System.Convert.ChangeType(__y, typeof(double))); + } + if (content.Contains("UncompressedDataRateInMb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).UncompressedDataRateInMb = (double?) content.GetValueForProperty("UncompressedDataRateInMb",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).UncompressedDataRateInMb, (__y)=> (double) global::System.Convert.ChangeType(__y, typeof(double))); + } + if (content.Contains("RpoInSecond")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).RpoInSecond = (long?) content.GetValueForProperty("RpoInSecond",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).RpoInSecond, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("ProtectedDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).ProtectedDisk = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetails[]) content.GetValueForProperty("ProtectedDisk",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).ProtectedDisk, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageProtectedDiskDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("IPAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).IPAddress = (string) content.GetValueForProperty("IPAddress",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).IPAddress, global::System.Convert.ToString); + } + if (content.Contains("LastHeartbeat")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).LastHeartbeat = (global::System.DateTime?) content.GetValueForProperty("LastHeartbeat",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).LastHeartbeat, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ProcessServerId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).ProcessServerId = (string) content.GetValueForProperty("ProcessServerId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).ProcessServerId, global::System.Convert.ToString); + } + if (content.Contains("MasterTargetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).MasterTargetId = (string) content.GetValueForProperty("MasterTargetId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).MasterTargetId, global::System.Convert.ToString); + } + if (content.Contains("ConsistencyPoint")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).ConsistencyPoint = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsConsistencyPoints) content.GetValueForProperty("ConsistencyPoint",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).ConsistencyPoint, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageReplicationDetailsConsistencyPointsTypeConverter.ConvertFrom); + } + if (content.Contains("DiskResized")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).DiskResized = (string) content.GetValueForProperty("DiskResized",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).DiskResized, global::System.Convert.ToString); + } + if (content.Contains("RebootAfterUpdateStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).RebootAfterUpdateStatus = (string) content.GetValueForProperty("RebootAfterUpdateStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).RebootAfterUpdateStatus, global::System.Convert.ToString); + } + if (content.Contains("MultiVMGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).MultiVMGroupId = (string) content.GetValueForProperty("MultiVMGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).MultiVMGroupId, global::System.Convert.ToString); + } + if (content.Contains("MultiVMGroupName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).MultiVMGroupName = (string) content.GetValueForProperty("MultiVMGroupName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).MultiVMGroupName, global::System.Convert.ToString); + } + if (content.Contains("MultiVMSyncStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).MultiVMSyncStatus = (string) content.GetValueForProperty("MultiVMSyncStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).MultiVMSyncStatus, global::System.Convert.ToString); + } + if (content.Contains("VCenterInfrastructureId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).VCenterInfrastructureId = (string) content.GetValueForProperty("VCenterInfrastructureId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).VCenterInfrastructureId, global::System.Convert.ToString); + } + if (content.Contains("InfrastructureVMId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).InfrastructureVMId = (string) content.GetValueForProperty("InfrastructureVMId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).InfrastructureVMId, global::System.Convert.ToString); + } + if (content.Contains("VMNic")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).VMNic = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetails[]) content.GetValueForProperty("VMNic",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).VMNic, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMNicDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("DiscoveryType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).DiscoveryType = (string) content.GetValueForProperty("DiscoveryType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).DiscoveryType, global::System.Convert.ToString); + } + if (content.Contains("AzureStorageAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).AzureStorageAccountId = (string) content.GetValueForProperty("AzureStorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).AzureStorageAccountId, global::System.Convert.ToString); + } + if (content.Contains("Datastore")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).Datastore = (string[]) content.GetValueForProperty("Datastore",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).Datastore, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("ValidationError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).ValidationError = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[]) content.GetValueForProperty("ValidationError",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).ValidationError, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("LastRpoCalculatedTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).LastRpoCalculatedTime = (global::System.DateTime?) content.GetValueForProperty("LastRpoCalculatedTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).LastRpoCalculatedTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("LastUpdateReceivedTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).LastUpdateReceivedTime = (global::System.DateTime?) content.GetValueForProperty("LastUpdateReceivedTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).LastUpdateReceivedTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ReplicaId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).ReplicaId = (string) content.GetValueForProperty("ReplicaId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).ReplicaId, global::System.Convert.ToString); + } + if (content.Contains("OSVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).OSVersion = (string) content.GetValueForProperty("OSVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).OSVersion, global::System.Convert.ToString); + } + if (content.Contains("IsAdditionalStatsAvailable")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).IsAdditionalStatsAvailable = (bool?) content.GetValueForProperty("IsAdditionalStatsAvailable",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).IsAdditionalStatsAvailable, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("TotalDataTransferred")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).TotalDataTransferred = (long?) content.GetValueForProperty("TotalDataTransferred",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).TotalDataTransferred, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("TotalProgressHealth")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).TotalProgressHealth = (string) content.GetValueForProperty("TotalProgressHealth",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).TotalProgressHealth, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettingsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettingsInternal)this).InstanceType, global::System.Convert.ToString); + } + if (content.Contains("OSDetailOsvhdId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).OSDetailOsvhdId = (string) content.GetValueForProperty("OSDetailOsvhdId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).OSDetailOsvhdId, global::System.Convert.ToString); + } + if (content.Contains("OSDetailOstype")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).OSDetailOstype = (string) content.GetValueForProperty("OSDetailOstype",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).OSDetailOstype, global::System.Convert.ToString); + } + if (content.Contains("OSDetailVhdName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).OSDetailVhdName = (string) content.GetValueForProperty("OSDetailVhdName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).OSDetailVhdName, global::System.Convert.ToString); + } + if (content.Contains("ResyncDetailInitialReplicationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).ResyncDetailInitialReplicationType = (string) content.GetValueForProperty("ResyncDetailInitialReplicationType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).ResyncDetailInitialReplicationType, global::System.Convert.ToString); + } + if (content.Contains("ResyncDetailInitialReplicationProgressPercentage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).ResyncDetailInitialReplicationProgressPercentage = (string) content.GetValueForProperty("ResyncDetailInitialReplicationProgressPercentage",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).ResyncDetailInitialReplicationProgressPercentage, global::System.Convert.ToString); + } + if (content.Contains("AgentDetailAgentVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).AgentDetailAgentVersion = (string) content.GetValueForProperty("AgentDetailAgentVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).AgentDetailAgentVersion, global::System.Convert.ToString); + } + if (content.Contains("AgentDetailAgentUpdateStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).AgentDetailAgentUpdateStatus = (string) content.GetValueForProperty("AgentDetailAgentUpdateStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).AgentDetailAgentUpdateStatus, global::System.Convert.ToString); + } + if (content.Contains("AgentDetailPostUpdateRebootStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).AgentDetailPostUpdateRebootStatus = (string) content.GetValueForProperty("AgentDetailPostUpdateRebootStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).AgentDetailPostUpdateRebootStatus, global::System.Convert.ToString); + } + if (content.Contains("AgentDetailAgentExpiryDate")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).AgentDetailAgentExpiryDate = (global::System.DateTime?) content.GetValueForProperty("AgentDetailAgentExpiryDate",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal)this).AgentDetailAgentExpiryDate, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// InMage provider specific settings. + [System.ComponentModel.TypeConverter(typeof(InMageReplicationDetailsTypeConverter))] + public partial interface IInMageReplicationDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageReplicationDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageReplicationDetails.TypeConverter.cs new file mode 100644 index 000000000000..dba126a6833c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageReplicationDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InMageReplicationDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InMageReplicationDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InMageReplicationDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InMageReplicationDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageReplicationDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageReplicationDetails.cs new file mode 100644 index 000000000000..45b5d8bcaa86 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageReplicationDetails.cs @@ -0,0 +1,878 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMage provider specific settings. + public partial class InMageReplicationDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettings __replicationProviderSpecificSettings = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProviderSpecificSettings(); + + /// Backing field for property. + private string _activeSiteType; + + /// + /// 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. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ActiveSiteType { get => this._activeSiteType; set => this._activeSiteType = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAgentDetails _agentDetail; + + /// The agent details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAgentDetails AgentDetail { get => (this._agentDetail = this._agentDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAgentDetails()); set => this._agentDetail = value; } + + /// Agent expiry date. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public global::System.DateTime? AgentDetailAgentExpiryDate { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAgentDetailsInternal)AgentDetail).AgentExpiryDate; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAgentDetailsInternal)AgentDetail).AgentExpiryDate = value ?? default(global::System.DateTime); } + + /// A value indicating whether installed agent needs to be updated. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string AgentDetailAgentUpdateStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAgentDetailsInternal)AgentDetail).AgentUpdateStatus; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAgentDetailsInternal)AgentDetail).AgentUpdateStatus = value ?? null; } + + /// The agent version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string AgentDetailAgentVersion { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAgentDetailsInternal)AgentDetail).AgentVersion; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAgentDetailsInternal)AgentDetail).AgentVersion = value ?? null; } + + /// A value indicating whether reboot is required after update is applied. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string AgentDetailPostUpdateRebootStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAgentDetailsInternal)AgentDetail).PostUpdateRebootStatus; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAgentDetailsInternal)AgentDetail).PostUpdateRebootStatus = value ?? null; } + + /// Backing field for property. + private string _azureStorageAccountId; + + /// + /// A value indicating the underlying Azure storage account. If the VM is not running in Azure, this value shall be set to + /// null. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string AzureStorageAccountId { get => this._azureStorageAccountId; set => this._azureStorageAccountId = value; } + + /// Backing field for property. + private double? _compressedDataRateInMb; + + /// The compressed data change rate in MB. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public double? CompressedDataRateInMb { get => this._compressedDataRateInMb; set => this._compressedDataRateInMb = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsConsistencyPoints _consistencyPoint; + + /// The collection of Consistency points. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsConsistencyPoints ConsistencyPoint { get => (this._consistencyPoint = this._consistencyPoint ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageReplicationDetailsConsistencyPoints()); set => this._consistencyPoint = value; } + + /// Backing field for property. + private string[] _datastore; + + /// + /// The datastores of the on-premise machine Value can be list of strings that contain datastore names. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string[] Datastore { get => this._datastore; set => this._datastore = value; } + + /// Backing field for property. + private string _discoveryType; + + /// A value indicating the discovery type of the machine. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string DiscoveryType { get => this._discoveryType; set => this._discoveryType = value; } + + /// Backing field for property. + private string _diskResized; + + /// A value indicating whether any disk is resized for this VM. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string DiskResized { get => this._diskResized; set => this._diskResized = value; } + + /// Backing field for property. + private string _iPAddress; + + /// The source IP address. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string IPAddress { get => this._iPAddress; set => this._iPAddress = value; } + + /// Backing field for property. + private string _infrastructureVMId; + + /// The infrastructure VM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string InfrastructureVMId { get => this._infrastructureVMId; set => this._infrastructureVMId = value; } + + /// Gets the Instance type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettingsInternal)__replicationProviderSpecificSettings).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettingsInternal)__replicationProviderSpecificSettings).InstanceType = value ; } + + /// Backing field for property. + private bool? _isAdditionalStatsAvailable; + + /// A value indicating whether additional IR stats are available or not. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public bool? IsAdditionalStatsAvailable { get => this._isAdditionalStatsAvailable; set => this._isAdditionalStatsAvailable = value; } + + /// Backing field for property. + private global::System.DateTime? _lastHeartbeat; + + /// The last heartbeat received from the source server. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public global::System.DateTime? LastHeartbeat { get => this._lastHeartbeat; set => this._lastHeartbeat = value; } + + /// Backing field for property. + private global::System.DateTime? _lastRpoCalculatedTime; + + /// The last RPO calculated time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public global::System.DateTime? LastRpoCalculatedTime { get => this._lastRpoCalculatedTime; set => this._lastRpoCalculatedTime = value; } + + /// Backing field for property. + private global::System.DateTime? _lastUpdateReceivedTime; + + /// The last update time received from on-prem components. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public global::System.DateTime? LastUpdateReceivedTime { get => this._lastUpdateReceivedTime; set => this._lastUpdateReceivedTime = value; } + + /// Backing field for property. + private string _masterTargetId; + + /// The master target Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string MasterTargetId { get => this._masterTargetId; set => this._masterTargetId = value; } + + /// Internal Acessors for AgentDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAgentDetails Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal.AgentDetail { get => (this._agentDetail = this._agentDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAgentDetails()); set { {_agentDetail = value;} } } + + /// Internal Acessors for OSDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDiskDetails Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal.OSDetail { get => (this._oSDetail = this._oSDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.OSDiskDetails()); set { {_oSDetail = value;} } } + + /// Internal Acessors for ResyncDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInitialReplicationDetails Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsInternal.ResyncDetail { get => (this._resyncDetail = this._resyncDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InitialReplicationDetails()); set { {_resyncDetail = value;} } } + + /// Backing field for property. + private string _multiVMGroupId; + + /// The multi vm group Id, if any. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string MultiVMGroupId { get => this._multiVMGroupId; set => this._multiVMGroupId = value; } + + /// Backing field for property. + private string _multiVMGroupName; + + /// The multi vm group name, if any. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string MultiVMGroupName { get => this._multiVMGroupName; set => this._multiVMGroupName = value; } + + /// Backing field for property. + private string _multiVMSyncStatus; + + /// A value indicating whether the multi vm sync is enabled or disabled. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string MultiVMSyncStatus { get => this._multiVMSyncStatus; set => this._multiVMSyncStatus = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDiskDetails _oSDetail; + + /// The OS details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDiskDetails OSDetail { get => (this._oSDetail = this._oSDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.OSDiskDetails()); set => this._oSDetail = value; } + + /// The type of the OS on the VM. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string OSDetailOstype { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDiskDetailsInternal)OSDetail).OSType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDiskDetailsInternal)OSDetail).OSType = value ?? null; } + + /// The id of the disk containing the OS. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string OSDetailOsvhdId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDiskDetailsInternal)OSDetail).OSVhdId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDiskDetailsInternal)OSDetail).OSVhdId = value ?? null; } + + /// The OS disk VHD name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string OSDetailVhdName { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDiskDetailsInternal)OSDetail).VhdName; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDiskDetailsInternal)OSDetail).VhdName = value ?? null; } + + /// Backing field for property. + private string _oSVersion; + + /// The OS Version of the protected item. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string OSVersion { get => this._oSVersion; set => this._oSVersion = value; } + + /// Backing field for property. + private string _processServerId; + + /// The process server Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ProcessServerId { get => this._processServerId; set => this._processServerId = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetails[] _protectedDisk; + + /// The list of protected disks. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetails[] ProtectedDisk { get => this._protectedDisk; set => this._protectedDisk = value; } + + /// Backing field for property. + private string _protectionStage; + + /// The protection stage. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ProtectionStage { get => this._protectionStage; set => this._protectionStage = value; } + + /// Backing field for property. + private string _rebootAfterUpdateStatus; + + /// A value indicating whether the source server requires a restart after update. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RebootAfterUpdateStatus { get => this._rebootAfterUpdateStatus; set => this._rebootAfterUpdateStatus = value; } + + /// Backing field for property. + private string _replicaId; + + /// The replica id of the protected item. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ReplicaId { get => this._replicaId; set => this._replicaId = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInitialReplicationDetails _resyncDetail; + + /// The resync details of the machine. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInitialReplicationDetails ResyncDetail { get => (this._resyncDetail = this._resyncDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InitialReplicationDetails()); set => this._resyncDetail = value; } + + /// The initial replication progress percentage. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ResyncDetailInitialReplicationProgressPercentage { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInitialReplicationDetailsInternal)ResyncDetail).InitialReplicationProgressPercentage; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInitialReplicationDetailsInternal)ResyncDetail).InitialReplicationProgressPercentage = value ?? null; } + + /// Initial replication type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ResyncDetailInitialReplicationType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInitialReplicationDetailsInternal)ResyncDetail).InitialReplicationType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInitialReplicationDetailsInternal)ResyncDetail).InitialReplicationType = value ?? null; } + + /// Backing field for property. + private global::System.DateTime? _retentionWindowEnd; + + /// The retention window end time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public global::System.DateTime? RetentionWindowEnd { get => this._retentionWindowEnd; set => this._retentionWindowEnd = value; } + + /// Backing field for property. + private global::System.DateTime? _retentionWindowStart; + + /// The retention window start time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public global::System.DateTime? RetentionWindowStart { get => this._retentionWindowStart; set => this._retentionWindowStart = value; } + + /// Backing field for property. + private long? _rpoInSecond; + + /// The RPO in seconds. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public long? RpoInSecond { get => this._rpoInSecond; set => this._rpoInSecond = value; } + + /// Backing field for property. + private int? _sourceVMCpuCount; + + /// The CPU count of the VM on the primary side. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? SourceVMCpuCount { get => this._sourceVMCpuCount; set => this._sourceVMCpuCount = value; } + + /// Backing field for property. + private int? _sourceVMRamSizeInMb; + + /// The RAM size of the VM on the primary side. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? SourceVMRamSizeInMb { get => this._sourceVMRamSizeInMb; set => this._sourceVMRamSizeInMb = value; } + + /// Backing field for property. + private long? _totalDataTransferred; + + /// The total transferred data in bytes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public long? TotalDataTransferred { get => this._totalDataTransferred; set => this._totalDataTransferred = value; } + + /// Backing field for property. + private string _totalProgressHealth; + + /// The progress health. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TotalProgressHealth { get => this._totalProgressHealth; set => this._totalProgressHealth = value; } + + /// Backing field for property. + private double? _uncompressedDataRateInMb; + + /// The uncompressed data change rate in MB. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public double? UncompressedDataRateInMb { get => this._uncompressedDataRateInMb; set => this._uncompressedDataRateInMb = value; } + + /// Backing field for property. + private string _vCenterInfrastructureId; + + /// The vCenter infrastructure Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string VCenterInfrastructureId { get => this._vCenterInfrastructureId; set => this._vCenterInfrastructureId = value; } + + /// Backing field for property. + private string _vMId; + + /// The virtual machine Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string VMId { get => this._vMId; set => this._vMId = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetails[] _vMNic; + + /// The PE Network details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetails[] VMNic { get => this._vMNic; set => this._vMNic = value; } + + /// Backing field for property. + private string _vMProtectionState; + + /// The protection state for the vm. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string VMProtectionState { get => this._vMProtectionState; set => this._vMProtectionState = value; } + + /// Backing field for property. + private string _vMProtectionStateDescription; + + /// The protection state description for the vm. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string VMProtectionStateDescription { get => this._vMProtectionStateDescription; set => this._vMProtectionStateDescription = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] _validationError; + + /// + /// The validation errors of the on-premise machine Value can be list of validation errors. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] ValidationError { get => this._validationError; set => this._validationError = value; } + + /// Creates an new instance. + public InMageReplicationDetails() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__replicationProviderSpecificSettings), __replicationProviderSpecificSettings); + await eventListener.AssertObjectIsValid(nameof(__replicationProviderSpecificSettings), __replicationProviderSpecificSettings); + } + } + /// InMage provider specific settings. + public partial interface IInMageReplicationDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettings + { + /// + /// 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. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"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.", + SerializedName = @"activeSiteType", + PossibleTypes = new [] { typeof(string) })] + string ActiveSiteType { get; set; } + /// Agent expiry date. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Agent expiry date.", + SerializedName = @"agentExpiryDate", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? AgentDetailAgentExpiryDate { get; set; } + /// A value indicating whether installed agent needs to be updated. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether installed agent needs to be updated.", + SerializedName = @"agentUpdateStatus", + PossibleTypes = new [] { typeof(string) })] + string AgentDetailAgentUpdateStatus { get; set; } + /// The agent version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The agent version.", + SerializedName = @"agentVersion", + PossibleTypes = new [] { typeof(string) })] + string AgentDetailAgentVersion { get; set; } + /// A value indicating whether reboot is required after update is applied. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether reboot is required after update is applied.", + SerializedName = @"postUpdateRebootStatus", + PossibleTypes = new [] { typeof(string) })] + string AgentDetailPostUpdateRebootStatus { get; set; } + /// + /// A value indicating the underlying Azure storage account. If the VM is not running in Azure, this value shall be set to + /// null. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating the underlying Azure storage account. If the VM is not running in Azure, this value shall be set to null.", + SerializedName = @"azureStorageAccountId", + PossibleTypes = new [] { typeof(string) })] + string AzureStorageAccountId { get; set; } + /// The compressed data change rate in MB. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The compressed data change rate in MB.", + SerializedName = @"compressedDataRateInMB", + PossibleTypes = new [] { typeof(double) })] + double? CompressedDataRateInMb { get; set; } + /// The collection of Consistency points. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The collection of Consistency points.", + SerializedName = @"consistencyPoints", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsConsistencyPoints) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsConsistencyPoints ConsistencyPoint { get; set; } + /// + /// The datastores of the on-premise machine Value can be list of strings that contain datastore names. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The datastores of the on-premise machine Value can be list of strings that contain datastore names.", + SerializedName = @"datastores", + PossibleTypes = new [] { typeof(string) })] + string[] Datastore { get; set; } + /// A value indicating the discovery type of the machine. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating the discovery type of the machine.", + SerializedName = @"discoveryType", + PossibleTypes = new [] { typeof(string) })] + string DiscoveryType { get; set; } + /// A value indicating whether any disk is resized for this VM. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether any disk is resized for this VM.", + SerializedName = @"diskResized", + PossibleTypes = new [] { typeof(string) })] + string DiskResized { get; set; } + /// The source IP address. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The source IP address.", + SerializedName = @"ipAddress", + PossibleTypes = new [] { typeof(string) })] + string IPAddress { get; set; } + /// The infrastructure VM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The infrastructure VM Id.", + SerializedName = @"infrastructureVmId", + PossibleTypes = new [] { typeof(string) })] + string InfrastructureVMId { get; set; } + /// A value indicating whether additional IR stats are available or not. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether additional IR stats are available or not.", + SerializedName = @"isAdditionalStatsAvailable", + PossibleTypes = new [] { typeof(bool) })] + bool? IsAdditionalStatsAvailable { get; set; } + /// The last heartbeat received from the source server. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The last heartbeat received from the source server.", + SerializedName = @"lastHeartbeat", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? LastHeartbeat { get; set; } + /// The last RPO calculated time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The last RPO calculated time.", + SerializedName = @"lastRpoCalculatedTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? LastRpoCalculatedTime { get; set; } + /// The last update time received from on-prem components. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The last update time received from on-prem components.", + SerializedName = @"lastUpdateReceivedTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? LastUpdateReceivedTime { get; set; } + /// The master target Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The master target Id.", + SerializedName = @"masterTargetId", + PossibleTypes = new [] { typeof(string) })] + string MasterTargetId { get; set; } + /// The multi vm group Id, if any. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The multi vm group Id, if any.", + SerializedName = @"multiVmGroupId", + PossibleTypes = new [] { typeof(string) })] + string MultiVMGroupId { get; set; } + /// The multi vm group name, if any. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The multi vm group name, if any.", + SerializedName = @"multiVmGroupName", + PossibleTypes = new [] { typeof(string) })] + string MultiVMGroupName { get; set; } + /// A value indicating whether the multi vm sync is enabled or disabled. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether the multi vm sync is enabled or disabled.", + SerializedName = @"multiVmSyncStatus", + PossibleTypes = new [] { typeof(string) })] + string MultiVMSyncStatus { get; set; } + /// The type of the OS on the VM. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The type of the OS on the VM.", + SerializedName = @"osType", + PossibleTypes = new [] { typeof(string) })] + string OSDetailOstype { get; set; } + /// The id of the disk containing the OS. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The id of the disk containing the OS.", + SerializedName = @"osVhdId", + PossibleTypes = new [] { typeof(string) })] + string OSDetailOsvhdId { get; set; } + /// The OS disk VHD name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The OS disk VHD name.", + SerializedName = @"vhdName", + PossibleTypes = new [] { typeof(string) })] + string OSDetailVhdName { get; set; } + /// The OS Version of the protected item. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The OS Version of the protected item.", + SerializedName = @"osVersion", + PossibleTypes = new [] { typeof(string) })] + string OSVersion { get; set; } + /// The process server Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The process server Id.", + SerializedName = @"processServerId", + PossibleTypes = new [] { typeof(string) })] + string ProcessServerId { get; set; } + /// The list of protected disks. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of protected disks.", + SerializedName = @"protectedDisks", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetails) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetails[] ProtectedDisk { get; set; } + /// The protection stage. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The protection stage.", + SerializedName = @"protectionStage", + PossibleTypes = new [] { typeof(string) })] + string ProtectionStage { get; set; } + /// A value indicating whether the source server requires a restart after update. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether the source server requires a restart after update.", + SerializedName = @"rebootAfterUpdateStatus", + PossibleTypes = new [] { typeof(string) })] + string RebootAfterUpdateStatus { get; set; } + /// The replica id of the protected item. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The replica id of the protected item.", + SerializedName = @"replicaId", + PossibleTypes = new [] { typeof(string) })] + string ReplicaId { get; set; } + /// The initial replication progress percentage. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The initial replication progress percentage.", + SerializedName = @"initialReplicationProgressPercentage", + PossibleTypes = new [] { typeof(string) })] + string ResyncDetailInitialReplicationProgressPercentage { get; set; } + /// Initial replication type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Initial replication type.", + SerializedName = @"initialReplicationType", + PossibleTypes = new [] { typeof(string) })] + string ResyncDetailInitialReplicationType { get; set; } + /// The retention window end time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The retention window end time.", + SerializedName = @"retentionWindowEnd", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? RetentionWindowEnd { get; set; } + /// The retention window start time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The retention window start time.", + SerializedName = @"retentionWindowStart", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? RetentionWindowStart { get; set; } + /// The RPO in seconds. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The RPO in seconds.", + SerializedName = @"rpoInSeconds", + PossibleTypes = new [] { typeof(long) })] + long? RpoInSecond { get; set; } + /// The CPU count of the VM on the primary side. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The CPU count of the VM on the primary side.", + SerializedName = @"sourceVmCpuCount", + PossibleTypes = new [] { typeof(int) })] + int? SourceVMCpuCount { get; set; } + /// The RAM size of the VM on the primary side. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The RAM size of the VM on the primary side.", + SerializedName = @"sourceVmRamSizeInMB", + PossibleTypes = new [] { typeof(int) })] + int? SourceVMRamSizeInMb { get; set; } + /// The total transferred data in bytes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The total transferred data in bytes.", + SerializedName = @"totalDataTransferred", + PossibleTypes = new [] { typeof(long) })] + long? TotalDataTransferred { get; set; } + /// The progress health. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The progress health.", + SerializedName = @"totalProgressHealth", + PossibleTypes = new [] { typeof(string) })] + string TotalProgressHealth { get; set; } + /// The uncompressed data change rate in MB. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The uncompressed data change rate in MB.", + SerializedName = @"uncompressedDataRateInMB", + PossibleTypes = new [] { typeof(double) })] + double? UncompressedDataRateInMb { get; set; } + /// The vCenter infrastructure Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The vCenter infrastructure Id.", + SerializedName = @"vCenterInfrastructureId", + PossibleTypes = new [] { typeof(string) })] + string VCenterInfrastructureId { get; set; } + /// The virtual machine Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The virtual machine Id.", + SerializedName = @"vmId", + PossibleTypes = new [] { typeof(string) })] + string VMId { get; set; } + /// The PE Network details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The PE Network details.", + SerializedName = @"vmNics", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetails) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetails[] VMNic { get; set; } + /// The protection state for the vm. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The protection state for the vm.", + SerializedName = @"vmProtectionState", + PossibleTypes = new [] { typeof(string) })] + string VMProtectionState { get; set; } + /// The protection state description for the vm. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The protection state description for the vm.", + SerializedName = @"vmProtectionStateDescription", + PossibleTypes = new [] { typeof(string) })] + string VMProtectionStateDescription { get; set; } + /// + /// The validation errors of the on-premise machine Value can be list of validation errors. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The validation errors of the on-premise machine Value can be list of validation errors.", + SerializedName = @"validationErrors", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] ValidationError { get; set; } + + } + /// InMage provider specific settings. + internal partial interface IInMageReplicationDetailsInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettingsInternal + { + /// + /// 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. + /// + string ActiveSiteType { get; set; } + /// The agent details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageAgentDetails AgentDetail { get; set; } + /// Agent expiry date. + global::System.DateTime? AgentDetailAgentExpiryDate { get; set; } + /// A value indicating whether installed agent needs to be updated. + string AgentDetailAgentUpdateStatus { get; set; } + /// The agent version. + string AgentDetailAgentVersion { get; set; } + /// A value indicating whether reboot is required after update is applied. + string AgentDetailPostUpdateRebootStatus { get; set; } + /// + /// A value indicating the underlying Azure storage account. If the VM is not running in Azure, this value shall be set to + /// null. + /// + string AzureStorageAccountId { get; set; } + /// The compressed data change rate in MB. + double? CompressedDataRateInMb { get; set; } + /// The collection of Consistency points. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsConsistencyPoints ConsistencyPoint { get; set; } + /// + /// The datastores of the on-premise machine Value can be list of strings that contain datastore names. + /// + string[] Datastore { get; set; } + /// A value indicating the discovery type of the machine. + string DiscoveryType { get; set; } + /// A value indicating whether any disk is resized for this VM. + string DiskResized { get; set; } + /// The source IP address. + string IPAddress { get; set; } + /// The infrastructure VM Id. + string InfrastructureVMId { get; set; } + /// A value indicating whether additional IR stats are available or not. + bool? IsAdditionalStatsAvailable { get; set; } + /// The last heartbeat received from the source server. + global::System.DateTime? LastHeartbeat { get; set; } + /// The last RPO calculated time. + global::System.DateTime? LastRpoCalculatedTime { get; set; } + /// The last update time received from on-prem components. + global::System.DateTime? LastUpdateReceivedTime { get; set; } + /// The master target Id. + string MasterTargetId { get; set; } + /// The multi vm group Id, if any. + string MultiVMGroupId { get; set; } + /// The multi vm group name, if any. + string MultiVMGroupName { get; set; } + /// A value indicating whether the multi vm sync is enabled or disabled. + string MultiVMSyncStatus { get; set; } + /// The OS details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDiskDetails OSDetail { get; set; } + /// The type of the OS on the VM. + string OSDetailOstype { get; set; } + /// The id of the disk containing the OS. + string OSDetailOsvhdId { get; set; } + /// The OS disk VHD name. + string OSDetailVhdName { get; set; } + /// The OS Version of the protected item. + string OSVersion { get; set; } + /// The process server Id. + string ProcessServerId { get; set; } + /// The list of protected disks. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetails[] ProtectedDisk { get; set; } + /// The protection stage. + string ProtectionStage { get; set; } + /// A value indicating whether the source server requires a restart after update. + string RebootAfterUpdateStatus { get; set; } + /// The replica id of the protected item. + string ReplicaId { get; set; } + /// The resync details of the machine. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInitialReplicationDetails ResyncDetail { get; set; } + /// The initial replication progress percentage. + string ResyncDetailInitialReplicationProgressPercentage { get; set; } + /// Initial replication type. + string ResyncDetailInitialReplicationType { get; set; } + /// The retention window end time. + global::System.DateTime? RetentionWindowEnd { get; set; } + /// The retention window start time. + global::System.DateTime? RetentionWindowStart { get; set; } + /// The RPO in seconds. + long? RpoInSecond { get; set; } + /// The CPU count of the VM on the primary side. + int? SourceVMCpuCount { get; set; } + /// The RAM size of the VM on the primary side. + int? SourceVMRamSizeInMb { get; set; } + /// The total transferred data in bytes. + long? TotalDataTransferred { get; set; } + /// The progress health. + string TotalProgressHealth { get; set; } + /// The uncompressed data change rate in MB. + double? UncompressedDataRateInMb { get; set; } + /// The vCenter infrastructure Id. + string VCenterInfrastructureId { get; set; } + /// The virtual machine Id. + string VMId { get; set; } + /// The PE Network details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetails[] VMNic { get; set; } + /// The protection state for the vm. + string VMProtectionState { get; set; } + /// The protection state description for the vm. + string VMProtectionStateDescription { get; set; } + /// + /// The validation errors of the on-premise machine Value can be list of validation errors. + /// + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] ValidationError { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageReplicationDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageReplicationDetails.json.cs new file mode 100644 index 000000000000..dd2d730e2f53 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageReplicationDetails.json.cs @@ -0,0 +1,220 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMage provider specific settings. + public partial class InMageReplicationDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new InMageReplicationDetails(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal InMageReplicationDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __replicationProviderSpecificSettings = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProviderSpecificSettings(json); + {_oSDetail = If( json?.PropertyT("osDetails"), out var __jsonOSDetails) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.OSDiskDetails.FromJson(__jsonOSDetails) : OSDetail;} + {_resyncDetail = If( json?.PropertyT("resyncDetails"), out var __jsonResyncDetails) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InitialReplicationDetails.FromJson(__jsonResyncDetails) : ResyncDetail;} + {_agentDetail = If( json?.PropertyT("agentDetails"), out var __jsonAgentDetails) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageAgentDetails.FromJson(__jsonAgentDetails) : AgentDetail;} + {_activeSiteType = If( json?.PropertyT("activeSiteType"), out var __jsonActiveSiteType) ? (string)__jsonActiveSiteType : (string)ActiveSiteType;} + {_sourceVMCpuCount = If( json?.PropertyT("sourceVmCpuCount"), out var __jsonSourceVMCpuCount) ? (int?)__jsonSourceVMCpuCount : SourceVMCpuCount;} + {_sourceVMRamSizeInMb = If( json?.PropertyT("sourceVmRamSizeInMB"), out var __jsonSourceVMRamSizeInMb) ? (int?)__jsonSourceVMRamSizeInMb : SourceVMRamSizeInMb;} + {_protectionStage = If( json?.PropertyT("protectionStage"), out var __jsonProtectionStage) ? (string)__jsonProtectionStage : (string)ProtectionStage;} + {_vMId = If( json?.PropertyT("vmId"), out var __jsonVMId) ? (string)__jsonVMId : (string)VMId;} + {_vMProtectionState = If( json?.PropertyT("vmProtectionState"), out var __jsonVMProtectionState) ? (string)__jsonVMProtectionState : (string)VMProtectionState;} + {_vMProtectionStateDescription = If( json?.PropertyT("vmProtectionStateDescription"), out var __jsonVMProtectionStateDescription) ? (string)__jsonVMProtectionStateDescription : (string)VMProtectionStateDescription;} + {_retentionWindowStart = If( json?.PropertyT("retentionWindowStart"), out var __jsonRetentionWindowStart) ? global::System.DateTime.TryParse((string)__jsonRetentionWindowStart, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonRetentionWindowStartValue) ? __jsonRetentionWindowStartValue : RetentionWindowStart : RetentionWindowStart;} + {_retentionWindowEnd = If( json?.PropertyT("retentionWindowEnd"), out var __jsonRetentionWindowEnd) ? global::System.DateTime.TryParse((string)__jsonRetentionWindowEnd, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonRetentionWindowEndValue) ? __jsonRetentionWindowEndValue : RetentionWindowEnd : RetentionWindowEnd;} + {_compressedDataRateInMb = If( json?.PropertyT("compressedDataRateInMB"), out var __jsonCompressedDataRateInMb) ? (double?)__jsonCompressedDataRateInMb : CompressedDataRateInMb;} + {_uncompressedDataRateInMb = If( json?.PropertyT("uncompressedDataRateInMB"), out var __jsonUncompressedDataRateInMb) ? (double?)__jsonUncompressedDataRateInMb : UncompressedDataRateInMb;} + {_rpoInSecond = If( json?.PropertyT("rpoInSeconds"), out var __jsonRpoInSeconds) ? (long?)__jsonRpoInSeconds : RpoInSecond;} + {_protectedDisk = If( json?.PropertyT("protectedDisks"), out var __jsonProtectedDisks) ? If( __jsonProtectedDisks as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageProtectedDiskDetails) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageProtectedDiskDetails.FromJson(__u) )) ))() : null : ProtectedDisk;} + {_iPAddress = If( json?.PropertyT("ipAddress"), out var __jsonIPAddress) ? (string)__jsonIPAddress : (string)IPAddress;} + {_lastHeartbeat = If( json?.PropertyT("lastHeartbeat"), out var __jsonLastHeartbeat) ? global::System.DateTime.TryParse((string)__jsonLastHeartbeat, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonLastHeartbeatValue) ? __jsonLastHeartbeatValue : LastHeartbeat : LastHeartbeat;} + {_processServerId = If( json?.PropertyT("processServerId"), out var __jsonProcessServerId) ? (string)__jsonProcessServerId : (string)ProcessServerId;} + {_masterTargetId = If( json?.PropertyT("masterTargetId"), out var __jsonMasterTargetId) ? (string)__jsonMasterTargetId : (string)MasterTargetId;} + {_consistencyPoint = If( json?.PropertyT("consistencyPoints"), out var __jsonConsistencyPoints) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageReplicationDetailsConsistencyPoints.FromJson(__jsonConsistencyPoints) : ConsistencyPoint;} + {_diskResized = If( json?.PropertyT("diskResized"), out var __jsonDiskResized) ? (string)__jsonDiskResized : (string)DiskResized;} + {_rebootAfterUpdateStatus = If( json?.PropertyT("rebootAfterUpdateStatus"), out var __jsonRebootAfterUpdateStatus) ? (string)__jsonRebootAfterUpdateStatus : (string)RebootAfterUpdateStatus;} + {_multiVMGroupId = If( json?.PropertyT("multiVmGroupId"), out var __jsonMultiVMGroupId) ? (string)__jsonMultiVMGroupId : (string)MultiVMGroupId;} + {_multiVMGroupName = If( json?.PropertyT("multiVmGroupName"), out var __jsonMultiVMGroupName) ? (string)__jsonMultiVMGroupName : (string)MultiVMGroupName;} + {_multiVMSyncStatus = If( json?.PropertyT("multiVmSyncStatus"), out var __jsonMultiVMSyncStatus) ? (string)__jsonMultiVMSyncStatus : (string)MultiVMSyncStatus;} + {_vCenterInfrastructureId = If( json?.PropertyT("vCenterInfrastructureId"), out var __jsonVCenterInfrastructureId) ? (string)__jsonVCenterInfrastructureId : (string)VCenterInfrastructureId;} + {_infrastructureVMId = If( json?.PropertyT("infrastructureVmId"), out var __jsonInfrastructureVMId) ? (string)__jsonInfrastructureVMId : (string)InfrastructureVMId;} + {_vMNic = If( json?.PropertyT("vmNics"), out var __jsonVMNics) ? If( __jsonVMNics as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __q) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__q, (__p)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetails) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMNicDetails.FromJson(__p) )) ))() : null : VMNic;} + {_discoveryType = If( json?.PropertyT("discoveryType"), out var __jsonDiscoveryType) ? (string)__jsonDiscoveryType : (string)DiscoveryType;} + {_azureStorageAccountId = If( json?.PropertyT("azureStorageAccountId"), out var __jsonAzureStorageAccountId) ? (string)__jsonAzureStorageAccountId : (string)AzureStorageAccountId;} + {_datastore = If( json?.PropertyT("datastores"), out var __jsonDatastores) ? If( __jsonDatastores as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __l) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__l, (__k)=>(string) (__k is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString __j ? (string)(__j.ToString()) : null)) ))() : null : Datastore;} + {_validationError = If( json?.PropertyT("validationErrors"), out var __jsonValidationErrors) ? If( __jsonValidationErrors as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __g) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__g, (__f)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthError.FromJson(__f) )) ))() : null : ValidationError;} + {_lastRpoCalculatedTime = If( json?.PropertyT("lastRpoCalculatedTime"), out var __jsonLastRpoCalculatedTime) ? global::System.DateTime.TryParse((string)__jsonLastRpoCalculatedTime, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonLastRpoCalculatedTimeValue) ? __jsonLastRpoCalculatedTimeValue : LastRpoCalculatedTime : LastRpoCalculatedTime;} + {_lastUpdateReceivedTime = If( json?.PropertyT("lastUpdateReceivedTime"), out var __jsonLastUpdateReceivedTime) ? global::System.DateTime.TryParse((string)__jsonLastUpdateReceivedTime, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonLastUpdateReceivedTimeValue) ? __jsonLastUpdateReceivedTimeValue : LastUpdateReceivedTime : LastUpdateReceivedTime;} + {_replicaId = If( json?.PropertyT("replicaId"), out var __jsonReplicaId) ? (string)__jsonReplicaId : (string)ReplicaId;} + {_oSVersion = If( json?.PropertyT("osVersion"), out var __jsonOSVersion) ? (string)__jsonOSVersion : (string)OSVersion;} + {_isAdditionalStatsAvailable = If( json?.PropertyT("isAdditionalStatsAvailable"), out var __jsonIsAdditionalStatsAvailable) ? (bool?)__jsonIsAdditionalStatsAvailable : IsAdditionalStatsAvailable;} + {_totalDataTransferred = If( json?.PropertyT("totalDataTransferred"), out var __jsonTotalDataTransferred) ? (long?)__jsonTotalDataTransferred : TotalDataTransferred;} + {_totalProgressHealth = If( json?.PropertyT("totalProgressHealth"), out var __jsonTotalProgressHealth) ? (string)__jsonTotalProgressHealth : (string)TotalProgressHealth;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __replicationProviderSpecificSettings?.ToJson(container, serializationMode); + AddIf( null != this._oSDetail ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._oSDetail.ToJson(null,serializationMode) : null, "osDetails" ,container.Add ); + AddIf( null != this._resyncDetail ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._resyncDetail.ToJson(null,serializationMode) : null, "resyncDetails" ,container.Add ); + AddIf( null != this._agentDetail ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._agentDetail.ToJson(null,serializationMode) : null, "agentDetails" ,container.Add ); + AddIf( null != (((object)this._activeSiteType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._activeSiteType.ToString()) : null, "activeSiteType" ,container.Add ); + AddIf( null != this._sourceVMCpuCount ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._sourceVMCpuCount) : null, "sourceVmCpuCount" ,container.Add ); + AddIf( null != this._sourceVMRamSizeInMb ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._sourceVMRamSizeInMb) : null, "sourceVmRamSizeInMB" ,container.Add ); + AddIf( null != (((object)this._protectionStage)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._protectionStage.ToString()) : null, "protectionStage" ,container.Add ); + AddIf( null != (((object)this._vMId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._vMId.ToString()) : null, "vmId" ,container.Add ); + AddIf( null != (((object)this._vMProtectionState)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._vMProtectionState.ToString()) : null, "vmProtectionState" ,container.Add ); + AddIf( null != (((object)this._vMProtectionStateDescription)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._vMProtectionStateDescription.ToString()) : null, "vmProtectionStateDescription" ,container.Add ); + AddIf( null != this._retentionWindowStart ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._retentionWindowStart?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "retentionWindowStart" ,container.Add ); + AddIf( null != this._retentionWindowEnd ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._retentionWindowEnd?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "retentionWindowEnd" ,container.Add ); + AddIf( null != this._compressedDataRateInMb ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((double)this._compressedDataRateInMb) : null, "compressedDataRateInMB" ,container.Add ); + AddIf( null != this._uncompressedDataRateInMb ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((double)this._uncompressedDataRateInMb) : null, "uncompressedDataRateInMB" ,container.Add ); + AddIf( null != this._rpoInSecond ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((long)this._rpoInSecond) : null, "rpoInSeconds" ,container.Add ); + if (null != this._protectedDisk) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._protectedDisk ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("protectedDisks",__w); + } + AddIf( null != (((object)this._iPAddress)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._iPAddress.ToString()) : null, "ipAddress" ,container.Add ); + AddIf( null != this._lastHeartbeat ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._lastHeartbeat?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "lastHeartbeat" ,container.Add ); + AddIf( null != (((object)this._processServerId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._processServerId.ToString()) : null, "processServerId" ,container.Add ); + AddIf( null != (((object)this._masterTargetId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._masterTargetId.ToString()) : null, "masterTargetId" ,container.Add ); + AddIf( null != this._consistencyPoint ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._consistencyPoint.ToJson(null,serializationMode) : null, "consistencyPoints" ,container.Add ); + AddIf( null != (((object)this._diskResized)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._diskResized.ToString()) : null, "diskResized" ,container.Add ); + AddIf( null != (((object)this._rebootAfterUpdateStatus)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._rebootAfterUpdateStatus.ToString()) : null, "rebootAfterUpdateStatus" ,container.Add ); + AddIf( null != (((object)this._multiVMGroupId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._multiVMGroupId.ToString()) : null, "multiVmGroupId" ,container.Add ); + AddIf( null != (((object)this._multiVMGroupName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._multiVMGroupName.ToString()) : null, "multiVmGroupName" ,container.Add ); + AddIf( null != (((object)this._multiVMSyncStatus)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._multiVMSyncStatus.ToString()) : null, "multiVmSyncStatus" ,container.Add ); + AddIf( null != (((object)this._vCenterInfrastructureId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._vCenterInfrastructureId.ToString()) : null, "vCenterInfrastructureId" ,container.Add ); + AddIf( null != (((object)this._infrastructureVMId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._infrastructureVMId.ToString()) : null, "infrastructureVmId" ,container.Add ); + if (null != this._vMNic) + { + var __r = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __s in this._vMNic ) + { + AddIf(__s?.ToJson(null, serializationMode) ,__r.Add); + } + container.Add("vmNics",__r); + } + AddIf( null != (((object)this._discoveryType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._discoveryType.ToString()) : null, "discoveryType" ,container.Add ); + AddIf( null != (((object)this._azureStorageAccountId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._azureStorageAccountId.ToString()) : null, "azureStorageAccountId" ,container.Add ); + if (null != this._datastore) + { + var __m = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __n in this._datastore ) + { + AddIf(null != (((object)__n)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(__n.ToString()) : null ,__m.Add); + } + container.Add("datastores",__m); + } + if (null != this._validationError) + { + var __h = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __i in this._validationError ) + { + AddIf(__i?.ToJson(null, serializationMode) ,__h.Add); + } + container.Add("validationErrors",__h); + } + AddIf( null != this._lastRpoCalculatedTime ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._lastRpoCalculatedTime?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "lastRpoCalculatedTime" ,container.Add ); + AddIf( null != this._lastUpdateReceivedTime ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._lastUpdateReceivedTime?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "lastUpdateReceivedTime" ,container.Add ); + AddIf( null != (((object)this._replicaId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._replicaId.ToString()) : null, "replicaId" ,container.Add ); + AddIf( null != (((object)this._oSVersion)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._oSVersion.ToString()) : null, "osVersion" ,container.Add ); + AddIf( null != this._isAdditionalStatsAvailable ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonBoolean((bool)this._isAdditionalStatsAvailable) : null, "isAdditionalStatsAvailable" ,container.Add ); + AddIf( null != this._totalDataTransferred ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((long)this._totalDataTransferred) : null, "totalDataTransferred" ,container.Add ); + AddIf( null != (((object)this._totalProgressHealth)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._totalProgressHealth.ToString()) : null, "totalProgressHealth" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageReplicationDetailsConsistencyPoints.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageReplicationDetailsConsistencyPoints.PowerShell.cs new file mode 100644 index 000000000000..10536895ee41 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageReplicationDetailsConsistencyPoints.PowerShell.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// The collection of Consistency points. + [System.ComponentModel.TypeConverter(typeof(InMageReplicationDetailsConsistencyPointsTypeConverter))] + public partial class InMageReplicationDetailsConsistencyPoints + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsConsistencyPoints DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InMageReplicationDetailsConsistencyPoints(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsConsistencyPoints DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InMageReplicationDetailsConsistencyPoints(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json + /// string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsConsistencyPoints FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InMageReplicationDetailsConsistencyPoints(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InMageReplicationDetailsConsistencyPoints(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// The collection of Consistency points. + [System.ComponentModel.TypeConverter(typeof(InMageReplicationDetailsConsistencyPointsTypeConverter))] + public partial interface IInMageReplicationDetailsConsistencyPoints + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageReplicationDetailsConsistencyPoints.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageReplicationDetailsConsistencyPoints.TypeConverter.cs new file mode 100644 index 000000000000..ea587ca6b9cc --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageReplicationDetailsConsistencyPoints.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InMageReplicationDetailsConsistencyPointsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsConsistencyPoints ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsConsistencyPoints).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InMageReplicationDetailsConsistencyPoints.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InMageReplicationDetailsConsistencyPoints.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InMageReplicationDetailsConsistencyPoints.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageReplicationDetailsConsistencyPoints.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageReplicationDetailsConsistencyPoints.cs new file mode 100644 index 000000000000..47e29344176f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageReplicationDetailsConsistencyPoints.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The collection of Consistency points. + public partial class InMageReplicationDetailsConsistencyPoints : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsConsistencyPoints, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsConsistencyPointsInternal + { + + /// + /// Creates an new instance. + /// + public InMageReplicationDetailsConsistencyPoints() + { + + } + } + /// The collection of Consistency points. + public partial interface IInMageReplicationDetailsConsistencyPoints : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray + { + + } + /// The collection of Consistency points. + internal partial interface IInMageReplicationDetailsConsistencyPointsInternal + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageReplicationDetailsConsistencyPoints.dictionary.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageReplicationDetailsConsistencyPoints.dictionary.cs new file mode 100644 index 000000000000..d00e3e4217e2 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageReplicationDetailsConsistencyPoints.dictionary.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + public partial class InMageReplicationDetailsConsistencyPoints : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray + { + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + + int Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Values { get => __additionalProperties.Values; } + + public global::System.DateTime this[global::System.String index] { get => __additionalProperties[index]; set => __additionalProperties[index] = value; } + + /// + /// + public void Add(global::System.String key, global::System.DateTime value) => __additionalProperties.Add( key, value); + + public void Clear() => __additionalProperties.Clear(); + + /// + public bool ContainsKey(global::System.String key) => __additionalProperties.ContainsKey( key); + + /// + public void CopyFrom(global::System.Collections.IDictionary source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public void CopyFrom(global::System.Management.Automation.PSObject source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public bool Remove(global::System.String key) => __additionalProperties.Remove( key); + + /// + /// + public bool TryGetValue(global::System.String key, out global::System.DateTime value) => __additionalProperties.TryGetValue( key, out value); + + /// + + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageReplicationDetailsConsistencyPoints source) => source.__additionalProperties; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageReplicationDetailsConsistencyPoints.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageReplicationDetailsConsistencyPoints.json.cs new file mode 100644 index 000000000000..73efbd716dd0 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageReplicationDetailsConsistencyPoints.json.cs @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The collection of Consistency points. + public partial class InMageReplicationDetailsConsistencyPoints + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsConsistencyPoints. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsConsistencyPoints. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReplicationDetailsConsistencyPoints FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new InMageReplicationDetailsConsistencyPoints(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + /// + internal InMageReplicationDetailsConsistencyPoints(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, global::System.Collections.Generic.HashSet exclusions = null) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray)this).AdditionalProperties, null ,exclusions ); + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray)this).AdditionalProperties, container); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageReprotectInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageReprotectInput.PowerShell.cs new file mode 100644 index 000000000000..837b7250dfa9 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageReprotectInput.PowerShell.cs @@ -0,0 +1,224 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// InMageAzureV2 specific provider input. + [System.ComponentModel.TypeConverter(typeof(InMageReprotectInputTypeConverter))] + public partial class InMageReprotectInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReprotectInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InMageReprotectInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReprotectInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InMageReprotectInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReprotectInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InMageReprotectInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DiskExclusionInput")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReprotectInputInternal)this).DiskExclusionInput = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskExclusionInput) content.GetValueForProperty("DiskExclusionInput",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReprotectInputInternal)this).DiskExclusionInput, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageDiskExclusionInputTypeConverter.ConvertFrom); + } + if (content.Contains("MasterTargetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReprotectInputInternal)this).MasterTargetId = (string) content.GetValueForProperty("MasterTargetId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReprotectInputInternal)this).MasterTargetId, global::System.Convert.ToString); + } + if (content.Contains("ProcessServerId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReprotectInputInternal)this).ProcessServerId = (string) content.GetValueForProperty("ProcessServerId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReprotectInputInternal)this).ProcessServerId, global::System.Convert.ToString); + } + if (content.Contains("RetentionDrive")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReprotectInputInternal)this).RetentionDrive = (string) content.GetValueForProperty("RetentionDrive",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReprotectInputInternal)this).RetentionDrive, global::System.Convert.ToString); + } + if (content.Contains("RunAsAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReprotectInputInternal)this).RunAsAccountId = (string) content.GetValueForProperty("RunAsAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReprotectInputInternal)this).RunAsAccountId, global::System.Convert.ToString); + } + if (content.Contains("DatastoreName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReprotectInputInternal)this).DatastoreName = (string) content.GetValueForProperty("DatastoreName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReprotectInputInternal)this).DatastoreName, global::System.Convert.ToString); + } + if (content.Contains("ProfileId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReprotectInputInternal)this).ProfileId = (string) content.GetValueForProperty("ProfileId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReprotectInputInternal)this).ProfileId, global::System.Convert.ToString); + } + if (content.Contains("DisksToInclude")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReprotectInputInternal)this).DisksToInclude = (string[]) content.GetValueForProperty("DisksToInclude",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReprotectInputInternal)this).DisksToInclude, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + if (content.Contains("DiskExclusionInputVolumeOption")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReprotectInputInternal)this).DiskExclusionInputVolumeOption = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageVolumeExclusionOptions[]) content.GetValueForProperty("DiskExclusionInputVolumeOption",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReprotectInputInternal)this).DiskExclusionInputVolumeOption, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageVolumeExclusionOptionsTypeConverter.ConvertFrom)); + } + if (content.Contains("DiskExclusionInputDiskSignatureOption")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReprotectInputInternal)this).DiskExclusionInputDiskSignatureOption = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskSignatureExclusionOptions[]) content.GetValueForProperty("DiskExclusionInputDiskSignatureOption",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReprotectInputInternal)this).DiskExclusionInputDiskSignatureOption, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageDiskSignatureExclusionOptionsTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InMageReprotectInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DiskExclusionInput")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReprotectInputInternal)this).DiskExclusionInput = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskExclusionInput) content.GetValueForProperty("DiskExclusionInput",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReprotectInputInternal)this).DiskExclusionInput, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageDiskExclusionInputTypeConverter.ConvertFrom); + } + if (content.Contains("MasterTargetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReprotectInputInternal)this).MasterTargetId = (string) content.GetValueForProperty("MasterTargetId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReprotectInputInternal)this).MasterTargetId, global::System.Convert.ToString); + } + if (content.Contains("ProcessServerId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReprotectInputInternal)this).ProcessServerId = (string) content.GetValueForProperty("ProcessServerId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReprotectInputInternal)this).ProcessServerId, global::System.Convert.ToString); + } + if (content.Contains("RetentionDrive")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReprotectInputInternal)this).RetentionDrive = (string) content.GetValueForProperty("RetentionDrive",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReprotectInputInternal)this).RetentionDrive, global::System.Convert.ToString); + } + if (content.Contains("RunAsAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReprotectInputInternal)this).RunAsAccountId = (string) content.GetValueForProperty("RunAsAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReprotectInputInternal)this).RunAsAccountId, global::System.Convert.ToString); + } + if (content.Contains("DatastoreName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReprotectInputInternal)this).DatastoreName = (string) content.GetValueForProperty("DatastoreName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReprotectInputInternal)this).DatastoreName, global::System.Convert.ToString); + } + if (content.Contains("ProfileId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReprotectInputInternal)this).ProfileId = (string) content.GetValueForProperty("ProfileId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReprotectInputInternal)this).ProfileId, global::System.Convert.ToString); + } + if (content.Contains("DisksToInclude")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReprotectInputInternal)this).DisksToInclude = (string[]) content.GetValueForProperty("DisksToInclude",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReprotectInputInternal)this).DisksToInclude, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + if (content.Contains("DiskExclusionInputVolumeOption")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReprotectInputInternal)this).DiskExclusionInputVolumeOption = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageVolumeExclusionOptions[]) content.GetValueForProperty("DiskExclusionInputVolumeOption",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReprotectInputInternal)this).DiskExclusionInputVolumeOption, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageVolumeExclusionOptionsTypeConverter.ConvertFrom)); + } + if (content.Contains("DiskExclusionInputDiskSignatureOption")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReprotectInputInternal)this).DiskExclusionInputDiskSignatureOption = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskSignatureExclusionOptions[]) content.GetValueForProperty("DiskExclusionInputDiskSignatureOption",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReprotectInputInternal)this).DiskExclusionInputDiskSignatureOption, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageDiskSignatureExclusionOptionsTypeConverter.ConvertFrom)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// InMageAzureV2 specific provider input. + [System.ComponentModel.TypeConverter(typeof(InMageReprotectInputTypeConverter))] + public partial interface IInMageReprotectInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageReprotectInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageReprotectInput.TypeConverter.cs new file mode 100644 index 000000000000..557c179b9b0b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageReprotectInput.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InMageReprotectInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReprotectInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReprotectInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InMageReprotectInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InMageReprotectInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InMageReprotectInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageReprotectInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageReprotectInput.cs new file mode 100644 index 000000000000..eae27247cd60 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageReprotectInput.cs @@ -0,0 +1,216 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMageAzureV2 specific provider input. + public partial class InMageReprotectInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReprotectInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReprotectInputInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationProviderSpecificInput __reverseReplicationProviderSpecificInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReverseReplicationProviderSpecificInput(); + + /// Backing field for property. + private string _datastoreName; + + /// The target datastore name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string DatastoreName { get => this._datastoreName; set => this._datastoreName = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskExclusionInput _diskExclusionInput; + + /// The enable disk exclusion input. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskExclusionInput DiskExclusionInput { get => (this._diskExclusionInput = this._diskExclusionInput ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageDiskExclusionInput()); set => this._diskExclusionInput = value; } + + /// The guest disk signature based option for disk exclusion. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskSignatureExclusionOptions[] DiskExclusionInputDiskSignatureOption { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskExclusionInputInternal)DiskExclusionInput).DiskSignatureOption; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskExclusionInputInternal)DiskExclusionInput).DiskSignatureOption = value ?? null /* arrayOf */; } + + /// The volume label based option for disk exclusion. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageVolumeExclusionOptions[] DiskExclusionInputVolumeOption { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskExclusionInputInternal)DiskExclusionInput).VolumeOption; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskExclusionInputInternal)DiskExclusionInput).VolumeOption = value ?? null /* arrayOf */; } + + /// Backing field for property. + private string[] _disksToInclude; + + /// The disks to include list. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string[] DisksToInclude { get => this._disksToInclude; set => this._disksToInclude = value; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationProviderSpecificInputInternal)__reverseReplicationProviderSpecificInput).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationProviderSpecificInputInternal)__reverseReplicationProviderSpecificInput).InstanceType = value ; } + + /// Backing field for property. + private string _masterTargetId; + + /// The Master Target Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string MasterTargetId { get => this._masterTargetId; set => this._masterTargetId = value; } + + /// Internal Acessors for DiskExclusionInput + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskExclusionInput Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReprotectInputInternal.DiskExclusionInput { get => (this._diskExclusionInput = this._diskExclusionInput ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageDiskExclusionInput()); set { {_diskExclusionInput = value;} } } + + /// Backing field for property. + private string _processServerId; + + /// The Process Server Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ProcessServerId { get => this._processServerId; set => this._processServerId = value; } + + /// Backing field for property. + private string _profileId; + + /// The Policy Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ProfileId { get => this._profileId; set => this._profileId = value; } + + /// Backing field for property. + private string _retentionDrive; + + /// The retention drive to use on the MT. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RetentionDrive { get => this._retentionDrive; set => this._retentionDrive = value; } + + /// Backing field for property. + private string _runAsAccountId; + + /// The CS account Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RunAsAccountId { get => this._runAsAccountId; set => this._runAsAccountId = value; } + + /// Creates an new instance. + public InMageReprotectInput() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__reverseReplicationProviderSpecificInput), __reverseReplicationProviderSpecificInput); + await eventListener.AssertObjectIsValid(nameof(__reverseReplicationProviderSpecificInput), __reverseReplicationProviderSpecificInput); + } + } + /// InMageAzureV2 specific provider input. + public partial interface IInMageReprotectInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationProviderSpecificInput + { + /// The target datastore name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target datastore name.", + SerializedName = @"datastoreName", + PossibleTypes = new [] { typeof(string) })] + string DatastoreName { get; set; } + /// The guest disk signature based option for disk exclusion. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The guest disk signature based option for disk exclusion.", + SerializedName = @"diskSignatureOptions", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskSignatureExclusionOptions) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskSignatureExclusionOptions[] DiskExclusionInputDiskSignatureOption { get; set; } + /// The volume label based option for disk exclusion. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The volume label based option for disk exclusion.", + SerializedName = @"volumeOptions", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageVolumeExclusionOptions) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageVolumeExclusionOptions[] DiskExclusionInputVolumeOption { get; set; } + /// The disks to include list. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The disks to include list.", + SerializedName = @"disksToInclude", + PossibleTypes = new [] { typeof(string) })] + string[] DisksToInclude { get; set; } + /// The Master Target Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The Master Target Id.", + SerializedName = @"masterTargetId", + PossibleTypes = new [] { typeof(string) })] + string MasterTargetId { get; set; } + /// The Process Server Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The Process Server Id.", + SerializedName = @"processServerId", + PossibleTypes = new [] { typeof(string) })] + string ProcessServerId { get; set; } + /// The Policy Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The Policy Id.", + SerializedName = @"profileId", + PossibleTypes = new [] { typeof(string) })] + string ProfileId { get; set; } + /// The retention drive to use on the MT. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The retention drive to use on the MT.", + SerializedName = @"retentionDrive", + PossibleTypes = new [] { typeof(string) })] + string RetentionDrive { get; set; } + /// The CS account Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The CS account Id.", + SerializedName = @"runAsAccountId", + PossibleTypes = new [] { typeof(string) })] + string RunAsAccountId { get; set; } + + } + /// InMageAzureV2 specific provider input. + internal partial interface IInMageReprotectInputInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationProviderSpecificInputInternal + { + /// The target datastore name. + string DatastoreName { get; set; } + /// The enable disk exclusion input. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskExclusionInput DiskExclusionInput { get; set; } + /// The guest disk signature based option for disk exclusion. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskSignatureExclusionOptions[] DiskExclusionInputDiskSignatureOption { get; set; } + /// The volume label based option for disk exclusion. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageVolumeExclusionOptions[] DiskExclusionInputVolumeOption { get; set; } + /// The disks to include list. + string[] DisksToInclude { get; set; } + /// The Master Target Id. + string MasterTargetId { get; set; } + /// The Process Server Id. + string ProcessServerId { get; set; } + /// The Policy Id. + string ProfileId { get; set; } + /// The retention drive to use on the MT. + string RetentionDrive { get; set; } + /// The CS account Id. + string RunAsAccountId { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageReprotectInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageReprotectInput.json.cs new file mode 100644 index 000000000000..cfeb05c2a5f8 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageReprotectInput.json.cs @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// InMageAzureV2 specific provider input. + public partial class InMageReprotectInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReprotectInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReprotectInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageReprotectInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new InMageReprotectInput(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal InMageReprotectInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __reverseReplicationProviderSpecificInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReverseReplicationProviderSpecificInput(json); + {_diskExclusionInput = If( json?.PropertyT("diskExclusionInput"), out var __jsonDiskExclusionInput) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageDiskExclusionInput.FromJson(__jsonDiskExclusionInput) : DiskExclusionInput;} + {_masterTargetId = If( json?.PropertyT("masterTargetId"), out var __jsonMasterTargetId) ? (string)__jsonMasterTargetId : (string)MasterTargetId;} + {_processServerId = If( json?.PropertyT("processServerId"), out var __jsonProcessServerId) ? (string)__jsonProcessServerId : (string)ProcessServerId;} + {_retentionDrive = If( json?.PropertyT("retentionDrive"), out var __jsonRetentionDrive) ? (string)__jsonRetentionDrive : (string)RetentionDrive;} + {_runAsAccountId = If( json?.PropertyT("runAsAccountId"), out var __jsonRunAsAccountId) ? (string)__jsonRunAsAccountId : (string)RunAsAccountId;} + {_datastoreName = If( json?.PropertyT("datastoreName"), out var __jsonDatastoreName) ? (string)__jsonDatastoreName : (string)DatastoreName;} + {_profileId = If( json?.PropertyT("profileId"), out var __jsonProfileId) ? (string)__jsonProfileId : (string)ProfileId;} + {_disksToInclude = If( json?.PropertyT("disksToInclude"), out var __jsonDisksToInclude) ? If( __jsonDisksToInclude as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(string) (__u is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : DisksToInclude;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __reverseReplicationProviderSpecificInput?.ToJson(container, serializationMode); + AddIf( null != this._diskExclusionInput ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._diskExclusionInput.ToJson(null,serializationMode) : null, "diskExclusionInput" ,container.Add ); + AddIf( null != (((object)this._masterTargetId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._masterTargetId.ToString()) : null, "masterTargetId" ,container.Add ); + AddIf( null != (((object)this._processServerId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._processServerId.ToString()) : null, "processServerId" ,container.Add ); + AddIf( null != (((object)this._retentionDrive)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._retentionDrive.ToString()) : null, "retentionDrive" ,container.Add ); + AddIf( null != (((object)this._runAsAccountId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._runAsAccountId.ToString()) : null, "runAsAccountId" ,container.Add ); + AddIf( null != (((object)this._datastoreName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._datastoreName.ToString()) : null, "datastoreName" ,container.Add ); + AddIf( null != (((object)this._profileId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._profileId.ToString()) : null, "profileId" ,container.Add ); + if (null != this._disksToInclude) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._disksToInclude ) + { + AddIf(null != (((object)__x)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(__x.ToString()) : null ,__w.Add); + } + container.Add("disksToInclude",__w); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageTestFailoverInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageTestFailoverInput.PowerShell.cs new file mode 100644 index 000000000000..5b5a9cafdb44 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageTestFailoverInput.PowerShell.cs @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Provider specific input for InMage test failover. + [System.ComponentModel.TypeConverter(typeof(InMageTestFailoverInputTypeConverter))] + public partial class InMageTestFailoverInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageTestFailoverInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InMageTestFailoverInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageTestFailoverInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InMageTestFailoverInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageTestFailoverInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InMageTestFailoverInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("RecoveryPointType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageTestFailoverInputInternal)this).RecoveryPointType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPointType?) content.GetValueForProperty("RecoveryPointType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageTestFailoverInputInternal)this).RecoveryPointType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPointType.CreateFrom); + } + if (content.Contains("RecoveryPointId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageTestFailoverInputInternal)this).RecoveryPointId = (string) content.GetValueForProperty("RecoveryPointId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageTestFailoverInputInternal)this).RecoveryPointId, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InMageTestFailoverInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("RecoveryPointType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageTestFailoverInputInternal)this).RecoveryPointType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPointType?) content.GetValueForProperty("RecoveryPointType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageTestFailoverInputInternal)this).RecoveryPointType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPointType.CreateFrom); + } + if (content.Contains("RecoveryPointId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageTestFailoverInputInternal)this).RecoveryPointId = (string) content.GetValueForProperty("RecoveryPointId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageTestFailoverInputInternal)this).RecoveryPointId, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Provider specific input for InMage test failover. + [System.ComponentModel.TypeConverter(typeof(InMageTestFailoverInputTypeConverter))] + public partial interface IInMageTestFailoverInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageTestFailoverInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageTestFailoverInput.TypeConverter.cs new file mode 100644 index 000000000000..987e63a678e1 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageTestFailoverInput.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InMageTestFailoverInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageTestFailoverInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageTestFailoverInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InMageTestFailoverInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InMageTestFailoverInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InMageTestFailoverInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageTestFailoverInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageTestFailoverInput.cs new file mode 100644 index 000000000000..224c7cbd749d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageTestFailoverInput.cs @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Provider specific input for InMage test failover. + public partial class InMageTestFailoverInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageTestFailoverInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageTestFailoverInputInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverProviderSpecificInput __testFailoverProviderSpecificInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.TestFailoverProviderSpecificInput(); + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverProviderSpecificInputInternal)__testFailoverProviderSpecificInput).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverProviderSpecificInputInternal)__testFailoverProviderSpecificInput).InstanceType = value ; } + + /// Backing field for property. + private string _recoveryPointId; + + /// + /// 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. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryPointId { get => this._recoveryPointId; set => this._recoveryPointId = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPointType? _recoveryPointType; + + /// + /// 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. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPointType? RecoveryPointType { get => this._recoveryPointType; set => this._recoveryPointType = value; } + + /// Creates an new instance. + public InMageTestFailoverInput() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__testFailoverProviderSpecificInput), __testFailoverProviderSpecificInput); + await eventListener.AssertObjectIsValid(nameof(__testFailoverProviderSpecificInput), __testFailoverProviderSpecificInput); + } + } + /// Provider specific input for InMage test failover. + public partial interface IInMageTestFailoverInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverProviderSpecificInput + { + /// + /// 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. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"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.", + SerializedName = @"recoveryPointId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryPointId { get; set; } + /// + /// 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. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"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.", + SerializedName = @"recoveryPointType", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPointType) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPointType? RecoveryPointType { get; set; } + + } + /// Provider specific input for InMage test failover. + internal partial interface IInMageTestFailoverInputInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverProviderSpecificInputInternal + { + /// + /// 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. + /// + string RecoveryPointId { get; set; } + /// + /// 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. + /// + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPointType? RecoveryPointType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageTestFailoverInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageTestFailoverInput.json.cs new file mode 100644 index 000000000000..1236205b5564 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageTestFailoverInput.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Provider specific input for InMage test failover. + public partial class InMageTestFailoverInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageTestFailoverInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageTestFailoverInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageTestFailoverInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new InMageTestFailoverInput(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal InMageTestFailoverInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __testFailoverProviderSpecificInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.TestFailoverProviderSpecificInput(json); + {_recoveryPointType = If( json?.PropertyT("recoveryPointType"), out var __jsonRecoveryPointType) ? (string)__jsonRecoveryPointType : (string)RecoveryPointType;} + {_recoveryPointId = If( json?.PropertyT("recoveryPointId"), out var __jsonRecoveryPointId) ? (string)__jsonRecoveryPointId : (string)RecoveryPointId;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __testFailoverProviderSpecificInput?.ToJson(container, serializationMode); + AddIf( null != (((object)this._recoveryPointType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryPointType.ToString()) : null, "recoveryPointType" ,container.Add ); + AddIf( null != (((object)this._recoveryPointId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryPointId.ToString()) : null, "recoveryPointId" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageUnplannedFailoverInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageUnplannedFailoverInput.PowerShell.cs new file mode 100644 index 000000000000..00aa23c71981 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageUnplannedFailoverInput.PowerShell.cs @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Provider specific input for InMage unplanned failover. + [System.ComponentModel.TypeConverter(typeof(InMageUnplannedFailoverInputTypeConverter))] + public partial class InMageUnplannedFailoverInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageUnplannedFailoverInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InMageUnplannedFailoverInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageUnplannedFailoverInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InMageUnplannedFailoverInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageUnplannedFailoverInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InMageUnplannedFailoverInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("RecoveryPointType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageUnplannedFailoverInputInternal)this).RecoveryPointType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPointType?) content.GetValueForProperty("RecoveryPointType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageUnplannedFailoverInputInternal)this).RecoveryPointType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPointType.CreateFrom); + } + if (content.Contains("RecoveryPointId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageUnplannedFailoverInputInternal)this).RecoveryPointId = (string) content.GetValueForProperty("RecoveryPointId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageUnplannedFailoverInputInternal)this).RecoveryPointId, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InMageUnplannedFailoverInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("RecoveryPointType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageUnplannedFailoverInputInternal)this).RecoveryPointType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPointType?) content.GetValueForProperty("RecoveryPointType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageUnplannedFailoverInputInternal)this).RecoveryPointType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPointType.CreateFrom); + } + if (content.Contains("RecoveryPointId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageUnplannedFailoverInputInternal)this).RecoveryPointId = (string) content.GetValueForProperty("RecoveryPointId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageUnplannedFailoverInputInternal)this).RecoveryPointId, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Provider specific input for InMage unplanned failover. + [System.ComponentModel.TypeConverter(typeof(InMageUnplannedFailoverInputTypeConverter))] + public partial interface IInMageUnplannedFailoverInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageUnplannedFailoverInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageUnplannedFailoverInput.TypeConverter.cs new file mode 100644 index 000000000000..5bdf5411b739 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageUnplannedFailoverInput.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InMageUnplannedFailoverInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageUnplannedFailoverInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageUnplannedFailoverInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InMageUnplannedFailoverInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InMageUnplannedFailoverInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InMageUnplannedFailoverInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageUnplannedFailoverInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageUnplannedFailoverInput.cs new file mode 100644 index 000000000000..cb233fb28d46 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageUnplannedFailoverInput.cs @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Provider specific input for InMage unplanned failover. + public partial class InMageUnplannedFailoverInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageUnplannedFailoverInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageUnplannedFailoverInputInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverProviderSpecificInput __unplannedFailoverProviderSpecificInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UnplannedFailoverProviderSpecificInput(); + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverProviderSpecificInputInternal)__unplannedFailoverProviderSpecificInput).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverProviderSpecificInputInternal)__unplannedFailoverProviderSpecificInput).InstanceType = value ; } + + /// Backing field for property. + private string _recoveryPointId; + + /// + /// The recovery point id to be passed to failover to a particular recovery point. In case of latest recovery point, null + /// should be passed. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryPointId { get => this._recoveryPointId; set => this._recoveryPointId = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPointType? _recoveryPointType; + + /// + /// 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. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPointType? RecoveryPointType { get => this._recoveryPointType; set => this._recoveryPointType = value; } + + /// Creates an new instance. + public InMageUnplannedFailoverInput() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__unplannedFailoverProviderSpecificInput), __unplannedFailoverProviderSpecificInput); + await eventListener.AssertObjectIsValid(nameof(__unplannedFailoverProviderSpecificInput), __unplannedFailoverProviderSpecificInput); + } + } + /// Provider specific input for InMage unplanned failover. + public partial interface IInMageUnplannedFailoverInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverProviderSpecificInput + { + /// + /// The recovery point id to be passed to failover to a particular recovery point. In case of latest recovery point, null + /// should be passed. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery point id to be passed to failover to a particular recovery point. In case of latest recovery point, null should be passed.", + SerializedName = @"recoveryPointId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryPointId { get; set; } + /// + /// 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. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"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.", + SerializedName = @"recoveryPointType", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPointType) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPointType? RecoveryPointType { get; set; } + + } + /// Provider specific input for InMage unplanned failover. + internal partial interface IInMageUnplannedFailoverInputInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverProviderSpecificInputInternal + { + /// + /// The recovery point id to be passed to failover to a particular recovery point. In case of latest recovery point, null + /// should be passed. + /// + string RecoveryPointId { get; set; } + /// + /// 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. + /// + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPointType? RecoveryPointType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageUnplannedFailoverInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageUnplannedFailoverInput.json.cs new file mode 100644 index 000000000000..dcd12f8debce --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageUnplannedFailoverInput.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Provider specific input for InMage unplanned failover. + public partial class InMageUnplannedFailoverInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageUnplannedFailoverInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageUnplannedFailoverInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageUnplannedFailoverInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new InMageUnplannedFailoverInput(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal InMageUnplannedFailoverInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __unplannedFailoverProviderSpecificInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UnplannedFailoverProviderSpecificInput(json); + {_recoveryPointType = If( json?.PropertyT("recoveryPointType"), out var __jsonRecoveryPointType) ? (string)__jsonRecoveryPointType : (string)RecoveryPointType;} + {_recoveryPointId = If( json?.PropertyT("recoveryPointId"), out var __jsonRecoveryPointId) ? (string)__jsonRecoveryPointId : (string)RecoveryPointId;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __unplannedFailoverProviderSpecificInput?.ToJson(container, serializationMode); + AddIf( null != (((object)this._recoveryPointType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryPointType.ToString()) : null, "recoveryPointType" ,container.Add ); + AddIf( null != (((object)this._recoveryPointId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryPointId.ToString()) : null, "recoveryPointId" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageVolumeExclusionOptions.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageVolumeExclusionOptions.PowerShell.cs new file mode 100644 index 000000000000..7a3f2e05dc22 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageVolumeExclusionOptions.PowerShell.cs @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// Guest disk signature based disk exclusion option when doing enable protection of virtual machine in InMage provider. + /// + [System.ComponentModel.TypeConverter(typeof(InMageVolumeExclusionOptionsTypeConverter))] + public partial class InMageVolumeExclusionOptions + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageVolumeExclusionOptions DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InMageVolumeExclusionOptions(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageVolumeExclusionOptions DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InMageVolumeExclusionOptions(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageVolumeExclusionOptions FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InMageVolumeExclusionOptions(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("VolumeLabel")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageVolumeExclusionOptionsInternal)this).VolumeLabel = (string) content.GetValueForProperty("VolumeLabel",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageVolumeExclusionOptionsInternal)this).VolumeLabel, global::System.Convert.ToString); + } + if (content.Contains("OnlyExcludeIfSingleVolume")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageVolumeExclusionOptionsInternal)this).OnlyExcludeIfSingleVolume = (string) content.GetValueForProperty("OnlyExcludeIfSingleVolume",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageVolumeExclusionOptionsInternal)this).OnlyExcludeIfSingleVolume, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InMageVolumeExclusionOptions(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("VolumeLabel")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageVolumeExclusionOptionsInternal)this).VolumeLabel = (string) content.GetValueForProperty("VolumeLabel",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageVolumeExclusionOptionsInternal)this).VolumeLabel, global::System.Convert.ToString); + } + if (content.Contains("OnlyExcludeIfSingleVolume")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageVolumeExclusionOptionsInternal)this).OnlyExcludeIfSingleVolume = (string) content.GetValueForProperty("OnlyExcludeIfSingleVolume",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageVolumeExclusionOptionsInternal)this).OnlyExcludeIfSingleVolume, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Guest disk signature based disk exclusion option when doing enable protection of virtual machine in InMage provider. + [System.ComponentModel.TypeConverter(typeof(InMageVolumeExclusionOptionsTypeConverter))] + public partial interface IInMageVolumeExclusionOptions + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageVolumeExclusionOptions.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageVolumeExclusionOptions.TypeConverter.cs new file mode 100644 index 000000000000..620c96b27064 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageVolumeExclusionOptions.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InMageVolumeExclusionOptionsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageVolumeExclusionOptions ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageVolumeExclusionOptions).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InMageVolumeExclusionOptions.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InMageVolumeExclusionOptions.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InMageVolumeExclusionOptions.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageVolumeExclusionOptions.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageVolumeExclusionOptions.cs new file mode 100644 index 000000000000..f3afac445f04 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageVolumeExclusionOptions.cs @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// + /// Guest disk signature based disk exclusion option when doing enable protection of virtual machine in InMage provider. + /// + public partial class InMageVolumeExclusionOptions : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageVolumeExclusionOptions, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageVolumeExclusionOptionsInternal + { + + /// Backing field for property. + private string _onlyExcludeIfSingleVolume; + + /// + /// 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. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string OnlyExcludeIfSingleVolume { get => this._onlyExcludeIfSingleVolume; set => this._onlyExcludeIfSingleVolume = value; } + + /// Backing field for property. + private string _volumeLabel; + + /// + /// The volume label. The disk having any volume with this label will be excluded from replication. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string VolumeLabel { get => this._volumeLabel; set => this._volumeLabel = value; } + + /// Creates an new instance. + public InMageVolumeExclusionOptions() + { + + } + } + /// Guest disk signature based disk exclusion option when doing enable protection of virtual machine in InMage provider. + public partial interface IInMageVolumeExclusionOptions : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// + /// 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. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"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.", + SerializedName = @"onlyExcludeIfSingleVolume", + PossibleTypes = new [] { typeof(string) })] + string OnlyExcludeIfSingleVolume { get; set; } + /// + /// The volume label. The disk having any volume with this label will be excluded from replication. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The volume label. The disk having any volume with this label will be excluded from replication.", + SerializedName = @"volumeLabel", + PossibleTypes = new [] { typeof(string) })] + string VolumeLabel { get; set; } + + } + /// Guest disk signature based disk exclusion option when doing enable protection of virtual machine in InMage provider. + internal partial interface IInMageVolumeExclusionOptionsInternal + + { + /// + /// 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. + /// + string OnlyExcludeIfSingleVolume { get; set; } + /// + /// The volume label. The disk having any volume with this label will be excluded from replication. + /// + string VolumeLabel { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageVolumeExclusionOptions.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageVolumeExclusionOptions.json.cs new file mode 100644 index 000000000000..08c40e133b5c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InMageVolumeExclusionOptions.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// + /// Guest disk signature based disk exclusion option when doing enable protection of virtual machine in InMage provider. + /// + public partial class InMageVolumeExclusionOptions + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageVolumeExclusionOptions. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageVolumeExclusionOptions. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageVolumeExclusionOptions FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new InMageVolumeExclusionOptions(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal InMageVolumeExclusionOptions(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_volumeLabel = If( json?.PropertyT("volumeLabel"), out var __jsonVolumeLabel) ? (string)__jsonVolumeLabel : (string)VolumeLabel;} + {_onlyExcludeIfSingleVolume = If( json?.PropertyT("onlyExcludeIfSingleVolume"), out var __jsonOnlyExcludeIfSingleVolume) ? (string)__jsonOnlyExcludeIfSingleVolume : (string)OnlyExcludeIfSingleVolume;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._volumeLabel)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._volumeLabel.ToString()) : null, "volumeLabel" ,container.Add ); + AddIf( null != (((object)this._onlyExcludeIfSingleVolume)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._onlyExcludeIfSingleVolume.ToString()) : null, "onlyExcludeIfSingleVolume" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InconsistentVMDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InconsistentVMDetails.PowerShell.cs new file mode 100644 index 000000000000..90fc7f5e4a4a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InconsistentVMDetails.PowerShell.cs @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// This class stores the monitoring details for consistency check of inconsistent Protected Entity. + /// + [System.ComponentModel.TypeConverter(typeof(InconsistentVMDetailsTypeConverter))] + public partial class InconsistentVMDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInconsistentVMDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InconsistentVMDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInconsistentVMDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InconsistentVMDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInconsistentVMDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InconsistentVMDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("VMName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInconsistentVMDetailsInternal)this).VMName = (string) content.GetValueForProperty("VMName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInconsistentVMDetailsInternal)this).VMName, global::System.Convert.ToString); + } + if (content.Contains("CloudName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInconsistentVMDetailsInternal)this).CloudName = (string) content.GetValueForProperty("CloudName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInconsistentVMDetailsInternal)this).CloudName, global::System.Convert.ToString); + } + if (content.Contains("Detail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInconsistentVMDetailsInternal)this).Detail = (string[]) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInconsistentVMDetailsInternal)this).Detail, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("ErrorId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInconsistentVMDetailsInternal)this).ErrorId = (string[]) content.GetValueForProperty("ErrorId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInconsistentVMDetailsInternal)this).ErrorId, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InconsistentVMDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("VMName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInconsistentVMDetailsInternal)this).VMName = (string) content.GetValueForProperty("VMName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInconsistentVMDetailsInternal)this).VMName, global::System.Convert.ToString); + } + if (content.Contains("CloudName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInconsistentVMDetailsInternal)this).CloudName = (string) content.GetValueForProperty("CloudName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInconsistentVMDetailsInternal)this).CloudName, global::System.Convert.ToString); + } + if (content.Contains("Detail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInconsistentVMDetailsInternal)this).Detail = (string[]) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInconsistentVMDetailsInternal)this).Detail, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("ErrorId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInconsistentVMDetailsInternal)this).ErrorId = (string[]) content.GetValueForProperty("ErrorId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInconsistentVMDetailsInternal)this).ErrorId, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// This class stores the monitoring details for consistency check of inconsistent Protected Entity. + [System.ComponentModel.TypeConverter(typeof(InconsistentVMDetailsTypeConverter))] + public partial interface IInconsistentVMDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InconsistentVMDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InconsistentVMDetails.TypeConverter.cs new file mode 100644 index 000000000000..a358116bd015 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InconsistentVMDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InconsistentVMDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInconsistentVMDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInconsistentVMDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InconsistentVMDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InconsistentVMDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InconsistentVMDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InconsistentVMDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InconsistentVMDetails.cs new file mode 100644 index 000000000000..0064cd7b1925 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InconsistentVMDetails.cs @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// + /// This class stores the monitoring details for consistency check of inconsistent Protected Entity. + /// + public partial class InconsistentVMDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInconsistentVMDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInconsistentVMDetailsInternal + { + + /// Backing field for property. + private string _cloudName; + + /// The Cloud name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string CloudName { get => this._cloudName; set => this._cloudName = value; } + + /// Backing field for property. + private string[] _detail; + + /// The list of details regarding state of the Protected Entity in SRS and On prem. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string[] Detail { get => this._detail; set => this._detail = value; } + + /// Backing field for property. + private string[] _errorId; + + /// The list of error ids. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string[] ErrorId { get => this._errorId; set => this._errorId = value; } + + /// Backing field for property. + private string _vMName; + + /// The Vm name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string VMName { get => this._vMName; set => this._vMName = value; } + + /// Creates an new instance. + public InconsistentVMDetails() + { + + } + } + /// This class stores the monitoring details for consistency check of inconsistent Protected Entity. + public partial interface IInconsistentVMDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The Cloud name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Cloud name.", + SerializedName = @"cloudName", + PossibleTypes = new [] { typeof(string) })] + string CloudName { get; set; } + /// The list of details regarding state of the Protected Entity in SRS and On prem. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of details regarding state of the Protected Entity in SRS and On prem.", + SerializedName = @"details", + PossibleTypes = new [] { typeof(string) })] + string[] Detail { get; set; } + /// The list of error ids. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of error ids.", + SerializedName = @"errorIds", + PossibleTypes = new [] { typeof(string) })] + string[] ErrorId { get; set; } + /// The Vm name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Vm name.", + SerializedName = @"vmName", + PossibleTypes = new [] { typeof(string) })] + string VMName { get; set; } + + } + /// This class stores the monitoring details for consistency check of inconsistent Protected Entity. + internal partial interface IInconsistentVMDetailsInternal + + { + /// The Cloud name. + string CloudName { get; set; } + /// The list of details regarding state of the Protected Entity in SRS and On prem. + string[] Detail { get; set; } + /// The list of error ids. + string[] ErrorId { get; set; } + /// The Vm name. + string VMName { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InconsistentVMDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InconsistentVMDetails.json.cs new file mode 100644 index 000000000000..44e1f999d59b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InconsistentVMDetails.json.cs @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// + /// This class stores the monitoring details for consistency check of inconsistent Protected Entity. + /// + public partial class InconsistentVMDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInconsistentVMDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInconsistentVMDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInconsistentVMDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new InconsistentVMDetails(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal InconsistentVMDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_vMName = If( json?.PropertyT("vmName"), out var __jsonVMName) ? (string)__jsonVMName : (string)VMName;} + {_cloudName = If( json?.PropertyT("cloudName"), out var __jsonCloudName) ? (string)__jsonCloudName : (string)CloudName;} + {_detail = If( json?.PropertyT("details"), out var __jsonDetails) ? If( __jsonDetails as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(string) (__u is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : Detail;} + {_errorId = If( json?.PropertyT("errorIds"), out var __jsonErrorIds) ? If( __jsonErrorIds as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __q) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__q, (__p)=>(string) (__p is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString __o ? (string)(__o.ToString()) : null)) ))() : null : ErrorId;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._vMName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._vMName.ToString()) : null, "vmName" ,container.Add ); + AddIf( null != (((object)this._cloudName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._cloudName.ToString()) : null, "cloudName" ,container.Add ); + if (null != this._detail) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._detail ) + { + AddIf(null != (((object)__x)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(__x.ToString()) : null ,__w.Add); + } + container.Add("details",__w); + } + if (null != this._errorId) + { + var __r = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __s in this._errorId ) + { + AddIf(null != (((object)__s)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(__s.ToString()) : null ,__r.Add); + } + container.Add("errorIds",__r); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InitialReplicationDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InitialReplicationDetails.PowerShell.cs new file mode 100644 index 000000000000..8b80ce847ad2 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InitialReplicationDetails.PowerShell.cs @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Initial replication details. + [System.ComponentModel.TypeConverter(typeof(InitialReplicationDetailsTypeConverter))] + public partial class InitialReplicationDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInitialReplicationDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InitialReplicationDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInitialReplicationDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InitialReplicationDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInitialReplicationDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InitialReplicationDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InitialReplicationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInitialReplicationDetailsInternal)this).InitialReplicationType = (string) content.GetValueForProperty("InitialReplicationType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInitialReplicationDetailsInternal)this).InitialReplicationType, global::System.Convert.ToString); + } + if (content.Contains("InitialReplicationProgressPercentage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInitialReplicationDetailsInternal)this).InitialReplicationProgressPercentage = (string) content.GetValueForProperty("InitialReplicationProgressPercentage",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInitialReplicationDetailsInternal)this).InitialReplicationProgressPercentage, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InitialReplicationDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InitialReplicationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInitialReplicationDetailsInternal)this).InitialReplicationType = (string) content.GetValueForProperty("InitialReplicationType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInitialReplicationDetailsInternal)this).InitialReplicationType, global::System.Convert.ToString); + } + if (content.Contains("InitialReplicationProgressPercentage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInitialReplicationDetailsInternal)this).InitialReplicationProgressPercentage = (string) content.GetValueForProperty("InitialReplicationProgressPercentage",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInitialReplicationDetailsInternal)this).InitialReplicationProgressPercentage, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Initial replication details. + [System.ComponentModel.TypeConverter(typeof(InitialReplicationDetailsTypeConverter))] + public partial interface IInitialReplicationDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InitialReplicationDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InitialReplicationDetails.TypeConverter.cs new file mode 100644 index 000000000000..56c5563b7500 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InitialReplicationDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InitialReplicationDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInitialReplicationDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInitialReplicationDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InitialReplicationDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InitialReplicationDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InitialReplicationDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InitialReplicationDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InitialReplicationDetails.cs new file mode 100644 index 000000000000..a016e2206d52 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InitialReplicationDetails.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Initial replication details. + public partial class InitialReplicationDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInitialReplicationDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInitialReplicationDetailsInternal + { + + /// Backing field for property. + private string _initialReplicationProgressPercentage; + + /// The initial replication progress percentage. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string InitialReplicationProgressPercentage { get => this._initialReplicationProgressPercentage; set => this._initialReplicationProgressPercentage = value; } + + /// Backing field for property. + private string _initialReplicationType; + + /// Initial replication type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string InitialReplicationType { get => this._initialReplicationType; set => this._initialReplicationType = value; } + + /// Creates an new instance. + public InitialReplicationDetails() + { + + } + } + /// Initial replication details. + public partial interface IInitialReplicationDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The initial replication progress percentage. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The initial replication progress percentage.", + SerializedName = @"initialReplicationProgressPercentage", + PossibleTypes = new [] { typeof(string) })] + string InitialReplicationProgressPercentage { get; set; } + /// Initial replication type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Initial replication type.", + SerializedName = @"initialReplicationType", + PossibleTypes = new [] { typeof(string) })] + string InitialReplicationType { get; set; } + + } + /// Initial replication details. + internal partial interface IInitialReplicationDetailsInternal + + { + /// The initial replication progress percentage. + string InitialReplicationProgressPercentage { get; set; } + /// Initial replication type. + string InitialReplicationType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InitialReplicationDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InitialReplicationDetails.json.cs new file mode 100644 index 000000000000..93c183603cc9 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InitialReplicationDetails.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Initial replication details. + public partial class InitialReplicationDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInitialReplicationDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInitialReplicationDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInitialReplicationDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new InitialReplicationDetails(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal InitialReplicationDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_initialReplicationType = If( json?.PropertyT("initialReplicationType"), out var __jsonInitialReplicationType) ? (string)__jsonInitialReplicationType : (string)InitialReplicationType;} + {_initialReplicationProgressPercentage = If( json?.PropertyT("initialReplicationProgressPercentage"), out var __jsonInitialReplicationProgressPercentage) ? (string)__jsonInitialReplicationProgressPercentage : (string)InitialReplicationProgressPercentage;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._initialReplicationType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._initialReplicationType.ToString()) : null, "initialReplicationType" ,container.Add ); + AddIf( null != (((object)this._initialReplicationProgressPercentage)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._initialReplicationProgressPercentage.ToString()) : null, "initialReplicationProgressPercentage" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InlineWorkflowTaskDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InlineWorkflowTaskDetails.PowerShell.cs new file mode 100644 index 000000000000..896d9db412e3 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InlineWorkflowTaskDetails.PowerShell.cs @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// This class represents the inline workflow task details. + [System.ComponentModel.TypeConverter(typeof(InlineWorkflowTaskDetailsTypeConverter))] + public partial class InlineWorkflowTaskDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInlineWorkflowTaskDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InlineWorkflowTaskDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInlineWorkflowTaskDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InlineWorkflowTaskDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInlineWorkflowTaskDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InlineWorkflowTaskDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("WorkflowId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInlineWorkflowTaskDetailsInternal)this).WorkflowId = (string[]) content.GetValueForProperty("WorkflowId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInlineWorkflowTaskDetailsInternal)this).WorkflowId, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IGroupTaskDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IGroupTaskDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + if (content.Contains("ChildTask")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IGroupTaskDetailsInternal)this).ChildTask = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTask[]) content.GetValueForProperty("ChildTask",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IGroupTaskDetailsInternal)this).ChildTask, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AsrTaskTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InlineWorkflowTaskDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("WorkflowId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInlineWorkflowTaskDetailsInternal)this).WorkflowId = (string[]) content.GetValueForProperty("WorkflowId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInlineWorkflowTaskDetailsInternal)this).WorkflowId, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IGroupTaskDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IGroupTaskDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + if (content.Contains("ChildTask")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IGroupTaskDetailsInternal)this).ChildTask = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTask[]) content.GetValueForProperty("ChildTask",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IGroupTaskDetailsInternal)this).ChildTask, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AsrTaskTypeConverter.ConvertFrom)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// This class represents the inline workflow task details. + [System.ComponentModel.TypeConverter(typeof(InlineWorkflowTaskDetailsTypeConverter))] + public partial interface IInlineWorkflowTaskDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InlineWorkflowTaskDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InlineWorkflowTaskDetails.TypeConverter.cs new file mode 100644 index 000000000000..eaf7693102b1 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InlineWorkflowTaskDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InlineWorkflowTaskDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInlineWorkflowTaskDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInlineWorkflowTaskDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InlineWorkflowTaskDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InlineWorkflowTaskDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InlineWorkflowTaskDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InlineWorkflowTaskDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InlineWorkflowTaskDetails.cs new file mode 100644 index 000000000000..cc7789eeabcc --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InlineWorkflowTaskDetails.cs @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// This class represents the inline workflow task details. + public partial class InlineWorkflowTaskDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInlineWorkflowTaskDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInlineWorkflowTaskDetailsInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IGroupTaskDetails __groupTaskDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.GroupTaskDetails(); + + /// The child tasks. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTask[] ChildTask { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IGroupTaskDetailsInternal)__groupTaskDetails).ChildTask; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IGroupTaskDetailsInternal)__groupTaskDetails).ChildTask = value ?? null /* arrayOf */; } + + /// The type of task details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IGroupTaskDetailsInternal)__groupTaskDetails).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IGroupTaskDetailsInternal)__groupTaskDetails).InstanceType = value ; } + + /// Backing field for property. + private string[] _workflowId; + + /// The list of child workflow ids. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string[] WorkflowId { get => this._workflowId; set => this._workflowId = value; } + + /// Creates an new instance. + public InlineWorkflowTaskDetails() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__groupTaskDetails), __groupTaskDetails); + await eventListener.AssertObjectIsValid(nameof(__groupTaskDetails), __groupTaskDetails); + } + } + /// This class represents the inline workflow task details. + public partial interface IInlineWorkflowTaskDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IGroupTaskDetails + { + /// The list of child workflow ids. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of child workflow ids.", + SerializedName = @"workflowIds", + PossibleTypes = new [] { typeof(string) })] + string[] WorkflowId { get; set; } + + } + /// This class represents the inline workflow task details. + internal partial interface IInlineWorkflowTaskDetailsInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IGroupTaskDetailsInternal + { + /// The list of child workflow ids. + string[] WorkflowId { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InlineWorkflowTaskDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InlineWorkflowTaskDetails.json.cs new file mode 100644 index 000000000000..b0e6ae2ea178 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InlineWorkflowTaskDetails.json.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// This class represents the inline workflow task details. + public partial class InlineWorkflowTaskDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInlineWorkflowTaskDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInlineWorkflowTaskDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInlineWorkflowTaskDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new InlineWorkflowTaskDetails(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal InlineWorkflowTaskDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __groupTaskDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.GroupTaskDetails(json); + {_workflowId = If( json?.PropertyT("workflowIds"), out var __jsonWorkflowIds) ? If( __jsonWorkflowIds as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(string) (__u is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : WorkflowId;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __groupTaskDetails?.ToJson(container, serializationMode); + if (null != this._workflowId) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._workflowId ) + { + AddIf(null != (((object)__x)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(__x.ToString()) : null ,__w.Add); + } + container.Add("workflowIds",__w); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InnerHealthError.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InnerHealthError.PowerShell.cs new file mode 100644 index 000000000000..313d8773486d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InnerHealthError.PowerShell.cs @@ -0,0 +1,256 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// 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. + /// + [System.ComponentModel.TypeConverter(typeof(InnerHealthErrorTypeConverter))] + public partial class InnerHealthError + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInnerHealthError DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InnerHealthError(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInnerHealthError DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InnerHealthError(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInnerHealthError FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InnerHealthError(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ErrorSource")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInnerHealthErrorInternal)this).ErrorSource = (string) content.GetValueForProperty("ErrorSource",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInnerHealthErrorInternal)this).ErrorSource, global::System.Convert.ToString); + } + if (content.Contains("ErrorType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInnerHealthErrorInternal)this).ErrorType = (string) content.GetValueForProperty("ErrorType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInnerHealthErrorInternal)this).ErrorType, global::System.Convert.ToString); + } + if (content.Contains("ErrorLevel")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInnerHealthErrorInternal)this).ErrorLevel = (string) content.GetValueForProperty("ErrorLevel",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInnerHealthErrorInternal)this).ErrorLevel, global::System.Convert.ToString); + } + if (content.Contains("ErrorCategory")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInnerHealthErrorInternal)this).ErrorCategory = (string) content.GetValueForProperty("ErrorCategory",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInnerHealthErrorInternal)this).ErrorCategory, global::System.Convert.ToString); + } + if (content.Contains("ErrorCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInnerHealthErrorInternal)this).ErrorCode = (string) content.GetValueForProperty("ErrorCode",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInnerHealthErrorInternal)this).ErrorCode, global::System.Convert.ToString); + } + if (content.Contains("SummaryMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInnerHealthErrorInternal)this).SummaryMessage = (string) content.GetValueForProperty("SummaryMessage",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInnerHealthErrorInternal)this).SummaryMessage, global::System.Convert.ToString); + } + if (content.Contains("ErrorMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInnerHealthErrorInternal)this).ErrorMessage = (string) content.GetValueForProperty("ErrorMessage",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInnerHealthErrorInternal)this).ErrorMessage, global::System.Convert.ToString); + } + if (content.Contains("PossibleCaus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInnerHealthErrorInternal)this).PossibleCaus = (string) content.GetValueForProperty("PossibleCaus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInnerHealthErrorInternal)this).PossibleCaus, global::System.Convert.ToString); + } + if (content.Contains("RecommendedAction")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInnerHealthErrorInternal)this).RecommendedAction = (string) content.GetValueForProperty("RecommendedAction",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInnerHealthErrorInternal)this).RecommendedAction, global::System.Convert.ToString); + } + if (content.Contains("CreationTimeUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInnerHealthErrorInternal)this).CreationTimeUtc = (global::System.DateTime?) content.GetValueForProperty("CreationTimeUtc",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInnerHealthErrorInternal)this).CreationTimeUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("RecoveryProviderErrorMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInnerHealthErrorInternal)this).RecoveryProviderErrorMessage = (string) content.GetValueForProperty("RecoveryProviderErrorMessage",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInnerHealthErrorInternal)this).RecoveryProviderErrorMessage, global::System.Convert.ToString); + } + if (content.Contains("EntityId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInnerHealthErrorInternal)this).EntityId = (string) content.GetValueForProperty("EntityId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInnerHealthErrorInternal)this).EntityId, global::System.Convert.ToString); + } + if (content.Contains("ErrorId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInnerHealthErrorInternal)this).ErrorId = (string) content.GetValueForProperty("ErrorId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInnerHealthErrorInternal)this).ErrorId, global::System.Convert.ToString); + } + if (content.Contains("CustomerResolvability")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInnerHealthErrorInternal)this).CustomerResolvability = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.HealthErrorCustomerResolvability?) content.GetValueForProperty("CustomerResolvability",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInnerHealthErrorInternal)this).CustomerResolvability, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.HealthErrorCustomerResolvability.CreateFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InnerHealthError(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ErrorSource")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInnerHealthErrorInternal)this).ErrorSource = (string) content.GetValueForProperty("ErrorSource",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInnerHealthErrorInternal)this).ErrorSource, global::System.Convert.ToString); + } + if (content.Contains("ErrorType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInnerHealthErrorInternal)this).ErrorType = (string) content.GetValueForProperty("ErrorType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInnerHealthErrorInternal)this).ErrorType, global::System.Convert.ToString); + } + if (content.Contains("ErrorLevel")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInnerHealthErrorInternal)this).ErrorLevel = (string) content.GetValueForProperty("ErrorLevel",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInnerHealthErrorInternal)this).ErrorLevel, global::System.Convert.ToString); + } + if (content.Contains("ErrorCategory")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInnerHealthErrorInternal)this).ErrorCategory = (string) content.GetValueForProperty("ErrorCategory",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInnerHealthErrorInternal)this).ErrorCategory, global::System.Convert.ToString); + } + if (content.Contains("ErrorCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInnerHealthErrorInternal)this).ErrorCode = (string) content.GetValueForProperty("ErrorCode",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInnerHealthErrorInternal)this).ErrorCode, global::System.Convert.ToString); + } + if (content.Contains("SummaryMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInnerHealthErrorInternal)this).SummaryMessage = (string) content.GetValueForProperty("SummaryMessage",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInnerHealthErrorInternal)this).SummaryMessage, global::System.Convert.ToString); + } + if (content.Contains("ErrorMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInnerHealthErrorInternal)this).ErrorMessage = (string) content.GetValueForProperty("ErrorMessage",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInnerHealthErrorInternal)this).ErrorMessage, global::System.Convert.ToString); + } + if (content.Contains("PossibleCaus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInnerHealthErrorInternal)this).PossibleCaus = (string) content.GetValueForProperty("PossibleCaus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInnerHealthErrorInternal)this).PossibleCaus, global::System.Convert.ToString); + } + if (content.Contains("RecommendedAction")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInnerHealthErrorInternal)this).RecommendedAction = (string) content.GetValueForProperty("RecommendedAction",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInnerHealthErrorInternal)this).RecommendedAction, global::System.Convert.ToString); + } + if (content.Contains("CreationTimeUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInnerHealthErrorInternal)this).CreationTimeUtc = (global::System.DateTime?) content.GetValueForProperty("CreationTimeUtc",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInnerHealthErrorInternal)this).CreationTimeUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("RecoveryProviderErrorMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInnerHealthErrorInternal)this).RecoveryProviderErrorMessage = (string) content.GetValueForProperty("RecoveryProviderErrorMessage",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInnerHealthErrorInternal)this).RecoveryProviderErrorMessage, global::System.Convert.ToString); + } + if (content.Contains("EntityId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInnerHealthErrorInternal)this).EntityId = (string) content.GetValueForProperty("EntityId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInnerHealthErrorInternal)this).EntityId, global::System.Convert.ToString); + } + if (content.Contains("ErrorId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInnerHealthErrorInternal)this).ErrorId = (string) content.GetValueForProperty("ErrorId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInnerHealthErrorInternal)this).ErrorId, global::System.Convert.ToString); + } + if (content.Contains("CustomerResolvability")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInnerHealthErrorInternal)this).CustomerResolvability = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.HealthErrorCustomerResolvability?) content.GetValueForProperty("CustomerResolvability",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInnerHealthErrorInternal)this).CustomerResolvability, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.HealthErrorCustomerResolvability.CreateFrom); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// 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. + [System.ComponentModel.TypeConverter(typeof(InnerHealthErrorTypeConverter))] + public partial interface IInnerHealthError + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InnerHealthError.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InnerHealthError.TypeConverter.cs new file mode 100644 index 000000000000..8059dfbf8b66 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InnerHealthError.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InnerHealthErrorTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInnerHealthError ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInnerHealthError).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InnerHealthError.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InnerHealthError.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InnerHealthError.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InnerHealthError.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InnerHealthError.cs new file mode 100644 index 000000000000..dcd49dfdcb37 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InnerHealthError.cs @@ -0,0 +1,283 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// + /// 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. + /// + public partial class InnerHealthError : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInnerHealthError, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInnerHealthErrorInternal + { + + /// Backing field for property. + private global::System.DateTime? _creationTimeUtc; + + /// Error creation time (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public global::System.DateTime? CreationTimeUtc { get => this._creationTimeUtc; set => this._creationTimeUtc = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.HealthErrorCustomerResolvability? _customerResolvability; + + /// Value indicating whether the health error is customer resolvable. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.HealthErrorCustomerResolvability? CustomerResolvability { get => this._customerResolvability; set => this._customerResolvability = value; } + + /// Backing field for property. + private string _entityId; + + /// ID of the entity. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string EntityId { get => this._entityId; set => this._entityId = value; } + + /// Backing field for property. + private string _errorCategory; + + /// Category of error. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ErrorCategory { get => this._errorCategory; set => this._errorCategory = value; } + + /// Backing field for property. + private string _errorCode; + + /// Error code. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ErrorCode { get => this._errorCode; set => this._errorCode = value; } + + /// Backing field for property. + private string _errorId; + + /// The health error unique id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ErrorId { get => this._errorId; set => this._errorId = value; } + + /// Backing field for property. + private string _errorLevel; + + /// Level of error. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ErrorLevel { get => this._errorLevel; set => this._errorLevel = value; } + + /// Backing field for property. + private string _errorMessage; + + /// Error message. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ErrorMessage { get => this._errorMessage; set => this._errorMessage = value; } + + /// Backing field for property. + private string _errorSource; + + /// Source of error. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ErrorSource { get => this._errorSource; set => this._errorSource = value; } + + /// Backing field for property. + private string _errorType; + + /// Type of error. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ErrorType { get => this._errorType; set => this._errorType = value; } + + /// Backing field for property. + private string _possibleCaus; + + /// Possible causes of error. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string PossibleCaus { get => this._possibleCaus; set => this._possibleCaus = value; } + + /// Backing field for property. + private string _recommendedAction; + + /// Recommended action to resolve error. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecommendedAction { get => this._recommendedAction; set => this._recommendedAction = value; } + + /// Backing field for property. + private string _recoveryProviderErrorMessage; + + /// DRA error message. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryProviderErrorMessage { get => this._recoveryProviderErrorMessage; set => this._recoveryProviderErrorMessage = value; } + + /// Backing field for property. + private string _summaryMessage; + + /// Summary message of the entity. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string SummaryMessage { get => this._summaryMessage; set => this._summaryMessage = value; } + + /// Creates an new instance. + public InnerHealthError() + { + + } + } + /// 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. + public partial interface IInnerHealthError : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// Error creation time (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Error creation time (UTC).", + SerializedName = @"creationTimeUtc", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? CreationTimeUtc { get; set; } + /// Value indicating whether the health error is customer resolvable. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Value indicating whether the health error is customer resolvable.", + SerializedName = @"customerResolvability", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.HealthErrorCustomerResolvability) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.HealthErrorCustomerResolvability? CustomerResolvability { get; set; } + /// ID of the entity. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"ID of the entity.", + SerializedName = @"entityId", + PossibleTypes = new [] { typeof(string) })] + string EntityId { get; set; } + /// Category of error. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Category of error.", + SerializedName = @"errorCategory", + PossibleTypes = new [] { typeof(string) })] + string ErrorCategory { get; set; } + /// Error code. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Error code.", + SerializedName = @"errorCode", + PossibleTypes = new [] { typeof(string) })] + string ErrorCode { get; set; } + /// The health error unique id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The health error unique id.", + SerializedName = @"errorId", + PossibleTypes = new [] { typeof(string) })] + string ErrorId { get; set; } + /// Level of error. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Level of error.", + SerializedName = @"errorLevel", + PossibleTypes = new [] { typeof(string) })] + string ErrorLevel { get; set; } + /// Error message. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Error message.", + SerializedName = @"errorMessage", + PossibleTypes = new [] { typeof(string) })] + string ErrorMessage { get; set; } + /// Source of error. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Source of error.", + SerializedName = @"errorSource", + PossibleTypes = new [] { typeof(string) })] + string ErrorSource { get; set; } + /// Type of error. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Type of error.", + SerializedName = @"errorType", + PossibleTypes = new [] { typeof(string) })] + string ErrorType { get; set; } + /// Possible causes of error. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Possible causes of error.", + SerializedName = @"possibleCauses", + PossibleTypes = new [] { typeof(string) })] + string PossibleCaus { get; set; } + /// Recommended action to resolve error. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Recommended action to resolve error.", + SerializedName = @"recommendedAction", + PossibleTypes = new [] { typeof(string) })] + string RecommendedAction { get; set; } + /// DRA error message. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"DRA error message.", + SerializedName = @"recoveryProviderErrorMessage", + PossibleTypes = new [] { typeof(string) })] + string RecoveryProviderErrorMessage { get; set; } + /// Summary message of the entity. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Summary message of the entity.", + SerializedName = @"summaryMessage", + PossibleTypes = new [] { typeof(string) })] + string SummaryMessage { get; set; } + + } + /// 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. + internal partial interface IInnerHealthErrorInternal + + { + /// Error creation time (UTC). + global::System.DateTime? CreationTimeUtc { get; set; } + /// Value indicating whether the health error is customer resolvable. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.HealthErrorCustomerResolvability? CustomerResolvability { get; set; } + /// ID of the entity. + string EntityId { get; set; } + /// Category of error. + string ErrorCategory { get; set; } + /// Error code. + string ErrorCode { get; set; } + /// The health error unique id. + string ErrorId { get; set; } + /// Level of error. + string ErrorLevel { get; set; } + /// Error message. + string ErrorMessage { get; set; } + /// Source of error. + string ErrorSource { get; set; } + /// Type of error. + string ErrorType { get; set; } + /// Possible causes of error. + string PossibleCaus { get; set; } + /// Recommended action to resolve error. + string RecommendedAction { get; set; } + /// DRA error message. + string RecoveryProviderErrorMessage { get; set; } + /// Summary message of the entity. + string SummaryMessage { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InnerHealthError.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InnerHealthError.json.cs new file mode 100644 index 000000000000..f383077a81bf --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InnerHealthError.json.cs @@ -0,0 +1,139 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// + /// 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. + /// + public partial class InnerHealthError + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInnerHealthError. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInnerHealthError. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInnerHealthError FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new InnerHealthError(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal InnerHealthError(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_errorSource = If( json?.PropertyT("errorSource"), out var __jsonErrorSource) ? (string)__jsonErrorSource : (string)ErrorSource;} + {_errorType = If( json?.PropertyT("errorType"), out var __jsonErrorType) ? (string)__jsonErrorType : (string)ErrorType;} + {_errorLevel = If( json?.PropertyT("errorLevel"), out var __jsonErrorLevel) ? (string)__jsonErrorLevel : (string)ErrorLevel;} + {_errorCategory = If( json?.PropertyT("errorCategory"), out var __jsonErrorCategory) ? (string)__jsonErrorCategory : (string)ErrorCategory;} + {_errorCode = If( json?.PropertyT("errorCode"), out var __jsonErrorCode) ? (string)__jsonErrorCode : (string)ErrorCode;} + {_summaryMessage = If( json?.PropertyT("summaryMessage"), out var __jsonSummaryMessage) ? (string)__jsonSummaryMessage : (string)SummaryMessage;} + {_errorMessage = If( json?.PropertyT("errorMessage"), out var __jsonErrorMessage) ? (string)__jsonErrorMessage : (string)ErrorMessage;} + {_possibleCaus = If( json?.PropertyT("possibleCauses"), out var __jsonPossibleCauses) ? (string)__jsonPossibleCauses : (string)PossibleCaus;} + {_recommendedAction = If( json?.PropertyT("recommendedAction"), out var __jsonRecommendedAction) ? (string)__jsonRecommendedAction : (string)RecommendedAction;} + {_creationTimeUtc = If( json?.PropertyT("creationTimeUtc"), out var __jsonCreationTimeUtc) ? global::System.DateTime.TryParse((string)__jsonCreationTimeUtc, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonCreationTimeUtcValue) ? __jsonCreationTimeUtcValue : CreationTimeUtc : CreationTimeUtc;} + {_recoveryProviderErrorMessage = If( json?.PropertyT("recoveryProviderErrorMessage"), out var __jsonRecoveryProviderErrorMessage) ? (string)__jsonRecoveryProviderErrorMessage : (string)RecoveryProviderErrorMessage;} + {_entityId = If( json?.PropertyT("entityId"), out var __jsonEntityId) ? (string)__jsonEntityId : (string)EntityId;} + {_errorId = If( json?.PropertyT("errorId"), out var __jsonErrorId) ? (string)__jsonErrorId : (string)ErrorId;} + {_customerResolvability = If( json?.PropertyT("customerResolvability"), out var __jsonCustomerResolvability) ? (string)__jsonCustomerResolvability : (string)CustomerResolvability;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._errorSource)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._errorSource.ToString()) : null, "errorSource" ,container.Add ); + AddIf( null != (((object)this._errorType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._errorType.ToString()) : null, "errorType" ,container.Add ); + AddIf( null != (((object)this._errorLevel)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._errorLevel.ToString()) : null, "errorLevel" ,container.Add ); + AddIf( null != (((object)this._errorCategory)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._errorCategory.ToString()) : null, "errorCategory" ,container.Add ); + AddIf( null != (((object)this._errorCode)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._errorCode.ToString()) : null, "errorCode" ,container.Add ); + AddIf( null != (((object)this._summaryMessage)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._summaryMessage.ToString()) : null, "summaryMessage" ,container.Add ); + AddIf( null != (((object)this._errorMessage)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._errorMessage.ToString()) : null, "errorMessage" ,container.Add ); + AddIf( null != (((object)this._possibleCaus)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._possibleCaus.ToString()) : null, "possibleCauses" ,container.Add ); + AddIf( null != (((object)this._recommendedAction)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recommendedAction.ToString()) : null, "recommendedAction" ,container.Add ); + AddIf( null != this._creationTimeUtc ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._creationTimeUtc?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "creationTimeUtc" ,container.Add ); + AddIf( null != (((object)this._recoveryProviderErrorMessage)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryProviderErrorMessage.ToString()) : null, "recoveryProviderErrorMessage" ,container.Add ); + AddIf( null != (((object)this._entityId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._entityId.ToString()) : null, "entityId" ,container.Add ); + AddIf( null != (((object)this._errorId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._errorId.ToString()) : null, "errorId" ,container.Add ); + AddIf( null != (((object)this._customerResolvability)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._customerResolvability.ToString()) : null, "customerResolvability" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InputEndpoint.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InputEndpoint.PowerShell.cs new file mode 100644 index 000000000000..cfeb8e455681 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InputEndpoint.PowerShell.cs @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + [System.ComponentModel.TypeConverter(typeof(InputEndpointTypeConverter))] + public partial class InputEndpoint + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInputEndpoint DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InputEndpoint(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInputEndpoint DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InputEndpoint(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInputEndpoint FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InputEndpoint(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("EndpointName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInputEndpointInternal)this).EndpointName = (string) content.GetValueForProperty("EndpointName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInputEndpointInternal)this).EndpointName, global::System.Convert.ToString); + } + if (content.Contains("PrivatePort")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInputEndpointInternal)this).PrivatePort = (int?) content.GetValueForProperty("PrivatePort",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInputEndpointInternal)this).PrivatePort, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("PublicPort")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInputEndpointInternal)this).PublicPort = (int?) content.GetValueForProperty("PublicPort",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInputEndpointInternal)this).PublicPort, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("Protocol")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInputEndpointInternal)this).Protocol = (string) content.GetValueForProperty("Protocol",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInputEndpointInternal)this).Protocol, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InputEndpoint(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("EndpointName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInputEndpointInternal)this).EndpointName = (string) content.GetValueForProperty("EndpointName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInputEndpointInternal)this).EndpointName, global::System.Convert.ToString); + } + if (content.Contains("PrivatePort")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInputEndpointInternal)this).PrivatePort = (int?) content.GetValueForProperty("PrivatePort",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInputEndpointInternal)this).PrivatePort, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("PublicPort")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInputEndpointInternal)this).PublicPort = (int?) content.GetValueForProperty("PublicPort",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInputEndpointInternal)this).PublicPort, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("Protocol")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInputEndpointInternal)this).Protocol = (string) content.GetValueForProperty("Protocol",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInputEndpointInternal)this).Protocol, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + [System.ComponentModel.TypeConverter(typeof(InputEndpointTypeConverter))] + public partial interface IInputEndpoint + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InputEndpoint.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InputEndpoint.TypeConverter.cs new file mode 100644 index 000000000000..346ce3f076eb --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InputEndpoint.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InputEndpointTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInputEndpoint ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInputEndpoint).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InputEndpoint.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InputEndpoint.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InputEndpoint.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InputEndpoint.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InputEndpoint.cs new file mode 100644 index 000000000000..045c4bec2f3b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InputEndpoint.cs @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + public partial class InputEndpoint : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInputEndpoint, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInputEndpointInternal + { + + /// Backing field for property. + private string _endpointName; + + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string EndpointName { get => this._endpointName; set => this._endpointName = value; } + + /// Backing field for property. + private int? _privatePort; + + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? PrivatePort { get => this._privatePort; set => this._privatePort = value; } + + /// Backing field for property. + private string _protocol; + + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Protocol { get => this._protocol; set => this._protocol = value; } + + /// Backing field for property. + private int? _publicPort; + + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? PublicPort { get => this._publicPort; set => this._publicPort = value; } + + /// Creates an new instance. + public InputEndpoint() + { + + } + } + public partial interface IInputEndpoint : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"", + SerializedName = @"endpointName", + PossibleTypes = new [] { typeof(string) })] + string EndpointName { get; set; } + + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"", + SerializedName = @"privatePort", + PossibleTypes = new [] { typeof(int) })] + int? PrivatePort { get; set; } + + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"", + SerializedName = @"protocol", + PossibleTypes = new [] { typeof(string) })] + string Protocol { get; set; } + + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"", + SerializedName = @"publicPort", + PossibleTypes = new [] { typeof(int) })] + int? PublicPort { get; set; } + + } + internal partial interface IInputEndpointInternal + + { + string EndpointName { get; set; } + + int? PrivatePort { get; set; } + + string Protocol { get; set; } + + int? PublicPort { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InputEndpoint.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InputEndpoint.json.cs new file mode 100644 index 000000000000..f8c39a5db48f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/InputEndpoint.json.cs @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + public partial class InputEndpoint + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInputEndpoint. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInputEndpoint. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInputEndpoint FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new InputEndpoint(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal InputEndpoint(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_endpointName = If( json?.PropertyT("endpointName"), out var __jsonEndpointName) ? (string)__jsonEndpointName : (string)EndpointName;} + {_privatePort = If( json?.PropertyT("privatePort"), out var __jsonPrivatePort) ? (int?)__jsonPrivatePort : PrivatePort;} + {_publicPort = If( json?.PropertyT("publicPort"), out var __jsonPublicPort) ? (int?)__jsonPublicPort : PublicPort;} + {_protocol = If( json?.PropertyT("protocol"), out var __jsonProtocol) ? (string)__jsonProtocol : (string)Protocol;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._endpointName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._endpointName.ToString()) : null, "endpointName" ,container.Add ); + AddIf( null != this._privatePort ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._privatePort) : null, "privatePort" ,container.Add ); + AddIf( null != this._publicPort ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._publicPort) : null, "publicPort" ,container.Add ); + AddIf( null != (((object)this._protocol)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._protocol.ToString()) : null, "protocol" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Job.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Job.PowerShell.cs new file mode 100644 index 000000000000..c4c1b63ef577 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Job.PowerShell.cs @@ -0,0 +1,304 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Job details. + [System.ComponentModel.TypeConverter(typeof(JobTypeConverter))] + public partial class Job + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJob DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new Job(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJob DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new Job(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJob FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal Job(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.JobPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("CustomDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobInternal)this).CustomDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetails) content.GetValueForProperty("CustomDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobInternal)this).CustomDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.JobDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("ActivityId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobInternal)this).ActivityId = (string) content.GetValueForProperty("ActivityId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobInternal)this).ActivityId, global::System.Convert.ToString); + } + if (content.Contains("ScenarioName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobInternal)this).ScenarioName = (string) content.GetValueForProperty("ScenarioName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobInternal)this).ScenarioName, global::System.Convert.ToString); + } + if (content.Contains("FriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobInternal)this).FriendlyName = (string) content.GetValueForProperty("FriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobInternal)this).FriendlyName, global::System.Convert.ToString); + } + if (content.Contains("State")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobInternal)this).State = (string) content.GetValueForProperty("State",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobInternal)this).State, global::System.Convert.ToString); + } + if (content.Contains("StateDescription")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobInternal)this).StateDescription = (string) content.GetValueForProperty("StateDescription",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobInternal)this).StateDescription, global::System.Convert.ToString); + } + if (content.Contains("Task")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobInternal)this).Task = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTask[]) content.GetValueForProperty("Task",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobInternal)this).Task, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AsrTaskTypeConverter.ConvertFrom)); + } + if (content.Contains("Error")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobInternal)this).Error = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobErrorDetails[]) content.GetValueForProperty("Error",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobInternal)this).Error, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.JobErrorDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("StartTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobInternal)this).StartTime = (global::System.DateTime?) content.GetValueForProperty("StartTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobInternal)this).StartTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("EndTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobInternal)this).EndTime = (global::System.DateTime?) content.GetValueForProperty("EndTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobInternal)this).EndTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("AllowedAction")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobInternal)this).AllowedAction = (string[]) content.GetValueForProperty("AllowedAction",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobInternal)this).AllowedAction, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("TargetObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobInternal)this).TargetObjectId = (string) content.GetValueForProperty("TargetObjectId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobInternal)this).TargetObjectId, global::System.Convert.ToString); + } + if (content.Contains("TargetObjectName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobInternal)this).TargetObjectName = (string) content.GetValueForProperty("TargetObjectName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobInternal)this).TargetObjectName, global::System.Convert.ToString); + } + if (content.Contains("TargetInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobInternal)this).TargetInstanceType = (string) content.GetValueForProperty("TargetInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobInternal)this).TargetInstanceType, global::System.Convert.ToString); + } + if (content.Contains("CustomDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobInternal)this).CustomDetailInstanceType = (string) content.GetValueForProperty("CustomDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobInternal)this).CustomDetailInstanceType, global::System.Convert.ToString); + } + if (content.Contains("CustomDetailAffectedObjectDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobInternal)this).CustomDetailAffectedObjectDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsAffectedObjectDetails) content.GetValueForProperty("CustomDetailAffectedObjectDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobInternal)this).CustomDetailAffectedObjectDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.JobDetailsAffectedObjectDetailsTypeConverter.ConvertFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal Job(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.JobPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("CustomDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobInternal)this).CustomDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetails) content.GetValueForProperty("CustomDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobInternal)this).CustomDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.JobDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("ActivityId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobInternal)this).ActivityId = (string) content.GetValueForProperty("ActivityId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobInternal)this).ActivityId, global::System.Convert.ToString); + } + if (content.Contains("ScenarioName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobInternal)this).ScenarioName = (string) content.GetValueForProperty("ScenarioName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobInternal)this).ScenarioName, global::System.Convert.ToString); + } + if (content.Contains("FriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobInternal)this).FriendlyName = (string) content.GetValueForProperty("FriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobInternal)this).FriendlyName, global::System.Convert.ToString); + } + if (content.Contains("State")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobInternal)this).State = (string) content.GetValueForProperty("State",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobInternal)this).State, global::System.Convert.ToString); + } + if (content.Contains("StateDescription")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobInternal)this).StateDescription = (string) content.GetValueForProperty("StateDescription",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobInternal)this).StateDescription, global::System.Convert.ToString); + } + if (content.Contains("Task")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobInternal)this).Task = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTask[]) content.GetValueForProperty("Task",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobInternal)this).Task, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AsrTaskTypeConverter.ConvertFrom)); + } + if (content.Contains("Error")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobInternal)this).Error = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobErrorDetails[]) content.GetValueForProperty("Error",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobInternal)this).Error, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.JobErrorDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("StartTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobInternal)this).StartTime = (global::System.DateTime?) content.GetValueForProperty("StartTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobInternal)this).StartTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("EndTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobInternal)this).EndTime = (global::System.DateTime?) content.GetValueForProperty("EndTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobInternal)this).EndTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("AllowedAction")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobInternal)this).AllowedAction = (string[]) content.GetValueForProperty("AllowedAction",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobInternal)this).AllowedAction, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("TargetObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobInternal)this).TargetObjectId = (string) content.GetValueForProperty("TargetObjectId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobInternal)this).TargetObjectId, global::System.Convert.ToString); + } + if (content.Contains("TargetObjectName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobInternal)this).TargetObjectName = (string) content.GetValueForProperty("TargetObjectName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobInternal)this).TargetObjectName, global::System.Convert.ToString); + } + if (content.Contains("TargetInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobInternal)this).TargetInstanceType = (string) content.GetValueForProperty("TargetInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobInternal)this).TargetInstanceType, global::System.Convert.ToString); + } + if (content.Contains("CustomDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobInternal)this).CustomDetailInstanceType = (string) content.GetValueForProperty("CustomDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobInternal)this).CustomDetailInstanceType, global::System.Convert.ToString); + } + if (content.Contains("CustomDetailAffectedObjectDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobInternal)this).CustomDetailAffectedObjectDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsAffectedObjectDetails) content.GetValueForProperty("CustomDetailAffectedObjectDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobInternal)this).CustomDetailAffectedObjectDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.JobDetailsAffectedObjectDetailsTypeConverter.ConvertFrom); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Job details. + [System.ComponentModel.TypeConverter(typeof(JobTypeConverter))] + public partial interface IJob + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Job.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Job.TypeConverter.cs new file mode 100644 index 000000000000..2f1c41d56fdf --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Job.TypeConverter.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class JobTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJob ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJob).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return Job.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return Job.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return Job.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Job.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Job.cs new file mode 100644 index 000000000000..137a7484c922 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Job.cs @@ -0,0 +1,338 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Job details. + public partial class Job : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJob, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResource __resource = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.Resource(); + + /// The activity id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ActivityId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobPropertiesInternal)Property).ActivityId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobPropertiesInternal)Property).ActivityId = value ?? null; } + + /// The Allowed action the job. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string[] AllowedAction { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobPropertiesInternal)Property).AllowedAction; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobPropertiesInternal)Property).AllowedAction = value ?? null /* arrayOf */; } + + /// + /// The affected object properties like source server, source cloud, target server, target cloud etc. based on the workflow + /// object details. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsAffectedObjectDetails CustomDetailAffectedObjectDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobPropertiesInternal)Property).CustomDetailAffectedObjectDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobPropertiesInternal)Property).CustomDetailAffectedObjectDetail = value ?? null /* model class */; } + + /// Gets the type of job details (see JobDetailsTypes enum for possible values). + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string CustomDetailInstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobPropertiesInternal)Property).CustomDetailInstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobPropertiesInternal)Property).CustomDetailInstanceType = value ?? null; } + + /// The end time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public global::System.DateTime? EndTime { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobPropertiesInternal)Property).EndTime; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobPropertiesInternal)Property).EndTime = value ?? default(global::System.DateTime); } + + /// The errors. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobErrorDetails[] Error { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobPropertiesInternal)Property).Error; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobPropertiesInternal)Property).Error = value ?? null /* arrayOf */; } + + /// The DisplayName. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string FriendlyName { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobPropertiesInternal)Property).FriendlyName; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobPropertiesInternal)Property).FriendlyName = value ?? null; } + + /// Resource Id + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Id; } + + /// Resource Location + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string Location { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Location; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Location = value ?? null; } + + /// Internal Acessors for CustomDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetails Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobInternal.CustomDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobPropertiesInternal)Property).CustomDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobPropertiesInternal)Property).CustomDetail = value; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobProperties Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.JobProperties()); set { {_property = value;} } } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Id = value; } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Name = value; } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Type = value; } + + /// Resource Name + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Name; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobProperties _property; + + /// The custom data. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.JobProperties()); set => this._property = value; } + + /// The ScenarioName. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ScenarioName { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobPropertiesInternal)Property).ScenarioName; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobPropertiesInternal)Property).ScenarioName = value ?? null; } + + /// The start time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public global::System.DateTime? StartTime { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobPropertiesInternal)Property).StartTime; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobPropertiesInternal)Property).StartTime = value ?? default(global::System.DateTime); } + + /// + /// The status of the Job. It is one of these values - NotStarted, InProgress, Succeeded, Failed, Cancelled, Suspended or + /// Other. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string State { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobPropertiesInternal)Property).State; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobPropertiesInternal)Property).State = value ?? null; } + + /// + /// The description of the state of the Job. For e.g. - For Succeeded state, description can be Completed, PartiallySucceeded, + /// CompletedWithInformation or Skipped. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string StateDescription { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobPropertiesInternal)Property).StateDescription; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobPropertiesInternal)Property).StateDescription = value ?? null; } + + /// + /// The type of the affected object which is of Microsoft.Azure.SiteRecovery.V2015_11_10.AffectedObjectType class. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string TargetInstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobPropertiesInternal)Property).TargetInstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobPropertiesInternal)Property).TargetInstanceType = value ?? null; } + + /// The affected Object Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string TargetObjectId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobPropertiesInternal)Property).TargetObjectId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobPropertiesInternal)Property).TargetObjectId = value ?? null; } + + /// The name of the affected object. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string TargetObjectName { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobPropertiesInternal)Property).TargetObjectName; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobPropertiesInternal)Property).TargetObjectName = value ?? null; } + + /// The tasks. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTask[] Task { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobPropertiesInternal)Property).Task; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobPropertiesInternal)Property).Task = value ?? null /* arrayOf */; } + + /// Resource Type + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Type; } + + /// Creates an new instance. + public Job() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__resource), __resource); + await eventListener.AssertObjectIsValid(nameof(__resource), __resource); + } + } + /// Job details. + public partial interface IJob : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResource + { + /// The activity id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The activity id.", + SerializedName = @"activityId", + PossibleTypes = new [] { typeof(string) })] + string ActivityId { get; set; } + /// The Allowed action the job. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Allowed action the job.", + SerializedName = @"allowedActions", + PossibleTypes = new [] { typeof(string) })] + string[] AllowedAction { get; set; } + /// + /// The affected object properties like source server, source cloud, target server, target cloud etc. based on the workflow + /// object details. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The affected object properties like source server, source cloud, target server, target cloud etc. based on the workflow object details.", + SerializedName = @"affectedObjectDetails", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsAffectedObjectDetails) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsAffectedObjectDetails CustomDetailAffectedObjectDetail { get; set; } + /// Gets the type of job details (see JobDetailsTypes enum for possible values). + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets the type of job details (see JobDetailsTypes enum for possible values).", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string CustomDetailInstanceType { get; set; } + /// The end time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The end time.", + SerializedName = @"endTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? EndTime { get; set; } + /// The errors. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The errors.", + SerializedName = @"errors", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobErrorDetails) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobErrorDetails[] Error { get; set; } + /// The DisplayName. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The DisplayName.", + SerializedName = @"friendlyName", + PossibleTypes = new [] { typeof(string) })] + string FriendlyName { get; set; } + /// The ScenarioName. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The ScenarioName.", + SerializedName = @"scenarioName", + PossibleTypes = new [] { typeof(string) })] + string ScenarioName { get; set; } + /// The start time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The start time.", + SerializedName = @"startTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? StartTime { get; set; } + /// + /// The status of the Job. It is one of these values - NotStarted, InProgress, Succeeded, Failed, Cancelled, Suspended or + /// Other. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The status of the Job. It is one of these values - NotStarted, InProgress, Succeeded, Failed, Cancelled, Suspended or Other.", + SerializedName = @"state", + PossibleTypes = new [] { typeof(string) })] + string State { get; set; } + /// + /// The description of the state of the Job. For e.g. - For Succeeded state, description can be Completed, PartiallySucceeded, + /// CompletedWithInformation or Skipped. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The description of the state of the Job. For e.g. - For Succeeded state, description can be Completed, PartiallySucceeded, CompletedWithInformation or Skipped.", + SerializedName = @"stateDescription", + PossibleTypes = new [] { typeof(string) })] + string StateDescription { get; set; } + /// + /// The type of the affected object which is of Microsoft.Azure.SiteRecovery.V2015_11_10.AffectedObjectType class. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The type of the affected object which is of Microsoft.Azure.SiteRecovery.V2015_11_10.AffectedObjectType class.", + SerializedName = @"targetInstanceType", + PossibleTypes = new [] { typeof(string) })] + string TargetInstanceType { get; set; } + /// The affected Object Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The affected Object Id.", + SerializedName = @"targetObjectId", + PossibleTypes = new [] { typeof(string) })] + string TargetObjectId { get; set; } + /// The name of the affected object. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the affected object.", + SerializedName = @"targetObjectName", + PossibleTypes = new [] { typeof(string) })] + string TargetObjectName { get; set; } + /// The tasks. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The tasks.", + SerializedName = @"tasks", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTask) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTask[] Task { get; set; } + + } + /// Job details. + internal partial interface IJobInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal + { + /// The activity id. + string ActivityId { get; set; } + /// The Allowed action the job. + string[] AllowedAction { get; set; } + /// The custom job details like test failover job details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetails CustomDetail { get; set; } + /// + /// The affected object properties like source server, source cloud, target server, target cloud etc. based on the workflow + /// object details. + /// + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsAffectedObjectDetails CustomDetailAffectedObjectDetail { get; set; } + /// Gets the type of job details (see JobDetailsTypes enum for possible values). + string CustomDetailInstanceType { get; set; } + /// The end time. + global::System.DateTime? EndTime { get; set; } + /// The errors. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobErrorDetails[] Error { get; set; } + /// The DisplayName. + string FriendlyName { get; set; } + /// The custom data. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobProperties Property { get; set; } + /// The ScenarioName. + string ScenarioName { get; set; } + /// The start time. + global::System.DateTime? StartTime { get; set; } + /// + /// The status of the Job. It is one of these values - NotStarted, InProgress, Succeeded, Failed, Cancelled, Suspended or + /// Other. + /// + string State { get; set; } + /// + /// The description of the state of the Job. For e.g. - For Succeeded state, description can be Completed, PartiallySucceeded, + /// CompletedWithInformation or Skipped. + /// + string StateDescription { get; set; } + /// + /// The type of the affected object which is of Microsoft.Azure.SiteRecovery.V2015_11_10.AffectedObjectType class. + /// + string TargetInstanceType { get; set; } + /// The affected Object Id. + string TargetObjectId { get; set; } + /// The name of the affected object. + string TargetObjectName { get; set; } + /// The tasks. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTask[] Task { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Job.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Job.json.cs new file mode 100644 index 000000000000..7cb224d15ea2 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Job.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Job details. + public partial class Job + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJob. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJob. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJob FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new Job(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal Job(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __resource = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.Resource(json); + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.JobProperties.FromJson(__jsonProperties) : Property;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __resource?.ToJson(container, serializationMode); + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobCollection.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobCollection.PowerShell.cs new file mode 100644 index 000000000000..cc24bb66fe2d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobCollection.PowerShell.cs @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Collection of jobs. + [System.ComponentModel.TypeConverter(typeof(JobCollectionTypeConverter))] + public partial class JobCollection + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobCollection DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new JobCollection(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobCollection DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new JobCollection(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobCollection FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal JobCollection(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJob[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.JobTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobCollectionInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobCollectionInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal JobCollection(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJob[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.JobTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobCollectionInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobCollectionInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Collection of jobs. + [System.ComponentModel.TypeConverter(typeof(JobCollectionTypeConverter))] + public partial interface IJobCollection + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobCollection.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobCollection.TypeConverter.cs new file mode 100644 index 000000000000..549d099dd71b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobCollection.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class JobCollectionTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobCollection ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobCollection).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return JobCollection.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return JobCollection.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return JobCollection.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobCollection.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobCollection.cs new file mode 100644 index 000000000000..214312a723f5 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobCollection.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Collection of jobs. + public partial class JobCollection : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobCollection, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobCollectionInternal + { + + /// Backing field for property. + private string _nextLink; + + /// The value of next link. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string NextLink { get => this._nextLink; set => this._nextLink = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJob[] _value; + + /// The list of jobs. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJob[] Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public JobCollection() + { + + } + } + /// Collection of jobs. + public partial interface IJobCollection : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The value of next link. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The value of next link.", + SerializedName = @"nextLink", + PossibleTypes = new [] { typeof(string) })] + string NextLink { get; set; } + /// The list of jobs. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of jobs.", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJob) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJob[] Value { get; set; } + + } + /// Collection of jobs. + internal partial interface IJobCollectionInternal + + { + /// The value of next link. + string NextLink { get; set; } + /// The list of jobs. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJob[] Value { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobCollection.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobCollection.json.cs new file mode 100644 index 000000000000..e3fae45db34c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobCollection.json.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Collection of jobs. + public partial class JobCollection + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobCollection. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobCollection. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobCollection FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new JobCollection(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal JobCollection(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJob) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.Job.FromJson(__u) )) ))() : null : Value;} + {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)NextLink;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._value) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._value ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("value",__w); + } + AddIf( null != (((object)this._nextLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobDetails.PowerShell.cs new file mode 100644 index 000000000000..d08d60a571d4 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobDetails.PowerShell.cs @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Job details based on specific job type. + [System.ComponentModel.TypeConverter(typeof(JobDetailsTypeConverter))] + public partial class JobDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new JobDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new JobDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal JobDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + if (content.Contains("AffectedObjectDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsInternal)this).AffectedObjectDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsAffectedObjectDetails) content.GetValueForProperty("AffectedObjectDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsInternal)this).AffectedObjectDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.JobDetailsAffectedObjectDetailsTypeConverter.ConvertFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal JobDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + if (content.Contains("AffectedObjectDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsInternal)this).AffectedObjectDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsAffectedObjectDetails) content.GetValueForProperty("AffectedObjectDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsInternal)this).AffectedObjectDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.JobDetailsAffectedObjectDetailsTypeConverter.ConvertFrom); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Job details based on specific job type. + [System.ComponentModel.TypeConverter(typeof(JobDetailsTypeConverter))] + public partial interface IJobDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobDetails.TypeConverter.cs new file mode 100644 index 000000000000..ea0cf1a8c841 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobDetails.TypeConverter.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class JobDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return JobDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return JobDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return JobDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobDetails.cs new file mode 100644 index 000000000000..e28413fa749e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobDetails.cs @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Job details based on specific job type. + public partial class JobDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsAffectedObjectDetails _affectedObjectDetail; + + /// + /// The affected object properties like source server, source cloud, target server, target cloud etc. based on the workflow + /// object details. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsAffectedObjectDetails AffectedObjectDetail { get => (this._affectedObjectDetail = this._affectedObjectDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.JobDetailsAffectedObjectDetails()); set => this._affectedObjectDetail = value; } + + /// Backing field for property. + private string _instanceType; + + /// Gets the type of job details (see JobDetailsTypes enum for possible values). + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string InstanceType { get => this._instanceType; set => this._instanceType = value; } + + /// Creates an new instance. + public JobDetails() + { + + } + } + /// Job details based on specific job type. + public partial interface IJobDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// + /// The affected object properties like source server, source cloud, target server, target cloud etc. based on the workflow + /// object details. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The affected object properties like source server, source cloud, target server, target cloud etc. based on the workflow object details.", + SerializedName = @"affectedObjectDetails", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsAffectedObjectDetails) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsAffectedObjectDetails AffectedObjectDetail { get; set; } + /// Gets the type of job details (see JobDetailsTypes enum for possible values). + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets the type of job details (see JobDetailsTypes enum for possible values).", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string InstanceType { get; set; } + + } + /// Job details based on specific job type. + internal partial interface IJobDetailsInternal + + { + /// + /// The affected object properties like source server, source cloud, target server, target cloud etc. based on the workflow + /// object details. + /// + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsAffectedObjectDetails AffectedObjectDetail { get; set; } + /// Gets the type of job details (see JobDetailsTypes enum for possible values). + string InstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobDetails.json.cs new file mode 100644 index 000000000000..f9848d40552d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobDetails.json.cs @@ -0,0 +1,141 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Job details based on specific job type. + public partial class JobDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetails. + /// Note: the Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetails interface is polymorphic, and the + /// precise model class that will get deserialized is determined at runtime based on the payload. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + if (!(node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json)) + { + return null; + } + // Polymorphic type -- select the appropriate constructor using the discriminator + + switch ( json.StringProperty("instanceType") ) + { + case "AsrJobDetails": + { + return new AsrJobDetails(json); + } + case "ExportJobDetails": + { + return new ExportJobDetails(json); + } + case "FailoverJobDetails": + { + return new FailoverJobDetails(json); + } + case "SwitchProtectionJobDetails": + { + return new SwitchProtectionJobDetails(json); + } + case "TestFailoverJobDetails": + { + return new TestFailoverJobDetails(json); + } + } + return new JobDetails(json); + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal JobDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_instanceType = If( json?.PropertyT("instanceType"), out var __jsonInstanceType) ? (string)__jsonInstanceType : (string)InstanceType;} + {_affectedObjectDetail = If( json?.PropertyT("affectedObjectDetails"), out var __jsonAffectedObjectDetails) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.JobDetailsAffectedObjectDetails.FromJson(__jsonAffectedObjectDetails) : AffectedObjectDetail;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._instanceType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._instanceType.ToString()) : null, "instanceType" ,container.Add ); + AddIf( null != this._affectedObjectDetail ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._affectedObjectDetail.ToJson(null,serializationMode) : null, "affectedObjectDetails" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobDetailsAffectedObjectDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobDetailsAffectedObjectDetails.PowerShell.cs new file mode 100644 index 000000000000..ce5742cb9751 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobDetailsAffectedObjectDetails.PowerShell.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// The affected object properties like source server, source cloud, target server, target cloud etc. based on the workflow + /// object details. + /// + [System.ComponentModel.TypeConverter(typeof(JobDetailsAffectedObjectDetailsTypeConverter))] + public partial class JobDetailsAffectedObjectDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsAffectedObjectDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new JobDetailsAffectedObjectDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsAffectedObjectDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new JobDetailsAffectedObjectDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsAffectedObjectDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal JobDetailsAffectedObjectDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal JobDetailsAffectedObjectDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// The affected object properties like source server, source cloud, target server, target cloud etc. based on the workflow + /// object details. + [System.ComponentModel.TypeConverter(typeof(JobDetailsAffectedObjectDetailsTypeConverter))] + public partial interface IJobDetailsAffectedObjectDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobDetailsAffectedObjectDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobDetailsAffectedObjectDetails.TypeConverter.cs new file mode 100644 index 000000000000..aa6792818a1a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobDetailsAffectedObjectDetails.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class JobDetailsAffectedObjectDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsAffectedObjectDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsAffectedObjectDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return JobDetailsAffectedObjectDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return JobDetailsAffectedObjectDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return JobDetailsAffectedObjectDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobDetailsAffectedObjectDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobDetailsAffectedObjectDetails.cs new file mode 100644 index 000000000000..25f5cc939901 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobDetailsAffectedObjectDetails.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// + /// The affected object properties like source server, source cloud, target server, target cloud etc. based on the workflow + /// object details. + /// + public partial class JobDetailsAffectedObjectDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsAffectedObjectDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsAffectedObjectDetailsInternal + { + + /// Creates an new instance. + public JobDetailsAffectedObjectDetails() + { + + } + } + /// The affected object properties like source server, source cloud, target server, target cloud etc. based on the workflow + /// object details. + public partial interface IJobDetailsAffectedObjectDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray + { + + } + /// The affected object properties like source server, source cloud, target server, target cloud etc. based on the workflow + /// object details. + internal partial interface IJobDetailsAffectedObjectDetailsInternal + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobDetailsAffectedObjectDetails.dictionary.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobDetailsAffectedObjectDetails.dictionary.cs new file mode 100644 index 000000000000..58c63ddb41c0 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobDetailsAffectedObjectDetails.dictionary.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + public partial class JobDetailsAffectedObjectDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray + { + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + + int Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Values { get => __additionalProperties.Values; } + + public string this[global::System.String index] { get => __additionalProperties[index]; set => __additionalProperties[index] = value; } + + /// + /// + public void Add(global::System.String key, string value) => __additionalProperties.Add( key, value); + + public void Clear() => __additionalProperties.Clear(); + + /// + public bool ContainsKey(global::System.String key) => __additionalProperties.ContainsKey( key); + + /// + public void CopyFrom(global::System.Collections.IDictionary source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public void CopyFrom(global::System.Management.Automation.PSObject source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public bool Remove(global::System.String key) => __additionalProperties.Remove( key); + + /// + /// + public bool TryGetValue(global::System.String key, out string value) => __additionalProperties.TryGetValue( key, out value); + + /// + + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.JobDetailsAffectedObjectDetails source) => source.__additionalProperties; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobDetailsAffectedObjectDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobDetailsAffectedObjectDetails.json.cs new file mode 100644 index 000000000000..ffc4961704e3 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobDetailsAffectedObjectDetails.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// + /// The affected object properties like source server, source cloud, target server, target cloud etc. based on the workflow + /// object details. + /// + public partial class JobDetailsAffectedObjectDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsAffectedObjectDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsAffectedObjectDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsAffectedObjectDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new JobDetailsAffectedObjectDetails(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + /// + internal JobDetailsAffectedObjectDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, global::System.Collections.Generic.HashSet exclusions = null) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray)this).AdditionalProperties, null ,exclusions ); + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray)this).AdditionalProperties, container); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobEntity.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobEntity.PowerShell.cs new file mode 100644 index 000000000000..e3234969e555 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobEntity.PowerShell.cs @@ -0,0 +1,186 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// This class contains the minimal job details required to navigate to the desired drill down. + /// + [System.ComponentModel.TypeConverter(typeof(JobEntityTypeConverter))] + public partial class JobEntity + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobEntity DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new JobEntity(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobEntity DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new JobEntity(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobEntity FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal JobEntity(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("JobId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobEntityInternal)this).JobId = (string) content.GetValueForProperty("JobId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobEntityInternal)this).JobId, global::System.Convert.ToString); + } + if (content.Contains("JobFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobEntityInternal)this).JobFriendlyName = (string) content.GetValueForProperty("JobFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobEntityInternal)this).JobFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("TargetObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobEntityInternal)this).TargetObjectId = (string) content.GetValueForProperty("TargetObjectId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobEntityInternal)this).TargetObjectId, global::System.Convert.ToString); + } + if (content.Contains("TargetObjectName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobEntityInternal)this).TargetObjectName = (string) content.GetValueForProperty("TargetObjectName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobEntityInternal)this).TargetObjectName, global::System.Convert.ToString); + } + if (content.Contains("TargetInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobEntityInternal)this).TargetInstanceType = (string) content.GetValueForProperty("TargetInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobEntityInternal)this).TargetInstanceType, global::System.Convert.ToString); + } + if (content.Contains("JobScenarioName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobEntityInternal)this).JobScenarioName = (string) content.GetValueForProperty("JobScenarioName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobEntityInternal)this).JobScenarioName, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal JobEntity(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("JobId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobEntityInternal)this).JobId = (string) content.GetValueForProperty("JobId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobEntityInternal)this).JobId, global::System.Convert.ToString); + } + if (content.Contains("JobFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobEntityInternal)this).JobFriendlyName = (string) content.GetValueForProperty("JobFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobEntityInternal)this).JobFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("TargetObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobEntityInternal)this).TargetObjectId = (string) content.GetValueForProperty("TargetObjectId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobEntityInternal)this).TargetObjectId, global::System.Convert.ToString); + } + if (content.Contains("TargetObjectName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobEntityInternal)this).TargetObjectName = (string) content.GetValueForProperty("TargetObjectName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobEntityInternal)this).TargetObjectName, global::System.Convert.ToString); + } + if (content.Contains("TargetInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobEntityInternal)this).TargetInstanceType = (string) content.GetValueForProperty("TargetInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobEntityInternal)this).TargetInstanceType, global::System.Convert.ToString); + } + if (content.Contains("JobScenarioName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobEntityInternal)this).JobScenarioName = (string) content.GetValueForProperty("JobScenarioName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobEntityInternal)this).JobScenarioName, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// This class contains the minimal job details required to navigate to the desired drill down. + [System.ComponentModel.TypeConverter(typeof(JobEntityTypeConverter))] + public partial interface IJobEntity + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobEntity.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobEntity.TypeConverter.cs new file mode 100644 index 000000000000..e5d59dadb3fa --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobEntity.TypeConverter.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class JobEntityTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobEntity ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobEntity).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return JobEntity.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return JobEntity.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return JobEntity.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobEntity.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobEntity.cs new file mode 100644 index 000000000000..8be99fc6105a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobEntity.cs @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// + /// This class contains the minimal job details required to navigate to the desired drill down. + /// + public partial class JobEntity : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobEntity, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobEntityInternal + { + + /// Backing field for property. + private string _jobFriendlyName; + + /// The job display name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string JobFriendlyName { get => this._jobFriendlyName; set => this._jobFriendlyName = value; } + + /// Backing field for property. + private string _jobId; + + /// The job id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string JobId { get => this._jobId; set => this._jobId = value; } + + /// Backing field for property. + private string _jobScenarioName; + + /// The job name. Enum type ScenarioName. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string JobScenarioName { get => this._jobScenarioName; set => this._jobScenarioName = value; } + + /// Backing field for property. + private string _targetInstanceType; + + /// The workflow affected object type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetInstanceType { get => this._targetInstanceType; set => this._targetInstanceType = value; } + + /// Backing field for property. + private string _targetObjectId; + + /// The object id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetObjectId { get => this._targetObjectId; set => this._targetObjectId = value; } + + /// Backing field for property. + private string _targetObjectName; + + /// The object name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetObjectName { get => this._targetObjectName; set => this._targetObjectName = value; } + + /// Creates an new instance. + public JobEntity() + { + + } + } + /// This class contains the minimal job details required to navigate to the desired drill down. + public partial interface IJobEntity : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The job display name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The job display name.", + SerializedName = @"jobFriendlyName", + PossibleTypes = new [] { typeof(string) })] + string JobFriendlyName { get; set; } + /// The job id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The job id.", + SerializedName = @"jobId", + PossibleTypes = new [] { typeof(string) })] + string JobId { get; set; } + /// The job name. Enum type ScenarioName. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The job name. Enum type ScenarioName.", + SerializedName = @"jobScenarioName", + PossibleTypes = new [] { typeof(string) })] + string JobScenarioName { get; set; } + /// The workflow affected object type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The workflow affected object type.", + SerializedName = @"targetInstanceType", + PossibleTypes = new [] { typeof(string) })] + string TargetInstanceType { get; set; } + /// The object id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The object id.", + SerializedName = @"targetObjectId", + PossibleTypes = new [] { typeof(string) })] + string TargetObjectId { get; set; } + /// The object name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The object name.", + SerializedName = @"targetObjectName", + PossibleTypes = new [] { typeof(string) })] + string TargetObjectName { get; set; } + + } + /// This class contains the minimal job details required to navigate to the desired drill down. + internal partial interface IJobEntityInternal + + { + /// The job display name. + string JobFriendlyName { get; set; } + /// The job id. + string JobId { get; set; } + /// The job name. Enum type ScenarioName. + string JobScenarioName { get; set; } + /// The workflow affected object type. + string TargetInstanceType { get; set; } + /// The object id. + string TargetObjectId { get; set; } + /// The object name. + string TargetObjectName { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobEntity.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobEntity.json.cs new file mode 100644 index 000000000000..3cd10f0c31c8 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobEntity.json.cs @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// + /// This class contains the minimal job details required to navigate to the desired drill down. + /// + public partial class JobEntity + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobEntity. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobEntity. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobEntity FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new JobEntity(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal JobEntity(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_jobId = If( json?.PropertyT("jobId"), out var __jsonJobId) ? (string)__jsonJobId : (string)JobId;} + {_jobFriendlyName = If( json?.PropertyT("jobFriendlyName"), out var __jsonJobFriendlyName) ? (string)__jsonJobFriendlyName : (string)JobFriendlyName;} + {_targetObjectId = If( json?.PropertyT("targetObjectId"), out var __jsonTargetObjectId) ? (string)__jsonTargetObjectId : (string)TargetObjectId;} + {_targetObjectName = If( json?.PropertyT("targetObjectName"), out var __jsonTargetObjectName) ? (string)__jsonTargetObjectName : (string)TargetObjectName;} + {_targetInstanceType = If( json?.PropertyT("targetInstanceType"), out var __jsonTargetInstanceType) ? (string)__jsonTargetInstanceType : (string)TargetInstanceType;} + {_jobScenarioName = If( json?.PropertyT("jobScenarioName"), out var __jsonJobScenarioName) ? (string)__jsonJobScenarioName : (string)JobScenarioName;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._jobId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._jobId.ToString()) : null, "jobId" ,container.Add ); + AddIf( null != (((object)this._jobFriendlyName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._jobFriendlyName.ToString()) : null, "jobFriendlyName" ,container.Add ); + AddIf( null != (((object)this._targetObjectId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetObjectId.ToString()) : null, "targetObjectId" ,container.Add ); + AddIf( null != (((object)this._targetObjectName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetObjectName.ToString()) : null, "targetObjectName" ,container.Add ); + AddIf( null != (((object)this._targetInstanceType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetInstanceType.ToString()) : null, "targetInstanceType" ,container.Add ); + AddIf( null != (((object)this._jobScenarioName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._jobScenarioName.ToString()) : null, "jobScenarioName" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobErrorDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobErrorDetails.PowerShell.cs new file mode 100644 index 000000000000..ef3ed9e82f1f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobErrorDetails.PowerShell.cs @@ -0,0 +1,256 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// This class contains the error details per object. + [System.ComponentModel.TypeConverter(typeof(JobErrorDetailsTypeConverter))] + public partial class JobErrorDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobErrorDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new JobErrorDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobErrorDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new JobErrorDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobErrorDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal JobErrorDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ServiceErrorDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobErrorDetailsInternal)this).ServiceErrorDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IServiceError) content.GetValueForProperty("ServiceErrorDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobErrorDetailsInternal)this).ServiceErrorDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ServiceErrorTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderErrorDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobErrorDetailsInternal)this).ProviderErrorDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProviderError) content.GetValueForProperty("ProviderErrorDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobErrorDetailsInternal)this).ProviderErrorDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProviderErrorTypeConverter.ConvertFrom); + } + if (content.Contains("ErrorLevel")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobErrorDetailsInternal)this).ErrorLevel = (string) content.GetValueForProperty("ErrorLevel",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobErrorDetailsInternal)this).ErrorLevel, global::System.Convert.ToString); + } + if (content.Contains("CreationTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobErrorDetailsInternal)this).CreationTime = (global::System.DateTime?) content.GetValueForProperty("CreationTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobErrorDetailsInternal)this).CreationTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("TaskId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobErrorDetailsInternal)this).TaskId = (string) content.GetValueForProperty("TaskId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobErrorDetailsInternal)this).TaskId, global::System.Convert.ToString); + } + if (content.Contains("ServiceErrorDetailCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobErrorDetailsInternal)this).ServiceErrorDetailCode = (string) content.GetValueForProperty("ServiceErrorDetailCode",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobErrorDetailsInternal)this).ServiceErrorDetailCode, global::System.Convert.ToString); + } + if (content.Contains("ServiceErrorDetailMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobErrorDetailsInternal)this).ServiceErrorDetailMessage = (string) content.GetValueForProperty("ServiceErrorDetailMessage",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobErrorDetailsInternal)this).ServiceErrorDetailMessage, global::System.Convert.ToString); + } + if (content.Contains("ServiceErrorDetailPossibleCaus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobErrorDetailsInternal)this).ServiceErrorDetailPossibleCaus = (string) content.GetValueForProperty("ServiceErrorDetailPossibleCaus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobErrorDetailsInternal)this).ServiceErrorDetailPossibleCaus, global::System.Convert.ToString); + } + if (content.Contains("ServiceErrorDetailRecommendedAction")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobErrorDetailsInternal)this).ServiceErrorDetailRecommendedAction = (string) content.GetValueForProperty("ServiceErrorDetailRecommendedAction",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobErrorDetailsInternal)this).ServiceErrorDetailRecommendedAction, global::System.Convert.ToString); + } + if (content.Contains("ServiceErrorDetailActivityId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobErrorDetailsInternal)this).ServiceErrorDetailActivityId = (string) content.GetValueForProperty("ServiceErrorDetailActivityId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobErrorDetailsInternal)this).ServiceErrorDetailActivityId, global::System.Convert.ToString); + } + if (content.Contains("ProviderErrorDetailErrorCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobErrorDetailsInternal)this).ProviderErrorDetailErrorCode = (int?) content.GetValueForProperty("ProviderErrorDetailErrorCode",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobErrorDetailsInternal)this).ProviderErrorDetailErrorCode, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("ProviderErrorDetailErrorMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobErrorDetailsInternal)this).ProviderErrorDetailErrorMessage = (string) content.GetValueForProperty("ProviderErrorDetailErrorMessage",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobErrorDetailsInternal)this).ProviderErrorDetailErrorMessage, global::System.Convert.ToString); + } + if (content.Contains("ProviderErrorDetailErrorId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobErrorDetailsInternal)this).ProviderErrorDetailErrorId = (string) content.GetValueForProperty("ProviderErrorDetailErrorId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobErrorDetailsInternal)this).ProviderErrorDetailErrorId, global::System.Convert.ToString); + } + if (content.Contains("ProviderErrorDetailPossibleCaus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobErrorDetailsInternal)this).ProviderErrorDetailPossibleCaus = (string) content.GetValueForProperty("ProviderErrorDetailPossibleCaus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobErrorDetailsInternal)this).ProviderErrorDetailPossibleCaus, global::System.Convert.ToString); + } + if (content.Contains("ProviderErrorDetailRecommendedAction")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobErrorDetailsInternal)this).ProviderErrorDetailRecommendedAction = (string) content.GetValueForProperty("ProviderErrorDetailRecommendedAction",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobErrorDetailsInternal)this).ProviderErrorDetailRecommendedAction, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal JobErrorDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ServiceErrorDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobErrorDetailsInternal)this).ServiceErrorDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IServiceError) content.GetValueForProperty("ServiceErrorDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobErrorDetailsInternal)this).ServiceErrorDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ServiceErrorTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderErrorDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobErrorDetailsInternal)this).ProviderErrorDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProviderError) content.GetValueForProperty("ProviderErrorDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobErrorDetailsInternal)this).ProviderErrorDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProviderErrorTypeConverter.ConvertFrom); + } + if (content.Contains("ErrorLevel")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobErrorDetailsInternal)this).ErrorLevel = (string) content.GetValueForProperty("ErrorLevel",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobErrorDetailsInternal)this).ErrorLevel, global::System.Convert.ToString); + } + if (content.Contains("CreationTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobErrorDetailsInternal)this).CreationTime = (global::System.DateTime?) content.GetValueForProperty("CreationTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobErrorDetailsInternal)this).CreationTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("TaskId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobErrorDetailsInternal)this).TaskId = (string) content.GetValueForProperty("TaskId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobErrorDetailsInternal)this).TaskId, global::System.Convert.ToString); + } + if (content.Contains("ServiceErrorDetailCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobErrorDetailsInternal)this).ServiceErrorDetailCode = (string) content.GetValueForProperty("ServiceErrorDetailCode",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobErrorDetailsInternal)this).ServiceErrorDetailCode, global::System.Convert.ToString); + } + if (content.Contains("ServiceErrorDetailMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobErrorDetailsInternal)this).ServiceErrorDetailMessage = (string) content.GetValueForProperty("ServiceErrorDetailMessage",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobErrorDetailsInternal)this).ServiceErrorDetailMessage, global::System.Convert.ToString); + } + if (content.Contains("ServiceErrorDetailPossibleCaus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobErrorDetailsInternal)this).ServiceErrorDetailPossibleCaus = (string) content.GetValueForProperty("ServiceErrorDetailPossibleCaus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobErrorDetailsInternal)this).ServiceErrorDetailPossibleCaus, global::System.Convert.ToString); + } + if (content.Contains("ServiceErrorDetailRecommendedAction")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobErrorDetailsInternal)this).ServiceErrorDetailRecommendedAction = (string) content.GetValueForProperty("ServiceErrorDetailRecommendedAction",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobErrorDetailsInternal)this).ServiceErrorDetailRecommendedAction, global::System.Convert.ToString); + } + if (content.Contains("ServiceErrorDetailActivityId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobErrorDetailsInternal)this).ServiceErrorDetailActivityId = (string) content.GetValueForProperty("ServiceErrorDetailActivityId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobErrorDetailsInternal)this).ServiceErrorDetailActivityId, global::System.Convert.ToString); + } + if (content.Contains("ProviderErrorDetailErrorCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobErrorDetailsInternal)this).ProviderErrorDetailErrorCode = (int?) content.GetValueForProperty("ProviderErrorDetailErrorCode",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobErrorDetailsInternal)this).ProviderErrorDetailErrorCode, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("ProviderErrorDetailErrorMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobErrorDetailsInternal)this).ProviderErrorDetailErrorMessage = (string) content.GetValueForProperty("ProviderErrorDetailErrorMessage",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobErrorDetailsInternal)this).ProviderErrorDetailErrorMessage, global::System.Convert.ToString); + } + if (content.Contains("ProviderErrorDetailErrorId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobErrorDetailsInternal)this).ProviderErrorDetailErrorId = (string) content.GetValueForProperty("ProviderErrorDetailErrorId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobErrorDetailsInternal)this).ProviderErrorDetailErrorId, global::System.Convert.ToString); + } + if (content.Contains("ProviderErrorDetailPossibleCaus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobErrorDetailsInternal)this).ProviderErrorDetailPossibleCaus = (string) content.GetValueForProperty("ProviderErrorDetailPossibleCaus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobErrorDetailsInternal)this).ProviderErrorDetailPossibleCaus, global::System.Convert.ToString); + } + if (content.Contains("ProviderErrorDetailRecommendedAction")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobErrorDetailsInternal)this).ProviderErrorDetailRecommendedAction = (string) content.GetValueForProperty("ProviderErrorDetailRecommendedAction",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobErrorDetailsInternal)this).ProviderErrorDetailRecommendedAction, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// This class contains the error details per object. + [System.ComponentModel.TypeConverter(typeof(JobErrorDetailsTypeConverter))] + public partial interface IJobErrorDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobErrorDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobErrorDetails.TypeConverter.cs new file mode 100644 index 000000000000..eaf27a99c51f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobErrorDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class JobErrorDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobErrorDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobErrorDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return JobErrorDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return JobErrorDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return JobErrorDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobErrorDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobErrorDetails.cs new file mode 100644 index 000000000000..3c9f81da8d33 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobErrorDetails.cs @@ -0,0 +1,249 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// This class contains the error details per object. + public partial class JobErrorDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobErrorDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobErrorDetailsInternal + { + + /// Backing field for property. + private global::System.DateTime? _creationTime; + + /// The creation time of job error. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public global::System.DateTime? CreationTime { get => this._creationTime; set => this._creationTime = value; } + + /// Backing field for property. + private string _errorLevel; + + /// Error level of error. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ErrorLevel { get => this._errorLevel; set => this._errorLevel = value; } + + /// Internal Acessors for ProviderErrorDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProviderError Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobErrorDetailsInternal.ProviderErrorDetail { get => (this._providerErrorDetail = this._providerErrorDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProviderError()); set { {_providerErrorDetail = value;} } } + + /// Internal Acessors for ServiceErrorDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IServiceError Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobErrorDetailsInternal.ServiceErrorDetail { get => (this._serviceErrorDetail = this._serviceErrorDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ServiceError()); set { {_serviceErrorDetail = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProviderError _providerErrorDetail; + + /// The Provider error details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProviderError ProviderErrorDetail { get => (this._providerErrorDetail = this._providerErrorDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProviderError()); set => this._providerErrorDetail = value; } + + /// The Error code. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public int? ProviderErrorDetailErrorCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProviderErrorInternal)ProviderErrorDetail).ErrorCode; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProviderErrorInternal)ProviderErrorDetail).ErrorCode = value ?? default(int); } + + /// The Provider error Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ProviderErrorDetailErrorId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProviderErrorInternal)ProviderErrorDetail).ErrorId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProviderErrorInternal)ProviderErrorDetail).ErrorId = value ?? null; } + + /// The Error message. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ProviderErrorDetailErrorMessage { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProviderErrorInternal)ProviderErrorDetail).ErrorMessage; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProviderErrorInternal)ProviderErrorDetail).ErrorMessage = value ?? null; } + + /// The possible causes for the error. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ProviderErrorDetailPossibleCaus { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProviderErrorInternal)ProviderErrorDetail).PossibleCaus; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProviderErrorInternal)ProviderErrorDetail).PossibleCaus = value ?? null; } + + /// The recommended action to resolve the error. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ProviderErrorDetailRecommendedAction { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProviderErrorInternal)ProviderErrorDetail).RecommendedAction; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProviderErrorInternal)ProviderErrorDetail).RecommendedAction = value ?? null; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IServiceError _serviceErrorDetail; + + /// The Service error details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IServiceError ServiceErrorDetail { get => (this._serviceErrorDetail = this._serviceErrorDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ServiceError()); set => this._serviceErrorDetail = value; } + + /// Activity Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ServiceErrorDetailActivityId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IServiceErrorInternal)ServiceErrorDetail).ActivityId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IServiceErrorInternal)ServiceErrorDetail).ActivityId = value ?? null; } + + /// Error code. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ServiceErrorDetailCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IServiceErrorInternal)ServiceErrorDetail).Code; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IServiceErrorInternal)ServiceErrorDetail).Code = value ?? null; } + + /// Error message. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ServiceErrorDetailMessage { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IServiceErrorInternal)ServiceErrorDetail).Message; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IServiceErrorInternal)ServiceErrorDetail).Message = value ?? null; } + + /// Possible causes of error. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ServiceErrorDetailPossibleCaus { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IServiceErrorInternal)ServiceErrorDetail).PossibleCaus; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IServiceErrorInternal)ServiceErrorDetail).PossibleCaus = value ?? null; } + + /// Recommended action to resolve error. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ServiceErrorDetailRecommendedAction { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IServiceErrorInternal)ServiceErrorDetail).RecommendedAction; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IServiceErrorInternal)ServiceErrorDetail).RecommendedAction = value ?? null; } + + /// Backing field for property. + private string _taskId; + + /// The Id of the task. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TaskId { get => this._taskId; set => this._taskId = value; } + + /// Creates an new instance. + public JobErrorDetails() + { + + } + } + /// This class contains the error details per object. + public partial interface IJobErrorDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The creation time of job error. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The creation time of job error.", + SerializedName = @"creationTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? CreationTime { get; set; } + /// Error level of error. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Error level of error.", + SerializedName = @"errorLevel", + PossibleTypes = new [] { typeof(string) })] + string ErrorLevel { get; set; } + /// The Error code. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Error code.", + SerializedName = @"errorCode", + PossibleTypes = new [] { typeof(int) })] + int? ProviderErrorDetailErrorCode { get; set; } + /// The Provider error Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Provider error Id.", + SerializedName = @"errorId", + PossibleTypes = new [] { typeof(string) })] + string ProviderErrorDetailErrorId { get; set; } + /// The Error message. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Error message.", + SerializedName = @"errorMessage", + PossibleTypes = new [] { typeof(string) })] + string ProviderErrorDetailErrorMessage { get; set; } + /// The possible causes for the error. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The possible causes for the error.", + SerializedName = @"possibleCauses", + PossibleTypes = new [] { typeof(string) })] + string ProviderErrorDetailPossibleCaus { get; set; } + /// The recommended action to resolve the error. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recommended action to resolve the error.", + SerializedName = @"recommendedAction", + PossibleTypes = new [] { typeof(string) })] + string ProviderErrorDetailRecommendedAction { get; set; } + /// Activity Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Activity Id.", + SerializedName = @"activityId", + PossibleTypes = new [] { typeof(string) })] + string ServiceErrorDetailActivityId { get; set; } + /// Error code. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Error code.", + SerializedName = @"code", + PossibleTypes = new [] { typeof(string) })] + string ServiceErrorDetailCode { get; set; } + /// Error message. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Error message.", + SerializedName = @"message", + PossibleTypes = new [] { typeof(string) })] + string ServiceErrorDetailMessage { get; set; } + /// Possible causes of error. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Possible causes of error.", + SerializedName = @"possibleCauses", + PossibleTypes = new [] { typeof(string) })] + string ServiceErrorDetailPossibleCaus { get; set; } + /// Recommended action to resolve error. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Recommended action to resolve error.", + SerializedName = @"recommendedAction", + PossibleTypes = new [] { typeof(string) })] + string ServiceErrorDetailRecommendedAction { get; set; } + /// The Id of the task. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Id of the task.", + SerializedName = @"taskId", + PossibleTypes = new [] { typeof(string) })] + string TaskId { get; set; } + + } + /// This class contains the error details per object. + internal partial interface IJobErrorDetailsInternal + + { + /// The creation time of job error. + global::System.DateTime? CreationTime { get; set; } + /// Error level of error. + string ErrorLevel { get; set; } + /// The Provider error details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProviderError ProviderErrorDetail { get; set; } + /// The Error code. + int? ProviderErrorDetailErrorCode { get; set; } + /// The Provider error Id. + string ProviderErrorDetailErrorId { get; set; } + /// The Error message. + string ProviderErrorDetailErrorMessage { get; set; } + /// The possible causes for the error. + string ProviderErrorDetailPossibleCaus { get; set; } + /// The recommended action to resolve the error. + string ProviderErrorDetailRecommendedAction { get; set; } + /// The Service error details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IServiceError ServiceErrorDetail { get; set; } + /// Activity Id. + string ServiceErrorDetailActivityId { get; set; } + /// Error code. + string ServiceErrorDetailCode { get; set; } + /// Error message. + string ServiceErrorDetailMessage { get; set; } + /// Possible causes of error. + string ServiceErrorDetailPossibleCaus { get; set; } + /// Recommended action to resolve error. + string ServiceErrorDetailRecommendedAction { get; set; } + /// The Id of the task. + string TaskId { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobErrorDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobErrorDetails.json.cs new file mode 100644 index 000000000000..6920c9e4c5a8 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobErrorDetails.json.cs @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// This class contains the error details per object. + public partial class JobErrorDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobErrorDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobErrorDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobErrorDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new JobErrorDetails(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal JobErrorDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_serviceErrorDetail = If( json?.PropertyT("serviceErrorDetails"), out var __jsonServiceErrorDetails) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ServiceError.FromJson(__jsonServiceErrorDetails) : ServiceErrorDetail;} + {_providerErrorDetail = If( json?.PropertyT("providerErrorDetails"), out var __jsonProviderErrorDetails) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProviderError.FromJson(__jsonProviderErrorDetails) : ProviderErrorDetail;} + {_errorLevel = If( json?.PropertyT("errorLevel"), out var __jsonErrorLevel) ? (string)__jsonErrorLevel : (string)ErrorLevel;} + {_creationTime = If( json?.PropertyT("creationTime"), out var __jsonCreationTime) ? global::System.DateTime.TryParse((string)__jsonCreationTime, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonCreationTimeValue) ? __jsonCreationTimeValue : CreationTime : CreationTime;} + {_taskId = If( json?.PropertyT("taskId"), out var __jsonTaskId) ? (string)__jsonTaskId : (string)TaskId;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._serviceErrorDetail ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._serviceErrorDetail.ToJson(null,serializationMode) : null, "serviceErrorDetails" ,container.Add ); + AddIf( null != this._providerErrorDetail ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._providerErrorDetail.ToJson(null,serializationMode) : null, "providerErrorDetails" ,container.Add ); + AddIf( null != (((object)this._errorLevel)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._errorLevel.ToString()) : null, "errorLevel" ,container.Add ); + AddIf( null != this._creationTime ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._creationTime?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "creationTime" ,container.Add ); + AddIf( null != (((object)this._taskId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._taskId.ToString()) : null, "taskId" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobProperties.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobProperties.PowerShell.cs new file mode 100644 index 000000000000..47250c174d88 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobProperties.PowerShell.cs @@ -0,0 +1,264 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Job custom data details. + [System.ComponentModel.TypeConverter(typeof(JobPropertiesTypeConverter))] + public partial class JobProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new JobProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new JobProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal JobProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CustomDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobPropertiesInternal)this).CustomDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetails) content.GetValueForProperty("CustomDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobPropertiesInternal)this).CustomDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.JobDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("ActivityId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobPropertiesInternal)this).ActivityId = (string) content.GetValueForProperty("ActivityId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobPropertiesInternal)this).ActivityId, global::System.Convert.ToString); + } + if (content.Contains("ScenarioName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobPropertiesInternal)this).ScenarioName = (string) content.GetValueForProperty("ScenarioName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobPropertiesInternal)this).ScenarioName, global::System.Convert.ToString); + } + if (content.Contains("FriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobPropertiesInternal)this).FriendlyName = (string) content.GetValueForProperty("FriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobPropertiesInternal)this).FriendlyName, global::System.Convert.ToString); + } + if (content.Contains("State")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobPropertiesInternal)this).State = (string) content.GetValueForProperty("State",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobPropertiesInternal)this).State, global::System.Convert.ToString); + } + if (content.Contains("StateDescription")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobPropertiesInternal)this).StateDescription = (string) content.GetValueForProperty("StateDescription",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobPropertiesInternal)this).StateDescription, global::System.Convert.ToString); + } + if (content.Contains("Task")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobPropertiesInternal)this).Task = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTask[]) content.GetValueForProperty("Task",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobPropertiesInternal)this).Task, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AsrTaskTypeConverter.ConvertFrom)); + } + if (content.Contains("Error")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobPropertiesInternal)this).Error = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobErrorDetails[]) content.GetValueForProperty("Error",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobPropertiesInternal)this).Error, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.JobErrorDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("StartTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobPropertiesInternal)this).StartTime = (global::System.DateTime?) content.GetValueForProperty("StartTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobPropertiesInternal)this).StartTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("EndTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobPropertiesInternal)this).EndTime = (global::System.DateTime?) content.GetValueForProperty("EndTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobPropertiesInternal)this).EndTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("AllowedAction")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobPropertiesInternal)this).AllowedAction = (string[]) content.GetValueForProperty("AllowedAction",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobPropertiesInternal)this).AllowedAction, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("TargetObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobPropertiesInternal)this).TargetObjectId = (string) content.GetValueForProperty("TargetObjectId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobPropertiesInternal)this).TargetObjectId, global::System.Convert.ToString); + } + if (content.Contains("TargetObjectName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobPropertiesInternal)this).TargetObjectName = (string) content.GetValueForProperty("TargetObjectName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobPropertiesInternal)this).TargetObjectName, global::System.Convert.ToString); + } + if (content.Contains("TargetInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobPropertiesInternal)this).TargetInstanceType = (string) content.GetValueForProperty("TargetInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobPropertiesInternal)this).TargetInstanceType, global::System.Convert.ToString); + } + if (content.Contains("CustomDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobPropertiesInternal)this).CustomDetailInstanceType = (string) content.GetValueForProperty("CustomDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobPropertiesInternal)this).CustomDetailInstanceType, global::System.Convert.ToString); + } + if (content.Contains("CustomDetailAffectedObjectDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobPropertiesInternal)this).CustomDetailAffectedObjectDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsAffectedObjectDetails) content.GetValueForProperty("CustomDetailAffectedObjectDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobPropertiesInternal)this).CustomDetailAffectedObjectDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.JobDetailsAffectedObjectDetailsTypeConverter.ConvertFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal JobProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CustomDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobPropertiesInternal)this).CustomDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetails) content.GetValueForProperty("CustomDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobPropertiesInternal)this).CustomDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.JobDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("ActivityId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobPropertiesInternal)this).ActivityId = (string) content.GetValueForProperty("ActivityId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobPropertiesInternal)this).ActivityId, global::System.Convert.ToString); + } + if (content.Contains("ScenarioName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobPropertiesInternal)this).ScenarioName = (string) content.GetValueForProperty("ScenarioName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobPropertiesInternal)this).ScenarioName, global::System.Convert.ToString); + } + if (content.Contains("FriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobPropertiesInternal)this).FriendlyName = (string) content.GetValueForProperty("FriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobPropertiesInternal)this).FriendlyName, global::System.Convert.ToString); + } + if (content.Contains("State")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobPropertiesInternal)this).State = (string) content.GetValueForProperty("State",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobPropertiesInternal)this).State, global::System.Convert.ToString); + } + if (content.Contains("StateDescription")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobPropertiesInternal)this).StateDescription = (string) content.GetValueForProperty("StateDescription",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobPropertiesInternal)this).StateDescription, global::System.Convert.ToString); + } + if (content.Contains("Task")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobPropertiesInternal)this).Task = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTask[]) content.GetValueForProperty("Task",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobPropertiesInternal)this).Task, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AsrTaskTypeConverter.ConvertFrom)); + } + if (content.Contains("Error")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobPropertiesInternal)this).Error = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobErrorDetails[]) content.GetValueForProperty("Error",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobPropertiesInternal)this).Error, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.JobErrorDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("StartTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobPropertiesInternal)this).StartTime = (global::System.DateTime?) content.GetValueForProperty("StartTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobPropertiesInternal)this).StartTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("EndTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobPropertiesInternal)this).EndTime = (global::System.DateTime?) content.GetValueForProperty("EndTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobPropertiesInternal)this).EndTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("AllowedAction")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobPropertiesInternal)this).AllowedAction = (string[]) content.GetValueForProperty("AllowedAction",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobPropertiesInternal)this).AllowedAction, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("TargetObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobPropertiesInternal)this).TargetObjectId = (string) content.GetValueForProperty("TargetObjectId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobPropertiesInternal)this).TargetObjectId, global::System.Convert.ToString); + } + if (content.Contains("TargetObjectName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobPropertiesInternal)this).TargetObjectName = (string) content.GetValueForProperty("TargetObjectName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobPropertiesInternal)this).TargetObjectName, global::System.Convert.ToString); + } + if (content.Contains("TargetInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobPropertiesInternal)this).TargetInstanceType = (string) content.GetValueForProperty("TargetInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobPropertiesInternal)this).TargetInstanceType, global::System.Convert.ToString); + } + if (content.Contains("CustomDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobPropertiesInternal)this).CustomDetailInstanceType = (string) content.GetValueForProperty("CustomDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobPropertiesInternal)this).CustomDetailInstanceType, global::System.Convert.ToString); + } + if (content.Contains("CustomDetailAffectedObjectDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobPropertiesInternal)this).CustomDetailAffectedObjectDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsAffectedObjectDetails) content.GetValueForProperty("CustomDetailAffectedObjectDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobPropertiesInternal)this).CustomDetailAffectedObjectDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.JobDetailsAffectedObjectDetailsTypeConverter.ConvertFrom); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Job custom data details. + [System.ComponentModel.TypeConverter(typeof(JobPropertiesTypeConverter))] + public partial interface IJobProperties + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobProperties.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobProperties.TypeConverter.cs new file mode 100644 index 000000000000..4b600b451e03 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobProperties.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class JobPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return JobProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return JobProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return JobProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobProperties.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobProperties.cs new file mode 100644 index 000000000000..be104280cf2c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobProperties.cs @@ -0,0 +1,328 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Job custom data details. + public partial class JobProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobProperties, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobPropertiesInternal + { + + /// Backing field for property. + private string _activityId; + + /// The activity id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ActivityId { get => this._activityId; set => this._activityId = value; } + + /// Backing field for property. + private string[] _allowedAction; + + /// The Allowed action the job. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string[] AllowedAction { get => this._allowedAction; set => this._allowedAction = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetails _customDetail; + + /// The custom job details like test failover job details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetails CustomDetail { get => (this._customDetail = this._customDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.JobDetails()); set => this._customDetail = value; } + + /// + /// The affected object properties like source server, source cloud, target server, target cloud etc. based on the workflow + /// object details. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsAffectedObjectDetails CustomDetailAffectedObjectDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsInternal)CustomDetail).AffectedObjectDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsInternal)CustomDetail).AffectedObjectDetail = value ?? null /* model class */; } + + /// Gets the type of job details (see JobDetailsTypes enum for possible values). + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string CustomDetailInstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsInternal)CustomDetail).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsInternal)CustomDetail).InstanceType = value ?? null; } + + /// Backing field for property. + private global::System.DateTime? _endTime; + + /// The end time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public global::System.DateTime? EndTime { get => this._endTime; set => this._endTime = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobErrorDetails[] _error; + + /// The errors. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobErrorDetails[] Error { get => this._error; set => this._error = value; } + + /// Backing field for property. + private string _friendlyName; + + /// The DisplayName. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string FriendlyName { get => this._friendlyName; set => this._friendlyName = value; } + + /// Internal Acessors for CustomDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetails Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobPropertiesInternal.CustomDetail { get => (this._customDetail = this._customDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.JobDetails()); set { {_customDetail = value;} } } + + /// Backing field for property. + private string _scenarioName; + + /// The ScenarioName. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ScenarioName { get => this._scenarioName; set => this._scenarioName = value; } + + /// Backing field for property. + private global::System.DateTime? _startTime; + + /// The start time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public global::System.DateTime? StartTime { get => this._startTime; set => this._startTime = value; } + + /// Backing field for property. + private string _state; + + /// + /// The status of the Job. It is one of these values - NotStarted, InProgress, Succeeded, Failed, Cancelled, Suspended or + /// Other. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string State { get => this._state; set => this._state = value; } + + /// Backing field for property. + private string _stateDescription; + + /// + /// The description of the state of the Job. For e.g. - For Succeeded state, description can be Completed, PartiallySucceeded, + /// CompletedWithInformation or Skipped. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string StateDescription { get => this._stateDescription; set => this._stateDescription = value; } + + /// Backing field for property. + private string _targetInstanceType; + + /// + /// The type of the affected object which is of Microsoft.Azure.SiteRecovery.V2015_11_10.AffectedObjectType class. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetInstanceType { get => this._targetInstanceType; set => this._targetInstanceType = value; } + + /// Backing field for property. + private string _targetObjectId; + + /// The affected Object Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetObjectId { get => this._targetObjectId; set => this._targetObjectId = value; } + + /// Backing field for property. + private string _targetObjectName; + + /// The name of the affected object. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetObjectName { get => this._targetObjectName; set => this._targetObjectName = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTask[] _task; + + /// The tasks. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTask[] Task { get => this._task; set => this._task = value; } + + /// Creates an new instance. + public JobProperties() + { + + } + } + /// Job custom data details. + public partial interface IJobProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The activity id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The activity id.", + SerializedName = @"activityId", + PossibleTypes = new [] { typeof(string) })] + string ActivityId { get; set; } + /// The Allowed action the job. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Allowed action the job.", + SerializedName = @"allowedActions", + PossibleTypes = new [] { typeof(string) })] + string[] AllowedAction { get; set; } + /// + /// The affected object properties like source server, source cloud, target server, target cloud etc. based on the workflow + /// object details. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The affected object properties like source server, source cloud, target server, target cloud etc. based on the workflow object details.", + SerializedName = @"affectedObjectDetails", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsAffectedObjectDetails) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsAffectedObjectDetails CustomDetailAffectedObjectDetail { get; set; } + /// Gets the type of job details (see JobDetailsTypes enum for possible values). + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets the type of job details (see JobDetailsTypes enum for possible values).", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string CustomDetailInstanceType { get; set; } + /// The end time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The end time.", + SerializedName = @"endTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? EndTime { get; set; } + /// The errors. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The errors.", + SerializedName = @"errors", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobErrorDetails) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobErrorDetails[] Error { get; set; } + /// The DisplayName. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The DisplayName.", + SerializedName = @"friendlyName", + PossibleTypes = new [] { typeof(string) })] + string FriendlyName { get; set; } + /// The ScenarioName. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The ScenarioName.", + SerializedName = @"scenarioName", + PossibleTypes = new [] { typeof(string) })] + string ScenarioName { get; set; } + /// The start time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The start time.", + SerializedName = @"startTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? StartTime { get; set; } + /// + /// The status of the Job. It is one of these values - NotStarted, InProgress, Succeeded, Failed, Cancelled, Suspended or + /// Other. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The status of the Job. It is one of these values - NotStarted, InProgress, Succeeded, Failed, Cancelled, Suspended or Other.", + SerializedName = @"state", + PossibleTypes = new [] { typeof(string) })] + string State { get; set; } + /// + /// The description of the state of the Job. For e.g. - For Succeeded state, description can be Completed, PartiallySucceeded, + /// CompletedWithInformation or Skipped. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The description of the state of the Job. For e.g. - For Succeeded state, description can be Completed, PartiallySucceeded, CompletedWithInformation or Skipped.", + SerializedName = @"stateDescription", + PossibleTypes = new [] { typeof(string) })] + string StateDescription { get; set; } + /// + /// The type of the affected object which is of Microsoft.Azure.SiteRecovery.V2015_11_10.AffectedObjectType class. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The type of the affected object which is of Microsoft.Azure.SiteRecovery.V2015_11_10.AffectedObjectType class.", + SerializedName = @"targetInstanceType", + PossibleTypes = new [] { typeof(string) })] + string TargetInstanceType { get; set; } + /// The affected Object Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The affected Object Id.", + SerializedName = @"targetObjectId", + PossibleTypes = new [] { typeof(string) })] + string TargetObjectId { get; set; } + /// The name of the affected object. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the affected object.", + SerializedName = @"targetObjectName", + PossibleTypes = new [] { typeof(string) })] + string TargetObjectName { get; set; } + /// The tasks. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The tasks.", + SerializedName = @"tasks", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTask) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTask[] Task { get; set; } + + } + /// Job custom data details. + internal partial interface IJobPropertiesInternal + + { + /// The activity id. + string ActivityId { get; set; } + /// The Allowed action the job. + string[] AllowedAction { get; set; } + /// The custom job details like test failover job details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetails CustomDetail { get; set; } + /// + /// The affected object properties like source server, source cloud, target server, target cloud etc. based on the workflow + /// object details. + /// + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsAffectedObjectDetails CustomDetailAffectedObjectDetail { get; set; } + /// Gets the type of job details (see JobDetailsTypes enum for possible values). + string CustomDetailInstanceType { get; set; } + /// The end time. + global::System.DateTime? EndTime { get; set; } + /// The errors. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobErrorDetails[] Error { get; set; } + /// The DisplayName. + string FriendlyName { get; set; } + /// The ScenarioName. + string ScenarioName { get; set; } + /// The start time. + global::System.DateTime? StartTime { get; set; } + /// + /// The status of the Job. It is one of these values - NotStarted, InProgress, Succeeded, Failed, Cancelled, Suspended or + /// Other. + /// + string State { get; set; } + /// + /// The description of the state of the Job. For e.g. - For Succeeded state, description can be Completed, PartiallySucceeded, + /// CompletedWithInformation or Skipped. + /// + string StateDescription { get; set; } + /// + /// The type of the affected object which is of Microsoft.Azure.SiteRecovery.V2015_11_10.AffectedObjectType class. + /// + string TargetInstanceType { get; set; } + /// The affected Object Id. + string TargetObjectId { get; set; } + /// The name of the affected object. + string TargetObjectName { get; set; } + /// The tasks. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTask[] Task { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobProperties.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobProperties.json.cs new file mode 100644 index 000000000000..1499b2dd2307 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobProperties.json.cs @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Job custom data details. + public partial class JobProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new JobProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal JobProperties(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_customDetail = If( json?.PropertyT("customDetails"), out var __jsonCustomDetails) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.JobDetails.FromJson(__jsonCustomDetails) : CustomDetail;} + {_activityId = If( json?.PropertyT("activityId"), out var __jsonActivityId) ? (string)__jsonActivityId : (string)ActivityId;} + {_scenarioName = If( json?.PropertyT("scenarioName"), out var __jsonScenarioName) ? (string)__jsonScenarioName : (string)ScenarioName;} + {_friendlyName = If( json?.PropertyT("friendlyName"), out var __jsonFriendlyName) ? (string)__jsonFriendlyName : (string)FriendlyName;} + {_state = If( json?.PropertyT("state"), out var __jsonState) ? (string)__jsonState : (string)State;} + {_stateDescription = If( json?.PropertyT("stateDescription"), out var __jsonStateDescription) ? (string)__jsonStateDescription : (string)StateDescription;} + {_task = If( json?.PropertyT("tasks"), out var __jsonTasks) ? If( __jsonTasks as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTask) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AsrTask.FromJson(__u) )) ))() : null : Task;} + {_error = If( json?.PropertyT("errors"), out var __jsonErrors) ? If( __jsonErrors as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __q) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__q, (__p)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobErrorDetails) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.JobErrorDetails.FromJson(__p) )) ))() : null : Error;} + {_startTime = If( json?.PropertyT("startTime"), out var __jsonStartTime) ? global::System.DateTime.TryParse((string)__jsonStartTime, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonStartTimeValue) ? __jsonStartTimeValue : StartTime : StartTime;} + {_endTime = If( json?.PropertyT("endTime"), out var __jsonEndTime) ? global::System.DateTime.TryParse((string)__jsonEndTime, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonEndTimeValue) ? __jsonEndTimeValue : EndTime : EndTime;} + {_allowedAction = If( json?.PropertyT("allowedActions"), out var __jsonAllowedActions) ? If( __jsonAllowedActions as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __l) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__l, (__k)=>(string) (__k is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString __j ? (string)(__j.ToString()) : null)) ))() : null : AllowedAction;} + {_targetObjectId = If( json?.PropertyT("targetObjectId"), out var __jsonTargetObjectId) ? (string)__jsonTargetObjectId : (string)TargetObjectId;} + {_targetObjectName = If( json?.PropertyT("targetObjectName"), out var __jsonTargetObjectName) ? (string)__jsonTargetObjectName : (string)TargetObjectName;} + {_targetInstanceType = If( json?.PropertyT("targetInstanceType"), out var __jsonTargetInstanceType) ? (string)__jsonTargetInstanceType : (string)TargetInstanceType;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._customDetail ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._customDetail.ToJson(null,serializationMode) : null, "customDetails" ,container.Add ); + AddIf( null != (((object)this._activityId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._activityId.ToString()) : null, "activityId" ,container.Add ); + AddIf( null != (((object)this._scenarioName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._scenarioName.ToString()) : null, "scenarioName" ,container.Add ); + AddIf( null != (((object)this._friendlyName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._friendlyName.ToString()) : null, "friendlyName" ,container.Add ); + AddIf( null != (((object)this._state)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._state.ToString()) : null, "state" ,container.Add ); + AddIf( null != (((object)this._stateDescription)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._stateDescription.ToString()) : null, "stateDescription" ,container.Add ); + if (null != this._task) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._task ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("tasks",__w); + } + if (null != this._error) + { + var __r = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __s in this._error ) + { + AddIf(__s?.ToJson(null, serializationMode) ,__r.Add); + } + container.Add("errors",__r); + } + AddIf( null != this._startTime ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._startTime?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "startTime" ,container.Add ); + AddIf( null != this._endTime ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._endTime?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "endTime" ,container.Add ); + if (null != this._allowedAction) + { + var __m = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __n in this._allowedAction ) + { + AddIf(null != (((object)__n)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(__n.ToString()) : null ,__m.Add); + } + container.Add("allowedActions",__m); + } + AddIf( null != (((object)this._targetObjectId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetObjectId.ToString()) : null, "targetObjectId" ,container.Add ); + AddIf( null != (((object)this._targetObjectName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetObjectName.ToString()) : null, "targetObjectName" ,container.Add ); + AddIf( null != (((object)this._targetInstanceType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetInstanceType.ToString()) : null, "targetInstanceType" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobQueryParameter.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobQueryParameter.PowerShell.cs new file mode 100644 index 000000000000..0484181c2948 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobQueryParameter.PowerShell.cs @@ -0,0 +1,200 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Query parameter to enumerate jobs. + [System.ComponentModel.TypeConverter(typeof(JobQueryParameterTypeConverter))] + public partial class JobQueryParameter + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobQueryParameter DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new JobQueryParameter(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobQueryParameter DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new JobQueryParameter(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobQueryParameter FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal JobQueryParameter(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("StartTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobQueryParameterInternal)this).StartTime = (string) content.GetValueForProperty("StartTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobQueryParameterInternal)this).StartTime, global::System.Convert.ToString); + } + if (content.Contains("EndTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobQueryParameterInternal)this).EndTime = (string) content.GetValueForProperty("EndTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobQueryParameterInternal)this).EndTime, global::System.Convert.ToString); + } + if (content.Contains("FabricId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobQueryParameterInternal)this).FabricId = (string) content.GetValueForProperty("FabricId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobQueryParameterInternal)this).FabricId, global::System.Convert.ToString); + } + if (content.Contains("AffectedObjectType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobQueryParameterInternal)this).AffectedObjectType = (string) content.GetValueForProperty("AffectedObjectType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobQueryParameterInternal)this).AffectedObjectType, global::System.Convert.ToString); + } + if (content.Contains("JobStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobQueryParameterInternal)this).JobStatus = (string) content.GetValueForProperty("JobStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobQueryParameterInternal)this).JobStatus, global::System.Convert.ToString); + } + if (content.Contains("JobOutputType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobQueryParameterInternal)this).JobOutputType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ExportJobOutputSerializationType?) content.GetValueForProperty("JobOutputType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobQueryParameterInternal)this).JobOutputType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ExportJobOutputSerializationType.CreateFrom); + } + if (content.Contains("JobName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobQueryParameterInternal)this).JobName = (string) content.GetValueForProperty("JobName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobQueryParameterInternal)this).JobName, global::System.Convert.ToString); + } + if (content.Contains("TimezoneOffset")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobQueryParameterInternal)this).TimezoneOffset = (double?) content.GetValueForProperty("TimezoneOffset",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobQueryParameterInternal)this).TimezoneOffset, (__y)=> (double) global::System.Convert.ChangeType(__y, typeof(double))); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal JobQueryParameter(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("StartTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobQueryParameterInternal)this).StartTime = (string) content.GetValueForProperty("StartTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobQueryParameterInternal)this).StartTime, global::System.Convert.ToString); + } + if (content.Contains("EndTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobQueryParameterInternal)this).EndTime = (string) content.GetValueForProperty("EndTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobQueryParameterInternal)this).EndTime, global::System.Convert.ToString); + } + if (content.Contains("FabricId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobQueryParameterInternal)this).FabricId = (string) content.GetValueForProperty("FabricId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobQueryParameterInternal)this).FabricId, global::System.Convert.ToString); + } + if (content.Contains("AffectedObjectType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobQueryParameterInternal)this).AffectedObjectType = (string) content.GetValueForProperty("AffectedObjectType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobQueryParameterInternal)this).AffectedObjectType, global::System.Convert.ToString); + } + if (content.Contains("JobStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobQueryParameterInternal)this).JobStatus = (string) content.GetValueForProperty("JobStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobQueryParameterInternal)this).JobStatus, global::System.Convert.ToString); + } + if (content.Contains("JobOutputType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobQueryParameterInternal)this).JobOutputType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ExportJobOutputSerializationType?) content.GetValueForProperty("JobOutputType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobQueryParameterInternal)this).JobOutputType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ExportJobOutputSerializationType.CreateFrom); + } + if (content.Contains("JobName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobQueryParameterInternal)this).JobName = (string) content.GetValueForProperty("JobName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobQueryParameterInternal)this).JobName, global::System.Convert.ToString); + } + if (content.Contains("TimezoneOffset")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobQueryParameterInternal)this).TimezoneOffset = (double?) content.GetValueForProperty("TimezoneOffset",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobQueryParameterInternal)this).TimezoneOffset, (__y)=> (double) global::System.Convert.ChangeType(__y, typeof(double))); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Query parameter to enumerate jobs. + [System.ComponentModel.TypeConverter(typeof(JobQueryParameterTypeConverter))] + public partial interface IJobQueryParameter + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobQueryParameter.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobQueryParameter.TypeConverter.cs new file mode 100644 index 000000000000..0085b78caa69 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobQueryParameter.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class JobQueryParameterTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobQueryParameter ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobQueryParameter).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return JobQueryParameter.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return JobQueryParameter.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return JobQueryParameter.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobQueryParameter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobQueryParameter.cs new file mode 100644 index 000000000000..ee921982233b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobQueryParameter.cs @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Query parameter to enumerate jobs. + public partial class JobQueryParameter : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobQueryParameter, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobQueryParameterInternal + { + + /// Backing field for property. + private string _affectedObjectType; + + /// The type of objects. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string AffectedObjectType { get => this._affectedObjectType; set => this._affectedObjectType = value; } + + /// Backing field for property. + private string _endTime; + + /// Date time to get jobs upto. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string EndTime { get => this._endTime; set => this._endTime = value; } + + /// Backing field for property. + private string _fabricId; + + /// The Id of the fabric to search jobs under. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string FabricId { get => this._fabricId; set => this._fabricId = value; } + + /// Backing field for property. + private string _jobName; + + /// The job Name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string JobName { get => this._jobName; set => this._jobName = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ExportJobOutputSerializationType? _jobOutputType; + + /// The output type of the jobs. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ExportJobOutputSerializationType? JobOutputType { get => this._jobOutputType; set => this._jobOutputType = value; } + + /// Backing field for property. + private string _jobStatus; + + /// The states of the job to be filtered can be in. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string JobStatus { get => this._jobStatus; set => this._jobStatus = value; } + + /// Backing field for property. + private string _startTime; + + /// Date time to get jobs from. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string StartTime { get => this._startTime; set => this._startTime = value; } + + /// Backing field for property. + private double? _timezoneOffset; + + /// The timezone offset for the location of the request (in minutes). + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public double? TimezoneOffset { get => this._timezoneOffset; set => this._timezoneOffset = value; } + + /// Creates an new instance. + public JobQueryParameter() + { + + } + } + /// Query parameter to enumerate jobs. + public partial interface IJobQueryParameter : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The type of objects. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The type of objects.", + SerializedName = @"affectedObjectTypes", + PossibleTypes = new [] { typeof(string) })] + string AffectedObjectType { get; set; } + /// Date time to get jobs upto. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Date time to get jobs upto.", + SerializedName = @"endTime", + PossibleTypes = new [] { typeof(string) })] + string EndTime { get; set; } + /// The Id of the fabric to search jobs under. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Id of the fabric to search jobs under.", + SerializedName = @"fabricId", + PossibleTypes = new [] { typeof(string) })] + string FabricId { get; set; } + /// The job Name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The job Name.", + SerializedName = @"jobName", + PossibleTypes = new [] { typeof(string) })] + string JobName { get; set; } + /// The output type of the jobs. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The output type of the jobs.", + SerializedName = @"jobOutputType", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ExportJobOutputSerializationType) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ExportJobOutputSerializationType? JobOutputType { get; set; } + /// The states of the job to be filtered can be in. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The states of the job to be filtered can be in.", + SerializedName = @"jobStatus", + PossibleTypes = new [] { typeof(string) })] + string JobStatus { get; set; } + /// Date time to get jobs from. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Date time to get jobs from.", + SerializedName = @"startTime", + PossibleTypes = new [] { typeof(string) })] + string StartTime { get; set; } + /// The timezone offset for the location of the request (in minutes). + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The timezone offset for the location of the request (in minutes).", + SerializedName = @"timezoneOffset", + PossibleTypes = new [] { typeof(double) })] + double? TimezoneOffset { get; set; } + + } + /// Query parameter to enumerate jobs. + internal partial interface IJobQueryParameterInternal + + { + /// The type of objects. + string AffectedObjectType { get; set; } + /// Date time to get jobs upto. + string EndTime { get; set; } + /// The Id of the fabric to search jobs under. + string FabricId { get; set; } + /// The job Name. + string JobName { get; set; } + /// The output type of the jobs. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ExportJobOutputSerializationType? JobOutputType { get; set; } + /// The states of the job to be filtered can be in. + string JobStatus { get; set; } + /// Date time to get jobs from. + string StartTime { get; set; } + /// The timezone offset for the location of the request (in minutes). + double? TimezoneOffset { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobQueryParameter.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobQueryParameter.json.cs new file mode 100644 index 000000000000..0a7eb2a13f54 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobQueryParameter.json.cs @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Query parameter to enumerate jobs. + public partial class JobQueryParameter + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobQueryParameter. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobQueryParameter. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobQueryParameter FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new JobQueryParameter(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal JobQueryParameter(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_startTime = If( json?.PropertyT("startTime"), out var __jsonStartTime) ? (string)__jsonStartTime : (string)StartTime;} + {_endTime = If( json?.PropertyT("endTime"), out var __jsonEndTime) ? (string)__jsonEndTime : (string)EndTime;} + {_fabricId = If( json?.PropertyT("fabricId"), out var __jsonFabricId) ? (string)__jsonFabricId : (string)FabricId;} + {_affectedObjectType = If( json?.PropertyT("affectedObjectTypes"), out var __jsonAffectedObjectTypes) ? (string)__jsonAffectedObjectTypes : (string)AffectedObjectType;} + {_jobStatus = If( json?.PropertyT("jobStatus"), out var __jsonJobStatus) ? (string)__jsonJobStatus : (string)JobStatus;} + {_jobOutputType = If( json?.PropertyT("jobOutputType"), out var __jsonJobOutputType) ? (string)__jsonJobOutputType : (string)JobOutputType;} + {_jobName = If( json?.PropertyT("jobName"), out var __jsonJobName) ? (string)__jsonJobName : (string)JobName;} + {_timezoneOffset = If( json?.PropertyT("timezoneOffset"), out var __jsonTimezoneOffset) ? (double?)__jsonTimezoneOffset : TimezoneOffset;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._startTime)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._startTime.ToString()) : null, "startTime" ,container.Add ); + AddIf( null != (((object)this._endTime)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._endTime.ToString()) : null, "endTime" ,container.Add ); + AddIf( null != (((object)this._fabricId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._fabricId.ToString()) : null, "fabricId" ,container.Add ); + AddIf( null != (((object)this._affectedObjectType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._affectedObjectType.ToString()) : null, "affectedObjectTypes" ,container.Add ); + AddIf( null != (((object)this._jobStatus)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._jobStatus.ToString()) : null, "jobStatus" ,container.Add ); + AddIf( null != (((object)this._jobOutputType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._jobOutputType.ToString()) : null, "jobOutputType" ,container.Add ); + AddIf( null != (((object)this._jobName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._jobName.ToString()) : null, "jobName" ,container.Add ); + AddIf( null != this._timezoneOffset ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((double)this._timezoneOffset) : null, "timezoneOffset" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobStatusEventDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobStatusEventDetails.PowerShell.cs new file mode 100644 index 000000000000..cca77494e74b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobStatusEventDetails.PowerShell.cs @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Model class for event details of a job status event. + [System.ComponentModel.TypeConverter(typeof(JobStatusEventDetailsTypeConverter))] + public partial class JobStatusEventDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobStatusEventDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new JobStatusEventDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobStatusEventDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new JobStatusEventDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobStatusEventDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal JobStatusEventDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("JobId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobStatusEventDetailsInternal)this).JobId = (string) content.GetValueForProperty("JobId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobStatusEventDetailsInternal)this).JobId, global::System.Convert.ToString); + } + if (content.Contains("JobFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobStatusEventDetailsInternal)this).JobFriendlyName = (string) content.GetValueForProperty("JobFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobStatusEventDetailsInternal)this).JobFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("JobStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobStatusEventDetailsInternal)this).JobStatus = (string) content.GetValueForProperty("JobStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobStatusEventDetailsInternal)this).JobStatus, global::System.Convert.ToString); + } + if (content.Contains("AffectedObjectType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobStatusEventDetailsInternal)this).AffectedObjectType = (string) content.GetValueForProperty("AffectedObjectType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobStatusEventDetailsInternal)this).AffectedObjectType, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventSpecificDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventSpecificDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal JobStatusEventDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("JobId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobStatusEventDetailsInternal)this).JobId = (string) content.GetValueForProperty("JobId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobStatusEventDetailsInternal)this).JobId, global::System.Convert.ToString); + } + if (content.Contains("JobFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobStatusEventDetailsInternal)this).JobFriendlyName = (string) content.GetValueForProperty("JobFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobStatusEventDetailsInternal)this).JobFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("JobStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobStatusEventDetailsInternal)this).JobStatus = (string) content.GetValueForProperty("JobStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobStatusEventDetailsInternal)this).JobStatus, global::System.Convert.ToString); + } + if (content.Contains("AffectedObjectType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobStatusEventDetailsInternal)this).AffectedObjectType = (string) content.GetValueForProperty("AffectedObjectType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobStatusEventDetailsInternal)this).AffectedObjectType, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventSpecificDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventSpecificDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Model class for event details of a job status event. + [System.ComponentModel.TypeConverter(typeof(JobStatusEventDetailsTypeConverter))] + public partial interface IJobStatusEventDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobStatusEventDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobStatusEventDetails.TypeConverter.cs new file mode 100644 index 000000000000..b9d7fe2ddbc2 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobStatusEventDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class JobStatusEventDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobStatusEventDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobStatusEventDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return JobStatusEventDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return JobStatusEventDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return JobStatusEventDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobStatusEventDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobStatusEventDetails.cs new file mode 100644 index 000000000000..4f4a07c4824a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobStatusEventDetails.cs @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Model class for event details of a job status event. + public partial class JobStatusEventDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobStatusEventDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobStatusEventDetailsInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventSpecificDetails __eventSpecificDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EventSpecificDetails(); + + /// Backing field for property. + private string _affectedObjectType; + + /// AffectedObjectType for the event. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string AffectedObjectType { get => this._affectedObjectType; set => this._affectedObjectType = value; } + + /// Gets the class type. Overridden in derived classes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventSpecificDetailsInternal)__eventSpecificDetails).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventSpecificDetailsInternal)__eventSpecificDetails).InstanceType = value ; } + + /// Backing field for property. + private string _jobFriendlyName; + + /// JobName for the Event. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string JobFriendlyName { get => this._jobFriendlyName; set => this._jobFriendlyName = value; } + + /// Backing field for property. + private string _jobId; + + /// Job arm id for the event. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string JobId { get => this._jobId; set => this._jobId = value; } + + /// Backing field for property. + private string _jobStatus; + + /// JobStatus for the Event. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string JobStatus { get => this._jobStatus; set => this._jobStatus = value; } + + /// Creates an new instance. + public JobStatusEventDetails() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__eventSpecificDetails), __eventSpecificDetails); + await eventListener.AssertObjectIsValid(nameof(__eventSpecificDetails), __eventSpecificDetails); + } + } + /// Model class for event details of a job status event. + public partial interface IJobStatusEventDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventSpecificDetails + { + /// AffectedObjectType for the event. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"AffectedObjectType for the event.", + SerializedName = @"affectedObjectType", + PossibleTypes = new [] { typeof(string) })] + string AffectedObjectType { get; set; } + /// JobName for the Event. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"JobName for the Event.", + SerializedName = @"jobFriendlyName", + PossibleTypes = new [] { typeof(string) })] + string JobFriendlyName { get; set; } + /// Job arm id for the event. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Job arm id for the event.", + SerializedName = @"jobId", + PossibleTypes = new [] { typeof(string) })] + string JobId { get; set; } + /// JobStatus for the Event. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"JobStatus for the Event.", + SerializedName = @"jobStatus", + PossibleTypes = new [] { typeof(string) })] + string JobStatus { get; set; } + + } + /// Model class for event details of a job status event. + internal partial interface IJobStatusEventDetailsInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventSpecificDetailsInternal + { + /// AffectedObjectType for the event. + string AffectedObjectType { get; set; } + /// JobName for the Event. + string JobFriendlyName { get; set; } + /// Job arm id for the event. + string JobId { get; set; } + /// JobStatus for the Event. + string JobStatus { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobStatusEventDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobStatusEventDetails.json.cs new file mode 100644 index 000000000000..dce813ff2a7d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobStatusEventDetails.json.cs @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Model class for event details of a job status event. + public partial class JobStatusEventDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobStatusEventDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobStatusEventDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobStatusEventDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new JobStatusEventDetails(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal JobStatusEventDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __eventSpecificDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EventSpecificDetails(json); + {_jobId = If( json?.PropertyT("jobId"), out var __jsonJobId) ? (string)__jsonJobId : (string)JobId;} + {_jobFriendlyName = If( json?.PropertyT("jobFriendlyName"), out var __jsonJobFriendlyName) ? (string)__jsonJobFriendlyName : (string)JobFriendlyName;} + {_jobStatus = If( json?.PropertyT("jobStatus"), out var __jsonJobStatus) ? (string)__jsonJobStatus : (string)JobStatus;} + {_affectedObjectType = If( json?.PropertyT("affectedObjectType"), out var __jsonAffectedObjectType) ? (string)__jsonAffectedObjectType : (string)AffectedObjectType;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __eventSpecificDetails?.ToJson(container, serializationMode); + AddIf( null != (((object)this._jobId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._jobId.ToString()) : null, "jobId" ,container.Add ); + AddIf( null != (((object)this._jobFriendlyName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._jobFriendlyName.ToString()) : null, "jobFriendlyName" ,container.Add ); + AddIf( null != (((object)this._jobStatus)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._jobStatus.ToString()) : null, "jobStatus" ,container.Add ); + AddIf( null != (((object)this._affectedObjectType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._affectedObjectType.ToString()) : null, "affectedObjectType" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobTaskDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobTaskDetails.PowerShell.cs new file mode 100644 index 000000000000..dc56812216a7 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobTaskDetails.PowerShell.cs @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// This class represents a task which is actually a workflow so that one can navigate to its individual drill down. + /// + [System.ComponentModel.TypeConverter(typeof(JobTaskDetailsTypeConverter))] + public partial class JobTaskDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new JobTaskDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new JobTaskDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal JobTaskDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("JobTask")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)this).JobTask = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobEntity) content.GetValueForProperty("JobTask",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)this).JobTask, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.JobEntityTypeConverter.ConvertFrom); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITaskTypeDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITaskTypeDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + if (content.Contains("JobTaskJobId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)this).JobTaskJobId = (string) content.GetValueForProperty("JobTaskJobId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)this).JobTaskJobId, global::System.Convert.ToString); + } + if (content.Contains("JobTaskJobFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)this).JobTaskJobFriendlyName = (string) content.GetValueForProperty("JobTaskJobFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)this).JobTaskJobFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("JobTaskTargetObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)this).JobTaskTargetObjectId = (string) content.GetValueForProperty("JobTaskTargetObjectId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)this).JobTaskTargetObjectId, global::System.Convert.ToString); + } + if (content.Contains("JobTaskTargetObjectName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)this).JobTaskTargetObjectName = (string) content.GetValueForProperty("JobTaskTargetObjectName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)this).JobTaskTargetObjectName, global::System.Convert.ToString); + } + if (content.Contains("JobTaskTargetInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)this).JobTaskTargetInstanceType = (string) content.GetValueForProperty("JobTaskTargetInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)this).JobTaskTargetInstanceType, global::System.Convert.ToString); + } + if (content.Contains("JobTaskJobScenarioName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)this).JobTaskJobScenarioName = (string) content.GetValueForProperty("JobTaskJobScenarioName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)this).JobTaskJobScenarioName, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal JobTaskDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("JobTask")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)this).JobTask = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobEntity) content.GetValueForProperty("JobTask",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)this).JobTask, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.JobEntityTypeConverter.ConvertFrom); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITaskTypeDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITaskTypeDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + if (content.Contains("JobTaskJobId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)this).JobTaskJobId = (string) content.GetValueForProperty("JobTaskJobId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)this).JobTaskJobId, global::System.Convert.ToString); + } + if (content.Contains("JobTaskJobFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)this).JobTaskJobFriendlyName = (string) content.GetValueForProperty("JobTaskJobFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)this).JobTaskJobFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("JobTaskTargetObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)this).JobTaskTargetObjectId = (string) content.GetValueForProperty("JobTaskTargetObjectId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)this).JobTaskTargetObjectId, global::System.Convert.ToString); + } + if (content.Contains("JobTaskTargetObjectName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)this).JobTaskTargetObjectName = (string) content.GetValueForProperty("JobTaskTargetObjectName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)this).JobTaskTargetObjectName, global::System.Convert.ToString); + } + if (content.Contains("JobTaskTargetInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)this).JobTaskTargetInstanceType = (string) content.GetValueForProperty("JobTaskTargetInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)this).JobTaskTargetInstanceType, global::System.Convert.ToString); + } + if (content.Contains("JobTaskJobScenarioName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)this).JobTaskJobScenarioName = (string) content.GetValueForProperty("JobTaskJobScenarioName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)this).JobTaskJobScenarioName, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// This class represents a task which is actually a workflow so that one can navigate to its individual drill down. + [System.ComponentModel.TypeConverter(typeof(JobTaskDetailsTypeConverter))] + public partial interface IJobTaskDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobTaskDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobTaskDetails.TypeConverter.cs new file mode 100644 index 000000000000..1df9e720507c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobTaskDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class JobTaskDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return JobTaskDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return JobTaskDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return JobTaskDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobTaskDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobTaskDetails.cs new file mode 100644 index 000000000000..301fc1226fa1 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobTaskDetails.cs @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// + /// This class represents a task which is actually a workflow so that one can navigate to its individual drill down. + /// + public partial class JobTaskDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITaskTypeDetails __taskTypeDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.TaskTypeDetails(); + + /// The type of task details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITaskTypeDetailsInternal)__taskTypeDetails).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITaskTypeDetailsInternal)__taskTypeDetails).InstanceType = value ; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobEntity _jobTask; + + /// The job entity. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobEntity JobTask { get => (this._jobTask = this._jobTask ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.JobEntity()); set => this._jobTask = value; } + + /// The job display name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string JobTaskJobFriendlyName { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobEntityInternal)JobTask).JobFriendlyName; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobEntityInternal)JobTask).JobFriendlyName = value ?? null; } + + /// The job id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string JobTaskJobId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobEntityInternal)JobTask).JobId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobEntityInternal)JobTask).JobId = value ?? null; } + + /// The job name. Enum type ScenarioName. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string JobTaskJobScenarioName { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobEntityInternal)JobTask).JobScenarioName; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobEntityInternal)JobTask).JobScenarioName = value ?? null; } + + /// The workflow affected object type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string JobTaskTargetInstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobEntityInternal)JobTask).TargetInstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobEntityInternal)JobTask).TargetInstanceType = value ?? null; } + + /// The object id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string JobTaskTargetObjectId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobEntityInternal)JobTask).TargetObjectId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobEntityInternal)JobTask).TargetObjectId = value ?? null; } + + /// The object name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string JobTaskTargetObjectName { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobEntityInternal)JobTask).TargetObjectName; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobEntityInternal)JobTask).TargetObjectName = value ?? null; } + + /// Internal Acessors for JobTask + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobEntity Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal.JobTask { get => (this._jobTask = this._jobTask ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.JobEntity()); set { {_jobTask = value;} } } + + /// Creates an new instance. + public JobTaskDetails() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__taskTypeDetails), __taskTypeDetails); + await eventListener.AssertObjectIsValid(nameof(__taskTypeDetails), __taskTypeDetails); + } + } + /// This class represents a task which is actually a workflow so that one can navigate to its individual drill down. + public partial interface IJobTaskDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITaskTypeDetails + { + /// The job display name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The job display name.", + SerializedName = @"jobFriendlyName", + PossibleTypes = new [] { typeof(string) })] + string JobTaskJobFriendlyName { get; set; } + /// The job id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The job id.", + SerializedName = @"jobId", + PossibleTypes = new [] { typeof(string) })] + string JobTaskJobId { get; set; } + /// The job name. Enum type ScenarioName. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The job name. Enum type ScenarioName.", + SerializedName = @"jobScenarioName", + PossibleTypes = new [] { typeof(string) })] + string JobTaskJobScenarioName { get; set; } + /// The workflow affected object type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The workflow affected object type.", + SerializedName = @"targetInstanceType", + PossibleTypes = new [] { typeof(string) })] + string JobTaskTargetInstanceType { get; set; } + /// The object id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The object id.", + SerializedName = @"targetObjectId", + PossibleTypes = new [] { typeof(string) })] + string JobTaskTargetObjectId { get; set; } + /// The object name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The object name.", + SerializedName = @"targetObjectName", + PossibleTypes = new [] { typeof(string) })] + string JobTaskTargetObjectName { get; set; } + + } + /// This class represents a task which is actually a workflow so that one can navigate to its individual drill down. + internal partial interface IJobTaskDetailsInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITaskTypeDetailsInternal + { + /// The job entity. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobEntity JobTask { get; set; } + /// The job display name. + string JobTaskJobFriendlyName { get; set; } + /// The job id. + string JobTaskJobId { get; set; } + /// The job name. Enum type ScenarioName. + string JobTaskJobScenarioName { get; set; } + /// The workflow affected object type. + string JobTaskTargetInstanceType { get; set; } + /// The object id. + string JobTaskTargetObjectId { get; set; } + /// The object name. + string JobTaskTargetObjectName { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobTaskDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobTaskDetails.json.cs new file mode 100644 index 000000000000..69c8379fa5fc --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/JobTaskDetails.json.cs @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// + /// This class represents a task which is actually a workflow so that one can navigate to its individual drill down. + /// + public partial class JobTaskDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetails. + /// Note: the Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetails interface is polymorphic, and + /// the precise model class that will get deserialized is determined at runtime based on the payload. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + if (!(node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json)) + { + return null; + } + // Polymorphic type -- select the appropriate constructor using the discriminator + + switch ( json.StringProperty("instanceType") ) + { + case "FabricReplicationGroupTaskDetails": + { + return new FabricReplicationGroupTaskDetails(json); + } + case "VirtualMachineTaskDetails": + { + return new VirtualMachineTaskDetails(json); + } + } + return new JobTaskDetails(json); + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal JobTaskDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __taskTypeDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.TaskTypeDetails(json); + {_jobTask = If( json?.PropertyT("jobTask"), out var __jsonJobTask) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.JobEntity.FromJson(__jsonJobTask) : JobTask;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __taskTypeDetails?.ToJson(container, serializationMode); + AddIf( null != this._jobTask ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._jobTask.ToJson(null,serializationMode) : null, "jobTask" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/KeyEncryptionKeyInfo.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/KeyEncryptionKeyInfo.PowerShell.cs new file mode 100644 index 000000000000..43c56b74189b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/KeyEncryptionKeyInfo.PowerShell.cs @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Key Encryption Key (KEK) information. + [System.ComponentModel.TypeConverter(typeof(KeyEncryptionKeyInfoTypeConverter))] + public partial class KeyEncryptionKeyInfo + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IKeyEncryptionKeyInfo DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new KeyEncryptionKeyInfo(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IKeyEncryptionKeyInfo DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new KeyEncryptionKeyInfo(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IKeyEncryptionKeyInfo FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal KeyEncryptionKeyInfo(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("KeyIdentifier")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IKeyEncryptionKeyInfoInternal)this).KeyIdentifier = (string) content.GetValueForProperty("KeyIdentifier",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IKeyEncryptionKeyInfoInternal)this).KeyIdentifier, global::System.Convert.ToString); + } + if (content.Contains("KeyVaultResourceArmId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IKeyEncryptionKeyInfoInternal)this).KeyVaultResourceArmId = (string) content.GetValueForProperty("KeyVaultResourceArmId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IKeyEncryptionKeyInfoInternal)this).KeyVaultResourceArmId, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal KeyEncryptionKeyInfo(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("KeyIdentifier")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IKeyEncryptionKeyInfoInternal)this).KeyIdentifier = (string) content.GetValueForProperty("KeyIdentifier",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IKeyEncryptionKeyInfoInternal)this).KeyIdentifier, global::System.Convert.ToString); + } + if (content.Contains("KeyVaultResourceArmId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IKeyEncryptionKeyInfoInternal)this).KeyVaultResourceArmId = (string) content.GetValueForProperty("KeyVaultResourceArmId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IKeyEncryptionKeyInfoInternal)this).KeyVaultResourceArmId, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Key Encryption Key (KEK) information. + [System.ComponentModel.TypeConverter(typeof(KeyEncryptionKeyInfoTypeConverter))] + public partial interface IKeyEncryptionKeyInfo + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/KeyEncryptionKeyInfo.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/KeyEncryptionKeyInfo.TypeConverter.cs new file mode 100644 index 000000000000..d348b9927ad5 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/KeyEncryptionKeyInfo.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class KeyEncryptionKeyInfoTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IKeyEncryptionKeyInfo ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IKeyEncryptionKeyInfo).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return KeyEncryptionKeyInfo.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return KeyEncryptionKeyInfo.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return KeyEncryptionKeyInfo.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/KeyEncryptionKeyInfo.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/KeyEncryptionKeyInfo.cs new file mode 100644 index 000000000000..21c89e1f8fe3 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/KeyEncryptionKeyInfo.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Key Encryption Key (KEK) information. + public partial class KeyEncryptionKeyInfo : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IKeyEncryptionKeyInfo, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IKeyEncryptionKeyInfoInternal + { + + /// Backing field for property. + private string _keyIdentifier; + + /// The key URL / identifier. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string KeyIdentifier { get => this._keyIdentifier; set => this._keyIdentifier = value; } + + /// Backing field for property. + private string _keyVaultResourceArmId; + + /// The KeyVault resource ARM Id for key. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string KeyVaultResourceArmId { get => this._keyVaultResourceArmId; set => this._keyVaultResourceArmId = value; } + + /// Creates an new instance. + public KeyEncryptionKeyInfo() + { + + } + } + /// Key Encryption Key (KEK) information. + public partial interface IKeyEncryptionKeyInfo : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The key URL / identifier. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The key URL / identifier.", + SerializedName = @"keyIdentifier", + PossibleTypes = new [] { typeof(string) })] + string KeyIdentifier { get; set; } + /// The KeyVault resource ARM Id for key. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The KeyVault resource ARM Id for key.", + SerializedName = @"keyVaultResourceArmId", + PossibleTypes = new [] { typeof(string) })] + string KeyVaultResourceArmId { get; set; } + + } + /// Key Encryption Key (KEK) information. + internal partial interface IKeyEncryptionKeyInfoInternal + + { + /// The key URL / identifier. + string KeyIdentifier { get; set; } + /// The KeyVault resource ARM Id for key. + string KeyVaultResourceArmId { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/KeyEncryptionKeyInfo.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/KeyEncryptionKeyInfo.json.cs new file mode 100644 index 000000000000..3598dda6de57 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/KeyEncryptionKeyInfo.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Key Encryption Key (KEK) information. + public partial class KeyEncryptionKeyInfo + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IKeyEncryptionKeyInfo. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IKeyEncryptionKeyInfo. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IKeyEncryptionKeyInfo FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new KeyEncryptionKeyInfo(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal KeyEncryptionKeyInfo(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_keyIdentifier = If( json?.PropertyT("keyIdentifier"), out var __jsonKeyIdentifier) ? (string)__jsonKeyIdentifier : (string)KeyIdentifier;} + {_keyVaultResourceArmId = If( json?.PropertyT("keyVaultResourceArmId"), out var __jsonKeyVaultResourceArmId) ? (string)__jsonKeyVaultResourceArmId : (string)KeyVaultResourceArmId;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._keyIdentifier)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._keyIdentifier.ToString()) : null, "keyIdentifier" ,container.Add ); + AddIf( null != (((object)this._keyVaultResourceArmId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._keyVaultResourceArmId.ToString()) : null, "keyVaultResourceArmId" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/LogicalNetwork.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/LogicalNetwork.PowerShell.cs new file mode 100644 index 000000000000..3bcc138b41d2 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/LogicalNetwork.PowerShell.cs @@ -0,0 +1,208 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Logical network data model. + [System.ComponentModel.TypeConverter(typeof(LogicalNetworkTypeConverter))] + public partial class LogicalNetwork + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetwork DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new LogicalNetwork(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetwork DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new LogicalNetwork(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetwork FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal LogicalNetwork(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetworkInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetworkProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetworkInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.LogicalNetworkPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("FriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetworkInternal)this).FriendlyName = (string) content.GetValueForProperty("FriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetworkInternal)this).FriendlyName, global::System.Convert.ToString); + } + if (content.Contains("NetworkVirtualizationStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetworkInternal)this).NetworkVirtualizationStatus = (string) content.GetValueForProperty("NetworkVirtualizationStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetworkInternal)this).NetworkVirtualizationStatus, global::System.Convert.ToString); + } + if (content.Contains("Usage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetworkInternal)this).Usage = (string) content.GetValueForProperty("Usage",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetworkInternal)this).Usage, global::System.Convert.ToString); + } + if (content.Contains("DefinitionsStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetworkInternal)this).DefinitionsStatus = (string) content.GetValueForProperty("DefinitionsStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetworkInternal)this).DefinitionsStatus, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal LogicalNetwork(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetworkInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetworkProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetworkInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.LogicalNetworkPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("FriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetworkInternal)this).FriendlyName = (string) content.GetValueForProperty("FriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetworkInternal)this).FriendlyName, global::System.Convert.ToString); + } + if (content.Contains("NetworkVirtualizationStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetworkInternal)this).NetworkVirtualizationStatus = (string) content.GetValueForProperty("NetworkVirtualizationStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetworkInternal)this).NetworkVirtualizationStatus, global::System.Convert.ToString); + } + if (content.Contains("Usage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetworkInternal)this).Usage = (string) content.GetValueForProperty("Usage",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetworkInternal)this).Usage, global::System.Convert.ToString); + } + if (content.Contains("DefinitionsStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetworkInternal)this).DefinitionsStatus = (string) content.GetValueForProperty("DefinitionsStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetworkInternal)this).DefinitionsStatus, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Logical network data model. + [System.ComponentModel.TypeConverter(typeof(LogicalNetworkTypeConverter))] + public partial interface ILogicalNetwork + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/LogicalNetwork.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/LogicalNetwork.TypeConverter.cs new file mode 100644 index 000000000000..40e5c7c997aa --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/LogicalNetwork.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class LogicalNetworkTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetwork ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetwork).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return LogicalNetwork.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return LogicalNetwork.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return LogicalNetwork.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/LogicalNetwork.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/LogicalNetwork.cs new file mode 100644 index 000000000000..e5366fb3ed6b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/LogicalNetwork.cs @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Logical network data model. + public partial class LogicalNetwork : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetwork, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetworkInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResource __resource = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.Resource(); + + /// A value indicating whether logical network definitions are isolated. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string DefinitionsStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetworkPropertiesInternal)Property).LogicalNetworkDefinitionsStatus; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetworkPropertiesInternal)Property).LogicalNetworkDefinitionsStatus = value ?? null; } + + /// The Friendly Name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string FriendlyName { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetworkPropertiesInternal)Property).FriendlyName; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetworkPropertiesInternal)Property).FriendlyName = value ?? null; } + + /// Resource Id + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Id; } + + /// Resource Location + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string Location { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Location; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Location = value ?? null; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetworkProperties Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetworkInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.LogicalNetworkProperties()); set { {_property = value;} } } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Id = value; } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Name = value; } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Type = value; } + + /// Resource Name + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Name; } + + /// + /// A value indicating whether Network Virtualization is enabled for the logical network. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string NetworkVirtualizationStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetworkPropertiesInternal)Property).NetworkVirtualizationStatus; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetworkPropertiesInternal)Property).NetworkVirtualizationStatus = value ?? null; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetworkProperties _property; + + /// The Logical Network Properties. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetworkProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.LogicalNetworkProperties()); set => this._property = value; } + + /// Resource Type + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Type; } + + /// + /// A value indicating whether logical network is used as private test network by test failover. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string Usage { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetworkPropertiesInternal)Property).LogicalNetworkUsage; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetworkPropertiesInternal)Property).LogicalNetworkUsage = value ?? null; } + + /// Creates an new instance. + public LogicalNetwork() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__resource), __resource); + await eventListener.AssertObjectIsValid(nameof(__resource), __resource); + } + } + /// Logical network data model. + public partial interface ILogicalNetwork : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResource + { + /// A value indicating whether logical network definitions are isolated. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether logical network definitions are isolated.", + SerializedName = @"logicalNetworkDefinitionsStatus", + PossibleTypes = new [] { typeof(string) })] + string DefinitionsStatus { get; set; } + /// The Friendly Name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Friendly Name.", + SerializedName = @"friendlyName", + PossibleTypes = new [] { typeof(string) })] + string FriendlyName { get; set; } + /// + /// A value indicating whether Network Virtualization is enabled for the logical network. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether Network Virtualization is enabled for the logical network.", + SerializedName = @"networkVirtualizationStatus", + PossibleTypes = new [] { typeof(string) })] + string NetworkVirtualizationStatus { get; set; } + /// + /// A value indicating whether logical network is used as private test network by test failover. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether logical network is used as private test network by test failover.", + SerializedName = @"logicalNetworkUsage", + PossibleTypes = new [] { typeof(string) })] + string Usage { get; set; } + + } + /// Logical network data model. + internal partial interface ILogicalNetworkInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal + { + /// A value indicating whether logical network definitions are isolated. + string DefinitionsStatus { get; set; } + /// The Friendly Name. + string FriendlyName { get; set; } + /// + /// A value indicating whether Network Virtualization is enabled for the logical network. + /// + string NetworkVirtualizationStatus { get; set; } + /// The Logical Network Properties. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetworkProperties Property { get; set; } + /// + /// A value indicating whether logical network is used as private test network by test failover. + /// + string Usage { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/LogicalNetwork.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/LogicalNetwork.json.cs new file mode 100644 index 000000000000..30195d1bb771 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/LogicalNetwork.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Logical network data model. + public partial class LogicalNetwork + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetwork. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetwork. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetwork FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new LogicalNetwork(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal LogicalNetwork(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __resource = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.Resource(json); + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.LogicalNetworkProperties.FromJson(__jsonProperties) : Property;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __resource?.ToJson(container, serializationMode); + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/LogicalNetworkCollection.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/LogicalNetworkCollection.PowerShell.cs new file mode 100644 index 000000000000..af277fff66a0 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/LogicalNetworkCollection.PowerShell.cs @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// List of logical networks. + [System.ComponentModel.TypeConverter(typeof(LogicalNetworkCollectionTypeConverter))] + public partial class LogicalNetworkCollection + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetworkCollection DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new LogicalNetworkCollection(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetworkCollection DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new LogicalNetworkCollection(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetworkCollection FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal LogicalNetworkCollection(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetworkCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetwork[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetworkCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.LogicalNetworkTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetworkCollectionInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetworkCollectionInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal LogicalNetworkCollection(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetworkCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetwork[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetworkCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.LogicalNetworkTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetworkCollectionInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetworkCollectionInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// List of logical networks. + [System.ComponentModel.TypeConverter(typeof(LogicalNetworkCollectionTypeConverter))] + public partial interface ILogicalNetworkCollection + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/LogicalNetworkCollection.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/LogicalNetworkCollection.TypeConverter.cs new file mode 100644 index 000000000000..043d369a3270 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/LogicalNetworkCollection.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class LogicalNetworkCollectionTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetworkCollection ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetworkCollection).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return LogicalNetworkCollection.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return LogicalNetworkCollection.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return LogicalNetworkCollection.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/LogicalNetworkCollection.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/LogicalNetworkCollection.cs new file mode 100644 index 000000000000..77b1aa4f2131 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/LogicalNetworkCollection.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// List of logical networks. + public partial class LogicalNetworkCollection : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetworkCollection, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetworkCollectionInternal + { + + /// Backing field for property. + private string _nextLink; + + /// The value of next link. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string NextLink { get => this._nextLink; set => this._nextLink = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetwork[] _value; + + /// The Logical Networks list details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetwork[] Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public LogicalNetworkCollection() + { + + } + } + /// List of logical networks. + public partial interface ILogicalNetworkCollection : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The value of next link. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The value of next link.", + SerializedName = @"nextLink", + PossibleTypes = new [] { typeof(string) })] + string NextLink { get; set; } + /// The Logical Networks list details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Logical Networks list details.", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetwork) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetwork[] Value { get; set; } + + } + /// List of logical networks. + internal partial interface ILogicalNetworkCollectionInternal + + { + /// The value of next link. + string NextLink { get; set; } + /// The Logical Networks list details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetwork[] Value { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/LogicalNetworkCollection.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/LogicalNetworkCollection.json.cs new file mode 100644 index 000000000000..dbbf7abedb23 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/LogicalNetworkCollection.json.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// List of logical networks. + public partial class LogicalNetworkCollection + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetworkCollection. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetworkCollection. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetworkCollection FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new LogicalNetworkCollection(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal LogicalNetworkCollection(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetwork) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.LogicalNetwork.FromJson(__u) )) ))() : null : Value;} + {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)NextLink;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._value) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._value ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("value",__w); + } + AddIf( null != (((object)this._nextLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/LogicalNetworkProperties.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/LogicalNetworkProperties.PowerShell.cs new file mode 100644 index 000000000000..4f7ab1dfeb24 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/LogicalNetworkProperties.PowerShell.cs @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Logical Network Properties. + [System.ComponentModel.TypeConverter(typeof(LogicalNetworkPropertiesTypeConverter))] + public partial class LogicalNetworkProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetworkProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new LogicalNetworkProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetworkProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new LogicalNetworkProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetworkProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal LogicalNetworkProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("FriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetworkPropertiesInternal)this).FriendlyName = (string) content.GetValueForProperty("FriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetworkPropertiesInternal)this).FriendlyName, global::System.Convert.ToString); + } + if (content.Contains("NetworkVirtualizationStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetworkPropertiesInternal)this).NetworkVirtualizationStatus = (string) content.GetValueForProperty("NetworkVirtualizationStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetworkPropertiesInternal)this).NetworkVirtualizationStatus, global::System.Convert.ToString); + } + if (content.Contains("LogicalNetworkUsage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetworkPropertiesInternal)this).LogicalNetworkUsage = (string) content.GetValueForProperty("LogicalNetworkUsage",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetworkPropertiesInternal)this).LogicalNetworkUsage, global::System.Convert.ToString); + } + if (content.Contains("LogicalNetworkDefinitionsStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetworkPropertiesInternal)this).LogicalNetworkDefinitionsStatus = (string) content.GetValueForProperty("LogicalNetworkDefinitionsStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetworkPropertiesInternal)this).LogicalNetworkDefinitionsStatus, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal LogicalNetworkProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("FriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetworkPropertiesInternal)this).FriendlyName = (string) content.GetValueForProperty("FriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetworkPropertiesInternal)this).FriendlyName, global::System.Convert.ToString); + } + if (content.Contains("NetworkVirtualizationStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetworkPropertiesInternal)this).NetworkVirtualizationStatus = (string) content.GetValueForProperty("NetworkVirtualizationStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetworkPropertiesInternal)this).NetworkVirtualizationStatus, global::System.Convert.ToString); + } + if (content.Contains("LogicalNetworkUsage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetworkPropertiesInternal)this).LogicalNetworkUsage = (string) content.GetValueForProperty("LogicalNetworkUsage",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetworkPropertiesInternal)this).LogicalNetworkUsage, global::System.Convert.ToString); + } + if (content.Contains("LogicalNetworkDefinitionsStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetworkPropertiesInternal)this).LogicalNetworkDefinitionsStatus = (string) content.GetValueForProperty("LogicalNetworkDefinitionsStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetworkPropertiesInternal)this).LogicalNetworkDefinitionsStatus, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Logical Network Properties. + [System.ComponentModel.TypeConverter(typeof(LogicalNetworkPropertiesTypeConverter))] + public partial interface ILogicalNetworkProperties + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/LogicalNetworkProperties.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/LogicalNetworkProperties.TypeConverter.cs new file mode 100644 index 000000000000..1c9963d44071 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/LogicalNetworkProperties.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class LogicalNetworkPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetworkProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetworkProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return LogicalNetworkProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return LogicalNetworkProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return LogicalNetworkProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/LogicalNetworkProperties.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/LogicalNetworkProperties.cs new file mode 100644 index 000000000000..e7ffdec6ed65 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/LogicalNetworkProperties.cs @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Logical Network Properties. + public partial class LogicalNetworkProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetworkProperties, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetworkPropertiesInternal + { + + /// Backing field for property. + private string _friendlyName; + + /// The Friendly Name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string FriendlyName { get => this._friendlyName; set => this._friendlyName = value; } + + /// Backing field for property. + private string _logicalNetworkDefinitionsStatus; + + /// A value indicating whether logical network definitions are isolated. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string LogicalNetworkDefinitionsStatus { get => this._logicalNetworkDefinitionsStatus; set => this._logicalNetworkDefinitionsStatus = value; } + + /// Backing field for property. + private string _logicalNetworkUsage; + + /// + /// A value indicating whether logical network is used as private test network by test failover. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string LogicalNetworkUsage { get => this._logicalNetworkUsage; set => this._logicalNetworkUsage = value; } + + /// Backing field for property. + private string _networkVirtualizationStatus; + + /// + /// A value indicating whether Network Virtualization is enabled for the logical network. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string NetworkVirtualizationStatus { get => this._networkVirtualizationStatus; set => this._networkVirtualizationStatus = value; } + + /// Creates an new instance. + public LogicalNetworkProperties() + { + + } + } + /// Logical Network Properties. + public partial interface ILogicalNetworkProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The Friendly Name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Friendly Name.", + SerializedName = @"friendlyName", + PossibleTypes = new [] { typeof(string) })] + string FriendlyName { get; set; } + /// A value indicating whether logical network definitions are isolated. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether logical network definitions are isolated.", + SerializedName = @"logicalNetworkDefinitionsStatus", + PossibleTypes = new [] { typeof(string) })] + string LogicalNetworkDefinitionsStatus { get; set; } + /// + /// A value indicating whether logical network is used as private test network by test failover. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether logical network is used as private test network by test failover.", + SerializedName = @"logicalNetworkUsage", + PossibleTypes = new [] { typeof(string) })] + string LogicalNetworkUsage { get; set; } + /// + /// A value indicating whether Network Virtualization is enabled for the logical network. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether Network Virtualization is enabled for the logical network.", + SerializedName = @"networkVirtualizationStatus", + PossibleTypes = new [] { typeof(string) })] + string NetworkVirtualizationStatus { get; set; } + + } + /// Logical Network Properties. + internal partial interface ILogicalNetworkPropertiesInternal + + { + /// The Friendly Name. + string FriendlyName { get; set; } + /// A value indicating whether logical network definitions are isolated. + string LogicalNetworkDefinitionsStatus { get; set; } + /// + /// A value indicating whether logical network is used as private test network by test failover. + /// + string LogicalNetworkUsage { get; set; } + /// + /// A value indicating whether Network Virtualization is enabled for the logical network. + /// + string NetworkVirtualizationStatus { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/LogicalNetworkProperties.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/LogicalNetworkProperties.json.cs new file mode 100644 index 000000000000..5393456bb39e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/LogicalNetworkProperties.json.cs @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Logical Network Properties. + public partial class LogicalNetworkProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetworkProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetworkProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetworkProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new LogicalNetworkProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal LogicalNetworkProperties(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_friendlyName = If( json?.PropertyT("friendlyName"), out var __jsonFriendlyName) ? (string)__jsonFriendlyName : (string)FriendlyName;} + {_networkVirtualizationStatus = If( json?.PropertyT("networkVirtualizationStatus"), out var __jsonNetworkVirtualizationStatus) ? (string)__jsonNetworkVirtualizationStatus : (string)NetworkVirtualizationStatus;} + {_logicalNetworkUsage = If( json?.PropertyT("logicalNetworkUsage"), out var __jsonLogicalNetworkUsage) ? (string)__jsonLogicalNetworkUsage : (string)LogicalNetworkUsage;} + {_logicalNetworkDefinitionsStatus = If( json?.PropertyT("logicalNetworkDefinitionsStatus"), out var __jsonLogicalNetworkDefinitionsStatus) ? (string)__jsonLogicalNetworkDefinitionsStatus : (string)LogicalNetworkDefinitionsStatus;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._friendlyName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._friendlyName.ToString()) : null, "friendlyName" ,container.Add ); + AddIf( null != (((object)this._networkVirtualizationStatus)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._networkVirtualizationStatus.ToString()) : null, "networkVirtualizationStatus" ,container.Add ); + AddIf( null != (((object)this._logicalNetworkUsage)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._logicalNetworkUsage.ToString()) : null, "logicalNetworkUsage" ,container.Add ); + AddIf( null != (((object)this._logicalNetworkDefinitionsStatus)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._logicalNetworkDefinitionsStatus.ToString()) : null, "logicalNetworkDefinitionsStatus" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ManualActionTaskDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ManualActionTaskDetails.PowerShell.cs new file mode 100644 index 000000000000..ef139bcb1283 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ManualActionTaskDetails.PowerShell.cs @@ -0,0 +1,168 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// This class represents the manual action task details. + [System.ComponentModel.TypeConverter(typeof(ManualActionTaskDetailsTypeConverter))] + public partial class ManualActionTaskDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IManualActionTaskDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ManualActionTaskDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IManualActionTaskDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ManualActionTaskDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IManualActionTaskDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ManualActionTaskDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IManualActionTaskDetailsInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IManualActionTaskDetailsInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Instruction")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IManualActionTaskDetailsInternal)this).Instruction = (string) content.GetValueForProperty("Instruction",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IManualActionTaskDetailsInternal)this).Instruction, global::System.Convert.ToString); + } + if (content.Contains("Observation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IManualActionTaskDetailsInternal)this).Observation = (string) content.GetValueForProperty("Observation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IManualActionTaskDetailsInternal)this).Observation, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITaskTypeDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITaskTypeDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ManualActionTaskDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IManualActionTaskDetailsInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IManualActionTaskDetailsInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Instruction")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IManualActionTaskDetailsInternal)this).Instruction = (string) content.GetValueForProperty("Instruction",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IManualActionTaskDetailsInternal)this).Instruction, global::System.Convert.ToString); + } + if (content.Contains("Observation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IManualActionTaskDetailsInternal)this).Observation = (string) content.GetValueForProperty("Observation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IManualActionTaskDetailsInternal)this).Observation, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITaskTypeDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITaskTypeDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// This class represents the manual action task details. + [System.ComponentModel.TypeConverter(typeof(ManualActionTaskDetailsTypeConverter))] + public partial interface IManualActionTaskDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ManualActionTaskDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ManualActionTaskDetails.TypeConverter.cs new file mode 100644 index 000000000000..56f6908c10d5 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ManualActionTaskDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ManualActionTaskDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IManualActionTaskDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IManualActionTaskDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ManualActionTaskDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ManualActionTaskDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ManualActionTaskDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ManualActionTaskDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ManualActionTaskDetails.cs new file mode 100644 index 000000000000..2bebcbfa57df --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ManualActionTaskDetails.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// This class represents the manual action task details. + public partial class ManualActionTaskDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IManualActionTaskDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IManualActionTaskDetailsInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITaskTypeDetails __taskTypeDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.TaskTypeDetails(); + + /// The type of task details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITaskTypeDetailsInternal)__taskTypeDetails).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITaskTypeDetailsInternal)__taskTypeDetails).InstanceType = value ; } + + /// Backing field for property. + private string _instruction; + + /// The instructions. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Instruction { get => this._instruction; set => this._instruction = value; } + + /// Backing field for property. + private string _name; + + /// The name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Name { get => this._name; set => this._name = value; } + + /// Backing field for property. + private string _observation; + + /// The observation. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Observation { get => this._observation; set => this._observation = value; } + + /// Creates an new instance. + public ManualActionTaskDetails() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__taskTypeDetails), __taskTypeDetails); + await eventListener.AssertObjectIsValid(nameof(__taskTypeDetails), __taskTypeDetails); + } + } + /// This class represents the manual action task details. + public partial interface IManualActionTaskDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITaskTypeDetails + { + /// The instructions. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The instructions.", + SerializedName = @"instructions", + PossibleTypes = new [] { typeof(string) })] + string Instruction { get; set; } + /// The name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string Name { get; set; } + /// The observation. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The observation.", + SerializedName = @"observation", + PossibleTypes = new [] { typeof(string) })] + string Observation { get; set; } + + } + /// This class represents the manual action task details. + internal partial interface IManualActionTaskDetailsInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITaskTypeDetailsInternal + { + /// The instructions. + string Instruction { get; set; } + /// The name. + string Name { get; set; } + /// The observation. + string Observation { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ManualActionTaskDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ManualActionTaskDetails.json.cs new file mode 100644 index 000000000000..d5a43a55f04b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ManualActionTaskDetails.json.cs @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// This class represents the manual action task details. + public partial class ManualActionTaskDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IManualActionTaskDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IManualActionTaskDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IManualActionTaskDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new ManualActionTaskDetails(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal ManualActionTaskDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __taskTypeDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.TaskTypeDetails(json); + {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)Name;} + {_instruction = If( json?.PropertyT("instructions"), out var __jsonInstructions) ? (string)__jsonInstructions : (string)Instruction;} + {_observation = If( json?.PropertyT("observation"), out var __jsonObservation) ? (string)__jsonObservation : (string)Observation;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __taskTypeDetails?.ToJson(container, serializationMode); + AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); + AddIf( null != (((object)this._instruction)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._instruction.ToString()) : null, "instructions" ,container.Add ); + AddIf( null != (((object)this._observation)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._observation.ToString()) : null, "observation" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MarsAgentDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MarsAgentDetails.PowerShell.cs new file mode 100644 index 000000000000..09d81c4eef6f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MarsAgentDetails.PowerShell.cs @@ -0,0 +1,208 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Mars agent details. + [System.ComponentModel.TypeConverter(typeof(MarsAgentDetailsTypeConverter))] + public partial class MarsAgentDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMarsAgentDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new MarsAgentDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMarsAgentDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new MarsAgentDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMarsAgentDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal MarsAgentDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMarsAgentDetailsInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMarsAgentDetailsInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMarsAgentDetailsInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMarsAgentDetailsInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("BiosId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMarsAgentDetailsInternal)this).BiosId = (string) content.GetValueForProperty("BiosId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMarsAgentDetailsInternal)this).BiosId, global::System.Convert.ToString); + } + if (content.Contains("FabricObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMarsAgentDetailsInternal)this).FabricObjectId = (string) content.GetValueForProperty("FabricObjectId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMarsAgentDetailsInternal)this).FabricObjectId, global::System.Convert.ToString); + } + if (content.Contains("Fqdn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMarsAgentDetailsInternal)this).Fqdn = (string) content.GetValueForProperty("Fqdn",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMarsAgentDetailsInternal)this).Fqdn, global::System.Convert.ToString); + } + if (content.Contains("Version")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMarsAgentDetailsInternal)this).Version = (string) content.GetValueForProperty("Version",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMarsAgentDetailsInternal)this).Version, global::System.Convert.ToString); + } + if (content.Contains("LastHeartbeatUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMarsAgentDetailsInternal)this).LastHeartbeatUtc = (global::System.DateTime?) content.GetValueForProperty("LastHeartbeatUtc",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMarsAgentDetailsInternal)this).LastHeartbeatUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("Health")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMarsAgentDetailsInternal)this).Health = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth?) content.GetValueForProperty("Health",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMarsAgentDetailsInternal)this).Health, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth.CreateFrom); + } + if (content.Contains("HealthError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMarsAgentDetailsInternal)this).HealthError = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[]) content.GetValueForProperty("HealthError",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMarsAgentDetailsInternal)this).HealthError, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthErrorTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal MarsAgentDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMarsAgentDetailsInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMarsAgentDetailsInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMarsAgentDetailsInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMarsAgentDetailsInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("BiosId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMarsAgentDetailsInternal)this).BiosId = (string) content.GetValueForProperty("BiosId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMarsAgentDetailsInternal)this).BiosId, global::System.Convert.ToString); + } + if (content.Contains("FabricObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMarsAgentDetailsInternal)this).FabricObjectId = (string) content.GetValueForProperty("FabricObjectId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMarsAgentDetailsInternal)this).FabricObjectId, global::System.Convert.ToString); + } + if (content.Contains("Fqdn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMarsAgentDetailsInternal)this).Fqdn = (string) content.GetValueForProperty("Fqdn",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMarsAgentDetailsInternal)this).Fqdn, global::System.Convert.ToString); + } + if (content.Contains("Version")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMarsAgentDetailsInternal)this).Version = (string) content.GetValueForProperty("Version",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMarsAgentDetailsInternal)this).Version, global::System.Convert.ToString); + } + if (content.Contains("LastHeartbeatUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMarsAgentDetailsInternal)this).LastHeartbeatUtc = (global::System.DateTime?) content.GetValueForProperty("LastHeartbeatUtc",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMarsAgentDetailsInternal)this).LastHeartbeatUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("Health")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMarsAgentDetailsInternal)this).Health = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth?) content.GetValueForProperty("Health",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMarsAgentDetailsInternal)this).Health, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth.CreateFrom); + } + if (content.Contains("HealthError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMarsAgentDetailsInternal)this).HealthError = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[]) content.GetValueForProperty("HealthError",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMarsAgentDetailsInternal)this).HealthError, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthErrorTypeConverter.ConvertFrom)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Mars agent details. + [System.ComponentModel.TypeConverter(typeof(MarsAgentDetailsTypeConverter))] + public partial interface IMarsAgentDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MarsAgentDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MarsAgentDetails.TypeConverter.cs new file mode 100644 index 000000000000..3e672a64e700 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MarsAgentDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class MarsAgentDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMarsAgentDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMarsAgentDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return MarsAgentDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return MarsAgentDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return MarsAgentDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MarsAgentDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MarsAgentDetails.cs new file mode 100644 index 000000000000..617ae669db49 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MarsAgentDetails.cs @@ -0,0 +1,214 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Mars agent details. + public partial class MarsAgentDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMarsAgentDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMarsAgentDetailsInternal + { + + /// Backing field for property. + private string _biosId; + + /// The Mars agent Bios Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string BiosId { get => this._biosId; } + + /// Backing field for property. + private string _fabricObjectId; + + /// The fabric object Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string FabricObjectId { get => this._fabricObjectId; } + + /// Backing field for property. + private string _fqdn; + + /// The Mars agent Fqdn. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Fqdn { get => this._fqdn; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth? _health; + + /// The health of the Mars agent. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth? Health { get => this._health; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] _healthError; + + /// The health errors. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] HealthError { get => this._healthError; } + + /// Backing field for property. + private string _id; + + /// The Mars agent Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Id { get => this._id; } + + /// Backing field for property. + private global::System.DateTime? _lastHeartbeatUtc; + + /// The last heartbeat received from the Mars agent. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public global::System.DateTime? LastHeartbeatUtc { get => this._lastHeartbeatUtc; } + + /// Internal Acessors for BiosId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMarsAgentDetailsInternal.BiosId { get => this._biosId; set { {_biosId = value;} } } + + /// Internal Acessors for FabricObjectId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMarsAgentDetailsInternal.FabricObjectId { get => this._fabricObjectId; set { {_fabricObjectId = value;} } } + + /// Internal Acessors for Fqdn + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMarsAgentDetailsInternal.Fqdn { get => this._fqdn; set { {_fqdn = value;} } } + + /// Internal Acessors for Health + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMarsAgentDetailsInternal.Health { get => this._health; set { {_health = value;} } } + + /// Internal Acessors for HealthError + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMarsAgentDetailsInternal.HealthError { get => this._healthError; set { {_healthError = value;} } } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMarsAgentDetailsInternal.Id { get => this._id; set { {_id = value;} } } + + /// Internal Acessors for LastHeartbeatUtc + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMarsAgentDetailsInternal.LastHeartbeatUtc { get => this._lastHeartbeatUtc; set { {_lastHeartbeatUtc = value;} } } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMarsAgentDetailsInternal.Name { get => this._name; set { {_name = value;} } } + + /// Internal Acessors for Version + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMarsAgentDetailsInternal.Version { get => this._version; set { {_version = value;} } } + + /// Backing field for property. + private string _name; + + /// The Mars agent name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Name { get => this._name; } + + /// Backing field for property. + private string _version; + + /// The version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Version { get => this._version; } + + /// Creates an new instance. + public MarsAgentDetails() + { + + } + } + /// Mars agent details. + public partial interface IMarsAgentDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The Mars agent Bios Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The Mars agent Bios Id.", + SerializedName = @"biosId", + PossibleTypes = new [] { typeof(string) })] + string BiosId { get; } + /// The fabric object Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The fabric object Id.", + SerializedName = @"fabricObjectId", + PossibleTypes = new [] { typeof(string) })] + string FabricObjectId { get; } + /// The Mars agent Fqdn. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The Mars agent Fqdn.", + SerializedName = @"fqdn", + PossibleTypes = new [] { typeof(string) })] + string Fqdn { get; } + /// The health of the Mars agent. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The health of the Mars agent.", + SerializedName = @"health", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth? Health { get; } + /// The health errors. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The health errors.", + SerializedName = @"healthErrors", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] HealthError { get; } + /// The Mars agent Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The Mars agent Id.", + SerializedName = @"id", + PossibleTypes = new [] { typeof(string) })] + string Id { get; } + /// The last heartbeat received from the Mars agent. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The last heartbeat received from the Mars agent.", + SerializedName = @"lastHeartbeatUtc", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? LastHeartbeatUtc { get; } + /// The Mars agent name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The Mars agent name.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string Name { get; } + /// The version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The version.", + SerializedName = @"version", + PossibleTypes = new [] { typeof(string) })] + string Version { get; } + + } + /// Mars agent details. + internal partial interface IMarsAgentDetailsInternal + + { + /// The Mars agent Bios Id. + string BiosId { get; set; } + /// The fabric object Id. + string FabricObjectId { get; set; } + /// The Mars agent Fqdn. + string Fqdn { get; set; } + /// The health of the Mars agent. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth? Health { get; set; } + /// The health errors. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] HealthError { get; set; } + /// The Mars agent Id. + string Id { get; set; } + /// The last heartbeat received from the Mars agent. + global::System.DateTime? LastHeartbeatUtc { get; set; } + /// The Mars agent name. + string Name { get; set; } + /// The version. + string Version { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MarsAgentDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MarsAgentDetails.json.cs new file mode 100644 index 000000000000..827c594a55fc --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MarsAgentDetails.json.cs @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Mars agent details. + public partial class MarsAgentDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMarsAgentDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMarsAgentDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMarsAgentDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new MarsAgentDetails(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal MarsAgentDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_id = If( json?.PropertyT("id"), out var __jsonId) ? (string)__jsonId : (string)Id;} + {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)Name;} + {_biosId = If( json?.PropertyT("biosId"), out var __jsonBiosId) ? (string)__jsonBiosId : (string)BiosId;} + {_fabricObjectId = If( json?.PropertyT("fabricObjectId"), out var __jsonFabricObjectId) ? (string)__jsonFabricObjectId : (string)FabricObjectId;} + {_fqdn = If( json?.PropertyT("fqdn"), out var __jsonFqdn) ? (string)__jsonFqdn : (string)Fqdn;} + {_version = If( json?.PropertyT("version"), out var __jsonVersion) ? (string)__jsonVersion : (string)Version;} + {_lastHeartbeatUtc = If( json?.PropertyT("lastHeartbeatUtc"), out var __jsonLastHeartbeatUtc) ? global::System.DateTime.TryParse((string)__jsonLastHeartbeatUtc, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonLastHeartbeatUtcValue) ? __jsonLastHeartbeatUtcValue : LastHeartbeatUtc : LastHeartbeatUtc;} + {_health = If( json?.PropertyT("health"), out var __jsonHealth) ? (string)__jsonHealth : (string)Health;} + {_healthError = If( json?.PropertyT("healthErrors"), out var __jsonHealthErrors) ? If( __jsonHealthErrors as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthError.FromJson(__u) )) ))() : null : HealthError;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._id)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._id.ToString()) : null, "id" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._biosId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._biosId.ToString()) : null, "biosId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._fabricObjectId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._fabricObjectId.ToString()) : null, "fabricObjectId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._fqdn)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._fqdn.ToString()) : null, "fqdn" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._version)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._version.ToString()) : null, "version" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._lastHeartbeatUtc ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._lastHeartbeatUtc?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "lastHeartbeatUtc" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._health)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._health.ToString()) : null, "health" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + if (null != this._healthError) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._healthError ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("healthErrors",__w); + } + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MasterTargetServer.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MasterTargetServer.PowerShell.cs new file mode 100644 index 000000000000..43db314c5e5c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MasterTargetServer.PowerShell.cs @@ -0,0 +1,328 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Details of a Master Target Server. + [System.ComponentModel.TypeConverter(typeof(MasterTargetServerTypeConverter))] + public partial class MasterTargetServer + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServer DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new MasterTargetServer(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServer DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new MasterTargetServer(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServer FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal MasterTargetServer(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("AgentVersionDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServerInternal)this).AgentVersionDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVersionDetails) content.GetValueForProperty("AgentVersionDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServerInternal)this).AgentVersionDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VersionDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("MarsAgentVersionDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServerInternal)this).MarsAgentVersionDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVersionDetails) content.GetValueForProperty("MarsAgentVersionDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServerInternal)this).MarsAgentVersionDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VersionDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServerInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServerInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("IPAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServerInternal)this).IPAddress = (string) content.GetValueForProperty("IPAddress",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServerInternal)this).IPAddress, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServerInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServerInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("OSType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServerInternal)this).OSType = (string) content.GetValueForProperty("OSType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServerInternal)this).OSType, global::System.Convert.ToString); + } + if (content.Contains("AgentVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServerInternal)this).AgentVersion = (string) content.GetValueForProperty("AgentVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServerInternal)this).AgentVersion, global::System.Convert.ToString); + } + if (content.Contains("LastHeartbeat")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServerInternal)this).LastHeartbeat = (global::System.DateTime?) content.GetValueForProperty("LastHeartbeat",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServerInternal)this).LastHeartbeat, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("VersionStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServerInternal)this).VersionStatus = (string) content.GetValueForProperty("VersionStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServerInternal)this).VersionStatus, global::System.Convert.ToString); + } + if (content.Contains("RetentionVolume")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServerInternal)this).RetentionVolume = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRetentionVolume[]) content.GetValueForProperty("RetentionVolume",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServerInternal)this).RetentionVolume, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RetentionVolumeTypeConverter.ConvertFrom)); + } + if (content.Contains("DataStore")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServerInternal)this).DataStore = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDataStore[]) content.GetValueForProperty("DataStore",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServerInternal)this).DataStore, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DataStoreTypeConverter.ConvertFrom)); + } + if (content.Contains("ValidationError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServerInternal)this).ValidationError = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[]) content.GetValueForProperty("ValidationError",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServerInternal)this).ValidationError, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("HealthError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServerInternal)this).HealthError = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[]) content.GetValueForProperty("HealthError",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServerInternal)this).HealthError, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("DiskCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServerInternal)this).DiskCount = (int?) content.GetValueForProperty("DiskCount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServerInternal)this).DiskCount, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("OSVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServerInternal)this).OSVersion = (string) content.GetValueForProperty("OSVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServerInternal)this).OSVersion, global::System.Convert.ToString); + } + if (content.Contains("AgentExpiryDate")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServerInternal)this).AgentExpiryDate = (global::System.DateTime?) content.GetValueForProperty("AgentExpiryDate",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServerInternal)this).AgentExpiryDate, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("MarsAgentVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServerInternal)this).MarsAgentVersion = (string) content.GetValueForProperty("MarsAgentVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServerInternal)this).MarsAgentVersion, global::System.Convert.ToString); + } + if (content.Contains("MarsAgentExpiryDate")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServerInternal)this).MarsAgentExpiryDate = (global::System.DateTime?) content.GetValueForProperty("MarsAgentExpiryDate",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServerInternal)this).MarsAgentExpiryDate, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("AgentVersionDetailVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServerInternal)this).AgentVersionDetailVersion = (string) content.GetValueForProperty("AgentVersionDetailVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServerInternal)this).AgentVersionDetailVersion, global::System.Convert.ToString); + } + if (content.Contains("AgentVersionDetailExpiryDate")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServerInternal)this).AgentVersionDetailExpiryDate = (global::System.DateTime?) content.GetValueForProperty("AgentVersionDetailExpiryDate",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServerInternal)this).AgentVersionDetailExpiryDate, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("AgentVersionDetailStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServerInternal)this).AgentVersionDetailStatus = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentVersionStatus?) content.GetValueForProperty("AgentVersionDetailStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServerInternal)this).AgentVersionDetailStatus, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentVersionStatus.CreateFrom); + } + if (content.Contains("MarAgentVersionDetailVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServerInternal)this).MarAgentVersionDetailVersion = (string) content.GetValueForProperty("MarAgentVersionDetailVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServerInternal)this).MarAgentVersionDetailVersion, global::System.Convert.ToString); + } + if (content.Contains("MarAgentVersionDetailExpiryDate")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServerInternal)this).MarAgentVersionDetailExpiryDate = (global::System.DateTime?) content.GetValueForProperty("MarAgentVersionDetailExpiryDate",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServerInternal)this).MarAgentVersionDetailExpiryDate, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("MarAgentVersionDetailStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServerInternal)this).MarAgentVersionDetailStatus = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentVersionStatus?) content.GetValueForProperty("MarAgentVersionDetailStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServerInternal)this).MarAgentVersionDetailStatus, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentVersionStatus.CreateFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal MasterTargetServer(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("AgentVersionDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServerInternal)this).AgentVersionDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVersionDetails) content.GetValueForProperty("AgentVersionDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServerInternal)this).AgentVersionDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VersionDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("MarsAgentVersionDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServerInternal)this).MarsAgentVersionDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVersionDetails) content.GetValueForProperty("MarsAgentVersionDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServerInternal)this).MarsAgentVersionDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VersionDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServerInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServerInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("IPAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServerInternal)this).IPAddress = (string) content.GetValueForProperty("IPAddress",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServerInternal)this).IPAddress, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServerInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServerInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("OSType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServerInternal)this).OSType = (string) content.GetValueForProperty("OSType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServerInternal)this).OSType, global::System.Convert.ToString); + } + if (content.Contains("AgentVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServerInternal)this).AgentVersion = (string) content.GetValueForProperty("AgentVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServerInternal)this).AgentVersion, global::System.Convert.ToString); + } + if (content.Contains("LastHeartbeat")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServerInternal)this).LastHeartbeat = (global::System.DateTime?) content.GetValueForProperty("LastHeartbeat",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServerInternal)this).LastHeartbeat, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("VersionStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServerInternal)this).VersionStatus = (string) content.GetValueForProperty("VersionStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServerInternal)this).VersionStatus, global::System.Convert.ToString); + } + if (content.Contains("RetentionVolume")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServerInternal)this).RetentionVolume = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRetentionVolume[]) content.GetValueForProperty("RetentionVolume",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServerInternal)this).RetentionVolume, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RetentionVolumeTypeConverter.ConvertFrom)); + } + if (content.Contains("DataStore")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServerInternal)this).DataStore = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDataStore[]) content.GetValueForProperty("DataStore",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServerInternal)this).DataStore, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DataStoreTypeConverter.ConvertFrom)); + } + if (content.Contains("ValidationError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServerInternal)this).ValidationError = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[]) content.GetValueForProperty("ValidationError",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServerInternal)this).ValidationError, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("HealthError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServerInternal)this).HealthError = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[]) content.GetValueForProperty("HealthError",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServerInternal)this).HealthError, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("DiskCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServerInternal)this).DiskCount = (int?) content.GetValueForProperty("DiskCount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServerInternal)this).DiskCount, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("OSVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServerInternal)this).OSVersion = (string) content.GetValueForProperty("OSVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServerInternal)this).OSVersion, global::System.Convert.ToString); + } + if (content.Contains("AgentExpiryDate")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServerInternal)this).AgentExpiryDate = (global::System.DateTime?) content.GetValueForProperty("AgentExpiryDate",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServerInternal)this).AgentExpiryDate, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("MarsAgentVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServerInternal)this).MarsAgentVersion = (string) content.GetValueForProperty("MarsAgentVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServerInternal)this).MarsAgentVersion, global::System.Convert.ToString); + } + if (content.Contains("MarsAgentExpiryDate")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServerInternal)this).MarsAgentExpiryDate = (global::System.DateTime?) content.GetValueForProperty("MarsAgentExpiryDate",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServerInternal)this).MarsAgentExpiryDate, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("AgentVersionDetailVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServerInternal)this).AgentVersionDetailVersion = (string) content.GetValueForProperty("AgentVersionDetailVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServerInternal)this).AgentVersionDetailVersion, global::System.Convert.ToString); + } + if (content.Contains("AgentVersionDetailExpiryDate")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServerInternal)this).AgentVersionDetailExpiryDate = (global::System.DateTime?) content.GetValueForProperty("AgentVersionDetailExpiryDate",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServerInternal)this).AgentVersionDetailExpiryDate, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("AgentVersionDetailStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServerInternal)this).AgentVersionDetailStatus = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentVersionStatus?) content.GetValueForProperty("AgentVersionDetailStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServerInternal)this).AgentVersionDetailStatus, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentVersionStatus.CreateFrom); + } + if (content.Contains("MarAgentVersionDetailVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServerInternal)this).MarAgentVersionDetailVersion = (string) content.GetValueForProperty("MarAgentVersionDetailVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServerInternal)this).MarAgentVersionDetailVersion, global::System.Convert.ToString); + } + if (content.Contains("MarAgentVersionDetailExpiryDate")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServerInternal)this).MarAgentVersionDetailExpiryDate = (global::System.DateTime?) content.GetValueForProperty("MarAgentVersionDetailExpiryDate",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServerInternal)this).MarAgentVersionDetailExpiryDate, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("MarAgentVersionDetailStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServerInternal)this).MarAgentVersionDetailStatus = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentVersionStatus?) content.GetValueForProperty("MarAgentVersionDetailStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServerInternal)this).MarAgentVersionDetailStatus, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentVersionStatus.CreateFrom); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Details of a Master Target Server. + [System.ComponentModel.TypeConverter(typeof(MasterTargetServerTypeConverter))] + public partial interface IMasterTargetServer + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MasterTargetServer.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MasterTargetServer.TypeConverter.cs new file mode 100644 index 000000000000..ceddb95c8f3e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MasterTargetServer.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class MasterTargetServerTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServer ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServer).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return MasterTargetServer.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return MasterTargetServer.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return MasterTargetServer.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MasterTargetServer.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MasterTargetServer.cs new file mode 100644 index 000000000000..d5bd370ec806 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MasterTargetServer.cs @@ -0,0 +1,414 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Details of a Master Target Server. + public partial class MasterTargetServer : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServer, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServerInternal + { + + /// Backing field for property. + private global::System.DateTime? _agentExpiryDate; + + /// Agent expiry date. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public global::System.DateTime? AgentExpiryDate { get => this._agentExpiryDate; set => this._agentExpiryDate = value; } + + /// Backing field for property. + private string _agentVersion; + + /// The version of the scout component on the server. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string AgentVersion { get => this._agentVersion; set => this._agentVersion = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVersionDetails _agentVersionDetail; + + /// Agent version details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVersionDetails AgentVersionDetail { get => (this._agentVersionDetail = this._agentVersionDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VersionDetails()); set => this._agentVersionDetail = value; } + + /// Version expiry date. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public global::System.DateTime? AgentVersionDetailExpiryDate { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVersionDetailsInternal)AgentVersionDetail).ExpiryDate; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVersionDetailsInternal)AgentVersionDetail).ExpiryDate = value ?? default(global::System.DateTime); } + + /// A value indicating whether security update required. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentVersionStatus? AgentVersionDetailStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVersionDetailsInternal)AgentVersionDetail).Status; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVersionDetailsInternal)AgentVersionDetail).Status = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentVersionStatus)""); } + + /// The agent version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string AgentVersionDetailVersion { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVersionDetailsInternal)AgentVersionDetail).Version; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVersionDetailsInternal)AgentVersionDetail).Version = value ?? null; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDataStore[] _dataStore; + + /// The list of data stores in the fabric. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDataStore[] DataStore { get => this._dataStore; set => this._dataStore = value; } + + /// Backing field for property. + private int? _diskCount; + + /// Disk count of the master target. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? DiskCount { get => this._diskCount; set => this._diskCount = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] _healthError; + + /// Health errors. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] HealthError { get => this._healthError; set => this._healthError = value; } + + /// Backing field for property. + private string _iPAddress; + + /// The IP address of the server. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string IPAddress { get => this._iPAddress; set => this._iPAddress = value; } + + /// Backing field for property. + private string _id; + + /// The server Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Id { get => this._id; set => this._id = value; } + + /// Backing field for property. + private global::System.DateTime? _lastHeartbeat; + + /// The last heartbeat received from the server. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public global::System.DateTime? LastHeartbeat { get => this._lastHeartbeat; set => this._lastHeartbeat = value; } + + /// Version expiry date. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public global::System.DateTime? MarAgentVersionDetailExpiryDate { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVersionDetailsInternal)MarsAgentVersionDetail).ExpiryDate; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVersionDetailsInternal)MarsAgentVersionDetail).ExpiryDate = value ?? default(global::System.DateTime); } + + /// A value indicating whether security update required. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentVersionStatus? MarAgentVersionDetailStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVersionDetailsInternal)MarsAgentVersionDetail).Status; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVersionDetailsInternal)MarsAgentVersionDetail).Status = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentVersionStatus)""); } + + /// The agent version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string MarAgentVersionDetailVersion { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVersionDetailsInternal)MarsAgentVersionDetail).Version; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVersionDetailsInternal)MarsAgentVersionDetail).Version = value ?? null; } + + /// Backing field for property. + private global::System.DateTime? _marsAgentExpiryDate; + + /// MARS agent expiry date. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public global::System.DateTime? MarsAgentExpiryDate { get => this._marsAgentExpiryDate; set => this._marsAgentExpiryDate = value; } + + /// Backing field for property. + private string _marsAgentVersion; + + /// MARS agent version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string MarsAgentVersion { get => this._marsAgentVersion; set => this._marsAgentVersion = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVersionDetails _marsAgentVersionDetail; + + /// Mars agent version details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVersionDetails MarsAgentVersionDetail { get => (this._marsAgentVersionDetail = this._marsAgentVersionDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VersionDetails()); set => this._marsAgentVersionDetail = value; } + + /// Internal Acessors for AgentVersionDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVersionDetails Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServerInternal.AgentVersionDetail { get => (this._agentVersionDetail = this._agentVersionDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VersionDetails()); set { {_agentVersionDetail = value;} } } + + /// Internal Acessors for MarsAgentVersionDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVersionDetails Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServerInternal.MarsAgentVersionDetail { get => (this._marsAgentVersionDetail = this._marsAgentVersionDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VersionDetails()); set { {_marsAgentVersionDetail = value;} } } + + /// Backing field for property. + private string _name; + + /// The server name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Name { get => this._name; set => this._name = value; } + + /// Backing field for property. + private string _oSType; + + /// The OS type of the server. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string OSType { get => this._oSType; set => this._oSType = value; } + + /// Backing field for property. + private string _oSVersion; + + /// OS Version of the master target. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string OSVersion { get => this._oSVersion; set => this._oSVersion = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRetentionVolume[] _retentionVolume; + + /// The retention volumes of Master target Server. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRetentionVolume[] RetentionVolume { get => this._retentionVolume; set => this._retentionVolume = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] _validationError; + + /// Validation errors. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] ValidationError { get => this._validationError; set => this._validationError = value; } + + /// Backing field for property. + private string _versionStatus; + + /// Version status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string VersionStatus { get => this._versionStatus; set => this._versionStatus = value; } + + /// Creates an new instance. + public MasterTargetServer() + { + + } + } + /// Details of a Master Target Server. + public partial interface IMasterTargetServer : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// Agent expiry date. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Agent expiry date.", + SerializedName = @"agentExpiryDate", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? AgentExpiryDate { get; set; } + /// The version of the scout component on the server. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The version of the scout component on the server.", + SerializedName = @"agentVersion", + PossibleTypes = new [] { typeof(string) })] + string AgentVersion { get; set; } + /// Version expiry date. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Version expiry date.", + SerializedName = @"expiryDate", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? AgentVersionDetailExpiryDate { get; set; } + /// A value indicating whether security update required. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether security update required.", + SerializedName = @"status", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentVersionStatus) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentVersionStatus? AgentVersionDetailStatus { get; set; } + /// The agent version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The agent version.", + SerializedName = @"version", + PossibleTypes = new [] { typeof(string) })] + string AgentVersionDetailVersion { get; set; } + /// The list of data stores in the fabric. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of data stores in the fabric.", + SerializedName = @"dataStores", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDataStore) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDataStore[] DataStore { get; set; } + /// Disk count of the master target. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Disk count of the master target.", + SerializedName = @"diskCount", + PossibleTypes = new [] { typeof(int) })] + int? DiskCount { get; set; } + /// Health errors. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Health errors.", + SerializedName = @"healthErrors", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] HealthError { get; set; } + /// The IP address of the server. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The IP address of the server.", + SerializedName = @"ipAddress", + PossibleTypes = new [] { typeof(string) })] + string IPAddress { get; set; } + /// The server Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The server Id.", + SerializedName = @"id", + PossibleTypes = new [] { typeof(string) })] + string Id { get; set; } + /// The last heartbeat received from the server. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The last heartbeat received from the server.", + SerializedName = @"lastHeartbeat", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? LastHeartbeat { get; set; } + /// Version expiry date. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Version expiry date.", + SerializedName = @"expiryDate", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? MarAgentVersionDetailExpiryDate { get; set; } + /// A value indicating whether security update required. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether security update required.", + SerializedName = @"status", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentVersionStatus) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentVersionStatus? MarAgentVersionDetailStatus { get; set; } + /// The agent version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The agent version.", + SerializedName = @"version", + PossibleTypes = new [] { typeof(string) })] + string MarAgentVersionDetailVersion { get; set; } + /// MARS agent expiry date. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"MARS agent expiry date.", + SerializedName = @"marsAgentExpiryDate", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? MarsAgentExpiryDate { get; set; } + /// MARS agent version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"MARS agent version.", + SerializedName = @"marsAgentVersion", + PossibleTypes = new [] { typeof(string) })] + string MarsAgentVersion { get; set; } + /// The server name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The server name.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string Name { get; set; } + /// The OS type of the server. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The OS type of the server.", + SerializedName = @"osType", + PossibleTypes = new [] { typeof(string) })] + string OSType { get; set; } + /// OS Version of the master target. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"OS Version of the master target.", + SerializedName = @"osVersion", + PossibleTypes = new [] { typeof(string) })] + string OSVersion { get; set; } + /// The retention volumes of Master target Server. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The retention volumes of Master target Server.", + SerializedName = @"retentionVolumes", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRetentionVolume) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRetentionVolume[] RetentionVolume { get; set; } + /// Validation errors. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Validation errors.", + SerializedName = @"validationErrors", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] ValidationError { get; set; } + /// Version status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Version status.", + SerializedName = @"versionStatus", + PossibleTypes = new [] { typeof(string) })] + string VersionStatus { get; set; } + + } + /// Details of a Master Target Server. + internal partial interface IMasterTargetServerInternal + + { + /// Agent expiry date. + global::System.DateTime? AgentExpiryDate { get; set; } + /// The version of the scout component on the server. + string AgentVersion { get; set; } + /// Agent version details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVersionDetails AgentVersionDetail { get; set; } + /// Version expiry date. + global::System.DateTime? AgentVersionDetailExpiryDate { get; set; } + /// A value indicating whether security update required. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentVersionStatus? AgentVersionDetailStatus { get; set; } + /// The agent version. + string AgentVersionDetailVersion { get; set; } + /// The list of data stores in the fabric. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDataStore[] DataStore { get; set; } + /// Disk count of the master target. + int? DiskCount { get; set; } + /// Health errors. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] HealthError { get; set; } + /// The IP address of the server. + string IPAddress { get; set; } + /// The server Id. + string Id { get; set; } + /// The last heartbeat received from the server. + global::System.DateTime? LastHeartbeat { get; set; } + /// Version expiry date. + global::System.DateTime? MarAgentVersionDetailExpiryDate { get; set; } + /// A value indicating whether security update required. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentVersionStatus? MarAgentVersionDetailStatus { get; set; } + /// The agent version. + string MarAgentVersionDetailVersion { get; set; } + /// MARS agent expiry date. + global::System.DateTime? MarsAgentExpiryDate { get; set; } + /// MARS agent version. + string MarsAgentVersion { get; set; } + /// Mars agent version details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVersionDetails MarsAgentVersionDetail { get; set; } + /// The server name. + string Name { get; set; } + /// The OS type of the server. + string OSType { get; set; } + /// OS Version of the master target. + string OSVersion { get; set; } + /// The retention volumes of Master target Server. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRetentionVolume[] RetentionVolume { get; set; } + /// Validation errors. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] ValidationError { get; set; } + /// Version status. + string VersionStatus { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MasterTargetServer.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MasterTargetServer.json.cs new file mode 100644 index 000000000000..fc24f036cf69 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MasterTargetServer.json.cs @@ -0,0 +1,174 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Details of a Master Target Server. + public partial class MasterTargetServer + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServer. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServer. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServer FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new MasterTargetServer(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal MasterTargetServer(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_agentVersionDetail = If( json?.PropertyT("agentVersionDetails"), out var __jsonAgentVersionDetails) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VersionDetails.FromJson(__jsonAgentVersionDetails) : AgentVersionDetail;} + {_marsAgentVersionDetail = If( json?.PropertyT("marsAgentVersionDetails"), out var __jsonMarsAgentVersionDetails) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VersionDetails.FromJson(__jsonMarsAgentVersionDetails) : MarsAgentVersionDetail;} + {_id = If( json?.PropertyT("id"), out var __jsonId) ? (string)__jsonId : (string)Id;} + {_iPAddress = If( json?.PropertyT("ipAddress"), out var __jsonIPAddress) ? (string)__jsonIPAddress : (string)IPAddress;} + {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)Name;} + {_oSType = If( json?.PropertyT("osType"), out var __jsonOSType) ? (string)__jsonOSType : (string)OSType;} + {_agentVersion = If( json?.PropertyT("agentVersion"), out var __jsonAgentVersion) ? (string)__jsonAgentVersion : (string)AgentVersion;} + {_lastHeartbeat = If( json?.PropertyT("lastHeartbeat"), out var __jsonLastHeartbeat) ? global::System.DateTime.TryParse((string)__jsonLastHeartbeat, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonLastHeartbeatValue) ? __jsonLastHeartbeatValue : LastHeartbeat : LastHeartbeat;} + {_versionStatus = If( json?.PropertyT("versionStatus"), out var __jsonVersionStatus) ? (string)__jsonVersionStatus : (string)VersionStatus;} + {_retentionVolume = If( json?.PropertyT("retentionVolumes"), out var __jsonRetentionVolumes) ? If( __jsonRetentionVolumes as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRetentionVolume) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RetentionVolume.FromJson(__u) )) ))() : null : RetentionVolume;} + {_dataStore = If( json?.PropertyT("dataStores"), out var __jsonDataStores) ? If( __jsonDataStores as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __q) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__q, (__p)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDataStore) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DataStore.FromJson(__p) )) ))() : null : DataStore;} + {_validationError = If( json?.PropertyT("validationErrors"), out var __jsonValidationErrors) ? If( __jsonValidationErrors as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __l) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__l, (__k)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthError.FromJson(__k) )) ))() : null : ValidationError;} + {_healthError = If( json?.PropertyT("healthErrors"), out var __jsonHealthErrors) ? If( __jsonHealthErrors as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __g) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__g, (__f)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthError.FromJson(__f) )) ))() : null : HealthError;} + {_diskCount = If( json?.PropertyT("diskCount"), out var __jsonDiskCount) ? (int?)__jsonDiskCount : DiskCount;} + {_oSVersion = If( json?.PropertyT("osVersion"), out var __jsonOSVersion) ? (string)__jsonOSVersion : (string)OSVersion;} + {_agentExpiryDate = If( json?.PropertyT("agentExpiryDate"), out var __jsonAgentExpiryDate) ? global::System.DateTime.TryParse((string)__jsonAgentExpiryDate, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonAgentExpiryDateValue) ? __jsonAgentExpiryDateValue : AgentExpiryDate : AgentExpiryDate;} + {_marsAgentVersion = If( json?.PropertyT("marsAgentVersion"), out var __jsonMarsAgentVersion) ? (string)__jsonMarsAgentVersion : (string)MarsAgentVersion;} + {_marsAgentExpiryDate = If( json?.PropertyT("marsAgentExpiryDate"), out var __jsonMarsAgentExpiryDate) ? global::System.DateTime.TryParse((string)__jsonMarsAgentExpiryDate, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonMarsAgentExpiryDateValue) ? __jsonMarsAgentExpiryDateValue : MarsAgentExpiryDate : MarsAgentExpiryDate;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._agentVersionDetail ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._agentVersionDetail.ToJson(null,serializationMode) : null, "agentVersionDetails" ,container.Add ); + AddIf( null != this._marsAgentVersionDetail ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._marsAgentVersionDetail.ToJson(null,serializationMode) : null, "marsAgentVersionDetails" ,container.Add ); + AddIf( null != (((object)this._id)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._id.ToString()) : null, "id" ,container.Add ); + AddIf( null != (((object)this._iPAddress)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._iPAddress.ToString()) : null, "ipAddress" ,container.Add ); + AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); + AddIf( null != (((object)this._oSType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._oSType.ToString()) : null, "osType" ,container.Add ); + AddIf( null != (((object)this._agentVersion)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._agentVersion.ToString()) : null, "agentVersion" ,container.Add ); + AddIf( null != this._lastHeartbeat ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._lastHeartbeat?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "lastHeartbeat" ,container.Add ); + AddIf( null != (((object)this._versionStatus)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._versionStatus.ToString()) : null, "versionStatus" ,container.Add ); + if (null != this._retentionVolume) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._retentionVolume ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("retentionVolumes",__w); + } + if (null != this._dataStore) + { + var __r = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __s in this._dataStore ) + { + AddIf(__s?.ToJson(null, serializationMode) ,__r.Add); + } + container.Add("dataStores",__r); + } + if (null != this._validationError) + { + var __m = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __n in this._validationError ) + { + AddIf(__n?.ToJson(null, serializationMode) ,__m.Add); + } + container.Add("validationErrors",__m); + } + if (null != this._healthError) + { + var __h = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __i in this._healthError ) + { + AddIf(__i?.ToJson(null, serializationMode) ,__h.Add); + } + container.Add("healthErrors",__h); + } + AddIf( null != this._diskCount ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._diskCount) : null, "diskCount" ,container.Add ); + AddIf( null != (((object)this._oSVersion)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._oSVersion.ToString()) : null, "osVersion" ,container.Add ); + AddIf( null != this._agentExpiryDate ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._agentExpiryDate?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "agentExpiryDate" ,container.Add ); + AddIf( null != (((object)this._marsAgentVersion)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._marsAgentVersion.ToString()) : null, "marsAgentVersion" ,container.Add ); + AddIf( null != this._marsAgentExpiryDate ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._marsAgentExpiryDate?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "marsAgentExpiryDate" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrateInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrateInput.PowerShell.cs new file mode 100644 index 000000000000..44e53fa42985 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrateInput.PowerShell.cs @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Input for migrate. + [System.ComponentModel.TypeConverter(typeof(MigrateInputTypeConverter))] + public partial class MigrateInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new MigrateInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new MigrateInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal MigrateInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateInputInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateInputProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateInputInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.MigrateInputPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateInputInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateProviderSpecificInput) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateInputInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.MigrateProviderSpecificInputTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateInputInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateInputInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal MigrateInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateInputInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateInputProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateInputInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.MigrateInputPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateInputInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateProviderSpecificInput) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateInputInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.MigrateProviderSpecificInputTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateInputInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateInputInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Input for migrate. + [System.ComponentModel.TypeConverter(typeof(MigrateInputTypeConverter))] + public partial interface IMigrateInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrateInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrateInput.TypeConverter.cs new file mode 100644 index 000000000000..8a5172d8ba59 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrateInput.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class MigrateInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return MigrateInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return MigrateInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return MigrateInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrateInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrateInput.cs new file mode 100644 index 000000000000..8b31ebce8ef2 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrateInput.cs @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Input for migrate. + public partial class MigrateInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateInputInternal + { + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateInputProperties Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateInputInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.MigrateInputProperties()); set { {_property = value;} } } + + /// Internal Acessors for ProviderSpecificDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateProviderSpecificInput Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateInputInternal.ProviderSpecificDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateInputPropertiesInternal)Property).ProviderSpecificDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateInputPropertiesInternal)Property).ProviderSpecificDetail = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateInputProperties _property; + + /// Migrate input properties. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateInputProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.MigrateInputProperties()); set => this._property = value; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ProviderSpecificDetailInstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateInputPropertiesInternal)Property).ProviderSpecificDetailInstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateInputPropertiesInternal)Property).ProviderSpecificDetailInstanceType = value ; } + + /// Creates an new instance. + public MigrateInput() + { + + } + } + /// Input for migrate. + public partial interface IMigrateInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string ProviderSpecificDetailInstanceType { get; set; } + + } + /// Input for migrate. + internal partial interface IMigrateInputInternal + + { + /// Migrate input properties. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateInputProperties Property { get; set; } + /// The provider specific details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateProviderSpecificInput ProviderSpecificDetail { get; set; } + /// The class type. + string ProviderSpecificDetailInstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrateInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrateInput.json.cs new file mode 100644 index 000000000000..8758f657b318 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrateInput.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Input for migrate. + public partial class MigrateInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new MigrateInput(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal MigrateInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.MigrateInputProperties.FromJson(__jsonProperties) : Property;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrateInputProperties.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrateInputProperties.PowerShell.cs new file mode 100644 index 000000000000..0699575a9bd3 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrateInputProperties.PowerShell.cs @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Migrate input properties. + [System.ComponentModel.TypeConverter(typeof(MigrateInputPropertiesTypeConverter))] + public partial class MigrateInputProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateInputProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new MigrateInputProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateInputProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new MigrateInputProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateInputProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal MigrateInputProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateInputPropertiesInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateProviderSpecificInput) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateInputPropertiesInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.MigrateProviderSpecificInputTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateInputPropertiesInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateInputPropertiesInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal MigrateInputProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateInputPropertiesInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateProviderSpecificInput) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateInputPropertiesInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.MigrateProviderSpecificInputTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateInputPropertiesInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateInputPropertiesInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Migrate input properties. + [System.ComponentModel.TypeConverter(typeof(MigrateInputPropertiesTypeConverter))] + public partial interface IMigrateInputProperties + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrateInputProperties.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrateInputProperties.TypeConverter.cs new file mode 100644 index 000000000000..13306c5be7d8 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrateInputProperties.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class MigrateInputPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateInputProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateInputProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return MigrateInputProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return MigrateInputProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return MigrateInputProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrateInputProperties.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrateInputProperties.cs new file mode 100644 index 000000000000..768c82f9cb01 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrateInputProperties.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Migrate input properties. + public partial class MigrateInputProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateInputProperties, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateInputPropertiesInternal + { + + /// Internal Acessors for ProviderSpecificDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateProviderSpecificInput Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateInputPropertiesInternal.ProviderSpecificDetail { get => (this._providerSpecificDetail = this._providerSpecificDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.MigrateProviderSpecificInput()); set { {_providerSpecificDetail = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateProviderSpecificInput _providerSpecificDetail; + + /// The provider specific details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateProviderSpecificInput ProviderSpecificDetail { get => (this._providerSpecificDetail = this._providerSpecificDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.MigrateProviderSpecificInput()); set => this._providerSpecificDetail = value; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ProviderSpecificDetailInstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateProviderSpecificInputInternal)ProviderSpecificDetail).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateProviderSpecificInputInternal)ProviderSpecificDetail).InstanceType = value ; } + + /// Creates an new instance. + public MigrateInputProperties() + { + + } + } + /// Migrate input properties. + public partial interface IMigrateInputProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string ProviderSpecificDetailInstanceType { get; set; } + + } + /// Migrate input properties. + internal partial interface IMigrateInputPropertiesInternal + + { + /// The provider specific details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateProviderSpecificInput ProviderSpecificDetail { get; set; } + /// The class type. + string ProviderSpecificDetailInstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrateInputProperties.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrateInputProperties.json.cs new file mode 100644 index 000000000000..6ef0255e35b4 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrateInputProperties.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Migrate input properties. + public partial class MigrateInputProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateInputProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateInputProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateInputProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new MigrateInputProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal MigrateInputProperties(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_providerSpecificDetail = If( json?.PropertyT("providerSpecificDetails"), out var __jsonProviderSpecificDetails) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.MigrateProviderSpecificInput.FromJson(__jsonProviderSpecificDetails) : ProviderSpecificDetail;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._providerSpecificDetail ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._providerSpecificDetail.ToJson(null,serializationMode) : null, "providerSpecificDetails" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrateProviderSpecificInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrateProviderSpecificInput.PowerShell.cs new file mode 100644 index 000000000000..6eafe7ed4539 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrateProviderSpecificInput.PowerShell.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Migrate provider specific input. + [System.ComponentModel.TypeConverter(typeof(MigrateProviderSpecificInputTypeConverter))] + public partial class MigrateProviderSpecificInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateProviderSpecificInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new MigrateProviderSpecificInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateProviderSpecificInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new MigrateProviderSpecificInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateProviderSpecificInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal MigrateProviderSpecificInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal MigrateProviderSpecificInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Migrate provider specific input. + [System.ComponentModel.TypeConverter(typeof(MigrateProviderSpecificInputTypeConverter))] + public partial interface IMigrateProviderSpecificInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrateProviderSpecificInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrateProviderSpecificInput.TypeConverter.cs new file mode 100644 index 000000000000..70b9038e859b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrateProviderSpecificInput.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class MigrateProviderSpecificInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateProviderSpecificInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateProviderSpecificInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return MigrateProviderSpecificInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return MigrateProviderSpecificInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return MigrateProviderSpecificInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrateProviderSpecificInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrateProviderSpecificInput.cs new file mode 100644 index 000000000000..c7d2a8e646d1 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrateProviderSpecificInput.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Migrate provider specific input. + public partial class MigrateProviderSpecificInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateProviderSpecificInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateProviderSpecificInputInternal + { + + /// Backing field for property. + private string _instanceType; + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string InstanceType { get => this._instanceType; set => this._instanceType = value; } + + /// Creates an new instance. + public MigrateProviderSpecificInput() + { + + } + } + /// Migrate provider specific input. + public partial interface IMigrateProviderSpecificInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string InstanceType { get; set; } + + } + /// Migrate provider specific input. + internal partial interface IMigrateProviderSpecificInputInternal + + { + /// The class type. + string InstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrateProviderSpecificInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrateProviderSpecificInput.json.cs new file mode 100644 index 000000000000..1b13614cc7fd --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrateProviderSpecificInput.json.cs @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Migrate provider specific input. + public partial class MigrateProviderSpecificInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateProviderSpecificInput. + /// Note: the Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateProviderSpecificInput interface is + /// polymorphic, and the precise model class that will get deserialized is determined at runtime based on the payload. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateProviderSpecificInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateProviderSpecificInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + if (!(node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json)) + { + return null; + } + // Polymorphic type -- select the appropriate constructor using the discriminator + + switch ( json.StringProperty("instanceType") ) + { + case "VMwareCbt": + { + return new VMwareCbtMigrateInput(json); + } + } + return new MigrateProviderSpecificInput(json); + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal MigrateProviderSpecificInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_instanceType = If( json?.PropertyT("instanceType"), out var __jsonInstanceType) ? (string)__jsonInstanceType : (string)InstanceType;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._instanceType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._instanceType.ToString()) : null, "instanceType" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrationItem.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrationItem.PowerShell.cs new file mode 100644 index 000000000000..b65235447f62 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrationItem.PowerShell.cs @@ -0,0 +1,368 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Migration item. + [System.ComponentModel.TypeConverter(typeof(MigrationItemTypeConverter))] + public partial class MigrationItem + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new MigrationItem(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new MigrationItem(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal MigrationItem(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.MigrationItemPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("MigrationState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal)this).MigrationState = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationState?) content.GetValueForProperty("MigrationState",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal)this).MigrationState, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationState.CreateFrom); + } + if (content.Contains("CurrentJob")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal)this).CurrentJob = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICurrentJobDetails) content.GetValueForProperty("CurrentJob",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal)this).CurrentJob, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.CurrentJobDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationProviderSpecificSettings) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.MigrationProviderSpecificSettingsTypeConverter.ConvertFrom); + } + if (content.Contains("MachineName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal)this).MachineName = (string) content.GetValueForProperty("MachineName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal)this).MachineName, global::System.Convert.ToString); + } + if (content.Contains("PolicyId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal)this).PolicyId = (string) content.GetValueForProperty("PolicyId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal)this).PolicyId, global::System.Convert.ToString); + } + if (content.Contains("PolicyFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal)this).PolicyFriendlyName = (string) content.GetValueForProperty("PolicyFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal)this).PolicyFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("RecoveryServicesProviderId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal)this).RecoveryServicesProviderId = (string) content.GetValueForProperty("RecoveryServicesProviderId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal)this).RecoveryServicesProviderId, global::System.Convert.ToString); + } + if (content.Contains("ReplicationStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal)this).ReplicationStatus = (string) content.GetValueForProperty("ReplicationStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal)this).ReplicationStatus, global::System.Convert.ToString); + } + if (content.Contains("MigrationStateDescription")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal)this).MigrationStateDescription = (string) content.GetValueForProperty("MigrationStateDescription",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal)this).MigrationStateDescription, global::System.Convert.ToString); + } + if (content.Contains("LastTestMigrationTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal)this).LastTestMigrationTime = (global::System.DateTime?) content.GetValueForProperty("LastTestMigrationTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal)this).LastTestMigrationTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("LastTestMigrationStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal)this).LastTestMigrationStatus = (string) content.GetValueForProperty("LastTestMigrationStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal)this).LastTestMigrationStatus, global::System.Convert.ToString); + } + if (content.Contains("LastMigrationTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal)this).LastMigrationTime = (global::System.DateTime?) content.GetValueForProperty("LastMigrationTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal)this).LastMigrationTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("LastMigrationStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal)this).LastMigrationStatus = (string) content.GetValueForProperty("LastMigrationStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal)this).LastMigrationStatus, global::System.Convert.ToString); + } + if (content.Contains("TestMigrateState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal)this).TestMigrateState = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.TestMigrationState?) content.GetValueForProperty("TestMigrateState",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal)this).TestMigrateState, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.TestMigrationState.CreateFrom); + } + if (content.Contains("TestMigrateStateDescription")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal)this).TestMigrateStateDescription = (string) content.GetValueForProperty("TestMigrateStateDescription",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal)this).TestMigrateStateDescription, global::System.Convert.ToString); + } + if (content.Contains("Health")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal)this).Health = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth?) content.GetValueForProperty("Health",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal)this).Health, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth.CreateFrom); + } + if (content.Contains("HealthError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal)this).HealthError = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[]) content.GetValueForProperty("HealthError",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal)this).HealthError, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("AllowedOperation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal)this).AllowedOperation = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationItemOperation[]) content.GetValueForProperty("AllowedOperation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal)this).AllowedOperation, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationItemOperation.CreateFrom)); + } + if (content.Contains("CriticalJobHistory")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal)this).CriticalJobHistory = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICriticalJobHistoryDetails[]) content.GetValueForProperty("CriticalJobHistory",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal)this).CriticalJobHistory, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.CriticalJobHistoryDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("EventCorrelationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal)this).EventCorrelationId = (string) content.GetValueForProperty("EventCorrelationId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal)this).EventCorrelationId, global::System.Convert.ToString); + } + if (content.Contains("CurrentJobName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal)this).CurrentJobName = (string) content.GetValueForProperty("CurrentJobName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal)this).CurrentJobName, global::System.Convert.ToString); + } + if (content.Contains("CurrentJobId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal)this).CurrentJobId = (string) content.GetValueForProperty("CurrentJobId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal)this).CurrentJobId, global::System.Convert.ToString); + } + if (content.Contains("CurrentJobStartTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal)this).CurrentJobStartTime = (global::System.DateTime?) content.GetValueForProperty("CurrentJobStartTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal)this).CurrentJobStartTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal MigrationItem(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.MigrationItemPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("MigrationState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal)this).MigrationState = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationState?) content.GetValueForProperty("MigrationState",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal)this).MigrationState, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationState.CreateFrom); + } + if (content.Contains("CurrentJob")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal)this).CurrentJob = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICurrentJobDetails) content.GetValueForProperty("CurrentJob",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal)this).CurrentJob, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.CurrentJobDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationProviderSpecificSettings) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.MigrationProviderSpecificSettingsTypeConverter.ConvertFrom); + } + if (content.Contains("MachineName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal)this).MachineName = (string) content.GetValueForProperty("MachineName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal)this).MachineName, global::System.Convert.ToString); + } + if (content.Contains("PolicyId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal)this).PolicyId = (string) content.GetValueForProperty("PolicyId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal)this).PolicyId, global::System.Convert.ToString); + } + if (content.Contains("PolicyFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal)this).PolicyFriendlyName = (string) content.GetValueForProperty("PolicyFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal)this).PolicyFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("RecoveryServicesProviderId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal)this).RecoveryServicesProviderId = (string) content.GetValueForProperty("RecoveryServicesProviderId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal)this).RecoveryServicesProviderId, global::System.Convert.ToString); + } + if (content.Contains("ReplicationStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal)this).ReplicationStatus = (string) content.GetValueForProperty("ReplicationStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal)this).ReplicationStatus, global::System.Convert.ToString); + } + if (content.Contains("MigrationStateDescription")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal)this).MigrationStateDescription = (string) content.GetValueForProperty("MigrationStateDescription",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal)this).MigrationStateDescription, global::System.Convert.ToString); + } + if (content.Contains("LastTestMigrationTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal)this).LastTestMigrationTime = (global::System.DateTime?) content.GetValueForProperty("LastTestMigrationTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal)this).LastTestMigrationTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("LastTestMigrationStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal)this).LastTestMigrationStatus = (string) content.GetValueForProperty("LastTestMigrationStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal)this).LastTestMigrationStatus, global::System.Convert.ToString); + } + if (content.Contains("LastMigrationTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal)this).LastMigrationTime = (global::System.DateTime?) content.GetValueForProperty("LastMigrationTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal)this).LastMigrationTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("LastMigrationStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal)this).LastMigrationStatus = (string) content.GetValueForProperty("LastMigrationStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal)this).LastMigrationStatus, global::System.Convert.ToString); + } + if (content.Contains("TestMigrateState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal)this).TestMigrateState = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.TestMigrationState?) content.GetValueForProperty("TestMigrateState",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal)this).TestMigrateState, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.TestMigrationState.CreateFrom); + } + if (content.Contains("TestMigrateStateDescription")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal)this).TestMigrateStateDescription = (string) content.GetValueForProperty("TestMigrateStateDescription",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal)this).TestMigrateStateDescription, global::System.Convert.ToString); + } + if (content.Contains("Health")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal)this).Health = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth?) content.GetValueForProperty("Health",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal)this).Health, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth.CreateFrom); + } + if (content.Contains("HealthError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal)this).HealthError = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[]) content.GetValueForProperty("HealthError",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal)this).HealthError, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("AllowedOperation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal)this).AllowedOperation = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationItemOperation[]) content.GetValueForProperty("AllowedOperation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal)this).AllowedOperation, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationItemOperation.CreateFrom)); + } + if (content.Contains("CriticalJobHistory")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal)this).CriticalJobHistory = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICriticalJobHistoryDetails[]) content.GetValueForProperty("CriticalJobHistory",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal)this).CriticalJobHistory, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.CriticalJobHistoryDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("EventCorrelationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal)this).EventCorrelationId = (string) content.GetValueForProperty("EventCorrelationId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal)this).EventCorrelationId, global::System.Convert.ToString); + } + if (content.Contains("CurrentJobName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal)this).CurrentJobName = (string) content.GetValueForProperty("CurrentJobName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal)this).CurrentJobName, global::System.Convert.ToString); + } + if (content.Contains("CurrentJobId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal)this).CurrentJobId = (string) content.GetValueForProperty("CurrentJobId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal)this).CurrentJobId, global::System.Convert.ToString); + } + if (content.Contains("CurrentJobStartTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal)this).CurrentJobStartTime = (global::System.DateTime?) content.GetValueForProperty("CurrentJobStartTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal)this).CurrentJobStartTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Migration item. + [System.ComponentModel.TypeConverter(typeof(MigrationItemTypeConverter))] + public partial interface IMigrationItem + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrationItem.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrationItem.TypeConverter.cs new file mode 100644 index 000000000000..78487a9f5b72 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrationItem.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class MigrationItemTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return MigrationItem.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return MigrationItem.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return MigrationItem.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrationItem.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrationItem.cs new file mode 100644 index 000000000000..2a7bf1e5707b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrationItem.cs @@ -0,0 +1,477 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Migration item. + public partial class MigrationItem : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResource __resource = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.Resource(); + + /// + /// The allowed operations on the migration item based on the current migration state of the item. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationItemOperation[] AllowedOperation { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)Property).AllowedOperation; } + + /// The critical past job details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICriticalJobHistoryDetails[] CriticalJobHistory { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)Property).CriticalJobHistory; } + + /// The ARM Id of the job being executed. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string CurrentJobId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)Property).CurrentJobId; } + + /// The job name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string CurrentJobName { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)Property).CurrentJobName; } + + /// The start time of the job. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public global::System.DateTime? CurrentJobStartTime { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)Property).CurrentJobStartTime; } + + /// The correlation Id for events associated with this migration item. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string EventCorrelationId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)Property).EventCorrelationId; } + + /// The consolidated health. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth? Health { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)Property).Health; } + + /// The list of health errors. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] HealthError { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)Property).HealthError; } + + /// Resource Id + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Id; } + + /// The status of the last migration. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string LastMigrationStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)Property).LastMigrationStatus; } + + /// The last migration time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public global::System.DateTime? LastMigrationTime { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)Property).LastMigrationTime; } + + /// The status of the last test migration. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string LastTestMigrationStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)Property).LastTestMigrationStatus; } + + /// The last test migration time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public global::System.DateTime? LastTestMigrationTime { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)Property).LastTestMigrationTime; } + + /// Resource Location + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string Location { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Location; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Location = value ?? null; } + + /// The on-premise virtual machine name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string MachineName { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)Property).MachineName; } + + /// Internal Acessors for AllowedOperation + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationItemOperation[] Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal.AllowedOperation { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)Property).AllowedOperation; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)Property).AllowedOperation = value; } + + /// Internal Acessors for CriticalJobHistory + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICriticalJobHistoryDetails[] Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal.CriticalJobHistory { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)Property).CriticalJobHistory; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)Property).CriticalJobHistory = value; } + + /// Internal Acessors for CurrentJob + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICurrentJobDetails Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal.CurrentJob { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)Property).CurrentJob; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)Property).CurrentJob = value; } + + /// Internal Acessors for CurrentJobId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal.CurrentJobId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)Property).CurrentJobId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)Property).CurrentJobId = value; } + + /// Internal Acessors for CurrentJobName + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal.CurrentJobName { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)Property).CurrentJobName; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)Property).CurrentJobName = value; } + + /// Internal Acessors for CurrentJobStartTime + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal.CurrentJobStartTime { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)Property).CurrentJobStartTime; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)Property).CurrentJobStartTime = value; } + + /// Internal Acessors for EventCorrelationId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal.EventCorrelationId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)Property).EventCorrelationId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)Property).EventCorrelationId = value; } + + /// Internal Acessors for Health + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal.Health { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)Property).Health; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)Property).Health = value; } + + /// Internal Acessors for HealthError + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal.HealthError { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)Property).HealthError; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)Property).HealthError = value; } + + /// Internal Acessors for LastMigrationStatus + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal.LastMigrationStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)Property).LastMigrationStatus; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)Property).LastMigrationStatus = value; } + + /// Internal Acessors for LastMigrationTime + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal.LastMigrationTime { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)Property).LastMigrationTime; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)Property).LastMigrationTime = value; } + + /// Internal Acessors for LastTestMigrationStatus + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal.LastTestMigrationStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)Property).LastTestMigrationStatus; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)Property).LastTestMigrationStatus = value; } + + /// Internal Acessors for LastTestMigrationTime + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal.LastTestMigrationTime { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)Property).LastTestMigrationTime; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)Property).LastTestMigrationTime = value; } + + /// Internal Acessors for MachineName + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal.MachineName { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)Property).MachineName; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)Property).MachineName = value; } + + /// Internal Acessors for MigrationState + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationState? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal.MigrationState { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)Property).MigrationState; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)Property).MigrationState = value; } + + /// Internal Acessors for MigrationStateDescription + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal.MigrationStateDescription { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)Property).MigrationStateDescription; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)Property).MigrationStateDescription = value; } + + /// Internal Acessors for PolicyFriendlyName + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal.PolicyFriendlyName { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)Property).PolicyFriendlyName; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)Property).PolicyFriendlyName = value; } + + /// Internal Acessors for PolicyId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal.PolicyId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)Property).PolicyId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)Property).PolicyId = value; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemProperties Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.MigrationItemProperties()); set { {_property = value;} } } + + /// Internal Acessors for ProviderSpecificDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationProviderSpecificSettings Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal.ProviderSpecificDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)Property).ProviderSpecificDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)Property).ProviderSpecificDetail = value; } + + /// Internal Acessors for RecoveryServicesProviderId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal.RecoveryServicesProviderId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)Property).RecoveryServicesProviderId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)Property).RecoveryServicesProviderId = value; } + + /// Internal Acessors for ReplicationStatus + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal.ReplicationStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)Property).ReplicationStatus; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)Property).ReplicationStatus = value; } + + /// Internal Acessors for TestMigrateState + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.TestMigrationState? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal.TestMigrateState { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)Property).TestMigrateState; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)Property).TestMigrateState = value; } + + /// Internal Acessors for TestMigrateStateDescription + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemInternal.TestMigrateStateDescription { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)Property).TestMigrateStateDescription; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)Property).TestMigrateStateDescription = value; } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Id = value; } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Name = value; } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Type = value; } + + /// The migration status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationState? MigrationState { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)Property).MigrationState; } + + /// The migration state description. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string MigrationStateDescription { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)Property).MigrationStateDescription; } + + /// Resource Name + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Name; } + + /// The name of policy governing this item. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string PolicyFriendlyName { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)Property).PolicyFriendlyName; } + + /// The ARM Id of policy governing this item. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string PolicyId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)Property).PolicyId; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemProperties _property; + + /// The migration item properties. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.MigrationItemProperties()); set => this._property = value; } + + /// Gets the instance type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ProviderSpecificDetailInstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)Property).ProviderSpecificDetailInstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)Property).ProviderSpecificDetailInstanceType = value ?? null; } + + /// The recovery services provider ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string RecoveryServicesProviderId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)Property).RecoveryServicesProviderId; } + + /// The replication status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ReplicationStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)Property).ReplicationStatus; } + + /// The test migrate state. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.TestMigrationState? TestMigrateState { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)Property).TestMigrateState; } + + /// The test migrate state description. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string TestMigrateStateDescription { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)Property).TestMigrateStateDescription; } + + /// Resource Type + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Type; } + + /// Creates an new instance. + public MigrationItem() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__resource), __resource); + await eventListener.AssertObjectIsValid(nameof(__resource), __resource); + } + } + /// Migration item. + public partial interface IMigrationItem : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResource + { + /// + /// The allowed operations on the migration item based on the current migration state of the item. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The allowed operations on the migration item based on the current migration state of the item.", + SerializedName = @"allowedOperations", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationItemOperation) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationItemOperation[] AllowedOperation { get; } + /// The critical past job details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The critical past job details.", + SerializedName = @"criticalJobHistory", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICriticalJobHistoryDetails) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICriticalJobHistoryDetails[] CriticalJobHistory { get; } + /// The ARM Id of the job being executed. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The ARM Id of the job being executed.", + SerializedName = @"jobId", + PossibleTypes = new [] { typeof(string) })] + string CurrentJobId { get; } + /// The job name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The job name.", + SerializedName = @"jobName", + PossibleTypes = new [] { typeof(string) })] + string CurrentJobName { get; } + /// The start time of the job. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The start time of the job.", + SerializedName = @"startTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? CurrentJobStartTime { get; } + /// The correlation Id for events associated with this migration item. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The correlation Id for events associated with this migration item.", + SerializedName = @"eventCorrelationId", + PossibleTypes = new [] { typeof(string) })] + string EventCorrelationId { get; } + /// The consolidated health. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The consolidated health.", + SerializedName = @"health", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth? Health { get; } + /// The list of health errors. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The list of health errors.", + SerializedName = @"healthErrors", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] HealthError { get; } + /// The status of the last migration. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The status of the last migration.", + SerializedName = @"lastMigrationStatus", + PossibleTypes = new [] { typeof(string) })] + string LastMigrationStatus { get; } + /// The last migration time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The last migration time.", + SerializedName = @"lastMigrationTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? LastMigrationTime { get; } + /// The status of the last test migration. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The status of the last test migration.", + SerializedName = @"lastTestMigrationStatus", + PossibleTypes = new [] { typeof(string) })] + string LastTestMigrationStatus { get; } + /// The last test migration time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The last test migration time.", + SerializedName = @"lastTestMigrationTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? LastTestMigrationTime { get; } + /// The on-premise virtual machine name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The on-premise virtual machine name.", + SerializedName = @"machineName", + PossibleTypes = new [] { typeof(string) })] + string MachineName { get; } + /// The migration status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The migration status.", + SerializedName = @"migrationState", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationState) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationState? MigrationState { get; } + /// The migration state description. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The migration state description.", + SerializedName = @"migrationStateDescription", + PossibleTypes = new [] { typeof(string) })] + string MigrationStateDescription { get; } + /// The name of policy governing this item. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The name of policy governing this item.", + SerializedName = @"policyFriendlyName", + PossibleTypes = new [] { typeof(string) })] + string PolicyFriendlyName { get; } + /// The ARM Id of policy governing this item. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The ARM Id of policy governing this item.", + SerializedName = @"policyId", + PossibleTypes = new [] { typeof(string) })] + string PolicyId { get; } + /// Gets the instance type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets the instance type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string ProviderSpecificDetailInstanceType { get; set; } + /// The recovery services provider ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The recovery services provider ARM Id.", + SerializedName = @"recoveryServicesProviderId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryServicesProviderId { get; } + /// The replication status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The replication status.", + SerializedName = @"replicationStatus", + PossibleTypes = new [] { typeof(string) })] + string ReplicationStatus { get; } + /// The test migrate state. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The test migrate state.", + SerializedName = @"testMigrateState", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.TestMigrationState) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.TestMigrationState? TestMigrateState { get; } + /// The test migrate state description. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The test migrate state description.", + SerializedName = @"testMigrateStateDescription", + PossibleTypes = new [] { typeof(string) })] + string TestMigrateStateDescription { get; } + + } + /// Migration item. + internal partial interface IMigrationItemInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal + { + /// + /// The allowed operations on the migration item based on the current migration state of the item. + /// + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationItemOperation[] AllowedOperation { get; set; } + /// The critical past job details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICriticalJobHistoryDetails[] CriticalJobHistory { get; set; } + /// The current job details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICurrentJobDetails CurrentJob { get; set; } + /// The ARM Id of the job being executed. + string CurrentJobId { get; set; } + /// The job name. + string CurrentJobName { get; set; } + /// The start time of the job. + global::System.DateTime? CurrentJobStartTime { get; set; } + /// The correlation Id for events associated with this migration item. + string EventCorrelationId { get; set; } + /// The consolidated health. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth? Health { get; set; } + /// The list of health errors. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] HealthError { get; set; } + /// The status of the last migration. + string LastMigrationStatus { get; set; } + /// The last migration time. + global::System.DateTime? LastMigrationTime { get; set; } + /// The status of the last test migration. + string LastTestMigrationStatus { get; set; } + /// The last test migration time. + global::System.DateTime? LastTestMigrationTime { get; set; } + /// The on-premise virtual machine name. + string MachineName { get; set; } + /// The migration status. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationState? MigrationState { get; set; } + /// The migration state description. + string MigrationStateDescription { get; set; } + /// The name of policy governing this item. + string PolicyFriendlyName { get; set; } + /// The ARM Id of policy governing this item. + string PolicyId { get; set; } + /// The migration item properties. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemProperties Property { get; set; } + /// The migration provider custom settings. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationProviderSpecificSettings ProviderSpecificDetail { get; set; } + /// Gets the instance type. + string ProviderSpecificDetailInstanceType { get; set; } + /// The recovery services provider ARM Id. + string RecoveryServicesProviderId { get; set; } + /// The replication status. + string ReplicationStatus { get; set; } + /// The test migrate state. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.TestMigrationState? TestMigrateState { get; set; } + /// The test migrate state description. + string TestMigrateStateDescription { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrationItem.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrationItem.json.cs new file mode 100644 index 000000000000..666c57e4e0a4 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrationItem.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Migration item. + public partial class MigrationItem + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new MigrationItem(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal MigrationItem(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __resource = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.Resource(json); + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.MigrationItemProperties.FromJson(__jsonProperties) : Property;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __resource?.ToJson(container, serializationMode); + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrationItemCollection.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrationItemCollection.PowerShell.cs new file mode 100644 index 000000000000..3eecf669f5fc --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrationItemCollection.PowerShell.cs @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Migration item collection. + [System.ComponentModel.TypeConverter(typeof(MigrationItemCollectionTypeConverter))] + public partial class MigrationItemCollection + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemCollection DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new MigrationItemCollection(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemCollection DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new MigrationItemCollection(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemCollection FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal MigrationItemCollection(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.MigrationItemTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemCollectionInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemCollectionInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal MigrationItemCollection(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.MigrationItemTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemCollectionInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemCollectionInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Migration item collection. + [System.ComponentModel.TypeConverter(typeof(MigrationItemCollectionTypeConverter))] + public partial interface IMigrationItemCollection + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrationItemCollection.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrationItemCollection.TypeConverter.cs new file mode 100644 index 000000000000..6f886ef6015e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrationItemCollection.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class MigrationItemCollectionTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemCollection ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemCollection).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return MigrationItemCollection.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return MigrationItemCollection.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return MigrationItemCollection.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrationItemCollection.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrationItemCollection.cs new file mode 100644 index 000000000000..1d2c12574f59 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrationItemCollection.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Migration item collection. + public partial class MigrationItemCollection : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemCollection, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemCollectionInternal + { + + /// Backing field for property. + private string _nextLink; + + /// The value of next link. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string NextLink { get => this._nextLink; set => this._nextLink = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem[] _value; + + /// The list of migration items. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem[] Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public MigrationItemCollection() + { + + } + } + /// Migration item collection. + public partial interface IMigrationItemCollection : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The value of next link. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The value of next link.", + SerializedName = @"nextLink", + PossibleTypes = new [] { typeof(string) })] + string NextLink { get; set; } + /// The list of migration items. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of migration items.", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem[] Value { get; set; } + + } + /// Migration item collection. + internal partial interface IMigrationItemCollectionInternal + + { + /// The value of next link. + string NextLink { get; set; } + /// The list of migration items. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem[] Value { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrationItemCollection.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrationItemCollection.json.cs new file mode 100644 index 000000000000..d649b90d062d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrationItemCollection.json.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Migration item collection. + public partial class MigrationItemCollection + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemCollection. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemCollection. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemCollection FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new MigrationItemCollection(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal MigrationItemCollection(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.MigrationItem.FromJson(__u) )) ))() : null : Value;} + {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)NextLink;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._value) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._value ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("value",__w); + } + AddIf( null != (((object)this._nextLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrationItemProperties.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrationItemProperties.PowerShell.cs new file mode 100644 index 000000000000..aa0bdc5eee3e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrationItemProperties.PowerShell.cs @@ -0,0 +1,328 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Migration item properties. + [System.ComponentModel.TypeConverter(typeof(MigrationItemPropertiesTypeConverter))] + public partial class MigrationItemProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new MigrationItemProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new MigrationItemProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal MigrationItemProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CurrentJob")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)this).CurrentJob = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICurrentJobDetails) content.GetValueForProperty("CurrentJob",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)this).CurrentJob, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.CurrentJobDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationProviderSpecificSettings) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.MigrationProviderSpecificSettingsTypeConverter.ConvertFrom); + } + if (content.Contains("MachineName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)this).MachineName = (string) content.GetValueForProperty("MachineName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)this).MachineName, global::System.Convert.ToString); + } + if (content.Contains("PolicyId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)this).PolicyId = (string) content.GetValueForProperty("PolicyId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)this).PolicyId, global::System.Convert.ToString); + } + if (content.Contains("PolicyFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)this).PolicyFriendlyName = (string) content.GetValueForProperty("PolicyFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)this).PolicyFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("RecoveryServicesProviderId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)this).RecoveryServicesProviderId = (string) content.GetValueForProperty("RecoveryServicesProviderId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)this).RecoveryServicesProviderId, global::System.Convert.ToString); + } + if (content.Contains("ReplicationStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)this).ReplicationStatus = (string) content.GetValueForProperty("ReplicationStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)this).ReplicationStatus, global::System.Convert.ToString); + } + if (content.Contains("MigrationState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)this).MigrationState = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationState?) content.GetValueForProperty("MigrationState",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)this).MigrationState, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationState.CreateFrom); + } + if (content.Contains("MigrationStateDescription")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)this).MigrationStateDescription = (string) content.GetValueForProperty("MigrationStateDescription",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)this).MigrationStateDescription, global::System.Convert.ToString); + } + if (content.Contains("LastTestMigrationTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)this).LastTestMigrationTime = (global::System.DateTime?) content.GetValueForProperty("LastTestMigrationTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)this).LastTestMigrationTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("LastTestMigrationStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)this).LastTestMigrationStatus = (string) content.GetValueForProperty("LastTestMigrationStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)this).LastTestMigrationStatus, global::System.Convert.ToString); + } + if (content.Contains("LastMigrationTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)this).LastMigrationTime = (global::System.DateTime?) content.GetValueForProperty("LastMigrationTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)this).LastMigrationTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("LastMigrationStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)this).LastMigrationStatus = (string) content.GetValueForProperty("LastMigrationStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)this).LastMigrationStatus, global::System.Convert.ToString); + } + if (content.Contains("TestMigrateState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)this).TestMigrateState = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.TestMigrationState?) content.GetValueForProperty("TestMigrateState",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)this).TestMigrateState, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.TestMigrationState.CreateFrom); + } + if (content.Contains("TestMigrateStateDescription")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)this).TestMigrateStateDescription = (string) content.GetValueForProperty("TestMigrateStateDescription",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)this).TestMigrateStateDescription, global::System.Convert.ToString); + } + if (content.Contains("Health")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)this).Health = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth?) content.GetValueForProperty("Health",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)this).Health, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth.CreateFrom); + } + if (content.Contains("HealthError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)this).HealthError = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[]) content.GetValueForProperty("HealthError",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)this).HealthError, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("AllowedOperation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)this).AllowedOperation = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationItemOperation[]) content.GetValueForProperty("AllowedOperation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)this).AllowedOperation, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationItemOperation.CreateFrom)); + } + if (content.Contains("CriticalJobHistory")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)this).CriticalJobHistory = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICriticalJobHistoryDetails[]) content.GetValueForProperty("CriticalJobHistory",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)this).CriticalJobHistory, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.CriticalJobHistoryDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("EventCorrelationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)this).EventCorrelationId = (string) content.GetValueForProperty("EventCorrelationId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)this).EventCorrelationId, global::System.Convert.ToString); + } + if (content.Contains("CurrentJobName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)this).CurrentJobName = (string) content.GetValueForProperty("CurrentJobName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)this).CurrentJobName, global::System.Convert.ToString); + } + if (content.Contains("CurrentJobId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)this).CurrentJobId = (string) content.GetValueForProperty("CurrentJobId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)this).CurrentJobId, global::System.Convert.ToString); + } + if (content.Contains("CurrentJobStartTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)this).CurrentJobStartTime = (global::System.DateTime?) content.GetValueForProperty("CurrentJobStartTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)this).CurrentJobStartTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal MigrationItemProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CurrentJob")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)this).CurrentJob = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICurrentJobDetails) content.GetValueForProperty("CurrentJob",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)this).CurrentJob, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.CurrentJobDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationProviderSpecificSettings) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.MigrationProviderSpecificSettingsTypeConverter.ConvertFrom); + } + if (content.Contains("MachineName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)this).MachineName = (string) content.GetValueForProperty("MachineName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)this).MachineName, global::System.Convert.ToString); + } + if (content.Contains("PolicyId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)this).PolicyId = (string) content.GetValueForProperty("PolicyId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)this).PolicyId, global::System.Convert.ToString); + } + if (content.Contains("PolicyFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)this).PolicyFriendlyName = (string) content.GetValueForProperty("PolicyFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)this).PolicyFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("RecoveryServicesProviderId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)this).RecoveryServicesProviderId = (string) content.GetValueForProperty("RecoveryServicesProviderId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)this).RecoveryServicesProviderId, global::System.Convert.ToString); + } + if (content.Contains("ReplicationStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)this).ReplicationStatus = (string) content.GetValueForProperty("ReplicationStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)this).ReplicationStatus, global::System.Convert.ToString); + } + if (content.Contains("MigrationState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)this).MigrationState = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationState?) content.GetValueForProperty("MigrationState",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)this).MigrationState, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationState.CreateFrom); + } + if (content.Contains("MigrationStateDescription")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)this).MigrationStateDescription = (string) content.GetValueForProperty("MigrationStateDescription",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)this).MigrationStateDescription, global::System.Convert.ToString); + } + if (content.Contains("LastTestMigrationTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)this).LastTestMigrationTime = (global::System.DateTime?) content.GetValueForProperty("LastTestMigrationTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)this).LastTestMigrationTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("LastTestMigrationStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)this).LastTestMigrationStatus = (string) content.GetValueForProperty("LastTestMigrationStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)this).LastTestMigrationStatus, global::System.Convert.ToString); + } + if (content.Contains("LastMigrationTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)this).LastMigrationTime = (global::System.DateTime?) content.GetValueForProperty("LastMigrationTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)this).LastMigrationTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("LastMigrationStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)this).LastMigrationStatus = (string) content.GetValueForProperty("LastMigrationStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)this).LastMigrationStatus, global::System.Convert.ToString); + } + if (content.Contains("TestMigrateState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)this).TestMigrateState = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.TestMigrationState?) content.GetValueForProperty("TestMigrateState",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)this).TestMigrateState, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.TestMigrationState.CreateFrom); + } + if (content.Contains("TestMigrateStateDescription")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)this).TestMigrateStateDescription = (string) content.GetValueForProperty("TestMigrateStateDescription",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)this).TestMigrateStateDescription, global::System.Convert.ToString); + } + if (content.Contains("Health")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)this).Health = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth?) content.GetValueForProperty("Health",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)this).Health, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth.CreateFrom); + } + if (content.Contains("HealthError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)this).HealthError = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[]) content.GetValueForProperty("HealthError",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)this).HealthError, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("AllowedOperation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)this).AllowedOperation = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationItemOperation[]) content.GetValueForProperty("AllowedOperation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)this).AllowedOperation, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationItemOperation.CreateFrom)); + } + if (content.Contains("CriticalJobHistory")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)this).CriticalJobHistory = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICriticalJobHistoryDetails[]) content.GetValueForProperty("CriticalJobHistory",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)this).CriticalJobHistory, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.CriticalJobHistoryDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("EventCorrelationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)this).EventCorrelationId = (string) content.GetValueForProperty("EventCorrelationId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)this).EventCorrelationId, global::System.Convert.ToString); + } + if (content.Contains("CurrentJobName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)this).CurrentJobName = (string) content.GetValueForProperty("CurrentJobName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)this).CurrentJobName, global::System.Convert.ToString); + } + if (content.Contains("CurrentJobId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)this).CurrentJobId = (string) content.GetValueForProperty("CurrentJobId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)this).CurrentJobId, global::System.Convert.ToString); + } + if (content.Contains("CurrentJobStartTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)this).CurrentJobStartTime = (global::System.DateTime?) content.GetValueForProperty("CurrentJobStartTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)this).CurrentJobStartTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Migration item properties. + [System.ComponentModel.TypeConverter(typeof(MigrationItemPropertiesTypeConverter))] + public partial interface IMigrationItemProperties + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrationItemProperties.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrationItemProperties.TypeConverter.cs new file mode 100644 index 000000000000..e8dfc399447e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrationItemProperties.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class MigrationItemPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return MigrationItemProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return MigrationItemProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return MigrationItemProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrationItemProperties.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrationItemProperties.cs new file mode 100644 index 000000000000..e1c25b7584af --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrationItemProperties.cs @@ -0,0 +1,489 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Migration item properties. + public partial class MigrationItemProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemProperties, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationItemOperation[] _allowedOperation; + + /// + /// The allowed operations on the migration item based on the current migration state of the item. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationItemOperation[] AllowedOperation { get => this._allowedOperation; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICriticalJobHistoryDetails[] _criticalJobHistory; + + /// The critical past job details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICriticalJobHistoryDetails[] CriticalJobHistory { get => this._criticalJobHistory; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICurrentJobDetails _currentJob; + + /// The current job details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICurrentJobDetails CurrentJob { get => (this._currentJob = this._currentJob ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.CurrentJobDetails()); } + + /// The ARM Id of the job being executed. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string CurrentJobId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICurrentJobDetailsInternal)CurrentJob).JobId; } + + /// The job name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string CurrentJobName { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICurrentJobDetailsInternal)CurrentJob).JobName; } + + /// The start time of the job. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public global::System.DateTime? CurrentJobStartTime { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICurrentJobDetailsInternal)CurrentJob).StartTime; } + + /// Backing field for property. + private string _eventCorrelationId; + + /// The correlation Id for events associated with this migration item. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string EventCorrelationId { get => this._eventCorrelationId; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth? _health; + + /// The consolidated health. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth? Health { get => this._health; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] _healthError; + + /// The list of health errors. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] HealthError { get => this._healthError; } + + /// Backing field for property. + private string _lastMigrationStatus; + + /// The status of the last migration. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string LastMigrationStatus { get => this._lastMigrationStatus; } + + /// Backing field for property. + private global::System.DateTime? _lastMigrationTime; + + /// The last migration time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public global::System.DateTime? LastMigrationTime { get => this._lastMigrationTime; } + + /// Backing field for property. + private string _lastTestMigrationStatus; + + /// The status of the last test migration. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string LastTestMigrationStatus { get => this._lastTestMigrationStatus; } + + /// Backing field for property. + private global::System.DateTime? _lastTestMigrationTime; + + /// The last test migration time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public global::System.DateTime? LastTestMigrationTime { get => this._lastTestMigrationTime; } + + /// Backing field for property. + private string _machineName; + + /// The on-premise virtual machine name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string MachineName { get => this._machineName; } + + /// Internal Acessors for AllowedOperation + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationItemOperation[] Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal.AllowedOperation { get => this._allowedOperation; set { {_allowedOperation = value;} } } + + /// Internal Acessors for CriticalJobHistory + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICriticalJobHistoryDetails[] Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal.CriticalJobHistory { get => this._criticalJobHistory; set { {_criticalJobHistory = value;} } } + + /// Internal Acessors for CurrentJob + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICurrentJobDetails Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal.CurrentJob { get => (this._currentJob = this._currentJob ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.CurrentJobDetails()); set { {_currentJob = value;} } } + + /// Internal Acessors for CurrentJobId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal.CurrentJobId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICurrentJobDetailsInternal)CurrentJob).JobId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICurrentJobDetailsInternal)CurrentJob).JobId = value; } + + /// Internal Acessors for CurrentJobName + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal.CurrentJobName { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICurrentJobDetailsInternal)CurrentJob).JobName; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICurrentJobDetailsInternal)CurrentJob).JobName = value; } + + /// Internal Acessors for CurrentJobStartTime + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal.CurrentJobStartTime { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICurrentJobDetailsInternal)CurrentJob).StartTime; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICurrentJobDetailsInternal)CurrentJob).StartTime = value; } + + /// Internal Acessors for EventCorrelationId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal.EventCorrelationId { get => this._eventCorrelationId; set { {_eventCorrelationId = value;} } } + + /// Internal Acessors for Health + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal.Health { get => this._health; set { {_health = value;} } } + + /// Internal Acessors for HealthError + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal.HealthError { get => this._healthError; set { {_healthError = value;} } } + + /// Internal Acessors for LastMigrationStatus + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal.LastMigrationStatus { get => this._lastMigrationStatus; set { {_lastMigrationStatus = value;} } } + + /// Internal Acessors for LastMigrationTime + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal.LastMigrationTime { get => this._lastMigrationTime; set { {_lastMigrationTime = value;} } } + + /// Internal Acessors for LastTestMigrationStatus + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal.LastTestMigrationStatus { get => this._lastTestMigrationStatus; set { {_lastTestMigrationStatus = value;} } } + + /// Internal Acessors for LastTestMigrationTime + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal.LastTestMigrationTime { get => this._lastTestMigrationTime; set { {_lastTestMigrationTime = value;} } } + + /// Internal Acessors for MachineName + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal.MachineName { get => this._machineName; set { {_machineName = value;} } } + + /// Internal Acessors for MigrationState + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationState? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal.MigrationState { get => this._migrationState; set { {_migrationState = value;} } } + + /// Internal Acessors for MigrationStateDescription + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal.MigrationStateDescription { get => this._migrationStateDescription; set { {_migrationStateDescription = value;} } } + + /// Internal Acessors for PolicyFriendlyName + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal.PolicyFriendlyName { get => this._policyFriendlyName; set { {_policyFriendlyName = value;} } } + + /// Internal Acessors for PolicyId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal.PolicyId { get => this._policyId; set { {_policyId = value;} } } + + /// Internal Acessors for ProviderSpecificDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationProviderSpecificSettings Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal.ProviderSpecificDetail { get => (this._providerSpecificDetail = this._providerSpecificDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.MigrationProviderSpecificSettings()); set { {_providerSpecificDetail = value;} } } + + /// Internal Acessors for RecoveryServicesProviderId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal.RecoveryServicesProviderId { get => this._recoveryServicesProviderId; set { {_recoveryServicesProviderId = value;} } } + + /// Internal Acessors for ReplicationStatus + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal.ReplicationStatus { get => this._replicationStatus; set { {_replicationStatus = value;} } } + + /// Internal Acessors for TestMigrateState + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.TestMigrationState? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal.TestMigrateState { get => this._testMigrateState; set { {_testMigrateState = value;} } } + + /// Internal Acessors for TestMigrateStateDescription + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemPropertiesInternal.TestMigrateStateDescription { get => this._testMigrateStateDescription; set { {_testMigrateStateDescription = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationState? _migrationState; + + /// The migration status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationState? MigrationState { get => this._migrationState; } + + /// Backing field for property. + private string _migrationStateDescription; + + /// The migration state description. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string MigrationStateDescription { get => this._migrationStateDescription; } + + /// Backing field for property. + private string _policyFriendlyName; + + /// The name of policy governing this item. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string PolicyFriendlyName { get => this._policyFriendlyName; } + + /// Backing field for property. + private string _policyId; + + /// The ARM Id of policy governing this item. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string PolicyId { get => this._policyId; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationProviderSpecificSettings _providerSpecificDetail; + + /// The migration provider custom settings. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationProviderSpecificSettings ProviderSpecificDetail { get => (this._providerSpecificDetail = this._providerSpecificDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.MigrationProviderSpecificSettings()); set => this._providerSpecificDetail = value; } + + /// Gets the instance type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ProviderSpecificDetailInstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationProviderSpecificSettingsInternal)ProviderSpecificDetail).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationProviderSpecificSettingsInternal)ProviderSpecificDetail).InstanceType = value ?? null; } + + /// Backing field for property. + private string _recoveryServicesProviderId; + + /// The recovery services provider ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryServicesProviderId { get => this._recoveryServicesProviderId; } + + /// Backing field for property. + private string _replicationStatus; + + /// The replication status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ReplicationStatus { get => this._replicationStatus; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.TestMigrationState? _testMigrateState; + + /// The test migrate state. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.TestMigrationState? TestMigrateState { get => this._testMigrateState; } + + /// Backing field for property. + private string _testMigrateStateDescription; + + /// The test migrate state description. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TestMigrateStateDescription { get => this._testMigrateStateDescription; } + + /// Creates an new instance. + public MigrationItemProperties() + { + + } + } + /// Migration item properties. + public partial interface IMigrationItemProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// + /// The allowed operations on the migration item based on the current migration state of the item. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The allowed operations on the migration item based on the current migration state of the item.", + SerializedName = @"allowedOperations", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationItemOperation) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationItemOperation[] AllowedOperation { get; } + /// The critical past job details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The critical past job details.", + SerializedName = @"criticalJobHistory", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICriticalJobHistoryDetails) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICriticalJobHistoryDetails[] CriticalJobHistory { get; } + /// The ARM Id of the job being executed. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The ARM Id of the job being executed.", + SerializedName = @"jobId", + PossibleTypes = new [] { typeof(string) })] + string CurrentJobId { get; } + /// The job name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The job name.", + SerializedName = @"jobName", + PossibleTypes = new [] { typeof(string) })] + string CurrentJobName { get; } + /// The start time of the job. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The start time of the job.", + SerializedName = @"startTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? CurrentJobStartTime { get; } + /// The correlation Id for events associated with this migration item. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The correlation Id for events associated with this migration item.", + SerializedName = @"eventCorrelationId", + PossibleTypes = new [] { typeof(string) })] + string EventCorrelationId { get; } + /// The consolidated health. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The consolidated health.", + SerializedName = @"health", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth? Health { get; } + /// The list of health errors. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The list of health errors.", + SerializedName = @"healthErrors", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] HealthError { get; } + /// The status of the last migration. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The status of the last migration.", + SerializedName = @"lastMigrationStatus", + PossibleTypes = new [] { typeof(string) })] + string LastMigrationStatus { get; } + /// The last migration time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The last migration time.", + SerializedName = @"lastMigrationTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? LastMigrationTime { get; } + /// The status of the last test migration. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The status of the last test migration.", + SerializedName = @"lastTestMigrationStatus", + PossibleTypes = new [] { typeof(string) })] + string LastTestMigrationStatus { get; } + /// The last test migration time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The last test migration time.", + SerializedName = @"lastTestMigrationTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? LastTestMigrationTime { get; } + /// The on-premise virtual machine name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The on-premise virtual machine name.", + SerializedName = @"machineName", + PossibleTypes = new [] { typeof(string) })] + string MachineName { get; } + /// The migration status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The migration status.", + SerializedName = @"migrationState", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationState) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationState? MigrationState { get; } + /// The migration state description. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The migration state description.", + SerializedName = @"migrationStateDescription", + PossibleTypes = new [] { typeof(string) })] + string MigrationStateDescription { get; } + /// The name of policy governing this item. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The name of policy governing this item.", + SerializedName = @"policyFriendlyName", + PossibleTypes = new [] { typeof(string) })] + string PolicyFriendlyName { get; } + /// The ARM Id of policy governing this item. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The ARM Id of policy governing this item.", + SerializedName = @"policyId", + PossibleTypes = new [] { typeof(string) })] + string PolicyId { get; } + /// Gets the instance type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets the instance type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string ProviderSpecificDetailInstanceType { get; set; } + /// The recovery services provider ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The recovery services provider ARM Id.", + SerializedName = @"recoveryServicesProviderId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryServicesProviderId { get; } + /// The replication status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The replication status.", + SerializedName = @"replicationStatus", + PossibleTypes = new [] { typeof(string) })] + string ReplicationStatus { get; } + /// The test migrate state. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The test migrate state.", + SerializedName = @"testMigrateState", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.TestMigrationState) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.TestMigrationState? TestMigrateState { get; } + /// The test migrate state description. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The test migrate state description.", + SerializedName = @"testMigrateStateDescription", + PossibleTypes = new [] { typeof(string) })] + string TestMigrateStateDescription { get; } + + } + /// Migration item properties. + internal partial interface IMigrationItemPropertiesInternal + + { + /// + /// The allowed operations on the migration item based on the current migration state of the item. + /// + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationItemOperation[] AllowedOperation { get; set; } + /// The critical past job details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICriticalJobHistoryDetails[] CriticalJobHistory { get; set; } + /// The current job details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICurrentJobDetails CurrentJob { get; set; } + /// The ARM Id of the job being executed. + string CurrentJobId { get; set; } + /// The job name. + string CurrentJobName { get; set; } + /// The start time of the job. + global::System.DateTime? CurrentJobStartTime { get; set; } + /// The correlation Id for events associated with this migration item. + string EventCorrelationId { get; set; } + /// The consolidated health. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth? Health { get; set; } + /// The list of health errors. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] HealthError { get; set; } + /// The status of the last migration. + string LastMigrationStatus { get; set; } + /// The last migration time. + global::System.DateTime? LastMigrationTime { get; set; } + /// The status of the last test migration. + string LastTestMigrationStatus { get; set; } + /// The last test migration time. + global::System.DateTime? LastTestMigrationTime { get; set; } + /// The on-premise virtual machine name. + string MachineName { get; set; } + /// The migration status. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationState? MigrationState { get; set; } + /// The migration state description. + string MigrationStateDescription { get; set; } + /// The name of policy governing this item. + string PolicyFriendlyName { get; set; } + /// The ARM Id of policy governing this item. + string PolicyId { get; set; } + /// The migration provider custom settings. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationProviderSpecificSettings ProviderSpecificDetail { get; set; } + /// Gets the instance type. + string ProviderSpecificDetailInstanceType { get; set; } + /// The recovery services provider ARM Id. + string RecoveryServicesProviderId { get; set; } + /// The replication status. + string ReplicationStatus { get; set; } + /// The test migrate state. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.TestMigrationState? TestMigrateState { get; set; } + /// The test migrate state description. + string TestMigrateStateDescription { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrationItemProperties.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrationItemProperties.json.cs new file mode 100644 index 000000000000..2ca3199c1658 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrationItemProperties.json.cs @@ -0,0 +1,227 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Migration item properties. + public partial class MigrationItemProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new MigrationItemProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal MigrationItemProperties(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_currentJob = If( json?.PropertyT("currentJob"), out var __jsonCurrentJob) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.CurrentJobDetails.FromJson(__jsonCurrentJob) : CurrentJob;} + {_providerSpecificDetail = If( json?.PropertyT("providerSpecificDetails"), out var __jsonProviderSpecificDetails) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.MigrationProviderSpecificSettings.FromJson(__jsonProviderSpecificDetails) : ProviderSpecificDetail;} + {_machineName = If( json?.PropertyT("machineName"), out var __jsonMachineName) ? (string)__jsonMachineName : (string)MachineName;} + {_policyId = If( json?.PropertyT("policyId"), out var __jsonPolicyId) ? (string)__jsonPolicyId : (string)PolicyId;} + {_policyFriendlyName = If( json?.PropertyT("policyFriendlyName"), out var __jsonPolicyFriendlyName) ? (string)__jsonPolicyFriendlyName : (string)PolicyFriendlyName;} + {_recoveryServicesProviderId = If( json?.PropertyT("recoveryServicesProviderId"), out var __jsonRecoveryServicesProviderId) ? (string)__jsonRecoveryServicesProviderId : (string)RecoveryServicesProviderId;} + {_replicationStatus = If( json?.PropertyT("replicationStatus"), out var __jsonReplicationStatus) ? (string)__jsonReplicationStatus : (string)ReplicationStatus;} + {_migrationState = If( json?.PropertyT("migrationState"), out var __jsonMigrationState) ? (string)__jsonMigrationState : (string)MigrationState;} + {_migrationStateDescription = If( json?.PropertyT("migrationStateDescription"), out var __jsonMigrationStateDescription) ? (string)__jsonMigrationStateDescription : (string)MigrationStateDescription;} + {_lastTestMigrationTime = If( json?.PropertyT("lastTestMigrationTime"), out var __jsonLastTestMigrationTime) ? global::System.DateTime.TryParse((string)__jsonLastTestMigrationTime, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonLastTestMigrationTimeValue) ? __jsonLastTestMigrationTimeValue : LastTestMigrationTime : LastTestMigrationTime;} + {_lastTestMigrationStatus = If( json?.PropertyT("lastTestMigrationStatus"), out var __jsonLastTestMigrationStatus) ? (string)__jsonLastTestMigrationStatus : (string)LastTestMigrationStatus;} + {_lastMigrationTime = If( json?.PropertyT("lastMigrationTime"), out var __jsonLastMigrationTime) ? global::System.DateTime.TryParse((string)__jsonLastMigrationTime, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonLastMigrationTimeValue) ? __jsonLastMigrationTimeValue : LastMigrationTime : LastMigrationTime;} + {_lastMigrationStatus = If( json?.PropertyT("lastMigrationStatus"), out var __jsonLastMigrationStatus) ? (string)__jsonLastMigrationStatus : (string)LastMigrationStatus;} + {_testMigrateState = If( json?.PropertyT("testMigrateState"), out var __jsonTestMigrateState) ? (string)__jsonTestMigrateState : (string)TestMigrateState;} + {_testMigrateStateDescription = If( json?.PropertyT("testMigrateStateDescription"), out var __jsonTestMigrateStateDescription) ? (string)__jsonTestMigrateStateDescription : (string)TestMigrateStateDescription;} + {_health = If( json?.PropertyT("health"), out var __jsonHealth) ? (string)__jsonHealth : (string)Health;} + {_healthError = If( json?.PropertyT("healthErrors"), out var __jsonHealthErrors) ? If( __jsonHealthErrors as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthError.FromJson(__u) )) ))() : null : HealthError;} + {_allowedOperation = If( json?.PropertyT("allowedOperations"), out var __jsonAllowedOperations) ? If( __jsonAllowedOperations as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __q) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__q, (__p)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationItemOperation) (__p is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString __o ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationItemOperation)(__o.ToString()) : ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationItemOperation)""))) ))() : null : AllowedOperation;} + {_criticalJobHistory = If( json?.PropertyT("criticalJobHistory"), out var __jsonCriticalJobHistory) ? If( __jsonCriticalJobHistory as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __l) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__l, (__k)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICriticalJobHistoryDetails) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.CriticalJobHistoryDetails.FromJson(__k) )) ))() : null : CriticalJobHistory;} + {_eventCorrelationId = If( json?.PropertyT("eventCorrelationId"), out var __jsonEventCorrelationId) ? (string)__jsonEventCorrelationId : (string)EventCorrelationId;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._currentJob ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._currentJob.ToJson(null,serializationMode) : null, "currentJob" ,container.Add ); + } + AddIf( null != this._providerSpecificDetail ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._providerSpecificDetail.ToJson(null,serializationMode) : null, "providerSpecificDetails" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._machineName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._machineName.ToString()) : null, "machineName" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._policyId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._policyId.ToString()) : null, "policyId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._policyFriendlyName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._policyFriendlyName.ToString()) : null, "policyFriendlyName" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._recoveryServicesProviderId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryServicesProviderId.ToString()) : null, "recoveryServicesProviderId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._replicationStatus)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._replicationStatus.ToString()) : null, "replicationStatus" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._migrationState)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._migrationState.ToString()) : null, "migrationState" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._migrationStateDescription)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._migrationStateDescription.ToString()) : null, "migrationStateDescription" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._lastTestMigrationTime ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._lastTestMigrationTime?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "lastTestMigrationTime" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._lastTestMigrationStatus)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._lastTestMigrationStatus.ToString()) : null, "lastTestMigrationStatus" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._lastMigrationTime ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._lastMigrationTime?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "lastMigrationTime" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._lastMigrationStatus)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._lastMigrationStatus.ToString()) : null, "lastMigrationStatus" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._testMigrateState)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._testMigrateState.ToString()) : null, "testMigrateState" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._testMigrateStateDescription)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._testMigrateStateDescription.ToString()) : null, "testMigrateStateDescription" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._health)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._health.ToString()) : null, "health" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + if (null != this._healthError) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._healthError ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("healthErrors",__w); + } + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + if (null != this._allowedOperation) + { + var __r = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __s in this._allowedOperation ) + { + AddIf(null != (((object)__s)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(__s.ToString()) : null ,__r.Add); + } + container.Add("allowedOperations",__r); + } + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + if (null != this._criticalJobHistory) + { + var __m = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __n in this._criticalJobHistory ) + { + AddIf(__n?.ToJson(null, serializationMode) ,__m.Add); + } + container.Add("criticalJobHistory",__m); + } + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._eventCorrelationId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._eventCorrelationId.ToString()) : null, "eventCorrelationId" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrationItemsQueryParameter.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrationItemsQueryParameter.PowerShell.cs new file mode 100644 index 000000000000..fa8d2c4dcbe7 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrationItemsQueryParameter.PowerShell.cs @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Query parameter to enumerate migration items. + [System.ComponentModel.TypeConverter(typeof(MigrationItemsQueryParameterTypeConverter))] + public partial class MigrationItemsQueryParameter + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemsQueryParameter DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new MigrationItemsQueryParameter(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemsQueryParameter DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new MigrationItemsQueryParameter(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemsQueryParameter FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal MigrationItemsQueryParameter(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SourceFabricName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemsQueryParameterInternal)this).SourceFabricName = (string) content.GetValueForProperty("SourceFabricName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemsQueryParameterInternal)this).SourceFabricName, global::System.Convert.ToString); + } + if (content.Contains("SourceContainerName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemsQueryParameterInternal)this).SourceContainerName = (string) content.GetValueForProperty("SourceContainerName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemsQueryParameterInternal)this).SourceContainerName, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemsQueryParameterInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemsQueryParameterInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal MigrationItemsQueryParameter(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SourceFabricName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemsQueryParameterInternal)this).SourceFabricName = (string) content.GetValueForProperty("SourceFabricName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemsQueryParameterInternal)this).SourceFabricName, global::System.Convert.ToString); + } + if (content.Contains("SourceContainerName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemsQueryParameterInternal)this).SourceContainerName = (string) content.GetValueForProperty("SourceContainerName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemsQueryParameterInternal)this).SourceContainerName, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemsQueryParameterInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemsQueryParameterInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Query parameter to enumerate migration items. + [System.ComponentModel.TypeConverter(typeof(MigrationItemsQueryParameterTypeConverter))] + public partial interface IMigrationItemsQueryParameter + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrationItemsQueryParameter.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrationItemsQueryParameter.TypeConverter.cs new file mode 100644 index 000000000000..3293eb2af2e1 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrationItemsQueryParameter.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class MigrationItemsQueryParameterTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemsQueryParameter ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemsQueryParameter).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return MigrationItemsQueryParameter.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return MigrationItemsQueryParameter.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return MigrationItemsQueryParameter.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrationItemsQueryParameter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrationItemsQueryParameter.cs new file mode 100644 index 000000000000..3411e9b01d78 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrationItemsQueryParameter.cs @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Query parameter to enumerate migration items. + public partial class MigrationItemsQueryParameter : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemsQueryParameter, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemsQueryParameterInternal + { + + /// Backing field for property. + private string _instanceType; + + /// The replication provider type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string InstanceType { get => this._instanceType; set => this._instanceType = value; } + + /// Backing field for property. + private string _sourceContainerName; + + /// The source container name filter. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string SourceContainerName { get => this._sourceContainerName; set => this._sourceContainerName = value; } + + /// Backing field for property. + private string _sourceFabricName; + + /// The source fabric name filter. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string SourceFabricName { get => this._sourceFabricName; set => this._sourceFabricName = value; } + + /// Creates an new instance. + public MigrationItemsQueryParameter() + { + + } + } + /// Query parameter to enumerate migration items. + public partial interface IMigrationItemsQueryParameter : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The replication provider type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The replication provider type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string InstanceType { get; set; } + /// The source container name filter. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The source container name filter.", + SerializedName = @"sourceContainerName", + PossibleTypes = new [] { typeof(string) })] + string SourceContainerName { get; set; } + /// The source fabric name filter. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The source fabric name filter.", + SerializedName = @"sourceFabricName", + PossibleTypes = new [] { typeof(string) })] + string SourceFabricName { get; set; } + + } + /// Query parameter to enumerate migration items. + internal partial interface IMigrationItemsQueryParameterInternal + + { + /// The replication provider type. + string InstanceType { get; set; } + /// The source container name filter. + string SourceContainerName { get; set; } + /// The source fabric name filter. + string SourceFabricName { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrationItemsQueryParameter.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrationItemsQueryParameter.json.cs new file mode 100644 index 000000000000..df02f5286cc3 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrationItemsQueryParameter.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Query parameter to enumerate migration items. + public partial class MigrationItemsQueryParameter + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemsQueryParameter. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemsQueryParameter. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemsQueryParameter FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new MigrationItemsQueryParameter(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal MigrationItemsQueryParameter(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_sourceFabricName = If( json?.PropertyT("sourceFabricName"), out var __jsonSourceFabricName) ? (string)__jsonSourceFabricName : (string)SourceFabricName;} + {_sourceContainerName = If( json?.PropertyT("sourceContainerName"), out var __jsonSourceContainerName) ? (string)__jsonSourceContainerName : (string)SourceContainerName;} + {_instanceType = If( json?.PropertyT("instanceType"), out var __jsonInstanceType) ? (string)__jsonInstanceType : (string)InstanceType;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._sourceFabricName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._sourceFabricName.ToString()) : null, "sourceFabricName" ,container.Add ); + AddIf( null != (((object)this._sourceContainerName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._sourceContainerName.ToString()) : null, "sourceContainerName" ,container.Add ); + AddIf( null != (((object)this._instanceType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._instanceType.ToString()) : null, "instanceType" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrationProviderSpecificSettings.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrationProviderSpecificSettings.PowerShell.cs new file mode 100644 index 000000000000..d8b53406917f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrationProviderSpecificSettings.PowerShell.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Migration provider specific settings. + [System.ComponentModel.TypeConverter(typeof(MigrationProviderSpecificSettingsTypeConverter))] + public partial class MigrationProviderSpecificSettings + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationProviderSpecificSettings DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new MigrationProviderSpecificSettings(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationProviderSpecificSettings DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new MigrationProviderSpecificSettings(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationProviderSpecificSettings FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal MigrationProviderSpecificSettings(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationProviderSpecificSettingsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationProviderSpecificSettingsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal MigrationProviderSpecificSettings(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationProviderSpecificSettingsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationProviderSpecificSettingsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Migration provider specific settings. + [System.ComponentModel.TypeConverter(typeof(MigrationProviderSpecificSettingsTypeConverter))] + public partial interface IMigrationProviderSpecificSettings + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrationProviderSpecificSettings.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrationProviderSpecificSettings.TypeConverter.cs new file mode 100644 index 000000000000..7ef8e2a0656e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrationProviderSpecificSettings.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class MigrationProviderSpecificSettingsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationProviderSpecificSettings ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationProviderSpecificSettings).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return MigrationProviderSpecificSettings.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return MigrationProviderSpecificSettings.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return MigrationProviderSpecificSettings.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrationProviderSpecificSettings.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrationProviderSpecificSettings.cs new file mode 100644 index 000000000000..660d4accf85a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrationProviderSpecificSettings.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Migration provider specific settings. + public partial class MigrationProviderSpecificSettings : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationProviderSpecificSettings, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationProviderSpecificSettingsInternal + { + + /// Backing field for property. + private string _instanceType; + + /// Gets the instance type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string InstanceType { get => this._instanceType; set => this._instanceType = value; } + + /// Creates an new instance. + public MigrationProviderSpecificSettings() + { + + } + } + /// Migration provider specific settings. + public partial interface IMigrationProviderSpecificSettings : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// Gets the instance type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets the instance type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string InstanceType { get; set; } + + } + /// Migration provider specific settings. + internal partial interface IMigrationProviderSpecificSettingsInternal + + { + /// Gets the instance type. + string InstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrationProviderSpecificSettings.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrationProviderSpecificSettings.json.cs new file mode 100644 index 000000000000..d9a2381e1029 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrationProviderSpecificSettings.json.cs @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Migration provider specific settings. + public partial class MigrationProviderSpecificSettings + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationProviderSpecificSettings. + /// Note: the Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationProviderSpecificSettings interface + /// is polymorphic, and the precise model class that will get deserialized is determined at runtime based on the payload. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationProviderSpecificSettings. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationProviderSpecificSettings FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + if (!(node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json)) + { + return null; + } + // Polymorphic type -- select the appropriate constructor using the discriminator + + switch ( json.StringProperty("instanceType") ) + { + case "VMwareCbt": + { + return new VMwareCbtMigrationDetails(json); + } + } + return new MigrationProviderSpecificSettings(json); + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal MigrationProviderSpecificSettings(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_instanceType = If( json?.PropertyT("instanceType"), out var __jsonInstanceType) ? (string)__jsonInstanceType : (string)InstanceType;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._instanceType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._instanceType.ToString()) : null, "instanceType" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrationRecoveryPoint.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrationRecoveryPoint.PowerShell.cs new file mode 100644 index 000000000000..9d5af62c0a47 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrationRecoveryPoint.PowerShell.cs @@ -0,0 +1,192 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Recovery point for a migration item. + [System.ComponentModel.TypeConverter(typeof(MigrationRecoveryPointTypeConverter))] + public partial class MigrationRecoveryPoint + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationRecoveryPoint DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new MigrationRecoveryPoint(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationRecoveryPoint DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new MigrationRecoveryPoint(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationRecoveryPoint FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal MigrationRecoveryPoint(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationRecoveryPointInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationRecoveryPointProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationRecoveryPointInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.MigrationRecoveryPointPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("RecoveryPointTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationRecoveryPointInternal)this).RecoveryPointTime = (global::System.DateTime?) content.GetValueForProperty("RecoveryPointTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationRecoveryPointInternal)this).RecoveryPointTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("RecoveryPointType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationRecoveryPointInternal)this).RecoveryPointType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationRecoveryPointType?) content.GetValueForProperty("RecoveryPointType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationRecoveryPointInternal)this).RecoveryPointType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationRecoveryPointType.CreateFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal MigrationRecoveryPoint(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationRecoveryPointInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationRecoveryPointProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationRecoveryPointInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.MigrationRecoveryPointPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("RecoveryPointTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationRecoveryPointInternal)this).RecoveryPointTime = (global::System.DateTime?) content.GetValueForProperty("RecoveryPointTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationRecoveryPointInternal)this).RecoveryPointTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("RecoveryPointType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationRecoveryPointInternal)this).RecoveryPointType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationRecoveryPointType?) content.GetValueForProperty("RecoveryPointType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationRecoveryPointInternal)this).RecoveryPointType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationRecoveryPointType.CreateFrom); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Recovery point for a migration item. + [System.ComponentModel.TypeConverter(typeof(MigrationRecoveryPointTypeConverter))] + public partial interface IMigrationRecoveryPoint + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrationRecoveryPoint.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrationRecoveryPoint.TypeConverter.cs new file mode 100644 index 000000000000..13897678e830 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrationRecoveryPoint.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class MigrationRecoveryPointTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationRecoveryPoint ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationRecoveryPoint).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return MigrationRecoveryPoint.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return MigrationRecoveryPoint.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return MigrationRecoveryPoint.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrationRecoveryPoint.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrationRecoveryPoint.cs new file mode 100644 index 000000000000..cc31408f8f4f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrationRecoveryPoint.cs @@ -0,0 +1,124 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Recovery point for a migration item. + public partial class MigrationRecoveryPoint : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationRecoveryPoint, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationRecoveryPointInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResource __resource = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.Resource(); + + /// Resource Id + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Id; } + + /// Resource Location + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string Location { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Location; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Location = value ?? null; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationRecoveryPointProperties Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationRecoveryPointInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.MigrationRecoveryPointProperties()); set { {_property = value;} } } + + /// Internal Acessors for RecoveryPointTime + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationRecoveryPointInternal.RecoveryPointTime { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationRecoveryPointPropertiesInternal)Property).RecoveryPointTime; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationRecoveryPointPropertiesInternal)Property).RecoveryPointTime = value; } + + /// Internal Acessors for RecoveryPointType + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationRecoveryPointType? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationRecoveryPointInternal.RecoveryPointType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationRecoveryPointPropertiesInternal)Property).RecoveryPointType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationRecoveryPointPropertiesInternal)Property).RecoveryPointType = value; } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Id = value; } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Name = value; } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Type = value; } + + /// Resource Name + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Name; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationRecoveryPointProperties _property; + + /// Recovery point properties. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationRecoveryPointProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.MigrationRecoveryPointProperties()); set => this._property = value; } + + /// The recovery point time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public global::System.DateTime? RecoveryPointTime { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationRecoveryPointPropertiesInternal)Property).RecoveryPointTime; } + + /// The recovery point type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationRecoveryPointType? RecoveryPointType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationRecoveryPointPropertiesInternal)Property).RecoveryPointType; } + + /// Resource Type + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Type; } + + /// Creates an new instance. + public MigrationRecoveryPoint() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__resource), __resource); + await eventListener.AssertObjectIsValid(nameof(__resource), __resource); + } + } + /// Recovery point for a migration item. + public partial interface IMigrationRecoveryPoint : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResource + { + /// The recovery point time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The recovery point time.", + SerializedName = @"recoveryPointTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? RecoveryPointTime { get; } + /// The recovery point type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The recovery point type.", + SerializedName = @"recoveryPointType", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationRecoveryPointType) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationRecoveryPointType? RecoveryPointType { get; } + + } + /// Recovery point for a migration item. + internal partial interface IMigrationRecoveryPointInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal + { + /// Recovery point properties. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationRecoveryPointProperties Property { get; set; } + /// The recovery point time. + global::System.DateTime? RecoveryPointTime { get; set; } + /// The recovery point type. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationRecoveryPointType? RecoveryPointType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrationRecoveryPoint.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrationRecoveryPoint.json.cs new file mode 100644 index 000000000000..ac5ff691c819 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrationRecoveryPoint.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Recovery point for a migration item. + public partial class MigrationRecoveryPoint + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationRecoveryPoint. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationRecoveryPoint. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationRecoveryPoint FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new MigrationRecoveryPoint(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal MigrationRecoveryPoint(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __resource = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.Resource(json); + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.MigrationRecoveryPointProperties.FromJson(__jsonProperties) : Property;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __resource?.ToJson(container, serializationMode); + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrationRecoveryPointCollection.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrationRecoveryPointCollection.PowerShell.cs new file mode 100644 index 000000000000..9dd2830afaca --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrationRecoveryPointCollection.PowerShell.cs @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Collection of migration recovery points. + [System.ComponentModel.TypeConverter(typeof(MigrationRecoveryPointCollectionTypeConverter))] + public partial class MigrationRecoveryPointCollection + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationRecoveryPointCollection DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new MigrationRecoveryPointCollection(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationRecoveryPointCollection DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new MigrationRecoveryPointCollection(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationRecoveryPointCollection FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal MigrationRecoveryPointCollection(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationRecoveryPointCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationRecoveryPoint[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationRecoveryPointCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.MigrationRecoveryPointTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationRecoveryPointCollectionInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationRecoveryPointCollectionInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal MigrationRecoveryPointCollection(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationRecoveryPointCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationRecoveryPoint[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationRecoveryPointCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.MigrationRecoveryPointTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationRecoveryPointCollectionInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationRecoveryPointCollectionInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Collection of migration recovery points. + [System.ComponentModel.TypeConverter(typeof(MigrationRecoveryPointCollectionTypeConverter))] + public partial interface IMigrationRecoveryPointCollection + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrationRecoveryPointCollection.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrationRecoveryPointCollection.TypeConverter.cs new file mode 100644 index 000000000000..a1ad45cdc062 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrationRecoveryPointCollection.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class MigrationRecoveryPointCollectionTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationRecoveryPointCollection ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationRecoveryPointCollection).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return MigrationRecoveryPointCollection.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return MigrationRecoveryPointCollection.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return MigrationRecoveryPointCollection.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrationRecoveryPointCollection.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrationRecoveryPointCollection.cs new file mode 100644 index 000000000000..a1fb7d6ed75d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrationRecoveryPointCollection.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Collection of migration recovery points. + public partial class MigrationRecoveryPointCollection : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationRecoveryPointCollection, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationRecoveryPointCollectionInternal + { + + /// Backing field for property. + private string _nextLink; + + /// The value of next link. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string NextLink { get => this._nextLink; set => this._nextLink = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationRecoveryPoint[] _value; + + /// The migration recovery point details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationRecoveryPoint[] Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public MigrationRecoveryPointCollection() + { + + } + } + /// Collection of migration recovery points. + public partial interface IMigrationRecoveryPointCollection : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The value of next link. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The value of next link.", + SerializedName = @"nextLink", + PossibleTypes = new [] { typeof(string) })] + string NextLink { get; set; } + /// The migration recovery point details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The migration recovery point details.", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationRecoveryPoint) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationRecoveryPoint[] Value { get; set; } + + } + /// Collection of migration recovery points. + internal partial interface IMigrationRecoveryPointCollectionInternal + + { + /// The value of next link. + string NextLink { get; set; } + /// The migration recovery point details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationRecoveryPoint[] Value { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrationRecoveryPointCollection.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrationRecoveryPointCollection.json.cs new file mode 100644 index 000000000000..2ff5f7548e73 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrationRecoveryPointCollection.json.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Collection of migration recovery points. + public partial class MigrationRecoveryPointCollection + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationRecoveryPointCollection. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationRecoveryPointCollection. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationRecoveryPointCollection FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new MigrationRecoveryPointCollection(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal MigrationRecoveryPointCollection(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationRecoveryPoint) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.MigrationRecoveryPoint.FromJson(__u) )) ))() : null : Value;} + {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)NextLink;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._value) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._value ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("value",__w); + } + AddIf( null != (((object)this._nextLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrationRecoveryPointProperties.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrationRecoveryPointProperties.PowerShell.cs new file mode 100644 index 000000000000..da407e433512 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrationRecoveryPointProperties.PowerShell.cs @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Migration item recovery point properties. + [System.ComponentModel.TypeConverter(typeof(MigrationRecoveryPointPropertiesTypeConverter))] + public partial class MigrationRecoveryPointProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationRecoveryPointProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new MigrationRecoveryPointProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationRecoveryPointProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new MigrationRecoveryPointProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationRecoveryPointProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal MigrationRecoveryPointProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("RecoveryPointTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationRecoveryPointPropertiesInternal)this).RecoveryPointTime = (global::System.DateTime?) content.GetValueForProperty("RecoveryPointTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationRecoveryPointPropertiesInternal)this).RecoveryPointTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("RecoveryPointType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationRecoveryPointPropertiesInternal)this).RecoveryPointType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationRecoveryPointType?) content.GetValueForProperty("RecoveryPointType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationRecoveryPointPropertiesInternal)this).RecoveryPointType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationRecoveryPointType.CreateFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal MigrationRecoveryPointProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("RecoveryPointTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationRecoveryPointPropertiesInternal)this).RecoveryPointTime = (global::System.DateTime?) content.GetValueForProperty("RecoveryPointTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationRecoveryPointPropertiesInternal)this).RecoveryPointTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("RecoveryPointType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationRecoveryPointPropertiesInternal)this).RecoveryPointType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationRecoveryPointType?) content.GetValueForProperty("RecoveryPointType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationRecoveryPointPropertiesInternal)this).RecoveryPointType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationRecoveryPointType.CreateFrom); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Migration item recovery point properties. + [System.ComponentModel.TypeConverter(typeof(MigrationRecoveryPointPropertiesTypeConverter))] + public partial interface IMigrationRecoveryPointProperties + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrationRecoveryPointProperties.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrationRecoveryPointProperties.TypeConverter.cs new file mode 100644 index 000000000000..8713c5bb1beb --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrationRecoveryPointProperties.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class MigrationRecoveryPointPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationRecoveryPointProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationRecoveryPointProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return MigrationRecoveryPointProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return MigrationRecoveryPointProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return MigrationRecoveryPointProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrationRecoveryPointProperties.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrationRecoveryPointProperties.cs new file mode 100644 index 000000000000..d782cba34f69 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrationRecoveryPointProperties.cs @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Migration item recovery point properties. + public partial class MigrationRecoveryPointProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationRecoveryPointProperties, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationRecoveryPointPropertiesInternal + { + + /// Internal Acessors for RecoveryPointTime + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationRecoveryPointPropertiesInternal.RecoveryPointTime { get => this._recoveryPointTime; set { {_recoveryPointTime = value;} } } + + /// Internal Acessors for RecoveryPointType + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationRecoveryPointType? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationRecoveryPointPropertiesInternal.RecoveryPointType { get => this._recoveryPointType; set { {_recoveryPointType = value;} } } + + /// Backing field for property. + private global::System.DateTime? _recoveryPointTime; + + /// The recovery point time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public global::System.DateTime? RecoveryPointTime { get => this._recoveryPointTime; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationRecoveryPointType? _recoveryPointType; + + /// The recovery point type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationRecoveryPointType? RecoveryPointType { get => this._recoveryPointType; } + + /// Creates an new instance. + public MigrationRecoveryPointProperties() + { + + } + } + /// Migration item recovery point properties. + public partial interface IMigrationRecoveryPointProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The recovery point time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The recovery point time.", + SerializedName = @"recoveryPointTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? RecoveryPointTime { get; } + /// The recovery point type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The recovery point type.", + SerializedName = @"recoveryPointType", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationRecoveryPointType) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationRecoveryPointType? RecoveryPointType { get; } + + } + /// Migration item recovery point properties. + internal partial interface IMigrationRecoveryPointPropertiesInternal + + { + /// The recovery point time. + global::System.DateTime? RecoveryPointTime { get; set; } + /// The recovery point type. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationRecoveryPointType? RecoveryPointType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrationRecoveryPointProperties.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrationRecoveryPointProperties.json.cs new file mode 100644 index 000000000000..61dd980cad56 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MigrationRecoveryPointProperties.json.cs @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Migration item recovery point properties. + public partial class MigrationRecoveryPointProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationRecoveryPointProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationRecoveryPointProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationRecoveryPointProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new MigrationRecoveryPointProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal MigrationRecoveryPointProperties(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_recoveryPointTime = If( json?.PropertyT("recoveryPointTime"), out var __jsonRecoveryPointTime) ? global::System.DateTime.TryParse((string)__jsonRecoveryPointTime, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonRecoveryPointTimeValue) ? __jsonRecoveryPointTimeValue : RecoveryPointTime : RecoveryPointTime;} + {_recoveryPointType = If( json?.PropertyT("recoveryPointType"), out var __jsonRecoveryPointType) ? (string)__jsonRecoveryPointType : (string)RecoveryPointType;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._recoveryPointTime ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryPointTime?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "recoveryPointTime" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._recoveryPointType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryPointType.ToString()) : null, "recoveryPointType" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MobilityServiceUpdate.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MobilityServiceUpdate.PowerShell.cs new file mode 100644 index 000000000000..eceadd38f894 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MobilityServiceUpdate.PowerShell.cs @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// The Mobility Service update details. + [System.ComponentModel.TypeConverter(typeof(MobilityServiceUpdateTypeConverter))] + public partial class MobilityServiceUpdate + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMobilityServiceUpdate DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new MobilityServiceUpdate(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMobilityServiceUpdate DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new MobilityServiceUpdate(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMobilityServiceUpdate FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal MobilityServiceUpdate(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Version")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMobilityServiceUpdateInternal)this).Version = (string) content.GetValueForProperty("Version",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMobilityServiceUpdateInternal)this).Version, global::System.Convert.ToString); + } + if (content.Contains("RebootStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMobilityServiceUpdateInternal)this).RebootStatus = (string) content.GetValueForProperty("RebootStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMobilityServiceUpdateInternal)this).RebootStatus, global::System.Convert.ToString); + } + if (content.Contains("OSType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMobilityServiceUpdateInternal)this).OSType = (string) content.GetValueForProperty("OSType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMobilityServiceUpdateInternal)this).OSType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal MobilityServiceUpdate(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Version")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMobilityServiceUpdateInternal)this).Version = (string) content.GetValueForProperty("Version",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMobilityServiceUpdateInternal)this).Version, global::System.Convert.ToString); + } + if (content.Contains("RebootStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMobilityServiceUpdateInternal)this).RebootStatus = (string) content.GetValueForProperty("RebootStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMobilityServiceUpdateInternal)this).RebootStatus, global::System.Convert.ToString); + } + if (content.Contains("OSType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMobilityServiceUpdateInternal)this).OSType = (string) content.GetValueForProperty("OSType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMobilityServiceUpdateInternal)this).OSType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// The Mobility Service update details. + [System.ComponentModel.TypeConverter(typeof(MobilityServiceUpdateTypeConverter))] + public partial interface IMobilityServiceUpdate + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MobilityServiceUpdate.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MobilityServiceUpdate.TypeConverter.cs new file mode 100644 index 000000000000..454acb91a0c7 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MobilityServiceUpdate.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class MobilityServiceUpdateTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMobilityServiceUpdate ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMobilityServiceUpdate).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return MobilityServiceUpdate.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return MobilityServiceUpdate.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return MobilityServiceUpdate.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MobilityServiceUpdate.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MobilityServiceUpdate.cs new file mode 100644 index 000000000000..acdd592bec0b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MobilityServiceUpdate.cs @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The Mobility Service update details. + public partial class MobilityServiceUpdate : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMobilityServiceUpdate, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMobilityServiceUpdateInternal + { + + /// Backing field for property. + private string _oSType; + + /// The OS type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string OSType { get => this._oSType; set => this._oSType = value; } + + /// Backing field for property. + private string _rebootStatus; + + /// The reboot status of the update - whether it is required or not. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RebootStatus { get => this._rebootStatus; set => this._rebootStatus = value; } + + /// Backing field for property. + private string _version; + + /// The version of the latest update. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Version { get => this._version; set => this._version = value; } + + /// Creates an new instance. + public MobilityServiceUpdate() + { + + } + } + /// The Mobility Service update details. + public partial interface IMobilityServiceUpdate : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The OS type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The OS type.", + SerializedName = @"osType", + PossibleTypes = new [] { typeof(string) })] + string OSType { get; set; } + /// The reboot status of the update - whether it is required or not. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The reboot status of the update - whether it is required or not.", + SerializedName = @"rebootStatus", + PossibleTypes = new [] { typeof(string) })] + string RebootStatus { get; set; } + /// The version of the latest update. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The version of the latest update.", + SerializedName = @"version", + PossibleTypes = new [] { typeof(string) })] + string Version { get; set; } + + } + /// The Mobility Service update details. + internal partial interface IMobilityServiceUpdateInternal + + { + /// The OS type. + string OSType { get; set; } + /// The reboot status of the update - whether it is required or not. + string RebootStatus { get; set; } + /// The version of the latest update. + string Version { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MobilityServiceUpdate.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MobilityServiceUpdate.json.cs new file mode 100644 index 000000000000..e69fd44f47a6 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/MobilityServiceUpdate.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The Mobility Service update details. + public partial class MobilityServiceUpdate + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMobilityServiceUpdate. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMobilityServiceUpdate. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMobilityServiceUpdate FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new MobilityServiceUpdate(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal MobilityServiceUpdate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_version = If( json?.PropertyT("version"), out var __jsonVersion) ? (string)__jsonVersion : (string)Version;} + {_rebootStatus = If( json?.PropertyT("rebootStatus"), out var __jsonRebootStatus) ? (string)__jsonRebootStatus : (string)RebootStatus;} + {_oSType = If( json?.PropertyT("osType"), out var __jsonOSType) ? (string)__jsonOSType : (string)OSType;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._version)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._version.ToString()) : null, "version" ,container.Add ); + AddIf( null != (((object)this._rebootStatus)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._rebootStatus.ToString()) : null, "rebootStatus" ,container.Add ); + AddIf( null != (((object)this._oSType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._oSType.ToString()) : null, "osType" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Network.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Network.PowerShell.cs new file mode 100644 index 000000000000..071c0e786045 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Network.PowerShell.cs @@ -0,0 +1,208 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Network model. + [System.ComponentModel.TypeConverter(typeof(NetworkTypeConverter))] + public partial class Network + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetwork DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new Network(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetwork DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new Network(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetwork FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal Network(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.NetworkPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("FabricType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkInternal)this).FabricType = (string) content.GetValueForProperty("FabricType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkInternal)this).FabricType, global::System.Convert.ToString); + } + if (content.Contains("Subnet")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkInternal)this).Subnet = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISubnet[]) content.GetValueForProperty("Subnet",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkInternal)this).Subnet, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.SubnetTypeConverter.ConvertFrom)); + } + if (content.Contains("FriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkInternal)this).FriendlyName = (string) content.GetValueForProperty("FriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkInternal)this).FriendlyName, global::System.Convert.ToString); + } + if (content.Contains("NetworkType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkInternal)this).NetworkType = (string) content.GetValueForProperty("NetworkType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkInternal)this).NetworkType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal Network(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.NetworkPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("FabricType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkInternal)this).FabricType = (string) content.GetValueForProperty("FabricType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkInternal)this).FabricType, global::System.Convert.ToString); + } + if (content.Contains("Subnet")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkInternal)this).Subnet = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISubnet[]) content.GetValueForProperty("Subnet",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkInternal)this).Subnet, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.SubnetTypeConverter.ConvertFrom)); + } + if (content.Contains("FriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkInternal)this).FriendlyName = (string) content.GetValueForProperty("FriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkInternal)this).FriendlyName, global::System.Convert.ToString); + } + if (content.Contains("NetworkType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkInternal)this).NetworkType = (string) content.GetValueForProperty("NetworkType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkInternal)this).NetworkType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Network model. + [System.ComponentModel.TypeConverter(typeof(NetworkTypeConverter))] + public partial interface INetwork + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Network.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Network.TypeConverter.cs new file mode 100644 index 000000000000..ec733e0de605 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Network.TypeConverter.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class NetworkTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetwork ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetwork).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return Network.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return Network.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return Network.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Network.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Network.cs new file mode 100644 index 000000000000..0d6ae58332b0 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Network.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Network model. + public partial class Network : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetwork, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResource __resource = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.Resource(); + + /// The Fabric Type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string FabricType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkPropertiesInternal)Property).FabricType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkPropertiesInternal)Property).FabricType = value ?? null; } + + /// The Friendly Name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string FriendlyName { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkPropertiesInternal)Property).FriendlyName; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkPropertiesInternal)Property).FriendlyName = value ?? null; } + + /// Resource Id + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Id; } + + /// Resource Location + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string Location { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Location; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Location = value ?? null; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkProperties Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.NetworkProperties()); set { {_property = value;} } } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Id = value; } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Name = value; } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Type = value; } + + /// Resource Name + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Name; } + + /// The Network Type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string NetworkType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkPropertiesInternal)Property).NetworkType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkPropertiesInternal)Property).NetworkType = value ?? null; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkProperties _property; + + /// The Network Properties. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.NetworkProperties()); set => this._property = value; } + + /// The List of subnets. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISubnet[] Subnet { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkPropertiesInternal)Property).Subnet; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkPropertiesInternal)Property).Subnet = value ?? null /* arrayOf */; } + + /// Resource Type + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Type; } + + /// Creates an new instance. + public Network() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__resource), __resource); + await eventListener.AssertObjectIsValid(nameof(__resource), __resource); + } + } + /// Network model. + public partial interface INetwork : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResource + { + /// The Fabric Type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Fabric Type.", + SerializedName = @"fabricType", + PossibleTypes = new [] { typeof(string) })] + string FabricType { get; set; } + /// The Friendly Name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Friendly Name.", + SerializedName = @"friendlyName", + PossibleTypes = new [] { typeof(string) })] + string FriendlyName { get; set; } + /// The Network Type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Network Type.", + SerializedName = @"networkType", + PossibleTypes = new [] { typeof(string) })] + string NetworkType { get; set; } + /// The List of subnets. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The List of subnets.", + SerializedName = @"subnets", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISubnet) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISubnet[] Subnet { get; set; } + + } + /// Network model. + internal partial interface INetworkInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal + { + /// The Fabric Type. + string FabricType { get; set; } + /// The Friendly Name. + string FriendlyName { get; set; } + /// The Network Type. + string NetworkType { get; set; } + /// The Network Properties. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkProperties Property { get; set; } + /// The List of subnets. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISubnet[] Subnet { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Network.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Network.json.cs new file mode 100644 index 000000000000..0db7bf80bf2d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Network.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Network model. + public partial class Network + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetwork. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetwork. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetwork FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new Network(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal Network(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __resource = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.Resource(json); + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.NetworkProperties.FromJson(__jsonProperties) : Property;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __resource?.ToJson(container, serializationMode); + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/NetworkCollection.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/NetworkCollection.PowerShell.cs new file mode 100644 index 000000000000..2c2dcac66674 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/NetworkCollection.PowerShell.cs @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// List of networks. + [System.ComponentModel.TypeConverter(typeof(NetworkCollectionTypeConverter))] + public partial class NetworkCollection + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkCollection DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new NetworkCollection(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkCollection DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new NetworkCollection(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkCollection FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal NetworkCollection(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetwork[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.NetworkTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkCollectionInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkCollectionInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal NetworkCollection(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetwork[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.NetworkTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkCollectionInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkCollectionInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// List of networks. + [System.ComponentModel.TypeConverter(typeof(NetworkCollectionTypeConverter))] + public partial interface INetworkCollection + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/NetworkCollection.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/NetworkCollection.TypeConverter.cs new file mode 100644 index 000000000000..39d97a1b4df1 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/NetworkCollection.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class NetworkCollectionTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkCollection ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkCollection).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return NetworkCollection.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return NetworkCollection.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return NetworkCollection.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/NetworkCollection.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/NetworkCollection.cs new file mode 100644 index 000000000000..2b52f06de4dc --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/NetworkCollection.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// List of networks. + public partial class NetworkCollection : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkCollection, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkCollectionInternal + { + + /// Backing field for property. + private string _nextLink; + + /// The value of next link. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string NextLink { get => this._nextLink; set => this._nextLink = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetwork[] _value; + + /// The Networks list details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetwork[] Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public NetworkCollection() + { + + } + } + /// List of networks. + public partial interface INetworkCollection : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The value of next link. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The value of next link.", + SerializedName = @"nextLink", + PossibleTypes = new [] { typeof(string) })] + string NextLink { get; set; } + /// The Networks list details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Networks list details.", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetwork) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetwork[] Value { get; set; } + + } + /// List of networks. + internal partial interface INetworkCollectionInternal + + { + /// The value of next link. + string NextLink { get; set; } + /// The Networks list details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetwork[] Value { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/NetworkCollection.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/NetworkCollection.json.cs new file mode 100644 index 000000000000..bd5aad7271c2 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/NetworkCollection.json.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// List of networks. + public partial class NetworkCollection + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkCollection. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkCollection. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkCollection FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new NetworkCollection(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal NetworkCollection(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetwork) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.Network.FromJson(__u) )) ))() : null : Value;} + {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)NextLink;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._value) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._value ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("value",__w); + } + AddIf( null != (((object)this._nextLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/NetworkMapping.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/NetworkMapping.PowerShell.cs new file mode 100644 index 000000000000..02ad754cb857 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/NetworkMapping.PowerShell.cs @@ -0,0 +1,264 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// 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. + /// + [System.ComponentModel.TypeConverter(typeof(NetworkMappingTypeConverter))] + public partial class NetworkMapping + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMapping DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new NetworkMapping(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMapping DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new NetworkMapping(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMapping FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal NetworkMapping(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.NetworkMappingPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("FabricSpecificSetting")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingInternal)this).FabricSpecificSetting = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingFabricSpecificSettings) content.GetValueForProperty("FabricSpecificSetting",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingInternal)this).FabricSpecificSetting, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.NetworkMappingFabricSpecificSettingsTypeConverter.ConvertFrom); + } + if (content.Contains("State")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingInternal)this).State = (string) content.GetValueForProperty("State",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingInternal)this).State, global::System.Convert.ToString); + } + if (content.Contains("PrimaryNetworkFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingInternal)this).PrimaryNetworkFriendlyName = (string) content.GetValueForProperty("PrimaryNetworkFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingInternal)this).PrimaryNetworkFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("PrimaryNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingInternal)this).PrimaryNetworkId = (string) content.GetValueForProperty("PrimaryNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingInternal)this).PrimaryNetworkId, global::System.Convert.ToString); + } + if (content.Contains("PrimaryFabricFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingInternal)this).PrimaryFabricFriendlyName = (string) content.GetValueForProperty("PrimaryFabricFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingInternal)this).PrimaryFabricFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("RecoveryNetworkFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingInternal)this).RecoveryNetworkFriendlyName = (string) content.GetValueForProperty("RecoveryNetworkFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingInternal)this).RecoveryNetworkFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("RecoveryNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingInternal)this).RecoveryNetworkId = (string) content.GetValueForProperty("RecoveryNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingInternal)this).RecoveryNetworkId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryFabricArmId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingInternal)this).RecoveryFabricArmId = (string) content.GetValueForProperty("RecoveryFabricArmId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingInternal)this).RecoveryFabricArmId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryFabricFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingInternal)this).RecoveryFabricFriendlyName = (string) content.GetValueForProperty("RecoveryFabricFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingInternal)this).RecoveryFabricFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("FabricSpecificSettingInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingInternal)this).FabricSpecificSettingInstanceType = (string) content.GetValueForProperty("FabricSpecificSettingInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingInternal)this).FabricSpecificSettingInstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal NetworkMapping(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.NetworkMappingPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("FabricSpecificSetting")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingInternal)this).FabricSpecificSetting = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingFabricSpecificSettings) content.GetValueForProperty("FabricSpecificSetting",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingInternal)this).FabricSpecificSetting, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.NetworkMappingFabricSpecificSettingsTypeConverter.ConvertFrom); + } + if (content.Contains("State")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingInternal)this).State = (string) content.GetValueForProperty("State",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingInternal)this).State, global::System.Convert.ToString); + } + if (content.Contains("PrimaryNetworkFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingInternal)this).PrimaryNetworkFriendlyName = (string) content.GetValueForProperty("PrimaryNetworkFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingInternal)this).PrimaryNetworkFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("PrimaryNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingInternal)this).PrimaryNetworkId = (string) content.GetValueForProperty("PrimaryNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingInternal)this).PrimaryNetworkId, global::System.Convert.ToString); + } + if (content.Contains("PrimaryFabricFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingInternal)this).PrimaryFabricFriendlyName = (string) content.GetValueForProperty("PrimaryFabricFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingInternal)this).PrimaryFabricFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("RecoveryNetworkFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingInternal)this).RecoveryNetworkFriendlyName = (string) content.GetValueForProperty("RecoveryNetworkFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingInternal)this).RecoveryNetworkFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("RecoveryNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingInternal)this).RecoveryNetworkId = (string) content.GetValueForProperty("RecoveryNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingInternal)this).RecoveryNetworkId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryFabricArmId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingInternal)this).RecoveryFabricArmId = (string) content.GetValueForProperty("RecoveryFabricArmId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingInternal)this).RecoveryFabricArmId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryFabricFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingInternal)this).RecoveryFabricFriendlyName = (string) content.GetValueForProperty("RecoveryFabricFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingInternal)this).RecoveryFabricFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("FabricSpecificSettingInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingInternal)this).FabricSpecificSettingInstanceType = (string) content.GetValueForProperty("FabricSpecificSettingInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingInternal)this).FabricSpecificSettingInstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// 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. + [System.ComponentModel.TypeConverter(typeof(NetworkMappingTypeConverter))] + public partial interface INetworkMapping + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/NetworkMapping.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/NetworkMapping.TypeConverter.cs new file mode 100644 index 000000000000..d9464d243153 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/NetworkMapping.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class NetworkMappingTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMapping ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMapping).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return NetworkMapping.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return NetworkMapping.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return NetworkMapping.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/NetworkMapping.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/NetworkMapping.cs new file mode 100644 index 000000000000..11153d7f71a6 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/NetworkMapping.cs @@ -0,0 +1,232 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// + /// 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. + /// + public partial class NetworkMapping : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMapping, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResource __resource = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.Resource(); + + /// Gets the Instance type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string FabricSpecificSettingInstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingPropertiesInternal)Property).FabricSpecificSettingInstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingPropertiesInternal)Property).FabricSpecificSettingInstanceType = value ?? null; } + + /// Resource Id + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Id; } + + /// Resource Location + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string Location { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Location; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Location = value ?? null; } + + /// Internal Acessors for FabricSpecificSetting + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingFabricSpecificSettings Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingInternal.FabricSpecificSetting { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingPropertiesInternal)Property).FabricSpecificSetting; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingPropertiesInternal)Property).FabricSpecificSetting = value; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingProperties Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.NetworkMappingProperties()); set { {_property = value;} } } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Id = value; } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Name = value; } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Type = value; } + + /// Resource Name + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Name; } + + /// The primary fabric friendly name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string PrimaryFabricFriendlyName { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingPropertiesInternal)Property).PrimaryFabricFriendlyName; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingPropertiesInternal)Property).PrimaryFabricFriendlyName = value ?? null; } + + /// The primary network friendly name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string PrimaryNetworkFriendlyName { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingPropertiesInternal)Property).PrimaryNetworkFriendlyName; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingPropertiesInternal)Property).PrimaryNetworkFriendlyName = value ?? null; } + + /// The primary network id for network mapping. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string PrimaryNetworkId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingPropertiesInternal)Property).PrimaryNetworkId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingPropertiesInternal)Property).PrimaryNetworkId = value ?? null; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingProperties _property; + + /// The Network Mapping Properties. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.NetworkMappingProperties()); set => this._property = value; } + + /// The recovery fabric ARM id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string RecoveryFabricArmId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingPropertiesInternal)Property).RecoveryFabricArmId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingPropertiesInternal)Property).RecoveryFabricArmId = value ?? null; } + + /// The recovery fabric friendly name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string RecoveryFabricFriendlyName { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingPropertiesInternal)Property).RecoveryFabricFriendlyName; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingPropertiesInternal)Property).RecoveryFabricFriendlyName = value ?? null; } + + /// The recovery network friendly name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string RecoveryNetworkFriendlyName { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingPropertiesInternal)Property).RecoveryNetworkFriendlyName; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingPropertiesInternal)Property).RecoveryNetworkFriendlyName = value ?? null; } + + /// The recovery network id for network mapping. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string RecoveryNetworkId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingPropertiesInternal)Property).RecoveryNetworkId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingPropertiesInternal)Property).RecoveryNetworkId = value ?? null; } + + /// The pairing state for network mapping. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string State { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingPropertiesInternal)Property).State; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingPropertiesInternal)Property).State = value ?? null; } + + /// Resource Type + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Type; } + + /// Creates an new instance. + public NetworkMapping() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__resource), __resource); + await eventListener.AssertObjectIsValid(nameof(__resource), __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. + public partial interface INetworkMapping : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResource + { + /// Gets the Instance type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets the Instance type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string FabricSpecificSettingInstanceType { get; set; } + /// The primary fabric friendly name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The primary fabric friendly name.", + SerializedName = @"primaryFabricFriendlyName", + PossibleTypes = new [] { typeof(string) })] + string PrimaryFabricFriendlyName { get; set; } + /// The primary network friendly name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The primary network friendly name.", + SerializedName = @"primaryNetworkFriendlyName", + PossibleTypes = new [] { typeof(string) })] + string PrimaryNetworkFriendlyName { get; set; } + /// The primary network id for network mapping. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The primary network id for network mapping.", + SerializedName = @"primaryNetworkId", + PossibleTypes = new [] { typeof(string) })] + string PrimaryNetworkId { get; set; } + /// The recovery fabric ARM id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery fabric ARM id.", + SerializedName = @"recoveryFabricArmId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryFabricArmId { get; set; } + /// The recovery fabric friendly name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery fabric friendly name.", + SerializedName = @"recoveryFabricFriendlyName", + PossibleTypes = new [] { typeof(string) })] + string RecoveryFabricFriendlyName { get; set; } + /// The recovery network friendly name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery network friendly name.", + SerializedName = @"recoveryNetworkFriendlyName", + PossibleTypes = new [] { typeof(string) })] + string RecoveryNetworkFriendlyName { get; set; } + /// The recovery network id for network mapping. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery network id for network mapping.", + SerializedName = @"recoveryNetworkId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryNetworkId { get; set; } + /// The pairing state for network mapping. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The pairing state for network mapping.", + SerializedName = @"state", + PossibleTypes = new [] { typeof(string) })] + string State { get; set; } + + } + /// 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. + internal partial interface INetworkMappingInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal + { + /// The fabric specific settings. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingFabricSpecificSettings FabricSpecificSetting { get; set; } + /// Gets the Instance type. + string FabricSpecificSettingInstanceType { get; set; } + /// The primary fabric friendly name. + string PrimaryFabricFriendlyName { get; set; } + /// The primary network friendly name. + string PrimaryNetworkFriendlyName { get; set; } + /// The primary network id for network mapping. + string PrimaryNetworkId { get; set; } + /// The Network Mapping Properties. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingProperties Property { get; set; } + /// The recovery fabric ARM id. + string RecoveryFabricArmId { get; set; } + /// The recovery fabric friendly name. + string RecoveryFabricFriendlyName { get; set; } + /// The recovery network friendly name. + string RecoveryNetworkFriendlyName { get; set; } + /// The recovery network id for network mapping. + string RecoveryNetworkId { get; set; } + /// The pairing state for network mapping. + string State { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/NetworkMapping.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/NetworkMapping.json.cs new file mode 100644 index 000000000000..ee4d61150a06 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/NetworkMapping.json.cs @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// + /// 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. + /// + public partial class NetworkMapping + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMapping. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMapping. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMapping FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new NetworkMapping(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal NetworkMapping(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __resource = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.Resource(json); + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.NetworkMappingProperties.FromJson(__jsonProperties) : Property;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __resource?.ToJson(container, serializationMode); + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/NetworkMappingCollection.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/NetworkMappingCollection.PowerShell.cs new file mode 100644 index 000000000000..bab04fd6ed33 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/NetworkMappingCollection.PowerShell.cs @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// 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. + /// + [System.ComponentModel.TypeConverter(typeof(NetworkMappingCollectionTypeConverter))] + public partial class NetworkMappingCollection + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingCollection DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new NetworkMappingCollection(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingCollection DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new NetworkMappingCollection(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingCollection FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal NetworkMappingCollection(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMapping[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.NetworkMappingTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingCollectionInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingCollectionInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal NetworkMappingCollection(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMapping[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.NetworkMappingTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingCollectionInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingCollectionInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// 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. + [System.ComponentModel.TypeConverter(typeof(NetworkMappingCollectionTypeConverter))] + public partial interface INetworkMappingCollection + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/NetworkMappingCollection.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/NetworkMappingCollection.TypeConverter.cs new file mode 100644 index 000000000000..2323909fd404 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/NetworkMappingCollection.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class NetworkMappingCollectionTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingCollection ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingCollection).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return NetworkMappingCollection.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return NetworkMappingCollection.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return NetworkMappingCollection.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/NetworkMappingCollection.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/NetworkMappingCollection.cs new file mode 100644 index 000000000000..d3883ab650af --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/NetworkMappingCollection.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// + /// 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. + /// + public partial class NetworkMappingCollection : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingCollection, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingCollectionInternal + { + + /// Backing field for property. + private string _nextLink; + + /// The value of next link. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string NextLink { get => this._nextLink; set => this._nextLink = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMapping[] _value; + + /// The Network Mappings list. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMapping[] Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public NetworkMappingCollection() + { + + } + } + /// 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. + public partial interface INetworkMappingCollection : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The value of next link. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The value of next link.", + SerializedName = @"nextLink", + PossibleTypes = new [] { typeof(string) })] + string NextLink { get; set; } + /// The Network Mappings list. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Network Mappings list.", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMapping) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMapping[] Value { get; set; } + + } + /// 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. + internal partial interface INetworkMappingCollectionInternal + + { + /// The value of next link. + string NextLink { get; set; } + /// The Network Mappings list. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMapping[] Value { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/NetworkMappingCollection.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/NetworkMappingCollection.json.cs new file mode 100644 index 000000000000..ef96db25914d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/NetworkMappingCollection.json.cs @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// + /// 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. + /// + public partial class NetworkMappingCollection + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingCollection. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingCollection. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingCollection FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new NetworkMappingCollection(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal NetworkMappingCollection(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMapping) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.NetworkMapping.FromJson(__u) )) ))() : null : Value;} + {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)NextLink;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._value) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._value ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("value",__w); + } + AddIf( null != (((object)this._nextLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/NetworkMappingFabricSpecificSettings.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/NetworkMappingFabricSpecificSettings.PowerShell.cs new file mode 100644 index 000000000000..57611bad70a1 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/NetworkMappingFabricSpecificSettings.PowerShell.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Network Mapping fabric specific settings. + [System.ComponentModel.TypeConverter(typeof(NetworkMappingFabricSpecificSettingsTypeConverter))] + public partial class NetworkMappingFabricSpecificSettings + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingFabricSpecificSettings DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new NetworkMappingFabricSpecificSettings(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingFabricSpecificSettings DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new NetworkMappingFabricSpecificSettings(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingFabricSpecificSettings FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal NetworkMappingFabricSpecificSettings(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingFabricSpecificSettingsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingFabricSpecificSettingsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal NetworkMappingFabricSpecificSettings(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingFabricSpecificSettingsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingFabricSpecificSettingsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Network Mapping fabric specific settings. + [System.ComponentModel.TypeConverter(typeof(NetworkMappingFabricSpecificSettingsTypeConverter))] + public partial interface INetworkMappingFabricSpecificSettings + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/NetworkMappingFabricSpecificSettings.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/NetworkMappingFabricSpecificSettings.TypeConverter.cs new file mode 100644 index 000000000000..aa48140235ef --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/NetworkMappingFabricSpecificSettings.TypeConverter.cs @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class NetworkMappingFabricSpecificSettingsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingFabricSpecificSettings ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingFabricSpecificSettings).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return NetworkMappingFabricSpecificSettings.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return NetworkMappingFabricSpecificSettings.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return NetworkMappingFabricSpecificSettings.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/NetworkMappingFabricSpecificSettings.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/NetworkMappingFabricSpecificSettings.cs new file mode 100644 index 000000000000..ec3d388de3c5 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/NetworkMappingFabricSpecificSettings.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Network Mapping fabric specific settings. + public partial class NetworkMappingFabricSpecificSettings : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingFabricSpecificSettings, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingFabricSpecificSettingsInternal + { + + /// Backing field for property. + private string _instanceType; + + /// Gets the Instance type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string InstanceType { get => this._instanceType; set => this._instanceType = value; } + + /// Creates an new instance. + public NetworkMappingFabricSpecificSettings() + { + + } + } + /// Network Mapping fabric specific settings. + public partial interface INetworkMappingFabricSpecificSettings : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// Gets the Instance type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets the Instance type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string InstanceType { get; set; } + + } + /// Network Mapping fabric specific settings. + internal partial interface INetworkMappingFabricSpecificSettingsInternal + + { + /// Gets the Instance type. + string InstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/NetworkMappingFabricSpecificSettings.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/NetworkMappingFabricSpecificSettings.json.cs new file mode 100644 index 000000000000..057da90000d8 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/NetworkMappingFabricSpecificSettings.json.cs @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Network Mapping fabric specific settings. + public partial class NetworkMappingFabricSpecificSettings + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingFabricSpecificSettings. + /// Note: the Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingFabricSpecificSettings interface + /// is polymorphic, and the precise model class that will get deserialized is determined at runtime based on the payload. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingFabricSpecificSettings. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingFabricSpecificSettings FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + if (!(node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json)) + { + return null; + } + // Polymorphic type -- select the appropriate constructor using the discriminator + + switch ( json.StringProperty("instanceType") ) + { + case "AzureToAzure": + { + return new AzureToAzureNetworkMappingSettings(json); + } + case "VmmToAzure": + { + return new VmmToAzureNetworkMappingSettings(json); + } + case "VmmToVmm": + { + return new VmmToVmmNetworkMappingSettings(json); + } + } + return new NetworkMappingFabricSpecificSettings(json); + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal NetworkMappingFabricSpecificSettings(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_instanceType = If( json?.PropertyT("instanceType"), out var __jsonInstanceType) ? (string)__jsonInstanceType : (string)InstanceType;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._instanceType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._instanceType.ToString()) : null, "instanceType" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/NetworkMappingProperties.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/NetworkMappingProperties.PowerShell.cs new file mode 100644 index 000000000000..7160d30232d7 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/NetworkMappingProperties.PowerShell.cs @@ -0,0 +1,218 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Network Mapping Properties. + [System.ComponentModel.TypeConverter(typeof(NetworkMappingPropertiesTypeConverter))] + public partial class NetworkMappingProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new NetworkMappingProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new NetworkMappingProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal NetworkMappingProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("FabricSpecificSetting")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingPropertiesInternal)this).FabricSpecificSetting = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingFabricSpecificSettings) content.GetValueForProperty("FabricSpecificSetting",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingPropertiesInternal)this).FabricSpecificSetting, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.NetworkMappingFabricSpecificSettingsTypeConverter.ConvertFrom); + } + if (content.Contains("State")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingPropertiesInternal)this).State = (string) content.GetValueForProperty("State",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingPropertiesInternal)this).State, global::System.Convert.ToString); + } + if (content.Contains("PrimaryNetworkFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingPropertiesInternal)this).PrimaryNetworkFriendlyName = (string) content.GetValueForProperty("PrimaryNetworkFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingPropertiesInternal)this).PrimaryNetworkFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("PrimaryNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingPropertiesInternal)this).PrimaryNetworkId = (string) content.GetValueForProperty("PrimaryNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingPropertiesInternal)this).PrimaryNetworkId, global::System.Convert.ToString); + } + if (content.Contains("PrimaryFabricFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingPropertiesInternal)this).PrimaryFabricFriendlyName = (string) content.GetValueForProperty("PrimaryFabricFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingPropertiesInternal)this).PrimaryFabricFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("RecoveryNetworkFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingPropertiesInternal)this).RecoveryNetworkFriendlyName = (string) content.GetValueForProperty("RecoveryNetworkFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingPropertiesInternal)this).RecoveryNetworkFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("RecoveryNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingPropertiesInternal)this).RecoveryNetworkId = (string) content.GetValueForProperty("RecoveryNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingPropertiesInternal)this).RecoveryNetworkId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryFabricArmId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingPropertiesInternal)this).RecoveryFabricArmId = (string) content.GetValueForProperty("RecoveryFabricArmId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingPropertiesInternal)this).RecoveryFabricArmId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryFabricFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingPropertiesInternal)this).RecoveryFabricFriendlyName = (string) content.GetValueForProperty("RecoveryFabricFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingPropertiesInternal)this).RecoveryFabricFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("FabricSpecificSettingInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingPropertiesInternal)this).FabricSpecificSettingInstanceType = (string) content.GetValueForProperty("FabricSpecificSettingInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingPropertiesInternal)this).FabricSpecificSettingInstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal NetworkMappingProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("FabricSpecificSetting")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingPropertiesInternal)this).FabricSpecificSetting = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingFabricSpecificSettings) content.GetValueForProperty("FabricSpecificSetting",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingPropertiesInternal)this).FabricSpecificSetting, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.NetworkMappingFabricSpecificSettingsTypeConverter.ConvertFrom); + } + if (content.Contains("State")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingPropertiesInternal)this).State = (string) content.GetValueForProperty("State",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingPropertiesInternal)this).State, global::System.Convert.ToString); + } + if (content.Contains("PrimaryNetworkFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingPropertiesInternal)this).PrimaryNetworkFriendlyName = (string) content.GetValueForProperty("PrimaryNetworkFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingPropertiesInternal)this).PrimaryNetworkFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("PrimaryNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingPropertiesInternal)this).PrimaryNetworkId = (string) content.GetValueForProperty("PrimaryNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingPropertiesInternal)this).PrimaryNetworkId, global::System.Convert.ToString); + } + if (content.Contains("PrimaryFabricFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingPropertiesInternal)this).PrimaryFabricFriendlyName = (string) content.GetValueForProperty("PrimaryFabricFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingPropertiesInternal)this).PrimaryFabricFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("RecoveryNetworkFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingPropertiesInternal)this).RecoveryNetworkFriendlyName = (string) content.GetValueForProperty("RecoveryNetworkFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingPropertiesInternal)this).RecoveryNetworkFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("RecoveryNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingPropertiesInternal)this).RecoveryNetworkId = (string) content.GetValueForProperty("RecoveryNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingPropertiesInternal)this).RecoveryNetworkId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryFabricArmId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingPropertiesInternal)this).RecoveryFabricArmId = (string) content.GetValueForProperty("RecoveryFabricArmId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingPropertiesInternal)this).RecoveryFabricArmId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryFabricFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingPropertiesInternal)this).RecoveryFabricFriendlyName = (string) content.GetValueForProperty("RecoveryFabricFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingPropertiesInternal)this).RecoveryFabricFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("FabricSpecificSettingInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingPropertiesInternal)this).FabricSpecificSettingInstanceType = (string) content.GetValueForProperty("FabricSpecificSettingInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingPropertiesInternal)this).FabricSpecificSettingInstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Network Mapping Properties. + [System.ComponentModel.TypeConverter(typeof(NetworkMappingPropertiesTypeConverter))] + public partial interface INetworkMappingProperties + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/NetworkMappingProperties.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/NetworkMappingProperties.TypeConverter.cs new file mode 100644 index 000000000000..1aed78993454 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/NetworkMappingProperties.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class NetworkMappingPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return NetworkMappingProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return NetworkMappingProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return NetworkMappingProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/NetworkMappingProperties.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/NetworkMappingProperties.cs new file mode 100644 index 000000000000..9ff5cea32cd8 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/NetworkMappingProperties.cs @@ -0,0 +1,196 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Network Mapping Properties. + public partial class NetworkMappingProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingProperties, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingPropertiesInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingFabricSpecificSettings _fabricSpecificSetting; + + /// The fabric specific settings. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingFabricSpecificSettings FabricSpecificSetting { get => (this._fabricSpecificSetting = this._fabricSpecificSetting ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.NetworkMappingFabricSpecificSettings()); set => this._fabricSpecificSetting = value; } + + /// Gets the Instance type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string FabricSpecificSettingInstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingFabricSpecificSettingsInternal)FabricSpecificSetting).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingFabricSpecificSettingsInternal)FabricSpecificSetting).InstanceType = value ?? null; } + + /// Internal Acessors for FabricSpecificSetting + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingFabricSpecificSettings Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingPropertiesInternal.FabricSpecificSetting { get => (this._fabricSpecificSetting = this._fabricSpecificSetting ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.NetworkMappingFabricSpecificSettings()); set { {_fabricSpecificSetting = value;} } } + + /// Backing field for property. + private string _primaryFabricFriendlyName; + + /// The primary fabric friendly name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string PrimaryFabricFriendlyName { get => this._primaryFabricFriendlyName; set => this._primaryFabricFriendlyName = value; } + + /// Backing field for property. + private string _primaryNetworkFriendlyName; + + /// The primary network friendly name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string PrimaryNetworkFriendlyName { get => this._primaryNetworkFriendlyName; set => this._primaryNetworkFriendlyName = value; } + + /// Backing field for property. + private string _primaryNetworkId; + + /// The primary network id for network mapping. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string PrimaryNetworkId { get => this._primaryNetworkId; set => this._primaryNetworkId = value; } + + /// Backing field for property. + private string _recoveryFabricArmId; + + /// The recovery fabric ARM id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryFabricArmId { get => this._recoveryFabricArmId; set => this._recoveryFabricArmId = value; } + + /// Backing field for property. + private string _recoveryFabricFriendlyName; + + /// The recovery fabric friendly name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryFabricFriendlyName { get => this._recoveryFabricFriendlyName; set => this._recoveryFabricFriendlyName = value; } + + /// Backing field for property. + private string _recoveryNetworkFriendlyName; + + /// The recovery network friendly name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryNetworkFriendlyName { get => this._recoveryNetworkFriendlyName; set => this._recoveryNetworkFriendlyName = value; } + + /// Backing field for property. + private string _recoveryNetworkId; + + /// The recovery network id for network mapping. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryNetworkId { get => this._recoveryNetworkId; set => this._recoveryNetworkId = value; } + + /// Backing field for property. + private string _state; + + /// The pairing state for network mapping. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string State { get => this._state; set => this._state = value; } + + /// Creates an new instance. + public NetworkMappingProperties() + { + + } + } + /// Network Mapping Properties. + public partial interface INetworkMappingProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// Gets the Instance type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets the Instance type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string FabricSpecificSettingInstanceType { get; set; } + /// The primary fabric friendly name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The primary fabric friendly name.", + SerializedName = @"primaryFabricFriendlyName", + PossibleTypes = new [] { typeof(string) })] + string PrimaryFabricFriendlyName { get; set; } + /// The primary network friendly name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The primary network friendly name.", + SerializedName = @"primaryNetworkFriendlyName", + PossibleTypes = new [] { typeof(string) })] + string PrimaryNetworkFriendlyName { get; set; } + /// The primary network id for network mapping. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The primary network id for network mapping.", + SerializedName = @"primaryNetworkId", + PossibleTypes = new [] { typeof(string) })] + string PrimaryNetworkId { get; set; } + /// The recovery fabric ARM id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery fabric ARM id.", + SerializedName = @"recoveryFabricArmId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryFabricArmId { get; set; } + /// The recovery fabric friendly name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery fabric friendly name.", + SerializedName = @"recoveryFabricFriendlyName", + PossibleTypes = new [] { typeof(string) })] + string RecoveryFabricFriendlyName { get; set; } + /// The recovery network friendly name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery network friendly name.", + SerializedName = @"recoveryNetworkFriendlyName", + PossibleTypes = new [] { typeof(string) })] + string RecoveryNetworkFriendlyName { get; set; } + /// The recovery network id for network mapping. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery network id for network mapping.", + SerializedName = @"recoveryNetworkId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryNetworkId { get; set; } + /// The pairing state for network mapping. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The pairing state for network mapping.", + SerializedName = @"state", + PossibleTypes = new [] { typeof(string) })] + string State { get; set; } + + } + /// Network Mapping Properties. + internal partial interface INetworkMappingPropertiesInternal + + { + /// The fabric specific settings. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingFabricSpecificSettings FabricSpecificSetting { get; set; } + /// Gets the Instance type. + string FabricSpecificSettingInstanceType { get; set; } + /// The primary fabric friendly name. + string PrimaryFabricFriendlyName { get; set; } + /// The primary network friendly name. + string PrimaryNetworkFriendlyName { get; set; } + /// The primary network id for network mapping. + string PrimaryNetworkId { get; set; } + /// The recovery fabric ARM id. + string RecoveryFabricArmId { get; set; } + /// The recovery fabric friendly name. + string RecoveryFabricFriendlyName { get; set; } + /// The recovery network friendly name. + string RecoveryNetworkFriendlyName { get; set; } + /// The recovery network id for network mapping. + string RecoveryNetworkId { get; set; } + /// The pairing state for network mapping. + string State { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/NetworkMappingProperties.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/NetworkMappingProperties.json.cs new file mode 100644 index 000000000000..041e52f99d4a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/NetworkMappingProperties.json.cs @@ -0,0 +1,124 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Network Mapping Properties. + public partial class NetworkMappingProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new NetworkMappingProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal NetworkMappingProperties(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_fabricSpecificSetting = If( json?.PropertyT("fabricSpecificSettings"), out var __jsonFabricSpecificSettings) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.NetworkMappingFabricSpecificSettings.FromJson(__jsonFabricSpecificSettings) : FabricSpecificSetting;} + {_state = If( json?.PropertyT("state"), out var __jsonState) ? (string)__jsonState : (string)State;} + {_primaryNetworkFriendlyName = If( json?.PropertyT("primaryNetworkFriendlyName"), out var __jsonPrimaryNetworkFriendlyName) ? (string)__jsonPrimaryNetworkFriendlyName : (string)PrimaryNetworkFriendlyName;} + {_primaryNetworkId = If( json?.PropertyT("primaryNetworkId"), out var __jsonPrimaryNetworkId) ? (string)__jsonPrimaryNetworkId : (string)PrimaryNetworkId;} + {_primaryFabricFriendlyName = If( json?.PropertyT("primaryFabricFriendlyName"), out var __jsonPrimaryFabricFriendlyName) ? (string)__jsonPrimaryFabricFriendlyName : (string)PrimaryFabricFriendlyName;} + {_recoveryNetworkFriendlyName = If( json?.PropertyT("recoveryNetworkFriendlyName"), out var __jsonRecoveryNetworkFriendlyName) ? (string)__jsonRecoveryNetworkFriendlyName : (string)RecoveryNetworkFriendlyName;} + {_recoveryNetworkId = If( json?.PropertyT("recoveryNetworkId"), out var __jsonRecoveryNetworkId) ? (string)__jsonRecoveryNetworkId : (string)RecoveryNetworkId;} + {_recoveryFabricArmId = If( json?.PropertyT("recoveryFabricArmId"), out var __jsonRecoveryFabricArmId) ? (string)__jsonRecoveryFabricArmId : (string)RecoveryFabricArmId;} + {_recoveryFabricFriendlyName = If( json?.PropertyT("recoveryFabricFriendlyName"), out var __jsonRecoveryFabricFriendlyName) ? (string)__jsonRecoveryFabricFriendlyName : (string)RecoveryFabricFriendlyName;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._fabricSpecificSetting ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._fabricSpecificSetting.ToJson(null,serializationMode) : null, "fabricSpecificSettings" ,container.Add ); + AddIf( null != (((object)this._state)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._state.ToString()) : null, "state" ,container.Add ); + AddIf( null != (((object)this._primaryNetworkFriendlyName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._primaryNetworkFriendlyName.ToString()) : null, "primaryNetworkFriendlyName" ,container.Add ); + AddIf( null != (((object)this._primaryNetworkId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._primaryNetworkId.ToString()) : null, "primaryNetworkId" ,container.Add ); + AddIf( null != (((object)this._primaryFabricFriendlyName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._primaryFabricFriendlyName.ToString()) : null, "primaryFabricFriendlyName" ,container.Add ); + AddIf( null != (((object)this._recoveryNetworkFriendlyName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryNetworkFriendlyName.ToString()) : null, "recoveryNetworkFriendlyName" ,container.Add ); + AddIf( null != (((object)this._recoveryNetworkId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryNetworkId.ToString()) : null, "recoveryNetworkId" ,container.Add ); + AddIf( null != (((object)this._recoveryFabricArmId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryFabricArmId.ToString()) : null, "recoveryFabricArmId" ,container.Add ); + AddIf( null != (((object)this._recoveryFabricFriendlyName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryFabricFriendlyName.ToString()) : null, "recoveryFabricFriendlyName" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/NetworkProperties.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/NetworkProperties.PowerShell.cs new file mode 100644 index 000000000000..6ddbe37fb520 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/NetworkProperties.PowerShell.cs @@ -0,0 +1,168 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Network Properties. + [System.ComponentModel.TypeConverter(typeof(NetworkPropertiesTypeConverter))] + public partial class NetworkProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new NetworkProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new NetworkProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal NetworkProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("FabricType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkPropertiesInternal)this).FabricType = (string) content.GetValueForProperty("FabricType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkPropertiesInternal)this).FabricType, global::System.Convert.ToString); + } + if (content.Contains("Subnet")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkPropertiesInternal)this).Subnet = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISubnet[]) content.GetValueForProperty("Subnet",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkPropertiesInternal)this).Subnet, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.SubnetTypeConverter.ConvertFrom)); + } + if (content.Contains("FriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkPropertiesInternal)this).FriendlyName = (string) content.GetValueForProperty("FriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkPropertiesInternal)this).FriendlyName, global::System.Convert.ToString); + } + if (content.Contains("NetworkType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkPropertiesInternal)this).NetworkType = (string) content.GetValueForProperty("NetworkType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkPropertiesInternal)this).NetworkType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal NetworkProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("FabricType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkPropertiesInternal)this).FabricType = (string) content.GetValueForProperty("FabricType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkPropertiesInternal)this).FabricType, global::System.Convert.ToString); + } + if (content.Contains("Subnet")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkPropertiesInternal)this).Subnet = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISubnet[]) content.GetValueForProperty("Subnet",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkPropertiesInternal)this).Subnet, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.SubnetTypeConverter.ConvertFrom)); + } + if (content.Contains("FriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkPropertiesInternal)this).FriendlyName = (string) content.GetValueForProperty("FriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkPropertiesInternal)this).FriendlyName, global::System.Convert.ToString); + } + if (content.Contains("NetworkType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkPropertiesInternal)this).NetworkType = (string) content.GetValueForProperty("NetworkType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkPropertiesInternal)this).NetworkType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Network Properties. + [System.ComponentModel.TypeConverter(typeof(NetworkPropertiesTypeConverter))] + public partial interface INetworkProperties + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/NetworkProperties.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/NetworkProperties.TypeConverter.cs new file mode 100644 index 000000000000..711910c04fd4 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/NetworkProperties.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class NetworkPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return NetworkProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return NetworkProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return NetworkProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/NetworkProperties.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/NetworkProperties.cs new file mode 100644 index 000000000000..5d566d6e937f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/NetworkProperties.cs @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Network Properties. + public partial class NetworkProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkProperties, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkPropertiesInternal + { + + /// Backing field for property. + private string _fabricType; + + /// The Fabric Type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string FabricType { get => this._fabricType; set => this._fabricType = value; } + + /// Backing field for property. + private string _friendlyName; + + /// The Friendly Name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string FriendlyName { get => this._friendlyName; set => this._friendlyName = value; } + + /// Backing field for property. + private string _networkType; + + /// The Network Type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string NetworkType { get => this._networkType; set => this._networkType = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISubnet[] _subnet; + + /// The List of subnets. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISubnet[] Subnet { get => this._subnet; set => this._subnet = value; } + + /// Creates an new instance. + public NetworkProperties() + { + + } + } + /// Network Properties. + public partial interface INetworkProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The Fabric Type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Fabric Type.", + SerializedName = @"fabricType", + PossibleTypes = new [] { typeof(string) })] + string FabricType { get; set; } + /// The Friendly Name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Friendly Name.", + SerializedName = @"friendlyName", + PossibleTypes = new [] { typeof(string) })] + string FriendlyName { get; set; } + /// The Network Type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Network Type.", + SerializedName = @"networkType", + PossibleTypes = new [] { typeof(string) })] + string NetworkType { get; set; } + /// The List of subnets. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The List of subnets.", + SerializedName = @"subnets", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISubnet) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISubnet[] Subnet { get; set; } + + } + /// Network Properties. + internal partial interface INetworkPropertiesInternal + + { + /// The Fabric Type. + string FabricType { get; set; } + /// The Friendly Name. + string FriendlyName { get; set; } + /// The Network Type. + string NetworkType { get; set; } + /// The List of subnets. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISubnet[] Subnet { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/NetworkProperties.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/NetworkProperties.json.cs new file mode 100644 index 000000000000..e29d4cdb91dc --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/NetworkProperties.json.cs @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Network Properties. + public partial class NetworkProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new NetworkProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal NetworkProperties(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_fabricType = If( json?.PropertyT("fabricType"), out var __jsonFabricType) ? (string)__jsonFabricType : (string)FabricType;} + {_subnet = If( json?.PropertyT("subnets"), out var __jsonSubnets) ? If( __jsonSubnets as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISubnet) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.Subnet.FromJson(__u) )) ))() : null : Subnet;} + {_friendlyName = If( json?.PropertyT("friendlyName"), out var __jsonFriendlyName) ? (string)__jsonFriendlyName : (string)FriendlyName;} + {_networkType = If( json?.PropertyT("networkType"), out var __jsonNetworkType) ? (string)__jsonNetworkType : (string)NetworkType;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._fabricType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._fabricType.ToString()) : null, "fabricType" ,container.Add ); + if (null != this._subnet) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._subnet ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("subnets",__w); + } + AddIf( null != (((object)this._friendlyName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._friendlyName.ToString()) : null, "friendlyName" ,container.Add ); + AddIf( null != (((object)this._networkType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._networkType.ToString()) : null, "networkType" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/NewProtectionProfile.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/NewProtectionProfile.PowerShell.cs new file mode 100644 index 000000000000..6ee3fc763597 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/NewProtectionProfile.PowerShell.cs @@ -0,0 +1,184 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// New Protection profile input. + [System.ComponentModel.TypeConverter(typeof(NewProtectionProfileTypeConverter))] + public partial class NewProtectionProfile + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INewProtectionProfile DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new NewProtectionProfile(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INewProtectionProfile DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new NewProtectionProfile(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INewProtectionProfile FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal NewProtectionProfile(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("PolicyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INewProtectionProfileInternal)this).PolicyName = (string) content.GetValueForProperty("PolicyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INewProtectionProfileInternal)this).PolicyName, global::System.Convert.ToString); + } + if (content.Contains("RecoveryPointHistory")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INewProtectionProfileInternal)this).RecoveryPointHistory = (int?) content.GetValueForProperty("RecoveryPointHistory",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INewProtectionProfileInternal)this).RecoveryPointHistory, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("CrashConsistentFrequencyInMinute")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INewProtectionProfileInternal)this).CrashConsistentFrequencyInMinute = (int?) content.GetValueForProperty("CrashConsistentFrequencyInMinute",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INewProtectionProfileInternal)this).CrashConsistentFrequencyInMinute, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("AppConsistentFrequencyInMinute")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INewProtectionProfileInternal)this).AppConsistentFrequencyInMinute = (int?) content.GetValueForProperty("AppConsistentFrequencyInMinute",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INewProtectionProfileInternal)this).AppConsistentFrequencyInMinute, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("MultiVMSyncStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INewProtectionProfileInternal)this).MultiVMSyncStatus = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SetMultiVMSyncStatus) content.GetValueForProperty("MultiVMSyncStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INewProtectionProfileInternal)this).MultiVMSyncStatus, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SetMultiVMSyncStatus.CreateFrom); + } + if (content.Contains("ResourceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionProfileCustomDetailsInternal)this).ResourceType = (string) content.GetValueForProperty("ResourceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionProfileCustomDetailsInternal)this).ResourceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal NewProtectionProfile(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("PolicyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INewProtectionProfileInternal)this).PolicyName = (string) content.GetValueForProperty("PolicyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INewProtectionProfileInternal)this).PolicyName, global::System.Convert.ToString); + } + if (content.Contains("RecoveryPointHistory")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INewProtectionProfileInternal)this).RecoveryPointHistory = (int?) content.GetValueForProperty("RecoveryPointHistory",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INewProtectionProfileInternal)this).RecoveryPointHistory, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("CrashConsistentFrequencyInMinute")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INewProtectionProfileInternal)this).CrashConsistentFrequencyInMinute = (int?) content.GetValueForProperty("CrashConsistentFrequencyInMinute",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INewProtectionProfileInternal)this).CrashConsistentFrequencyInMinute, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("AppConsistentFrequencyInMinute")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INewProtectionProfileInternal)this).AppConsistentFrequencyInMinute = (int?) content.GetValueForProperty("AppConsistentFrequencyInMinute",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INewProtectionProfileInternal)this).AppConsistentFrequencyInMinute, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("MultiVMSyncStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INewProtectionProfileInternal)this).MultiVMSyncStatus = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SetMultiVMSyncStatus) content.GetValueForProperty("MultiVMSyncStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INewProtectionProfileInternal)this).MultiVMSyncStatus, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SetMultiVMSyncStatus.CreateFrom); + } + if (content.Contains("ResourceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionProfileCustomDetailsInternal)this).ResourceType = (string) content.GetValueForProperty("ResourceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionProfileCustomDetailsInternal)this).ResourceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// New Protection profile input. + [System.ComponentModel.TypeConverter(typeof(NewProtectionProfileTypeConverter))] + public partial interface INewProtectionProfile + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/NewProtectionProfile.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/NewProtectionProfile.TypeConverter.cs new file mode 100644 index 000000000000..dc49373acc95 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/NewProtectionProfile.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class NewProtectionProfileTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INewProtectionProfile ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INewProtectionProfile).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return NewProtectionProfile.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return NewProtectionProfile.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return NewProtectionProfile.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/NewProtectionProfile.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/NewProtectionProfile.cs new file mode 100644 index 000000000000..38f4196534a0 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/NewProtectionProfile.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// New Protection profile input. + public partial class NewProtectionProfile : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INewProtectionProfile, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INewProtectionProfileInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionProfileCustomDetails __protectionProfileCustomDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProtectionProfileCustomDetails(); + + /// Backing field for property. + private int? _appConsistentFrequencyInMinute; + + /// The app consistent snapshot frequency (in minutes). + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? AppConsistentFrequencyInMinute { get => this._appConsistentFrequencyInMinute; set => this._appConsistentFrequencyInMinute = value; } + + /// Backing field for property. + private int? _crashConsistentFrequencyInMinute; + + /// The crash consistent snapshot frequency (in minutes). + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? CrashConsistentFrequencyInMinute { get => this._crashConsistentFrequencyInMinute; set => this._crashConsistentFrequencyInMinute = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SetMultiVMSyncStatus _multiVMSyncStatus; + + /// + /// A value indicating whether multi-VM sync has to be enabled. Value should be 'Enabled' or 'Disabled'. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SetMultiVMSyncStatus MultiVMSyncStatus { get => this._multiVMSyncStatus; set => this._multiVMSyncStatus = value; } + + /// Backing field for property. + private string _policyName; + + /// The protection profile input. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string PolicyName { get => this._policyName; set => this._policyName = value; } + + /// Backing field for property. + private int? _recoveryPointHistory; + + /// The duration in minutes until which the recovery points need to be stored. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? RecoveryPointHistory { get => this._recoveryPointHistory; set => this._recoveryPointHistory = value; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string ResourceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionProfileCustomDetailsInternal)__protectionProfileCustomDetails).ResourceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionProfileCustomDetailsInternal)__protectionProfileCustomDetails).ResourceType = value ; } + + /// Creates an new instance. + public NewProtectionProfile() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__protectionProfileCustomDetails), __protectionProfileCustomDetails); + await eventListener.AssertObjectIsValid(nameof(__protectionProfileCustomDetails), __protectionProfileCustomDetails); + } + } + /// New Protection profile input. + public partial interface INewProtectionProfile : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionProfileCustomDetails + { + /// The app consistent snapshot frequency (in minutes). + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The app consistent snapshot frequency (in minutes).", + SerializedName = @"appConsistentFrequencyInMinutes", + PossibleTypes = new [] { typeof(int) })] + int? AppConsistentFrequencyInMinute { get; set; } + /// The crash consistent snapshot frequency (in minutes). + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The crash consistent snapshot frequency (in minutes).", + SerializedName = @"crashConsistentFrequencyInMinutes", + PossibleTypes = new [] { typeof(int) })] + int? CrashConsistentFrequencyInMinute { get; set; } + /// + /// A value indicating whether multi-VM sync has to be enabled. Value should be 'Enabled' or 'Disabled'. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"A value indicating whether multi-VM sync has to be enabled. Value should be 'Enabled' or 'Disabled'.", + SerializedName = @"multiVmSyncStatus", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SetMultiVMSyncStatus) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SetMultiVMSyncStatus MultiVMSyncStatus { get; set; } + /// The protection profile input. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The protection profile input.", + SerializedName = @"policyName", + PossibleTypes = new [] { typeof(string) })] + string PolicyName { get; set; } + /// The duration in minutes until which the recovery points need to be stored. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The duration in minutes until which the recovery points need to be stored.", + SerializedName = @"recoveryPointHistory", + PossibleTypes = new [] { typeof(int) })] + int? RecoveryPointHistory { get; set; } + + } + /// New Protection profile input. + internal partial interface INewProtectionProfileInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionProfileCustomDetailsInternal + { + /// The app consistent snapshot frequency (in minutes). + int? AppConsistentFrequencyInMinute { get; set; } + /// The crash consistent snapshot frequency (in minutes). + int? CrashConsistentFrequencyInMinute { get; set; } + /// + /// A value indicating whether multi-VM sync has to be enabled. Value should be 'Enabled' or 'Disabled'. + /// + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SetMultiVMSyncStatus MultiVMSyncStatus { get; set; } + /// The protection profile input. + string PolicyName { get; set; } + /// The duration in minutes until which the recovery points need to be stored. + int? RecoveryPointHistory { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/NewProtectionProfile.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/NewProtectionProfile.json.cs new file mode 100644 index 000000000000..adc5e091dd15 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/NewProtectionProfile.json.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// New Protection profile input. + public partial class NewProtectionProfile + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INewProtectionProfile. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INewProtectionProfile. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INewProtectionProfile FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new NewProtectionProfile(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal NewProtectionProfile(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __protectionProfileCustomDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProtectionProfileCustomDetails(json); + {_policyName = If( json?.PropertyT("policyName"), out var __jsonPolicyName) ? (string)__jsonPolicyName : (string)PolicyName;} + {_recoveryPointHistory = If( json?.PropertyT("recoveryPointHistory"), out var __jsonRecoveryPointHistory) ? (int?)__jsonRecoveryPointHistory : RecoveryPointHistory;} + {_crashConsistentFrequencyInMinute = If( json?.PropertyT("crashConsistentFrequencyInMinutes"), out var __jsonCrashConsistentFrequencyInMinutes) ? (int?)__jsonCrashConsistentFrequencyInMinutes : CrashConsistentFrequencyInMinute;} + {_appConsistentFrequencyInMinute = If( json?.PropertyT("appConsistentFrequencyInMinutes"), out var __jsonAppConsistentFrequencyInMinutes) ? (int?)__jsonAppConsistentFrequencyInMinutes : AppConsistentFrequencyInMinute;} + {_multiVMSyncStatus = If( json?.PropertyT("multiVmSyncStatus"), out var __jsonMultiVMSyncStatus) ? (string)__jsonMultiVMSyncStatus : (string)MultiVMSyncStatus;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __protectionProfileCustomDetails?.ToJson(container, serializationMode); + AddIf( null != (((object)this._policyName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._policyName.ToString()) : null, "policyName" ,container.Add ); + AddIf( null != this._recoveryPointHistory ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._recoveryPointHistory) : null, "recoveryPointHistory" ,container.Add ); + AddIf( null != this._crashConsistentFrequencyInMinute ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._crashConsistentFrequencyInMinute) : null, "crashConsistentFrequencyInMinutes" ,container.Add ); + AddIf( null != this._appConsistentFrequencyInMinute ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._appConsistentFrequencyInMinute) : null, "appConsistentFrequencyInMinutes" ,container.Add ); + AddIf( null != (((object)this._multiVMSyncStatus)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._multiVMSyncStatus.ToString()) : null, "multiVmSyncStatus" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/NewRecoveryVirtualNetwork.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/NewRecoveryVirtualNetwork.PowerShell.cs new file mode 100644 index 000000000000..50841f64d5f5 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/NewRecoveryVirtualNetwork.PowerShell.cs @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// Recovery virtual network input to create new virtual network from given source network. + /// + [System.ComponentModel.TypeConverter(typeof(NewRecoveryVirtualNetworkTypeConverter))] + public partial class NewRecoveryVirtualNetwork + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INewRecoveryVirtualNetwork DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new NewRecoveryVirtualNetwork(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INewRecoveryVirtualNetwork DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new NewRecoveryVirtualNetwork(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INewRecoveryVirtualNetwork FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal NewRecoveryVirtualNetwork(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("RecoveryVirtualNetworkResourceGroupName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INewRecoveryVirtualNetworkInternal)this).RecoveryVirtualNetworkResourceGroupName = (string) content.GetValueForProperty("RecoveryVirtualNetworkResourceGroupName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INewRecoveryVirtualNetworkInternal)this).RecoveryVirtualNetworkResourceGroupName, global::System.Convert.ToString); + } + if (content.Contains("RecoveryVirtualNetworkName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INewRecoveryVirtualNetworkInternal)this).RecoveryVirtualNetworkName = (string) content.GetValueForProperty("RecoveryVirtualNetworkName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INewRecoveryVirtualNetworkInternal)this).RecoveryVirtualNetworkName, global::System.Convert.ToString); + } + if (content.Contains("ResourceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryVirtualNetworkCustomDetailsInternal)this).ResourceType = (string) content.GetValueForProperty("ResourceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryVirtualNetworkCustomDetailsInternal)this).ResourceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal NewRecoveryVirtualNetwork(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("RecoveryVirtualNetworkResourceGroupName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INewRecoveryVirtualNetworkInternal)this).RecoveryVirtualNetworkResourceGroupName = (string) content.GetValueForProperty("RecoveryVirtualNetworkResourceGroupName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INewRecoveryVirtualNetworkInternal)this).RecoveryVirtualNetworkResourceGroupName, global::System.Convert.ToString); + } + if (content.Contains("RecoveryVirtualNetworkName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INewRecoveryVirtualNetworkInternal)this).RecoveryVirtualNetworkName = (string) content.GetValueForProperty("RecoveryVirtualNetworkName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INewRecoveryVirtualNetworkInternal)this).RecoveryVirtualNetworkName, global::System.Convert.ToString); + } + if (content.Contains("ResourceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryVirtualNetworkCustomDetailsInternal)this).ResourceType = (string) content.GetValueForProperty("ResourceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryVirtualNetworkCustomDetailsInternal)this).ResourceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Recovery virtual network input to create new virtual network from given source network. + [System.ComponentModel.TypeConverter(typeof(NewRecoveryVirtualNetworkTypeConverter))] + public partial interface INewRecoveryVirtualNetwork + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/NewRecoveryVirtualNetwork.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/NewRecoveryVirtualNetwork.TypeConverter.cs new file mode 100644 index 000000000000..81fde503b0b7 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/NewRecoveryVirtualNetwork.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class NewRecoveryVirtualNetworkTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INewRecoveryVirtualNetwork ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INewRecoveryVirtualNetwork).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return NewRecoveryVirtualNetwork.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return NewRecoveryVirtualNetwork.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return NewRecoveryVirtualNetwork.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/NewRecoveryVirtualNetwork.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/NewRecoveryVirtualNetwork.cs new file mode 100644 index 000000000000..de25e154da68 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/NewRecoveryVirtualNetwork.cs @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// + /// Recovery virtual network input to create new virtual network from given source network. + /// + public partial class NewRecoveryVirtualNetwork : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INewRecoveryVirtualNetwork, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INewRecoveryVirtualNetworkInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryVirtualNetworkCustomDetails __recoveryVirtualNetworkCustomDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryVirtualNetworkCustomDetails(); + + /// Backing field for property. + private string _recoveryVirtualNetworkName; + + /// The recovery virtual network name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryVirtualNetworkName { get => this._recoveryVirtualNetworkName; set => this._recoveryVirtualNetworkName = value; } + + /// + /// Backing field for property. + /// + private string _recoveryVirtualNetworkResourceGroupName; + + /// + /// 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. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryVirtualNetworkResourceGroupName { get => this._recoveryVirtualNetworkResourceGroupName; set => this._recoveryVirtualNetworkResourceGroupName = value; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string ResourceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryVirtualNetworkCustomDetailsInternal)__recoveryVirtualNetworkCustomDetails).ResourceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryVirtualNetworkCustomDetailsInternal)__recoveryVirtualNetworkCustomDetails).ResourceType = value ; } + + /// Creates an new instance. + public NewRecoveryVirtualNetwork() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__recoveryVirtualNetworkCustomDetails), __recoveryVirtualNetworkCustomDetails); + await eventListener.AssertObjectIsValid(nameof(__recoveryVirtualNetworkCustomDetails), __recoveryVirtualNetworkCustomDetails); + } + } + /// Recovery virtual network input to create new virtual network from given source network. + public partial interface INewRecoveryVirtualNetwork : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryVirtualNetworkCustomDetails + { + /// The recovery virtual network name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery virtual network name.", + SerializedName = @"recoveryVirtualNetworkName", + PossibleTypes = new [] { typeof(string) })] + string RecoveryVirtualNetworkName { get; set; } + /// + /// 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. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"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.", + SerializedName = @"recoveryVirtualNetworkResourceGroupName", + PossibleTypes = new [] { typeof(string) })] + string RecoveryVirtualNetworkResourceGroupName { get; set; } + + } + /// Recovery virtual network input to create new virtual network from given source network. + internal partial interface INewRecoveryVirtualNetworkInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryVirtualNetworkCustomDetailsInternal + { + /// The recovery virtual network name. + string RecoveryVirtualNetworkName { get; set; } + /// + /// 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. + /// + string RecoveryVirtualNetworkResourceGroupName { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/NewRecoveryVirtualNetwork.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/NewRecoveryVirtualNetwork.json.cs new file mode 100644 index 000000000000..5ecf5da7dbb9 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/NewRecoveryVirtualNetwork.json.cs @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// + /// Recovery virtual network input to create new virtual network from given source network. + /// + public partial class NewRecoveryVirtualNetwork + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INewRecoveryVirtualNetwork. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INewRecoveryVirtualNetwork. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INewRecoveryVirtualNetwork FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new NewRecoveryVirtualNetwork(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal NewRecoveryVirtualNetwork(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __recoveryVirtualNetworkCustomDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryVirtualNetworkCustomDetails(json); + {_recoveryVirtualNetworkResourceGroupName = If( json?.PropertyT("recoveryVirtualNetworkResourceGroupName"), out var __jsonRecoveryVirtualNetworkResourceGroupName) ? (string)__jsonRecoveryVirtualNetworkResourceGroupName : (string)RecoveryVirtualNetworkResourceGroupName;} + {_recoveryVirtualNetworkName = If( json?.PropertyT("recoveryVirtualNetworkName"), out var __jsonRecoveryVirtualNetworkName) ? (string)__jsonRecoveryVirtualNetworkName : (string)RecoveryVirtualNetworkName;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __recoveryVirtualNetworkCustomDetails?.ToJson(container, serializationMode); + AddIf( null != (((object)this._recoveryVirtualNetworkResourceGroupName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryVirtualNetworkResourceGroupName.ToString()) : null, "recoveryVirtualNetworkResourceGroupName" ,container.Add ); + AddIf( null != (((object)this._recoveryVirtualNetworkName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryVirtualNetworkName.ToString()) : null, "recoveryVirtualNetworkName" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/OSDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/OSDetails.PowerShell.cs new file mode 100644 index 000000000000..cf28ba060113 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/OSDetails.PowerShell.cs @@ -0,0 +1,184 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Disk Details. + [System.ComponentModel.TypeConverter(typeof(OSDetailsTypeConverter))] + public partial class OSDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new OSDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new OSDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal OSDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("OSType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDetailsInternal)this).OSType = (string) content.GetValueForProperty("OSType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDetailsInternal)this).OSType, global::System.Convert.ToString); + } + if (content.Contains("ProductType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDetailsInternal)this).ProductType = (string) content.GetValueForProperty("ProductType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDetailsInternal)this).ProductType, global::System.Convert.ToString); + } + if (content.Contains("OSEdition")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDetailsInternal)this).OSEdition = (string) content.GetValueForProperty("OSEdition",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDetailsInternal)this).OSEdition, global::System.Convert.ToString); + } + if (content.Contains("OSVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDetailsInternal)this).OSVersion = (string) content.GetValueForProperty("OSVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDetailsInternal)this).OSVersion, global::System.Convert.ToString); + } + if (content.Contains("OSMajorVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDetailsInternal)this).OSMajorVersion = (string) content.GetValueForProperty("OSMajorVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDetailsInternal)this).OSMajorVersion, global::System.Convert.ToString); + } + if (content.Contains("OSMinorVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDetailsInternal)this).OSMinorVersion = (string) content.GetValueForProperty("OSMinorVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDetailsInternal)this).OSMinorVersion, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal OSDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("OSType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDetailsInternal)this).OSType = (string) content.GetValueForProperty("OSType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDetailsInternal)this).OSType, global::System.Convert.ToString); + } + if (content.Contains("ProductType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDetailsInternal)this).ProductType = (string) content.GetValueForProperty("ProductType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDetailsInternal)this).ProductType, global::System.Convert.ToString); + } + if (content.Contains("OSEdition")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDetailsInternal)this).OSEdition = (string) content.GetValueForProperty("OSEdition",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDetailsInternal)this).OSEdition, global::System.Convert.ToString); + } + if (content.Contains("OSVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDetailsInternal)this).OSVersion = (string) content.GetValueForProperty("OSVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDetailsInternal)this).OSVersion, global::System.Convert.ToString); + } + if (content.Contains("OSMajorVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDetailsInternal)this).OSMajorVersion = (string) content.GetValueForProperty("OSMajorVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDetailsInternal)this).OSMajorVersion, global::System.Convert.ToString); + } + if (content.Contains("OSMinorVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDetailsInternal)this).OSMinorVersion = (string) content.GetValueForProperty("OSMinorVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDetailsInternal)this).OSMinorVersion, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Disk Details. + [System.ComponentModel.TypeConverter(typeof(OSDetailsTypeConverter))] + public partial interface IOSDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/OSDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/OSDetails.TypeConverter.cs new file mode 100644 index 000000000000..d6d41317951f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/OSDetails.TypeConverter.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class OSDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return OSDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return OSDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return OSDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/OSDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/OSDetails.cs new file mode 100644 index 000000000000..5a326e4c8b56 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/OSDetails.cs @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Disk Details. + public partial class OSDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDetailsInternal + { + + /// Backing field for property. + private string _oSEdition; + + /// The OSEdition. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string OSEdition { get => this._oSEdition; set => this._oSEdition = value; } + + /// Backing field for property. + private string _oSMajorVersion; + + /// The OS Major Version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string OSMajorVersion { get => this._oSMajorVersion; set => this._oSMajorVersion = value; } + + /// Backing field for property. + private string _oSMinorVersion; + + /// The OS Minor Version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string OSMinorVersion { get => this._oSMinorVersion; set => this._oSMinorVersion = value; } + + /// Backing field for property. + private string _oSType; + + /// VM Disk details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string OSType { get => this._oSType; set => this._oSType = value; } + + /// Backing field for property. + private string _oSVersion; + + /// The OS Version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string OSVersion { get => this._oSVersion; set => this._oSVersion = value; } + + /// Backing field for property. + private string _productType; + + /// Product type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ProductType { get => this._productType; set => this._productType = value; } + + /// Creates an new instance. + public OSDetails() + { + + } + } + /// Disk Details. + public partial interface IOSDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The OSEdition. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The OSEdition.", + SerializedName = @"osEdition", + PossibleTypes = new [] { typeof(string) })] + string OSEdition { get; set; } + /// The OS Major Version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The OS Major Version.", + SerializedName = @"oSMajorVersion", + PossibleTypes = new [] { typeof(string) })] + string OSMajorVersion { get; set; } + /// The OS Minor Version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The OS Minor Version.", + SerializedName = @"oSMinorVersion", + PossibleTypes = new [] { typeof(string) })] + string OSMinorVersion { get; set; } + /// VM Disk details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"VM Disk details.", + SerializedName = @"osType", + PossibleTypes = new [] { typeof(string) })] + string OSType { get; set; } + /// The OS Version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The OS Version.", + SerializedName = @"oSVersion", + PossibleTypes = new [] { typeof(string) })] + string OSVersion { get; set; } + /// Product type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Product type.", + SerializedName = @"productType", + PossibleTypes = new [] { typeof(string) })] + string ProductType { get; set; } + + } + /// Disk Details. + internal partial interface IOSDetailsInternal + + { + /// The OSEdition. + string OSEdition { get; set; } + /// The OS Major Version. + string OSMajorVersion { get; set; } + /// The OS Minor Version. + string OSMinorVersion { get; set; } + /// VM Disk details. + string OSType { get; set; } + /// The OS Version. + string OSVersion { get; set; } + /// Product type. + string ProductType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/OSDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/OSDetails.json.cs new file mode 100644 index 000000000000..66026e5be912 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/OSDetails.json.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Disk Details. + public partial class OSDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new OSDetails(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal OSDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_oSType = If( json?.PropertyT("osType"), out var __jsonOSType) ? (string)__jsonOSType : (string)OSType;} + {_productType = If( json?.PropertyT("productType"), out var __jsonProductType) ? (string)__jsonProductType : (string)ProductType;} + {_oSEdition = If( json?.PropertyT("osEdition"), out var __jsonOSEdition) ? (string)__jsonOSEdition : (string)OSEdition;} + {_oSVersion = If( json?.PropertyT("oSVersion"), out var __jsonOSVersion) ? (string)__jsonOSVersion : (string)OSVersion;} + {_oSMajorVersion = If( json?.PropertyT("oSMajorVersion"), out var __jsonOSMajorVersion) ? (string)__jsonOSMajorVersion : (string)OSMajorVersion;} + {_oSMinorVersion = If( json?.PropertyT("oSMinorVersion"), out var __jsonOSMinorVersion) ? (string)__jsonOSMinorVersion : (string)OSMinorVersion;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._oSType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._oSType.ToString()) : null, "osType" ,container.Add ); + AddIf( null != (((object)this._productType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._productType.ToString()) : null, "productType" ,container.Add ); + AddIf( null != (((object)this._oSEdition)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._oSEdition.ToString()) : null, "osEdition" ,container.Add ); + AddIf( null != (((object)this._oSVersion)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._oSVersion.ToString()) : null, "oSVersion" ,container.Add ); + AddIf( null != (((object)this._oSMajorVersion)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._oSMajorVersion.ToString()) : null, "oSMajorVersion" ,container.Add ); + AddIf( null != (((object)this._oSMinorVersion)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._oSMinorVersion.ToString()) : null, "oSMinorVersion" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/OSDiskDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/OSDiskDetails.PowerShell.cs new file mode 100644 index 000000000000..9b8fd5b24680 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/OSDiskDetails.PowerShell.cs @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Details of the OS Disk. + [System.ComponentModel.TypeConverter(typeof(OSDiskDetailsTypeConverter))] + public partial class OSDiskDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDiskDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new OSDiskDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDiskDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new OSDiskDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDiskDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal OSDiskDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("OSVhdId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDiskDetailsInternal)this).OSVhdId = (string) content.GetValueForProperty("OSVhdId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDiskDetailsInternal)this).OSVhdId, global::System.Convert.ToString); + } + if (content.Contains("OSType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDiskDetailsInternal)this).OSType = (string) content.GetValueForProperty("OSType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDiskDetailsInternal)this).OSType, global::System.Convert.ToString); + } + if (content.Contains("VhdName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDiskDetailsInternal)this).VhdName = (string) content.GetValueForProperty("VhdName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDiskDetailsInternal)this).VhdName, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal OSDiskDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("OSVhdId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDiskDetailsInternal)this).OSVhdId = (string) content.GetValueForProperty("OSVhdId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDiskDetailsInternal)this).OSVhdId, global::System.Convert.ToString); + } + if (content.Contains("OSType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDiskDetailsInternal)this).OSType = (string) content.GetValueForProperty("OSType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDiskDetailsInternal)this).OSType, global::System.Convert.ToString); + } + if (content.Contains("VhdName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDiskDetailsInternal)this).VhdName = (string) content.GetValueForProperty("VhdName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDiskDetailsInternal)this).VhdName, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Details of the OS Disk. + [System.ComponentModel.TypeConverter(typeof(OSDiskDetailsTypeConverter))] + public partial interface IOSDiskDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/OSDiskDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/OSDiskDetails.TypeConverter.cs new file mode 100644 index 000000000000..15e968bf212f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/OSDiskDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class OSDiskDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDiskDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDiskDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return OSDiskDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return OSDiskDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return OSDiskDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/OSDiskDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/OSDiskDetails.cs new file mode 100644 index 000000000000..e13e3c67b46a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/OSDiskDetails.cs @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Details of the OS Disk. + public partial class OSDiskDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDiskDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDiskDetailsInternal + { + + /// Backing field for property. + private string _oSType; + + /// The type of the OS on the VM. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string OSType { get => this._oSType; set => this._oSType = value; } + + /// Backing field for property. + private string _oSVhdId; + + /// The id of the disk containing the OS. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string OSVhdId { get => this._oSVhdId; set => this._oSVhdId = value; } + + /// Backing field for property. + private string _vhdName; + + /// The OS disk VHD name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string VhdName { get => this._vhdName; set => this._vhdName = value; } + + /// Creates an new instance. + public OSDiskDetails() + { + + } + } + /// Details of the OS Disk. + public partial interface IOSDiskDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The type of the OS on the VM. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The type of the OS on the VM.", + SerializedName = @"osType", + PossibleTypes = new [] { typeof(string) })] + string OSType { get; set; } + /// The id of the disk containing the OS. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The id of the disk containing the OS.", + SerializedName = @"osVhdId", + PossibleTypes = new [] { typeof(string) })] + string OSVhdId { get; set; } + /// The OS disk VHD name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The OS disk VHD name.", + SerializedName = @"vhdName", + PossibleTypes = new [] { typeof(string) })] + string VhdName { get; set; } + + } + /// Details of the OS Disk. + internal partial interface IOSDiskDetailsInternal + + { + /// The type of the OS on the VM. + string OSType { get; set; } + /// The id of the disk containing the OS. + string OSVhdId { get; set; } + /// The OS disk VHD name. + string VhdName { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/OSDiskDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/OSDiskDetails.json.cs new file mode 100644 index 000000000000..cdbaa1cca387 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/OSDiskDetails.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Details of the OS Disk. + public partial class OSDiskDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDiskDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDiskDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDiskDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new OSDiskDetails(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal OSDiskDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_oSVhdId = If( json?.PropertyT("osVhdId"), out var __jsonOSVhdId) ? (string)__jsonOSVhdId : (string)OSVhdId;} + {_oSType = If( json?.PropertyT("osType"), out var __jsonOSType) ? (string)__jsonOSType : (string)OSType;} + {_vhdName = If( json?.PropertyT("vhdName"), out var __jsonVhdName) ? (string)__jsonVhdName : (string)VhdName;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._oSVhdId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._oSVhdId.ToString()) : null, "osVhdId" ,container.Add ); + AddIf( null != (((object)this._oSType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._oSType.ToString()) : null, "osType" ,container.Add ); + AddIf( null != (((object)this._vhdName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._vhdName.ToString()) : null, "vhdName" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/OSVersionWrapper.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/OSVersionWrapper.PowerShell.cs new file mode 100644 index 000000000000..4f5898b264ef --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/OSVersionWrapper.PowerShell.cs @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Wrapper model for OSVersion to include version and service pack info. + [System.ComponentModel.TypeConverter(typeof(OSVersionWrapperTypeConverter))] + public partial class OSVersionWrapper + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSVersionWrapper DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new OSVersionWrapper(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSVersionWrapper DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new OSVersionWrapper(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSVersionWrapper FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal OSVersionWrapper(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Version")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSVersionWrapperInternal)this).Version = (string) content.GetValueForProperty("Version",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSVersionWrapperInternal)this).Version, global::System.Convert.ToString); + } + if (content.Contains("ServicePack")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSVersionWrapperInternal)this).ServicePack = (string) content.GetValueForProperty("ServicePack",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSVersionWrapperInternal)this).ServicePack, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal OSVersionWrapper(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Version")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSVersionWrapperInternal)this).Version = (string) content.GetValueForProperty("Version",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSVersionWrapperInternal)this).Version, global::System.Convert.ToString); + } + if (content.Contains("ServicePack")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSVersionWrapperInternal)this).ServicePack = (string) content.GetValueForProperty("ServicePack",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSVersionWrapperInternal)this).ServicePack, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Wrapper model for OSVersion to include version and service pack info. + [System.ComponentModel.TypeConverter(typeof(OSVersionWrapperTypeConverter))] + public partial interface IOSVersionWrapper + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/OSVersionWrapper.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/OSVersionWrapper.TypeConverter.cs new file mode 100644 index 000000000000..34002e259558 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/OSVersionWrapper.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class OSVersionWrapperTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSVersionWrapper ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSVersionWrapper).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return OSVersionWrapper.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return OSVersionWrapper.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return OSVersionWrapper.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/OSVersionWrapper.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/OSVersionWrapper.cs new file mode 100644 index 000000000000..a50650a9e363 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/OSVersionWrapper.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Wrapper model for OSVersion to include version and service pack info. + public partial class OSVersionWrapper : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSVersionWrapper, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSVersionWrapperInternal + { + + /// Backing field for property. + private string _servicePack; + + /// The service pack. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ServicePack { get => this._servicePack; set => this._servicePack = value; } + + /// Backing field for property. + private string _version; + + /// The version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Version { get => this._version; set => this._version = value; } + + /// Creates an new instance. + public OSVersionWrapper() + { + + } + } + /// Wrapper model for OSVersion to include version and service pack info. + public partial interface IOSVersionWrapper : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The service pack. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The service pack.", + SerializedName = @"servicePack", + PossibleTypes = new [] { typeof(string) })] + string ServicePack { get; set; } + /// The version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The version.", + SerializedName = @"version", + PossibleTypes = new [] { typeof(string) })] + string Version { get; set; } + + } + /// Wrapper model for OSVersion to include version and service pack info. + internal partial interface IOSVersionWrapperInternal + + { + /// The service pack. + string ServicePack { get; set; } + /// The version. + string Version { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/OSVersionWrapper.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/OSVersionWrapper.json.cs new file mode 100644 index 000000000000..bffc45607b60 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/OSVersionWrapper.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Wrapper model for OSVersion to include version and service pack info. + public partial class OSVersionWrapper + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSVersionWrapper. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSVersionWrapper. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSVersionWrapper FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new OSVersionWrapper(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal OSVersionWrapper(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_version = If( json?.PropertyT("version"), out var __jsonVersion) ? (string)__jsonVersion : (string)Version;} + {_servicePack = If( json?.PropertyT("servicePack"), out var __jsonServicePack) ? (string)__jsonServicePack : (string)ServicePack;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._version)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._version.ToString()) : null, "version" ,container.Add ); + AddIf( null != (((object)this._servicePack)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._servicePack.ToString()) : null, "servicePack" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/OperationsDiscovery.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/OperationsDiscovery.PowerShell.cs new file mode 100644 index 000000000000..4b52e0a79d6b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/OperationsDiscovery.PowerShell.cs @@ -0,0 +1,200 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Operations discovery class. + [System.ComponentModel.TypeConverter(typeof(OperationsDiscoveryTypeConverter))] + public partial class OperationsDiscovery + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOperationsDiscovery DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new OperationsDiscovery(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOperationsDiscovery DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new OperationsDiscovery(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOperationsDiscovery FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal OperationsDiscovery(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Display")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOperationsDiscoveryInternal)this).Display = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisplay) content.GetValueForProperty("Display",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOperationsDiscoveryInternal)this).Display, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DisplayTypeConverter.ConvertFrom); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOperationsDiscoveryInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOperationsDiscoveryInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Origin")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOperationsDiscoveryInternal)this).Origin = (string) content.GetValueForProperty("Origin",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOperationsDiscoveryInternal)this).Origin, global::System.Convert.ToString); + } + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOperationsDiscoveryInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.IAny) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOperationsDiscoveryInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.AnyTypeConverter.ConvertFrom); + } + if (content.Contains("DisplayProvider")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOperationsDiscoveryInternal)this).DisplayProvider = (string) content.GetValueForProperty("DisplayProvider",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOperationsDiscoveryInternal)this).DisplayProvider, global::System.Convert.ToString); + } + if (content.Contains("DisplayResource")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOperationsDiscoveryInternal)this).DisplayResource = (string) content.GetValueForProperty("DisplayResource",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOperationsDiscoveryInternal)this).DisplayResource, global::System.Convert.ToString); + } + if (content.Contains("DisplayOperation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOperationsDiscoveryInternal)this).DisplayOperation = (string) content.GetValueForProperty("DisplayOperation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOperationsDiscoveryInternal)this).DisplayOperation, global::System.Convert.ToString); + } + if (content.Contains("DisplayDescription")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOperationsDiscoveryInternal)this).DisplayDescription = (string) content.GetValueForProperty("DisplayDescription",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOperationsDiscoveryInternal)this).DisplayDescription, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal OperationsDiscovery(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Display")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOperationsDiscoveryInternal)this).Display = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisplay) content.GetValueForProperty("Display",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOperationsDiscoveryInternal)this).Display, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DisplayTypeConverter.ConvertFrom); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOperationsDiscoveryInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOperationsDiscoveryInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Origin")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOperationsDiscoveryInternal)this).Origin = (string) content.GetValueForProperty("Origin",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOperationsDiscoveryInternal)this).Origin, global::System.Convert.ToString); + } + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOperationsDiscoveryInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.IAny) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOperationsDiscoveryInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.AnyTypeConverter.ConvertFrom); + } + if (content.Contains("DisplayProvider")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOperationsDiscoveryInternal)this).DisplayProvider = (string) content.GetValueForProperty("DisplayProvider",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOperationsDiscoveryInternal)this).DisplayProvider, global::System.Convert.ToString); + } + if (content.Contains("DisplayResource")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOperationsDiscoveryInternal)this).DisplayResource = (string) content.GetValueForProperty("DisplayResource",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOperationsDiscoveryInternal)this).DisplayResource, global::System.Convert.ToString); + } + if (content.Contains("DisplayOperation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOperationsDiscoveryInternal)this).DisplayOperation = (string) content.GetValueForProperty("DisplayOperation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOperationsDiscoveryInternal)this).DisplayOperation, global::System.Convert.ToString); + } + if (content.Contains("DisplayDescription")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOperationsDiscoveryInternal)this).DisplayDescription = (string) content.GetValueForProperty("DisplayDescription",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOperationsDiscoveryInternal)this).DisplayDescription, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Operations discovery class. + [System.ComponentModel.TypeConverter(typeof(OperationsDiscoveryTypeConverter))] + public partial interface IOperationsDiscovery + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/OperationsDiscovery.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/OperationsDiscovery.TypeConverter.cs new file mode 100644 index 000000000000..45e468eae9cd --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/OperationsDiscovery.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class OperationsDiscoveryTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOperationsDiscovery ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOperationsDiscovery).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return OperationsDiscovery.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return OperationsDiscovery.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return OperationsDiscovery.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/OperationsDiscovery.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/OperationsDiscovery.cs new file mode 100644 index 000000000000..c91f07811353 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/OperationsDiscovery.cs @@ -0,0 +1,252 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Operations discovery class. + public partial class OperationsDiscovery : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOperationsDiscovery, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOperationsDiscoveryInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisplay _display; + + /// Object type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisplay Display { get => (this._display = this._display ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.Display()); set => this._display = value; } + + /// + /// 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'. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string DisplayDescription { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisplayInternal)Display).Description; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisplayInternal)Display).Description = value ?? null; } + + /// + /// 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'. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string DisplayOperation { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisplayInternal)Display).Operation; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisplayInternal)Display).Operation = value ?? null; } + + /// + /// 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.". + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string DisplayProvider { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisplayInternal)Display).Provider; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisplayInternal)Display).Provider = value ?? null; } + + /// + /// 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". + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string DisplayResource { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisplayInternal)Display).Resource; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisplayInternal)Display).Resource = value ?? null; } + + /// Internal Acessors for Display + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisplay Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOperationsDiscoveryInternal.Display { get => (this._display = this._display ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.Display()); set { {_display = value;} } } + + /// Backing field for property. + private string _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). + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Name { get => this._name; set => this._name = value; } + + /// Backing field for property. + private string _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". + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Origin { get => this._origin; set => this._origin = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.IAny _property; + + /// Properties. Reserved for future use. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.IAny Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Any()); set => this._property = value; } + + /// Creates an new instance. + public OperationsDiscovery() + { + + } + } + /// Operations discovery class. + public partial interface IOperationsDiscovery : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// + /// 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'. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + 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'.", + SerializedName = @"description", + PossibleTypes = new [] { typeof(string) })] + string DisplayDescription { get; set; } + /// + /// 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'. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"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'.", + SerializedName = @"operation", + PossibleTypes = new [] { typeof(string) })] + string DisplayOperation { get; set; } + /// + /// 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.". + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"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."".", + SerializedName = @"provider", + PossibleTypes = new [] { typeof(string) })] + string DisplayProvider { get; set; } + /// + /// 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". + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"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"".", + SerializedName = @"resource", + PossibleTypes = new [] { typeof(string) })] + string DisplayResource { get; set; } + /// + /// 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). + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"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).", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string Name { get; set; } + /// + /// 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". + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"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"".", + SerializedName = @"origin", + PossibleTypes = new [] { typeof(string) })] + string Origin { get; set; } + /// Properties. Reserved for future use. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Properties. Reserved for future use.", + SerializedName = @"properties", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.IAny) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.IAny Property { get; set; } + + } + /// Operations discovery class. + internal partial interface IOperationsDiscoveryInternal + + { + /// Object type. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisplay Display { get; set; } + /// + /// 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'. + /// + string DisplayDescription { get; set; } + /// + /// 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'. + /// + string DisplayOperation { get; set; } + /// + /// 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.". + /// + string DisplayProvider { get; set; } + /// + /// 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". + /// + string DisplayResource { get; set; } + /// + /// 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). + /// + string Name { get; set; } + /// + /// 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". + /// + string Origin { get; set; } + /// Properties. Reserved for future use. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.IAny Property { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/OperationsDiscovery.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/OperationsDiscovery.json.cs new file mode 100644 index 000000000000..e30332670417 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/OperationsDiscovery.json.cs @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Operations discovery class. + public partial class OperationsDiscovery + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOperationsDiscovery. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOperationsDiscovery. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOperationsDiscovery FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new OperationsDiscovery(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal OperationsDiscovery(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_display = If( json?.PropertyT("display"), out var __jsonDisplay) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.Display.FromJson(__jsonDisplay) : Display;} + {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)Name;} + {_origin = If( json?.PropertyT("origin"), out var __jsonOrigin) ? (string)__jsonOrigin : (string)Origin;} + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Any.FromJson(__jsonProperties) : Property;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._display ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._display.ToJson(null,serializationMode) : null, "display" ,container.Add ); + AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); + AddIf( null != (((object)this._origin)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._origin.ToString()) : null, "origin" ,container.Add ); + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/OperationsDiscoveryCollection.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/OperationsDiscoveryCollection.PowerShell.cs new file mode 100644 index 000000000000..aa158319c74a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/OperationsDiscoveryCollection.PowerShell.cs @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Collection of ClientDiscovery details. + [System.ComponentModel.TypeConverter(typeof(OperationsDiscoveryCollectionTypeConverter))] + public partial class OperationsDiscoveryCollection + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOperationsDiscoveryCollection DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new OperationsDiscoveryCollection(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOperationsDiscoveryCollection DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new OperationsDiscoveryCollection(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOperationsDiscoveryCollection FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal OperationsDiscoveryCollection(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOperationsDiscoveryCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOperationsDiscovery[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOperationsDiscoveryCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.OperationsDiscoveryTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOperationsDiscoveryCollectionInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOperationsDiscoveryCollectionInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal OperationsDiscoveryCollection(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOperationsDiscoveryCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOperationsDiscovery[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOperationsDiscoveryCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.OperationsDiscoveryTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOperationsDiscoveryCollectionInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOperationsDiscoveryCollectionInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Collection of ClientDiscovery details. + [System.ComponentModel.TypeConverter(typeof(OperationsDiscoveryCollectionTypeConverter))] + public partial interface IOperationsDiscoveryCollection + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/OperationsDiscoveryCollection.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/OperationsDiscoveryCollection.TypeConverter.cs new file mode 100644 index 000000000000..855d091e283d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/OperationsDiscoveryCollection.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class OperationsDiscoveryCollectionTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOperationsDiscoveryCollection ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOperationsDiscoveryCollection).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return OperationsDiscoveryCollection.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return OperationsDiscoveryCollection.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return OperationsDiscoveryCollection.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/OperationsDiscoveryCollection.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/OperationsDiscoveryCollection.cs new file mode 100644 index 000000000000..0ea4e58b0f95 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/OperationsDiscoveryCollection.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Collection of ClientDiscovery details. + public partial class OperationsDiscoveryCollection : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOperationsDiscoveryCollection, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOperationsDiscoveryCollectionInternal + { + + /// Backing field for property. + private string _nextLink; + + /// The value of next link. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string NextLink { get => this._nextLink; set => this._nextLink = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOperationsDiscovery[] _value; + + /// The ClientDiscovery details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOperationsDiscovery[] Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public OperationsDiscoveryCollection() + { + + } + } + /// Collection of ClientDiscovery details. + public partial interface IOperationsDiscoveryCollection : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The value of next link. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The value of next link.", + SerializedName = @"nextLink", + PossibleTypes = new [] { typeof(string) })] + string NextLink { get; set; } + /// The ClientDiscovery details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The ClientDiscovery details.", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOperationsDiscovery) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOperationsDiscovery[] Value { get; set; } + + } + /// Collection of ClientDiscovery details. + internal partial interface IOperationsDiscoveryCollectionInternal + + { + /// The value of next link. + string NextLink { get; set; } + /// The ClientDiscovery details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOperationsDiscovery[] Value { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/OperationsDiscoveryCollection.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/OperationsDiscoveryCollection.json.cs new file mode 100644 index 000000000000..a755f9018e85 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/OperationsDiscoveryCollection.json.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Collection of ClientDiscovery details. + public partial class OperationsDiscoveryCollection + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOperationsDiscoveryCollection. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOperationsDiscoveryCollection. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOperationsDiscoveryCollection FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new OperationsDiscoveryCollection(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal OperationsDiscoveryCollection(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOperationsDiscovery) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.OperationsDiscovery.FromJson(__u) )) ))() : null : Value;} + {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)NextLink;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._value) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._value ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("value",__w); + } + AddIf( null != (((object)this._nextLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PauseReplicationInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PauseReplicationInput.PowerShell.cs new file mode 100644 index 000000000000..f5b4b2f05e4a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PauseReplicationInput.PowerShell.cs @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Pause replication input. + [System.ComponentModel.TypeConverter(typeof(PauseReplicationInputTypeConverter))] + public partial class PauseReplicationInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPauseReplicationInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new PauseReplicationInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPauseReplicationInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new PauseReplicationInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPauseReplicationInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal PauseReplicationInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPauseReplicationInputInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPauseReplicationInputProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPauseReplicationInputInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PauseReplicationInputPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPauseReplicationInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPauseReplicationInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal PauseReplicationInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPauseReplicationInputInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPauseReplicationInputProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPauseReplicationInputInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PauseReplicationInputPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPauseReplicationInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPauseReplicationInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Pause replication input. + [System.ComponentModel.TypeConverter(typeof(PauseReplicationInputTypeConverter))] + public partial interface IPauseReplicationInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PauseReplicationInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PauseReplicationInput.TypeConverter.cs new file mode 100644 index 000000000000..02bf74477ab4 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PauseReplicationInput.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class PauseReplicationInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPauseReplicationInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPauseReplicationInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return PauseReplicationInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return PauseReplicationInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return PauseReplicationInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PauseReplicationInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PauseReplicationInput.cs new file mode 100644 index 000000000000..eea3ff598d57 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PauseReplicationInput.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Pause replication input. + public partial class PauseReplicationInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPauseReplicationInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPauseReplicationInputInternal + { + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPauseReplicationInputPropertiesInternal)Property).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPauseReplicationInputPropertiesInternal)Property).InstanceType = value ; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPauseReplicationInputProperties Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPauseReplicationInputInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PauseReplicationInputProperties()); set { {_property = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPauseReplicationInputProperties _property; + + /// Pause replication input properties. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPauseReplicationInputProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PauseReplicationInputProperties()); set => this._property = value; } + + /// Creates an new instance. + public PauseReplicationInput() + { + + } + } + /// Pause replication input. + public partial interface IPauseReplicationInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string InstanceType { get; set; } + + } + /// Pause replication input. + internal partial interface IPauseReplicationInputInternal + + { + /// The class type. + string InstanceType { get; set; } + /// Pause replication input properties. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPauseReplicationInputProperties Property { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PauseReplicationInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PauseReplicationInput.json.cs new file mode 100644 index 000000000000..ffc23bc5ecb4 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PauseReplicationInput.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Pause replication input. + public partial class PauseReplicationInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPauseReplicationInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPauseReplicationInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPauseReplicationInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new PauseReplicationInput(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal PauseReplicationInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PauseReplicationInputProperties.FromJson(__jsonProperties) : Property;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PauseReplicationInputProperties.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PauseReplicationInputProperties.PowerShell.cs new file mode 100644 index 000000000000..b74fb9fd18c6 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PauseReplicationInputProperties.PowerShell.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Pause replication input properties. + [System.ComponentModel.TypeConverter(typeof(PauseReplicationInputPropertiesTypeConverter))] + public partial class PauseReplicationInputProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPauseReplicationInputProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new PauseReplicationInputProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPauseReplicationInputProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new PauseReplicationInputProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPauseReplicationInputProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal PauseReplicationInputProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPauseReplicationInputPropertiesInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPauseReplicationInputPropertiesInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal PauseReplicationInputProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPauseReplicationInputPropertiesInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPauseReplicationInputPropertiesInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Pause replication input properties. + [System.ComponentModel.TypeConverter(typeof(PauseReplicationInputPropertiesTypeConverter))] + public partial interface IPauseReplicationInputProperties + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PauseReplicationInputProperties.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PauseReplicationInputProperties.TypeConverter.cs new file mode 100644 index 000000000000..59f5c2917b32 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PauseReplicationInputProperties.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class PauseReplicationInputPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPauseReplicationInputProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPauseReplicationInputProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return PauseReplicationInputProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return PauseReplicationInputProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return PauseReplicationInputProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PauseReplicationInputProperties.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PauseReplicationInputProperties.cs new file mode 100644 index 000000000000..c5a2df4c0e9a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PauseReplicationInputProperties.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Pause replication input properties. + public partial class PauseReplicationInputProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPauseReplicationInputProperties, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPauseReplicationInputPropertiesInternal + { + + /// Backing field for property. + private string _instanceType; + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string InstanceType { get => this._instanceType; set => this._instanceType = value; } + + /// Creates an new instance. + public PauseReplicationInputProperties() + { + + } + } + /// Pause replication input properties. + public partial interface IPauseReplicationInputProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string InstanceType { get; set; } + + } + /// Pause replication input properties. + internal partial interface IPauseReplicationInputPropertiesInternal + + { + /// The class type. + string InstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PauseReplicationInputProperties.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PauseReplicationInputProperties.json.cs new file mode 100644 index 000000000000..864133653264 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PauseReplicationInputProperties.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Pause replication input properties. + public partial class PauseReplicationInputProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPauseReplicationInputProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPauseReplicationInputProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPauseReplicationInputProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new PauseReplicationInputProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal PauseReplicationInputProperties(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_instanceType = If( json?.PropertyT("instanceType"), out var __jsonInstanceType) ? (string)__jsonInstanceType : (string)InstanceType;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._instanceType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._instanceType.ToString()) : null, "instanceType" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PlannedFailoverInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PlannedFailoverInput.PowerShell.cs new file mode 100644 index 000000000000..95ef7319db19 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PlannedFailoverInput.PowerShell.cs @@ -0,0 +1,168 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Input definition for planned failover. + [System.ComponentModel.TypeConverter(typeof(PlannedFailoverInputTypeConverter))] + public partial class PlannedFailoverInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new PlannedFailoverInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new PlannedFailoverInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal PlannedFailoverInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverInputInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverInputProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverInputInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PlannedFailoverInputPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverInputInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverProviderSpecificFailoverInput) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverInputInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PlannedFailoverProviderSpecificFailoverInputTypeConverter.ConvertFrom); + } + if (content.Contains("FailoverDirection")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverInputInternal)this).FailoverDirection = (string) content.GetValueForProperty("FailoverDirection",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverInputInternal)this).FailoverDirection, global::System.Convert.ToString); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverInputInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverInputInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal PlannedFailoverInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverInputInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverInputProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverInputInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PlannedFailoverInputPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverInputInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverProviderSpecificFailoverInput) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverInputInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PlannedFailoverProviderSpecificFailoverInputTypeConverter.ConvertFrom); + } + if (content.Contains("FailoverDirection")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverInputInternal)this).FailoverDirection = (string) content.GetValueForProperty("FailoverDirection",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverInputInternal)this).FailoverDirection, global::System.Convert.ToString); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverInputInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverInputInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Input definition for planned failover. + [System.ComponentModel.TypeConverter(typeof(PlannedFailoverInputTypeConverter))] + public partial interface IPlannedFailoverInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PlannedFailoverInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PlannedFailoverInput.TypeConverter.cs new file mode 100644 index 000000000000..59bba179cf96 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PlannedFailoverInput.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class PlannedFailoverInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return PlannedFailoverInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return PlannedFailoverInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return PlannedFailoverInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PlannedFailoverInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PlannedFailoverInput.cs new file mode 100644 index 000000000000..f40f690add3f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PlannedFailoverInput.cs @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Input definition for planned failover. + public partial class PlannedFailoverInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverInputInternal + { + + /// Failover direction. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string FailoverDirection { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverInputPropertiesInternal)Property).FailoverDirection; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverInputPropertiesInternal)Property).FailoverDirection = value ?? null; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverInputProperties Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverInputInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PlannedFailoverInputProperties()); set { {_property = value;} } } + + /// Internal Acessors for ProviderSpecificDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverProviderSpecificFailoverInput Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverInputInternal.ProviderSpecificDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverInputPropertiesInternal)Property).ProviderSpecificDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverInputPropertiesInternal)Property).ProviderSpecificDetail = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverInputProperties _property; + + /// Planned failover input properties. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverInputProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PlannedFailoverInputProperties()); set => this._property = value; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ProviderSpecificDetailInstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverInputPropertiesInternal)Property).ProviderSpecificDetailInstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverInputPropertiesInternal)Property).ProviderSpecificDetailInstanceType = value ?? null; } + + /// Creates an new instance. + public PlannedFailoverInput() + { + + } + } + /// Input definition for planned failover. + public partial interface IPlannedFailoverInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// Failover direction. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Failover direction.", + SerializedName = @"failoverDirection", + PossibleTypes = new [] { typeof(string) })] + string FailoverDirection { get; set; } + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string ProviderSpecificDetailInstanceType { get; set; } + + } + /// Input definition for planned failover. + internal partial interface IPlannedFailoverInputInternal + + { + /// Failover direction. + string FailoverDirection { get; set; } + /// Planned failover input properties. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverInputProperties Property { get; set; } + /// Provider specific settings. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverProviderSpecificFailoverInput ProviderSpecificDetail { get; set; } + /// The class type. + string ProviderSpecificDetailInstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PlannedFailoverInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PlannedFailoverInput.json.cs new file mode 100644 index 000000000000..7d052b9d4ff8 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PlannedFailoverInput.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Input definition for planned failover. + public partial class PlannedFailoverInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new PlannedFailoverInput(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal PlannedFailoverInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PlannedFailoverInputProperties.FromJson(__jsonProperties) : Property;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PlannedFailoverInputProperties.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PlannedFailoverInputProperties.PowerShell.cs new file mode 100644 index 000000000000..d0d5c4c366d5 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PlannedFailoverInputProperties.PowerShell.cs @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Input definition for planned failover input properties. + [System.ComponentModel.TypeConverter(typeof(PlannedFailoverInputPropertiesTypeConverter))] + public partial class PlannedFailoverInputProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverInputProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new PlannedFailoverInputProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverInputProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new PlannedFailoverInputProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverInputProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal PlannedFailoverInputProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverInputPropertiesInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverProviderSpecificFailoverInput) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverInputPropertiesInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PlannedFailoverProviderSpecificFailoverInputTypeConverter.ConvertFrom); + } + if (content.Contains("FailoverDirection")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverInputPropertiesInternal)this).FailoverDirection = (string) content.GetValueForProperty("FailoverDirection",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverInputPropertiesInternal)this).FailoverDirection, global::System.Convert.ToString); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverInputPropertiesInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverInputPropertiesInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal PlannedFailoverInputProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverInputPropertiesInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverProviderSpecificFailoverInput) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverInputPropertiesInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PlannedFailoverProviderSpecificFailoverInputTypeConverter.ConvertFrom); + } + if (content.Contains("FailoverDirection")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverInputPropertiesInternal)this).FailoverDirection = (string) content.GetValueForProperty("FailoverDirection",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverInputPropertiesInternal)this).FailoverDirection, global::System.Convert.ToString); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverInputPropertiesInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverInputPropertiesInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Input definition for planned failover input properties. + [System.ComponentModel.TypeConverter(typeof(PlannedFailoverInputPropertiesTypeConverter))] + public partial interface IPlannedFailoverInputProperties + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PlannedFailoverInputProperties.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PlannedFailoverInputProperties.TypeConverter.cs new file mode 100644 index 000000000000..5fd2c0940f4a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PlannedFailoverInputProperties.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class PlannedFailoverInputPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverInputProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverInputProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return PlannedFailoverInputProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return PlannedFailoverInputProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return PlannedFailoverInputProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PlannedFailoverInputProperties.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PlannedFailoverInputProperties.cs new file mode 100644 index 000000000000..aa405be8532a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PlannedFailoverInputProperties.cs @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Input definition for planned failover input properties. + public partial class PlannedFailoverInputProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverInputProperties, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverInputPropertiesInternal + { + + /// Backing field for property. + private string _failoverDirection; + + /// Failover direction. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string FailoverDirection { get => this._failoverDirection; set => this._failoverDirection = value; } + + /// Internal Acessors for ProviderSpecificDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverProviderSpecificFailoverInput Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverInputPropertiesInternal.ProviderSpecificDetail { get => (this._providerSpecificDetail = this._providerSpecificDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PlannedFailoverProviderSpecificFailoverInput()); set { {_providerSpecificDetail = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverProviderSpecificFailoverInput _providerSpecificDetail; + + /// Provider specific settings. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverProviderSpecificFailoverInput ProviderSpecificDetail { get => (this._providerSpecificDetail = this._providerSpecificDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PlannedFailoverProviderSpecificFailoverInput()); set => this._providerSpecificDetail = value; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ProviderSpecificDetailInstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverProviderSpecificFailoverInputInternal)ProviderSpecificDetail).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverProviderSpecificFailoverInputInternal)ProviderSpecificDetail).InstanceType = value ?? null; } + + /// Creates an new instance. + public PlannedFailoverInputProperties() + { + + } + } + /// Input definition for planned failover input properties. + public partial interface IPlannedFailoverInputProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// Failover direction. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Failover direction.", + SerializedName = @"failoverDirection", + PossibleTypes = new [] { typeof(string) })] + string FailoverDirection { get; set; } + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string ProviderSpecificDetailInstanceType { get; set; } + + } + /// Input definition for planned failover input properties. + internal partial interface IPlannedFailoverInputPropertiesInternal + + { + /// Failover direction. + string FailoverDirection { get; set; } + /// Provider specific settings. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverProviderSpecificFailoverInput ProviderSpecificDetail { get; set; } + /// The class type. + string ProviderSpecificDetailInstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PlannedFailoverInputProperties.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PlannedFailoverInputProperties.json.cs new file mode 100644 index 000000000000..c4dfb25d8d76 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PlannedFailoverInputProperties.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Input definition for planned failover input properties. + public partial class PlannedFailoverInputProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverInputProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverInputProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverInputProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new PlannedFailoverInputProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal PlannedFailoverInputProperties(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_providerSpecificDetail = If( json?.PropertyT("providerSpecificDetails"), out var __jsonProviderSpecificDetails) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PlannedFailoverProviderSpecificFailoverInput.FromJson(__jsonProviderSpecificDetails) : ProviderSpecificDetail;} + {_failoverDirection = If( json?.PropertyT("failoverDirection"), out var __jsonFailoverDirection) ? (string)__jsonFailoverDirection : (string)FailoverDirection;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._providerSpecificDetail ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._providerSpecificDetail.ToJson(null,serializationMode) : null, "providerSpecificDetails" ,container.Add ); + AddIf( null != (((object)this._failoverDirection)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._failoverDirection.ToString()) : null, "failoverDirection" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PlannedFailoverProviderSpecificFailoverInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PlannedFailoverProviderSpecificFailoverInput.PowerShell.cs new file mode 100644 index 000000000000..05dbb4b4d690 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PlannedFailoverProviderSpecificFailoverInput.PowerShell.cs @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Provider specific failover input. + [System.ComponentModel.TypeConverter(typeof(PlannedFailoverProviderSpecificFailoverInputTypeConverter))] + public partial class PlannedFailoverProviderSpecificFailoverInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverProviderSpecificFailoverInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new PlannedFailoverProviderSpecificFailoverInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverProviderSpecificFailoverInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new PlannedFailoverProviderSpecificFailoverInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from + /// a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverProviderSpecificFailoverInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal PlannedFailoverProviderSpecificFailoverInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverProviderSpecificFailoverInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverProviderSpecificFailoverInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal PlannedFailoverProviderSpecificFailoverInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverProviderSpecificFailoverInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverProviderSpecificFailoverInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Provider specific failover input. + [System.ComponentModel.TypeConverter(typeof(PlannedFailoverProviderSpecificFailoverInputTypeConverter))] + public partial interface IPlannedFailoverProviderSpecificFailoverInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PlannedFailoverProviderSpecificFailoverInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PlannedFailoverProviderSpecificFailoverInput.TypeConverter.cs new file mode 100644 index 000000000000..fe4465153c81 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PlannedFailoverProviderSpecificFailoverInput.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class PlannedFailoverProviderSpecificFailoverInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, + /// otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverProviderSpecificFailoverInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverProviderSpecificFailoverInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return PlannedFailoverProviderSpecificFailoverInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return PlannedFailoverProviderSpecificFailoverInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return PlannedFailoverProviderSpecificFailoverInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PlannedFailoverProviderSpecificFailoverInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PlannedFailoverProviderSpecificFailoverInput.cs new file mode 100644 index 000000000000..8930a6d9466c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PlannedFailoverProviderSpecificFailoverInput.cs @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Provider specific failover input. + public partial class PlannedFailoverProviderSpecificFailoverInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverProviderSpecificFailoverInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverProviderSpecificFailoverInputInternal + { + + /// Backing field for property. + private string _instanceType; + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string InstanceType { get => this._instanceType; set => this._instanceType = value; } + + /// + /// Creates an new instance. + /// + public PlannedFailoverProviderSpecificFailoverInput() + { + + } + } + /// Provider specific failover input. + public partial interface IPlannedFailoverProviderSpecificFailoverInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string InstanceType { get; set; } + + } + /// Provider specific failover input. + internal partial interface IPlannedFailoverProviderSpecificFailoverInputInternal + + { + /// The class type. + string InstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PlannedFailoverProviderSpecificFailoverInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PlannedFailoverProviderSpecificFailoverInput.json.cs new file mode 100644 index 000000000000..d08ee6b42b8b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PlannedFailoverProviderSpecificFailoverInput.json.cs @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Provider specific failover input. + public partial class PlannedFailoverProviderSpecificFailoverInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverProviderSpecificFailoverInput. + /// Note: the Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverProviderSpecificFailoverInput + /// interface is polymorphic, and the precise model class that will get deserialized is determined at runtime based on the + /// payload. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverProviderSpecificFailoverInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverProviderSpecificFailoverInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + if (!(node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json)) + { + return null; + } + // Polymorphic type -- select the appropriate constructor using the discriminator + + switch ( json.StringProperty("instanceType") ) + { + case "HyperVReplicaAzureFailback": + { + return new HyperVReplicaAzureFailbackProviderInput(json); + } + case "HyperVReplicaAzure": + { + return new HyperVReplicaAzurePlannedFailoverProviderInput(json); + } + case "InMageRcmFailback": + { + return new InMageRcmFailbackPlannedFailoverProviderInput(json); + } + } + return new PlannedFailoverProviderSpecificFailoverInput(json); + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal PlannedFailoverProviderSpecificFailoverInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_instanceType = If( json?.PropertyT("instanceType"), out var __jsonInstanceType) ? (string)__jsonInstanceType : (string)InstanceType;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._instanceType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._instanceType.ToString()) : null, "instanceType" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Policy.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Policy.PowerShell.cs new file mode 100644 index 000000000000..ad61238154d0 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Policy.PowerShell.cs @@ -0,0 +1,200 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Protection profile details. + [System.ComponentModel.TypeConverter(typeof(PolicyTypeConverter))] + public partial class Policy + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicy DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new Policy(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicy DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new Policy(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicy FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal Policy(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PolicyPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetails) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PolicyProviderSpecificDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("FriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyInternal)this).FriendlyName = (string) content.GetValueForProperty("FriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyInternal)this).FriendlyName, global::System.Convert.ToString); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal Policy(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PolicyPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetails) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PolicyProviderSpecificDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("FriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyInternal)this).FriendlyName = (string) content.GetValueForProperty("FriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyInternal)this).FriendlyName, global::System.Convert.ToString); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Protection profile details. + [System.ComponentModel.TypeConverter(typeof(PolicyTypeConverter))] + public partial interface IPolicy + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Policy.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Policy.TypeConverter.cs new file mode 100644 index 000000000000..a39e5ea5a146 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Policy.TypeConverter.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class PolicyTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicy ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicy).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return Policy.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return Policy.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return Policy.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Policy.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Policy.cs new file mode 100644 index 000000000000..9634c8d3cd4b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Policy.cs @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Protection profile details. + public partial class Policy : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicy, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResource __resource = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.Resource(); + + /// The FriendlyName. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string FriendlyName { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyPropertiesInternal)Property).FriendlyName; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyPropertiesInternal)Property).FriendlyName = value ?? null; } + + /// Resource Id + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Id; } + + /// Resource Location + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string Location { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Location; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Location = value ?? null; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProperties Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PolicyProperties()); set { {_property = value;} } } + + /// Internal Acessors for ProviderSpecificDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetails Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyInternal.ProviderSpecificDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyPropertiesInternal)Property).ProviderSpecificDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyPropertiesInternal)Property).ProviderSpecificDetail = value; } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Id = value; } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Name = value; } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Type = value; } + + /// Resource Name + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Name; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProperties _property; + + /// The custom data. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PolicyProperties()); set => this._property = value; } + + /// Gets the class type. Overridden in derived classes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ProviderSpecificDetailInstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyPropertiesInternal)Property).ProviderSpecificDetailInstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyPropertiesInternal)Property).ProviderSpecificDetailInstanceType = value ?? null; } + + /// Resource Type + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Type; } + + /// Creates an new instance. + public Policy() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__resource), __resource); + await eventListener.AssertObjectIsValid(nameof(__resource), __resource); + } + } + /// Protection profile details. + public partial interface IPolicy : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResource + { + /// The FriendlyName. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The FriendlyName.", + SerializedName = @"friendlyName", + PossibleTypes = new [] { typeof(string) })] + string FriendlyName { get; set; } + /// Gets the class type. Overridden in derived classes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets the class type. Overridden in derived classes.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string ProviderSpecificDetailInstanceType { get; set; } + + } + /// Protection profile details. + internal partial interface IPolicyInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal + { + /// The FriendlyName. + string FriendlyName { get; set; } + /// The custom data. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProperties Property { get; set; } + /// The ReplicationChannelSetting. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetails ProviderSpecificDetail { get; set; } + /// Gets the class type. Overridden in derived classes. + string ProviderSpecificDetailInstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Policy.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Policy.json.cs new file mode 100644 index 000000000000..39e69a6a6cd8 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Policy.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Protection profile details. + public partial class Policy + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicy. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicy. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicy FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new Policy(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal Policy(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __resource = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.Resource(json); + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PolicyProperties.FromJson(__jsonProperties) : Property;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __resource?.ToJson(container, serializationMode); + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PolicyCollection.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PolicyCollection.PowerShell.cs new file mode 100644 index 000000000000..b8e58343baf2 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PolicyCollection.PowerShell.cs @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Protection Profile Collection details. + [System.ComponentModel.TypeConverter(typeof(PolicyCollectionTypeConverter))] + public partial class PolicyCollection + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyCollection DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new PolicyCollection(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyCollection DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new PolicyCollection(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyCollection FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal PolicyCollection(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicy[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PolicyTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyCollectionInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyCollectionInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal PolicyCollection(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicy[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PolicyTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyCollectionInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyCollectionInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Protection Profile Collection details. + [System.ComponentModel.TypeConverter(typeof(PolicyCollectionTypeConverter))] + public partial interface IPolicyCollection + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PolicyCollection.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PolicyCollection.TypeConverter.cs new file mode 100644 index 000000000000..a4c3fda42726 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PolicyCollection.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class PolicyCollectionTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyCollection ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyCollection).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return PolicyCollection.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return PolicyCollection.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return PolicyCollection.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PolicyCollection.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PolicyCollection.cs new file mode 100644 index 000000000000..c3012da87509 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PolicyCollection.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Protection Profile Collection details. + public partial class PolicyCollection : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyCollection, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyCollectionInternal + { + + /// Backing field for property. + private string _nextLink; + + /// The value of next link. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string NextLink { get => this._nextLink; set => this._nextLink = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicy[] _value; + + /// The policy details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicy[] Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public PolicyCollection() + { + + } + } + /// Protection Profile Collection details. + public partial interface IPolicyCollection : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The value of next link. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The value of next link.", + SerializedName = @"nextLink", + PossibleTypes = new [] { typeof(string) })] + string NextLink { get; set; } + /// The policy details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The policy details.", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicy) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicy[] Value { get; set; } + + } + /// Protection Profile Collection details. + internal partial interface IPolicyCollectionInternal + + { + /// The value of next link. + string NextLink { get; set; } + /// The policy details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicy[] Value { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PolicyCollection.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PolicyCollection.json.cs new file mode 100644 index 000000000000..cd9b862d5eab --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PolicyCollection.json.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Protection Profile Collection details. + public partial class PolicyCollection + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyCollection. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyCollection. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyCollection FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new PolicyCollection(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal PolicyCollection(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicy) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.Policy.FromJson(__u) )) ))() : null : Value;} + {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)NextLink;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._value) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._value ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("value",__w); + } + AddIf( null != (((object)this._nextLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PolicyProperties.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PolicyProperties.PowerShell.cs new file mode 100644 index 000000000000..16b6df25637d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PolicyProperties.PowerShell.cs @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Protection profile custom data details. + [System.ComponentModel.TypeConverter(typeof(PolicyPropertiesTypeConverter))] + public partial class PolicyProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new PolicyProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new PolicyProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal PolicyProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyPropertiesInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetails) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyPropertiesInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PolicyProviderSpecificDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("FriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyPropertiesInternal)this).FriendlyName = (string) content.GetValueForProperty("FriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyPropertiesInternal)this).FriendlyName, global::System.Convert.ToString); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyPropertiesInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyPropertiesInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal PolicyProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyPropertiesInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetails) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyPropertiesInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PolicyProviderSpecificDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("FriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyPropertiesInternal)this).FriendlyName = (string) content.GetValueForProperty("FriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyPropertiesInternal)this).FriendlyName, global::System.Convert.ToString); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyPropertiesInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyPropertiesInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Protection profile custom data details. + [System.ComponentModel.TypeConverter(typeof(PolicyPropertiesTypeConverter))] + public partial interface IPolicyProperties + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PolicyProperties.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PolicyProperties.TypeConverter.cs new file mode 100644 index 000000000000..ef223526e23c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PolicyProperties.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class PolicyPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return PolicyProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return PolicyProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return PolicyProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PolicyProperties.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PolicyProperties.cs new file mode 100644 index 000000000000..aa172c925146 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PolicyProperties.cs @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Protection profile custom data details. + public partial class PolicyProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProperties, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyPropertiesInternal + { + + /// Backing field for property. + private string _friendlyName; + + /// The FriendlyName. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string FriendlyName { get => this._friendlyName; set => this._friendlyName = value; } + + /// Internal Acessors for ProviderSpecificDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetails Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyPropertiesInternal.ProviderSpecificDetail { get => (this._providerSpecificDetail = this._providerSpecificDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PolicyProviderSpecificDetails()); set { {_providerSpecificDetail = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetails _providerSpecificDetail; + + /// The ReplicationChannelSetting. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetails ProviderSpecificDetail { get => (this._providerSpecificDetail = this._providerSpecificDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PolicyProviderSpecificDetails()); set => this._providerSpecificDetail = value; } + + /// Gets the class type. Overridden in derived classes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ProviderSpecificDetailInstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetailsInternal)ProviderSpecificDetail).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetailsInternal)ProviderSpecificDetail).InstanceType = value ?? null; } + + /// Creates an new instance. + public PolicyProperties() + { + + } + } + /// Protection profile custom data details. + public partial interface IPolicyProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The FriendlyName. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The FriendlyName.", + SerializedName = @"friendlyName", + PossibleTypes = new [] { typeof(string) })] + string FriendlyName { get; set; } + /// Gets the class type. Overridden in derived classes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets the class type. Overridden in derived classes.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string ProviderSpecificDetailInstanceType { get; set; } + + } + /// Protection profile custom data details. + internal partial interface IPolicyPropertiesInternal + + { + /// The FriendlyName. + string FriendlyName { get; set; } + /// The ReplicationChannelSetting. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetails ProviderSpecificDetail { get; set; } + /// Gets the class type. Overridden in derived classes. + string ProviderSpecificDetailInstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PolicyProperties.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PolicyProperties.json.cs new file mode 100644 index 000000000000..e716a675cd4b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PolicyProperties.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Protection profile custom data details. + public partial class PolicyProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new PolicyProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal PolicyProperties(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_providerSpecificDetail = If( json?.PropertyT("providerSpecificDetails"), out var __jsonProviderSpecificDetails) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PolicyProviderSpecificDetails.FromJson(__jsonProviderSpecificDetails) : ProviderSpecificDetail;} + {_friendlyName = If( json?.PropertyT("friendlyName"), out var __jsonFriendlyName) ? (string)__jsonFriendlyName : (string)FriendlyName;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._providerSpecificDetail ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._providerSpecificDetail.ToJson(null,serializationMode) : null, "providerSpecificDetails" ,container.Add ); + AddIf( null != (((object)this._friendlyName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._friendlyName.ToString()) : null, "friendlyName" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PolicyProviderSpecificDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PolicyProviderSpecificDetails.PowerShell.cs new file mode 100644 index 000000000000..f613794813df --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PolicyProviderSpecificDetails.PowerShell.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Base class for Provider specific details for policies. + [System.ComponentModel.TypeConverter(typeof(PolicyProviderSpecificDetailsTypeConverter))] + public partial class PolicyProviderSpecificDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new PolicyProviderSpecificDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new PolicyProviderSpecificDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal PolicyProviderSpecificDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal PolicyProviderSpecificDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Base class for Provider specific details for policies. + [System.ComponentModel.TypeConverter(typeof(PolicyProviderSpecificDetailsTypeConverter))] + public partial interface IPolicyProviderSpecificDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PolicyProviderSpecificDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PolicyProviderSpecificDetails.TypeConverter.cs new file mode 100644 index 000000000000..cb4ac5bef53d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PolicyProviderSpecificDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class PolicyProviderSpecificDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return PolicyProviderSpecificDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return PolicyProviderSpecificDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return PolicyProviderSpecificDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PolicyProviderSpecificDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PolicyProviderSpecificDetails.cs new file mode 100644 index 000000000000..503eff0925d5 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PolicyProviderSpecificDetails.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Base class for Provider specific details for policies. + public partial class PolicyProviderSpecificDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetailsInternal + { + + /// Backing field for property. + private string _instanceType; + + /// Gets the class type. Overridden in derived classes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string InstanceType { get => this._instanceType; set => this._instanceType = value; } + + /// Creates an new instance. + public PolicyProviderSpecificDetails() + { + + } + } + /// Base class for Provider specific details for policies. + public partial interface IPolicyProviderSpecificDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// Gets the class type. Overridden in derived classes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets the class type. Overridden in derived classes.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string InstanceType { get; set; } + + } + /// Base class for Provider specific details for policies. + internal partial interface IPolicyProviderSpecificDetailsInternal + + { + /// Gets the class type. Overridden in derived classes. + string InstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PolicyProviderSpecificDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PolicyProviderSpecificDetails.json.cs new file mode 100644 index 000000000000..98a962d21d4e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PolicyProviderSpecificDetails.json.cs @@ -0,0 +1,163 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Base class for Provider specific details for policies. + public partial class PolicyProviderSpecificDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetails. + /// Note: the Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetails interface is + /// polymorphic, and the precise model class that will get deserialized is determined at runtime based on the payload. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + if (!(node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json)) + { + return null; + } + // Polymorphic type -- select the appropriate constructor using the discriminator + + switch ( json.StringProperty("instanceType") ) + { + case "A2A": + { + return new A2APolicyDetails(json); + } + case "HyperVReplicaAzure": + { + return new HyperVReplicaAzurePolicyDetails(json); + } + case "HyperVReplicaBasePolicyDetails": + { + return new HyperVReplicaBasePolicyDetails(json); + } + case "HyperVReplica2012R2": + { + return new HyperVReplicaBluePolicyDetails(json); + } + case "HyperVReplica2012": + { + return new HyperVReplicaPolicyDetails(json); + } + case "InMageAzureV2": + { + return new InMageAzureV2PolicyDetails(json); + } + case "InMageBasePolicyDetails": + { + return new InMageBasePolicyDetails(json); + } + case "InMage": + { + return new InMagePolicyDetails(json); + } + case "InMageRcmFailback": + { + return new InMageRcmFailbackPolicyDetails(json); + } + case "InMageRcm": + { + return new InMageRcmPolicyDetails(json); + } + case "VMwareCbt": + { + return new VmwareCbtPolicyDetails(json); + } + } + return new PolicyProviderSpecificDetails(json); + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal PolicyProviderSpecificDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_instanceType = If( json?.PropertyT("instanceType"), out var __jsonInstanceType) ? (string)__jsonInstanceType : (string)InstanceType;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._instanceType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._instanceType.ToString()) : null, "instanceType" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PolicyProviderSpecificInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PolicyProviderSpecificInput.PowerShell.cs new file mode 100644 index 000000000000..4bac73e631d6 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PolicyProviderSpecificInput.PowerShell.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Base class for provider specific input. + [System.ComponentModel.TypeConverter(typeof(PolicyProviderSpecificInputTypeConverter))] + public partial class PolicyProviderSpecificInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new PolicyProviderSpecificInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new PolicyProviderSpecificInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal PolicyProviderSpecificInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal PolicyProviderSpecificInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Base class for provider specific input. + [System.ComponentModel.TypeConverter(typeof(PolicyProviderSpecificInputTypeConverter))] + public partial interface IPolicyProviderSpecificInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PolicyProviderSpecificInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PolicyProviderSpecificInput.TypeConverter.cs new file mode 100644 index 000000000000..62b0eef44298 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PolicyProviderSpecificInput.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class PolicyProviderSpecificInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return PolicyProviderSpecificInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return PolicyProviderSpecificInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return PolicyProviderSpecificInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PolicyProviderSpecificInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PolicyProviderSpecificInput.cs new file mode 100644 index 000000000000..f397824f2563 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PolicyProviderSpecificInput.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Base class for provider specific input. + public partial class PolicyProviderSpecificInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInputInternal + { + + /// Backing field for property. + private string _instanceType; + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string InstanceType { get => this._instanceType; set => this._instanceType = value; } + + /// Creates an new instance. + public PolicyProviderSpecificInput() + { + + } + } + /// Base class for provider specific input. + public partial interface IPolicyProviderSpecificInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string InstanceType { get; set; } + + } + /// Base class for provider specific input. + internal partial interface IPolicyProviderSpecificInputInternal + + { + /// The class type. + string InstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PolicyProviderSpecificInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PolicyProviderSpecificInput.json.cs new file mode 100644 index 000000000000..2beaa20115cb --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PolicyProviderSpecificInput.json.cs @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Base class for provider specific input. + public partial class PolicyProviderSpecificInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInput. + /// Note: the Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInput interface is polymorphic, + /// and the precise model class that will get deserialized is determined at runtime based on the payload. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + if (!(node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json)) + { + return null; + } + // Polymorphic type -- select the appropriate constructor using the discriminator + + switch ( json.StringProperty("instanceType") ) + { + case "A2ACrossClusterMigration": + { + return new A2ACrossClusterMigrationPolicyCreationInput(json); + } + case "A2A": + { + return new A2APolicyCreationInput(json); + } + case "HyperVReplicaAzure": + { + return new HyperVReplicaAzurePolicyInput(json); + } + case "HyperVReplica2012": + { + return new HyperVReplicaPolicyInput(json); + } + case "HyperVReplica2012R2": + { + return new HyperVReplicaBluePolicyInput(json); + } + case "InMageAzureV2": + { + return new InMageAzureV2PolicyInput(json); + } + case "InMage": + { + return new InMagePolicyInput(json); + } + case "InMageRcmFailback": + { + return new InMageRcmFailbackPolicyCreationInput(json); + } + case "InMageRcm": + { + return new InMageRcmPolicyCreationInput(json); + } + case "VMwareCbt": + { + return new VMwareCbtPolicyCreationInput(json); + } + } + return new PolicyProviderSpecificInput(json); + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal PolicyProviderSpecificInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_instanceType = If( json?.PropertyT("instanceType"), out var __jsonInstanceType) ? (string)__jsonInstanceType : (string)InstanceType;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._instanceType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._instanceType.ToString()) : null, "instanceType" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProcessServer.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProcessServer.PowerShell.cs new file mode 100644 index 000000000000..bc473d7837ef --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProcessServer.PowerShell.cs @@ -0,0 +1,448 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Details of the Process Server. + [System.ComponentModel.TypeConverter(typeof(ProcessServerTypeConverter))] + public partial class ProcessServer + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServer DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ProcessServer(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServer DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ProcessServer(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServer FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ProcessServer(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("AgentVersionDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).AgentVersionDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVersionDetails) content.GetValueForProperty("AgentVersionDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).AgentVersionDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VersionDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("FriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).FriendlyName = (string) content.GetValueForProperty("FriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).FriendlyName, global::System.Convert.ToString); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("IPAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).IPAddress = (string) content.GetValueForProperty("IPAddress",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).IPAddress, global::System.Convert.ToString); + } + if (content.Contains("OSType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).OSType = (string) content.GetValueForProperty("OSType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).OSType, global::System.Convert.ToString); + } + if (content.Contains("AgentVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).AgentVersion = (string) content.GetValueForProperty("AgentVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).AgentVersion, global::System.Convert.ToString); + } + if (content.Contains("LastHeartbeat")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).LastHeartbeat = (global::System.DateTime?) content.GetValueForProperty("LastHeartbeat",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).LastHeartbeat, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("VersionStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).VersionStatus = (string) content.GetValueForProperty("VersionStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).VersionStatus, global::System.Convert.ToString); + } + if (content.Contains("MobilityServiceUpdate")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).MobilityServiceUpdate = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMobilityServiceUpdate[]) content.GetValueForProperty("MobilityServiceUpdate",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).MobilityServiceUpdate, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.MobilityServiceUpdateTypeConverter.ConvertFrom)); + } + if (content.Contains("HostId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).HostId = (string) content.GetValueForProperty("HostId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).HostId, global::System.Convert.ToString); + } + if (content.Contains("MachineCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).MachineCount = (string) content.GetValueForProperty("MachineCount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).MachineCount, global::System.Convert.ToString); + } + if (content.Contains("ReplicationPairCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).ReplicationPairCount = (string) content.GetValueForProperty("ReplicationPairCount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).ReplicationPairCount, global::System.Convert.ToString); + } + if (content.Contains("SystemLoad")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).SystemLoad = (string) content.GetValueForProperty("SystemLoad",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).SystemLoad, global::System.Convert.ToString); + } + if (content.Contains("SystemLoadStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).SystemLoadStatus = (string) content.GetValueForProperty("SystemLoadStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).SystemLoadStatus, global::System.Convert.ToString); + } + if (content.Contains("CpuLoad")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).CpuLoad = (string) content.GetValueForProperty("CpuLoad",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).CpuLoad, global::System.Convert.ToString); + } + if (content.Contains("CpuLoadStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).CpuLoadStatus = (string) content.GetValueForProperty("CpuLoadStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).CpuLoadStatus, global::System.Convert.ToString); + } + if (content.Contains("TotalMemoryInByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).TotalMemoryInByte = (long?) content.GetValueForProperty("TotalMemoryInByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).TotalMemoryInByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("AvailableMemoryInByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).AvailableMemoryInByte = (long?) content.GetValueForProperty("AvailableMemoryInByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).AvailableMemoryInByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("MemoryUsageStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).MemoryUsageStatus = (string) content.GetValueForProperty("MemoryUsageStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).MemoryUsageStatus, global::System.Convert.ToString); + } + if (content.Contains("TotalSpaceInByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).TotalSpaceInByte = (long?) content.GetValueForProperty("TotalSpaceInByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).TotalSpaceInByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("AvailableSpaceInByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).AvailableSpaceInByte = (long?) content.GetValueForProperty("AvailableSpaceInByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).AvailableSpaceInByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("SpaceUsageStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).SpaceUsageStatus = (string) content.GetValueForProperty("SpaceUsageStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).SpaceUsageStatus, global::System.Convert.ToString); + } + if (content.Contains("PsServiceStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).PsServiceStatus = (string) content.GetValueForProperty("PsServiceStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).PsServiceStatus, global::System.Convert.ToString); + } + if (content.Contains("SslCertExpiryDate")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).SslCertExpiryDate = (global::System.DateTime?) content.GetValueForProperty("SslCertExpiryDate",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).SslCertExpiryDate, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SslCertExpiryRemainingDay")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).SslCertExpiryRemainingDay = (int?) content.GetValueForProperty("SslCertExpiryRemainingDay",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).SslCertExpiryRemainingDay, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("OSVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).OSVersion = (string) content.GetValueForProperty("OSVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).OSVersion, global::System.Convert.ToString); + } + if (content.Contains("HealthError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).HealthError = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[]) content.GetValueForProperty("HealthError",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).HealthError, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("AgentExpiryDate")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).AgentExpiryDate = (global::System.DateTime?) content.GetValueForProperty("AgentExpiryDate",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).AgentExpiryDate, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("Health")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).Health = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth?) content.GetValueForProperty("Health",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).Health, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth.CreateFrom); + } + if (content.Contains("PsStatsRefreshTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).PsStatsRefreshTime = (global::System.DateTime?) content.GetValueForProperty("PsStatsRefreshTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).PsStatsRefreshTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ThroughputUploadPendingDataInByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).ThroughputUploadPendingDataInByte = (long?) content.GetValueForProperty("ThroughputUploadPendingDataInByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).ThroughputUploadPendingDataInByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("ThroughputInMBps")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).ThroughputInMBps = (long?) content.GetValueForProperty("ThroughputInMBps",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).ThroughputInMBps, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("ThroughputInByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).ThroughputInByte = (long?) content.GetValueForProperty("ThroughputInByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).ThroughputInByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("ThroughputStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).ThroughputStatus = (string) content.GetValueForProperty("ThroughputStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).ThroughputStatus, global::System.Convert.ToString); + } + if (content.Contains("MarsCommunicationStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).MarsCommunicationStatus = (string) content.GetValueForProperty("MarsCommunicationStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).MarsCommunicationStatus, global::System.Convert.ToString); + } + if (content.Contains("MarsRegistrationStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).MarsRegistrationStatus = (string) content.GetValueForProperty("MarsRegistrationStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).MarsRegistrationStatus, global::System.Convert.ToString); + } + if (content.Contains("AgentVersionDetailVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).AgentVersionDetailVersion = (string) content.GetValueForProperty("AgentVersionDetailVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).AgentVersionDetailVersion, global::System.Convert.ToString); + } + if (content.Contains("AgentVersionDetailExpiryDate")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).AgentVersionDetailExpiryDate = (global::System.DateTime?) content.GetValueForProperty("AgentVersionDetailExpiryDate",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).AgentVersionDetailExpiryDate, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("AgentVersionDetailStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).AgentVersionDetailStatus = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentVersionStatus?) content.GetValueForProperty("AgentVersionDetailStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).AgentVersionDetailStatus, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentVersionStatus.CreateFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ProcessServer(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("AgentVersionDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).AgentVersionDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVersionDetails) content.GetValueForProperty("AgentVersionDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).AgentVersionDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VersionDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("FriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).FriendlyName = (string) content.GetValueForProperty("FriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).FriendlyName, global::System.Convert.ToString); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("IPAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).IPAddress = (string) content.GetValueForProperty("IPAddress",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).IPAddress, global::System.Convert.ToString); + } + if (content.Contains("OSType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).OSType = (string) content.GetValueForProperty("OSType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).OSType, global::System.Convert.ToString); + } + if (content.Contains("AgentVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).AgentVersion = (string) content.GetValueForProperty("AgentVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).AgentVersion, global::System.Convert.ToString); + } + if (content.Contains("LastHeartbeat")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).LastHeartbeat = (global::System.DateTime?) content.GetValueForProperty("LastHeartbeat",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).LastHeartbeat, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("VersionStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).VersionStatus = (string) content.GetValueForProperty("VersionStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).VersionStatus, global::System.Convert.ToString); + } + if (content.Contains("MobilityServiceUpdate")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).MobilityServiceUpdate = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMobilityServiceUpdate[]) content.GetValueForProperty("MobilityServiceUpdate",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).MobilityServiceUpdate, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.MobilityServiceUpdateTypeConverter.ConvertFrom)); + } + if (content.Contains("HostId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).HostId = (string) content.GetValueForProperty("HostId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).HostId, global::System.Convert.ToString); + } + if (content.Contains("MachineCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).MachineCount = (string) content.GetValueForProperty("MachineCount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).MachineCount, global::System.Convert.ToString); + } + if (content.Contains("ReplicationPairCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).ReplicationPairCount = (string) content.GetValueForProperty("ReplicationPairCount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).ReplicationPairCount, global::System.Convert.ToString); + } + if (content.Contains("SystemLoad")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).SystemLoad = (string) content.GetValueForProperty("SystemLoad",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).SystemLoad, global::System.Convert.ToString); + } + if (content.Contains("SystemLoadStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).SystemLoadStatus = (string) content.GetValueForProperty("SystemLoadStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).SystemLoadStatus, global::System.Convert.ToString); + } + if (content.Contains("CpuLoad")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).CpuLoad = (string) content.GetValueForProperty("CpuLoad",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).CpuLoad, global::System.Convert.ToString); + } + if (content.Contains("CpuLoadStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).CpuLoadStatus = (string) content.GetValueForProperty("CpuLoadStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).CpuLoadStatus, global::System.Convert.ToString); + } + if (content.Contains("TotalMemoryInByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).TotalMemoryInByte = (long?) content.GetValueForProperty("TotalMemoryInByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).TotalMemoryInByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("AvailableMemoryInByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).AvailableMemoryInByte = (long?) content.GetValueForProperty("AvailableMemoryInByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).AvailableMemoryInByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("MemoryUsageStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).MemoryUsageStatus = (string) content.GetValueForProperty("MemoryUsageStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).MemoryUsageStatus, global::System.Convert.ToString); + } + if (content.Contains("TotalSpaceInByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).TotalSpaceInByte = (long?) content.GetValueForProperty("TotalSpaceInByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).TotalSpaceInByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("AvailableSpaceInByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).AvailableSpaceInByte = (long?) content.GetValueForProperty("AvailableSpaceInByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).AvailableSpaceInByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("SpaceUsageStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).SpaceUsageStatus = (string) content.GetValueForProperty("SpaceUsageStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).SpaceUsageStatus, global::System.Convert.ToString); + } + if (content.Contains("PsServiceStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).PsServiceStatus = (string) content.GetValueForProperty("PsServiceStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).PsServiceStatus, global::System.Convert.ToString); + } + if (content.Contains("SslCertExpiryDate")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).SslCertExpiryDate = (global::System.DateTime?) content.GetValueForProperty("SslCertExpiryDate",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).SslCertExpiryDate, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SslCertExpiryRemainingDay")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).SslCertExpiryRemainingDay = (int?) content.GetValueForProperty("SslCertExpiryRemainingDay",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).SslCertExpiryRemainingDay, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("OSVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).OSVersion = (string) content.GetValueForProperty("OSVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).OSVersion, global::System.Convert.ToString); + } + if (content.Contains("HealthError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).HealthError = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[]) content.GetValueForProperty("HealthError",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).HealthError, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("AgentExpiryDate")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).AgentExpiryDate = (global::System.DateTime?) content.GetValueForProperty("AgentExpiryDate",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).AgentExpiryDate, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("Health")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).Health = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth?) content.GetValueForProperty("Health",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).Health, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth.CreateFrom); + } + if (content.Contains("PsStatsRefreshTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).PsStatsRefreshTime = (global::System.DateTime?) content.GetValueForProperty("PsStatsRefreshTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).PsStatsRefreshTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ThroughputUploadPendingDataInByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).ThroughputUploadPendingDataInByte = (long?) content.GetValueForProperty("ThroughputUploadPendingDataInByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).ThroughputUploadPendingDataInByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("ThroughputInMBps")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).ThroughputInMBps = (long?) content.GetValueForProperty("ThroughputInMBps",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).ThroughputInMBps, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("ThroughputInByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).ThroughputInByte = (long?) content.GetValueForProperty("ThroughputInByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).ThroughputInByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("ThroughputStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).ThroughputStatus = (string) content.GetValueForProperty("ThroughputStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).ThroughputStatus, global::System.Convert.ToString); + } + if (content.Contains("MarsCommunicationStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).MarsCommunicationStatus = (string) content.GetValueForProperty("MarsCommunicationStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).MarsCommunicationStatus, global::System.Convert.ToString); + } + if (content.Contains("MarsRegistrationStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).MarsRegistrationStatus = (string) content.GetValueForProperty("MarsRegistrationStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).MarsRegistrationStatus, global::System.Convert.ToString); + } + if (content.Contains("AgentVersionDetailVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).AgentVersionDetailVersion = (string) content.GetValueForProperty("AgentVersionDetailVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).AgentVersionDetailVersion, global::System.Convert.ToString); + } + if (content.Contains("AgentVersionDetailExpiryDate")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).AgentVersionDetailExpiryDate = (global::System.DateTime?) content.GetValueForProperty("AgentVersionDetailExpiryDate",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).AgentVersionDetailExpiryDate, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("AgentVersionDetailStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).AgentVersionDetailStatus = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentVersionStatus?) content.GetValueForProperty("AgentVersionDetailStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal)this).AgentVersionDetailStatus, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentVersionStatus.CreateFrom); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Details of the Process Server. + [System.ComponentModel.TypeConverter(typeof(ProcessServerTypeConverter))] + public partial interface IProcessServer + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProcessServer.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProcessServer.TypeConverter.cs new file mode 100644 index 000000000000..eddeb5b6fc0a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProcessServer.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ProcessServerTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServer ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServer).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ProcessServer.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ProcessServer.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ProcessServer.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProcessServer.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProcessServer.cs new file mode 100644 index 000000000000..180275364811 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProcessServer.cs @@ -0,0 +1,713 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Details of the Process Server. + public partial class ProcessServer : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServer, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal + { + + /// Backing field for property. + private global::System.DateTime? _agentExpiryDate; + + /// Agent expiry date. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public global::System.DateTime? AgentExpiryDate { get => this._agentExpiryDate; set => this._agentExpiryDate = value; } + + /// Backing field for property. + private string _agentVersion; + + /// The version of the scout component on the server. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string AgentVersion { get => this._agentVersion; set => this._agentVersion = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVersionDetails _agentVersionDetail; + + /// The agent version details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVersionDetails AgentVersionDetail { get => (this._agentVersionDetail = this._agentVersionDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VersionDetails()); set => this._agentVersionDetail = value; } + + /// Version expiry date. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public global::System.DateTime? AgentVersionDetailExpiryDate { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVersionDetailsInternal)AgentVersionDetail).ExpiryDate; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVersionDetailsInternal)AgentVersionDetail).ExpiryDate = value ?? default(global::System.DateTime); } + + /// A value indicating whether security update required. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentVersionStatus? AgentVersionDetailStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVersionDetailsInternal)AgentVersionDetail).Status; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVersionDetailsInternal)AgentVersionDetail).Status = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentVersionStatus)""); } + + /// The agent version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string AgentVersionDetailVersion { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVersionDetailsInternal)AgentVersionDetail).Version; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVersionDetailsInternal)AgentVersionDetail).Version = value ?? null; } + + /// Backing field for property. + private long? _availableMemoryInByte; + + /// The available memory. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public long? AvailableMemoryInByte { get => this._availableMemoryInByte; set => this._availableMemoryInByte = value; } + + /// Backing field for property. + private long? _availableSpaceInByte; + + /// The available space. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public long? AvailableSpaceInByte { get => this._availableSpaceInByte; set => this._availableSpaceInByte = value; } + + /// Backing field for property. + private string _cpuLoad; + + /// The percentage of the CPU load. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string CpuLoad { get => this._cpuLoad; set => this._cpuLoad = value; } + + /// Backing field for property. + private string _cpuLoadStatus; + + /// The CPU load status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string CpuLoadStatus { get => this._cpuLoadStatus; set => this._cpuLoadStatus = value; } + + /// Backing field for property. + private string _friendlyName; + + /// The Process Server's friendly name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string FriendlyName { get => this._friendlyName; set => this._friendlyName = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth? _health; + + /// The health of Process Server. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth? Health { get => this._health; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] _healthError; + + /// Health errors. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] HealthError { get => this._healthError; set => this._healthError = value; } + + /// Backing field for property. + private string _hostId; + + /// The agent generated Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string HostId { get => this._hostId; set => this._hostId = value; } + + /// Backing field for property. + private string _iPAddress; + + /// The IP address of the server. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string IPAddress { get => this._iPAddress; set => this._iPAddress = value; } + + /// Backing field for property. + private string _id; + + /// The Process Server Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Id { get => this._id; set => this._id = value; } + + /// Backing field for property. + private global::System.DateTime? _lastHeartbeat; + + /// The last heartbeat received from the server. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public global::System.DateTime? LastHeartbeat { get => this._lastHeartbeat; set => this._lastHeartbeat = value; } + + /// Backing field for property. + private string _machineCount; + + /// The servers configured with this PS. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string MachineCount { get => this._machineCount; set => this._machineCount = value; } + + /// Backing field for property. + private string _marsCommunicationStatus; + + /// The MARS communication status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string MarsCommunicationStatus { get => this._marsCommunicationStatus; } + + /// Backing field for property. + private string _marsRegistrationStatus; + + /// The MARS registration status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string MarsRegistrationStatus { get => this._marsRegistrationStatus; } + + /// Backing field for property. + private string _memoryUsageStatus; + + /// The memory usage status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string MemoryUsageStatus { get => this._memoryUsageStatus; set => this._memoryUsageStatus = value; } + + /// Internal Acessors for AgentVersionDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVersionDetails Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal.AgentVersionDetail { get => (this._agentVersionDetail = this._agentVersionDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VersionDetails()); set { {_agentVersionDetail = value;} } } + + /// Internal Acessors for Health + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal.Health { get => this._health; set { {_health = value;} } } + + /// Internal Acessors for MarsCommunicationStatus + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal.MarsCommunicationStatus { get => this._marsCommunicationStatus; set { {_marsCommunicationStatus = value;} } } + + /// Internal Acessors for MarsRegistrationStatus + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal.MarsRegistrationStatus { get => this._marsRegistrationStatus; set { {_marsRegistrationStatus = value;} } } + + /// Internal Acessors for PsStatsRefreshTime + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal.PsStatsRefreshTime { get => this._psStatsRefreshTime; set { {_psStatsRefreshTime = value;} } } + + /// Internal Acessors for ThroughputInByte + long? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal.ThroughputInByte { get => this._throughputInByte; set { {_throughputInByte = value;} } } + + /// Internal Acessors for ThroughputInMBps + long? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal.ThroughputInMBps { get => this._throughputInMBps; set { {_throughputInMBps = value;} } } + + /// Internal Acessors for ThroughputStatus + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal.ThroughputStatus { get => this._throughputStatus; set { {_throughputStatus = value;} } } + + /// Internal Acessors for ThroughputUploadPendingDataInByte + long? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerInternal.ThroughputUploadPendingDataInByte { get => this._throughputUploadPendingDataInByte; set { {_throughputUploadPendingDataInByte = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMobilityServiceUpdate[] _mobilityServiceUpdate; + + /// The list of the mobility service updates available on the Process Server. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMobilityServiceUpdate[] MobilityServiceUpdate { get => this._mobilityServiceUpdate; set => this._mobilityServiceUpdate = value; } + + /// Backing field for property. + private string _oSType; + + /// The OS type of the server. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string OSType { get => this._oSType; set => this._oSType = value; } + + /// Backing field for property. + private string _oSVersion; + + /// + /// OS Version of the process server. Note: This will get populated if user has CS version greater than 9.12.0.0. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string OSVersion { get => this._oSVersion; set => this._oSVersion = value; } + + /// Backing field for property. + private string _psServiceStatus; + + /// The PS service status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string PsServiceStatus { get => this._psServiceStatus; set => this._psServiceStatus = value; } + + /// Backing field for property. + private global::System.DateTime? _psStatsRefreshTime; + + /// The process server stats refresh time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public global::System.DateTime? PsStatsRefreshTime { get => this._psStatsRefreshTime; } + + /// Backing field for property. + private string _replicationPairCount; + + /// The number of replication pairs configured in this PS. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ReplicationPairCount { get => this._replicationPairCount; set => this._replicationPairCount = value; } + + /// Backing field for property. + private string _spaceUsageStatus; + + /// The space usage status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string SpaceUsageStatus { get => this._spaceUsageStatus; set => this._spaceUsageStatus = value; } + + /// Backing field for property. + private global::System.DateTime? _sslCertExpiryDate; + + /// The PS SSL cert expiry date. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public global::System.DateTime? SslCertExpiryDate { get => this._sslCertExpiryDate; set => this._sslCertExpiryDate = value; } + + /// Backing field for property. + private int? _sslCertExpiryRemainingDay; + + /// CS SSL cert expiry date. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? SslCertExpiryRemainingDay { get => this._sslCertExpiryRemainingDay; set => this._sslCertExpiryRemainingDay = value; } + + /// Backing field for property. + private string _systemLoad; + + /// The percentage of the system load. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string SystemLoad { get => this._systemLoad; set => this._systemLoad = value; } + + /// Backing field for property. + private string _systemLoadStatus; + + /// The system load status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string SystemLoadStatus { get => this._systemLoadStatus; set => this._systemLoadStatus = value; } + + /// Backing field for property. + private long? _throughputInByte; + + /// The throughput in bytes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public long? ThroughputInByte { get => this._throughputInByte; } + + /// Backing field for property. + private long? _throughputInMBps; + + /// The throughput in MBps. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public long? ThroughputInMBps { get => this._throughputInMBps; } + + /// Backing field for property. + private string _throughputStatus; + + /// The throughput status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ThroughputStatus { get => this._throughputStatus; } + + /// Backing field for property. + private long? _throughputUploadPendingDataInByte; + + /// The uploading pending data in bytes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public long? ThroughputUploadPendingDataInByte { get => this._throughputUploadPendingDataInByte; } + + /// Backing field for property. + private long? _totalMemoryInByte; + + /// The total memory. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public long? TotalMemoryInByte { get => this._totalMemoryInByte; set => this._totalMemoryInByte = value; } + + /// Backing field for property. + private long? _totalSpaceInByte; + + /// The total space. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public long? TotalSpaceInByte { get => this._totalSpaceInByte; set => this._totalSpaceInByte = value; } + + /// Backing field for property. + private string _versionStatus; + + /// Version status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string VersionStatus { get => this._versionStatus; set => this._versionStatus = value; } + + /// Creates an new instance. + public ProcessServer() + { + + } + } + /// Details of the Process Server. + public partial interface IProcessServer : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// Agent expiry date. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Agent expiry date.", + SerializedName = @"agentExpiryDate", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? AgentExpiryDate { get; set; } + /// The version of the scout component on the server. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The version of the scout component on the server.", + SerializedName = @"agentVersion", + PossibleTypes = new [] { typeof(string) })] + string AgentVersion { get; set; } + /// Version expiry date. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Version expiry date.", + SerializedName = @"expiryDate", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? AgentVersionDetailExpiryDate { get; set; } + /// A value indicating whether security update required. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether security update required.", + SerializedName = @"status", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentVersionStatus) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentVersionStatus? AgentVersionDetailStatus { get; set; } + /// The agent version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The agent version.", + SerializedName = @"version", + PossibleTypes = new [] { typeof(string) })] + string AgentVersionDetailVersion { get; set; } + /// The available memory. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The available memory.", + SerializedName = @"availableMemoryInBytes", + PossibleTypes = new [] { typeof(long) })] + long? AvailableMemoryInByte { get; set; } + /// The available space. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The available space.", + SerializedName = @"availableSpaceInBytes", + PossibleTypes = new [] { typeof(long) })] + long? AvailableSpaceInByte { get; set; } + /// The percentage of the CPU load. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The percentage of the CPU load.", + SerializedName = @"cpuLoad", + PossibleTypes = new [] { typeof(string) })] + string CpuLoad { get; set; } + /// The CPU load status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The CPU load status.", + SerializedName = @"cpuLoadStatus", + PossibleTypes = new [] { typeof(string) })] + string CpuLoadStatus { get; set; } + /// The Process Server's friendly name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Process Server's friendly name.", + SerializedName = @"friendlyName", + PossibleTypes = new [] { typeof(string) })] + string FriendlyName { get; set; } + /// The health of Process Server. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The health of Process Server.", + SerializedName = @"health", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth? Health { get; } + /// Health errors. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Health errors.", + SerializedName = @"healthErrors", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] HealthError { get; set; } + /// The agent generated Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The agent generated Id.", + SerializedName = @"hostId", + PossibleTypes = new [] { typeof(string) })] + string HostId { get; set; } + /// The IP address of the server. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The IP address of the server.", + SerializedName = @"ipAddress", + PossibleTypes = new [] { typeof(string) })] + string IPAddress { get; set; } + /// The Process Server Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Process Server Id.", + SerializedName = @"id", + PossibleTypes = new [] { typeof(string) })] + string Id { get; set; } + /// The last heartbeat received from the server. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The last heartbeat received from the server.", + SerializedName = @"lastHeartbeat", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? LastHeartbeat { get; set; } + /// The servers configured with this PS. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The servers configured with this PS.", + SerializedName = @"machineCount", + PossibleTypes = new [] { typeof(string) })] + string MachineCount { get; set; } + /// The MARS communication status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The MARS communication status.", + SerializedName = @"marsCommunicationStatus", + PossibleTypes = new [] { typeof(string) })] + string MarsCommunicationStatus { get; } + /// The MARS registration status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The MARS registration status.", + SerializedName = @"marsRegistrationStatus", + PossibleTypes = new [] { typeof(string) })] + string MarsRegistrationStatus { get; } + /// The memory usage status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The memory usage status.", + SerializedName = @"memoryUsageStatus", + PossibleTypes = new [] { typeof(string) })] + string MemoryUsageStatus { get; set; } + /// The list of the mobility service updates available on the Process Server. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of the mobility service updates available on the Process Server.", + SerializedName = @"mobilityServiceUpdates", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMobilityServiceUpdate) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMobilityServiceUpdate[] MobilityServiceUpdate { get; set; } + /// The OS type of the server. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The OS type of the server.", + SerializedName = @"osType", + PossibleTypes = new [] { typeof(string) })] + string OSType { get; set; } + /// + /// OS Version of the process server. Note: This will get populated if user has CS version greater than 9.12.0.0. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"OS Version of the process server. Note: This will get populated if user has CS version greater than 9.12.0.0.", + SerializedName = @"osVersion", + PossibleTypes = new [] { typeof(string) })] + string OSVersion { get; set; } + /// The PS service status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The PS service status.", + SerializedName = @"psServiceStatus", + PossibleTypes = new [] { typeof(string) })] + string PsServiceStatus { get; set; } + /// The process server stats refresh time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The process server stats refresh time.", + SerializedName = @"psStatsRefreshTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? PsStatsRefreshTime { get; } + /// The number of replication pairs configured in this PS. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The number of replication pairs configured in this PS.", + SerializedName = @"replicationPairCount", + PossibleTypes = new [] { typeof(string) })] + string ReplicationPairCount { get; set; } + /// The space usage status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The space usage status.", + SerializedName = @"spaceUsageStatus", + PossibleTypes = new [] { typeof(string) })] + string SpaceUsageStatus { get; set; } + /// The PS SSL cert expiry date. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The PS SSL cert expiry date.", + SerializedName = @"sslCertExpiryDate", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? SslCertExpiryDate { get; set; } + /// CS SSL cert expiry date. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"CS SSL cert expiry date.", + SerializedName = @"sslCertExpiryRemainingDays", + PossibleTypes = new [] { typeof(int) })] + int? SslCertExpiryRemainingDay { get; set; } + /// The percentage of the system load. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The percentage of the system load.", + SerializedName = @"systemLoad", + PossibleTypes = new [] { typeof(string) })] + string SystemLoad { get; set; } + /// The system load status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The system load status.", + SerializedName = @"systemLoadStatus", + PossibleTypes = new [] { typeof(string) })] + string SystemLoadStatus { get; set; } + /// The throughput in bytes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The throughput in bytes.", + SerializedName = @"throughputInBytes", + PossibleTypes = new [] { typeof(long) })] + long? ThroughputInByte { get; } + /// The throughput in MBps. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The throughput in MBps.", + SerializedName = @"throughputInMBps", + PossibleTypes = new [] { typeof(long) })] + long? ThroughputInMBps { get; } + /// The throughput status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The throughput status.", + SerializedName = @"throughputStatus", + PossibleTypes = new [] { typeof(string) })] + string ThroughputStatus { get; } + /// The uploading pending data in bytes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The uploading pending data in bytes.", + SerializedName = @"throughputUploadPendingDataInBytes", + PossibleTypes = new [] { typeof(long) })] + long? ThroughputUploadPendingDataInByte { get; } + /// The total memory. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The total memory.", + SerializedName = @"totalMemoryInBytes", + PossibleTypes = new [] { typeof(long) })] + long? TotalMemoryInByte { get; set; } + /// The total space. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The total space.", + SerializedName = @"totalSpaceInBytes", + PossibleTypes = new [] { typeof(long) })] + long? TotalSpaceInByte { get; set; } + /// Version status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Version status.", + SerializedName = @"versionStatus", + PossibleTypes = new [] { typeof(string) })] + string VersionStatus { get; set; } + + } + /// Details of the Process Server. + internal partial interface IProcessServerInternal + + { + /// Agent expiry date. + global::System.DateTime? AgentExpiryDate { get; set; } + /// The version of the scout component on the server. + string AgentVersion { get; set; } + /// The agent version details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVersionDetails AgentVersionDetail { get; set; } + /// Version expiry date. + global::System.DateTime? AgentVersionDetailExpiryDate { get; set; } + /// A value indicating whether security update required. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentVersionStatus? AgentVersionDetailStatus { get; set; } + /// The agent version. + string AgentVersionDetailVersion { get; set; } + /// The available memory. + long? AvailableMemoryInByte { get; set; } + /// The available space. + long? AvailableSpaceInByte { get; set; } + /// The percentage of the CPU load. + string CpuLoad { get; set; } + /// The CPU load status. + string CpuLoadStatus { get; set; } + /// The Process Server's friendly name. + string FriendlyName { get; set; } + /// The health of Process Server. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth? Health { get; set; } + /// Health errors. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] HealthError { get; set; } + /// The agent generated Id. + string HostId { get; set; } + /// The IP address of the server. + string IPAddress { get; set; } + /// The Process Server Id. + string Id { get; set; } + /// The last heartbeat received from the server. + global::System.DateTime? LastHeartbeat { get; set; } + /// The servers configured with this PS. + string MachineCount { get; set; } + /// The MARS communication status. + string MarsCommunicationStatus { get; set; } + /// The MARS registration status. + string MarsRegistrationStatus { get; set; } + /// The memory usage status. + string MemoryUsageStatus { get; set; } + /// The list of the mobility service updates available on the Process Server. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMobilityServiceUpdate[] MobilityServiceUpdate { get; set; } + /// The OS type of the server. + string OSType { get; set; } + /// + /// OS Version of the process server. Note: This will get populated if user has CS version greater than 9.12.0.0. + /// + string OSVersion { get; set; } + /// The PS service status. + string PsServiceStatus { get; set; } + /// The process server stats refresh time. + global::System.DateTime? PsStatsRefreshTime { get; set; } + /// The number of replication pairs configured in this PS. + string ReplicationPairCount { get; set; } + /// The space usage status. + string SpaceUsageStatus { get; set; } + /// The PS SSL cert expiry date. + global::System.DateTime? SslCertExpiryDate { get; set; } + /// CS SSL cert expiry date. + int? SslCertExpiryRemainingDay { get; set; } + /// The percentage of the system load. + string SystemLoad { get; set; } + /// The system load status. + string SystemLoadStatus { get; set; } + /// The throughput in bytes. + long? ThroughputInByte { get; set; } + /// The throughput in MBps. + long? ThroughputInMBps { get; set; } + /// The throughput status. + string ThroughputStatus { get; set; } + /// The uploading pending data in bytes. + long? ThroughputUploadPendingDataInByte { get; set; } + /// The total memory. + long? TotalMemoryInByte { get; set; } + /// The total space. + long? TotalSpaceInByte { get; set; } + /// Version status. + string VersionStatus { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProcessServer.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProcessServer.json.cs new file mode 100644 index 000000000000..47854a57f090 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProcessServer.json.cs @@ -0,0 +1,218 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Details of the Process Server. + public partial class ProcessServer + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServer. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServer. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServer FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new ProcessServer(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal ProcessServer(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_agentVersionDetail = If( json?.PropertyT("agentVersionDetails"), out var __jsonAgentVersionDetails) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VersionDetails.FromJson(__jsonAgentVersionDetails) : AgentVersionDetail;} + {_friendlyName = If( json?.PropertyT("friendlyName"), out var __jsonFriendlyName) ? (string)__jsonFriendlyName : (string)FriendlyName;} + {_id = If( json?.PropertyT("id"), out var __jsonId) ? (string)__jsonId : (string)Id;} + {_iPAddress = If( json?.PropertyT("ipAddress"), out var __jsonIPAddress) ? (string)__jsonIPAddress : (string)IPAddress;} + {_oSType = If( json?.PropertyT("osType"), out var __jsonOSType) ? (string)__jsonOSType : (string)OSType;} + {_agentVersion = If( json?.PropertyT("agentVersion"), out var __jsonAgentVersion) ? (string)__jsonAgentVersion : (string)AgentVersion;} + {_lastHeartbeat = If( json?.PropertyT("lastHeartbeat"), out var __jsonLastHeartbeat) ? global::System.DateTime.TryParse((string)__jsonLastHeartbeat, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonLastHeartbeatValue) ? __jsonLastHeartbeatValue : LastHeartbeat : LastHeartbeat;} + {_versionStatus = If( json?.PropertyT("versionStatus"), out var __jsonVersionStatus) ? (string)__jsonVersionStatus : (string)VersionStatus;} + {_mobilityServiceUpdate = If( json?.PropertyT("mobilityServiceUpdates"), out var __jsonMobilityServiceUpdates) ? If( __jsonMobilityServiceUpdates as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMobilityServiceUpdate) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.MobilityServiceUpdate.FromJson(__u) )) ))() : null : MobilityServiceUpdate;} + {_hostId = If( json?.PropertyT("hostId"), out var __jsonHostId) ? (string)__jsonHostId : (string)HostId;} + {_machineCount = If( json?.PropertyT("machineCount"), out var __jsonMachineCount) ? (string)__jsonMachineCount : (string)MachineCount;} + {_replicationPairCount = If( json?.PropertyT("replicationPairCount"), out var __jsonReplicationPairCount) ? (string)__jsonReplicationPairCount : (string)ReplicationPairCount;} + {_systemLoad = If( json?.PropertyT("systemLoad"), out var __jsonSystemLoad) ? (string)__jsonSystemLoad : (string)SystemLoad;} + {_systemLoadStatus = If( json?.PropertyT("systemLoadStatus"), out var __jsonSystemLoadStatus) ? (string)__jsonSystemLoadStatus : (string)SystemLoadStatus;} + {_cpuLoad = If( json?.PropertyT("cpuLoad"), out var __jsonCpuLoad) ? (string)__jsonCpuLoad : (string)CpuLoad;} + {_cpuLoadStatus = If( json?.PropertyT("cpuLoadStatus"), out var __jsonCpuLoadStatus) ? (string)__jsonCpuLoadStatus : (string)CpuLoadStatus;} + {_totalMemoryInByte = If( json?.PropertyT("totalMemoryInBytes"), out var __jsonTotalMemoryInBytes) ? (long?)__jsonTotalMemoryInBytes : TotalMemoryInByte;} + {_availableMemoryInByte = If( json?.PropertyT("availableMemoryInBytes"), out var __jsonAvailableMemoryInBytes) ? (long?)__jsonAvailableMemoryInBytes : AvailableMemoryInByte;} + {_memoryUsageStatus = If( json?.PropertyT("memoryUsageStatus"), out var __jsonMemoryUsageStatus) ? (string)__jsonMemoryUsageStatus : (string)MemoryUsageStatus;} + {_totalSpaceInByte = If( json?.PropertyT("totalSpaceInBytes"), out var __jsonTotalSpaceInBytes) ? (long?)__jsonTotalSpaceInBytes : TotalSpaceInByte;} + {_availableSpaceInByte = If( json?.PropertyT("availableSpaceInBytes"), out var __jsonAvailableSpaceInBytes) ? (long?)__jsonAvailableSpaceInBytes : AvailableSpaceInByte;} + {_spaceUsageStatus = If( json?.PropertyT("spaceUsageStatus"), out var __jsonSpaceUsageStatus) ? (string)__jsonSpaceUsageStatus : (string)SpaceUsageStatus;} + {_psServiceStatus = If( json?.PropertyT("psServiceStatus"), out var __jsonPsServiceStatus) ? (string)__jsonPsServiceStatus : (string)PsServiceStatus;} + {_sslCertExpiryDate = If( json?.PropertyT("sslCertExpiryDate"), out var __jsonSslCertExpiryDate) ? global::System.DateTime.TryParse((string)__jsonSslCertExpiryDate, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonSslCertExpiryDateValue) ? __jsonSslCertExpiryDateValue : SslCertExpiryDate : SslCertExpiryDate;} + {_sslCertExpiryRemainingDay = If( json?.PropertyT("sslCertExpiryRemainingDays"), out var __jsonSslCertExpiryRemainingDays) ? (int?)__jsonSslCertExpiryRemainingDays : SslCertExpiryRemainingDay;} + {_oSVersion = If( json?.PropertyT("osVersion"), out var __jsonOSVersion) ? (string)__jsonOSVersion : (string)OSVersion;} + {_healthError = If( json?.PropertyT("healthErrors"), out var __jsonHealthErrors) ? If( __jsonHealthErrors as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __q) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__q, (__p)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthError.FromJson(__p) )) ))() : null : HealthError;} + {_agentExpiryDate = If( json?.PropertyT("agentExpiryDate"), out var __jsonAgentExpiryDate) ? global::System.DateTime.TryParse((string)__jsonAgentExpiryDate, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonAgentExpiryDateValue) ? __jsonAgentExpiryDateValue : AgentExpiryDate : AgentExpiryDate;} + {_health = If( json?.PropertyT("health"), out var __jsonHealth) ? (string)__jsonHealth : (string)Health;} + {_psStatsRefreshTime = If( json?.PropertyT("psStatsRefreshTime"), out var __jsonPsStatsRefreshTime) ? global::System.DateTime.TryParse((string)__jsonPsStatsRefreshTime, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonPsStatsRefreshTimeValue) ? __jsonPsStatsRefreshTimeValue : PsStatsRefreshTime : PsStatsRefreshTime;} + {_throughputUploadPendingDataInByte = If( json?.PropertyT("throughputUploadPendingDataInBytes"), out var __jsonThroughputUploadPendingDataInBytes) ? (long?)__jsonThroughputUploadPendingDataInBytes : ThroughputUploadPendingDataInByte;} + {_throughputInMBps = If( json?.PropertyT("throughputInMBps"), out var __jsonThroughputInMBps) ? (long?)__jsonThroughputInMBps : ThroughputInMBps;} + {_throughputInByte = If( json?.PropertyT("throughputInBytes"), out var __jsonThroughputInBytes) ? (long?)__jsonThroughputInBytes : ThroughputInByte;} + {_throughputStatus = If( json?.PropertyT("throughputStatus"), out var __jsonThroughputStatus) ? (string)__jsonThroughputStatus : (string)ThroughputStatus;} + {_marsCommunicationStatus = If( json?.PropertyT("marsCommunicationStatus"), out var __jsonMarsCommunicationStatus) ? (string)__jsonMarsCommunicationStatus : (string)MarsCommunicationStatus;} + {_marsRegistrationStatus = If( json?.PropertyT("marsRegistrationStatus"), out var __jsonMarsRegistrationStatus) ? (string)__jsonMarsRegistrationStatus : (string)MarsRegistrationStatus;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._agentVersionDetail ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._agentVersionDetail.ToJson(null,serializationMode) : null, "agentVersionDetails" ,container.Add ); + AddIf( null != (((object)this._friendlyName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._friendlyName.ToString()) : null, "friendlyName" ,container.Add ); + AddIf( null != (((object)this._id)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._id.ToString()) : null, "id" ,container.Add ); + AddIf( null != (((object)this._iPAddress)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._iPAddress.ToString()) : null, "ipAddress" ,container.Add ); + AddIf( null != (((object)this._oSType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._oSType.ToString()) : null, "osType" ,container.Add ); + AddIf( null != (((object)this._agentVersion)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._agentVersion.ToString()) : null, "agentVersion" ,container.Add ); + AddIf( null != this._lastHeartbeat ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._lastHeartbeat?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "lastHeartbeat" ,container.Add ); + AddIf( null != (((object)this._versionStatus)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._versionStatus.ToString()) : null, "versionStatus" ,container.Add ); + if (null != this._mobilityServiceUpdate) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._mobilityServiceUpdate ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("mobilityServiceUpdates",__w); + } + AddIf( null != (((object)this._hostId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._hostId.ToString()) : null, "hostId" ,container.Add ); + AddIf( null != (((object)this._machineCount)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._machineCount.ToString()) : null, "machineCount" ,container.Add ); + AddIf( null != (((object)this._replicationPairCount)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._replicationPairCount.ToString()) : null, "replicationPairCount" ,container.Add ); + AddIf( null != (((object)this._systemLoad)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._systemLoad.ToString()) : null, "systemLoad" ,container.Add ); + AddIf( null != (((object)this._systemLoadStatus)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._systemLoadStatus.ToString()) : null, "systemLoadStatus" ,container.Add ); + AddIf( null != (((object)this._cpuLoad)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._cpuLoad.ToString()) : null, "cpuLoad" ,container.Add ); + AddIf( null != (((object)this._cpuLoadStatus)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._cpuLoadStatus.ToString()) : null, "cpuLoadStatus" ,container.Add ); + AddIf( null != this._totalMemoryInByte ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((long)this._totalMemoryInByte) : null, "totalMemoryInBytes" ,container.Add ); + AddIf( null != this._availableMemoryInByte ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((long)this._availableMemoryInByte) : null, "availableMemoryInBytes" ,container.Add ); + AddIf( null != (((object)this._memoryUsageStatus)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._memoryUsageStatus.ToString()) : null, "memoryUsageStatus" ,container.Add ); + AddIf( null != this._totalSpaceInByte ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((long)this._totalSpaceInByte) : null, "totalSpaceInBytes" ,container.Add ); + AddIf( null != this._availableSpaceInByte ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((long)this._availableSpaceInByte) : null, "availableSpaceInBytes" ,container.Add ); + AddIf( null != (((object)this._spaceUsageStatus)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._spaceUsageStatus.ToString()) : null, "spaceUsageStatus" ,container.Add ); + AddIf( null != (((object)this._psServiceStatus)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._psServiceStatus.ToString()) : null, "psServiceStatus" ,container.Add ); + AddIf( null != this._sslCertExpiryDate ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._sslCertExpiryDate?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "sslCertExpiryDate" ,container.Add ); + AddIf( null != this._sslCertExpiryRemainingDay ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._sslCertExpiryRemainingDay) : null, "sslCertExpiryRemainingDays" ,container.Add ); + AddIf( null != (((object)this._oSVersion)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._oSVersion.ToString()) : null, "osVersion" ,container.Add ); + if (null != this._healthError) + { + var __r = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __s in this._healthError ) + { + AddIf(__s?.ToJson(null, serializationMode) ,__r.Add); + } + container.Add("healthErrors",__r); + } + AddIf( null != this._agentExpiryDate ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._agentExpiryDate?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "agentExpiryDate" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._health)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._health.ToString()) : null, "health" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._psStatsRefreshTime ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._psStatsRefreshTime?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "psStatsRefreshTime" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._throughputUploadPendingDataInByte ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((long)this._throughputUploadPendingDataInByte) : null, "throughputUploadPendingDataInBytes" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._throughputInMBps ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((long)this._throughputInMBps) : null, "throughputInMBps" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._throughputInByte ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((long)this._throughputInByte) : null, "throughputInBytes" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._throughputStatus)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._throughputStatus.ToString()) : null, "throughputStatus" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._marsCommunicationStatus)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._marsCommunicationStatus.ToString()) : null, "marsCommunicationStatus" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._marsRegistrationStatus)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._marsRegistrationStatus.ToString()) : null, "marsRegistrationStatus" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProcessServerDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProcessServerDetails.PowerShell.cs new file mode 100644 index 000000000000..11b2680ffe5f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProcessServerDetails.PowerShell.cs @@ -0,0 +1,368 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Process server details. + [System.ComponentModel.TypeConverter(typeof(ProcessServerDetailsTypeConverter))] + public partial class ProcessServerDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ProcessServerDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ProcessServerDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ProcessServerDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("BiosId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).BiosId = (string) content.GetValueForProperty("BiosId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).BiosId, global::System.Convert.ToString); + } + if (content.Contains("FabricObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).FabricObjectId = (string) content.GetValueForProperty("FabricObjectId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).FabricObjectId, global::System.Convert.ToString); + } + if (content.Contains("Fqdn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).Fqdn = (string) content.GetValueForProperty("Fqdn",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).Fqdn, global::System.Convert.ToString); + } + if (content.Contains("IPAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).IPAddress = (string[]) content.GetValueForProperty("IPAddress",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).IPAddress, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("Version")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).Version = (string) content.GetValueForProperty("Version",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).Version, global::System.Convert.ToString); + } + if (content.Contains("LastHeartbeatUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).LastHeartbeatUtc = (global::System.DateTime?) content.GetValueForProperty("LastHeartbeatUtc",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).LastHeartbeatUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("TotalMemoryInByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).TotalMemoryInByte = (long?) content.GetValueForProperty("TotalMemoryInByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).TotalMemoryInByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("AvailableMemoryInByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).AvailableMemoryInByte = (long?) content.GetValueForProperty("AvailableMemoryInByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).AvailableMemoryInByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("UsedMemoryInByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).UsedMemoryInByte = (long?) content.GetValueForProperty("UsedMemoryInByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).UsedMemoryInByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("MemoryUsagePercentage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).MemoryUsagePercentage = (double?) content.GetValueForProperty("MemoryUsagePercentage",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).MemoryUsagePercentage, (__y)=> (double) global::System.Convert.ChangeType(__y, typeof(double))); + } + if (content.Contains("TotalSpaceInByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).TotalSpaceInByte = (long?) content.GetValueForProperty("TotalSpaceInByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).TotalSpaceInByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("AvailableSpaceInByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).AvailableSpaceInByte = (long?) content.GetValueForProperty("AvailableSpaceInByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).AvailableSpaceInByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("UsedSpaceInByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).UsedSpaceInByte = (long?) content.GetValueForProperty("UsedSpaceInByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).UsedSpaceInByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("FreeSpacePercentage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).FreeSpacePercentage = (double?) content.GetValueForProperty("FreeSpacePercentage",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).FreeSpacePercentage, (__y)=> (double) global::System.Convert.ChangeType(__y, typeof(double))); + } + if (content.Contains("ThroughputUploadPendingDataInByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).ThroughputUploadPendingDataInByte = (long?) content.GetValueForProperty("ThroughputUploadPendingDataInByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).ThroughputUploadPendingDataInByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("ThroughputInByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).ThroughputInByte = (long?) content.GetValueForProperty("ThroughputInByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).ThroughputInByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("ProcessorUsagePercentage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).ProcessorUsagePercentage = (double?) content.GetValueForProperty("ProcessorUsagePercentage",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).ProcessorUsagePercentage, (__y)=> (double) global::System.Convert.ChangeType(__y, typeof(double))); + } + if (content.Contains("ThroughputStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).ThroughputStatus = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RcmComponentStatus?) content.GetValueForProperty("ThroughputStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).ThroughputStatus, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RcmComponentStatus.CreateFrom); + } + if (content.Contains("SystemLoad")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).SystemLoad = (long?) content.GetValueForProperty("SystemLoad",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).SystemLoad, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("SystemLoadStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).SystemLoadStatus = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RcmComponentStatus?) content.GetValueForProperty("SystemLoadStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).SystemLoadStatus, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RcmComponentStatus.CreateFrom); + } + if (content.Contains("DiskUsageStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).DiskUsageStatus = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RcmComponentStatus?) content.GetValueForProperty("DiskUsageStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).DiskUsageStatus, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RcmComponentStatus.CreateFrom); + } + if (content.Contains("MemoryUsageStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).MemoryUsageStatus = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RcmComponentStatus?) content.GetValueForProperty("MemoryUsageStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).MemoryUsageStatus, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RcmComponentStatus.CreateFrom); + } + if (content.Contains("ProcessorUsageStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).ProcessorUsageStatus = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RcmComponentStatus?) content.GetValueForProperty("ProcessorUsageStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).ProcessorUsageStatus, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RcmComponentStatus.CreateFrom); + } + if (content.Contains("Health")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).Health = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth?) content.GetValueForProperty("Health",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).Health, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth.CreateFrom); + } + if (content.Contains("HealthError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).HealthError = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[]) content.GetValueForProperty("HealthError",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).HealthError, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("ProtectedItemCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).ProtectedItemCount = (int?) content.GetValueForProperty("ProtectedItemCount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).ProtectedItemCount, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("HistoricHealth")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).HistoricHealth = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth?) content.GetValueForProperty("HistoricHealth",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).HistoricHealth, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth.CreateFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ProcessServerDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("BiosId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).BiosId = (string) content.GetValueForProperty("BiosId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).BiosId, global::System.Convert.ToString); + } + if (content.Contains("FabricObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).FabricObjectId = (string) content.GetValueForProperty("FabricObjectId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).FabricObjectId, global::System.Convert.ToString); + } + if (content.Contains("Fqdn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).Fqdn = (string) content.GetValueForProperty("Fqdn",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).Fqdn, global::System.Convert.ToString); + } + if (content.Contains("IPAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).IPAddress = (string[]) content.GetValueForProperty("IPAddress",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).IPAddress, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("Version")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).Version = (string) content.GetValueForProperty("Version",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).Version, global::System.Convert.ToString); + } + if (content.Contains("LastHeartbeatUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).LastHeartbeatUtc = (global::System.DateTime?) content.GetValueForProperty("LastHeartbeatUtc",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).LastHeartbeatUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("TotalMemoryInByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).TotalMemoryInByte = (long?) content.GetValueForProperty("TotalMemoryInByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).TotalMemoryInByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("AvailableMemoryInByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).AvailableMemoryInByte = (long?) content.GetValueForProperty("AvailableMemoryInByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).AvailableMemoryInByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("UsedMemoryInByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).UsedMemoryInByte = (long?) content.GetValueForProperty("UsedMemoryInByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).UsedMemoryInByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("MemoryUsagePercentage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).MemoryUsagePercentage = (double?) content.GetValueForProperty("MemoryUsagePercentage",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).MemoryUsagePercentage, (__y)=> (double) global::System.Convert.ChangeType(__y, typeof(double))); + } + if (content.Contains("TotalSpaceInByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).TotalSpaceInByte = (long?) content.GetValueForProperty("TotalSpaceInByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).TotalSpaceInByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("AvailableSpaceInByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).AvailableSpaceInByte = (long?) content.GetValueForProperty("AvailableSpaceInByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).AvailableSpaceInByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("UsedSpaceInByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).UsedSpaceInByte = (long?) content.GetValueForProperty("UsedSpaceInByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).UsedSpaceInByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("FreeSpacePercentage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).FreeSpacePercentage = (double?) content.GetValueForProperty("FreeSpacePercentage",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).FreeSpacePercentage, (__y)=> (double) global::System.Convert.ChangeType(__y, typeof(double))); + } + if (content.Contains("ThroughputUploadPendingDataInByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).ThroughputUploadPendingDataInByte = (long?) content.GetValueForProperty("ThroughputUploadPendingDataInByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).ThroughputUploadPendingDataInByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("ThroughputInByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).ThroughputInByte = (long?) content.GetValueForProperty("ThroughputInByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).ThroughputInByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("ProcessorUsagePercentage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).ProcessorUsagePercentage = (double?) content.GetValueForProperty("ProcessorUsagePercentage",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).ProcessorUsagePercentage, (__y)=> (double) global::System.Convert.ChangeType(__y, typeof(double))); + } + if (content.Contains("ThroughputStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).ThroughputStatus = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RcmComponentStatus?) content.GetValueForProperty("ThroughputStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).ThroughputStatus, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RcmComponentStatus.CreateFrom); + } + if (content.Contains("SystemLoad")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).SystemLoad = (long?) content.GetValueForProperty("SystemLoad",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).SystemLoad, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("SystemLoadStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).SystemLoadStatus = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RcmComponentStatus?) content.GetValueForProperty("SystemLoadStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).SystemLoadStatus, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RcmComponentStatus.CreateFrom); + } + if (content.Contains("DiskUsageStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).DiskUsageStatus = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RcmComponentStatus?) content.GetValueForProperty("DiskUsageStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).DiskUsageStatus, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RcmComponentStatus.CreateFrom); + } + if (content.Contains("MemoryUsageStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).MemoryUsageStatus = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RcmComponentStatus?) content.GetValueForProperty("MemoryUsageStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).MemoryUsageStatus, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RcmComponentStatus.CreateFrom); + } + if (content.Contains("ProcessorUsageStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).ProcessorUsageStatus = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RcmComponentStatus?) content.GetValueForProperty("ProcessorUsageStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).ProcessorUsageStatus, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RcmComponentStatus.CreateFrom); + } + if (content.Contains("Health")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).Health = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth?) content.GetValueForProperty("Health",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).Health, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth.CreateFrom); + } + if (content.Contains("HealthError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).HealthError = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[]) content.GetValueForProperty("HealthError",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).HealthError, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("ProtectedItemCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).ProtectedItemCount = (int?) content.GetValueForProperty("ProtectedItemCount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).ProtectedItemCount, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("HistoricHealth")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).HistoricHealth = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth?) content.GetValueForProperty("HistoricHealth",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal)this).HistoricHealth, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth.CreateFrom); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Process server details. + [System.ComponentModel.TypeConverter(typeof(ProcessServerDetailsTypeConverter))] + public partial interface IProcessServerDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProcessServerDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProcessServerDetails.TypeConverter.cs new file mode 100644 index 000000000000..9f0df65f09db --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProcessServerDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ProcessServerDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ProcessServerDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ProcessServerDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ProcessServerDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProcessServerDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProcessServerDetails.cs new file mode 100644 index 000000000000..4f4097aa0513 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProcessServerDetails.cs @@ -0,0 +1,614 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Process server details. + public partial class ProcessServerDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal + { + + /// Backing field for property. + private long? _availableMemoryInByte; + + /// The available memory. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public long? AvailableMemoryInByte { get => this._availableMemoryInByte; } + + /// Backing field for property. + private long? _availableSpaceInByte; + + /// The available disk space. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public long? AvailableSpaceInByte { get => this._availableSpaceInByte; } + + /// Backing field for property. + private string _biosId; + + /// The process server Bios Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string BiosId { get => this._biosId; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RcmComponentStatus? _diskUsageStatus; + + /// The disk usage status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RcmComponentStatus? DiskUsageStatus { get => this._diskUsageStatus; } + + /// Backing field for property. + private string _fabricObjectId; + + /// The fabric object Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string FabricObjectId { get => this._fabricObjectId; } + + /// Backing field for property. + private string _fqdn; + + /// The process server Fqdn. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Fqdn { get => this._fqdn; } + + /// Backing field for property. + private double? _freeSpacePercentage; + + /// The free disk space percentage. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public double? FreeSpacePercentage { get => this._freeSpacePercentage; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth? _health; + + /// The health of the process server. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth? Health { get => this._health; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] _healthError; + + /// The health errors. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] HealthError { get => this._healthError; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth? _historicHealth; + + /// The historic health of the process server based on the health in last 24 hours. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth? HistoricHealth { get => this._historicHealth; } + + /// Backing field for property. + private string[] _iPAddress; + + /// The list of IP addresses for communicating with the RCM component. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string[] IPAddress { get => this._iPAddress; } + + /// Backing field for property. + private string _id; + + /// The process server Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Id { get => this._id; } + + /// Backing field for property. + private global::System.DateTime? _lastHeartbeatUtc; + + /// The last heartbeat received from the process server. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public global::System.DateTime? LastHeartbeatUtc { get => this._lastHeartbeatUtc; } + + /// Backing field for property. + private double? _memoryUsagePercentage; + + /// The memory usage percentage. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public double? MemoryUsagePercentage { get => this._memoryUsagePercentage; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RcmComponentStatus? _memoryUsageStatus; + + /// The memory usage status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RcmComponentStatus? MemoryUsageStatus { get => this._memoryUsageStatus; } + + /// Internal Acessors for AvailableMemoryInByte + long? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal.AvailableMemoryInByte { get => this._availableMemoryInByte; set { {_availableMemoryInByte = value;} } } + + /// Internal Acessors for AvailableSpaceInByte + long? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal.AvailableSpaceInByte { get => this._availableSpaceInByte; set { {_availableSpaceInByte = value;} } } + + /// Internal Acessors for BiosId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal.BiosId { get => this._biosId; set { {_biosId = value;} } } + + /// Internal Acessors for DiskUsageStatus + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RcmComponentStatus? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal.DiskUsageStatus { get => this._diskUsageStatus; set { {_diskUsageStatus = value;} } } + + /// Internal Acessors for FabricObjectId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal.FabricObjectId { get => this._fabricObjectId; set { {_fabricObjectId = value;} } } + + /// Internal Acessors for Fqdn + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal.Fqdn { get => this._fqdn; set { {_fqdn = value;} } } + + /// Internal Acessors for FreeSpacePercentage + double? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal.FreeSpacePercentage { get => this._freeSpacePercentage; set { {_freeSpacePercentage = value;} } } + + /// Internal Acessors for Health + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal.Health { get => this._health; set { {_health = value;} } } + + /// Internal Acessors for HealthError + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal.HealthError { get => this._healthError; set { {_healthError = value;} } } + + /// Internal Acessors for HistoricHealth + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal.HistoricHealth { get => this._historicHealth; set { {_historicHealth = value;} } } + + /// Internal Acessors for IPAddress + string[] Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal.IPAddress { get => this._iPAddress; set { {_iPAddress = value;} } } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal.Id { get => this._id; set { {_id = value;} } } + + /// Internal Acessors for LastHeartbeatUtc + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal.LastHeartbeatUtc { get => this._lastHeartbeatUtc; set { {_lastHeartbeatUtc = value;} } } + + /// Internal Acessors for MemoryUsagePercentage + double? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal.MemoryUsagePercentage { get => this._memoryUsagePercentage; set { {_memoryUsagePercentage = value;} } } + + /// Internal Acessors for MemoryUsageStatus + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RcmComponentStatus? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal.MemoryUsageStatus { get => this._memoryUsageStatus; set { {_memoryUsageStatus = value;} } } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal.Name { get => this._name; set { {_name = value;} } } + + /// Internal Acessors for ProcessorUsagePercentage + double? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal.ProcessorUsagePercentage { get => this._processorUsagePercentage; set { {_processorUsagePercentage = value;} } } + + /// Internal Acessors for ProcessorUsageStatus + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RcmComponentStatus? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal.ProcessorUsageStatus { get => this._processorUsageStatus; set { {_processorUsageStatus = value;} } } + + /// Internal Acessors for ProtectedItemCount + int? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal.ProtectedItemCount { get => this._protectedItemCount; set { {_protectedItemCount = value;} } } + + /// Internal Acessors for SystemLoad + long? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal.SystemLoad { get => this._systemLoad; set { {_systemLoad = value;} } } + + /// Internal Acessors for SystemLoadStatus + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RcmComponentStatus? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal.SystemLoadStatus { get => this._systemLoadStatus; set { {_systemLoadStatus = value;} } } + + /// Internal Acessors for ThroughputInByte + long? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal.ThroughputInByte { get => this._throughputInByte; set { {_throughputInByte = value;} } } + + /// Internal Acessors for ThroughputStatus + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RcmComponentStatus? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal.ThroughputStatus { get => this._throughputStatus; set { {_throughputStatus = value;} } } + + /// Internal Acessors for ThroughputUploadPendingDataInByte + long? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal.ThroughputUploadPendingDataInByte { get => this._throughputUploadPendingDataInByte; set { {_throughputUploadPendingDataInByte = value;} } } + + /// Internal Acessors for TotalMemoryInByte + long? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal.TotalMemoryInByte { get => this._totalMemoryInByte; set { {_totalMemoryInByte = value;} } } + + /// Internal Acessors for TotalSpaceInByte + long? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal.TotalSpaceInByte { get => this._totalSpaceInByte; set { {_totalSpaceInByte = value;} } } + + /// Internal Acessors for UsedMemoryInByte + long? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal.UsedMemoryInByte { get => this._usedMemoryInByte; set { {_usedMemoryInByte = value;} } } + + /// Internal Acessors for UsedSpaceInByte + long? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal.UsedSpaceInByte { get => this._usedSpaceInByte; set { {_usedSpaceInByte = value;} } } + + /// Internal Acessors for Version + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetailsInternal.Version { get => this._version; set { {_version = value;} } } + + /// Backing field for property. + private string _name; + + /// The process server name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Name { get => this._name; } + + /// Backing field for property. + private double? _processorUsagePercentage; + + /// The processor usage percentage. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public double? ProcessorUsagePercentage { get => this._processorUsagePercentage; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RcmComponentStatus? _processorUsageStatus; + + /// The processor usage status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RcmComponentStatus? ProcessorUsageStatus { get => this._processorUsageStatus; } + + /// Backing field for property. + private int? _protectedItemCount; + + /// The protected item count. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? ProtectedItemCount { get => this._protectedItemCount; } + + /// Backing field for property. + private long? _systemLoad; + + /// The system load. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public long? SystemLoad { get => this._systemLoad; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RcmComponentStatus? _systemLoadStatus; + + /// The system load status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RcmComponentStatus? SystemLoadStatus { get => this._systemLoadStatus; } + + /// Backing field for property. + private long? _throughputInByte; + + /// The throughput in bytes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public long? ThroughputInByte { get => this._throughputInByte; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RcmComponentStatus? _throughputStatus; + + /// The throughput status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RcmComponentStatus? ThroughputStatus { get => this._throughputStatus; } + + /// Backing field for property. + private long? _throughputUploadPendingDataInByte; + + /// The uploading pending data in bytes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public long? ThroughputUploadPendingDataInByte { get => this._throughputUploadPendingDataInByte; } + + /// Backing field for property. + private long? _totalMemoryInByte; + + /// The total memory. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public long? TotalMemoryInByte { get => this._totalMemoryInByte; } + + /// Backing field for property. + private long? _totalSpaceInByte; + + /// The total disk space. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public long? TotalSpaceInByte { get => this._totalSpaceInByte; } + + /// Backing field for property. + private long? _usedMemoryInByte; + + /// The used memory. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public long? UsedMemoryInByte { get => this._usedMemoryInByte; } + + /// Backing field for property. + private long? _usedSpaceInByte; + + /// The used disk space. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public long? UsedSpaceInByte { get => this._usedSpaceInByte; } + + /// Backing field for property. + private string _version; + + /// The version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Version { get => this._version; } + + /// Creates an new instance. + public ProcessServerDetails() + { + + } + } + /// Process server details. + public partial interface IProcessServerDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The available memory. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The available memory.", + SerializedName = @"availableMemoryInBytes", + PossibleTypes = new [] { typeof(long) })] + long? AvailableMemoryInByte { get; } + /// The available disk space. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The available disk space.", + SerializedName = @"availableSpaceInBytes", + PossibleTypes = new [] { typeof(long) })] + long? AvailableSpaceInByte { get; } + /// The process server Bios Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The process server Bios Id.", + SerializedName = @"biosId", + PossibleTypes = new [] { typeof(string) })] + string BiosId { get; } + /// The disk usage status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The disk usage status.", + SerializedName = @"diskUsageStatus", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RcmComponentStatus) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RcmComponentStatus? DiskUsageStatus { get; } + /// The fabric object Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The fabric object Id.", + SerializedName = @"fabricObjectId", + PossibleTypes = new [] { typeof(string) })] + string FabricObjectId { get; } + /// The process server Fqdn. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The process server Fqdn.", + SerializedName = @"fqdn", + PossibleTypes = new [] { typeof(string) })] + string Fqdn { get; } + /// The free disk space percentage. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The free disk space percentage.", + SerializedName = @"freeSpacePercentage", + PossibleTypes = new [] { typeof(double) })] + double? FreeSpacePercentage { get; } + /// The health of the process server. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The health of the process server.", + SerializedName = @"health", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth? Health { get; } + /// The health errors. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The health errors.", + SerializedName = @"healthErrors", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] HealthError { get; } + /// The historic health of the process server based on the health in last 24 hours. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The historic health of the process server based on the health in last 24 hours.", + SerializedName = @"historicHealth", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth? HistoricHealth { get; } + /// The list of IP addresses for communicating with the RCM component. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The list of IP addresses for communicating with the RCM component.", + SerializedName = @"ipAddresses", + PossibleTypes = new [] { typeof(string) })] + string[] IPAddress { get; } + /// The process server Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The process server Id.", + SerializedName = @"id", + PossibleTypes = new [] { typeof(string) })] + string Id { get; } + /// The last heartbeat received from the process server. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The last heartbeat received from the process server.", + SerializedName = @"lastHeartbeatUtc", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? LastHeartbeatUtc { get; } + /// The memory usage percentage. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The memory usage percentage.", + SerializedName = @"memoryUsagePercentage", + PossibleTypes = new [] { typeof(double) })] + double? MemoryUsagePercentage { get; } + /// The memory usage status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The memory usage status.", + SerializedName = @"memoryUsageStatus", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RcmComponentStatus) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RcmComponentStatus? MemoryUsageStatus { get; } + /// The process server name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The process server name.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string Name { get; } + /// The processor usage percentage. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The processor usage percentage.", + SerializedName = @"processorUsagePercentage", + PossibleTypes = new [] { typeof(double) })] + double? ProcessorUsagePercentage { get; } + /// The processor usage status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The processor usage status.", + SerializedName = @"processorUsageStatus", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RcmComponentStatus) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RcmComponentStatus? ProcessorUsageStatus { get; } + /// The protected item count. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The protected item count.", + SerializedName = @"protectedItemCount", + PossibleTypes = new [] { typeof(int) })] + int? ProtectedItemCount { get; } + /// The system load. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The system load.", + SerializedName = @"systemLoad", + PossibleTypes = new [] { typeof(long) })] + long? SystemLoad { get; } + /// The system load status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The system load status.", + SerializedName = @"systemLoadStatus", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RcmComponentStatus) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RcmComponentStatus? SystemLoadStatus { get; } + /// The throughput in bytes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The throughput in bytes.", + SerializedName = @"throughputInBytes", + PossibleTypes = new [] { typeof(long) })] + long? ThroughputInByte { get; } + /// The throughput status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The throughput status.", + SerializedName = @"throughputStatus", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RcmComponentStatus) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RcmComponentStatus? ThroughputStatus { get; } + /// The uploading pending data in bytes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The uploading pending data in bytes.", + SerializedName = @"throughputUploadPendingDataInBytes", + PossibleTypes = new [] { typeof(long) })] + long? ThroughputUploadPendingDataInByte { get; } + /// The total memory. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The total memory.", + SerializedName = @"totalMemoryInBytes", + PossibleTypes = new [] { typeof(long) })] + long? TotalMemoryInByte { get; } + /// The total disk space. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The total disk space.", + SerializedName = @"totalSpaceInBytes", + PossibleTypes = new [] { typeof(long) })] + long? TotalSpaceInByte { get; } + /// The used memory. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The used memory.", + SerializedName = @"usedMemoryInBytes", + PossibleTypes = new [] { typeof(long) })] + long? UsedMemoryInByte { get; } + /// The used disk space. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The used disk space.", + SerializedName = @"usedSpaceInBytes", + PossibleTypes = new [] { typeof(long) })] + long? UsedSpaceInByte { get; } + /// The version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The version.", + SerializedName = @"version", + PossibleTypes = new [] { typeof(string) })] + string Version { get; } + + } + /// Process server details. + internal partial interface IProcessServerDetailsInternal + + { + /// The available memory. + long? AvailableMemoryInByte { get; set; } + /// The available disk space. + long? AvailableSpaceInByte { get; set; } + /// The process server Bios Id. + string BiosId { get; set; } + /// The disk usage status. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RcmComponentStatus? DiskUsageStatus { get; set; } + /// The fabric object Id. + string FabricObjectId { get; set; } + /// The process server Fqdn. + string Fqdn { get; set; } + /// The free disk space percentage. + double? FreeSpacePercentage { get; set; } + /// The health of the process server. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth? Health { get; set; } + /// The health errors. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] HealthError { get; set; } + /// The historic health of the process server based on the health in last 24 hours. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth? HistoricHealth { get; set; } + /// The list of IP addresses for communicating with the RCM component. + string[] IPAddress { get; set; } + /// The process server Id. + string Id { get; set; } + /// The last heartbeat received from the process server. + global::System.DateTime? LastHeartbeatUtc { get; set; } + /// The memory usage percentage. + double? MemoryUsagePercentage { get; set; } + /// The memory usage status. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RcmComponentStatus? MemoryUsageStatus { get; set; } + /// The process server name. + string Name { get; set; } + /// The processor usage percentage. + double? ProcessorUsagePercentage { get; set; } + /// The processor usage status. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RcmComponentStatus? ProcessorUsageStatus { get; set; } + /// The protected item count. + int? ProtectedItemCount { get; set; } + /// The system load. + long? SystemLoad { get; set; } + /// The system load status. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RcmComponentStatus? SystemLoadStatus { get; set; } + /// The throughput in bytes. + long? ThroughputInByte { get; set; } + /// The throughput status. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RcmComponentStatus? ThroughputStatus { get; set; } + /// The uploading pending data in bytes. + long? ThroughputUploadPendingDataInByte { get; set; } + /// The total memory. + long? TotalMemoryInByte { get; set; } + /// The total disk space. + long? TotalSpaceInByte { get; set; } + /// The used memory. + long? UsedMemoryInByte { get; set; } + /// The used disk space. + long? UsedSpaceInByte { get; set; } + /// The version. + string Version { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProcessServerDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProcessServerDetails.json.cs new file mode 100644 index 000000000000..dbbc621c57d1 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProcessServerDetails.json.cs @@ -0,0 +1,267 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Process server details. + public partial class ProcessServerDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new ProcessServerDetails(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal ProcessServerDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_id = If( json?.PropertyT("id"), out var __jsonId) ? (string)__jsonId : (string)Id;} + {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)Name;} + {_biosId = If( json?.PropertyT("biosId"), out var __jsonBiosId) ? (string)__jsonBiosId : (string)BiosId;} + {_fabricObjectId = If( json?.PropertyT("fabricObjectId"), out var __jsonFabricObjectId) ? (string)__jsonFabricObjectId : (string)FabricObjectId;} + {_fqdn = If( json?.PropertyT("fqdn"), out var __jsonFqdn) ? (string)__jsonFqdn : (string)Fqdn;} + {_iPAddress = If( json?.PropertyT("ipAddresses"), out var __jsonIPAddresses) ? If( __jsonIPAddresses as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(string) (__u is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : IPAddress;} + {_version = If( json?.PropertyT("version"), out var __jsonVersion) ? (string)__jsonVersion : (string)Version;} + {_lastHeartbeatUtc = If( json?.PropertyT("lastHeartbeatUtc"), out var __jsonLastHeartbeatUtc) ? global::System.DateTime.TryParse((string)__jsonLastHeartbeatUtc, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonLastHeartbeatUtcValue) ? __jsonLastHeartbeatUtcValue : LastHeartbeatUtc : LastHeartbeatUtc;} + {_totalMemoryInByte = If( json?.PropertyT("totalMemoryInBytes"), out var __jsonTotalMemoryInBytes) ? (long?)__jsonTotalMemoryInBytes : TotalMemoryInByte;} + {_availableMemoryInByte = If( json?.PropertyT("availableMemoryInBytes"), out var __jsonAvailableMemoryInBytes) ? (long?)__jsonAvailableMemoryInBytes : AvailableMemoryInByte;} + {_usedMemoryInByte = If( json?.PropertyT("usedMemoryInBytes"), out var __jsonUsedMemoryInBytes) ? (long?)__jsonUsedMemoryInBytes : UsedMemoryInByte;} + {_memoryUsagePercentage = If( json?.PropertyT("memoryUsagePercentage"), out var __jsonMemoryUsagePercentage) ? (double?)__jsonMemoryUsagePercentage : MemoryUsagePercentage;} + {_totalSpaceInByte = If( json?.PropertyT("totalSpaceInBytes"), out var __jsonTotalSpaceInBytes) ? (long?)__jsonTotalSpaceInBytes : TotalSpaceInByte;} + {_availableSpaceInByte = If( json?.PropertyT("availableSpaceInBytes"), out var __jsonAvailableSpaceInBytes) ? (long?)__jsonAvailableSpaceInBytes : AvailableSpaceInByte;} + {_usedSpaceInByte = If( json?.PropertyT("usedSpaceInBytes"), out var __jsonUsedSpaceInBytes) ? (long?)__jsonUsedSpaceInBytes : UsedSpaceInByte;} + {_freeSpacePercentage = If( json?.PropertyT("freeSpacePercentage"), out var __jsonFreeSpacePercentage) ? (double?)__jsonFreeSpacePercentage : FreeSpacePercentage;} + {_throughputUploadPendingDataInByte = If( json?.PropertyT("throughputUploadPendingDataInBytes"), out var __jsonThroughputUploadPendingDataInBytes) ? (long?)__jsonThroughputUploadPendingDataInBytes : ThroughputUploadPendingDataInByte;} + {_throughputInByte = If( json?.PropertyT("throughputInBytes"), out var __jsonThroughputInBytes) ? (long?)__jsonThroughputInBytes : ThroughputInByte;} + {_processorUsagePercentage = If( json?.PropertyT("processorUsagePercentage"), out var __jsonProcessorUsagePercentage) ? (double?)__jsonProcessorUsagePercentage : ProcessorUsagePercentage;} + {_throughputStatus = If( json?.PropertyT("throughputStatus"), out var __jsonThroughputStatus) ? (string)__jsonThroughputStatus : (string)ThroughputStatus;} + {_systemLoad = If( json?.PropertyT("systemLoad"), out var __jsonSystemLoad) ? (long?)__jsonSystemLoad : SystemLoad;} + {_systemLoadStatus = If( json?.PropertyT("systemLoadStatus"), out var __jsonSystemLoadStatus) ? (string)__jsonSystemLoadStatus : (string)SystemLoadStatus;} + {_diskUsageStatus = If( json?.PropertyT("diskUsageStatus"), out var __jsonDiskUsageStatus) ? (string)__jsonDiskUsageStatus : (string)DiskUsageStatus;} + {_memoryUsageStatus = If( json?.PropertyT("memoryUsageStatus"), out var __jsonMemoryUsageStatus) ? (string)__jsonMemoryUsageStatus : (string)MemoryUsageStatus;} + {_processorUsageStatus = If( json?.PropertyT("processorUsageStatus"), out var __jsonProcessorUsageStatus) ? (string)__jsonProcessorUsageStatus : (string)ProcessorUsageStatus;} + {_health = If( json?.PropertyT("health"), out var __jsonHealth) ? (string)__jsonHealth : (string)Health;} + {_healthError = If( json?.PropertyT("healthErrors"), out var __jsonHealthErrors) ? If( __jsonHealthErrors as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __q) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__q, (__p)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthError.FromJson(__p) )) ))() : null : HealthError;} + {_protectedItemCount = If( json?.PropertyT("protectedItemCount"), out var __jsonProtectedItemCount) ? (int?)__jsonProtectedItemCount : ProtectedItemCount;} + {_historicHealth = If( json?.PropertyT("historicHealth"), out var __jsonHistoricHealth) ? (string)__jsonHistoricHealth : (string)HistoricHealth;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._id)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._id.ToString()) : null, "id" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._biosId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._biosId.ToString()) : null, "biosId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._fabricObjectId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._fabricObjectId.ToString()) : null, "fabricObjectId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._fqdn)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._fqdn.ToString()) : null, "fqdn" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + if (null != this._iPAddress) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._iPAddress ) + { + AddIf(null != (((object)__x)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(__x.ToString()) : null ,__w.Add); + } + container.Add("ipAddresses",__w); + } + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._version)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._version.ToString()) : null, "version" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._lastHeartbeatUtc ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._lastHeartbeatUtc?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "lastHeartbeatUtc" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._totalMemoryInByte ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((long)this._totalMemoryInByte) : null, "totalMemoryInBytes" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._availableMemoryInByte ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((long)this._availableMemoryInByte) : null, "availableMemoryInBytes" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._usedMemoryInByte ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((long)this._usedMemoryInByte) : null, "usedMemoryInBytes" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._memoryUsagePercentage ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((double)this._memoryUsagePercentage) : null, "memoryUsagePercentage" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._totalSpaceInByte ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((long)this._totalSpaceInByte) : null, "totalSpaceInBytes" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._availableSpaceInByte ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((long)this._availableSpaceInByte) : null, "availableSpaceInBytes" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._usedSpaceInByte ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((long)this._usedSpaceInByte) : null, "usedSpaceInBytes" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._freeSpacePercentage ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((double)this._freeSpacePercentage) : null, "freeSpacePercentage" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._throughputUploadPendingDataInByte ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((long)this._throughputUploadPendingDataInByte) : null, "throughputUploadPendingDataInBytes" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._throughputInByte ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((long)this._throughputInByte) : null, "throughputInBytes" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._processorUsagePercentage ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((double)this._processorUsagePercentage) : null, "processorUsagePercentage" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._throughputStatus)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._throughputStatus.ToString()) : null, "throughputStatus" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._systemLoad ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((long)this._systemLoad) : null, "systemLoad" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._systemLoadStatus)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._systemLoadStatus.ToString()) : null, "systemLoadStatus" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._diskUsageStatus)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._diskUsageStatus.ToString()) : null, "diskUsageStatus" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._memoryUsageStatus)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._memoryUsageStatus.ToString()) : null, "memoryUsageStatus" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._processorUsageStatus)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._processorUsageStatus.ToString()) : null, "processorUsageStatus" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._health)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._health.ToString()) : null, "health" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + if (null != this._healthError) + { + var __r = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __s in this._healthError ) + { + AddIf(__s?.ToJson(null, serializationMode) ,__r.Add); + } + container.Add("healthErrors",__r); + } + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._protectedItemCount ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._protectedItemCount) : null, "protectedItemCount" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._historicHealth)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._historicHealth.ToString()) : null, "historicHealth" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectableItem.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectableItem.PowerShell.cs new file mode 100644 index 000000000000..39812ba10dfe --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectableItem.PowerShell.cs @@ -0,0 +1,240 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Replication protected item. + [System.ComponentModel.TypeConverter(typeof(ProtectableItemTypeConverter))] + public partial class ProtectableItem + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItem DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ProtectableItem(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItem DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ProtectableItem(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItem FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ProtectableItem(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProtectableItemPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("CustomDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemInternal)this).CustomDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigurationSettings) content.GetValueForProperty("CustomDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemInternal)this).CustomDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ConfigurationSettingsTypeConverter.ConvertFrom); + } + if (content.Contains("FriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemInternal)this).FriendlyName = (string) content.GetValueForProperty("FriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemInternal)this).FriendlyName, global::System.Convert.ToString); + } + if (content.Contains("ProtectionStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemInternal)this).ProtectionStatus = (string) content.GetValueForProperty("ProtectionStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemInternal)this).ProtectionStatus, global::System.Convert.ToString); + } + if (content.Contains("ReplicationProtectedItemId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemInternal)this).ReplicationProtectedItemId = (string) content.GetValueForProperty("ReplicationProtectedItemId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemInternal)this).ReplicationProtectedItemId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryServicesProviderId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemInternal)this).RecoveryServicesProviderId = (string) content.GetValueForProperty("RecoveryServicesProviderId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemInternal)this).RecoveryServicesProviderId, global::System.Convert.ToString); + } + if (content.Contains("ProtectionReadinessError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemInternal)this).ProtectionReadinessError = (string[]) content.GetValueForProperty("ProtectionReadinessError",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemInternal)this).ProtectionReadinessError, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("SupportedReplicationProvider")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemInternal)this).SupportedReplicationProvider = (string[]) content.GetValueForProperty("SupportedReplicationProvider",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemInternal)this).SupportedReplicationProvider, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("CustomDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemInternal)this).CustomDetailInstanceType = (string) content.GetValueForProperty("CustomDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemInternal)this).CustomDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ProtectableItem(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProtectableItemPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("CustomDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemInternal)this).CustomDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigurationSettings) content.GetValueForProperty("CustomDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemInternal)this).CustomDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ConfigurationSettingsTypeConverter.ConvertFrom); + } + if (content.Contains("FriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemInternal)this).FriendlyName = (string) content.GetValueForProperty("FriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemInternal)this).FriendlyName, global::System.Convert.ToString); + } + if (content.Contains("ProtectionStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemInternal)this).ProtectionStatus = (string) content.GetValueForProperty("ProtectionStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemInternal)this).ProtectionStatus, global::System.Convert.ToString); + } + if (content.Contains("ReplicationProtectedItemId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemInternal)this).ReplicationProtectedItemId = (string) content.GetValueForProperty("ReplicationProtectedItemId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemInternal)this).ReplicationProtectedItemId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryServicesProviderId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemInternal)this).RecoveryServicesProviderId = (string) content.GetValueForProperty("RecoveryServicesProviderId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemInternal)this).RecoveryServicesProviderId, global::System.Convert.ToString); + } + if (content.Contains("ProtectionReadinessError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemInternal)this).ProtectionReadinessError = (string[]) content.GetValueForProperty("ProtectionReadinessError",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemInternal)this).ProtectionReadinessError, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("SupportedReplicationProvider")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemInternal)this).SupportedReplicationProvider = (string[]) content.GetValueForProperty("SupportedReplicationProvider",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemInternal)this).SupportedReplicationProvider, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("CustomDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemInternal)this).CustomDetailInstanceType = (string) content.GetValueForProperty("CustomDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemInternal)this).CustomDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Replication protected item. + [System.ComponentModel.TypeConverter(typeof(ProtectableItemTypeConverter))] + public partial interface IProtectableItem + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectableItem.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectableItem.TypeConverter.cs new file mode 100644 index 000000000000..5c88bfb99342 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectableItem.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ProtectableItemTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItem ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItem).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ProtectableItem.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ProtectableItem.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ProtectableItem.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectableItem.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectableItem.cs new file mode 100644 index 000000000000..ad50e62bf160 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectableItem.cs @@ -0,0 +1,193 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Replication protected item. + public partial class ProtectableItem : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItem, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResource __resource = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.Resource(); + + /// Gets the class type. Overridden in derived classes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string CustomDetailInstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemPropertiesInternal)Property).CustomDetailInstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemPropertiesInternal)Property).CustomDetailInstanceType = value ?? null; } + + /// The name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string FriendlyName { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemPropertiesInternal)Property).FriendlyName; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemPropertiesInternal)Property).FriendlyName = value ?? null; } + + /// Resource Id + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Id; } + + /// Resource Location + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string Location { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Location; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Location = value ?? null; } + + /// Internal Acessors for CustomDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigurationSettings Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemInternal.CustomDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemPropertiesInternal)Property).CustomDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemPropertiesInternal)Property).CustomDetail = value; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemProperties Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProtectableItemProperties()); set { {_property = value;} } } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Id = value; } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Name = value; } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Type = value; } + + /// Resource Name + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Name; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemProperties _property; + + /// The custom data. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProtectableItemProperties()); set => this._property = value; } + + /// The Current protection readiness errors. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string[] ProtectionReadinessError { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemPropertiesInternal)Property).ProtectionReadinessError; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemPropertiesInternal)Property).ProtectionReadinessError = value ?? null /* arrayOf */; } + + /// The protection status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ProtectionStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemPropertiesInternal)Property).ProtectionStatus; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemPropertiesInternal)Property).ProtectionStatus = value ?? null; } + + /// The recovery provider ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string RecoveryServicesProviderId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemPropertiesInternal)Property).RecoveryServicesProviderId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemPropertiesInternal)Property).RecoveryServicesProviderId = value ?? null; } + + /// The ARM resource of protected items. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ReplicationProtectedItemId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemPropertiesInternal)Property).ReplicationProtectedItemId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemPropertiesInternal)Property).ReplicationProtectedItemId = value ?? null; } + + /// The list of replication providers supported for the protectable item. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string[] SupportedReplicationProvider { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemPropertiesInternal)Property).SupportedReplicationProvider; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemPropertiesInternal)Property).SupportedReplicationProvider = value ?? null /* arrayOf */; } + + /// Resource Type + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Type; } + + /// Creates an new instance. + public ProtectableItem() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__resource), __resource); + await eventListener.AssertObjectIsValid(nameof(__resource), __resource); + } + } + /// Replication protected item. + public partial interface IProtectableItem : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResource + { + /// Gets the class type. Overridden in derived classes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets the class type. Overridden in derived classes.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string CustomDetailInstanceType { get; set; } + /// The name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name.", + SerializedName = @"friendlyName", + PossibleTypes = new [] { typeof(string) })] + string FriendlyName { get; set; } + /// The Current protection readiness errors. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Current protection readiness errors.", + SerializedName = @"protectionReadinessErrors", + PossibleTypes = new [] { typeof(string) })] + string[] ProtectionReadinessError { get; set; } + /// The protection status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The protection status.", + SerializedName = @"protectionStatus", + PossibleTypes = new [] { typeof(string) })] + string ProtectionStatus { get; set; } + /// The recovery provider ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery provider ARM Id.", + SerializedName = @"recoveryServicesProviderId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryServicesProviderId { get; set; } + /// The ARM resource of protected items. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The ARM resource of protected items.", + SerializedName = @"replicationProtectedItemId", + PossibleTypes = new [] { typeof(string) })] + string ReplicationProtectedItemId { get; set; } + /// The list of replication providers supported for the protectable item. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of replication providers supported for the protectable item.", + SerializedName = @"supportedReplicationProviders", + PossibleTypes = new [] { typeof(string) })] + string[] SupportedReplicationProvider { get; set; } + + } + /// Replication protected item. + internal partial interface IProtectableItemInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal + { + /// The Replication provider custom settings. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigurationSettings CustomDetail { get; set; } + /// Gets the class type. Overridden in derived classes. + string CustomDetailInstanceType { get; set; } + /// The name. + string FriendlyName { get; set; } + /// The custom data. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemProperties Property { get; set; } + /// The Current protection readiness errors. + string[] ProtectionReadinessError { get; set; } + /// The protection status. + string ProtectionStatus { get; set; } + /// The recovery provider ARM Id. + string RecoveryServicesProviderId { get; set; } + /// The ARM resource of protected items. + string ReplicationProtectedItemId { get; set; } + /// The list of replication providers supported for the protectable item. + string[] SupportedReplicationProvider { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectableItem.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectableItem.json.cs new file mode 100644 index 000000000000..3d6931bfa48e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectableItem.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Replication protected item. + public partial class ProtectableItem + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItem. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItem. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItem FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new ProtectableItem(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal ProtectableItem(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __resource = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.Resource(json); + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProtectableItemProperties.FromJson(__jsonProperties) : Property;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __resource?.ToJson(container, serializationMode); + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectableItemCollection.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectableItemCollection.PowerShell.cs new file mode 100644 index 000000000000..a14008ddf3a4 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectableItemCollection.PowerShell.cs @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Protectable item collection. + [System.ComponentModel.TypeConverter(typeof(ProtectableItemCollectionTypeConverter))] + public partial class ProtectableItemCollection + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemCollection DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ProtectableItemCollection(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemCollection DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ProtectableItemCollection(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemCollection FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ProtectableItemCollection(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItem[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProtectableItemTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemCollectionInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemCollectionInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ProtectableItemCollection(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItem[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProtectableItemTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemCollectionInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemCollectionInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Protectable item collection. + [System.ComponentModel.TypeConverter(typeof(ProtectableItemCollectionTypeConverter))] + public partial interface IProtectableItemCollection + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectableItemCollection.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectableItemCollection.TypeConverter.cs new file mode 100644 index 000000000000..ecb84c699ea5 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectableItemCollection.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ProtectableItemCollectionTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemCollection ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemCollection).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ProtectableItemCollection.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ProtectableItemCollection.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ProtectableItemCollection.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectableItemCollection.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectableItemCollection.cs new file mode 100644 index 000000000000..0af75b4bd473 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectableItemCollection.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Protectable item collection. + public partial class ProtectableItemCollection : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemCollection, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemCollectionInternal + { + + /// Backing field for property. + private string _nextLink; + + /// The value of next link. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string NextLink { get => this._nextLink; set => this._nextLink = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItem[] _value; + + /// The Protectable item details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItem[] Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public ProtectableItemCollection() + { + + } + } + /// Protectable item collection. + public partial interface IProtectableItemCollection : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The value of next link. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The value of next link.", + SerializedName = @"nextLink", + PossibleTypes = new [] { typeof(string) })] + string NextLink { get; set; } + /// The Protectable item details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Protectable item details.", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItem) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItem[] Value { get; set; } + + } + /// Protectable item collection. + internal partial interface IProtectableItemCollectionInternal + + { + /// The value of next link. + string NextLink { get; set; } + /// The Protectable item details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItem[] Value { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectableItemCollection.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectableItemCollection.json.cs new file mode 100644 index 000000000000..6cb73b6c195a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectableItemCollection.json.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Protectable item collection. + public partial class ProtectableItemCollection + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemCollection. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemCollection. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemCollection FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new ProtectableItemCollection(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal ProtectableItemCollection(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItem) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProtectableItem.FromJson(__u) )) ))() : null : Value;} + {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)NextLink;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._value) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._value ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("value",__w); + } + AddIf( null != (((object)this._nextLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectableItemProperties.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectableItemProperties.PowerShell.cs new file mode 100644 index 000000000000..97d0346fe3b8 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectableItemProperties.PowerShell.cs @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Replication protected item custom data details. + [System.ComponentModel.TypeConverter(typeof(ProtectableItemPropertiesTypeConverter))] + public partial class ProtectableItemProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ProtectableItemProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ProtectableItemProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ProtectableItemProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CustomDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemPropertiesInternal)this).CustomDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigurationSettings) content.GetValueForProperty("CustomDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemPropertiesInternal)this).CustomDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ConfigurationSettingsTypeConverter.ConvertFrom); + } + if (content.Contains("FriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemPropertiesInternal)this).FriendlyName = (string) content.GetValueForProperty("FriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemPropertiesInternal)this).FriendlyName, global::System.Convert.ToString); + } + if (content.Contains("ProtectionStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemPropertiesInternal)this).ProtectionStatus = (string) content.GetValueForProperty("ProtectionStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemPropertiesInternal)this).ProtectionStatus, global::System.Convert.ToString); + } + if (content.Contains("ReplicationProtectedItemId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemPropertiesInternal)this).ReplicationProtectedItemId = (string) content.GetValueForProperty("ReplicationProtectedItemId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemPropertiesInternal)this).ReplicationProtectedItemId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryServicesProviderId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemPropertiesInternal)this).RecoveryServicesProviderId = (string) content.GetValueForProperty("RecoveryServicesProviderId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemPropertiesInternal)this).RecoveryServicesProviderId, global::System.Convert.ToString); + } + if (content.Contains("ProtectionReadinessError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemPropertiesInternal)this).ProtectionReadinessError = (string[]) content.GetValueForProperty("ProtectionReadinessError",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemPropertiesInternal)this).ProtectionReadinessError, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("SupportedReplicationProvider")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemPropertiesInternal)this).SupportedReplicationProvider = (string[]) content.GetValueForProperty("SupportedReplicationProvider",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemPropertiesInternal)this).SupportedReplicationProvider, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("CustomDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemPropertiesInternal)this).CustomDetailInstanceType = (string) content.GetValueForProperty("CustomDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemPropertiesInternal)this).CustomDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ProtectableItemProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CustomDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemPropertiesInternal)this).CustomDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigurationSettings) content.GetValueForProperty("CustomDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemPropertiesInternal)this).CustomDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ConfigurationSettingsTypeConverter.ConvertFrom); + } + if (content.Contains("FriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemPropertiesInternal)this).FriendlyName = (string) content.GetValueForProperty("FriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemPropertiesInternal)this).FriendlyName, global::System.Convert.ToString); + } + if (content.Contains("ProtectionStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemPropertiesInternal)this).ProtectionStatus = (string) content.GetValueForProperty("ProtectionStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemPropertiesInternal)this).ProtectionStatus, global::System.Convert.ToString); + } + if (content.Contains("ReplicationProtectedItemId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemPropertiesInternal)this).ReplicationProtectedItemId = (string) content.GetValueForProperty("ReplicationProtectedItemId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemPropertiesInternal)this).ReplicationProtectedItemId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryServicesProviderId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemPropertiesInternal)this).RecoveryServicesProviderId = (string) content.GetValueForProperty("RecoveryServicesProviderId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemPropertiesInternal)this).RecoveryServicesProviderId, global::System.Convert.ToString); + } + if (content.Contains("ProtectionReadinessError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemPropertiesInternal)this).ProtectionReadinessError = (string[]) content.GetValueForProperty("ProtectionReadinessError",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemPropertiesInternal)this).ProtectionReadinessError, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("SupportedReplicationProvider")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemPropertiesInternal)this).SupportedReplicationProvider = (string[]) content.GetValueForProperty("SupportedReplicationProvider",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemPropertiesInternal)this).SupportedReplicationProvider, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("CustomDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemPropertiesInternal)this).CustomDetailInstanceType = (string) content.GetValueForProperty("CustomDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemPropertiesInternal)this).CustomDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Replication protected item custom data details. + [System.ComponentModel.TypeConverter(typeof(ProtectableItemPropertiesTypeConverter))] + public partial interface IProtectableItemProperties + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectableItemProperties.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectableItemProperties.TypeConverter.cs new file mode 100644 index 000000000000..a835484fefc6 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectableItemProperties.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ProtectableItemPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ProtectableItemProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ProtectableItemProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ProtectableItemProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectableItemProperties.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectableItemProperties.cs new file mode 100644 index 000000000000..aa6780887088 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectableItemProperties.cs @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Replication protected item custom data details. + public partial class ProtectableItemProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemProperties, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemPropertiesInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigurationSettings _customDetail; + + /// The Replication provider custom settings. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigurationSettings CustomDetail { get => (this._customDetail = this._customDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ConfigurationSettings()); set => this._customDetail = value; } + + /// Gets the class type. Overridden in derived classes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string CustomDetailInstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigurationSettingsInternal)CustomDetail).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigurationSettingsInternal)CustomDetail).InstanceType = value ?? null; } + + /// Backing field for property. + private string _friendlyName; + + /// The name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string FriendlyName { get => this._friendlyName; set => this._friendlyName = value; } + + /// Internal Acessors for CustomDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigurationSettings Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemPropertiesInternal.CustomDetail { get => (this._customDetail = this._customDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ConfigurationSettings()); set { {_customDetail = value;} } } + + /// Backing field for property. + private string[] _protectionReadinessError; + + /// The Current protection readiness errors. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string[] ProtectionReadinessError { get => this._protectionReadinessError; set => this._protectionReadinessError = value; } + + /// Backing field for property. + private string _protectionStatus; + + /// The protection status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ProtectionStatus { get => this._protectionStatus; set => this._protectionStatus = value; } + + /// Backing field for property. + private string _recoveryServicesProviderId; + + /// The recovery provider ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryServicesProviderId { get => this._recoveryServicesProviderId; set => this._recoveryServicesProviderId = value; } + + /// Backing field for property. + private string _replicationProtectedItemId; + + /// The ARM resource of protected items. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ReplicationProtectedItemId { get => this._replicationProtectedItemId; set => this._replicationProtectedItemId = value; } + + /// Backing field for property. + private string[] _supportedReplicationProvider; + + /// The list of replication providers supported for the protectable item. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string[] SupportedReplicationProvider { get => this._supportedReplicationProvider; set => this._supportedReplicationProvider = value; } + + /// Creates an new instance. + public ProtectableItemProperties() + { + + } + } + /// Replication protected item custom data details. + public partial interface IProtectableItemProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// Gets the class type. Overridden in derived classes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets the class type. Overridden in derived classes.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string CustomDetailInstanceType { get; set; } + /// The name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name.", + SerializedName = @"friendlyName", + PossibleTypes = new [] { typeof(string) })] + string FriendlyName { get; set; } + /// The Current protection readiness errors. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Current protection readiness errors.", + SerializedName = @"protectionReadinessErrors", + PossibleTypes = new [] { typeof(string) })] + string[] ProtectionReadinessError { get; set; } + /// The protection status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The protection status.", + SerializedName = @"protectionStatus", + PossibleTypes = new [] { typeof(string) })] + string ProtectionStatus { get; set; } + /// The recovery provider ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery provider ARM Id.", + SerializedName = @"recoveryServicesProviderId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryServicesProviderId { get; set; } + /// The ARM resource of protected items. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The ARM resource of protected items.", + SerializedName = @"replicationProtectedItemId", + PossibleTypes = new [] { typeof(string) })] + string ReplicationProtectedItemId { get; set; } + /// The list of replication providers supported for the protectable item. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of replication providers supported for the protectable item.", + SerializedName = @"supportedReplicationProviders", + PossibleTypes = new [] { typeof(string) })] + string[] SupportedReplicationProvider { get; set; } + + } + /// Replication protected item custom data details. + internal partial interface IProtectableItemPropertiesInternal + + { + /// The Replication provider custom settings. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigurationSettings CustomDetail { get; set; } + /// Gets the class type. Overridden in derived classes. + string CustomDetailInstanceType { get; set; } + /// The name. + string FriendlyName { get; set; } + /// The Current protection readiness errors. + string[] ProtectionReadinessError { get; set; } + /// The protection status. + string ProtectionStatus { get; set; } + /// The recovery provider ARM Id. + string RecoveryServicesProviderId { get; set; } + /// The ARM resource of protected items. + string ReplicationProtectedItemId { get; set; } + /// The list of replication providers supported for the protectable item. + string[] SupportedReplicationProvider { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectableItemProperties.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectableItemProperties.json.cs new file mode 100644 index 000000000000..a8b63c4045e6 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectableItemProperties.json.cs @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Replication protected item custom data details. + public partial class ProtectableItemProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new ProtectableItemProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal ProtectableItemProperties(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_customDetail = If( json?.PropertyT("customDetails"), out var __jsonCustomDetails) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ConfigurationSettings.FromJson(__jsonCustomDetails) : CustomDetail;} + {_friendlyName = If( json?.PropertyT("friendlyName"), out var __jsonFriendlyName) ? (string)__jsonFriendlyName : (string)FriendlyName;} + {_protectionStatus = If( json?.PropertyT("protectionStatus"), out var __jsonProtectionStatus) ? (string)__jsonProtectionStatus : (string)ProtectionStatus;} + {_replicationProtectedItemId = If( json?.PropertyT("replicationProtectedItemId"), out var __jsonReplicationProtectedItemId) ? (string)__jsonReplicationProtectedItemId : (string)ReplicationProtectedItemId;} + {_recoveryServicesProviderId = If( json?.PropertyT("recoveryServicesProviderId"), out var __jsonRecoveryServicesProviderId) ? (string)__jsonRecoveryServicesProviderId : (string)RecoveryServicesProviderId;} + {_protectionReadinessError = If( json?.PropertyT("protectionReadinessErrors"), out var __jsonProtectionReadinessErrors) ? If( __jsonProtectionReadinessErrors as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(string) (__u is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : ProtectionReadinessError;} + {_supportedReplicationProvider = If( json?.PropertyT("supportedReplicationProviders"), out var __jsonSupportedReplicationProviders) ? If( __jsonSupportedReplicationProviders as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __q) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__q, (__p)=>(string) (__p is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString __o ? (string)(__o.ToString()) : null)) ))() : null : SupportedReplicationProvider;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._customDetail ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._customDetail.ToJson(null,serializationMode) : null, "customDetails" ,container.Add ); + AddIf( null != (((object)this._friendlyName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._friendlyName.ToString()) : null, "friendlyName" ,container.Add ); + AddIf( null != (((object)this._protectionStatus)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._protectionStatus.ToString()) : null, "protectionStatus" ,container.Add ); + AddIf( null != (((object)this._replicationProtectedItemId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._replicationProtectedItemId.ToString()) : null, "replicationProtectedItemId" ,container.Add ); + AddIf( null != (((object)this._recoveryServicesProviderId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryServicesProviderId.ToString()) : null, "recoveryServicesProviderId" ,container.Add ); + if (null != this._protectionReadinessError) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._protectionReadinessError ) + { + AddIf(null != (((object)__x)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(__x.ToString()) : null ,__w.Add); + } + container.Add("protectionReadinessErrors",__w); + } + if (null != this._supportedReplicationProvider) + { + var __r = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __s in this._supportedReplicationProvider ) + { + AddIf(null != (((object)__s)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(__s.ToString()) : null ,__r.Add); + } + container.Add("supportedReplicationProviders",__r); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectableItemQueryParameter.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectableItemQueryParameter.PowerShell.cs new file mode 100644 index 000000000000..456d33c3a3e1 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectableItemQueryParameter.PowerShell.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Query parameter to enumerate Protectable items. + [System.ComponentModel.TypeConverter(typeof(ProtectableItemQueryParameterTypeConverter))] + public partial class ProtectableItemQueryParameter + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemQueryParameter DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ProtectableItemQueryParameter(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemQueryParameter DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ProtectableItemQueryParameter(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemQueryParameter FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ProtectableItemQueryParameter(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("State")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemQueryParameterInternal)this).State = (string) content.GetValueForProperty("State",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemQueryParameterInternal)this).State, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ProtectableItemQueryParameter(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("State")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemQueryParameterInternal)this).State = (string) content.GetValueForProperty("State",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemQueryParameterInternal)this).State, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Query parameter to enumerate Protectable items. + [System.ComponentModel.TypeConverter(typeof(ProtectableItemQueryParameterTypeConverter))] + public partial interface IProtectableItemQueryParameter + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectableItemQueryParameter.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectableItemQueryParameter.TypeConverter.cs new file mode 100644 index 000000000000..0b0420bd3ee9 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectableItemQueryParameter.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ProtectableItemQueryParameterTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemQueryParameter ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemQueryParameter).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ProtectableItemQueryParameter.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ProtectableItemQueryParameter.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ProtectableItemQueryParameter.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectableItemQueryParameter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectableItemQueryParameter.cs new file mode 100644 index 000000000000..bb754b3c2673 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectableItemQueryParameter.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Query parameter to enumerate Protectable items. + public partial class ProtectableItemQueryParameter : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemQueryParameter, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemQueryParameterInternal + { + + /// Backing field for property. + private string _state; + + /// State of the Protectable item query filter. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string State { get => this._state; set => this._state = value; } + + /// Creates an new instance. + public ProtectableItemQueryParameter() + { + + } + } + /// Query parameter to enumerate Protectable items. + public partial interface IProtectableItemQueryParameter : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// State of the Protectable item query filter. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"State of the Protectable item query filter.", + SerializedName = @"state", + PossibleTypes = new [] { typeof(string) })] + string State { get; set; } + + } + /// Query parameter to enumerate Protectable items. + internal partial interface IProtectableItemQueryParameterInternal + + { + /// State of the Protectable item query filter. + string State { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectableItemQueryParameter.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectableItemQueryParameter.json.cs new file mode 100644 index 000000000000..10b8f8b34b83 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectableItemQueryParameter.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Query parameter to enumerate Protectable items. + public partial class ProtectableItemQueryParameter + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemQueryParameter. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemQueryParameter. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemQueryParameter FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new ProtectableItemQueryParameter(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal ProtectableItemQueryParameter(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_state = If( json?.PropertyT("state"), out var __jsonState) ? (string)__jsonState : (string)State;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._state)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._state.ToString()) : null, "state" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectedItemsQueryParameter.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectedItemsQueryParameter.PowerShell.cs new file mode 100644 index 000000000000..c792136c1b44 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectedItemsQueryParameter.PowerShell.cs @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Query parameter to enumerate protected items. + [System.ComponentModel.TypeConverter(typeof(ProtectedItemsQueryParameterTypeConverter))] + public partial class ProtectedItemsQueryParameter + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectedItemsQueryParameter DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ProtectedItemsQueryParameter(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectedItemsQueryParameter DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ProtectedItemsQueryParameter(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectedItemsQueryParameter FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ProtectedItemsQueryParameter(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SourceFabricName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectedItemsQueryParameterInternal)this).SourceFabricName = (string) content.GetValueForProperty("SourceFabricName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectedItemsQueryParameterInternal)this).SourceFabricName, global::System.Convert.ToString); + } + if (content.Contains("RecoveryPlanName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectedItemsQueryParameterInternal)this).RecoveryPlanName = (string) content.GetValueForProperty("RecoveryPlanName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectedItemsQueryParameterInternal)this).RecoveryPlanName, global::System.Convert.ToString); + } + if (content.Contains("SourceFabricLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectedItemsQueryParameterInternal)this).SourceFabricLocation = (string) content.GetValueForProperty("SourceFabricLocation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectedItemsQueryParameterInternal)this).SourceFabricLocation, global::System.Convert.ToString); + } + if (content.Contains("FabricObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectedItemsQueryParameterInternal)this).FabricObjectId = (string) content.GetValueForProperty("FabricObjectId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectedItemsQueryParameterInternal)this).FabricObjectId, global::System.Convert.ToString); + } + if (content.Contains("VCenterName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectedItemsQueryParameterInternal)this).VCenterName = (string) content.GetValueForProperty("VCenterName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectedItemsQueryParameterInternal)this).VCenterName, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectedItemsQueryParameterInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectedItemsQueryParameterInternal)this).InstanceType, global::System.Convert.ToString); + } + if (content.Contains("MultiVMGroupCreateOption")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectedItemsQueryParameterInternal)this).MultiVMGroupCreateOption = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MultiVMGroupCreateOption?) content.GetValueForProperty("MultiVMGroupCreateOption",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectedItemsQueryParameterInternal)this).MultiVMGroupCreateOption, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MultiVMGroupCreateOption.CreateFrom); + } + if (content.Contains("ProcessServerId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectedItemsQueryParameterInternal)this).ProcessServerId = (string) content.GetValueForProperty("ProcessServerId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectedItemsQueryParameterInternal)this).ProcessServerId, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ProtectedItemsQueryParameter(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SourceFabricName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectedItemsQueryParameterInternal)this).SourceFabricName = (string) content.GetValueForProperty("SourceFabricName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectedItemsQueryParameterInternal)this).SourceFabricName, global::System.Convert.ToString); + } + if (content.Contains("RecoveryPlanName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectedItemsQueryParameterInternal)this).RecoveryPlanName = (string) content.GetValueForProperty("RecoveryPlanName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectedItemsQueryParameterInternal)this).RecoveryPlanName, global::System.Convert.ToString); + } + if (content.Contains("SourceFabricLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectedItemsQueryParameterInternal)this).SourceFabricLocation = (string) content.GetValueForProperty("SourceFabricLocation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectedItemsQueryParameterInternal)this).SourceFabricLocation, global::System.Convert.ToString); + } + if (content.Contains("FabricObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectedItemsQueryParameterInternal)this).FabricObjectId = (string) content.GetValueForProperty("FabricObjectId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectedItemsQueryParameterInternal)this).FabricObjectId, global::System.Convert.ToString); + } + if (content.Contains("VCenterName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectedItemsQueryParameterInternal)this).VCenterName = (string) content.GetValueForProperty("VCenterName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectedItemsQueryParameterInternal)this).VCenterName, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectedItemsQueryParameterInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectedItemsQueryParameterInternal)this).InstanceType, global::System.Convert.ToString); + } + if (content.Contains("MultiVMGroupCreateOption")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectedItemsQueryParameterInternal)this).MultiVMGroupCreateOption = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MultiVMGroupCreateOption?) content.GetValueForProperty("MultiVMGroupCreateOption",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectedItemsQueryParameterInternal)this).MultiVMGroupCreateOption, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MultiVMGroupCreateOption.CreateFrom); + } + if (content.Contains("ProcessServerId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectedItemsQueryParameterInternal)this).ProcessServerId = (string) content.GetValueForProperty("ProcessServerId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectedItemsQueryParameterInternal)this).ProcessServerId, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Query parameter to enumerate protected items. + [System.ComponentModel.TypeConverter(typeof(ProtectedItemsQueryParameterTypeConverter))] + public partial interface IProtectedItemsQueryParameter + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectedItemsQueryParameter.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectedItemsQueryParameter.TypeConverter.cs new file mode 100644 index 000000000000..432ce8c0ae97 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectedItemsQueryParameter.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ProtectedItemsQueryParameterTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectedItemsQueryParameter ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectedItemsQueryParameter).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ProtectedItemsQueryParameter.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ProtectedItemsQueryParameter.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ProtectedItemsQueryParameter.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectedItemsQueryParameter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectedItemsQueryParameter.cs new file mode 100644 index 000000000000..22332fdb5b57 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectedItemsQueryParameter.cs @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Query parameter to enumerate protected items. + public partial class ProtectedItemsQueryParameter : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectedItemsQueryParameter, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectedItemsQueryParameterInternal + { + + /// Backing field for property. + private string _fabricObjectId; + + /// The fabric object Id filter. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string FabricObjectId { get => this._fabricObjectId; set => this._fabricObjectId = value; } + + /// Backing field for property. + private string _instanceType; + + /// The replication provider type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string InstanceType { get => this._instanceType; set => this._instanceType = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MultiVMGroupCreateOption? _multiVMGroupCreateOption; + + /// Whether Multi VM group is auto created or specified by user. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MultiVMGroupCreateOption? MultiVMGroupCreateOption { get => this._multiVMGroupCreateOption; set => this._multiVMGroupCreateOption = value; } + + /// Backing field for property. + private string _processServerId; + + /// The process server Id filter. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ProcessServerId { get => this._processServerId; set => this._processServerId = value; } + + /// Backing field for property. + private string _recoveryPlanName; + + /// The recovery plan filter. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryPlanName { get => this._recoveryPlanName; set => this._recoveryPlanName = value; } + + /// Backing field for property. + private string _sourceFabricLocation; + + /// The source fabric location filter. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string SourceFabricLocation { get => this._sourceFabricLocation; set => this._sourceFabricLocation = value; } + + /// Backing field for property. + private string _sourceFabricName; + + /// The source fabric name filter. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string SourceFabricName { get => this._sourceFabricName; set => this._sourceFabricName = value; } + + /// Backing field for property. + private string _vCenterName; + + /// The vCenter name filter. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string VCenterName { get => this._vCenterName; set => this._vCenterName = value; } + + /// Creates an new instance. + public ProtectedItemsQueryParameter() + { + + } + } + /// Query parameter to enumerate protected items. + public partial interface IProtectedItemsQueryParameter : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The fabric object Id filter. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The fabric object Id filter.", + SerializedName = @"fabricObjectId", + PossibleTypes = new [] { typeof(string) })] + string FabricObjectId { get; set; } + /// The replication provider type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The replication provider type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string InstanceType { get; set; } + /// Whether Multi VM group is auto created or specified by user. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Whether Multi VM group is auto created or specified by user.", + SerializedName = @"multiVmGroupCreateOption", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MultiVMGroupCreateOption) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MultiVMGroupCreateOption? MultiVMGroupCreateOption { get; set; } + /// The process server Id filter. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The process server Id filter.", + SerializedName = @"processServerId", + PossibleTypes = new [] { typeof(string) })] + string ProcessServerId { get; set; } + /// The recovery plan filter. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery plan filter.", + SerializedName = @"recoveryPlanName", + PossibleTypes = new [] { typeof(string) })] + string RecoveryPlanName { get; set; } + /// The source fabric location filter. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The source fabric location filter.", + SerializedName = @"sourceFabricLocation", + PossibleTypes = new [] { typeof(string) })] + string SourceFabricLocation { get; set; } + /// The source fabric name filter. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The source fabric name filter.", + SerializedName = @"sourceFabricName", + PossibleTypes = new [] { typeof(string) })] + string SourceFabricName { get; set; } + /// The vCenter name filter. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The vCenter name filter.", + SerializedName = @"vCenterName", + PossibleTypes = new [] { typeof(string) })] + string VCenterName { get; set; } + + } + /// Query parameter to enumerate protected items. + internal partial interface IProtectedItemsQueryParameterInternal + + { + /// The fabric object Id filter. + string FabricObjectId { get; set; } + /// The replication provider type. + string InstanceType { get; set; } + /// Whether Multi VM group is auto created or specified by user. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MultiVMGroupCreateOption? MultiVMGroupCreateOption { get; set; } + /// The process server Id filter. + string ProcessServerId { get; set; } + /// The recovery plan filter. + string RecoveryPlanName { get; set; } + /// The source fabric location filter. + string SourceFabricLocation { get; set; } + /// The source fabric name filter. + string SourceFabricName { get; set; } + /// The vCenter name filter. + string VCenterName { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectedItemsQueryParameter.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectedItemsQueryParameter.json.cs new file mode 100644 index 000000000000..896644515dcc --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectedItemsQueryParameter.json.cs @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Query parameter to enumerate protected items. + public partial class ProtectedItemsQueryParameter + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectedItemsQueryParameter. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectedItemsQueryParameter. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectedItemsQueryParameter FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new ProtectedItemsQueryParameter(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal ProtectedItemsQueryParameter(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_sourceFabricName = If( json?.PropertyT("sourceFabricName"), out var __jsonSourceFabricName) ? (string)__jsonSourceFabricName : (string)SourceFabricName;} + {_recoveryPlanName = If( json?.PropertyT("recoveryPlanName"), out var __jsonRecoveryPlanName) ? (string)__jsonRecoveryPlanName : (string)RecoveryPlanName;} + {_sourceFabricLocation = If( json?.PropertyT("sourceFabricLocation"), out var __jsonSourceFabricLocation) ? (string)__jsonSourceFabricLocation : (string)SourceFabricLocation;} + {_fabricObjectId = If( json?.PropertyT("fabricObjectId"), out var __jsonFabricObjectId) ? (string)__jsonFabricObjectId : (string)FabricObjectId;} + {_vCenterName = If( json?.PropertyT("vCenterName"), out var __jsonVCenterName) ? (string)__jsonVCenterName : (string)VCenterName;} + {_instanceType = If( json?.PropertyT("instanceType"), out var __jsonInstanceType) ? (string)__jsonInstanceType : (string)InstanceType;} + {_multiVMGroupCreateOption = If( json?.PropertyT("multiVmGroupCreateOption"), out var __jsonMultiVMGroupCreateOption) ? (string)__jsonMultiVMGroupCreateOption : (string)MultiVMGroupCreateOption;} + {_processServerId = If( json?.PropertyT("processServerId"), out var __jsonProcessServerId) ? (string)__jsonProcessServerId : (string)ProcessServerId;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._sourceFabricName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._sourceFabricName.ToString()) : null, "sourceFabricName" ,container.Add ); + AddIf( null != (((object)this._recoveryPlanName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryPlanName.ToString()) : null, "recoveryPlanName" ,container.Add ); + AddIf( null != (((object)this._sourceFabricLocation)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._sourceFabricLocation.ToString()) : null, "sourceFabricLocation" ,container.Add ); + AddIf( null != (((object)this._fabricObjectId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._fabricObjectId.ToString()) : null, "fabricObjectId" ,container.Add ); + AddIf( null != (((object)this._vCenterName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._vCenterName.ToString()) : null, "vCenterName" ,container.Add ); + AddIf( null != (((object)this._instanceType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._instanceType.ToString()) : null, "instanceType" ,container.Add ); + AddIf( null != (((object)this._multiVMGroupCreateOption)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._multiVMGroupCreateOption.ToString()) : null, "multiVmGroupCreateOption" ,container.Add ); + AddIf( null != (((object)this._processServerId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._processServerId.ToString()) : null, "processServerId" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionContainer.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionContainer.PowerShell.cs new file mode 100644 index 000000000000..2e4881bb8249 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionContainer.PowerShell.cs @@ -0,0 +1,240 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Protection container details. + [System.ComponentModel.TypeConverter(typeof(ProtectionContainerTypeConverter))] + public partial class ProtectionContainer + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainer DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ProtectionContainer(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainer DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ProtectionContainer(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainer FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ProtectionContainer(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProtectionContainerPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("FabricSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerInternal)this).FabricSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerFabricSpecificDetails) content.GetValueForProperty("FabricSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerInternal)this).FabricSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProtectionContainerFabricSpecificDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("FabricFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerInternal)this).FabricFriendlyName = (string) content.GetValueForProperty("FabricFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerInternal)this).FabricFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("FriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerInternal)this).FriendlyName = (string) content.GetValueForProperty("FriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerInternal)this).FriendlyName, global::System.Convert.ToString); + } + if (content.Contains("FabricType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerInternal)this).FabricType = (string) content.GetValueForProperty("FabricType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerInternal)this).FabricType, global::System.Convert.ToString); + } + if (content.Contains("ProtectedItemCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerInternal)this).ProtectedItemCount = (int?) content.GetValueForProperty("ProtectedItemCount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerInternal)this).ProtectedItemCount, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("PairingStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerInternal)this).PairingStatus = (string) content.GetValueForProperty("PairingStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerInternal)this).PairingStatus, global::System.Convert.ToString); + } + if (content.Contains("Role")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerInternal)this).Role = (string) content.GetValueForProperty("Role",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerInternal)this).Role, global::System.Convert.ToString); + } + if (content.Contains("FabricSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerInternal)this).FabricSpecificDetailInstanceType = (string) content.GetValueForProperty("FabricSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerInternal)this).FabricSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ProtectionContainer(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProtectionContainerPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("FabricSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerInternal)this).FabricSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerFabricSpecificDetails) content.GetValueForProperty("FabricSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerInternal)this).FabricSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProtectionContainerFabricSpecificDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("FabricFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerInternal)this).FabricFriendlyName = (string) content.GetValueForProperty("FabricFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerInternal)this).FabricFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("FriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerInternal)this).FriendlyName = (string) content.GetValueForProperty("FriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerInternal)this).FriendlyName, global::System.Convert.ToString); + } + if (content.Contains("FabricType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerInternal)this).FabricType = (string) content.GetValueForProperty("FabricType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerInternal)this).FabricType, global::System.Convert.ToString); + } + if (content.Contains("ProtectedItemCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerInternal)this).ProtectedItemCount = (int?) content.GetValueForProperty("ProtectedItemCount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerInternal)this).ProtectedItemCount, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("PairingStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerInternal)this).PairingStatus = (string) content.GetValueForProperty("PairingStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerInternal)this).PairingStatus, global::System.Convert.ToString); + } + if (content.Contains("Role")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerInternal)this).Role = (string) content.GetValueForProperty("Role",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerInternal)this).Role, global::System.Convert.ToString); + } + if (content.Contains("FabricSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerInternal)this).FabricSpecificDetailInstanceType = (string) content.GetValueForProperty("FabricSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerInternal)this).FabricSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Protection container details. + [System.ComponentModel.TypeConverter(typeof(ProtectionContainerTypeConverter))] + public partial interface IProtectionContainer + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionContainer.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionContainer.TypeConverter.cs new file mode 100644 index 000000000000..9ffbb0901ac8 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionContainer.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ProtectionContainerTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainer ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainer).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ProtectionContainer.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ProtectionContainer.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ProtectionContainer.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionContainer.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionContainer.cs new file mode 100644 index 000000000000..728849eb64ba --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionContainer.cs @@ -0,0 +1,196 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Protection container details. + public partial class ProtectionContainer : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainer, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResource __resource = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.Resource(); + + /// Fabric friendly name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string FabricFriendlyName { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerPropertiesInternal)Property).FabricFriendlyName; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerPropertiesInternal)Property).FabricFriendlyName = value ?? null; } + + /// Gets the class type. Overridden in derived classes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string FabricSpecificDetailInstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerPropertiesInternal)Property).FabricSpecificDetailInstanceType; } + + /// The fabric type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string FabricType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerPropertiesInternal)Property).FabricType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerPropertiesInternal)Property).FabricType = value ?? null; } + + /// The name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string FriendlyName { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerPropertiesInternal)Property).FriendlyName; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerPropertiesInternal)Property).FriendlyName = value ?? null; } + + /// Resource Id + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Id; } + + /// Resource Location + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string Location { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Location; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Location = value ?? null; } + + /// Internal Acessors for FabricSpecificDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerFabricSpecificDetails Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerInternal.FabricSpecificDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerPropertiesInternal)Property).FabricSpecificDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerPropertiesInternal)Property).FabricSpecificDetail = value; } + + /// Internal Acessors for FabricSpecificDetailInstanceType + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerInternal.FabricSpecificDetailInstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerPropertiesInternal)Property).FabricSpecificDetailInstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerPropertiesInternal)Property).FabricSpecificDetailInstanceType = value; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerProperties Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProtectionContainerProperties()); set { {_property = value;} } } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Id = value; } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Name = value; } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Type = value; } + + /// Resource Name + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Name; } + + /// The pairing status of this cloud. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string PairingStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerPropertiesInternal)Property).PairingStatus; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerPropertiesInternal)Property).PairingStatus = value ?? null; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerProperties _property; + + /// The custom data. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProtectionContainerProperties()); set => this._property = value; } + + /// Number of protected PEs. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public int? ProtectedItemCount { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerPropertiesInternal)Property).ProtectedItemCount; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerPropertiesInternal)Property).ProtectedItemCount = value ?? default(int); } + + /// The role of this cloud. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string Role { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerPropertiesInternal)Property).Role; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerPropertiesInternal)Property).Role = value ?? null; } + + /// Resource Type + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Type; } + + /// Creates an new instance. + public ProtectionContainer() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__resource), __resource); + await eventListener.AssertObjectIsValid(nameof(__resource), __resource); + } + } + /// Protection container details. + public partial interface IProtectionContainer : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResource + { + /// Fabric friendly name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Fabric friendly name.", + SerializedName = @"fabricFriendlyName", + PossibleTypes = new [] { typeof(string) })] + string FabricFriendlyName { get; set; } + /// Gets the class type. Overridden in derived classes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets the class type. Overridden in derived classes.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string FabricSpecificDetailInstanceType { get; } + /// The fabric type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The fabric type.", + SerializedName = @"fabricType", + PossibleTypes = new [] { typeof(string) })] + string FabricType { get; set; } + /// The name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name.", + SerializedName = @"friendlyName", + PossibleTypes = new [] { typeof(string) })] + string FriendlyName { get; set; } + /// The pairing status of this cloud. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The pairing status of this cloud.", + SerializedName = @"pairingStatus", + PossibleTypes = new [] { typeof(string) })] + string PairingStatus { get; set; } + /// Number of protected PEs. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Number of protected PEs.", + SerializedName = @"protectedItemCount", + PossibleTypes = new [] { typeof(int) })] + int? ProtectedItemCount { get; set; } + /// The role of this cloud. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The role of this cloud.", + SerializedName = @"role", + PossibleTypes = new [] { typeof(string) })] + string Role { get; set; } + + } + /// Protection container details. + internal partial interface IProtectionContainerInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal + { + /// Fabric friendly name. + string FabricFriendlyName { get; set; } + /// Fabric specific details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerFabricSpecificDetails FabricSpecificDetail { get; set; } + /// Gets the class type. Overridden in derived classes. + string FabricSpecificDetailInstanceType { get; set; } + /// The fabric type. + string FabricType { get; set; } + /// The name. + string FriendlyName { get; set; } + /// The pairing status of this cloud. + string PairingStatus { get; set; } + /// The custom data. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerProperties Property { get; set; } + /// Number of protected PEs. + int? ProtectedItemCount { get; set; } + /// The role of this cloud. + string Role { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionContainer.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionContainer.json.cs new file mode 100644 index 000000000000..30f10205e541 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionContainer.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Protection container details. + public partial class ProtectionContainer + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainer. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainer. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainer FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new ProtectionContainer(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal ProtectionContainer(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __resource = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.Resource(json); + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProtectionContainerProperties.FromJson(__jsonProperties) : Property;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __resource?.ToJson(container, serializationMode); + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionContainerCollection.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionContainerCollection.PowerShell.cs new file mode 100644 index 000000000000..4e55f2aab0e3 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionContainerCollection.PowerShell.cs @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Protection Container collection. + [System.ComponentModel.TypeConverter(typeof(ProtectionContainerCollectionTypeConverter))] + public partial class ProtectionContainerCollection + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerCollection DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ProtectionContainerCollection(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerCollection DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ProtectionContainerCollection(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerCollection FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ProtectionContainerCollection(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainer[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProtectionContainerTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerCollectionInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerCollectionInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ProtectionContainerCollection(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainer[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProtectionContainerTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerCollectionInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerCollectionInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Protection Container collection. + [System.ComponentModel.TypeConverter(typeof(ProtectionContainerCollectionTypeConverter))] + public partial interface IProtectionContainerCollection + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionContainerCollection.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionContainerCollection.TypeConverter.cs new file mode 100644 index 000000000000..bef76358b1f9 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionContainerCollection.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ProtectionContainerCollectionTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerCollection ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerCollection).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ProtectionContainerCollection.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ProtectionContainerCollection.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ProtectionContainerCollection.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionContainerCollection.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionContainerCollection.cs new file mode 100644 index 000000000000..217916348902 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionContainerCollection.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Protection Container collection. + public partial class ProtectionContainerCollection : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerCollection, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerCollectionInternal + { + + /// Backing field for property. + private string _nextLink; + + /// The value of next link. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string NextLink { get => this._nextLink; set => this._nextLink = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainer[] _value; + + /// The Protection Container details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainer[] Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public ProtectionContainerCollection() + { + + } + } + /// Protection Container collection. + public partial interface IProtectionContainerCollection : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The value of next link. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The value of next link.", + SerializedName = @"nextLink", + PossibleTypes = new [] { typeof(string) })] + string NextLink { get; set; } + /// The Protection Container details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Protection Container details.", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainer) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainer[] Value { get; set; } + + } + /// Protection Container collection. + internal partial interface IProtectionContainerCollectionInternal + + { + /// The value of next link. + string NextLink { get; set; } + /// The Protection Container details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainer[] Value { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionContainerCollection.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionContainerCollection.json.cs new file mode 100644 index 000000000000..ffa6079ec864 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionContainerCollection.json.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Protection Container collection. + public partial class ProtectionContainerCollection + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerCollection. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerCollection. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerCollection FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new ProtectionContainerCollection(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal ProtectionContainerCollection(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainer) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProtectionContainer.FromJson(__u) )) ))() : null : Value;} + {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)NextLink;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._value) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._value ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("value",__w); + } + AddIf( null != (((object)this._nextLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionContainerFabricSpecificDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionContainerFabricSpecificDetails.PowerShell.cs new file mode 100644 index 000000000000..fb5d981fe544 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionContainerFabricSpecificDetails.PowerShell.cs @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Base class for fabric specific details of container. + [System.ComponentModel.TypeConverter(typeof(ProtectionContainerFabricSpecificDetailsTypeConverter))] + public partial class ProtectionContainerFabricSpecificDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerFabricSpecificDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ProtectionContainerFabricSpecificDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerFabricSpecificDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ProtectionContainerFabricSpecificDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json + /// string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerFabricSpecificDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ProtectionContainerFabricSpecificDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerFabricSpecificDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerFabricSpecificDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ProtectionContainerFabricSpecificDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerFabricSpecificDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerFabricSpecificDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Base class for fabric specific details of container. + [System.ComponentModel.TypeConverter(typeof(ProtectionContainerFabricSpecificDetailsTypeConverter))] + public partial interface IProtectionContainerFabricSpecificDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionContainerFabricSpecificDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionContainerFabricSpecificDetails.TypeConverter.cs new file mode 100644 index 000000000000..08d12dc5ec6b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionContainerFabricSpecificDetails.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ProtectionContainerFabricSpecificDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerFabricSpecificDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerFabricSpecificDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ProtectionContainerFabricSpecificDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ProtectionContainerFabricSpecificDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ProtectionContainerFabricSpecificDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionContainerFabricSpecificDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionContainerFabricSpecificDetails.cs new file mode 100644 index 000000000000..2bd1bdc13149 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionContainerFabricSpecificDetails.cs @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Base class for fabric specific details of container. + public partial class ProtectionContainerFabricSpecificDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerFabricSpecificDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerFabricSpecificDetailsInternal + { + + /// Backing field for property. + private string _instanceType; + + /// Gets the class type. Overridden in derived classes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string InstanceType { get => this._instanceType; } + + /// Internal Acessors for InstanceType + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerFabricSpecificDetailsInternal.InstanceType { get => this._instanceType; set { {_instanceType = value;} } } + + /// + /// Creates an new instance. + /// + public ProtectionContainerFabricSpecificDetails() + { + + } + } + /// Base class for fabric specific details of container. + public partial interface IProtectionContainerFabricSpecificDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// Gets the class type. Overridden in derived classes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets the class type. Overridden in derived classes.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string InstanceType { get; } + + } + /// Base class for fabric specific details of container. + internal partial interface IProtectionContainerFabricSpecificDetailsInternal + + { + /// Gets the class type. Overridden in derived classes. + string InstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionContainerFabricSpecificDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionContainerFabricSpecificDetails.json.cs new file mode 100644 index 000000000000..8beebac3d40e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionContainerFabricSpecificDetails.json.cs @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Base class for fabric specific details of container. + public partial class ProtectionContainerFabricSpecificDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerFabricSpecificDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerFabricSpecificDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerFabricSpecificDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new ProtectionContainerFabricSpecificDetails(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal ProtectionContainerFabricSpecificDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_instanceType = If( json?.PropertyT("instanceType"), out var __jsonInstanceType) ? (string)__jsonInstanceType : (string)InstanceType;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._instanceType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._instanceType.ToString()) : null, "instanceType" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionContainerMapping.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionContainerMapping.PowerShell.cs new file mode 100644 index 000000000000..16c06551437c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionContainerMapping.PowerShell.cs @@ -0,0 +1,274 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Protection container mapping object. + [System.ComponentModel.TypeConverter(typeof(ProtectionContainerMappingTypeConverter))] + public partial class ProtectionContainerMapping + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMapping DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ProtectionContainerMapping(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMapping DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ProtectionContainerMapping(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMapping FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ProtectionContainerMapping(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProtectionContainerMappingPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingProviderSpecificDetails) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProtectionContainerMappingProviderSpecificDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("TargetProtectionContainerId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingInternal)this).TargetProtectionContainerId = (string) content.GetValueForProperty("TargetProtectionContainerId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingInternal)this).TargetProtectionContainerId, global::System.Convert.ToString); + } + if (content.Contains("TargetProtectionContainerFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingInternal)this).TargetProtectionContainerFriendlyName = (string) content.GetValueForProperty("TargetProtectionContainerFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingInternal)this).TargetProtectionContainerFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("Health")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingInternal)this).Health = (string) content.GetValueForProperty("Health",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingInternal)this).Health, global::System.Convert.ToString); + } + if (content.Contains("HealthErrorDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingInternal)this).HealthErrorDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[]) content.GetValueForProperty("HealthErrorDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingInternal)this).HealthErrorDetail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("PolicyId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingInternal)this).PolicyId = (string) content.GetValueForProperty("PolicyId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingInternal)this).PolicyId, global::System.Convert.ToString); + } + if (content.Contains("State")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingInternal)this).State = (string) content.GetValueForProperty("State",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingInternal)this).State, global::System.Convert.ToString); + } + if (content.Contains("SourceProtectionContainerFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingInternal)this).SourceProtectionContainerFriendlyName = (string) content.GetValueForProperty("SourceProtectionContainerFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingInternal)this).SourceProtectionContainerFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("SourceFabricFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingInternal)this).SourceFabricFriendlyName = (string) content.GetValueForProperty("SourceFabricFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingInternal)this).SourceFabricFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("TargetFabricFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingInternal)this).TargetFabricFriendlyName = (string) content.GetValueForProperty("TargetFabricFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingInternal)this).TargetFabricFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("PolicyFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingInternal)this).PolicyFriendlyName = (string) content.GetValueForProperty("PolicyFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingInternal)this).PolicyFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ProtectionContainerMapping(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProtectionContainerMappingPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingProviderSpecificDetails) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProtectionContainerMappingProviderSpecificDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("TargetProtectionContainerId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingInternal)this).TargetProtectionContainerId = (string) content.GetValueForProperty("TargetProtectionContainerId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingInternal)this).TargetProtectionContainerId, global::System.Convert.ToString); + } + if (content.Contains("TargetProtectionContainerFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingInternal)this).TargetProtectionContainerFriendlyName = (string) content.GetValueForProperty("TargetProtectionContainerFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingInternal)this).TargetProtectionContainerFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("Health")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingInternal)this).Health = (string) content.GetValueForProperty("Health",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingInternal)this).Health, global::System.Convert.ToString); + } + if (content.Contains("HealthErrorDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingInternal)this).HealthErrorDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[]) content.GetValueForProperty("HealthErrorDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingInternal)this).HealthErrorDetail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("PolicyId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingInternal)this).PolicyId = (string) content.GetValueForProperty("PolicyId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingInternal)this).PolicyId, global::System.Convert.ToString); + } + if (content.Contains("State")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingInternal)this).State = (string) content.GetValueForProperty("State",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingInternal)this).State, global::System.Convert.ToString); + } + if (content.Contains("SourceProtectionContainerFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingInternal)this).SourceProtectionContainerFriendlyName = (string) content.GetValueForProperty("SourceProtectionContainerFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingInternal)this).SourceProtectionContainerFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("SourceFabricFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingInternal)this).SourceFabricFriendlyName = (string) content.GetValueForProperty("SourceFabricFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingInternal)this).SourceFabricFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("TargetFabricFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingInternal)this).TargetFabricFriendlyName = (string) content.GetValueForProperty("TargetFabricFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingInternal)this).TargetFabricFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("PolicyFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingInternal)this).PolicyFriendlyName = (string) content.GetValueForProperty("PolicyFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingInternal)this).PolicyFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Protection container mapping object. + [System.ComponentModel.TypeConverter(typeof(ProtectionContainerMappingTypeConverter))] + public partial interface IProtectionContainerMapping + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionContainerMapping.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionContainerMapping.TypeConverter.cs new file mode 100644 index 000000000000..5c0bf89a38a3 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionContainerMapping.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ProtectionContainerMappingTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMapping ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMapping).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ProtectionContainerMapping.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ProtectionContainerMapping.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ProtectionContainerMapping.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionContainerMapping.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionContainerMapping.cs new file mode 100644 index 000000000000..903c32286570 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionContainerMapping.cs @@ -0,0 +1,249 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Protection container mapping object. + public partial class ProtectionContainerMapping : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMapping, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResource __resource = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.Resource(); + + /// Health of pairing. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string Health { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingPropertiesInternal)Property).Health; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingPropertiesInternal)Property).Health = value ?? null; } + + /// Health error. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] HealthErrorDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingPropertiesInternal)Property).HealthErrorDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingPropertiesInternal)Property).HealthErrorDetail = value ?? null /* arrayOf */; } + + /// Resource Id + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Id; } + + /// Resource Location + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string Location { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Location; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Location = value ?? null; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingProperties Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProtectionContainerMappingProperties()); set { {_property = value;} } } + + /// Internal Acessors for ProviderSpecificDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingProviderSpecificDetails Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingInternal.ProviderSpecificDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingPropertiesInternal)Property).ProviderSpecificDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingPropertiesInternal)Property).ProviderSpecificDetail = value; } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Id = value; } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Name = value; } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Type = value; } + + /// Resource Name + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Name; } + + /// Friendly name of replication policy. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string PolicyFriendlyName { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingPropertiesInternal)Property).PolicyFriendlyName; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingPropertiesInternal)Property).PolicyFriendlyName = value ?? null; } + + /// Policy ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string PolicyId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingPropertiesInternal)Property).PolicyId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingPropertiesInternal)Property).PolicyId = value ?? null; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingProperties _property; + + /// The custom data. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProtectionContainerMappingProperties()); set => this._property = value; } + + /// Gets the class type. Overridden in derived classes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ProviderSpecificDetailInstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingPropertiesInternal)Property).ProviderSpecificDetailInstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingPropertiesInternal)Property).ProviderSpecificDetailInstanceType = value ?? null; } + + /// Friendly name of source fabric. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string SourceFabricFriendlyName { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingPropertiesInternal)Property).SourceFabricFriendlyName; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingPropertiesInternal)Property).SourceFabricFriendlyName = value ?? null; } + + /// Friendly name of source protection container. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string SourceProtectionContainerFriendlyName { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingPropertiesInternal)Property).SourceProtectionContainerFriendlyName; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingPropertiesInternal)Property).SourceProtectionContainerFriendlyName = value ?? null; } + + /// Association Status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string State { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingPropertiesInternal)Property).State; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingPropertiesInternal)Property).State = value ?? null; } + + /// Friendly name of target fabric. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string TargetFabricFriendlyName { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingPropertiesInternal)Property).TargetFabricFriendlyName; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingPropertiesInternal)Property).TargetFabricFriendlyName = value ?? null; } + + /// Friendly name of paired container. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string TargetProtectionContainerFriendlyName { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingPropertiesInternal)Property).TargetProtectionContainerFriendlyName; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingPropertiesInternal)Property).TargetProtectionContainerFriendlyName = value ?? null; } + + /// Paired protection container ARM ID. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string TargetProtectionContainerId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingPropertiesInternal)Property).TargetProtectionContainerId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingPropertiesInternal)Property).TargetProtectionContainerId = value ?? null; } + + /// Resource Type + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Type; } + + /// Creates an new instance. + public ProtectionContainerMapping() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__resource), __resource); + await eventListener.AssertObjectIsValid(nameof(__resource), __resource); + } + } + /// Protection container mapping object. + public partial interface IProtectionContainerMapping : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResource + { + /// Health of pairing. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Health of pairing.", + SerializedName = @"health", + PossibleTypes = new [] { typeof(string) })] + string Health { get; set; } + /// Health error. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Health error.", + SerializedName = @"healthErrorDetails", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] HealthErrorDetail { get; set; } + /// Friendly name of replication policy. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Friendly name of replication policy.", + SerializedName = @"policyFriendlyName", + PossibleTypes = new [] { typeof(string) })] + string PolicyFriendlyName { get; set; } + /// Policy ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Policy ARM Id.", + SerializedName = @"policyId", + PossibleTypes = new [] { typeof(string) })] + string PolicyId { get; set; } + /// Gets the class type. Overridden in derived classes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets the class type. Overridden in derived classes.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string ProviderSpecificDetailInstanceType { get; set; } + /// Friendly name of source fabric. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Friendly name of source fabric.", + SerializedName = @"sourceFabricFriendlyName", + PossibleTypes = new [] { typeof(string) })] + string SourceFabricFriendlyName { get; set; } + /// Friendly name of source protection container. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Friendly name of source protection container.", + SerializedName = @"sourceProtectionContainerFriendlyName", + PossibleTypes = new [] { typeof(string) })] + string SourceProtectionContainerFriendlyName { get; set; } + /// Association Status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Association Status.", + SerializedName = @"state", + PossibleTypes = new [] { typeof(string) })] + string State { get; set; } + /// Friendly name of target fabric. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Friendly name of target fabric.", + SerializedName = @"targetFabricFriendlyName", + PossibleTypes = new [] { typeof(string) })] + string TargetFabricFriendlyName { get; set; } + /// Friendly name of paired container. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Friendly name of paired container.", + SerializedName = @"targetProtectionContainerFriendlyName", + PossibleTypes = new [] { typeof(string) })] + string TargetProtectionContainerFriendlyName { get; set; } + /// Paired protection container ARM ID. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Paired protection container ARM ID.", + SerializedName = @"targetProtectionContainerId", + PossibleTypes = new [] { typeof(string) })] + string TargetProtectionContainerId { get; set; } + + } + /// Protection container mapping object. + internal partial interface IProtectionContainerMappingInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal + { + /// Health of pairing. + string Health { get; set; } + /// Health error. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] HealthErrorDetail { get; set; } + /// Friendly name of replication policy. + string PolicyFriendlyName { get; set; } + /// Policy ARM Id. + string PolicyId { get; set; } + /// The custom data. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingProperties Property { get; set; } + /// Provider specific provider details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingProviderSpecificDetails ProviderSpecificDetail { get; set; } + /// Gets the class type. Overridden in derived classes. + string ProviderSpecificDetailInstanceType { get; set; } + /// Friendly name of source fabric. + string SourceFabricFriendlyName { get; set; } + /// Friendly name of source protection container. + string SourceProtectionContainerFriendlyName { get; set; } + /// Association Status. + string State { get; set; } + /// Friendly name of target fabric. + string TargetFabricFriendlyName { get; set; } + /// Friendly name of paired container. + string TargetProtectionContainerFriendlyName { get; set; } + /// Paired protection container ARM ID. + string TargetProtectionContainerId { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionContainerMapping.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionContainerMapping.json.cs new file mode 100644 index 000000000000..770635059631 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionContainerMapping.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Protection container mapping object. + public partial class ProtectionContainerMapping + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMapping. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMapping. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMapping FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new ProtectionContainerMapping(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal ProtectionContainerMapping(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __resource = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.Resource(json); + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProtectionContainerMappingProperties.FromJson(__jsonProperties) : Property;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __resource?.ToJson(container, serializationMode); + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionContainerMappingCollection.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionContainerMappingCollection.PowerShell.cs new file mode 100644 index 000000000000..871bbf4a5e5d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionContainerMappingCollection.PowerShell.cs @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Protection container mapping collection class. + [System.ComponentModel.TypeConverter(typeof(ProtectionContainerMappingCollectionTypeConverter))] + public partial class ProtectionContainerMappingCollection + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingCollection DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ProtectionContainerMappingCollection(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingCollection DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ProtectionContainerMappingCollection(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingCollection FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ProtectionContainerMappingCollection(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMapping[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProtectionContainerMappingTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingCollectionInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingCollectionInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ProtectionContainerMappingCollection(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMapping[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProtectionContainerMappingTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingCollectionInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingCollectionInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Protection container mapping collection class. + [System.ComponentModel.TypeConverter(typeof(ProtectionContainerMappingCollectionTypeConverter))] + public partial interface IProtectionContainerMappingCollection + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionContainerMappingCollection.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionContainerMappingCollection.TypeConverter.cs new file mode 100644 index 000000000000..7e6f6d8b4f71 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionContainerMappingCollection.TypeConverter.cs @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ProtectionContainerMappingCollectionTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingCollection ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingCollection).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ProtectionContainerMappingCollection.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ProtectionContainerMappingCollection.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ProtectionContainerMappingCollection.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionContainerMappingCollection.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionContainerMappingCollection.cs new file mode 100644 index 000000000000..f84ede4f1368 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionContainerMappingCollection.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Protection container mapping collection class. + public partial class ProtectionContainerMappingCollection : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingCollection, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingCollectionInternal + { + + /// Backing field for property. + private string _nextLink; + + /// Link to fetch rest of the data. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string NextLink { get => this._nextLink; set => this._nextLink = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMapping[] _value; + + /// List of container mappings. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMapping[] Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public ProtectionContainerMappingCollection() + { + + } + } + /// Protection container mapping collection class. + public partial interface IProtectionContainerMappingCollection : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// Link to fetch rest of the data. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Link to fetch rest of the data.", + SerializedName = @"nextLink", + PossibleTypes = new [] { typeof(string) })] + string NextLink { get; set; } + /// List of container mappings. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"List of container mappings.", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMapping) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMapping[] Value { get; set; } + + } + /// Protection container mapping collection class. + internal partial interface IProtectionContainerMappingCollectionInternal + + { + /// Link to fetch rest of the data. + string NextLink { get; set; } + /// List of container mappings. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMapping[] Value { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionContainerMappingCollection.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionContainerMappingCollection.json.cs new file mode 100644 index 000000000000..2820ee48cd08 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionContainerMappingCollection.json.cs @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Protection container mapping collection class. + public partial class ProtectionContainerMappingCollection + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingCollection. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingCollection. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingCollection FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new ProtectionContainerMappingCollection(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal ProtectionContainerMappingCollection(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMapping) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProtectionContainerMapping.FromJson(__u) )) ))() : null : Value;} + {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)NextLink;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._value) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._value ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("value",__w); + } + AddIf( null != (((object)this._nextLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionContainerMappingProperties.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionContainerMappingProperties.PowerShell.cs new file mode 100644 index 000000000000..4562f7dc0fb9 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionContainerMappingProperties.PowerShell.cs @@ -0,0 +1,236 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Protection container mapping properties. + [System.ComponentModel.TypeConverter(typeof(ProtectionContainerMappingPropertiesTypeConverter))] + public partial class ProtectionContainerMappingProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ProtectionContainerMappingProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ProtectionContainerMappingProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ProtectionContainerMappingProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingPropertiesInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingProviderSpecificDetails) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingPropertiesInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProtectionContainerMappingProviderSpecificDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("TargetProtectionContainerId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingPropertiesInternal)this).TargetProtectionContainerId = (string) content.GetValueForProperty("TargetProtectionContainerId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingPropertiesInternal)this).TargetProtectionContainerId, global::System.Convert.ToString); + } + if (content.Contains("TargetProtectionContainerFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingPropertiesInternal)this).TargetProtectionContainerFriendlyName = (string) content.GetValueForProperty("TargetProtectionContainerFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingPropertiesInternal)this).TargetProtectionContainerFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("Health")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingPropertiesInternal)this).Health = (string) content.GetValueForProperty("Health",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingPropertiesInternal)this).Health, global::System.Convert.ToString); + } + if (content.Contains("HealthErrorDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingPropertiesInternal)this).HealthErrorDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[]) content.GetValueForProperty("HealthErrorDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingPropertiesInternal)this).HealthErrorDetail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("PolicyId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingPropertiesInternal)this).PolicyId = (string) content.GetValueForProperty("PolicyId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingPropertiesInternal)this).PolicyId, global::System.Convert.ToString); + } + if (content.Contains("State")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingPropertiesInternal)this).State = (string) content.GetValueForProperty("State",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingPropertiesInternal)this).State, global::System.Convert.ToString); + } + if (content.Contains("SourceProtectionContainerFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingPropertiesInternal)this).SourceProtectionContainerFriendlyName = (string) content.GetValueForProperty("SourceProtectionContainerFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingPropertiesInternal)this).SourceProtectionContainerFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("SourceFabricFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingPropertiesInternal)this).SourceFabricFriendlyName = (string) content.GetValueForProperty("SourceFabricFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingPropertiesInternal)this).SourceFabricFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("TargetFabricFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingPropertiesInternal)this).TargetFabricFriendlyName = (string) content.GetValueForProperty("TargetFabricFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingPropertiesInternal)this).TargetFabricFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("PolicyFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingPropertiesInternal)this).PolicyFriendlyName = (string) content.GetValueForProperty("PolicyFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingPropertiesInternal)this).PolicyFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingPropertiesInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingPropertiesInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ProtectionContainerMappingProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingPropertiesInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingProviderSpecificDetails) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingPropertiesInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProtectionContainerMappingProviderSpecificDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("TargetProtectionContainerId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingPropertiesInternal)this).TargetProtectionContainerId = (string) content.GetValueForProperty("TargetProtectionContainerId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingPropertiesInternal)this).TargetProtectionContainerId, global::System.Convert.ToString); + } + if (content.Contains("TargetProtectionContainerFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingPropertiesInternal)this).TargetProtectionContainerFriendlyName = (string) content.GetValueForProperty("TargetProtectionContainerFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingPropertiesInternal)this).TargetProtectionContainerFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("Health")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingPropertiesInternal)this).Health = (string) content.GetValueForProperty("Health",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingPropertiesInternal)this).Health, global::System.Convert.ToString); + } + if (content.Contains("HealthErrorDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingPropertiesInternal)this).HealthErrorDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[]) content.GetValueForProperty("HealthErrorDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingPropertiesInternal)this).HealthErrorDetail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("PolicyId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingPropertiesInternal)this).PolicyId = (string) content.GetValueForProperty("PolicyId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingPropertiesInternal)this).PolicyId, global::System.Convert.ToString); + } + if (content.Contains("State")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingPropertiesInternal)this).State = (string) content.GetValueForProperty("State",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingPropertiesInternal)this).State, global::System.Convert.ToString); + } + if (content.Contains("SourceProtectionContainerFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingPropertiesInternal)this).SourceProtectionContainerFriendlyName = (string) content.GetValueForProperty("SourceProtectionContainerFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingPropertiesInternal)this).SourceProtectionContainerFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("SourceFabricFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingPropertiesInternal)this).SourceFabricFriendlyName = (string) content.GetValueForProperty("SourceFabricFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingPropertiesInternal)this).SourceFabricFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("TargetFabricFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingPropertiesInternal)this).TargetFabricFriendlyName = (string) content.GetValueForProperty("TargetFabricFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingPropertiesInternal)this).TargetFabricFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("PolicyFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingPropertiesInternal)this).PolicyFriendlyName = (string) content.GetValueForProperty("PolicyFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingPropertiesInternal)this).PolicyFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingPropertiesInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingPropertiesInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Protection container mapping properties. + [System.ComponentModel.TypeConverter(typeof(ProtectionContainerMappingPropertiesTypeConverter))] + public partial interface IProtectionContainerMappingProperties + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionContainerMappingProperties.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionContainerMappingProperties.TypeConverter.cs new file mode 100644 index 000000000000..c4126efadfe3 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionContainerMappingProperties.TypeConverter.cs @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ProtectionContainerMappingPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ProtectionContainerMappingProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ProtectionContainerMappingProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ProtectionContainerMappingProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionContainerMappingProperties.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionContainerMappingProperties.cs new file mode 100644 index 000000000000..24129320809b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionContainerMappingProperties.cs @@ -0,0 +1,234 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Protection container mapping properties. + public partial class ProtectionContainerMappingProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingProperties, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingPropertiesInternal + { + + /// Backing field for property. + private string _health; + + /// Health of pairing. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Health { get => this._health; set => this._health = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] _healthErrorDetail; + + /// Health error. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] HealthErrorDetail { get => this._healthErrorDetail; set => this._healthErrorDetail = value; } + + /// Internal Acessors for ProviderSpecificDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingProviderSpecificDetails Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingPropertiesInternal.ProviderSpecificDetail { get => (this._providerSpecificDetail = this._providerSpecificDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProtectionContainerMappingProviderSpecificDetails()); set { {_providerSpecificDetail = value;} } } + + /// Backing field for property. + private string _policyFriendlyName; + + /// Friendly name of replication policy. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string PolicyFriendlyName { get => this._policyFriendlyName; set => this._policyFriendlyName = value; } + + /// Backing field for property. + private string _policyId; + + /// Policy ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string PolicyId { get => this._policyId; set => this._policyId = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingProviderSpecificDetails _providerSpecificDetail; + + /// Provider specific provider details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingProviderSpecificDetails ProviderSpecificDetail { get => (this._providerSpecificDetail = this._providerSpecificDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProtectionContainerMappingProviderSpecificDetails()); set => this._providerSpecificDetail = value; } + + /// Gets the class type. Overridden in derived classes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ProviderSpecificDetailInstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingProviderSpecificDetailsInternal)ProviderSpecificDetail).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingProviderSpecificDetailsInternal)ProviderSpecificDetail).InstanceType = value ?? null; } + + /// Backing field for property. + private string _sourceFabricFriendlyName; + + /// Friendly name of source fabric. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string SourceFabricFriendlyName { get => this._sourceFabricFriendlyName; set => this._sourceFabricFriendlyName = value; } + + /// + /// Backing field for property. + /// + private string _sourceProtectionContainerFriendlyName; + + /// Friendly name of source protection container. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string SourceProtectionContainerFriendlyName { get => this._sourceProtectionContainerFriendlyName; set => this._sourceProtectionContainerFriendlyName = value; } + + /// Backing field for property. + private string _state; + + /// Association Status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string State { get => this._state; set => this._state = value; } + + /// Backing field for property. + private string _targetFabricFriendlyName; + + /// Friendly name of target fabric. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetFabricFriendlyName { get => this._targetFabricFriendlyName; set => this._targetFabricFriendlyName = value; } + + /// + /// Backing field for property. + /// + private string _targetProtectionContainerFriendlyName; + + /// Friendly name of paired container. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetProtectionContainerFriendlyName { get => this._targetProtectionContainerFriendlyName; set => this._targetProtectionContainerFriendlyName = value; } + + /// Backing field for property. + private string _targetProtectionContainerId; + + /// Paired protection container ARM ID. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetProtectionContainerId { get => this._targetProtectionContainerId; set => this._targetProtectionContainerId = value; } + + /// Creates an new instance. + public ProtectionContainerMappingProperties() + { + + } + } + /// Protection container mapping properties. + public partial interface IProtectionContainerMappingProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// Health of pairing. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Health of pairing.", + SerializedName = @"health", + PossibleTypes = new [] { typeof(string) })] + string Health { get; set; } + /// Health error. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Health error.", + SerializedName = @"healthErrorDetails", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] HealthErrorDetail { get; set; } + /// Friendly name of replication policy. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Friendly name of replication policy.", + SerializedName = @"policyFriendlyName", + PossibleTypes = new [] { typeof(string) })] + string PolicyFriendlyName { get; set; } + /// Policy ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Policy ARM Id.", + SerializedName = @"policyId", + PossibleTypes = new [] { typeof(string) })] + string PolicyId { get; set; } + /// Gets the class type. Overridden in derived classes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets the class type. Overridden in derived classes.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string ProviderSpecificDetailInstanceType { get; set; } + /// Friendly name of source fabric. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Friendly name of source fabric.", + SerializedName = @"sourceFabricFriendlyName", + PossibleTypes = new [] { typeof(string) })] + string SourceFabricFriendlyName { get; set; } + /// Friendly name of source protection container. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Friendly name of source protection container.", + SerializedName = @"sourceProtectionContainerFriendlyName", + PossibleTypes = new [] { typeof(string) })] + string SourceProtectionContainerFriendlyName { get; set; } + /// Association Status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Association Status.", + SerializedName = @"state", + PossibleTypes = new [] { typeof(string) })] + string State { get; set; } + /// Friendly name of target fabric. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Friendly name of target fabric.", + SerializedName = @"targetFabricFriendlyName", + PossibleTypes = new [] { typeof(string) })] + string TargetFabricFriendlyName { get; set; } + /// Friendly name of paired container. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Friendly name of paired container.", + SerializedName = @"targetProtectionContainerFriendlyName", + PossibleTypes = new [] { typeof(string) })] + string TargetProtectionContainerFriendlyName { get; set; } + /// Paired protection container ARM ID. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Paired protection container ARM ID.", + SerializedName = @"targetProtectionContainerId", + PossibleTypes = new [] { typeof(string) })] + string TargetProtectionContainerId { get; set; } + + } + /// Protection container mapping properties. + internal partial interface IProtectionContainerMappingPropertiesInternal + + { + /// Health of pairing. + string Health { get; set; } + /// Health error. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] HealthErrorDetail { get; set; } + /// Friendly name of replication policy. + string PolicyFriendlyName { get; set; } + /// Policy ARM Id. + string PolicyId { get; set; } + /// Provider specific provider details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingProviderSpecificDetails ProviderSpecificDetail { get; set; } + /// Gets the class type. Overridden in derived classes. + string ProviderSpecificDetailInstanceType { get; set; } + /// Friendly name of source fabric. + string SourceFabricFriendlyName { get; set; } + /// Friendly name of source protection container. + string SourceProtectionContainerFriendlyName { get; set; } + /// Association Status. + string State { get; set; } + /// Friendly name of target fabric. + string TargetFabricFriendlyName { get; set; } + /// Friendly name of paired container. + string TargetProtectionContainerFriendlyName { get; set; } + /// Paired protection container ARM ID. + string TargetProtectionContainerId { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionContainerMappingProperties.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionContainerMappingProperties.json.cs new file mode 100644 index 000000000000..fe63f420ffa2 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionContainerMappingProperties.json.cs @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Protection container mapping properties. + public partial class ProtectionContainerMappingProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new ProtectionContainerMappingProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal ProtectionContainerMappingProperties(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_providerSpecificDetail = If( json?.PropertyT("providerSpecificDetails"), out var __jsonProviderSpecificDetails) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProtectionContainerMappingProviderSpecificDetails.FromJson(__jsonProviderSpecificDetails) : ProviderSpecificDetail;} + {_targetProtectionContainerId = If( json?.PropertyT("targetProtectionContainerId"), out var __jsonTargetProtectionContainerId) ? (string)__jsonTargetProtectionContainerId : (string)TargetProtectionContainerId;} + {_targetProtectionContainerFriendlyName = If( json?.PropertyT("targetProtectionContainerFriendlyName"), out var __jsonTargetProtectionContainerFriendlyName) ? (string)__jsonTargetProtectionContainerFriendlyName : (string)TargetProtectionContainerFriendlyName;} + {_health = If( json?.PropertyT("health"), out var __jsonHealth) ? (string)__jsonHealth : (string)Health;} + {_healthErrorDetail = If( json?.PropertyT("healthErrorDetails"), out var __jsonHealthErrorDetails) ? If( __jsonHealthErrorDetails as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthError.FromJson(__u) )) ))() : null : HealthErrorDetail;} + {_policyId = If( json?.PropertyT("policyId"), out var __jsonPolicyId) ? (string)__jsonPolicyId : (string)PolicyId;} + {_state = If( json?.PropertyT("state"), out var __jsonState) ? (string)__jsonState : (string)State;} + {_sourceProtectionContainerFriendlyName = If( json?.PropertyT("sourceProtectionContainerFriendlyName"), out var __jsonSourceProtectionContainerFriendlyName) ? (string)__jsonSourceProtectionContainerFriendlyName : (string)SourceProtectionContainerFriendlyName;} + {_sourceFabricFriendlyName = If( json?.PropertyT("sourceFabricFriendlyName"), out var __jsonSourceFabricFriendlyName) ? (string)__jsonSourceFabricFriendlyName : (string)SourceFabricFriendlyName;} + {_targetFabricFriendlyName = If( json?.PropertyT("targetFabricFriendlyName"), out var __jsonTargetFabricFriendlyName) ? (string)__jsonTargetFabricFriendlyName : (string)TargetFabricFriendlyName;} + {_policyFriendlyName = If( json?.PropertyT("policyFriendlyName"), out var __jsonPolicyFriendlyName) ? (string)__jsonPolicyFriendlyName : (string)PolicyFriendlyName;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._providerSpecificDetail ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._providerSpecificDetail.ToJson(null,serializationMode) : null, "providerSpecificDetails" ,container.Add ); + AddIf( null != (((object)this._targetProtectionContainerId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetProtectionContainerId.ToString()) : null, "targetProtectionContainerId" ,container.Add ); + AddIf( null != (((object)this._targetProtectionContainerFriendlyName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetProtectionContainerFriendlyName.ToString()) : null, "targetProtectionContainerFriendlyName" ,container.Add ); + AddIf( null != (((object)this._health)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._health.ToString()) : null, "health" ,container.Add ); + if (null != this._healthErrorDetail) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._healthErrorDetail ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("healthErrorDetails",__w); + } + AddIf( null != (((object)this._policyId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._policyId.ToString()) : null, "policyId" ,container.Add ); + AddIf( null != (((object)this._state)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._state.ToString()) : null, "state" ,container.Add ); + AddIf( null != (((object)this._sourceProtectionContainerFriendlyName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._sourceProtectionContainerFriendlyName.ToString()) : null, "sourceProtectionContainerFriendlyName" ,container.Add ); + AddIf( null != (((object)this._sourceFabricFriendlyName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._sourceFabricFriendlyName.ToString()) : null, "sourceFabricFriendlyName" ,container.Add ); + AddIf( null != (((object)this._targetFabricFriendlyName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetFabricFriendlyName.ToString()) : null, "targetFabricFriendlyName" ,container.Add ); + AddIf( null != (((object)this._policyFriendlyName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._policyFriendlyName.ToString()) : null, "policyFriendlyName" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionContainerMappingProviderSpecificDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionContainerMappingProviderSpecificDetails.PowerShell.cs new file mode 100644 index 000000000000..7af451af93e3 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionContainerMappingProviderSpecificDetails.PowerShell.cs @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Container mapping provider specific details. + [System.ComponentModel.TypeConverter(typeof(ProtectionContainerMappingProviderSpecificDetailsTypeConverter))] + public partial class ProtectionContainerMappingProviderSpecificDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingProviderSpecificDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ProtectionContainerMappingProviderSpecificDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingProviderSpecificDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ProtectionContainerMappingProviderSpecificDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content + /// from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingProviderSpecificDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ProtectionContainerMappingProviderSpecificDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingProviderSpecificDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingProviderSpecificDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ProtectionContainerMappingProviderSpecificDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingProviderSpecificDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingProviderSpecificDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Container mapping provider specific details. + [System.ComponentModel.TypeConverter(typeof(ProtectionContainerMappingProviderSpecificDetailsTypeConverter))] + public partial interface IProtectionContainerMappingProviderSpecificDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionContainerMappingProviderSpecificDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionContainerMappingProviderSpecificDetails.TypeConverter.cs new file mode 100644 index 000000000000..8094737db944 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionContainerMappingProviderSpecificDetails.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ProtectionContainerMappingProviderSpecificDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, + /// otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingProviderSpecificDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingProviderSpecificDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ProtectionContainerMappingProviderSpecificDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ProtectionContainerMappingProviderSpecificDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ProtectionContainerMappingProviderSpecificDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionContainerMappingProviderSpecificDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionContainerMappingProviderSpecificDetails.cs new file mode 100644 index 000000000000..119ed1ebc658 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionContainerMappingProviderSpecificDetails.cs @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Container mapping provider specific details. + public partial class ProtectionContainerMappingProviderSpecificDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingProviderSpecificDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingProviderSpecificDetailsInternal + { + + /// Backing field for property. + private string _instanceType; + + /// Gets the class type. Overridden in derived classes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string InstanceType { get => this._instanceType; set => this._instanceType = value; } + + /// + /// Creates an new instance. + /// + public ProtectionContainerMappingProviderSpecificDetails() + { + + } + } + /// Container mapping provider specific details. + public partial interface IProtectionContainerMappingProviderSpecificDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// Gets the class type. Overridden in derived classes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets the class type. Overridden in derived classes.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string InstanceType { get; set; } + + } + /// Container mapping provider specific details. + internal partial interface IProtectionContainerMappingProviderSpecificDetailsInternal + + { + /// Gets the class type. Overridden in derived classes. + string InstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionContainerMappingProviderSpecificDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionContainerMappingProviderSpecificDetails.json.cs new file mode 100644 index 000000000000..7b5a6276c4f9 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionContainerMappingProviderSpecificDetails.json.cs @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Container mapping provider specific details. + public partial class ProtectionContainerMappingProviderSpecificDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingProviderSpecificDetails. + /// Note: the Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingProviderSpecificDetails + /// interface is polymorphic, and the precise model class that will get deserialized is determined at runtime based on the + /// payload. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingProviderSpecificDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingProviderSpecificDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + if (!(node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json)) + { + return null; + } + // Polymorphic type -- select the appropriate constructor using the discriminator + + switch ( json.StringProperty("instanceType") ) + { + case "A2A": + { + return new A2AProtectionContainerMappingDetails(json); + } + case "InMageRcm": + { + return new InMageRcmProtectionContainerMappingDetails(json); + } + case "VMwareCbt": + { + return new VMwareCbtProtectionContainerMappingDetails(json); + } + } + return new ProtectionContainerMappingProviderSpecificDetails(json); + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal ProtectionContainerMappingProviderSpecificDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_instanceType = If( json?.PropertyT("instanceType"), out var __jsonInstanceType) ? (string)__jsonInstanceType : (string)InstanceType;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._instanceType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._instanceType.ToString()) : null, "instanceType" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionContainerProperties.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionContainerProperties.PowerShell.cs new file mode 100644 index 000000000000..7dbc60ec5de8 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionContainerProperties.PowerShell.cs @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Protection profile custom data details. + [System.ComponentModel.TypeConverter(typeof(ProtectionContainerPropertiesTypeConverter))] + public partial class ProtectionContainerProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ProtectionContainerProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ProtectionContainerProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ProtectionContainerProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("FabricSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerPropertiesInternal)this).FabricSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerFabricSpecificDetails) content.GetValueForProperty("FabricSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerPropertiesInternal)this).FabricSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProtectionContainerFabricSpecificDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("FabricFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerPropertiesInternal)this).FabricFriendlyName = (string) content.GetValueForProperty("FabricFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerPropertiesInternal)this).FabricFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("FriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerPropertiesInternal)this).FriendlyName = (string) content.GetValueForProperty("FriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerPropertiesInternal)this).FriendlyName, global::System.Convert.ToString); + } + if (content.Contains("FabricType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerPropertiesInternal)this).FabricType = (string) content.GetValueForProperty("FabricType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerPropertiesInternal)this).FabricType, global::System.Convert.ToString); + } + if (content.Contains("ProtectedItemCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerPropertiesInternal)this).ProtectedItemCount = (int?) content.GetValueForProperty("ProtectedItemCount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerPropertiesInternal)this).ProtectedItemCount, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("PairingStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerPropertiesInternal)this).PairingStatus = (string) content.GetValueForProperty("PairingStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerPropertiesInternal)this).PairingStatus, global::System.Convert.ToString); + } + if (content.Contains("Role")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerPropertiesInternal)this).Role = (string) content.GetValueForProperty("Role",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerPropertiesInternal)this).Role, global::System.Convert.ToString); + } + if (content.Contains("FabricSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerPropertiesInternal)this).FabricSpecificDetailInstanceType = (string) content.GetValueForProperty("FabricSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerPropertiesInternal)this).FabricSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ProtectionContainerProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("FabricSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerPropertiesInternal)this).FabricSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerFabricSpecificDetails) content.GetValueForProperty("FabricSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerPropertiesInternal)this).FabricSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProtectionContainerFabricSpecificDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("FabricFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerPropertiesInternal)this).FabricFriendlyName = (string) content.GetValueForProperty("FabricFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerPropertiesInternal)this).FabricFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("FriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerPropertiesInternal)this).FriendlyName = (string) content.GetValueForProperty("FriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerPropertiesInternal)this).FriendlyName, global::System.Convert.ToString); + } + if (content.Contains("FabricType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerPropertiesInternal)this).FabricType = (string) content.GetValueForProperty("FabricType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerPropertiesInternal)this).FabricType, global::System.Convert.ToString); + } + if (content.Contains("ProtectedItemCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerPropertiesInternal)this).ProtectedItemCount = (int?) content.GetValueForProperty("ProtectedItemCount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerPropertiesInternal)this).ProtectedItemCount, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("PairingStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerPropertiesInternal)this).PairingStatus = (string) content.GetValueForProperty("PairingStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerPropertiesInternal)this).PairingStatus, global::System.Convert.ToString); + } + if (content.Contains("Role")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerPropertiesInternal)this).Role = (string) content.GetValueForProperty("Role",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerPropertiesInternal)this).Role, global::System.Convert.ToString); + } + if (content.Contains("FabricSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerPropertiesInternal)this).FabricSpecificDetailInstanceType = (string) content.GetValueForProperty("FabricSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerPropertiesInternal)this).FabricSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Protection profile custom data details. + [System.ComponentModel.TypeConverter(typeof(ProtectionContainerPropertiesTypeConverter))] + public partial interface IProtectionContainerProperties + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionContainerProperties.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionContainerProperties.TypeConverter.cs new file mode 100644 index 000000000000..e472fd33d456 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionContainerProperties.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ProtectionContainerPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ProtectionContainerProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ProtectionContainerProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ProtectionContainerProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionContainerProperties.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionContainerProperties.cs new file mode 100644 index 000000000000..070ce0a1f9f2 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionContainerProperties.cs @@ -0,0 +1,165 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Protection profile custom data details. + public partial class ProtectionContainerProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerProperties, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerPropertiesInternal + { + + /// Backing field for property. + private string _fabricFriendlyName; + + /// Fabric friendly name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string FabricFriendlyName { get => this._fabricFriendlyName; set => this._fabricFriendlyName = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerFabricSpecificDetails _fabricSpecificDetail; + + /// Fabric specific details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerFabricSpecificDetails FabricSpecificDetail { get => (this._fabricSpecificDetail = this._fabricSpecificDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProtectionContainerFabricSpecificDetails()); set => this._fabricSpecificDetail = value; } + + /// Gets the class type. Overridden in derived classes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string FabricSpecificDetailInstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerFabricSpecificDetailsInternal)FabricSpecificDetail).InstanceType; } + + /// Backing field for property. + private string _fabricType; + + /// The fabric type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string FabricType { get => this._fabricType; set => this._fabricType = value; } + + /// Backing field for property. + private string _friendlyName; + + /// The name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string FriendlyName { get => this._friendlyName; set => this._friendlyName = value; } + + /// Internal Acessors for FabricSpecificDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerFabricSpecificDetails Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerPropertiesInternal.FabricSpecificDetail { get => (this._fabricSpecificDetail = this._fabricSpecificDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProtectionContainerFabricSpecificDetails()); set { {_fabricSpecificDetail = value;} } } + + /// Internal Acessors for FabricSpecificDetailInstanceType + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerPropertiesInternal.FabricSpecificDetailInstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerFabricSpecificDetailsInternal)FabricSpecificDetail).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerFabricSpecificDetailsInternal)FabricSpecificDetail).InstanceType = value; } + + /// Backing field for property. + private string _pairingStatus; + + /// The pairing status of this cloud. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string PairingStatus { get => this._pairingStatus; set => this._pairingStatus = value; } + + /// Backing field for property. + private int? _protectedItemCount; + + /// Number of protected PEs. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? ProtectedItemCount { get => this._protectedItemCount; set => this._protectedItemCount = value; } + + /// Backing field for property. + private string _role; + + /// The role of this cloud. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Role { get => this._role; set => this._role = value; } + + /// Creates an new instance. + public ProtectionContainerProperties() + { + + } + } + /// Protection profile custom data details. + public partial interface IProtectionContainerProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// Fabric friendly name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Fabric friendly name.", + SerializedName = @"fabricFriendlyName", + PossibleTypes = new [] { typeof(string) })] + string FabricFriendlyName { get; set; } + /// Gets the class type. Overridden in derived classes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets the class type. Overridden in derived classes.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string FabricSpecificDetailInstanceType { get; } + /// The fabric type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The fabric type.", + SerializedName = @"fabricType", + PossibleTypes = new [] { typeof(string) })] + string FabricType { get; set; } + /// The name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name.", + SerializedName = @"friendlyName", + PossibleTypes = new [] { typeof(string) })] + string FriendlyName { get; set; } + /// The pairing status of this cloud. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The pairing status of this cloud.", + SerializedName = @"pairingStatus", + PossibleTypes = new [] { typeof(string) })] + string PairingStatus { get; set; } + /// Number of protected PEs. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Number of protected PEs.", + SerializedName = @"protectedItemCount", + PossibleTypes = new [] { typeof(int) })] + int? ProtectedItemCount { get; set; } + /// The role of this cloud. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The role of this cloud.", + SerializedName = @"role", + PossibleTypes = new [] { typeof(string) })] + string Role { get; set; } + + } + /// Protection profile custom data details. + internal partial interface IProtectionContainerPropertiesInternal + + { + /// Fabric friendly name. + string FabricFriendlyName { get; set; } + /// Fabric specific details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerFabricSpecificDetails FabricSpecificDetail { get; set; } + /// Gets the class type. Overridden in derived classes. + string FabricSpecificDetailInstanceType { get; set; } + /// The fabric type. + string FabricType { get; set; } + /// The name. + string FriendlyName { get; set; } + /// The pairing status of this cloud. + string PairingStatus { get; set; } + /// Number of protected PEs. + int? ProtectedItemCount { get; set; } + /// The role of this cloud. + string Role { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionContainerProperties.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionContainerProperties.json.cs new file mode 100644 index 000000000000..2da262125a86 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionContainerProperties.json.cs @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Protection profile custom data details. + public partial class ProtectionContainerProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new ProtectionContainerProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal ProtectionContainerProperties(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_fabricSpecificDetail = If( json?.PropertyT("fabricSpecificDetails"), out var __jsonFabricSpecificDetails) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProtectionContainerFabricSpecificDetails.FromJson(__jsonFabricSpecificDetails) : FabricSpecificDetail;} + {_fabricFriendlyName = If( json?.PropertyT("fabricFriendlyName"), out var __jsonFabricFriendlyName) ? (string)__jsonFabricFriendlyName : (string)FabricFriendlyName;} + {_friendlyName = If( json?.PropertyT("friendlyName"), out var __jsonFriendlyName) ? (string)__jsonFriendlyName : (string)FriendlyName;} + {_fabricType = If( json?.PropertyT("fabricType"), out var __jsonFabricType) ? (string)__jsonFabricType : (string)FabricType;} + {_protectedItemCount = If( json?.PropertyT("protectedItemCount"), out var __jsonProtectedItemCount) ? (int?)__jsonProtectedItemCount : ProtectedItemCount;} + {_pairingStatus = If( json?.PropertyT("pairingStatus"), out var __jsonPairingStatus) ? (string)__jsonPairingStatus : (string)PairingStatus;} + {_role = If( json?.PropertyT("role"), out var __jsonRole) ? (string)__jsonRole : (string)Role;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._fabricSpecificDetail ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._fabricSpecificDetail.ToJson(null,serializationMode) : null, "fabricSpecificDetails" ,container.Add ); + AddIf( null != (((object)this._fabricFriendlyName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._fabricFriendlyName.ToString()) : null, "fabricFriendlyName" ,container.Add ); + AddIf( null != (((object)this._friendlyName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._friendlyName.ToString()) : null, "friendlyName" ,container.Add ); + AddIf( null != (((object)this._fabricType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._fabricType.ToString()) : null, "fabricType" ,container.Add ); + AddIf( null != this._protectedItemCount ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._protectedItemCount) : null, "protectedItemCount" ,container.Add ); + AddIf( null != (((object)this._pairingStatus)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._pairingStatus.ToString()) : null, "pairingStatus" ,container.Add ); + AddIf( null != (((object)this._role)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._role.ToString()) : null, "role" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionProfileCustomDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionProfileCustomDetails.PowerShell.cs new file mode 100644 index 000000000000..6cc0ba1890ac --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionProfileCustomDetails.PowerShell.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Protection Profile custom input. + [System.ComponentModel.TypeConverter(typeof(ProtectionProfileCustomDetailsTypeConverter))] + public partial class ProtectionProfileCustomDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionProfileCustomDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ProtectionProfileCustomDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionProfileCustomDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ProtectionProfileCustomDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionProfileCustomDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ProtectionProfileCustomDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ResourceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionProfileCustomDetailsInternal)this).ResourceType = (string) content.GetValueForProperty("ResourceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionProfileCustomDetailsInternal)this).ResourceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ProtectionProfileCustomDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ResourceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionProfileCustomDetailsInternal)this).ResourceType = (string) content.GetValueForProperty("ResourceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionProfileCustomDetailsInternal)this).ResourceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Protection Profile custom input. + [System.ComponentModel.TypeConverter(typeof(ProtectionProfileCustomDetailsTypeConverter))] + public partial interface IProtectionProfileCustomDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionProfileCustomDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionProfileCustomDetails.TypeConverter.cs new file mode 100644 index 000000000000..aa59a5bf1c54 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionProfileCustomDetails.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ProtectionProfileCustomDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionProfileCustomDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionProfileCustomDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ProtectionProfileCustomDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ProtectionProfileCustomDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ProtectionProfileCustomDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionProfileCustomDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionProfileCustomDetails.cs new file mode 100644 index 000000000000..b695ca572087 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionProfileCustomDetails.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Protection Profile custom input. + public partial class ProtectionProfileCustomDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionProfileCustomDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionProfileCustomDetailsInternal + { + + /// Backing field for property. + private string _resourceType; + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ResourceType { get => this._resourceType; set => this._resourceType = value; } + + /// Creates an new instance. + public ProtectionProfileCustomDetails() + { + + } + } + /// Protection Profile custom input. + public partial interface IProtectionProfileCustomDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"resourceType", + PossibleTypes = new [] { typeof(string) })] + string ResourceType { get; set; } + + } + /// Protection Profile custom input. + internal partial interface IProtectionProfileCustomDetailsInternal + + { + /// The class type. + string ResourceType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionProfileCustomDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionProfileCustomDetails.json.cs new file mode 100644 index 000000000000..1aeef3869085 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProtectionProfileCustomDetails.json.cs @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Protection Profile custom input. + public partial class ProtectionProfileCustomDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionProfileCustomDetails. + /// Note: the Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionProfileCustomDetails interface is + /// polymorphic, and the precise model class that will get deserialized is determined at runtime based on the payload. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionProfileCustomDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionProfileCustomDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + if (!(node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json)) + { + return null; + } + // Polymorphic type -- select the appropriate constructor using the discriminator + + switch ( json.StringProperty("resourceType") ) + { + case "Existing": + { + return new ExistingProtectionProfile(json); + } + case "New": + { + return new NewProtectionProfile(json); + } + } + return new ProtectionProfileCustomDetails(json); + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal ProtectionProfileCustomDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_resourceType = If( json?.PropertyT("resourceType"), out var __jsonResourceType) ? (string)__jsonResourceType : (string)ResourceType;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._resourceType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._resourceType.ToString()) : null, "resourceType" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProviderError.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProviderError.PowerShell.cs new file mode 100644 index 000000000000..6de4e9b4b94c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProviderError.PowerShell.cs @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// This class contains the error details per object. + [System.ComponentModel.TypeConverter(typeof(ProviderErrorTypeConverter))] + public partial class ProviderError + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProviderError DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ProviderError(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProviderError DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ProviderError(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProviderError FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ProviderError(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ErrorCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProviderErrorInternal)this).ErrorCode = (int?) content.GetValueForProperty("ErrorCode",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProviderErrorInternal)this).ErrorCode, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("ErrorMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProviderErrorInternal)this).ErrorMessage = (string) content.GetValueForProperty("ErrorMessage",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProviderErrorInternal)this).ErrorMessage, global::System.Convert.ToString); + } + if (content.Contains("ErrorId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProviderErrorInternal)this).ErrorId = (string) content.GetValueForProperty("ErrorId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProviderErrorInternal)this).ErrorId, global::System.Convert.ToString); + } + if (content.Contains("PossibleCaus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProviderErrorInternal)this).PossibleCaus = (string) content.GetValueForProperty("PossibleCaus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProviderErrorInternal)this).PossibleCaus, global::System.Convert.ToString); + } + if (content.Contains("RecommendedAction")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProviderErrorInternal)this).RecommendedAction = (string) content.GetValueForProperty("RecommendedAction",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProviderErrorInternal)this).RecommendedAction, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ProviderError(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ErrorCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProviderErrorInternal)this).ErrorCode = (int?) content.GetValueForProperty("ErrorCode",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProviderErrorInternal)this).ErrorCode, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("ErrorMessage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProviderErrorInternal)this).ErrorMessage = (string) content.GetValueForProperty("ErrorMessage",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProviderErrorInternal)this).ErrorMessage, global::System.Convert.ToString); + } + if (content.Contains("ErrorId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProviderErrorInternal)this).ErrorId = (string) content.GetValueForProperty("ErrorId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProviderErrorInternal)this).ErrorId, global::System.Convert.ToString); + } + if (content.Contains("PossibleCaus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProviderErrorInternal)this).PossibleCaus = (string) content.GetValueForProperty("PossibleCaus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProviderErrorInternal)this).PossibleCaus, global::System.Convert.ToString); + } + if (content.Contains("RecommendedAction")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProviderErrorInternal)this).RecommendedAction = (string) content.GetValueForProperty("RecommendedAction",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProviderErrorInternal)this).RecommendedAction, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// This class contains the error details per object. + [System.ComponentModel.TypeConverter(typeof(ProviderErrorTypeConverter))] + public partial interface IProviderError + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProviderError.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProviderError.TypeConverter.cs new file mode 100644 index 000000000000..d9c23a74cf18 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProviderError.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ProviderErrorTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProviderError ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProviderError).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ProviderError.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ProviderError.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ProviderError.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProviderError.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProviderError.cs new file mode 100644 index 000000000000..c8b83a8a76de --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProviderError.cs @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// This class contains the error details per object. + public partial class ProviderError : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProviderError, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProviderErrorInternal + { + + /// Backing field for property. + private int? _errorCode; + + /// The Error code. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? ErrorCode { get => this._errorCode; set => this._errorCode = value; } + + /// Backing field for property. + private string _errorId; + + /// The Provider error Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ErrorId { get => this._errorId; set => this._errorId = value; } + + /// Backing field for property. + private string _errorMessage; + + /// The Error message. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ErrorMessage { get => this._errorMessage; set => this._errorMessage = value; } + + /// Backing field for property. + private string _possibleCaus; + + /// The possible causes for the error. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string PossibleCaus { get => this._possibleCaus; set => this._possibleCaus = value; } + + /// Backing field for property. + private string _recommendedAction; + + /// The recommended action to resolve the error. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecommendedAction { get => this._recommendedAction; set => this._recommendedAction = value; } + + /// Creates an new instance. + public ProviderError() + { + + } + } + /// This class contains the error details per object. + public partial interface IProviderError : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The Error code. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Error code.", + SerializedName = @"errorCode", + PossibleTypes = new [] { typeof(int) })] + int? ErrorCode { get; set; } + /// The Provider error Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Provider error Id.", + SerializedName = @"errorId", + PossibleTypes = new [] { typeof(string) })] + string ErrorId { get; set; } + /// The Error message. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Error message.", + SerializedName = @"errorMessage", + PossibleTypes = new [] { typeof(string) })] + string ErrorMessage { get; set; } + /// The possible causes for the error. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The possible causes for the error.", + SerializedName = @"possibleCauses", + PossibleTypes = new [] { typeof(string) })] + string PossibleCaus { get; set; } + /// The recommended action to resolve the error. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recommended action to resolve the error.", + SerializedName = @"recommendedAction", + PossibleTypes = new [] { typeof(string) })] + string RecommendedAction { get; set; } + + } + /// This class contains the error details per object. + internal partial interface IProviderErrorInternal + + { + /// The Error code. + int? ErrorCode { get; set; } + /// The Provider error Id. + string ErrorId { get; set; } + /// The Error message. + string ErrorMessage { get; set; } + /// The possible causes for the error. + string PossibleCaus { get; set; } + /// The recommended action to resolve the error. + string RecommendedAction { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProviderError.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProviderError.json.cs new file mode 100644 index 000000000000..8d58844a38fb --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProviderError.json.cs @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// This class contains the error details per object. + public partial class ProviderError + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProviderError. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProviderError. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProviderError FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new ProviderError(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal ProviderError(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_errorCode = If( json?.PropertyT("errorCode"), out var __jsonErrorCode) ? (int?)__jsonErrorCode : ErrorCode;} + {_errorMessage = If( json?.PropertyT("errorMessage"), out var __jsonErrorMessage) ? (string)__jsonErrorMessage : (string)ErrorMessage;} + {_errorId = If( json?.PropertyT("errorId"), out var __jsonErrorId) ? (string)__jsonErrorId : (string)ErrorId;} + {_possibleCaus = If( json?.PropertyT("possibleCauses"), out var __jsonPossibleCauses) ? (string)__jsonPossibleCauses : (string)PossibleCaus;} + {_recommendedAction = If( json?.PropertyT("recommendedAction"), out var __jsonRecommendedAction) ? (string)__jsonRecommendedAction : (string)RecommendedAction;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._errorCode ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._errorCode) : null, "errorCode" ,container.Add ); + AddIf( null != (((object)this._errorMessage)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._errorMessage.ToString()) : null, "errorMessage" ,container.Add ); + AddIf( null != (((object)this._errorId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._errorId.ToString()) : null, "errorId" ,container.Add ); + AddIf( null != (((object)this._possibleCaus)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._possibleCaus.ToString()) : null, "possibleCauses" ,container.Add ); + AddIf( null != (((object)this._recommendedAction)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recommendedAction.ToString()) : null, "recommendedAction" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProviderSpecificRecoveryPointDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProviderSpecificRecoveryPointDetails.PowerShell.cs new file mode 100644 index 000000000000..160651cb053f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProviderSpecificRecoveryPointDetails.PowerShell.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Replication provider specific recovery point details. + [System.ComponentModel.TypeConverter(typeof(ProviderSpecificRecoveryPointDetailsTypeConverter))] + public partial class ProviderSpecificRecoveryPointDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProviderSpecificRecoveryPointDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ProviderSpecificRecoveryPointDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProviderSpecificRecoveryPointDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ProviderSpecificRecoveryPointDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProviderSpecificRecoveryPointDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ProviderSpecificRecoveryPointDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProviderSpecificRecoveryPointDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProviderSpecificRecoveryPointDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ProviderSpecificRecoveryPointDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProviderSpecificRecoveryPointDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProviderSpecificRecoveryPointDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Replication provider specific recovery point details. + [System.ComponentModel.TypeConverter(typeof(ProviderSpecificRecoveryPointDetailsTypeConverter))] + public partial interface IProviderSpecificRecoveryPointDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProviderSpecificRecoveryPointDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProviderSpecificRecoveryPointDetails.TypeConverter.cs new file mode 100644 index 000000000000..de6277cf1aae --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProviderSpecificRecoveryPointDetails.TypeConverter.cs @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ProviderSpecificRecoveryPointDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProviderSpecificRecoveryPointDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProviderSpecificRecoveryPointDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ProviderSpecificRecoveryPointDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ProviderSpecificRecoveryPointDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ProviderSpecificRecoveryPointDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProviderSpecificRecoveryPointDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProviderSpecificRecoveryPointDetails.cs new file mode 100644 index 000000000000..4c8645df713c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProviderSpecificRecoveryPointDetails.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Replication provider specific recovery point details. + public partial class ProviderSpecificRecoveryPointDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProviderSpecificRecoveryPointDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProviderSpecificRecoveryPointDetailsInternal + { + + /// Backing field for property. + private string _instanceType; + + /// Gets the provider type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string InstanceType { get => this._instanceType; set => this._instanceType = value; } + + /// Creates an new instance. + public ProviderSpecificRecoveryPointDetails() + { + + } + } + /// Replication provider specific recovery point details. + public partial interface IProviderSpecificRecoveryPointDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// Gets the provider type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets the provider type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string InstanceType { get; set; } + + } + /// Replication provider specific recovery point details. + internal partial interface IProviderSpecificRecoveryPointDetailsInternal + + { + /// Gets the provider type. + string InstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProviderSpecificRecoveryPointDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProviderSpecificRecoveryPointDetails.json.cs new file mode 100644 index 000000000000..8c695b3480cd --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ProviderSpecificRecoveryPointDetails.json.cs @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Replication provider specific recovery point details. + public partial class ProviderSpecificRecoveryPointDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProviderSpecificRecoveryPointDetails. + /// Note: the Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProviderSpecificRecoveryPointDetails interface + /// is polymorphic, and the precise model class that will get deserialized is determined at runtime based on the payload. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProviderSpecificRecoveryPointDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProviderSpecificRecoveryPointDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + if (!(node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json)) + { + return null; + } + // Polymorphic type -- select the appropriate constructor using the discriminator + + switch ( json.StringProperty("instanceType") ) + { + case "A2A": + { + return new A2ARecoveryPointDetails(json); + } + case "InMageAzureV2": + { + return new InMageAzureV2RecoveryPointDetails(json); + } + case "InMageRcm": + { + return new InMageRcmRecoveryPointDetails(json); + } + } + return new ProviderSpecificRecoveryPointDetails(json); + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal ProviderSpecificRecoveryPointDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_instanceType = If( json?.PropertyT("instanceType"), out var __jsonInstanceType) ? (string)__jsonInstanceType : (string)InstanceType;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._instanceType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._instanceType.ToString()) : null, "instanceType" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PushInstallerDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PushInstallerDetails.PowerShell.cs new file mode 100644 index 000000000000..0a80d0485f91 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PushInstallerDetails.PowerShell.cs @@ -0,0 +1,208 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Push installer details. + [System.ComponentModel.TypeConverter(typeof(PushInstallerDetailsTypeConverter))] + public partial class PushInstallerDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPushInstallerDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new PushInstallerDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPushInstallerDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new PushInstallerDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPushInstallerDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal PushInstallerDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPushInstallerDetailsInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPushInstallerDetailsInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPushInstallerDetailsInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPushInstallerDetailsInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("BiosId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPushInstallerDetailsInternal)this).BiosId = (string) content.GetValueForProperty("BiosId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPushInstallerDetailsInternal)this).BiosId, global::System.Convert.ToString); + } + if (content.Contains("FabricObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPushInstallerDetailsInternal)this).FabricObjectId = (string) content.GetValueForProperty("FabricObjectId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPushInstallerDetailsInternal)this).FabricObjectId, global::System.Convert.ToString); + } + if (content.Contains("Fqdn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPushInstallerDetailsInternal)this).Fqdn = (string) content.GetValueForProperty("Fqdn",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPushInstallerDetailsInternal)this).Fqdn, global::System.Convert.ToString); + } + if (content.Contains("Version")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPushInstallerDetailsInternal)this).Version = (string) content.GetValueForProperty("Version",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPushInstallerDetailsInternal)this).Version, global::System.Convert.ToString); + } + if (content.Contains("LastHeartbeatUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPushInstallerDetailsInternal)this).LastHeartbeatUtc = (global::System.DateTime?) content.GetValueForProperty("LastHeartbeatUtc",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPushInstallerDetailsInternal)this).LastHeartbeatUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("Health")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPushInstallerDetailsInternal)this).Health = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth?) content.GetValueForProperty("Health",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPushInstallerDetailsInternal)this).Health, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth.CreateFrom); + } + if (content.Contains("HealthError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPushInstallerDetailsInternal)this).HealthError = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[]) content.GetValueForProperty("HealthError",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPushInstallerDetailsInternal)this).HealthError, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthErrorTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal PushInstallerDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPushInstallerDetailsInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPushInstallerDetailsInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPushInstallerDetailsInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPushInstallerDetailsInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("BiosId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPushInstallerDetailsInternal)this).BiosId = (string) content.GetValueForProperty("BiosId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPushInstallerDetailsInternal)this).BiosId, global::System.Convert.ToString); + } + if (content.Contains("FabricObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPushInstallerDetailsInternal)this).FabricObjectId = (string) content.GetValueForProperty("FabricObjectId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPushInstallerDetailsInternal)this).FabricObjectId, global::System.Convert.ToString); + } + if (content.Contains("Fqdn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPushInstallerDetailsInternal)this).Fqdn = (string) content.GetValueForProperty("Fqdn",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPushInstallerDetailsInternal)this).Fqdn, global::System.Convert.ToString); + } + if (content.Contains("Version")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPushInstallerDetailsInternal)this).Version = (string) content.GetValueForProperty("Version",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPushInstallerDetailsInternal)this).Version, global::System.Convert.ToString); + } + if (content.Contains("LastHeartbeatUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPushInstallerDetailsInternal)this).LastHeartbeatUtc = (global::System.DateTime?) content.GetValueForProperty("LastHeartbeatUtc",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPushInstallerDetailsInternal)this).LastHeartbeatUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("Health")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPushInstallerDetailsInternal)this).Health = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth?) content.GetValueForProperty("Health",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPushInstallerDetailsInternal)this).Health, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth.CreateFrom); + } + if (content.Contains("HealthError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPushInstallerDetailsInternal)this).HealthError = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[]) content.GetValueForProperty("HealthError",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPushInstallerDetailsInternal)this).HealthError, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthErrorTypeConverter.ConvertFrom)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Push installer details. + [System.ComponentModel.TypeConverter(typeof(PushInstallerDetailsTypeConverter))] + public partial interface IPushInstallerDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PushInstallerDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PushInstallerDetails.TypeConverter.cs new file mode 100644 index 000000000000..fb3af039f9e1 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PushInstallerDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class PushInstallerDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPushInstallerDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPushInstallerDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return PushInstallerDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return PushInstallerDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return PushInstallerDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PushInstallerDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PushInstallerDetails.cs new file mode 100644 index 000000000000..ab1872c1a16f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PushInstallerDetails.cs @@ -0,0 +1,214 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Push installer details. + public partial class PushInstallerDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPushInstallerDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPushInstallerDetailsInternal + { + + /// Backing field for property. + private string _biosId; + + /// The push installer Bios Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string BiosId { get => this._biosId; } + + /// Backing field for property. + private string _fabricObjectId; + + /// The fabric object Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string FabricObjectId { get => this._fabricObjectId; } + + /// Backing field for property. + private string _fqdn; + + /// The push installer Fqdn. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Fqdn { get => this._fqdn; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth? _health; + + /// The health of the push installer. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth? Health { get => this._health; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] _healthError; + + /// The health errors. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] HealthError { get => this._healthError; } + + /// Backing field for property. + private string _id; + + /// The push installer Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Id { get => this._id; } + + /// Backing field for property. + private global::System.DateTime? _lastHeartbeatUtc; + + /// The last heartbeat received from the push installer. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public global::System.DateTime? LastHeartbeatUtc { get => this._lastHeartbeatUtc; } + + /// Internal Acessors for BiosId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPushInstallerDetailsInternal.BiosId { get => this._biosId; set { {_biosId = value;} } } + + /// Internal Acessors for FabricObjectId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPushInstallerDetailsInternal.FabricObjectId { get => this._fabricObjectId; set { {_fabricObjectId = value;} } } + + /// Internal Acessors for Fqdn + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPushInstallerDetailsInternal.Fqdn { get => this._fqdn; set { {_fqdn = value;} } } + + /// Internal Acessors for Health + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPushInstallerDetailsInternal.Health { get => this._health; set { {_health = value;} } } + + /// Internal Acessors for HealthError + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPushInstallerDetailsInternal.HealthError { get => this._healthError; set { {_healthError = value;} } } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPushInstallerDetailsInternal.Id { get => this._id; set { {_id = value;} } } + + /// Internal Acessors for LastHeartbeatUtc + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPushInstallerDetailsInternal.LastHeartbeatUtc { get => this._lastHeartbeatUtc; set { {_lastHeartbeatUtc = value;} } } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPushInstallerDetailsInternal.Name { get => this._name; set { {_name = value;} } } + + /// Internal Acessors for Version + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPushInstallerDetailsInternal.Version { get => this._version; set { {_version = value;} } } + + /// Backing field for property. + private string _name; + + /// The push installer name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Name { get => this._name; } + + /// Backing field for property. + private string _version; + + /// The version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Version { get => this._version; } + + /// Creates an new instance. + public PushInstallerDetails() + { + + } + } + /// Push installer details. + public partial interface IPushInstallerDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The push installer Bios Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The push installer Bios Id.", + SerializedName = @"biosId", + PossibleTypes = new [] { typeof(string) })] + string BiosId { get; } + /// The fabric object Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The fabric object Id.", + SerializedName = @"fabricObjectId", + PossibleTypes = new [] { typeof(string) })] + string FabricObjectId { get; } + /// The push installer Fqdn. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The push installer Fqdn.", + SerializedName = @"fqdn", + PossibleTypes = new [] { typeof(string) })] + string Fqdn { get; } + /// The health of the push installer. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The health of the push installer.", + SerializedName = @"health", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth? Health { get; } + /// The health errors. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The health errors.", + SerializedName = @"healthErrors", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] HealthError { get; } + /// The push installer Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The push installer Id.", + SerializedName = @"id", + PossibleTypes = new [] { typeof(string) })] + string Id { get; } + /// The last heartbeat received from the push installer. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The last heartbeat received from the push installer.", + SerializedName = @"lastHeartbeatUtc", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? LastHeartbeatUtc { get; } + /// The push installer name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The push installer name.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string Name { get; } + /// The version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The version.", + SerializedName = @"version", + PossibleTypes = new [] { typeof(string) })] + string Version { get; } + + } + /// Push installer details. + internal partial interface IPushInstallerDetailsInternal + + { + /// The push installer Bios Id. + string BiosId { get; set; } + /// The fabric object Id. + string FabricObjectId { get; set; } + /// The push installer Fqdn. + string Fqdn { get; set; } + /// The health of the push installer. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth? Health { get; set; } + /// The health errors. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] HealthError { get; set; } + /// The push installer Id. + string Id { get; set; } + /// The last heartbeat received from the push installer. + global::System.DateTime? LastHeartbeatUtc { get; set; } + /// The push installer name. + string Name { get; set; } + /// The version. + string Version { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PushInstallerDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PushInstallerDetails.json.cs new file mode 100644 index 000000000000..8ca6c5b63c64 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/PushInstallerDetails.json.cs @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Push installer details. + public partial class PushInstallerDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPushInstallerDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPushInstallerDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPushInstallerDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new PushInstallerDetails(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal PushInstallerDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_id = If( json?.PropertyT("id"), out var __jsonId) ? (string)__jsonId : (string)Id;} + {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)Name;} + {_biosId = If( json?.PropertyT("biosId"), out var __jsonBiosId) ? (string)__jsonBiosId : (string)BiosId;} + {_fabricObjectId = If( json?.PropertyT("fabricObjectId"), out var __jsonFabricObjectId) ? (string)__jsonFabricObjectId : (string)FabricObjectId;} + {_fqdn = If( json?.PropertyT("fqdn"), out var __jsonFqdn) ? (string)__jsonFqdn : (string)Fqdn;} + {_version = If( json?.PropertyT("version"), out var __jsonVersion) ? (string)__jsonVersion : (string)Version;} + {_lastHeartbeatUtc = If( json?.PropertyT("lastHeartbeatUtc"), out var __jsonLastHeartbeatUtc) ? global::System.DateTime.TryParse((string)__jsonLastHeartbeatUtc, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonLastHeartbeatUtcValue) ? __jsonLastHeartbeatUtcValue : LastHeartbeatUtc : LastHeartbeatUtc;} + {_health = If( json?.PropertyT("health"), out var __jsonHealth) ? (string)__jsonHealth : (string)Health;} + {_healthError = If( json?.PropertyT("healthErrors"), out var __jsonHealthErrors) ? If( __jsonHealthErrors as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthError.FromJson(__u) )) ))() : null : HealthError;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._id)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._id.ToString()) : null, "id" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._biosId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._biosId.ToString()) : null, "biosId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._fabricObjectId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._fabricObjectId.ToString()) : null, "fabricObjectId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._fqdn)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._fqdn.ToString()) : null, "fqdn" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._version)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._version.ToString()) : null, "version" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._lastHeartbeatUtc ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._lastHeartbeatUtc?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "lastHeartbeatUtc" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._health)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._health.ToString()) : null, "health" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + if (null != this._healthError) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._healthError ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("healthErrors",__w); + } + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RcmProxyDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RcmProxyDetails.PowerShell.cs new file mode 100644 index 000000000000..12e6ad28d776 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RcmProxyDetails.PowerShell.cs @@ -0,0 +1,216 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// RCM proxy details. + [System.ComponentModel.TypeConverter(typeof(RcmProxyDetailsTypeConverter))] + public partial class RcmProxyDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new RcmProxyDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new RcmProxyDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal RcmProxyDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetailsInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetailsInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetailsInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetailsInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("BiosId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetailsInternal)this).BiosId = (string) content.GetValueForProperty("BiosId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetailsInternal)this).BiosId, global::System.Convert.ToString); + } + if (content.Contains("FabricObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetailsInternal)this).FabricObjectId = (string) content.GetValueForProperty("FabricObjectId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetailsInternal)this).FabricObjectId, global::System.Convert.ToString); + } + if (content.Contains("Fqdn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetailsInternal)this).Fqdn = (string) content.GetValueForProperty("Fqdn",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetailsInternal)this).Fqdn, global::System.Convert.ToString); + } + if (content.Contains("ClientAuthenticationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetailsInternal)this).ClientAuthenticationType = (string) content.GetValueForProperty("ClientAuthenticationType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetailsInternal)this).ClientAuthenticationType, global::System.Convert.ToString); + } + if (content.Contains("Version")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetailsInternal)this).Version = (string) content.GetValueForProperty("Version",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetailsInternal)this).Version, global::System.Convert.ToString); + } + if (content.Contains("LastHeartbeatUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetailsInternal)this).LastHeartbeatUtc = (global::System.DateTime?) content.GetValueForProperty("LastHeartbeatUtc",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetailsInternal)this).LastHeartbeatUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("Health")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetailsInternal)this).Health = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth?) content.GetValueForProperty("Health",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetailsInternal)this).Health, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth.CreateFrom); + } + if (content.Contains("HealthError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetailsInternal)this).HealthError = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[]) content.GetValueForProperty("HealthError",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetailsInternal)this).HealthError, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthErrorTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal RcmProxyDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetailsInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetailsInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetailsInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetailsInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("BiosId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetailsInternal)this).BiosId = (string) content.GetValueForProperty("BiosId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetailsInternal)this).BiosId, global::System.Convert.ToString); + } + if (content.Contains("FabricObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetailsInternal)this).FabricObjectId = (string) content.GetValueForProperty("FabricObjectId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetailsInternal)this).FabricObjectId, global::System.Convert.ToString); + } + if (content.Contains("Fqdn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetailsInternal)this).Fqdn = (string) content.GetValueForProperty("Fqdn",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetailsInternal)this).Fqdn, global::System.Convert.ToString); + } + if (content.Contains("ClientAuthenticationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetailsInternal)this).ClientAuthenticationType = (string) content.GetValueForProperty("ClientAuthenticationType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetailsInternal)this).ClientAuthenticationType, global::System.Convert.ToString); + } + if (content.Contains("Version")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetailsInternal)this).Version = (string) content.GetValueForProperty("Version",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetailsInternal)this).Version, global::System.Convert.ToString); + } + if (content.Contains("LastHeartbeatUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetailsInternal)this).LastHeartbeatUtc = (global::System.DateTime?) content.GetValueForProperty("LastHeartbeatUtc",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetailsInternal)this).LastHeartbeatUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("Health")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetailsInternal)this).Health = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth?) content.GetValueForProperty("Health",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetailsInternal)this).Health, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth.CreateFrom); + } + if (content.Contains("HealthError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetailsInternal)this).HealthError = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[]) content.GetValueForProperty("HealthError",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetailsInternal)this).HealthError, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthErrorTypeConverter.ConvertFrom)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// RCM proxy details. + [System.ComponentModel.TypeConverter(typeof(RcmProxyDetailsTypeConverter))] + public partial interface IRcmProxyDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RcmProxyDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RcmProxyDetails.TypeConverter.cs new file mode 100644 index 000000000000..a09ad72e2634 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RcmProxyDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class RcmProxyDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return RcmProxyDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return RcmProxyDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return RcmProxyDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RcmProxyDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RcmProxyDetails.cs new file mode 100644 index 000000000000..644effa201ac --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RcmProxyDetails.cs @@ -0,0 +1,234 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// RCM proxy details. + public partial class RcmProxyDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetailsInternal + { + + /// Backing field for property. + private string _biosId; + + /// The RCM proxy Bios Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string BiosId { get => this._biosId; } + + /// Backing field for property. + private string _clientAuthenticationType; + + /// The client authentication type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ClientAuthenticationType { get => this._clientAuthenticationType; } + + /// Backing field for property. + private string _fabricObjectId; + + /// The fabric object Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string FabricObjectId { get => this._fabricObjectId; } + + /// Backing field for property. + private string _fqdn; + + /// The RCM proxy Fqdn. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Fqdn { get => this._fqdn; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth? _health; + + /// The health of the RCM proxy. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth? Health { get => this._health; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] _healthError; + + /// The health errors. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] HealthError { get => this._healthError; } + + /// Backing field for property. + private string _id; + + /// The RCM proxy Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Id { get => this._id; } + + /// Backing field for property. + private global::System.DateTime? _lastHeartbeatUtc; + + /// The last heartbeat received from the RCM proxy. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public global::System.DateTime? LastHeartbeatUtc { get => this._lastHeartbeatUtc; } + + /// Internal Acessors for BiosId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetailsInternal.BiosId { get => this._biosId; set { {_biosId = value;} } } + + /// Internal Acessors for ClientAuthenticationType + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetailsInternal.ClientAuthenticationType { get => this._clientAuthenticationType; set { {_clientAuthenticationType = value;} } } + + /// Internal Acessors for FabricObjectId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetailsInternal.FabricObjectId { get => this._fabricObjectId; set { {_fabricObjectId = value;} } } + + /// Internal Acessors for Fqdn + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetailsInternal.Fqdn { get => this._fqdn; set { {_fqdn = value;} } } + + /// Internal Acessors for Health + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetailsInternal.Health { get => this._health; set { {_health = value;} } } + + /// Internal Acessors for HealthError + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetailsInternal.HealthError { get => this._healthError; set { {_healthError = value;} } } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetailsInternal.Id { get => this._id; set { {_id = value;} } } + + /// Internal Acessors for LastHeartbeatUtc + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetailsInternal.LastHeartbeatUtc { get => this._lastHeartbeatUtc; set { {_lastHeartbeatUtc = value;} } } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetailsInternal.Name { get => this._name; set { {_name = value;} } } + + /// Internal Acessors for Version + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetailsInternal.Version { get => this._version; set { {_version = value;} } } + + /// Backing field for property. + private string _name; + + /// The RCM proxy name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Name { get => this._name; } + + /// Backing field for property. + private string _version; + + /// The version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Version { get => this._version; } + + /// Creates an new instance. + public RcmProxyDetails() + { + + } + } + /// RCM proxy details. + public partial interface IRcmProxyDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The RCM proxy Bios Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The RCM proxy Bios Id.", + SerializedName = @"biosId", + PossibleTypes = new [] { typeof(string) })] + string BiosId { get; } + /// The client authentication type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The client authentication type.", + SerializedName = @"clientAuthenticationType", + PossibleTypes = new [] { typeof(string) })] + string ClientAuthenticationType { get; } + /// The fabric object Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The fabric object Id.", + SerializedName = @"fabricObjectId", + PossibleTypes = new [] { typeof(string) })] + string FabricObjectId { get; } + /// The RCM proxy Fqdn. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The RCM proxy Fqdn.", + SerializedName = @"fqdn", + PossibleTypes = new [] { typeof(string) })] + string Fqdn { get; } + /// The health of the RCM proxy. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The health of the RCM proxy.", + SerializedName = @"health", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth? Health { get; } + /// The health errors. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The health errors.", + SerializedName = @"healthErrors", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] HealthError { get; } + /// The RCM proxy Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The RCM proxy Id.", + SerializedName = @"id", + PossibleTypes = new [] { typeof(string) })] + string Id { get; } + /// The last heartbeat received from the RCM proxy. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The last heartbeat received from the RCM proxy.", + SerializedName = @"lastHeartbeatUtc", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? LastHeartbeatUtc { get; } + /// The RCM proxy name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The RCM proxy name.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string Name { get; } + /// The version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The version.", + SerializedName = @"version", + PossibleTypes = new [] { typeof(string) })] + string Version { get; } + + } + /// RCM proxy details. + internal partial interface IRcmProxyDetailsInternal + + { + /// The RCM proxy Bios Id. + string BiosId { get; set; } + /// The client authentication type. + string ClientAuthenticationType { get; set; } + /// The fabric object Id. + string FabricObjectId { get; set; } + /// The RCM proxy Fqdn. + string Fqdn { get; set; } + /// The health of the RCM proxy. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth? Health { get; set; } + /// The health errors. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] HealthError { get; set; } + /// The RCM proxy Id. + string Id { get; set; } + /// The last heartbeat received from the RCM proxy. + global::System.DateTime? LastHeartbeatUtc { get; set; } + /// The RCM proxy name. + string Name { get; set; } + /// The version. + string Version { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RcmProxyDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RcmProxyDetails.json.cs new file mode 100644 index 000000000000..96fc25dd2ea1 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RcmProxyDetails.json.cs @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// RCM proxy details. + public partial class RcmProxyDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRcmProxyDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new RcmProxyDetails(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal RcmProxyDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_id = If( json?.PropertyT("id"), out var __jsonId) ? (string)__jsonId : (string)Id;} + {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)Name;} + {_biosId = If( json?.PropertyT("biosId"), out var __jsonBiosId) ? (string)__jsonBiosId : (string)BiosId;} + {_fabricObjectId = If( json?.PropertyT("fabricObjectId"), out var __jsonFabricObjectId) ? (string)__jsonFabricObjectId : (string)FabricObjectId;} + {_fqdn = If( json?.PropertyT("fqdn"), out var __jsonFqdn) ? (string)__jsonFqdn : (string)Fqdn;} + {_clientAuthenticationType = If( json?.PropertyT("clientAuthenticationType"), out var __jsonClientAuthenticationType) ? (string)__jsonClientAuthenticationType : (string)ClientAuthenticationType;} + {_version = If( json?.PropertyT("version"), out var __jsonVersion) ? (string)__jsonVersion : (string)Version;} + {_lastHeartbeatUtc = If( json?.PropertyT("lastHeartbeatUtc"), out var __jsonLastHeartbeatUtc) ? global::System.DateTime.TryParse((string)__jsonLastHeartbeatUtc, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonLastHeartbeatUtcValue) ? __jsonLastHeartbeatUtcValue : LastHeartbeatUtc : LastHeartbeatUtc;} + {_health = If( json?.PropertyT("health"), out var __jsonHealth) ? (string)__jsonHealth : (string)Health;} + {_healthError = If( json?.PropertyT("healthErrors"), out var __jsonHealthErrors) ? If( __jsonHealthErrors as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthError.FromJson(__u) )) ))() : null : HealthError;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._id)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._id.ToString()) : null, "id" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._biosId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._biosId.ToString()) : null, "biosId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._fabricObjectId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._fabricObjectId.ToString()) : null, "fabricObjectId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._fqdn)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._fqdn.ToString()) : null, "fqdn" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._clientAuthenticationType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._clientAuthenticationType.ToString()) : null, "clientAuthenticationType" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._version)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._version.ToString()) : null, "version" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._lastHeartbeatUtc ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._lastHeartbeatUtc?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "lastHeartbeatUtc" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._health)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._health.ToString()) : null, "health" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + if (null != this._healthError) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._healthError ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("healthErrors",__w); + } + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryAvailabilitySetCustomDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryAvailabilitySetCustomDetails.PowerShell.cs new file mode 100644 index 000000000000..3ca5104d68a5 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryAvailabilitySetCustomDetails.PowerShell.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Recovery Availability Set custom input. + [System.ComponentModel.TypeConverter(typeof(RecoveryAvailabilitySetCustomDetailsTypeConverter))] + public partial class RecoveryAvailabilitySetCustomDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryAvailabilitySetCustomDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new RecoveryAvailabilitySetCustomDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryAvailabilitySetCustomDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new RecoveryAvailabilitySetCustomDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryAvailabilitySetCustomDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal RecoveryAvailabilitySetCustomDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ResourceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryAvailabilitySetCustomDetailsInternal)this).ResourceType = (string) content.GetValueForProperty("ResourceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryAvailabilitySetCustomDetailsInternal)this).ResourceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal RecoveryAvailabilitySetCustomDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ResourceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryAvailabilitySetCustomDetailsInternal)this).ResourceType = (string) content.GetValueForProperty("ResourceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryAvailabilitySetCustomDetailsInternal)this).ResourceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Recovery Availability Set custom input. + [System.ComponentModel.TypeConverter(typeof(RecoveryAvailabilitySetCustomDetailsTypeConverter))] + public partial interface IRecoveryAvailabilitySetCustomDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryAvailabilitySetCustomDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryAvailabilitySetCustomDetails.TypeConverter.cs new file mode 100644 index 000000000000..3021c1a80bdc --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryAvailabilitySetCustomDetails.TypeConverter.cs @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class RecoveryAvailabilitySetCustomDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryAvailabilitySetCustomDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryAvailabilitySetCustomDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return RecoveryAvailabilitySetCustomDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return RecoveryAvailabilitySetCustomDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return RecoveryAvailabilitySetCustomDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryAvailabilitySetCustomDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryAvailabilitySetCustomDetails.cs new file mode 100644 index 000000000000..f6e712c65e27 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryAvailabilitySetCustomDetails.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Recovery Availability Set custom input. + public partial class RecoveryAvailabilitySetCustomDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryAvailabilitySetCustomDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryAvailabilitySetCustomDetailsInternal + { + + /// Backing field for property. + private string _resourceType; + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ResourceType { get => this._resourceType; set => this._resourceType = value; } + + /// Creates an new instance. + public RecoveryAvailabilitySetCustomDetails() + { + + } + } + /// Recovery Availability Set custom input. + public partial interface IRecoveryAvailabilitySetCustomDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"resourceType", + PossibleTypes = new [] { typeof(string) })] + string ResourceType { get; set; } + + } + /// Recovery Availability Set custom input. + internal partial interface IRecoveryAvailabilitySetCustomDetailsInternal + + { + /// The class type. + string ResourceType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryAvailabilitySetCustomDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryAvailabilitySetCustomDetails.json.cs new file mode 100644 index 000000000000..d8546b0cb5ec --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryAvailabilitySetCustomDetails.json.cs @@ -0,0 +1,124 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Recovery Availability Set custom input. + public partial class RecoveryAvailabilitySetCustomDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryAvailabilitySetCustomDetails. + /// Note: the Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryAvailabilitySetCustomDetails interface + /// is polymorphic, and the precise model class that will get deserialized is determined at runtime based on the payload. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryAvailabilitySetCustomDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryAvailabilitySetCustomDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + if (!(node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json)) + { + return null; + } + // Polymorphic type -- select the appropriate constructor using the discriminator + + switch ( json.StringProperty("resourceType") ) + { + case "Existing": + { + return new ExistingRecoveryAvailabilitySet(json); + } + } + return new RecoveryAvailabilitySetCustomDetails(json); + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal RecoveryAvailabilitySetCustomDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_resourceType = If( json?.PropertyT("resourceType"), out var __jsonResourceType) ? (string)__jsonResourceType : (string)ResourceType;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._resourceType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._resourceType.ToString()) : null, "resourceType" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlan.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlan.PowerShell.cs new file mode 100644 index 000000000000..70751ad4281c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlan.PowerShell.cs @@ -0,0 +1,328 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Recovery plan details. + [System.ComponentModel.TypeConverter(typeof(RecoveryPlanTypeConverter))] + public partial class RecoveryPlan + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new RecoveryPlan(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new RecoveryPlan(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal RecoveryPlan(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("CurrentScenario")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInternal)this).CurrentScenario = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICurrentScenarioDetails) content.GetValueForProperty("CurrentScenario",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInternal)this).CurrentScenario, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.CurrentScenarioDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("FriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInternal)this).FriendlyName = (string) content.GetValueForProperty("FriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInternal)this).FriendlyName, global::System.Convert.ToString); + } + if (content.Contains("PrimaryFabricId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInternal)this).PrimaryFabricId = (string) content.GetValueForProperty("PrimaryFabricId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInternal)this).PrimaryFabricId, global::System.Convert.ToString); + } + if (content.Contains("PrimaryFabricFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInternal)this).PrimaryFabricFriendlyName = (string) content.GetValueForProperty("PrimaryFabricFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInternal)this).PrimaryFabricFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("RecoveryFabricId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInternal)this).RecoveryFabricId = (string) content.GetValueForProperty("RecoveryFabricId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInternal)this).RecoveryFabricId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryFabricFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInternal)this).RecoveryFabricFriendlyName = (string) content.GetValueForProperty("RecoveryFabricFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInternal)this).RecoveryFabricFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("FailoverDeploymentModel")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInternal)this).FailoverDeploymentModel = (string) content.GetValueForProperty("FailoverDeploymentModel",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInternal)this).FailoverDeploymentModel, global::System.Convert.ToString); + } + if (content.Contains("ReplicationProvider")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInternal)this).ReplicationProvider = (string[]) content.GetValueForProperty("ReplicationProvider",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInternal)this).ReplicationProvider, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("AllowedOperation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInternal)this).AllowedOperation = (string[]) content.GetValueForProperty("AllowedOperation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInternal)this).AllowedOperation, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("LastPlannedFailoverTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInternal)this).LastPlannedFailoverTime = (global::System.DateTime?) content.GetValueForProperty("LastPlannedFailoverTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInternal)this).LastPlannedFailoverTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("LastUnplannedFailoverTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInternal)this).LastUnplannedFailoverTime = (global::System.DateTime?) content.GetValueForProperty("LastUnplannedFailoverTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInternal)this).LastUnplannedFailoverTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("LastTestFailoverTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInternal)this).LastTestFailoverTime = (global::System.DateTime?) content.GetValueForProperty("LastTestFailoverTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInternal)this).LastTestFailoverTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("CurrentScenarioStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInternal)this).CurrentScenarioStatus = (string) content.GetValueForProperty("CurrentScenarioStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInternal)this).CurrentScenarioStatus, global::System.Convert.ToString); + } + if (content.Contains("CurrentScenarioStatusDescription")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInternal)this).CurrentScenarioStatusDescription = (string) content.GetValueForProperty("CurrentScenarioStatusDescription",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInternal)this).CurrentScenarioStatusDescription, global::System.Convert.ToString); + } + if (content.Contains("Group")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInternal)this).Group = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroup[]) content.GetValueForProperty("Group",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInternal)this).Group, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanGroupTypeConverter.ConvertFrom)); + } + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificDetails[]) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInternal)this).ProviderSpecificDetail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanProviderSpecificDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("CurrentScenarioName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInternal)this).CurrentScenarioName = (string) content.GetValueForProperty("CurrentScenarioName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInternal)this).CurrentScenarioName, global::System.Convert.ToString); + } + if (content.Contains("CurrentScenarioJobId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInternal)this).CurrentScenarioJobId = (string) content.GetValueForProperty("CurrentScenarioJobId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInternal)this).CurrentScenarioJobId, global::System.Convert.ToString); + } + if (content.Contains("CurrentScenarioStartTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInternal)this).CurrentScenarioStartTime = (global::System.DateTime?) content.GetValueForProperty("CurrentScenarioStartTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInternal)this).CurrentScenarioStartTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal RecoveryPlan(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("CurrentScenario")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInternal)this).CurrentScenario = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICurrentScenarioDetails) content.GetValueForProperty("CurrentScenario",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInternal)this).CurrentScenario, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.CurrentScenarioDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("FriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInternal)this).FriendlyName = (string) content.GetValueForProperty("FriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInternal)this).FriendlyName, global::System.Convert.ToString); + } + if (content.Contains("PrimaryFabricId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInternal)this).PrimaryFabricId = (string) content.GetValueForProperty("PrimaryFabricId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInternal)this).PrimaryFabricId, global::System.Convert.ToString); + } + if (content.Contains("PrimaryFabricFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInternal)this).PrimaryFabricFriendlyName = (string) content.GetValueForProperty("PrimaryFabricFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInternal)this).PrimaryFabricFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("RecoveryFabricId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInternal)this).RecoveryFabricId = (string) content.GetValueForProperty("RecoveryFabricId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInternal)this).RecoveryFabricId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryFabricFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInternal)this).RecoveryFabricFriendlyName = (string) content.GetValueForProperty("RecoveryFabricFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInternal)this).RecoveryFabricFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("FailoverDeploymentModel")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInternal)this).FailoverDeploymentModel = (string) content.GetValueForProperty("FailoverDeploymentModel",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInternal)this).FailoverDeploymentModel, global::System.Convert.ToString); + } + if (content.Contains("ReplicationProvider")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInternal)this).ReplicationProvider = (string[]) content.GetValueForProperty("ReplicationProvider",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInternal)this).ReplicationProvider, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("AllowedOperation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInternal)this).AllowedOperation = (string[]) content.GetValueForProperty("AllowedOperation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInternal)this).AllowedOperation, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("LastPlannedFailoverTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInternal)this).LastPlannedFailoverTime = (global::System.DateTime?) content.GetValueForProperty("LastPlannedFailoverTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInternal)this).LastPlannedFailoverTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("LastUnplannedFailoverTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInternal)this).LastUnplannedFailoverTime = (global::System.DateTime?) content.GetValueForProperty("LastUnplannedFailoverTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInternal)this).LastUnplannedFailoverTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("LastTestFailoverTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInternal)this).LastTestFailoverTime = (global::System.DateTime?) content.GetValueForProperty("LastTestFailoverTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInternal)this).LastTestFailoverTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("CurrentScenarioStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInternal)this).CurrentScenarioStatus = (string) content.GetValueForProperty("CurrentScenarioStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInternal)this).CurrentScenarioStatus, global::System.Convert.ToString); + } + if (content.Contains("CurrentScenarioStatusDescription")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInternal)this).CurrentScenarioStatusDescription = (string) content.GetValueForProperty("CurrentScenarioStatusDescription",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInternal)this).CurrentScenarioStatusDescription, global::System.Convert.ToString); + } + if (content.Contains("Group")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInternal)this).Group = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroup[]) content.GetValueForProperty("Group",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInternal)this).Group, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanGroupTypeConverter.ConvertFrom)); + } + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificDetails[]) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInternal)this).ProviderSpecificDetail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanProviderSpecificDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("CurrentScenarioName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInternal)this).CurrentScenarioName = (string) content.GetValueForProperty("CurrentScenarioName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInternal)this).CurrentScenarioName, global::System.Convert.ToString); + } + if (content.Contains("CurrentScenarioJobId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInternal)this).CurrentScenarioJobId = (string) content.GetValueForProperty("CurrentScenarioJobId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInternal)this).CurrentScenarioJobId, global::System.Convert.ToString); + } + if (content.Contains("CurrentScenarioStartTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInternal)this).CurrentScenarioStartTime = (global::System.DateTime?) content.GetValueForProperty("CurrentScenarioStartTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInternal)this).CurrentScenarioStartTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Recovery plan details. + [System.ComponentModel.TypeConverter(typeof(RecoveryPlanTypeConverter))] + public partial interface IRecoveryPlan + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlan.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlan.TypeConverter.cs new file mode 100644 index 000000000000..323787dabcf7 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlan.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class RecoveryPlanTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return RecoveryPlan.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return RecoveryPlan.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return RecoveryPlan.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlan.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlan.cs new file mode 100644 index 000000000000..bdeb2b25bae7 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlan.cs @@ -0,0 +1,347 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Recovery plan details. + public partial class RecoveryPlan : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResource __resource = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.Resource(); + + /// The list of allowed operations. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string[] AllowedOperation { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)Property).AllowedOperation; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)Property).AllowedOperation = value ?? null /* arrayOf */; } + + /// ARM Id of the job being executed. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string CurrentScenarioJobId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)Property).CurrentScenarioJobId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)Property).CurrentScenarioJobId = value ?? null; } + + /// Scenario name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string CurrentScenarioName { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)Property).CurrentScenarioName; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)Property).CurrentScenarioName = value ?? null; } + + /// Start time of the workflow. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public global::System.DateTime? CurrentScenarioStartTime { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)Property).CurrentScenarioStartTime; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)Property).CurrentScenarioStartTime = value ?? default(global::System.DateTime); } + + /// The recovery plan status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string CurrentScenarioStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)Property).CurrentScenarioStatus; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)Property).CurrentScenarioStatus = value ?? null; } + + /// The recovery plan status description. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string CurrentScenarioStatusDescription { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)Property).CurrentScenarioStatusDescription; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)Property).CurrentScenarioStatusDescription = value ?? null; } + + /// The failover deployment model. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string FailoverDeploymentModel { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)Property).FailoverDeploymentModel; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)Property).FailoverDeploymentModel = value ?? null; } + + /// The friendly name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string FriendlyName { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)Property).FriendlyName; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)Property).FriendlyName = value ?? null; } + + /// The recovery plan groups. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroup[] Group { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)Property).Group; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)Property).Group = value ?? null /* arrayOf */; } + + /// Resource Id + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Id; } + + /// The start time of the last planned failover. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public global::System.DateTime? LastPlannedFailoverTime { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)Property).LastPlannedFailoverTime; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)Property).LastPlannedFailoverTime = value ?? default(global::System.DateTime); } + + /// The start time of the last test failover. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public global::System.DateTime? LastTestFailoverTime { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)Property).LastTestFailoverTime; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)Property).LastTestFailoverTime = value ?? default(global::System.DateTime); } + + /// The start time of the last unplanned failover. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public global::System.DateTime? LastUnplannedFailoverTime { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)Property).LastUnplannedFailoverTime; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)Property).LastUnplannedFailoverTime = value ?? default(global::System.DateTime); } + + /// Resource Location + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string Location { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Location; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Location = value ?? null; } + + /// Internal Acessors for CurrentScenario + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICurrentScenarioDetails Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInternal.CurrentScenario { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)Property).CurrentScenario; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)Property).CurrentScenario = value; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProperties Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanProperties()); set { {_property = value;} } } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Id = value; } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Name = value; } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Type = value; } + + /// Resource Name + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Name; } + + /// The primary fabric friendly name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string PrimaryFabricFriendlyName { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)Property).PrimaryFabricFriendlyName; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)Property).PrimaryFabricFriendlyName = value ?? null; } + + /// The primary fabric Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string PrimaryFabricId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)Property).PrimaryFabricId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)Property).PrimaryFabricId = value ?? null; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProperties _property; + + /// The custom details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanProperties()); set => this._property = value; } + + /// The provider id and provider specific details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificDetails[] ProviderSpecificDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)Property).ProviderSpecificDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)Property).ProviderSpecificDetail = value ?? null /* arrayOf */; } + + /// The recovery fabric friendly name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string RecoveryFabricFriendlyName { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)Property).RecoveryFabricFriendlyName; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)Property).RecoveryFabricFriendlyName = value ?? null; } + + /// The recovery fabric Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string RecoveryFabricId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)Property).RecoveryFabricId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)Property).RecoveryFabricId = value ?? null; } + + /// The list of replication providers. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string[] ReplicationProvider { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)Property).ReplicationProvider; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)Property).ReplicationProvider = value ?? null /* arrayOf */; } + + /// Resource Type + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Type; } + + /// Creates an new instance. + public RecoveryPlan() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__resource), __resource); + await eventListener.AssertObjectIsValid(nameof(__resource), __resource); + } + } + /// Recovery plan details. + public partial interface IRecoveryPlan : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResource + { + /// The list of allowed operations. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of allowed operations.", + SerializedName = @"allowedOperations", + PossibleTypes = new [] { typeof(string) })] + string[] AllowedOperation { get; set; } + /// ARM Id of the job being executed. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"ARM Id of the job being executed.", + SerializedName = @"jobId", + PossibleTypes = new [] { typeof(string) })] + string CurrentScenarioJobId { get; set; } + /// Scenario name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Scenario name.", + SerializedName = @"scenarioName", + PossibleTypes = new [] { typeof(string) })] + string CurrentScenarioName { get; set; } + /// Start time of the workflow. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Start time of the workflow.", + SerializedName = @"startTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? CurrentScenarioStartTime { get; set; } + /// The recovery plan status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery plan status.", + SerializedName = @"currentScenarioStatus", + PossibleTypes = new [] { typeof(string) })] + string CurrentScenarioStatus { get; set; } + /// The recovery plan status description. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery plan status description.", + SerializedName = @"currentScenarioStatusDescription", + PossibleTypes = new [] { typeof(string) })] + string CurrentScenarioStatusDescription { get; set; } + /// The failover deployment model. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The failover deployment model.", + SerializedName = @"failoverDeploymentModel", + PossibleTypes = new [] { typeof(string) })] + string FailoverDeploymentModel { get; set; } + /// The friendly name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The friendly name.", + SerializedName = @"friendlyName", + PossibleTypes = new [] { typeof(string) })] + string FriendlyName { get; set; } + /// The recovery plan groups. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery plan groups.", + SerializedName = @"groups", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroup) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroup[] Group { get; set; } + /// The start time of the last planned failover. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The start time of the last planned failover.", + SerializedName = @"lastPlannedFailoverTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? LastPlannedFailoverTime { get; set; } + /// The start time of the last test failover. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The start time of the last test failover.", + SerializedName = @"lastTestFailoverTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? LastTestFailoverTime { get; set; } + /// The start time of the last unplanned failover. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The start time of the last unplanned failover.", + SerializedName = @"lastUnplannedFailoverTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? LastUnplannedFailoverTime { get; set; } + /// The primary fabric friendly name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The primary fabric friendly name.", + SerializedName = @"primaryFabricFriendlyName", + PossibleTypes = new [] { typeof(string) })] + string PrimaryFabricFriendlyName { get; set; } + /// The primary fabric Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The primary fabric Id.", + SerializedName = @"primaryFabricId", + PossibleTypes = new [] { typeof(string) })] + string PrimaryFabricId { get; set; } + /// The provider id and provider specific details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The provider id and provider specific details.", + SerializedName = @"providerSpecificDetails", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificDetails) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificDetails[] ProviderSpecificDetail { get; set; } + /// The recovery fabric friendly name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery fabric friendly name.", + SerializedName = @"recoveryFabricFriendlyName", + PossibleTypes = new [] { typeof(string) })] + string RecoveryFabricFriendlyName { get; set; } + /// The recovery fabric Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery fabric Id.", + SerializedName = @"recoveryFabricId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryFabricId { get; set; } + /// The list of replication providers. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of replication providers.", + SerializedName = @"replicationProviders", + PossibleTypes = new [] { typeof(string) })] + string[] ReplicationProvider { get; set; } + + } + /// Recovery plan details. + internal partial interface IRecoveryPlanInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal + { + /// The list of allowed operations. + string[] AllowedOperation { get; set; } + /// The current scenario details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICurrentScenarioDetails CurrentScenario { get; set; } + /// ARM Id of the job being executed. + string CurrentScenarioJobId { get; set; } + /// Scenario name. + string CurrentScenarioName { get; set; } + /// Start time of the workflow. + global::System.DateTime? CurrentScenarioStartTime { get; set; } + /// The recovery plan status. + string CurrentScenarioStatus { get; set; } + /// The recovery plan status description. + string CurrentScenarioStatusDescription { get; set; } + /// The failover deployment model. + string FailoverDeploymentModel { get; set; } + /// The friendly name. + string FriendlyName { get; set; } + /// The recovery plan groups. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroup[] Group { get; set; } + /// The start time of the last planned failover. + global::System.DateTime? LastPlannedFailoverTime { get; set; } + /// The start time of the last test failover. + global::System.DateTime? LastTestFailoverTime { get; set; } + /// The start time of the last unplanned failover. + global::System.DateTime? LastUnplannedFailoverTime { get; set; } + /// The primary fabric friendly name. + string PrimaryFabricFriendlyName { get; set; } + /// The primary fabric Id. + string PrimaryFabricId { get; set; } + /// The custom details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProperties Property { get; set; } + /// The provider id and provider specific details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificDetails[] ProviderSpecificDetail { get; set; } + /// The recovery fabric friendly name. + string RecoveryFabricFriendlyName { get; set; } + /// The recovery fabric Id. + string RecoveryFabricId { get; set; } + /// The list of replication providers. + string[] ReplicationProvider { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlan.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlan.json.cs new file mode 100644 index 000000000000..d2239db8762f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlan.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Recovery plan details. + public partial class RecoveryPlan + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new RecoveryPlan(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal RecoveryPlan(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __resource = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.Resource(json); + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanProperties.FromJson(__jsonProperties) : Property;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __resource?.ToJson(container, serializationMode); + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanA2ADetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanA2ADetails.PowerShell.cs new file mode 100644 index 000000000000..88ae548b7d44 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanA2ADetails.PowerShell.cs @@ -0,0 +1,208 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Recovery plan A2A specific details. + [System.ComponentModel.TypeConverter(typeof(RecoveryPlanA2ADetailsTypeConverter))] + public partial class RecoveryPlanA2ADetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2ADetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new RecoveryPlanA2ADetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2ADetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new RecoveryPlanA2ADetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2ADetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal RecoveryPlanA2ADetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("PrimaryExtendedLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2ADetailsInternal)this).PrimaryExtendedLocation = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocation) content.GetValueForProperty("PrimaryExtendedLocation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2ADetailsInternal)this).PrimaryExtendedLocation, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ExtendedLocationTypeConverter.ConvertFrom); + } + if (content.Contains("RecoveryExtendedLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2ADetailsInternal)this).RecoveryExtendedLocation = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocation) content.GetValueForProperty("RecoveryExtendedLocation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2ADetailsInternal)this).RecoveryExtendedLocation, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ExtendedLocationTypeConverter.ConvertFrom); + } + if (content.Contains("PrimaryZone")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2ADetailsInternal)this).PrimaryZone = (string) content.GetValueForProperty("PrimaryZone",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2ADetailsInternal)this).PrimaryZone, global::System.Convert.ToString); + } + if (content.Contains("RecoveryZone")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2ADetailsInternal)this).RecoveryZone = (string) content.GetValueForProperty("RecoveryZone",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2ADetailsInternal)this).RecoveryZone, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + if (content.Contains("PrimaryExtendedLocationName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2ADetailsInternal)this).PrimaryExtendedLocationName = (string) content.GetValueForProperty("PrimaryExtendedLocationName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2ADetailsInternal)this).PrimaryExtendedLocationName, global::System.Convert.ToString); + } + if (content.Contains("PrimaryExtendedLocationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2ADetailsInternal)this).PrimaryExtendedLocationType = (string) content.GetValueForProperty("PrimaryExtendedLocationType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2ADetailsInternal)this).PrimaryExtendedLocationType, global::System.Convert.ToString); + } + if (content.Contains("RecoveryExtendedLocationName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2ADetailsInternal)this).RecoveryExtendedLocationName = (string) content.GetValueForProperty("RecoveryExtendedLocationName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2ADetailsInternal)this).RecoveryExtendedLocationName, global::System.Convert.ToString); + } + if (content.Contains("RecoveryExtendedLocationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2ADetailsInternal)this).RecoveryExtendedLocationType = (string) content.GetValueForProperty("RecoveryExtendedLocationType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2ADetailsInternal)this).RecoveryExtendedLocationType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal RecoveryPlanA2ADetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("PrimaryExtendedLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2ADetailsInternal)this).PrimaryExtendedLocation = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocation) content.GetValueForProperty("PrimaryExtendedLocation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2ADetailsInternal)this).PrimaryExtendedLocation, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ExtendedLocationTypeConverter.ConvertFrom); + } + if (content.Contains("RecoveryExtendedLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2ADetailsInternal)this).RecoveryExtendedLocation = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocation) content.GetValueForProperty("RecoveryExtendedLocation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2ADetailsInternal)this).RecoveryExtendedLocation, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ExtendedLocationTypeConverter.ConvertFrom); + } + if (content.Contains("PrimaryZone")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2ADetailsInternal)this).PrimaryZone = (string) content.GetValueForProperty("PrimaryZone",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2ADetailsInternal)this).PrimaryZone, global::System.Convert.ToString); + } + if (content.Contains("RecoveryZone")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2ADetailsInternal)this).RecoveryZone = (string) content.GetValueForProperty("RecoveryZone",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2ADetailsInternal)this).RecoveryZone, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + if (content.Contains("PrimaryExtendedLocationName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2ADetailsInternal)this).PrimaryExtendedLocationName = (string) content.GetValueForProperty("PrimaryExtendedLocationName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2ADetailsInternal)this).PrimaryExtendedLocationName, global::System.Convert.ToString); + } + if (content.Contains("PrimaryExtendedLocationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2ADetailsInternal)this).PrimaryExtendedLocationType = (string) content.GetValueForProperty("PrimaryExtendedLocationType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2ADetailsInternal)this).PrimaryExtendedLocationType, global::System.Convert.ToString); + } + if (content.Contains("RecoveryExtendedLocationName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2ADetailsInternal)this).RecoveryExtendedLocationName = (string) content.GetValueForProperty("RecoveryExtendedLocationName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2ADetailsInternal)this).RecoveryExtendedLocationName, global::System.Convert.ToString); + } + if (content.Contains("RecoveryExtendedLocationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2ADetailsInternal)this).RecoveryExtendedLocationType = (string) content.GetValueForProperty("RecoveryExtendedLocationType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2ADetailsInternal)this).RecoveryExtendedLocationType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Recovery plan A2A specific details. + [System.ComponentModel.TypeConverter(typeof(RecoveryPlanA2ADetailsTypeConverter))] + public partial interface IRecoveryPlanA2ADetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanA2ADetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanA2ADetails.TypeConverter.cs new file mode 100644 index 000000000000..dcc3d8d75f65 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanA2ADetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class RecoveryPlanA2ADetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2ADetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2ADetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return RecoveryPlanA2ADetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return RecoveryPlanA2ADetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return RecoveryPlanA2ADetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanA2ADetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanA2ADetails.cs new file mode 100644 index 000000000000..50082e6d29e6 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanA2ADetails.cs @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Recovery plan A2A specific details. + public partial class RecoveryPlanA2ADetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2ADetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2ADetailsInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificDetails __recoveryPlanProviderSpecificDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanProviderSpecificDetails(); + + /// Gets the Instance type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificDetailsInternal)__recoveryPlanProviderSpecificDetails).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificDetailsInternal)__recoveryPlanProviderSpecificDetails).InstanceType = value ; } + + /// Internal Acessors for PrimaryExtendedLocation + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocation Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2ADetailsInternal.PrimaryExtendedLocation { get => (this._primaryExtendedLocation = this._primaryExtendedLocation ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ExtendedLocation()); set { {_primaryExtendedLocation = value;} } } + + /// Internal Acessors for PrimaryExtendedLocationType + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2ADetailsInternal.PrimaryExtendedLocationType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocationInternal)PrimaryExtendedLocation).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocationInternal)PrimaryExtendedLocation).Type = value; } + + /// Internal Acessors for RecoveryExtendedLocation + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocation Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2ADetailsInternal.RecoveryExtendedLocation { get => (this._recoveryExtendedLocation = this._recoveryExtendedLocation ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ExtendedLocation()); set { {_recoveryExtendedLocation = value;} } } + + /// Internal Acessors for RecoveryExtendedLocationType + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2ADetailsInternal.RecoveryExtendedLocationType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocationInternal)RecoveryExtendedLocation).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocationInternal)RecoveryExtendedLocation).Type = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocation _primaryExtendedLocation; + + /// The primary extended location. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocation PrimaryExtendedLocation { get => (this._primaryExtendedLocation = this._primaryExtendedLocation ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ExtendedLocation()); set => this._primaryExtendedLocation = value; } + + /// The name of the extended location. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string PrimaryExtendedLocationName { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocationInternal)PrimaryExtendedLocation).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocationInternal)PrimaryExtendedLocation).Name = value ?? null; } + + /// The extended location type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string PrimaryExtendedLocationType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocationInternal)PrimaryExtendedLocation).Type; } + + /// Backing field for property. + private string _primaryZone; + + /// The primary zone. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string PrimaryZone { get => this._primaryZone; set => this._primaryZone = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocation _recoveryExtendedLocation; + + /// The recovery extended location. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocation RecoveryExtendedLocation { get => (this._recoveryExtendedLocation = this._recoveryExtendedLocation ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ExtendedLocation()); set => this._recoveryExtendedLocation = value; } + + /// The name of the extended location. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string RecoveryExtendedLocationName { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocationInternal)RecoveryExtendedLocation).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocationInternal)RecoveryExtendedLocation).Name = value ?? null; } + + /// The extended location type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string RecoveryExtendedLocationType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocationInternal)RecoveryExtendedLocation).Type; } + + /// Backing field for property. + private string _recoveryZone; + + /// The recovery zone. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryZone { get => this._recoveryZone; set => this._recoveryZone = value; } + + /// Creates an new instance. + public RecoveryPlanA2ADetails() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__recoveryPlanProviderSpecificDetails), __recoveryPlanProviderSpecificDetails); + await eventListener.AssertObjectIsValid(nameof(__recoveryPlanProviderSpecificDetails), __recoveryPlanProviderSpecificDetails); + } + } + /// Recovery plan A2A specific details. + public partial interface IRecoveryPlanA2ADetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificDetails + { + /// The name of the extended location. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the extended location.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string PrimaryExtendedLocationName { get; set; } + /// The extended location type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The extended location type.", + SerializedName = @"type", + PossibleTypes = new [] { typeof(string) })] + string PrimaryExtendedLocationType { get; } + /// The primary zone. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The primary zone.", + SerializedName = @"primaryZone", + PossibleTypes = new [] { typeof(string) })] + string PrimaryZone { get; set; } + /// The name of the extended location. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the extended location.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string RecoveryExtendedLocationName { get; set; } + /// The extended location type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The extended location type.", + SerializedName = @"type", + PossibleTypes = new [] { typeof(string) })] + string RecoveryExtendedLocationType { get; } + /// The recovery zone. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery zone.", + SerializedName = @"recoveryZone", + PossibleTypes = new [] { typeof(string) })] + string RecoveryZone { get; set; } + + } + /// Recovery plan A2A specific details. + internal partial interface IRecoveryPlanA2ADetailsInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificDetailsInternal + { + /// The primary extended location. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocation PrimaryExtendedLocation { get; set; } + /// The name of the extended location. + string PrimaryExtendedLocationName { get; set; } + /// The extended location type. + string PrimaryExtendedLocationType { get; set; } + /// The primary zone. + string PrimaryZone { get; set; } + /// The recovery extended location. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocation RecoveryExtendedLocation { get; set; } + /// The name of the extended location. + string RecoveryExtendedLocationName { get; set; } + /// The extended location type. + string RecoveryExtendedLocationType { get; set; } + /// The recovery zone. + string RecoveryZone { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanA2ADetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanA2ADetails.json.cs new file mode 100644 index 000000000000..19790c79cdc6 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanA2ADetails.json.cs @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Recovery plan A2A specific details. + public partial class RecoveryPlanA2ADetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2ADetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2ADetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2ADetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new RecoveryPlanA2ADetails(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal RecoveryPlanA2ADetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __recoveryPlanProviderSpecificDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanProviderSpecificDetails(json); + {_primaryExtendedLocation = If( json?.PropertyT("primaryExtendedLocation"), out var __jsonPrimaryExtendedLocation) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ExtendedLocation.FromJson(__jsonPrimaryExtendedLocation) : PrimaryExtendedLocation;} + {_recoveryExtendedLocation = If( json?.PropertyT("recoveryExtendedLocation"), out var __jsonRecoveryExtendedLocation) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ExtendedLocation.FromJson(__jsonRecoveryExtendedLocation) : RecoveryExtendedLocation;} + {_primaryZone = If( json?.PropertyT("primaryZone"), out var __jsonPrimaryZone) ? (string)__jsonPrimaryZone : (string)PrimaryZone;} + {_recoveryZone = If( json?.PropertyT("recoveryZone"), out var __jsonRecoveryZone) ? (string)__jsonRecoveryZone : (string)RecoveryZone;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __recoveryPlanProviderSpecificDetails?.ToJson(container, serializationMode); + AddIf( null != this._primaryExtendedLocation ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._primaryExtendedLocation.ToJson(null,serializationMode) : null, "primaryExtendedLocation" ,container.Add ); + AddIf( null != this._recoveryExtendedLocation ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._recoveryExtendedLocation.ToJson(null,serializationMode) : null, "recoveryExtendedLocation" ,container.Add ); + AddIf( null != (((object)this._primaryZone)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._primaryZone.ToString()) : null, "primaryZone" ,container.Add ); + AddIf( null != (((object)this._recoveryZone)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryZone.ToString()) : null, "recoveryZone" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanA2AFailoverInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanA2AFailoverInput.PowerShell.cs new file mode 100644 index 000000000000..f42b743416fd --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanA2AFailoverInput.PowerShell.cs @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Recovery plan A2A failover input. + [System.ComponentModel.TypeConverter(typeof(RecoveryPlanA2AFailoverInputTypeConverter))] + public partial class RecoveryPlanA2AFailoverInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2AFailoverInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new RecoveryPlanA2AFailoverInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2AFailoverInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new RecoveryPlanA2AFailoverInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2AFailoverInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal RecoveryPlanA2AFailoverInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("RecoveryPointType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2AFailoverInputInternal)this).RecoveryPointType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.A2ARpRecoveryPointType) content.GetValueForProperty("RecoveryPointType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2AFailoverInputInternal)this).RecoveryPointType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.A2ARpRecoveryPointType.CreateFrom); + } + if (content.Contains("CloudServiceCreationOption")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2AFailoverInputInternal)this).CloudServiceCreationOption = (string) content.GetValueForProperty("CloudServiceCreationOption",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2AFailoverInputInternal)this).CloudServiceCreationOption, global::System.Convert.ToString); + } + if (content.Contains("MultiVMSyncPointOption")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2AFailoverInputInternal)this).MultiVMSyncPointOption = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MultiVMSyncPointOption?) content.GetValueForProperty("MultiVMSyncPointOption",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2AFailoverInputInternal)this).MultiVMSyncPointOption, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MultiVMSyncPointOption.CreateFrom); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal RecoveryPlanA2AFailoverInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("RecoveryPointType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2AFailoverInputInternal)this).RecoveryPointType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.A2ARpRecoveryPointType) content.GetValueForProperty("RecoveryPointType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2AFailoverInputInternal)this).RecoveryPointType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.A2ARpRecoveryPointType.CreateFrom); + } + if (content.Contains("CloudServiceCreationOption")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2AFailoverInputInternal)this).CloudServiceCreationOption = (string) content.GetValueForProperty("CloudServiceCreationOption",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2AFailoverInputInternal)this).CloudServiceCreationOption, global::System.Convert.ToString); + } + if (content.Contains("MultiVMSyncPointOption")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2AFailoverInputInternal)this).MultiVMSyncPointOption = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MultiVMSyncPointOption?) content.GetValueForProperty("MultiVMSyncPointOption",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2AFailoverInputInternal)this).MultiVMSyncPointOption, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MultiVMSyncPointOption.CreateFrom); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Recovery plan A2A failover input. + [System.ComponentModel.TypeConverter(typeof(RecoveryPlanA2AFailoverInputTypeConverter))] + public partial interface IRecoveryPlanA2AFailoverInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanA2AFailoverInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanA2AFailoverInput.TypeConverter.cs new file mode 100644 index 000000000000..6ffd330cfb4c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanA2AFailoverInput.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class RecoveryPlanA2AFailoverInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2AFailoverInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2AFailoverInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return RecoveryPlanA2AFailoverInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return RecoveryPlanA2AFailoverInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return RecoveryPlanA2AFailoverInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanA2AFailoverInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanA2AFailoverInput.cs new file mode 100644 index 000000000000..b740e2c81137 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanA2AFailoverInput.cs @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Recovery plan A2A failover input. + public partial class RecoveryPlanA2AFailoverInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2AFailoverInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2AFailoverInputInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInput __recoveryPlanProviderSpecificFailoverInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanProviderSpecificFailoverInput(); + + /// Backing field for property. + private string _cloudServiceCreationOption; + + /// A value indicating whether to use recovery cloud service for TFO or not. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string CloudServiceCreationOption { get => this._cloudServiceCreationOption; set => this._cloudServiceCreationOption = value; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInputInternal)__recoveryPlanProviderSpecificFailoverInput).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInputInternal)__recoveryPlanProviderSpecificFailoverInput).InstanceType = value ; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MultiVMSyncPointOption? _multiVMSyncPointOption; + + /// + /// A value indicating whether multi VM sync enabled VMs should use multi VM sync points for failover. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MultiVMSyncPointOption? MultiVMSyncPointOption { get => this._multiVMSyncPointOption; set => this._multiVMSyncPointOption = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.A2ARpRecoveryPointType _recoveryPointType; + + /// The recovery point type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.A2ARpRecoveryPointType RecoveryPointType { get => this._recoveryPointType; set => this._recoveryPointType = value; } + + /// Creates an new instance. + public RecoveryPlanA2AFailoverInput() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__recoveryPlanProviderSpecificFailoverInput), __recoveryPlanProviderSpecificFailoverInput); + await eventListener.AssertObjectIsValid(nameof(__recoveryPlanProviderSpecificFailoverInput), __recoveryPlanProviderSpecificFailoverInput); + } + } + /// Recovery plan A2A failover input. + public partial interface IRecoveryPlanA2AFailoverInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInput + { + /// A value indicating whether to use recovery cloud service for TFO or not. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether to use recovery cloud service for TFO or not.", + SerializedName = @"cloudServiceCreationOption", + PossibleTypes = new [] { typeof(string) })] + string CloudServiceCreationOption { get; set; } + /// + /// A value indicating whether multi VM sync enabled VMs should use multi VM sync points for failover. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether multi VM sync enabled VMs should use multi VM sync points for failover.", + SerializedName = @"multiVmSyncPointOption", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MultiVMSyncPointOption) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MultiVMSyncPointOption? MultiVMSyncPointOption { get; set; } + /// The recovery point type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The recovery point type.", + SerializedName = @"recoveryPointType", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.A2ARpRecoveryPointType) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.A2ARpRecoveryPointType RecoveryPointType { get; set; } + + } + /// Recovery plan A2A failover input. + internal partial interface IRecoveryPlanA2AFailoverInputInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInputInternal + { + /// A value indicating whether to use recovery cloud service for TFO or not. + string CloudServiceCreationOption { get; set; } + /// + /// A value indicating whether multi VM sync enabled VMs should use multi VM sync points for failover. + /// + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MultiVMSyncPointOption? MultiVMSyncPointOption { get; set; } + /// The recovery point type. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.A2ARpRecoveryPointType RecoveryPointType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanA2AFailoverInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanA2AFailoverInput.json.cs new file mode 100644 index 000000000000..de0d1ac10aea --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanA2AFailoverInput.json.cs @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Recovery plan A2A failover input. + public partial class RecoveryPlanA2AFailoverInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2AFailoverInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2AFailoverInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2AFailoverInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new RecoveryPlanA2AFailoverInput(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal RecoveryPlanA2AFailoverInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __recoveryPlanProviderSpecificFailoverInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanProviderSpecificFailoverInput(json); + {_recoveryPointType = If( json?.PropertyT("recoveryPointType"), out var __jsonRecoveryPointType) ? (string)__jsonRecoveryPointType : (string)RecoveryPointType;} + {_cloudServiceCreationOption = If( json?.PropertyT("cloudServiceCreationOption"), out var __jsonCloudServiceCreationOption) ? (string)__jsonCloudServiceCreationOption : (string)CloudServiceCreationOption;} + {_multiVMSyncPointOption = If( json?.PropertyT("multiVmSyncPointOption"), out var __jsonMultiVMSyncPointOption) ? (string)__jsonMultiVMSyncPointOption : (string)MultiVMSyncPointOption;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __recoveryPlanProviderSpecificFailoverInput?.ToJson(container, serializationMode); + AddIf( null != (((object)this._recoveryPointType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryPointType.ToString()) : null, "recoveryPointType" ,container.Add ); + AddIf( null != (((object)this._cloudServiceCreationOption)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._cloudServiceCreationOption.ToString()) : null, "cloudServiceCreationOption" ,container.Add ); + AddIf( null != (((object)this._multiVMSyncPointOption)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._multiVMSyncPointOption.ToString()) : null, "multiVmSyncPointOption" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanA2AInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanA2AInput.PowerShell.cs new file mode 100644 index 000000000000..ce7d4cd7f843 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanA2AInput.PowerShell.cs @@ -0,0 +1,208 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Recovery plan A2A input. + [System.ComponentModel.TypeConverter(typeof(RecoveryPlanA2AInputTypeConverter))] + public partial class RecoveryPlanA2AInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2AInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new RecoveryPlanA2AInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2AInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new RecoveryPlanA2AInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2AInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal RecoveryPlanA2AInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("PrimaryExtendedLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2AInputInternal)this).PrimaryExtendedLocation = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocation) content.GetValueForProperty("PrimaryExtendedLocation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2AInputInternal)this).PrimaryExtendedLocation, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ExtendedLocationTypeConverter.ConvertFrom); + } + if (content.Contains("RecoveryExtendedLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2AInputInternal)this).RecoveryExtendedLocation = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocation) content.GetValueForProperty("RecoveryExtendedLocation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2AInputInternal)this).RecoveryExtendedLocation, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ExtendedLocationTypeConverter.ConvertFrom); + } + if (content.Contains("PrimaryZone")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2AInputInternal)this).PrimaryZone = (string) content.GetValueForProperty("PrimaryZone",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2AInputInternal)this).PrimaryZone, global::System.Convert.ToString); + } + if (content.Contains("RecoveryZone")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2AInputInternal)this).RecoveryZone = (string) content.GetValueForProperty("RecoveryZone",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2AInputInternal)this).RecoveryZone, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + if (content.Contains("PrimaryExtendedLocationName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2AInputInternal)this).PrimaryExtendedLocationName = (string) content.GetValueForProperty("PrimaryExtendedLocationName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2AInputInternal)this).PrimaryExtendedLocationName, global::System.Convert.ToString); + } + if (content.Contains("PrimaryExtendedLocationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2AInputInternal)this).PrimaryExtendedLocationType = (string) content.GetValueForProperty("PrimaryExtendedLocationType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2AInputInternal)this).PrimaryExtendedLocationType, global::System.Convert.ToString); + } + if (content.Contains("RecoveryExtendedLocationName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2AInputInternal)this).RecoveryExtendedLocationName = (string) content.GetValueForProperty("RecoveryExtendedLocationName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2AInputInternal)this).RecoveryExtendedLocationName, global::System.Convert.ToString); + } + if (content.Contains("RecoveryExtendedLocationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2AInputInternal)this).RecoveryExtendedLocationType = (string) content.GetValueForProperty("RecoveryExtendedLocationType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2AInputInternal)this).RecoveryExtendedLocationType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal RecoveryPlanA2AInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("PrimaryExtendedLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2AInputInternal)this).PrimaryExtendedLocation = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocation) content.GetValueForProperty("PrimaryExtendedLocation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2AInputInternal)this).PrimaryExtendedLocation, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ExtendedLocationTypeConverter.ConvertFrom); + } + if (content.Contains("RecoveryExtendedLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2AInputInternal)this).RecoveryExtendedLocation = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocation) content.GetValueForProperty("RecoveryExtendedLocation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2AInputInternal)this).RecoveryExtendedLocation, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ExtendedLocationTypeConverter.ConvertFrom); + } + if (content.Contains("PrimaryZone")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2AInputInternal)this).PrimaryZone = (string) content.GetValueForProperty("PrimaryZone",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2AInputInternal)this).PrimaryZone, global::System.Convert.ToString); + } + if (content.Contains("RecoveryZone")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2AInputInternal)this).RecoveryZone = (string) content.GetValueForProperty("RecoveryZone",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2AInputInternal)this).RecoveryZone, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + if (content.Contains("PrimaryExtendedLocationName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2AInputInternal)this).PrimaryExtendedLocationName = (string) content.GetValueForProperty("PrimaryExtendedLocationName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2AInputInternal)this).PrimaryExtendedLocationName, global::System.Convert.ToString); + } + if (content.Contains("PrimaryExtendedLocationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2AInputInternal)this).PrimaryExtendedLocationType = (string) content.GetValueForProperty("PrimaryExtendedLocationType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2AInputInternal)this).PrimaryExtendedLocationType, global::System.Convert.ToString); + } + if (content.Contains("RecoveryExtendedLocationName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2AInputInternal)this).RecoveryExtendedLocationName = (string) content.GetValueForProperty("RecoveryExtendedLocationName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2AInputInternal)this).RecoveryExtendedLocationName, global::System.Convert.ToString); + } + if (content.Contains("RecoveryExtendedLocationType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2AInputInternal)this).RecoveryExtendedLocationType = (string) content.GetValueForProperty("RecoveryExtendedLocationType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2AInputInternal)this).RecoveryExtendedLocationType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Recovery plan A2A input. + [System.ComponentModel.TypeConverter(typeof(RecoveryPlanA2AInputTypeConverter))] + public partial interface IRecoveryPlanA2AInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanA2AInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanA2AInput.TypeConverter.cs new file mode 100644 index 000000000000..a50178d0bec5 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanA2AInput.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class RecoveryPlanA2AInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2AInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2AInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return RecoveryPlanA2AInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return RecoveryPlanA2AInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return RecoveryPlanA2AInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanA2AInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanA2AInput.cs new file mode 100644 index 000000000000..8500cfaa1ecc --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanA2AInput.cs @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Recovery plan A2A input. + public partial class RecoveryPlanA2AInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2AInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2AInputInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificInput __recoveryPlanProviderSpecificInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanProviderSpecificInput(); + + /// Gets the Instance type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificInputInternal)__recoveryPlanProviderSpecificInput).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificInputInternal)__recoveryPlanProviderSpecificInput).InstanceType = value ; } + + /// Internal Acessors for PrimaryExtendedLocation + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocation Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2AInputInternal.PrimaryExtendedLocation { get => (this._primaryExtendedLocation = this._primaryExtendedLocation ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ExtendedLocation()); set { {_primaryExtendedLocation = value;} } } + + /// Internal Acessors for PrimaryExtendedLocationType + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2AInputInternal.PrimaryExtendedLocationType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocationInternal)PrimaryExtendedLocation).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocationInternal)PrimaryExtendedLocation).Type = value; } + + /// Internal Acessors for RecoveryExtendedLocation + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocation Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2AInputInternal.RecoveryExtendedLocation { get => (this._recoveryExtendedLocation = this._recoveryExtendedLocation ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ExtendedLocation()); set { {_recoveryExtendedLocation = value;} } } + + /// Internal Acessors for RecoveryExtendedLocationType + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2AInputInternal.RecoveryExtendedLocationType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocationInternal)RecoveryExtendedLocation).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocationInternal)RecoveryExtendedLocation).Type = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocation _primaryExtendedLocation; + + /// The primary extended location. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocation PrimaryExtendedLocation { get => (this._primaryExtendedLocation = this._primaryExtendedLocation ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ExtendedLocation()); set => this._primaryExtendedLocation = value; } + + /// The name of the extended location. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string PrimaryExtendedLocationName { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocationInternal)PrimaryExtendedLocation).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocationInternal)PrimaryExtendedLocation).Name = value ?? null; } + + /// The extended location type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string PrimaryExtendedLocationType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocationInternal)PrimaryExtendedLocation).Type; } + + /// Backing field for property. + private string _primaryZone; + + /// The primary zone. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string PrimaryZone { get => this._primaryZone; set => this._primaryZone = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocation _recoveryExtendedLocation; + + /// The recovery extended location. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocation RecoveryExtendedLocation { get => (this._recoveryExtendedLocation = this._recoveryExtendedLocation ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ExtendedLocation()); set => this._recoveryExtendedLocation = value; } + + /// The name of the extended location. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string RecoveryExtendedLocationName { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocationInternal)RecoveryExtendedLocation).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocationInternal)RecoveryExtendedLocation).Name = value ?? null; } + + /// The extended location type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string RecoveryExtendedLocationType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocationInternal)RecoveryExtendedLocation).Type; } + + /// Backing field for property. + private string _recoveryZone; + + /// The recovery zone. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryZone { get => this._recoveryZone; set => this._recoveryZone = value; } + + /// Creates an new instance. + public RecoveryPlanA2AInput() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__recoveryPlanProviderSpecificInput), __recoveryPlanProviderSpecificInput); + await eventListener.AssertObjectIsValid(nameof(__recoveryPlanProviderSpecificInput), __recoveryPlanProviderSpecificInput); + } + } + /// Recovery plan A2A input. + public partial interface IRecoveryPlanA2AInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificInput + { + /// The name of the extended location. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the extended location.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string PrimaryExtendedLocationName { get; set; } + /// The extended location type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The extended location type.", + SerializedName = @"type", + PossibleTypes = new [] { typeof(string) })] + string PrimaryExtendedLocationType { get; } + /// The primary zone. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The primary zone.", + SerializedName = @"primaryZone", + PossibleTypes = new [] { typeof(string) })] + string PrimaryZone { get; set; } + /// The name of the extended location. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the extended location.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string RecoveryExtendedLocationName { get; set; } + /// The extended location type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The extended location type.", + SerializedName = @"type", + PossibleTypes = new [] { typeof(string) })] + string RecoveryExtendedLocationType { get; } + /// The recovery zone. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery zone.", + SerializedName = @"recoveryZone", + PossibleTypes = new [] { typeof(string) })] + string RecoveryZone { get; set; } + + } + /// Recovery plan A2A input. + internal partial interface IRecoveryPlanA2AInputInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificInputInternal + { + /// The primary extended location. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocation PrimaryExtendedLocation { get; set; } + /// The name of the extended location. + string PrimaryExtendedLocationName { get; set; } + /// The extended location type. + string PrimaryExtendedLocationType { get; set; } + /// The primary zone. + string PrimaryZone { get; set; } + /// The recovery extended location. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IExtendedLocation RecoveryExtendedLocation { get; set; } + /// The name of the extended location. + string RecoveryExtendedLocationName { get; set; } + /// The extended location type. + string RecoveryExtendedLocationType { get; set; } + /// The recovery zone. + string RecoveryZone { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanA2AInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanA2AInput.json.cs new file mode 100644 index 000000000000..3e327ae175fd --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanA2AInput.json.cs @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Recovery plan A2A input. + public partial class RecoveryPlanA2AInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2AInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2AInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanA2AInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new RecoveryPlanA2AInput(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal RecoveryPlanA2AInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __recoveryPlanProviderSpecificInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanProviderSpecificInput(json); + {_primaryExtendedLocation = If( json?.PropertyT("primaryExtendedLocation"), out var __jsonPrimaryExtendedLocation) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ExtendedLocation.FromJson(__jsonPrimaryExtendedLocation) : PrimaryExtendedLocation;} + {_recoveryExtendedLocation = If( json?.PropertyT("recoveryExtendedLocation"), out var __jsonRecoveryExtendedLocation) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ExtendedLocation.FromJson(__jsonRecoveryExtendedLocation) : RecoveryExtendedLocation;} + {_primaryZone = If( json?.PropertyT("primaryZone"), out var __jsonPrimaryZone) ? (string)__jsonPrimaryZone : (string)PrimaryZone;} + {_recoveryZone = If( json?.PropertyT("recoveryZone"), out var __jsonRecoveryZone) ? (string)__jsonRecoveryZone : (string)RecoveryZone;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __recoveryPlanProviderSpecificInput?.ToJson(container, serializationMode); + AddIf( null != this._primaryExtendedLocation ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._primaryExtendedLocation.ToJson(null,serializationMode) : null, "primaryExtendedLocation" ,container.Add ); + AddIf( null != this._recoveryExtendedLocation ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._recoveryExtendedLocation.ToJson(null,serializationMode) : null, "recoveryExtendedLocation" ,container.Add ); + AddIf( null != (((object)this._primaryZone)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._primaryZone.ToString()) : null, "primaryZone" ,container.Add ); + AddIf( null != (((object)this._recoveryZone)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryZone.ToString()) : null, "recoveryZone" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanAction.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanAction.PowerShell.cs new file mode 100644 index 000000000000..e7ee950dd6b2 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanAction.PowerShell.cs @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Recovery plan action details. + [System.ComponentModel.TypeConverter(typeof(RecoveryPlanActionTypeConverter))] + public partial class RecoveryPlanAction + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanAction DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new RecoveryPlanAction(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanAction DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new RecoveryPlanAction(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanAction FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal RecoveryPlanAction(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CustomDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanActionInternal)this).CustomDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanActionDetails) content.GetValueForProperty("CustomDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanActionInternal)this).CustomDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanActionDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("ActionName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanActionInternal)this).ActionName = (string) content.GetValueForProperty("ActionName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanActionInternal)this).ActionName, global::System.Convert.ToString); + } + if (content.Contains("FailoverType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanActionInternal)this).FailoverType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ReplicationProtectedItemOperation[]) content.GetValueForProperty("FailoverType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanActionInternal)this).FailoverType, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ReplicationProtectedItemOperation.CreateFrom)); + } + if (content.Contains("FailoverDirection")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanActionInternal)this).FailoverDirection = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections[]) content.GetValueForProperty("FailoverDirection",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanActionInternal)this).FailoverDirection, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections.CreateFrom)); + } + if (content.Contains("CustomDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanActionInternal)this).CustomDetailInstanceType = (string) content.GetValueForProperty("CustomDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanActionInternal)this).CustomDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal RecoveryPlanAction(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CustomDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanActionInternal)this).CustomDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanActionDetails) content.GetValueForProperty("CustomDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanActionInternal)this).CustomDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanActionDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("ActionName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanActionInternal)this).ActionName = (string) content.GetValueForProperty("ActionName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanActionInternal)this).ActionName, global::System.Convert.ToString); + } + if (content.Contains("FailoverType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanActionInternal)this).FailoverType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ReplicationProtectedItemOperation[]) content.GetValueForProperty("FailoverType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanActionInternal)this).FailoverType, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ReplicationProtectedItemOperation.CreateFrom)); + } + if (content.Contains("FailoverDirection")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanActionInternal)this).FailoverDirection = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections[]) content.GetValueForProperty("FailoverDirection",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanActionInternal)this).FailoverDirection, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections.CreateFrom)); + } + if (content.Contains("CustomDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanActionInternal)this).CustomDetailInstanceType = (string) content.GetValueForProperty("CustomDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanActionInternal)this).CustomDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Recovery plan action details. + [System.ComponentModel.TypeConverter(typeof(RecoveryPlanActionTypeConverter))] + public partial interface IRecoveryPlanAction + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanAction.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanAction.TypeConverter.cs new file mode 100644 index 000000000000..df5e872522e9 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanAction.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class RecoveryPlanActionTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanAction ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanAction).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return RecoveryPlanAction.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return RecoveryPlanAction.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return RecoveryPlanAction.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanAction.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanAction.cs new file mode 100644 index 000000000000..45dad5920948 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanAction.cs @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Recovery plan action details. + public partial class RecoveryPlanAction : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanAction, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanActionInternal + { + + /// Backing field for property. + private string _actionName; + + /// The action name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ActionName { get => this._actionName; set => this._actionName = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanActionDetails _customDetail; + + /// The custom details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanActionDetails CustomDetail { get => (this._customDetail = this._customDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanActionDetails()); set => this._customDetail = value; } + + /// + /// Gets the type of action details (see RecoveryPlanActionDetailsTypes enum for possible values). + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string CustomDetailInstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanActionDetailsInternal)CustomDetail).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanActionDetailsInternal)CustomDetail).InstanceType = value ; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections[] _failoverDirection; + + /// The list of failover directions. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections[] FailoverDirection { get => this._failoverDirection; set => this._failoverDirection = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ReplicationProtectedItemOperation[] _failoverType; + + /// The list of failover types. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ReplicationProtectedItemOperation[] FailoverType { get => this._failoverType; set => this._failoverType = value; } + + /// Internal Acessors for CustomDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanActionDetails Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanActionInternal.CustomDetail { get => (this._customDetail = this._customDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanActionDetails()); set { {_customDetail = value;} } } + + /// Creates an new instance. + public RecoveryPlanAction() + { + + } + } + /// Recovery plan action details. + public partial interface IRecoveryPlanAction : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The action name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The action name.", + SerializedName = @"actionName", + PossibleTypes = new [] { typeof(string) })] + string ActionName { get; set; } + /// + /// Gets the type of action details (see RecoveryPlanActionDetailsTypes enum for possible values). + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets the type of action details (see RecoveryPlanActionDetailsTypes enum for possible values).", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string CustomDetailInstanceType { get; set; } + /// The list of failover directions. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The list of failover directions.", + SerializedName = @"failoverDirections", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections[] FailoverDirection { get; set; } + /// The list of failover types. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The list of failover types.", + SerializedName = @"failoverTypes", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ReplicationProtectedItemOperation) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ReplicationProtectedItemOperation[] FailoverType { get; set; } + + } + /// Recovery plan action details. + internal partial interface IRecoveryPlanActionInternal + + { + /// The action name. + string ActionName { get; set; } + /// The custom details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanActionDetails CustomDetail { get; set; } + /// + /// Gets the type of action details (see RecoveryPlanActionDetailsTypes enum for possible values). + /// + string CustomDetailInstanceType { get; set; } + /// The list of failover directions. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections[] FailoverDirection { get; set; } + /// The list of failover types. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ReplicationProtectedItemOperation[] FailoverType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanAction.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanAction.json.cs new file mode 100644 index 000000000000..b36a21c8b49a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanAction.json.cs @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Recovery plan action details. + public partial class RecoveryPlanAction + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanAction. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanAction. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanAction FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new RecoveryPlanAction(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal RecoveryPlanAction(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_customDetail = If( json?.PropertyT("customDetails"), out var __jsonCustomDetails) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanActionDetails.FromJson(__jsonCustomDetails) : CustomDetail;} + {_actionName = If( json?.PropertyT("actionName"), out var __jsonActionName) ? (string)__jsonActionName : (string)ActionName;} + {_failoverType = If( json?.PropertyT("failoverTypes"), out var __jsonFailoverTypes) ? If( __jsonFailoverTypes as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ReplicationProtectedItemOperation) (__u is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString __t ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ReplicationProtectedItemOperation)(__t.ToString()) : ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ReplicationProtectedItemOperation)""))) ))() : null : FailoverType;} + {_failoverDirection = If( json?.PropertyT("failoverDirections"), out var __jsonFailoverDirections) ? If( __jsonFailoverDirections as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __q) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__q, (__p)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections) (__p is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString __o ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections)(__o.ToString()) : ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections)""))) ))() : null : FailoverDirection;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._customDetail ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._customDetail.ToJson(null,serializationMode) : null, "customDetails" ,container.Add ); + AddIf( null != (((object)this._actionName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._actionName.ToString()) : null, "actionName" ,container.Add ); + if (null != this._failoverType) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._failoverType ) + { + AddIf(null != (((object)__x)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(__x.ToString()) : null ,__w.Add); + } + container.Add("failoverTypes",__w); + } + if (null != this._failoverDirection) + { + var __r = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __s in this._failoverDirection ) + { + AddIf(null != (((object)__s)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(__s.ToString()) : null ,__r.Add); + } + container.Add("failoverDirections",__r); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanActionDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanActionDetails.PowerShell.cs new file mode 100644 index 000000000000..4afe6858ed6c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanActionDetails.PowerShell.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Recovery plan action custom details. + [System.ComponentModel.TypeConverter(typeof(RecoveryPlanActionDetailsTypeConverter))] + public partial class RecoveryPlanActionDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanActionDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new RecoveryPlanActionDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanActionDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new RecoveryPlanActionDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanActionDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal RecoveryPlanActionDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanActionDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanActionDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal RecoveryPlanActionDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanActionDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanActionDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Recovery plan action custom details. + [System.ComponentModel.TypeConverter(typeof(RecoveryPlanActionDetailsTypeConverter))] + public partial interface IRecoveryPlanActionDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanActionDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanActionDetails.TypeConverter.cs new file mode 100644 index 000000000000..c60fb466b69b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanActionDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class RecoveryPlanActionDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanActionDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanActionDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return RecoveryPlanActionDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return RecoveryPlanActionDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return RecoveryPlanActionDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanActionDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanActionDetails.cs new file mode 100644 index 000000000000..7545e5b7e123 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanActionDetails.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Recovery plan action custom details. + public partial class RecoveryPlanActionDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanActionDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanActionDetailsInternal + { + + /// Backing field for property. + private string _instanceType; + + /// + /// Gets the type of action details (see RecoveryPlanActionDetailsTypes enum for possible values). + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string InstanceType { get => this._instanceType; set => this._instanceType = value; } + + /// Creates an new instance. + public RecoveryPlanActionDetails() + { + + } + } + /// Recovery plan action custom details. + public partial interface IRecoveryPlanActionDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// + /// Gets the type of action details (see RecoveryPlanActionDetailsTypes enum for possible values). + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets the type of action details (see RecoveryPlanActionDetailsTypes enum for possible values).", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string InstanceType { get; set; } + + } + /// Recovery plan action custom details. + internal partial interface IRecoveryPlanActionDetailsInternal + + { + /// + /// Gets the type of action details (see RecoveryPlanActionDetailsTypes enum for possible values). + /// + string InstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanActionDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanActionDetails.json.cs new file mode 100644 index 000000000000..17e018b71121 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanActionDetails.json.cs @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Recovery plan action custom details. + public partial class RecoveryPlanActionDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanActionDetails. + /// Note: the Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanActionDetails interface is polymorphic, + /// and the precise model class that will get deserialized is determined at runtime based on the payload. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanActionDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanActionDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + if (!(node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json)) + { + return null; + } + // Polymorphic type -- select the appropriate constructor using the discriminator + + switch ( json.StringProperty("instanceType") ) + { + case "AutomationRunbookActionDetails": + { + return new RecoveryPlanAutomationRunbookActionDetails(json); + } + case "ManualActionDetails": + { + return new RecoveryPlanManualActionDetails(json); + } + case "ScriptActionDetails": + { + return new RecoveryPlanScriptActionDetails(json); + } + } + return new RecoveryPlanActionDetails(json); + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal RecoveryPlanActionDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_instanceType = If( json?.PropertyT("instanceType"), out var __jsonInstanceType) ? (string)__jsonInstanceType : (string)InstanceType;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._instanceType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._instanceType.ToString()) : null, "instanceType" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanAutomationRunbookActionDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanAutomationRunbookActionDetails.PowerShell.cs new file mode 100644 index 000000000000..3cc5f1557640 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanAutomationRunbookActionDetails.PowerShell.cs @@ -0,0 +1,173 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Recovery plan Automation runbook action details. + [System.ComponentModel.TypeConverter(typeof(RecoveryPlanAutomationRunbookActionDetailsTypeConverter))] + public partial class RecoveryPlanAutomationRunbookActionDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanAutomationRunbookActionDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new RecoveryPlanAutomationRunbookActionDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanAutomationRunbookActionDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new RecoveryPlanAutomationRunbookActionDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a + /// json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanAutomationRunbookActionDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal RecoveryPlanAutomationRunbookActionDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("RunbookId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanAutomationRunbookActionDetailsInternal)this).RunbookId = (string) content.GetValueForProperty("RunbookId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanAutomationRunbookActionDetailsInternal)this).RunbookId, global::System.Convert.ToString); + } + if (content.Contains("Timeout")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanAutomationRunbookActionDetailsInternal)this).Timeout = (string) content.GetValueForProperty("Timeout",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanAutomationRunbookActionDetailsInternal)this).Timeout, global::System.Convert.ToString); + } + if (content.Contains("FabricLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanAutomationRunbookActionDetailsInternal)this).FabricLocation = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPlanActionLocation) content.GetValueForProperty("FabricLocation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanAutomationRunbookActionDetailsInternal)this).FabricLocation, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPlanActionLocation.CreateFrom); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanActionDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanActionDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal RecoveryPlanAutomationRunbookActionDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("RunbookId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanAutomationRunbookActionDetailsInternal)this).RunbookId = (string) content.GetValueForProperty("RunbookId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanAutomationRunbookActionDetailsInternal)this).RunbookId, global::System.Convert.ToString); + } + if (content.Contains("Timeout")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanAutomationRunbookActionDetailsInternal)this).Timeout = (string) content.GetValueForProperty("Timeout",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanAutomationRunbookActionDetailsInternal)this).Timeout, global::System.Convert.ToString); + } + if (content.Contains("FabricLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanAutomationRunbookActionDetailsInternal)this).FabricLocation = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPlanActionLocation) content.GetValueForProperty("FabricLocation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanAutomationRunbookActionDetailsInternal)this).FabricLocation, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPlanActionLocation.CreateFrom); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanActionDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanActionDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Recovery plan Automation runbook action details. + [System.ComponentModel.TypeConverter(typeof(RecoveryPlanAutomationRunbookActionDetailsTypeConverter))] + public partial interface IRecoveryPlanAutomationRunbookActionDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanAutomationRunbookActionDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanAutomationRunbookActionDetails.TypeConverter.cs new file mode 100644 index 000000000000..cd80ab0fab5f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanAutomationRunbookActionDetails.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class RecoveryPlanAutomationRunbookActionDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanAutomationRunbookActionDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanAutomationRunbookActionDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return RecoveryPlanAutomationRunbookActionDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return RecoveryPlanAutomationRunbookActionDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return RecoveryPlanAutomationRunbookActionDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanAutomationRunbookActionDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanAutomationRunbookActionDetails.cs new file mode 100644 index 000000000000..acc0ae40139c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanAutomationRunbookActionDetails.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Recovery plan Automation runbook action details. + public partial class RecoveryPlanAutomationRunbookActionDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanAutomationRunbookActionDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanAutomationRunbookActionDetailsInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanActionDetails __recoveryPlanActionDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanActionDetails(); + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPlanActionLocation _fabricLocation; + + /// The fabric location. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPlanActionLocation FabricLocation { get => this._fabricLocation; set => this._fabricLocation = value; } + + /// + /// Gets the type of action details (see RecoveryPlanActionDetailsTypes enum for possible values). + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanActionDetailsInternal)__recoveryPlanActionDetails).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanActionDetailsInternal)__recoveryPlanActionDetails).InstanceType = value ; } + + /// Backing field for property. + private string _runbookId; + + /// The runbook ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RunbookId { get => this._runbookId; set => this._runbookId = value; } + + /// Backing field for property. + private string _timeout; + + /// The runbook timeout. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Timeout { get => this._timeout; set => this._timeout = value; } + + /// + /// Creates an new instance. + /// + public RecoveryPlanAutomationRunbookActionDetails() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__recoveryPlanActionDetails), __recoveryPlanActionDetails); + await eventListener.AssertObjectIsValid(nameof(__recoveryPlanActionDetails), __recoveryPlanActionDetails); + } + } + /// Recovery plan Automation runbook action details. + public partial interface IRecoveryPlanAutomationRunbookActionDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanActionDetails + { + /// The fabric location. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The fabric location.", + SerializedName = @"fabricLocation", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPlanActionLocation) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPlanActionLocation FabricLocation { get; set; } + /// The runbook ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The runbook ARM Id.", + SerializedName = @"runbookId", + PossibleTypes = new [] { typeof(string) })] + string RunbookId { get; set; } + /// The runbook timeout. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The runbook timeout.", + SerializedName = @"timeout", + PossibleTypes = new [] { typeof(string) })] + string Timeout { get; set; } + + } + /// Recovery plan Automation runbook action details. + internal partial interface IRecoveryPlanAutomationRunbookActionDetailsInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanActionDetailsInternal + { + /// The fabric location. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPlanActionLocation FabricLocation { get; set; } + /// The runbook ARM Id. + string RunbookId { get; set; } + /// The runbook timeout. + string Timeout { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanAutomationRunbookActionDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanAutomationRunbookActionDetails.json.cs new file mode 100644 index 000000000000..b89f10cbcba8 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanAutomationRunbookActionDetails.json.cs @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Recovery plan Automation runbook action details. + public partial class RecoveryPlanAutomationRunbookActionDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanAutomationRunbookActionDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanAutomationRunbookActionDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanAutomationRunbookActionDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new RecoveryPlanAutomationRunbookActionDetails(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal RecoveryPlanAutomationRunbookActionDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __recoveryPlanActionDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanActionDetails(json); + {_runbookId = If( json?.PropertyT("runbookId"), out var __jsonRunbookId) ? (string)__jsonRunbookId : (string)RunbookId;} + {_timeout = If( json?.PropertyT("timeout"), out var __jsonTimeout) ? (string)__jsonTimeout : (string)Timeout;} + {_fabricLocation = If( json?.PropertyT("fabricLocation"), out var __jsonFabricLocation) ? (string)__jsonFabricLocation : (string)FabricLocation;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __recoveryPlanActionDetails?.ToJson(container, serializationMode); + AddIf( null != (((object)this._runbookId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._runbookId.ToString()) : null, "runbookId" ,container.Add ); + AddIf( null != (((object)this._timeout)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._timeout.ToString()) : null, "timeout" ,container.Add ); + AddIf( null != (((object)this._fabricLocation)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._fabricLocation.ToString()) : null, "fabricLocation" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanCollection.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanCollection.PowerShell.cs new file mode 100644 index 000000000000..132c6fed62bf --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanCollection.PowerShell.cs @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Recovery plan collection details. + [System.ComponentModel.TypeConverter(typeof(RecoveryPlanCollectionTypeConverter))] + public partial class RecoveryPlanCollection + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanCollection DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new RecoveryPlanCollection(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanCollection DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new RecoveryPlanCollection(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanCollection FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal RecoveryPlanCollection(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanCollectionInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanCollectionInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal RecoveryPlanCollection(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanCollectionInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanCollectionInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Recovery plan collection details. + [System.ComponentModel.TypeConverter(typeof(RecoveryPlanCollectionTypeConverter))] + public partial interface IRecoveryPlanCollection + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanCollection.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanCollection.TypeConverter.cs new file mode 100644 index 000000000000..72876b6def93 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanCollection.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class RecoveryPlanCollectionTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanCollection ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanCollection).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return RecoveryPlanCollection.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return RecoveryPlanCollection.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return RecoveryPlanCollection.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanCollection.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanCollection.cs new file mode 100644 index 000000000000..0667621149d9 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanCollection.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Recovery plan collection details. + public partial class RecoveryPlanCollection : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanCollection, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanCollectionInternal + { + + /// Backing field for property. + private string _nextLink; + + /// The value of next link. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string NextLink { get => this._nextLink; set => this._nextLink = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan[] _value; + + /// The list of recovery plans. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan[] Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public RecoveryPlanCollection() + { + + } + } + /// Recovery plan collection details. + public partial interface IRecoveryPlanCollection : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The value of next link. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The value of next link.", + SerializedName = @"nextLink", + PossibleTypes = new [] { typeof(string) })] + string NextLink { get; set; } + /// The list of recovery plans. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of recovery plans.", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan[] Value { get; set; } + + } + /// Recovery plan collection details. + internal partial interface IRecoveryPlanCollectionInternal + + { + /// The value of next link. + string NextLink { get; set; } + /// The list of recovery plans. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan[] Value { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanCollection.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanCollection.json.cs new file mode 100644 index 000000000000..c6e57a71e982 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanCollection.json.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Recovery plan collection details. + public partial class RecoveryPlanCollection + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanCollection. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanCollection. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanCollection FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new RecoveryPlanCollection(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal RecoveryPlanCollection(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlan.FromJson(__u) )) ))() : null : Value;} + {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)NextLink;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._value) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._value ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("value",__w); + } + AddIf( null != (((object)this._nextLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanGroup.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanGroup.PowerShell.cs new file mode 100644 index 000000000000..cd51ce158d71 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanGroup.PowerShell.cs @@ -0,0 +1,168 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Recovery plan group details. + [System.ComponentModel.TypeConverter(typeof(RecoveryPlanGroupTypeConverter))] + public partial class RecoveryPlanGroup + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroup DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new RecoveryPlanGroup(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroup DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new RecoveryPlanGroup(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroup FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal RecoveryPlanGroup(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("GroupType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroupInternal)this).GroupType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPlanGroupType) content.GetValueForProperty("GroupType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroupInternal)this).GroupType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPlanGroupType.CreateFrom); + } + if (content.Contains("ReplicationProtectedItem")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroupInternal)this).ReplicationProtectedItem = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProtectedItem[]) content.GetValueForProperty("ReplicationProtectedItem",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroupInternal)this).ReplicationProtectedItem, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanProtectedItemTypeConverter.ConvertFrom)); + } + if (content.Contains("StartGroupAction")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroupInternal)this).StartGroupAction = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanAction[]) content.GetValueForProperty("StartGroupAction",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroupInternal)this).StartGroupAction, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanActionTypeConverter.ConvertFrom)); + } + if (content.Contains("EndGroupAction")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroupInternal)this).EndGroupAction = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanAction[]) content.GetValueForProperty("EndGroupAction",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroupInternal)this).EndGroupAction, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanActionTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal RecoveryPlanGroup(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("GroupType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroupInternal)this).GroupType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPlanGroupType) content.GetValueForProperty("GroupType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroupInternal)this).GroupType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPlanGroupType.CreateFrom); + } + if (content.Contains("ReplicationProtectedItem")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroupInternal)this).ReplicationProtectedItem = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProtectedItem[]) content.GetValueForProperty("ReplicationProtectedItem",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroupInternal)this).ReplicationProtectedItem, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanProtectedItemTypeConverter.ConvertFrom)); + } + if (content.Contains("StartGroupAction")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroupInternal)this).StartGroupAction = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanAction[]) content.GetValueForProperty("StartGroupAction",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroupInternal)this).StartGroupAction, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanActionTypeConverter.ConvertFrom)); + } + if (content.Contains("EndGroupAction")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroupInternal)this).EndGroupAction = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanAction[]) content.GetValueForProperty("EndGroupAction",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroupInternal)this).EndGroupAction, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanActionTypeConverter.ConvertFrom)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Recovery plan group details. + [System.ComponentModel.TypeConverter(typeof(RecoveryPlanGroupTypeConverter))] + public partial interface IRecoveryPlanGroup + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanGroup.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanGroup.TypeConverter.cs new file mode 100644 index 000000000000..fdc180439060 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanGroup.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class RecoveryPlanGroupTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroup ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroup).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return RecoveryPlanGroup.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return RecoveryPlanGroup.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return RecoveryPlanGroup.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanGroup.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanGroup.cs new file mode 100644 index 000000000000..7d4e89102f40 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanGroup.cs @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Recovery plan group details. + public partial class RecoveryPlanGroup : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroup, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroupInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanAction[] _endGroupAction; + + /// The end group actions. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanAction[] EndGroupAction { get => this._endGroupAction; set => this._endGroupAction = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPlanGroupType _groupType; + + /// The group type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPlanGroupType GroupType { get => this._groupType; set => this._groupType = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProtectedItem[] _replicationProtectedItem; + + /// The list of protected items. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProtectedItem[] ReplicationProtectedItem { get => this._replicationProtectedItem; set => this._replicationProtectedItem = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanAction[] _startGroupAction; + + /// The start group actions. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanAction[] StartGroupAction { get => this._startGroupAction; set => this._startGroupAction = value; } + + /// Creates an new instance. + public RecoveryPlanGroup() + { + + } + } + /// Recovery plan group details. + public partial interface IRecoveryPlanGroup : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The end group actions. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The end group actions.", + SerializedName = @"endGroupActions", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanAction) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanAction[] EndGroupAction { get; set; } + /// The group type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The group type.", + SerializedName = @"groupType", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPlanGroupType) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPlanGroupType GroupType { get; set; } + /// The list of protected items. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of protected items.", + SerializedName = @"replicationProtectedItems", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProtectedItem) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProtectedItem[] ReplicationProtectedItem { get; set; } + /// The start group actions. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The start group actions.", + SerializedName = @"startGroupActions", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanAction) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanAction[] StartGroupAction { get; set; } + + } + /// Recovery plan group details. + internal partial interface IRecoveryPlanGroupInternal + + { + /// The end group actions. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanAction[] EndGroupAction { get; set; } + /// The group type. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPlanGroupType GroupType { get; set; } + /// The list of protected items. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProtectedItem[] ReplicationProtectedItem { get; set; } + /// The start group actions. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanAction[] StartGroupAction { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanGroup.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanGroup.json.cs new file mode 100644 index 000000000000..f08e57aea373 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanGroup.json.cs @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Recovery plan group details. + public partial class RecoveryPlanGroup + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroup. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroup. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroup FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new RecoveryPlanGroup(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal RecoveryPlanGroup(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_groupType = If( json?.PropertyT("groupType"), out var __jsonGroupType) ? (string)__jsonGroupType : (string)GroupType;} + {_replicationProtectedItem = If( json?.PropertyT("replicationProtectedItems"), out var __jsonReplicationProtectedItems) ? If( __jsonReplicationProtectedItems as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProtectedItem) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanProtectedItem.FromJson(__u) )) ))() : null : ReplicationProtectedItem;} + {_startGroupAction = If( json?.PropertyT("startGroupActions"), out var __jsonStartGroupActions) ? If( __jsonStartGroupActions as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __q) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__q, (__p)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanAction) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanAction.FromJson(__p) )) ))() : null : StartGroupAction;} + {_endGroupAction = If( json?.PropertyT("endGroupActions"), out var __jsonEndGroupActions) ? If( __jsonEndGroupActions as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __l) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__l, (__k)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanAction) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanAction.FromJson(__k) )) ))() : null : EndGroupAction;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._groupType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._groupType.ToString()) : null, "groupType" ,container.Add ); + if (null != this._replicationProtectedItem) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._replicationProtectedItem ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("replicationProtectedItems",__w); + } + if (null != this._startGroupAction) + { + var __r = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __s in this._startGroupAction ) + { + AddIf(__s?.ToJson(null, serializationMode) ,__r.Add); + } + container.Add("startGroupActions",__r); + } + if (null != this._endGroupAction) + { + var __m = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __n in this._endGroupAction ) + { + AddIf(__n?.ToJson(null, serializationMode) ,__m.Add); + } + container.Add("endGroupActions",__m); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanGroupTaskDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanGroupTaskDetails.PowerShell.cs new file mode 100644 index 000000000000..6be5c6af8f5c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanGroupTaskDetails.PowerShell.cs @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// This class represents the recovery plan group task. + [System.ComponentModel.TypeConverter(typeof(RecoveryPlanGroupTaskDetailsTypeConverter))] + public partial class RecoveryPlanGroupTaskDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroupTaskDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new RecoveryPlanGroupTaskDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroupTaskDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new RecoveryPlanGroupTaskDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroupTaskDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal RecoveryPlanGroupTaskDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroupTaskDetailsInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroupTaskDetailsInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("GroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroupTaskDetailsInternal)this).GroupId = (string) content.GetValueForProperty("GroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroupTaskDetailsInternal)this).GroupId, global::System.Convert.ToString); + } + if (content.Contains("RpGroupType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroupTaskDetailsInternal)this).RpGroupType = (string) content.GetValueForProperty("RpGroupType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroupTaskDetailsInternal)this).RpGroupType, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IGroupTaskDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IGroupTaskDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + if (content.Contains("ChildTask")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IGroupTaskDetailsInternal)this).ChildTask = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTask[]) content.GetValueForProperty("ChildTask",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IGroupTaskDetailsInternal)this).ChildTask, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AsrTaskTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal RecoveryPlanGroupTaskDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroupTaskDetailsInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroupTaskDetailsInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("GroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroupTaskDetailsInternal)this).GroupId = (string) content.GetValueForProperty("GroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroupTaskDetailsInternal)this).GroupId, global::System.Convert.ToString); + } + if (content.Contains("RpGroupType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroupTaskDetailsInternal)this).RpGroupType = (string) content.GetValueForProperty("RpGroupType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroupTaskDetailsInternal)this).RpGroupType, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IGroupTaskDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IGroupTaskDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + if (content.Contains("ChildTask")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IGroupTaskDetailsInternal)this).ChildTask = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTask[]) content.GetValueForProperty("ChildTask",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IGroupTaskDetailsInternal)this).ChildTask, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AsrTaskTypeConverter.ConvertFrom)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// This class represents the recovery plan group task. + [System.ComponentModel.TypeConverter(typeof(RecoveryPlanGroupTaskDetailsTypeConverter))] + public partial interface IRecoveryPlanGroupTaskDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanGroupTaskDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanGroupTaskDetails.TypeConverter.cs new file mode 100644 index 000000000000..68249089f933 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanGroupTaskDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class RecoveryPlanGroupTaskDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroupTaskDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroupTaskDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return RecoveryPlanGroupTaskDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return RecoveryPlanGroupTaskDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return RecoveryPlanGroupTaskDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanGroupTaskDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanGroupTaskDetails.cs new file mode 100644 index 000000000000..f5aae981db31 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanGroupTaskDetails.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// This class represents the recovery plan group task. + public partial class RecoveryPlanGroupTaskDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroupTaskDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroupTaskDetailsInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IGroupTaskDetails __groupTaskDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.GroupTaskDetails(); + + /// The child tasks. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTask[] ChildTask { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IGroupTaskDetailsInternal)__groupTaskDetails).ChildTask; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IGroupTaskDetailsInternal)__groupTaskDetails).ChildTask = value ?? null /* arrayOf */; } + + /// Backing field for property. + private string _groupId; + + /// The group identifier. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string GroupId { get => this._groupId; set => this._groupId = value; } + + /// The type of task details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IGroupTaskDetailsInternal)__groupTaskDetails).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IGroupTaskDetailsInternal)__groupTaskDetails).InstanceType = value ; } + + /// Backing field for property. + private string _name; + + /// The name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Name { get => this._name; set => this._name = value; } + + /// Backing field for property. + private string _rpGroupType; + + /// The group type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RpGroupType { get => this._rpGroupType; set => this._rpGroupType = value; } + + /// Creates an new instance. + public RecoveryPlanGroupTaskDetails() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__groupTaskDetails), __groupTaskDetails); + await eventListener.AssertObjectIsValid(nameof(__groupTaskDetails), __groupTaskDetails); + } + } + /// This class represents the recovery plan group task. + public partial interface IRecoveryPlanGroupTaskDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IGroupTaskDetails + { + /// The group identifier. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The group identifier.", + SerializedName = @"groupId", + PossibleTypes = new [] { typeof(string) })] + string GroupId { get; set; } + /// The name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string Name { get; set; } + /// The group type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The group type.", + SerializedName = @"rpGroupType", + PossibleTypes = new [] { typeof(string) })] + string RpGroupType { get; set; } + + } + /// This class represents the recovery plan group task. + internal partial interface IRecoveryPlanGroupTaskDetailsInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IGroupTaskDetailsInternal + { + /// The group identifier. + string GroupId { get; set; } + /// The name. + string Name { get; set; } + /// The group type. + string RpGroupType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanGroupTaskDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanGroupTaskDetails.json.cs new file mode 100644 index 000000000000..75973a30d939 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanGroupTaskDetails.json.cs @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// This class represents the recovery plan group task. + public partial class RecoveryPlanGroupTaskDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroupTaskDetails. + /// Note: the Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroupTaskDetails interface is + /// polymorphic, and the precise model class that will get deserialized is determined at runtime based on the payload. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroupTaskDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroupTaskDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + if (!(node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json)) + { + return null; + } + // Polymorphic type -- select the appropriate constructor using the discriminator + + switch ( json.StringProperty("instanceType") ) + { + case "RecoveryPlanShutdownGroupTaskDetails": + { + return new RecoveryPlanShutdownGroupTaskDetails(json); + } + } + return new RecoveryPlanGroupTaskDetails(json); + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal RecoveryPlanGroupTaskDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __groupTaskDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.GroupTaskDetails(json); + {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)Name;} + {_groupId = If( json?.PropertyT("groupId"), out var __jsonGroupId) ? (string)__jsonGroupId : (string)GroupId;} + {_rpGroupType = If( json?.PropertyT("rpGroupType"), out var __jsonRpGroupType) ? (string)__jsonRpGroupType : (string)RpGroupType;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __groupTaskDetails?.ToJson(container, serializationMode); + AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); + AddIf( null != (((object)this._groupId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._groupId.ToString()) : null, "groupId" ,container.Add ); + AddIf( null != (((object)this._rpGroupType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._rpGroupType.ToString()) : null, "rpGroupType" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanHyperVReplicaAzureFailbackInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanHyperVReplicaAzureFailbackInput.PowerShell.cs new file mode 100644 index 000000000000..ce953eef2fb6 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanHyperVReplicaAzureFailbackInput.PowerShell.cs @@ -0,0 +1,165 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Recovery plan HVR Azure failback input. + [System.ComponentModel.TypeConverter(typeof(RecoveryPlanHyperVReplicaAzureFailbackInputTypeConverter))] + public partial class RecoveryPlanHyperVReplicaAzureFailbackInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanHyperVReplicaAzureFailbackInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new RecoveryPlanHyperVReplicaAzureFailbackInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanHyperVReplicaAzureFailbackInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new RecoveryPlanHyperVReplicaAzureFailbackInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a + /// json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanHyperVReplicaAzureFailbackInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal RecoveryPlanHyperVReplicaAzureFailbackInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DataSyncOption")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanHyperVReplicaAzureFailbackInputInternal)this).DataSyncOption = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DataSyncStatus) content.GetValueForProperty("DataSyncOption",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanHyperVReplicaAzureFailbackInputInternal)this).DataSyncOption, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DataSyncStatus.CreateFrom); + } + if (content.Contains("RecoveryVMCreationOption")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanHyperVReplicaAzureFailbackInputInternal)this).RecoveryVMCreationOption = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AlternateLocationRecoveryOption) content.GetValueForProperty("RecoveryVMCreationOption",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanHyperVReplicaAzureFailbackInputInternal)this).RecoveryVMCreationOption, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AlternateLocationRecoveryOption.CreateFrom); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal RecoveryPlanHyperVReplicaAzureFailbackInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DataSyncOption")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanHyperVReplicaAzureFailbackInputInternal)this).DataSyncOption = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DataSyncStatus) content.GetValueForProperty("DataSyncOption",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanHyperVReplicaAzureFailbackInputInternal)this).DataSyncOption, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DataSyncStatus.CreateFrom); + } + if (content.Contains("RecoveryVMCreationOption")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanHyperVReplicaAzureFailbackInputInternal)this).RecoveryVMCreationOption = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AlternateLocationRecoveryOption) content.GetValueForProperty("RecoveryVMCreationOption",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanHyperVReplicaAzureFailbackInputInternal)this).RecoveryVMCreationOption, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AlternateLocationRecoveryOption.CreateFrom); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Recovery plan HVR Azure failback input. + [System.ComponentModel.TypeConverter(typeof(RecoveryPlanHyperVReplicaAzureFailbackInputTypeConverter))] + public partial interface IRecoveryPlanHyperVReplicaAzureFailbackInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanHyperVReplicaAzureFailbackInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanHyperVReplicaAzureFailbackInput.TypeConverter.cs new file mode 100644 index 000000000000..09896cbe354c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanHyperVReplicaAzureFailbackInput.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class RecoveryPlanHyperVReplicaAzureFailbackInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanHyperVReplicaAzureFailbackInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanHyperVReplicaAzureFailbackInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return RecoveryPlanHyperVReplicaAzureFailbackInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return RecoveryPlanHyperVReplicaAzureFailbackInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return RecoveryPlanHyperVReplicaAzureFailbackInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanHyperVReplicaAzureFailbackInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanHyperVReplicaAzureFailbackInput.cs new file mode 100644 index 000000000000..34a2ce25a5e2 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanHyperVReplicaAzureFailbackInput.cs @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Recovery plan HVR Azure failback input. + public partial class RecoveryPlanHyperVReplicaAzureFailbackInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanHyperVReplicaAzureFailbackInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanHyperVReplicaAzureFailbackInputInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInput __recoveryPlanProviderSpecificFailoverInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanProviderSpecificFailoverInput(); + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DataSyncStatus _dataSyncOption; + + /// The data sync option. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DataSyncStatus DataSyncOption { get => this._dataSyncOption; set => this._dataSyncOption = value; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInputInternal)__recoveryPlanProviderSpecificFailoverInput).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInputInternal)__recoveryPlanProviderSpecificFailoverInput).InstanceType = value ; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AlternateLocationRecoveryOption _recoveryVMCreationOption; + + /// The ALR option. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AlternateLocationRecoveryOption RecoveryVMCreationOption { get => this._recoveryVMCreationOption; set => this._recoveryVMCreationOption = value; } + + /// + /// Creates an new instance. + /// + public RecoveryPlanHyperVReplicaAzureFailbackInput() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__recoveryPlanProviderSpecificFailoverInput), __recoveryPlanProviderSpecificFailoverInput); + await eventListener.AssertObjectIsValid(nameof(__recoveryPlanProviderSpecificFailoverInput), __recoveryPlanProviderSpecificFailoverInput); + } + } + /// Recovery plan HVR Azure failback input. + public partial interface IRecoveryPlanHyperVReplicaAzureFailbackInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInput + { + /// The data sync option. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The data sync option.", + SerializedName = @"dataSyncOption", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DataSyncStatus) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DataSyncStatus DataSyncOption { get; set; } + /// The ALR option. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ALR option.", + SerializedName = @"recoveryVmCreationOption", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AlternateLocationRecoveryOption) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AlternateLocationRecoveryOption RecoveryVMCreationOption { get; set; } + + } + /// Recovery plan HVR Azure failback input. + internal partial interface IRecoveryPlanHyperVReplicaAzureFailbackInputInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInputInternal + { + /// The data sync option. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DataSyncStatus DataSyncOption { get; set; } + /// The ALR option. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AlternateLocationRecoveryOption RecoveryVMCreationOption { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanHyperVReplicaAzureFailbackInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanHyperVReplicaAzureFailbackInput.json.cs new file mode 100644 index 000000000000..72b96a167070 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanHyperVReplicaAzureFailbackInput.json.cs @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Recovery plan HVR Azure failback input. + public partial class RecoveryPlanHyperVReplicaAzureFailbackInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanHyperVReplicaAzureFailbackInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanHyperVReplicaAzureFailbackInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanHyperVReplicaAzureFailbackInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new RecoveryPlanHyperVReplicaAzureFailbackInput(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal RecoveryPlanHyperVReplicaAzureFailbackInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __recoveryPlanProviderSpecificFailoverInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanProviderSpecificFailoverInput(json); + {_dataSyncOption = If( json?.PropertyT("dataSyncOption"), out var __jsonDataSyncOption) ? (string)__jsonDataSyncOption : (string)DataSyncOption;} + {_recoveryVMCreationOption = If( json?.PropertyT("recoveryVmCreationOption"), out var __jsonRecoveryVMCreationOption) ? (string)__jsonRecoveryVMCreationOption : (string)RecoveryVMCreationOption;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __recoveryPlanProviderSpecificFailoverInput?.ToJson(container, serializationMode); + AddIf( null != (((object)this._dataSyncOption)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._dataSyncOption.ToString()) : null, "dataSyncOption" ,container.Add ); + AddIf( null != (((object)this._recoveryVMCreationOption)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryVMCreationOption.ToString()) : null, "recoveryVmCreationOption" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanHyperVReplicaAzureFailoverInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanHyperVReplicaAzureFailoverInput.PowerShell.cs new file mode 100644 index 000000000000..af370e80714a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanHyperVReplicaAzureFailoverInput.PowerShell.cs @@ -0,0 +1,173 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Recovery plan HVR Azure failover input. + [System.ComponentModel.TypeConverter(typeof(RecoveryPlanHyperVReplicaAzureFailoverInputTypeConverter))] + public partial class RecoveryPlanHyperVReplicaAzureFailoverInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanHyperVReplicaAzureFailoverInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new RecoveryPlanHyperVReplicaAzureFailoverInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanHyperVReplicaAzureFailoverInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new RecoveryPlanHyperVReplicaAzureFailoverInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a + /// json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanHyperVReplicaAzureFailoverInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal RecoveryPlanHyperVReplicaAzureFailoverInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("PrimaryKekCertificatePfx")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanHyperVReplicaAzureFailoverInputInternal)this).PrimaryKekCertificatePfx = (string) content.GetValueForProperty("PrimaryKekCertificatePfx",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanHyperVReplicaAzureFailoverInputInternal)this).PrimaryKekCertificatePfx, global::System.Convert.ToString); + } + if (content.Contains("SecondaryKekCertificatePfx")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanHyperVReplicaAzureFailoverInputInternal)this).SecondaryKekCertificatePfx = (string) content.GetValueForProperty("SecondaryKekCertificatePfx",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanHyperVReplicaAzureFailoverInputInternal)this).SecondaryKekCertificatePfx, global::System.Convert.ToString); + } + if (content.Contains("RecoveryPointType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanHyperVReplicaAzureFailoverInputInternal)this).RecoveryPointType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.HyperVReplicaAzureRpRecoveryPointType?) content.GetValueForProperty("RecoveryPointType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanHyperVReplicaAzureFailoverInputInternal)this).RecoveryPointType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.HyperVReplicaAzureRpRecoveryPointType.CreateFrom); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal RecoveryPlanHyperVReplicaAzureFailoverInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("PrimaryKekCertificatePfx")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanHyperVReplicaAzureFailoverInputInternal)this).PrimaryKekCertificatePfx = (string) content.GetValueForProperty("PrimaryKekCertificatePfx",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanHyperVReplicaAzureFailoverInputInternal)this).PrimaryKekCertificatePfx, global::System.Convert.ToString); + } + if (content.Contains("SecondaryKekCertificatePfx")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanHyperVReplicaAzureFailoverInputInternal)this).SecondaryKekCertificatePfx = (string) content.GetValueForProperty("SecondaryKekCertificatePfx",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanHyperVReplicaAzureFailoverInputInternal)this).SecondaryKekCertificatePfx, global::System.Convert.ToString); + } + if (content.Contains("RecoveryPointType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanHyperVReplicaAzureFailoverInputInternal)this).RecoveryPointType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.HyperVReplicaAzureRpRecoveryPointType?) content.GetValueForProperty("RecoveryPointType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanHyperVReplicaAzureFailoverInputInternal)this).RecoveryPointType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.HyperVReplicaAzureRpRecoveryPointType.CreateFrom); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Recovery plan HVR Azure failover input. + [System.ComponentModel.TypeConverter(typeof(RecoveryPlanHyperVReplicaAzureFailoverInputTypeConverter))] + public partial interface IRecoveryPlanHyperVReplicaAzureFailoverInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanHyperVReplicaAzureFailoverInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanHyperVReplicaAzureFailoverInput.TypeConverter.cs new file mode 100644 index 000000000000..905f7e27715d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanHyperVReplicaAzureFailoverInput.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class RecoveryPlanHyperVReplicaAzureFailoverInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanHyperVReplicaAzureFailoverInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanHyperVReplicaAzureFailoverInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return RecoveryPlanHyperVReplicaAzureFailoverInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return RecoveryPlanHyperVReplicaAzureFailoverInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return RecoveryPlanHyperVReplicaAzureFailoverInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanHyperVReplicaAzureFailoverInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanHyperVReplicaAzureFailoverInput.cs new file mode 100644 index 000000000000..25c8fc1e5395 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanHyperVReplicaAzureFailoverInput.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Recovery plan HVR Azure failover input. + public partial class RecoveryPlanHyperVReplicaAzureFailoverInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanHyperVReplicaAzureFailoverInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanHyperVReplicaAzureFailoverInputInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInput __recoveryPlanProviderSpecificFailoverInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanProviderSpecificFailoverInput(); + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInputInternal)__recoveryPlanProviderSpecificFailoverInput).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInputInternal)__recoveryPlanProviderSpecificFailoverInput).InstanceType = value ; } + + /// Backing field for property. + private string _primaryKekCertificatePfx; + + /// The primary KEK certificate PFX. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string PrimaryKekCertificatePfx { get => this._primaryKekCertificatePfx; set => this._primaryKekCertificatePfx = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.HyperVReplicaAzureRpRecoveryPointType? _recoveryPointType; + + /// The recovery point type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.HyperVReplicaAzureRpRecoveryPointType? RecoveryPointType { get => this._recoveryPointType; set => this._recoveryPointType = value; } + + /// Backing field for property. + private string _secondaryKekCertificatePfx; + + /// The secondary KEK certificate PFX. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string SecondaryKekCertificatePfx { get => this._secondaryKekCertificatePfx; set => this._secondaryKekCertificatePfx = value; } + + /// + /// Creates an new instance. + /// + public RecoveryPlanHyperVReplicaAzureFailoverInput() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__recoveryPlanProviderSpecificFailoverInput), __recoveryPlanProviderSpecificFailoverInput); + await eventListener.AssertObjectIsValid(nameof(__recoveryPlanProviderSpecificFailoverInput), __recoveryPlanProviderSpecificFailoverInput); + } + } + /// Recovery plan HVR Azure failover input. + public partial interface IRecoveryPlanHyperVReplicaAzureFailoverInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInput + { + /// The primary KEK certificate PFX. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The primary KEK certificate PFX.", + SerializedName = @"primaryKekCertificatePfx", + PossibleTypes = new [] { typeof(string) })] + string PrimaryKekCertificatePfx { get; set; } + /// The recovery point type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery point type.", + SerializedName = @"recoveryPointType", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.HyperVReplicaAzureRpRecoveryPointType) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.HyperVReplicaAzureRpRecoveryPointType? RecoveryPointType { get; set; } + /// The secondary KEK certificate PFX. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The secondary KEK certificate PFX.", + SerializedName = @"secondaryKekCertificatePfx", + PossibleTypes = new [] { typeof(string) })] + string SecondaryKekCertificatePfx { get; set; } + + } + /// Recovery plan HVR Azure failover input. + internal partial interface IRecoveryPlanHyperVReplicaAzureFailoverInputInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInputInternal + { + /// The primary KEK certificate PFX. + string PrimaryKekCertificatePfx { get; set; } + /// The recovery point type. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.HyperVReplicaAzureRpRecoveryPointType? RecoveryPointType { get; set; } + /// The secondary KEK certificate PFX. + string SecondaryKekCertificatePfx { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanHyperVReplicaAzureFailoverInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanHyperVReplicaAzureFailoverInput.json.cs new file mode 100644 index 000000000000..d7ed6cbc7515 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanHyperVReplicaAzureFailoverInput.json.cs @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Recovery plan HVR Azure failover input. + public partial class RecoveryPlanHyperVReplicaAzureFailoverInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanHyperVReplicaAzureFailoverInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanHyperVReplicaAzureFailoverInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanHyperVReplicaAzureFailoverInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new RecoveryPlanHyperVReplicaAzureFailoverInput(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal RecoveryPlanHyperVReplicaAzureFailoverInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __recoveryPlanProviderSpecificFailoverInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanProviderSpecificFailoverInput(json); + {_primaryKekCertificatePfx = If( json?.PropertyT("primaryKekCertificatePfx"), out var __jsonPrimaryKekCertificatePfx) ? (string)__jsonPrimaryKekCertificatePfx : (string)PrimaryKekCertificatePfx;} + {_secondaryKekCertificatePfx = If( json?.PropertyT("secondaryKekCertificatePfx"), out var __jsonSecondaryKekCertificatePfx) ? (string)__jsonSecondaryKekCertificatePfx : (string)SecondaryKekCertificatePfx;} + {_recoveryPointType = If( json?.PropertyT("recoveryPointType"), out var __jsonRecoveryPointType) ? (string)__jsonRecoveryPointType : (string)RecoveryPointType;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __recoveryPlanProviderSpecificFailoverInput?.ToJson(container, serializationMode); + AddIf( null != (((object)this._primaryKekCertificatePfx)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._primaryKekCertificatePfx.ToString()) : null, "primaryKekCertificatePfx" ,container.Add ); + AddIf( null != (((object)this._secondaryKekCertificatePfx)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._secondaryKekCertificatePfx.ToString()) : null, "secondaryKekCertificatePfx" ,container.Add ); + AddIf( null != (((object)this._recoveryPointType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryPointType.ToString()) : null, "recoveryPointType" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanInMageAzureV2FailoverInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanInMageAzureV2FailoverInput.PowerShell.cs new file mode 100644 index 000000000000..27aa5076ed98 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanInMageAzureV2FailoverInput.PowerShell.cs @@ -0,0 +1,165 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Recovery plan InMageAzureV2 failover input. + [System.ComponentModel.TypeConverter(typeof(RecoveryPlanInMageAzureV2FailoverInputTypeConverter))] + public partial class RecoveryPlanInMageAzureV2FailoverInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInMageAzureV2FailoverInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new RecoveryPlanInMageAzureV2FailoverInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInMageAzureV2FailoverInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new RecoveryPlanInMageAzureV2FailoverInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json + /// string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInMageAzureV2FailoverInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal RecoveryPlanInMageAzureV2FailoverInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("RecoveryPointType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInMageAzureV2FailoverInputInternal)this).RecoveryPointType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.InMageV2RpRecoveryPointType) content.GetValueForProperty("RecoveryPointType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInMageAzureV2FailoverInputInternal)this).RecoveryPointType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.InMageV2RpRecoveryPointType.CreateFrom); + } + if (content.Contains("UseMultiVMSyncPoint")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInMageAzureV2FailoverInputInternal)this).UseMultiVMSyncPoint = (string) content.GetValueForProperty("UseMultiVMSyncPoint",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInMageAzureV2FailoverInputInternal)this).UseMultiVMSyncPoint, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal RecoveryPlanInMageAzureV2FailoverInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("RecoveryPointType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInMageAzureV2FailoverInputInternal)this).RecoveryPointType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.InMageV2RpRecoveryPointType) content.GetValueForProperty("RecoveryPointType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInMageAzureV2FailoverInputInternal)this).RecoveryPointType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.InMageV2RpRecoveryPointType.CreateFrom); + } + if (content.Contains("UseMultiVMSyncPoint")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInMageAzureV2FailoverInputInternal)this).UseMultiVMSyncPoint = (string) content.GetValueForProperty("UseMultiVMSyncPoint",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInMageAzureV2FailoverInputInternal)this).UseMultiVMSyncPoint, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Recovery plan InMageAzureV2 failover input. + [System.ComponentModel.TypeConverter(typeof(RecoveryPlanInMageAzureV2FailoverInputTypeConverter))] + public partial interface IRecoveryPlanInMageAzureV2FailoverInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanInMageAzureV2FailoverInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanInMageAzureV2FailoverInput.TypeConverter.cs new file mode 100644 index 000000000000..0b9be1b26400 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanInMageAzureV2FailoverInput.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class RecoveryPlanInMageAzureV2FailoverInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInMageAzureV2FailoverInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInMageAzureV2FailoverInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return RecoveryPlanInMageAzureV2FailoverInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return RecoveryPlanInMageAzureV2FailoverInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return RecoveryPlanInMageAzureV2FailoverInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanInMageAzureV2FailoverInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanInMageAzureV2FailoverInput.cs new file mode 100644 index 000000000000..3e9e0d039d74 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanInMageAzureV2FailoverInput.cs @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Recovery plan InMageAzureV2 failover input. + public partial class RecoveryPlanInMageAzureV2FailoverInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInMageAzureV2FailoverInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInMageAzureV2FailoverInputInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInput __recoveryPlanProviderSpecificFailoverInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanProviderSpecificFailoverInput(); + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInputInternal)__recoveryPlanProviderSpecificFailoverInput).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInputInternal)__recoveryPlanProviderSpecificFailoverInput).InstanceType = value ; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.InMageV2RpRecoveryPointType _recoveryPointType; + + /// The recovery point type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.InMageV2RpRecoveryPointType RecoveryPointType { get => this._recoveryPointType; set => this._recoveryPointType = value; } + + /// Backing field for property. + private string _useMultiVMSyncPoint; + + /// + /// A value indicating whether multi VM sync enabled VMs should use multi VM sync points for failover. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string UseMultiVMSyncPoint { get => this._useMultiVMSyncPoint; set => this._useMultiVMSyncPoint = value; } + + /// Creates an new instance. + public RecoveryPlanInMageAzureV2FailoverInput() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__recoveryPlanProviderSpecificFailoverInput), __recoveryPlanProviderSpecificFailoverInput); + await eventListener.AssertObjectIsValid(nameof(__recoveryPlanProviderSpecificFailoverInput), __recoveryPlanProviderSpecificFailoverInput); + } + } + /// Recovery plan InMageAzureV2 failover input. + public partial interface IRecoveryPlanInMageAzureV2FailoverInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInput + { + /// The recovery point type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The recovery point type.", + SerializedName = @"recoveryPointType", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.InMageV2RpRecoveryPointType) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.InMageV2RpRecoveryPointType RecoveryPointType { get; set; } + /// + /// A value indicating whether multi VM sync enabled VMs should use multi VM sync points for failover. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether multi VM sync enabled VMs should use multi VM sync points for failover.", + SerializedName = @"useMultiVmSyncPoint", + PossibleTypes = new [] { typeof(string) })] + string UseMultiVMSyncPoint { get; set; } + + } + /// Recovery plan InMageAzureV2 failover input. + internal partial interface IRecoveryPlanInMageAzureV2FailoverInputInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInputInternal + { + /// The recovery point type. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.InMageV2RpRecoveryPointType RecoveryPointType { get; set; } + /// + /// A value indicating whether multi VM sync enabled VMs should use multi VM sync points for failover. + /// + string UseMultiVMSyncPoint { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanInMageAzureV2FailoverInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanInMageAzureV2FailoverInput.json.cs new file mode 100644 index 000000000000..206682ce737c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanInMageAzureV2FailoverInput.json.cs @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Recovery plan InMageAzureV2 failover input. + public partial class RecoveryPlanInMageAzureV2FailoverInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInMageAzureV2FailoverInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInMageAzureV2FailoverInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInMageAzureV2FailoverInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new RecoveryPlanInMageAzureV2FailoverInput(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal RecoveryPlanInMageAzureV2FailoverInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __recoveryPlanProviderSpecificFailoverInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanProviderSpecificFailoverInput(json); + {_recoveryPointType = If( json?.PropertyT("recoveryPointType"), out var __jsonRecoveryPointType) ? (string)__jsonRecoveryPointType : (string)RecoveryPointType;} + {_useMultiVMSyncPoint = If( json?.PropertyT("useMultiVmSyncPoint"), out var __jsonUseMultiVMSyncPoint) ? (string)__jsonUseMultiVMSyncPoint : (string)UseMultiVMSyncPoint;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __recoveryPlanProviderSpecificFailoverInput?.ToJson(container, serializationMode); + AddIf( null != (((object)this._recoveryPointType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryPointType.ToString()) : null, "recoveryPointType" ,container.Add ); + AddIf( null != (((object)this._useMultiVMSyncPoint)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._useMultiVMSyncPoint.ToString()) : null, "useMultiVmSyncPoint" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanInMageFailoverInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanInMageFailoverInput.PowerShell.cs new file mode 100644 index 000000000000..5af56cc75216 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanInMageFailoverInput.PowerShell.cs @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Recovery plan InMage failover input. + [System.ComponentModel.TypeConverter(typeof(RecoveryPlanInMageFailoverInputTypeConverter))] + public partial class RecoveryPlanInMageFailoverInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInMageFailoverInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new RecoveryPlanInMageFailoverInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInMageFailoverInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new RecoveryPlanInMageFailoverInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInMageFailoverInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal RecoveryPlanInMageFailoverInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("RecoveryPointType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInMageFailoverInputInternal)this).RecoveryPointType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RpInMageRecoveryPointType) content.GetValueForProperty("RecoveryPointType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInMageFailoverInputInternal)this).RecoveryPointType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RpInMageRecoveryPointType.CreateFrom); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal RecoveryPlanInMageFailoverInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("RecoveryPointType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInMageFailoverInputInternal)this).RecoveryPointType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RpInMageRecoveryPointType) content.GetValueForProperty("RecoveryPointType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInMageFailoverInputInternal)this).RecoveryPointType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RpInMageRecoveryPointType.CreateFrom); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Recovery plan InMage failover input. + [System.ComponentModel.TypeConverter(typeof(RecoveryPlanInMageFailoverInputTypeConverter))] + public partial interface IRecoveryPlanInMageFailoverInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanInMageFailoverInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanInMageFailoverInput.TypeConverter.cs new file mode 100644 index 000000000000..ba2c1e63f366 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanInMageFailoverInput.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class RecoveryPlanInMageFailoverInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInMageFailoverInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInMageFailoverInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return RecoveryPlanInMageFailoverInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return RecoveryPlanInMageFailoverInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return RecoveryPlanInMageFailoverInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanInMageFailoverInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanInMageFailoverInput.cs new file mode 100644 index 000000000000..22308e426355 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanInMageFailoverInput.cs @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Recovery plan InMage failover input. + public partial class RecoveryPlanInMageFailoverInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInMageFailoverInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInMageFailoverInputInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInput __recoveryPlanProviderSpecificFailoverInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanProviderSpecificFailoverInput(); + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInputInternal)__recoveryPlanProviderSpecificFailoverInput).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInputInternal)__recoveryPlanProviderSpecificFailoverInput).InstanceType = value ; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RpInMageRecoveryPointType _recoveryPointType; + + /// The recovery point type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RpInMageRecoveryPointType RecoveryPointType { get => this._recoveryPointType; set => this._recoveryPointType = value; } + + /// Creates an new instance. + public RecoveryPlanInMageFailoverInput() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__recoveryPlanProviderSpecificFailoverInput), __recoveryPlanProviderSpecificFailoverInput); + await eventListener.AssertObjectIsValid(nameof(__recoveryPlanProviderSpecificFailoverInput), __recoveryPlanProviderSpecificFailoverInput); + } + } + /// Recovery plan InMage failover input. + public partial interface IRecoveryPlanInMageFailoverInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInput + { + /// The recovery point type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The recovery point type.", + SerializedName = @"recoveryPointType", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RpInMageRecoveryPointType) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RpInMageRecoveryPointType RecoveryPointType { get; set; } + + } + /// Recovery plan InMage failover input. + internal partial interface IRecoveryPlanInMageFailoverInputInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInputInternal + { + /// The recovery point type. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RpInMageRecoveryPointType RecoveryPointType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanInMageFailoverInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanInMageFailoverInput.json.cs new file mode 100644 index 000000000000..1cee99c58e49 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanInMageFailoverInput.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Recovery plan InMage failover input. + public partial class RecoveryPlanInMageFailoverInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInMageFailoverInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInMageFailoverInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInMageFailoverInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new RecoveryPlanInMageFailoverInput(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal RecoveryPlanInMageFailoverInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __recoveryPlanProviderSpecificFailoverInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanProviderSpecificFailoverInput(json); + {_recoveryPointType = If( json?.PropertyT("recoveryPointType"), out var __jsonRecoveryPointType) ? (string)__jsonRecoveryPointType : (string)RecoveryPointType;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __recoveryPlanProviderSpecificFailoverInput?.ToJson(container, serializationMode); + AddIf( null != (((object)this._recoveryPointType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryPointType.ToString()) : null, "recoveryPointType" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanInMageRcmFailbackFailoverInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanInMageRcmFailbackFailoverInput.PowerShell.cs new file mode 100644 index 000000000000..dd2c101c2fe7 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanInMageRcmFailbackFailoverInput.PowerShell.cs @@ -0,0 +1,165 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Recovery plan InMageRcmFailback failover input. + [System.ComponentModel.TypeConverter(typeof(RecoveryPlanInMageRcmFailbackFailoverInputTypeConverter))] + public partial class RecoveryPlanInMageRcmFailbackFailoverInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInMageRcmFailbackFailoverInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new RecoveryPlanInMageRcmFailbackFailoverInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInMageRcmFailbackFailoverInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new RecoveryPlanInMageRcmFailbackFailoverInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a + /// json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInMageRcmFailbackFailoverInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal RecoveryPlanInMageRcmFailbackFailoverInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("RecoveryPointType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInMageRcmFailbackFailoverInputInternal)this).RecoveryPointType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.InMageRcmFailbackRecoveryPointType) content.GetValueForProperty("RecoveryPointType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInMageRcmFailbackFailoverInputInternal)this).RecoveryPointType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.InMageRcmFailbackRecoveryPointType.CreateFrom); + } + if (content.Contains("UseMultiVMSyncPoint")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInMageRcmFailbackFailoverInputInternal)this).UseMultiVMSyncPoint = (string) content.GetValueForProperty("UseMultiVMSyncPoint",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInMageRcmFailbackFailoverInputInternal)this).UseMultiVMSyncPoint, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal RecoveryPlanInMageRcmFailbackFailoverInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("RecoveryPointType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInMageRcmFailbackFailoverInputInternal)this).RecoveryPointType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.InMageRcmFailbackRecoveryPointType) content.GetValueForProperty("RecoveryPointType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInMageRcmFailbackFailoverInputInternal)this).RecoveryPointType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.InMageRcmFailbackRecoveryPointType.CreateFrom); + } + if (content.Contains("UseMultiVMSyncPoint")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInMageRcmFailbackFailoverInputInternal)this).UseMultiVMSyncPoint = (string) content.GetValueForProperty("UseMultiVMSyncPoint",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInMageRcmFailbackFailoverInputInternal)this).UseMultiVMSyncPoint, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Recovery plan InMageRcmFailback failover input. + [System.ComponentModel.TypeConverter(typeof(RecoveryPlanInMageRcmFailbackFailoverInputTypeConverter))] + public partial interface IRecoveryPlanInMageRcmFailbackFailoverInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanInMageRcmFailbackFailoverInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanInMageRcmFailbackFailoverInput.TypeConverter.cs new file mode 100644 index 000000000000..a46ddc3e087f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanInMageRcmFailbackFailoverInput.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class RecoveryPlanInMageRcmFailbackFailoverInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInMageRcmFailbackFailoverInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInMageRcmFailbackFailoverInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return RecoveryPlanInMageRcmFailbackFailoverInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return RecoveryPlanInMageRcmFailbackFailoverInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return RecoveryPlanInMageRcmFailbackFailoverInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanInMageRcmFailbackFailoverInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanInMageRcmFailbackFailoverInput.cs new file mode 100644 index 000000000000..34632852097c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanInMageRcmFailbackFailoverInput.cs @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Recovery plan InMageRcmFailback failover input. + public partial class RecoveryPlanInMageRcmFailbackFailoverInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInMageRcmFailbackFailoverInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInMageRcmFailbackFailoverInputInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInput __recoveryPlanProviderSpecificFailoverInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanProviderSpecificFailoverInput(); + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInputInternal)__recoveryPlanProviderSpecificFailoverInput).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInputInternal)__recoveryPlanProviderSpecificFailoverInput).InstanceType = value ; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.InMageRcmFailbackRecoveryPointType _recoveryPointType; + + /// The recovery point type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.InMageRcmFailbackRecoveryPointType RecoveryPointType { get => this._recoveryPointType; set => this._recoveryPointType = value; } + + /// Backing field for property. + private string _useMultiVMSyncPoint; + + /// + /// A value indicating whether multi VM sync enabled VMs should use multi VM sync points for failover. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string UseMultiVMSyncPoint { get => this._useMultiVMSyncPoint; set => this._useMultiVMSyncPoint = value; } + + /// + /// Creates an new instance. + /// + public RecoveryPlanInMageRcmFailbackFailoverInput() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__recoveryPlanProviderSpecificFailoverInput), __recoveryPlanProviderSpecificFailoverInput); + await eventListener.AssertObjectIsValid(nameof(__recoveryPlanProviderSpecificFailoverInput), __recoveryPlanProviderSpecificFailoverInput); + } + } + /// Recovery plan InMageRcmFailback failover input. + public partial interface IRecoveryPlanInMageRcmFailbackFailoverInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInput + { + /// The recovery point type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The recovery point type.", + SerializedName = @"recoveryPointType", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.InMageRcmFailbackRecoveryPointType) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.InMageRcmFailbackRecoveryPointType RecoveryPointType { get; set; } + /// + /// A value indicating whether multi VM sync enabled VMs should use multi VM sync points for failover. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether multi VM sync enabled VMs should use multi VM sync points for failover.", + SerializedName = @"useMultiVmSyncPoint", + PossibleTypes = new [] { typeof(string) })] + string UseMultiVMSyncPoint { get; set; } + + } + /// Recovery plan InMageRcmFailback failover input. + internal partial interface IRecoveryPlanInMageRcmFailbackFailoverInputInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInputInternal + { + /// The recovery point type. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.InMageRcmFailbackRecoveryPointType RecoveryPointType { get; set; } + /// + /// A value indicating whether multi VM sync enabled VMs should use multi VM sync points for failover. + /// + string UseMultiVMSyncPoint { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanInMageRcmFailbackFailoverInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanInMageRcmFailbackFailoverInput.json.cs new file mode 100644 index 000000000000..30c29b5d4d6a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanInMageRcmFailbackFailoverInput.json.cs @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Recovery plan InMageRcmFailback failover input. + public partial class RecoveryPlanInMageRcmFailbackFailoverInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInMageRcmFailbackFailoverInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInMageRcmFailbackFailoverInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInMageRcmFailbackFailoverInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new RecoveryPlanInMageRcmFailbackFailoverInput(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal RecoveryPlanInMageRcmFailbackFailoverInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __recoveryPlanProviderSpecificFailoverInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanProviderSpecificFailoverInput(json); + {_recoveryPointType = If( json?.PropertyT("recoveryPointType"), out var __jsonRecoveryPointType) ? (string)__jsonRecoveryPointType : (string)RecoveryPointType;} + {_useMultiVMSyncPoint = If( json?.PropertyT("useMultiVmSyncPoint"), out var __jsonUseMultiVMSyncPoint) ? (string)__jsonUseMultiVMSyncPoint : (string)UseMultiVMSyncPoint;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __recoveryPlanProviderSpecificFailoverInput?.ToJson(container, serializationMode); + AddIf( null != (((object)this._recoveryPointType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryPointType.ToString()) : null, "recoveryPointType" ,container.Add ); + AddIf( null != (((object)this._useMultiVMSyncPoint)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._useMultiVMSyncPoint.ToString()) : null, "useMultiVmSyncPoint" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanInMageRcmFailoverInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanInMageRcmFailoverInput.PowerShell.cs new file mode 100644 index 000000000000..2cf1a745dfe5 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanInMageRcmFailoverInput.PowerShell.cs @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Recovery plan InMageRcm failover input. + [System.ComponentModel.TypeConverter(typeof(RecoveryPlanInMageRcmFailoverInputTypeConverter))] + public partial class RecoveryPlanInMageRcmFailoverInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInMageRcmFailoverInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new RecoveryPlanInMageRcmFailoverInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInMageRcmFailoverInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new RecoveryPlanInMageRcmFailoverInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInMageRcmFailoverInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal RecoveryPlanInMageRcmFailoverInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("RecoveryPointType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInMageRcmFailoverInputInternal)this).RecoveryPointType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPlanPointType) content.GetValueForProperty("RecoveryPointType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInMageRcmFailoverInputInternal)this).RecoveryPointType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPlanPointType.CreateFrom); + } + if (content.Contains("UseMultiVMSyncPoint")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInMageRcmFailoverInputInternal)this).UseMultiVMSyncPoint = (string) content.GetValueForProperty("UseMultiVMSyncPoint",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInMageRcmFailoverInputInternal)this).UseMultiVMSyncPoint, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal RecoveryPlanInMageRcmFailoverInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("RecoveryPointType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInMageRcmFailoverInputInternal)this).RecoveryPointType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPlanPointType) content.GetValueForProperty("RecoveryPointType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInMageRcmFailoverInputInternal)this).RecoveryPointType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPlanPointType.CreateFrom); + } + if (content.Contains("UseMultiVMSyncPoint")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInMageRcmFailoverInputInternal)this).UseMultiVMSyncPoint = (string) content.GetValueForProperty("UseMultiVMSyncPoint",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInMageRcmFailoverInputInternal)this).UseMultiVMSyncPoint, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Recovery plan InMageRcm failover input. + [System.ComponentModel.TypeConverter(typeof(RecoveryPlanInMageRcmFailoverInputTypeConverter))] + public partial interface IRecoveryPlanInMageRcmFailoverInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanInMageRcmFailoverInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanInMageRcmFailoverInput.TypeConverter.cs new file mode 100644 index 000000000000..45fa74173e51 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanInMageRcmFailoverInput.TypeConverter.cs @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class RecoveryPlanInMageRcmFailoverInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInMageRcmFailoverInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInMageRcmFailoverInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return RecoveryPlanInMageRcmFailoverInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return RecoveryPlanInMageRcmFailoverInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return RecoveryPlanInMageRcmFailoverInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanInMageRcmFailoverInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanInMageRcmFailoverInput.cs new file mode 100644 index 000000000000..3cda6293131b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanInMageRcmFailoverInput.cs @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Recovery plan InMageRcm failover input. + public partial class RecoveryPlanInMageRcmFailoverInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInMageRcmFailoverInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInMageRcmFailoverInputInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInput __recoveryPlanProviderSpecificFailoverInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanProviderSpecificFailoverInput(); + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInputInternal)__recoveryPlanProviderSpecificFailoverInput).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInputInternal)__recoveryPlanProviderSpecificFailoverInput).InstanceType = value ; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPlanPointType _recoveryPointType; + + /// The recovery point type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPlanPointType RecoveryPointType { get => this._recoveryPointType; set => this._recoveryPointType = value; } + + /// Backing field for property. + private string _useMultiVMSyncPoint; + + /// + /// A value indicating whether multi VM sync enabled VMs should use multi VM sync points for failover. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string UseMultiVMSyncPoint { get => this._useMultiVMSyncPoint; set => this._useMultiVMSyncPoint = value; } + + /// Creates an new instance. + public RecoveryPlanInMageRcmFailoverInput() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__recoveryPlanProviderSpecificFailoverInput), __recoveryPlanProviderSpecificFailoverInput); + await eventListener.AssertObjectIsValid(nameof(__recoveryPlanProviderSpecificFailoverInput), __recoveryPlanProviderSpecificFailoverInput); + } + } + /// Recovery plan InMageRcm failover input. + public partial interface IRecoveryPlanInMageRcmFailoverInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInput + { + /// The recovery point type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The recovery point type.", + SerializedName = @"recoveryPointType", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPlanPointType) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPlanPointType RecoveryPointType { get; set; } + /// + /// A value indicating whether multi VM sync enabled VMs should use multi VM sync points for failover. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether multi VM sync enabled VMs should use multi VM sync points for failover.", + SerializedName = @"useMultiVmSyncPoint", + PossibleTypes = new [] { typeof(string) })] + string UseMultiVMSyncPoint { get; set; } + + } + /// Recovery plan InMageRcm failover input. + internal partial interface IRecoveryPlanInMageRcmFailoverInputInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInputInternal + { + /// The recovery point type. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPlanPointType RecoveryPointType { get; set; } + /// + /// A value indicating whether multi VM sync enabled VMs should use multi VM sync points for failover. + /// + string UseMultiVMSyncPoint { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanInMageRcmFailoverInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanInMageRcmFailoverInput.json.cs new file mode 100644 index 000000000000..e9778362d649 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanInMageRcmFailoverInput.json.cs @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Recovery plan InMageRcm failover input. + public partial class RecoveryPlanInMageRcmFailoverInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInMageRcmFailoverInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInMageRcmFailoverInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanInMageRcmFailoverInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new RecoveryPlanInMageRcmFailoverInput(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal RecoveryPlanInMageRcmFailoverInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __recoveryPlanProviderSpecificFailoverInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanProviderSpecificFailoverInput(json); + {_recoveryPointType = If( json?.PropertyT("recoveryPointType"), out var __jsonRecoveryPointType) ? (string)__jsonRecoveryPointType : (string)RecoveryPointType;} + {_useMultiVMSyncPoint = If( json?.PropertyT("useMultiVmSyncPoint"), out var __jsonUseMultiVMSyncPoint) ? (string)__jsonUseMultiVMSyncPoint : (string)UseMultiVMSyncPoint;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __recoveryPlanProviderSpecificFailoverInput?.ToJson(container, serializationMode); + AddIf( null != (((object)this._recoveryPointType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryPointType.ToString()) : null, "recoveryPointType" ,container.Add ); + AddIf( null != (((object)this._useMultiVMSyncPoint)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._useMultiVMSyncPoint.ToString()) : null, "useMultiVmSyncPoint" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanManualActionDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanManualActionDetails.PowerShell.cs new file mode 100644 index 000000000000..92bba691b322 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanManualActionDetails.PowerShell.cs @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Recovery plan manual action details. + [System.ComponentModel.TypeConverter(typeof(RecoveryPlanManualActionDetailsTypeConverter))] + public partial class RecoveryPlanManualActionDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanManualActionDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new RecoveryPlanManualActionDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanManualActionDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new RecoveryPlanManualActionDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanManualActionDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal RecoveryPlanManualActionDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Description")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanManualActionDetailsInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanManualActionDetailsInternal)this).Description, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanActionDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanActionDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal RecoveryPlanManualActionDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Description")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanManualActionDetailsInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanManualActionDetailsInternal)this).Description, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanActionDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanActionDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Recovery plan manual action details. + [System.ComponentModel.TypeConverter(typeof(RecoveryPlanManualActionDetailsTypeConverter))] + public partial interface IRecoveryPlanManualActionDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanManualActionDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanManualActionDetails.TypeConverter.cs new file mode 100644 index 000000000000..d5b27e4ec26b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanManualActionDetails.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class RecoveryPlanManualActionDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanManualActionDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanManualActionDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return RecoveryPlanManualActionDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return RecoveryPlanManualActionDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return RecoveryPlanManualActionDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanManualActionDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanManualActionDetails.cs new file mode 100644 index 000000000000..188962f69594 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanManualActionDetails.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Recovery plan manual action details. + public partial class RecoveryPlanManualActionDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanManualActionDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanManualActionDetailsInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanActionDetails __recoveryPlanActionDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanActionDetails(); + + /// Backing field for property. + private string _description; + + /// The manual action description. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Description { get => this._description; set => this._description = value; } + + /// + /// Gets the type of action details (see RecoveryPlanActionDetailsTypes enum for possible values). + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanActionDetailsInternal)__recoveryPlanActionDetails).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanActionDetailsInternal)__recoveryPlanActionDetails).InstanceType = value ; } + + /// Creates an new instance. + public RecoveryPlanManualActionDetails() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__recoveryPlanActionDetails), __recoveryPlanActionDetails); + await eventListener.AssertObjectIsValid(nameof(__recoveryPlanActionDetails), __recoveryPlanActionDetails); + } + } + /// Recovery plan manual action details. + public partial interface IRecoveryPlanManualActionDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanActionDetails + { + /// The manual action description. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The manual action description.", + SerializedName = @"description", + PossibleTypes = new [] { typeof(string) })] + string Description { get; set; } + + } + /// Recovery plan manual action details. + internal partial interface IRecoveryPlanManualActionDetailsInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanActionDetailsInternal + { + /// The manual action description. + string Description { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanManualActionDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanManualActionDetails.json.cs new file mode 100644 index 000000000000..bc58c1f469e8 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanManualActionDetails.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Recovery plan manual action details. + public partial class RecoveryPlanManualActionDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanManualActionDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanManualActionDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanManualActionDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new RecoveryPlanManualActionDetails(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal RecoveryPlanManualActionDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __recoveryPlanActionDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanActionDetails(json); + {_description = If( json?.PropertyT("description"), out var __jsonDescription) ? (string)__jsonDescription : (string)Description;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __recoveryPlanActionDetails?.ToJson(container, serializationMode); + AddIf( null != (((object)this._description)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._description.ToString()) : null, "description" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanPlannedFailoverInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanPlannedFailoverInput.PowerShell.cs new file mode 100644 index 000000000000..71882adb2dde --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanPlannedFailoverInput.PowerShell.cs @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Recovery plan planned failover input. + [System.ComponentModel.TypeConverter(typeof(RecoveryPlanPlannedFailoverInputTypeConverter))] + public partial class RecoveryPlanPlannedFailoverInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPlannedFailoverInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new RecoveryPlanPlannedFailoverInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPlannedFailoverInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new RecoveryPlanPlannedFailoverInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPlannedFailoverInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal RecoveryPlanPlannedFailoverInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPlannedFailoverInputInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPlannedFailoverInputProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPlannedFailoverInputInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanPlannedFailoverInputPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("FailoverDirection")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPlannedFailoverInputInternal)this).FailoverDirection = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections) content.GetValueForProperty("FailoverDirection",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPlannedFailoverInputInternal)this).FailoverDirection, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections.CreateFrom); + } + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPlannedFailoverInputInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInput[]) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPlannedFailoverInputInternal)this).ProviderSpecificDetail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanProviderSpecificFailoverInputTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal RecoveryPlanPlannedFailoverInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPlannedFailoverInputInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPlannedFailoverInputProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPlannedFailoverInputInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanPlannedFailoverInputPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("FailoverDirection")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPlannedFailoverInputInternal)this).FailoverDirection = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections) content.GetValueForProperty("FailoverDirection",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPlannedFailoverInputInternal)this).FailoverDirection, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections.CreateFrom); + } + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPlannedFailoverInputInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInput[]) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPlannedFailoverInputInternal)this).ProviderSpecificDetail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanProviderSpecificFailoverInputTypeConverter.ConvertFrom)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Recovery plan planned failover input. + [System.ComponentModel.TypeConverter(typeof(RecoveryPlanPlannedFailoverInputTypeConverter))] + public partial interface IRecoveryPlanPlannedFailoverInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanPlannedFailoverInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanPlannedFailoverInput.TypeConverter.cs new file mode 100644 index 000000000000..6ec71a69d652 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanPlannedFailoverInput.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class RecoveryPlanPlannedFailoverInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPlannedFailoverInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPlannedFailoverInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return RecoveryPlanPlannedFailoverInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return RecoveryPlanPlannedFailoverInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return RecoveryPlanPlannedFailoverInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanPlannedFailoverInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanPlannedFailoverInput.cs new file mode 100644 index 000000000000..cdd2b26a7972 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanPlannedFailoverInput.cs @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Recovery plan planned failover input. + public partial class RecoveryPlanPlannedFailoverInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPlannedFailoverInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPlannedFailoverInputInternal + { + + /// The failover direction. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections FailoverDirection { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPlannedFailoverInputPropertiesInternal)Property).FailoverDirection; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPlannedFailoverInputPropertiesInternal)Property).FailoverDirection = value ; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPlannedFailoverInputProperties Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPlannedFailoverInputInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanPlannedFailoverInputProperties()); set { {_property = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPlannedFailoverInputProperties _property; + + /// The recovery plan planned failover input properties. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPlannedFailoverInputProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanPlannedFailoverInputProperties()); set => this._property = value; } + + /// The provider specific properties. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInput[] ProviderSpecificDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPlannedFailoverInputPropertiesInternal)Property).ProviderSpecificDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPlannedFailoverInputPropertiesInternal)Property).ProviderSpecificDetail = value ?? null /* arrayOf */; } + + /// Creates an new instance. + public RecoveryPlanPlannedFailoverInput() + { + + } + } + /// Recovery plan planned failover input. + public partial interface IRecoveryPlanPlannedFailoverInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The failover direction. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The failover direction.", + SerializedName = @"failoverDirection", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections FailoverDirection { get; set; } + /// The provider specific properties. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The provider specific properties.", + SerializedName = @"providerSpecificDetails", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInput) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInput[] ProviderSpecificDetail { get; set; } + + } + /// Recovery plan planned failover input. + internal partial interface IRecoveryPlanPlannedFailoverInputInternal + + { + /// The failover direction. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections FailoverDirection { get; set; } + /// The recovery plan planned failover input properties. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPlannedFailoverInputProperties Property { get; set; } + /// The provider specific properties. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInput[] ProviderSpecificDetail { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanPlannedFailoverInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanPlannedFailoverInput.json.cs new file mode 100644 index 000000000000..a4d533528aef --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanPlannedFailoverInput.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Recovery plan planned failover input. + public partial class RecoveryPlanPlannedFailoverInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPlannedFailoverInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPlannedFailoverInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPlannedFailoverInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new RecoveryPlanPlannedFailoverInput(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal RecoveryPlanPlannedFailoverInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanPlannedFailoverInputProperties.FromJson(__jsonProperties) : Property;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanPlannedFailoverInputProperties.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanPlannedFailoverInputProperties.PowerShell.cs new file mode 100644 index 000000000000..b7d710dc4aeb --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanPlannedFailoverInputProperties.PowerShell.cs @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Recovery plan planned failover input properties. + [System.ComponentModel.TypeConverter(typeof(RecoveryPlanPlannedFailoverInputPropertiesTypeConverter))] + public partial class RecoveryPlanPlannedFailoverInputProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPlannedFailoverInputProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new RecoveryPlanPlannedFailoverInputProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPlannedFailoverInputProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new RecoveryPlanPlannedFailoverInputProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a + /// json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPlannedFailoverInputProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal RecoveryPlanPlannedFailoverInputProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("FailoverDirection")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPlannedFailoverInputPropertiesInternal)this).FailoverDirection = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections) content.GetValueForProperty("FailoverDirection",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPlannedFailoverInputPropertiesInternal)this).FailoverDirection, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections.CreateFrom); + } + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPlannedFailoverInputPropertiesInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInput[]) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPlannedFailoverInputPropertiesInternal)this).ProviderSpecificDetail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanProviderSpecificFailoverInputTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal RecoveryPlanPlannedFailoverInputProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("FailoverDirection")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPlannedFailoverInputPropertiesInternal)this).FailoverDirection = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections) content.GetValueForProperty("FailoverDirection",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPlannedFailoverInputPropertiesInternal)this).FailoverDirection, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections.CreateFrom); + } + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPlannedFailoverInputPropertiesInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInput[]) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPlannedFailoverInputPropertiesInternal)this).ProviderSpecificDetail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanProviderSpecificFailoverInputTypeConverter.ConvertFrom)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Recovery plan planned failover input properties. + [System.ComponentModel.TypeConverter(typeof(RecoveryPlanPlannedFailoverInputPropertiesTypeConverter))] + public partial interface IRecoveryPlanPlannedFailoverInputProperties + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanPlannedFailoverInputProperties.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanPlannedFailoverInputProperties.TypeConverter.cs new file mode 100644 index 000000000000..887bc0601cf5 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanPlannedFailoverInputProperties.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class RecoveryPlanPlannedFailoverInputPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPlannedFailoverInputProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPlannedFailoverInputProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return RecoveryPlanPlannedFailoverInputProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return RecoveryPlanPlannedFailoverInputProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return RecoveryPlanPlannedFailoverInputProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanPlannedFailoverInputProperties.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanPlannedFailoverInputProperties.cs new file mode 100644 index 000000000000..5014f069eb7c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanPlannedFailoverInputProperties.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Recovery plan planned failover input properties. + public partial class RecoveryPlanPlannedFailoverInputProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPlannedFailoverInputProperties, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPlannedFailoverInputPropertiesInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections _failoverDirection; + + /// The failover direction. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections FailoverDirection { get => this._failoverDirection; set => this._failoverDirection = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInput[] _providerSpecificDetail; + + /// The provider specific properties. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInput[] ProviderSpecificDetail { get => this._providerSpecificDetail; set => this._providerSpecificDetail = value; } + + /// + /// Creates an new instance. + /// + public RecoveryPlanPlannedFailoverInputProperties() + { + + } + } + /// Recovery plan planned failover input properties. + public partial interface IRecoveryPlanPlannedFailoverInputProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The failover direction. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The failover direction.", + SerializedName = @"failoverDirection", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections FailoverDirection { get; set; } + /// The provider specific properties. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The provider specific properties.", + SerializedName = @"providerSpecificDetails", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInput) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInput[] ProviderSpecificDetail { get; set; } + + } + /// Recovery plan planned failover input properties. + internal partial interface IRecoveryPlanPlannedFailoverInputPropertiesInternal + + { + /// The failover direction. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections FailoverDirection { get; set; } + /// The provider specific properties. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInput[] ProviderSpecificDetail { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanPlannedFailoverInputProperties.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanPlannedFailoverInputProperties.json.cs new file mode 100644 index 000000000000..6ee80f521979 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanPlannedFailoverInputProperties.json.cs @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Recovery plan planned failover input properties. + public partial class RecoveryPlanPlannedFailoverInputProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPlannedFailoverInputProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPlannedFailoverInputProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPlannedFailoverInputProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new RecoveryPlanPlannedFailoverInputProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal RecoveryPlanPlannedFailoverInputProperties(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_failoverDirection = If( json?.PropertyT("failoverDirection"), out var __jsonFailoverDirection) ? (string)__jsonFailoverDirection : (string)FailoverDirection;} + {_providerSpecificDetail = If( json?.PropertyT("providerSpecificDetails"), out var __jsonProviderSpecificDetails) ? If( __jsonProviderSpecificDetails as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInput) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanProviderSpecificFailoverInput.FromJson(__u) )) ))() : null : ProviderSpecificDetail;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._failoverDirection)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._failoverDirection.ToString()) : null, "failoverDirection" ,container.Add ); + if (null != this._providerSpecificDetail) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._providerSpecificDetail ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("providerSpecificDetails",__w); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanProperties.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanProperties.PowerShell.cs new file mode 100644 index 000000000000..bf35e5b39272 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanProperties.PowerShell.cs @@ -0,0 +1,288 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Recovery plan properties. + [System.ComponentModel.TypeConverter(typeof(RecoveryPlanPropertiesTypeConverter))] + public partial class RecoveryPlanProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new RecoveryPlanProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new RecoveryPlanProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal RecoveryPlanProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CurrentScenario")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)this).CurrentScenario = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICurrentScenarioDetails) content.GetValueForProperty("CurrentScenario",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)this).CurrentScenario, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.CurrentScenarioDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("FriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)this).FriendlyName = (string) content.GetValueForProperty("FriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)this).FriendlyName, global::System.Convert.ToString); + } + if (content.Contains("PrimaryFabricId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)this).PrimaryFabricId = (string) content.GetValueForProperty("PrimaryFabricId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)this).PrimaryFabricId, global::System.Convert.ToString); + } + if (content.Contains("PrimaryFabricFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)this).PrimaryFabricFriendlyName = (string) content.GetValueForProperty("PrimaryFabricFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)this).PrimaryFabricFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("RecoveryFabricId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)this).RecoveryFabricId = (string) content.GetValueForProperty("RecoveryFabricId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)this).RecoveryFabricId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryFabricFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)this).RecoveryFabricFriendlyName = (string) content.GetValueForProperty("RecoveryFabricFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)this).RecoveryFabricFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("FailoverDeploymentModel")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)this).FailoverDeploymentModel = (string) content.GetValueForProperty("FailoverDeploymentModel",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)this).FailoverDeploymentModel, global::System.Convert.ToString); + } + if (content.Contains("ReplicationProvider")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)this).ReplicationProvider = (string[]) content.GetValueForProperty("ReplicationProvider",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)this).ReplicationProvider, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("AllowedOperation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)this).AllowedOperation = (string[]) content.GetValueForProperty("AllowedOperation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)this).AllowedOperation, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("LastPlannedFailoverTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)this).LastPlannedFailoverTime = (global::System.DateTime?) content.GetValueForProperty("LastPlannedFailoverTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)this).LastPlannedFailoverTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("LastUnplannedFailoverTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)this).LastUnplannedFailoverTime = (global::System.DateTime?) content.GetValueForProperty("LastUnplannedFailoverTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)this).LastUnplannedFailoverTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("LastTestFailoverTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)this).LastTestFailoverTime = (global::System.DateTime?) content.GetValueForProperty("LastTestFailoverTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)this).LastTestFailoverTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("CurrentScenarioStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)this).CurrentScenarioStatus = (string) content.GetValueForProperty("CurrentScenarioStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)this).CurrentScenarioStatus, global::System.Convert.ToString); + } + if (content.Contains("CurrentScenarioStatusDescription")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)this).CurrentScenarioStatusDescription = (string) content.GetValueForProperty("CurrentScenarioStatusDescription",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)this).CurrentScenarioStatusDescription, global::System.Convert.ToString); + } + if (content.Contains("Group")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)this).Group = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroup[]) content.GetValueForProperty("Group",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)this).Group, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanGroupTypeConverter.ConvertFrom)); + } + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificDetails[]) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)this).ProviderSpecificDetail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanProviderSpecificDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("CurrentScenarioName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)this).CurrentScenarioName = (string) content.GetValueForProperty("CurrentScenarioName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)this).CurrentScenarioName, global::System.Convert.ToString); + } + if (content.Contains("CurrentScenarioJobId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)this).CurrentScenarioJobId = (string) content.GetValueForProperty("CurrentScenarioJobId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)this).CurrentScenarioJobId, global::System.Convert.ToString); + } + if (content.Contains("CurrentScenarioStartTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)this).CurrentScenarioStartTime = (global::System.DateTime?) content.GetValueForProperty("CurrentScenarioStartTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)this).CurrentScenarioStartTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal RecoveryPlanProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CurrentScenario")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)this).CurrentScenario = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICurrentScenarioDetails) content.GetValueForProperty("CurrentScenario",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)this).CurrentScenario, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.CurrentScenarioDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("FriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)this).FriendlyName = (string) content.GetValueForProperty("FriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)this).FriendlyName, global::System.Convert.ToString); + } + if (content.Contains("PrimaryFabricId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)this).PrimaryFabricId = (string) content.GetValueForProperty("PrimaryFabricId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)this).PrimaryFabricId, global::System.Convert.ToString); + } + if (content.Contains("PrimaryFabricFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)this).PrimaryFabricFriendlyName = (string) content.GetValueForProperty("PrimaryFabricFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)this).PrimaryFabricFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("RecoveryFabricId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)this).RecoveryFabricId = (string) content.GetValueForProperty("RecoveryFabricId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)this).RecoveryFabricId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryFabricFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)this).RecoveryFabricFriendlyName = (string) content.GetValueForProperty("RecoveryFabricFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)this).RecoveryFabricFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("FailoverDeploymentModel")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)this).FailoverDeploymentModel = (string) content.GetValueForProperty("FailoverDeploymentModel",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)this).FailoverDeploymentModel, global::System.Convert.ToString); + } + if (content.Contains("ReplicationProvider")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)this).ReplicationProvider = (string[]) content.GetValueForProperty("ReplicationProvider",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)this).ReplicationProvider, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("AllowedOperation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)this).AllowedOperation = (string[]) content.GetValueForProperty("AllowedOperation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)this).AllowedOperation, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("LastPlannedFailoverTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)this).LastPlannedFailoverTime = (global::System.DateTime?) content.GetValueForProperty("LastPlannedFailoverTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)this).LastPlannedFailoverTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("LastUnplannedFailoverTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)this).LastUnplannedFailoverTime = (global::System.DateTime?) content.GetValueForProperty("LastUnplannedFailoverTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)this).LastUnplannedFailoverTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("LastTestFailoverTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)this).LastTestFailoverTime = (global::System.DateTime?) content.GetValueForProperty("LastTestFailoverTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)this).LastTestFailoverTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("CurrentScenarioStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)this).CurrentScenarioStatus = (string) content.GetValueForProperty("CurrentScenarioStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)this).CurrentScenarioStatus, global::System.Convert.ToString); + } + if (content.Contains("CurrentScenarioStatusDescription")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)this).CurrentScenarioStatusDescription = (string) content.GetValueForProperty("CurrentScenarioStatusDescription",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)this).CurrentScenarioStatusDescription, global::System.Convert.ToString); + } + if (content.Contains("Group")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)this).Group = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroup[]) content.GetValueForProperty("Group",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)this).Group, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanGroupTypeConverter.ConvertFrom)); + } + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificDetails[]) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)this).ProviderSpecificDetail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanProviderSpecificDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("CurrentScenarioName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)this).CurrentScenarioName = (string) content.GetValueForProperty("CurrentScenarioName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)this).CurrentScenarioName, global::System.Convert.ToString); + } + if (content.Contains("CurrentScenarioJobId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)this).CurrentScenarioJobId = (string) content.GetValueForProperty("CurrentScenarioJobId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)this).CurrentScenarioJobId, global::System.Convert.ToString); + } + if (content.Contains("CurrentScenarioStartTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)this).CurrentScenarioStartTime = (global::System.DateTime?) content.GetValueForProperty("CurrentScenarioStartTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal)this).CurrentScenarioStartTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Recovery plan properties. + [System.ComponentModel.TypeConverter(typeof(RecoveryPlanPropertiesTypeConverter))] + public partial interface IRecoveryPlanProperties + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanProperties.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanProperties.TypeConverter.cs new file mode 100644 index 000000000000..e39c62b7ec44 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanProperties.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class RecoveryPlanPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return RecoveryPlanProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return RecoveryPlanProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return RecoveryPlanProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanProperties.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanProperties.cs new file mode 100644 index 000000000000..63a9a10e09f3 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanProperties.cs @@ -0,0 +1,343 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Recovery plan properties. + public partial class RecoveryPlanProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProperties, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal + { + + /// Backing field for property. + private string[] _allowedOperation; + + /// The list of allowed operations. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string[] AllowedOperation { get => this._allowedOperation; set => this._allowedOperation = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICurrentScenarioDetails _currentScenario; + + /// The current scenario details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICurrentScenarioDetails CurrentScenario { get => (this._currentScenario = this._currentScenario ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.CurrentScenarioDetails()); set => this._currentScenario = value; } + + /// ARM Id of the job being executed. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string CurrentScenarioJobId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICurrentScenarioDetailsInternal)CurrentScenario).JobId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICurrentScenarioDetailsInternal)CurrentScenario).JobId = value ?? null; } + + /// Scenario name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string CurrentScenarioName { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICurrentScenarioDetailsInternal)CurrentScenario).ScenarioName; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICurrentScenarioDetailsInternal)CurrentScenario).ScenarioName = value ?? null; } + + /// Start time of the workflow. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public global::System.DateTime? CurrentScenarioStartTime { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICurrentScenarioDetailsInternal)CurrentScenario).StartTime; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICurrentScenarioDetailsInternal)CurrentScenario).StartTime = value ?? default(global::System.DateTime); } + + /// Backing field for property. + private string _currentScenarioStatus; + + /// The recovery plan status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string CurrentScenarioStatus { get => this._currentScenarioStatus; set => this._currentScenarioStatus = value; } + + /// Backing field for property. + private string _currentScenarioStatusDescription; + + /// The recovery plan status description. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string CurrentScenarioStatusDescription { get => this._currentScenarioStatusDescription; set => this._currentScenarioStatusDescription = value; } + + /// Backing field for property. + private string _failoverDeploymentModel; + + /// The failover deployment model. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string FailoverDeploymentModel { get => this._failoverDeploymentModel; set => this._failoverDeploymentModel = value; } + + /// Backing field for property. + private string _friendlyName; + + /// The friendly name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string FriendlyName { get => this._friendlyName; set => this._friendlyName = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroup[] _group; + + /// The recovery plan groups. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroup[] Group { get => this._group; set => this._group = value; } + + /// Backing field for property. + private global::System.DateTime? _lastPlannedFailoverTime; + + /// The start time of the last planned failover. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public global::System.DateTime? LastPlannedFailoverTime { get => this._lastPlannedFailoverTime; set => this._lastPlannedFailoverTime = value; } + + /// Backing field for property. + private global::System.DateTime? _lastTestFailoverTime; + + /// The start time of the last test failover. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public global::System.DateTime? LastTestFailoverTime { get => this._lastTestFailoverTime; set => this._lastTestFailoverTime = value; } + + /// Backing field for property. + private global::System.DateTime? _lastUnplannedFailoverTime; + + /// The start time of the last unplanned failover. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public global::System.DateTime? LastUnplannedFailoverTime { get => this._lastUnplannedFailoverTime; set => this._lastUnplannedFailoverTime = value; } + + /// Internal Acessors for CurrentScenario + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICurrentScenarioDetails Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPropertiesInternal.CurrentScenario { get => (this._currentScenario = this._currentScenario ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.CurrentScenarioDetails()); set { {_currentScenario = value;} } } + + /// Backing field for property. + private string _primaryFabricFriendlyName; + + /// The primary fabric friendly name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string PrimaryFabricFriendlyName { get => this._primaryFabricFriendlyName; set => this._primaryFabricFriendlyName = value; } + + /// Backing field for property. + private string _primaryFabricId; + + /// The primary fabric Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string PrimaryFabricId { get => this._primaryFabricId; set => this._primaryFabricId = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificDetails[] _providerSpecificDetail; + + /// The provider id and provider specific details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificDetails[] ProviderSpecificDetail { get => this._providerSpecificDetail; set => this._providerSpecificDetail = value; } + + /// Backing field for property. + private string _recoveryFabricFriendlyName; + + /// The recovery fabric friendly name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryFabricFriendlyName { get => this._recoveryFabricFriendlyName; set => this._recoveryFabricFriendlyName = value; } + + /// Backing field for property. + private string _recoveryFabricId; + + /// The recovery fabric Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryFabricId { get => this._recoveryFabricId; set => this._recoveryFabricId = value; } + + /// Backing field for property. + private string[] _replicationProvider; + + /// The list of replication providers. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string[] ReplicationProvider { get => this._replicationProvider; set => this._replicationProvider = value; } + + /// Creates an new instance. + public RecoveryPlanProperties() + { + + } + } + /// Recovery plan properties. + public partial interface IRecoveryPlanProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The list of allowed operations. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of allowed operations.", + SerializedName = @"allowedOperations", + PossibleTypes = new [] { typeof(string) })] + string[] AllowedOperation { get; set; } + /// ARM Id of the job being executed. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"ARM Id of the job being executed.", + SerializedName = @"jobId", + PossibleTypes = new [] { typeof(string) })] + string CurrentScenarioJobId { get; set; } + /// Scenario name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Scenario name.", + SerializedName = @"scenarioName", + PossibleTypes = new [] { typeof(string) })] + string CurrentScenarioName { get; set; } + /// Start time of the workflow. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Start time of the workflow.", + SerializedName = @"startTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? CurrentScenarioStartTime { get; set; } + /// The recovery plan status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery plan status.", + SerializedName = @"currentScenarioStatus", + PossibleTypes = new [] { typeof(string) })] + string CurrentScenarioStatus { get; set; } + /// The recovery plan status description. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery plan status description.", + SerializedName = @"currentScenarioStatusDescription", + PossibleTypes = new [] { typeof(string) })] + string CurrentScenarioStatusDescription { get; set; } + /// The failover deployment model. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The failover deployment model.", + SerializedName = @"failoverDeploymentModel", + PossibleTypes = new [] { typeof(string) })] + string FailoverDeploymentModel { get; set; } + /// The friendly name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The friendly name.", + SerializedName = @"friendlyName", + PossibleTypes = new [] { typeof(string) })] + string FriendlyName { get; set; } + /// The recovery plan groups. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery plan groups.", + SerializedName = @"groups", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroup) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroup[] Group { get; set; } + /// The start time of the last planned failover. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The start time of the last planned failover.", + SerializedName = @"lastPlannedFailoverTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? LastPlannedFailoverTime { get; set; } + /// The start time of the last test failover. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The start time of the last test failover.", + SerializedName = @"lastTestFailoverTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? LastTestFailoverTime { get; set; } + /// The start time of the last unplanned failover. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The start time of the last unplanned failover.", + SerializedName = @"lastUnplannedFailoverTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? LastUnplannedFailoverTime { get; set; } + /// The primary fabric friendly name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The primary fabric friendly name.", + SerializedName = @"primaryFabricFriendlyName", + PossibleTypes = new [] { typeof(string) })] + string PrimaryFabricFriendlyName { get; set; } + /// The primary fabric Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The primary fabric Id.", + SerializedName = @"primaryFabricId", + PossibleTypes = new [] { typeof(string) })] + string PrimaryFabricId { get; set; } + /// The provider id and provider specific details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The provider id and provider specific details.", + SerializedName = @"providerSpecificDetails", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificDetails) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificDetails[] ProviderSpecificDetail { get; set; } + /// The recovery fabric friendly name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery fabric friendly name.", + SerializedName = @"recoveryFabricFriendlyName", + PossibleTypes = new [] { typeof(string) })] + string RecoveryFabricFriendlyName { get; set; } + /// The recovery fabric Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery fabric Id.", + SerializedName = @"recoveryFabricId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryFabricId { get; set; } + /// The list of replication providers. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of replication providers.", + SerializedName = @"replicationProviders", + PossibleTypes = new [] { typeof(string) })] + string[] ReplicationProvider { get; set; } + + } + /// Recovery plan properties. + internal partial interface IRecoveryPlanPropertiesInternal + + { + /// The list of allowed operations. + string[] AllowedOperation { get; set; } + /// The current scenario details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICurrentScenarioDetails CurrentScenario { get; set; } + /// ARM Id of the job being executed. + string CurrentScenarioJobId { get; set; } + /// Scenario name. + string CurrentScenarioName { get; set; } + /// Start time of the workflow. + global::System.DateTime? CurrentScenarioStartTime { get; set; } + /// The recovery plan status. + string CurrentScenarioStatus { get; set; } + /// The recovery plan status description. + string CurrentScenarioStatusDescription { get; set; } + /// The failover deployment model. + string FailoverDeploymentModel { get; set; } + /// The friendly name. + string FriendlyName { get; set; } + /// The recovery plan groups. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroup[] Group { get; set; } + /// The start time of the last planned failover. + global::System.DateTime? LastPlannedFailoverTime { get; set; } + /// The start time of the last test failover. + global::System.DateTime? LastTestFailoverTime { get; set; } + /// The start time of the last unplanned failover. + global::System.DateTime? LastUnplannedFailoverTime { get; set; } + /// The primary fabric friendly name. + string PrimaryFabricFriendlyName { get; set; } + /// The primary fabric Id. + string PrimaryFabricId { get; set; } + /// The provider id and provider specific details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificDetails[] ProviderSpecificDetail { get; set; } + /// The recovery fabric friendly name. + string RecoveryFabricFriendlyName { get; set; } + /// The recovery fabric Id. + string RecoveryFabricId { get; set; } + /// The list of replication providers. + string[] ReplicationProvider { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanProperties.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanProperties.json.cs new file mode 100644 index 000000000000..e1b617c6e07f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanProperties.json.cs @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Recovery plan properties. + public partial class RecoveryPlanProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new RecoveryPlanProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal RecoveryPlanProperties(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_currentScenario = If( json?.PropertyT("currentScenario"), out var __jsonCurrentScenario) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.CurrentScenarioDetails.FromJson(__jsonCurrentScenario) : CurrentScenario;} + {_friendlyName = If( json?.PropertyT("friendlyName"), out var __jsonFriendlyName) ? (string)__jsonFriendlyName : (string)FriendlyName;} + {_primaryFabricId = If( json?.PropertyT("primaryFabricId"), out var __jsonPrimaryFabricId) ? (string)__jsonPrimaryFabricId : (string)PrimaryFabricId;} + {_primaryFabricFriendlyName = If( json?.PropertyT("primaryFabricFriendlyName"), out var __jsonPrimaryFabricFriendlyName) ? (string)__jsonPrimaryFabricFriendlyName : (string)PrimaryFabricFriendlyName;} + {_recoveryFabricId = If( json?.PropertyT("recoveryFabricId"), out var __jsonRecoveryFabricId) ? (string)__jsonRecoveryFabricId : (string)RecoveryFabricId;} + {_recoveryFabricFriendlyName = If( json?.PropertyT("recoveryFabricFriendlyName"), out var __jsonRecoveryFabricFriendlyName) ? (string)__jsonRecoveryFabricFriendlyName : (string)RecoveryFabricFriendlyName;} + {_failoverDeploymentModel = If( json?.PropertyT("failoverDeploymentModel"), out var __jsonFailoverDeploymentModel) ? (string)__jsonFailoverDeploymentModel : (string)FailoverDeploymentModel;} + {_replicationProvider = If( json?.PropertyT("replicationProviders"), out var __jsonReplicationProviders) ? If( __jsonReplicationProviders as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(string) (__u is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : ReplicationProvider;} + {_allowedOperation = If( json?.PropertyT("allowedOperations"), out var __jsonAllowedOperations) ? If( __jsonAllowedOperations as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __q) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__q, (__p)=>(string) (__p is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString __o ? (string)(__o.ToString()) : null)) ))() : null : AllowedOperation;} + {_lastPlannedFailoverTime = If( json?.PropertyT("lastPlannedFailoverTime"), out var __jsonLastPlannedFailoverTime) ? global::System.DateTime.TryParse((string)__jsonLastPlannedFailoverTime, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonLastPlannedFailoverTimeValue) ? __jsonLastPlannedFailoverTimeValue : LastPlannedFailoverTime : LastPlannedFailoverTime;} + {_lastUnplannedFailoverTime = If( json?.PropertyT("lastUnplannedFailoverTime"), out var __jsonLastUnplannedFailoverTime) ? global::System.DateTime.TryParse((string)__jsonLastUnplannedFailoverTime, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonLastUnplannedFailoverTimeValue) ? __jsonLastUnplannedFailoverTimeValue : LastUnplannedFailoverTime : LastUnplannedFailoverTime;} + {_lastTestFailoverTime = If( json?.PropertyT("lastTestFailoverTime"), out var __jsonLastTestFailoverTime) ? global::System.DateTime.TryParse((string)__jsonLastTestFailoverTime, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonLastTestFailoverTimeValue) ? __jsonLastTestFailoverTimeValue : LastTestFailoverTime : LastTestFailoverTime;} + {_currentScenarioStatus = If( json?.PropertyT("currentScenarioStatus"), out var __jsonCurrentScenarioStatus) ? (string)__jsonCurrentScenarioStatus : (string)CurrentScenarioStatus;} + {_currentScenarioStatusDescription = If( json?.PropertyT("currentScenarioStatusDescription"), out var __jsonCurrentScenarioStatusDescription) ? (string)__jsonCurrentScenarioStatusDescription : (string)CurrentScenarioStatusDescription;} + {_group = If( json?.PropertyT("groups"), out var __jsonGroups) ? If( __jsonGroups as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __l) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__l, (__k)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroup) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanGroup.FromJson(__k) )) ))() : null : Group;} + {_providerSpecificDetail = If( json?.PropertyT("providerSpecificDetails"), out var __jsonProviderSpecificDetails) ? If( __jsonProviderSpecificDetails as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __g) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__g, (__f)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificDetails) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanProviderSpecificDetails.FromJson(__f) )) ))() : null : ProviderSpecificDetail;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._currentScenario ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._currentScenario.ToJson(null,serializationMode) : null, "currentScenario" ,container.Add ); + AddIf( null != (((object)this._friendlyName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._friendlyName.ToString()) : null, "friendlyName" ,container.Add ); + AddIf( null != (((object)this._primaryFabricId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._primaryFabricId.ToString()) : null, "primaryFabricId" ,container.Add ); + AddIf( null != (((object)this._primaryFabricFriendlyName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._primaryFabricFriendlyName.ToString()) : null, "primaryFabricFriendlyName" ,container.Add ); + AddIf( null != (((object)this._recoveryFabricId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryFabricId.ToString()) : null, "recoveryFabricId" ,container.Add ); + AddIf( null != (((object)this._recoveryFabricFriendlyName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryFabricFriendlyName.ToString()) : null, "recoveryFabricFriendlyName" ,container.Add ); + AddIf( null != (((object)this._failoverDeploymentModel)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._failoverDeploymentModel.ToString()) : null, "failoverDeploymentModel" ,container.Add ); + if (null != this._replicationProvider) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._replicationProvider ) + { + AddIf(null != (((object)__x)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(__x.ToString()) : null ,__w.Add); + } + container.Add("replicationProviders",__w); + } + if (null != this._allowedOperation) + { + var __r = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __s in this._allowedOperation ) + { + AddIf(null != (((object)__s)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(__s.ToString()) : null ,__r.Add); + } + container.Add("allowedOperations",__r); + } + AddIf( null != this._lastPlannedFailoverTime ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._lastPlannedFailoverTime?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "lastPlannedFailoverTime" ,container.Add ); + AddIf( null != this._lastUnplannedFailoverTime ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._lastUnplannedFailoverTime?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "lastUnplannedFailoverTime" ,container.Add ); + AddIf( null != this._lastTestFailoverTime ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._lastTestFailoverTime?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "lastTestFailoverTime" ,container.Add ); + AddIf( null != (((object)this._currentScenarioStatus)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._currentScenarioStatus.ToString()) : null, "currentScenarioStatus" ,container.Add ); + AddIf( null != (((object)this._currentScenarioStatusDescription)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._currentScenarioStatusDescription.ToString()) : null, "currentScenarioStatusDescription" ,container.Add ); + if (null != this._group) + { + var __m = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __n in this._group ) + { + AddIf(__n?.ToJson(null, serializationMode) ,__m.Add); + } + container.Add("groups",__m); + } + if (null != this._providerSpecificDetail) + { + var __h = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __i in this._providerSpecificDetail ) + { + AddIf(__i?.ToJson(null, serializationMode) ,__h.Add); + } + container.Add("providerSpecificDetails",__h); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanProtectedItem.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanProtectedItem.PowerShell.cs new file mode 100644 index 000000000000..7054d751b546 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanProtectedItem.PowerShell.cs @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Recovery plan protected item. + [System.ComponentModel.TypeConverter(typeof(RecoveryPlanProtectedItemTypeConverter))] + public partial class RecoveryPlanProtectedItem + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProtectedItem DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new RecoveryPlanProtectedItem(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProtectedItem DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new RecoveryPlanProtectedItem(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProtectedItem FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal RecoveryPlanProtectedItem(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProtectedItemInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProtectedItemInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("VirtualMachineId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProtectedItemInternal)this).VirtualMachineId = (string) content.GetValueForProperty("VirtualMachineId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProtectedItemInternal)this).VirtualMachineId, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal RecoveryPlanProtectedItem(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProtectedItemInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProtectedItemInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("VirtualMachineId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProtectedItemInternal)this).VirtualMachineId = (string) content.GetValueForProperty("VirtualMachineId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProtectedItemInternal)this).VirtualMachineId, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Recovery plan protected item. + [System.ComponentModel.TypeConverter(typeof(RecoveryPlanProtectedItemTypeConverter))] + public partial interface IRecoveryPlanProtectedItem + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanProtectedItem.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanProtectedItem.TypeConverter.cs new file mode 100644 index 000000000000..b040570e4cbe --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanProtectedItem.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class RecoveryPlanProtectedItemTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProtectedItem ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProtectedItem).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return RecoveryPlanProtectedItem.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return RecoveryPlanProtectedItem.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return RecoveryPlanProtectedItem.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanProtectedItem.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanProtectedItem.cs new file mode 100644 index 000000000000..4c4ad3121a7f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanProtectedItem.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Recovery plan protected item. + public partial class RecoveryPlanProtectedItem : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProtectedItem, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProtectedItemInternal + { + + /// Backing field for property. + private string _id; + + /// The ARM Id of the recovery plan protected item. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Id { get => this._id; set => this._id = value; } + + /// Backing field for property. + private string _virtualMachineId; + + /// The virtual machine Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string VirtualMachineId { get => this._virtualMachineId; set => this._virtualMachineId = value; } + + /// Creates an new instance. + public RecoveryPlanProtectedItem() + { + + } + } + /// Recovery plan protected item. + public partial interface IRecoveryPlanProtectedItem : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The ARM Id of the recovery plan protected item. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The ARM Id of the recovery plan protected item.", + SerializedName = @"id", + PossibleTypes = new [] { typeof(string) })] + string Id { get; set; } + /// The virtual machine Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The virtual machine Id.", + SerializedName = @"virtualMachineId", + PossibleTypes = new [] { typeof(string) })] + string VirtualMachineId { get; set; } + + } + /// Recovery plan protected item. + internal partial interface IRecoveryPlanProtectedItemInternal + + { + /// The ARM Id of the recovery plan protected item. + string Id { get; set; } + /// The virtual machine Id. + string VirtualMachineId { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanProtectedItem.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanProtectedItem.json.cs new file mode 100644 index 000000000000..b3dc90b20c1c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanProtectedItem.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Recovery plan protected item. + public partial class RecoveryPlanProtectedItem + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProtectedItem. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProtectedItem. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProtectedItem FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new RecoveryPlanProtectedItem(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal RecoveryPlanProtectedItem(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_id = If( json?.PropertyT("id"), out var __jsonId) ? (string)__jsonId : (string)Id;} + {_virtualMachineId = If( json?.PropertyT("virtualMachineId"), out var __jsonVirtualMachineId) ? (string)__jsonVirtualMachineId : (string)VirtualMachineId;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._id)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._id.ToString()) : null, "id" ,container.Add ); + AddIf( null != (((object)this._virtualMachineId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._virtualMachineId.ToString()) : null, "virtualMachineId" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanProviderSpecificDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanProviderSpecificDetails.PowerShell.cs new file mode 100644 index 000000000000..a6a69b3e0395 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanProviderSpecificDetails.PowerShell.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Recovery plan provider specific details. + [System.ComponentModel.TypeConverter(typeof(RecoveryPlanProviderSpecificDetailsTypeConverter))] + public partial class RecoveryPlanProviderSpecificDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new RecoveryPlanProviderSpecificDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new RecoveryPlanProviderSpecificDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal RecoveryPlanProviderSpecificDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal RecoveryPlanProviderSpecificDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Recovery plan provider specific details. + [System.ComponentModel.TypeConverter(typeof(RecoveryPlanProviderSpecificDetailsTypeConverter))] + public partial interface IRecoveryPlanProviderSpecificDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanProviderSpecificDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanProviderSpecificDetails.TypeConverter.cs new file mode 100644 index 000000000000..db07d3d88535 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanProviderSpecificDetails.TypeConverter.cs @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class RecoveryPlanProviderSpecificDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return RecoveryPlanProviderSpecificDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return RecoveryPlanProviderSpecificDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return RecoveryPlanProviderSpecificDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanProviderSpecificDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanProviderSpecificDetails.cs new file mode 100644 index 000000000000..9207c8d3b7c8 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanProviderSpecificDetails.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Recovery plan provider specific details. + public partial class RecoveryPlanProviderSpecificDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificDetailsInternal + { + + /// Backing field for property. + private string _instanceType; + + /// Gets the Instance type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string InstanceType { get => this._instanceType; set => this._instanceType = value; } + + /// Creates an new instance. + public RecoveryPlanProviderSpecificDetails() + { + + } + } + /// Recovery plan provider specific details. + public partial interface IRecoveryPlanProviderSpecificDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// Gets the Instance type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets the Instance type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string InstanceType { get; set; } + + } + /// Recovery plan provider specific details. + internal partial interface IRecoveryPlanProviderSpecificDetailsInternal + + { + /// Gets the Instance type. + string InstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanProviderSpecificDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanProviderSpecificDetails.json.cs new file mode 100644 index 000000000000..7a666a4c3880 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanProviderSpecificDetails.json.cs @@ -0,0 +1,124 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Recovery plan provider specific details. + public partial class RecoveryPlanProviderSpecificDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificDetails. + /// Note: the Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificDetails interface + /// is polymorphic, and the precise model class that will get deserialized is determined at runtime based on the payload. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + if (!(node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json)) + { + return null; + } + // Polymorphic type -- select the appropriate constructor using the discriminator + + switch ( json.StringProperty("instanceType") ) + { + case "A2A": + { + return new RecoveryPlanA2ADetails(json); + } + } + return new RecoveryPlanProviderSpecificDetails(json); + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal RecoveryPlanProviderSpecificDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_instanceType = If( json?.PropertyT("instanceType"), out var __jsonInstanceType) ? (string)__jsonInstanceType : (string)InstanceType;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._instanceType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._instanceType.ToString()) : null, "instanceType" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanProviderSpecificFailoverInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanProviderSpecificFailoverInput.PowerShell.cs new file mode 100644 index 000000000000..a49147fa3a9a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanProviderSpecificFailoverInput.PowerShell.cs @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Recovery plan provider specific failover input. + [System.ComponentModel.TypeConverter(typeof(RecoveryPlanProviderSpecificFailoverInputTypeConverter))] + public partial class RecoveryPlanProviderSpecificFailoverInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new RecoveryPlanProviderSpecificFailoverInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new RecoveryPlanProviderSpecificFailoverInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json + /// string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal RecoveryPlanProviderSpecificFailoverInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal RecoveryPlanProviderSpecificFailoverInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Recovery plan provider specific failover input. + [System.ComponentModel.TypeConverter(typeof(RecoveryPlanProviderSpecificFailoverInputTypeConverter))] + public partial interface IRecoveryPlanProviderSpecificFailoverInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanProviderSpecificFailoverInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanProviderSpecificFailoverInput.TypeConverter.cs new file mode 100644 index 000000000000..54e9e63f1201 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanProviderSpecificFailoverInput.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class RecoveryPlanProviderSpecificFailoverInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return RecoveryPlanProviderSpecificFailoverInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return RecoveryPlanProviderSpecificFailoverInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return RecoveryPlanProviderSpecificFailoverInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanProviderSpecificFailoverInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanProviderSpecificFailoverInput.cs new file mode 100644 index 000000000000..fefafffa65e2 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanProviderSpecificFailoverInput.cs @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Recovery plan provider specific failover input. + public partial class RecoveryPlanProviderSpecificFailoverInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInputInternal + { + + /// Backing field for property. + private string _instanceType; + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string InstanceType { get => this._instanceType; set => this._instanceType = value; } + + /// + /// Creates an new instance. + /// + public RecoveryPlanProviderSpecificFailoverInput() + { + + } + } + /// Recovery plan provider specific failover input. + public partial interface IRecoveryPlanProviderSpecificFailoverInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string InstanceType { get; set; } + + } + /// Recovery plan provider specific failover input. + internal partial interface IRecoveryPlanProviderSpecificFailoverInputInternal + + { + /// The class type. + string InstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanProviderSpecificFailoverInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanProviderSpecificFailoverInput.json.cs new file mode 100644 index 000000000000..fac814b04cb0 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanProviderSpecificFailoverInput.json.cs @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Recovery plan provider specific failover input. + public partial class RecoveryPlanProviderSpecificFailoverInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInput. + /// Note: the Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInput + /// interface is polymorphic, and the precise model class that will get deserialized is determined at runtime based on the + /// payload. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + if (!(node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json)) + { + return null; + } + // Polymorphic type -- select the appropriate constructor using the discriminator + + switch ( json.StringProperty("instanceType") ) + { + case "A2A": + { + return new RecoveryPlanA2AFailoverInput(json); + } + case "HyperVReplicaAzureFailback": + { + return new RecoveryPlanHyperVReplicaAzureFailbackInput(json); + } + case "HyperVReplicaAzure": + { + return new RecoveryPlanHyperVReplicaAzureFailoverInput(json); + } + case "InMageAzureV2": + { + return new RecoveryPlanInMageAzureV2FailoverInput(json); + } + case "InMage": + { + return new RecoveryPlanInMageFailoverInput(json); + } + case "InMageRcmFailback": + { + return new RecoveryPlanInMageRcmFailbackFailoverInput(json); + } + case "InMageRcm": + { + return new RecoveryPlanInMageRcmFailoverInput(json); + } + } + return new RecoveryPlanProviderSpecificFailoverInput(json); + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal RecoveryPlanProviderSpecificFailoverInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_instanceType = If( json?.PropertyT("instanceType"), out var __jsonInstanceType) ? (string)__jsonInstanceType : (string)InstanceType;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._instanceType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._instanceType.ToString()) : null, "instanceType" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanProviderSpecificInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanProviderSpecificInput.PowerShell.cs new file mode 100644 index 000000000000..fa29e5440381 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanProviderSpecificInput.PowerShell.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Recovery plan provider specific input base class. + [System.ComponentModel.TypeConverter(typeof(RecoveryPlanProviderSpecificInputTypeConverter))] + public partial class RecoveryPlanProviderSpecificInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new RecoveryPlanProviderSpecificInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new RecoveryPlanProviderSpecificInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal RecoveryPlanProviderSpecificInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal RecoveryPlanProviderSpecificInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Recovery plan provider specific input base class. + [System.ComponentModel.TypeConverter(typeof(RecoveryPlanProviderSpecificInputTypeConverter))] + public partial interface IRecoveryPlanProviderSpecificInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanProviderSpecificInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanProviderSpecificInput.TypeConverter.cs new file mode 100644 index 000000000000..572fa93bf470 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanProviderSpecificInput.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class RecoveryPlanProviderSpecificInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return RecoveryPlanProviderSpecificInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return RecoveryPlanProviderSpecificInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return RecoveryPlanProviderSpecificInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanProviderSpecificInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanProviderSpecificInput.cs new file mode 100644 index 000000000000..a83f64d9d239 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanProviderSpecificInput.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Recovery plan provider specific input base class. + public partial class RecoveryPlanProviderSpecificInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificInputInternal + { + + /// Backing field for property. + private string _instanceType; + + /// Gets the Instance type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string InstanceType { get => this._instanceType; set => this._instanceType = value; } + + /// Creates an new instance. + public RecoveryPlanProviderSpecificInput() + { + + } + } + /// Recovery plan provider specific input base class. + public partial interface IRecoveryPlanProviderSpecificInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// Gets the Instance type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets the Instance type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string InstanceType { get; set; } + + } + /// Recovery plan provider specific input base class. + internal partial interface IRecoveryPlanProviderSpecificInputInternal + + { + /// Gets the Instance type. + string InstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanProviderSpecificInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanProviderSpecificInput.json.cs new file mode 100644 index 000000000000..30c1d736f93e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanProviderSpecificInput.json.cs @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Recovery plan provider specific input base class. + public partial class RecoveryPlanProviderSpecificInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificInput. + /// Note: the Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificInput interface + /// is polymorphic, and the precise model class that will get deserialized is determined at runtime based on the payload. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + if (!(node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json)) + { + return null; + } + // Polymorphic type -- select the appropriate constructor using the discriminator + + switch ( json.StringProperty("instanceType") ) + { + case "A2A": + { + return new RecoveryPlanA2AInput(json); + } + } + return new RecoveryPlanProviderSpecificInput(json); + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal RecoveryPlanProviderSpecificInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_instanceType = If( json?.PropertyT("instanceType"), out var __jsonInstanceType) ? (string)__jsonInstanceType : (string)InstanceType;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._instanceType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._instanceType.ToString()) : null, "instanceType" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanScriptActionDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanScriptActionDetails.PowerShell.cs new file mode 100644 index 000000000000..15b716627d93 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanScriptActionDetails.PowerShell.cs @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Recovery plan script action details. + [System.ComponentModel.TypeConverter(typeof(RecoveryPlanScriptActionDetailsTypeConverter))] + public partial class RecoveryPlanScriptActionDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanScriptActionDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new RecoveryPlanScriptActionDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanScriptActionDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new RecoveryPlanScriptActionDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanScriptActionDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal RecoveryPlanScriptActionDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Path")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanScriptActionDetailsInternal)this).Path = (string) content.GetValueForProperty("Path",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanScriptActionDetailsInternal)this).Path, global::System.Convert.ToString); + } + if (content.Contains("Timeout")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanScriptActionDetailsInternal)this).Timeout = (string) content.GetValueForProperty("Timeout",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanScriptActionDetailsInternal)this).Timeout, global::System.Convert.ToString); + } + if (content.Contains("FabricLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanScriptActionDetailsInternal)this).FabricLocation = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPlanActionLocation) content.GetValueForProperty("FabricLocation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanScriptActionDetailsInternal)this).FabricLocation, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPlanActionLocation.CreateFrom); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanActionDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanActionDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal RecoveryPlanScriptActionDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Path")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanScriptActionDetailsInternal)this).Path = (string) content.GetValueForProperty("Path",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanScriptActionDetailsInternal)this).Path, global::System.Convert.ToString); + } + if (content.Contains("Timeout")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanScriptActionDetailsInternal)this).Timeout = (string) content.GetValueForProperty("Timeout",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanScriptActionDetailsInternal)this).Timeout, global::System.Convert.ToString); + } + if (content.Contains("FabricLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanScriptActionDetailsInternal)this).FabricLocation = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPlanActionLocation) content.GetValueForProperty("FabricLocation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanScriptActionDetailsInternal)this).FabricLocation, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPlanActionLocation.CreateFrom); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanActionDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanActionDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Recovery plan script action details. + [System.ComponentModel.TypeConverter(typeof(RecoveryPlanScriptActionDetailsTypeConverter))] + public partial interface IRecoveryPlanScriptActionDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanScriptActionDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanScriptActionDetails.TypeConverter.cs new file mode 100644 index 000000000000..a219e2e29f3a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanScriptActionDetails.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class RecoveryPlanScriptActionDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanScriptActionDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanScriptActionDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return RecoveryPlanScriptActionDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return RecoveryPlanScriptActionDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return RecoveryPlanScriptActionDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanScriptActionDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanScriptActionDetails.cs new file mode 100644 index 000000000000..1ad30cde1a19 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanScriptActionDetails.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Recovery plan script action details. + public partial class RecoveryPlanScriptActionDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanScriptActionDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanScriptActionDetailsInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanActionDetails __recoveryPlanActionDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanActionDetails(); + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPlanActionLocation _fabricLocation; + + /// The fabric location. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPlanActionLocation FabricLocation { get => this._fabricLocation; set => this._fabricLocation = value; } + + /// + /// Gets the type of action details (see RecoveryPlanActionDetailsTypes enum for possible values). + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanActionDetailsInternal)__recoveryPlanActionDetails).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanActionDetailsInternal)__recoveryPlanActionDetails).InstanceType = value ; } + + /// Backing field for property. + private string _path; + + /// The script path. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Path { get => this._path; set => this._path = value; } + + /// Backing field for property. + private string _timeout; + + /// The script timeout. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Timeout { get => this._timeout; set => this._timeout = value; } + + /// Creates an new instance. + public RecoveryPlanScriptActionDetails() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__recoveryPlanActionDetails), __recoveryPlanActionDetails); + await eventListener.AssertObjectIsValid(nameof(__recoveryPlanActionDetails), __recoveryPlanActionDetails); + } + } + /// Recovery plan script action details. + public partial interface IRecoveryPlanScriptActionDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanActionDetails + { + /// The fabric location. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The fabric location.", + SerializedName = @"fabricLocation", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPlanActionLocation) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPlanActionLocation FabricLocation { get; set; } + /// The script path. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The script path.", + SerializedName = @"path", + PossibleTypes = new [] { typeof(string) })] + string Path { get; set; } + /// The script timeout. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The script timeout.", + SerializedName = @"timeout", + PossibleTypes = new [] { typeof(string) })] + string Timeout { get; set; } + + } + /// Recovery plan script action details. + internal partial interface IRecoveryPlanScriptActionDetailsInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanActionDetailsInternal + { + /// The fabric location. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPlanActionLocation FabricLocation { get; set; } + /// The script path. + string Path { get; set; } + /// The script timeout. + string Timeout { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanScriptActionDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanScriptActionDetails.json.cs new file mode 100644 index 000000000000..fa79bcbe319f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanScriptActionDetails.json.cs @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Recovery plan script action details. + public partial class RecoveryPlanScriptActionDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanScriptActionDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanScriptActionDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanScriptActionDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new RecoveryPlanScriptActionDetails(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal RecoveryPlanScriptActionDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __recoveryPlanActionDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanActionDetails(json); + {_path = If( json?.PropertyT("path"), out var __jsonPath) ? (string)__jsonPath : (string)Path;} + {_timeout = If( json?.PropertyT("timeout"), out var __jsonTimeout) ? (string)__jsonTimeout : (string)Timeout;} + {_fabricLocation = If( json?.PropertyT("fabricLocation"), out var __jsonFabricLocation) ? (string)__jsonFabricLocation : (string)FabricLocation;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __recoveryPlanActionDetails?.ToJson(container, serializationMode); + AddIf( null != (((object)this._path)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._path.ToString()) : null, "path" ,container.Add ); + AddIf( null != (((object)this._timeout)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._timeout.ToString()) : null, "timeout" ,container.Add ); + AddIf( null != (((object)this._fabricLocation)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._fabricLocation.ToString()) : null, "fabricLocation" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanShutdownGroupTaskDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanShutdownGroupTaskDetails.PowerShell.cs new file mode 100644 index 000000000000..47a94b349332 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanShutdownGroupTaskDetails.PowerShell.cs @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// This class represents the recovery plan shutdown group task details. + [System.ComponentModel.TypeConverter(typeof(RecoveryPlanShutdownGroupTaskDetailsTypeConverter))] + public partial class RecoveryPlanShutdownGroupTaskDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanShutdownGroupTaskDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new RecoveryPlanShutdownGroupTaskDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanShutdownGroupTaskDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new RecoveryPlanShutdownGroupTaskDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanShutdownGroupTaskDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal RecoveryPlanShutdownGroupTaskDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IGroupTaskDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IGroupTaskDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + if (content.Contains("ChildTask")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IGroupTaskDetailsInternal)this).ChildTask = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTask[]) content.GetValueForProperty("ChildTask",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IGroupTaskDetailsInternal)this).ChildTask, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AsrTaskTypeConverter.ConvertFrom)); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroupTaskDetailsInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroupTaskDetailsInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("GroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroupTaskDetailsInternal)this).GroupId = (string) content.GetValueForProperty("GroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroupTaskDetailsInternal)this).GroupId, global::System.Convert.ToString); + } + if (content.Contains("RpGroupType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroupTaskDetailsInternal)this).RpGroupType = (string) content.GetValueForProperty("RpGroupType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroupTaskDetailsInternal)this).RpGroupType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal RecoveryPlanShutdownGroupTaskDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IGroupTaskDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IGroupTaskDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + if (content.Contains("ChildTask")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IGroupTaskDetailsInternal)this).ChildTask = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTask[]) content.GetValueForProperty("ChildTask",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IGroupTaskDetailsInternal)this).ChildTask, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AsrTaskTypeConverter.ConvertFrom)); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroupTaskDetailsInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroupTaskDetailsInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("GroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroupTaskDetailsInternal)this).GroupId = (string) content.GetValueForProperty("GroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroupTaskDetailsInternal)this).GroupId, global::System.Convert.ToString); + } + if (content.Contains("RpGroupType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroupTaskDetailsInternal)this).RpGroupType = (string) content.GetValueForProperty("RpGroupType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroupTaskDetailsInternal)this).RpGroupType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// This class represents the recovery plan shutdown group task details. + [System.ComponentModel.TypeConverter(typeof(RecoveryPlanShutdownGroupTaskDetailsTypeConverter))] + public partial interface IRecoveryPlanShutdownGroupTaskDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanShutdownGroupTaskDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanShutdownGroupTaskDetails.TypeConverter.cs new file mode 100644 index 000000000000..840bc4a11034 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanShutdownGroupTaskDetails.TypeConverter.cs @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class RecoveryPlanShutdownGroupTaskDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanShutdownGroupTaskDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanShutdownGroupTaskDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return RecoveryPlanShutdownGroupTaskDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return RecoveryPlanShutdownGroupTaskDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return RecoveryPlanShutdownGroupTaskDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanShutdownGroupTaskDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanShutdownGroupTaskDetails.cs new file mode 100644 index 000000000000..56ac8e757561 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanShutdownGroupTaskDetails.cs @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// This class represents the recovery plan shutdown group task details. + public partial class RecoveryPlanShutdownGroupTaskDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanShutdownGroupTaskDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanShutdownGroupTaskDetailsInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroupTaskDetails __recoveryPlanGroupTaskDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanGroupTaskDetails(); + + /// The child tasks. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAsrTask[] ChildTask { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IGroupTaskDetailsInternal)__recoveryPlanGroupTaskDetails).ChildTask; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IGroupTaskDetailsInternal)__recoveryPlanGroupTaskDetails).ChildTask = value ?? null /* arrayOf */; } + + /// The group identifier. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string GroupId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroupTaskDetailsInternal)__recoveryPlanGroupTaskDetails).GroupId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroupTaskDetailsInternal)__recoveryPlanGroupTaskDetails).GroupId = value ?? null; } + + /// The type of task details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IGroupTaskDetailsInternal)__recoveryPlanGroupTaskDetails).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IGroupTaskDetailsInternal)__recoveryPlanGroupTaskDetails).InstanceType = value ; } + + /// The name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroupTaskDetailsInternal)__recoveryPlanGroupTaskDetails).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroupTaskDetailsInternal)__recoveryPlanGroupTaskDetails).Name = value ?? null; } + + /// The group type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string RpGroupType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroupTaskDetailsInternal)__recoveryPlanGroupTaskDetails).RpGroupType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroupTaskDetailsInternal)__recoveryPlanGroupTaskDetails).RpGroupType = value ?? null; } + + /// Creates an new instance. + public RecoveryPlanShutdownGroupTaskDetails() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__recoveryPlanGroupTaskDetails), __recoveryPlanGroupTaskDetails); + await eventListener.AssertObjectIsValid(nameof(__recoveryPlanGroupTaskDetails), __recoveryPlanGroupTaskDetails); + } + } + /// This class represents the recovery plan shutdown group task details. + public partial interface IRecoveryPlanShutdownGroupTaskDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroupTaskDetails + { + + } + /// This class represents the recovery plan shutdown group task details. + internal partial interface IRecoveryPlanShutdownGroupTaskDetailsInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroupTaskDetailsInternal + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanShutdownGroupTaskDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanShutdownGroupTaskDetails.json.cs new file mode 100644 index 000000000000..c6435c12181e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanShutdownGroupTaskDetails.json.cs @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// This class represents the recovery plan shutdown group task details. + public partial class RecoveryPlanShutdownGroupTaskDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanShutdownGroupTaskDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanShutdownGroupTaskDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanShutdownGroupTaskDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new RecoveryPlanShutdownGroupTaskDetails(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal RecoveryPlanShutdownGroupTaskDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __recoveryPlanGroupTaskDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanGroupTaskDetails(json); + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __recoveryPlanGroupTaskDetails?.ToJson(container, serializationMode); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanTestFailoverCleanupInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanTestFailoverCleanupInput.PowerShell.cs new file mode 100644 index 000000000000..b6301929eaf2 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanTestFailoverCleanupInput.PowerShell.cs @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Recovery plan test failover cleanup input. + [System.ComponentModel.TypeConverter(typeof(RecoveryPlanTestFailoverCleanupInputTypeConverter))] + public partial class RecoveryPlanTestFailoverCleanupInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverCleanupInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new RecoveryPlanTestFailoverCleanupInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverCleanupInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new RecoveryPlanTestFailoverCleanupInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverCleanupInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal RecoveryPlanTestFailoverCleanupInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverCleanupInputInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverCleanupInputProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverCleanupInputInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanTestFailoverCleanupInputPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Comment")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverCleanupInputInternal)this).Comment = (string) content.GetValueForProperty("Comment",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverCleanupInputInternal)this).Comment, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal RecoveryPlanTestFailoverCleanupInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverCleanupInputInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverCleanupInputProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverCleanupInputInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanTestFailoverCleanupInputPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Comment")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverCleanupInputInternal)this).Comment = (string) content.GetValueForProperty("Comment",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverCleanupInputInternal)this).Comment, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Recovery plan test failover cleanup input. + [System.ComponentModel.TypeConverter(typeof(RecoveryPlanTestFailoverCleanupInputTypeConverter))] + public partial interface IRecoveryPlanTestFailoverCleanupInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanTestFailoverCleanupInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanTestFailoverCleanupInput.TypeConverter.cs new file mode 100644 index 000000000000..ae59386c32af --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanTestFailoverCleanupInput.TypeConverter.cs @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class RecoveryPlanTestFailoverCleanupInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverCleanupInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverCleanupInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return RecoveryPlanTestFailoverCleanupInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return RecoveryPlanTestFailoverCleanupInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return RecoveryPlanTestFailoverCleanupInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanTestFailoverCleanupInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanTestFailoverCleanupInput.cs new file mode 100644 index 000000000000..8a2be4269b80 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanTestFailoverCleanupInput.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Recovery plan test failover cleanup input. + public partial class RecoveryPlanTestFailoverCleanupInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverCleanupInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverCleanupInputInternal + { + + /// The test failover cleanup comments. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string Comment { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverCleanupInputPropertiesInternal)Property).Comment; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverCleanupInputPropertiesInternal)Property).Comment = value ?? null; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverCleanupInputProperties Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverCleanupInputInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanTestFailoverCleanupInputProperties()); set { {_property = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverCleanupInputProperties _property; + + /// The recovery plan test failover cleanup input properties. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverCleanupInputProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanTestFailoverCleanupInputProperties()); set => this._property = value; } + + /// Creates an new instance. + public RecoveryPlanTestFailoverCleanupInput() + { + + } + } + /// Recovery plan test failover cleanup input. + public partial interface IRecoveryPlanTestFailoverCleanupInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The test failover cleanup comments. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The test failover cleanup comments.", + SerializedName = @"comments", + PossibleTypes = new [] { typeof(string) })] + string Comment { get; set; } + + } + /// Recovery plan test failover cleanup input. + internal partial interface IRecoveryPlanTestFailoverCleanupInputInternal + + { + /// The test failover cleanup comments. + string Comment { get; set; } + /// The recovery plan test failover cleanup input properties. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverCleanupInputProperties Property { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanTestFailoverCleanupInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanTestFailoverCleanupInput.json.cs new file mode 100644 index 000000000000..00fc6ddb90bc --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanTestFailoverCleanupInput.json.cs @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Recovery plan test failover cleanup input. + public partial class RecoveryPlanTestFailoverCleanupInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverCleanupInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverCleanupInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverCleanupInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new RecoveryPlanTestFailoverCleanupInput(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal RecoveryPlanTestFailoverCleanupInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanTestFailoverCleanupInputProperties.FromJson(__jsonProperties) : Property;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanTestFailoverCleanupInputProperties.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanTestFailoverCleanupInputProperties.PowerShell.cs new file mode 100644 index 000000000000..fa9e4bd48c13 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanTestFailoverCleanupInputProperties.PowerShell.cs @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Recovery plan test failover cleanup input properties. + [System.ComponentModel.TypeConverter(typeof(RecoveryPlanTestFailoverCleanupInputPropertiesTypeConverter))] + public partial class RecoveryPlanTestFailoverCleanupInputProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverCleanupInputProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new RecoveryPlanTestFailoverCleanupInputProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverCleanupInputProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new RecoveryPlanTestFailoverCleanupInputProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from + /// a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverCleanupInputProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal RecoveryPlanTestFailoverCleanupInputProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Comment")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverCleanupInputPropertiesInternal)this).Comment = (string) content.GetValueForProperty("Comment",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverCleanupInputPropertiesInternal)this).Comment, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal RecoveryPlanTestFailoverCleanupInputProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Comment")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverCleanupInputPropertiesInternal)this).Comment = (string) content.GetValueForProperty("Comment",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverCleanupInputPropertiesInternal)this).Comment, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Recovery plan test failover cleanup input properties. + [System.ComponentModel.TypeConverter(typeof(RecoveryPlanTestFailoverCleanupInputPropertiesTypeConverter))] + public partial interface IRecoveryPlanTestFailoverCleanupInputProperties + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanTestFailoverCleanupInputProperties.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanTestFailoverCleanupInputProperties.TypeConverter.cs new file mode 100644 index 000000000000..1c7e4f8306c1 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanTestFailoverCleanupInputProperties.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class RecoveryPlanTestFailoverCleanupInputPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, + /// otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverCleanupInputProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverCleanupInputProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return RecoveryPlanTestFailoverCleanupInputProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return RecoveryPlanTestFailoverCleanupInputProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return RecoveryPlanTestFailoverCleanupInputProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanTestFailoverCleanupInputProperties.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanTestFailoverCleanupInputProperties.cs new file mode 100644 index 000000000000..c6abec87f59c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanTestFailoverCleanupInputProperties.cs @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Recovery plan test failover cleanup input properties. + public partial class RecoveryPlanTestFailoverCleanupInputProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverCleanupInputProperties, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverCleanupInputPropertiesInternal + { + + /// Backing field for property. + private string _comment; + + /// The test failover cleanup comments. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Comment { get => this._comment; set => this._comment = value; } + + /// + /// Creates an new instance. + /// + public RecoveryPlanTestFailoverCleanupInputProperties() + { + + } + } + /// Recovery plan test failover cleanup input properties. + public partial interface IRecoveryPlanTestFailoverCleanupInputProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The test failover cleanup comments. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The test failover cleanup comments.", + SerializedName = @"comments", + PossibleTypes = new [] { typeof(string) })] + string Comment { get; set; } + + } + /// Recovery plan test failover cleanup input properties. + internal partial interface IRecoveryPlanTestFailoverCleanupInputPropertiesInternal + + { + /// The test failover cleanup comments. + string Comment { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanTestFailoverCleanupInputProperties.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanTestFailoverCleanupInputProperties.json.cs new file mode 100644 index 000000000000..17cca740912e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanTestFailoverCleanupInputProperties.json.cs @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Recovery plan test failover cleanup input properties. + public partial class RecoveryPlanTestFailoverCleanupInputProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverCleanupInputProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverCleanupInputProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverCleanupInputProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new RecoveryPlanTestFailoverCleanupInputProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal RecoveryPlanTestFailoverCleanupInputProperties(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_comment = If( json?.PropertyT("comments"), out var __jsonComments) ? (string)__jsonComments : (string)Comment;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._comment)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._comment.ToString()) : null, "comments" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanTestFailoverInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanTestFailoverInput.PowerShell.cs new file mode 100644 index 000000000000..51817affc435 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanTestFailoverInput.PowerShell.cs @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Recovery plan test failover input. + [System.ComponentModel.TypeConverter(typeof(RecoveryPlanTestFailoverInputTypeConverter))] + public partial class RecoveryPlanTestFailoverInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new RecoveryPlanTestFailoverInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new RecoveryPlanTestFailoverInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal RecoveryPlanTestFailoverInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverInputInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverInputProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverInputInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanTestFailoverInputPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("FailoverDirection")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverInputInternal)this).FailoverDirection = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections) content.GetValueForProperty("FailoverDirection",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverInputInternal)this).FailoverDirection, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections.CreateFrom); + } + if (content.Contains("NetworkType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverInputInternal)this).NetworkType = (string) content.GetValueForProperty("NetworkType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverInputInternal)this).NetworkType, global::System.Convert.ToString); + } + if (content.Contains("NetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverInputInternal)this).NetworkId = (string) content.GetValueForProperty("NetworkId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverInputInternal)this).NetworkId, global::System.Convert.ToString); + } + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverInputInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInput[]) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverInputInternal)this).ProviderSpecificDetail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanProviderSpecificFailoverInputTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal RecoveryPlanTestFailoverInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverInputInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverInputProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverInputInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanTestFailoverInputPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("FailoverDirection")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverInputInternal)this).FailoverDirection = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections) content.GetValueForProperty("FailoverDirection",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverInputInternal)this).FailoverDirection, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections.CreateFrom); + } + if (content.Contains("NetworkType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverInputInternal)this).NetworkType = (string) content.GetValueForProperty("NetworkType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverInputInternal)this).NetworkType, global::System.Convert.ToString); + } + if (content.Contains("NetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverInputInternal)this).NetworkId = (string) content.GetValueForProperty("NetworkId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverInputInternal)this).NetworkId, global::System.Convert.ToString); + } + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverInputInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInput[]) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverInputInternal)this).ProviderSpecificDetail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanProviderSpecificFailoverInputTypeConverter.ConvertFrom)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Recovery plan test failover input. + [System.ComponentModel.TypeConverter(typeof(RecoveryPlanTestFailoverInputTypeConverter))] + public partial interface IRecoveryPlanTestFailoverInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanTestFailoverInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanTestFailoverInput.TypeConverter.cs new file mode 100644 index 000000000000..394b95b291c1 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanTestFailoverInput.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class RecoveryPlanTestFailoverInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return RecoveryPlanTestFailoverInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return RecoveryPlanTestFailoverInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return RecoveryPlanTestFailoverInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanTestFailoverInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanTestFailoverInput.cs new file mode 100644 index 000000000000..29d3457c0cae --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanTestFailoverInput.cs @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Recovery plan test failover input. + public partial class RecoveryPlanTestFailoverInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverInputInternal + { + + /// The failover direction. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections FailoverDirection { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverInputPropertiesInternal)Property).FailoverDirection; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverInputPropertiesInternal)Property).FailoverDirection = value ; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverInputProperties Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverInputInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanTestFailoverInputProperties()); set { {_property = value;} } } + + /// The Id of the network to be used for test failover. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string NetworkId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverInputPropertiesInternal)Property).NetworkId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverInputPropertiesInternal)Property).NetworkId = value ?? null; } + + /// The network type to be used for test failover. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string NetworkType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverInputPropertiesInternal)Property).NetworkType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverInputPropertiesInternal)Property).NetworkType = value ; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverInputProperties _property; + + /// The recovery plan test failover input properties. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverInputProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanTestFailoverInputProperties()); set => this._property = value; } + + /// The provider specific properties. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInput[] ProviderSpecificDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverInputPropertiesInternal)Property).ProviderSpecificDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverInputPropertiesInternal)Property).ProviderSpecificDetail = value ?? null /* arrayOf */; } + + /// Creates an new instance. + public RecoveryPlanTestFailoverInput() + { + + } + } + /// Recovery plan test failover input. + public partial interface IRecoveryPlanTestFailoverInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The failover direction. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The failover direction.", + SerializedName = @"failoverDirection", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections FailoverDirection { get; set; } + /// The Id of the network to be used for test failover. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Id of the network to be used for test failover.", + SerializedName = @"networkId", + PossibleTypes = new [] { typeof(string) })] + string NetworkId { get; set; } + /// The network type to be used for test failover. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The network type to be used for test failover.", + SerializedName = @"networkType", + PossibleTypes = new [] { typeof(string) })] + string NetworkType { get; set; } + /// The provider specific properties. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The provider specific properties.", + SerializedName = @"providerSpecificDetails", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInput) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInput[] ProviderSpecificDetail { get; set; } + + } + /// Recovery plan test failover input. + internal partial interface IRecoveryPlanTestFailoverInputInternal + + { + /// The failover direction. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections FailoverDirection { get; set; } + /// The Id of the network to be used for test failover. + string NetworkId { get; set; } + /// The network type to be used for test failover. + string NetworkType { get; set; } + /// The recovery plan test failover input properties. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverInputProperties Property { get; set; } + /// The provider specific properties. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInput[] ProviderSpecificDetail { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanTestFailoverInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanTestFailoverInput.json.cs new file mode 100644 index 000000000000..3d342e70da79 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanTestFailoverInput.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Recovery plan test failover input. + public partial class RecoveryPlanTestFailoverInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new RecoveryPlanTestFailoverInput(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal RecoveryPlanTestFailoverInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanTestFailoverInputProperties.FromJson(__jsonProperties) : Property;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanTestFailoverInputProperties.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanTestFailoverInputProperties.PowerShell.cs new file mode 100644 index 000000000000..6dc12653eee9 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanTestFailoverInputProperties.PowerShell.cs @@ -0,0 +1,173 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Recovery plan test failover input properties. + [System.ComponentModel.TypeConverter(typeof(RecoveryPlanTestFailoverInputPropertiesTypeConverter))] + public partial class RecoveryPlanTestFailoverInputProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverInputProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new RecoveryPlanTestFailoverInputProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverInputProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new RecoveryPlanTestFailoverInputProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json + /// string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverInputProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal RecoveryPlanTestFailoverInputProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("FailoverDirection")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverInputPropertiesInternal)this).FailoverDirection = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections) content.GetValueForProperty("FailoverDirection",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverInputPropertiesInternal)this).FailoverDirection, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections.CreateFrom); + } + if (content.Contains("NetworkType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverInputPropertiesInternal)this).NetworkType = (string) content.GetValueForProperty("NetworkType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverInputPropertiesInternal)this).NetworkType, global::System.Convert.ToString); + } + if (content.Contains("NetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverInputPropertiesInternal)this).NetworkId = (string) content.GetValueForProperty("NetworkId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverInputPropertiesInternal)this).NetworkId, global::System.Convert.ToString); + } + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverInputPropertiesInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInput[]) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverInputPropertiesInternal)this).ProviderSpecificDetail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanProviderSpecificFailoverInputTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal RecoveryPlanTestFailoverInputProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("FailoverDirection")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverInputPropertiesInternal)this).FailoverDirection = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections) content.GetValueForProperty("FailoverDirection",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverInputPropertiesInternal)this).FailoverDirection, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections.CreateFrom); + } + if (content.Contains("NetworkType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverInputPropertiesInternal)this).NetworkType = (string) content.GetValueForProperty("NetworkType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverInputPropertiesInternal)this).NetworkType, global::System.Convert.ToString); + } + if (content.Contains("NetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverInputPropertiesInternal)this).NetworkId = (string) content.GetValueForProperty("NetworkId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverInputPropertiesInternal)this).NetworkId, global::System.Convert.ToString); + } + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverInputPropertiesInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInput[]) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverInputPropertiesInternal)this).ProviderSpecificDetail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanProviderSpecificFailoverInputTypeConverter.ConvertFrom)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Recovery plan test failover input properties. + [System.ComponentModel.TypeConverter(typeof(RecoveryPlanTestFailoverInputPropertiesTypeConverter))] + public partial interface IRecoveryPlanTestFailoverInputProperties + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanTestFailoverInputProperties.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanTestFailoverInputProperties.TypeConverter.cs new file mode 100644 index 000000000000..72554c7c7516 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanTestFailoverInputProperties.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class RecoveryPlanTestFailoverInputPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverInputProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverInputProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return RecoveryPlanTestFailoverInputProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return RecoveryPlanTestFailoverInputProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return RecoveryPlanTestFailoverInputProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanTestFailoverInputProperties.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanTestFailoverInputProperties.cs new file mode 100644 index 000000000000..255b19c979cd --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanTestFailoverInputProperties.cs @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Recovery plan test failover input properties. + public partial class RecoveryPlanTestFailoverInputProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverInputProperties, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverInputPropertiesInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections _failoverDirection; + + /// The failover direction. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections FailoverDirection { get => this._failoverDirection; set => this._failoverDirection = value; } + + /// Backing field for property. + private string _networkId; + + /// The Id of the network to be used for test failover. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string NetworkId { get => this._networkId; set => this._networkId = value; } + + /// Backing field for property. + private string _networkType; + + /// The network type to be used for test failover. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string NetworkType { get => this._networkType; set => this._networkType = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInput[] _providerSpecificDetail; + + /// The provider specific properties. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInput[] ProviderSpecificDetail { get => this._providerSpecificDetail; set => this._providerSpecificDetail = value; } + + /// Creates an new instance. + public RecoveryPlanTestFailoverInputProperties() + { + + } + } + /// Recovery plan test failover input properties. + public partial interface IRecoveryPlanTestFailoverInputProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The failover direction. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The failover direction.", + SerializedName = @"failoverDirection", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections FailoverDirection { get; set; } + /// The Id of the network to be used for test failover. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Id of the network to be used for test failover.", + SerializedName = @"networkId", + PossibleTypes = new [] { typeof(string) })] + string NetworkId { get; set; } + /// The network type to be used for test failover. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The network type to be used for test failover.", + SerializedName = @"networkType", + PossibleTypes = new [] { typeof(string) })] + string NetworkType { get; set; } + /// The provider specific properties. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The provider specific properties.", + SerializedName = @"providerSpecificDetails", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInput) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInput[] ProviderSpecificDetail { get; set; } + + } + /// Recovery plan test failover input properties. + internal partial interface IRecoveryPlanTestFailoverInputPropertiesInternal + + { + /// The failover direction. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections FailoverDirection { get; set; } + /// The Id of the network to be used for test failover. + string NetworkId { get; set; } + /// The network type to be used for test failover. + string NetworkType { get; set; } + /// The provider specific properties. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInput[] ProviderSpecificDetail { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanTestFailoverInputProperties.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanTestFailoverInputProperties.json.cs new file mode 100644 index 000000000000..2ad17c38032f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanTestFailoverInputProperties.json.cs @@ -0,0 +1,124 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Recovery plan test failover input properties. + public partial class RecoveryPlanTestFailoverInputProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverInputProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverInputProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverInputProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new RecoveryPlanTestFailoverInputProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal RecoveryPlanTestFailoverInputProperties(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_failoverDirection = If( json?.PropertyT("failoverDirection"), out var __jsonFailoverDirection) ? (string)__jsonFailoverDirection : (string)FailoverDirection;} + {_networkType = If( json?.PropertyT("networkType"), out var __jsonNetworkType) ? (string)__jsonNetworkType : (string)NetworkType;} + {_networkId = If( json?.PropertyT("networkId"), out var __jsonNetworkId) ? (string)__jsonNetworkId : (string)NetworkId;} + {_providerSpecificDetail = If( json?.PropertyT("providerSpecificDetails"), out var __jsonProviderSpecificDetails) ? If( __jsonProviderSpecificDetails as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInput) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanProviderSpecificFailoverInput.FromJson(__u) )) ))() : null : ProviderSpecificDetail;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._failoverDirection)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._failoverDirection.ToString()) : null, "failoverDirection" ,container.Add ); + AddIf( null != (((object)this._networkType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._networkType.ToString()) : null, "networkType" ,container.Add ); + AddIf( null != (((object)this._networkId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._networkId.ToString()) : null, "networkId" ,container.Add ); + if (null != this._providerSpecificDetail) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._providerSpecificDetail ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("providerSpecificDetails",__w); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanUnplannedFailoverInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanUnplannedFailoverInput.PowerShell.cs new file mode 100644 index 000000000000..8d8179061b6e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanUnplannedFailoverInput.PowerShell.cs @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Recovery plan unplanned failover input. + [System.ComponentModel.TypeConverter(typeof(RecoveryPlanUnplannedFailoverInputTypeConverter))] + public partial class RecoveryPlanUnplannedFailoverInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanUnplannedFailoverInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new RecoveryPlanUnplannedFailoverInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanUnplannedFailoverInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new RecoveryPlanUnplannedFailoverInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanUnplannedFailoverInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal RecoveryPlanUnplannedFailoverInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanUnplannedFailoverInputInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanUnplannedFailoverInputProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanUnplannedFailoverInputInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanUnplannedFailoverInputPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("FailoverDirection")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanUnplannedFailoverInputInternal)this).FailoverDirection = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections) content.GetValueForProperty("FailoverDirection",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanUnplannedFailoverInputInternal)this).FailoverDirection, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections.CreateFrom); + } + if (content.Contains("SourceSiteOperation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanUnplannedFailoverInputInternal)this).SourceSiteOperation = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SourceSiteOperations) content.GetValueForProperty("SourceSiteOperation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanUnplannedFailoverInputInternal)this).SourceSiteOperation, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SourceSiteOperations.CreateFrom); + } + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanUnplannedFailoverInputInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInput[]) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanUnplannedFailoverInputInternal)this).ProviderSpecificDetail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanProviderSpecificFailoverInputTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal RecoveryPlanUnplannedFailoverInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanUnplannedFailoverInputInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanUnplannedFailoverInputProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanUnplannedFailoverInputInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanUnplannedFailoverInputPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("FailoverDirection")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanUnplannedFailoverInputInternal)this).FailoverDirection = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections) content.GetValueForProperty("FailoverDirection",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanUnplannedFailoverInputInternal)this).FailoverDirection, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections.CreateFrom); + } + if (content.Contains("SourceSiteOperation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanUnplannedFailoverInputInternal)this).SourceSiteOperation = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SourceSiteOperations) content.GetValueForProperty("SourceSiteOperation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanUnplannedFailoverInputInternal)this).SourceSiteOperation, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SourceSiteOperations.CreateFrom); + } + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanUnplannedFailoverInputInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInput[]) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanUnplannedFailoverInputInternal)this).ProviderSpecificDetail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanProviderSpecificFailoverInputTypeConverter.ConvertFrom)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Recovery plan unplanned failover input. + [System.ComponentModel.TypeConverter(typeof(RecoveryPlanUnplannedFailoverInputTypeConverter))] + public partial interface IRecoveryPlanUnplannedFailoverInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanUnplannedFailoverInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanUnplannedFailoverInput.TypeConverter.cs new file mode 100644 index 000000000000..ac4ac897a42e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanUnplannedFailoverInput.TypeConverter.cs @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class RecoveryPlanUnplannedFailoverInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanUnplannedFailoverInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanUnplannedFailoverInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return RecoveryPlanUnplannedFailoverInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return RecoveryPlanUnplannedFailoverInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return RecoveryPlanUnplannedFailoverInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanUnplannedFailoverInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanUnplannedFailoverInput.cs new file mode 100644 index 000000000000..212ec4b4bd84 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanUnplannedFailoverInput.cs @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Recovery plan unplanned failover input. + public partial class RecoveryPlanUnplannedFailoverInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanUnplannedFailoverInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanUnplannedFailoverInputInternal + { + + /// The failover direction. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections FailoverDirection { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanUnplannedFailoverInputPropertiesInternal)Property).FailoverDirection; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanUnplannedFailoverInputPropertiesInternal)Property).FailoverDirection = value ; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanUnplannedFailoverInputProperties Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanUnplannedFailoverInputInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanUnplannedFailoverInputProperties()); set { {_property = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanUnplannedFailoverInputProperties _property; + + /// The recovery plan unplanned failover input properties. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanUnplannedFailoverInputProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanUnplannedFailoverInputProperties()); set => this._property = value; } + + /// The provider specific properties. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInput[] ProviderSpecificDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanUnplannedFailoverInputPropertiesInternal)Property).ProviderSpecificDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanUnplannedFailoverInputPropertiesInternal)Property).ProviderSpecificDetail = value ?? null /* arrayOf */; } + + /// A value indicating whether source site operations are required. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SourceSiteOperations SourceSiteOperation { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanUnplannedFailoverInputPropertiesInternal)Property).SourceSiteOperation; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanUnplannedFailoverInputPropertiesInternal)Property).SourceSiteOperation = value ; } + + /// Creates an new instance. + public RecoveryPlanUnplannedFailoverInput() + { + + } + } + /// Recovery plan unplanned failover input. + public partial interface IRecoveryPlanUnplannedFailoverInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The failover direction. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The failover direction.", + SerializedName = @"failoverDirection", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections FailoverDirection { get; set; } + /// The provider specific properties. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The provider specific properties.", + SerializedName = @"providerSpecificDetails", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInput) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInput[] ProviderSpecificDetail { get; set; } + /// A value indicating whether source site operations are required. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"A value indicating whether source site operations are required.", + SerializedName = @"sourceSiteOperations", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SourceSiteOperations) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SourceSiteOperations SourceSiteOperation { get; set; } + + } + /// Recovery plan unplanned failover input. + internal partial interface IRecoveryPlanUnplannedFailoverInputInternal + + { + /// The failover direction. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections FailoverDirection { get; set; } + /// The recovery plan unplanned failover input properties. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanUnplannedFailoverInputProperties Property { get; set; } + /// The provider specific properties. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInput[] ProviderSpecificDetail { get; set; } + /// A value indicating whether source site operations are required. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SourceSiteOperations SourceSiteOperation { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanUnplannedFailoverInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanUnplannedFailoverInput.json.cs new file mode 100644 index 000000000000..01f9b96a6a4b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanUnplannedFailoverInput.json.cs @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Recovery plan unplanned failover input. + public partial class RecoveryPlanUnplannedFailoverInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanUnplannedFailoverInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanUnplannedFailoverInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanUnplannedFailoverInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new RecoveryPlanUnplannedFailoverInput(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal RecoveryPlanUnplannedFailoverInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanUnplannedFailoverInputProperties.FromJson(__jsonProperties) : Property;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanUnplannedFailoverInputProperties.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanUnplannedFailoverInputProperties.PowerShell.cs new file mode 100644 index 000000000000..4024ee2caf14 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanUnplannedFailoverInputProperties.PowerShell.cs @@ -0,0 +1,165 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Recovery plan unplanned failover input properties. + [System.ComponentModel.TypeConverter(typeof(RecoveryPlanUnplannedFailoverInputPropertiesTypeConverter))] + public partial class RecoveryPlanUnplannedFailoverInputProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanUnplannedFailoverInputProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new RecoveryPlanUnplannedFailoverInputProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanUnplannedFailoverInputProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new RecoveryPlanUnplannedFailoverInputProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from + /// a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanUnplannedFailoverInputProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal RecoveryPlanUnplannedFailoverInputProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("FailoverDirection")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanUnplannedFailoverInputPropertiesInternal)this).FailoverDirection = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections) content.GetValueForProperty("FailoverDirection",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanUnplannedFailoverInputPropertiesInternal)this).FailoverDirection, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections.CreateFrom); + } + if (content.Contains("SourceSiteOperation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanUnplannedFailoverInputPropertiesInternal)this).SourceSiteOperation = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SourceSiteOperations) content.GetValueForProperty("SourceSiteOperation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanUnplannedFailoverInputPropertiesInternal)this).SourceSiteOperation, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SourceSiteOperations.CreateFrom); + } + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanUnplannedFailoverInputPropertiesInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInput[]) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanUnplannedFailoverInputPropertiesInternal)this).ProviderSpecificDetail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanProviderSpecificFailoverInputTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal RecoveryPlanUnplannedFailoverInputProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("FailoverDirection")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanUnplannedFailoverInputPropertiesInternal)this).FailoverDirection = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections) content.GetValueForProperty("FailoverDirection",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanUnplannedFailoverInputPropertiesInternal)this).FailoverDirection, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections.CreateFrom); + } + if (content.Contains("SourceSiteOperation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanUnplannedFailoverInputPropertiesInternal)this).SourceSiteOperation = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SourceSiteOperations) content.GetValueForProperty("SourceSiteOperation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanUnplannedFailoverInputPropertiesInternal)this).SourceSiteOperation, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SourceSiteOperations.CreateFrom); + } + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanUnplannedFailoverInputPropertiesInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInput[]) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanUnplannedFailoverInputPropertiesInternal)this).ProviderSpecificDetail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanProviderSpecificFailoverInputTypeConverter.ConvertFrom)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Recovery plan unplanned failover input properties. + [System.ComponentModel.TypeConverter(typeof(RecoveryPlanUnplannedFailoverInputPropertiesTypeConverter))] + public partial interface IRecoveryPlanUnplannedFailoverInputProperties + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanUnplannedFailoverInputProperties.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanUnplannedFailoverInputProperties.TypeConverter.cs new file mode 100644 index 000000000000..66a64d3d8f6d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanUnplannedFailoverInputProperties.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class RecoveryPlanUnplannedFailoverInputPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, + /// otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanUnplannedFailoverInputProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanUnplannedFailoverInputProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return RecoveryPlanUnplannedFailoverInputProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return RecoveryPlanUnplannedFailoverInputProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return RecoveryPlanUnplannedFailoverInputProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanUnplannedFailoverInputProperties.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanUnplannedFailoverInputProperties.cs new file mode 100644 index 000000000000..6eb3d5e034d5 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanUnplannedFailoverInputProperties.cs @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Recovery plan unplanned failover input properties. + public partial class RecoveryPlanUnplannedFailoverInputProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanUnplannedFailoverInputProperties, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanUnplannedFailoverInputPropertiesInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections _failoverDirection; + + /// The failover direction. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections FailoverDirection { get => this._failoverDirection; set => this._failoverDirection = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInput[] _providerSpecificDetail; + + /// The provider specific properties. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInput[] ProviderSpecificDetail { get => this._providerSpecificDetail; set => this._providerSpecificDetail = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SourceSiteOperations _sourceSiteOperation; + + /// A value indicating whether source site operations are required. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SourceSiteOperations SourceSiteOperation { get => this._sourceSiteOperation; set => this._sourceSiteOperation = value; } + + /// + /// Creates an new instance. + /// + public RecoveryPlanUnplannedFailoverInputProperties() + { + + } + } + /// Recovery plan unplanned failover input properties. + public partial interface IRecoveryPlanUnplannedFailoverInputProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The failover direction. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The failover direction.", + SerializedName = @"failoverDirection", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections FailoverDirection { get; set; } + /// The provider specific properties. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The provider specific properties.", + SerializedName = @"providerSpecificDetails", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInput) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInput[] ProviderSpecificDetail { get; set; } + /// A value indicating whether source site operations are required. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"A value indicating whether source site operations are required.", + SerializedName = @"sourceSiteOperations", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SourceSiteOperations) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SourceSiteOperations SourceSiteOperation { get; set; } + + } + /// Recovery plan unplanned failover input properties. + internal partial interface IRecoveryPlanUnplannedFailoverInputPropertiesInternal + + { + /// The failover direction. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections FailoverDirection { get; set; } + /// The provider specific properties. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInput[] ProviderSpecificDetail { get; set; } + /// A value indicating whether source site operations are required. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SourceSiteOperations SourceSiteOperation { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanUnplannedFailoverInputProperties.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanUnplannedFailoverInputProperties.json.cs new file mode 100644 index 000000000000..559fcaabe2dd --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPlanUnplannedFailoverInputProperties.json.cs @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Recovery plan unplanned failover input properties. + public partial class RecoveryPlanUnplannedFailoverInputProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanUnplannedFailoverInputProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanUnplannedFailoverInputProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanUnplannedFailoverInputProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new RecoveryPlanUnplannedFailoverInputProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal RecoveryPlanUnplannedFailoverInputProperties(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_failoverDirection = If( json?.PropertyT("failoverDirection"), out var __jsonFailoverDirection) ? (string)__jsonFailoverDirection : (string)FailoverDirection;} + {_sourceSiteOperation = If( json?.PropertyT("sourceSiteOperations"), out var __jsonSourceSiteOperations) ? (string)__jsonSourceSiteOperations : (string)SourceSiteOperation;} + {_providerSpecificDetail = If( json?.PropertyT("providerSpecificDetails"), out var __jsonProviderSpecificDetails) ? If( __jsonProviderSpecificDetails as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInput) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanProviderSpecificFailoverInput.FromJson(__u) )) ))() : null : ProviderSpecificDetail;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._failoverDirection)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._failoverDirection.ToString()) : null, "failoverDirection" ,container.Add ); + AddIf( null != (((object)this._sourceSiteOperation)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._sourceSiteOperation.ToString()) : null, "sourceSiteOperations" ,container.Add ); + if (null != this._providerSpecificDetail) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._providerSpecificDetail ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("providerSpecificDetails",__w); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPoint.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPoint.PowerShell.cs new file mode 100644 index 000000000000..895d56151fec --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPoint.PowerShell.cs @@ -0,0 +1,208 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Recovery point. + [System.ComponentModel.TypeConverter(typeof(RecoveryPointTypeConverter))] + public partial class RecoveryPoint + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPoint DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new RecoveryPoint(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPoint DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new RecoveryPoint(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPoint FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal RecoveryPoint(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPointInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPointProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPointInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPointPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPointInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProviderSpecificRecoveryPointDetails) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPointInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProviderSpecificRecoveryPointDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("Time")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPointInternal)this).Time = (global::System.DateTime?) content.GetValueForProperty("Time",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPointInternal)this).Time, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("RecoveryPointType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPointInternal)this).RecoveryPointType = (string) content.GetValueForProperty("RecoveryPointType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPointInternal)this).RecoveryPointType, global::System.Convert.ToString); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPointInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPointInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal RecoveryPoint(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPointInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPointProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPointInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPointPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPointInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProviderSpecificRecoveryPointDetails) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPointInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProviderSpecificRecoveryPointDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("Time")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPointInternal)this).Time = (global::System.DateTime?) content.GetValueForProperty("Time",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPointInternal)this).Time, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("RecoveryPointType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPointInternal)this).RecoveryPointType = (string) content.GetValueForProperty("RecoveryPointType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPointInternal)this).RecoveryPointType, global::System.Convert.ToString); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPointInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPointInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Recovery point. + [System.ComponentModel.TypeConverter(typeof(RecoveryPointTypeConverter))] + public partial interface IRecoveryPoint + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPoint.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPoint.TypeConverter.cs new file mode 100644 index 000000000000..f8527b338216 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPoint.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class RecoveryPointTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPoint ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPoint).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return RecoveryPoint.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return RecoveryPoint.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return RecoveryPoint.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPoint.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPoint.cs new file mode 100644 index 000000000000..2f29188aeeac --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPoint.cs @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Recovery point. + public partial class RecoveryPoint : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPoint, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPointInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResource __resource = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.Resource(); + + /// Resource Id + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Id; } + + /// Resource Location + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string Location { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Location; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Location = value ?? null; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPointProperties Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPointInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPointProperties()); set { {_property = value;} } } + + /// Internal Acessors for ProviderSpecificDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProviderSpecificRecoveryPointDetails Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPointInternal.ProviderSpecificDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPointPropertiesInternal)Property).ProviderSpecificDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPointPropertiesInternal)Property).ProviderSpecificDetail = value; } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Id = value; } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Name = value; } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Type = value; } + + /// Resource Name + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Name; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPointProperties _property; + + /// The recovery point properties. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPointProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPointProperties()); set => this._property = value; } + + /// Gets the provider type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ProviderSpecificDetailInstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPointPropertiesInternal)Property).ProviderSpecificDetailInstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPointPropertiesInternal)Property).ProviderSpecificDetailInstanceType = value ?? null; } + + /// The recovery point type: ApplicationConsistent, CrashConsistent. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string RecoveryPointType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPointPropertiesInternal)Property).RecoveryPointType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPointPropertiesInternal)Property).RecoveryPointType = value ?? null; } + + /// The recovery point time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public global::System.DateTime? Time { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPointPropertiesInternal)Property).RecoveryPointTime; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPointPropertiesInternal)Property).RecoveryPointTime = value ?? default(global::System.DateTime); } + + /// Resource Type + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Type; } + + /// Creates an new instance. + public RecoveryPoint() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__resource), __resource); + await eventListener.AssertObjectIsValid(nameof(__resource), __resource); + } + } + /// Recovery point. + public partial interface IRecoveryPoint : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResource + { + /// Gets the provider type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets the provider type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string ProviderSpecificDetailInstanceType { get; set; } + /// The recovery point type: ApplicationConsistent, CrashConsistent. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery point type: ApplicationConsistent, CrashConsistent.", + SerializedName = @"recoveryPointType", + PossibleTypes = new [] { typeof(string) })] + string RecoveryPointType { get; set; } + /// The recovery point time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery point time.", + SerializedName = @"recoveryPointTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? Time { get; set; } + + } + /// Recovery point. + internal partial interface IRecoveryPointInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal + { + /// The recovery point properties. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPointProperties Property { get; set; } + /// The provider specific details for the recovery point. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProviderSpecificRecoveryPointDetails ProviderSpecificDetail { get; set; } + /// Gets the provider type. + string ProviderSpecificDetailInstanceType { get; set; } + /// The recovery point type: ApplicationConsistent, CrashConsistent. + string RecoveryPointType { get; set; } + /// The recovery point time. + global::System.DateTime? Time { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPoint.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPoint.json.cs new file mode 100644 index 000000000000..2f2cbd7503fe --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPoint.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Recovery point. + public partial class RecoveryPoint + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPoint. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPoint. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPoint FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new RecoveryPoint(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal RecoveryPoint(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __resource = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.Resource(json); + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPointProperties.FromJson(__jsonProperties) : Property;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __resource?.ToJson(container, serializationMode); + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPointCollection.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPointCollection.PowerShell.cs new file mode 100644 index 000000000000..5d95e01900e2 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPointCollection.PowerShell.cs @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Collection of recovery point details. + [System.ComponentModel.TypeConverter(typeof(RecoveryPointCollectionTypeConverter))] + public partial class RecoveryPointCollection + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPointCollection DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new RecoveryPointCollection(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPointCollection DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new RecoveryPointCollection(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPointCollection FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal RecoveryPointCollection(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPointCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPoint[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPointCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPointTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPointCollectionInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPointCollectionInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal RecoveryPointCollection(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPointCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPoint[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPointCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPointTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPointCollectionInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPointCollectionInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Collection of recovery point details. + [System.ComponentModel.TypeConverter(typeof(RecoveryPointCollectionTypeConverter))] + public partial interface IRecoveryPointCollection + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPointCollection.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPointCollection.TypeConverter.cs new file mode 100644 index 000000000000..350dd427015a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPointCollection.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class RecoveryPointCollectionTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPointCollection ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPointCollection).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return RecoveryPointCollection.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return RecoveryPointCollection.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return RecoveryPointCollection.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPointCollection.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPointCollection.cs new file mode 100644 index 000000000000..43353530b2ac --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPointCollection.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Collection of recovery point details. + public partial class RecoveryPointCollection : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPointCollection, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPointCollectionInternal + { + + /// Backing field for property. + private string _nextLink; + + /// The value of next link. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string NextLink { get => this._nextLink; set => this._nextLink = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPoint[] _value; + + /// The recovery point details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPoint[] Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public RecoveryPointCollection() + { + + } + } + /// Collection of recovery point details. + public partial interface IRecoveryPointCollection : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The value of next link. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The value of next link.", + SerializedName = @"nextLink", + PossibleTypes = new [] { typeof(string) })] + string NextLink { get; set; } + /// The recovery point details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery point details.", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPoint) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPoint[] Value { get; set; } + + } + /// Collection of recovery point details. + internal partial interface IRecoveryPointCollectionInternal + + { + /// The value of next link. + string NextLink { get; set; } + /// The recovery point details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPoint[] Value { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPointCollection.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPointCollection.json.cs new file mode 100644 index 000000000000..04c90fb2b933 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPointCollection.json.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Collection of recovery point details. + public partial class RecoveryPointCollection + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPointCollection. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPointCollection. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPointCollection FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new RecoveryPointCollection(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal RecoveryPointCollection(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPoint) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPoint.FromJson(__u) )) ))() : null : Value;} + {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)NextLink;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._value) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._value ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("value",__w); + } + AddIf( null != (((object)this._nextLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPointProperties.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPointProperties.PowerShell.cs new file mode 100644 index 000000000000..dcfb5e3ae378 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPointProperties.PowerShell.cs @@ -0,0 +1,168 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Recovery point properties. + [System.ComponentModel.TypeConverter(typeof(RecoveryPointPropertiesTypeConverter))] + public partial class RecoveryPointProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPointProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new RecoveryPointProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPointProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new RecoveryPointProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPointProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal RecoveryPointProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPointPropertiesInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProviderSpecificRecoveryPointDetails) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPointPropertiesInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProviderSpecificRecoveryPointDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("RecoveryPointTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPointPropertiesInternal)this).RecoveryPointTime = (global::System.DateTime?) content.GetValueForProperty("RecoveryPointTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPointPropertiesInternal)this).RecoveryPointTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("RecoveryPointType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPointPropertiesInternal)this).RecoveryPointType = (string) content.GetValueForProperty("RecoveryPointType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPointPropertiesInternal)this).RecoveryPointType, global::System.Convert.ToString); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPointPropertiesInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPointPropertiesInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal RecoveryPointProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPointPropertiesInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProviderSpecificRecoveryPointDetails) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPointPropertiesInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProviderSpecificRecoveryPointDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("RecoveryPointTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPointPropertiesInternal)this).RecoveryPointTime = (global::System.DateTime?) content.GetValueForProperty("RecoveryPointTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPointPropertiesInternal)this).RecoveryPointTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("RecoveryPointType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPointPropertiesInternal)this).RecoveryPointType = (string) content.GetValueForProperty("RecoveryPointType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPointPropertiesInternal)this).RecoveryPointType, global::System.Convert.ToString); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPointPropertiesInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPointPropertiesInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Recovery point properties. + [System.ComponentModel.TypeConverter(typeof(RecoveryPointPropertiesTypeConverter))] + public partial interface IRecoveryPointProperties + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPointProperties.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPointProperties.TypeConverter.cs new file mode 100644 index 000000000000..c1df6700a5b9 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPointProperties.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class RecoveryPointPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPointProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPointProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return RecoveryPointProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return RecoveryPointProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return RecoveryPointProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPointProperties.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPointProperties.cs new file mode 100644 index 000000000000..8649a3ffe575 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPointProperties.cs @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Recovery point properties. + public partial class RecoveryPointProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPointProperties, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPointPropertiesInternal + { + + /// Internal Acessors for ProviderSpecificDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProviderSpecificRecoveryPointDetails Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPointPropertiesInternal.ProviderSpecificDetail { get => (this._providerSpecificDetail = this._providerSpecificDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProviderSpecificRecoveryPointDetails()); set { {_providerSpecificDetail = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProviderSpecificRecoveryPointDetails _providerSpecificDetail; + + /// The provider specific details for the recovery point. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProviderSpecificRecoveryPointDetails ProviderSpecificDetail { get => (this._providerSpecificDetail = this._providerSpecificDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProviderSpecificRecoveryPointDetails()); set => this._providerSpecificDetail = value; } + + /// Gets the provider type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ProviderSpecificDetailInstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProviderSpecificRecoveryPointDetailsInternal)ProviderSpecificDetail).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProviderSpecificRecoveryPointDetailsInternal)ProviderSpecificDetail).InstanceType = value ?? null; } + + /// Backing field for property. + private global::System.DateTime? _recoveryPointTime; + + /// The recovery point time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public global::System.DateTime? RecoveryPointTime { get => this._recoveryPointTime; set => this._recoveryPointTime = value; } + + /// Backing field for property. + private string _recoveryPointType; + + /// The recovery point type: ApplicationConsistent, CrashConsistent. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryPointType { get => this._recoveryPointType; set => this._recoveryPointType = value; } + + /// Creates an new instance. + public RecoveryPointProperties() + { + + } + } + /// Recovery point properties. + public partial interface IRecoveryPointProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// Gets the provider type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets the provider type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string ProviderSpecificDetailInstanceType { get; set; } + /// The recovery point time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery point time.", + SerializedName = @"recoveryPointTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? RecoveryPointTime { get; set; } + /// The recovery point type: ApplicationConsistent, CrashConsistent. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery point type: ApplicationConsistent, CrashConsistent.", + SerializedName = @"recoveryPointType", + PossibleTypes = new [] { typeof(string) })] + string RecoveryPointType { get; set; } + + } + /// Recovery point properties. + internal partial interface IRecoveryPointPropertiesInternal + + { + /// The provider specific details for the recovery point. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProviderSpecificRecoveryPointDetails ProviderSpecificDetail { get; set; } + /// Gets the provider type. + string ProviderSpecificDetailInstanceType { get; set; } + /// The recovery point time. + global::System.DateTime? RecoveryPointTime { get; set; } + /// The recovery point type: ApplicationConsistent, CrashConsistent. + string RecoveryPointType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPointProperties.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPointProperties.json.cs new file mode 100644 index 000000000000..597fd2005fc0 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryPointProperties.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Recovery point properties. + public partial class RecoveryPointProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPointProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPointProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPointProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new RecoveryPointProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal RecoveryPointProperties(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_providerSpecificDetail = If( json?.PropertyT("providerSpecificDetails"), out var __jsonProviderSpecificDetails) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProviderSpecificRecoveryPointDetails.FromJson(__jsonProviderSpecificDetails) : ProviderSpecificDetail;} + {_recoveryPointTime = If( json?.PropertyT("recoveryPointTime"), out var __jsonRecoveryPointTime) ? global::System.DateTime.TryParse((string)__jsonRecoveryPointTime, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonRecoveryPointTimeValue) ? __jsonRecoveryPointTimeValue : RecoveryPointTime : RecoveryPointTime;} + {_recoveryPointType = If( json?.PropertyT("recoveryPointType"), out var __jsonRecoveryPointType) ? (string)__jsonRecoveryPointType : (string)RecoveryPointType;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._providerSpecificDetail ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._providerSpecificDetail.ToJson(null,serializationMode) : null, "providerSpecificDetails" ,container.Add ); + AddIf( null != this._recoveryPointTime ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryPointTime?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "recoveryPointTime" ,container.Add ); + AddIf( null != (((object)this._recoveryPointType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryPointType.ToString()) : null, "recoveryPointType" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryProximityPlacementGroupCustomDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryProximityPlacementGroupCustomDetails.PowerShell.cs new file mode 100644 index 000000000000..a74fd772d52b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryProximityPlacementGroupCustomDetails.PowerShell.cs @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Recovery Proximity placement group custom input. + [System.ComponentModel.TypeConverter(typeof(RecoveryProximityPlacementGroupCustomDetailsTypeConverter))] + public partial class RecoveryProximityPlacementGroupCustomDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryProximityPlacementGroupCustomDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new RecoveryProximityPlacementGroupCustomDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryProximityPlacementGroupCustomDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new RecoveryProximityPlacementGroupCustomDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from + /// a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryProximityPlacementGroupCustomDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal RecoveryProximityPlacementGroupCustomDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ResourceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryProximityPlacementGroupCustomDetailsInternal)this).ResourceType = (string) content.GetValueForProperty("ResourceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryProximityPlacementGroupCustomDetailsInternal)this).ResourceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal RecoveryProximityPlacementGroupCustomDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ResourceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryProximityPlacementGroupCustomDetailsInternal)this).ResourceType = (string) content.GetValueForProperty("ResourceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryProximityPlacementGroupCustomDetailsInternal)this).ResourceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Recovery Proximity placement group custom input. + [System.ComponentModel.TypeConverter(typeof(RecoveryProximityPlacementGroupCustomDetailsTypeConverter))] + public partial interface IRecoveryProximityPlacementGroupCustomDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryProximityPlacementGroupCustomDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryProximityPlacementGroupCustomDetails.TypeConverter.cs new file mode 100644 index 000000000000..af1c0a3aac2e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryProximityPlacementGroupCustomDetails.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class RecoveryProximityPlacementGroupCustomDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, + /// otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryProximityPlacementGroupCustomDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryProximityPlacementGroupCustomDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return RecoveryProximityPlacementGroupCustomDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return RecoveryProximityPlacementGroupCustomDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return RecoveryProximityPlacementGroupCustomDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryProximityPlacementGroupCustomDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryProximityPlacementGroupCustomDetails.cs new file mode 100644 index 000000000000..74fff9216224 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryProximityPlacementGroupCustomDetails.cs @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Recovery Proximity placement group custom input. + public partial class RecoveryProximityPlacementGroupCustomDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryProximityPlacementGroupCustomDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryProximityPlacementGroupCustomDetailsInternal + { + + /// Backing field for property. + private string _resourceType; + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ResourceType { get => this._resourceType; set => this._resourceType = value; } + + /// + /// Creates an new instance. + /// + public RecoveryProximityPlacementGroupCustomDetails() + { + + } + } + /// Recovery Proximity placement group custom input. + public partial interface IRecoveryProximityPlacementGroupCustomDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"resourceType", + PossibleTypes = new [] { typeof(string) })] + string ResourceType { get; set; } + + } + /// Recovery Proximity placement group custom input. + internal partial interface IRecoveryProximityPlacementGroupCustomDetailsInternal + + { + /// The class type. + string ResourceType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryProximityPlacementGroupCustomDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryProximityPlacementGroupCustomDetails.json.cs new file mode 100644 index 000000000000..f598163dee1e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryProximityPlacementGroupCustomDetails.json.cs @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Recovery Proximity placement group custom input. + public partial class RecoveryProximityPlacementGroupCustomDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryProximityPlacementGroupCustomDetails. + /// Note: the Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryProximityPlacementGroupCustomDetails + /// interface is polymorphic, and the precise model class that will get deserialized is determined at runtime based on the + /// payload. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryProximityPlacementGroupCustomDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryProximityPlacementGroupCustomDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + if (!(node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json)) + { + return null; + } + // Polymorphic type -- select the appropriate constructor using the discriminator + + switch ( json.StringProperty("resourceType") ) + { + case "Existing": + { + return new ExistingRecoveryProximityPlacementGroup(json); + } + } + return new RecoveryProximityPlacementGroupCustomDetails(json); + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal RecoveryProximityPlacementGroupCustomDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_resourceType = If( json?.PropertyT("resourceType"), out var __jsonResourceType) ? (string)__jsonResourceType : (string)ResourceType;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._resourceType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._resourceType.ToString()) : null, "resourceType" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryResourceGroupCustomDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryResourceGroupCustomDetails.PowerShell.cs new file mode 100644 index 000000000000..2874bff09205 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryResourceGroupCustomDetails.PowerShell.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Recovery Resource Group custom input. + [System.ComponentModel.TypeConverter(typeof(RecoveryResourceGroupCustomDetailsTypeConverter))] + public partial class RecoveryResourceGroupCustomDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryResourceGroupCustomDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new RecoveryResourceGroupCustomDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryResourceGroupCustomDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new RecoveryResourceGroupCustomDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryResourceGroupCustomDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal RecoveryResourceGroupCustomDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ResourceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryResourceGroupCustomDetailsInternal)this).ResourceType = (string) content.GetValueForProperty("ResourceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryResourceGroupCustomDetailsInternal)this).ResourceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal RecoveryResourceGroupCustomDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ResourceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryResourceGroupCustomDetailsInternal)this).ResourceType = (string) content.GetValueForProperty("ResourceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryResourceGroupCustomDetailsInternal)this).ResourceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Recovery Resource Group custom input. + [System.ComponentModel.TypeConverter(typeof(RecoveryResourceGroupCustomDetailsTypeConverter))] + public partial interface IRecoveryResourceGroupCustomDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryResourceGroupCustomDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryResourceGroupCustomDetails.TypeConverter.cs new file mode 100644 index 000000000000..bb387fce2078 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryResourceGroupCustomDetails.TypeConverter.cs @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class RecoveryResourceGroupCustomDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryResourceGroupCustomDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryResourceGroupCustomDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return RecoveryResourceGroupCustomDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return RecoveryResourceGroupCustomDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return RecoveryResourceGroupCustomDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryResourceGroupCustomDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryResourceGroupCustomDetails.cs new file mode 100644 index 000000000000..e95881964041 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryResourceGroupCustomDetails.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Recovery Resource Group custom input. + public partial class RecoveryResourceGroupCustomDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryResourceGroupCustomDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryResourceGroupCustomDetailsInternal + { + + /// Backing field for property. + private string _resourceType; + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ResourceType { get => this._resourceType; set => this._resourceType = value; } + + /// Creates an new instance. + public RecoveryResourceGroupCustomDetails() + { + + } + } + /// Recovery Resource Group custom input. + public partial interface IRecoveryResourceGroupCustomDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"resourceType", + PossibleTypes = new [] { typeof(string) })] + string ResourceType { get; set; } + + } + /// Recovery Resource Group custom input. + internal partial interface IRecoveryResourceGroupCustomDetailsInternal + + { + /// The class type. + string ResourceType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryResourceGroupCustomDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryResourceGroupCustomDetails.json.cs new file mode 100644 index 000000000000..334f320c7912 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryResourceGroupCustomDetails.json.cs @@ -0,0 +1,124 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Recovery Resource Group custom input. + public partial class RecoveryResourceGroupCustomDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryResourceGroupCustomDetails. + /// Note: the Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryResourceGroupCustomDetails interface + /// is polymorphic, and the precise model class that will get deserialized is determined at runtime based on the payload. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryResourceGroupCustomDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryResourceGroupCustomDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + if (!(node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json)) + { + return null; + } + // Polymorphic type -- select the appropriate constructor using the discriminator + + switch ( json.StringProperty("resourceType") ) + { + case "Existing": + { + return new ExistingRecoveryResourceGroup(json); + } + } + return new RecoveryResourceGroupCustomDetails(json); + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal RecoveryResourceGroupCustomDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_resourceType = If( json?.PropertyT("resourceType"), out var __jsonResourceType) ? (string)__jsonResourceType : (string)ResourceType;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._resourceType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._resourceType.ToString()) : null, "resourceType" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryServicesProvider.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryServicesProvider.PowerShell.cs new file mode 100644 index 000000000000..3e7cfd42bc76 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryServicesProvider.PowerShell.cs @@ -0,0 +1,482 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Provider details. + [System.ComponentModel.TypeConverter(typeof(RecoveryServicesProviderTypeConverter))] + public partial class RecoveryServicesProvider + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProvider DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new RecoveryServicesProvider(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProvider DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new RecoveryServicesProvider(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProvider FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal RecoveryServicesProvider(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryServicesProviderPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("AuthenticationIdentityDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).AuthenticationIdentityDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetails) content.GetValueForProperty("AuthenticationIdentityDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).AuthenticationIdentityDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IdentityProviderDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("ResourceAccessIdentityDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).ResourceAccessIdentityDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetails) content.GetValueForProperty("ResourceAccessIdentityDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).ResourceAccessIdentityDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IdentityProviderDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("DataPlaneAuthenticationIdentityDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).DataPlaneAuthenticationIdentityDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetails) content.GetValueForProperty("DataPlaneAuthenticationIdentityDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).DataPlaneAuthenticationIdentityDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IdentityProviderDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderVersionDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).ProviderVersionDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVersionDetails) content.GetValueForProperty("ProviderVersionDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).ProviderVersionDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VersionDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("FabricType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).FabricType = (string) content.GetValueForProperty("FabricType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).FabricType, global::System.Convert.ToString); + } + if (content.Contains("FriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).FriendlyName = (string) content.GetValueForProperty("FriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).FriendlyName, global::System.Convert.ToString); + } + if (content.Contains("ProviderVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).ProviderVersion = (string) content.GetValueForProperty("ProviderVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).ProviderVersion, global::System.Convert.ToString); + } + if (content.Contains("ServerVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).ServerVersion = (string) content.GetValueForProperty("ServerVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).ServerVersion, global::System.Convert.ToString); + } + if (content.Contains("ProviderVersionState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).ProviderVersionState = (string) content.GetValueForProperty("ProviderVersionState",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).ProviderVersionState, global::System.Convert.ToString); + } + if (content.Contains("ProviderVersionExpiryDate")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).ProviderVersionExpiryDate = (global::System.DateTime?) content.GetValueForProperty("ProviderVersionExpiryDate",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).ProviderVersionExpiryDate, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("FabricFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).FabricFriendlyName = (string) content.GetValueForProperty("FabricFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).FabricFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("LastHeartBeat")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).LastHeartBeat = (global::System.DateTime?) content.GetValueForProperty("LastHeartBeat",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).LastHeartBeat, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ConnectionStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).ConnectionStatus = (string) content.GetValueForProperty("ConnectionStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).ConnectionStatus, global::System.Convert.ToString); + } + if (content.Contains("ProtectedItemCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).ProtectedItemCount = (int?) content.GetValueForProperty("ProtectedItemCount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).ProtectedItemCount, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("AllowedScenario")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).AllowedScenario = (string[]) content.GetValueForProperty("AllowedScenario",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).AllowedScenario, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("HealthErrorDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).HealthErrorDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[]) content.GetValueForProperty("HealthErrorDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).HealthErrorDetail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("DraIdentifier")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).DraIdentifier = (string) content.GetValueForProperty("DraIdentifier",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).DraIdentifier, global::System.Convert.ToString); + } + if (content.Contains("MachineId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).MachineId = (string) content.GetValueForProperty("MachineId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).MachineId, global::System.Convert.ToString); + } + if (content.Contains("MachineName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).MachineName = (string) content.GetValueForProperty("MachineName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).MachineName, global::System.Convert.ToString); + } + if (content.Contains("BiosId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).BiosId = (string) content.GetValueForProperty("BiosId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).BiosId, global::System.Convert.ToString); + } + if (content.Contains("AuthenticationIdentityDetailTenantId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).AuthenticationIdentityDetailTenantId = (string) content.GetValueForProperty("AuthenticationIdentityDetailTenantId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).AuthenticationIdentityDetailTenantId, global::System.Convert.ToString); + } + if (content.Contains("AuthenticationIdentityDetailApplicationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).AuthenticationIdentityDetailApplicationId = (string) content.GetValueForProperty("AuthenticationIdentityDetailApplicationId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).AuthenticationIdentityDetailApplicationId, global::System.Convert.ToString); + } + if (content.Contains("AuthenticationIdentityDetailObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).AuthenticationIdentityDetailObjectId = (string) content.GetValueForProperty("AuthenticationIdentityDetailObjectId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).AuthenticationIdentityDetailObjectId, global::System.Convert.ToString); + } + if (content.Contains("AuthenticationIdentityDetailAudience")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).AuthenticationIdentityDetailAudience = (string) content.GetValueForProperty("AuthenticationIdentityDetailAudience",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).AuthenticationIdentityDetailAudience, global::System.Convert.ToString); + } + if (content.Contains("AuthenticationIdentityDetailAadAuthority")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).AuthenticationIdentityDetailAadAuthority = (string) content.GetValueForProperty("AuthenticationIdentityDetailAadAuthority",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).AuthenticationIdentityDetailAadAuthority, global::System.Convert.ToString); + } + if (content.Contains("ResourceAccessIdentityDetailTenantId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).ResourceAccessIdentityDetailTenantId = (string) content.GetValueForProperty("ResourceAccessIdentityDetailTenantId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).ResourceAccessIdentityDetailTenantId, global::System.Convert.ToString); + } + if (content.Contains("ResourceAccessIdentityDetailApplicationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).ResourceAccessIdentityDetailApplicationId = (string) content.GetValueForProperty("ResourceAccessIdentityDetailApplicationId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).ResourceAccessIdentityDetailApplicationId, global::System.Convert.ToString); + } + if (content.Contains("ResourceAccessIdentityDetailObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).ResourceAccessIdentityDetailObjectId = (string) content.GetValueForProperty("ResourceAccessIdentityDetailObjectId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).ResourceAccessIdentityDetailObjectId, global::System.Convert.ToString); + } + if (content.Contains("ResourceAccessIdentityDetailAudience")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).ResourceAccessIdentityDetailAudience = (string) content.GetValueForProperty("ResourceAccessIdentityDetailAudience",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).ResourceAccessIdentityDetailAudience, global::System.Convert.ToString); + } + if (content.Contains("ResourceAccessIdentityDetailAadAuthority")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).ResourceAccessIdentityDetailAadAuthority = (string) content.GetValueForProperty("ResourceAccessIdentityDetailAadAuthority",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).ResourceAccessIdentityDetailAadAuthority, global::System.Convert.ToString); + } + if (content.Contains("DataPlaneAuthenticationIdentityDetailTenantId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).DataPlaneAuthenticationIdentityDetailTenantId = (string) content.GetValueForProperty("DataPlaneAuthenticationIdentityDetailTenantId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).DataPlaneAuthenticationIdentityDetailTenantId, global::System.Convert.ToString); + } + if (content.Contains("DataPlaneAuthenticationIdentityDetailApplicationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).DataPlaneAuthenticationIdentityDetailApplicationId = (string) content.GetValueForProperty("DataPlaneAuthenticationIdentityDetailApplicationId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).DataPlaneAuthenticationIdentityDetailApplicationId, global::System.Convert.ToString); + } + if (content.Contains("DataPlaneAuthenticationIdentityDetailObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).DataPlaneAuthenticationIdentityDetailObjectId = (string) content.GetValueForProperty("DataPlaneAuthenticationIdentityDetailObjectId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).DataPlaneAuthenticationIdentityDetailObjectId, global::System.Convert.ToString); + } + if (content.Contains("DataPlaneAuthenticationIdentityDetailAudience")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).DataPlaneAuthenticationIdentityDetailAudience = (string) content.GetValueForProperty("DataPlaneAuthenticationIdentityDetailAudience",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).DataPlaneAuthenticationIdentityDetailAudience, global::System.Convert.ToString); + } + if (content.Contains("DataPlaneAuthenticationIdentityDetailAadAuthority")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).DataPlaneAuthenticationIdentityDetailAadAuthority = (string) content.GetValueForProperty("DataPlaneAuthenticationIdentityDetailAadAuthority",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).DataPlaneAuthenticationIdentityDetailAadAuthority, global::System.Convert.ToString); + } + if (content.Contains("ProviderVersionDetailVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).ProviderVersionDetailVersion = (string) content.GetValueForProperty("ProviderVersionDetailVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).ProviderVersionDetailVersion, global::System.Convert.ToString); + } + if (content.Contains("ProviderVersionDetailExpiryDate")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).ProviderVersionDetailExpiryDate = (global::System.DateTime?) content.GetValueForProperty("ProviderVersionDetailExpiryDate",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).ProviderVersionDetailExpiryDate, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ProviderVersionDetailStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).ProviderVersionDetailStatus = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentVersionStatus?) content.GetValueForProperty("ProviderVersionDetailStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).ProviderVersionDetailStatus, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentVersionStatus.CreateFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal RecoveryServicesProvider(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryServicesProviderPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("AuthenticationIdentityDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).AuthenticationIdentityDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetails) content.GetValueForProperty("AuthenticationIdentityDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).AuthenticationIdentityDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IdentityProviderDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("ResourceAccessIdentityDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).ResourceAccessIdentityDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetails) content.GetValueForProperty("ResourceAccessIdentityDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).ResourceAccessIdentityDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IdentityProviderDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("DataPlaneAuthenticationIdentityDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).DataPlaneAuthenticationIdentityDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetails) content.GetValueForProperty("DataPlaneAuthenticationIdentityDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).DataPlaneAuthenticationIdentityDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IdentityProviderDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderVersionDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).ProviderVersionDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVersionDetails) content.GetValueForProperty("ProviderVersionDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).ProviderVersionDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VersionDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("FabricType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).FabricType = (string) content.GetValueForProperty("FabricType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).FabricType, global::System.Convert.ToString); + } + if (content.Contains("FriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).FriendlyName = (string) content.GetValueForProperty("FriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).FriendlyName, global::System.Convert.ToString); + } + if (content.Contains("ProviderVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).ProviderVersion = (string) content.GetValueForProperty("ProviderVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).ProviderVersion, global::System.Convert.ToString); + } + if (content.Contains("ServerVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).ServerVersion = (string) content.GetValueForProperty("ServerVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).ServerVersion, global::System.Convert.ToString); + } + if (content.Contains("ProviderVersionState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).ProviderVersionState = (string) content.GetValueForProperty("ProviderVersionState",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).ProviderVersionState, global::System.Convert.ToString); + } + if (content.Contains("ProviderVersionExpiryDate")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).ProviderVersionExpiryDate = (global::System.DateTime?) content.GetValueForProperty("ProviderVersionExpiryDate",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).ProviderVersionExpiryDate, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("FabricFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).FabricFriendlyName = (string) content.GetValueForProperty("FabricFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).FabricFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("LastHeartBeat")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).LastHeartBeat = (global::System.DateTime?) content.GetValueForProperty("LastHeartBeat",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).LastHeartBeat, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ConnectionStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).ConnectionStatus = (string) content.GetValueForProperty("ConnectionStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).ConnectionStatus, global::System.Convert.ToString); + } + if (content.Contains("ProtectedItemCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).ProtectedItemCount = (int?) content.GetValueForProperty("ProtectedItemCount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).ProtectedItemCount, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("AllowedScenario")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).AllowedScenario = (string[]) content.GetValueForProperty("AllowedScenario",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).AllowedScenario, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("HealthErrorDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).HealthErrorDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[]) content.GetValueForProperty("HealthErrorDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).HealthErrorDetail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("DraIdentifier")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).DraIdentifier = (string) content.GetValueForProperty("DraIdentifier",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).DraIdentifier, global::System.Convert.ToString); + } + if (content.Contains("MachineId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).MachineId = (string) content.GetValueForProperty("MachineId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).MachineId, global::System.Convert.ToString); + } + if (content.Contains("MachineName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).MachineName = (string) content.GetValueForProperty("MachineName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).MachineName, global::System.Convert.ToString); + } + if (content.Contains("BiosId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).BiosId = (string) content.GetValueForProperty("BiosId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).BiosId, global::System.Convert.ToString); + } + if (content.Contains("AuthenticationIdentityDetailTenantId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).AuthenticationIdentityDetailTenantId = (string) content.GetValueForProperty("AuthenticationIdentityDetailTenantId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).AuthenticationIdentityDetailTenantId, global::System.Convert.ToString); + } + if (content.Contains("AuthenticationIdentityDetailApplicationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).AuthenticationIdentityDetailApplicationId = (string) content.GetValueForProperty("AuthenticationIdentityDetailApplicationId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).AuthenticationIdentityDetailApplicationId, global::System.Convert.ToString); + } + if (content.Contains("AuthenticationIdentityDetailObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).AuthenticationIdentityDetailObjectId = (string) content.GetValueForProperty("AuthenticationIdentityDetailObjectId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).AuthenticationIdentityDetailObjectId, global::System.Convert.ToString); + } + if (content.Contains("AuthenticationIdentityDetailAudience")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).AuthenticationIdentityDetailAudience = (string) content.GetValueForProperty("AuthenticationIdentityDetailAudience",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).AuthenticationIdentityDetailAudience, global::System.Convert.ToString); + } + if (content.Contains("AuthenticationIdentityDetailAadAuthority")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).AuthenticationIdentityDetailAadAuthority = (string) content.GetValueForProperty("AuthenticationIdentityDetailAadAuthority",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).AuthenticationIdentityDetailAadAuthority, global::System.Convert.ToString); + } + if (content.Contains("ResourceAccessIdentityDetailTenantId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).ResourceAccessIdentityDetailTenantId = (string) content.GetValueForProperty("ResourceAccessIdentityDetailTenantId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).ResourceAccessIdentityDetailTenantId, global::System.Convert.ToString); + } + if (content.Contains("ResourceAccessIdentityDetailApplicationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).ResourceAccessIdentityDetailApplicationId = (string) content.GetValueForProperty("ResourceAccessIdentityDetailApplicationId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).ResourceAccessIdentityDetailApplicationId, global::System.Convert.ToString); + } + if (content.Contains("ResourceAccessIdentityDetailObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).ResourceAccessIdentityDetailObjectId = (string) content.GetValueForProperty("ResourceAccessIdentityDetailObjectId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).ResourceAccessIdentityDetailObjectId, global::System.Convert.ToString); + } + if (content.Contains("ResourceAccessIdentityDetailAudience")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).ResourceAccessIdentityDetailAudience = (string) content.GetValueForProperty("ResourceAccessIdentityDetailAudience",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).ResourceAccessIdentityDetailAudience, global::System.Convert.ToString); + } + if (content.Contains("ResourceAccessIdentityDetailAadAuthority")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).ResourceAccessIdentityDetailAadAuthority = (string) content.GetValueForProperty("ResourceAccessIdentityDetailAadAuthority",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).ResourceAccessIdentityDetailAadAuthority, global::System.Convert.ToString); + } + if (content.Contains("DataPlaneAuthenticationIdentityDetailTenantId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).DataPlaneAuthenticationIdentityDetailTenantId = (string) content.GetValueForProperty("DataPlaneAuthenticationIdentityDetailTenantId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).DataPlaneAuthenticationIdentityDetailTenantId, global::System.Convert.ToString); + } + if (content.Contains("DataPlaneAuthenticationIdentityDetailApplicationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).DataPlaneAuthenticationIdentityDetailApplicationId = (string) content.GetValueForProperty("DataPlaneAuthenticationIdentityDetailApplicationId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).DataPlaneAuthenticationIdentityDetailApplicationId, global::System.Convert.ToString); + } + if (content.Contains("DataPlaneAuthenticationIdentityDetailObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).DataPlaneAuthenticationIdentityDetailObjectId = (string) content.GetValueForProperty("DataPlaneAuthenticationIdentityDetailObjectId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).DataPlaneAuthenticationIdentityDetailObjectId, global::System.Convert.ToString); + } + if (content.Contains("DataPlaneAuthenticationIdentityDetailAudience")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).DataPlaneAuthenticationIdentityDetailAudience = (string) content.GetValueForProperty("DataPlaneAuthenticationIdentityDetailAudience",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).DataPlaneAuthenticationIdentityDetailAudience, global::System.Convert.ToString); + } + if (content.Contains("DataPlaneAuthenticationIdentityDetailAadAuthority")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).DataPlaneAuthenticationIdentityDetailAadAuthority = (string) content.GetValueForProperty("DataPlaneAuthenticationIdentityDetailAadAuthority",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).DataPlaneAuthenticationIdentityDetailAadAuthority, global::System.Convert.ToString); + } + if (content.Contains("ProviderVersionDetailVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).ProviderVersionDetailVersion = (string) content.GetValueForProperty("ProviderVersionDetailVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).ProviderVersionDetailVersion, global::System.Convert.ToString); + } + if (content.Contains("ProviderVersionDetailExpiryDate")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).ProviderVersionDetailExpiryDate = (global::System.DateTime?) content.GetValueForProperty("ProviderVersionDetailExpiryDate",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).ProviderVersionDetailExpiryDate, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ProviderVersionDetailStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).ProviderVersionDetailStatus = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentVersionStatus?) content.GetValueForProperty("ProviderVersionDetailStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal)this).ProviderVersionDetailStatus, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentVersionStatus.CreateFrom); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Provider details. + [System.ComponentModel.TypeConverter(typeof(RecoveryServicesProviderTypeConverter))] + public partial interface IRecoveryServicesProvider + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryServicesProvider.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryServicesProvider.TypeConverter.cs new file mode 100644 index 000000000000..3ee0a3d4100b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryServicesProvider.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class RecoveryServicesProviderTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProvider ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProvider).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return RecoveryServicesProvider.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return RecoveryServicesProvider.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return RecoveryServicesProvider.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryServicesProvider.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryServicesProvider.cs new file mode 100644 index 000000000000..acfcb7255346 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryServicesProvider.cs @@ -0,0 +1,694 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Provider details. + public partial class RecoveryServicesProvider : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProvider, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResource __resource = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.Resource(); + + /// The scenarios allowed on this provider. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string[] AllowedScenario { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)Property).AllowedScenario; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)Property).AllowedScenario = value ?? null /* arrayOf */; } + + /// The base authority for Azure Active Directory authentication. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string AuthenticationIdentityDetailAadAuthority { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)Property).AuthenticationIdentityDetailAadAuthority; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)Property).AuthenticationIdentityDetailAadAuthority = value ?? null; } + + /// + /// The application/client Id for the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string AuthenticationIdentityDetailApplicationId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)Property).AuthenticationIdentityDetailApplicationId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)Property).AuthenticationIdentityDetailApplicationId = value ?? null; } + + /// + /// The intended Audience of the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string AuthenticationIdentityDetailAudience { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)Property).AuthenticationIdentityDetailAudience; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)Property).AuthenticationIdentityDetailAudience = value ?? null; } + + /// + /// The object Id of the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string AuthenticationIdentityDetailObjectId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)Property).AuthenticationIdentityDetailObjectId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)Property).AuthenticationIdentityDetailObjectId = value ?? null; } + + /// + /// The tenant Id for the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string AuthenticationIdentityDetailTenantId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)Property).AuthenticationIdentityDetailTenantId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)Property).AuthenticationIdentityDetailTenantId = value ?? null; } + + /// The Bios Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string BiosId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)Property).BiosId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)Property).BiosId = value ?? null; } + + /// A value indicating whether DRA is responsive. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ConnectionStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)Property).ConnectionStatus; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)Property).ConnectionStatus = value ?? null; } + + /// The base authority for Azure Active Directory authentication. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string DataPlaneAuthenticationIdentityDetailAadAuthority { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)Property).DataPlaneAuthenticationIdentityDetailAadAuthority; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)Property).DataPlaneAuthenticationIdentityDetailAadAuthority = value ?? null; } + + /// + /// The application/client Id for the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string DataPlaneAuthenticationIdentityDetailApplicationId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)Property).DataPlaneAuthenticationIdentityDetailApplicationId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)Property).DataPlaneAuthenticationIdentityDetailApplicationId = value ?? null; } + + /// + /// The intended Audience of the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string DataPlaneAuthenticationIdentityDetailAudience { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)Property).DataPlaneAuthenticationIdentityDetailAudience; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)Property).DataPlaneAuthenticationIdentityDetailAudience = value ?? null; } + + /// + /// The object Id of the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string DataPlaneAuthenticationIdentityDetailObjectId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)Property).DataPlaneAuthenticationIdentityDetailObjectId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)Property).DataPlaneAuthenticationIdentityDetailObjectId = value ?? null; } + + /// + /// The tenant Id for the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string DataPlaneAuthenticationIdentityDetailTenantId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)Property).DataPlaneAuthenticationIdentityDetailTenantId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)Property).DataPlaneAuthenticationIdentityDetailTenantId = value ?? null; } + + /// The DRA Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string DraIdentifier { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)Property).DraIdentifier; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)Property).DraIdentifier = value ?? null; } + + /// The fabric friendly name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string FabricFriendlyName { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)Property).FabricFriendlyName; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)Property).FabricFriendlyName = value ?? null; } + + /// Type of the site. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string FabricType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)Property).FabricType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)Property).FabricType = value ?? null; } + + /// Friendly name of the DRA. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string FriendlyName { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)Property).FriendlyName; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)Property).FriendlyName = value ?? null; } + + /// The recovery services provider health error details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] HealthErrorDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)Property).HealthErrorDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)Property).HealthErrorDetail = value ?? null /* arrayOf */; } + + /// Resource Id + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Id; } + + /// Time when last heartbeat was sent by the DRA. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public global::System.DateTime? LastHeartBeat { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)Property).LastHeartBeat; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)Property).LastHeartBeat = value ?? default(global::System.DateTime); } + + /// Resource Location + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string Location { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Location; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Location = value ?? null; } + + /// The machine Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string MachineId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)Property).MachineId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)Property).MachineId = value ?? null; } + + /// The machine name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string MachineName { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)Property).MachineName; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)Property).MachineName = value ?? null; } + + /// Internal Acessors for AuthenticationIdentityDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetails Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal.AuthenticationIdentityDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)Property).AuthenticationIdentityDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)Property).AuthenticationIdentityDetail = value; } + + /// Internal Acessors for DataPlaneAuthenticationIdentityDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetails Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal.DataPlaneAuthenticationIdentityDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)Property).DataPlaneAuthenticationIdentityDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)Property).DataPlaneAuthenticationIdentityDetail = value; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderProperties Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryServicesProviderProperties()); set { {_property = value;} } } + + /// Internal Acessors for ProviderVersionDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVersionDetails Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal.ProviderVersionDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)Property).ProviderVersionDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)Property).ProviderVersionDetail = value; } + + /// Internal Acessors for ResourceAccessIdentityDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetails Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderInternal.ResourceAccessIdentityDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)Property).ResourceAccessIdentityDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)Property).ResourceAccessIdentityDetail = value; } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Id = value; } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Name = value; } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Type = value; } + + /// Resource Name + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Name; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderProperties _property; + + /// Provider properties. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryServicesProviderProperties()); set => this._property = value; } + + /// Number of protected VMs currently managed by the DRA. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public int? ProtectedItemCount { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)Property).ProtectedItemCount; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)Property).ProtectedItemCount = value ?? default(int); } + + /// The provider version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ProviderVersion { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)Property).ProviderVersion; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)Property).ProviderVersion = value ?? null; } + + /// Version expiry date. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public global::System.DateTime? ProviderVersionDetailExpiryDate { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)Property).ProviderVersionDetailExpiryDate; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)Property).ProviderVersionDetailExpiryDate = value ?? default(global::System.DateTime); } + + /// A value indicating whether security update required. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentVersionStatus? ProviderVersionDetailStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)Property).ProviderVersionDetailStatus; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)Property).ProviderVersionDetailStatus = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentVersionStatus)""); } + + /// The agent version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ProviderVersionDetailVersion { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)Property).ProviderVersionDetailVersion; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)Property).ProviderVersionDetailVersion = value ?? null; } + + /// Expiry date of the version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public global::System.DateTime? ProviderVersionExpiryDate { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)Property).ProviderVersionExpiryDate; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)Property).ProviderVersionExpiryDate = value ?? default(global::System.DateTime); } + + /// DRA version status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ProviderVersionState { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)Property).ProviderVersionState; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)Property).ProviderVersionState = value ?? null; } + + /// The base authority for Azure Active Directory authentication. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ResourceAccessIdentityDetailAadAuthority { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)Property).ResourceAccessIdentityDetailAadAuthority; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)Property).ResourceAccessIdentityDetailAadAuthority = value ?? null; } + + /// + /// The application/client Id for the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ResourceAccessIdentityDetailApplicationId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)Property).ResourceAccessIdentityDetailApplicationId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)Property).ResourceAccessIdentityDetailApplicationId = value ?? null; } + + /// + /// The intended Audience of the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ResourceAccessIdentityDetailAudience { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)Property).ResourceAccessIdentityDetailAudience; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)Property).ResourceAccessIdentityDetailAudience = value ?? null; } + + /// + /// The object Id of the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ResourceAccessIdentityDetailObjectId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)Property).ResourceAccessIdentityDetailObjectId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)Property).ResourceAccessIdentityDetailObjectId = value ?? null; } + + /// + /// The tenant Id for the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ResourceAccessIdentityDetailTenantId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)Property).ResourceAccessIdentityDetailTenantId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)Property).ResourceAccessIdentityDetailTenantId = value ?? null; } + + /// The fabric provider. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ServerVersion { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)Property).ServerVersion; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)Property).ServerVersion = value ?? null; } + + /// Resource Type + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Type; } + + /// Creates an new instance. + public RecoveryServicesProvider() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__resource), __resource); + await eventListener.AssertObjectIsValid(nameof(__resource), __resource); + } + } + /// Provider details. + public partial interface IRecoveryServicesProvider : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResource + { + /// The scenarios allowed on this provider. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The scenarios allowed on this provider.", + SerializedName = @"allowedScenarios", + PossibleTypes = new [] { typeof(string) })] + string[] AllowedScenario { get; set; } + /// The base authority for Azure Active Directory authentication. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The base authority for Azure Active Directory authentication.", + SerializedName = @"aadAuthority", + PossibleTypes = new [] { typeof(string) })] + string AuthenticationIdentityDetailAadAuthority { get; set; } + /// + /// The application/client Id for the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The application/client Id for the service principal with which the on-premise management/data plane components would communicate with our Azure services.", + SerializedName = @"applicationId", + PossibleTypes = new [] { typeof(string) })] + string AuthenticationIdentityDetailApplicationId { get; set; } + /// + /// The intended Audience of the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The intended Audience of the service principal with which the on-premise management/data plane components would communicate with our Azure services.", + SerializedName = @"audience", + PossibleTypes = new [] { typeof(string) })] + string AuthenticationIdentityDetailAudience { get; set; } + /// + /// The object Id of the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The object Id of the service principal with which the on-premise management/data plane components would communicate with our Azure services.", + SerializedName = @"objectId", + PossibleTypes = new [] { typeof(string) })] + string AuthenticationIdentityDetailObjectId { get; set; } + /// + /// The tenant Id for the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The tenant Id for the service principal with which the on-premise management/data plane components would communicate with our Azure services.", + SerializedName = @"tenantId", + PossibleTypes = new [] { typeof(string) })] + string AuthenticationIdentityDetailTenantId { get; set; } + /// The Bios Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Bios Id.", + SerializedName = @"biosId", + PossibleTypes = new [] { typeof(string) })] + string BiosId { get; set; } + /// A value indicating whether DRA is responsive. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether DRA is responsive.", + SerializedName = @"connectionStatus", + PossibleTypes = new [] { typeof(string) })] + string ConnectionStatus { get; set; } + /// The base authority for Azure Active Directory authentication. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The base authority for Azure Active Directory authentication.", + SerializedName = @"aadAuthority", + PossibleTypes = new [] { typeof(string) })] + string DataPlaneAuthenticationIdentityDetailAadAuthority { get; set; } + /// + /// The application/client Id for the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The application/client Id for the service principal with which the on-premise management/data plane components would communicate with our Azure services.", + SerializedName = @"applicationId", + PossibleTypes = new [] { typeof(string) })] + string DataPlaneAuthenticationIdentityDetailApplicationId { get; set; } + /// + /// The intended Audience of the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The intended Audience of the service principal with which the on-premise management/data plane components would communicate with our Azure services.", + SerializedName = @"audience", + PossibleTypes = new [] { typeof(string) })] + string DataPlaneAuthenticationIdentityDetailAudience { get; set; } + /// + /// The object Id of the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The object Id of the service principal with which the on-premise management/data plane components would communicate with our Azure services.", + SerializedName = @"objectId", + PossibleTypes = new [] { typeof(string) })] + string DataPlaneAuthenticationIdentityDetailObjectId { get; set; } + /// + /// The tenant Id for the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The tenant Id for the service principal with which the on-premise management/data plane components would communicate with our Azure services.", + SerializedName = @"tenantId", + PossibleTypes = new [] { typeof(string) })] + string DataPlaneAuthenticationIdentityDetailTenantId { get; set; } + /// The DRA Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The DRA Id.", + SerializedName = @"draIdentifier", + PossibleTypes = new [] { typeof(string) })] + string DraIdentifier { get; set; } + /// The fabric friendly name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The fabric friendly name.", + SerializedName = @"fabricFriendlyName", + PossibleTypes = new [] { typeof(string) })] + string FabricFriendlyName { get; set; } + /// Type of the site. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Type of the site.", + SerializedName = @"fabricType", + PossibleTypes = new [] { typeof(string) })] + string FabricType { get; set; } + /// Friendly name of the DRA. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Friendly name of the DRA.", + SerializedName = @"friendlyName", + PossibleTypes = new [] { typeof(string) })] + string FriendlyName { get; set; } + /// The recovery services provider health error details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery services provider health error details.", + SerializedName = @"healthErrorDetails", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] HealthErrorDetail { get; set; } + /// Time when last heartbeat was sent by the DRA. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Time when last heartbeat was sent by the DRA.", + SerializedName = @"lastHeartBeat", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? LastHeartBeat { get; set; } + /// The machine Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The machine Id.", + SerializedName = @"machineId", + PossibleTypes = new [] { typeof(string) })] + string MachineId { get; set; } + /// The machine name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The machine name.", + SerializedName = @"machineName", + PossibleTypes = new [] { typeof(string) })] + string MachineName { get; set; } + /// Number of protected VMs currently managed by the DRA. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Number of protected VMs currently managed by the DRA.", + SerializedName = @"protectedItemCount", + PossibleTypes = new [] { typeof(int) })] + int? ProtectedItemCount { get; set; } + /// The provider version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The provider version.", + SerializedName = @"providerVersion", + PossibleTypes = new [] { typeof(string) })] + string ProviderVersion { get; set; } + /// Version expiry date. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Version expiry date.", + SerializedName = @"expiryDate", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? ProviderVersionDetailExpiryDate { get; set; } + /// A value indicating whether security update required. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether security update required.", + SerializedName = @"status", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentVersionStatus) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentVersionStatus? ProviderVersionDetailStatus { get; set; } + /// The agent version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The agent version.", + SerializedName = @"version", + PossibleTypes = new [] { typeof(string) })] + string ProviderVersionDetailVersion { get; set; } + /// Expiry date of the version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Expiry date of the version.", + SerializedName = @"providerVersionExpiryDate", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? ProviderVersionExpiryDate { get; set; } + /// DRA version status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"DRA version status.", + SerializedName = @"providerVersionState", + PossibleTypes = new [] { typeof(string) })] + string ProviderVersionState { get; set; } + /// The base authority for Azure Active Directory authentication. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The base authority for Azure Active Directory authentication.", + SerializedName = @"aadAuthority", + PossibleTypes = new [] { typeof(string) })] + string ResourceAccessIdentityDetailAadAuthority { get; set; } + /// + /// The application/client Id for the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The application/client Id for the service principal with which the on-premise management/data plane components would communicate with our Azure services.", + SerializedName = @"applicationId", + PossibleTypes = new [] { typeof(string) })] + string ResourceAccessIdentityDetailApplicationId { get; set; } + /// + /// The intended Audience of the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The intended Audience of the service principal with which the on-premise management/data plane components would communicate with our Azure services.", + SerializedName = @"audience", + PossibleTypes = new [] { typeof(string) })] + string ResourceAccessIdentityDetailAudience { get; set; } + /// + /// The object Id of the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The object Id of the service principal with which the on-premise management/data plane components would communicate with our Azure services.", + SerializedName = @"objectId", + PossibleTypes = new [] { typeof(string) })] + string ResourceAccessIdentityDetailObjectId { get; set; } + /// + /// The tenant Id for the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The tenant Id for the service principal with which the on-premise management/data plane components would communicate with our Azure services.", + SerializedName = @"tenantId", + PossibleTypes = new [] { typeof(string) })] + string ResourceAccessIdentityDetailTenantId { get; set; } + /// The fabric provider. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The fabric provider.", + SerializedName = @"serverVersion", + PossibleTypes = new [] { typeof(string) })] + string ServerVersion { get; set; } + + } + /// Provider details. + internal partial interface IRecoveryServicesProviderInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal + { + /// The scenarios allowed on this provider. + string[] AllowedScenario { get; set; } + /// The authentication identity details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetails AuthenticationIdentityDetail { get; set; } + /// The base authority for Azure Active Directory authentication. + string AuthenticationIdentityDetailAadAuthority { get; set; } + /// + /// The application/client Id for the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + string AuthenticationIdentityDetailApplicationId { get; set; } + /// + /// The intended Audience of the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + string AuthenticationIdentityDetailAudience { get; set; } + /// + /// The object Id of the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + string AuthenticationIdentityDetailObjectId { get; set; } + /// + /// The tenant Id for the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + string AuthenticationIdentityDetailTenantId { get; set; } + /// The Bios Id. + string BiosId { get; set; } + /// A value indicating whether DRA is responsive. + string ConnectionStatus { get; set; } + /// The data plane authentication identity details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetails DataPlaneAuthenticationIdentityDetail { get; set; } + /// The base authority for Azure Active Directory authentication. + string DataPlaneAuthenticationIdentityDetailAadAuthority { get; set; } + /// + /// The application/client Id for the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + string DataPlaneAuthenticationIdentityDetailApplicationId { get; set; } + /// + /// The intended Audience of the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + string DataPlaneAuthenticationIdentityDetailAudience { get; set; } + /// + /// The object Id of the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + string DataPlaneAuthenticationIdentityDetailObjectId { get; set; } + /// + /// The tenant Id for the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + string DataPlaneAuthenticationIdentityDetailTenantId { get; set; } + /// The DRA Id. + string DraIdentifier { get; set; } + /// The fabric friendly name. + string FabricFriendlyName { get; set; } + /// Type of the site. + string FabricType { get; set; } + /// Friendly name of the DRA. + string FriendlyName { get; set; } + /// The recovery services provider health error details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] HealthErrorDetail { get; set; } + /// Time when last heartbeat was sent by the DRA. + global::System.DateTime? LastHeartBeat { get; set; } + /// The machine Id. + string MachineId { get; set; } + /// The machine name. + string MachineName { get; set; } + /// Provider properties. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderProperties Property { get; set; } + /// Number of protected VMs currently managed by the DRA. + int? ProtectedItemCount { get; set; } + /// The provider version. + string ProviderVersion { get; set; } + /// The provider version details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVersionDetails ProviderVersionDetail { get; set; } + /// Version expiry date. + global::System.DateTime? ProviderVersionDetailExpiryDate { get; set; } + /// A value indicating whether security update required. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentVersionStatus? ProviderVersionDetailStatus { get; set; } + /// The agent version. + string ProviderVersionDetailVersion { get; set; } + /// Expiry date of the version. + global::System.DateTime? ProviderVersionExpiryDate { get; set; } + /// DRA version status. + string ProviderVersionState { get; set; } + /// The resource access identity details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetails ResourceAccessIdentityDetail { get; set; } + /// The base authority for Azure Active Directory authentication. + string ResourceAccessIdentityDetailAadAuthority { get; set; } + /// + /// The application/client Id for the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + string ResourceAccessIdentityDetailApplicationId { get; set; } + /// + /// The intended Audience of the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + string ResourceAccessIdentityDetailAudience { get; set; } + /// + /// The object Id of the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + string ResourceAccessIdentityDetailObjectId { get; set; } + /// + /// The tenant Id for the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + string ResourceAccessIdentityDetailTenantId { get; set; } + /// The fabric provider. + string ServerVersion { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryServicesProvider.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryServicesProvider.json.cs new file mode 100644 index 000000000000..48cd5a195992 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryServicesProvider.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Provider details. + public partial class RecoveryServicesProvider + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProvider. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProvider. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProvider FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new RecoveryServicesProvider(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal RecoveryServicesProvider(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __resource = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.Resource(json); + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryServicesProviderProperties.FromJson(__jsonProperties) : Property;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __resource?.ToJson(container, serializationMode); + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryServicesProviderCollection.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryServicesProviderCollection.PowerShell.cs new file mode 100644 index 000000000000..b88e9b0cab9a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryServicesProviderCollection.PowerShell.cs @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Collection of providers. + [System.ComponentModel.TypeConverter(typeof(RecoveryServicesProviderCollectionTypeConverter))] + public partial class RecoveryServicesProviderCollection + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderCollection DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new RecoveryServicesProviderCollection(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderCollection DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new RecoveryServicesProviderCollection(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderCollection FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal RecoveryServicesProviderCollection(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProvider[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryServicesProviderTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderCollectionInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderCollectionInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal RecoveryServicesProviderCollection(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProvider[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryServicesProviderTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderCollectionInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderCollectionInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Collection of providers. + [System.ComponentModel.TypeConverter(typeof(RecoveryServicesProviderCollectionTypeConverter))] + public partial interface IRecoveryServicesProviderCollection + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryServicesProviderCollection.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryServicesProviderCollection.TypeConverter.cs new file mode 100644 index 000000000000..f0652e9315b0 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryServicesProviderCollection.TypeConverter.cs @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class RecoveryServicesProviderCollectionTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderCollection ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderCollection).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return RecoveryServicesProviderCollection.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return RecoveryServicesProviderCollection.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return RecoveryServicesProviderCollection.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryServicesProviderCollection.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryServicesProviderCollection.cs new file mode 100644 index 000000000000..4f26bc447574 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryServicesProviderCollection.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Collection of providers. + public partial class RecoveryServicesProviderCollection : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderCollection, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderCollectionInternal + { + + /// Backing field for property. + private string _nextLink; + + /// The value of next link. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string NextLink { get => this._nextLink; set => this._nextLink = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProvider[] _value; + + /// The Servers details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProvider[] Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public RecoveryServicesProviderCollection() + { + + } + } + /// Collection of providers. + public partial interface IRecoveryServicesProviderCollection : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The value of next link. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The value of next link.", + SerializedName = @"nextLink", + PossibleTypes = new [] { typeof(string) })] + string NextLink { get; set; } + /// The Servers details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Servers details.", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProvider) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProvider[] Value { get; set; } + + } + /// Collection of providers. + internal partial interface IRecoveryServicesProviderCollectionInternal + + { + /// The value of next link. + string NextLink { get; set; } + /// The Servers details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProvider[] Value { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryServicesProviderCollection.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryServicesProviderCollection.json.cs new file mode 100644 index 000000000000..07800f4ef08a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryServicesProviderCollection.json.cs @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Collection of providers. + public partial class RecoveryServicesProviderCollection + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderCollection. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderCollection. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderCollection FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new RecoveryServicesProviderCollection(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal RecoveryServicesProviderCollection(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProvider) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryServicesProvider.FromJson(__u) )) ))() : null : Value;} + {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)NextLink;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._value) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._value ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("value",__w); + } + AddIf( null != (((object)this._nextLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryServicesProviderProperties.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryServicesProviderProperties.PowerShell.cs new file mode 100644 index 000000000000..9a881650164f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryServicesProviderProperties.PowerShell.cs @@ -0,0 +1,444 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Recovery services provider properties. + [System.ComponentModel.TypeConverter(typeof(RecoveryServicesProviderPropertiesTypeConverter))] + public partial class RecoveryServicesProviderProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new RecoveryServicesProviderProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new RecoveryServicesProviderProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal RecoveryServicesProviderProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("AuthenticationIdentityDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).AuthenticationIdentityDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetails) content.GetValueForProperty("AuthenticationIdentityDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).AuthenticationIdentityDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IdentityProviderDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("ResourceAccessIdentityDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).ResourceAccessIdentityDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetails) content.GetValueForProperty("ResourceAccessIdentityDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).ResourceAccessIdentityDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IdentityProviderDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("DataPlaneAuthenticationIdentityDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).DataPlaneAuthenticationIdentityDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetails) content.GetValueForProperty("DataPlaneAuthenticationIdentityDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).DataPlaneAuthenticationIdentityDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IdentityProviderDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderVersionDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).ProviderVersionDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVersionDetails) content.GetValueForProperty("ProviderVersionDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).ProviderVersionDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VersionDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("FabricType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).FabricType = (string) content.GetValueForProperty("FabricType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).FabricType, global::System.Convert.ToString); + } + if (content.Contains("FriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).FriendlyName = (string) content.GetValueForProperty("FriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).FriendlyName, global::System.Convert.ToString); + } + if (content.Contains("ProviderVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).ProviderVersion = (string) content.GetValueForProperty("ProviderVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).ProviderVersion, global::System.Convert.ToString); + } + if (content.Contains("ServerVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).ServerVersion = (string) content.GetValueForProperty("ServerVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).ServerVersion, global::System.Convert.ToString); + } + if (content.Contains("ProviderVersionState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).ProviderVersionState = (string) content.GetValueForProperty("ProviderVersionState",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).ProviderVersionState, global::System.Convert.ToString); + } + if (content.Contains("ProviderVersionExpiryDate")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).ProviderVersionExpiryDate = (global::System.DateTime?) content.GetValueForProperty("ProviderVersionExpiryDate",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).ProviderVersionExpiryDate, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("FabricFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).FabricFriendlyName = (string) content.GetValueForProperty("FabricFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).FabricFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("LastHeartBeat")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).LastHeartBeat = (global::System.DateTime?) content.GetValueForProperty("LastHeartBeat",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).LastHeartBeat, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ConnectionStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).ConnectionStatus = (string) content.GetValueForProperty("ConnectionStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).ConnectionStatus, global::System.Convert.ToString); + } + if (content.Contains("ProtectedItemCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).ProtectedItemCount = (int?) content.GetValueForProperty("ProtectedItemCount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).ProtectedItemCount, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("AllowedScenario")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).AllowedScenario = (string[]) content.GetValueForProperty("AllowedScenario",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).AllowedScenario, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("HealthErrorDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).HealthErrorDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[]) content.GetValueForProperty("HealthErrorDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).HealthErrorDetail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("DraIdentifier")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).DraIdentifier = (string) content.GetValueForProperty("DraIdentifier",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).DraIdentifier, global::System.Convert.ToString); + } + if (content.Contains("MachineId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).MachineId = (string) content.GetValueForProperty("MachineId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).MachineId, global::System.Convert.ToString); + } + if (content.Contains("MachineName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).MachineName = (string) content.GetValueForProperty("MachineName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).MachineName, global::System.Convert.ToString); + } + if (content.Contains("BiosId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).BiosId = (string) content.GetValueForProperty("BiosId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).BiosId, global::System.Convert.ToString); + } + if (content.Contains("AuthenticationIdentityDetailTenantId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).AuthenticationIdentityDetailTenantId = (string) content.GetValueForProperty("AuthenticationIdentityDetailTenantId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).AuthenticationIdentityDetailTenantId, global::System.Convert.ToString); + } + if (content.Contains("AuthenticationIdentityDetailApplicationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).AuthenticationIdentityDetailApplicationId = (string) content.GetValueForProperty("AuthenticationIdentityDetailApplicationId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).AuthenticationIdentityDetailApplicationId, global::System.Convert.ToString); + } + if (content.Contains("AuthenticationIdentityDetailObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).AuthenticationIdentityDetailObjectId = (string) content.GetValueForProperty("AuthenticationIdentityDetailObjectId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).AuthenticationIdentityDetailObjectId, global::System.Convert.ToString); + } + if (content.Contains("AuthenticationIdentityDetailAudience")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).AuthenticationIdentityDetailAudience = (string) content.GetValueForProperty("AuthenticationIdentityDetailAudience",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).AuthenticationIdentityDetailAudience, global::System.Convert.ToString); + } + if (content.Contains("AuthenticationIdentityDetailAadAuthority")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).AuthenticationIdentityDetailAadAuthority = (string) content.GetValueForProperty("AuthenticationIdentityDetailAadAuthority",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).AuthenticationIdentityDetailAadAuthority, global::System.Convert.ToString); + } + if (content.Contains("ResourceAccessIdentityDetailTenantId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).ResourceAccessIdentityDetailTenantId = (string) content.GetValueForProperty("ResourceAccessIdentityDetailTenantId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).ResourceAccessIdentityDetailTenantId, global::System.Convert.ToString); + } + if (content.Contains("ResourceAccessIdentityDetailApplicationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).ResourceAccessIdentityDetailApplicationId = (string) content.GetValueForProperty("ResourceAccessIdentityDetailApplicationId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).ResourceAccessIdentityDetailApplicationId, global::System.Convert.ToString); + } + if (content.Contains("ResourceAccessIdentityDetailObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).ResourceAccessIdentityDetailObjectId = (string) content.GetValueForProperty("ResourceAccessIdentityDetailObjectId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).ResourceAccessIdentityDetailObjectId, global::System.Convert.ToString); + } + if (content.Contains("ResourceAccessIdentityDetailAudience")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).ResourceAccessIdentityDetailAudience = (string) content.GetValueForProperty("ResourceAccessIdentityDetailAudience",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).ResourceAccessIdentityDetailAudience, global::System.Convert.ToString); + } + if (content.Contains("ResourceAccessIdentityDetailAadAuthority")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).ResourceAccessIdentityDetailAadAuthority = (string) content.GetValueForProperty("ResourceAccessIdentityDetailAadAuthority",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).ResourceAccessIdentityDetailAadAuthority, global::System.Convert.ToString); + } + if (content.Contains("DataPlaneAuthenticationIdentityDetailTenantId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).DataPlaneAuthenticationIdentityDetailTenantId = (string) content.GetValueForProperty("DataPlaneAuthenticationIdentityDetailTenantId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).DataPlaneAuthenticationIdentityDetailTenantId, global::System.Convert.ToString); + } + if (content.Contains("DataPlaneAuthenticationIdentityDetailApplicationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).DataPlaneAuthenticationIdentityDetailApplicationId = (string) content.GetValueForProperty("DataPlaneAuthenticationIdentityDetailApplicationId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).DataPlaneAuthenticationIdentityDetailApplicationId, global::System.Convert.ToString); + } + if (content.Contains("DataPlaneAuthenticationIdentityDetailObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).DataPlaneAuthenticationIdentityDetailObjectId = (string) content.GetValueForProperty("DataPlaneAuthenticationIdentityDetailObjectId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).DataPlaneAuthenticationIdentityDetailObjectId, global::System.Convert.ToString); + } + if (content.Contains("DataPlaneAuthenticationIdentityDetailAudience")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).DataPlaneAuthenticationIdentityDetailAudience = (string) content.GetValueForProperty("DataPlaneAuthenticationIdentityDetailAudience",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).DataPlaneAuthenticationIdentityDetailAudience, global::System.Convert.ToString); + } + if (content.Contains("DataPlaneAuthenticationIdentityDetailAadAuthority")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).DataPlaneAuthenticationIdentityDetailAadAuthority = (string) content.GetValueForProperty("DataPlaneAuthenticationIdentityDetailAadAuthority",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).DataPlaneAuthenticationIdentityDetailAadAuthority, global::System.Convert.ToString); + } + if (content.Contains("ProviderVersionDetailVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).ProviderVersionDetailVersion = (string) content.GetValueForProperty("ProviderVersionDetailVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).ProviderVersionDetailVersion, global::System.Convert.ToString); + } + if (content.Contains("ProviderVersionDetailExpiryDate")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).ProviderVersionDetailExpiryDate = (global::System.DateTime?) content.GetValueForProperty("ProviderVersionDetailExpiryDate",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).ProviderVersionDetailExpiryDate, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ProviderVersionDetailStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).ProviderVersionDetailStatus = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentVersionStatus?) content.GetValueForProperty("ProviderVersionDetailStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).ProviderVersionDetailStatus, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentVersionStatus.CreateFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal RecoveryServicesProviderProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("AuthenticationIdentityDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).AuthenticationIdentityDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetails) content.GetValueForProperty("AuthenticationIdentityDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).AuthenticationIdentityDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IdentityProviderDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("ResourceAccessIdentityDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).ResourceAccessIdentityDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetails) content.GetValueForProperty("ResourceAccessIdentityDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).ResourceAccessIdentityDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IdentityProviderDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("DataPlaneAuthenticationIdentityDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).DataPlaneAuthenticationIdentityDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetails) content.GetValueForProperty("DataPlaneAuthenticationIdentityDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).DataPlaneAuthenticationIdentityDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IdentityProviderDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderVersionDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).ProviderVersionDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVersionDetails) content.GetValueForProperty("ProviderVersionDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).ProviderVersionDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VersionDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("FabricType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).FabricType = (string) content.GetValueForProperty("FabricType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).FabricType, global::System.Convert.ToString); + } + if (content.Contains("FriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).FriendlyName = (string) content.GetValueForProperty("FriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).FriendlyName, global::System.Convert.ToString); + } + if (content.Contains("ProviderVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).ProviderVersion = (string) content.GetValueForProperty("ProviderVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).ProviderVersion, global::System.Convert.ToString); + } + if (content.Contains("ServerVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).ServerVersion = (string) content.GetValueForProperty("ServerVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).ServerVersion, global::System.Convert.ToString); + } + if (content.Contains("ProviderVersionState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).ProviderVersionState = (string) content.GetValueForProperty("ProviderVersionState",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).ProviderVersionState, global::System.Convert.ToString); + } + if (content.Contains("ProviderVersionExpiryDate")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).ProviderVersionExpiryDate = (global::System.DateTime?) content.GetValueForProperty("ProviderVersionExpiryDate",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).ProviderVersionExpiryDate, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("FabricFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).FabricFriendlyName = (string) content.GetValueForProperty("FabricFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).FabricFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("LastHeartBeat")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).LastHeartBeat = (global::System.DateTime?) content.GetValueForProperty("LastHeartBeat",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).LastHeartBeat, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ConnectionStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).ConnectionStatus = (string) content.GetValueForProperty("ConnectionStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).ConnectionStatus, global::System.Convert.ToString); + } + if (content.Contains("ProtectedItemCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).ProtectedItemCount = (int?) content.GetValueForProperty("ProtectedItemCount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).ProtectedItemCount, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("AllowedScenario")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).AllowedScenario = (string[]) content.GetValueForProperty("AllowedScenario",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).AllowedScenario, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("HealthErrorDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).HealthErrorDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[]) content.GetValueForProperty("HealthErrorDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).HealthErrorDetail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("DraIdentifier")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).DraIdentifier = (string) content.GetValueForProperty("DraIdentifier",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).DraIdentifier, global::System.Convert.ToString); + } + if (content.Contains("MachineId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).MachineId = (string) content.GetValueForProperty("MachineId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).MachineId, global::System.Convert.ToString); + } + if (content.Contains("MachineName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).MachineName = (string) content.GetValueForProperty("MachineName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).MachineName, global::System.Convert.ToString); + } + if (content.Contains("BiosId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).BiosId = (string) content.GetValueForProperty("BiosId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).BiosId, global::System.Convert.ToString); + } + if (content.Contains("AuthenticationIdentityDetailTenantId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).AuthenticationIdentityDetailTenantId = (string) content.GetValueForProperty("AuthenticationIdentityDetailTenantId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).AuthenticationIdentityDetailTenantId, global::System.Convert.ToString); + } + if (content.Contains("AuthenticationIdentityDetailApplicationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).AuthenticationIdentityDetailApplicationId = (string) content.GetValueForProperty("AuthenticationIdentityDetailApplicationId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).AuthenticationIdentityDetailApplicationId, global::System.Convert.ToString); + } + if (content.Contains("AuthenticationIdentityDetailObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).AuthenticationIdentityDetailObjectId = (string) content.GetValueForProperty("AuthenticationIdentityDetailObjectId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).AuthenticationIdentityDetailObjectId, global::System.Convert.ToString); + } + if (content.Contains("AuthenticationIdentityDetailAudience")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).AuthenticationIdentityDetailAudience = (string) content.GetValueForProperty("AuthenticationIdentityDetailAudience",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).AuthenticationIdentityDetailAudience, global::System.Convert.ToString); + } + if (content.Contains("AuthenticationIdentityDetailAadAuthority")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).AuthenticationIdentityDetailAadAuthority = (string) content.GetValueForProperty("AuthenticationIdentityDetailAadAuthority",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).AuthenticationIdentityDetailAadAuthority, global::System.Convert.ToString); + } + if (content.Contains("ResourceAccessIdentityDetailTenantId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).ResourceAccessIdentityDetailTenantId = (string) content.GetValueForProperty("ResourceAccessIdentityDetailTenantId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).ResourceAccessIdentityDetailTenantId, global::System.Convert.ToString); + } + if (content.Contains("ResourceAccessIdentityDetailApplicationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).ResourceAccessIdentityDetailApplicationId = (string) content.GetValueForProperty("ResourceAccessIdentityDetailApplicationId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).ResourceAccessIdentityDetailApplicationId, global::System.Convert.ToString); + } + if (content.Contains("ResourceAccessIdentityDetailObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).ResourceAccessIdentityDetailObjectId = (string) content.GetValueForProperty("ResourceAccessIdentityDetailObjectId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).ResourceAccessIdentityDetailObjectId, global::System.Convert.ToString); + } + if (content.Contains("ResourceAccessIdentityDetailAudience")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).ResourceAccessIdentityDetailAudience = (string) content.GetValueForProperty("ResourceAccessIdentityDetailAudience",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).ResourceAccessIdentityDetailAudience, global::System.Convert.ToString); + } + if (content.Contains("ResourceAccessIdentityDetailAadAuthority")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).ResourceAccessIdentityDetailAadAuthority = (string) content.GetValueForProperty("ResourceAccessIdentityDetailAadAuthority",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).ResourceAccessIdentityDetailAadAuthority, global::System.Convert.ToString); + } + if (content.Contains("DataPlaneAuthenticationIdentityDetailTenantId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).DataPlaneAuthenticationIdentityDetailTenantId = (string) content.GetValueForProperty("DataPlaneAuthenticationIdentityDetailTenantId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).DataPlaneAuthenticationIdentityDetailTenantId, global::System.Convert.ToString); + } + if (content.Contains("DataPlaneAuthenticationIdentityDetailApplicationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).DataPlaneAuthenticationIdentityDetailApplicationId = (string) content.GetValueForProperty("DataPlaneAuthenticationIdentityDetailApplicationId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).DataPlaneAuthenticationIdentityDetailApplicationId, global::System.Convert.ToString); + } + if (content.Contains("DataPlaneAuthenticationIdentityDetailObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).DataPlaneAuthenticationIdentityDetailObjectId = (string) content.GetValueForProperty("DataPlaneAuthenticationIdentityDetailObjectId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).DataPlaneAuthenticationIdentityDetailObjectId, global::System.Convert.ToString); + } + if (content.Contains("DataPlaneAuthenticationIdentityDetailAudience")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).DataPlaneAuthenticationIdentityDetailAudience = (string) content.GetValueForProperty("DataPlaneAuthenticationIdentityDetailAudience",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).DataPlaneAuthenticationIdentityDetailAudience, global::System.Convert.ToString); + } + if (content.Contains("DataPlaneAuthenticationIdentityDetailAadAuthority")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).DataPlaneAuthenticationIdentityDetailAadAuthority = (string) content.GetValueForProperty("DataPlaneAuthenticationIdentityDetailAadAuthority",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).DataPlaneAuthenticationIdentityDetailAadAuthority, global::System.Convert.ToString); + } + if (content.Contains("ProviderVersionDetailVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).ProviderVersionDetailVersion = (string) content.GetValueForProperty("ProviderVersionDetailVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).ProviderVersionDetailVersion, global::System.Convert.ToString); + } + if (content.Contains("ProviderVersionDetailExpiryDate")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).ProviderVersionDetailExpiryDate = (global::System.DateTime?) content.GetValueForProperty("ProviderVersionDetailExpiryDate",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).ProviderVersionDetailExpiryDate, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ProviderVersionDetailStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).ProviderVersionDetailStatus = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentVersionStatus?) content.GetValueForProperty("ProviderVersionDetailStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal)this).ProviderVersionDetailStatus, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentVersionStatus.CreateFrom); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Recovery services provider properties. + [System.ComponentModel.TypeConverter(typeof(RecoveryServicesProviderPropertiesTypeConverter))] + public partial interface IRecoveryServicesProviderProperties + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryServicesProviderProperties.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryServicesProviderProperties.TypeConverter.cs new file mode 100644 index 000000000000..25246098e492 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryServicesProviderProperties.TypeConverter.cs @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class RecoveryServicesProviderPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return RecoveryServicesProviderProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return RecoveryServicesProviderProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return RecoveryServicesProviderProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryServicesProviderProperties.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryServicesProviderProperties.cs new file mode 100644 index 000000000000..e33dab0df6ac --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryServicesProviderProperties.cs @@ -0,0 +1,716 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Recovery services provider properties. + public partial class RecoveryServicesProviderProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderProperties, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal + { + + /// Backing field for property. + private string[] _allowedScenario; + + /// The scenarios allowed on this provider. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string[] AllowedScenario { get => this._allowedScenario; set => this._allowedScenario = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetails _authenticationIdentityDetail; + + /// The authentication identity details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetails AuthenticationIdentityDetail { get => (this._authenticationIdentityDetail = this._authenticationIdentityDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IdentityProviderDetails()); set => this._authenticationIdentityDetail = value; } + + /// The base authority for Azure Active Directory authentication. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string AuthenticationIdentityDetailAadAuthority { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetailsInternal)AuthenticationIdentityDetail).AadAuthority; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetailsInternal)AuthenticationIdentityDetail).AadAuthority = value ?? null; } + + /// + /// The application/client Id for the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string AuthenticationIdentityDetailApplicationId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetailsInternal)AuthenticationIdentityDetail).ApplicationId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetailsInternal)AuthenticationIdentityDetail).ApplicationId = value ?? null; } + + /// + /// The intended Audience of the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string AuthenticationIdentityDetailAudience { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetailsInternal)AuthenticationIdentityDetail).Audience; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetailsInternal)AuthenticationIdentityDetail).Audience = value ?? null; } + + /// + /// The object Id of the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string AuthenticationIdentityDetailObjectId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetailsInternal)AuthenticationIdentityDetail).ObjectId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetailsInternal)AuthenticationIdentityDetail).ObjectId = value ?? null; } + + /// + /// The tenant Id for the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string AuthenticationIdentityDetailTenantId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetailsInternal)AuthenticationIdentityDetail).TenantId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetailsInternal)AuthenticationIdentityDetail).TenantId = value ?? null; } + + /// Backing field for property. + private string _biosId; + + /// The Bios Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string BiosId { get => this._biosId; set => this._biosId = value; } + + /// Backing field for property. + private string _connectionStatus; + + /// A value indicating whether DRA is responsive. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ConnectionStatus { get => this._connectionStatus; set => this._connectionStatus = value; } + + /// + /// Backing field for property. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetails _dataPlaneAuthenticationIdentityDetail; + + /// The data plane authentication identity details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetails DataPlaneAuthenticationIdentityDetail { get => (this._dataPlaneAuthenticationIdentityDetail = this._dataPlaneAuthenticationIdentityDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IdentityProviderDetails()); set => this._dataPlaneAuthenticationIdentityDetail = value; } + + /// The base authority for Azure Active Directory authentication. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string DataPlaneAuthenticationIdentityDetailAadAuthority { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetailsInternal)DataPlaneAuthenticationIdentityDetail).AadAuthority; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetailsInternal)DataPlaneAuthenticationIdentityDetail).AadAuthority = value ?? null; } + + /// + /// The application/client Id for the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string DataPlaneAuthenticationIdentityDetailApplicationId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetailsInternal)DataPlaneAuthenticationIdentityDetail).ApplicationId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetailsInternal)DataPlaneAuthenticationIdentityDetail).ApplicationId = value ?? null; } + + /// + /// The intended Audience of the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string DataPlaneAuthenticationIdentityDetailAudience { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetailsInternal)DataPlaneAuthenticationIdentityDetail).Audience; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetailsInternal)DataPlaneAuthenticationIdentityDetail).Audience = value ?? null; } + + /// + /// The object Id of the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string DataPlaneAuthenticationIdentityDetailObjectId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetailsInternal)DataPlaneAuthenticationIdentityDetail).ObjectId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetailsInternal)DataPlaneAuthenticationIdentityDetail).ObjectId = value ?? null; } + + /// + /// The tenant Id for the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string DataPlaneAuthenticationIdentityDetailTenantId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetailsInternal)DataPlaneAuthenticationIdentityDetail).TenantId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetailsInternal)DataPlaneAuthenticationIdentityDetail).TenantId = value ?? null; } + + /// Backing field for property. + private string _draIdentifier; + + /// The DRA Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string DraIdentifier { get => this._draIdentifier; set => this._draIdentifier = value; } + + /// Backing field for property. + private string _fabricFriendlyName; + + /// The fabric friendly name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string FabricFriendlyName { get => this._fabricFriendlyName; set => this._fabricFriendlyName = value; } + + /// Backing field for property. + private string _fabricType; + + /// Type of the site. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string FabricType { get => this._fabricType; set => this._fabricType = value; } + + /// Backing field for property. + private string _friendlyName; + + /// Friendly name of the DRA. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string FriendlyName { get => this._friendlyName; set => this._friendlyName = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] _healthErrorDetail; + + /// The recovery services provider health error details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] HealthErrorDetail { get => this._healthErrorDetail; set => this._healthErrorDetail = value; } + + /// Backing field for property. + private global::System.DateTime? _lastHeartBeat; + + /// Time when last heartbeat was sent by the DRA. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public global::System.DateTime? LastHeartBeat { get => this._lastHeartBeat; set => this._lastHeartBeat = value; } + + /// Backing field for property. + private string _machineId; + + /// The machine Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string MachineId { get => this._machineId; set => this._machineId = value; } + + /// Backing field for property. + private string _machineName; + + /// The machine name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string MachineName { get => this._machineName; set => this._machineName = value; } + + /// Internal Acessors for AuthenticationIdentityDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetails Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal.AuthenticationIdentityDetail { get => (this._authenticationIdentityDetail = this._authenticationIdentityDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IdentityProviderDetails()); set { {_authenticationIdentityDetail = value;} } } + + /// Internal Acessors for DataPlaneAuthenticationIdentityDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetails Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal.DataPlaneAuthenticationIdentityDetail { get => (this._dataPlaneAuthenticationIdentityDetail = this._dataPlaneAuthenticationIdentityDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IdentityProviderDetails()); set { {_dataPlaneAuthenticationIdentityDetail = value;} } } + + /// Internal Acessors for ProviderVersionDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVersionDetails Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal.ProviderVersionDetail { get => (this._providerVersionDetail = this._providerVersionDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VersionDetails()); set { {_providerVersionDetail = value;} } } + + /// Internal Acessors for ResourceAccessIdentityDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetails Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderPropertiesInternal.ResourceAccessIdentityDetail { get => (this._resourceAccessIdentityDetail = this._resourceAccessIdentityDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IdentityProviderDetails()); set { {_resourceAccessIdentityDetail = value;} } } + + /// Backing field for property. + private int? _protectedItemCount; + + /// Number of protected VMs currently managed by the DRA. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? ProtectedItemCount { get => this._protectedItemCount; set => this._protectedItemCount = value; } + + /// Backing field for property. + private string _providerVersion; + + /// The provider version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ProviderVersion { get => this._providerVersion; set => this._providerVersion = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVersionDetails _providerVersionDetail; + + /// The provider version details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVersionDetails ProviderVersionDetail { get => (this._providerVersionDetail = this._providerVersionDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VersionDetails()); set => this._providerVersionDetail = value; } + + /// Version expiry date. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public global::System.DateTime? ProviderVersionDetailExpiryDate { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVersionDetailsInternal)ProviderVersionDetail).ExpiryDate; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVersionDetailsInternal)ProviderVersionDetail).ExpiryDate = value ?? default(global::System.DateTime); } + + /// A value indicating whether security update required. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentVersionStatus? ProviderVersionDetailStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVersionDetailsInternal)ProviderVersionDetail).Status; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVersionDetailsInternal)ProviderVersionDetail).Status = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentVersionStatus)""); } + + /// The agent version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ProviderVersionDetailVersion { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVersionDetailsInternal)ProviderVersionDetail).Version; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVersionDetailsInternal)ProviderVersionDetail).Version = value ?? null; } + + /// Backing field for property. + private global::System.DateTime? _providerVersionExpiryDate; + + /// Expiry date of the version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public global::System.DateTime? ProviderVersionExpiryDate { get => this._providerVersionExpiryDate; set => this._providerVersionExpiryDate = value; } + + /// Backing field for property. + private string _providerVersionState; + + /// DRA version status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ProviderVersionState { get => this._providerVersionState; set => this._providerVersionState = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetails _resourceAccessIdentityDetail; + + /// The resource access identity details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetails ResourceAccessIdentityDetail { get => (this._resourceAccessIdentityDetail = this._resourceAccessIdentityDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IdentityProviderDetails()); set => this._resourceAccessIdentityDetail = value; } + + /// The base authority for Azure Active Directory authentication. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ResourceAccessIdentityDetailAadAuthority { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetailsInternal)ResourceAccessIdentityDetail).AadAuthority; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetailsInternal)ResourceAccessIdentityDetail).AadAuthority = value ?? null; } + + /// + /// The application/client Id for the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ResourceAccessIdentityDetailApplicationId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetailsInternal)ResourceAccessIdentityDetail).ApplicationId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetailsInternal)ResourceAccessIdentityDetail).ApplicationId = value ?? null; } + + /// + /// The intended Audience of the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ResourceAccessIdentityDetailAudience { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetailsInternal)ResourceAccessIdentityDetail).Audience; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetailsInternal)ResourceAccessIdentityDetail).Audience = value ?? null; } + + /// + /// The object Id of the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ResourceAccessIdentityDetailObjectId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetailsInternal)ResourceAccessIdentityDetail).ObjectId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetailsInternal)ResourceAccessIdentityDetail).ObjectId = value ?? null; } + + /// + /// The tenant Id for the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ResourceAccessIdentityDetailTenantId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetailsInternal)ResourceAccessIdentityDetail).TenantId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetailsInternal)ResourceAccessIdentityDetail).TenantId = value ?? null; } + + /// Backing field for property. + private string _serverVersion; + + /// The fabric provider. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ServerVersion { get => this._serverVersion; set => this._serverVersion = value; } + + /// Creates an new instance. + public RecoveryServicesProviderProperties() + { + + } + } + /// Recovery services provider properties. + public partial interface IRecoveryServicesProviderProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The scenarios allowed on this provider. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The scenarios allowed on this provider.", + SerializedName = @"allowedScenarios", + PossibleTypes = new [] { typeof(string) })] + string[] AllowedScenario { get; set; } + /// The base authority for Azure Active Directory authentication. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The base authority for Azure Active Directory authentication.", + SerializedName = @"aadAuthority", + PossibleTypes = new [] { typeof(string) })] + string AuthenticationIdentityDetailAadAuthority { get; set; } + /// + /// The application/client Id for the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The application/client Id for the service principal with which the on-premise management/data plane components would communicate with our Azure services.", + SerializedName = @"applicationId", + PossibleTypes = new [] { typeof(string) })] + string AuthenticationIdentityDetailApplicationId { get; set; } + /// + /// The intended Audience of the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The intended Audience of the service principal with which the on-premise management/data plane components would communicate with our Azure services.", + SerializedName = @"audience", + PossibleTypes = new [] { typeof(string) })] + string AuthenticationIdentityDetailAudience { get; set; } + /// + /// The object Id of the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The object Id of the service principal with which the on-premise management/data plane components would communicate with our Azure services.", + SerializedName = @"objectId", + PossibleTypes = new [] { typeof(string) })] + string AuthenticationIdentityDetailObjectId { get; set; } + /// + /// The tenant Id for the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The tenant Id for the service principal with which the on-premise management/data plane components would communicate with our Azure services.", + SerializedName = @"tenantId", + PossibleTypes = new [] { typeof(string) })] + string AuthenticationIdentityDetailTenantId { get; set; } + /// The Bios Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Bios Id.", + SerializedName = @"biosId", + PossibleTypes = new [] { typeof(string) })] + string BiosId { get; set; } + /// A value indicating whether DRA is responsive. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether DRA is responsive.", + SerializedName = @"connectionStatus", + PossibleTypes = new [] { typeof(string) })] + string ConnectionStatus { get; set; } + /// The base authority for Azure Active Directory authentication. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The base authority for Azure Active Directory authentication.", + SerializedName = @"aadAuthority", + PossibleTypes = new [] { typeof(string) })] + string DataPlaneAuthenticationIdentityDetailAadAuthority { get; set; } + /// + /// The application/client Id for the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The application/client Id for the service principal with which the on-premise management/data plane components would communicate with our Azure services.", + SerializedName = @"applicationId", + PossibleTypes = new [] { typeof(string) })] + string DataPlaneAuthenticationIdentityDetailApplicationId { get; set; } + /// + /// The intended Audience of the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The intended Audience of the service principal with which the on-premise management/data plane components would communicate with our Azure services.", + SerializedName = @"audience", + PossibleTypes = new [] { typeof(string) })] + string DataPlaneAuthenticationIdentityDetailAudience { get; set; } + /// + /// The object Id of the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The object Id of the service principal with which the on-premise management/data plane components would communicate with our Azure services.", + SerializedName = @"objectId", + PossibleTypes = new [] { typeof(string) })] + string DataPlaneAuthenticationIdentityDetailObjectId { get; set; } + /// + /// The tenant Id for the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The tenant Id for the service principal with which the on-premise management/data plane components would communicate with our Azure services.", + SerializedName = @"tenantId", + PossibleTypes = new [] { typeof(string) })] + string DataPlaneAuthenticationIdentityDetailTenantId { get; set; } + /// The DRA Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The DRA Id.", + SerializedName = @"draIdentifier", + PossibleTypes = new [] { typeof(string) })] + string DraIdentifier { get; set; } + /// The fabric friendly name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The fabric friendly name.", + SerializedName = @"fabricFriendlyName", + PossibleTypes = new [] { typeof(string) })] + string FabricFriendlyName { get; set; } + /// Type of the site. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Type of the site.", + SerializedName = @"fabricType", + PossibleTypes = new [] { typeof(string) })] + string FabricType { get; set; } + /// Friendly name of the DRA. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Friendly name of the DRA.", + SerializedName = @"friendlyName", + PossibleTypes = new [] { typeof(string) })] + string FriendlyName { get; set; } + /// The recovery services provider health error details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery services provider health error details.", + SerializedName = @"healthErrorDetails", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] HealthErrorDetail { get; set; } + /// Time when last heartbeat was sent by the DRA. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Time when last heartbeat was sent by the DRA.", + SerializedName = @"lastHeartBeat", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? LastHeartBeat { get; set; } + /// The machine Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The machine Id.", + SerializedName = @"machineId", + PossibleTypes = new [] { typeof(string) })] + string MachineId { get; set; } + /// The machine name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The machine name.", + SerializedName = @"machineName", + PossibleTypes = new [] { typeof(string) })] + string MachineName { get; set; } + /// Number of protected VMs currently managed by the DRA. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Number of protected VMs currently managed by the DRA.", + SerializedName = @"protectedItemCount", + PossibleTypes = new [] { typeof(int) })] + int? ProtectedItemCount { get; set; } + /// The provider version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The provider version.", + SerializedName = @"providerVersion", + PossibleTypes = new [] { typeof(string) })] + string ProviderVersion { get; set; } + /// Version expiry date. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Version expiry date.", + SerializedName = @"expiryDate", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? ProviderVersionDetailExpiryDate { get; set; } + /// A value indicating whether security update required. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether security update required.", + SerializedName = @"status", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentVersionStatus) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentVersionStatus? ProviderVersionDetailStatus { get; set; } + /// The agent version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The agent version.", + SerializedName = @"version", + PossibleTypes = new [] { typeof(string) })] + string ProviderVersionDetailVersion { get; set; } + /// Expiry date of the version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Expiry date of the version.", + SerializedName = @"providerVersionExpiryDate", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? ProviderVersionExpiryDate { get; set; } + /// DRA version status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"DRA version status.", + SerializedName = @"providerVersionState", + PossibleTypes = new [] { typeof(string) })] + string ProviderVersionState { get; set; } + /// The base authority for Azure Active Directory authentication. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The base authority for Azure Active Directory authentication.", + SerializedName = @"aadAuthority", + PossibleTypes = new [] { typeof(string) })] + string ResourceAccessIdentityDetailAadAuthority { get; set; } + /// + /// The application/client Id for the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The application/client Id for the service principal with which the on-premise management/data plane components would communicate with our Azure services.", + SerializedName = @"applicationId", + PossibleTypes = new [] { typeof(string) })] + string ResourceAccessIdentityDetailApplicationId { get; set; } + /// + /// The intended Audience of the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The intended Audience of the service principal with which the on-premise management/data plane components would communicate with our Azure services.", + SerializedName = @"audience", + PossibleTypes = new [] { typeof(string) })] + string ResourceAccessIdentityDetailAudience { get; set; } + /// + /// The object Id of the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The object Id of the service principal with which the on-premise management/data plane components would communicate with our Azure services.", + SerializedName = @"objectId", + PossibleTypes = new [] { typeof(string) })] + string ResourceAccessIdentityDetailObjectId { get; set; } + /// + /// The tenant Id for the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The tenant Id for the service principal with which the on-premise management/data plane components would communicate with our Azure services.", + SerializedName = @"tenantId", + PossibleTypes = new [] { typeof(string) })] + string ResourceAccessIdentityDetailTenantId { get; set; } + /// The fabric provider. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The fabric provider.", + SerializedName = @"serverVersion", + PossibleTypes = new [] { typeof(string) })] + string ServerVersion { get; set; } + + } + /// Recovery services provider properties. + internal partial interface IRecoveryServicesProviderPropertiesInternal + + { + /// The scenarios allowed on this provider. + string[] AllowedScenario { get; set; } + /// The authentication identity details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetails AuthenticationIdentityDetail { get; set; } + /// The base authority for Azure Active Directory authentication. + string AuthenticationIdentityDetailAadAuthority { get; set; } + /// + /// The application/client Id for the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + string AuthenticationIdentityDetailApplicationId { get; set; } + /// + /// The intended Audience of the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + string AuthenticationIdentityDetailAudience { get; set; } + /// + /// The object Id of the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + string AuthenticationIdentityDetailObjectId { get; set; } + /// + /// The tenant Id for the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + string AuthenticationIdentityDetailTenantId { get; set; } + /// The Bios Id. + string BiosId { get; set; } + /// A value indicating whether DRA is responsive. + string ConnectionStatus { get; set; } + /// The data plane authentication identity details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetails DataPlaneAuthenticationIdentityDetail { get; set; } + /// The base authority for Azure Active Directory authentication. + string DataPlaneAuthenticationIdentityDetailAadAuthority { get; set; } + /// + /// The application/client Id for the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + string DataPlaneAuthenticationIdentityDetailApplicationId { get; set; } + /// + /// The intended Audience of the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + string DataPlaneAuthenticationIdentityDetailAudience { get; set; } + /// + /// The object Id of the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + string DataPlaneAuthenticationIdentityDetailObjectId { get; set; } + /// + /// The tenant Id for the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + string DataPlaneAuthenticationIdentityDetailTenantId { get; set; } + /// The DRA Id. + string DraIdentifier { get; set; } + /// The fabric friendly name. + string FabricFriendlyName { get; set; } + /// Type of the site. + string FabricType { get; set; } + /// Friendly name of the DRA. + string FriendlyName { get; set; } + /// The recovery services provider health error details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] HealthErrorDetail { get; set; } + /// Time when last heartbeat was sent by the DRA. + global::System.DateTime? LastHeartBeat { get; set; } + /// The machine Id. + string MachineId { get; set; } + /// The machine name. + string MachineName { get; set; } + /// Number of protected VMs currently managed by the DRA. + int? ProtectedItemCount { get; set; } + /// The provider version. + string ProviderVersion { get; set; } + /// The provider version details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVersionDetails ProviderVersionDetail { get; set; } + /// Version expiry date. + global::System.DateTime? ProviderVersionDetailExpiryDate { get; set; } + /// A value indicating whether security update required. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentVersionStatus? ProviderVersionDetailStatus { get; set; } + /// The agent version. + string ProviderVersionDetailVersion { get; set; } + /// Expiry date of the version. + global::System.DateTime? ProviderVersionExpiryDate { get; set; } + /// DRA version status. + string ProviderVersionState { get; set; } + /// The resource access identity details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIdentityProviderDetails ResourceAccessIdentityDetail { get; set; } + /// The base authority for Azure Active Directory authentication. + string ResourceAccessIdentityDetailAadAuthority { get; set; } + /// + /// The application/client Id for the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + string ResourceAccessIdentityDetailApplicationId { get; set; } + /// + /// The intended Audience of the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + string ResourceAccessIdentityDetailAudience { get; set; } + /// + /// The object Id of the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + string ResourceAccessIdentityDetailObjectId { get; set; } + /// + /// The tenant Id for the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + string ResourceAccessIdentityDetailTenantId { get; set; } + /// The fabric provider. + string ServerVersion { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryServicesProviderProperties.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryServicesProviderProperties.json.cs new file mode 100644 index 000000000000..34d6398021d5 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryServicesProviderProperties.json.cs @@ -0,0 +1,163 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Recovery services provider properties. + public partial class RecoveryServicesProviderProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new RecoveryServicesProviderProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal RecoveryServicesProviderProperties(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_authenticationIdentityDetail = If( json?.PropertyT("authenticationIdentityDetails"), out var __jsonAuthenticationIdentityDetails) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IdentityProviderDetails.FromJson(__jsonAuthenticationIdentityDetails) : AuthenticationIdentityDetail;} + {_resourceAccessIdentityDetail = If( json?.PropertyT("resourceAccessIdentityDetails"), out var __jsonResourceAccessIdentityDetails) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IdentityProviderDetails.FromJson(__jsonResourceAccessIdentityDetails) : ResourceAccessIdentityDetail;} + {_dataPlaneAuthenticationIdentityDetail = If( json?.PropertyT("dataPlaneAuthenticationIdentityDetails"), out var __jsonDataPlaneAuthenticationIdentityDetails) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IdentityProviderDetails.FromJson(__jsonDataPlaneAuthenticationIdentityDetails) : DataPlaneAuthenticationIdentityDetail;} + {_providerVersionDetail = If( json?.PropertyT("providerVersionDetails"), out var __jsonProviderVersionDetails) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VersionDetails.FromJson(__jsonProviderVersionDetails) : ProviderVersionDetail;} + {_fabricType = If( json?.PropertyT("fabricType"), out var __jsonFabricType) ? (string)__jsonFabricType : (string)FabricType;} + {_friendlyName = If( json?.PropertyT("friendlyName"), out var __jsonFriendlyName) ? (string)__jsonFriendlyName : (string)FriendlyName;} + {_providerVersion = If( json?.PropertyT("providerVersion"), out var __jsonProviderVersion) ? (string)__jsonProviderVersion : (string)ProviderVersion;} + {_serverVersion = If( json?.PropertyT("serverVersion"), out var __jsonServerVersion) ? (string)__jsonServerVersion : (string)ServerVersion;} + {_providerVersionState = If( json?.PropertyT("providerVersionState"), out var __jsonProviderVersionState) ? (string)__jsonProviderVersionState : (string)ProviderVersionState;} + {_providerVersionExpiryDate = If( json?.PropertyT("providerVersionExpiryDate"), out var __jsonProviderVersionExpiryDate) ? global::System.DateTime.TryParse((string)__jsonProviderVersionExpiryDate, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonProviderVersionExpiryDateValue) ? __jsonProviderVersionExpiryDateValue : ProviderVersionExpiryDate : ProviderVersionExpiryDate;} + {_fabricFriendlyName = If( json?.PropertyT("fabricFriendlyName"), out var __jsonFabricFriendlyName) ? (string)__jsonFabricFriendlyName : (string)FabricFriendlyName;} + {_lastHeartBeat = If( json?.PropertyT("lastHeartBeat"), out var __jsonLastHeartBeat) ? global::System.DateTime.TryParse((string)__jsonLastHeartBeat, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonLastHeartBeatValue) ? __jsonLastHeartBeatValue : LastHeartBeat : LastHeartBeat;} + {_connectionStatus = If( json?.PropertyT("connectionStatus"), out var __jsonConnectionStatus) ? (string)__jsonConnectionStatus : (string)ConnectionStatus;} + {_protectedItemCount = If( json?.PropertyT("protectedItemCount"), out var __jsonProtectedItemCount) ? (int?)__jsonProtectedItemCount : ProtectedItemCount;} + {_allowedScenario = If( json?.PropertyT("allowedScenarios"), out var __jsonAllowedScenarios) ? If( __jsonAllowedScenarios as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(string) (__u is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : AllowedScenario;} + {_healthErrorDetail = If( json?.PropertyT("healthErrorDetails"), out var __jsonHealthErrorDetails) ? If( __jsonHealthErrorDetails as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __q) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__q, (__p)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthError.FromJson(__p) )) ))() : null : HealthErrorDetail;} + {_draIdentifier = If( json?.PropertyT("draIdentifier"), out var __jsonDraIdentifier) ? (string)__jsonDraIdentifier : (string)DraIdentifier;} + {_machineId = If( json?.PropertyT("machineId"), out var __jsonMachineId) ? (string)__jsonMachineId : (string)MachineId;} + {_machineName = If( json?.PropertyT("machineName"), out var __jsonMachineName) ? (string)__jsonMachineName : (string)MachineName;} + {_biosId = If( json?.PropertyT("biosId"), out var __jsonBiosId) ? (string)__jsonBiosId : (string)BiosId;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._authenticationIdentityDetail ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._authenticationIdentityDetail.ToJson(null,serializationMode) : null, "authenticationIdentityDetails" ,container.Add ); + AddIf( null != this._resourceAccessIdentityDetail ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._resourceAccessIdentityDetail.ToJson(null,serializationMode) : null, "resourceAccessIdentityDetails" ,container.Add ); + AddIf( null != this._dataPlaneAuthenticationIdentityDetail ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._dataPlaneAuthenticationIdentityDetail.ToJson(null,serializationMode) : null, "dataPlaneAuthenticationIdentityDetails" ,container.Add ); + AddIf( null != this._providerVersionDetail ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._providerVersionDetail.ToJson(null,serializationMode) : null, "providerVersionDetails" ,container.Add ); + AddIf( null != (((object)this._fabricType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._fabricType.ToString()) : null, "fabricType" ,container.Add ); + AddIf( null != (((object)this._friendlyName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._friendlyName.ToString()) : null, "friendlyName" ,container.Add ); + AddIf( null != (((object)this._providerVersion)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._providerVersion.ToString()) : null, "providerVersion" ,container.Add ); + AddIf( null != (((object)this._serverVersion)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._serverVersion.ToString()) : null, "serverVersion" ,container.Add ); + AddIf( null != (((object)this._providerVersionState)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._providerVersionState.ToString()) : null, "providerVersionState" ,container.Add ); + AddIf( null != this._providerVersionExpiryDate ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._providerVersionExpiryDate?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "providerVersionExpiryDate" ,container.Add ); + AddIf( null != (((object)this._fabricFriendlyName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._fabricFriendlyName.ToString()) : null, "fabricFriendlyName" ,container.Add ); + AddIf( null != this._lastHeartBeat ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._lastHeartBeat?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "lastHeartBeat" ,container.Add ); + AddIf( null != (((object)this._connectionStatus)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._connectionStatus.ToString()) : null, "connectionStatus" ,container.Add ); + AddIf( null != this._protectedItemCount ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._protectedItemCount) : null, "protectedItemCount" ,container.Add ); + if (null != this._allowedScenario) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._allowedScenario ) + { + AddIf(null != (((object)__x)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(__x.ToString()) : null ,__w.Add); + } + container.Add("allowedScenarios",__w); + } + if (null != this._healthErrorDetail) + { + var __r = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __s in this._healthErrorDetail ) + { + AddIf(__s?.ToJson(null, serializationMode) ,__r.Add); + } + container.Add("healthErrorDetails",__r); + } + AddIf( null != (((object)this._draIdentifier)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._draIdentifier.ToString()) : null, "draIdentifier" ,container.Add ); + AddIf( null != (((object)this._machineId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._machineId.ToString()) : null, "machineId" ,container.Add ); + AddIf( null != (((object)this._machineName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._machineName.ToString()) : null, "machineName" ,container.Add ); + AddIf( null != (((object)this._biosId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._biosId.ToString()) : null, "biosId" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryVirtualNetworkCustomDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryVirtualNetworkCustomDetails.PowerShell.cs new file mode 100644 index 000000000000..e702246f387f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryVirtualNetworkCustomDetails.PowerShell.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Recovery Virtual network custom input. + [System.ComponentModel.TypeConverter(typeof(RecoveryVirtualNetworkCustomDetailsTypeConverter))] + public partial class RecoveryVirtualNetworkCustomDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryVirtualNetworkCustomDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new RecoveryVirtualNetworkCustomDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryVirtualNetworkCustomDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new RecoveryVirtualNetworkCustomDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryVirtualNetworkCustomDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal RecoveryVirtualNetworkCustomDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ResourceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryVirtualNetworkCustomDetailsInternal)this).ResourceType = (string) content.GetValueForProperty("ResourceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryVirtualNetworkCustomDetailsInternal)this).ResourceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal RecoveryVirtualNetworkCustomDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ResourceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryVirtualNetworkCustomDetailsInternal)this).ResourceType = (string) content.GetValueForProperty("ResourceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryVirtualNetworkCustomDetailsInternal)this).ResourceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Recovery Virtual network custom input. + [System.ComponentModel.TypeConverter(typeof(RecoveryVirtualNetworkCustomDetailsTypeConverter))] + public partial interface IRecoveryVirtualNetworkCustomDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryVirtualNetworkCustomDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryVirtualNetworkCustomDetails.TypeConverter.cs new file mode 100644 index 000000000000..9381187b71b2 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryVirtualNetworkCustomDetails.TypeConverter.cs @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class RecoveryVirtualNetworkCustomDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryVirtualNetworkCustomDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryVirtualNetworkCustomDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return RecoveryVirtualNetworkCustomDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return RecoveryVirtualNetworkCustomDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return RecoveryVirtualNetworkCustomDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryVirtualNetworkCustomDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryVirtualNetworkCustomDetails.cs new file mode 100644 index 000000000000..3b135ba63655 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryVirtualNetworkCustomDetails.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Recovery Virtual network custom input. + public partial class RecoveryVirtualNetworkCustomDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryVirtualNetworkCustomDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryVirtualNetworkCustomDetailsInternal + { + + /// Backing field for property. + private string _resourceType; + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ResourceType { get => this._resourceType; set => this._resourceType = value; } + + /// Creates an new instance. + public RecoveryVirtualNetworkCustomDetails() + { + + } + } + /// Recovery Virtual network custom input. + public partial interface IRecoveryVirtualNetworkCustomDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"resourceType", + PossibleTypes = new [] { typeof(string) })] + string ResourceType { get; set; } + + } + /// Recovery Virtual network custom input. + internal partial interface IRecoveryVirtualNetworkCustomDetailsInternal + + { + /// The class type. + string ResourceType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryVirtualNetworkCustomDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryVirtualNetworkCustomDetails.json.cs new file mode 100644 index 000000000000..7b2056eeaaf1 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RecoveryVirtualNetworkCustomDetails.json.cs @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Recovery Virtual network custom input. + public partial class RecoveryVirtualNetworkCustomDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryVirtualNetworkCustomDetails. + /// Note: the Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryVirtualNetworkCustomDetails interface + /// is polymorphic, and the precise model class that will get deserialized is determined at runtime based on the payload. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryVirtualNetworkCustomDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryVirtualNetworkCustomDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + if (!(node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json)) + { + return null; + } + // Polymorphic type -- select the appropriate constructor using the discriminator + + switch ( json.StringProperty("resourceType") ) + { + case "Existing": + { + return new ExistingRecoveryVirtualNetwork(json); + } + case "New": + { + return new NewRecoveryVirtualNetwork(json); + } + } + return new RecoveryVirtualNetworkCustomDetails(json); + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal RecoveryVirtualNetworkCustomDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_resourceType = If( json?.PropertyT("resourceType"), out var __jsonResourceType) ? (string)__jsonResourceType : (string)ResourceType;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._resourceType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._resourceType.ToString()) : null, "resourceType" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RemoveDisksInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RemoveDisksInput.PowerShell.cs new file mode 100644 index 000000000000..71db6974e9e8 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RemoveDisksInput.PowerShell.cs @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Input for remove disk(s) operation. + [System.ComponentModel.TypeConverter(typeof(RemoveDisksInputTypeConverter))] + public partial class RemoveDisksInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new RemoveDisksInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new RemoveDisksInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal RemoveDisksInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksInputInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksInputProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksInputInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RemoveDisksInputPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksInputInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksProviderSpecificInput) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksInputInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RemoveDisksProviderSpecificInputTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksInputInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksInputInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal RemoveDisksInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksInputInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksInputProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksInputInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RemoveDisksInputPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksInputInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksProviderSpecificInput) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksInputInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RemoveDisksProviderSpecificInputTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksInputInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksInputInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Input for remove disk(s) operation. + [System.ComponentModel.TypeConverter(typeof(RemoveDisksInputTypeConverter))] + public partial interface IRemoveDisksInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RemoveDisksInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RemoveDisksInput.TypeConverter.cs new file mode 100644 index 000000000000..ac5f94fd9ad4 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RemoveDisksInput.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class RemoveDisksInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return RemoveDisksInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return RemoveDisksInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return RemoveDisksInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RemoveDisksInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RemoveDisksInput.cs new file mode 100644 index 000000000000..0cfac3f53bad --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RemoveDisksInput.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Input for remove disk(s) operation. + public partial class RemoveDisksInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksInputInternal + { + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksInputProperties Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksInputInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RemoveDisksInputProperties()); set { {_property = value;} } } + + /// Internal Acessors for ProviderSpecificDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksProviderSpecificInput Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksInputInternal.ProviderSpecificDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksInputPropertiesInternal)Property).ProviderSpecificDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksInputPropertiesInternal)Property).ProviderSpecificDetail = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksInputProperties _property; + + /// Remove disk input properties. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksInputProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RemoveDisksInputProperties()); set => this._property = value; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ProviderSpecificDetailInstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksInputPropertiesInternal)Property).ProviderSpecificDetailInstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksInputPropertiesInternal)Property).ProviderSpecificDetailInstanceType = value ?? null; } + + /// Creates an new instance. + public RemoveDisksInput() + { + + } + } + /// Input for remove disk(s) operation. + public partial interface IRemoveDisksInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string ProviderSpecificDetailInstanceType { get; set; } + + } + /// Input for remove disk(s) operation. + internal partial interface IRemoveDisksInputInternal + + { + /// Remove disk input properties. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksInputProperties Property { get; set; } + /// + /// 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. + /// + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksProviderSpecificInput ProviderSpecificDetail { get; set; } + /// The class type. + string ProviderSpecificDetailInstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RemoveDisksInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RemoveDisksInput.json.cs new file mode 100644 index 000000000000..3fc8c3bcaf2d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RemoveDisksInput.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Input for remove disk(s) operation. + public partial class RemoveDisksInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new RemoveDisksInput(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal RemoveDisksInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RemoveDisksInputProperties.FromJson(__jsonProperties) : Property;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RemoveDisksInputProperties.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RemoveDisksInputProperties.PowerShell.cs new file mode 100644 index 000000000000..9bdd26d02adf --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RemoveDisksInputProperties.PowerShell.cs @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Remove Disk input properties. + [System.ComponentModel.TypeConverter(typeof(RemoveDisksInputPropertiesTypeConverter))] + public partial class RemoveDisksInputProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksInputProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new RemoveDisksInputProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksInputProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new RemoveDisksInputProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksInputProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal RemoveDisksInputProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksInputPropertiesInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksProviderSpecificInput) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksInputPropertiesInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RemoveDisksProviderSpecificInputTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksInputPropertiesInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksInputPropertiesInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal RemoveDisksInputProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksInputPropertiesInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksProviderSpecificInput) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksInputPropertiesInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RemoveDisksProviderSpecificInputTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksInputPropertiesInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksInputPropertiesInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Remove Disk input properties. + [System.ComponentModel.TypeConverter(typeof(RemoveDisksInputPropertiesTypeConverter))] + public partial interface IRemoveDisksInputProperties + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RemoveDisksInputProperties.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RemoveDisksInputProperties.TypeConverter.cs new file mode 100644 index 000000000000..d5314c6d1f98 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RemoveDisksInputProperties.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class RemoveDisksInputPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksInputProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksInputProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return RemoveDisksInputProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return RemoveDisksInputProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return RemoveDisksInputProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RemoveDisksInputProperties.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RemoveDisksInputProperties.cs new file mode 100644 index 000000000000..a86717228527 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RemoveDisksInputProperties.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Remove Disk input properties. + public partial class RemoveDisksInputProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksInputProperties, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksInputPropertiesInternal + { + + /// Internal Acessors for ProviderSpecificDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksProviderSpecificInput Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksInputPropertiesInternal.ProviderSpecificDetail { get => (this._providerSpecificDetail = this._providerSpecificDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RemoveDisksProviderSpecificInput()); set { {_providerSpecificDetail = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksProviderSpecificInput _providerSpecificDetail; + + /// + /// 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. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksProviderSpecificInput ProviderSpecificDetail { get => (this._providerSpecificDetail = this._providerSpecificDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RemoveDisksProviderSpecificInput()); set => this._providerSpecificDetail = value; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ProviderSpecificDetailInstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksProviderSpecificInputInternal)ProviderSpecificDetail).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksProviderSpecificInputInternal)ProviderSpecificDetail).InstanceType = value ?? null; } + + /// Creates an new instance. + public RemoveDisksInputProperties() + { + + } + } + /// Remove Disk input properties. + public partial interface IRemoveDisksInputProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string ProviderSpecificDetailInstanceType { get; set; } + + } + /// Remove Disk input properties. + internal partial interface IRemoveDisksInputPropertiesInternal + + { + /// + /// 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. + /// + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksProviderSpecificInput ProviderSpecificDetail { get; set; } + /// The class type. + string ProviderSpecificDetailInstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RemoveDisksInputProperties.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RemoveDisksInputProperties.json.cs new file mode 100644 index 000000000000..bdb762d823a3 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RemoveDisksInputProperties.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Remove Disk input properties. + public partial class RemoveDisksInputProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksInputProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksInputProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksInputProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new RemoveDisksInputProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal RemoveDisksInputProperties(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_providerSpecificDetail = If( json?.PropertyT("providerSpecificDetails"), out var __jsonProviderSpecificDetails) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RemoveDisksProviderSpecificInput.FromJson(__jsonProviderSpecificDetails) : ProviderSpecificDetail;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._providerSpecificDetail ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._providerSpecificDetail.ToJson(null,serializationMode) : null, "providerSpecificDetails" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RemoveDisksProviderSpecificInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RemoveDisksProviderSpecificInput.PowerShell.cs new file mode 100644 index 000000000000..7c8160ad868e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RemoveDisksProviderSpecificInput.PowerShell.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Remove Disk provider specific input. + [System.ComponentModel.TypeConverter(typeof(RemoveDisksProviderSpecificInputTypeConverter))] + public partial class RemoveDisksProviderSpecificInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksProviderSpecificInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new RemoveDisksProviderSpecificInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksProviderSpecificInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new RemoveDisksProviderSpecificInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksProviderSpecificInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal RemoveDisksProviderSpecificInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal RemoveDisksProviderSpecificInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Remove Disk provider specific input. + [System.ComponentModel.TypeConverter(typeof(RemoveDisksProviderSpecificInputTypeConverter))] + public partial interface IRemoveDisksProviderSpecificInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RemoveDisksProviderSpecificInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RemoveDisksProviderSpecificInput.TypeConverter.cs new file mode 100644 index 000000000000..99e554cf8279 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RemoveDisksProviderSpecificInput.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class RemoveDisksProviderSpecificInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksProviderSpecificInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksProviderSpecificInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return RemoveDisksProviderSpecificInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return RemoveDisksProviderSpecificInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return RemoveDisksProviderSpecificInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RemoveDisksProviderSpecificInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RemoveDisksProviderSpecificInput.cs new file mode 100644 index 000000000000..b912aa320f9d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RemoveDisksProviderSpecificInput.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Remove Disk provider specific input. + public partial class RemoveDisksProviderSpecificInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksProviderSpecificInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksProviderSpecificInputInternal + { + + /// Backing field for property. + private string _instanceType; + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string InstanceType { get => this._instanceType; set => this._instanceType = value; } + + /// Creates an new instance. + public RemoveDisksProviderSpecificInput() + { + + } + } + /// Remove Disk provider specific input. + public partial interface IRemoveDisksProviderSpecificInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string InstanceType { get; set; } + + } + /// Remove Disk provider specific input. + internal partial interface IRemoveDisksProviderSpecificInputInternal + + { + /// The class type. + string InstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RemoveDisksProviderSpecificInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RemoveDisksProviderSpecificInput.json.cs new file mode 100644 index 000000000000..d32ece8388b0 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RemoveDisksProviderSpecificInput.json.cs @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Remove Disk provider specific input. + public partial class RemoveDisksProviderSpecificInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksProviderSpecificInput. + /// Note: the Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksProviderSpecificInput interface + /// is polymorphic, and the precise model class that will get deserialized is determined at runtime based on the payload. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksProviderSpecificInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksProviderSpecificInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + if (!(node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json)) + { + return null; + } + // Polymorphic type -- select the appropriate constructor using the discriminator + + switch ( json.StringProperty("instanceType") ) + { + case "A2A": + { + return new A2ARemoveDisksInput(json); + } + } + return new RemoveDisksProviderSpecificInput(json); + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal RemoveDisksProviderSpecificInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_instanceType = If( json?.PropertyT("instanceType"), out var __jsonInstanceType) ? (string)__jsonInstanceType : (string)InstanceType;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._instanceType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._instanceType.ToString()) : null, "instanceType" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RemoveProtectionContainerMappingInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RemoveProtectionContainerMappingInput.PowerShell.cs new file mode 100644 index 000000000000..1f8ce927ecd6 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RemoveProtectionContainerMappingInput.PowerShell.cs @@ -0,0 +1,165 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Container unpairing input. + [System.ComponentModel.TypeConverter(typeof(RemoveProtectionContainerMappingInputTypeConverter))] + public partial class RemoveProtectionContainerMappingInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveProtectionContainerMappingInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new RemoveProtectionContainerMappingInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveProtectionContainerMappingInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new RemoveProtectionContainerMappingInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json + /// string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveProtectionContainerMappingInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal RemoveProtectionContainerMappingInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveProtectionContainerMappingInputInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveProtectionContainerMappingInputProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveProtectionContainerMappingInputInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RemoveProtectionContainerMappingInputPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificInput")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveProtectionContainerMappingInputInternal)this).ProviderSpecificInput = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderContainerUnmappingInput) content.GetValueForProperty("ProviderSpecificInput",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveProtectionContainerMappingInputInternal)this).ProviderSpecificInput, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProviderContainerUnmappingInputTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificInputInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveProtectionContainerMappingInputInternal)this).ProviderSpecificInputInstanceType = (string) content.GetValueForProperty("ProviderSpecificInputInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveProtectionContainerMappingInputInternal)this).ProviderSpecificInputInstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal RemoveProtectionContainerMappingInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveProtectionContainerMappingInputInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveProtectionContainerMappingInputProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveProtectionContainerMappingInputInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RemoveProtectionContainerMappingInputPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificInput")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveProtectionContainerMappingInputInternal)this).ProviderSpecificInput = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderContainerUnmappingInput) content.GetValueForProperty("ProviderSpecificInput",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveProtectionContainerMappingInputInternal)this).ProviderSpecificInput, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProviderContainerUnmappingInputTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificInputInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveProtectionContainerMappingInputInternal)this).ProviderSpecificInputInstanceType = (string) content.GetValueForProperty("ProviderSpecificInputInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveProtectionContainerMappingInputInternal)this).ProviderSpecificInputInstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Container unpairing input. + [System.ComponentModel.TypeConverter(typeof(RemoveProtectionContainerMappingInputTypeConverter))] + public partial interface IRemoveProtectionContainerMappingInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RemoveProtectionContainerMappingInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RemoveProtectionContainerMappingInput.TypeConverter.cs new file mode 100644 index 000000000000..86716e4e2964 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RemoveProtectionContainerMappingInput.TypeConverter.cs @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class RemoveProtectionContainerMappingInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveProtectionContainerMappingInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveProtectionContainerMappingInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return RemoveProtectionContainerMappingInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return RemoveProtectionContainerMappingInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return RemoveProtectionContainerMappingInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RemoveProtectionContainerMappingInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RemoveProtectionContainerMappingInput.cs new file mode 100644 index 000000000000..e893340aa6c7 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RemoveProtectionContainerMappingInput.cs @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Container unpairing input. + public partial class RemoveProtectionContainerMappingInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveProtectionContainerMappingInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveProtectionContainerMappingInputInternal + { + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveProtectionContainerMappingInputProperties Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveProtectionContainerMappingInputInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RemoveProtectionContainerMappingInputProperties()); set { {_property = value;} } } + + /// Internal Acessors for ProviderSpecificInput + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderContainerUnmappingInput Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveProtectionContainerMappingInputInternal.ProviderSpecificInput { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveProtectionContainerMappingInputPropertiesInternal)Property).ProviderSpecificInput; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveProtectionContainerMappingInputPropertiesInternal)Property).ProviderSpecificInput = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveProtectionContainerMappingInputProperties _property; + + /// Configure protection input properties. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveProtectionContainerMappingInputProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RemoveProtectionContainerMappingInputProperties()); set => this._property = value; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ProviderSpecificInputInstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveProtectionContainerMappingInputPropertiesInternal)Property).ProviderSpecificInputInstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveProtectionContainerMappingInputPropertiesInternal)Property).ProviderSpecificInputInstanceType = value ?? null; } + + /// Creates an new instance. + public RemoveProtectionContainerMappingInput() + { + + } + } + /// Container unpairing input. + public partial interface IRemoveProtectionContainerMappingInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string ProviderSpecificInputInstanceType { get; set; } + + } + /// Container unpairing input. + internal partial interface IRemoveProtectionContainerMappingInputInternal + + { + /// Configure protection input properties. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveProtectionContainerMappingInputProperties Property { get; set; } + /// Provider specific input for unpairing. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderContainerUnmappingInput ProviderSpecificInput { get; set; } + /// The class type. + string ProviderSpecificInputInstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RemoveProtectionContainerMappingInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RemoveProtectionContainerMappingInput.json.cs new file mode 100644 index 000000000000..7c450db76a48 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RemoveProtectionContainerMappingInput.json.cs @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Container unpairing input. + public partial class RemoveProtectionContainerMappingInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveProtectionContainerMappingInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveProtectionContainerMappingInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveProtectionContainerMappingInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new RemoveProtectionContainerMappingInput(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal RemoveProtectionContainerMappingInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RemoveProtectionContainerMappingInputProperties.FromJson(__jsonProperties) : Property;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RemoveProtectionContainerMappingInputProperties.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RemoveProtectionContainerMappingInputProperties.PowerShell.cs new file mode 100644 index 000000000000..e298c8b6533c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RemoveProtectionContainerMappingInputProperties.PowerShell.cs @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Unpairing input properties. + [System.ComponentModel.TypeConverter(typeof(RemoveProtectionContainerMappingInputPropertiesTypeConverter))] + public partial class RemoveProtectionContainerMappingInputProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveProtectionContainerMappingInputProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new RemoveProtectionContainerMappingInputProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveProtectionContainerMappingInputProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new RemoveProtectionContainerMappingInputProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from + /// a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveProtectionContainerMappingInputProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal RemoveProtectionContainerMappingInputProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProviderSpecificInput")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveProtectionContainerMappingInputPropertiesInternal)this).ProviderSpecificInput = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderContainerUnmappingInput) content.GetValueForProperty("ProviderSpecificInput",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveProtectionContainerMappingInputPropertiesInternal)this).ProviderSpecificInput, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProviderContainerUnmappingInputTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificInputInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveProtectionContainerMappingInputPropertiesInternal)this).ProviderSpecificInputInstanceType = (string) content.GetValueForProperty("ProviderSpecificInputInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveProtectionContainerMappingInputPropertiesInternal)this).ProviderSpecificInputInstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal RemoveProtectionContainerMappingInputProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProviderSpecificInput")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveProtectionContainerMappingInputPropertiesInternal)this).ProviderSpecificInput = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderContainerUnmappingInput) content.GetValueForProperty("ProviderSpecificInput",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveProtectionContainerMappingInputPropertiesInternal)this).ProviderSpecificInput, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProviderContainerUnmappingInputTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificInputInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveProtectionContainerMappingInputPropertiesInternal)this).ProviderSpecificInputInstanceType = (string) content.GetValueForProperty("ProviderSpecificInputInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveProtectionContainerMappingInputPropertiesInternal)this).ProviderSpecificInputInstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Unpairing input properties. + [System.ComponentModel.TypeConverter(typeof(RemoveProtectionContainerMappingInputPropertiesTypeConverter))] + public partial interface IRemoveProtectionContainerMappingInputProperties + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RemoveProtectionContainerMappingInputProperties.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RemoveProtectionContainerMappingInputProperties.TypeConverter.cs new file mode 100644 index 000000000000..6003b119c8ec --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RemoveProtectionContainerMappingInputProperties.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class RemoveProtectionContainerMappingInputPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, + /// otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveProtectionContainerMappingInputProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveProtectionContainerMappingInputProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return RemoveProtectionContainerMappingInputProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return RemoveProtectionContainerMappingInputProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return RemoveProtectionContainerMappingInputProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RemoveProtectionContainerMappingInputProperties.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RemoveProtectionContainerMappingInputProperties.cs new file mode 100644 index 000000000000..23bcb61f3a35 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RemoveProtectionContainerMappingInputProperties.cs @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Unpairing input properties. + public partial class RemoveProtectionContainerMappingInputProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveProtectionContainerMappingInputProperties, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveProtectionContainerMappingInputPropertiesInternal + { + + /// Internal Acessors for ProviderSpecificInput + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderContainerUnmappingInput Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveProtectionContainerMappingInputPropertiesInternal.ProviderSpecificInput { get => (this._providerSpecificInput = this._providerSpecificInput ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProviderContainerUnmappingInput()); set { {_providerSpecificInput = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderContainerUnmappingInput _providerSpecificInput; + + /// Provider specific input for unpairing. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderContainerUnmappingInput ProviderSpecificInput { get => (this._providerSpecificInput = this._providerSpecificInput ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProviderContainerUnmappingInput()); set => this._providerSpecificInput = value; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ProviderSpecificInputInstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderContainerUnmappingInputInternal)ProviderSpecificInput).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderContainerUnmappingInputInternal)ProviderSpecificInput).InstanceType = value ?? null; } + + /// + /// Creates an new instance. + /// + public RemoveProtectionContainerMappingInputProperties() + { + + } + } + /// Unpairing input properties. + public partial interface IRemoveProtectionContainerMappingInputProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string ProviderSpecificInputInstanceType { get; set; } + + } + /// Unpairing input properties. + internal partial interface IRemoveProtectionContainerMappingInputPropertiesInternal + + { + /// Provider specific input for unpairing. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderContainerUnmappingInput ProviderSpecificInput { get; set; } + /// The class type. + string ProviderSpecificInputInstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RemoveProtectionContainerMappingInputProperties.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RemoveProtectionContainerMappingInputProperties.json.cs new file mode 100644 index 000000000000..07bde0e341b3 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RemoveProtectionContainerMappingInputProperties.json.cs @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Unpairing input properties. + public partial class RemoveProtectionContainerMappingInputProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveProtectionContainerMappingInputProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveProtectionContainerMappingInputProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveProtectionContainerMappingInputProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new RemoveProtectionContainerMappingInputProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal RemoveProtectionContainerMappingInputProperties(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_providerSpecificInput = If( json?.PropertyT("providerSpecificInput"), out var __jsonProviderSpecificInput) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProviderContainerUnmappingInput.FromJson(__jsonProviderSpecificInput) : ProviderSpecificInput;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._providerSpecificInput ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._providerSpecificInput.ToJson(null,serializationMode) : null, "providerSpecificInput" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RenewCertificateInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RenewCertificateInput.PowerShell.cs new file mode 100644 index 000000000000..4a653cac2a03 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RenewCertificateInput.PowerShell.cs @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Certificate renewal input. + [System.ComponentModel.TypeConverter(typeof(RenewCertificateInputTypeConverter))] + public partial class RenewCertificateInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRenewCertificateInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new RenewCertificateInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRenewCertificateInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new RenewCertificateInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRenewCertificateInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal RenewCertificateInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRenewCertificateInputInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRenewCertificateInputProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRenewCertificateInputInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RenewCertificateInputPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("RenewCertificateType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRenewCertificateInputInternal)this).RenewCertificateType = (string) content.GetValueForProperty("RenewCertificateType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRenewCertificateInputInternal)this).RenewCertificateType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal RenewCertificateInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRenewCertificateInputInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRenewCertificateInputProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRenewCertificateInputInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RenewCertificateInputPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("RenewCertificateType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRenewCertificateInputInternal)this).RenewCertificateType = (string) content.GetValueForProperty("RenewCertificateType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRenewCertificateInputInternal)this).RenewCertificateType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Certificate renewal input. + [System.ComponentModel.TypeConverter(typeof(RenewCertificateInputTypeConverter))] + public partial interface IRenewCertificateInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RenewCertificateInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RenewCertificateInput.TypeConverter.cs new file mode 100644 index 000000000000..0faee4f01ee3 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RenewCertificateInput.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class RenewCertificateInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRenewCertificateInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRenewCertificateInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return RenewCertificateInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return RenewCertificateInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return RenewCertificateInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RenewCertificateInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RenewCertificateInput.cs new file mode 100644 index 000000000000..24dc7f5900cd --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RenewCertificateInput.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Certificate renewal input. + public partial class RenewCertificateInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRenewCertificateInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRenewCertificateInputInternal + { + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRenewCertificateInputProperties Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRenewCertificateInputInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RenewCertificateInputProperties()); set { {_property = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRenewCertificateInputProperties _property; + + /// Renew certificate input properties. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRenewCertificateInputProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RenewCertificateInputProperties()); set => this._property = value; } + + /// Renew certificate type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string RenewCertificateType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRenewCertificateInputPropertiesInternal)Property).RenewCertificateType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRenewCertificateInputPropertiesInternal)Property).RenewCertificateType = value ?? null; } + + /// Creates an new instance. + public RenewCertificateInput() + { + + } + } + /// Certificate renewal input. + public partial interface IRenewCertificateInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// Renew certificate type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Renew certificate type.", + SerializedName = @"renewCertificateType", + PossibleTypes = new [] { typeof(string) })] + string RenewCertificateType { get; set; } + + } + /// Certificate renewal input. + internal partial interface IRenewCertificateInputInternal + + { + /// Renew certificate input properties. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRenewCertificateInputProperties Property { get; set; } + /// Renew certificate type. + string RenewCertificateType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RenewCertificateInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RenewCertificateInput.json.cs new file mode 100644 index 000000000000..7f3dc35723fc --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RenewCertificateInput.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Certificate renewal input. + public partial class RenewCertificateInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRenewCertificateInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRenewCertificateInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRenewCertificateInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new RenewCertificateInput(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal RenewCertificateInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RenewCertificateInputProperties.FromJson(__jsonProperties) : Property;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RenewCertificateInputProperties.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RenewCertificateInputProperties.PowerShell.cs new file mode 100644 index 000000000000..c42f4a73c8b5 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RenewCertificateInputProperties.PowerShell.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Renew Certificate input properties. + [System.ComponentModel.TypeConverter(typeof(RenewCertificateInputPropertiesTypeConverter))] + public partial class RenewCertificateInputProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRenewCertificateInputProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new RenewCertificateInputProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRenewCertificateInputProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new RenewCertificateInputProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRenewCertificateInputProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal RenewCertificateInputProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("RenewCertificateType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRenewCertificateInputPropertiesInternal)this).RenewCertificateType = (string) content.GetValueForProperty("RenewCertificateType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRenewCertificateInputPropertiesInternal)this).RenewCertificateType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal RenewCertificateInputProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("RenewCertificateType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRenewCertificateInputPropertiesInternal)this).RenewCertificateType = (string) content.GetValueForProperty("RenewCertificateType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRenewCertificateInputPropertiesInternal)this).RenewCertificateType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Renew Certificate input properties. + [System.ComponentModel.TypeConverter(typeof(RenewCertificateInputPropertiesTypeConverter))] + public partial interface IRenewCertificateInputProperties + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RenewCertificateInputProperties.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RenewCertificateInputProperties.TypeConverter.cs new file mode 100644 index 000000000000..8b6802e05eb9 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RenewCertificateInputProperties.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class RenewCertificateInputPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRenewCertificateInputProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRenewCertificateInputProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return RenewCertificateInputProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return RenewCertificateInputProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return RenewCertificateInputProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RenewCertificateInputProperties.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RenewCertificateInputProperties.cs new file mode 100644 index 000000000000..2c684148ab53 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RenewCertificateInputProperties.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Renew Certificate input properties. + public partial class RenewCertificateInputProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRenewCertificateInputProperties, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRenewCertificateInputPropertiesInternal + { + + /// Backing field for property. + private string _renewCertificateType; + + /// Renew certificate type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RenewCertificateType { get => this._renewCertificateType; set => this._renewCertificateType = value; } + + /// Creates an new instance. + public RenewCertificateInputProperties() + { + + } + } + /// Renew Certificate input properties. + public partial interface IRenewCertificateInputProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// Renew certificate type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Renew certificate type.", + SerializedName = @"renewCertificateType", + PossibleTypes = new [] { typeof(string) })] + string RenewCertificateType { get; set; } + + } + /// Renew Certificate input properties. + internal partial interface IRenewCertificateInputPropertiesInternal + + { + /// Renew certificate type. + string RenewCertificateType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RenewCertificateInputProperties.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RenewCertificateInputProperties.json.cs new file mode 100644 index 000000000000..ba17d87794b1 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RenewCertificateInputProperties.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Renew Certificate input properties. + public partial class RenewCertificateInputProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRenewCertificateInputProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRenewCertificateInputProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRenewCertificateInputProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new RenewCertificateInputProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal RenewCertificateInputProperties(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_renewCertificateType = If( json?.PropertyT("renewCertificateType"), out var __jsonRenewCertificateType) ? (string)__jsonRenewCertificateType : (string)RenewCertificateType;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._renewCertificateType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._renewCertificateType.ToString()) : null, "renewCertificateType" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationAgentDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationAgentDetails.PowerShell.cs new file mode 100644 index 000000000000..02c119be6458 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationAgentDetails.PowerShell.cs @@ -0,0 +1,208 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Replication agent details. + [System.ComponentModel.TypeConverter(typeof(ReplicationAgentDetailsTypeConverter))] + public partial class ReplicationAgentDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAgentDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ReplicationAgentDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAgentDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ReplicationAgentDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAgentDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ReplicationAgentDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAgentDetailsInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAgentDetailsInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAgentDetailsInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAgentDetailsInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("BiosId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAgentDetailsInternal)this).BiosId = (string) content.GetValueForProperty("BiosId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAgentDetailsInternal)this).BiosId, global::System.Convert.ToString); + } + if (content.Contains("FabricObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAgentDetailsInternal)this).FabricObjectId = (string) content.GetValueForProperty("FabricObjectId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAgentDetailsInternal)this).FabricObjectId, global::System.Convert.ToString); + } + if (content.Contains("Fqdn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAgentDetailsInternal)this).Fqdn = (string) content.GetValueForProperty("Fqdn",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAgentDetailsInternal)this).Fqdn, global::System.Convert.ToString); + } + if (content.Contains("Version")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAgentDetailsInternal)this).Version = (string) content.GetValueForProperty("Version",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAgentDetailsInternal)this).Version, global::System.Convert.ToString); + } + if (content.Contains("LastHeartbeatUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAgentDetailsInternal)this).LastHeartbeatUtc = (global::System.DateTime?) content.GetValueForProperty("LastHeartbeatUtc",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAgentDetailsInternal)this).LastHeartbeatUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("Health")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAgentDetailsInternal)this).Health = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth?) content.GetValueForProperty("Health",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAgentDetailsInternal)this).Health, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth.CreateFrom); + } + if (content.Contains("HealthError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAgentDetailsInternal)this).HealthError = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[]) content.GetValueForProperty("HealthError",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAgentDetailsInternal)this).HealthError, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthErrorTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ReplicationAgentDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAgentDetailsInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAgentDetailsInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAgentDetailsInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAgentDetailsInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("BiosId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAgentDetailsInternal)this).BiosId = (string) content.GetValueForProperty("BiosId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAgentDetailsInternal)this).BiosId, global::System.Convert.ToString); + } + if (content.Contains("FabricObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAgentDetailsInternal)this).FabricObjectId = (string) content.GetValueForProperty("FabricObjectId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAgentDetailsInternal)this).FabricObjectId, global::System.Convert.ToString); + } + if (content.Contains("Fqdn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAgentDetailsInternal)this).Fqdn = (string) content.GetValueForProperty("Fqdn",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAgentDetailsInternal)this).Fqdn, global::System.Convert.ToString); + } + if (content.Contains("Version")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAgentDetailsInternal)this).Version = (string) content.GetValueForProperty("Version",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAgentDetailsInternal)this).Version, global::System.Convert.ToString); + } + if (content.Contains("LastHeartbeatUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAgentDetailsInternal)this).LastHeartbeatUtc = (global::System.DateTime?) content.GetValueForProperty("LastHeartbeatUtc",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAgentDetailsInternal)this).LastHeartbeatUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("Health")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAgentDetailsInternal)this).Health = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth?) content.GetValueForProperty("Health",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAgentDetailsInternal)this).Health, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth.CreateFrom); + } + if (content.Contains("HealthError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAgentDetailsInternal)this).HealthError = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[]) content.GetValueForProperty("HealthError",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAgentDetailsInternal)this).HealthError, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthErrorTypeConverter.ConvertFrom)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Replication agent details. + [System.ComponentModel.TypeConverter(typeof(ReplicationAgentDetailsTypeConverter))] + public partial interface IReplicationAgentDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationAgentDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationAgentDetails.TypeConverter.cs new file mode 100644 index 000000000000..900ed6fb97ce --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationAgentDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ReplicationAgentDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAgentDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAgentDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ReplicationAgentDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ReplicationAgentDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ReplicationAgentDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationAgentDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationAgentDetails.cs new file mode 100644 index 000000000000..73cc57005868 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationAgentDetails.cs @@ -0,0 +1,214 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Replication agent details. + public partial class ReplicationAgentDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAgentDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAgentDetailsInternal + { + + /// Backing field for property. + private string _biosId; + + /// The replication agent Bios Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string BiosId { get => this._biosId; } + + /// Backing field for property. + private string _fabricObjectId; + + /// The fabric object Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string FabricObjectId { get => this._fabricObjectId; } + + /// Backing field for property. + private string _fqdn; + + /// The replication agent Fqdn. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Fqdn { get => this._fqdn; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth? _health; + + /// The health of the replication agent. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth? Health { get => this._health; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] _healthError; + + /// The health errors. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] HealthError { get => this._healthError; } + + /// Backing field for property. + private string _id; + + /// The replication agent Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Id { get => this._id; } + + /// Backing field for property. + private global::System.DateTime? _lastHeartbeatUtc; + + /// The last heartbeat received from the replication agent. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public global::System.DateTime? LastHeartbeatUtc { get => this._lastHeartbeatUtc; } + + /// Internal Acessors for BiosId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAgentDetailsInternal.BiosId { get => this._biosId; set { {_biosId = value;} } } + + /// Internal Acessors for FabricObjectId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAgentDetailsInternal.FabricObjectId { get => this._fabricObjectId; set { {_fabricObjectId = value;} } } + + /// Internal Acessors for Fqdn + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAgentDetailsInternal.Fqdn { get => this._fqdn; set { {_fqdn = value;} } } + + /// Internal Acessors for Health + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAgentDetailsInternal.Health { get => this._health; set { {_health = value;} } } + + /// Internal Acessors for HealthError + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAgentDetailsInternal.HealthError { get => this._healthError; set { {_healthError = value;} } } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAgentDetailsInternal.Id { get => this._id; set { {_id = value;} } } + + /// Internal Acessors for LastHeartbeatUtc + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAgentDetailsInternal.LastHeartbeatUtc { get => this._lastHeartbeatUtc; set { {_lastHeartbeatUtc = value;} } } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAgentDetailsInternal.Name { get => this._name; set { {_name = value;} } } + + /// Internal Acessors for Version + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAgentDetailsInternal.Version { get => this._version; set { {_version = value;} } } + + /// Backing field for property. + private string _name; + + /// The replication agent name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Name { get => this._name; } + + /// Backing field for property. + private string _version; + + /// The version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Version { get => this._version; } + + /// Creates an new instance. + public ReplicationAgentDetails() + { + + } + } + /// Replication agent details. + public partial interface IReplicationAgentDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The replication agent Bios Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The replication agent Bios Id.", + SerializedName = @"biosId", + PossibleTypes = new [] { typeof(string) })] + string BiosId { get; } + /// The fabric object Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The fabric object Id.", + SerializedName = @"fabricObjectId", + PossibleTypes = new [] { typeof(string) })] + string FabricObjectId { get; } + /// The replication agent Fqdn. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The replication agent Fqdn.", + SerializedName = @"fqdn", + PossibleTypes = new [] { typeof(string) })] + string Fqdn { get; } + /// The health of the replication agent. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The health of the replication agent.", + SerializedName = @"health", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth? Health { get; } + /// The health errors. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The health errors.", + SerializedName = @"healthErrors", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] HealthError { get; } + /// The replication agent Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The replication agent Id.", + SerializedName = @"id", + PossibleTypes = new [] { typeof(string) })] + string Id { get; } + /// The last heartbeat received from the replication agent. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The last heartbeat received from the replication agent.", + SerializedName = @"lastHeartbeatUtc", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? LastHeartbeatUtc { get; } + /// The replication agent name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The replication agent name.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string Name { get; } + /// The version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The version.", + SerializedName = @"version", + PossibleTypes = new [] { typeof(string) })] + string Version { get; } + + } + /// Replication agent details. + internal partial interface IReplicationAgentDetailsInternal + + { + /// The replication agent Bios Id. + string BiosId { get; set; } + /// The fabric object Id. + string FabricObjectId { get; set; } + /// The replication agent Fqdn. + string Fqdn { get; set; } + /// The health of the replication agent. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth? Health { get; set; } + /// The health errors. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] HealthError { get; set; } + /// The replication agent Id. + string Id { get; set; } + /// The last heartbeat received from the replication agent. + global::System.DateTime? LastHeartbeatUtc { get; set; } + /// The replication agent name. + string Name { get; set; } + /// The version. + string Version { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationAgentDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationAgentDetails.json.cs new file mode 100644 index 000000000000..3e5535ca7201 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationAgentDetails.json.cs @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Replication agent details. + public partial class ReplicationAgentDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAgentDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAgentDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAgentDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new ReplicationAgentDetails(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal ReplicationAgentDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_id = If( json?.PropertyT("id"), out var __jsonId) ? (string)__jsonId : (string)Id;} + {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)Name;} + {_biosId = If( json?.PropertyT("biosId"), out var __jsonBiosId) ? (string)__jsonBiosId : (string)BiosId;} + {_fabricObjectId = If( json?.PropertyT("fabricObjectId"), out var __jsonFabricObjectId) ? (string)__jsonFabricObjectId : (string)FabricObjectId;} + {_fqdn = If( json?.PropertyT("fqdn"), out var __jsonFqdn) ? (string)__jsonFqdn : (string)Fqdn;} + {_version = If( json?.PropertyT("version"), out var __jsonVersion) ? (string)__jsonVersion : (string)Version;} + {_lastHeartbeatUtc = If( json?.PropertyT("lastHeartbeatUtc"), out var __jsonLastHeartbeatUtc) ? global::System.DateTime.TryParse((string)__jsonLastHeartbeatUtc, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonLastHeartbeatUtcValue) ? __jsonLastHeartbeatUtcValue : LastHeartbeatUtc : LastHeartbeatUtc;} + {_health = If( json?.PropertyT("health"), out var __jsonHealth) ? (string)__jsonHealth : (string)Health;} + {_healthError = If( json?.PropertyT("healthErrors"), out var __jsonHealthErrors) ? If( __jsonHealthErrors as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthError.FromJson(__u) )) ))() : null : HealthError;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._id)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._id.ToString()) : null, "id" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._biosId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._biosId.ToString()) : null, "biosId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._fabricObjectId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._fabricObjectId.ToString()) : null, "fabricObjectId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._fqdn)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._fqdn.ToString()) : null, "fqdn" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._version)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._version.ToString()) : null, "version" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._lastHeartbeatUtc ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._lastHeartbeatUtc?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "lastHeartbeatUtc" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._health)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._health.ToString()) : null, "health" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + if (null != this._healthError) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._healthError ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("healthErrors",__w); + } + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationAppliance.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationAppliance.PowerShell.cs new file mode 100644 index 000000000000..b21a614cefd7 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationAppliance.PowerShell.cs @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Replication appliance definition. + [System.ComponentModel.TypeConverter(typeof(ReplicationApplianceTypeConverter))] + public partial class ReplicationAppliance + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAppliance DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ReplicationAppliance(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAppliance DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ReplicationAppliance(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAppliance FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ReplicationAppliance(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationApplianceInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationApplianceProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationApplianceInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationAppliancePropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationApplianceInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplianceSpecificDetails) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationApplianceInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ApplianceSpecificDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationApplianceInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationApplianceInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ReplicationAppliance(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationApplianceInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationApplianceProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationApplianceInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationAppliancePropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationApplianceInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplianceSpecificDetails) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationApplianceInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ApplianceSpecificDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationApplianceInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationApplianceInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Replication appliance definition. + [System.ComponentModel.TypeConverter(typeof(ReplicationApplianceTypeConverter))] + public partial interface IReplicationAppliance + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationAppliance.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationAppliance.TypeConverter.cs new file mode 100644 index 000000000000..78c4285e1488 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationAppliance.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ReplicationApplianceTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAppliance ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAppliance).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ReplicationAppliance.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ReplicationAppliance.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ReplicationAppliance.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationAppliance.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationAppliance.cs new file mode 100644 index 000000000000..864c16428c86 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationAppliance.cs @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Replication appliance definition. + public partial class ReplicationAppliance : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAppliance, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationApplianceInternal + { + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationApplianceProperties Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationApplianceInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationApplianceProperties()); set { {_property = value;} } } + + /// Internal Acessors for ProviderSpecificDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplianceSpecificDetails Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationApplianceInternal.ProviderSpecificDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAppliancePropertiesInternal)Property).ProviderSpecificDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAppliancePropertiesInternal)Property).ProviderSpecificDetail = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationApplianceProperties _property; + + /// Appliance related data. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationApplianceProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationApplianceProperties()); set => this._property = value; } + + /// Gets the class type. Overridden in derived classes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ProviderSpecificDetailInstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAppliancePropertiesInternal)Property).ProviderSpecificDetailInstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAppliancePropertiesInternal)Property).ProviderSpecificDetailInstanceType = value ?? null; } + + /// Creates an new instance. + public ReplicationAppliance() + { + + } + } + /// Replication appliance definition. + public partial interface IReplicationAppliance : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// Gets the class type. Overridden in derived classes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets the class type. Overridden in derived classes.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string ProviderSpecificDetailInstanceType { get; set; } + + } + /// Replication appliance definition. + internal partial interface IReplicationApplianceInternal + + { + /// Appliance related data. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationApplianceProperties Property { get; set; } + /// Provider specific settings. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplianceSpecificDetails ProviderSpecificDetail { get; set; } + /// Gets the class type. Overridden in derived classes. + string ProviderSpecificDetailInstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationAppliance.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationAppliance.json.cs new file mode 100644 index 000000000000..949e7e6552cb --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationAppliance.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Replication appliance definition. + public partial class ReplicationAppliance + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAppliance. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAppliance. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAppliance FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new ReplicationAppliance(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal ReplicationAppliance(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationApplianceProperties.FromJson(__jsonProperties) : Property;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationApplianceProperties.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationApplianceProperties.PowerShell.cs new file mode 100644 index 000000000000..31830a51ab28 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationApplianceProperties.PowerShell.cs @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Replication appliance properties. + [System.ComponentModel.TypeConverter(typeof(ReplicationAppliancePropertiesTypeConverter))] + public partial class ReplicationApplianceProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationApplianceProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ReplicationApplianceProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationApplianceProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ReplicationApplianceProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationApplianceProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ReplicationApplianceProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAppliancePropertiesInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplianceSpecificDetails) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAppliancePropertiesInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ApplianceSpecificDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAppliancePropertiesInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAppliancePropertiesInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ReplicationApplianceProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAppliancePropertiesInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplianceSpecificDetails) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAppliancePropertiesInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ApplianceSpecificDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAppliancePropertiesInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAppliancePropertiesInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Replication appliance properties. + [System.ComponentModel.TypeConverter(typeof(ReplicationAppliancePropertiesTypeConverter))] + public partial interface IReplicationApplianceProperties + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationApplianceProperties.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationApplianceProperties.TypeConverter.cs new file mode 100644 index 000000000000..bcc2750ebe56 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationApplianceProperties.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ReplicationAppliancePropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationApplianceProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationApplianceProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ReplicationApplianceProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ReplicationApplianceProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ReplicationApplianceProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationApplianceProperties.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationApplianceProperties.cs new file mode 100644 index 000000000000..885c2c03f9a9 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationApplianceProperties.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Replication appliance properties. + public partial class ReplicationApplianceProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationApplianceProperties, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAppliancePropertiesInternal + { + + /// Internal Acessors for ProviderSpecificDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplianceSpecificDetails Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAppliancePropertiesInternal.ProviderSpecificDetail { get => (this._providerSpecificDetail = this._providerSpecificDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ApplianceSpecificDetails()); set { {_providerSpecificDetail = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplianceSpecificDetails _providerSpecificDetail; + + /// Provider specific settings. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplianceSpecificDetails ProviderSpecificDetail { get => (this._providerSpecificDetail = this._providerSpecificDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ApplianceSpecificDetails()); set => this._providerSpecificDetail = value; } + + /// Gets the class type. Overridden in derived classes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ProviderSpecificDetailInstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplianceSpecificDetailsInternal)ProviderSpecificDetail).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplianceSpecificDetailsInternal)ProviderSpecificDetail).InstanceType = value ?? null; } + + /// Creates an new instance. + public ReplicationApplianceProperties() + { + + } + } + /// Replication appliance properties. + public partial interface IReplicationApplianceProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// Gets the class type. Overridden in derived classes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets the class type. Overridden in derived classes.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string ProviderSpecificDetailInstanceType { get; set; } + + } + /// Replication appliance properties. + internal partial interface IReplicationAppliancePropertiesInternal + + { + /// Provider specific settings. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplianceSpecificDetails ProviderSpecificDetail { get; set; } + /// Gets the class type. Overridden in derived classes. + string ProviderSpecificDetailInstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationApplianceProperties.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationApplianceProperties.json.cs new file mode 100644 index 000000000000..bed8be64a295 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationApplianceProperties.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Replication appliance properties. + public partial class ReplicationApplianceProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationApplianceProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationApplianceProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationApplianceProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new ReplicationApplianceProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal ReplicationApplianceProperties(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_providerSpecificDetail = If( json?.PropertyT("providerSpecificDetails"), out var __jsonProviderSpecificDetails) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ApplianceSpecificDetails.FromJson(__jsonProviderSpecificDetails) : ProviderSpecificDetail;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._providerSpecificDetail ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._providerSpecificDetail.ToJson(null,serializationMode) : null, "providerSpecificDetails" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationEligibilityResults.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationEligibilityResults.PowerShell.cs new file mode 100644 index 000000000000..15039c131b18 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationEligibilityResults.PowerShell.cs @@ -0,0 +1,186 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Replication eligibility results response model. + [System.ComponentModel.TypeConverter(typeof(ReplicationEligibilityResultsTypeConverter))] + public partial class ReplicationEligibilityResults + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResults DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ReplicationEligibilityResults(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResults DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ReplicationEligibilityResults(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResults FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ReplicationEligibilityResults(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationEligibilityResultsPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("ClientRequestId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsInternal)this).ClientRequestId = (string) content.GetValueForProperty("ClientRequestId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsInternal)this).ClientRequestId, global::System.Convert.ToString); + } + if (content.Contains("Error")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsInternal)this).Error = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsErrorInfo[]) content.GetValueForProperty("Error",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsInternal)this).Error, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationEligibilityResultsErrorInfoTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ReplicationEligibilityResults(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationEligibilityResultsPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("ClientRequestId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsInternal)this).ClientRequestId = (string) content.GetValueForProperty("ClientRequestId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsInternal)this).ClientRequestId, global::System.Convert.ToString); + } + if (content.Contains("Error")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsInternal)this).Error = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsErrorInfo[]) content.GetValueForProperty("Error",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsInternal)this).Error, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationEligibilityResultsErrorInfoTypeConverter.ConvertFrom)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Replication eligibility results response model. + [System.ComponentModel.TypeConverter(typeof(ReplicationEligibilityResultsTypeConverter))] + public partial interface IReplicationEligibilityResults + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationEligibilityResults.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationEligibilityResults.TypeConverter.cs new file mode 100644 index 000000000000..96294ef8b31e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationEligibilityResults.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ReplicationEligibilityResultsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResults ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResults).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ReplicationEligibilityResults.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ReplicationEligibilityResults.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ReplicationEligibilityResults.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationEligibilityResults.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationEligibilityResults.cs new file mode 100644 index 000000000000..710854368ec6 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationEligibilityResults.cs @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Replication eligibility results response model. + public partial class ReplicationEligibilityResults : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResults, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsInternal + { + + /// The client request Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ClientRequestId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsPropertiesInternal)Property).ClientRequestId; } + + /// The error details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsErrorInfo[] Error { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsPropertiesInternal)Property).Error; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsPropertiesInternal)Property).Error = value ?? null /* arrayOf */; } + + /// Backing field for property. + private string _id; + + /// Gets Unique ARM identifier for this object. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Id { get => this._id; } + + /// Internal Acessors for ClientRequestId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsInternal.ClientRequestId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsPropertiesInternal)Property).ClientRequestId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsPropertiesInternal)Property).ClientRequestId = value; } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsInternal.Id { get => this._id; set { {_id = value;} } } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsInternal.Name { get => this._name; set { {_name = value;} } } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsProperties Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationEligibilityResultsProperties()); set { {_property = value;} } } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsInternal.Type { get => this._type; set { {_type = value;} } } + + /// Backing field for property. + private string _name; + + /// Gets the name of this object. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Name { get => this._name; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsProperties _property; + + /// Gets properties model for replication eligibility results API. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationEligibilityResultsProperties()); } + + /// Backing field for property. + private string _type; + + /// Gets the object type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Type { get => this._type; } + + /// Creates an new instance. + public ReplicationEligibilityResults() + { + + } + } + /// Replication eligibility results response model. + public partial interface IReplicationEligibilityResults : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The client request Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The client request Id.", + SerializedName = @"clientRequestId", + PossibleTypes = new [] { typeof(string) })] + string ClientRequestId { get; } + /// The error details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The error details.", + SerializedName = @"errors", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsErrorInfo) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsErrorInfo[] Error { get; set; } + /// Gets Unique ARM identifier for this object. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets Unique ARM identifier for this object.", + SerializedName = @"id", + PossibleTypes = new [] { typeof(string) })] + string Id { get; } + /// Gets the name of this object. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets the name of this object.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string Name { get; } + /// Gets the object type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets the object type.", + SerializedName = @"type", + PossibleTypes = new [] { typeof(string) })] + string Type { get; } + + } + /// Replication eligibility results response model. + internal partial interface IReplicationEligibilityResultsInternal + + { + /// The client request Id. + string ClientRequestId { get; set; } + /// The error details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsErrorInfo[] Error { get; set; } + /// Gets Unique ARM identifier for this object. + string Id { get; set; } + /// Gets the name of this object. + string Name { get; set; } + /// Gets properties model for replication eligibility results API. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsProperties Property { get; set; } + /// Gets the object type. + string Type { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationEligibilityResults.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationEligibilityResults.json.cs new file mode 100644 index 000000000000..02def221ca4d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationEligibilityResults.json.cs @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Replication eligibility results response model. + public partial class ReplicationEligibilityResults + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResults. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResults. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResults FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new ReplicationEligibilityResults(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal ReplicationEligibilityResults(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationEligibilityResultsProperties.FromJson(__jsonProperties) : Property;} + {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)Name;} + {_type = If( json?.PropertyT("type"), out var __jsonType) ? (string)__jsonType : (string)Type;} + {_id = If( json?.PropertyT("id"), out var __jsonId) ? (string)__jsonId : (string)Id;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._type)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._type.ToString()) : null, "type" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._id)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._id.ToString()) : null, "id" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationEligibilityResultsCollection.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationEligibilityResultsCollection.PowerShell.cs new file mode 100644 index 000000000000..a042eea4b1d0 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationEligibilityResultsCollection.PowerShell.cs @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Replication eligibility results collection response model. + [System.ComponentModel.TypeConverter(typeof(ReplicationEligibilityResultsCollectionTypeConverter))] + public partial class ReplicationEligibilityResultsCollection + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsCollection DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ReplicationEligibilityResultsCollection(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsCollection DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ReplicationEligibilityResultsCollection(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json + /// string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsCollection FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ReplicationEligibilityResultsCollection(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResults[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationEligibilityResultsTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ReplicationEligibilityResultsCollection(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResults[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationEligibilityResultsTypeConverter.ConvertFrom)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Replication eligibility results collection response model. + [System.ComponentModel.TypeConverter(typeof(ReplicationEligibilityResultsCollectionTypeConverter))] + public partial interface IReplicationEligibilityResultsCollection + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationEligibilityResultsCollection.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationEligibilityResultsCollection.TypeConverter.cs new file mode 100644 index 000000000000..f0966386b208 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationEligibilityResultsCollection.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ReplicationEligibilityResultsCollectionTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsCollection ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsCollection).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ReplicationEligibilityResultsCollection.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ReplicationEligibilityResultsCollection.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ReplicationEligibilityResultsCollection.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationEligibilityResultsCollection.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationEligibilityResultsCollection.cs new file mode 100644 index 000000000000..e14f2c062691 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationEligibilityResultsCollection.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Replication eligibility results collection response model. + public partial class ReplicationEligibilityResultsCollection : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsCollection, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsCollectionInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResults[] _value; + + /// The replication eligibility results details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResults[] Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public ReplicationEligibilityResultsCollection() + { + + } + } + /// Replication eligibility results collection response model. + public partial interface IReplicationEligibilityResultsCollection : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The replication eligibility results details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The replication eligibility results details.", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResults) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResults[] Value { get; set; } + + } + /// Replication eligibility results collection response model. + internal partial interface IReplicationEligibilityResultsCollectionInternal + + { + /// The replication eligibility results details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResults[] Value { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationEligibilityResultsCollection.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationEligibilityResultsCollection.json.cs new file mode 100644 index 000000000000..d912c23f24a9 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationEligibilityResultsCollection.json.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Replication eligibility results collection response model. + public partial class ReplicationEligibilityResultsCollection + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsCollection. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsCollection. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsCollection FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new ReplicationEligibilityResultsCollection(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal ReplicationEligibilityResultsCollection(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResults) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationEligibilityResults.FromJson(__u) )) ))() : null : Value;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._value) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._value ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("value",__w); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationEligibilityResultsErrorInfo.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationEligibilityResultsErrorInfo.PowerShell.cs new file mode 100644 index 000000000000..5db8e651f798 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationEligibilityResultsErrorInfo.PowerShell.cs @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Error model that can be exposed to the user. + [System.ComponentModel.TypeConverter(typeof(ReplicationEligibilityResultsErrorInfoTypeConverter))] + public partial class ReplicationEligibilityResultsErrorInfo + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsErrorInfo DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ReplicationEligibilityResultsErrorInfo(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsErrorInfo DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ReplicationEligibilityResultsErrorInfo(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json + /// string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsErrorInfo FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ReplicationEligibilityResultsErrorInfo(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Code")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsErrorInfoInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsErrorInfoInternal)this).Code, global::System.Convert.ToString); + } + if (content.Contains("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsErrorInfoInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsErrorInfoInternal)this).Message, global::System.Convert.ToString); + } + if (content.Contains("PossibleCaus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsErrorInfoInternal)this).PossibleCaus = (string) content.GetValueForProperty("PossibleCaus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsErrorInfoInternal)this).PossibleCaus, global::System.Convert.ToString); + } + if (content.Contains("RecommendedAction")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsErrorInfoInternal)this).RecommendedAction = (string) content.GetValueForProperty("RecommendedAction",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsErrorInfoInternal)this).RecommendedAction, global::System.Convert.ToString); + } + if (content.Contains("Status")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsErrorInfoInternal)this).Status = (string) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsErrorInfoInternal)this).Status, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ReplicationEligibilityResultsErrorInfo(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Code")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsErrorInfoInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsErrorInfoInternal)this).Code, global::System.Convert.ToString); + } + if (content.Contains("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsErrorInfoInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsErrorInfoInternal)this).Message, global::System.Convert.ToString); + } + if (content.Contains("PossibleCaus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsErrorInfoInternal)this).PossibleCaus = (string) content.GetValueForProperty("PossibleCaus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsErrorInfoInternal)this).PossibleCaus, global::System.Convert.ToString); + } + if (content.Contains("RecommendedAction")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsErrorInfoInternal)this).RecommendedAction = (string) content.GetValueForProperty("RecommendedAction",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsErrorInfoInternal)this).RecommendedAction, global::System.Convert.ToString); + } + if (content.Contains("Status")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsErrorInfoInternal)this).Status = (string) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsErrorInfoInternal)this).Status, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Error model that can be exposed to the user. + [System.ComponentModel.TypeConverter(typeof(ReplicationEligibilityResultsErrorInfoTypeConverter))] + public partial interface IReplicationEligibilityResultsErrorInfo + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationEligibilityResultsErrorInfo.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationEligibilityResultsErrorInfo.TypeConverter.cs new file mode 100644 index 000000000000..997e19be5b0b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationEligibilityResultsErrorInfo.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ReplicationEligibilityResultsErrorInfoTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsErrorInfo ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsErrorInfo).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ReplicationEligibilityResultsErrorInfo.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ReplicationEligibilityResultsErrorInfo.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ReplicationEligibilityResultsErrorInfo.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationEligibilityResultsErrorInfo.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationEligibilityResultsErrorInfo.cs new file mode 100644 index 000000000000..c7c40a98851e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationEligibilityResultsErrorInfo.cs @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Error model that can be exposed to the user. + public partial class ReplicationEligibilityResultsErrorInfo : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsErrorInfo, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsErrorInfoInternal + { + + /// Backing field for property. + private string _code; + + /// The error code. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Code { get => this._code; set => this._code = value; } + + /// Backing field for property. + private string _message; + + /// The error message. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Message { get => this._message; set => this._message = value; } + + /// Internal Acessors for Status + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsErrorInfoInternal.Status { get => this._status; set { {_status = value;} } } + + /// Backing field for property. + private string _possibleCaus; + + /// The possible causes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string PossibleCaus { get => this._possibleCaus; set => this._possibleCaus = value; } + + /// Backing field for property. + private string _recommendedAction; + + /// The recommended action. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecommendedAction { get => this._recommendedAction; set => this._recommendedAction = value; } + + /// Backing field for property. + private string _status; + + /// The error status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Status { get => this._status; } + + /// Creates an new instance. + public ReplicationEligibilityResultsErrorInfo() + { + + } + } + /// Error model that can be exposed to the user. + public partial interface IReplicationEligibilityResultsErrorInfo : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The error code. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The error code.", + SerializedName = @"code", + PossibleTypes = new [] { typeof(string) })] + string Code { get; set; } + /// The error message. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The error message.", + SerializedName = @"message", + PossibleTypes = new [] { typeof(string) })] + string Message { get; set; } + /// The possible causes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The possible causes.", + SerializedName = @"possibleCauses", + PossibleTypes = new [] { typeof(string) })] + string PossibleCaus { get; set; } + /// The recommended action. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recommended action.", + SerializedName = @"recommendedAction", + PossibleTypes = new [] { typeof(string) })] + string RecommendedAction { get; set; } + /// The error status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The error status.", + SerializedName = @"status", + PossibleTypes = new [] { typeof(string) })] + string Status { get; } + + } + /// Error model that can be exposed to the user. + internal partial interface IReplicationEligibilityResultsErrorInfoInternal + + { + /// The error code. + string Code { get; set; } + /// The error message. + string Message { get; set; } + /// The possible causes. + string PossibleCaus { get; set; } + /// The recommended action. + string RecommendedAction { get; set; } + /// The error status. + string Status { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationEligibilityResultsErrorInfo.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationEligibilityResultsErrorInfo.json.cs new file mode 100644 index 000000000000..1ece6626adab --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationEligibilityResultsErrorInfo.json.cs @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Error model that can be exposed to the user. + public partial class ReplicationEligibilityResultsErrorInfo + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsErrorInfo. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsErrorInfo. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsErrorInfo FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new ReplicationEligibilityResultsErrorInfo(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal ReplicationEligibilityResultsErrorInfo(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_code = If( json?.PropertyT("code"), out var __jsonCode) ? (string)__jsonCode : (string)Code;} + {_message = If( json?.PropertyT("message"), out var __jsonMessage) ? (string)__jsonMessage : (string)Message;} + {_possibleCaus = If( json?.PropertyT("possibleCauses"), out var __jsonPossibleCauses) ? (string)__jsonPossibleCauses : (string)PossibleCaus;} + {_recommendedAction = If( json?.PropertyT("recommendedAction"), out var __jsonRecommendedAction) ? (string)__jsonRecommendedAction : (string)RecommendedAction;} + {_status = If( json?.PropertyT("status"), out var __jsonStatus) ? (string)__jsonStatus : (string)Status;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._code)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._code.ToString()) : null, "code" ,container.Add ); + AddIf( null != (((object)this._message)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._message.ToString()) : null, "message" ,container.Add ); + AddIf( null != (((object)this._possibleCaus)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._possibleCaus.ToString()) : null, "possibleCauses" ,container.Add ); + AddIf( null != (((object)this._recommendedAction)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recommendedAction.ToString()) : null, "recommendedAction" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._status)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._status.ToString()) : null, "status" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationEligibilityResultsProperties.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationEligibilityResultsProperties.PowerShell.cs new file mode 100644 index 000000000000..cb7471ba6505 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationEligibilityResultsProperties.PowerShell.cs @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Properties model for replication eligibility results API. + [System.ComponentModel.TypeConverter(typeof(ReplicationEligibilityResultsPropertiesTypeConverter))] + public partial class ReplicationEligibilityResultsProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ReplicationEligibilityResultsProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ReplicationEligibilityResultsProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json + /// string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ReplicationEligibilityResultsProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ClientRequestId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsPropertiesInternal)this).ClientRequestId = (string) content.GetValueForProperty("ClientRequestId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsPropertiesInternal)this).ClientRequestId, global::System.Convert.ToString); + } + if (content.Contains("Error")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsPropertiesInternal)this).Error = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsErrorInfo[]) content.GetValueForProperty("Error",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsPropertiesInternal)this).Error, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationEligibilityResultsErrorInfoTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ReplicationEligibilityResultsProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ClientRequestId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsPropertiesInternal)this).ClientRequestId = (string) content.GetValueForProperty("ClientRequestId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsPropertiesInternal)this).ClientRequestId, global::System.Convert.ToString); + } + if (content.Contains("Error")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsPropertiesInternal)this).Error = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsErrorInfo[]) content.GetValueForProperty("Error",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsPropertiesInternal)this).Error, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationEligibilityResultsErrorInfoTypeConverter.ConvertFrom)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Properties model for replication eligibility results API. + [System.ComponentModel.TypeConverter(typeof(ReplicationEligibilityResultsPropertiesTypeConverter))] + public partial interface IReplicationEligibilityResultsProperties + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationEligibilityResultsProperties.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationEligibilityResultsProperties.TypeConverter.cs new file mode 100644 index 000000000000..5ae633d6ffcf --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationEligibilityResultsProperties.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ReplicationEligibilityResultsPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ReplicationEligibilityResultsProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ReplicationEligibilityResultsProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ReplicationEligibilityResultsProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationEligibilityResultsProperties.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationEligibilityResultsProperties.cs new file mode 100644 index 000000000000..a4f1d1ab91e3 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationEligibilityResultsProperties.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Properties model for replication eligibility results API. + public partial class ReplicationEligibilityResultsProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsProperties, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsPropertiesInternal + { + + /// Backing field for property. + private string _clientRequestId; + + /// The client request Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ClientRequestId { get => this._clientRequestId; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsErrorInfo[] _error; + + /// The error details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsErrorInfo[] Error { get => this._error; set => this._error = value; } + + /// Internal Acessors for ClientRequestId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsPropertiesInternal.ClientRequestId { get => this._clientRequestId; set { {_clientRequestId = value;} } } + + /// Creates an new instance. + public ReplicationEligibilityResultsProperties() + { + + } + } + /// Properties model for replication eligibility results API. + public partial interface IReplicationEligibilityResultsProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The client request Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The client request Id.", + SerializedName = @"clientRequestId", + PossibleTypes = new [] { typeof(string) })] + string ClientRequestId { get; } + /// The error details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The error details.", + SerializedName = @"errors", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsErrorInfo) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsErrorInfo[] Error { get; set; } + + } + /// Properties model for replication eligibility results API. + internal partial interface IReplicationEligibilityResultsPropertiesInternal + + { + /// The client request Id. + string ClientRequestId { get; set; } + /// The error details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsErrorInfo[] Error { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationEligibilityResultsProperties.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationEligibilityResultsProperties.json.cs new file mode 100644 index 000000000000..583d8c6ebe44 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationEligibilityResultsProperties.json.cs @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Properties model for replication eligibility results API. + public partial class ReplicationEligibilityResultsProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new ReplicationEligibilityResultsProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal ReplicationEligibilityResultsProperties(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_clientRequestId = If( json?.PropertyT("clientRequestId"), out var __jsonClientRequestId) ? (string)__jsonClientRequestId : (string)ClientRequestId;} + {_error = If( json?.PropertyT("errors"), out var __jsonErrors) ? If( __jsonErrors as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsErrorInfo) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationEligibilityResultsErrorInfo.FromJson(__u) )) ))() : null : Error;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._clientRequestId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._clientRequestId.ToString()) : null, "clientRequestId" ,container.Add ); + } + if (null != this._error) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._error ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("errors",__w); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationGroupDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationGroupDetails.PowerShell.cs new file mode 100644 index 000000000000..ac41baab572a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationGroupDetails.PowerShell.cs @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Replication group details. This will be used in case of San. + [System.ComponentModel.TypeConverter(typeof(ReplicationGroupDetailsTypeConverter))] + public partial class ReplicationGroupDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationGroupDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ReplicationGroupDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationGroupDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ReplicationGroupDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationGroupDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ReplicationGroupDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigurationSettingsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigurationSettingsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ReplicationGroupDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigurationSettingsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigurationSettingsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Replication group details. This will be used in case of San. + [System.ComponentModel.TypeConverter(typeof(ReplicationGroupDetailsTypeConverter))] + public partial interface IReplicationGroupDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationGroupDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationGroupDetails.TypeConverter.cs new file mode 100644 index 000000000000..52da3a48dfe7 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationGroupDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ReplicationGroupDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationGroupDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationGroupDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ReplicationGroupDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ReplicationGroupDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ReplicationGroupDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationGroupDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationGroupDetails.cs new file mode 100644 index 000000000000..ddb6b6820895 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationGroupDetails.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Replication group details. This will be used in case of San. + public partial class ReplicationGroupDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationGroupDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationGroupDetailsInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigurationSettings __configurationSettings = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ConfigurationSettings(); + + /// Gets the class type. Overridden in derived classes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigurationSettingsInternal)__configurationSettings).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigurationSettingsInternal)__configurationSettings).InstanceType = value ; } + + /// Creates an new instance. + public ReplicationGroupDetails() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__configurationSettings), __configurationSettings); + await eventListener.AssertObjectIsValid(nameof(__configurationSettings), __configurationSettings); + } + } + /// Replication group details. This will be used in case of San. + public partial interface IReplicationGroupDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigurationSettings + { + + } + /// Replication group details. This will be used in case of San. + internal partial interface IReplicationGroupDetailsInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigurationSettingsInternal + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationGroupDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationGroupDetails.json.cs new file mode 100644 index 000000000000..9591f5c03c1e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationGroupDetails.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Replication group details. This will be used in case of San. + public partial class ReplicationGroupDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationGroupDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationGroupDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationGroupDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new ReplicationGroupDetails(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal ReplicationGroupDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __configurationSettings = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ConfigurationSettings(json); + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __configurationSettings?.ToJson(container, serializationMode); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProtectedItem.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProtectedItem.PowerShell.cs new file mode 100644 index 000000000000..5d3d2fd5c763 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProtectedItem.PowerShell.cs @@ -0,0 +1,450 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Replication protected item. + [System.ComponentModel.TypeConverter(typeof(ReplicationProtectedItemTypeConverter))] + public partial class ReplicationProtectedItem + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ReplicationProtectedItem(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ReplicationProtectedItem(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ReplicationProtectedItem(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProtectedItemPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("CurrentScenario")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).CurrentScenario = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICurrentScenarioDetails) content.GetValueForProperty("CurrentScenario",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).CurrentScenario, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.CurrentScenarioDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettings) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProviderSpecificSettingsTypeConverter.ConvertFrom); + } + if (content.Contains("FriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).FriendlyName = (string) content.GetValueForProperty("FriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).FriendlyName, global::System.Convert.ToString); + } + if (content.Contains("ProtectedItemType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).ProtectedItemType = (string) content.GetValueForProperty("ProtectedItemType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).ProtectedItemType, global::System.Convert.ToString); + } + if (content.Contains("ProtectableItemId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).ProtectableItemId = (string) content.GetValueForProperty("ProtectableItemId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).ProtectableItemId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryServicesProviderId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).RecoveryServicesProviderId = (string) content.GetValueForProperty("RecoveryServicesProviderId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).RecoveryServicesProviderId, global::System.Convert.ToString); + } + if (content.Contains("PrimaryFabricFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).PrimaryFabricFriendlyName = (string) content.GetValueForProperty("PrimaryFabricFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).PrimaryFabricFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("PrimaryFabricProvider")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).PrimaryFabricProvider = (string) content.GetValueForProperty("PrimaryFabricProvider",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).PrimaryFabricProvider, global::System.Convert.ToString); + } + if (content.Contains("RecoveryFabricFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).RecoveryFabricFriendlyName = (string) content.GetValueForProperty("RecoveryFabricFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).RecoveryFabricFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("RecoveryFabricId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).RecoveryFabricId = (string) content.GetValueForProperty("RecoveryFabricId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).RecoveryFabricId, global::System.Convert.ToString); + } + if (content.Contains("PrimaryProtectionContainerFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).PrimaryProtectionContainerFriendlyName = (string) content.GetValueForProperty("PrimaryProtectionContainerFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).PrimaryProtectionContainerFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("RecoveryProtectionContainerFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).RecoveryProtectionContainerFriendlyName = (string) content.GetValueForProperty("RecoveryProtectionContainerFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).RecoveryProtectionContainerFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("ProtectionState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).ProtectionState = (string) content.GetValueForProperty("ProtectionState",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).ProtectionState, global::System.Convert.ToString); + } + if (content.Contains("ProtectionStateDescription")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).ProtectionStateDescription = (string) content.GetValueForProperty("ProtectionStateDescription",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).ProtectionStateDescription, global::System.Convert.ToString); + } + if (content.Contains("ActiveLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).ActiveLocation = (string) content.GetValueForProperty("ActiveLocation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).ActiveLocation, global::System.Convert.ToString); + } + if (content.Contains("TestFailoverState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).TestFailoverState = (string) content.GetValueForProperty("TestFailoverState",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).TestFailoverState, global::System.Convert.ToString); + } + if (content.Contains("TestFailoverStateDescription")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).TestFailoverStateDescription = (string) content.GetValueForProperty("TestFailoverStateDescription",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).TestFailoverStateDescription, global::System.Convert.ToString); + } + if (content.Contains("SwitchProviderState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).SwitchProviderState = (string) content.GetValueForProperty("SwitchProviderState",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).SwitchProviderState, global::System.Convert.ToString); + } + if (content.Contains("SwitchProviderStateDescription")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).SwitchProviderStateDescription = (string) content.GetValueForProperty("SwitchProviderStateDescription",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).SwitchProviderStateDescription, global::System.Convert.ToString); + } + if (content.Contains("AllowedOperation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).AllowedOperation = (string[]) content.GetValueForProperty("AllowedOperation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).AllowedOperation, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("ReplicationHealth")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).ReplicationHealth = (string) content.GetValueForProperty("ReplicationHealth",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).ReplicationHealth, global::System.Convert.ToString); + } + if (content.Contains("FailoverHealth")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).FailoverHealth = (string) content.GetValueForProperty("FailoverHealth",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).FailoverHealth, global::System.Convert.ToString); + } + if (content.Contains("HealthError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).HealthError = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[]) content.GetValueForProperty("HealthError",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).HealthError, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("PolicyId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).PolicyId = (string) content.GetValueForProperty("PolicyId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).PolicyId, global::System.Convert.ToString); + } + if (content.Contains("PolicyFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).PolicyFriendlyName = (string) content.GetValueForProperty("PolicyFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).PolicyFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("LastSuccessfulFailoverTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).LastSuccessfulFailoverTime = (global::System.DateTime?) content.GetValueForProperty("LastSuccessfulFailoverTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).LastSuccessfulFailoverTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("LastSuccessfulTestFailoverTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).LastSuccessfulTestFailoverTime = (global::System.DateTime?) content.GetValueForProperty("LastSuccessfulTestFailoverTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).LastSuccessfulTestFailoverTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("FailoverRecoveryPointId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).FailoverRecoveryPointId = (string) content.GetValueForProperty("FailoverRecoveryPointId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).FailoverRecoveryPointId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryContainerId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).RecoveryContainerId = (string) content.GetValueForProperty("RecoveryContainerId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).RecoveryContainerId, global::System.Convert.ToString); + } + if (content.Contains("EventCorrelationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).EventCorrelationId = (string) content.GetValueForProperty("EventCorrelationId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).EventCorrelationId, global::System.Convert.ToString); + } + if (content.Contains("CurrentScenarioName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).CurrentScenarioName = (string) content.GetValueForProperty("CurrentScenarioName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).CurrentScenarioName, global::System.Convert.ToString); + } + if (content.Contains("CurrentScenarioJobId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).CurrentScenarioJobId = (string) content.GetValueForProperty("CurrentScenarioJobId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).CurrentScenarioJobId, global::System.Convert.ToString); + } + if (content.Contains("CurrentScenarioStartTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).CurrentScenarioStartTime = (global::System.DateTime?) content.GetValueForProperty("CurrentScenarioStartTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).CurrentScenarioStartTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ReplicationProtectedItem(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProtectedItemPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("CurrentScenario")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).CurrentScenario = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICurrentScenarioDetails) content.GetValueForProperty("CurrentScenario",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).CurrentScenario, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.CurrentScenarioDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettings) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProviderSpecificSettingsTypeConverter.ConvertFrom); + } + if (content.Contains("FriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).FriendlyName = (string) content.GetValueForProperty("FriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).FriendlyName, global::System.Convert.ToString); + } + if (content.Contains("ProtectedItemType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).ProtectedItemType = (string) content.GetValueForProperty("ProtectedItemType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).ProtectedItemType, global::System.Convert.ToString); + } + if (content.Contains("ProtectableItemId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).ProtectableItemId = (string) content.GetValueForProperty("ProtectableItemId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).ProtectableItemId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryServicesProviderId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).RecoveryServicesProviderId = (string) content.GetValueForProperty("RecoveryServicesProviderId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).RecoveryServicesProviderId, global::System.Convert.ToString); + } + if (content.Contains("PrimaryFabricFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).PrimaryFabricFriendlyName = (string) content.GetValueForProperty("PrimaryFabricFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).PrimaryFabricFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("PrimaryFabricProvider")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).PrimaryFabricProvider = (string) content.GetValueForProperty("PrimaryFabricProvider",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).PrimaryFabricProvider, global::System.Convert.ToString); + } + if (content.Contains("RecoveryFabricFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).RecoveryFabricFriendlyName = (string) content.GetValueForProperty("RecoveryFabricFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).RecoveryFabricFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("RecoveryFabricId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).RecoveryFabricId = (string) content.GetValueForProperty("RecoveryFabricId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).RecoveryFabricId, global::System.Convert.ToString); + } + if (content.Contains("PrimaryProtectionContainerFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).PrimaryProtectionContainerFriendlyName = (string) content.GetValueForProperty("PrimaryProtectionContainerFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).PrimaryProtectionContainerFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("RecoveryProtectionContainerFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).RecoveryProtectionContainerFriendlyName = (string) content.GetValueForProperty("RecoveryProtectionContainerFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).RecoveryProtectionContainerFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("ProtectionState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).ProtectionState = (string) content.GetValueForProperty("ProtectionState",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).ProtectionState, global::System.Convert.ToString); + } + if (content.Contains("ProtectionStateDescription")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).ProtectionStateDescription = (string) content.GetValueForProperty("ProtectionStateDescription",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).ProtectionStateDescription, global::System.Convert.ToString); + } + if (content.Contains("ActiveLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).ActiveLocation = (string) content.GetValueForProperty("ActiveLocation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).ActiveLocation, global::System.Convert.ToString); + } + if (content.Contains("TestFailoverState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).TestFailoverState = (string) content.GetValueForProperty("TestFailoverState",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).TestFailoverState, global::System.Convert.ToString); + } + if (content.Contains("TestFailoverStateDescription")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).TestFailoverStateDescription = (string) content.GetValueForProperty("TestFailoverStateDescription",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).TestFailoverStateDescription, global::System.Convert.ToString); + } + if (content.Contains("SwitchProviderState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).SwitchProviderState = (string) content.GetValueForProperty("SwitchProviderState",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).SwitchProviderState, global::System.Convert.ToString); + } + if (content.Contains("SwitchProviderStateDescription")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).SwitchProviderStateDescription = (string) content.GetValueForProperty("SwitchProviderStateDescription",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).SwitchProviderStateDescription, global::System.Convert.ToString); + } + if (content.Contains("AllowedOperation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).AllowedOperation = (string[]) content.GetValueForProperty("AllowedOperation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).AllowedOperation, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("ReplicationHealth")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).ReplicationHealth = (string) content.GetValueForProperty("ReplicationHealth",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).ReplicationHealth, global::System.Convert.ToString); + } + if (content.Contains("FailoverHealth")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).FailoverHealth = (string) content.GetValueForProperty("FailoverHealth",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).FailoverHealth, global::System.Convert.ToString); + } + if (content.Contains("HealthError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).HealthError = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[]) content.GetValueForProperty("HealthError",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).HealthError, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("PolicyId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).PolicyId = (string) content.GetValueForProperty("PolicyId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).PolicyId, global::System.Convert.ToString); + } + if (content.Contains("PolicyFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).PolicyFriendlyName = (string) content.GetValueForProperty("PolicyFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).PolicyFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("LastSuccessfulFailoverTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).LastSuccessfulFailoverTime = (global::System.DateTime?) content.GetValueForProperty("LastSuccessfulFailoverTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).LastSuccessfulFailoverTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("LastSuccessfulTestFailoverTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).LastSuccessfulTestFailoverTime = (global::System.DateTime?) content.GetValueForProperty("LastSuccessfulTestFailoverTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).LastSuccessfulTestFailoverTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("FailoverRecoveryPointId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).FailoverRecoveryPointId = (string) content.GetValueForProperty("FailoverRecoveryPointId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).FailoverRecoveryPointId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryContainerId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).RecoveryContainerId = (string) content.GetValueForProperty("RecoveryContainerId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).RecoveryContainerId, global::System.Convert.ToString); + } + if (content.Contains("EventCorrelationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).EventCorrelationId = (string) content.GetValueForProperty("EventCorrelationId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).EventCorrelationId, global::System.Convert.ToString); + } + if (content.Contains("CurrentScenarioName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).CurrentScenarioName = (string) content.GetValueForProperty("CurrentScenarioName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).CurrentScenarioName, global::System.Convert.ToString); + } + if (content.Contains("CurrentScenarioJobId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).CurrentScenarioJobId = (string) content.GetValueForProperty("CurrentScenarioJobId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).CurrentScenarioJobId, global::System.Convert.ToString); + } + if (content.Contains("CurrentScenarioStartTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).CurrentScenarioStartTime = (global::System.DateTime?) content.GetValueForProperty("CurrentScenarioStartTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).CurrentScenarioStartTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Replication protected item. + [System.ComponentModel.TypeConverter(typeof(ReplicationProtectedItemTypeConverter))] + public partial interface IReplicationProtectedItem + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProtectedItem.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProtectedItem.TypeConverter.cs new file mode 100644 index 000000000000..7a8b5e710caf --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProtectedItem.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ReplicationProtectedItemTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ReplicationProtectedItem.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ReplicationProtectedItem.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ReplicationProtectedItem.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProtectedItem.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProtectedItem.cs new file mode 100644 index 000000000000..82c23a439ffd --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProtectedItem.cs @@ -0,0 +1,557 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Replication protected item. + public partial class ReplicationProtectedItem : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResource __resource = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.Resource(); + + /// The Current active location of the PE. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ActiveLocation { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)Property).ActiveLocation; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)Property).ActiveLocation = value ?? null; } + + /// The allowed operations on the Replication protected item. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string[] AllowedOperation { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)Property).AllowedOperation; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)Property).AllowedOperation = value ?? null /* arrayOf */; } + + /// ARM Id of the job being executed. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string CurrentScenarioJobId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)Property).CurrentScenarioJobId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)Property).CurrentScenarioJobId = value ?? null; } + + /// Scenario name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string CurrentScenarioName { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)Property).CurrentScenarioName; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)Property).CurrentScenarioName = value ?? null; } + + /// Start time of the workflow. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public global::System.DateTime? CurrentScenarioStartTime { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)Property).CurrentScenarioStartTime; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)Property).CurrentScenarioStartTime = value ?? default(global::System.DateTime); } + + /// The correlation Id for events associated with this protected item. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string EventCorrelationId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)Property).EventCorrelationId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)Property).EventCorrelationId = value ?? null; } + + /// The consolidated failover health for the VM. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string FailoverHealth { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)Property).FailoverHealth; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)Property).FailoverHealth = value ?? null; } + + /// The recovery point ARM Id to which the Vm was failed over. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string FailoverRecoveryPointId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)Property).FailoverRecoveryPointId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)Property).FailoverRecoveryPointId = value ?? null; } + + /// The name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string FriendlyName { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)Property).FriendlyName; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)Property).FriendlyName = value ?? null; } + + /// List of health errors. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] HealthError { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)Property).HealthError; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)Property).HealthError = value ?? null /* arrayOf */; } + + /// Resource Id + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Id; } + + /// The Last successful failover time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public global::System.DateTime? LastSuccessfulFailoverTime { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)Property).LastSuccessfulFailoverTime; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)Property).LastSuccessfulFailoverTime = value ?? default(global::System.DateTime); } + + /// The Last successful test failover time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public global::System.DateTime? LastSuccessfulTestFailoverTime { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)Property).LastSuccessfulTestFailoverTime; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)Property).LastSuccessfulTestFailoverTime = value ?? default(global::System.DateTime); } + + /// Resource Location + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string Location { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Location; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Location = value ?? null; } + + /// Internal Acessors for CurrentScenario + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICurrentScenarioDetails Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal.CurrentScenario { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)Property).CurrentScenario; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)Property).CurrentScenario = value; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemProperties Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProtectedItemProperties()); set { {_property = value;} } } + + /// Internal Acessors for ProviderSpecificDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettings Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemInternal.ProviderSpecificDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)Property).ProviderSpecificDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)Property).ProviderSpecificDetail = value; } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Id = value; } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Name = value; } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Type = value; } + + /// Resource Name + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Name; } + + /// The name of Policy governing this PE. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string PolicyFriendlyName { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)Property).PolicyFriendlyName; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)Property).PolicyFriendlyName = value ?? null; } + + /// The ID of Policy governing this PE. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string PolicyId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)Property).PolicyId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)Property).PolicyId = value ?? null; } + + /// The friendly name of the primary fabric. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string PrimaryFabricFriendlyName { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)Property).PrimaryFabricFriendlyName; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)Property).PrimaryFabricFriendlyName = value ?? null; } + + /// The fabric provider of the primary fabric. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string PrimaryFabricProvider { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)Property).PrimaryFabricProvider; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)Property).PrimaryFabricProvider = value ?? null; } + + /// The name of primary protection container friendly name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string PrimaryProtectionContainerFriendlyName { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)Property).PrimaryProtectionContainerFriendlyName; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)Property).PrimaryProtectionContainerFriendlyName = value ?? null; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemProperties _property; + + /// The custom data. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProtectedItemProperties()); set => this._property = value; } + + /// The protected item ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ProtectableItemId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)Property).ProtectableItemId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)Property).ProtectableItemId = value ?? null; } + + /// The type of protected item type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ProtectedItemType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)Property).ProtectedItemType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)Property).ProtectedItemType = value ?? null; } + + /// The protection status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ProtectionState { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)Property).ProtectionState; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)Property).ProtectionState = value ?? null; } + + /// The protection state description. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ProtectionStateDescription { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)Property).ProtectionStateDescription; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)Property).ProtectionStateDescription = value ?? null; } + + /// Gets the Instance type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ProviderSpecificDetailInstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)Property).ProviderSpecificDetailInstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)Property).ProviderSpecificDetailInstanceType = value ?? null; } + + /// The recovery container Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string RecoveryContainerId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)Property).RecoveryContainerId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)Property).RecoveryContainerId = value ?? null; } + + /// The friendly name of recovery fabric. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string RecoveryFabricFriendlyName { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)Property).RecoveryFabricFriendlyName; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)Property).RecoveryFabricFriendlyName = value ?? null; } + + /// The Arm Id of recovery fabric. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string RecoveryFabricId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)Property).RecoveryFabricId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)Property).RecoveryFabricId = value ?? null; } + + /// The name of recovery container friendly name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string RecoveryProtectionContainerFriendlyName { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)Property).RecoveryProtectionContainerFriendlyName; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)Property).RecoveryProtectionContainerFriendlyName = value ?? null; } + + /// The recovery provider ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string RecoveryServicesProviderId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)Property).RecoveryServicesProviderId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)Property).RecoveryServicesProviderId = value ?? null; } + + /// + /// 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. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ReplicationHealth { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)Property).ReplicationHealth; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)Property).ReplicationHealth = value ?? null; } + + /// The switch provider state. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string SwitchProviderState { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)Property).SwitchProviderState; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)Property).SwitchProviderState = value ?? null; } + + /// The switch provider state description. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string SwitchProviderStateDescription { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)Property).SwitchProviderStateDescription; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)Property).SwitchProviderStateDescription = value ?? null; } + + /// The Test failover state. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string TestFailoverState { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)Property).TestFailoverState; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)Property).TestFailoverState = value ?? null; } + + /// The Test failover state description. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string TestFailoverStateDescription { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)Property).TestFailoverStateDescription; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)Property).TestFailoverStateDescription = value ?? null; } + + /// Resource Type + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Type; } + + /// Creates an new instance. + public ReplicationProtectedItem() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__resource), __resource); + await eventListener.AssertObjectIsValid(nameof(__resource), __resource); + } + } + /// Replication protected item. + public partial interface IReplicationProtectedItem : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResource + { + /// The Current active location of the PE. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Current active location of the PE.", + SerializedName = @"activeLocation", + PossibleTypes = new [] { typeof(string) })] + string ActiveLocation { get; set; } + /// The allowed operations on the Replication protected item. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The allowed operations on the Replication protected item.", + SerializedName = @"allowedOperations", + PossibleTypes = new [] { typeof(string) })] + string[] AllowedOperation { get; set; } + /// ARM Id of the job being executed. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"ARM Id of the job being executed.", + SerializedName = @"jobId", + PossibleTypes = new [] { typeof(string) })] + string CurrentScenarioJobId { get; set; } + /// Scenario name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Scenario name.", + SerializedName = @"scenarioName", + PossibleTypes = new [] { typeof(string) })] + string CurrentScenarioName { get; set; } + /// Start time of the workflow. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Start time of the workflow.", + SerializedName = @"startTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? CurrentScenarioStartTime { get; set; } + /// The correlation Id for events associated with this protected item. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The correlation Id for events associated with this protected item.", + SerializedName = @"eventCorrelationId", + PossibleTypes = new [] { typeof(string) })] + string EventCorrelationId { get; set; } + /// The consolidated failover health for the VM. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The consolidated failover health for the VM.", + SerializedName = @"failoverHealth", + PossibleTypes = new [] { typeof(string) })] + string FailoverHealth { get; set; } + /// The recovery point ARM Id to which the Vm was failed over. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery point ARM Id to which the Vm was failed over.", + SerializedName = @"failoverRecoveryPointId", + PossibleTypes = new [] { typeof(string) })] + string FailoverRecoveryPointId { get; set; } + /// The name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name.", + SerializedName = @"friendlyName", + PossibleTypes = new [] { typeof(string) })] + string FriendlyName { get; set; } + /// List of health errors. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"List of health errors.", + SerializedName = @"healthErrors", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] HealthError { get; set; } + /// The Last successful failover time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Last successful failover time.", + SerializedName = @"lastSuccessfulFailoverTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? LastSuccessfulFailoverTime { get; set; } + /// The Last successful test failover time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Last successful test failover time.", + SerializedName = @"lastSuccessfulTestFailoverTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? LastSuccessfulTestFailoverTime { get; set; } + /// The name of Policy governing this PE. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of Policy governing this PE.", + SerializedName = @"policyFriendlyName", + PossibleTypes = new [] { typeof(string) })] + string PolicyFriendlyName { get; set; } + /// The ID of Policy governing this PE. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The ID of Policy governing this PE.", + SerializedName = @"policyId", + PossibleTypes = new [] { typeof(string) })] + string PolicyId { get; set; } + /// The friendly name of the primary fabric. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The friendly name of the primary fabric.", + SerializedName = @"primaryFabricFriendlyName", + PossibleTypes = new [] { typeof(string) })] + string PrimaryFabricFriendlyName { get; set; } + /// The fabric provider of the primary fabric. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The fabric provider of the primary fabric.", + SerializedName = @"primaryFabricProvider", + PossibleTypes = new [] { typeof(string) })] + string PrimaryFabricProvider { get; set; } + /// The name of primary protection container friendly name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of primary protection container friendly name.", + SerializedName = @"primaryProtectionContainerFriendlyName", + PossibleTypes = new [] { typeof(string) })] + string PrimaryProtectionContainerFriendlyName { get; set; } + /// The protected item ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The protected item ARM Id.", + SerializedName = @"protectableItemId", + PossibleTypes = new [] { typeof(string) })] + string ProtectableItemId { get; set; } + /// The type of protected item type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The type of protected item type.", + SerializedName = @"protectedItemType", + PossibleTypes = new [] { typeof(string) })] + string ProtectedItemType { get; set; } + /// The protection status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The protection status.", + SerializedName = @"protectionState", + PossibleTypes = new [] { typeof(string) })] + string ProtectionState { get; set; } + /// The protection state description. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The protection state description.", + SerializedName = @"protectionStateDescription", + PossibleTypes = new [] { typeof(string) })] + string ProtectionStateDescription { get; set; } + /// Gets the Instance type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets the Instance type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string ProviderSpecificDetailInstanceType { get; set; } + /// The recovery container Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery container Id.", + SerializedName = @"recoveryContainerId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryContainerId { get; set; } + /// The friendly name of recovery fabric. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The friendly name of recovery fabric.", + SerializedName = @"recoveryFabricFriendlyName", + PossibleTypes = new [] { typeof(string) })] + string RecoveryFabricFriendlyName { get; set; } + /// The Arm Id of recovery fabric. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Arm Id of recovery fabric.", + SerializedName = @"recoveryFabricId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryFabricId { get; set; } + /// The name of recovery container friendly name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of recovery container friendly name.", + SerializedName = @"recoveryProtectionContainerFriendlyName", + PossibleTypes = new [] { typeof(string) })] + string RecoveryProtectionContainerFriendlyName { get; set; } + /// The recovery provider ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery provider ARM Id.", + SerializedName = @"recoveryServicesProviderId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryServicesProviderId { get; set; } + /// + /// 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. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"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.", + SerializedName = @"replicationHealth", + PossibleTypes = new [] { typeof(string) })] + string ReplicationHealth { get; set; } + /// The switch provider state. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The switch provider state.", + SerializedName = @"switchProviderState", + PossibleTypes = new [] { typeof(string) })] + string SwitchProviderState { get; set; } + /// The switch provider state description. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The switch provider state description.", + SerializedName = @"switchProviderStateDescription", + PossibleTypes = new [] { typeof(string) })] + string SwitchProviderStateDescription { get; set; } + /// The Test failover state. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Test failover state.", + SerializedName = @"testFailoverState", + PossibleTypes = new [] { typeof(string) })] + string TestFailoverState { get; set; } + /// The Test failover state description. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Test failover state description.", + SerializedName = @"testFailoverStateDescription", + PossibleTypes = new [] { typeof(string) })] + string TestFailoverStateDescription { get; set; } + + } + /// Replication protected item. + internal partial interface IReplicationProtectedItemInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal + { + /// The Current active location of the PE. + string ActiveLocation { get; set; } + /// The allowed operations on the Replication protected item. + string[] AllowedOperation { get; set; } + /// The current scenario. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICurrentScenarioDetails CurrentScenario { get; set; } + /// ARM Id of the job being executed. + string CurrentScenarioJobId { get; set; } + /// Scenario name. + string CurrentScenarioName { get; set; } + /// Start time of the workflow. + global::System.DateTime? CurrentScenarioStartTime { get; set; } + /// The correlation Id for events associated with this protected item. + string EventCorrelationId { get; set; } + /// The consolidated failover health for the VM. + string FailoverHealth { get; set; } + /// The recovery point ARM Id to which the Vm was failed over. + string FailoverRecoveryPointId { get; set; } + /// The name. + string FriendlyName { get; set; } + /// List of health errors. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] HealthError { get; set; } + /// The Last successful failover time. + global::System.DateTime? LastSuccessfulFailoverTime { get; set; } + /// The Last successful test failover time. + global::System.DateTime? LastSuccessfulTestFailoverTime { get; set; } + /// The name of Policy governing this PE. + string PolicyFriendlyName { get; set; } + /// The ID of Policy governing this PE. + string PolicyId { get; set; } + /// The friendly name of the primary fabric. + string PrimaryFabricFriendlyName { get; set; } + /// The fabric provider of the primary fabric. + string PrimaryFabricProvider { get; set; } + /// The name of primary protection container friendly name. + string PrimaryProtectionContainerFriendlyName { get; set; } + /// The custom data. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemProperties Property { get; set; } + /// The protected item ARM Id. + string ProtectableItemId { get; set; } + /// The type of protected item type. + string ProtectedItemType { get; set; } + /// The protection status. + string ProtectionState { get; set; } + /// The protection state description. + string ProtectionStateDescription { get; set; } + /// The Replication provider custom settings. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettings ProviderSpecificDetail { get; set; } + /// Gets the Instance type. + string ProviderSpecificDetailInstanceType { get; set; } + /// The recovery container Id. + string RecoveryContainerId { get; set; } + /// The friendly name of recovery fabric. + string RecoveryFabricFriendlyName { get; set; } + /// The Arm Id of recovery fabric. + string RecoveryFabricId { get; set; } + /// The name of recovery container friendly name. + string RecoveryProtectionContainerFriendlyName { get; set; } + /// The recovery provider ARM Id. + string RecoveryServicesProviderId { get; set; } + /// + /// 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. + /// + string ReplicationHealth { get; set; } + /// The switch provider state. + string SwitchProviderState { get; set; } + /// The switch provider state description. + string SwitchProviderStateDescription { get; set; } + /// The Test failover state. + string TestFailoverState { get; set; } + /// The Test failover state description. + string TestFailoverStateDescription { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProtectedItem.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProtectedItem.json.cs new file mode 100644 index 000000000000..02b318d9a2fa --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProtectedItem.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Replication protected item. + public partial class ReplicationProtectedItem + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new ReplicationProtectedItem(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal ReplicationProtectedItem(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __resource = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.Resource(json); + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProtectedItemProperties.FromJson(__jsonProperties) : Property;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __resource?.ToJson(container, serializationMode); + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProtectedItemCollection.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProtectedItemCollection.PowerShell.cs new file mode 100644 index 000000000000..092e5f7c76f9 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProtectedItemCollection.PowerShell.cs @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Replication protected item collection. + [System.ComponentModel.TypeConverter(typeof(ReplicationProtectedItemCollectionTypeConverter))] + public partial class ReplicationProtectedItemCollection + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemCollection DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ReplicationProtectedItemCollection(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemCollection DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ReplicationProtectedItemCollection(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemCollection FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ReplicationProtectedItemCollection(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProtectedItemTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemCollectionInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemCollectionInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ReplicationProtectedItemCollection(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProtectedItemTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemCollectionInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemCollectionInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Replication protected item collection. + [System.ComponentModel.TypeConverter(typeof(ReplicationProtectedItemCollectionTypeConverter))] + public partial interface IReplicationProtectedItemCollection + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProtectedItemCollection.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProtectedItemCollection.TypeConverter.cs new file mode 100644 index 000000000000..84896b4b2ee5 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProtectedItemCollection.TypeConverter.cs @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ReplicationProtectedItemCollectionTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemCollection ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemCollection).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ReplicationProtectedItemCollection.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ReplicationProtectedItemCollection.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ReplicationProtectedItemCollection.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProtectedItemCollection.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProtectedItemCollection.cs new file mode 100644 index 000000000000..dd10fda68b59 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProtectedItemCollection.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Replication protected item collection. + public partial class ReplicationProtectedItemCollection : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemCollection, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemCollectionInternal + { + + /// Backing field for property. + private string _nextLink; + + /// The value of next link. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string NextLink { get => this._nextLink; set => this._nextLink = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem[] _value; + + /// The Replication protected item details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem[] Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public ReplicationProtectedItemCollection() + { + + } + } + /// Replication protected item collection. + public partial interface IReplicationProtectedItemCollection : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The value of next link. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The value of next link.", + SerializedName = @"nextLink", + PossibleTypes = new [] { typeof(string) })] + string NextLink { get; set; } + /// The Replication protected item details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Replication protected item details.", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem[] Value { get; set; } + + } + /// Replication protected item collection. + internal partial interface IReplicationProtectedItemCollectionInternal + + { + /// The value of next link. + string NextLink { get; set; } + /// The Replication protected item details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem[] Value { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProtectedItemCollection.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProtectedItemCollection.json.cs new file mode 100644 index 000000000000..9deede920b44 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProtectedItemCollection.json.cs @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Replication protected item collection. + public partial class ReplicationProtectedItemCollection + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemCollection. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemCollection. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemCollection FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new ReplicationProtectedItemCollection(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal ReplicationProtectedItemCollection(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProtectedItem.FromJson(__u) )) ))() : null : Value;} + {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)NextLink;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._value) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._value ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("value",__w); + } + AddIf( null != (((object)this._nextLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProtectedItemProperties.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProtectedItemProperties.PowerShell.cs new file mode 100644 index 000000000000..2f55666da6c2 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProtectedItemProperties.PowerShell.cs @@ -0,0 +1,412 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Replication protected item custom data details. + [System.ComponentModel.TypeConverter(typeof(ReplicationProtectedItemPropertiesTypeConverter))] + public partial class ReplicationProtectedItemProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ReplicationProtectedItemProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ReplicationProtectedItemProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ReplicationProtectedItemProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CurrentScenario")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).CurrentScenario = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICurrentScenarioDetails) content.GetValueForProperty("CurrentScenario",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).CurrentScenario, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.CurrentScenarioDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettings) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProviderSpecificSettingsTypeConverter.ConvertFrom); + } + if (content.Contains("FriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).FriendlyName = (string) content.GetValueForProperty("FriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).FriendlyName, global::System.Convert.ToString); + } + if (content.Contains("ProtectedItemType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).ProtectedItemType = (string) content.GetValueForProperty("ProtectedItemType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).ProtectedItemType, global::System.Convert.ToString); + } + if (content.Contains("ProtectableItemId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).ProtectableItemId = (string) content.GetValueForProperty("ProtectableItemId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).ProtectableItemId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryServicesProviderId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).RecoveryServicesProviderId = (string) content.GetValueForProperty("RecoveryServicesProviderId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).RecoveryServicesProviderId, global::System.Convert.ToString); + } + if (content.Contains("PrimaryFabricFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).PrimaryFabricFriendlyName = (string) content.GetValueForProperty("PrimaryFabricFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).PrimaryFabricFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("PrimaryFabricProvider")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).PrimaryFabricProvider = (string) content.GetValueForProperty("PrimaryFabricProvider",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).PrimaryFabricProvider, global::System.Convert.ToString); + } + if (content.Contains("RecoveryFabricFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).RecoveryFabricFriendlyName = (string) content.GetValueForProperty("RecoveryFabricFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).RecoveryFabricFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("RecoveryFabricId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).RecoveryFabricId = (string) content.GetValueForProperty("RecoveryFabricId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).RecoveryFabricId, global::System.Convert.ToString); + } + if (content.Contains("PrimaryProtectionContainerFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).PrimaryProtectionContainerFriendlyName = (string) content.GetValueForProperty("PrimaryProtectionContainerFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).PrimaryProtectionContainerFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("RecoveryProtectionContainerFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).RecoveryProtectionContainerFriendlyName = (string) content.GetValueForProperty("RecoveryProtectionContainerFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).RecoveryProtectionContainerFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("ProtectionState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).ProtectionState = (string) content.GetValueForProperty("ProtectionState",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).ProtectionState, global::System.Convert.ToString); + } + if (content.Contains("ProtectionStateDescription")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).ProtectionStateDescription = (string) content.GetValueForProperty("ProtectionStateDescription",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).ProtectionStateDescription, global::System.Convert.ToString); + } + if (content.Contains("ActiveLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).ActiveLocation = (string) content.GetValueForProperty("ActiveLocation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).ActiveLocation, global::System.Convert.ToString); + } + if (content.Contains("TestFailoverState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).TestFailoverState = (string) content.GetValueForProperty("TestFailoverState",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).TestFailoverState, global::System.Convert.ToString); + } + if (content.Contains("TestFailoverStateDescription")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).TestFailoverStateDescription = (string) content.GetValueForProperty("TestFailoverStateDescription",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).TestFailoverStateDescription, global::System.Convert.ToString); + } + if (content.Contains("SwitchProviderState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).SwitchProviderState = (string) content.GetValueForProperty("SwitchProviderState",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).SwitchProviderState, global::System.Convert.ToString); + } + if (content.Contains("SwitchProviderStateDescription")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).SwitchProviderStateDescription = (string) content.GetValueForProperty("SwitchProviderStateDescription",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).SwitchProviderStateDescription, global::System.Convert.ToString); + } + if (content.Contains("AllowedOperation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).AllowedOperation = (string[]) content.GetValueForProperty("AllowedOperation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).AllowedOperation, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("ReplicationHealth")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).ReplicationHealth = (string) content.GetValueForProperty("ReplicationHealth",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).ReplicationHealth, global::System.Convert.ToString); + } + if (content.Contains("FailoverHealth")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).FailoverHealth = (string) content.GetValueForProperty("FailoverHealth",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).FailoverHealth, global::System.Convert.ToString); + } + if (content.Contains("HealthError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).HealthError = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[]) content.GetValueForProperty("HealthError",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).HealthError, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("PolicyId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).PolicyId = (string) content.GetValueForProperty("PolicyId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).PolicyId, global::System.Convert.ToString); + } + if (content.Contains("PolicyFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).PolicyFriendlyName = (string) content.GetValueForProperty("PolicyFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).PolicyFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("LastSuccessfulFailoverTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).LastSuccessfulFailoverTime = (global::System.DateTime?) content.GetValueForProperty("LastSuccessfulFailoverTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).LastSuccessfulFailoverTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("LastSuccessfulTestFailoverTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).LastSuccessfulTestFailoverTime = (global::System.DateTime?) content.GetValueForProperty("LastSuccessfulTestFailoverTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).LastSuccessfulTestFailoverTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("FailoverRecoveryPointId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).FailoverRecoveryPointId = (string) content.GetValueForProperty("FailoverRecoveryPointId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).FailoverRecoveryPointId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryContainerId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).RecoveryContainerId = (string) content.GetValueForProperty("RecoveryContainerId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).RecoveryContainerId, global::System.Convert.ToString); + } + if (content.Contains("EventCorrelationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).EventCorrelationId = (string) content.GetValueForProperty("EventCorrelationId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).EventCorrelationId, global::System.Convert.ToString); + } + if (content.Contains("CurrentScenarioName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).CurrentScenarioName = (string) content.GetValueForProperty("CurrentScenarioName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).CurrentScenarioName, global::System.Convert.ToString); + } + if (content.Contains("CurrentScenarioJobId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).CurrentScenarioJobId = (string) content.GetValueForProperty("CurrentScenarioJobId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).CurrentScenarioJobId, global::System.Convert.ToString); + } + if (content.Contains("CurrentScenarioStartTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).CurrentScenarioStartTime = (global::System.DateTime?) content.GetValueForProperty("CurrentScenarioStartTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).CurrentScenarioStartTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ReplicationProtectedItemProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CurrentScenario")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).CurrentScenario = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICurrentScenarioDetails) content.GetValueForProperty("CurrentScenario",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).CurrentScenario, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.CurrentScenarioDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettings) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProviderSpecificSettingsTypeConverter.ConvertFrom); + } + if (content.Contains("FriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).FriendlyName = (string) content.GetValueForProperty("FriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).FriendlyName, global::System.Convert.ToString); + } + if (content.Contains("ProtectedItemType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).ProtectedItemType = (string) content.GetValueForProperty("ProtectedItemType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).ProtectedItemType, global::System.Convert.ToString); + } + if (content.Contains("ProtectableItemId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).ProtectableItemId = (string) content.GetValueForProperty("ProtectableItemId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).ProtectableItemId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryServicesProviderId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).RecoveryServicesProviderId = (string) content.GetValueForProperty("RecoveryServicesProviderId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).RecoveryServicesProviderId, global::System.Convert.ToString); + } + if (content.Contains("PrimaryFabricFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).PrimaryFabricFriendlyName = (string) content.GetValueForProperty("PrimaryFabricFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).PrimaryFabricFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("PrimaryFabricProvider")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).PrimaryFabricProvider = (string) content.GetValueForProperty("PrimaryFabricProvider",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).PrimaryFabricProvider, global::System.Convert.ToString); + } + if (content.Contains("RecoveryFabricFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).RecoveryFabricFriendlyName = (string) content.GetValueForProperty("RecoveryFabricFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).RecoveryFabricFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("RecoveryFabricId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).RecoveryFabricId = (string) content.GetValueForProperty("RecoveryFabricId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).RecoveryFabricId, global::System.Convert.ToString); + } + if (content.Contains("PrimaryProtectionContainerFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).PrimaryProtectionContainerFriendlyName = (string) content.GetValueForProperty("PrimaryProtectionContainerFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).PrimaryProtectionContainerFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("RecoveryProtectionContainerFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).RecoveryProtectionContainerFriendlyName = (string) content.GetValueForProperty("RecoveryProtectionContainerFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).RecoveryProtectionContainerFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("ProtectionState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).ProtectionState = (string) content.GetValueForProperty("ProtectionState",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).ProtectionState, global::System.Convert.ToString); + } + if (content.Contains("ProtectionStateDescription")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).ProtectionStateDescription = (string) content.GetValueForProperty("ProtectionStateDescription",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).ProtectionStateDescription, global::System.Convert.ToString); + } + if (content.Contains("ActiveLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).ActiveLocation = (string) content.GetValueForProperty("ActiveLocation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).ActiveLocation, global::System.Convert.ToString); + } + if (content.Contains("TestFailoverState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).TestFailoverState = (string) content.GetValueForProperty("TestFailoverState",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).TestFailoverState, global::System.Convert.ToString); + } + if (content.Contains("TestFailoverStateDescription")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).TestFailoverStateDescription = (string) content.GetValueForProperty("TestFailoverStateDescription",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).TestFailoverStateDescription, global::System.Convert.ToString); + } + if (content.Contains("SwitchProviderState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).SwitchProviderState = (string) content.GetValueForProperty("SwitchProviderState",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).SwitchProviderState, global::System.Convert.ToString); + } + if (content.Contains("SwitchProviderStateDescription")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).SwitchProviderStateDescription = (string) content.GetValueForProperty("SwitchProviderStateDescription",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).SwitchProviderStateDescription, global::System.Convert.ToString); + } + if (content.Contains("AllowedOperation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).AllowedOperation = (string[]) content.GetValueForProperty("AllowedOperation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).AllowedOperation, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("ReplicationHealth")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).ReplicationHealth = (string) content.GetValueForProperty("ReplicationHealth",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).ReplicationHealth, global::System.Convert.ToString); + } + if (content.Contains("FailoverHealth")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).FailoverHealth = (string) content.GetValueForProperty("FailoverHealth",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).FailoverHealth, global::System.Convert.ToString); + } + if (content.Contains("HealthError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).HealthError = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[]) content.GetValueForProperty("HealthError",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).HealthError, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("PolicyId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).PolicyId = (string) content.GetValueForProperty("PolicyId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).PolicyId, global::System.Convert.ToString); + } + if (content.Contains("PolicyFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).PolicyFriendlyName = (string) content.GetValueForProperty("PolicyFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).PolicyFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("LastSuccessfulFailoverTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).LastSuccessfulFailoverTime = (global::System.DateTime?) content.GetValueForProperty("LastSuccessfulFailoverTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).LastSuccessfulFailoverTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("LastSuccessfulTestFailoverTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).LastSuccessfulTestFailoverTime = (global::System.DateTime?) content.GetValueForProperty("LastSuccessfulTestFailoverTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).LastSuccessfulTestFailoverTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("FailoverRecoveryPointId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).FailoverRecoveryPointId = (string) content.GetValueForProperty("FailoverRecoveryPointId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).FailoverRecoveryPointId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryContainerId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).RecoveryContainerId = (string) content.GetValueForProperty("RecoveryContainerId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).RecoveryContainerId, global::System.Convert.ToString); + } + if (content.Contains("EventCorrelationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).EventCorrelationId = (string) content.GetValueForProperty("EventCorrelationId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).EventCorrelationId, global::System.Convert.ToString); + } + if (content.Contains("CurrentScenarioName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).CurrentScenarioName = (string) content.GetValueForProperty("CurrentScenarioName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).CurrentScenarioName, global::System.Convert.ToString); + } + if (content.Contains("CurrentScenarioJobId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).CurrentScenarioJobId = (string) content.GetValueForProperty("CurrentScenarioJobId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).CurrentScenarioJobId, global::System.Convert.ToString); + } + if (content.Contains("CurrentScenarioStartTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).CurrentScenarioStartTime = (global::System.DateTime?) content.GetValueForProperty("CurrentScenarioStartTime",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).CurrentScenarioStartTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Replication protected item custom data details. + [System.ComponentModel.TypeConverter(typeof(ReplicationProtectedItemPropertiesTypeConverter))] + public partial interface IReplicationProtectedItemProperties + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProtectedItemProperties.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProtectedItemProperties.TypeConverter.cs new file mode 100644 index 000000000000..d271536ff199 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProtectedItemProperties.TypeConverter.cs @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ReplicationProtectedItemPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ReplicationProtectedItemProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ReplicationProtectedItemProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ReplicationProtectedItemProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProtectedItemProperties.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProtectedItemProperties.cs new file mode 100644 index 000000000000..385b7fa54636 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProtectedItemProperties.cs @@ -0,0 +1,603 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Replication protected item custom data details. + public partial class ReplicationProtectedItemProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemProperties, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal + { + + /// Backing field for property. + private string _activeLocation; + + /// The Current active location of the PE. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ActiveLocation { get => this._activeLocation; set => this._activeLocation = value; } + + /// Backing field for property. + private string[] _allowedOperation; + + /// The allowed operations on the Replication protected item. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string[] AllowedOperation { get => this._allowedOperation; set => this._allowedOperation = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICurrentScenarioDetails _currentScenario; + + /// The current scenario. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICurrentScenarioDetails CurrentScenario { get => (this._currentScenario = this._currentScenario ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.CurrentScenarioDetails()); set => this._currentScenario = value; } + + /// ARM Id of the job being executed. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string CurrentScenarioJobId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICurrentScenarioDetailsInternal)CurrentScenario).JobId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICurrentScenarioDetailsInternal)CurrentScenario).JobId = value ?? null; } + + /// Scenario name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string CurrentScenarioName { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICurrentScenarioDetailsInternal)CurrentScenario).ScenarioName; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICurrentScenarioDetailsInternal)CurrentScenario).ScenarioName = value ?? null; } + + /// Start time of the workflow. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public global::System.DateTime? CurrentScenarioStartTime { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICurrentScenarioDetailsInternal)CurrentScenario).StartTime; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICurrentScenarioDetailsInternal)CurrentScenario).StartTime = value ?? default(global::System.DateTime); } + + /// Backing field for property. + private string _eventCorrelationId; + + /// The correlation Id for events associated with this protected item. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string EventCorrelationId { get => this._eventCorrelationId; set => this._eventCorrelationId = value; } + + /// Backing field for property. + private string _failoverHealth; + + /// The consolidated failover health for the VM. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string FailoverHealth { get => this._failoverHealth; set => this._failoverHealth = value; } + + /// Backing field for property. + private string _failoverRecoveryPointId; + + /// The recovery point ARM Id to which the Vm was failed over. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string FailoverRecoveryPointId { get => this._failoverRecoveryPointId; set => this._failoverRecoveryPointId = value; } + + /// Backing field for property. + private string _friendlyName; + + /// The name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string FriendlyName { get => this._friendlyName; set => this._friendlyName = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] _healthError; + + /// List of health errors. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] HealthError { get => this._healthError; set => this._healthError = value; } + + /// Backing field for property. + private global::System.DateTime? _lastSuccessfulFailoverTime; + + /// The Last successful failover time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public global::System.DateTime? LastSuccessfulFailoverTime { get => this._lastSuccessfulFailoverTime; set => this._lastSuccessfulFailoverTime = value; } + + /// Backing field for property. + private global::System.DateTime? _lastSuccessfulTestFailoverTime; + + /// The Last successful test failover time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public global::System.DateTime? LastSuccessfulTestFailoverTime { get => this._lastSuccessfulTestFailoverTime; set => this._lastSuccessfulTestFailoverTime = value; } + + /// Internal Acessors for CurrentScenario + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICurrentScenarioDetails Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal.CurrentScenario { get => (this._currentScenario = this._currentScenario ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.CurrentScenarioDetails()); set { {_currentScenario = value;} } } + + /// Internal Acessors for ProviderSpecificDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettings Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemPropertiesInternal.ProviderSpecificDetail { get => (this._providerSpecificDetail = this._providerSpecificDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProviderSpecificSettings()); set { {_providerSpecificDetail = value;} } } + + /// Backing field for property. + private string _policyFriendlyName; + + /// The name of Policy governing this PE. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string PolicyFriendlyName { get => this._policyFriendlyName; set => this._policyFriendlyName = value; } + + /// Backing field for property. + private string _policyId; + + /// The ID of Policy governing this PE. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string PolicyId { get => this._policyId; set => this._policyId = value; } + + /// Backing field for property. + private string _primaryFabricFriendlyName; + + /// The friendly name of the primary fabric. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string PrimaryFabricFriendlyName { get => this._primaryFabricFriendlyName; set => this._primaryFabricFriendlyName = value; } + + /// Backing field for property. + private string _primaryFabricProvider; + + /// The fabric provider of the primary fabric. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string PrimaryFabricProvider { get => this._primaryFabricProvider; set => this._primaryFabricProvider = value; } + + /// + /// Backing field for property. + /// + private string _primaryProtectionContainerFriendlyName; + + /// The name of primary protection container friendly name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string PrimaryProtectionContainerFriendlyName { get => this._primaryProtectionContainerFriendlyName; set => this._primaryProtectionContainerFriendlyName = value; } + + /// Backing field for property. + private string _protectableItemId; + + /// The protected item ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ProtectableItemId { get => this._protectableItemId; set => this._protectableItemId = value; } + + /// Backing field for property. + private string _protectedItemType; + + /// The type of protected item type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ProtectedItemType { get => this._protectedItemType; set => this._protectedItemType = value; } + + /// Backing field for property. + private string _protectionState; + + /// The protection status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ProtectionState { get => this._protectionState; set => this._protectionState = value; } + + /// Backing field for property. + private string _protectionStateDescription; + + /// The protection state description. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ProtectionStateDescription { get => this._protectionStateDescription; set => this._protectionStateDescription = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettings _providerSpecificDetail; + + /// The Replication provider custom settings. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettings ProviderSpecificDetail { get => (this._providerSpecificDetail = this._providerSpecificDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProviderSpecificSettings()); set => this._providerSpecificDetail = value; } + + /// Gets the Instance type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ProviderSpecificDetailInstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettingsInternal)ProviderSpecificDetail).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettingsInternal)ProviderSpecificDetail).InstanceType = value ?? null; } + + /// Backing field for property. + private string _recoveryContainerId; + + /// The recovery container Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryContainerId { get => this._recoveryContainerId; set => this._recoveryContainerId = value; } + + /// Backing field for property. + private string _recoveryFabricFriendlyName; + + /// The friendly name of recovery fabric. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryFabricFriendlyName { get => this._recoveryFabricFriendlyName; set => this._recoveryFabricFriendlyName = value; } + + /// Backing field for property. + private string _recoveryFabricId; + + /// The Arm Id of recovery fabric. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryFabricId { get => this._recoveryFabricId; set => this._recoveryFabricId = value; } + + /// + /// Backing field for property. + /// + private string _recoveryProtectionContainerFriendlyName; + + /// The name of recovery container friendly name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryProtectionContainerFriendlyName { get => this._recoveryProtectionContainerFriendlyName; set => this._recoveryProtectionContainerFriendlyName = value; } + + /// Backing field for property. + private string _recoveryServicesProviderId; + + /// The recovery provider ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryServicesProviderId { get => this._recoveryServicesProviderId; set => this._recoveryServicesProviderId = value; } + + /// Backing field for property. + private string _replicationHealth; + + /// + /// 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. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ReplicationHealth { get => this._replicationHealth; set => this._replicationHealth = value; } + + /// Backing field for property. + private string _switchProviderState; + + /// The switch provider state. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string SwitchProviderState { get => this._switchProviderState; set => this._switchProviderState = value; } + + /// Backing field for property. + private string _switchProviderStateDescription; + + /// The switch provider state description. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string SwitchProviderStateDescription { get => this._switchProviderStateDescription; set => this._switchProviderStateDescription = value; } + + /// Backing field for property. + private string _testFailoverState; + + /// The Test failover state. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TestFailoverState { get => this._testFailoverState; set => this._testFailoverState = value; } + + /// Backing field for property. + private string _testFailoverStateDescription; + + /// The Test failover state description. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TestFailoverStateDescription { get => this._testFailoverStateDescription; set => this._testFailoverStateDescription = value; } + + /// Creates an new instance. + public ReplicationProtectedItemProperties() + { + + } + } + /// Replication protected item custom data details. + public partial interface IReplicationProtectedItemProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The Current active location of the PE. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Current active location of the PE.", + SerializedName = @"activeLocation", + PossibleTypes = new [] { typeof(string) })] + string ActiveLocation { get; set; } + /// The allowed operations on the Replication protected item. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The allowed operations on the Replication protected item.", + SerializedName = @"allowedOperations", + PossibleTypes = new [] { typeof(string) })] + string[] AllowedOperation { get; set; } + /// ARM Id of the job being executed. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"ARM Id of the job being executed.", + SerializedName = @"jobId", + PossibleTypes = new [] { typeof(string) })] + string CurrentScenarioJobId { get; set; } + /// Scenario name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Scenario name.", + SerializedName = @"scenarioName", + PossibleTypes = new [] { typeof(string) })] + string CurrentScenarioName { get; set; } + /// Start time of the workflow. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Start time of the workflow.", + SerializedName = @"startTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? CurrentScenarioStartTime { get; set; } + /// The correlation Id for events associated with this protected item. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The correlation Id for events associated with this protected item.", + SerializedName = @"eventCorrelationId", + PossibleTypes = new [] { typeof(string) })] + string EventCorrelationId { get; set; } + /// The consolidated failover health for the VM. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The consolidated failover health for the VM.", + SerializedName = @"failoverHealth", + PossibleTypes = new [] { typeof(string) })] + string FailoverHealth { get; set; } + /// The recovery point ARM Id to which the Vm was failed over. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery point ARM Id to which the Vm was failed over.", + SerializedName = @"failoverRecoveryPointId", + PossibleTypes = new [] { typeof(string) })] + string FailoverRecoveryPointId { get; set; } + /// The name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name.", + SerializedName = @"friendlyName", + PossibleTypes = new [] { typeof(string) })] + string FriendlyName { get; set; } + /// List of health errors. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"List of health errors.", + SerializedName = @"healthErrors", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] HealthError { get; set; } + /// The Last successful failover time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Last successful failover time.", + SerializedName = @"lastSuccessfulFailoverTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? LastSuccessfulFailoverTime { get; set; } + /// The Last successful test failover time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Last successful test failover time.", + SerializedName = @"lastSuccessfulTestFailoverTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? LastSuccessfulTestFailoverTime { get; set; } + /// The name of Policy governing this PE. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of Policy governing this PE.", + SerializedName = @"policyFriendlyName", + PossibleTypes = new [] { typeof(string) })] + string PolicyFriendlyName { get; set; } + /// The ID of Policy governing this PE. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The ID of Policy governing this PE.", + SerializedName = @"policyId", + PossibleTypes = new [] { typeof(string) })] + string PolicyId { get; set; } + /// The friendly name of the primary fabric. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The friendly name of the primary fabric.", + SerializedName = @"primaryFabricFriendlyName", + PossibleTypes = new [] { typeof(string) })] + string PrimaryFabricFriendlyName { get; set; } + /// The fabric provider of the primary fabric. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The fabric provider of the primary fabric.", + SerializedName = @"primaryFabricProvider", + PossibleTypes = new [] { typeof(string) })] + string PrimaryFabricProvider { get; set; } + /// The name of primary protection container friendly name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of primary protection container friendly name.", + SerializedName = @"primaryProtectionContainerFriendlyName", + PossibleTypes = new [] { typeof(string) })] + string PrimaryProtectionContainerFriendlyName { get; set; } + /// The protected item ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The protected item ARM Id.", + SerializedName = @"protectableItemId", + PossibleTypes = new [] { typeof(string) })] + string ProtectableItemId { get; set; } + /// The type of protected item type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The type of protected item type.", + SerializedName = @"protectedItemType", + PossibleTypes = new [] { typeof(string) })] + string ProtectedItemType { get; set; } + /// The protection status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The protection status.", + SerializedName = @"protectionState", + PossibleTypes = new [] { typeof(string) })] + string ProtectionState { get; set; } + /// The protection state description. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The protection state description.", + SerializedName = @"protectionStateDescription", + PossibleTypes = new [] { typeof(string) })] + string ProtectionStateDescription { get; set; } + /// Gets the Instance type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets the Instance type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string ProviderSpecificDetailInstanceType { get; set; } + /// The recovery container Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery container Id.", + SerializedName = @"recoveryContainerId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryContainerId { get; set; } + /// The friendly name of recovery fabric. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The friendly name of recovery fabric.", + SerializedName = @"recoveryFabricFriendlyName", + PossibleTypes = new [] { typeof(string) })] + string RecoveryFabricFriendlyName { get; set; } + /// The Arm Id of recovery fabric. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Arm Id of recovery fabric.", + SerializedName = @"recoveryFabricId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryFabricId { get; set; } + /// The name of recovery container friendly name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of recovery container friendly name.", + SerializedName = @"recoveryProtectionContainerFriendlyName", + PossibleTypes = new [] { typeof(string) })] + string RecoveryProtectionContainerFriendlyName { get; set; } + /// The recovery provider ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery provider ARM Id.", + SerializedName = @"recoveryServicesProviderId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryServicesProviderId { get; set; } + /// + /// 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. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"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.", + SerializedName = @"replicationHealth", + PossibleTypes = new [] { typeof(string) })] + string ReplicationHealth { get; set; } + /// The switch provider state. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The switch provider state.", + SerializedName = @"switchProviderState", + PossibleTypes = new [] { typeof(string) })] + string SwitchProviderState { get; set; } + /// The switch provider state description. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The switch provider state description.", + SerializedName = @"switchProviderStateDescription", + PossibleTypes = new [] { typeof(string) })] + string SwitchProviderStateDescription { get; set; } + /// The Test failover state. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Test failover state.", + SerializedName = @"testFailoverState", + PossibleTypes = new [] { typeof(string) })] + string TestFailoverState { get; set; } + /// The Test failover state description. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Test failover state description.", + SerializedName = @"testFailoverStateDescription", + PossibleTypes = new [] { typeof(string) })] + string TestFailoverStateDescription { get; set; } + + } + /// Replication protected item custom data details. + internal partial interface IReplicationProtectedItemPropertiesInternal + + { + /// The Current active location of the PE. + string ActiveLocation { get; set; } + /// The allowed operations on the Replication protected item. + string[] AllowedOperation { get; set; } + /// The current scenario. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICurrentScenarioDetails CurrentScenario { get; set; } + /// ARM Id of the job being executed. + string CurrentScenarioJobId { get; set; } + /// Scenario name. + string CurrentScenarioName { get; set; } + /// Start time of the workflow. + global::System.DateTime? CurrentScenarioStartTime { get; set; } + /// The correlation Id for events associated with this protected item. + string EventCorrelationId { get; set; } + /// The consolidated failover health for the VM. + string FailoverHealth { get; set; } + /// The recovery point ARM Id to which the Vm was failed over. + string FailoverRecoveryPointId { get; set; } + /// The name. + string FriendlyName { get; set; } + /// List of health errors. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] HealthError { get; set; } + /// The Last successful failover time. + global::System.DateTime? LastSuccessfulFailoverTime { get; set; } + /// The Last successful test failover time. + global::System.DateTime? LastSuccessfulTestFailoverTime { get; set; } + /// The name of Policy governing this PE. + string PolicyFriendlyName { get; set; } + /// The ID of Policy governing this PE. + string PolicyId { get; set; } + /// The friendly name of the primary fabric. + string PrimaryFabricFriendlyName { get; set; } + /// The fabric provider of the primary fabric. + string PrimaryFabricProvider { get; set; } + /// The name of primary protection container friendly name. + string PrimaryProtectionContainerFriendlyName { get; set; } + /// The protected item ARM Id. + string ProtectableItemId { get; set; } + /// The type of protected item type. + string ProtectedItemType { get; set; } + /// The protection status. + string ProtectionState { get; set; } + /// The protection state description. + string ProtectionStateDescription { get; set; } + /// The Replication provider custom settings. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettings ProviderSpecificDetail { get; set; } + /// Gets the Instance type. + string ProviderSpecificDetailInstanceType { get; set; } + /// The recovery container Id. + string RecoveryContainerId { get; set; } + /// The friendly name of recovery fabric. + string RecoveryFabricFriendlyName { get; set; } + /// The Arm Id of recovery fabric. + string RecoveryFabricId { get; set; } + /// The name of recovery container friendly name. + string RecoveryProtectionContainerFriendlyName { get; set; } + /// The recovery provider ARM Id. + string RecoveryServicesProviderId { get; set; } + /// + /// 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. + /// + string ReplicationHealth { get; set; } + /// The switch provider state. + string SwitchProviderState { get; set; } + /// The switch provider state description. + string SwitchProviderStateDescription { get; set; } + /// The Test failover state. + string TestFailoverState { get; set; } + /// The Test failover state description. + string TestFailoverStateDescription { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProtectedItemProperties.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProtectedItemProperties.json.cs new file mode 100644 index 000000000000..d173ba7f39b0 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProtectedItemProperties.json.cs @@ -0,0 +1,183 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Replication protected item custom data details. + public partial class ReplicationProtectedItemProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new ReplicationProtectedItemProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal ReplicationProtectedItemProperties(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_currentScenario = If( json?.PropertyT("currentScenario"), out var __jsonCurrentScenario) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.CurrentScenarioDetails.FromJson(__jsonCurrentScenario) : CurrentScenario;} + {_providerSpecificDetail = If( json?.PropertyT("providerSpecificDetails"), out var __jsonProviderSpecificDetails) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProviderSpecificSettings.FromJson(__jsonProviderSpecificDetails) : ProviderSpecificDetail;} + {_friendlyName = If( json?.PropertyT("friendlyName"), out var __jsonFriendlyName) ? (string)__jsonFriendlyName : (string)FriendlyName;} + {_protectedItemType = If( json?.PropertyT("protectedItemType"), out var __jsonProtectedItemType) ? (string)__jsonProtectedItemType : (string)ProtectedItemType;} + {_protectableItemId = If( json?.PropertyT("protectableItemId"), out var __jsonProtectableItemId) ? (string)__jsonProtectableItemId : (string)ProtectableItemId;} + {_recoveryServicesProviderId = If( json?.PropertyT("recoveryServicesProviderId"), out var __jsonRecoveryServicesProviderId) ? (string)__jsonRecoveryServicesProviderId : (string)RecoveryServicesProviderId;} + {_primaryFabricFriendlyName = If( json?.PropertyT("primaryFabricFriendlyName"), out var __jsonPrimaryFabricFriendlyName) ? (string)__jsonPrimaryFabricFriendlyName : (string)PrimaryFabricFriendlyName;} + {_primaryFabricProvider = If( json?.PropertyT("primaryFabricProvider"), out var __jsonPrimaryFabricProvider) ? (string)__jsonPrimaryFabricProvider : (string)PrimaryFabricProvider;} + {_recoveryFabricFriendlyName = If( json?.PropertyT("recoveryFabricFriendlyName"), out var __jsonRecoveryFabricFriendlyName) ? (string)__jsonRecoveryFabricFriendlyName : (string)RecoveryFabricFriendlyName;} + {_recoveryFabricId = If( json?.PropertyT("recoveryFabricId"), out var __jsonRecoveryFabricId) ? (string)__jsonRecoveryFabricId : (string)RecoveryFabricId;} + {_primaryProtectionContainerFriendlyName = If( json?.PropertyT("primaryProtectionContainerFriendlyName"), out var __jsonPrimaryProtectionContainerFriendlyName) ? (string)__jsonPrimaryProtectionContainerFriendlyName : (string)PrimaryProtectionContainerFriendlyName;} + {_recoveryProtectionContainerFriendlyName = If( json?.PropertyT("recoveryProtectionContainerFriendlyName"), out var __jsonRecoveryProtectionContainerFriendlyName) ? (string)__jsonRecoveryProtectionContainerFriendlyName : (string)RecoveryProtectionContainerFriendlyName;} + {_protectionState = If( json?.PropertyT("protectionState"), out var __jsonProtectionState) ? (string)__jsonProtectionState : (string)ProtectionState;} + {_protectionStateDescription = If( json?.PropertyT("protectionStateDescription"), out var __jsonProtectionStateDescription) ? (string)__jsonProtectionStateDescription : (string)ProtectionStateDescription;} + {_activeLocation = If( json?.PropertyT("activeLocation"), out var __jsonActiveLocation) ? (string)__jsonActiveLocation : (string)ActiveLocation;} + {_testFailoverState = If( json?.PropertyT("testFailoverState"), out var __jsonTestFailoverState) ? (string)__jsonTestFailoverState : (string)TestFailoverState;} + {_testFailoverStateDescription = If( json?.PropertyT("testFailoverStateDescription"), out var __jsonTestFailoverStateDescription) ? (string)__jsonTestFailoverStateDescription : (string)TestFailoverStateDescription;} + {_switchProviderState = If( json?.PropertyT("switchProviderState"), out var __jsonSwitchProviderState) ? (string)__jsonSwitchProviderState : (string)SwitchProviderState;} + {_switchProviderStateDescription = If( json?.PropertyT("switchProviderStateDescription"), out var __jsonSwitchProviderStateDescription) ? (string)__jsonSwitchProviderStateDescription : (string)SwitchProviderStateDescription;} + {_allowedOperation = If( json?.PropertyT("allowedOperations"), out var __jsonAllowedOperations) ? If( __jsonAllowedOperations as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(string) (__u is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : AllowedOperation;} + {_replicationHealth = If( json?.PropertyT("replicationHealth"), out var __jsonReplicationHealth) ? (string)__jsonReplicationHealth : (string)ReplicationHealth;} + {_failoverHealth = If( json?.PropertyT("failoverHealth"), out var __jsonFailoverHealth) ? (string)__jsonFailoverHealth : (string)FailoverHealth;} + {_healthError = If( json?.PropertyT("healthErrors"), out var __jsonHealthErrors) ? If( __jsonHealthErrors as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __q) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__q, (__p)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthError.FromJson(__p) )) ))() : null : HealthError;} + {_policyId = If( json?.PropertyT("policyId"), out var __jsonPolicyId) ? (string)__jsonPolicyId : (string)PolicyId;} + {_policyFriendlyName = If( json?.PropertyT("policyFriendlyName"), out var __jsonPolicyFriendlyName) ? (string)__jsonPolicyFriendlyName : (string)PolicyFriendlyName;} + {_lastSuccessfulFailoverTime = If( json?.PropertyT("lastSuccessfulFailoverTime"), out var __jsonLastSuccessfulFailoverTime) ? global::System.DateTime.TryParse((string)__jsonLastSuccessfulFailoverTime, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonLastSuccessfulFailoverTimeValue) ? __jsonLastSuccessfulFailoverTimeValue : LastSuccessfulFailoverTime : LastSuccessfulFailoverTime;} + {_lastSuccessfulTestFailoverTime = If( json?.PropertyT("lastSuccessfulTestFailoverTime"), out var __jsonLastSuccessfulTestFailoverTime) ? global::System.DateTime.TryParse((string)__jsonLastSuccessfulTestFailoverTime, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonLastSuccessfulTestFailoverTimeValue) ? __jsonLastSuccessfulTestFailoverTimeValue : LastSuccessfulTestFailoverTime : LastSuccessfulTestFailoverTime;} + {_failoverRecoveryPointId = If( json?.PropertyT("failoverRecoveryPointId"), out var __jsonFailoverRecoveryPointId) ? (string)__jsonFailoverRecoveryPointId : (string)FailoverRecoveryPointId;} + {_recoveryContainerId = If( json?.PropertyT("recoveryContainerId"), out var __jsonRecoveryContainerId) ? (string)__jsonRecoveryContainerId : (string)RecoveryContainerId;} + {_eventCorrelationId = If( json?.PropertyT("eventCorrelationId"), out var __jsonEventCorrelationId) ? (string)__jsonEventCorrelationId : (string)EventCorrelationId;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._currentScenario ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._currentScenario.ToJson(null,serializationMode) : null, "currentScenario" ,container.Add ); + AddIf( null != this._providerSpecificDetail ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._providerSpecificDetail.ToJson(null,serializationMode) : null, "providerSpecificDetails" ,container.Add ); + AddIf( null != (((object)this._friendlyName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._friendlyName.ToString()) : null, "friendlyName" ,container.Add ); + AddIf( null != (((object)this._protectedItemType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._protectedItemType.ToString()) : null, "protectedItemType" ,container.Add ); + AddIf( null != (((object)this._protectableItemId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._protectableItemId.ToString()) : null, "protectableItemId" ,container.Add ); + AddIf( null != (((object)this._recoveryServicesProviderId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryServicesProviderId.ToString()) : null, "recoveryServicesProviderId" ,container.Add ); + AddIf( null != (((object)this._primaryFabricFriendlyName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._primaryFabricFriendlyName.ToString()) : null, "primaryFabricFriendlyName" ,container.Add ); + AddIf( null != (((object)this._primaryFabricProvider)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._primaryFabricProvider.ToString()) : null, "primaryFabricProvider" ,container.Add ); + AddIf( null != (((object)this._recoveryFabricFriendlyName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryFabricFriendlyName.ToString()) : null, "recoveryFabricFriendlyName" ,container.Add ); + AddIf( null != (((object)this._recoveryFabricId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryFabricId.ToString()) : null, "recoveryFabricId" ,container.Add ); + AddIf( null != (((object)this._primaryProtectionContainerFriendlyName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._primaryProtectionContainerFriendlyName.ToString()) : null, "primaryProtectionContainerFriendlyName" ,container.Add ); + AddIf( null != (((object)this._recoveryProtectionContainerFriendlyName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryProtectionContainerFriendlyName.ToString()) : null, "recoveryProtectionContainerFriendlyName" ,container.Add ); + AddIf( null != (((object)this._protectionState)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._protectionState.ToString()) : null, "protectionState" ,container.Add ); + AddIf( null != (((object)this._protectionStateDescription)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._protectionStateDescription.ToString()) : null, "protectionStateDescription" ,container.Add ); + AddIf( null != (((object)this._activeLocation)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._activeLocation.ToString()) : null, "activeLocation" ,container.Add ); + AddIf( null != (((object)this._testFailoverState)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._testFailoverState.ToString()) : null, "testFailoverState" ,container.Add ); + AddIf( null != (((object)this._testFailoverStateDescription)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._testFailoverStateDescription.ToString()) : null, "testFailoverStateDescription" ,container.Add ); + AddIf( null != (((object)this._switchProviderState)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._switchProviderState.ToString()) : null, "switchProviderState" ,container.Add ); + AddIf( null != (((object)this._switchProviderStateDescription)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._switchProviderStateDescription.ToString()) : null, "switchProviderStateDescription" ,container.Add ); + if (null != this._allowedOperation) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._allowedOperation ) + { + AddIf(null != (((object)__x)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(__x.ToString()) : null ,__w.Add); + } + container.Add("allowedOperations",__w); + } + AddIf( null != (((object)this._replicationHealth)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._replicationHealth.ToString()) : null, "replicationHealth" ,container.Add ); + AddIf( null != (((object)this._failoverHealth)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._failoverHealth.ToString()) : null, "failoverHealth" ,container.Add ); + if (null != this._healthError) + { + var __r = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __s in this._healthError ) + { + AddIf(__s?.ToJson(null, serializationMode) ,__r.Add); + } + container.Add("healthErrors",__r); + } + AddIf( null != (((object)this._policyId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._policyId.ToString()) : null, "policyId" ,container.Add ); + AddIf( null != (((object)this._policyFriendlyName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._policyFriendlyName.ToString()) : null, "policyFriendlyName" ,container.Add ); + AddIf( null != this._lastSuccessfulFailoverTime ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._lastSuccessfulFailoverTime?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "lastSuccessfulFailoverTime" ,container.Add ); + AddIf( null != this._lastSuccessfulTestFailoverTime ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._lastSuccessfulTestFailoverTime?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "lastSuccessfulTestFailoverTime" ,container.Add ); + AddIf( null != (((object)this._failoverRecoveryPointId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._failoverRecoveryPointId.ToString()) : null, "failoverRecoveryPointId" ,container.Add ); + AddIf( null != (((object)this._recoveryContainerId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryContainerId.ToString()) : null, "recoveryContainerId" ,container.Add ); + AddIf( null != (((object)this._eventCorrelationId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._eventCorrelationId.ToString()) : null, "eventCorrelationId" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProtectionIntent.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProtectionIntent.PowerShell.cs new file mode 100644 index 000000000000..aa2ab12754dc --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProtectionIntent.PowerShell.cs @@ -0,0 +1,234 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Replication protection intent. + [System.ComponentModel.TypeConverter(typeof(ReplicationProtectionIntentTypeConverter))] + public partial class ReplicationProtectionIntent + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntent DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ReplicationProtectionIntent(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntent DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ReplicationProtectionIntent(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntent FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ReplicationProtectionIntent(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProtectionIntentPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentProviderSpecificSettings) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProtectionIntentProviderSpecificSettingsTypeConverter.ConvertFrom); + } + if (content.Contains("FriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentInternal)this).FriendlyName = (string) content.GetValueForProperty("FriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentInternal)this).FriendlyName, global::System.Convert.ToString); + } + if (content.Contains("JobId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentInternal)this).JobId = (string) content.GetValueForProperty("JobId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentInternal)this).JobId, global::System.Convert.ToString); + } + if (content.Contains("JobState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentInternal)this).JobState = (string) content.GetValueForProperty("JobState",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentInternal)this).JobState, global::System.Convert.ToString); + } + if (content.Contains("IsActive")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentInternal)this).IsActive = (bool?) content.GetValueForProperty("IsActive",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentInternal)this).IsActive, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("CreationTimeUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentInternal)this).CreationTimeUtc = (string) content.GetValueForProperty("CreationTimeUtc",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentInternal)this).CreationTimeUtc, global::System.Convert.ToString); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ReplicationProtectionIntent(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProtectionIntentPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentProviderSpecificSettings) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProtectionIntentProviderSpecificSettingsTypeConverter.ConvertFrom); + } + if (content.Contains("FriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentInternal)this).FriendlyName = (string) content.GetValueForProperty("FriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentInternal)this).FriendlyName, global::System.Convert.ToString); + } + if (content.Contains("JobId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentInternal)this).JobId = (string) content.GetValueForProperty("JobId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentInternal)this).JobId, global::System.Convert.ToString); + } + if (content.Contains("JobState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentInternal)this).JobState = (string) content.GetValueForProperty("JobState",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentInternal)this).JobState, global::System.Convert.ToString); + } + if (content.Contains("IsActive")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentInternal)this).IsActive = (bool?) content.GetValueForProperty("IsActive",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentInternal)this).IsActive, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("CreationTimeUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentInternal)this).CreationTimeUtc = (string) content.GetValueForProperty("CreationTimeUtc",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentInternal)this).CreationTimeUtc, global::System.Convert.ToString); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Replication protection intent. + [System.ComponentModel.TypeConverter(typeof(ReplicationProtectionIntentTypeConverter))] + public partial interface IReplicationProtectionIntent + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProtectionIntent.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProtectionIntent.TypeConverter.cs new file mode 100644 index 000000000000..32a72a83067f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProtectionIntent.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ReplicationProtectionIntentTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntent ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntent).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ReplicationProtectionIntent.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ReplicationProtectionIntent.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ReplicationProtectionIntent.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProtectionIntent.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProtectionIntent.cs new file mode 100644 index 000000000000..4625486f745e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProtectionIntent.cs @@ -0,0 +1,191 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Replication protection intent. + public partial class ReplicationProtectionIntent : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntent, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResource __resource = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.Resource(); + + /// The creation time in UTC. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string CreationTimeUtc { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentPropertiesInternal)Property).CreationTimeUtc; } + + /// The name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string FriendlyName { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentPropertiesInternal)Property).FriendlyName; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentPropertiesInternal)Property).FriendlyName = value ?? null; } + + /// Resource Id + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Id; } + + /// A value indicating whether the intent object is active. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public bool? IsActive { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentPropertiesInternal)Property).IsActive; } + + /// The job Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string JobId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentPropertiesInternal)Property).JobId; } + + /// The job state. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string JobState { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentPropertiesInternal)Property).JobState; } + + /// Resource Location + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string Location { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Location; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Location = value ?? null; } + + /// Internal Acessors for CreationTimeUtc + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentInternal.CreationTimeUtc { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentPropertiesInternal)Property).CreationTimeUtc; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentPropertiesInternal)Property).CreationTimeUtc = value; } + + /// Internal Acessors for IsActive + bool? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentInternal.IsActive { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentPropertiesInternal)Property).IsActive; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentPropertiesInternal)Property).IsActive = value; } + + /// Internal Acessors for JobId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentInternal.JobId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentPropertiesInternal)Property).JobId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentPropertiesInternal)Property).JobId = value; } + + /// Internal Acessors for JobState + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentInternal.JobState { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentPropertiesInternal)Property).JobState; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentPropertiesInternal)Property).JobState = value; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentProperties Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProtectionIntentProperties()); set { {_property = value;} } } + + /// Internal Acessors for ProviderSpecificDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentProviderSpecificSettings Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentInternal.ProviderSpecificDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentPropertiesInternal)Property).ProviderSpecificDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentPropertiesInternal)Property).ProviderSpecificDetail = value; } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Id = value; } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Name = value; } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Type = value; } + + /// Resource Name + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Name; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentProperties _property; + + /// The custom data. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProtectionIntentProperties()); set => this._property = value; } + + /// Gets the Instance type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ProviderSpecificDetailInstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentPropertiesInternal)Property).ProviderSpecificDetailInstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentPropertiesInternal)Property).ProviderSpecificDetailInstanceType = value ?? null; } + + /// Resource Type + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Type; } + + /// Creates an new instance. + public ReplicationProtectionIntent() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__resource), __resource); + await eventListener.AssertObjectIsValid(nameof(__resource), __resource); + } + } + /// Replication protection intent. + public partial interface IReplicationProtectionIntent : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResource + { + /// The creation time in UTC. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The creation time in UTC.", + SerializedName = @"creationTimeUTC", + PossibleTypes = new [] { typeof(string) })] + string CreationTimeUtc { get; } + /// The name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name.", + SerializedName = @"friendlyName", + PossibleTypes = new [] { typeof(string) })] + string FriendlyName { get; set; } + /// A value indicating whether the intent object is active. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"A value indicating whether the intent object is active.", + SerializedName = @"isActive", + PossibleTypes = new [] { typeof(bool) })] + bool? IsActive { get; } + /// The job Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The job Id.", + SerializedName = @"jobId", + PossibleTypes = new [] { typeof(string) })] + string JobId { get; } + /// The job state. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The job state.", + SerializedName = @"jobState", + PossibleTypes = new [] { typeof(string) })] + string JobState { get; } + /// Gets the Instance type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets the Instance type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string ProviderSpecificDetailInstanceType { get; set; } + + } + /// Replication protection intent. + internal partial interface IReplicationProtectionIntentInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal + { + /// The creation time in UTC. + string CreationTimeUtc { get; set; } + /// The name. + string FriendlyName { get; set; } + /// A value indicating whether the intent object is active. + bool? IsActive { get; set; } + /// The job Id. + string JobId { get; set; } + /// The job state. + string JobState { get; set; } + /// The custom data. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentProperties Property { get; set; } + /// The Replication provider custom settings. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentProviderSpecificSettings ProviderSpecificDetail { get; set; } + /// Gets the Instance type. + string ProviderSpecificDetailInstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProtectionIntent.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProtectionIntent.json.cs new file mode 100644 index 000000000000..05feeb6bf64b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProtectionIntent.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Replication protection intent. + public partial class ReplicationProtectionIntent + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntent. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntent. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntent FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new ReplicationProtectionIntent(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal ReplicationProtectionIntent(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __resource = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.Resource(json); + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProtectionIntentProperties.FromJson(__jsonProperties) : Property;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __resource?.ToJson(container, serializationMode); + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProtectionIntentCollection.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProtectionIntentCollection.PowerShell.cs new file mode 100644 index 000000000000..9fedc058e234 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProtectionIntentCollection.PowerShell.cs @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Replication protection intent objects collection. + [System.ComponentModel.TypeConverter(typeof(ReplicationProtectionIntentCollectionTypeConverter))] + public partial class ReplicationProtectionIntentCollection + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentCollection DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ReplicationProtectionIntentCollection(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentCollection DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ReplicationProtectionIntentCollection(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json + /// string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentCollection FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ReplicationProtectionIntentCollection(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntent[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProtectionIntentTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentCollectionInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentCollectionInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ReplicationProtectionIntentCollection(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntent[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProtectionIntentTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentCollectionInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentCollectionInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Replication protection intent objects collection. + [System.ComponentModel.TypeConverter(typeof(ReplicationProtectionIntentCollectionTypeConverter))] + public partial interface IReplicationProtectionIntentCollection + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProtectionIntentCollection.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProtectionIntentCollection.TypeConverter.cs new file mode 100644 index 000000000000..36311032343c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProtectionIntentCollection.TypeConverter.cs @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ReplicationProtectionIntentCollectionTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentCollection ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentCollection).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ReplicationProtectionIntentCollection.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ReplicationProtectionIntentCollection.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ReplicationProtectionIntentCollection.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProtectionIntentCollection.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProtectionIntentCollection.cs new file mode 100644 index 000000000000..8d40a09aa0bf --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProtectionIntentCollection.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Replication protection intent objects collection. + public partial class ReplicationProtectionIntentCollection : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentCollection, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentCollectionInternal + { + + /// Backing field for property. + private string _nextLink; + + /// The value of next link. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string NextLink { get => this._nextLink; set => this._nextLink = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntent[] _value; + + /// The Replication protection intent details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntent[] Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public ReplicationProtectionIntentCollection() + { + + } + } + /// Replication protection intent objects collection. + public partial interface IReplicationProtectionIntentCollection : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The value of next link. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The value of next link.", + SerializedName = @"nextLink", + PossibleTypes = new [] { typeof(string) })] + string NextLink { get; set; } + /// The Replication protection intent details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Replication protection intent details.", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntent) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntent[] Value { get; set; } + + } + /// Replication protection intent objects collection. + internal partial interface IReplicationProtectionIntentCollectionInternal + + { + /// The value of next link. + string NextLink { get; set; } + /// The Replication protection intent details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntent[] Value { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProtectionIntentCollection.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProtectionIntentCollection.json.cs new file mode 100644 index 000000000000..745dda60dccf --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProtectionIntentCollection.json.cs @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Replication protection intent objects collection. + public partial class ReplicationProtectionIntentCollection + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentCollection. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentCollection. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentCollection FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new ReplicationProtectionIntentCollection(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal ReplicationProtectionIntentCollection(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntent) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProtectionIntent.FromJson(__u) )) ))() : null : Value;} + {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)NextLink;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._value) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._value ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("value",__w); + } + AddIf( null != (((object)this._nextLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProtectionIntentProperties.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProtectionIntentProperties.PowerShell.cs new file mode 100644 index 000000000000..5fc2c3140f00 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProtectionIntentProperties.PowerShell.cs @@ -0,0 +1,197 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Replication protection intent custom data details. + [System.ComponentModel.TypeConverter(typeof(ReplicationProtectionIntentPropertiesTypeConverter))] + public partial class ReplicationProtectionIntentProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ReplicationProtectionIntentProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ReplicationProtectionIntentProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json + /// string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ReplicationProtectionIntentProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentPropertiesInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentProviderSpecificSettings) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentPropertiesInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProtectionIntentProviderSpecificSettingsTypeConverter.ConvertFrom); + } + if (content.Contains("FriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentPropertiesInternal)this).FriendlyName = (string) content.GetValueForProperty("FriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentPropertiesInternal)this).FriendlyName, global::System.Convert.ToString); + } + if (content.Contains("JobId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentPropertiesInternal)this).JobId = (string) content.GetValueForProperty("JobId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentPropertiesInternal)this).JobId, global::System.Convert.ToString); + } + if (content.Contains("JobState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentPropertiesInternal)this).JobState = (string) content.GetValueForProperty("JobState",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentPropertiesInternal)this).JobState, global::System.Convert.ToString); + } + if (content.Contains("IsActive")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentPropertiesInternal)this).IsActive = (bool?) content.GetValueForProperty("IsActive",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentPropertiesInternal)this).IsActive, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("CreationTimeUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentPropertiesInternal)this).CreationTimeUtc = (string) content.GetValueForProperty("CreationTimeUtc",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentPropertiesInternal)this).CreationTimeUtc, global::System.Convert.ToString); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentPropertiesInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentPropertiesInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ReplicationProtectionIntentProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentPropertiesInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentProviderSpecificSettings) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentPropertiesInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProtectionIntentProviderSpecificSettingsTypeConverter.ConvertFrom); + } + if (content.Contains("FriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentPropertiesInternal)this).FriendlyName = (string) content.GetValueForProperty("FriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentPropertiesInternal)this).FriendlyName, global::System.Convert.ToString); + } + if (content.Contains("JobId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentPropertiesInternal)this).JobId = (string) content.GetValueForProperty("JobId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentPropertiesInternal)this).JobId, global::System.Convert.ToString); + } + if (content.Contains("JobState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentPropertiesInternal)this).JobState = (string) content.GetValueForProperty("JobState",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentPropertiesInternal)this).JobState, global::System.Convert.ToString); + } + if (content.Contains("IsActive")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentPropertiesInternal)this).IsActive = (bool?) content.GetValueForProperty("IsActive",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentPropertiesInternal)this).IsActive, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("CreationTimeUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentPropertiesInternal)this).CreationTimeUtc = (string) content.GetValueForProperty("CreationTimeUtc",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentPropertiesInternal)this).CreationTimeUtc, global::System.Convert.ToString); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentPropertiesInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentPropertiesInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Replication protection intent custom data details. + [System.ComponentModel.TypeConverter(typeof(ReplicationProtectionIntentPropertiesTypeConverter))] + public partial interface IReplicationProtectionIntentProperties + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProtectionIntentProperties.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProtectionIntentProperties.TypeConverter.cs new file mode 100644 index 000000000000..608a763fc4f5 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProtectionIntentProperties.TypeConverter.cs @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ReplicationProtectionIntentPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ReplicationProtectionIntentProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ReplicationProtectionIntentProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ReplicationProtectionIntentProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProtectionIntentProperties.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProtectionIntentProperties.cs new file mode 100644 index 000000000000..f3e5a7f6139f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProtectionIntentProperties.cs @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Replication protection intent custom data details. + public partial class ReplicationProtectionIntentProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentProperties, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentPropertiesInternal + { + + /// Backing field for property. + private string _creationTimeUtc; + + /// The creation time in UTC. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string CreationTimeUtc { get => this._creationTimeUtc; } + + /// Backing field for property. + private string _friendlyName; + + /// The name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string FriendlyName { get => this._friendlyName; set => this._friendlyName = value; } + + /// Backing field for property. + private bool? _isActive; + + /// A value indicating whether the intent object is active. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public bool? IsActive { get => this._isActive; } + + /// Backing field for property. + private string _jobId; + + /// The job Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string JobId { get => this._jobId; } + + /// Backing field for property. + private string _jobState; + + /// The job state. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string JobState { get => this._jobState; } + + /// Internal Acessors for CreationTimeUtc + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentPropertiesInternal.CreationTimeUtc { get => this._creationTimeUtc; set { {_creationTimeUtc = value;} } } + + /// Internal Acessors for IsActive + bool? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentPropertiesInternal.IsActive { get => this._isActive; set { {_isActive = value;} } } + + /// Internal Acessors for JobId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentPropertiesInternal.JobId { get => this._jobId; set { {_jobId = value;} } } + + /// Internal Acessors for JobState + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentPropertiesInternal.JobState { get => this._jobState; set { {_jobState = value;} } } + + /// Internal Acessors for ProviderSpecificDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentProviderSpecificSettings Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentPropertiesInternal.ProviderSpecificDetail { get => (this._providerSpecificDetail = this._providerSpecificDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProtectionIntentProviderSpecificSettings()); set { {_providerSpecificDetail = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentProviderSpecificSettings _providerSpecificDetail; + + /// The Replication provider custom settings. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentProviderSpecificSettings ProviderSpecificDetail { get => (this._providerSpecificDetail = this._providerSpecificDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProtectionIntentProviderSpecificSettings()); set => this._providerSpecificDetail = value; } + + /// Gets the Instance type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ProviderSpecificDetailInstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentProviderSpecificSettingsInternal)ProviderSpecificDetail).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentProviderSpecificSettingsInternal)ProviderSpecificDetail).InstanceType = value ?? null; } + + /// Creates an new instance. + public ReplicationProtectionIntentProperties() + { + + } + } + /// Replication protection intent custom data details. + public partial interface IReplicationProtectionIntentProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The creation time in UTC. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The creation time in UTC.", + SerializedName = @"creationTimeUTC", + PossibleTypes = new [] { typeof(string) })] + string CreationTimeUtc { get; } + /// The name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name.", + SerializedName = @"friendlyName", + PossibleTypes = new [] { typeof(string) })] + string FriendlyName { get; set; } + /// A value indicating whether the intent object is active. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"A value indicating whether the intent object is active.", + SerializedName = @"isActive", + PossibleTypes = new [] { typeof(bool) })] + bool? IsActive { get; } + /// The job Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The job Id.", + SerializedName = @"jobId", + PossibleTypes = new [] { typeof(string) })] + string JobId { get; } + /// The job state. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The job state.", + SerializedName = @"jobState", + PossibleTypes = new [] { typeof(string) })] + string JobState { get; } + /// Gets the Instance type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets the Instance type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string ProviderSpecificDetailInstanceType { get; set; } + + } + /// Replication protection intent custom data details. + internal partial interface IReplicationProtectionIntentPropertiesInternal + + { + /// The creation time in UTC. + string CreationTimeUtc { get; set; } + /// The name. + string FriendlyName { get; set; } + /// A value indicating whether the intent object is active. + bool? IsActive { get; set; } + /// The job Id. + string JobId { get; set; } + /// The job state. + string JobState { get; set; } + /// The Replication provider custom settings. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentProviderSpecificSettings ProviderSpecificDetail { get; set; } + /// Gets the Instance type. + string ProviderSpecificDetailInstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProtectionIntentProperties.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProtectionIntentProperties.json.cs new file mode 100644 index 000000000000..3b7aaa6e11e1 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProtectionIntentProperties.json.cs @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Replication protection intent custom data details. + public partial class ReplicationProtectionIntentProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new ReplicationProtectionIntentProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal ReplicationProtectionIntentProperties(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_providerSpecificDetail = If( json?.PropertyT("providerSpecificDetails"), out var __jsonProviderSpecificDetails) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProtectionIntentProviderSpecificSettings.FromJson(__jsonProviderSpecificDetails) : ProviderSpecificDetail;} + {_friendlyName = If( json?.PropertyT("friendlyName"), out var __jsonFriendlyName) ? (string)__jsonFriendlyName : (string)FriendlyName;} + {_jobId = If( json?.PropertyT("jobId"), out var __jsonJobId) ? (string)__jsonJobId : (string)JobId;} + {_jobState = If( json?.PropertyT("jobState"), out var __jsonJobState) ? (string)__jsonJobState : (string)JobState;} + {_isActive = If( json?.PropertyT("isActive"), out var __jsonIsActive) ? (bool?)__jsonIsActive : IsActive;} + {_creationTimeUtc = If( json?.PropertyT("creationTimeUTC"), out var __jsonCreationTimeUtc) ? (string)__jsonCreationTimeUtc : (string)CreationTimeUtc;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._providerSpecificDetail ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._providerSpecificDetail.ToJson(null,serializationMode) : null, "providerSpecificDetails" ,container.Add ); + AddIf( null != (((object)this._friendlyName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._friendlyName.ToString()) : null, "friendlyName" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._jobId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._jobId.ToString()) : null, "jobId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._jobState)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._jobState.ToString()) : null, "jobState" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._isActive ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonBoolean((bool)this._isActive) : null, "isActive" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._creationTimeUtc)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._creationTimeUtc.ToString()) : null, "creationTimeUTC" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProtectionIntentProviderSpecificSettings.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProtectionIntentProviderSpecificSettings.PowerShell.cs new file mode 100644 index 000000000000..ebda1bd55868 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProtectionIntentProviderSpecificSettings.PowerShell.cs @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Replication provider specific settings. + [System.ComponentModel.TypeConverter(typeof(ReplicationProtectionIntentProviderSpecificSettingsTypeConverter))] + public partial class ReplicationProtectionIntentProviderSpecificSettings + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentProviderSpecificSettings DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ReplicationProtectionIntentProviderSpecificSettings(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentProviderSpecificSettings DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ReplicationProtectionIntentProviderSpecificSettings(content); + } + + /// + /// Creates a new instance of , deserializing the content + /// from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentProviderSpecificSettings FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ReplicationProtectionIntentProviderSpecificSettings(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentProviderSpecificSettingsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentProviderSpecificSettingsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ReplicationProtectionIntentProviderSpecificSettings(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentProviderSpecificSettingsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentProviderSpecificSettingsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Replication provider specific settings. + [System.ComponentModel.TypeConverter(typeof(ReplicationProtectionIntentProviderSpecificSettingsTypeConverter))] + public partial interface IReplicationProtectionIntentProviderSpecificSettings + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProtectionIntentProviderSpecificSettings.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProtectionIntentProviderSpecificSettings.TypeConverter.cs new file mode 100644 index 000000000000..32764d18c493 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProtectionIntentProviderSpecificSettings.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ReplicationProtectionIntentProviderSpecificSettingsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a + /// type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentProviderSpecificSettings ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentProviderSpecificSettings).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ReplicationProtectionIntentProviderSpecificSettings.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ReplicationProtectionIntentProviderSpecificSettings.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ReplicationProtectionIntentProviderSpecificSettings.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProtectionIntentProviderSpecificSettings.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProtectionIntentProviderSpecificSettings.cs new file mode 100644 index 000000000000..83a02ea9f372 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProtectionIntentProviderSpecificSettings.cs @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Replication provider specific settings. + public partial class ReplicationProtectionIntentProviderSpecificSettings : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentProviderSpecificSettings, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentProviderSpecificSettingsInternal + { + + /// Backing field for property. + private string _instanceType; + + /// Gets the Instance type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string InstanceType { get => this._instanceType; set => this._instanceType = value; } + + /// + /// Creates an new instance. + /// + public ReplicationProtectionIntentProviderSpecificSettings() + { + + } + } + /// Replication provider specific settings. + public partial interface IReplicationProtectionIntentProviderSpecificSettings : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// Gets the Instance type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets the Instance type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string InstanceType { get; set; } + + } + /// Replication provider specific settings. + internal partial interface IReplicationProtectionIntentProviderSpecificSettingsInternal + + { + /// Gets the Instance type. + string InstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProtectionIntentProviderSpecificSettings.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProtectionIntentProviderSpecificSettings.json.cs new file mode 100644 index 000000000000..101c58cc90af --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProtectionIntentProviderSpecificSettings.json.cs @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Replication provider specific settings. + public partial class ReplicationProtectionIntentProviderSpecificSettings + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentProviderSpecificSettings. + /// Note: the Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentProviderSpecificSettings + /// interface is polymorphic, and the precise model class that will get deserialized is determined at runtime based on the + /// payload. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentProviderSpecificSettings. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentProviderSpecificSettings FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + if (!(node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json)) + { + return null; + } + // Polymorphic type -- select the appropriate constructor using the discriminator + + switch ( json.StringProperty("instanceType") ) + { + case "A2A": + { + return new A2AReplicationIntentDetails(json); + } + } + return new ReplicationProtectionIntentProviderSpecificSettings(json); + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal ReplicationProtectionIntentProviderSpecificSettings(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_instanceType = If( json?.PropertyT("instanceType"), out var __jsonInstanceType) ? (string)__jsonInstanceType : (string)InstanceType;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._instanceType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._instanceType.ToString()) : null, "instanceType" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProviderContainerUnmappingInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProviderContainerUnmappingInput.PowerShell.cs new file mode 100644 index 000000000000..d0fef9057c7f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProviderContainerUnmappingInput.PowerShell.cs @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Provider specific input for unpairing operations. + [System.ComponentModel.TypeConverter(typeof(ReplicationProviderContainerUnmappingInputTypeConverter))] + public partial class ReplicationProviderContainerUnmappingInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderContainerUnmappingInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ReplicationProviderContainerUnmappingInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderContainerUnmappingInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ReplicationProviderContainerUnmappingInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a + /// json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderContainerUnmappingInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ReplicationProviderContainerUnmappingInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderContainerUnmappingInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderContainerUnmappingInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ReplicationProviderContainerUnmappingInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderContainerUnmappingInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderContainerUnmappingInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Provider specific input for unpairing operations. + [System.ComponentModel.TypeConverter(typeof(ReplicationProviderContainerUnmappingInputTypeConverter))] + public partial interface IReplicationProviderContainerUnmappingInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProviderContainerUnmappingInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProviderContainerUnmappingInput.TypeConverter.cs new file mode 100644 index 000000000000..0883648ee0f9 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProviderContainerUnmappingInput.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ReplicationProviderContainerUnmappingInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderContainerUnmappingInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderContainerUnmappingInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ReplicationProviderContainerUnmappingInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ReplicationProviderContainerUnmappingInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ReplicationProviderContainerUnmappingInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProviderContainerUnmappingInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProviderContainerUnmappingInput.cs new file mode 100644 index 000000000000..1b9c0292094b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProviderContainerUnmappingInput.cs @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Provider specific input for unpairing operations. + public partial class ReplicationProviderContainerUnmappingInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderContainerUnmappingInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderContainerUnmappingInputInternal + { + + /// Backing field for property. + private string _instanceType; + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string InstanceType { get => this._instanceType; set => this._instanceType = value; } + + /// + /// Creates an new instance. + /// + public ReplicationProviderContainerUnmappingInput() + { + + } + } + /// Provider specific input for unpairing operations. + public partial interface IReplicationProviderContainerUnmappingInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string InstanceType { get; set; } + + } + /// Provider specific input for unpairing operations. + internal partial interface IReplicationProviderContainerUnmappingInputInternal + + { + /// The class type. + string InstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProviderContainerUnmappingInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProviderContainerUnmappingInput.json.cs new file mode 100644 index 000000000000..63bd2b90dac0 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProviderContainerUnmappingInput.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Provider specific input for unpairing operations. + public partial class ReplicationProviderContainerUnmappingInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderContainerUnmappingInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderContainerUnmappingInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderContainerUnmappingInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new ReplicationProviderContainerUnmappingInput(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal ReplicationProviderContainerUnmappingInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_instanceType = If( json?.PropertyT("instanceType"), out var __jsonInstanceType) ? (string)__jsonInstanceType : (string)InstanceType;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._instanceType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._instanceType.ToString()) : null, "instanceType" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProviderSpecificContainerCreationInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProviderSpecificContainerCreationInput.PowerShell.cs new file mode 100644 index 000000000000..e02eb0447cd7 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProviderSpecificContainerCreationInput.PowerShell.cs @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Provider specific input for container creation operation. + [System.ComponentModel.TypeConverter(typeof(ReplicationProviderSpecificContainerCreationInputTypeConverter))] + public partial class ReplicationProviderSpecificContainerCreationInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerCreationInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ReplicationProviderSpecificContainerCreationInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerCreationInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ReplicationProviderSpecificContainerCreationInput(content); + } + + /// + /// Creates a new instance of , deserializing the content + /// from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerCreationInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ReplicationProviderSpecificContainerCreationInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerCreationInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerCreationInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ReplicationProviderSpecificContainerCreationInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerCreationInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerCreationInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Provider specific input for container creation operation. + [System.ComponentModel.TypeConverter(typeof(ReplicationProviderSpecificContainerCreationInputTypeConverter))] + public partial interface IReplicationProviderSpecificContainerCreationInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProviderSpecificContainerCreationInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProviderSpecificContainerCreationInput.TypeConverter.cs new file mode 100644 index 000000000000..c3c9113678c1 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProviderSpecificContainerCreationInput.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ReplicationProviderSpecificContainerCreationInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, + /// otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerCreationInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerCreationInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ReplicationProviderSpecificContainerCreationInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ReplicationProviderSpecificContainerCreationInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ReplicationProviderSpecificContainerCreationInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProviderSpecificContainerCreationInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProviderSpecificContainerCreationInput.cs new file mode 100644 index 000000000000..bdede13035af --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProviderSpecificContainerCreationInput.cs @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Provider specific input for container creation operation. + public partial class ReplicationProviderSpecificContainerCreationInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerCreationInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerCreationInputInternal + { + + /// Backing field for property. + private string _instanceType; + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string InstanceType { get => this._instanceType; set => this._instanceType = value; } + + /// + /// Creates an new instance. + /// + public ReplicationProviderSpecificContainerCreationInput() + { + + } + } + /// Provider specific input for container creation operation. + public partial interface IReplicationProviderSpecificContainerCreationInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string InstanceType { get; set; } + + } + /// Provider specific input for container creation operation. + internal partial interface IReplicationProviderSpecificContainerCreationInputInternal + + { + /// The class type. + string InstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProviderSpecificContainerCreationInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProviderSpecificContainerCreationInput.json.cs new file mode 100644 index 000000000000..081951b8f38c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProviderSpecificContainerCreationInput.json.cs @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Provider specific input for container creation operation. + public partial class ReplicationProviderSpecificContainerCreationInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerCreationInput. + /// Note: the Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerCreationInput + /// interface is polymorphic, and the precise model class that will get deserialized is determined at runtime based on the + /// payload. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerCreationInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerCreationInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + if (!(node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json)) + { + return null; + } + // Polymorphic type -- select the appropriate constructor using the discriminator + + switch ( json.StringProperty("instanceType") ) + { + case "A2A": + { + return new A2AContainerCreationInput(json); + } + case "A2ACrossClusterMigration": + { + return new A2ACrossClusterMigrationContainerCreationInput(json); + } + case "VMwareCbt": + { + return new VMwareCbtContainerCreationInput(json); + } + } + return new ReplicationProviderSpecificContainerCreationInput(json); + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal ReplicationProviderSpecificContainerCreationInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_instanceType = If( json?.PropertyT("instanceType"), out var __jsonInstanceType) ? (string)__jsonInstanceType : (string)InstanceType;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._instanceType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._instanceType.ToString()) : null, "instanceType" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProviderSpecificContainerMappingInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProviderSpecificContainerMappingInput.PowerShell.cs new file mode 100644 index 000000000000..504872c3c67b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProviderSpecificContainerMappingInput.PowerShell.cs @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Provider specific input for pairing operations. + [System.ComponentModel.TypeConverter(typeof(ReplicationProviderSpecificContainerMappingInputTypeConverter))] + public partial class ReplicationProviderSpecificContainerMappingInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerMappingInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ReplicationProviderSpecificContainerMappingInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerMappingInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ReplicationProviderSpecificContainerMappingInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from + /// a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerMappingInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ReplicationProviderSpecificContainerMappingInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerMappingInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerMappingInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ReplicationProviderSpecificContainerMappingInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerMappingInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerMappingInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Provider specific input for pairing operations. + [System.ComponentModel.TypeConverter(typeof(ReplicationProviderSpecificContainerMappingInputTypeConverter))] + public partial interface IReplicationProviderSpecificContainerMappingInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProviderSpecificContainerMappingInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProviderSpecificContainerMappingInput.TypeConverter.cs new file mode 100644 index 000000000000..64e71667c2ae --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProviderSpecificContainerMappingInput.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ReplicationProviderSpecificContainerMappingInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, + /// otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerMappingInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerMappingInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ReplicationProviderSpecificContainerMappingInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ReplicationProviderSpecificContainerMappingInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ReplicationProviderSpecificContainerMappingInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProviderSpecificContainerMappingInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProviderSpecificContainerMappingInput.cs new file mode 100644 index 000000000000..8c295c0da927 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProviderSpecificContainerMappingInput.cs @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Provider specific input for pairing operations. + public partial class ReplicationProviderSpecificContainerMappingInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerMappingInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerMappingInputInternal + { + + /// Backing field for property. + private string _instanceType; + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string InstanceType { get => this._instanceType; set => this._instanceType = value; } + + /// + /// Creates an new instance. + /// + public ReplicationProviderSpecificContainerMappingInput() + { + + } + } + /// Provider specific input for pairing operations. + public partial interface IReplicationProviderSpecificContainerMappingInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string InstanceType { get; set; } + + } + /// Provider specific input for pairing operations. + internal partial interface IReplicationProviderSpecificContainerMappingInputInternal + + { + /// The class type. + string InstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProviderSpecificContainerMappingInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProviderSpecificContainerMappingInput.json.cs new file mode 100644 index 000000000000..12014af47dfb --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProviderSpecificContainerMappingInput.json.cs @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Provider specific input for pairing operations. + public partial class ReplicationProviderSpecificContainerMappingInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerMappingInput. + /// Note: the Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerMappingInput + /// interface is polymorphic, and the precise model class that will get deserialized is determined at runtime based on the + /// payload. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerMappingInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerMappingInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + if (!(node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json)) + { + return null; + } + // Polymorphic type -- select the appropriate constructor using the discriminator + + switch ( json.StringProperty("instanceType") ) + { + case "A2A": + { + return new A2AContainerMappingInput(json); + } + case "VMwareCbt": + { + return new VMwareCbtContainerMappingInput(json); + } + } + return new ReplicationProviderSpecificContainerMappingInput(json); + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal ReplicationProviderSpecificContainerMappingInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_instanceType = If( json?.PropertyT("instanceType"), out var __jsonInstanceType) ? (string)__jsonInstanceType : (string)InstanceType;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._instanceType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._instanceType.ToString()) : null, "instanceType" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProviderSpecificSettings.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProviderSpecificSettings.PowerShell.cs new file mode 100644 index 000000000000..efc136d6b3c8 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProviderSpecificSettings.PowerShell.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Replication provider specific settings. + [System.ComponentModel.TypeConverter(typeof(ReplicationProviderSpecificSettingsTypeConverter))] + public partial class ReplicationProviderSpecificSettings + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettings DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ReplicationProviderSpecificSettings(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettings DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ReplicationProviderSpecificSettings(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettings FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ReplicationProviderSpecificSettings(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettingsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettingsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ReplicationProviderSpecificSettings(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettingsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettingsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Replication provider specific settings. + [System.ComponentModel.TypeConverter(typeof(ReplicationProviderSpecificSettingsTypeConverter))] + public partial interface IReplicationProviderSpecificSettings + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProviderSpecificSettings.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProviderSpecificSettings.TypeConverter.cs new file mode 100644 index 000000000000..1306dad519de --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProviderSpecificSettings.TypeConverter.cs @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ReplicationProviderSpecificSettingsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettings ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettings).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ReplicationProviderSpecificSettings.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ReplicationProviderSpecificSettings.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ReplicationProviderSpecificSettings.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProviderSpecificSettings.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProviderSpecificSettings.cs new file mode 100644 index 000000000000..4ce98f69ee33 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProviderSpecificSettings.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Replication provider specific settings. + public partial class ReplicationProviderSpecificSettings : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettings, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettingsInternal + { + + /// Backing field for property. + private string _instanceType; + + /// Gets the Instance type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string InstanceType { get => this._instanceType; set => this._instanceType = value; } + + /// Creates an new instance. + public ReplicationProviderSpecificSettings() + { + + } + } + /// Replication provider specific settings. + public partial interface IReplicationProviderSpecificSettings : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// Gets the Instance type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets the Instance type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string InstanceType { get; set; } + + } + /// Replication provider specific settings. + internal partial interface IReplicationProviderSpecificSettingsInternal + + { + /// Gets the Instance type. + string InstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProviderSpecificSettings.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProviderSpecificSettings.json.cs new file mode 100644 index 000000000000..1083c1d2a8c1 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProviderSpecificSettings.json.cs @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Replication provider specific settings. + public partial class ReplicationProviderSpecificSettings + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettings. + /// Note: the Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettings interface + /// is polymorphic, and the precise model class that will get deserialized is determined at runtime based on the payload. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettings. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificSettings FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + if (!(node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json)) + { + return null; + } + // Polymorphic type -- select the appropriate constructor using the discriminator + + switch ( json.StringProperty("instanceType") ) + { + case "A2ACrossClusterMigration": + { + return new A2ACrossClusterMigrationReplicationDetails(json); + } + case "A2A": + { + return new A2AReplicationDetails(json); + } + case "HyperVReplicaAzure": + { + return new HyperVReplicaAzureReplicationDetails(json); + } + case "HyperVReplicaBaseReplicationDetails": + { + return new HyperVReplicaBaseReplicationDetails(json); + } + case "HyperVReplica2012R2": + { + return new HyperVReplicaBlueReplicationDetails(json); + } + case "HyperVReplica2012": + { + return new HyperVReplicaReplicationDetails(json); + } + case "InMageAzureV2": + { + return new InMageAzureV2ReplicationDetails(json); + } + case "InMageRcmFailback": + { + return new InMageRcmFailbackReplicationDetails(json); + } + case "InMageRcm": + { + return new InMageRcmReplicationDetails(json); + } + case "InMage": + { + return new InMageReplicationDetails(json); + } + } + return new ReplicationProviderSpecificSettings(json); + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal ReplicationProviderSpecificSettings(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_instanceType = If( json?.PropertyT("instanceType"), out var __jsonInstanceType) ? (string)__jsonInstanceType : (string)InstanceType;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._instanceType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._instanceType.ToString()) : null, "instanceType" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProviderSpecificUpdateContainerMappingInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProviderSpecificUpdateContainerMappingInput.PowerShell.cs new file mode 100644 index 000000000000..5441d3b53ba0 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProviderSpecificUpdateContainerMappingInput.PowerShell.cs @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Provider specific input for update pairing operations. + [System.ComponentModel.TypeConverter(typeof(ReplicationProviderSpecificUpdateContainerMappingInputTypeConverter))] + public partial class ReplicationProviderSpecificUpdateContainerMappingInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificUpdateContainerMappingInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ReplicationProviderSpecificUpdateContainerMappingInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificUpdateContainerMappingInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ReplicationProviderSpecificUpdateContainerMappingInput(content); + } + + /// + /// Creates a new instance of , deserializing the content + /// from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificUpdateContainerMappingInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ReplicationProviderSpecificUpdateContainerMappingInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificUpdateContainerMappingInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificUpdateContainerMappingInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ReplicationProviderSpecificUpdateContainerMappingInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificUpdateContainerMappingInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificUpdateContainerMappingInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Provider specific input for update pairing operations. + [System.ComponentModel.TypeConverter(typeof(ReplicationProviderSpecificUpdateContainerMappingInputTypeConverter))] + public partial interface IReplicationProviderSpecificUpdateContainerMappingInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProviderSpecificUpdateContainerMappingInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProviderSpecificUpdateContainerMappingInput.TypeConverter.cs new file mode 100644 index 000000000000..638b89b196c8 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProviderSpecificUpdateContainerMappingInput.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ReplicationProviderSpecificUpdateContainerMappingInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificUpdateContainerMappingInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificUpdateContainerMappingInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ReplicationProviderSpecificUpdateContainerMappingInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ReplicationProviderSpecificUpdateContainerMappingInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ReplicationProviderSpecificUpdateContainerMappingInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProviderSpecificUpdateContainerMappingInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProviderSpecificUpdateContainerMappingInput.cs new file mode 100644 index 000000000000..67ec89289112 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProviderSpecificUpdateContainerMappingInput.cs @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Provider specific input for update pairing operations. + public partial class ReplicationProviderSpecificUpdateContainerMappingInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificUpdateContainerMappingInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificUpdateContainerMappingInputInternal + { + + /// Backing field for property. + private string _instanceType; + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string InstanceType { get => this._instanceType; set => this._instanceType = value; } + + /// + /// Creates an new instance. + /// + public ReplicationProviderSpecificUpdateContainerMappingInput() + { + + } + } + /// Provider specific input for update pairing operations. + public partial interface IReplicationProviderSpecificUpdateContainerMappingInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string InstanceType { get; set; } + + } + /// Provider specific input for update pairing operations. + internal partial interface IReplicationProviderSpecificUpdateContainerMappingInputInternal + + { + /// The class type. + string InstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProviderSpecificUpdateContainerMappingInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProviderSpecificUpdateContainerMappingInput.json.cs new file mode 100644 index 000000000000..d075c8293ac5 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReplicationProviderSpecificUpdateContainerMappingInput.json.cs @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Provider specific input for update pairing operations. + public partial class ReplicationProviderSpecificUpdateContainerMappingInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificUpdateContainerMappingInput. + /// Note: the Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificUpdateContainerMappingInput + /// interface is polymorphic, and the precise model class that will get deserialized is determined at runtime based on the + /// payload. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificUpdateContainerMappingInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificUpdateContainerMappingInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + if (!(node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json)) + { + return null; + } + // Polymorphic type -- select the appropriate constructor using the discriminator + + switch ( json.StringProperty("instanceType") ) + { + case "A2A": + { + return new A2AUpdateContainerMappingInput(json); + } + case "InMageRcm": + { + return new InMageRcmUpdateContainerMappingInput(json); + } + } + return new ReplicationProviderSpecificUpdateContainerMappingInput(json); + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal ReplicationProviderSpecificUpdateContainerMappingInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_instanceType = If( json?.PropertyT("instanceType"), out var __jsonInstanceType) ? (string)__jsonInstanceType : (string)InstanceType;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._instanceType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._instanceType.ToString()) : null, "instanceType" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReprotectAgentDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReprotectAgentDetails.PowerShell.cs new file mode 100644 index 000000000000..b8dc9df7e691 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReprotectAgentDetails.PowerShell.cs @@ -0,0 +1,240 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Reprotect agent details. + [System.ComponentModel.TypeConverter(typeof(ReprotectAgentDetailsTypeConverter))] + public partial class ReprotectAgentDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ReprotectAgentDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ReprotectAgentDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ReprotectAgentDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("BiosId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal)this).BiosId = (string) content.GetValueForProperty("BiosId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal)this).BiosId, global::System.Convert.ToString); + } + if (content.Contains("FabricObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal)this).FabricObjectId = (string) content.GetValueForProperty("FabricObjectId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal)this).FabricObjectId, global::System.Convert.ToString); + } + if (content.Contains("Fqdn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal)this).Fqdn = (string) content.GetValueForProperty("Fqdn",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal)this).Fqdn, global::System.Convert.ToString); + } + if (content.Contains("Version")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal)this).Version = (string) content.GetValueForProperty("Version",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal)this).Version, global::System.Convert.ToString); + } + if (content.Contains("LastHeartbeatUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal)this).LastHeartbeatUtc = (global::System.DateTime?) content.GetValueForProperty("LastHeartbeatUtc",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal)this).LastHeartbeatUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("Health")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal)this).Health = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth?) content.GetValueForProperty("Health",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal)this).Health, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth.CreateFrom); + } + if (content.Contains("HealthError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal)this).HealthError = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[]) content.GetValueForProperty("HealthError",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal)this).HealthError, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("ProtectedItemCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal)this).ProtectedItemCount = (int?) content.GetValueForProperty("ProtectedItemCount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal)this).ProtectedItemCount, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("AccessibleDatastore")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal)this).AccessibleDatastore = (string[]) content.GetValueForProperty("AccessibleDatastore",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal)this).AccessibleDatastore, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("VcenterId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal)this).VcenterId = (string) content.GetValueForProperty("VcenterId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal)this).VcenterId, global::System.Convert.ToString); + } + if (content.Contains("LastDiscoveryInUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal)this).LastDiscoveryInUtc = (global::System.DateTime?) content.GetValueForProperty("LastDiscoveryInUtc",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal)this).LastDiscoveryInUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ReprotectAgentDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("BiosId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal)this).BiosId = (string) content.GetValueForProperty("BiosId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal)this).BiosId, global::System.Convert.ToString); + } + if (content.Contains("FabricObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal)this).FabricObjectId = (string) content.GetValueForProperty("FabricObjectId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal)this).FabricObjectId, global::System.Convert.ToString); + } + if (content.Contains("Fqdn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal)this).Fqdn = (string) content.GetValueForProperty("Fqdn",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal)this).Fqdn, global::System.Convert.ToString); + } + if (content.Contains("Version")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal)this).Version = (string) content.GetValueForProperty("Version",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal)this).Version, global::System.Convert.ToString); + } + if (content.Contains("LastHeartbeatUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal)this).LastHeartbeatUtc = (global::System.DateTime?) content.GetValueForProperty("LastHeartbeatUtc",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal)this).LastHeartbeatUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("Health")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal)this).Health = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth?) content.GetValueForProperty("Health",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal)this).Health, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth.CreateFrom); + } + if (content.Contains("HealthError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal)this).HealthError = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[]) content.GetValueForProperty("HealthError",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal)this).HealthError, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("ProtectedItemCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal)this).ProtectedItemCount = (int?) content.GetValueForProperty("ProtectedItemCount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal)this).ProtectedItemCount, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("AccessibleDatastore")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal)this).AccessibleDatastore = (string[]) content.GetValueForProperty("AccessibleDatastore",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal)this).AccessibleDatastore, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("VcenterId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal)this).VcenterId = (string) content.GetValueForProperty("VcenterId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal)this).VcenterId, global::System.Convert.ToString); + } + if (content.Contains("LastDiscoveryInUtc")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal)this).LastDiscoveryInUtc = (global::System.DateTime?) content.GetValueForProperty("LastDiscoveryInUtc",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal)this).LastDiscoveryInUtc, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Reprotect agent details. + [System.ComponentModel.TypeConverter(typeof(ReprotectAgentDetailsTypeConverter))] + public partial interface IReprotectAgentDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReprotectAgentDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReprotectAgentDetails.TypeConverter.cs new file mode 100644 index 000000000000..a61df315e405 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReprotectAgentDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ReprotectAgentDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ReprotectAgentDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ReprotectAgentDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ReprotectAgentDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReprotectAgentDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReprotectAgentDetails.cs new file mode 100644 index 000000000000..920d4517148a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReprotectAgentDetails.cs @@ -0,0 +1,294 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Reprotect agent details. + public partial class ReprotectAgentDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal + { + + /// Backing field for property. + private string[] _accessibleDatastore; + + /// The list of accessible datastores fetched from discovery. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string[] AccessibleDatastore { get => this._accessibleDatastore; } + + /// Backing field for property. + private string _biosId; + + /// The reprotect agent Bios Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string BiosId { get => this._biosId; } + + /// Backing field for property. + private string _fabricObjectId; + + /// The fabric object Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string FabricObjectId { get => this._fabricObjectId; } + + /// Backing field for property. + private string _fqdn; + + /// The reprotect agent Fqdn. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Fqdn { get => this._fqdn; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth? _health; + + /// The health of the reprotect agent. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth? Health { get => this._health; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] _healthError; + + /// The health errors. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] HealthError { get => this._healthError; } + + /// Backing field for property. + private string _id; + + /// The reprotect agent Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Id { get => this._id; } + + /// Backing field for property. + private global::System.DateTime? _lastDiscoveryInUtc; + + /// The last time when SDS information discovered in SRS. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public global::System.DateTime? LastDiscoveryInUtc { get => this._lastDiscoveryInUtc; } + + /// Backing field for property. + private global::System.DateTime? _lastHeartbeatUtc; + + /// The last heartbeat received from the reprotect agent. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public global::System.DateTime? LastHeartbeatUtc { get => this._lastHeartbeatUtc; } + + /// Internal Acessors for AccessibleDatastore + string[] Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal.AccessibleDatastore { get => this._accessibleDatastore; set { {_accessibleDatastore = value;} } } + + /// Internal Acessors for BiosId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal.BiosId { get => this._biosId; set { {_biosId = value;} } } + + /// Internal Acessors for FabricObjectId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal.FabricObjectId { get => this._fabricObjectId; set { {_fabricObjectId = value;} } } + + /// Internal Acessors for Fqdn + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal.Fqdn { get => this._fqdn; set { {_fqdn = value;} } } + + /// Internal Acessors for Health + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal.Health { get => this._health; set { {_health = value;} } } + + /// Internal Acessors for HealthError + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal.HealthError { get => this._healthError; set { {_healthError = value;} } } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal.Id { get => this._id; set { {_id = value;} } } + + /// Internal Acessors for LastDiscoveryInUtc + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal.LastDiscoveryInUtc { get => this._lastDiscoveryInUtc; set { {_lastDiscoveryInUtc = value;} } } + + /// Internal Acessors for LastHeartbeatUtc + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal.LastHeartbeatUtc { get => this._lastHeartbeatUtc; set { {_lastHeartbeatUtc = value;} } } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal.Name { get => this._name; set { {_name = value;} } } + + /// Internal Acessors for ProtectedItemCount + int? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal.ProtectedItemCount { get => this._protectedItemCount; set { {_protectedItemCount = value;} } } + + /// Internal Acessors for VcenterId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal.VcenterId { get => this._vcenterId; set { {_vcenterId = value;} } } + + /// Internal Acessors for Version + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetailsInternal.Version { get => this._version; set { {_version = value;} } } + + /// Backing field for property. + private string _name; + + /// The reprotect agent name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Name { get => this._name; } + + /// Backing field for property. + private int? _protectedItemCount; + + /// The protected item count. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? ProtectedItemCount { get => this._protectedItemCount; } + + /// Backing field for property. + private string _vcenterId; + + /// The Vcenter Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string VcenterId { get => this._vcenterId; } + + /// Backing field for property. + private string _version; + + /// The version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Version { get => this._version; } + + /// Creates an new instance. + public ReprotectAgentDetails() + { + + } + } + /// Reprotect agent details. + public partial interface IReprotectAgentDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The list of accessible datastores fetched from discovery. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The list of accessible datastores fetched from discovery.", + SerializedName = @"accessibleDatastores", + PossibleTypes = new [] { typeof(string) })] + string[] AccessibleDatastore { get; } + /// The reprotect agent Bios Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The reprotect agent Bios Id.", + SerializedName = @"biosId", + PossibleTypes = new [] { typeof(string) })] + string BiosId { get; } + /// The fabric object Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The fabric object Id.", + SerializedName = @"fabricObjectId", + PossibleTypes = new [] { typeof(string) })] + string FabricObjectId { get; } + /// The reprotect agent Fqdn. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The reprotect agent Fqdn.", + SerializedName = @"fqdn", + PossibleTypes = new [] { typeof(string) })] + string Fqdn { get; } + /// The health of the reprotect agent. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The health of the reprotect agent.", + SerializedName = @"health", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth? Health { get; } + /// The health errors. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The health errors.", + SerializedName = @"healthErrors", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] HealthError { get; } + /// The reprotect agent Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The reprotect agent Id.", + SerializedName = @"id", + PossibleTypes = new [] { typeof(string) })] + string Id { get; } + /// The last time when SDS information discovered in SRS. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The last time when SDS information discovered in SRS.", + SerializedName = @"lastDiscoveryInUtc", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? LastDiscoveryInUtc { get; } + /// The last heartbeat received from the reprotect agent. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The last heartbeat received from the reprotect agent.", + SerializedName = @"lastHeartbeatUtc", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? LastHeartbeatUtc { get; } + /// The reprotect agent name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The reprotect agent name.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string Name { get; } + /// The protected item count. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The protected item count.", + SerializedName = @"protectedItemCount", + PossibleTypes = new [] { typeof(int) })] + int? ProtectedItemCount { get; } + /// The Vcenter Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The Vcenter Id.", + SerializedName = @"vcenterId", + PossibleTypes = new [] { typeof(string) })] + string VcenterId { get; } + /// The version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The version.", + SerializedName = @"version", + PossibleTypes = new [] { typeof(string) })] + string Version { get; } + + } + /// Reprotect agent details. + internal partial interface IReprotectAgentDetailsInternal + + { + /// The list of accessible datastores fetched from discovery. + string[] AccessibleDatastore { get; set; } + /// The reprotect agent Bios Id. + string BiosId { get; set; } + /// The fabric object Id. + string FabricObjectId { get; set; } + /// The reprotect agent Fqdn. + string Fqdn { get; set; } + /// The health of the reprotect agent. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth? Health { get; set; } + /// The health errors. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] HealthError { get; set; } + /// The reprotect agent Id. + string Id { get; set; } + /// The last time when SDS information discovered in SRS. + global::System.DateTime? LastDiscoveryInUtc { get; set; } + /// The last heartbeat received from the reprotect agent. + global::System.DateTime? LastHeartbeatUtc { get; set; } + /// The reprotect agent name. + string Name { get; set; } + /// The protected item count. + int? ProtectedItemCount { get; set; } + /// The Vcenter Id. + string VcenterId { get; set; } + /// The version. + string Version { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReprotectAgentDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReprotectAgentDetails.json.cs new file mode 100644 index 000000000000..d988686d7ebb --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReprotectAgentDetails.json.cs @@ -0,0 +1,187 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Reprotect agent details. + public partial class ReprotectAgentDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReprotectAgentDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new ReprotectAgentDetails(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal ReprotectAgentDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_id = If( json?.PropertyT("id"), out var __jsonId) ? (string)__jsonId : (string)Id;} + {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)Name;} + {_biosId = If( json?.PropertyT("biosId"), out var __jsonBiosId) ? (string)__jsonBiosId : (string)BiosId;} + {_fabricObjectId = If( json?.PropertyT("fabricObjectId"), out var __jsonFabricObjectId) ? (string)__jsonFabricObjectId : (string)FabricObjectId;} + {_fqdn = If( json?.PropertyT("fqdn"), out var __jsonFqdn) ? (string)__jsonFqdn : (string)Fqdn;} + {_version = If( json?.PropertyT("version"), out var __jsonVersion) ? (string)__jsonVersion : (string)Version;} + {_lastHeartbeatUtc = If( json?.PropertyT("lastHeartbeatUtc"), out var __jsonLastHeartbeatUtc) ? global::System.DateTime.TryParse((string)__jsonLastHeartbeatUtc, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonLastHeartbeatUtcValue) ? __jsonLastHeartbeatUtcValue : LastHeartbeatUtc : LastHeartbeatUtc;} + {_health = If( json?.PropertyT("health"), out var __jsonHealth) ? (string)__jsonHealth : (string)Health;} + {_healthError = If( json?.PropertyT("healthErrors"), out var __jsonHealthErrors) ? If( __jsonHealthErrors as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthError.FromJson(__u) )) ))() : null : HealthError;} + {_protectedItemCount = If( json?.PropertyT("protectedItemCount"), out var __jsonProtectedItemCount) ? (int?)__jsonProtectedItemCount : ProtectedItemCount;} + {_accessibleDatastore = If( json?.PropertyT("accessibleDatastores"), out var __jsonAccessibleDatastores) ? If( __jsonAccessibleDatastores as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __q) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__q, (__p)=>(string) (__p is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString __o ? (string)(__o.ToString()) : null)) ))() : null : AccessibleDatastore;} + {_vcenterId = If( json?.PropertyT("vcenterId"), out var __jsonVcenterId) ? (string)__jsonVcenterId : (string)VcenterId;} + {_lastDiscoveryInUtc = If( json?.PropertyT("lastDiscoveryInUtc"), out var __jsonLastDiscoveryInUtc) ? global::System.DateTime.TryParse((string)__jsonLastDiscoveryInUtc, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonLastDiscoveryInUtcValue) ? __jsonLastDiscoveryInUtcValue : LastDiscoveryInUtc : LastDiscoveryInUtc;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._id)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._id.ToString()) : null, "id" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._biosId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._biosId.ToString()) : null, "biosId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._fabricObjectId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._fabricObjectId.ToString()) : null, "fabricObjectId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._fqdn)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._fqdn.ToString()) : null, "fqdn" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._version)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._version.ToString()) : null, "version" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._lastHeartbeatUtc ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._lastHeartbeatUtc?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "lastHeartbeatUtc" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._health)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._health.ToString()) : null, "health" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + if (null != this._healthError) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._healthError ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("healthErrors",__w); + } + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._protectedItemCount ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._protectedItemCount) : null, "protectedItemCount" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + if (null != this._accessibleDatastore) + { + var __r = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __s in this._accessibleDatastore ) + { + AddIf(null != (((object)__s)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(__s.ToString()) : null ,__r.Add); + } + container.Add("accessibleDatastores",__r); + } + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._vcenterId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._vcenterId.ToString()) : null, "vcenterId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._lastDiscoveryInUtc ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._lastDiscoveryInUtc?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "lastDiscoveryInUtc" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResolveHealthError.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResolveHealthError.PowerShell.cs new file mode 100644 index 000000000000..593722d0d3cb --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResolveHealthError.PowerShell.cs @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Resolve health errors input properties. + [System.ComponentModel.TypeConverter(typeof(ResolveHealthErrorTypeConverter))] + public partial class ResolveHealthError + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResolveHealthError DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ResolveHealthError(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResolveHealthError DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ResolveHealthError(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResolveHealthError FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ResolveHealthError(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("HealthErrorId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResolveHealthErrorInternal)this).HealthErrorId = (string) content.GetValueForProperty("HealthErrorId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResolveHealthErrorInternal)this).HealthErrorId, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ResolveHealthError(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("HealthErrorId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResolveHealthErrorInternal)this).HealthErrorId = (string) content.GetValueForProperty("HealthErrorId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResolveHealthErrorInternal)this).HealthErrorId, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Resolve health errors input properties. + [System.ComponentModel.TypeConverter(typeof(ResolveHealthErrorTypeConverter))] + public partial interface IResolveHealthError + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResolveHealthError.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResolveHealthError.TypeConverter.cs new file mode 100644 index 000000000000..62026be14451 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResolveHealthError.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ResolveHealthErrorTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResolveHealthError ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResolveHealthError).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ResolveHealthError.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ResolveHealthError.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ResolveHealthError.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResolveHealthError.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResolveHealthError.cs new file mode 100644 index 000000000000..c2431c3ec9b7 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResolveHealthError.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Resolve health errors input properties. + public partial class ResolveHealthError : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResolveHealthError, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResolveHealthErrorInternal + { + + /// Backing field for property. + private string _healthErrorId; + + /// Health error id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string HealthErrorId { get => this._healthErrorId; set => this._healthErrorId = value; } + + /// Creates an new instance. + public ResolveHealthError() + { + + } + } + /// Resolve health errors input properties. + public partial interface IResolveHealthError : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// Health error id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Health error id.", + SerializedName = @"healthErrorId", + PossibleTypes = new [] { typeof(string) })] + string HealthErrorId { get; set; } + + } + /// Resolve health errors input properties. + internal partial interface IResolveHealthErrorInternal + + { + /// Health error id. + string HealthErrorId { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResolveHealthError.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResolveHealthError.json.cs new file mode 100644 index 000000000000..ff25ba74fee0 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResolveHealthError.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Resolve health errors input properties. + public partial class ResolveHealthError + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResolveHealthError. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResolveHealthError. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResolveHealthError FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new ResolveHealthError(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal ResolveHealthError(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_healthErrorId = If( json?.PropertyT("healthErrorId"), out var __jsonHealthErrorId) ? (string)__jsonHealthErrorId : (string)HealthErrorId;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._healthErrorId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._healthErrorId.ToString()) : null, "healthErrorId" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResolveHealthInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResolveHealthInput.PowerShell.cs new file mode 100644 index 000000000000..ef0c8067d906 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResolveHealthInput.PowerShell.cs @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Resolve health input. + [System.ComponentModel.TypeConverter(typeof(ResolveHealthInputTypeConverter))] + public partial class ResolveHealthInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResolveHealthInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ResolveHealthInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResolveHealthInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ResolveHealthInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResolveHealthInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ResolveHealthInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResolveHealthInputInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResolveHealthInputProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResolveHealthInputInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ResolveHealthInputPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("HealthError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResolveHealthInputInternal)this).HealthError = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResolveHealthError[]) content.GetValueForProperty("HealthError",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResolveHealthInputInternal)this).HealthError, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ResolveHealthErrorTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ResolveHealthInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResolveHealthInputInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResolveHealthInputProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResolveHealthInputInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ResolveHealthInputPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("HealthError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResolveHealthInputInternal)this).HealthError = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResolveHealthError[]) content.GetValueForProperty("HealthError",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResolveHealthInputInternal)this).HealthError, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ResolveHealthErrorTypeConverter.ConvertFrom)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Resolve health input. + [System.ComponentModel.TypeConverter(typeof(ResolveHealthInputTypeConverter))] + public partial interface IResolveHealthInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResolveHealthInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResolveHealthInput.TypeConverter.cs new file mode 100644 index 000000000000..dd982f3b34bb --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResolveHealthInput.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ResolveHealthInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResolveHealthInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResolveHealthInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ResolveHealthInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ResolveHealthInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ResolveHealthInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResolveHealthInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResolveHealthInput.cs new file mode 100644 index 000000000000..b0d188512f7c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResolveHealthInput.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Resolve health input. + public partial class ResolveHealthInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResolveHealthInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResolveHealthInputInternal + { + + /// Health errors. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResolveHealthError[] HealthError { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResolveHealthInputPropertiesInternal)Property).HealthError; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResolveHealthInputPropertiesInternal)Property).HealthError = value ?? null /* arrayOf */; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResolveHealthInputProperties Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResolveHealthInputInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ResolveHealthInputProperties()); set { {_property = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResolveHealthInputProperties _property; + + /// Disable resolve health input properties. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResolveHealthInputProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ResolveHealthInputProperties()); set => this._property = value; } + + /// Creates an new instance. + public ResolveHealthInput() + { + + } + } + /// Resolve health input. + public partial interface IResolveHealthInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// Health errors. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Health errors.", + SerializedName = @"healthErrors", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResolveHealthError) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResolveHealthError[] HealthError { get; set; } + + } + /// Resolve health input. + internal partial interface IResolveHealthInputInternal + + { + /// Health errors. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResolveHealthError[] HealthError { get; set; } + /// Disable resolve health input properties. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResolveHealthInputProperties Property { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResolveHealthInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResolveHealthInput.json.cs new file mode 100644 index 000000000000..f7a1d8bf8a60 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResolveHealthInput.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Resolve health input. + public partial class ResolveHealthInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResolveHealthInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResolveHealthInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResolveHealthInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new ResolveHealthInput(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal ResolveHealthInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ResolveHealthInputProperties.FromJson(__jsonProperties) : Property;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResolveHealthInputProperties.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResolveHealthInputProperties.PowerShell.cs new file mode 100644 index 000000000000..44a3fd594343 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResolveHealthInputProperties.PowerShell.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Resolve health input properties. + [System.ComponentModel.TypeConverter(typeof(ResolveHealthInputPropertiesTypeConverter))] + public partial class ResolveHealthInputProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResolveHealthInputProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ResolveHealthInputProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResolveHealthInputProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ResolveHealthInputProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResolveHealthInputProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ResolveHealthInputProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("HealthError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResolveHealthInputPropertiesInternal)this).HealthError = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResolveHealthError[]) content.GetValueForProperty("HealthError",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResolveHealthInputPropertiesInternal)this).HealthError, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ResolveHealthErrorTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ResolveHealthInputProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("HealthError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResolveHealthInputPropertiesInternal)this).HealthError = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResolveHealthError[]) content.GetValueForProperty("HealthError",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResolveHealthInputPropertiesInternal)this).HealthError, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ResolveHealthErrorTypeConverter.ConvertFrom)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Resolve health input properties. + [System.ComponentModel.TypeConverter(typeof(ResolveHealthInputPropertiesTypeConverter))] + public partial interface IResolveHealthInputProperties + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResolveHealthInputProperties.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResolveHealthInputProperties.TypeConverter.cs new file mode 100644 index 000000000000..231919275159 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResolveHealthInputProperties.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ResolveHealthInputPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResolveHealthInputProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResolveHealthInputProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ResolveHealthInputProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ResolveHealthInputProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ResolveHealthInputProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResolveHealthInputProperties.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResolveHealthInputProperties.cs new file mode 100644 index 000000000000..6740125484a0 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResolveHealthInputProperties.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Resolve health input properties. + public partial class ResolveHealthInputProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResolveHealthInputProperties, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResolveHealthInputPropertiesInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResolveHealthError[] _healthError; + + /// Health errors. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResolveHealthError[] HealthError { get => this._healthError; set => this._healthError = value; } + + /// Creates an new instance. + public ResolveHealthInputProperties() + { + + } + } + /// Resolve health input properties. + public partial interface IResolveHealthInputProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// Health errors. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Health errors.", + SerializedName = @"healthErrors", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResolveHealthError) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResolveHealthError[] HealthError { get; set; } + + } + /// Resolve health input properties. + internal partial interface IResolveHealthInputPropertiesInternal + + { + /// Health errors. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResolveHealthError[] HealthError { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResolveHealthInputProperties.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResolveHealthInputProperties.json.cs new file mode 100644 index 000000000000..3b28ce78d705 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResolveHealthInputProperties.json.cs @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Resolve health input properties. + public partial class ResolveHealthInputProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResolveHealthInputProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResolveHealthInputProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResolveHealthInputProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new ResolveHealthInputProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal ResolveHealthInputProperties(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_healthError = If( json?.PropertyT("healthErrors"), out var __jsonHealthErrors) ? If( __jsonHealthErrors as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResolveHealthError) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ResolveHealthError.FromJson(__u) )) ))() : null : HealthError;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._healthError) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._healthError ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("healthErrors",__w); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Resource.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Resource.PowerShell.cs new file mode 100644 index 000000000000..5bf88884fff9 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Resource.PowerShell.cs @@ -0,0 +1,168 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Azure resource. + [System.ComponentModel.TypeConverter(typeof(ResourceTypeConverter))] + public partial class Resource + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResource DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new Resource(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResource DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new Resource(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResource FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal Resource(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Location, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal Resource(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Location, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Azure resource. + [System.ComponentModel.TypeConverter(typeof(ResourceTypeConverter))] + public partial interface IResource + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Resource.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Resource.TypeConverter.cs new file mode 100644 index 000000000000..339de32343d9 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Resource.TypeConverter.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ResourceTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResource ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResource).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return Resource.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return Resource.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return Resource.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Resource.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Resource.cs new file mode 100644 index 000000000000..3052e4cb5948 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Resource.cs @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Azure resource. + public partial class Resource : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResource, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal + { + + /// Backing field for property. + private string _id; + + /// Resource Id + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Id { get => this._id; } + + /// Backing field for property. + private string _location; + + /// Resource Location + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Location { get => this._location; set => this._location = value; } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal.Id { get => this._id; set { {_id = value;} } } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal.Name { get => this._name; set { {_name = value;} } } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal.Type { get => this._type; set { {_type = value;} } } + + /// Backing field for property. + private string _name; + + /// Resource Name + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Name { get => this._name; } + + /// Backing field for property. + private string _type; + + /// Resource Type + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Type { get => this._type; } + + /// Creates an new instance. + public Resource() + { + + } + } + /// Azure resource. + public partial interface IResource : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// Resource Id + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Resource Id", + SerializedName = @"id", + PossibleTypes = new [] { typeof(string) })] + string Id { get; } + /// Resource Location + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Resource Location", + SerializedName = @"location", + PossibleTypes = new [] { typeof(string) })] + string Location { get; set; } + /// Resource Name + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Resource Name", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string Name { get; } + /// Resource Type + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Resource Type", + SerializedName = @"type", + PossibleTypes = new [] { typeof(string) })] + string Type { get; } + + } + /// Azure resource. + internal partial interface IResourceInternal + + { + /// Resource Id + string Id { get; set; } + /// Resource Location + string Location { get; set; } + /// Resource Name + string Name { get; set; } + /// Resource Type + string Type { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Resource.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Resource.json.cs new file mode 100644 index 000000000000..84470dffc852 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Resource.json.cs @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Azure resource. + public partial class Resource + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResource. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResource. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResource FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new Resource(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal Resource(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_id = If( json?.PropertyT("id"), out var __jsonId) ? (string)__jsonId : (string)Id;} + {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)Name;} + {_type = If( json?.PropertyT("type"), out var __jsonType) ? (string)__jsonType : (string)Type;} + {_location = If( json?.PropertyT("location"), out var __jsonLocation) ? (string)__jsonLocation : (string)Location;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._id)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._id.ToString()) : null, "id" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._type)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._type.ToString()) : null, "type" ,container.Add ); + } + AddIf( null != (((object)this._location)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._location.ToString()) : null, "location" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResourceHealthSummary.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResourceHealthSummary.PowerShell.cs new file mode 100644 index 000000000000..aff54cc81161 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResourceHealthSummary.PowerShell.cs @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// Base class to define the health summary of the resources contained under an Arm resource. + /// + [System.ComponentModel.TypeConverter(typeof(ResourceHealthSummaryTypeConverter))] + public partial class ResourceHealthSummary + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummary DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ResourceHealthSummary(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummary DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ResourceHealthSummary(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummary FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ResourceHealthSummary(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ResourceCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummaryInternal)this).ResourceCount = (int?) content.GetValueForProperty("ResourceCount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummaryInternal)this).ResourceCount, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("Issue")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummaryInternal)this).Issue = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorSummary[]) content.GetValueForProperty("Issue",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummaryInternal)this).Issue, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthErrorSummaryTypeConverter.ConvertFrom)); + } + if (content.Contains("CategorizedResourceCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummaryInternal)this).CategorizedResourceCount = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummaryCategorizedResourceCounts) content.GetValueForProperty("CategorizedResourceCount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummaryInternal)this).CategorizedResourceCount, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ResourceHealthSummaryCategorizedResourceCountsTypeConverter.ConvertFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ResourceHealthSummary(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ResourceCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummaryInternal)this).ResourceCount = (int?) content.GetValueForProperty("ResourceCount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummaryInternal)this).ResourceCount, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("Issue")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummaryInternal)this).Issue = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorSummary[]) content.GetValueForProperty("Issue",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummaryInternal)this).Issue, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthErrorSummaryTypeConverter.ConvertFrom)); + } + if (content.Contains("CategorizedResourceCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummaryInternal)this).CategorizedResourceCount = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummaryCategorizedResourceCounts) content.GetValueForProperty("CategorizedResourceCount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummaryInternal)this).CategorizedResourceCount, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ResourceHealthSummaryCategorizedResourceCountsTypeConverter.ConvertFrom); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Base class to define the health summary of the resources contained under an Arm resource. + [System.ComponentModel.TypeConverter(typeof(ResourceHealthSummaryTypeConverter))] + public partial interface IResourceHealthSummary + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResourceHealthSummary.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResourceHealthSummary.TypeConverter.cs new file mode 100644 index 000000000000..c6716e540616 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResourceHealthSummary.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ResourceHealthSummaryTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummary ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummary).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ResourceHealthSummary.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ResourceHealthSummary.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ResourceHealthSummary.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResourceHealthSummary.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResourceHealthSummary.cs new file mode 100644 index 000000000000..cbf582e396a5 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResourceHealthSummary.cs @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// + /// Base class to define the health summary of the resources contained under an Arm resource. + /// + public partial class ResourceHealthSummary : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummary, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummaryInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummaryCategorizedResourceCounts _categorizedResourceCount; + + /// The categorized resource counts. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummaryCategorizedResourceCounts CategorizedResourceCount { get => (this._categorizedResourceCount = this._categorizedResourceCount ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ResourceHealthSummaryCategorizedResourceCounts()); set => this._categorizedResourceCount = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorSummary[] _issue; + + /// The list of summary of health errors across the resources under the container. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorSummary[] Issue { get => this._issue; set => this._issue = value; } + + /// Backing field for property. + private int? _resourceCount; + + /// The count of total resources under the container. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? ResourceCount { get => this._resourceCount; set => this._resourceCount = value; } + + /// Creates an new instance. + public ResourceHealthSummary() + { + + } + } + /// Base class to define the health summary of the resources contained under an Arm resource. + public partial interface IResourceHealthSummary : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The categorized resource counts. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The categorized resource counts.", + SerializedName = @"categorizedResourceCounts", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummaryCategorizedResourceCounts) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummaryCategorizedResourceCounts CategorizedResourceCount { get; set; } + /// The list of summary of health errors across the resources under the container. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of summary of health errors across the resources under the container.", + SerializedName = @"issues", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorSummary) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorSummary[] Issue { get; set; } + /// The count of total resources under the container. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The count of total resources under the container.", + SerializedName = @"resourceCount", + PossibleTypes = new [] { typeof(int) })] + int? ResourceCount { get; set; } + + } + /// Base class to define the health summary of the resources contained under an Arm resource. + internal partial interface IResourceHealthSummaryInternal + + { + /// The categorized resource counts. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummaryCategorizedResourceCounts CategorizedResourceCount { get; set; } + /// The list of summary of health errors across the resources under the container. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorSummary[] Issue { get; set; } + /// The count of total resources under the container. + int? ResourceCount { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResourceHealthSummary.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResourceHealthSummary.json.cs new file mode 100644 index 000000000000..e08c6f139c27 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResourceHealthSummary.json.cs @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// + /// Base class to define the health summary of the resources contained under an Arm resource. + /// + public partial class ResourceHealthSummary + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummary. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummary. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummary FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new ResourceHealthSummary(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal ResourceHealthSummary(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_resourceCount = If( json?.PropertyT("resourceCount"), out var __jsonResourceCount) ? (int?)__jsonResourceCount : ResourceCount;} + {_issue = If( json?.PropertyT("issues"), out var __jsonIssues) ? If( __jsonIssues as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorSummary) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthErrorSummary.FromJson(__u) )) ))() : null : Issue;} + {_categorizedResourceCount = If( json?.PropertyT("categorizedResourceCounts"), out var __jsonCategorizedResourceCounts) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ResourceHealthSummaryCategorizedResourceCounts.FromJson(__jsonCategorizedResourceCounts) : CategorizedResourceCount;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._resourceCount ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._resourceCount) : null, "resourceCount" ,container.Add ); + if (null != this._issue) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._issue ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("issues",__w); + } + AddIf( null != this._categorizedResourceCount ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._categorizedResourceCount.ToJson(null,serializationMode) : null, "categorizedResourceCounts" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResourceHealthSummaryCategorizedResourceCounts.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResourceHealthSummaryCategorizedResourceCounts.PowerShell.cs new file mode 100644 index 000000000000..94ac2640b94a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResourceHealthSummaryCategorizedResourceCounts.PowerShell.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// The categorized resource counts. + [System.ComponentModel.TypeConverter(typeof(ResourceHealthSummaryCategorizedResourceCountsTypeConverter))] + public partial class ResourceHealthSummaryCategorizedResourceCounts + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummaryCategorizedResourceCounts DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ResourceHealthSummaryCategorizedResourceCounts(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummaryCategorizedResourceCounts DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ResourceHealthSummaryCategorizedResourceCounts(content); + } + + /// + /// Creates a new instance of , deserializing the content from + /// a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummaryCategorizedResourceCounts FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ResourceHealthSummaryCategorizedResourceCounts(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ResourceHealthSummaryCategorizedResourceCounts(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// The categorized resource counts. + [System.ComponentModel.TypeConverter(typeof(ResourceHealthSummaryCategorizedResourceCountsTypeConverter))] + public partial interface IResourceHealthSummaryCategorizedResourceCounts + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResourceHealthSummaryCategorizedResourceCounts.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResourceHealthSummaryCategorizedResourceCounts.TypeConverter.cs new file mode 100644 index 000000000000..7e649e119c3f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResourceHealthSummaryCategorizedResourceCounts.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ResourceHealthSummaryCategorizedResourceCountsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, + /// otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummaryCategorizedResourceCounts ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummaryCategorizedResourceCounts).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ResourceHealthSummaryCategorizedResourceCounts.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ResourceHealthSummaryCategorizedResourceCounts.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ResourceHealthSummaryCategorizedResourceCounts.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResourceHealthSummaryCategorizedResourceCounts.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResourceHealthSummaryCategorizedResourceCounts.cs new file mode 100644 index 000000000000..d936755112cd --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResourceHealthSummaryCategorizedResourceCounts.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The categorized resource counts. + public partial class ResourceHealthSummaryCategorizedResourceCounts : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummaryCategorizedResourceCounts, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummaryCategorizedResourceCountsInternal + { + + /// + /// Creates an new instance. + /// + public ResourceHealthSummaryCategorizedResourceCounts() + { + + } + } + /// The categorized resource counts. + public partial interface IResourceHealthSummaryCategorizedResourceCounts : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray + { + + } + /// The categorized resource counts. + internal partial interface IResourceHealthSummaryCategorizedResourceCountsInternal + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResourceHealthSummaryCategorizedResourceCounts.dictionary.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResourceHealthSummaryCategorizedResourceCounts.dictionary.cs new file mode 100644 index 000000000000..e47f0eb02905 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResourceHealthSummaryCategorizedResourceCounts.dictionary.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + public partial class ResourceHealthSummaryCategorizedResourceCounts : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray + { + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + + int Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Values { get => __additionalProperties.Values; } + + public int this[global::System.String index] { get => __additionalProperties[index]; set => __additionalProperties[index] = value; } + + /// + /// + public void Add(global::System.String key, int value) => __additionalProperties.Add( key, value); + + public void Clear() => __additionalProperties.Clear(); + + /// + public bool ContainsKey(global::System.String key) => __additionalProperties.ContainsKey( key); + + /// + public void CopyFrom(global::System.Collections.IDictionary source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public void CopyFrom(global::System.Management.Automation.PSObject source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public bool Remove(global::System.String key) => __additionalProperties.Remove( key); + + /// + /// + public bool TryGetValue(global::System.String key, out int value) => __additionalProperties.TryGetValue( key, out value); + + /// + + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ResourceHealthSummaryCategorizedResourceCounts source) => source.__additionalProperties; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResourceHealthSummaryCategorizedResourceCounts.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResourceHealthSummaryCategorizedResourceCounts.json.cs new file mode 100644 index 000000000000..e05809bd4151 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResourceHealthSummaryCategorizedResourceCounts.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The categorized resource counts. + public partial class ResourceHealthSummaryCategorizedResourceCounts + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummaryCategorizedResourceCounts. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummaryCategorizedResourceCounts. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummaryCategorizedResourceCounts FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new ResourceHealthSummaryCategorizedResourceCounts(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + /// + internal ResourceHealthSummaryCategorizedResourceCounts(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, global::System.Collections.Generic.HashSet exclusions = null) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray)this).AdditionalProperties, null ,exclusions ); + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray)this).AdditionalProperties, container); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResumeJobParams.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResumeJobParams.PowerShell.cs new file mode 100644 index 000000000000..854d424224bf --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResumeJobParams.PowerShell.cs @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Resume job params. + [System.ComponentModel.TypeConverter(typeof(ResumeJobParamsTypeConverter))] + public partial class ResumeJobParams + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeJobParams DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ResumeJobParams(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeJobParams DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ResumeJobParams(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeJobParams FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ResumeJobParams(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeJobParamsInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeJobParamsProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeJobParamsInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ResumeJobParamsPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Comment")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeJobParamsInternal)this).Comment = (string) content.GetValueForProperty("Comment",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeJobParamsInternal)this).Comment, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ResumeJobParams(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeJobParamsInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeJobParamsProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeJobParamsInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ResumeJobParamsPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Comment")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeJobParamsInternal)this).Comment = (string) content.GetValueForProperty("Comment",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeJobParamsInternal)this).Comment, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Resume job params. + [System.ComponentModel.TypeConverter(typeof(ResumeJobParamsTypeConverter))] + public partial interface IResumeJobParams + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResumeJobParams.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResumeJobParams.TypeConverter.cs new file mode 100644 index 000000000000..8b377b9cd8b8 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResumeJobParams.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ResumeJobParamsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeJobParams ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeJobParams).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ResumeJobParams.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ResumeJobParams.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ResumeJobParams.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResumeJobParams.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResumeJobParams.cs new file mode 100644 index 000000000000..6882e105c092 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResumeJobParams.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Resume job params. + public partial class ResumeJobParams : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeJobParams, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeJobParamsInternal + { + + /// Resume job comments. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string Comment { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeJobParamsPropertiesInternal)Property).Comment; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeJobParamsPropertiesInternal)Property).Comment = value ?? null; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeJobParamsProperties Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeJobParamsInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ResumeJobParamsProperties()); set { {_property = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeJobParamsProperties _property; + + /// Resume job properties. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeJobParamsProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ResumeJobParamsProperties()); set => this._property = value; } + + /// Creates an new instance. + public ResumeJobParams() + { + + } + } + /// Resume job params. + public partial interface IResumeJobParams : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// Resume job comments. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Resume job comments.", + SerializedName = @"comments", + PossibleTypes = new [] { typeof(string) })] + string Comment { get; set; } + + } + /// Resume job params. + internal partial interface IResumeJobParamsInternal + + { + /// Resume job comments. + string Comment { get; set; } + /// Resume job properties. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeJobParamsProperties Property { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResumeJobParams.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResumeJobParams.json.cs new file mode 100644 index 000000000000..bf0e4df5ee07 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResumeJobParams.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Resume job params. + public partial class ResumeJobParams + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeJobParams. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeJobParams. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeJobParams FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new ResumeJobParams(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal ResumeJobParams(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ResumeJobParamsProperties.FromJson(__jsonProperties) : Property;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResumeJobParamsProperties.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResumeJobParamsProperties.PowerShell.cs new file mode 100644 index 000000000000..80fd41a6f9e2 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResumeJobParamsProperties.PowerShell.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Resume job properties. + [System.ComponentModel.TypeConverter(typeof(ResumeJobParamsPropertiesTypeConverter))] + public partial class ResumeJobParamsProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeJobParamsProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ResumeJobParamsProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeJobParamsProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ResumeJobParamsProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeJobParamsProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ResumeJobParamsProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Comment")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeJobParamsPropertiesInternal)this).Comment = (string) content.GetValueForProperty("Comment",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeJobParamsPropertiesInternal)this).Comment, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ResumeJobParamsProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Comment")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeJobParamsPropertiesInternal)this).Comment = (string) content.GetValueForProperty("Comment",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeJobParamsPropertiesInternal)this).Comment, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Resume job properties. + [System.ComponentModel.TypeConverter(typeof(ResumeJobParamsPropertiesTypeConverter))] + public partial interface IResumeJobParamsProperties + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResumeJobParamsProperties.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResumeJobParamsProperties.TypeConverter.cs new file mode 100644 index 000000000000..ff21ed683d65 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResumeJobParamsProperties.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ResumeJobParamsPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeJobParamsProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeJobParamsProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ResumeJobParamsProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ResumeJobParamsProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ResumeJobParamsProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResumeJobParamsProperties.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResumeJobParamsProperties.cs new file mode 100644 index 000000000000..328204a6165f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResumeJobParamsProperties.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Resume job properties. + public partial class ResumeJobParamsProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeJobParamsProperties, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeJobParamsPropertiesInternal + { + + /// Backing field for property. + private string _comment; + + /// Resume job comments. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Comment { get => this._comment; set => this._comment = value; } + + /// Creates an new instance. + public ResumeJobParamsProperties() + { + + } + } + /// Resume job properties. + public partial interface IResumeJobParamsProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// Resume job comments. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Resume job comments.", + SerializedName = @"comments", + PossibleTypes = new [] { typeof(string) })] + string Comment { get; set; } + + } + /// Resume job properties. + internal partial interface IResumeJobParamsPropertiesInternal + + { + /// Resume job comments. + string Comment { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResumeJobParamsProperties.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResumeJobParamsProperties.json.cs new file mode 100644 index 000000000000..b63fea20c31c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResumeJobParamsProperties.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Resume job properties. + public partial class ResumeJobParamsProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeJobParamsProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeJobParamsProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeJobParamsProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new ResumeJobParamsProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal ResumeJobParamsProperties(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_comment = If( json?.PropertyT("comments"), out var __jsonComments) ? (string)__jsonComments : (string)Comment;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._comment)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._comment.ToString()) : null, "comments" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResumeReplicationInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResumeReplicationInput.PowerShell.cs new file mode 100644 index 000000000000..3d5714cbcfc9 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResumeReplicationInput.PowerShell.cs @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Resume replication input. + [System.ComponentModel.TypeConverter(typeof(ResumeReplicationInputTypeConverter))] + public partial class ResumeReplicationInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ResumeReplicationInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ResumeReplicationInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ResumeReplicationInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationInputInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationInputProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationInputInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ResumeReplicationInputPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationInputInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationProviderSpecificInput) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationInputInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ResumeReplicationProviderSpecificInputTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationInputInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationInputInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ResumeReplicationInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationInputInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationInputProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationInputInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ResumeReplicationInputPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationInputInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationProviderSpecificInput) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationInputInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ResumeReplicationProviderSpecificInputTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationInputInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationInputInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Resume replication input. + [System.ComponentModel.TypeConverter(typeof(ResumeReplicationInputTypeConverter))] + public partial interface IResumeReplicationInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResumeReplicationInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResumeReplicationInput.TypeConverter.cs new file mode 100644 index 000000000000..1631e49f9248 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResumeReplicationInput.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ResumeReplicationInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ResumeReplicationInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ResumeReplicationInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ResumeReplicationInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResumeReplicationInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResumeReplicationInput.cs new file mode 100644 index 000000000000..92049a396e90 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResumeReplicationInput.cs @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Resume replication input. + public partial class ResumeReplicationInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationInputInternal + { + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationInputProperties Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationInputInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ResumeReplicationInputProperties()); set { {_property = value;} } } + + /// Internal Acessors for ProviderSpecificDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationProviderSpecificInput Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationInputInternal.ProviderSpecificDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationInputPropertiesInternal)Property).ProviderSpecificDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationInputPropertiesInternal)Property).ProviderSpecificDetail = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationInputProperties _property; + + /// Resume replication input properties. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationInputProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ResumeReplicationInputProperties()); set => this._property = value; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ProviderSpecificDetailInstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationInputPropertiesInternal)Property).ProviderSpecificDetailInstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationInputPropertiesInternal)Property).ProviderSpecificDetailInstanceType = value ; } + + /// Creates an new instance. + public ResumeReplicationInput() + { + + } + } + /// Resume replication input. + public partial interface IResumeReplicationInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string ProviderSpecificDetailInstanceType { get; set; } + + } + /// Resume replication input. + internal partial interface IResumeReplicationInputInternal + + { + /// Resume replication input properties. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationInputProperties Property { get; set; } + /// The provider specific input for resume replication. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationProviderSpecificInput ProviderSpecificDetail { get; set; } + /// The class type. + string ProviderSpecificDetailInstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResumeReplicationInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResumeReplicationInput.json.cs new file mode 100644 index 000000000000..7e7206eefc23 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResumeReplicationInput.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Resume replication input. + public partial class ResumeReplicationInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new ResumeReplicationInput(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal ResumeReplicationInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ResumeReplicationInputProperties.FromJson(__jsonProperties) : Property;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResumeReplicationInputProperties.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResumeReplicationInputProperties.PowerShell.cs new file mode 100644 index 000000000000..ea02dbcb268e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResumeReplicationInputProperties.PowerShell.cs @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Resume replication input properties. + [System.ComponentModel.TypeConverter(typeof(ResumeReplicationInputPropertiesTypeConverter))] + public partial class ResumeReplicationInputProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationInputProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ResumeReplicationInputProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationInputProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ResumeReplicationInputProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationInputProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ResumeReplicationInputProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationInputPropertiesInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationProviderSpecificInput) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationInputPropertiesInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ResumeReplicationProviderSpecificInputTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationInputPropertiesInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationInputPropertiesInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ResumeReplicationInputProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationInputPropertiesInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationProviderSpecificInput) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationInputPropertiesInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ResumeReplicationProviderSpecificInputTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationInputPropertiesInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationInputPropertiesInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Resume replication input properties. + [System.ComponentModel.TypeConverter(typeof(ResumeReplicationInputPropertiesTypeConverter))] + public partial interface IResumeReplicationInputProperties + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResumeReplicationInputProperties.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResumeReplicationInputProperties.TypeConverter.cs new file mode 100644 index 000000000000..ab0b6482a430 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResumeReplicationInputProperties.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ResumeReplicationInputPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationInputProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationInputProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ResumeReplicationInputProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ResumeReplicationInputProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ResumeReplicationInputProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResumeReplicationInputProperties.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResumeReplicationInputProperties.cs new file mode 100644 index 000000000000..99092ca5b8c8 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResumeReplicationInputProperties.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Resume replication input properties. + public partial class ResumeReplicationInputProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationInputProperties, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationInputPropertiesInternal + { + + /// Internal Acessors for ProviderSpecificDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationProviderSpecificInput Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationInputPropertiesInternal.ProviderSpecificDetail { get => (this._providerSpecificDetail = this._providerSpecificDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ResumeReplicationProviderSpecificInput()); set { {_providerSpecificDetail = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationProviderSpecificInput _providerSpecificDetail; + + /// The provider specific input for resume replication. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationProviderSpecificInput ProviderSpecificDetail { get => (this._providerSpecificDetail = this._providerSpecificDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ResumeReplicationProviderSpecificInput()); set => this._providerSpecificDetail = value; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ProviderSpecificDetailInstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationProviderSpecificInputInternal)ProviderSpecificDetail).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationProviderSpecificInputInternal)ProviderSpecificDetail).InstanceType = value ; } + + /// Creates an new instance. + public ResumeReplicationInputProperties() + { + + } + } + /// Resume replication input properties. + public partial interface IResumeReplicationInputProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string ProviderSpecificDetailInstanceType { get; set; } + + } + /// Resume replication input properties. + internal partial interface IResumeReplicationInputPropertiesInternal + + { + /// The provider specific input for resume replication. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationProviderSpecificInput ProviderSpecificDetail { get; set; } + /// The class type. + string ProviderSpecificDetailInstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResumeReplicationInputProperties.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResumeReplicationInputProperties.json.cs new file mode 100644 index 000000000000..5222652a2fc8 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResumeReplicationInputProperties.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Resume replication input properties. + public partial class ResumeReplicationInputProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationInputProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationInputProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationInputProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new ResumeReplicationInputProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal ResumeReplicationInputProperties(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_providerSpecificDetail = If( json?.PropertyT("providerSpecificDetails"), out var __jsonProviderSpecificDetails) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ResumeReplicationProviderSpecificInput.FromJson(__jsonProviderSpecificDetails) : ProviderSpecificDetail;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._providerSpecificDetail ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._providerSpecificDetail.ToJson(null,serializationMode) : null, "providerSpecificDetails" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResumeReplicationProviderSpecificInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResumeReplicationProviderSpecificInput.PowerShell.cs new file mode 100644 index 000000000000..90250e67afc8 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResumeReplicationProviderSpecificInput.PowerShell.cs @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Resume replication provider specific input. + [System.ComponentModel.TypeConverter(typeof(ResumeReplicationProviderSpecificInputTypeConverter))] + public partial class ResumeReplicationProviderSpecificInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationProviderSpecificInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ResumeReplicationProviderSpecificInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationProviderSpecificInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ResumeReplicationProviderSpecificInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json + /// string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationProviderSpecificInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ResumeReplicationProviderSpecificInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ResumeReplicationProviderSpecificInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Resume replication provider specific input. + [System.ComponentModel.TypeConverter(typeof(ResumeReplicationProviderSpecificInputTypeConverter))] + public partial interface IResumeReplicationProviderSpecificInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResumeReplicationProviderSpecificInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResumeReplicationProviderSpecificInput.TypeConverter.cs new file mode 100644 index 000000000000..de09944dc36a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResumeReplicationProviderSpecificInput.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ResumeReplicationProviderSpecificInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationProviderSpecificInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationProviderSpecificInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ResumeReplicationProviderSpecificInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ResumeReplicationProviderSpecificInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ResumeReplicationProviderSpecificInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResumeReplicationProviderSpecificInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResumeReplicationProviderSpecificInput.cs new file mode 100644 index 000000000000..919efb41d4ef --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResumeReplicationProviderSpecificInput.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Resume replication provider specific input. + public partial class ResumeReplicationProviderSpecificInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationProviderSpecificInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationProviderSpecificInputInternal + { + + /// Backing field for property. + private string _instanceType; + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string InstanceType { get => this._instanceType; set => this._instanceType = value; } + + /// Creates an new instance. + public ResumeReplicationProviderSpecificInput() + { + + } + } + /// Resume replication provider specific input. + public partial interface IResumeReplicationProviderSpecificInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string InstanceType { get; set; } + + } + /// Resume replication provider specific input. + internal partial interface IResumeReplicationProviderSpecificInputInternal + + { + /// The class type. + string InstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResumeReplicationProviderSpecificInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResumeReplicationProviderSpecificInput.json.cs new file mode 100644 index 000000000000..1daf44c57ccf --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResumeReplicationProviderSpecificInput.json.cs @@ -0,0 +1,124 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Resume replication provider specific input. + public partial class ResumeReplicationProviderSpecificInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationProviderSpecificInput. + /// Note: the Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationProviderSpecificInput interface + /// is polymorphic, and the precise model class that will get deserialized is determined at runtime based on the payload. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationProviderSpecificInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationProviderSpecificInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + if (!(node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json)) + { + return null; + } + // Polymorphic type -- select the appropriate constructor using the discriminator + + switch ( json.StringProperty("instanceType") ) + { + case "VMwareCbt": + { + return new VMwareCbtResumeReplicationInput(json); + } + } + return new ResumeReplicationProviderSpecificInput(json); + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal ResumeReplicationProviderSpecificInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_instanceType = If( json?.PropertyT("instanceType"), out var __jsonInstanceType) ? (string)__jsonInstanceType : (string)InstanceType;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._instanceType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._instanceType.ToString()) : null, "instanceType" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResyncInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResyncInput.PowerShell.cs new file mode 100644 index 000000000000..9a592a5f2bcb --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResyncInput.PowerShell.cs @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Resync input. + [System.ComponentModel.TypeConverter(typeof(ResyncInputTypeConverter))] + public partial class ResyncInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ResyncInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ResyncInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ResyncInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncInputInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncInputProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncInputInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ResyncInputPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncInputInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncProviderSpecificInput) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncInputInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ResyncProviderSpecificInputTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncInputInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncInputInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ResyncInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncInputInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncInputProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncInputInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ResyncInputPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncInputInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncProviderSpecificInput) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncInputInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ResyncProviderSpecificInputTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncInputInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncInputInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Resync input. + [System.ComponentModel.TypeConverter(typeof(ResyncInputTypeConverter))] + public partial interface IResyncInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResyncInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResyncInput.TypeConverter.cs new file mode 100644 index 000000000000..6b787ef75fa5 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResyncInput.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ResyncInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ResyncInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ResyncInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ResyncInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResyncInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResyncInput.cs new file mode 100644 index 000000000000..eb391ca6ff12 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResyncInput.cs @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Resync input. + public partial class ResyncInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncInputInternal + { + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncInputProperties Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncInputInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ResyncInputProperties()); set { {_property = value;} } } + + /// Internal Acessors for ProviderSpecificDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncProviderSpecificInput Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncInputInternal.ProviderSpecificDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncInputPropertiesInternal)Property).ProviderSpecificDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncInputPropertiesInternal)Property).ProviderSpecificDetail = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncInputProperties _property; + + /// Resync input properties. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncInputProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ResyncInputProperties()); set => this._property = value; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ProviderSpecificDetailInstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncInputPropertiesInternal)Property).ProviderSpecificDetailInstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncInputPropertiesInternal)Property).ProviderSpecificDetailInstanceType = value ; } + + /// Creates an new instance. + public ResyncInput() + { + + } + } + /// Resync input. + public partial interface IResyncInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string ProviderSpecificDetailInstanceType { get; set; } + + } + /// Resync input. + internal partial interface IResyncInputInternal + + { + /// Resync input properties. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncInputProperties Property { get; set; } + /// The provider specific details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncProviderSpecificInput ProviderSpecificDetail { get; set; } + /// The class type. + string ProviderSpecificDetailInstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResyncInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResyncInput.json.cs new file mode 100644 index 000000000000..b03b6cfdd566 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResyncInput.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Resync input. + public partial class ResyncInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new ResyncInput(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal ResyncInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ResyncInputProperties.FromJson(__jsonProperties) : Property;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResyncInputProperties.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResyncInputProperties.PowerShell.cs new file mode 100644 index 000000000000..d1ec8db7e60e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResyncInputProperties.PowerShell.cs @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Resync input properties. + [System.ComponentModel.TypeConverter(typeof(ResyncInputPropertiesTypeConverter))] + public partial class ResyncInputProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncInputProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ResyncInputProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncInputProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ResyncInputProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncInputProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ResyncInputProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncInputPropertiesInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncProviderSpecificInput) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncInputPropertiesInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ResyncProviderSpecificInputTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncInputPropertiesInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncInputPropertiesInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ResyncInputProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncInputPropertiesInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncProviderSpecificInput) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncInputPropertiesInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ResyncProviderSpecificInputTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncInputPropertiesInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncInputPropertiesInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Resync input properties. + [System.ComponentModel.TypeConverter(typeof(ResyncInputPropertiesTypeConverter))] + public partial interface IResyncInputProperties + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResyncInputProperties.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResyncInputProperties.TypeConverter.cs new file mode 100644 index 000000000000..977695df3bb0 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResyncInputProperties.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ResyncInputPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncInputProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncInputProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ResyncInputProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ResyncInputProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ResyncInputProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResyncInputProperties.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResyncInputProperties.cs new file mode 100644 index 000000000000..d007a8a08d75 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResyncInputProperties.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Resync input properties. + public partial class ResyncInputProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncInputProperties, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncInputPropertiesInternal + { + + /// Internal Acessors for ProviderSpecificDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncProviderSpecificInput Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncInputPropertiesInternal.ProviderSpecificDetail { get => (this._providerSpecificDetail = this._providerSpecificDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ResyncProviderSpecificInput()); set { {_providerSpecificDetail = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncProviderSpecificInput _providerSpecificDetail; + + /// The provider specific details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncProviderSpecificInput ProviderSpecificDetail { get => (this._providerSpecificDetail = this._providerSpecificDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ResyncProviderSpecificInput()); set => this._providerSpecificDetail = value; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ProviderSpecificDetailInstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncProviderSpecificInputInternal)ProviderSpecificDetail).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncProviderSpecificInputInternal)ProviderSpecificDetail).InstanceType = value ; } + + /// Creates an new instance. + public ResyncInputProperties() + { + + } + } + /// Resync input properties. + public partial interface IResyncInputProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string ProviderSpecificDetailInstanceType { get; set; } + + } + /// Resync input properties. + internal partial interface IResyncInputPropertiesInternal + + { + /// The provider specific details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncProviderSpecificInput ProviderSpecificDetail { get; set; } + /// The class type. + string ProviderSpecificDetailInstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResyncInputProperties.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResyncInputProperties.json.cs new file mode 100644 index 000000000000..5efefaf75ace --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResyncInputProperties.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Resync input properties. + public partial class ResyncInputProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncInputProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncInputProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncInputProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new ResyncInputProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal ResyncInputProperties(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_providerSpecificDetail = If( json?.PropertyT("providerSpecificDetails"), out var __jsonProviderSpecificDetails) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ResyncProviderSpecificInput.FromJson(__jsonProviderSpecificDetails) : ProviderSpecificDetail;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._providerSpecificDetail ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._providerSpecificDetail.ToJson(null,serializationMode) : null, "providerSpecificDetails" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResyncProviderSpecificInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResyncProviderSpecificInput.PowerShell.cs new file mode 100644 index 000000000000..8519acae06d5 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResyncProviderSpecificInput.PowerShell.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Resync provider specific input. + [System.ComponentModel.TypeConverter(typeof(ResyncProviderSpecificInputTypeConverter))] + public partial class ResyncProviderSpecificInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncProviderSpecificInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ResyncProviderSpecificInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncProviderSpecificInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ResyncProviderSpecificInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncProviderSpecificInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ResyncProviderSpecificInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ResyncProviderSpecificInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Resync provider specific input. + [System.ComponentModel.TypeConverter(typeof(ResyncProviderSpecificInputTypeConverter))] + public partial interface IResyncProviderSpecificInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResyncProviderSpecificInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResyncProviderSpecificInput.TypeConverter.cs new file mode 100644 index 000000000000..52e95c46b9e2 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResyncProviderSpecificInput.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ResyncProviderSpecificInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncProviderSpecificInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncProviderSpecificInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ResyncProviderSpecificInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ResyncProviderSpecificInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ResyncProviderSpecificInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResyncProviderSpecificInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResyncProviderSpecificInput.cs new file mode 100644 index 000000000000..c4fd6e032486 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResyncProviderSpecificInput.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Resync provider specific input. + public partial class ResyncProviderSpecificInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncProviderSpecificInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncProviderSpecificInputInternal + { + + /// Backing field for property. + private string _instanceType; + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string InstanceType { get => this._instanceType; set => this._instanceType = value; } + + /// Creates an new instance. + public ResyncProviderSpecificInput() + { + + } + } + /// Resync provider specific input. + public partial interface IResyncProviderSpecificInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string InstanceType { get; set; } + + } + /// Resync provider specific input. + internal partial interface IResyncProviderSpecificInputInternal + + { + /// The class type. + string InstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResyncProviderSpecificInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResyncProviderSpecificInput.json.cs new file mode 100644 index 000000000000..8d6f8868c5d9 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ResyncProviderSpecificInput.json.cs @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Resync provider specific input. + public partial class ResyncProviderSpecificInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncProviderSpecificInput. + /// Note: the Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncProviderSpecificInput interface is polymorphic, + /// and the precise model class that will get deserialized is determined at runtime based on the payload. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncProviderSpecificInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncProviderSpecificInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + if (!(node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json)) + { + return null; + } + // Polymorphic type -- select the appropriate constructor using the discriminator + + switch ( json.StringProperty("instanceType") ) + { + case "VMwareCbt": + { + return new VMwareCbtResyncInput(json); + } + } + return new ResyncProviderSpecificInput(json); + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal ResyncProviderSpecificInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_instanceType = If( json?.PropertyT("instanceType"), out var __jsonInstanceType) ? (string)__jsonInstanceType : (string)InstanceType;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._instanceType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._instanceType.ToString()) : null, "instanceType" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RetentionVolume.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RetentionVolume.PowerShell.cs new file mode 100644 index 000000000000..3b1913e4b609 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RetentionVolume.PowerShell.cs @@ -0,0 +1,168 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// The retention details of the MT. + [System.ComponentModel.TypeConverter(typeof(RetentionVolumeTypeConverter))] + public partial class RetentionVolume + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRetentionVolume DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new RetentionVolume(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRetentionVolume DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new RetentionVolume(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRetentionVolume FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal RetentionVolume(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("VolumeName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRetentionVolumeInternal)this).VolumeName = (string) content.GetValueForProperty("VolumeName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRetentionVolumeInternal)this).VolumeName, global::System.Convert.ToString); + } + if (content.Contains("CapacityInByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRetentionVolumeInternal)this).CapacityInByte = (long?) content.GetValueForProperty("CapacityInByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRetentionVolumeInternal)this).CapacityInByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("FreeSpaceInByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRetentionVolumeInternal)this).FreeSpaceInByte = (long?) content.GetValueForProperty("FreeSpaceInByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRetentionVolumeInternal)this).FreeSpaceInByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("ThresholdPercentage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRetentionVolumeInternal)this).ThresholdPercentage = (int?) content.GetValueForProperty("ThresholdPercentage",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRetentionVolumeInternal)this).ThresholdPercentage, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal RetentionVolume(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("VolumeName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRetentionVolumeInternal)this).VolumeName = (string) content.GetValueForProperty("VolumeName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRetentionVolumeInternal)this).VolumeName, global::System.Convert.ToString); + } + if (content.Contains("CapacityInByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRetentionVolumeInternal)this).CapacityInByte = (long?) content.GetValueForProperty("CapacityInByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRetentionVolumeInternal)this).CapacityInByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("FreeSpaceInByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRetentionVolumeInternal)this).FreeSpaceInByte = (long?) content.GetValueForProperty("FreeSpaceInByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRetentionVolumeInternal)this).FreeSpaceInByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("ThresholdPercentage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRetentionVolumeInternal)this).ThresholdPercentage = (int?) content.GetValueForProperty("ThresholdPercentage",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRetentionVolumeInternal)this).ThresholdPercentage, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// The retention details of the MT. + [System.ComponentModel.TypeConverter(typeof(RetentionVolumeTypeConverter))] + public partial interface IRetentionVolume + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RetentionVolume.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RetentionVolume.TypeConverter.cs new file mode 100644 index 000000000000..ab2ae376c0c0 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RetentionVolume.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class RetentionVolumeTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRetentionVolume ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRetentionVolume).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return RetentionVolume.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return RetentionVolume.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return RetentionVolume.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RetentionVolume.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RetentionVolume.cs new file mode 100644 index 000000000000..92b1b2e1d204 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RetentionVolume.cs @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The retention details of the MT. + public partial class RetentionVolume : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRetentionVolume, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRetentionVolumeInternal + { + + /// Backing field for property. + private long? _capacityInByte; + + /// The volume capacity. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public long? CapacityInByte { get => this._capacityInByte; set => this._capacityInByte = value; } + + /// Backing field for property. + private long? _freeSpaceInByte; + + /// The free space available in this volume. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public long? FreeSpaceInByte { get => this._freeSpaceInByte; set => this._freeSpaceInByte = value; } + + /// Backing field for property. + private int? _thresholdPercentage; + + /// The threshold percentage. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? ThresholdPercentage { get => this._thresholdPercentage; set => this._thresholdPercentage = value; } + + /// Backing field for property. + private string _volumeName; + + /// The volume name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string VolumeName { get => this._volumeName; set => this._volumeName = value; } + + /// Creates an new instance. + public RetentionVolume() + { + + } + } + /// The retention details of the MT. + public partial interface IRetentionVolume : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The volume capacity. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The volume capacity.", + SerializedName = @"capacityInBytes", + PossibleTypes = new [] { typeof(long) })] + long? CapacityInByte { get; set; } + /// The free space available in this volume. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The free space available in this volume.", + SerializedName = @"freeSpaceInBytes", + PossibleTypes = new [] { typeof(long) })] + long? FreeSpaceInByte { get; set; } + /// The threshold percentage. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The threshold percentage.", + SerializedName = @"thresholdPercentage", + PossibleTypes = new [] { typeof(int) })] + int? ThresholdPercentage { get; set; } + /// The volume name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The volume name.", + SerializedName = @"volumeName", + PossibleTypes = new [] { typeof(string) })] + string VolumeName { get; set; } + + } + /// The retention details of the MT. + internal partial interface IRetentionVolumeInternal + + { + /// The volume capacity. + long? CapacityInByte { get; set; } + /// The free space available in this volume. + long? FreeSpaceInByte { get; set; } + /// The threshold percentage. + int? ThresholdPercentage { get; set; } + /// The volume name. + string VolumeName { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RetentionVolume.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RetentionVolume.json.cs new file mode 100644 index 000000000000..b6b8a1d52c13 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RetentionVolume.json.cs @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The retention details of the MT. + public partial class RetentionVolume + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRetentionVolume. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRetentionVolume. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRetentionVolume FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new RetentionVolume(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal RetentionVolume(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_volumeName = If( json?.PropertyT("volumeName"), out var __jsonVolumeName) ? (string)__jsonVolumeName : (string)VolumeName;} + {_capacityInByte = If( json?.PropertyT("capacityInBytes"), out var __jsonCapacityInBytes) ? (long?)__jsonCapacityInBytes : CapacityInByte;} + {_freeSpaceInByte = If( json?.PropertyT("freeSpaceInBytes"), out var __jsonFreeSpaceInBytes) ? (long?)__jsonFreeSpaceInBytes : FreeSpaceInByte;} + {_thresholdPercentage = If( json?.PropertyT("thresholdPercentage"), out var __jsonThresholdPercentage) ? (int?)__jsonThresholdPercentage : ThresholdPercentage;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._volumeName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._volumeName.ToString()) : null, "volumeName" ,container.Add ); + AddIf( null != this._capacityInByte ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((long)this._capacityInByte) : null, "capacityInBytes" ,container.Add ); + AddIf( null != this._freeSpaceInByte ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((long)this._freeSpaceInByte) : null, "freeSpaceInBytes" ,container.Add ); + AddIf( null != this._thresholdPercentage ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._thresholdPercentage) : null, "thresholdPercentage" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReverseReplicationInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReverseReplicationInput.PowerShell.cs new file mode 100644 index 000000000000..b3b709ecc63e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReverseReplicationInput.PowerShell.cs @@ -0,0 +1,168 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Reverse replication input. + [System.ComponentModel.TypeConverter(typeof(ReverseReplicationInputTypeConverter))] + public partial class ReverseReplicationInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ReverseReplicationInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ReverseReplicationInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ReverseReplicationInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationInputInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationInputProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationInputInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReverseReplicationInputPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationInputInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationProviderSpecificInput) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationInputInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReverseReplicationProviderSpecificInputTypeConverter.ConvertFrom); + } + if (content.Contains("FailoverDirection")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationInputInternal)this).FailoverDirection = (string) content.GetValueForProperty("FailoverDirection",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationInputInternal)this).FailoverDirection, global::System.Convert.ToString); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationInputInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationInputInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ReverseReplicationInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationInputInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationInputProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationInputInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReverseReplicationInputPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationInputInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationProviderSpecificInput) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationInputInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReverseReplicationProviderSpecificInputTypeConverter.ConvertFrom); + } + if (content.Contains("FailoverDirection")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationInputInternal)this).FailoverDirection = (string) content.GetValueForProperty("FailoverDirection",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationInputInternal)this).FailoverDirection, global::System.Convert.ToString); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationInputInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationInputInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Reverse replication input. + [System.ComponentModel.TypeConverter(typeof(ReverseReplicationInputTypeConverter))] + public partial interface IReverseReplicationInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReverseReplicationInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReverseReplicationInput.TypeConverter.cs new file mode 100644 index 000000000000..8c22c155bb68 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReverseReplicationInput.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ReverseReplicationInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ReverseReplicationInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ReverseReplicationInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ReverseReplicationInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReverseReplicationInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReverseReplicationInput.cs new file mode 100644 index 000000000000..3d70f9078682 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReverseReplicationInput.cs @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Reverse replication input. + public partial class ReverseReplicationInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationInputInternal + { + + /// Failover direction. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string FailoverDirection { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationInputPropertiesInternal)Property).FailoverDirection; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationInputPropertiesInternal)Property).FailoverDirection = value ?? null; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationInputProperties Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationInputInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReverseReplicationInputProperties()); set { {_property = value;} } } + + /// Internal Acessors for ProviderSpecificDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationProviderSpecificInput Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationInputInternal.ProviderSpecificDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationInputPropertiesInternal)Property).ProviderSpecificDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationInputPropertiesInternal)Property).ProviderSpecificDetail = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationInputProperties _property; + + /// Reverse replication properties. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationInputProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReverseReplicationInputProperties()); set => this._property = value; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ProviderSpecificDetailInstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationInputPropertiesInternal)Property).ProviderSpecificDetailInstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationInputPropertiesInternal)Property).ProviderSpecificDetailInstanceType = value ?? null; } + + /// Creates an new instance. + public ReverseReplicationInput() + { + + } + } + /// Reverse replication input. + public partial interface IReverseReplicationInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// Failover direction. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Failover direction.", + SerializedName = @"failoverDirection", + PossibleTypes = new [] { typeof(string) })] + string FailoverDirection { get; set; } + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string ProviderSpecificDetailInstanceType { get; set; } + + } + /// Reverse replication input. + internal partial interface IReverseReplicationInputInternal + + { + /// Failover direction. + string FailoverDirection { get; set; } + /// Reverse replication properties. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationInputProperties Property { get; set; } + /// Provider specific reverse replication input. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationProviderSpecificInput ProviderSpecificDetail { get; set; } + /// The class type. + string ProviderSpecificDetailInstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReverseReplicationInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReverseReplicationInput.json.cs new file mode 100644 index 000000000000..aa22307ccad9 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReverseReplicationInput.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Reverse replication input. + public partial class ReverseReplicationInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new ReverseReplicationInput(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal ReverseReplicationInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReverseReplicationInputProperties.FromJson(__jsonProperties) : Property;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReverseReplicationInputProperties.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReverseReplicationInputProperties.PowerShell.cs new file mode 100644 index 000000000000..894f3da1c27c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReverseReplicationInputProperties.PowerShell.cs @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Reverse replication input properties. + [System.ComponentModel.TypeConverter(typeof(ReverseReplicationInputPropertiesTypeConverter))] + public partial class ReverseReplicationInputProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationInputProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ReverseReplicationInputProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationInputProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ReverseReplicationInputProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationInputProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ReverseReplicationInputProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationInputPropertiesInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationProviderSpecificInput) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationInputPropertiesInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReverseReplicationProviderSpecificInputTypeConverter.ConvertFrom); + } + if (content.Contains("FailoverDirection")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationInputPropertiesInternal)this).FailoverDirection = (string) content.GetValueForProperty("FailoverDirection",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationInputPropertiesInternal)this).FailoverDirection, global::System.Convert.ToString); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationInputPropertiesInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationInputPropertiesInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ReverseReplicationInputProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationInputPropertiesInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationProviderSpecificInput) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationInputPropertiesInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReverseReplicationProviderSpecificInputTypeConverter.ConvertFrom); + } + if (content.Contains("FailoverDirection")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationInputPropertiesInternal)this).FailoverDirection = (string) content.GetValueForProperty("FailoverDirection",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationInputPropertiesInternal)this).FailoverDirection, global::System.Convert.ToString); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationInputPropertiesInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationInputPropertiesInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Reverse replication input properties. + [System.ComponentModel.TypeConverter(typeof(ReverseReplicationInputPropertiesTypeConverter))] + public partial interface IReverseReplicationInputProperties + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReverseReplicationInputProperties.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReverseReplicationInputProperties.TypeConverter.cs new file mode 100644 index 000000000000..a021b606dbae --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReverseReplicationInputProperties.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ReverseReplicationInputPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationInputProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationInputProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ReverseReplicationInputProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ReverseReplicationInputProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ReverseReplicationInputProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReverseReplicationInputProperties.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReverseReplicationInputProperties.cs new file mode 100644 index 000000000000..39f3d70fce90 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReverseReplicationInputProperties.cs @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Reverse replication input properties. + public partial class ReverseReplicationInputProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationInputProperties, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationInputPropertiesInternal + { + + /// Backing field for property. + private string _failoverDirection; + + /// Failover direction. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string FailoverDirection { get => this._failoverDirection; set => this._failoverDirection = value; } + + /// Internal Acessors for ProviderSpecificDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationProviderSpecificInput Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationInputPropertiesInternal.ProviderSpecificDetail { get => (this._providerSpecificDetail = this._providerSpecificDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReverseReplicationProviderSpecificInput()); set { {_providerSpecificDetail = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationProviderSpecificInput _providerSpecificDetail; + + /// Provider specific reverse replication input. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationProviderSpecificInput ProviderSpecificDetail { get => (this._providerSpecificDetail = this._providerSpecificDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReverseReplicationProviderSpecificInput()); set => this._providerSpecificDetail = value; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ProviderSpecificDetailInstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationProviderSpecificInputInternal)ProviderSpecificDetail).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationProviderSpecificInputInternal)ProviderSpecificDetail).InstanceType = value ?? null; } + + /// Creates an new instance. + public ReverseReplicationInputProperties() + { + + } + } + /// Reverse replication input properties. + public partial interface IReverseReplicationInputProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// Failover direction. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Failover direction.", + SerializedName = @"failoverDirection", + PossibleTypes = new [] { typeof(string) })] + string FailoverDirection { get; set; } + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string ProviderSpecificDetailInstanceType { get; set; } + + } + /// Reverse replication input properties. + internal partial interface IReverseReplicationInputPropertiesInternal + + { + /// Failover direction. + string FailoverDirection { get; set; } + /// Provider specific reverse replication input. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationProviderSpecificInput ProviderSpecificDetail { get; set; } + /// The class type. + string ProviderSpecificDetailInstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReverseReplicationInputProperties.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReverseReplicationInputProperties.json.cs new file mode 100644 index 000000000000..62b02c654a7c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReverseReplicationInputProperties.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Reverse replication input properties. + public partial class ReverseReplicationInputProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationInputProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationInputProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationInputProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new ReverseReplicationInputProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal ReverseReplicationInputProperties(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_providerSpecificDetail = If( json?.PropertyT("providerSpecificDetails"), out var __jsonProviderSpecificDetails) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReverseReplicationProviderSpecificInput.FromJson(__jsonProviderSpecificDetails) : ProviderSpecificDetail;} + {_failoverDirection = If( json?.PropertyT("failoverDirection"), out var __jsonFailoverDirection) ? (string)__jsonFailoverDirection : (string)FailoverDirection;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._providerSpecificDetail ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._providerSpecificDetail.ToJson(null,serializationMode) : null, "providerSpecificDetails" ,container.Add ); + AddIf( null != (((object)this._failoverDirection)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._failoverDirection.ToString()) : null, "failoverDirection" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReverseReplicationProviderSpecificInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReverseReplicationProviderSpecificInput.PowerShell.cs new file mode 100644 index 000000000000..2d01d05df6db --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReverseReplicationProviderSpecificInput.PowerShell.cs @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Provider specific reverse replication input. + [System.ComponentModel.TypeConverter(typeof(ReverseReplicationProviderSpecificInputTypeConverter))] + public partial class ReverseReplicationProviderSpecificInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationProviderSpecificInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ReverseReplicationProviderSpecificInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationProviderSpecificInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ReverseReplicationProviderSpecificInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json + /// string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationProviderSpecificInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ReverseReplicationProviderSpecificInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ReverseReplicationProviderSpecificInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Provider specific reverse replication input. + [System.ComponentModel.TypeConverter(typeof(ReverseReplicationProviderSpecificInputTypeConverter))] + public partial interface IReverseReplicationProviderSpecificInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReverseReplicationProviderSpecificInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReverseReplicationProviderSpecificInput.TypeConverter.cs new file mode 100644 index 000000000000..cc5604ddf782 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReverseReplicationProviderSpecificInput.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ReverseReplicationProviderSpecificInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationProviderSpecificInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationProviderSpecificInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ReverseReplicationProviderSpecificInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ReverseReplicationProviderSpecificInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ReverseReplicationProviderSpecificInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReverseReplicationProviderSpecificInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReverseReplicationProviderSpecificInput.cs new file mode 100644 index 000000000000..c1a446d6af86 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReverseReplicationProviderSpecificInput.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Provider specific reverse replication input. + public partial class ReverseReplicationProviderSpecificInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationProviderSpecificInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationProviderSpecificInputInternal + { + + /// Backing field for property. + private string _instanceType; + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string InstanceType { get => this._instanceType; set => this._instanceType = value; } + + /// Creates an new instance. + public ReverseReplicationProviderSpecificInput() + { + + } + } + /// Provider specific reverse replication input. + public partial interface IReverseReplicationProviderSpecificInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string InstanceType { get; set; } + + } + /// Provider specific reverse replication input. + internal partial interface IReverseReplicationProviderSpecificInputInternal + + { + /// The class type. + string InstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReverseReplicationProviderSpecificInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReverseReplicationProviderSpecificInput.json.cs new file mode 100644 index 000000000000..02d2e431e82f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ReverseReplicationProviderSpecificInput.json.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Provider specific reverse replication input. + public partial class ReverseReplicationProviderSpecificInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationProviderSpecificInput. + /// Note: the Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationProviderSpecificInput interface + /// is polymorphic, and the precise model class that will get deserialized is determined at runtime based on the payload. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationProviderSpecificInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationProviderSpecificInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + if (!(node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json)) + { + return null; + } + // Polymorphic type -- select the appropriate constructor using the discriminator + + switch ( json.StringProperty("instanceType") ) + { + case "A2A": + { + return new A2AReprotectInput(json); + } + case "HyperVReplicaAzure": + { + return new HyperVReplicaAzureReprotectInput(json); + } + case "InMageAzureV2": + { + return new InMageAzureV2ReprotectInput(json); + } + case "InMageRcmFailback": + { + return new InMageRcmFailbackReprotectInput(json); + } + case "InMageRcm": + { + return new InMageRcmReprotectInput(json); + } + case "InMage": + { + return new InMageReprotectInput(json); + } + } + return new ReverseReplicationProviderSpecificInput(json); + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal ReverseReplicationProviderSpecificInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_instanceType = If( json?.PropertyT("instanceType"), out var __jsonInstanceType) ? (string)__jsonInstanceType : (string)InstanceType;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._instanceType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._instanceType.ToString()) : null, "instanceType" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RoleAssignment.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RoleAssignment.PowerShell.cs new file mode 100644 index 000000000000..4f220b4ca119 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RoleAssignment.PowerShell.cs @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Azure role assignment details. + [System.ComponentModel.TypeConverter(typeof(RoleAssignmentTypeConverter))] + public partial class RoleAssignment + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRoleAssignment DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new RoleAssignment(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRoleAssignment DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new RoleAssignment(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRoleAssignment FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal RoleAssignment(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRoleAssignmentInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRoleAssignmentInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRoleAssignmentInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRoleAssignmentInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Scope")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRoleAssignmentInternal)this).Scope = (string) content.GetValueForProperty("Scope",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRoleAssignmentInternal)this).Scope, global::System.Convert.ToString); + } + if (content.Contains("PrincipalId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRoleAssignmentInternal)this).PrincipalId = (string) content.GetValueForProperty("PrincipalId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRoleAssignmentInternal)this).PrincipalId, global::System.Convert.ToString); + } + if (content.Contains("RoleDefinitionId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRoleAssignmentInternal)this).RoleDefinitionId = (string) content.GetValueForProperty("RoleDefinitionId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRoleAssignmentInternal)this).RoleDefinitionId, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal RoleAssignment(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRoleAssignmentInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRoleAssignmentInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRoleAssignmentInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRoleAssignmentInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Scope")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRoleAssignmentInternal)this).Scope = (string) content.GetValueForProperty("Scope",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRoleAssignmentInternal)this).Scope, global::System.Convert.ToString); + } + if (content.Contains("PrincipalId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRoleAssignmentInternal)this).PrincipalId = (string) content.GetValueForProperty("PrincipalId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRoleAssignmentInternal)this).PrincipalId, global::System.Convert.ToString); + } + if (content.Contains("RoleDefinitionId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRoleAssignmentInternal)this).RoleDefinitionId = (string) content.GetValueForProperty("RoleDefinitionId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRoleAssignmentInternal)this).RoleDefinitionId, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Azure role assignment details. + [System.ComponentModel.TypeConverter(typeof(RoleAssignmentTypeConverter))] + public partial interface IRoleAssignment + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RoleAssignment.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RoleAssignment.TypeConverter.cs new file mode 100644 index 000000000000..802aea9facbe --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RoleAssignment.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class RoleAssignmentTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRoleAssignment ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRoleAssignment).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return RoleAssignment.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return RoleAssignment.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return RoleAssignment.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RoleAssignment.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RoleAssignment.cs new file mode 100644 index 000000000000..2a86ad5d21be --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RoleAssignment.cs @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Azure role assignment details. + public partial class RoleAssignment : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRoleAssignment, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRoleAssignmentInternal + { + + /// Backing field for property. + private string _id; + + /// The ARM Id of the role assignment. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Id { get => this._id; set => this._id = value; } + + /// Backing field for property. + private string _name; + + /// The name of the role assignment. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Name { get => this._name; set => this._name = value; } + + /// Backing field for property. + private string _principalId; + + /// Principal Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string PrincipalId { get => this._principalId; set => this._principalId = value; } + + /// Backing field for property. + private string _roleDefinitionId; + + /// Role definition id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RoleDefinitionId { get => this._roleDefinitionId; set => this._roleDefinitionId = value; } + + /// Backing field for property. + private string _scope; + + /// Role assignment scope. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Scope { get => this._scope; set => this._scope = value; } + + /// Creates an new instance. + public RoleAssignment() + { + + } + } + /// Azure role assignment details. + public partial interface IRoleAssignment : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The ARM Id of the role assignment. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The ARM Id of the role assignment.", + SerializedName = @"id", + PossibleTypes = new [] { typeof(string) })] + string Id { get; set; } + /// The name of the role assignment. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the role assignment.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string Name { get; set; } + /// Principal Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Principal Id.", + SerializedName = @"principalId", + PossibleTypes = new [] { typeof(string) })] + string PrincipalId { get; set; } + /// Role definition id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Role definition id.", + SerializedName = @"roleDefinitionId", + PossibleTypes = new [] { typeof(string) })] + string RoleDefinitionId { get; set; } + /// Role assignment scope. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Role assignment scope.", + SerializedName = @"scope", + PossibleTypes = new [] { typeof(string) })] + string Scope { get; set; } + + } + /// Azure role assignment details. + internal partial interface IRoleAssignmentInternal + + { + /// The ARM Id of the role assignment. + string Id { get; set; } + /// The name of the role assignment. + string Name { get; set; } + /// Principal Id. + string PrincipalId { get; set; } + /// Role definition id. + string RoleDefinitionId { get; set; } + /// Role assignment scope. + string Scope { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RoleAssignment.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RoleAssignment.json.cs new file mode 100644 index 000000000000..8acc38cd600b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RoleAssignment.json.cs @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Azure role assignment details. + public partial class RoleAssignment + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRoleAssignment. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRoleAssignment. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRoleAssignment FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new RoleAssignment(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal RoleAssignment(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_id = If( json?.PropertyT("id"), out var __jsonId) ? (string)__jsonId : (string)Id;} + {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)Name;} + {_scope = If( json?.PropertyT("scope"), out var __jsonScope) ? (string)__jsonScope : (string)Scope;} + {_principalId = If( json?.PropertyT("principalId"), out var __jsonPrincipalId) ? (string)__jsonPrincipalId : (string)PrincipalId;} + {_roleDefinitionId = If( json?.PropertyT("roleDefinitionId"), out var __jsonRoleDefinitionId) ? (string)__jsonRoleDefinitionId : (string)RoleDefinitionId;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._id)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._id.ToString()) : null, "id" ,container.Add ); + AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); + AddIf( null != (((object)this._scope)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._scope.ToString()) : null, "scope" ,container.Add ); + AddIf( null != (((object)this._principalId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._principalId.ToString()) : null, "principalId" ,container.Add ); + AddIf( null != (((object)this._roleDefinitionId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._roleDefinitionId.ToString()) : null, "roleDefinitionId" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RunAsAccount.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RunAsAccount.PowerShell.cs new file mode 100644 index 000000000000..5298e9d40287 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RunAsAccount.PowerShell.cs @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// CS Accounts Details. + [System.ComponentModel.TypeConverter(typeof(RunAsAccountTypeConverter))] + public partial class RunAsAccount + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRunAsAccount DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new RunAsAccount(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRunAsAccount DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new RunAsAccount(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRunAsAccount FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal RunAsAccount(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("AccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRunAsAccountInternal)this).AccountId = (string) content.GetValueForProperty("AccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRunAsAccountInternal)this).AccountId, global::System.Convert.ToString); + } + if (content.Contains("AccountName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRunAsAccountInternal)this).AccountName = (string) content.GetValueForProperty("AccountName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRunAsAccountInternal)this).AccountName, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal RunAsAccount(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("AccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRunAsAccountInternal)this).AccountId = (string) content.GetValueForProperty("AccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRunAsAccountInternal)this).AccountId, global::System.Convert.ToString); + } + if (content.Contains("AccountName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRunAsAccountInternal)this).AccountName = (string) content.GetValueForProperty("AccountName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRunAsAccountInternal)this).AccountName, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// CS Accounts Details. + [System.ComponentModel.TypeConverter(typeof(RunAsAccountTypeConverter))] + public partial interface IRunAsAccount + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RunAsAccount.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RunAsAccount.TypeConverter.cs new file mode 100644 index 000000000000..1dba9a1adebd --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RunAsAccount.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class RunAsAccountTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRunAsAccount ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRunAsAccount).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return RunAsAccount.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return RunAsAccount.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return RunAsAccount.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RunAsAccount.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RunAsAccount.cs new file mode 100644 index 000000000000..07ebe2904517 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RunAsAccount.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// CS Accounts Details. + public partial class RunAsAccount : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRunAsAccount, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRunAsAccountInternal + { + + /// Backing field for property. + private string _accountId; + + /// The CS RunAs account Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string AccountId { get => this._accountId; set => this._accountId = value; } + + /// Backing field for property. + private string _accountName; + + /// The CS RunAs account name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string AccountName { get => this._accountName; set => this._accountName = value; } + + /// Creates an new instance. + public RunAsAccount() + { + + } + } + /// CS Accounts Details. + public partial interface IRunAsAccount : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The CS RunAs account Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The CS RunAs account Id.", + SerializedName = @"accountId", + PossibleTypes = new [] { typeof(string) })] + string AccountId { get; set; } + /// The CS RunAs account name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The CS RunAs account name.", + SerializedName = @"accountName", + PossibleTypes = new [] { typeof(string) })] + string AccountName { get; set; } + + } + /// CS Accounts Details. + internal partial interface IRunAsAccountInternal + + { + /// The CS RunAs account Id. + string AccountId { get; set; } + /// The CS RunAs account name. + string AccountName { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RunAsAccount.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RunAsAccount.json.cs new file mode 100644 index 000000000000..7c16d9e6f58b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/RunAsAccount.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// CS Accounts Details. + public partial class RunAsAccount + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRunAsAccount. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRunAsAccount. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRunAsAccount FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new RunAsAccount(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal RunAsAccount(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_accountId = If( json?.PropertyT("accountId"), out var __jsonAccountId) ? (string)__jsonAccountId : (string)AccountId;} + {_accountName = If( json?.PropertyT("accountName"), out var __jsonAccountName) ? (string)__jsonAccountName : (string)AccountName;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._accountId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._accountId.ToString()) : null, "accountId" ,container.Add ); + AddIf( null != (((object)this._accountName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._accountName.ToString()) : null, "accountName" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ScriptActionTaskDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ScriptActionTaskDetails.PowerShell.cs new file mode 100644 index 000000000000..a617ceed5fa0 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ScriptActionTaskDetails.PowerShell.cs @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// This class represents the script action task details. + [System.ComponentModel.TypeConverter(typeof(ScriptActionTaskDetailsTypeConverter))] + public partial class ScriptActionTaskDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IScriptActionTaskDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ScriptActionTaskDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IScriptActionTaskDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ScriptActionTaskDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IScriptActionTaskDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ScriptActionTaskDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IScriptActionTaskDetailsInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IScriptActionTaskDetailsInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Path")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IScriptActionTaskDetailsInternal)this).Path = (string) content.GetValueForProperty("Path",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IScriptActionTaskDetailsInternal)this).Path, global::System.Convert.ToString); + } + if (content.Contains("Output")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IScriptActionTaskDetailsInternal)this).Output = (string) content.GetValueForProperty("Output",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IScriptActionTaskDetailsInternal)this).Output, global::System.Convert.ToString); + } + if (content.Contains("IsPrimarySideScript")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IScriptActionTaskDetailsInternal)this).IsPrimarySideScript = (bool?) content.GetValueForProperty("IsPrimarySideScript",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IScriptActionTaskDetailsInternal)this).IsPrimarySideScript, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITaskTypeDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITaskTypeDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ScriptActionTaskDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IScriptActionTaskDetailsInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IScriptActionTaskDetailsInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Path")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IScriptActionTaskDetailsInternal)this).Path = (string) content.GetValueForProperty("Path",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IScriptActionTaskDetailsInternal)this).Path, global::System.Convert.ToString); + } + if (content.Contains("Output")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IScriptActionTaskDetailsInternal)this).Output = (string) content.GetValueForProperty("Output",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IScriptActionTaskDetailsInternal)this).Output, global::System.Convert.ToString); + } + if (content.Contains("IsPrimarySideScript")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IScriptActionTaskDetailsInternal)this).IsPrimarySideScript = (bool?) content.GetValueForProperty("IsPrimarySideScript",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IScriptActionTaskDetailsInternal)this).IsPrimarySideScript, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITaskTypeDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITaskTypeDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// This class represents the script action task details. + [System.ComponentModel.TypeConverter(typeof(ScriptActionTaskDetailsTypeConverter))] + public partial interface IScriptActionTaskDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ScriptActionTaskDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ScriptActionTaskDetails.TypeConverter.cs new file mode 100644 index 000000000000..32a8615fcbf9 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ScriptActionTaskDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ScriptActionTaskDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IScriptActionTaskDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IScriptActionTaskDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ScriptActionTaskDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ScriptActionTaskDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ScriptActionTaskDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ScriptActionTaskDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ScriptActionTaskDetails.cs new file mode 100644 index 000000000000..8bd2cf091fb2 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ScriptActionTaskDetails.cs @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// This class represents the script action task details. + public partial class ScriptActionTaskDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IScriptActionTaskDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IScriptActionTaskDetailsInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITaskTypeDetails __taskTypeDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.TaskTypeDetails(); + + /// The type of task details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITaskTypeDetailsInternal)__taskTypeDetails).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITaskTypeDetailsInternal)__taskTypeDetails).InstanceType = value ; } + + /// Backing field for property. + private bool? _isPrimarySideScript; + + /// A value indicating whether it is a primary side script or not. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public bool? IsPrimarySideScript { get => this._isPrimarySideScript; set => this._isPrimarySideScript = value; } + + /// Backing field for property. + private string _name; + + /// The name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Name { get => this._name; set => this._name = value; } + + /// Backing field for property. + private string _output; + + /// The output. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Output { get => this._output; set => this._output = value; } + + /// Backing field for property. + private string _path; + + /// The path. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Path { get => this._path; set => this._path = value; } + + /// Creates an new instance. + public ScriptActionTaskDetails() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__taskTypeDetails), __taskTypeDetails); + await eventListener.AssertObjectIsValid(nameof(__taskTypeDetails), __taskTypeDetails); + } + } + /// This class represents the script action task details. + public partial interface IScriptActionTaskDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITaskTypeDetails + { + /// A value indicating whether it is a primary side script or not. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether it is a primary side script or not.", + SerializedName = @"isPrimarySideScript", + PossibleTypes = new [] { typeof(bool) })] + bool? IsPrimarySideScript { get; set; } + /// The name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string Name { get; set; } + /// The output. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The output.", + SerializedName = @"output", + PossibleTypes = new [] { typeof(string) })] + string Output { get; set; } + /// The path. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The path.", + SerializedName = @"path", + PossibleTypes = new [] { typeof(string) })] + string Path { get; set; } + + } + /// This class represents the script action task details. + internal partial interface IScriptActionTaskDetailsInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITaskTypeDetailsInternal + { + /// A value indicating whether it is a primary side script or not. + bool? IsPrimarySideScript { get; set; } + /// The name. + string Name { get; set; } + /// The output. + string Output { get; set; } + /// The path. + string Path { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ScriptActionTaskDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ScriptActionTaskDetails.json.cs new file mode 100644 index 000000000000..a0f90630982a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ScriptActionTaskDetails.json.cs @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// This class represents the script action task details. + public partial class ScriptActionTaskDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IScriptActionTaskDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IScriptActionTaskDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IScriptActionTaskDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new ScriptActionTaskDetails(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal ScriptActionTaskDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __taskTypeDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.TaskTypeDetails(json); + {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)Name;} + {_path = If( json?.PropertyT("path"), out var __jsonPath) ? (string)__jsonPath : (string)Path;} + {_output = If( json?.PropertyT("output"), out var __jsonOutput) ? (string)__jsonOutput : (string)Output;} + {_isPrimarySideScript = If( json?.PropertyT("isPrimarySideScript"), out var __jsonIsPrimarySideScript) ? (bool?)__jsonIsPrimarySideScript : IsPrimarySideScript;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __taskTypeDetails?.ToJson(container, serializationMode); + AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); + AddIf( null != (((object)this._path)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._path.ToString()) : null, "path" ,container.Add ); + AddIf( null != (((object)this._output)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._output.ToString()) : null, "output" ,container.Add ); + AddIf( null != this._isPrimarySideScript ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonBoolean((bool)this._isPrimarySideScript) : null, "isPrimarySideScript" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ServiceError.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ServiceError.PowerShell.cs new file mode 100644 index 000000000000..c922ffc313d8 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ServiceError.PowerShell.cs @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// ASR error model. + [System.ComponentModel.TypeConverter(typeof(ServiceErrorTypeConverter))] + public partial class ServiceError + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IServiceError DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ServiceError(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IServiceError DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ServiceError(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IServiceError FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ServiceError(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Code")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IServiceErrorInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IServiceErrorInternal)this).Code, global::System.Convert.ToString); + } + if (content.Contains("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IServiceErrorInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IServiceErrorInternal)this).Message, global::System.Convert.ToString); + } + if (content.Contains("PossibleCaus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IServiceErrorInternal)this).PossibleCaus = (string) content.GetValueForProperty("PossibleCaus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IServiceErrorInternal)this).PossibleCaus, global::System.Convert.ToString); + } + if (content.Contains("RecommendedAction")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IServiceErrorInternal)this).RecommendedAction = (string) content.GetValueForProperty("RecommendedAction",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IServiceErrorInternal)this).RecommendedAction, global::System.Convert.ToString); + } + if (content.Contains("ActivityId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IServiceErrorInternal)this).ActivityId = (string) content.GetValueForProperty("ActivityId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IServiceErrorInternal)this).ActivityId, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ServiceError(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Code")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IServiceErrorInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IServiceErrorInternal)this).Code, global::System.Convert.ToString); + } + if (content.Contains("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IServiceErrorInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IServiceErrorInternal)this).Message, global::System.Convert.ToString); + } + if (content.Contains("PossibleCaus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IServiceErrorInternal)this).PossibleCaus = (string) content.GetValueForProperty("PossibleCaus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IServiceErrorInternal)this).PossibleCaus, global::System.Convert.ToString); + } + if (content.Contains("RecommendedAction")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IServiceErrorInternal)this).RecommendedAction = (string) content.GetValueForProperty("RecommendedAction",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IServiceErrorInternal)this).RecommendedAction, global::System.Convert.ToString); + } + if (content.Contains("ActivityId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IServiceErrorInternal)this).ActivityId = (string) content.GetValueForProperty("ActivityId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IServiceErrorInternal)this).ActivityId, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// ASR error model. + [System.ComponentModel.TypeConverter(typeof(ServiceErrorTypeConverter))] + public partial interface IServiceError + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ServiceError.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ServiceError.TypeConverter.cs new file mode 100644 index 000000000000..cf037c28d7d4 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ServiceError.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ServiceErrorTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IServiceError ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IServiceError).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ServiceError.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ServiceError.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ServiceError.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ServiceError.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ServiceError.cs new file mode 100644 index 000000000000..7f6b881fb25c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ServiceError.cs @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// ASR error model. + public partial class ServiceError : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IServiceError, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IServiceErrorInternal + { + + /// Backing field for property. + private string _activityId; + + /// Activity Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ActivityId { get => this._activityId; set => this._activityId = value; } + + /// Backing field for property. + private string _code; + + /// Error code. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Code { get => this._code; set => this._code = value; } + + /// Backing field for property. + private string _message; + + /// Error message. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Message { get => this._message; set => this._message = value; } + + /// Backing field for property. + private string _possibleCaus; + + /// Possible causes of error. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string PossibleCaus { get => this._possibleCaus; set => this._possibleCaus = value; } + + /// Backing field for property. + private string _recommendedAction; + + /// Recommended action to resolve error. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecommendedAction { get => this._recommendedAction; set => this._recommendedAction = value; } + + /// Creates an new instance. + public ServiceError() + { + + } + } + /// ASR error model. + public partial interface IServiceError : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// Activity Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Activity Id.", + SerializedName = @"activityId", + PossibleTypes = new [] { typeof(string) })] + string ActivityId { get; set; } + /// Error code. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Error code.", + SerializedName = @"code", + PossibleTypes = new [] { typeof(string) })] + string Code { get; set; } + /// Error message. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Error message.", + SerializedName = @"message", + PossibleTypes = new [] { typeof(string) })] + string Message { get; set; } + /// Possible causes of error. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Possible causes of error.", + SerializedName = @"possibleCauses", + PossibleTypes = new [] { typeof(string) })] + string PossibleCaus { get; set; } + /// Recommended action to resolve error. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Recommended action to resolve error.", + SerializedName = @"recommendedAction", + PossibleTypes = new [] { typeof(string) })] + string RecommendedAction { get; set; } + + } + /// ASR error model. + internal partial interface IServiceErrorInternal + + { + /// Activity Id. + string ActivityId { get; set; } + /// Error code. + string Code { get; set; } + /// Error message. + string Message { get; set; } + /// Possible causes of error. + string PossibleCaus { get; set; } + /// Recommended action to resolve error. + string RecommendedAction { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ServiceError.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ServiceError.json.cs new file mode 100644 index 000000000000..64ec137549b0 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/ServiceError.json.cs @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// ASR error model. + public partial class ServiceError + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IServiceError. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IServiceError. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IServiceError FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new ServiceError(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal ServiceError(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_code = If( json?.PropertyT("code"), out var __jsonCode) ? (string)__jsonCode : (string)Code;} + {_message = If( json?.PropertyT("message"), out var __jsonMessage) ? (string)__jsonMessage : (string)Message;} + {_possibleCaus = If( json?.PropertyT("possibleCauses"), out var __jsonPossibleCauses) ? (string)__jsonPossibleCauses : (string)PossibleCaus;} + {_recommendedAction = If( json?.PropertyT("recommendedAction"), out var __jsonRecommendedAction) ? (string)__jsonRecommendedAction : (string)RecommendedAction;} + {_activityId = If( json?.PropertyT("activityId"), out var __jsonActivityId) ? (string)__jsonActivityId : (string)ActivityId;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._code)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._code.ToString()) : null, "code" ,container.Add ); + AddIf( null != (((object)this._message)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._message.ToString()) : null, "message" ,container.Add ); + AddIf( null != (((object)this._possibleCaus)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._possibleCaus.ToString()) : null, "possibleCauses" ,container.Add ); + AddIf( null != (((object)this._recommendedAction)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recommendedAction.ToString()) : null, "recommendedAction" ,container.Add ); + AddIf( null != (((object)this._activityId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._activityId.ToString()) : null, "activityId" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageAccountCustomDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageAccountCustomDetails.PowerShell.cs new file mode 100644 index 000000000000..2d53541b6d60 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageAccountCustomDetails.PowerShell.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Storage account custom input. + [System.ComponentModel.TypeConverter(typeof(StorageAccountCustomDetailsTypeConverter))] + public partial class StorageAccountCustomDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageAccountCustomDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new StorageAccountCustomDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageAccountCustomDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new StorageAccountCustomDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageAccountCustomDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal StorageAccountCustomDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ResourceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageAccountCustomDetailsInternal)this).ResourceType = (string) content.GetValueForProperty("ResourceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageAccountCustomDetailsInternal)this).ResourceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal StorageAccountCustomDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ResourceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageAccountCustomDetailsInternal)this).ResourceType = (string) content.GetValueForProperty("ResourceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageAccountCustomDetailsInternal)this).ResourceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Storage account custom input. + [System.ComponentModel.TypeConverter(typeof(StorageAccountCustomDetailsTypeConverter))] + public partial interface IStorageAccountCustomDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageAccountCustomDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageAccountCustomDetails.TypeConverter.cs new file mode 100644 index 000000000000..f0e156d29207 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageAccountCustomDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class StorageAccountCustomDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageAccountCustomDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageAccountCustomDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return StorageAccountCustomDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return StorageAccountCustomDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return StorageAccountCustomDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageAccountCustomDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageAccountCustomDetails.cs new file mode 100644 index 000000000000..e09cf4931941 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageAccountCustomDetails.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Storage account custom input. + public partial class StorageAccountCustomDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageAccountCustomDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageAccountCustomDetailsInternal + { + + /// Backing field for property. + private string _resourceType; + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ResourceType { get => this._resourceType; set => this._resourceType = value; } + + /// Creates an new instance. + public StorageAccountCustomDetails() + { + + } + } + /// Storage account custom input. + public partial interface IStorageAccountCustomDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"resourceType", + PossibleTypes = new [] { typeof(string) })] + string ResourceType { get; set; } + + } + /// Storage account custom input. + internal partial interface IStorageAccountCustomDetailsInternal + + { + /// The class type. + string ResourceType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageAccountCustomDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageAccountCustomDetails.json.cs new file mode 100644 index 000000000000..d74228dd795c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageAccountCustomDetails.json.cs @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Storage account custom input. + public partial class StorageAccountCustomDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageAccountCustomDetails. + /// Note: the Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageAccountCustomDetails interface is polymorphic, + /// and the precise model class that will get deserialized is determined at runtime based on the payload. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageAccountCustomDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageAccountCustomDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + if (!(node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json)) + { + return null; + } + // Polymorphic type -- select the appropriate constructor using the discriminator + + switch ( json.StringProperty("resourceType") ) + { + case "Existing": + { + return new ExistingStorageAccount(json); + } + } + return new StorageAccountCustomDetails(json); + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal StorageAccountCustomDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_resourceType = If( json?.PropertyT("resourceType"), out var __jsonResourceType) ? (string)__jsonResourceType : (string)ResourceType;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._resourceType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._resourceType.ToString()) : null, "resourceType" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageClassification.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageClassification.PowerShell.cs new file mode 100644 index 000000000000..7d7d2dfb375d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageClassification.PowerShell.cs @@ -0,0 +1,184 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Storage object definition. + [System.ComponentModel.TypeConverter(typeof(StorageClassificationTypeConverter))] + public partial class StorageClassification + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassification DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new StorageClassification(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassification DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new StorageClassification(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassification FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal StorageClassification(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.StorageClassificationPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("FriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationInternal)this).FriendlyName = (string) content.GetValueForProperty("FriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationInternal)this).FriendlyName, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal StorageClassification(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.StorageClassificationPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("FriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationInternal)this).FriendlyName = (string) content.GetValueForProperty("FriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationInternal)this).FriendlyName, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Storage object definition. + [System.ComponentModel.TypeConverter(typeof(StorageClassificationTypeConverter))] + public partial interface IStorageClassification + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageClassification.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageClassification.TypeConverter.cs new file mode 100644 index 000000000000..7f578c970dbe --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageClassification.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class StorageClassificationTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassification ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassification).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return StorageClassification.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return StorageClassification.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return StorageClassification.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageClassification.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageClassification.cs new file mode 100644 index 000000000000..a422b0a882bb --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageClassification.cs @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Storage object definition. + public partial class StorageClassification : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassification, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResource __resource = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.Resource(); + + /// Friendly name of the Storage classification. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string FriendlyName { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationPropertiesInternal)Property).FriendlyName; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationPropertiesInternal)Property).FriendlyName = value ?? null; } + + /// Resource Id + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Id; } + + /// Resource Location + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string Location { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Location; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Location = value ?? null; } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Id = value; } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Name = value; } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Type = value; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationProperties Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.StorageClassificationProperties()); set { {_property = value;} } } + + /// Resource Name + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Name; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationProperties _property; + + /// Properties of the storage object. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.StorageClassificationProperties()); set => this._property = value; } + + /// Resource Type + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Type; } + + /// Creates an new instance. + public StorageClassification() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__resource), __resource); + await eventListener.AssertObjectIsValid(nameof(__resource), __resource); + } + } + /// Storage object definition. + public partial interface IStorageClassification : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResource + { + /// Friendly name of the Storage classification. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Friendly name of the Storage classification.", + SerializedName = @"friendlyName", + PossibleTypes = new [] { typeof(string) })] + string FriendlyName { get; set; } + + } + /// Storage object definition. + internal partial interface IStorageClassificationInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal + { + /// Friendly name of the Storage classification. + string FriendlyName { get; set; } + /// Properties of the storage object. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationProperties Property { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageClassification.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageClassification.json.cs new file mode 100644 index 000000000000..391dbfec52ef --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageClassification.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Storage object definition. + public partial class StorageClassification + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassification. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassification. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassification FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new StorageClassification(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal StorageClassification(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __resource = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.Resource(json); + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.StorageClassificationProperties.FromJson(__jsonProperties) : Property;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __resource?.ToJson(container, serializationMode); + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageClassificationCollection.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageClassificationCollection.PowerShell.cs new file mode 100644 index 000000000000..2d7f2da6476b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageClassificationCollection.PowerShell.cs @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Collection of storage details. + [System.ComponentModel.TypeConverter(typeof(StorageClassificationCollectionTypeConverter))] + public partial class StorageClassificationCollection + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationCollection DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new StorageClassificationCollection(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationCollection DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new StorageClassificationCollection(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationCollection FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal StorageClassificationCollection(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassification[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.StorageClassificationTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationCollectionInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationCollectionInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal StorageClassificationCollection(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassification[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.StorageClassificationTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationCollectionInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationCollectionInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Collection of storage details. + [System.ComponentModel.TypeConverter(typeof(StorageClassificationCollectionTypeConverter))] + public partial interface IStorageClassificationCollection + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageClassificationCollection.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageClassificationCollection.TypeConverter.cs new file mode 100644 index 000000000000..2119ffc76bdb --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageClassificationCollection.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class StorageClassificationCollectionTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationCollection ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationCollection).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return StorageClassificationCollection.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return StorageClassificationCollection.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return StorageClassificationCollection.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageClassificationCollection.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageClassificationCollection.cs new file mode 100644 index 000000000000..d9913be42d5f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageClassificationCollection.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Collection of storage details. + public partial class StorageClassificationCollection : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationCollection, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationCollectionInternal + { + + /// Backing field for property. + private string _nextLink; + + /// The value of next link. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string NextLink { get => this._nextLink; set => this._nextLink = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassification[] _value; + + /// The storage details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassification[] Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public StorageClassificationCollection() + { + + } + } + /// Collection of storage details. + public partial interface IStorageClassificationCollection : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The value of next link. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The value of next link.", + SerializedName = @"nextLink", + PossibleTypes = new [] { typeof(string) })] + string NextLink { get; set; } + /// The storage details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The storage details.", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassification) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassification[] Value { get; set; } + + } + /// Collection of storage details. + internal partial interface IStorageClassificationCollectionInternal + + { + /// The value of next link. + string NextLink { get; set; } + /// The storage details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassification[] Value { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageClassificationCollection.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageClassificationCollection.json.cs new file mode 100644 index 000000000000..a0133291f6d3 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageClassificationCollection.json.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Collection of storage details. + public partial class StorageClassificationCollection + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationCollection. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationCollection. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationCollection FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new StorageClassificationCollection(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal StorageClassificationCollection(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassification) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.StorageClassification.FromJson(__u) )) ))() : null : Value;} + {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)NextLink;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._value) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._value ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("value",__w); + } + AddIf( null != (((object)this._nextLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageClassificationMapping.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageClassificationMapping.PowerShell.cs new file mode 100644 index 000000000000..ab1fad8acd32 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageClassificationMapping.PowerShell.cs @@ -0,0 +1,186 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Storage mapping object. + [System.ComponentModel.TypeConverter(typeof(StorageClassificationMappingTypeConverter))] + public partial class StorageClassificationMapping + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMapping DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new StorageClassificationMapping(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMapping DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new StorageClassificationMapping(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMapping FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal StorageClassificationMapping(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMappingInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMappingProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMappingInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.StorageClassificationMappingPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("TargetStorageClassificationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMappingInternal)this).TargetStorageClassificationId = (string) content.GetValueForProperty("TargetStorageClassificationId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMappingInternal)this).TargetStorageClassificationId, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal StorageClassificationMapping(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMappingInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMappingProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMappingInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.StorageClassificationMappingPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("TargetStorageClassificationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMappingInternal)this).TargetStorageClassificationId = (string) content.GetValueForProperty("TargetStorageClassificationId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMappingInternal)this).TargetStorageClassificationId, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Storage mapping object. + [System.ComponentModel.TypeConverter(typeof(StorageClassificationMappingTypeConverter))] + public partial interface IStorageClassificationMapping + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageClassificationMapping.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageClassificationMapping.TypeConverter.cs new file mode 100644 index 000000000000..00104f154335 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageClassificationMapping.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class StorageClassificationMappingTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMapping ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMapping).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return StorageClassificationMapping.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return StorageClassificationMapping.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return StorageClassificationMapping.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageClassificationMapping.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageClassificationMapping.cs new file mode 100644 index 000000000000..35c2505765ce --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageClassificationMapping.cs @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Storage mapping object. + public partial class StorageClassificationMapping : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMapping, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMappingInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResource __resource = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.Resource(); + + /// Resource Id + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Id; } + + /// Resource Location + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string Location { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Location; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Location = value ?? null; } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Id = value; } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Name = value; } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Type = value; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMappingProperties Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMappingInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.StorageClassificationMappingProperties()); set { {_property = value;} } } + + /// Resource Name + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Name; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMappingProperties _property; + + /// Properties of the storage mapping object. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMappingProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.StorageClassificationMappingProperties()); set => this._property = value; } + + /// Target storage object Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string TargetStorageClassificationId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMappingPropertiesInternal)Property).TargetStorageClassificationId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMappingPropertiesInternal)Property).TargetStorageClassificationId = value ?? null; } + + /// Resource Type + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Type; } + + /// Creates an new instance. + public StorageClassificationMapping() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__resource), __resource); + await eventListener.AssertObjectIsValid(nameof(__resource), __resource); + } + } + /// Storage mapping object. + public partial interface IStorageClassificationMapping : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResource + { + /// Target storage object Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Target storage object Id.", + SerializedName = @"targetStorageClassificationId", + PossibleTypes = new [] { typeof(string) })] + string TargetStorageClassificationId { get; set; } + + } + /// Storage mapping object. + internal partial interface IStorageClassificationMappingInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal + { + /// Properties of the storage mapping object. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMappingProperties Property { get; set; } + /// Target storage object Id. + string TargetStorageClassificationId { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageClassificationMapping.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageClassificationMapping.json.cs new file mode 100644 index 000000000000..4cdcb7ed35ab --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageClassificationMapping.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Storage mapping object. + public partial class StorageClassificationMapping + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMapping. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMapping. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMapping FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new StorageClassificationMapping(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal StorageClassificationMapping(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __resource = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.Resource(json); + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.StorageClassificationMappingProperties.FromJson(__jsonProperties) : Property;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __resource?.ToJson(container, serializationMode); + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageClassificationMappingCollection.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageClassificationMappingCollection.PowerShell.cs new file mode 100644 index 000000000000..27d8390f688a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageClassificationMappingCollection.PowerShell.cs @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Collection of storage mapping details. + [System.ComponentModel.TypeConverter(typeof(StorageClassificationMappingCollectionTypeConverter))] + public partial class StorageClassificationMappingCollection + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMappingCollection DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new StorageClassificationMappingCollection(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMappingCollection DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new StorageClassificationMappingCollection(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json + /// string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMappingCollection FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal StorageClassificationMappingCollection(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMappingCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMapping[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMappingCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.StorageClassificationMappingTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMappingCollectionInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMappingCollectionInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal StorageClassificationMappingCollection(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMappingCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMapping[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMappingCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.StorageClassificationMappingTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMappingCollectionInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMappingCollectionInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Collection of storage mapping details. + [System.ComponentModel.TypeConverter(typeof(StorageClassificationMappingCollectionTypeConverter))] + public partial interface IStorageClassificationMappingCollection + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageClassificationMappingCollection.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageClassificationMappingCollection.TypeConverter.cs new file mode 100644 index 000000000000..a5f0fc608bac --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageClassificationMappingCollection.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class StorageClassificationMappingCollectionTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMappingCollection ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMappingCollection).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return StorageClassificationMappingCollection.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return StorageClassificationMappingCollection.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return StorageClassificationMappingCollection.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageClassificationMappingCollection.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageClassificationMappingCollection.cs new file mode 100644 index 000000000000..a9589b32c14a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageClassificationMappingCollection.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Collection of storage mapping details. + public partial class StorageClassificationMappingCollection : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMappingCollection, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMappingCollectionInternal + { + + /// Backing field for property. + private string _nextLink; + + /// The value of next link. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string NextLink { get => this._nextLink; set => this._nextLink = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMapping[] _value; + + /// The storage details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMapping[] Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public StorageClassificationMappingCollection() + { + + } + } + /// Collection of storage mapping details. + public partial interface IStorageClassificationMappingCollection : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The value of next link. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The value of next link.", + SerializedName = @"nextLink", + PossibleTypes = new [] { typeof(string) })] + string NextLink { get; set; } + /// The storage details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The storage details.", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMapping) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMapping[] Value { get; set; } + + } + /// Collection of storage mapping details. + internal partial interface IStorageClassificationMappingCollectionInternal + + { + /// The value of next link. + string NextLink { get; set; } + /// The storage details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMapping[] Value { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageClassificationMappingCollection.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageClassificationMappingCollection.json.cs new file mode 100644 index 000000000000..864f8ae76e4b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageClassificationMappingCollection.json.cs @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Collection of storage mapping details. + public partial class StorageClassificationMappingCollection + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMappingCollection. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMappingCollection. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMappingCollection FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new StorageClassificationMappingCollection(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal StorageClassificationMappingCollection(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMapping) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.StorageClassificationMapping.FromJson(__u) )) ))() : null : Value;} + {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)NextLink;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._value) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._value ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("value",__w); + } + AddIf( null != (((object)this._nextLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageClassificationMappingInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageClassificationMappingInput.PowerShell.cs new file mode 100644 index 000000000000..a6049f12eb04 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageClassificationMappingInput.PowerShell.cs @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Storage mapping input. + [System.ComponentModel.TypeConverter(typeof(StorageClassificationMappingInputTypeConverter))] + public partial class StorageClassificationMappingInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMappingInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new StorageClassificationMappingInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMappingInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new StorageClassificationMappingInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMappingInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal StorageClassificationMappingInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMappingInputInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageMappingInputProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMappingInputInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.StorageMappingInputPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("TargetStorageClassificationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMappingInputInternal)this).TargetStorageClassificationId = (string) content.GetValueForProperty("TargetStorageClassificationId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMappingInputInternal)this).TargetStorageClassificationId, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal StorageClassificationMappingInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMappingInputInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageMappingInputProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMappingInputInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.StorageMappingInputPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("TargetStorageClassificationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMappingInputInternal)this).TargetStorageClassificationId = (string) content.GetValueForProperty("TargetStorageClassificationId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMappingInputInternal)this).TargetStorageClassificationId, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Storage mapping input. + [System.ComponentModel.TypeConverter(typeof(StorageClassificationMappingInputTypeConverter))] + public partial interface IStorageClassificationMappingInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageClassificationMappingInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageClassificationMappingInput.TypeConverter.cs new file mode 100644 index 000000000000..01ca8a8f0e1c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageClassificationMappingInput.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class StorageClassificationMappingInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMappingInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMappingInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return StorageClassificationMappingInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return StorageClassificationMappingInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return StorageClassificationMappingInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageClassificationMappingInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageClassificationMappingInput.cs new file mode 100644 index 000000000000..b49e4b1e6923 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageClassificationMappingInput.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Storage mapping input. + public partial class StorageClassificationMappingInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMappingInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMappingInputInternal + { + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageMappingInputProperties Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMappingInputInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.StorageMappingInputProperties()); set { {_property = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageMappingInputProperties _property; + + /// Storage mapping input properties. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageMappingInputProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.StorageMappingInputProperties()); set => this._property = value; } + + /// The ID of the storage object. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string TargetStorageClassificationId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageMappingInputPropertiesInternal)Property).TargetStorageClassificationId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageMappingInputPropertiesInternal)Property).TargetStorageClassificationId = value ?? null; } + + /// Creates an new instance. + public StorageClassificationMappingInput() + { + + } + } + /// Storage mapping input. + public partial interface IStorageClassificationMappingInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The ID of the storage object. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The ID of the storage object.", + SerializedName = @"targetStorageClassificationId", + PossibleTypes = new [] { typeof(string) })] + string TargetStorageClassificationId { get; set; } + + } + /// Storage mapping input. + internal partial interface IStorageClassificationMappingInputInternal + + { + /// Storage mapping input properties. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageMappingInputProperties Property { get; set; } + /// The ID of the storage object. + string TargetStorageClassificationId { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageClassificationMappingInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageClassificationMappingInput.json.cs new file mode 100644 index 000000000000..c31b3353334f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageClassificationMappingInput.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Storage mapping input. + public partial class StorageClassificationMappingInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMappingInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMappingInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMappingInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new StorageClassificationMappingInput(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal StorageClassificationMappingInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.StorageMappingInputProperties.FromJson(__jsonProperties) : Property;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageClassificationMappingProperties.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageClassificationMappingProperties.PowerShell.cs new file mode 100644 index 000000000000..1eb710e3045d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageClassificationMappingProperties.PowerShell.cs @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Storage mapping properties. + [System.ComponentModel.TypeConverter(typeof(StorageClassificationMappingPropertiesTypeConverter))] + public partial class StorageClassificationMappingProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMappingProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new StorageClassificationMappingProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMappingProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new StorageClassificationMappingProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json + /// string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMappingProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal StorageClassificationMappingProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("TargetStorageClassificationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMappingPropertiesInternal)this).TargetStorageClassificationId = (string) content.GetValueForProperty("TargetStorageClassificationId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMappingPropertiesInternal)this).TargetStorageClassificationId, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal StorageClassificationMappingProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("TargetStorageClassificationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMappingPropertiesInternal)this).TargetStorageClassificationId = (string) content.GetValueForProperty("TargetStorageClassificationId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMappingPropertiesInternal)this).TargetStorageClassificationId, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Storage mapping properties. + [System.ComponentModel.TypeConverter(typeof(StorageClassificationMappingPropertiesTypeConverter))] + public partial interface IStorageClassificationMappingProperties + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageClassificationMappingProperties.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageClassificationMappingProperties.TypeConverter.cs new file mode 100644 index 000000000000..667f5602680b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageClassificationMappingProperties.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class StorageClassificationMappingPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMappingProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMappingProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return StorageClassificationMappingProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return StorageClassificationMappingProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return StorageClassificationMappingProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageClassificationMappingProperties.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageClassificationMappingProperties.cs new file mode 100644 index 000000000000..3d58af5f1bd8 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageClassificationMappingProperties.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Storage mapping properties. + public partial class StorageClassificationMappingProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMappingProperties, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMappingPropertiesInternal + { + + /// Backing field for property. + private string _targetStorageClassificationId; + + /// Target storage object Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetStorageClassificationId { get => this._targetStorageClassificationId; set => this._targetStorageClassificationId = value; } + + /// Creates an new instance. + public StorageClassificationMappingProperties() + { + + } + } + /// Storage mapping properties. + public partial interface IStorageClassificationMappingProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// Target storage object Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Target storage object Id.", + SerializedName = @"targetStorageClassificationId", + PossibleTypes = new [] { typeof(string) })] + string TargetStorageClassificationId { get; set; } + + } + /// Storage mapping properties. + internal partial interface IStorageClassificationMappingPropertiesInternal + + { + /// Target storage object Id. + string TargetStorageClassificationId { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageClassificationMappingProperties.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageClassificationMappingProperties.json.cs new file mode 100644 index 000000000000..0ef45d14f623 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageClassificationMappingProperties.json.cs @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Storage mapping properties. + public partial class StorageClassificationMappingProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMappingProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMappingProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMappingProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new StorageClassificationMappingProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal StorageClassificationMappingProperties(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_targetStorageClassificationId = If( json?.PropertyT("targetStorageClassificationId"), out var __jsonTargetStorageClassificationId) ? (string)__jsonTargetStorageClassificationId : (string)TargetStorageClassificationId;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._targetStorageClassificationId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetStorageClassificationId.ToString()) : null, "targetStorageClassificationId" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageClassificationProperties.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageClassificationProperties.PowerShell.cs new file mode 100644 index 000000000000..473e64a86bc5 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageClassificationProperties.PowerShell.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Storage object properties. + [System.ComponentModel.TypeConverter(typeof(StorageClassificationPropertiesTypeConverter))] + public partial class StorageClassificationProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new StorageClassificationProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new StorageClassificationProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal StorageClassificationProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("FriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationPropertiesInternal)this).FriendlyName = (string) content.GetValueForProperty("FriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationPropertiesInternal)this).FriendlyName, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal StorageClassificationProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("FriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationPropertiesInternal)this).FriendlyName = (string) content.GetValueForProperty("FriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationPropertiesInternal)this).FriendlyName, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Storage object properties. + [System.ComponentModel.TypeConverter(typeof(StorageClassificationPropertiesTypeConverter))] + public partial interface IStorageClassificationProperties + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageClassificationProperties.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageClassificationProperties.TypeConverter.cs new file mode 100644 index 000000000000..6b1e2d4b5705 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageClassificationProperties.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class StorageClassificationPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return StorageClassificationProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return StorageClassificationProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return StorageClassificationProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageClassificationProperties.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageClassificationProperties.cs new file mode 100644 index 000000000000..72a023cb76c0 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageClassificationProperties.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Storage object properties. + public partial class StorageClassificationProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationProperties, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationPropertiesInternal + { + + /// Backing field for property. + private string _friendlyName; + + /// Friendly name of the Storage classification. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string FriendlyName { get => this._friendlyName; set => this._friendlyName = value; } + + /// Creates an new instance. + public StorageClassificationProperties() + { + + } + } + /// Storage object properties. + public partial interface IStorageClassificationProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// Friendly name of the Storage classification. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Friendly name of the Storage classification.", + SerializedName = @"friendlyName", + PossibleTypes = new [] { typeof(string) })] + string FriendlyName { get; set; } + + } + /// Storage object properties. + internal partial interface IStorageClassificationPropertiesInternal + + { + /// Friendly name of the Storage classification. + string FriendlyName { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageClassificationProperties.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageClassificationProperties.json.cs new file mode 100644 index 000000000000..f923b5ca242b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageClassificationProperties.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Storage object properties. + public partial class StorageClassificationProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new StorageClassificationProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal StorageClassificationProperties(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_friendlyName = If( json?.PropertyT("friendlyName"), out var __jsonFriendlyName) ? (string)__jsonFriendlyName : (string)FriendlyName;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._friendlyName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._friendlyName.ToString()) : null, "friendlyName" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageMappingInputProperties.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageMappingInputProperties.PowerShell.cs new file mode 100644 index 000000000000..b69f91d2004d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageMappingInputProperties.PowerShell.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Storage mapping input properties. + [System.ComponentModel.TypeConverter(typeof(StorageMappingInputPropertiesTypeConverter))] + public partial class StorageMappingInputProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageMappingInputProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new StorageMappingInputProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageMappingInputProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new StorageMappingInputProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageMappingInputProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal StorageMappingInputProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("TargetStorageClassificationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageMappingInputPropertiesInternal)this).TargetStorageClassificationId = (string) content.GetValueForProperty("TargetStorageClassificationId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageMappingInputPropertiesInternal)this).TargetStorageClassificationId, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal StorageMappingInputProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("TargetStorageClassificationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageMappingInputPropertiesInternal)this).TargetStorageClassificationId = (string) content.GetValueForProperty("TargetStorageClassificationId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageMappingInputPropertiesInternal)this).TargetStorageClassificationId, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Storage mapping input properties. + [System.ComponentModel.TypeConverter(typeof(StorageMappingInputPropertiesTypeConverter))] + public partial interface IStorageMappingInputProperties + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageMappingInputProperties.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageMappingInputProperties.TypeConverter.cs new file mode 100644 index 000000000000..32d613f25051 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageMappingInputProperties.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class StorageMappingInputPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageMappingInputProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageMappingInputProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return StorageMappingInputProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return StorageMappingInputProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return StorageMappingInputProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageMappingInputProperties.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageMappingInputProperties.cs new file mode 100644 index 000000000000..600d4c397f8a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageMappingInputProperties.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Storage mapping input properties. + public partial class StorageMappingInputProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageMappingInputProperties, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageMappingInputPropertiesInternal + { + + /// Backing field for property. + private string _targetStorageClassificationId; + + /// The ID of the storage object. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetStorageClassificationId { get => this._targetStorageClassificationId; set => this._targetStorageClassificationId = value; } + + /// Creates an new instance. + public StorageMappingInputProperties() + { + + } + } + /// Storage mapping input properties. + public partial interface IStorageMappingInputProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The ID of the storage object. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The ID of the storage object.", + SerializedName = @"targetStorageClassificationId", + PossibleTypes = new [] { typeof(string) })] + string TargetStorageClassificationId { get; set; } + + } + /// Storage mapping input properties. + internal partial interface IStorageMappingInputPropertiesInternal + + { + /// The ID of the storage object. + string TargetStorageClassificationId { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageMappingInputProperties.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageMappingInputProperties.json.cs new file mode 100644 index 000000000000..ded6f15b0aca --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/StorageMappingInputProperties.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Storage mapping input properties. + public partial class StorageMappingInputProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageMappingInputProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageMappingInputProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageMappingInputProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new StorageMappingInputProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal StorageMappingInputProperties(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_targetStorageClassificationId = If( json?.PropertyT("targetStorageClassificationId"), out var __jsonTargetStorageClassificationId) ? (string)__jsonTargetStorageClassificationId : (string)TargetStorageClassificationId;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._targetStorageClassificationId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetStorageClassificationId.ToString()) : null, "targetStorageClassificationId" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Subnet.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Subnet.PowerShell.cs new file mode 100644 index 000000000000..89b282ca5999 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Subnet.PowerShell.cs @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Subnets of the network. + [System.ComponentModel.TypeConverter(typeof(SubnetTypeConverter))] + public partial class Subnet + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISubnet DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new Subnet(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISubnet DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new Subnet(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISubnet FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal Subnet(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISubnetInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISubnetInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("FriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISubnetInternal)this).FriendlyName = (string) content.GetValueForProperty("FriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISubnetInternal)this).FriendlyName, global::System.Convert.ToString); + } + if (content.Contains("AddressList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISubnetInternal)this).AddressList = (string[]) content.GetValueForProperty("AddressList",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISubnetInternal)this).AddressList, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal Subnet(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISubnetInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISubnetInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("FriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISubnetInternal)this).FriendlyName = (string) content.GetValueForProperty("FriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISubnetInternal)this).FriendlyName, global::System.Convert.ToString); + } + if (content.Contains("AddressList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISubnetInternal)this).AddressList = (string[]) content.GetValueForProperty("AddressList",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISubnetInternal)this).AddressList, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Subnets of the network. + [System.ComponentModel.TypeConverter(typeof(SubnetTypeConverter))] + public partial interface ISubnet + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Subnet.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Subnet.TypeConverter.cs new file mode 100644 index 000000000000..c86e8769c542 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Subnet.TypeConverter.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class SubnetTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISubnet ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISubnet).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return Subnet.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return Subnet.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return Subnet.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Subnet.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Subnet.cs new file mode 100644 index 000000000000..9d092630cef2 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Subnet.cs @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Subnets of the network. + public partial class Subnet : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISubnet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISubnetInternal + { + + /// Backing field for property. + private string[] _addressList; + + /// The list of addresses for the subnet. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string[] AddressList { get => this._addressList; set => this._addressList = value; } + + /// Backing field for property. + private string _friendlyName; + + /// The subnet friendly name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string FriendlyName { get => this._friendlyName; set => this._friendlyName = value; } + + /// Backing field for property. + private string _name; + + /// The subnet name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Name { get => this._name; set => this._name = value; } + + /// Creates an new instance. + public Subnet() + { + + } + } + /// Subnets of the network. + public partial interface ISubnet : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The list of addresses for the subnet. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of addresses for the subnet.", + SerializedName = @"addressList", + PossibleTypes = new [] { typeof(string) })] + string[] AddressList { get; set; } + /// The subnet friendly name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The subnet friendly name.", + SerializedName = @"friendlyName", + PossibleTypes = new [] { typeof(string) })] + string FriendlyName { get; set; } + /// The subnet name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The subnet name.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string Name { get; set; } + + } + /// Subnets of the network. + internal partial interface ISubnetInternal + + { + /// The list of addresses for the subnet. + string[] AddressList { get; set; } + /// The subnet friendly name. + string FriendlyName { get; set; } + /// The subnet name. + string Name { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Subnet.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Subnet.json.cs new file mode 100644 index 000000000000..d6676f2a2043 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/Subnet.json.cs @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Subnets of the network. + public partial class Subnet + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISubnet. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISubnet. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISubnet FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new Subnet(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal Subnet(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)Name;} + {_friendlyName = If( json?.PropertyT("friendlyName"), out var __jsonFriendlyName) ? (string)__jsonFriendlyName : (string)FriendlyName;} + {_addressList = If( json?.PropertyT("addressList"), out var __jsonAddressList) ? If( __jsonAddressList as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(string) (__u is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : AddressList;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); + AddIf( null != (((object)this._friendlyName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._friendlyName.ToString()) : null, "friendlyName" ,container.Add ); + if (null != this._addressList) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._addressList ) + { + AddIf(null != (((object)__x)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(__x.ToString()) : null ,__w.Add); + } + container.Add("addressList",__w); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SupportedOSDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SupportedOSDetails.PowerShell.cs new file mode 100644 index 000000000000..6c0bddc6c096 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SupportedOSDetails.PowerShell.cs @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Supported operating system details. + [System.ComponentModel.TypeConverter(typeof(SupportedOSDetailsTypeConverter))] + public partial class SupportedOSDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOSDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new SupportedOSDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOSDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new SupportedOSDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOSDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal SupportedOSDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("OSName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOSDetailsInternal)this).OSName = (string) content.GetValueForProperty("OSName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOSDetailsInternal)this).OSName, global::System.Convert.ToString); + } + if (content.Contains("OSType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOSDetailsInternal)this).OSType = (string) content.GetValueForProperty("OSType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOSDetailsInternal)this).OSType, global::System.Convert.ToString); + } + if (content.Contains("OSVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOSDetailsInternal)this).OSVersion = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSVersionWrapper[]) content.GetValueForProperty("OSVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOSDetailsInternal)this).OSVersion, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.OSVersionWrapperTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal SupportedOSDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("OSName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOSDetailsInternal)this).OSName = (string) content.GetValueForProperty("OSName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOSDetailsInternal)this).OSName, global::System.Convert.ToString); + } + if (content.Contains("OSType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOSDetailsInternal)this).OSType = (string) content.GetValueForProperty("OSType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOSDetailsInternal)this).OSType, global::System.Convert.ToString); + } + if (content.Contains("OSVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOSDetailsInternal)this).OSVersion = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSVersionWrapper[]) content.GetValueForProperty("OSVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOSDetailsInternal)this).OSVersion, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.OSVersionWrapperTypeConverter.ConvertFrom)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Supported operating system details. + [System.ComponentModel.TypeConverter(typeof(SupportedOSDetailsTypeConverter))] + public partial interface ISupportedOSDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SupportedOSDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SupportedOSDetails.TypeConverter.cs new file mode 100644 index 000000000000..d152b2d88bbf --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SupportedOSDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class SupportedOSDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOSDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOSDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return SupportedOSDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return SupportedOSDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return SupportedOSDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SupportedOSDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SupportedOSDetails.cs new file mode 100644 index 000000000000..90508c303e12 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SupportedOSDetails.cs @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Supported operating system details. + public partial class SupportedOSDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOSDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOSDetailsInternal + { + + /// Backing field for property. + private string _oSName; + + /// The name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string OSName { get => this._oSName; set => this._oSName = value; } + + /// Backing field for property. + private string _oSType; + + /// The type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string OSType { get => this._oSType; set => this._oSType = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSVersionWrapper[] _oSVersion; + + /// The list of version for operating system. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSVersionWrapper[] OSVersion { get => this._oSVersion; set => this._oSVersion = value; } + + /// Creates an new instance. + public SupportedOSDetails() + { + + } + } + /// Supported operating system details. + public partial interface ISupportedOSDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name.", + SerializedName = @"osName", + PossibleTypes = new [] { typeof(string) })] + string OSName { get; set; } + /// The type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The type.", + SerializedName = @"osType", + PossibleTypes = new [] { typeof(string) })] + string OSType { get; set; } + /// The list of version for operating system. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of version for operating system.", + SerializedName = @"osVersions", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSVersionWrapper) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSVersionWrapper[] OSVersion { get; set; } + + } + /// Supported operating system details. + internal partial interface ISupportedOSDetailsInternal + + { + /// The name. + string OSName { get; set; } + /// The type. + string OSType { get; set; } + /// The list of version for operating system. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSVersionWrapper[] OSVersion { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SupportedOSDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SupportedOSDetails.json.cs new file mode 100644 index 000000000000..daee477120b5 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SupportedOSDetails.json.cs @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Supported operating system details. + public partial class SupportedOSDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOSDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOSDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOSDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new SupportedOSDetails(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal SupportedOSDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_oSName = If( json?.PropertyT("osName"), out var __jsonOSName) ? (string)__jsonOSName : (string)OSName;} + {_oSType = If( json?.PropertyT("osType"), out var __jsonOSType) ? (string)__jsonOSType : (string)OSType;} + {_oSVersion = If( json?.PropertyT("osVersions"), out var __jsonOSVersions) ? If( __jsonOSVersions as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSVersionWrapper) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.OSVersionWrapper.FromJson(__u) )) ))() : null : OSVersion;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._oSName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._oSName.ToString()) : null, "osName" ,container.Add ); + AddIf( null != (((object)this._oSType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._oSType.ToString()) : null, "osType" ,container.Add ); + if (null != this._oSVersion) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._oSVersion ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("osVersions",__w); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SupportedOSProperties.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SupportedOSProperties.PowerShell.cs new file mode 100644 index 000000000000..28bf3463c9c2 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SupportedOSProperties.PowerShell.cs @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Supported operating systems properties. + [System.ComponentModel.TypeConverter(typeof(SupportedOSPropertiesTypeConverter))] + public partial class SupportedOSProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOSProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new SupportedOSProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOSProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new SupportedOSProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOSProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal SupportedOSProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SupportedOSList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOSPropertiesInternal)this).SupportedOSList = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOSProperty[]) content.GetValueForProperty("SupportedOSList",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOSPropertiesInternal)this).SupportedOSList, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.SupportedOSPropertyTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal SupportedOSProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SupportedOSList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOSPropertiesInternal)this).SupportedOSList = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOSProperty[]) content.GetValueForProperty("SupportedOSList",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOSPropertiesInternal)this).SupportedOSList, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.SupportedOSPropertyTypeConverter.ConvertFrom)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Supported operating systems properties. + [System.ComponentModel.TypeConverter(typeof(SupportedOSPropertiesTypeConverter))] + public partial interface ISupportedOSProperties + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SupportedOSProperties.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SupportedOSProperties.TypeConverter.cs new file mode 100644 index 000000000000..6341547c0da9 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SupportedOSProperties.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class SupportedOSPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOSProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOSProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return SupportedOSProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return SupportedOSProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return SupportedOSProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SupportedOSProperties.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SupportedOSProperties.cs new file mode 100644 index 000000000000..4b40a518395c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SupportedOSProperties.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Supported operating systems properties. + public partial class SupportedOSProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOSProperties, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOSPropertiesInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOSProperty[] _supportedOSList; + + /// The supported operating systems property list. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOSProperty[] SupportedOSList { get => this._supportedOSList; set => this._supportedOSList = value; } + + /// Creates an new instance. + public SupportedOSProperties() + { + + } + } + /// Supported operating systems properties. + public partial interface ISupportedOSProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The supported operating systems property list. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The supported operating systems property list.", + SerializedName = @"supportedOsList", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOSProperty) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOSProperty[] SupportedOSList { get; set; } + + } + /// Supported operating systems properties. + internal partial interface ISupportedOSPropertiesInternal + + { + /// The supported operating systems property list. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOSProperty[] SupportedOSList { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SupportedOSProperties.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SupportedOSProperties.json.cs new file mode 100644 index 000000000000..ddcfb491eac6 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SupportedOSProperties.json.cs @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Supported operating systems properties. + public partial class SupportedOSProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOSProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOSProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOSProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new SupportedOSProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal SupportedOSProperties(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_supportedOSList = If( json?.PropertyT("supportedOsList"), out var __jsonSupportedOSList) ? If( __jsonSupportedOSList as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOSProperty) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.SupportedOSProperty.FromJson(__u) )) ))() : null : SupportedOSList;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._supportedOSList) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._supportedOSList ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("supportedOsList",__w); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SupportedOSProperty.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SupportedOSProperty.PowerShell.cs new file mode 100644 index 000000000000..202745670e11 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SupportedOSProperty.PowerShell.cs @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Supported operating systems property. + [System.ComponentModel.TypeConverter(typeof(SupportedOSPropertyTypeConverter))] + public partial class SupportedOSProperty + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOSProperty DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new SupportedOSProperty(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOSProperty DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new SupportedOSProperty(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOSProperty FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal SupportedOSProperty(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOSPropertyInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOSPropertyInternal)this).InstanceType, global::System.Convert.ToString); + } + if (content.Contains("SupportedOS")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOSPropertyInternal)this).SupportedOS = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOSDetails[]) content.GetValueForProperty("SupportedOS",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOSPropertyInternal)this).SupportedOS, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.SupportedOSDetailsTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal SupportedOSProperty(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOSPropertyInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOSPropertyInternal)this).InstanceType, global::System.Convert.ToString); + } + if (content.Contains("SupportedOS")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOSPropertyInternal)this).SupportedOS = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOSDetails[]) content.GetValueForProperty("SupportedOS",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOSPropertyInternal)this).SupportedOS, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.SupportedOSDetailsTypeConverter.ConvertFrom)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Supported operating systems property. + [System.ComponentModel.TypeConverter(typeof(SupportedOSPropertyTypeConverter))] + public partial interface ISupportedOSProperty + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SupportedOSProperty.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SupportedOSProperty.TypeConverter.cs new file mode 100644 index 000000000000..bf21948be0cd --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SupportedOSProperty.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class SupportedOSPropertyTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOSProperty ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOSProperty).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return SupportedOSProperty.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return SupportedOSProperty.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return SupportedOSProperty.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SupportedOSProperty.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SupportedOSProperty.cs new file mode 100644 index 000000000000..91825c180fbd --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SupportedOSProperty.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Supported operating systems property. + public partial class SupportedOSProperty : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOSProperty, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOSPropertyInternal + { + + /// Backing field for property. + private string _instanceType; + + /// The replication provider type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string InstanceType { get => this._instanceType; set => this._instanceType = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOSDetails[] _supportedOS; + + /// The list of supported operating systems. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOSDetails[] SupportedOS { get => this._supportedOS; set => this._supportedOS = value; } + + /// Creates an new instance. + public SupportedOSProperty() + { + + } + } + /// Supported operating systems property. + public partial interface ISupportedOSProperty : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The replication provider type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The replication provider type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string InstanceType { get; set; } + /// The list of supported operating systems. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of supported operating systems.", + SerializedName = @"supportedOs", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOSDetails) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOSDetails[] SupportedOS { get; set; } + + } + /// Supported operating systems property. + internal partial interface ISupportedOSPropertyInternal + + { + /// The replication provider type. + string InstanceType { get; set; } + /// The list of supported operating systems. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOSDetails[] SupportedOS { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SupportedOSProperty.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SupportedOSProperty.json.cs new file mode 100644 index 000000000000..3495fb5c1d44 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SupportedOSProperty.json.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Supported operating systems property. + public partial class SupportedOSProperty + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOSProperty. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOSProperty. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOSProperty FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new SupportedOSProperty(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal SupportedOSProperty(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_instanceType = If( json?.PropertyT("instanceType"), out var __jsonInstanceType) ? (string)__jsonInstanceType : (string)InstanceType;} + {_supportedOS = If( json?.PropertyT("supportedOs"), out var __jsonSupportedOS) ? If( __jsonSupportedOS as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOSDetails) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.SupportedOSDetails.FromJson(__u) )) ))() : null : SupportedOS;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._instanceType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._instanceType.ToString()) : null, "instanceType" ,container.Add ); + if (null != this._supportedOS) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._supportedOS ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("supportedOs",__w); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SupportedOperatingSystems.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SupportedOperatingSystems.PowerShell.cs new file mode 100644 index 000000000000..47825da7f72b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SupportedOperatingSystems.PowerShell.cs @@ -0,0 +1,186 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Supported operating systems. + [System.ComponentModel.TypeConverter(typeof(SupportedOperatingSystemsTypeConverter))] + public partial class SupportedOperatingSystems + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOperatingSystems DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new SupportedOperatingSystems(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOperatingSystems DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new SupportedOperatingSystems(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOperatingSystems FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal SupportedOperatingSystems(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOperatingSystemsInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOSProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOperatingSystemsInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.SupportedOSPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("SupportedOSList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOperatingSystemsInternal)this).SupportedOSList = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOSProperty[]) content.GetValueForProperty("SupportedOSList",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOperatingSystemsInternal)this).SupportedOSList, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.SupportedOSPropertyTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal SupportedOperatingSystems(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOperatingSystemsInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOSProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOperatingSystemsInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.SupportedOSPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("SupportedOSList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOperatingSystemsInternal)this).SupportedOSList = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOSProperty[]) content.GetValueForProperty("SupportedOSList",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOperatingSystemsInternal)this).SupportedOSList, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.SupportedOSPropertyTypeConverter.ConvertFrom)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Supported operating systems. + [System.ComponentModel.TypeConverter(typeof(SupportedOperatingSystemsTypeConverter))] + public partial interface ISupportedOperatingSystems + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SupportedOperatingSystems.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SupportedOperatingSystems.TypeConverter.cs new file mode 100644 index 000000000000..212fb2762c1f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SupportedOperatingSystems.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class SupportedOperatingSystemsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOperatingSystems ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOperatingSystems).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return SupportedOperatingSystems.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return SupportedOperatingSystems.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return SupportedOperatingSystems.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SupportedOperatingSystems.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SupportedOperatingSystems.cs new file mode 100644 index 000000000000..972958b7b04a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SupportedOperatingSystems.cs @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Supported operating systems. + public partial class SupportedOperatingSystems : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOperatingSystems, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOperatingSystemsInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResource __resource = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.Resource(); + + /// Resource Id + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Id; } + + /// Resource Location + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string Location { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Location; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Location = value ?? null; } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Id = value; } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Name = value; } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Type = value; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOSProperties Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOperatingSystemsInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.SupportedOSProperties()); set { {_property = value;} } } + + /// Resource Name + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Name; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOSProperties _property; + + /// The supported operating systems properties. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOSProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.SupportedOSProperties()); set => this._property = value; } + + /// The supported operating systems property list. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOSProperty[] SupportedOSList { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOSPropertiesInternal)Property).SupportedOSList; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOSPropertiesInternal)Property).SupportedOSList = value ?? null /* arrayOf */; } + + /// Resource Type + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Type; } + + /// Creates an new instance. + public SupportedOperatingSystems() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__resource), __resource); + await eventListener.AssertObjectIsValid(nameof(__resource), __resource); + } + } + /// Supported operating systems. + public partial interface ISupportedOperatingSystems : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResource + { + /// The supported operating systems property list. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The supported operating systems property list.", + SerializedName = @"supportedOsList", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOSProperty) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOSProperty[] SupportedOSList { get; set; } + + } + /// Supported operating systems. + internal partial interface ISupportedOperatingSystemsInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal + { + /// The supported operating systems properties. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOSProperties Property { get; set; } + /// The supported operating systems property list. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOSProperty[] SupportedOSList { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SupportedOperatingSystems.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SupportedOperatingSystems.json.cs new file mode 100644 index 000000000000..c9dcfabe7d5d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SupportedOperatingSystems.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Supported operating systems. + public partial class SupportedOperatingSystems + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOperatingSystems. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOperatingSystems. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOperatingSystems FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new SupportedOperatingSystems(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal SupportedOperatingSystems(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __resource = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.Resource(json); + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.SupportedOSProperties.FromJson(__jsonProperties) : Property;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __resource?.ToJson(container, serializationMode); + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SwitchProtectionInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SwitchProtectionInput.PowerShell.cs new file mode 100644 index 000000000000..ecb7bbea3121 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SwitchProtectionInput.PowerShell.cs @@ -0,0 +1,168 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Switch protection input. + [System.ComponentModel.TypeConverter(typeof(SwitchProtectionInputTypeConverter))] + public partial class SwitchProtectionInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new SwitchProtectionInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new SwitchProtectionInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal SwitchProtectionInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionInputInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionInputProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionInputInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.SwitchProtectionInputPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionInputInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionProviderSpecificInput) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionInputInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.SwitchProtectionProviderSpecificInputTypeConverter.ConvertFrom); + } + if (content.Contains("ReplicationProtectedItemName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionInputInternal)this).ReplicationProtectedItemName = (string) content.GetValueForProperty("ReplicationProtectedItemName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionInputInternal)this).ReplicationProtectedItemName, global::System.Convert.ToString); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionInputInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionInputInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal SwitchProtectionInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionInputInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionInputProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionInputInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.SwitchProtectionInputPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionInputInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionProviderSpecificInput) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionInputInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.SwitchProtectionProviderSpecificInputTypeConverter.ConvertFrom); + } + if (content.Contains("ReplicationProtectedItemName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionInputInternal)this).ReplicationProtectedItemName = (string) content.GetValueForProperty("ReplicationProtectedItemName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionInputInternal)this).ReplicationProtectedItemName, global::System.Convert.ToString); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionInputInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionInputInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Switch protection input. + [System.ComponentModel.TypeConverter(typeof(SwitchProtectionInputTypeConverter))] + public partial interface ISwitchProtectionInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SwitchProtectionInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SwitchProtectionInput.TypeConverter.cs new file mode 100644 index 000000000000..88e1d8d2e528 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SwitchProtectionInput.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class SwitchProtectionInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return SwitchProtectionInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return SwitchProtectionInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return SwitchProtectionInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SwitchProtectionInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SwitchProtectionInput.cs new file mode 100644 index 000000000000..e49169746506 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SwitchProtectionInput.cs @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Switch protection input. + public partial class SwitchProtectionInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionInputInternal + { + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionInputProperties Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionInputInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.SwitchProtectionInputProperties()); set { {_property = value;} } } + + /// Internal Acessors for ProviderSpecificDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionProviderSpecificInput Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionInputInternal.ProviderSpecificDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionInputPropertiesInternal)Property).ProviderSpecificDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionInputPropertiesInternal)Property).ProviderSpecificDetail = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionInputProperties _property; + + /// Switch protection properties. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionInputProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.SwitchProtectionInputProperties()); set => this._property = value; } + + /// Gets the Instance type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ProviderSpecificDetailInstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionInputPropertiesInternal)Property).ProviderSpecificDetailInstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionInputPropertiesInternal)Property).ProviderSpecificDetailInstanceType = value ?? null; } + + /// The unique replication protected item name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ReplicationProtectedItemName { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionInputPropertiesInternal)Property).ReplicationProtectedItemName; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionInputPropertiesInternal)Property).ReplicationProtectedItemName = value ?? null; } + + /// Creates an new instance. + public SwitchProtectionInput() + { + + } + } + /// Switch protection input. + public partial interface ISwitchProtectionInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// Gets the Instance type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets the Instance type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string ProviderSpecificDetailInstanceType { get; set; } + /// The unique replication protected item name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The unique replication protected item name.", + SerializedName = @"replicationProtectedItemName", + PossibleTypes = new [] { typeof(string) })] + string ReplicationProtectedItemName { get; set; } + + } + /// Switch protection input. + internal partial interface ISwitchProtectionInputInternal + + { + /// Switch protection properties. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionInputProperties Property { get; set; } + /// Provider specific switch protection input. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionProviderSpecificInput ProviderSpecificDetail { get; set; } + /// Gets the Instance type. + string ProviderSpecificDetailInstanceType { get; set; } + /// The unique replication protected item name. + string ReplicationProtectedItemName { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SwitchProtectionInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SwitchProtectionInput.json.cs new file mode 100644 index 000000000000..3bbe01787caa --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SwitchProtectionInput.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Switch protection input. + public partial class SwitchProtectionInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new SwitchProtectionInput(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal SwitchProtectionInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.SwitchProtectionInputProperties.FromJson(__jsonProperties) : Property;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SwitchProtectionInputProperties.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SwitchProtectionInputProperties.PowerShell.cs new file mode 100644 index 000000000000..e6a66b8ee52c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SwitchProtectionInputProperties.PowerShell.cs @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Switch protection input properties. + [System.ComponentModel.TypeConverter(typeof(SwitchProtectionInputPropertiesTypeConverter))] + public partial class SwitchProtectionInputProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionInputProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new SwitchProtectionInputProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionInputProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new SwitchProtectionInputProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionInputProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal SwitchProtectionInputProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionInputPropertiesInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionProviderSpecificInput) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionInputPropertiesInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.SwitchProtectionProviderSpecificInputTypeConverter.ConvertFrom); + } + if (content.Contains("ReplicationProtectedItemName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionInputPropertiesInternal)this).ReplicationProtectedItemName = (string) content.GetValueForProperty("ReplicationProtectedItemName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionInputPropertiesInternal)this).ReplicationProtectedItemName, global::System.Convert.ToString); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionInputPropertiesInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionInputPropertiesInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal SwitchProtectionInputProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionInputPropertiesInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionProviderSpecificInput) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionInputPropertiesInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.SwitchProtectionProviderSpecificInputTypeConverter.ConvertFrom); + } + if (content.Contains("ReplicationProtectedItemName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionInputPropertiesInternal)this).ReplicationProtectedItemName = (string) content.GetValueForProperty("ReplicationProtectedItemName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionInputPropertiesInternal)this).ReplicationProtectedItemName, global::System.Convert.ToString); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionInputPropertiesInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionInputPropertiesInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Switch protection input properties. + [System.ComponentModel.TypeConverter(typeof(SwitchProtectionInputPropertiesTypeConverter))] + public partial interface ISwitchProtectionInputProperties + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SwitchProtectionInputProperties.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SwitchProtectionInputProperties.TypeConverter.cs new file mode 100644 index 000000000000..345e26a9e979 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SwitchProtectionInputProperties.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class SwitchProtectionInputPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionInputProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionInputProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return SwitchProtectionInputProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return SwitchProtectionInputProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return SwitchProtectionInputProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SwitchProtectionInputProperties.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SwitchProtectionInputProperties.cs new file mode 100644 index 000000000000..ba927f7d6b51 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SwitchProtectionInputProperties.cs @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Switch protection input properties. + public partial class SwitchProtectionInputProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionInputProperties, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionInputPropertiesInternal + { + + /// Internal Acessors for ProviderSpecificDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionProviderSpecificInput Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionInputPropertiesInternal.ProviderSpecificDetail { get => (this._providerSpecificDetail = this._providerSpecificDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.SwitchProtectionProviderSpecificInput()); set { {_providerSpecificDetail = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionProviderSpecificInput _providerSpecificDetail; + + /// Provider specific switch protection input. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionProviderSpecificInput ProviderSpecificDetail { get => (this._providerSpecificDetail = this._providerSpecificDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.SwitchProtectionProviderSpecificInput()); set => this._providerSpecificDetail = value; } + + /// Gets the Instance type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ProviderSpecificDetailInstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionProviderSpecificInputInternal)ProviderSpecificDetail).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionProviderSpecificInputInternal)ProviderSpecificDetail).InstanceType = value ?? null; } + + /// Backing field for property. + private string _replicationProtectedItemName; + + /// The unique replication protected item name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ReplicationProtectedItemName { get => this._replicationProtectedItemName; set => this._replicationProtectedItemName = value; } + + /// Creates an new instance. + public SwitchProtectionInputProperties() + { + + } + } + /// Switch protection input properties. + public partial interface ISwitchProtectionInputProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// Gets the Instance type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets the Instance type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string ProviderSpecificDetailInstanceType { get; set; } + /// The unique replication protected item name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The unique replication protected item name.", + SerializedName = @"replicationProtectedItemName", + PossibleTypes = new [] { typeof(string) })] + string ReplicationProtectedItemName { get; set; } + + } + /// Switch protection input properties. + internal partial interface ISwitchProtectionInputPropertiesInternal + + { + /// Provider specific switch protection input. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionProviderSpecificInput ProviderSpecificDetail { get; set; } + /// Gets the Instance type. + string ProviderSpecificDetailInstanceType { get; set; } + /// The unique replication protected item name. + string ReplicationProtectedItemName { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SwitchProtectionInputProperties.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SwitchProtectionInputProperties.json.cs new file mode 100644 index 000000000000..e98a4847a384 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SwitchProtectionInputProperties.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Switch protection input properties. + public partial class SwitchProtectionInputProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionInputProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionInputProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionInputProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new SwitchProtectionInputProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal SwitchProtectionInputProperties(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_providerSpecificDetail = If( json?.PropertyT("providerSpecificDetails"), out var __jsonProviderSpecificDetails) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.SwitchProtectionProviderSpecificInput.FromJson(__jsonProviderSpecificDetails) : ProviderSpecificDetail;} + {_replicationProtectedItemName = If( json?.PropertyT("replicationProtectedItemName"), out var __jsonReplicationProtectedItemName) ? (string)__jsonReplicationProtectedItemName : (string)ReplicationProtectedItemName;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._providerSpecificDetail ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._providerSpecificDetail.ToJson(null,serializationMode) : null, "providerSpecificDetails" ,container.Add ); + AddIf( null != (((object)this._replicationProtectedItemName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._replicationProtectedItemName.ToString()) : null, "replicationProtectedItemName" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SwitchProtectionJobDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SwitchProtectionJobDetails.PowerShell.cs new file mode 100644 index 000000000000..a8f657ff0e29 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SwitchProtectionJobDetails.PowerShell.cs @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// This class represents details for switch protection job. + [System.ComponentModel.TypeConverter(typeof(SwitchProtectionJobDetailsTypeConverter))] + public partial class SwitchProtectionJobDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionJobDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new SwitchProtectionJobDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionJobDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new SwitchProtectionJobDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionJobDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal SwitchProtectionJobDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("NewReplicationProtectedItemId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionJobDetailsInternal)this).NewReplicationProtectedItemId = (string) content.GetValueForProperty("NewReplicationProtectedItemId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionJobDetailsInternal)this).NewReplicationProtectedItemId, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + if (content.Contains("AffectedObjectDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsInternal)this).AffectedObjectDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsAffectedObjectDetails) content.GetValueForProperty("AffectedObjectDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsInternal)this).AffectedObjectDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.JobDetailsAffectedObjectDetailsTypeConverter.ConvertFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal SwitchProtectionJobDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("NewReplicationProtectedItemId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionJobDetailsInternal)this).NewReplicationProtectedItemId = (string) content.GetValueForProperty("NewReplicationProtectedItemId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionJobDetailsInternal)this).NewReplicationProtectedItemId, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + if (content.Contains("AffectedObjectDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsInternal)this).AffectedObjectDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsAffectedObjectDetails) content.GetValueForProperty("AffectedObjectDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsInternal)this).AffectedObjectDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.JobDetailsAffectedObjectDetailsTypeConverter.ConvertFrom); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// This class represents details for switch protection job. + [System.ComponentModel.TypeConverter(typeof(SwitchProtectionJobDetailsTypeConverter))] + public partial interface ISwitchProtectionJobDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SwitchProtectionJobDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SwitchProtectionJobDetails.TypeConverter.cs new file mode 100644 index 000000000000..29d10241a25b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SwitchProtectionJobDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class SwitchProtectionJobDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionJobDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionJobDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return SwitchProtectionJobDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return SwitchProtectionJobDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return SwitchProtectionJobDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SwitchProtectionJobDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SwitchProtectionJobDetails.cs new file mode 100644 index 000000000000..aae4cb4bb268 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SwitchProtectionJobDetails.cs @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// This class represents details for switch protection job. + public partial class SwitchProtectionJobDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionJobDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionJobDetailsInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetails __jobDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.JobDetails(); + + /// + /// The affected object properties like source server, source cloud, target server, target cloud etc. based on the workflow + /// object details. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsAffectedObjectDetails AffectedObjectDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsInternal)__jobDetails).AffectedObjectDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsInternal)__jobDetails).AffectedObjectDetail = value ?? null /* model class */; } + + /// Gets the type of job details (see JobDetailsTypes enum for possible values). + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsInternal)__jobDetails).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsInternal)__jobDetails).InstanceType = value ; } + + /// Backing field for property. + private string _newReplicationProtectedItemId; + + /// ARM Id of the new replication protected item. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string NewReplicationProtectedItemId { get => this._newReplicationProtectedItemId; set => this._newReplicationProtectedItemId = value; } + + /// Creates an new instance. + public SwitchProtectionJobDetails() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__jobDetails), __jobDetails); + await eventListener.AssertObjectIsValid(nameof(__jobDetails), __jobDetails); + } + } + /// This class represents details for switch protection job. + public partial interface ISwitchProtectionJobDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetails + { + /// ARM Id of the new replication protected item. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"ARM Id of the new replication protected item.", + SerializedName = @"newReplicationProtectedItemId", + PossibleTypes = new [] { typeof(string) })] + string NewReplicationProtectedItemId { get; set; } + + } + /// This class represents details for switch protection job. + internal partial interface ISwitchProtectionJobDetailsInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsInternal + { + /// ARM Id of the new replication protected item. + string NewReplicationProtectedItemId { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SwitchProtectionJobDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SwitchProtectionJobDetails.json.cs new file mode 100644 index 000000000000..b3e9158f0df8 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SwitchProtectionJobDetails.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// This class represents details for switch protection job. + public partial class SwitchProtectionJobDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionJobDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionJobDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionJobDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new SwitchProtectionJobDetails(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal SwitchProtectionJobDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __jobDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.JobDetails(json); + {_newReplicationProtectedItemId = If( json?.PropertyT("newReplicationProtectedItemId"), out var __jsonNewReplicationProtectedItemId) ? (string)__jsonNewReplicationProtectedItemId : (string)NewReplicationProtectedItemId;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __jobDetails?.ToJson(container, serializationMode); + AddIf( null != (((object)this._newReplicationProtectedItemId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._newReplicationProtectedItemId.ToString()) : null, "newReplicationProtectedItemId" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SwitchProtectionProviderSpecificInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SwitchProtectionProviderSpecificInput.PowerShell.cs new file mode 100644 index 000000000000..f3ad595c2215 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SwitchProtectionProviderSpecificInput.PowerShell.cs @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Provider specific switch protection input. + [System.ComponentModel.TypeConverter(typeof(SwitchProtectionProviderSpecificInputTypeConverter))] + public partial class SwitchProtectionProviderSpecificInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionProviderSpecificInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new SwitchProtectionProviderSpecificInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionProviderSpecificInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new SwitchProtectionProviderSpecificInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json + /// string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionProviderSpecificInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal SwitchProtectionProviderSpecificInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal SwitchProtectionProviderSpecificInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Provider specific switch protection input. + [System.ComponentModel.TypeConverter(typeof(SwitchProtectionProviderSpecificInputTypeConverter))] + public partial interface ISwitchProtectionProviderSpecificInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SwitchProtectionProviderSpecificInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SwitchProtectionProviderSpecificInput.TypeConverter.cs new file mode 100644 index 000000000000..1d25df96644a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SwitchProtectionProviderSpecificInput.TypeConverter.cs @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class SwitchProtectionProviderSpecificInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionProviderSpecificInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionProviderSpecificInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return SwitchProtectionProviderSpecificInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return SwitchProtectionProviderSpecificInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return SwitchProtectionProviderSpecificInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SwitchProtectionProviderSpecificInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SwitchProtectionProviderSpecificInput.cs new file mode 100644 index 000000000000..e55703c5d453 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SwitchProtectionProviderSpecificInput.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Provider specific switch protection input. + public partial class SwitchProtectionProviderSpecificInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionProviderSpecificInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionProviderSpecificInputInternal + { + + /// Backing field for property. + private string _instanceType; + + /// Gets the Instance type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string InstanceType { get => this._instanceType; set => this._instanceType = value; } + + /// Creates an new instance. + public SwitchProtectionProviderSpecificInput() + { + + } + } + /// Provider specific switch protection input. + public partial interface ISwitchProtectionProviderSpecificInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// Gets the Instance type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets the Instance type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string InstanceType { get; set; } + + } + /// Provider specific switch protection input. + internal partial interface ISwitchProtectionProviderSpecificInputInternal + + { + /// Gets the Instance type. + string InstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SwitchProtectionProviderSpecificInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SwitchProtectionProviderSpecificInput.json.cs new file mode 100644 index 000000000000..f639009ff7a0 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SwitchProtectionProviderSpecificInput.json.cs @@ -0,0 +1,124 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Provider specific switch protection input. + public partial class SwitchProtectionProviderSpecificInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionProviderSpecificInput. + /// Note: the Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionProviderSpecificInput interface + /// is polymorphic, and the precise model class that will get deserialized is determined at runtime based on the payload. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionProviderSpecificInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionProviderSpecificInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + if (!(node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json)) + { + return null; + } + // Polymorphic type -- select the appropriate constructor using the discriminator + + switch ( json.StringProperty("instanceType") ) + { + case "A2A": + { + return new A2ASwitchProtectionInput(json); + } + } + return new SwitchProtectionProviderSpecificInput(json); + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal SwitchProtectionProviderSpecificInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_instanceType = If( json?.PropertyT("instanceType"), out var __jsonInstanceType) ? (string)__jsonInstanceType : (string)InstanceType;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._instanceType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._instanceType.ToString()) : null, "instanceType" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SwitchProviderInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SwitchProviderInput.PowerShell.cs new file mode 100644 index 000000000000..036220f51e46 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SwitchProviderInput.PowerShell.cs @@ -0,0 +1,168 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Input definition for switch provider. + [System.ComponentModel.TypeConverter(typeof(SwitchProviderInputTypeConverter))] + public partial class SwitchProviderInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new SwitchProviderInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new SwitchProviderInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal SwitchProviderInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderInputInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderInputProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderInputInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.SwitchProviderInputPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderInputInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderSpecificInput) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderInputInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.SwitchProviderSpecificInputTypeConverter.ConvertFrom); + } + if (content.Contains("TargetInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderInputInternal)this).TargetInstanceType = (string) content.GetValueForProperty("TargetInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderInputInternal)this).TargetInstanceType, global::System.Convert.ToString); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderInputInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderInputInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal SwitchProviderInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderInputInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderInputProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderInputInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.SwitchProviderInputPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderInputInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderSpecificInput) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderInputInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.SwitchProviderSpecificInputTypeConverter.ConvertFrom); + } + if (content.Contains("TargetInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderInputInternal)this).TargetInstanceType = (string) content.GetValueForProperty("TargetInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderInputInternal)this).TargetInstanceType, global::System.Convert.ToString); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderInputInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderInputInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Input definition for switch provider. + [System.ComponentModel.TypeConverter(typeof(SwitchProviderInputTypeConverter))] + public partial interface ISwitchProviderInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SwitchProviderInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SwitchProviderInput.TypeConverter.cs new file mode 100644 index 000000000000..8bf3a7c21bb0 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SwitchProviderInput.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class SwitchProviderInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return SwitchProviderInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return SwitchProviderInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return SwitchProviderInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SwitchProviderInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SwitchProviderInput.cs new file mode 100644 index 000000000000..18f771134619 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SwitchProviderInput.cs @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Input definition for switch provider. + public partial class SwitchProviderInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderInputInternal + { + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderInputProperties Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderInputInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.SwitchProviderInputProperties()); set { {_property = value;} } } + + /// Internal Acessors for ProviderSpecificDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderSpecificInput Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderInputInternal.ProviderSpecificDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderInputPropertiesInternal)Property).ProviderSpecificDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderInputPropertiesInternal)Property).ProviderSpecificDetail = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderInputProperties _property; + + /// Switch provider input properties. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderInputProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.SwitchProviderInputProperties()); set => this._property = value; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ProviderSpecificDetailInstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderInputPropertiesInternal)Property).ProviderSpecificDetailInstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderInputPropertiesInternal)Property).ProviderSpecificDetailInstanceType = value ?? null; } + + /// Target provider type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string TargetInstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderInputPropertiesInternal)Property).TargetInstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderInputPropertiesInternal)Property).TargetInstanceType = value ?? null; } + + /// Creates an new instance. + public SwitchProviderInput() + { + + } + } + /// Input definition for switch provider. + public partial interface ISwitchProviderInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string ProviderSpecificDetailInstanceType { get; set; } + /// Target provider type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Target provider type.", + SerializedName = @"targetInstanceType", + PossibleTypes = new [] { typeof(string) })] + string TargetInstanceType { get; set; } + + } + /// Input definition for switch provider. + internal partial interface ISwitchProviderInputInternal + + { + /// Switch provider input properties. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderInputProperties Property { get; set; } + /// Provider specific settings. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderSpecificInput ProviderSpecificDetail { get; set; } + /// The class type. + string ProviderSpecificDetailInstanceType { get; set; } + /// Target provider type. + string TargetInstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SwitchProviderInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SwitchProviderInput.json.cs new file mode 100644 index 000000000000..2f5239912992 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SwitchProviderInput.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Input definition for switch provider. + public partial class SwitchProviderInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new SwitchProviderInput(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal SwitchProviderInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.SwitchProviderInputProperties.FromJson(__jsonProperties) : Property;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SwitchProviderInputProperties.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SwitchProviderInputProperties.PowerShell.cs new file mode 100644 index 000000000000..ff9c7066b684 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SwitchProviderInputProperties.PowerShell.cs @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Input definition for switch provider input properties. + [System.ComponentModel.TypeConverter(typeof(SwitchProviderInputPropertiesTypeConverter))] + public partial class SwitchProviderInputProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderInputProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new SwitchProviderInputProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderInputProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new SwitchProviderInputProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderInputProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal SwitchProviderInputProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderInputPropertiesInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderSpecificInput) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderInputPropertiesInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.SwitchProviderSpecificInputTypeConverter.ConvertFrom); + } + if (content.Contains("TargetInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderInputPropertiesInternal)this).TargetInstanceType = (string) content.GetValueForProperty("TargetInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderInputPropertiesInternal)this).TargetInstanceType, global::System.Convert.ToString); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderInputPropertiesInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderInputPropertiesInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal SwitchProviderInputProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderInputPropertiesInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderSpecificInput) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderInputPropertiesInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.SwitchProviderSpecificInputTypeConverter.ConvertFrom); + } + if (content.Contains("TargetInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderInputPropertiesInternal)this).TargetInstanceType = (string) content.GetValueForProperty("TargetInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderInputPropertiesInternal)this).TargetInstanceType, global::System.Convert.ToString); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderInputPropertiesInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderInputPropertiesInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Input definition for switch provider input properties. + [System.ComponentModel.TypeConverter(typeof(SwitchProviderInputPropertiesTypeConverter))] + public partial interface ISwitchProviderInputProperties + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SwitchProviderInputProperties.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SwitchProviderInputProperties.TypeConverter.cs new file mode 100644 index 000000000000..d3d05c6bea7e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SwitchProviderInputProperties.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class SwitchProviderInputPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderInputProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderInputProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return SwitchProviderInputProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return SwitchProviderInputProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return SwitchProviderInputProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SwitchProviderInputProperties.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SwitchProviderInputProperties.cs new file mode 100644 index 000000000000..3e5e1bd899c4 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SwitchProviderInputProperties.cs @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Input definition for switch provider input properties. + public partial class SwitchProviderInputProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderInputProperties, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderInputPropertiesInternal + { + + /// Internal Acessors for ProviderSpecificDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderSpecificInput Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderInputPropertiesInternal.ProviderSpecificDetail { get => (this._providerSpecificDetail = this._providerSpecificDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.SwitchProviderSpecificInput()); set { {_providerSpecificDetail = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderSpecificInput _providerSpecificDetail; + + /// Provider specific settings. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderSpecificInput ProviderSpecificDetail { get => (this._providerSpecificDetail = this._providerSpecificDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.SwitchProviderSpecificInput()); set => this._providerSpecificDetail = value; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ProviderSpecificDetailInstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderSpecificInputInternal)ProviderSpecificDetail).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderSpecificInputInternal)ProviderSpecificDetail).InstanceType = value ?? null; } + + /// Backing field for property. + private string _targetInstanceType; + + /// Target provider type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetInstanceType { get => this._targetInstanceType; set => this._targetInstanceType = value; } + + /// Creates an new instance. + public SwitchProviderInputProperties() + { + + } + } + /// Input definition for switch provider input properties. + public partial interface ISwitchProviderInputProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string ProviderSpecificDetailInstanceType { get; set; } + /// Target provider type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Target provider type.", + SerializedName = @"targetInstanceType", + PossibleTypes = new [] { typeof(string) })] + string TargetInstanceType { get; set; } + + } + /// Input definition for switch provider input properties. + internal partial interface ISwitchProviderInputPropertiesInternal + + { + /// Provider specific settings. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderSpecificInput ProviderSpecificDetail { get; set; } + /// The class type. + string ProviderSpecificDetailInstanceType { get; set; } + /// Target provider type. + string TargetInstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SwitchProviderInputProperties.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SwitchProviderInputProperties.json.cs new file mode 100644 index 000000000000..89b7d8caa031 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SwitchProviderInputProperties.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Input definition for switch provider input properties. + public partial class SwitchProviderInputProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderInputProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderInputProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderInputProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new SwitchProviderInputProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal SwitchProviderInputProperties(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_providerSpecificDetail = If( json?.PropertyT("providerSpecificDetails"), out var __jsonProviderSpecificDetails) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.SwitchProviderSpecificInput.FromJson(__jsonProviderSpecificDetails) : ProviderSpecificDetail;} + {_targetInstanceType = If( json?.PropertyT("targetInstanceType"), out var __jsonTargetInstanceType) ? (string)__jsonTargetInstanceType : (string)TargetInstanceType;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._providerSpecificDetail ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._providerSpecificDetail.ToJson(null,serializationMode) : null, "providerSpecificDetails" ,container.Add ); + AddIf( null != (((object)this._targetInstanceType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetInstanceType.ToString()) : null, "targetInstanceType" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SwitchProviderSpecificInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SwitchProviderSpecificInput.PowerShell.cs new file mode 100644 index 000000000000..0a183cbaec9d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SwitchProviderSpecificInput.PowerShell.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Provider specific switch provider input. + [System.ComponentModel.TypeConverter(typeof(SwitchProviderSpecificInputTypeConverter))] + public partial class SwitchProviderSpecificInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderSpecificInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new SwitchProviderSpecificInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderSpecificInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new SwitchProviderSpecificInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderSpecificInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal SwitchProviderSpecificInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal SwitchProviderSpecificInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Provider specific switch provider input. + [System.ComponentModel.TypeConverter(typeof(SwitchProviderSpecificInputTypeConverter))] + public partial interface ISwitchProviderSpecificInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SwitchProviderSpecificInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SwitchProviderSpecificInput.TypeConverter.cs new file mode 100644 index 000000000000..0f24ab5d3828 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SwitchProviderSpecificInput.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class SwitchProviderSpecificInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderSpecificInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderSpecificInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return SwitchProviderSpecificInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return SwitchProviderSpecificInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return SwitchProviderSpecificInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SwitchProviderSpecificInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SwitchProviderSpecificInput.cs new file mode 100644 index 000000000000..db21029bec29 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SwitchProviderSpecificInput.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Provider specific switch provider input. + public partial class SwitchProviderSpecificInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderSpecificInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderSpecificInputInternal + { + + /// Backing field for property. + private string _instanceType; + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string InstanceType { get => this._instanceType; set => this._instanceType = value; } + + /// Creates an new instance. + public SwitchProviderSpecificInput() + { + + } + } + /// Provider specific switch provider input. + public partial interface ISwitchProviderSpecificInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string InstanceType { get; set; } + + } + /// Provider specific switch provider input. + internal partial interface ISwitchProviderSpecificInputInternal + + { + /// The class type. + string InstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SwitchProviderSpecificInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SwitchProviderSpecificInput.json.cs new file mode 100644 index 000000000000..10ed6e35a340 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/SwitchProviderSpecificInput.json.cs @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Provider specific switch provider input. + public partial class SwitchProviderSpecificInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderSpecificInput. + /// Note: the Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderSpecificInput interface is polymorphic, + /// and the precise model class that will get deserialized is determined at runtime based on the payload. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderSpecificInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderSpecificInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + if (!(node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json)) + { + return null; + } + // Polymorphic type -- select the appropriate constructor using the discriminator + + switch ( json.StringProperty("instanceType") ) + { + case "InMageAzureV2": + { + return new InMageAzureV2SwitchProviderInput(json); + } + } + return new SwitchProviderSpecificInput(json); + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal SwitchProviderSpecificInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_instanceType = If( json?.PropertyT("instanceType"), out var __jsonInstanceType) ? (string)__jsonInstanceType : (string)InstanceType;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._instanceType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._instanceType.ToString()) : null, "instanceType" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TargetComputeSize.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TargetComputeSize.PowerShell.cs new file mode 100644 index 000000000000..046af7f5ad33 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TargetComputeSize.PowerShell.cs @@ -0,0 +1,248 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Represents applicable recovery vm sizes. + [System.ComponentModel.TypeConverter(typeof(TargetComputeSizeTypeConverter))] + public partial class TargetComputeSize + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSize DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new TargetComputeSize(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSize DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new TargetComputeSize(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSize FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal TargetComputeSize(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizeInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizeProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizeInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.TargetComputeSizePropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizeInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizeInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizeInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizeInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizeInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizeInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("PropertiesName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizeInternal)this).PropertiesName = (string) content.GetValueForProperty("PropertiesName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizeInternal)this).PropertiesName, global::System.Convert.ToString); + } + if (content.Contains("FriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizeInternal)this).FriendlyName = (string) content.GetValueForProperty("FriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizeInternal)this).FriendlyName, global::System.Convert.ToString); + } + if (content.Contains("CpuCoresCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizeInternal)this).CpuCoresCount = (int?) content.GetValueForProperty("CpuCoresCount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizeInternal)this).CpuCoresCount, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("VCpUsAvailable")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizeInternal)this).VCpUsAvailable = (int?) content.GetValueForProperty("VCpUsAvailable",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizeInternal)this).VCpUsAvailable, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("MemoryInGb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizeInternal)this).MemoryInGb = (double?) content.GetValueForProperty("MemoryInGb",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizeInternal)this).MemoryInGb, (__y)=> (double) global::System.Convert.ChangeType(__y, typeof(double))); + } + if (content.Contains("MaxDataDiskCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizeInternal)this).MaxDataDiskCount = (int?) content.GetValueForProperty("MaxDataDiskCount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizeInternal)this).MaxDataDiskCount, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("MaxNicsCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizeInternal)this).MaxNicsCount = (int?) content.GetValueForProperty("MaxNicsCount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizeInternal)this).MaxNicsCount, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("Error")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizeInternal)this).Error = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IComputeSizeErrorDetails[]) content.GetValueForProperty("Error",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizeInternal)this).Error, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ComputeSizeErrorDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("HighIopsSupported")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizeInternal)this).HighIopsSupported = (string) content.GetValueForProperty("HighIopsSupported",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizeInternal)this).HighIopsSupported, global::System.Convert.ToString); + } + if (content.Contains("HyperVGeneration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizeInternal)this).HyperVGeneration = (string[]) content.GetValueForProperty("HyperVGeneration",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizeInternal)this).HyperVGeneration, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal TargetComputeSize(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizeInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizeProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizeInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.TargetComputeSizePropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizeInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizeInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizeInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizeInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizeInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizeInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("PropertiesName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizeInternal)this).PropertiesName = (string) content.GetValueForProperty("PropertiesName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizeInternal)this).PropertiesName, global::System.Convert.ToString); + } + if (content.Contains("FriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizeInternal)this).FriendlyName = (string) content.GetValueForProperty("FriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizeInternal)this).FriendlyName, global::System.Convert.ToString); + } + if (content.Contains("CpuCoresCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizeInternal)this).CpuCoresCount = (int?) content.GetValueForProperty("CpuCoresCount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizeInternal)this).CpuCoresCount, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("VCpUsAvailable")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizeInternal)this).VCpUsAvailable = (int?) content.GetValueForProperty("VCpUsAvailable",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizeInternal)this).VCpUsAvailable, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("MemoryInGb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizeInternal)this).MemoryInGb = (double?) content.GetValueForProperty("MemoryInGb",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizeInternal)this).MemoryInGb, (__y)=> (double) global::System.Convert.ChangeType(__y, typeof(double))); + } + if (content.Contains("MaxDataDiskCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizeInternal)this).MaxDataDiskCount = (int?) content.GetValueForProperty("MaxDataDiskCount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizeInternal)this).MaxDataDiskCount, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("MaxNicsCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizeInternal)this).MaxNicsCount = (int?) content.GetValueForProperty("MaxNicsCount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizeInternal)this).MaxNicsCount, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("Error")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizeInternal)this).Error = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IComputeSizeErrorDetails[]) content.GetValueForProperty("Error",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizeInternal)this).Error, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ComputeSizeErrorDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("HighIopsSupported")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizeInternal)this).HighIopsSupported = (string) content.GetValueForProperty("HighIopsSupported",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizeInternal)this).HighIopsSupported, global::System.Convert.ToString); + } + if (content.Contains("HyperVGeneration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizeInternal)this).HyperVGeneration = (string[]) content.GetValueForProperty("HyperVGeneration",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizeInternal)this).HyperVGeneration, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Represents applicable recovery vm sizes. + [System.ComponentModel.TypeConverter(typeof(TargetComputeSizeTypeConverter))] + public partial interface ITargetComputeSize + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TargetComputeSize.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TargetComputeSize.TypeConverter.cs new file mode 100644 index 000000000000..780ccf51fdc0 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TargetComputeSize.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class TargetComputeSizeTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSize ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSize).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return TargetComputeSize.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return TargetComputeSize.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return TargetComputeSize.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TargetComputeSize.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TargetComputeSize.cs new file mode 100644 index 000000000000..abcd955b8c9d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TargetComputeSize.cs @@ -0,0 +1,246 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Represents applicable recovery vm sizes. + public partial class TargetComputeSize : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSize, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizeInternal + { + + /// The maximum cpu cores count supported by target compute size. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public int? CpuCoresCount { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizePropertiesInternal)Property).CpuCoresCount; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizePropertiesInternal)Property).CpuCoresCount = value ?? default(int); } + + /// + /// The reasons why the target compute size is not applicable for the protected item. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IComputeSizeErrorDetails[] Error { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizePropertiesInternal)Property).Error; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizePropertiesInternal)Property).Error = value ?? null /* arrayOf */; } + + /// Target compute size display name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string FriendlyName { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizePropertiesInternal)Property).FriendlyName; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizePropertiesInternal)Property).FriendlyName = value ?? null; } + + /// The value indicating whether the target compute size supports high Iops. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string HighIopsSupported { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizePropertiesInternal)Property).HighIopsSupported; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizePropertiesInternal)Property).HighIopsSupported = value ?? null; } + + /// The supported HyperV Generations. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string[] HyperVGeneration { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizePropertiesInternal)Property).HyperVGeneration; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizePropertiesInternal)Property).HyperVGeneration = value ?? null /* arrayOf */; } + + /// Backing field for property. + private string _id; + + /// The Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Id { get => this._id; set => this._id = value; } + + /// The maximum data disks count supported by target compute size. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public int? MaxDataDiskCount { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizePropertiesInternal)Property).MaxDataDiskCount; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizePropertiesInternal)Property).MaxDataDiskCount = value ?? default(int); } + + /// The maximum Nics count supported by target compute size. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public int? MaxNicsCount { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizePropertiesInternal)Property).MaxNicsCount; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizePropertiesInternal)Property).MaxNicsCount = value ?? default(int); } + + /// The maximum memory in GB supported by target compute size. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public double? MemoryInGb { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizePropertiesInternal)Property).MemoryInGb; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizePropertiesInternal)Property).MemoryInGb = value ?? default(double); } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizeProperties Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizeInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.TargetComputeSizeProperties()); set { {_property = value;} } } + + /// Internal Acessors for VCpUsAvailable + int? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizeInternal.VCpUsAvailable { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizePropertiesInternal)Property).VCpUsAvailable; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizePropertiesInternal)Property).VCpUsAvailable = value; } + + /// Backing field for property. + private string _name; + + /// The name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Name { get => this._name; set => this._name = value; } + + /// Target compute size name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string PropertiesName { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizePropertiesInternal)Property).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizePropertiesInternal)Property).Name = value ?? null; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizeProperties _property; + + /// The custom data. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizeProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.TargetComputeSizeProperties()); set => this._property = value; } + + /// Backing field for property. + private string _type; + + /// The Type of the object. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Type { get => this._type; set => this._type = value; } + + /// The Available vCPUs supported by target compute size. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public int? VCpUsAvailable { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizePropertiesInternal)Property).VCpUsAvailable; } + + /// Creates an new instance. + public TargetComputeSize() + { + + } + } + /// Represents applicable recovery vm sizes. + public partial interface ITargetComputeSize : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The maximum cpu cores count supported by target compute size. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The maximum cpu cores count supported by target compute size.", + SerializedName = @"cpuCoresCount", + PossibleTypes = new [] { typeof(int) })] + int? CpuCoresCount { get; set; } + /// + /// The reasons why the target compute size is not applicable for the protected item. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The reasons why the target compute size is not applicable for the protected item.", + SerializedName = @"errors", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IComputeSizeErrorDetails) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IComputeSizeErrorDetails[] Error { get; set; } + /// Target compute size display name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Target compute size display name.", + SerializedName = @"friendlyName", + PossibleTypes = new [] { typeof(string) })] + string FriendlyName { get; set; } + /// The value indicating whether the target compute size supports high Iops. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The value indicating whether the target compute size supports high Iops.", + SerializedName = @"highIopsSupported", + PossibleTypes = new [] { typeof(string) })] + string HighIopsSupported { get; set; } + /// The supported HyperV Generations. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The supported HyperV Generations.", + SerializedName = @"hyperVGenerations", + PossibleTypes = new [] { typeof(string) })] + string[] HyperVGeneration { get; set; } + /// The Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Id.", + SerializedName = @"id", + PossibleTypes = new [] { typeof(string) })] + string Id { get; set; } + /// The maximum data disks count supported by target compute size. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The maximum data disks count supported by target compute size.", + SerializedName = @"maxDataDiskCount", + PossibleTypes = new [] { typeof(int) })] + int? MaxDataDiskCount { get; set; } + /// The maximum Nics count supported by target compute size. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The maximum Nics count supported by target compute size.", + SerializedName = @"maxNicsCount", + PossibleTypes = new [] { typeof(int) })] + int? MaxNicsCount { get; set; } + /// The maximum memory in GB supported by target compute size. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The maximum memory in GB supported by target compute size.", + SerializedName = @"memoryInGB", + PossibleTypes = new [] { typeof(double) })] + double? MemoryInGb { get; set; } + /// The name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string Name { get; set; } + /// Target compute size name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Target compute size name.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string PropertiesName { get; set; } + /// The Type of the object. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Type of the object.", + SerializedName = @"type", + PossibleTypes = new [] { typeof(string) })] + string Type { get; set; } + /// The Available vCPUs supported by target compute size. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The Available vCPUs supported by target compute size.", + SerializedName = @"vCPUsAvailable", + PossibleTypes = new [] { typeof(int) })] + int? VCpUsAvailable { get; } + + } + /// Represents applicable recovery vm sizes. + internal partial interface ITargetComputeSizeInternal + + { + /// The maximum cpu cores count supported by target compute size. + int? CpuCoresCount { get; set; } + /// + /// The reasons why the target compute size is not applicable for the protected item. + /// + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IComputeSizeErrorDetails[] Error { get; set; } + /// Target compute size display name. + string FriendlyName { get; set; } + /// The value indicating whether the target compute size supports high Iops. + string HighIopsSupported { get; set; } + /// The supported HyperV Generations. + string[] HyperVGeneration { get; set; } + /// The Id. + string Id { get; set; } + /// The maximum data disks count supported by target compute size. + int? MaxDataDiskCount { get; set; } + /// The maximum Nics count supported by target compute size. + int? MaxNicsCount { get; set; } + /// The maximum memory in GB supported by target compute size. + double? MemoryInGb { get; set; } + /// The name. + string Name { get; set; } + /// Target compute size name. + string PropertiesName { get; set; } + /// The custom data. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizeProperties Property { get; set; } + /// The Type of the object. + string Type { get; set; } + /// The Available vCPUs supported by target compute size. + int? VCpUsAvailable { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TargetComputeSize.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TargetComputeSize.json.cs new file mode 100644 index 000000000000..626f688bfd32 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TargetComputeSize.json.cs @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Represents applicable recovery vm sizes. + public partial class TargetComputeSize + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSize. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSize. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSize FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new TargetComputeSize(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal TargetComputeSize(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.TargetComputeSizeProperties.FromJson(__jsonProperties) : Property;} + {_id = If( json?.PropertyT("id"), out var __jsonId) ? (string)__jsonId : (string)Id;} + {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)Name;} + {_type = If( json?.PropertyT("type"), out var __jsonType) ? (string)__jsonType : (string)Type;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AddIf( null != (((object)this._id)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._id.ToString()) : null, "id" ,container.Add ); + AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); + AddIf( null != (((object)this._type)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._type.ToString()) : null, "type" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TargetComputeSizeCollection.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TargetComputeSizeCollection.PowerShell.cs new file mode 100644 index 000000000000..d6b9e2276afa --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TargetComputeSizeCollection.PowerShell.cs @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Target compute size collection. + [System.ComponentModel.TypeConverter(typeof(TargetComputeSizeCollectionTypeConverter))] + public partial class TargetComputeSizeCollection + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizeCollection DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new TargetComputeSizeCollection(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizeCollection DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new TargetComputeSizeCollection(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizeCollection FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal TargetComputeSizeCollection(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizeCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSize[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizeCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.TargetComputeSizeTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizeCollectionInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizeCollectionInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal TargetComputeSizeCollection(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizeCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSize[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizeCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.TargetComputeSizeTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizeCollectionInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizeCollectionInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Target compute size collection. + [System.ComponentModel.TypeConverter(typeof(TargetComputeSizeCollectionTypeConverter))] + public partial interface ITargetComputeSizeCollection + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TargetComputeSizeCollection.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TargetComputeSizeCollection.TypeConverter.cs new file mode 100644 index 000000000000..e7b7a7460d47 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TargetComputeSizeCollection.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class TargetComputeSizeCollectionTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizeCollection ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizeCollection).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return TargetComputeSizeCollection.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return TargetComputeSizeCollection.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return TargetComputeSizeCollection.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TargetComputeSizeCollection.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TargetComputeSizeCollection.cs new file mode 100644 index 000000000000..91c68dce19e7 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TargetComputeSizeCollection.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Target compute size collection. + public partial class TargetComputeSizeCollection : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizeCollection, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizeCollectionInternal + { + + /// Backing field for property. + private string _nextLink; + + /// The value of next link. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string NextLink { get => this._nextLink; set => this._nextLink = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSize[] _value; + + /// The list of target compute sizes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSize[] Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public TargetComputeSizeCollection() + { + + } + } + /// Target compute size collection. + public partial interface ITargetComputeSizeCollection : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The value of next link. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The value of next link.", + SerializedName = @"nextLink", + PossibleTypes = new [] { typeof(string) })] + string NextLink { get; set; } + /// The list of target compute sizes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of target compute sizes.", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSize) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSize[] Value { get; set; } + + } + /// Target compute size collection. + internal partial interface ITargetComputeSizeCollectionInternal + + { + /// The value of next link. + string NextLink { get; set; } + /// The list of target compute sizes. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSize[] Value { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TargetComputeSizeCollection.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TargetComputeSizeCollection.json.cs new file mode 100644 index 000000000000..c438015a899f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TargetComputeSizeCollection.json.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Target compute size collection. + public partial class TargetComputeSizeCollection + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizeCollection. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizeCollection. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizeCollection FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new TargetComputeSizeCollection(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal TargetComputeSizeCollection(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSize) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.TargetComputeSize.FromJson(__u) )) ))() : null : Value;} + {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)NextLink;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._value) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._value ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("value",__w); + } + AddIf( null != (((object)this._nextLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TargetComputeSizeProperties.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TargetComputeSizeProperties.PowerShell.cs new file mode 100644 index 000000000000..afe98b3c794d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TargetComputeSizeProperties.PowerShell.cs @@ -0,0 +1,218 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Represents applicable recovery vm sizes properties. + [System.ComponentModel.TypeConverter(typeof(TargetComputeSizePropertiesTypeConverter))] + public partial class TargetComputeSizeProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizeProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new TargetComputeSizeProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizeProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new TargetComputeSizeProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizeProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal TargetComputeSizeProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizePropertiesInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizePropertiesInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("FriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizePropertiesInternal)this).FriendlyName = (string) content.GetValueForProperty("FriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizePropertiesInternal)this).FriendlyName, global::System.Convert.ToString); + } + if (content.Contains("CpuCoresCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizePropertiesInternal)this).CpuCoresCount = (int?) content.GetValueForProperty("CpuCoresCount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizePropertiesInternal)this).CpuCoresCount, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("VCpUsAvailable")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizePropertiesInternal)this).VCpUsAvailable = (int?) content.GetValueForProperty("VCpUsAvailable",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizePropertiesInternal)this).VCpUsAvailable, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("MemoryInGb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizePropertiesInternal)this).MemoryInGb = (double?) content.GetValueForProperty("MemoryInGb",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizePropertiesInternal)this).MemoryInGb, (__y)=> (double) global::System.Convert.ChangeType(__y, typeof(double))); + } + if (content.Contains("MaxDataDiskCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizePropertiesInternal)this).MaxDataDiskCount = (int?) content.GetValueForProperty("MaxDataDiskCount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizePropertiesInternal)this).MaxDataDiskCount, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("MaxNicsCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizePropertiesInternal)this).MaxNicsCount = (int?) content.GetValueForProperty("MaxNicsCount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizePropertiesInternal)this).MaxNicsCount, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("Error")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizePropertiesInternal)this).Error = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IComputeSizeErrorDetails[]) content.GetValueForProperty("Error",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizePropertiesInternal)this).Error, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ComputeSizeErrorDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("HighIopsSupported")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizePropertiesInternal)this).HighIopsSupported = (string) content.GetValueForProperty("HighIopsSupported",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizePropertiesInternal)this).HighIopsSupported, global::System.Convert.ToString); + } + if (content.Contains("HyperVGeneration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizePropertiesInternal)this).HyperVGeneration = (string[]) content.GetValueForProperty("HyperVGeneration",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizePropertiesInternal)this).HyperVGeneration, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal TargetComputeSizeProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizePropertiesInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizePropertiesInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("FriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizePropertiesInternal)this).FriendlyName = (string) content.GetValueForProperty("FriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizePropertiesInternal)this).FriendlyName, global::System.Convert.ToString); + } + if (content.Contains("CpuCoresCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizePropertiesInternal)this).CpuCoresCount = (int?) content.GetValueForProperty("CpuCoresCount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizePropertiesInternal)this).CpuCoresCount, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("VCpUsAvailable")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizePropertiesInternal)this).VCpUsAvailable = (int?) content.GetValueForProperty("VCpUsAvailable",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizePropertiesInternal)this).VCpUsAvailable, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("MemoryInGb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizePropertiesInternal)this).MemoryInGb = (double?) content.GetValueForProperty("MemoryInGb",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizePropertiesInternal)this).MemoryInGb, (__y)=> (double) global::System.Convert.ChangeType(__y, typeof(double))); + } + if (content.Contains("MaxDataDiskCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizePropertiesInternal)this).MaxDataDiskCount = (int?) content.GetValueForProperty("MaxDataDiskCount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizePropertiesInternal)this).MaxDataDiskCount, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("MaxNicsCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizePropertiesInternal)this).MaxNicsCount = (int?) content.GetValueForProperty("MaxNicsCount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizePropertiesInternal)this).MaxNicsCount, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("Error")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizePropertiesInternal)this).Error = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IComputeSizeErrorDetails[]) content.GetValueForProperty("Error",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizePropertiesInternal)this).Error, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ComputeSizeErrorDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("HighIopsSupported")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizePropertiesInternal)this).HighIopsSupported = (string) content.GetValueForProperty("HighIopsSupported",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizePropertiesInternal)this).HighIopsSupported, global::System.Convert.ToString); + } + if (content.Contains("HyperVGeneration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizePropertiesInternal)this).HyperVGeneration = (string[]) content.GetValueForProperty("HyperVGeneration",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizePropertiesInternal)this).HyperVGeneration, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Represents applicable recovery vm sizes properties. + [System.ComponentModel.TypeConverter(typeof(TargetComputeSizePropertiesTypeConverter))] + public partial interface ITargetComputeSizeProperties + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TargetComputeSizeProperties.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TargetComputeSizeProperties.TypeConverter.cs new file mode 100644 index 000000000000..a166e5b041c0 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TargetComputeSizeProperties.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class TargetComputeSizePropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizeProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizeProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return TargetComputeSizeProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return TargetComputeSizeProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return TargetComputeSizeProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TargetComputeSizeProperties.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TargetComputeSizeProperties.cs new file mode 100644 index 000000000000..ce07212e526f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TargetComputeSizeProperties.cs @@ -0,0 +1,213 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Represents applicable recovery vm sizes properties. + public partial class TargetComputeSizeProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizeProperties, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizePropertiesInternal + { + + /// Backing field for property. + private int? _cpuCoresCount; + + /// The maximum cpu cores count supported by target compute size. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? CpuCoresCount { get => this._cpuCoresCount; set => this._cpuCoresCount = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IComputeSizeErrorDetails[] _error; + + /// + /// The reasons why the target compute size is not applicable for the protected item. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IComputeSizeErrorDetails[] Error { get => this._error; set => this._error = value; } + + /// Backing field for property. + private string _friendlyName; + + /// Target compute size display name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string FriendlyName { get => this._friendlyName; set => this._friendlyName = value; } + + /// Backing field for property. + private string _highIopsSupported; + + /// The value indicating whether the target compute size supports high Iops. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string HighIopsSupported { get => this._highIopsSupported; set => this._highIopsSupported = value; } + + /// Backing field for property. + private string[] _hyperVGeneration; + + /// The supported HyperV Generations. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string[] HyperVGeneration { get => this._hyperVGeneration; set => this._hyperVGeneration = value; } + + /// Backing field for property. + private int? _maxDataDiskCount; + + /// The maximum data disks count supported by target compute size. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? MaxDataDiskCount { get => this._maxDataDiskCount; set => this._maxDataDiskCount = value; } + + /// Backing field for property. + private int? _maxNicsCount; + + /// The maximum Nics count supported by target compute size. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? MaxNicsCount { get => this._maxNicsCount; set => this._maxNicsCount = value; } + + /// Backing field for property. + private double? _memoryInGb; + + /// The maximum memory in GB supported by target compute size. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public double? MemoryInGb { get => this._memoryInGb; set => this._memoryInGb = value; } + + /// Internal Acessors for VCpUsAvailable + int? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizePropertiesInternal.VCpUsAvailable { get => this._vCpUsAvailable; set { {_vCpUsAvailable = value;} } } + + /// Backing field for property. + private string _name; + + /// Target compute size name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Name { get => this._name; set => this._name = value; } + + /// Backing field for property. + private int? _vCpUsAvailable; + + /// The Available vCPUs supported by target compute size. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? VCpUsAvailable { get => this._vCpUsAvailable; } + + /// Creates an new instance. + public TargetComputeSizeProperties() + { + + } + } + /// Represents applicable recovery vm sizes properties. + public partial interface ITargetComputeSizeProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The maximum cpu cores count supported by target compute size. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The maximum cpu cores count supported by target compute size.", + SerializedName = @"cpuCoresCount", + PossibleTypes = new [] { typeof(int) })] + int? CpuCoresCount { get; set; } + /// + /// The reasons why the target compute size is not applicable for the protected item. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The reasons why the target compute size is not applicable for the protected item.", + SerializedName = @"errors", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IComputeSizeErrorDetails) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IComputeSizeErrorDetails[] Error { get; set; } + /// Target compute size display name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Target compute size display name.", + SerializedName = @"friendlyName", + PossibleTypes = new [] { typeof(string) })] + string FriendlyName { get; set; } + /// The value indicating whether the target compute size supports high Iops. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The value indicating whether the target compute size supports high Iops.", + SerializedName = @"highIopsSupported", + PossibleTypes = new [] { typeof(string) })] + string HighIopsSupported { get; set; } + /// The supported HyperV Generations. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The supported HyperV Generations.", + SerializedName = @"hyperVGenerations", + PossibleTypes = new [] { typeof(string) })] + string[] HyperVGeneration { get; set; } + /// The maximum data disks count supported by target compute size. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The maximum data disks count supported by target compute size.", + SerializedName = @"maxDataDiskCount", + PossibleTypes = new [] { typeof(int) })] + int? MaxDataDiskCount { get; set; } + /// The maximum Nics count supported by target compute size. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The maximum Nics count supported by target compute size.", + SerializedName = @"maxNicsCount", + PossibleTypes = new [] { typeof(int) })] + int? MaxNicsCount { get; set; } + /// The maximum memory in GB supported by target compute size. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The maximum memory in GB supported by target compute size.", + SerializedName = @"memoryInGB", + PossibleTypes = new [] { typeof(double) })] + double? MemoryInGb { get; set; } + /// Target compute size name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Target compute size name.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string Name { get; set; } + /// The Available vCPUs supported by target compute size. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The Available vCPUs supported by target compute size.", + SerializedName = @"vCPUsAvailable", + PossibleTypes = new [] { typeof(int) })] + int? VCpUsAvailable { get; } + + } + /// Represents applicable recovery vm sizes properties. + internal partial interface ITargetComputeSizePropertiesInternal + + { + /// The maximum cpu cores count supported by target compute size. + int? CpuCoresCount { get; set; } + /// + /// The reasons why the target compute size is not applicable for the protected item. + /// + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IComputeSizeErrorDetails[] Error { get; set; } + /// Target compute size display name. + string FriendlyName { get; set; } + /// The value indicating whether the target compute size supports high Iops. + string HighIopsSupported { get; set; } + /// The supported HyperV Generations. + string[] HyperVGeneration { get; set; } + /// The maximum data disks count supported by target compute size. + int? MaxDataDiskCount { get; set; } + /// The maximum Nics count supported by target compute size. + int? MaxNicsCount { get; set; } + /// The maximum memory in GB supported by target compute size. + double? MemoryInGb { get; set; } + /// Target compute size name. + string Name { get; set; } + /// The Available vCPUs supported by target compute size. + int? VCpUsAvailable { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TargetComputeSizeProperties.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TargetComputeSizeProperties.json.cs new file mode 100644 index 000000000000..f9952eb6b7e5 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TargetComputeSizeProperties.json.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Represents applicable recovery vm sizes properties. + public partial class TargetComputeSizeProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizeProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizeProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizeProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new TargetComputeSizeProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal TargetComputeSizeProperties(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)Name;} + {_friendlyName = If( json?.PropertyT("friendlyName"), out var __jsonFriendlyName) ? (string)__jsonFriendlyName : (string)FriendlyName;} + {_cpuCoresCount = If( json?.PropertyT("cpuCoresCount"), out var __jsonCpuCoresCount) ? (int?)__jsonCpuCoresCount : CpuCoresCount;} + {_vCpUsAvailable = If( json?.PropertyT("vCPUsAvailable"), out var __jsonVCpUsAvailable) ? (int?)__jsonVCpUsAvailable : VCpUsAvailable;} + {_memoryInGb = If( json?.PropertyT("memoryInGB"), out var __jsonMemoryInGb) ? (double?)__jsonMemoryInGb : MemoryInGb;} + {_maxDataDiskCount = If( json?.PropertyT("maxDataDiskCount"), out var __jsonMaxDataDiskCount) ? (int?)__jsonMaxDataDiskCount : MaxDataDiskCount;} + {_maxNicsCount = If( json?.PropertyT("maxNicsCount"), out var __jsonMaxNicsCount) ? (int?)__jsonMaxNicsCount : MaxNicsCount;} + {_error = If( json?.PropertyT("errors"), out var __jsonErrors) ? If( __jsonErrors as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IComputeSizeErrorDetails) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ComputeSizeErrorDetails.FromJson(__u) )) ))() : null : Error;} + {_highIopsSupported = If( json?.PropertyT("highIopsSupported"), out var __jsonHighIopsSupported) ? (string)__jsonHighIopsSupported : (string)HighIopsSupported;} + {_hyperVGeneration = If( json?.PropertyT("hyperVGenerations"), out var __jsonHyperVGenerations) ? If( __jsonHyperVGenerations as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __q) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__q, (__p)=>(string) (__p is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString __o ? (string)(__o.ToString()) : null)) ))() : null : HyperVGeneration;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); + AddIf( null != (((object)this._friendlyName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._friendlyName.ToString()) : null, "friendlyName" ,container.Add ); + AddIf( null != this._cpuCoresCount ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._cpuCoresCount) : null, "cpuCoresCount" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._vCpUsAvailable ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._vCpUsAvailable) : null, "vCPUsAvailable" ,container.Add ); + } + AddIf( null != this._memoryInGb ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((double)this._memoryInGb) : null, "memoryInGB" ,container.Add ); + AddIf( null != this._maxDataDiskCount ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._maxDataDiskCount) : null, "maxDataDiskCount" ,container.Add ); + AddIf( null != this._maxNicsCount ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._maxNicsCount) : null, "maxNicsCount" ,container.Add ); + if (null != this._error) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._error ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("errors",__w); + } + AddIf( null != (((object)this._highIopsSupported)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._highIopsSupported.ToString()) : null, "highIopsSupported" ,container.Add ); + if (null != this._hyperVGeneration) + { + var __r = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __s in this._hyperVGeneration ) + { + AddIf(null != (((object)__s)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(__s.ToString()) : null ,__r.Add); + } + container.Add("hyperVGenerations",__r); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TaskTypeDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TaskTypeDetails.PowerShell.cs new file mode 100644 index 000000000000..494e8bd49183 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TaskTypeDetails.PowerShell.cs @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Task details based on specific task type. + [System.ComponentModel.TypeConverter(typeof(TaskTypeDetailsTypeConverter))] + public partial class TaskTypeDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITaskTypeDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new TaskTypeDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITaskTypeDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new TaskTypeDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITaskTypeDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal TaskTypeDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITaskTypeDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITaskTypeDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal TaskTypeDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITaskTypeDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITaskTypeDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Task details based on specific task type. + [System.ComponentModel.TypeConverter(typeof(TaskTypeDetailsTypeConverter))] + public partial interface ITaskTypeDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TaskTypeDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TaskTypeDetails.TypeConverter.cs new file mode 100644 index 000000000000..2ac4e12fd84f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TaskTypeDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class TaskTypeDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITaskTypeDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITaskTypeDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return TaskTypeDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return TaskTypeDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return TaskTypeDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TaskTypeDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TaskTypeDetails.cs new file mode 100644 index 000000000000..634f1c0b114d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TaskTypeDetails.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Task details based on specific task type. + public partial class TaskTypeDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITaskTypeDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITaskTypeDetailsInternal + { + + /// Backing field for property. + private string _instanceType; + + /// The type of task details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string InstanceType { get => this._instanceType; set => this._instanceType = value; } + + /// Creates an new instance. + public TaskTypeDetails() + { + + } + } + /// Task details based on specific task type. + public partial interface ITaskTypeDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The type of task details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The type of task details.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string InstanceType { get; set; } + + } + /// Task details based on specific task type. + internal partial interface ITaskTypeDetailsInternal + + { + /// The type of task details. + string InstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TaskTypeDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TaskTypeDetails.json.cs new file mode 100644 index 000000000000..dd428da38b2b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TaskTypeDetails.json.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Task details based on specific task type. + public partial class TaskTypeDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITaskTypeDetails. + /// Note: the Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITaskTypeDetails interface is polymorphic, + /// and the precise model class that will get deserialized is determined at runtime based on the payload. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITaskTypeDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITaskTypeDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + if (!(node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json)) + { + return null; + } + // Polymorphic type -- select the appropriate constructor using the discriminator + + switch ( json.StringProperty("instanceType") ) + { + case "AutomationRunbookTaskDetails": + { + return new AutomationRunbookTaskDetails(json); + } + case "ConsistencyCheckTaskDetails": + { + return new ConsistencyCheckTaskDetails(json); + } + case "JobTaskDetails": + { + return new JobTaskDetails(json); + } + case "FabricReplicationGroupTaskDetails": + { + return new FabricReplicationGroupTaskDetails(json); + } + case "ManualActionTaskDetails": + { + return new ManualActionTaskDetails(json); + } + case "ScriptActionTaskDetails": + { + return new ScriptActionTaskDetails(json); + } + case "VirtualMachineTaskDetails": + { + return new VirtualMachineTaskDetails(json); + } + case "VmNicUpdatesTaskDetails": + { + return new VMNicUpdatesTaskDetails(json); + } + } + return new TaskTypeDetails(json); + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal TaskTypeDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_instanceType = If( json?.PropertyT("instanceType"), out var __jsonInstanceType) ? (string)__jsonInstanceType : (string)InstanceType;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._instanceType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._instanceType.ToString()) : null, "instanceType" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestFailoverCleanupInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestFailoverCleanupInput.PowerShell.cs new file mode 100644 index 000000000000..fc92fbcee8e5 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestFailoverCleanupInput.PowerShell.cs @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Input definition for test failover cleanup. + [System.ComponentModel.TypeConverter(typeof(TestFailoverCleanupInputTypeConverter))] + public partial class TestFailoverCleanupInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverCleanupInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new TestFailoverCleanupInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverCleanupInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new TestFailoverCleanupInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverCleanupInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal TestFailoverCleanupInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverCleanupInputInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverCleanupInputProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverCleanupInputInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.TestFailoverCleanupInputPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Comment")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverCleanupInputInternal)this).Comment = (string) content.GetValueForProperty("Comment",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverCleanupInputInternal)this).Comment, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal TestFailoverCleanupInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverCleanupInputInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverCleanupInputProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverCleanupInputInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.TestFailoverCleanupInputPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Comment")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverCleanupInputInternal)this).Comment = (string) content.GetValueForProperty("Comment",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverCleanupInputInternal)this).Comment, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Input definition for test failover cleanup. + [System.ComponentModel.TypeConverter(typeof(TestFailoverCleanupInputTypeConverter))] + public partial interface ITestFailoverCleanupInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestFailoverCleanupInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestFailoverCleanupInput.TypeConverter.cs new file mode 100644 index 000000000000..070adc7df151 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestFailoverCleanupInput.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class TestFailoverCleanupInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverCleanupInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverCleanupInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return TestFailoverCleanupInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return TestFailoverCleanupInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return TestFailoverCleanupInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestFailoverCleanupInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestFailoverCleanupInput.cs new file mode 100644 index 000000000000..fc602cda40dc --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestFailoverCleanupInput.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Input definition for test failover cleanup. + public partial class TestFailoverCleanupInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverCleanupInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverCleanupInputInternal + { + + /// Test failover cleanup comments. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string Comment { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverCleanupInputPropertiesInternal)Property).Comment; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverCleanupInputPropertiesInternal)Property).Comment = value ?? null; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverCleanupInputProperties Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverCleanupInputInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.TestFailoverCleanupInputProperties()); set { {_property = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverCleanupInputProperties _property; + + /// Test failover cleanup input properties. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverCleanupInputProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.TestFailoverCleanupInputProperties()); set => this._property = value; } + + /// Creates an new instance. + public TestFailoverCleanupInput() + { + + } + } + /// Input definition for test failover cleanup. + public partial interface ITestFailoverCleanupInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// Test failover cleanup comments. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Test failover cleanup comments.", + SerializedName = @"comments", + PossibleTypes = new [] { typeof(string) })] + string Comment { get; set; } + + } + /// Input definition for test failover cleanup. + internal partial interface ITestFailoverCleanupInputInternal + + { + /// Test failover cleanup comments. + string Comment { get; set; } + /// Test failover cleanup input properties. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverCleanupInputProperties Property { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestFailoverCleanupInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestFailoverCleanupInput.json.cs new file mode 100644 index 000000000000..92c30af209e6 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestFailoverCleanupInput.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Input definition for test failover cleanup. + public partial class TestFailoverCleanupInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverCleanupInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverCleanupInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverCleanupInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new TestFailoverCleanupInput(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal TestFailoverCleanupInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.TestFailoverCleanupInputProperties.FromJson(__jsonProperties) : Property;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestFailoverCleanupInputProperties.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestFailoverCleanupInputProperties.PowerShell.cs new file mode 100644 index 000000000000..70c3f5dfa961 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestFailoverCleanupInputProperties.PowerShell.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Input definition for test failover cleanup input properties. + [System.ComponentModel.TypeConverter(typeof(TestFailoverCleanupInputPropertiesTypeConverter))] + public partial class TestFailoverCleanupInputProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverCleanupInputProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new TestFailoverCleanupInputProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverCleanupInputProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new TestFailoverCleanupInputProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverCleanupInputProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal TestFailoverCleanupInputProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Comment")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverCleanupInputPropertiesInternal)this).Comment = (string) content.GetValueForProperty("Comment",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverCleanupInputPropertiesInternal)this).Comment, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal TestFailoverCleanupInputProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Comment")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverCleanupInputPropertiesInternal)this).Comment = (string) content.GetValueForProperty("Comment",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverCleanupInputPropertiesInternal)this).Comment, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Input definition for test failover cleanup input properties. + [System.ComponentModel.TypeConverter(typeof(TestFailoverCleanupInputPropertiesTypeConverter))] + public partial interface ITestFailoverCleanupInputProperties + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestFailoverCleanupInputProperties.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestFailoverCleanupInputProperties.TypeConverter.cs new file mode 100644 index 000000000000..e7653fb3ea78 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestFailoverCleanupInputProperties.TypeConverter.cs @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class TestFailoverCleanupInputPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverCleanupInputProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverCleanupInputProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return TestFailoverCleanupInputProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return TestFailoverCleanupInputProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return TestFailoverCleanupInputProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestFailoverCleanupInputProperties.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestFailoverCleanupInputProperties.cs new file mode 100644 index 000000000000..9e721c6df631 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestFailoverCleanupInputProperties.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Input definition for test failover cleanup input properties. + public partial class TestFailoverCleanupInputProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverCleanupInputProperties, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverCleanupInputPropertiesInternal + { + + /// Backing field for property. + private string _comment; + + /// Test failover cleanup comments. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Comment { get => this._comment; set => this._comment = value; } + + /// Creates an new instance. + public TestFailoverCleanupInputProperties() + { + + } + } + /// Input definition for test failover cleanup input properties. + public partial interface ITestFailoverCleanupInputProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// Test failover cleanup comments. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Test failover cleanup comments.", + SerializedName = @"comments", + PossibleTypes = new [] { typeof(string) })] + string Comment { get; set; } + + } + /// Input definition for test failover cleanup input properties. + internal partial interface ITestFailoverCleanupInputPropertiesInternal + + { + /// Test failover cleanup comments. + string Comment { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestFailoverCleanupInputProperties.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestFailoverCleanupInputProperties.json.cs new file mode 100644 index 000000000000..ff7ffab0f8dc --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestFailoverCleanupInputProperties.json.cs @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Input definition for test failover cleanup input properties. + public partial class TestFailoverCleanupInputProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverCleanupInputProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverCleanupInputProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverCleanupInputProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new TestFailoverCleanupInputProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal TestFailoverCleanupInputProperties(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_comment = If( json?.PropertyT("comments"), out var __jsonComments) ? (string)__jsonComments : (string)Comment;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._comment)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._comment.ToString()) : null, "comments" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestFailoverInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestFailoverInput.PowerShell.cs new file mode 100644 index 000000000000..8e774c0448bb --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestFailoverInput.PowerShell.cs @@ -0,0 +1,184 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Input definition for test failover. + [System.ComponentModel.TypeConverter(typeof(TestFailoverInputTypeConverter))] + public partial class TestFailoverInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new TestFailoverInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new TestFailoverInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal TestFailoverInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverInputInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverInputProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverInputInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.TestFailoverInputPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverInputInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverProviderSpecificInput) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverInputInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.TestFailoverProviderSpecificInputTypeConverter.ConvertFrom); + } + if (content.Contains("FailoverDirection")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverInputInternal)this).FailoverDirection = (string) content.GetValueForProperty("FailoverDirection",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverInputInternal)this).FailoverDirection, global::System.Convert.ToString); + } + if (content.Contains("NetworkType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverInputInternal)this).NetworkType = (string) content.GetValueForProperty("NetworkType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverInputInternal)this).NetworkType, global::System.Convert.ToString); + } + if (content.Contains("NetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverInputInternal)this).NetworkId = (string) content.GetValueForProperty("NetworkId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverInputInternal)this).NetworkId, global::System.Convert.ToString); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverInputInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverInputInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal TestFailoverInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverInputInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverInputProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverInputInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.TestFailoverInputPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverInputInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverProviderSpecificInput) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverInputInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.TestFailoverProviderSpecificInputTypeConverter.ConvertFrom); + } + if (content.Contains("FailoverDirection")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverInputInternal)this).FailoverDirection = (string) content.GetValueForProperty("FailoverDirection",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverInputInternal)this).FailoverDirection, global::System.Convert.ToString); + } + if (content.Contains("NetworkType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverInputInternal)this).NetworkType = (string) content.GetValueForProperty("NetworkType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverInputInternal)this).NetworkType, global::System.Convert.ToString); + } + if (content.Contains("NetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverInputInternal)this).NetworkId = (string) content.GetValueForProperty("NetworkId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverInputInternal)this).NetworkId, global::System.Convert.ToString); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverInputInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverInputInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Input definition for test failover. + [System.ComponentModel.TypeConverter(typeof(TestFailoverInputTypeConverter))] + public partial interface ITestFailoverInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestFailoverInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestFailoverInput.TypeConverter.cs new file mode 100644 index 000000000000..f591f2120f82 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestFailoverInput.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class TestFailoverInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return TestFailoverInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return TestFailoverInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return TestFailoverInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestFailoverInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestFailoverInput.cs new file mode 100644 index 000000000000..2a8ca2a89094 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestFailoverInput.cs @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Input definition for test failover. + public partial class TestFailoverInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverInputInternal + { + + /// Test failover direction. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string FailoverDirection { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverInputPropertiesInternal)Property).FailoverDirection; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverInputPropertiesInternal)Property).FailoverDirection = value ?? null; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverInputProperties Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverInputInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.TestFailoverInputProperties()); set { {_property = value;} } } + + /// Internal Acessors for ProviderSpecificDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverProviderSpecificInput Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverInputInternal.ProviderSpecificDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverInputPropertiesInternal)Property).ProviderSpecificDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverInputPropertiesInternal)Property).ProviderSpecificDetail = value; } + + /// The id of the network to be used for test failover. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string NetworkId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverInputPropertiesInternal)Property).NetworkId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverInputPropertiesInternal)Property).NetworkId = value ?? null; } + + /// Network type to be used for test failover. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string NetworkType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverInputPropertiesInternal)Property).NetworkType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverInputPropertiesInternal)Property).NetworkType = value ?? null; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverInputProperties _property; + + /// Test failover input properties. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverInputProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.TestFailoverInputProperties()); set => this._property = value; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ProviderSpecificDetailInstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverInputPropertiesInternal)Property).ProviderSpecificDetailInstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverInputPropertiesInternal)Property).ProviderSpecificDetailInstanceType = value ?? null; } + + /// Creates an new instance. + public TestFailoverInput() + { + + } + } + /// Input definition for test failover. + public partial interface ITestFailoverInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// Test failover direction. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Test failover direction.", + SerializedName = @"failoverDirection", + PossibleTypes = new [] { typeof(string) })] + string FailoverDirection { get; set; } + /// The id of the network to be used for test failover. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The id of the network to be used for test failover.", + SerializedName = @"networkId", + PossibleTypes = new [] { typeof(string) })] + string NetworkId { get; set; } + /// Network type to be used for test failover. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Network type to be used for test failover.", + SerializedName = @"networkType", + PossibleTypes = new [] { typeof(string) })] + string NetworkType { get; set; } + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string ProviderSpecificDetailInstanceType { get; set; } + + } + /// Input definition for test failover. + internal partial interface ITestFailoverInputInternal + + { + /// Test failover direction. + string FailoverDirection { get; set; } + /// The id of the network to be used for test failover. + string NetworkId { get; set; } + /// Network type to be used for test failover. + string NetworkType { get; set; } + /// Test failover input properties. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverInputProperties Property { get; set; } + /// Provider specific settings. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverProviderSpecificInput ProviderSpecificDetail { get; set; } + /// The class type. + string ProviderSpecificDetailInstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestFailoverInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestFailoverInput.json.cs new file mode 100644 index 000000000000..f8b9d32fea55 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestFailoverInput.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Input definition for test failover. + public partial class TestFailoverInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new TestFailoverInput(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal TestFailoverInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.TestFailoverInputProperties.FromJson(__jsonProperties) : Property;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestFailoverInputProperties.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestFailoverInputProperties.PowerShell.cs new file mode 100644 index 000000000000..672dfc73ce79 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestFailoverInputProperties.PowerShell.cs @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Input definition for test failover input properties. + [System.ComponentModel.TypeConverter(typeof(TestFailoverInputPropertiesTypeConverter))] + public partial class TestFailoverInputProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverInputProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new TestFailoverInputProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverInputProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new TestFailoverInputProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverInputProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal TestFailoverInputProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverInputPropertiesInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverProviderSpecificInput) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverInputPropertiesInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.TestFailoverProviderSpecificInputTypeConverter.ConvertFrom); + } + if (content.Contains("FailoverDirection")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverInputPropertiesInternal)this).FailoverDirection = (string) content.GetValueForProperty("FailoverDirection",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverInputPropertiesInternal)this).FailoverDirection, global::System.Convert.ToString); + } + if (content.Contains("NetworkType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverInputPropertiesInternal)this).NetworkType = (string) content.GetValueForProperty("NetworkType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverInputPropertiesInternal)this).NetworkType, global::System.Convert.ToString); + } + if (content.Contains("NetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverInputPropertiesInternal)this).NetworkId = (string) content.GetValueForProperty("NetworkId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverInputPropertiesInternal)this).NetworkId, global::System.Convert.ToString); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverInputPropertiesInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverInputPropertiesInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal TestFailoverInputProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverInputPropertiesInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverProviderSpecificInput) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverInputPropertiesInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.TestFailoverProviderSpecificInputTypeConverter.ConvertFrom); + } + if (content.Contains("FailoverDirection")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverInputPropertiesInternal)this).FailoverDirection = (string) content.GetValueForProperty("FailoverDirection",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverInputPropertiesInternal)this).FailoverDirection, global::System.Convert.ToString); + } + if (content.Contains("NetworkType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverInputPropertiesInternal)this).NetworkType = (string) content.GetValueForProperty("NetworkType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverInputPropertiesInternal)this).NetworkType, global::System.Convert.ToString); + } + if (content.Contains("NetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverInputPropertiesInternal)this).NetworkId = (string) content.GetValueForProperty("NetworkId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverInputPropertiesInternal)this).NetworkId, global::System.Convert.ToString); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverInputPropertiesInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverInputPropertiesInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Input definition for test failover input properties. + [System.ComponentModel.TypeConverter(typeof(TestFailoverInputPropertiesTypeConverter))] + public partial interface ITestFailoverInputProperties + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestFailoverInputProperties.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestFailoverInputProperties.TypeConverter.cs new file mode 100644 index 000000000000..3b98f34f7033 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestFailoverInputProperties.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class TestFailoverInputPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverInputProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverInputProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return TestFailoverInputProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return TestFailoverInputProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return TestFailoverInputProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestFailoverInputProperties.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestFailoverInputProperties.cs new file mode 100644 index 000000000000..58e8a51b6abd --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestFailoverInputProperties.cs @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Input definition for test failover input properties. + public partial class TestFailoverInputProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverInputProperties, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverInputPropertiesInternal + { + + /// Backing field for property. + private string _failoverDirection; + + /// Test failover direction. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string FailoverDirection { get => this._failoverDirection; set => this._failoverDirection = value; } + + /// Internal Acessors for ProviderSpecificDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverProviderSpecificInput Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverInputPropertiesInternal.ProviderSpecificDetail { get => (this._providerSpecificDetail = this._providerSpecificDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.TestFailoverProviderSpecificInput()); set { {_providerSpecificDetail = value;} } } + + /// Backing field for property. + private string _networkId; + + /// The id of the network to be used for test failover. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string NetworkId { get => this._networkId; set => this._networkId = value; } + + /// Backing field for property. + private string _networkType; + + /// Network type to be used for test failover. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string NetworkType { get => this._networkType; set => this._networkType = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverProviderSpecificInput _providerSpecificDetail; + + /// Provider specific settings. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverProviderSpecificInput ProviderSpecificDetail { get => (this._providerSpecificDetail = this._providerSpecificDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.TestFailoverProviderSpecificInput()); set => this._providerSpecificDetail = value; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ProviderSpecificDetailInstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverProviderSpecificInputInternal)ProviderSpecificDetail).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverProviderSpecificInputInternal)ProviderSpecificDetail).InstanceType = value ?? null; } + + /// Creates an new instance. + public TestFailoverInputProperties() + { + + } + } + /// Input definition for test failover input properties. + public partial interface ITestFailoverInputProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// Test failover direction. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Test failover direction.", + SerializedName = @"failoverDirection", + PossibleTypes = new [] { typeof(string) })] + string FailoverDirection { get; set; } + /// The id of the network to be used for test failover. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The id of the network to be used for test failover.", + SerializedName = @"networkId", + PossibleTypes = new [] { typeof(string) })] + string NetworkId { get; set; } + /// Network type to be used for test failover. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Network type to be used for test failover.", + SerializedName = @"networkType", + PossibleTypes = new [] { typeof(string) })] + string NetworkType { get; set; } + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string ProviderSpecificDetailInstanceType { get; set; } + + } + /// Input definition for test failover input properties. + internal partial interface ITestFailoverInputPropertiesInternal + + { + /// Test failover direction. + string FailoverDirection { get; set; } + /// The id of the network to be used for test failover. + string NetworkId { get; set; } + /// Network type to be used for test failover. + string NetworkType { get; set; } + /// Provider specific settings. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverProviderSpecificInput ProviderSpecificDetail { get; set; } + /// The class type. + string ProviderSpecificDetailInstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestFailoverInputProperties.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestFailoverInputProperties.json.cs new file mode 100644 index 000000000000..34abf5abebfe --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestFailoverInputProperties.json.cs @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Input definition for test failover input properties. + public partial class TestFailoverInputProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverInputProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverInputProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverInputProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new TestFailoverInputProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal TestFailoverInputProperties(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_providerSpecificDetail = If( json?.PropertyT("providerSpecificDetails"), out var __jsonProviderSpecificDetails) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.TestFailoverProviderSpecificInput.FromJson(__jsonProviderSpecificDetails) : ProviderSpecificDetail;} + {_failoverDirection = If( json?.PropertyT("failoverDirection"), out var __jsonFailoverDirection) ? (string)__jsonFailoverDirection : (string)FailoverDirection;} + {_networkType = If( json?.PropertyT("networkType"), out var __jsonNetworkType) ? (string)__jsonNetworkType : (string)NetworkType;} + {_networkId = If( json?.PropertyT("networkId"), out var __jsonNetworkId) ? (string)__jsonNetworkId : (string)NetworkId;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._providerSpecificDetail ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._providerSpecificDetail.ToJson(null,serializationMode) : null, "providerSpecificDetails" ,container.Add ); + AddIf( null != (((object)this._failoverDirection)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._failoverDirection.ToString()) : null, "failoverDirection" ,container.Add ); + AddIf( null != (((object)this._networkType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._networkType.ToString()) : null, "networkType" ,container.Add ); + AddIf( null != (((object)this._networkId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._networkId.ToString()) : null, "networkId" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestFailoverJobDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestFailoverJobDetails.PowerShell.cs new file mode 100644 index 000000000000..7bf971b8553e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestFailoverJobDetails.PowerShell.cs @@ -0,0 +1,200 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// This class represents the details for a test failover job. + [System.ComponentModel.TypeConverter(typeof(TestFailoverJobDetailsTypeConverter))] + public partial class TestFailoverJobDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverJobDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new TestFailoverJobDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverJobDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new TestFailoverJobDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverJobDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal TestFailoverJobDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("TestFailoverStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverJobDetailsInternal)this).TestFailoverStatus = (string) content.GetValueForProperty("TestFailoverStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverJobDetailsInternal)this).TestFailoverStatus, global::System.Convert.ToString); + } + if (content.Contains("Comment")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverJobDetailsInternal)this).Comment = (string) content.GetValueForProperty("Comment",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverJobDetailsInternal)this).Comment, global::System.Convert.ToString); + } + if (content.Contains("NetworkName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverJobDetailsInternal)this).NetworkName = (string) content.GetValueForProperty("NetworkName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverJobDetailsInternal)this).NetworkName, global::System.Convert.ToString); + } + if (content.Contains("NetworkFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverJobDetailsInternal)this).NetworkFriendlyName = (string) content.GetValueForProperty("NetworkFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverJobDetailsInternal)this).NetworkFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("NetworkType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverJobDetailsInternal)this).NetworkType = (string) content.GetValueForProperty("NetworkType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverJobDetailsInternal)this).NetworkType, global::System.Convert.ToString); + } + if (content.Contains("ProtectedItemDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverJobDetailsInternal)this).ProtectedItemDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverReplicationProtectedItemDetails[]) content.GetValueForProperty("ProtectedItemDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverJobDetailsInternal)this).ProtectedItemDetail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FailoverReplicationProtectedItemDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + if (content.Contains("AffectedObjectDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsInternal)this).AffectedObjectDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsAffectedObjectDetails) content.GetValueForProperty("AffectedObjectDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsInternal)this).AffectedObjectDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.JobDetailsAffectedObjectDetailsTypeConverter.ConvertFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal TestFailoverJobDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("TestFailoverStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverJobDetailsInternal)this).TestFailoverStatus = (string) content.GetValueForProperty("TestFailoverStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverJobDetailsInternal)this).TestFailoverStatus, global::System.Convert.ToString); + } + if (content.Contains("Comment")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverJobDetailsInternal)this).Comment = (string) content.GetValueForProperty("Comment",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverJobDetailsInternal)this).Comment, global::System.Convert.ToString); + } + if (content.Contains("NetworkName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverJobDetailsInternal)this).NetworkName = (string) content.GetValueForProperty("NetworkName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverJobDetailsInternal)this).NetworkName, global::System.Convert.ToString); + } + if (content.Contains("NetworkFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverJobDetailsInternal)this).NetworkFriendlyName = (string) content.GetValueForProperty("NetworkFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverJobDetailsInternal)this).NetworkFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("NetworkType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverJobDetailsInternal)this).NetworkType = (string) content.GetValueForProperty("NetworkType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverJobDetailsInternal)this).NetworkType, global::System.Convert.ToString); + } + if (content.Contains("ProtectedItemDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverJobDetailsInternal)this).ProtectedItemDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverReplicationProtectedItemDetails[]) content.GetValueForProperty("ProtectedItemDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverJobDetailsInternal)this).ProtectedItemDetail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FailoverReplicationProtectedItemDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + if (content.Contains("AffectedObjectDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsInternal)this).AffectedObjectDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsAffectedObjectDetails) content.GetValueForProperty("AffectedObjectDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsInternal)this).AffectedObjectDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.JobDetailsAffectedObjectDetailsTypeConverter.ConvertFrom); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// This class represents the details for a test failover job. + [System.ComponentModel.TypeConverter(typeof(TestFailoverJobDetailsTypeConverter))] + public partial interface ITestFailoverJobDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestFailoverJobDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestFailoverJobDetails.TypeConverter.cs new file mode 100644 index 000000000000..778ab691168c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestFailoverJobDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class TestFailoverJobDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverJobDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverJobDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return TestFailoverJobDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return TestFailoverJobDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return TestFailoverJobDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestFailoverJobDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestFailoverJobDetails.cs new file mode 100644 index 000000000000..cf48bcce5a9f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestFailoverJobDetails.cs @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// This class represents the details for a test failover job. + public partial class TestFailoverJobDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverJobDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverJobDetailsInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetails __jobDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.JobDetails(); + + /// + /// The affected object properties like source server, source cloud, target server, target cloud etc. based on the workflow + /// object details. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsAffectedObjectDetails AffectedObjectDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsInternal)__jobDetails).AffectedObjectDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsInternal)__jobDetails).AffectedObjectDetail = value ?? null /* model class */; } + + /// Backing field for property. + private string _comment; + + /// The test failover comments. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Comment { get => this._comment; set => this._comment = value; } + + /// Gets the type of job details (see JobDetailsTypes enum for possible values). + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsInternal)__jobDetails).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsInternal)__jobDetails).InstanceType = value ; } + + /// Backing field for property. + private string _networkFriendlyName; + + /// The test network friendly name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string NetworkFriendlyName { get => this._networkFriendlyName; set => this._networkFriendlyName = value; } + + /// Backing field for property. + private string _networkName; + + /// The test network name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string NetworkName { get => this._networkName; set => this._networkName = value; } + + /// Backing field for property. + private string _networkType; + + /// The test network type (see TestFailoverInput enum for possible values). + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string NetworkType { get => this._networkType; set => this._networkType = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverReplicationProtectedItemDetails[] _protectedItemDetail; + + /// The test VM details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverReplicationProtectedItemDetails[] ProtectedItemDetail { get => this._protectedItemDetail; set => this._protectedItemDetail = value; } + + /// Backing field for property. + private string _testFailoverStatus; + + /// The test failover status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TestFailoverStatus { get => this._testFailoverStatus; set => this._testFailoverStatus = value; } + + /// Creates an new instance. + public TestFailoverJobDetails() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__jobDetails), __jobDetails); + await eventListener.AssertObjectIsValid(nameof(__jobDetails), __jobDetails); + } + } + /// This class represents the details for a test failover job. + public partial interface ITestFailoverJobDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetails + { + /// The test failover comments. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The test failover comments.", + SerializedName = @"comments", + PossibleTypes = new [] { typeof(string) })] + string Comment { get; set; } + /// The test network friendly name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The test network friendly name.", + SerializedName = @"networkFriendlyName", + PossibleTypes = new [] { typeof(string) })] + string NetworkFriendlyName { get; set; } + /// The test network name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The test network name.", + SerializedName = @"networkName", + PossibleTypes = new [] { typeof(string) })] + string NetworkName { get; set; } + /// The test network type (see TestFailoverInput enum for possible values). + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The test network type (see TestFailoverInput enum for possible values).", + SerializedName = @"networkType", + PossibleTypes = new [] { typeof(string) })] + string NetworkType { get; set; } + /// The test VM details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The test VM details.", + SerializedName = @"protectedItemDetails", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverReplicationProtectedItemDetails) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverReplicationProtectedItemDetails[] ProtectedItemDetail { get; set; } + /// The test failover status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The test failover status.", + SerializedName = @"testFailoverStatus", + PossibleTypes = new [] { typeof(string) })] + string TestFailoverStatus { get; set; } + + } + /// This class represents the details for a test failover job. + internal partial interface ITestFailoverJobDetailsInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobDetailsInternal + { + /// The test failover comments. + string Comment { get; set; } + /// The test network friendly name. + string NetworkFriendlyName { get; set; } + /// The test network name. + string NetworkName { get; set; } + /// The test network type (see TestFailoverInput enum for possible values). + string NetworkType { get; set; } + /// The test VM details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverReplicationProtectedItemDetails[] ProtectedItemDetail { get; set; } + /// The test failover status. + string TestFailoverStatus { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestFailoverJobDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestFailoverJobDetails.json.cs new file mode 100644 index 000000000000..af77531269b1 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestFailoverJobDetails.json.cs @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// This class represents the details for a test failover job. + public partial class TestFailoverJobDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverJobDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverJobDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverJobDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new TestFailoverJobDetails(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal TestFailoverJobDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __jobDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.JobDetails(json); + {_testFailoverStatus = If( json?.PropertyT("testFailoverStatus"), out var __jsonTestFailoverStatus) ? (string)__jsonTestFailoverStatus : (string)TestFailoverStatus;} + {_comment = If( json?.PropertyT("comments"), out var __jsonComments) ? (string)__jsonComments : (string)Comment;} + {_networkName = If( json?.PropertyT("networkName"), out var __jsonNetworkName) ? (string)__jsonNetworkName : (string)NetworkName;} + {_networkFriendlyName = If( json?.PropertyT("networkFriendlyName"), out var __jsonNetworkFriendlyName) ? (string)__jsonNetworkFriendlyName : (string)NetworkFriendlyName;} + {_networkType = If( json?.PropertyT("networkType"), out var __jsonNetworkType) ? (string)__jsonNetworkType : (string)NetworkType;} + {_protectedItemDetail = If( json?.PropertyT("protectedItemDetails"), out var __jsonProtectedItemDetails) ? If( __jsonProtectedItemDetails as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverReplicationProtectedItemDetails) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FailoverReplicationProtectedItemDetails.FromJson(__u) )) ))() : null : ProtectedItemDetail;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __jobDetails?.ToJson(container, serializationMode); + AddIf( null != (((object)this._testFailoverStatus)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._testFailoverStatus.ToString()) : null, "testFailoverStatus" ,container.Add ); + AddIf( null != (((object)this._comment)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._comment.ToString()) : null, "comments" ,container.Add ); + AddIf( null != (((object)this._networkName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._networkName.ToString()) : null, "networkName" ,container.Add ); + AddIf( null != (((object)this._networkFriendlyName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._networkFriendlyName.ToString()) : null, "networkFriendlyName" ,container.Add ); + AddIf( null != (((object)this._networkType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._networkType.ToString()) : null, "networkType" ,container.Add ); + if (null != this._protectedItemDetail) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._protectedItemDetail ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("protectedItemDetails",__w); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestFailoverProviderSpecificInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestFailoverProviderSpecificInput.PowerShell.cs new file mode 100644 index 000000000000..9477f8099a0e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestFailoverProviderSpecificInput.PowerShell.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Provider specific test failover input. + [System.ComponentModel.TypeConverter(typeof(TestFailoverProviderSpecificInputTypeConverter))] + public partial class TestFailoverProviderSpecificInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverProviderSpecificInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new TestFailoverProviderSpecificInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverProviderSpecificInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new TestFailoverProviderSpecificInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverProviderSpecificInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal TestFailoverProviderSpecificInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal TestFailoverProviderSpecificInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Provider specific test failover input. + [System.ComponentModel.TypeConverter(typeof(TestFailoverProviderSpecificInputTypeConverter))] + public partial interface ITestFailoverProviderSpecificInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestFailoverProviderSpecificInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestFailoverProviderSpecificInput.TypeConverter.cs new file mode 100644 index 000000000000..1028b6ef2d47 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestFailoverProviderSpecificInput.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class TestFailoverProviderSpecificInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverProviderSpecificInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverProviderSpecificInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return TestFailoverProviderSpecificInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return TestFailoverProviderSpecificInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return TestFailoverProviderSpecificInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestFailoverProviderSpecificInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestFailoverProviderSpecificInput.cs new file mode 100644 index 000000000000..2668e3d3800e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestFailoverProviderSpecificInput.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Provider specific test failover input. + public partial class TestFailoverProviderSpecificInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverProviderSpecificInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverProviderSpecificInputInternal + { + + /// Backing field for property. + private string _instanceType; + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string InstanceType { get => this._instanceType; set => this._instanceType = value; } + + /// Creates an new instance. + public TestFailoverProviderSpecificInput() + { + + } + } + /// Provider specific test failover input. + public partial interface ITestFailoverProviderSpecificInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string InstanceType { get; set; } + + } + /// Provider specific test failover input. + internal partial interface ITestFailoverProviderSpecificInputInternal + + { + /// The class type. + string InstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestFailoverProviderSpecificInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestFailoverProviderSpecificInput.json.cs new file mode 100644 index 000000000000..d0c6438c3273 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestFailoverProviderSpecificInput.json.cs @@ -0,0 +1,139 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Provider specific test failover input. + public partial class TestFailoverProviderSpecificInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverProviderSpecificInput. + /// Note: the Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverProviderSpecificInput interface + /// is polymorphic, and the precise model class that will get deserialized is determined at runtime based on the payload. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverProviderSpecificInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverProviderSpecificInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + if (!(node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json)) + { + return null; + } + // Polymorphic type -- select the appropriate constructor using the discriminator + + switch ( json.StringProperty("instanceType") ) + { + case "A2A": + { + return new A2ATestFailoverInput(json); + } + case "HyperVReplicaAzure": + { + return new HyperVReplicaAzureTestFailoverInput(json); + } + case "InMageAzureV2": + { + return new InMageAzureV2TestFailoverInput(json); + } + case "InMageRcm": + { + return new InMageRcmTestFailoverInput(json); + } + case "InMage": + { + return new InMageTestFailoverInput(json); + } + } + return new TestFailoverProviderSpecificInput(json); + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal TestFailoverProviderSpecificInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_instanceType = If( json?.PropertyT("instanceType"), out var __jsonInstanceType) ? (string)__jsonInstanceType : (string)InstanceType;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._instanceType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._instanceType.ToString()) : null, "instanceType" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestMigrateCleanupInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestMigrateCleanupInput.PowerShell.cs new file mode 100644 index 000000000000..01f09ec3a42e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestMigrateCleanupInput.PowerShell.cs @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Input for test migrate cleanup. + [System.ComponentModel.TypeConverter(typeof(TestMigrateCleanupInputTypeConverter))] + public partial class TestMigrateCleanupInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateCleanupInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new TestMigrateCleanupInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateCleanupInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new TestMigrateCleanupInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateCleanupInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal TestMigrateCleanupInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateCleanupInputInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateCleanupInputProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateCleanupInputInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.TestMigrateCleanupInputPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Comment")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateCleanupInputInternal)this).Comment = (string) content.GetValueForProperty("Comment",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateCleanupInputInternal)this).Comment, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal TestMigrateCleanupInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateCleanupInputInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateCleanupInputProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateCleanupInputInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.TestMigrateCleanupInputPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Comment")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateCleanupInputInternal)this).Comment = (string) content.GetValueForProperty("Comment",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateCleanupInputInternal)this).Comment, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Input for test migrate cleanup. + [System.ComponentModel.TypeConverter(typeof(TestMigrateCleanupInputTypeConverter))] + public partial interface ITestMigrateCleanupInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestMigrateCleanupInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestMigrateCleanupInput.TypeConverter.cs new file mode 100644 index 000000000000..d4d9190c0a8b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestMigrateCleanupInput.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class TestMigrateCleanupInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateCleanupInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateCleanupInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return TestMigrateCleanupInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return TestMigrateCleanupInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return TestMigrateCleanupInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestMigrateCleanupInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestMigrateCleanupInput.cs new file mode 100644 index 000000000000..6e389968f419 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestMigrateCleanupInput.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Input for test migrate cleanup. + public partial class TestMigrateCleanupInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateCleanupInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateCleanupInputInternal + { + + /// Test migrate cleanup comments. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string Comment { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateCleanupInputPropertiesInternal)Property).Comment; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateCleanupInputPropertiesInternal)Property).Comment = value ?? null; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateCleanupInputProperties Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateCleanupInputInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.TestMigrateCleanupInputProperties()); set { {_property = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateCleanupInputProperties _property; + + /// Test migrate cleanup input properties. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateCleanupInputProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.TestMigrateCleanupInputProperties()); set => this._property = value; } + + /// Creates an new instance. + public TestMigrateCleanupInput() + { + + } + } + /// Input for test migrate cleanup. + public partial interface ITestMigrateCleanupInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// Test migrate cleanup comments. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Test migrate cleanup comments.", + SerializedName = @"comments", + PossibleTypes = new [] { typeof(string) })] + string Comment { get; set; } + + } + /// Input for test migrate cleanup. + internal partial interface ITestMigrateCleanupInputInternal + + { + /// Test migrate cleanup comments. + string Comment { get; set; } + /// Test migrate cleanup input properties. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateCleanupInputProperties Property { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestMigrateCleanupInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestMigrateCleanupInput.json.cs new file mode 100644 index 000000000000..a8fd1145ea4d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestMigrateCleanupInput.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Input for test migrate cleanup. + public partial class TestMigrateCleanupInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateCleanupInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateCleanupInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateCleanupInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new TestMigrateCleanupInput(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal TestMigrateCleanupInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.TestMigrateCleanupInputProperties.FromJson(__jsonProperties) : Property;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestMigrateCleanupInputProperties.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestMigrateCleanupInputProperties.PowerShell.cs new file mode 100644 index 000000000000..3748598f73bb --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestMigrateCleanupInputProperties.PowerShell.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Test migrate cleanup input properties. + [System.ComponentModel.TypeConverter(typeof(TestMigrateCleanupInputPropertiesTypeConverter))] + public partial class TestMigrateCleanupInputProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateCleanupInputProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new TestMigrateCleanupInputProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateCleanupInputProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new TestMigrateCleanupInputProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateCleanupInputProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal TestMigrateCleanupInputProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Comment")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateCleanupInputPropertiesInternal)this).Comment = (string) content.GetValueForProperty("Comment",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateCleanupInputPropertiesInternal)this).Comment, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal TestMigrateCleanupInputProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Comment")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateCleanupInputPropertiesInternal)this).Comment = (string) content.GetValueForProperty("Comment",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateCleanupInputPropertiesInternal)this).Comment, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Test migrate cleanup input properties. + [System.ComponentModel.TypeConverter(typeof(TestMigrateCleanupInputPropertiesTypeConverter))] + public partial interface ITestMigrateCleanupInputProperties + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestMigrateCleanupInputProperties.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestMigrateCleanupInputProperties.TypeConverter.cs new file mode 100644 index 000000000000..f73af98355ae --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestMigrateCleanupInputProperties.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class TestMigrateCleanupInputPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateCleanupInputProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateCleanupInputProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return TestMigrateCleanupInputProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return TestMigrateCleanupInputProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return TestMigrateCleanupInputProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestMigrateCleanupInputProperties.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestMigrateCleanupInputProperties.cs new file mode 100644 index 000000000000..33725e323ba1 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestMigrateCleanupInputProperties.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Test migrate cleanup input properties. + public partial class TestMigrateCleanupInputProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateCleanupInputProperties, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateCleanupInputPropertiesInternal + { + + /// Backing field for property. + private string _comment; + + /// Test migrate cleanup comments. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Comment { get => this._comment; set => this._comment = value; } + + /// Creates an new instance. + public TestMigrateCleanupInputProperties() + { + + } + } + /// Test migrate cleanup input properties. + public partial interface ITestMigrateCleanupInputProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// Test migrate cleanup comments. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Test migrate cleanup comments.", + SerializedName = @"comments", + PossibleTypes = new [] { typeof(string) })] + string Comment { get; set; } + + } + /// Test migrate cleanup input properties. + internal partial interface ITestMigrateCleanupInputPropertiesInternal + + { + /// Test migrate cleanup comments. + string Comment { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestMigrateCleanupInputProperties.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestMigrateCleanupInputProperties.json.cs new file mode 100644 index 000000000000..7c0fdcbf9dde --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestMigrateCleanupInputProperties.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Test migrate cleanup input properties. + public partial class TestMigrateCleanupInputProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateCleanupInputProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateCleanupInputProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateCleanupInputProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new TestMigrateCleanupInputProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal TestMigrateCleanupInputProperties(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_comment = If( json?.PropertyT("comments"), out var __jsonComments) ? (string)__jsonComments : (string)Comment;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._comment)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._comment.ToString()) : null, "comments" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestMigrateInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestMigrateInput.PowerShell.cs new file mode 100644 index 000000000000..a66481120493 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestMigrateInput.PowerShell.cs @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Input for test migrate. + [System.ComponentModel.TypeConverter(typeof(TestMigrateInputTypeConverter))] + public partial class TestMigrateInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new TestMigrateInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new TestMigrateInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal TestMigrateInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateInputInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateInputProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateInputInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.TestMigrateInputPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateInputInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateProviderSpecificInput) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateInputInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.TestMigrateProviderSpecificInputTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateInputInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateInputInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal TestMigrateInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateInputInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateInputProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateInputInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.TestMigrateInputPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateInputInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateProviderSpecificInput) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateInputInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.TestMigrateProviderSpecificInputTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateInputInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateInputInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Input for test migrate. + [System.ComponentModel.TypeConverter(typeof(TestMigrateInputTypeConverter))] + public partial interface ITestMigrateInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestMigrateInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestMigrateInput.TypeConverter.cs new file mode 100644 index 000000000000..4a319f5ce189 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestMigrateInput.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class TestMigrateInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return TestMigrateInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return TestMigrateInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return TestMigrateInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestMigrateInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestMigrateInput.cs new file mode 100644 index 000000000000..b676bafd1f39 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestMigrateInput.cs @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Input for test migrate. + public partial class TestMigrateInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateInputInternal + { + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateInputProperties Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateInputInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.TestMigrateInputProperties()); set { {_property = value;} } } + + /// Internal Acessors for ProviderSpecificDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateProviderSpecificInput Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateInputInternal.ProviderSpecificDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateInputPropertiesInternal)Property).ProviderSpecificDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateInputPropertiesInternal)Property).ProviderSpecificDetail = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateInputProperties _property; + + /// Test migrate input properties. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateInputProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.TestMigrateInputProperties()); set => this._property = value; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ProviderSpecificDetailInstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateInputPropertiesInternal)Property).ProviderSpecificDetailInstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateInputPropertiesInternal)Property).ProviderSpecificDetailInstanceType = value ; } + + /// Creates an new instance. + public TestMigrateInput() + { + + } + } + /// Input for test migrate. + public partial interface ITestMigrateInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string ProviderSpecificDetailInstanceType { get; set; } + + } + /// Input for test migrate. + internal partial interface ITestMigrateInputInternal + + { + /// Test migrate input properties. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateInputProperties Property { get; set; } + /// The provider specific details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateProviderSpecificInput ProviderSpecificDetail { get; set; } + /// The class type. + string ProviderSpecificDetailInstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestMigrateInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestMigrateInput.json.cs new file mode 100644 index 000000000000..a386bc8c8252 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestMigrateInput.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Input for test migrate. + public partial class TestMigrateInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new TestMigrateInput(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal TestMigrateInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.TestMigrateInputProperties.FromJson(__jsonProperties) : Property;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestMigrateInputProperties.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestMigrateInputProperties.PowerShell.cs new file mode 100644 index 000000000000..3a2add20b406 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestMigrateInputProperties.PowerShell.cs @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Test migrate input properties. + [System.ComponentModel.TypeConverter(typeof(TestMigrateInputPropertiesTypeConverter))] + public partial class TestMigrateInputProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateInputProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new TestMigrateInputProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateInputProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new TestMigrateInputProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateInputProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal TestMigrateInputProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateInputPropertiesInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateProviderSpecificInput) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateInputPropertiesInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.TestMigrateProviderSpecificInputTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateInputPropertiesInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateInputPropertiesInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal TestMigrateInputProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateInputPropertiesInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateProviderSpecificInput) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateInputPropertiesInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.TestMigrateProviderSpecificInputTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateInputPropertiesInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateInputPropertiesInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Test migrate input properties. + [System.ComponentModel.TypeConverter(typeof(TestMigrateInputPropertiesTypeConverter))] + public partial interface ITestMigrateInputProperties + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestMigrateInputProperties.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestMigrateInputProperties.TypeConverter.cs new file mode 100644 index 000000000000..087298df3e86 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestMigrateInputProperties.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class TestMigrateInputPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateInputProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateInputProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return TestMigrateInputProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return TestMigrateInputProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return TestMigrateInputProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestMigrateInputProperties.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestMigrateInputProperties.cs new file mode 100644 index 000000000000..ffd41cfa7465 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestMigrateInputProperties.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Test migrate input properties. + public partial class TestMigrateInputProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateInputProperties, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateInputPropertiesInternal + { + + /// Internal Acessors for ProviderSpecificDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateProviderSpecificInput Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateInputPropertiesInternal.ProviderSpecificDetail { get => (this._providerSpecificDetail = this._providerSpecificDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.TestMigrateProviderSpecificInput()); set { {_providerSpecificDetail = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateProviderSpecificInput _providerSpecificDetail; + + /// The provider specific details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateProviderSpecificInput ProviderSpecificDetail { get => (this._providerSpecificDetail = this._providerSpecificDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.TestMigrateProviderSpecificInput()); set => this._providerSpecificDetail = value; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ProviderSpecificDetailInstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateProviderSpecificInputInternal)ProviderSpecificDetail).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateProviderSpecificInputInternal)ProviderSpecificDetail).InstanceType = value ; } + + /// Creates an new instance. + public TestMigrateInputProperties() + { + + } + } + /// Test migrate input properties. + public partial interface ITestMigrateInputProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string ProviderSpecificDetailInstanceType { get; set; } + + } + /// Test migrate input properties. + internal partial interface ITestMigrateInputPropertiesInternal + + { + /// The provider specific details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateProviderSpecificInput ProviderSpecificDetail { get; set; } + /// The class type. + string ProviderSpecificDetailInstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestMigrateInputProperties.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestMigrateInputProperties.json.cs new file mode 100644 index 000000000000..3ff3571ac013 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestMigrateInputProperties.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Test migrate input properties. + public partial class TestMigrateInputProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateInputProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateInputProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateInputProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new TestMigrateInputProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal TestMigrateInputProperties(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_providerSpecificDetail = If( json?.PropertyT("providerSpecificDetails"), out var __jsonProviderSpecificDetails) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.TestMigrateProviderSpecificInput.FromJson(__jsonProviderSpecificDetails) : ProviderSpecificDetail;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._providerSpecificDetail ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._providerSpecificDetail.ToJson(null,serializationMode) : null, "providerSpecificDetails" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestMigrateProviderSpecificInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestMigrateProviderSpecificInput.PowerShell.cs new file mode 100644 index 000000000000..55d5b27807a4 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestMigrateProviderSpecificInput.PowerShell.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Test migrate provider specific input. + [System.ComponentModel.TypeConverter(typeof(TestMigrateProviderSpecificInputTypeConverter))] + public partial class TestMigrateProviderSpecificInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateProviderSpecificInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new TestMigrateProviderSpecificInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateProviderSpecificInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new TestMigrateProviderSpecificInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateProviderSpecificInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal TestMigrateProviderSpecificInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal TestMigrateProviderSpecificInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Test migrate provider specific input. + [System.ComponentModel.TypeConverter(typeof(TestMigrateProviderSpecificInputTypeConverter))] + public partial interface ITestMigrateProviderSpecificInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestMigrateProviderSpecificInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestMigrateProviderSpecificInput.TypeConverter.cs new file mode 100644 index 000000000000..f3b145dd73b9 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestMigrateProviderSpecificInput.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class TestMigrateProviderSpecificInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateProviderSpecificInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateProviderSpecificInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return TestMigrateProviderSpecificInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return TestMigrateProviderSpecificInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return TestMigrateProviderSpecificInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestMigrateProviderSpecificInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestMigrateProviderSpecificInput.cs new file mode 100644 index 000000000000..d4220d72b48d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestMigrateProviderSpecificInput.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Test migrate provider specific input. + public partial class TestMigrateProviderSpecificInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateProviderSpecificInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateProviderSpecificInputInternal + { + + /// Backing field for property. + private string _instanceType; + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string InstanceType { get => this._instanceType; set => this._instanceType = value; } + + /// Creates an new instance. + public TestMigrateProviderSpecificInput() + { + + } + } + /// Test migrate provider specific input. + public partial interface ITestMigrateProviderSpecificInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string InstanceType { get; set; } + + } + /// Test migrate provider specific input. + internal partial interface ITestMigrateProviderSpecificInputInternal + + { + /// The class type. + string InstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestMigrateProviderSpecificInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestMigrateProviderSpecificInput.json.cs new file mode 100644 index 000000000000..0da6f4b8b509 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/TestMigrateProviderSpecificInput.json.cs @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Test migrate provider specific input. + public partial class TestMigrateProviderSpecificInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateProviderSpecificInput. + /// Note: the Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateProviderSpecificInput interface + /// is polymorphic, and the precise model class that will get deserialized is determined at runtime based on the payload. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateProviderSpecificInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateProviderSpecificInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + if (!(node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json)) + { + return null; + } + // Polymorphic type -- select the appropriate constructor using the discriminator + + switch ( json.StringProperty("instanceType") ) + { + case "VMwareCbt": + { + return new VMwareCbtTestMigrateInput(json); + } + } + return new TestMigrateProviderSpecificInput(json); + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal TestMigrateProviderSpecificInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_instanceType = If( json?.PropertyT("instanceType"), out var __jsonInstanceType) ? (string)__jsonInstanceType : (string)InstanceType;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._instanceType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._instanceType.ToString()) : null, "instanceType" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UnplannedFailoverInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UnplannedFailoverInput.PowerShell.cs new file mode 100644 index 000000000000..935d726d22da --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UnplannedFailoverInput.PowerShell.cs @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Input definition for unplanned failover. + [System.ComponentModel.TypeConverter(typeof(UnplannedFailoverInputTypeConverter))] + public partial class UnplannedFailoverInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new UnplannedFailoverInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new UnplannedFailoverInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal UnplannedFailoverInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverInputInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverInputProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverInputInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UnplannedFailoverInputPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverInputInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverProviderSpecificInput) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverInputInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UnplannedFailoverProviderSpecificInputTypeConverter.ConvertFrom); + } + if (content.Contains("FailoverDirection")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverInputInternal)this).FailoverDirection = (string) content.GetValueForProperty("FailoverDirection",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverInputInternal)this).FailoverDirection, global::System.Convert.ToString); + } + if (content.Contains("SourceSiteOperation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverInputInternal)this).SourceSiteOperation = (string) content.GetValueForProperty("SourceSiteOperation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverInputInternal)this).SourceSiteOperation, global::System.Convert.ToString); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverInputInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverInputInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal UnplannedFailoverInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverInputInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverInputProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverInputInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UnplannedFailoverInputPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverInputInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverProviderSpecificInput) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverInputInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UnplannedFailoverProviderSpecificInputTypeConverter.ConvertFrom); + } + if (content.Contains("FailoverDirection")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverInputInternal)this).FailoverDirection = (string) content.GetValueForProperty("FailoverDirection",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverInputInternal)this).FailoverDirection, global::System.Convert.ToString); + } + if (content.Contains("SourceSiteOperation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverInputInternal)this).SourceSiteOperation = (string) content.GetValueForProperty("SourceSiteOperation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverInputInternal)this).SourceSiteOperation, global::System.Convert.ToString); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverInputInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverInputInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + } + /// Input definition for unplanned failover. + [System.ComponentModel.TypeConverter(typeof(UnplannedFailoverInputTypeConverter))] + public partial interface IUnplannedFailoverInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UnplannedFailoverInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UnplannedFailoverInput.TypeConverter.cs new file mode 100644 index 000000000000..920743acaaca --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UnplannedFailoverInput.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class UnplannedFailoverInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return UnplannedFailoverInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return UnplannedFailoverInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return UnplannedFailoverInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UnplannedFailoverInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UnplannedFailoverInput.cs new file mode 100644 index 000000000000..143f80a29622 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UnplannedFailoverInput.cs @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Input definition for unplanned failover. + public partial class UnplannedFailoverInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverInputInternal + { + + /// Failover direction. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string FailoverDirection { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverInputPropertiesInternal)Property).FailoverDirection; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverInputPropertiesInternal)Property).FailoverDirection = value ?? null; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverInputProperties Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverInputInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UnplannedFailoverInputProperties()); set { {_property = value;} } } + + /// Internal Acessors for ProviderSpecificDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverProviderSpecificInput Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverInputInternal.ProviderSpecificDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverInputPropertiesInternal)Property).ProviderSpecificDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverInputPropertiesInternal)Property).ProviderSpecificDetail = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverInputProperties _property; + + /// Unplanned failover input properties. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverInputProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UnplannedFailoverInputProperties()); set => this._property = value; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ProviderSpecificDetailInstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverInputPropertiesInternal)Property).ProviderSpecificDetailInstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverInputPropertiesInternal)Property).ProviderSpecificDetailInstanceType = value ?? null; } + + /// Source site operations status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string SourceSiteOperation { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverInputPropertiesInternal)Property).SourceSiteOperation; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverInputPropertiesInternal)Property).SourceSiteOperation = value ?? null; } + + /// Creates an new instance. + public UnplannedFailoverInput() + { + + } + } + /// Input definition for unplanned failover. + public partial interface IUnplannedFailoverInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// Failover direction. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Failover direction.", + SerializedName = @"failoverDirection", + PossibleTypes = new [] { typeof(string) })] + string FailoverDirection { get; set; } + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string ProviderSpecificDetailInstanceType { get; set; } + /// Source site operations status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Source site operations status.", + SerializedName = @"sourceSiteOperations", + PossibleTypes = new [] { typeof(string) })] + string SourceSiteOperation { get; set; } + + } + /// Input definition for unplanned failover. + internal partial interface IUnplannedFailoverInputInternal + + { + /// Failover direction. + string FailoverDirection { get; set; } + /// Unplanned failover input properties. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverInputProperties Property { get; set; } + /// Provider specific settings. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverProviderSpecificInput ProviderSpecificDetail { get; set; } + /// The class type. + string ProviderSpecificDetailInstanceType { get; set; } + /// Source site operations status. + string SourceSiteOperation { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UnplannedFailoverInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UnplannedFailoverInput.json.cs new file mode 100644 index 000000000000..6736097448ca --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UnplannedFailoverInput.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Input definition for unplanned failover. + public partial class UnplannedFailoverInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new UnplannedFailoverInput(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal UnplannedFailoverInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UnplannedFailoverInputProperties.FromJson(__jsonProperties) : Property;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UnplannedFailoverInputProperties.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UnplannedFailoverInputProperties.PowerShell.cs new file mode 100644 index 000000000000..70562d1bb1ce --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UnplannedFailoverInputProperties.PowerShell.cs @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Input definition for unplanned failover input properties. + [System.ComponentModel.TypeConverter(typeof(UnplannedFailoverInputPropertiesTypeConverter))] + public partial class UnplannedFailoverInputProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverInputProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new UnplannedFailoverInputProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverInputProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new UnplannedFailoverInputProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverInputProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal UnplannedFailoverInputProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverInputPropertiesInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverProviderSpecificInput) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverInputPropertiesInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UnplannedFailoverProviderSpecificInputTypeConverter.ConvertFrom); + } + if (content.Contains("FailoverDirection")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverInputPropertiesInternal)this).FailoverDirection = (string) content.GetValueForProperty("FailoverDirection",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverInputPropertiesInternal)this).FailoverDirection, global::System.Convert.ToString); + } + if (content.Contains("SourceSiteOperation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverInputPropertiesInternal)this).SourceSiteOperation = (string) content.GetValueForProperty("SourceSiteOperation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverInputPropertiesInternal)this).SourceSiteOperation, global::System.Convert.ToString); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverInputPropertiesInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverInputPropertiesInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal UnplannedFailoverInputProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverInputPropertiesInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverProviderSpecificInput) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverInputPropertiesInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UnplannedFailoverProviderSpecificInputTypeConverter.ConvertFrom); + } + if (content.Contains("FailoverDirection")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverInputPropertiesInternal)this).FailoverDirection = (string) content.GetValueForProperty("FailoverDirection",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverInputPropertiesInternal)this).FailoverDirection, global::System.Convert.ToString); + } + if (content.Contains("SourceSiteOperation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverInputPropertiesInternal)this).SourceSiteOperation = (string) content.GetValueForProperty("SourceSiteOperation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverInputPropertiesInternal)this).SourceSiteOperation, global::System.Convert.ToString); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverInputPropertiesInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverInputPropertiesInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + } + /// Input definition for unplanned failover input properties. + [System.ComponentModel.TypeConverter(typeof(UnplannedFailoverInputPropertiesTypeConverter))] + public partial interface IUnplannedFailoverInputProperties + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UnplannedFailoverInputProperties.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UnplannedFailoverInputProperties.TypeConverter.cs new file mode 100644 index 000000000000..616d6531ee86 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UnplannedFailoverInputProperties.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class UnplannedFailoverInputPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverInputProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverInputProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return UnplannedFailoverInputProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return UnplannedFailoverInputProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return UnplannedFailoverInputProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UnplannedFailoverInputProperties.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UnplannedFailoverInputProperties.cs new file mode 100644 index 000000000000..37f5e9bbd0de --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UnplannedFailoverInputProperties.cs @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Input definition for unplanned failover input properties. + public partial class UnplannedFailoverInputProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverInputProperties, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverInputPropertiesInternal + { + + /// Backing field for property. + private string _failoverDirection; + + /// Failover direction. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string FailoverDirection { get => this._failoverDirection; set => this._failoverDirection = value; } + + /// Internal Acessors for ProviderSpecificDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverProviderSpecificInput Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverInputPropertiesInternal.ProviderSpecificDetail { get => (this._providerSpecificDetail = this._providerSpecificDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UnplannedFailoverProviderSpecificInput()); set { {_providerSpecificDetail = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverProviderSpecificInput _providerSpecificDetail; + + /// Provider specific settings. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverProviderSpecificInput ProviderSpecificDetail { get => (this._providerSpecificDetail = this._providerSpecificDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UnplannedFailoverProviderSpecificInput()); set => this._providerSpecificDetail = value; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ProviderSpecificDetailInstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverProviderSpecificInputInternal)ProviderSpecificDetail).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverProviderSpecificInputInternal)ProviderSpecificDetail).InstanceType = value ?? null; } + + /// Backing field for property. + private string _sourceSiteOperation; + + /// Source site operations status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string SourceSiteOperation { get => this._sourceSiteOperation; set => this._sourceSiteOperation = value; } + + /// Creates an new instance. + public UnplannedFailoverInputProperties() + { + + } + } + /// Input definition for unplanned failover input properties. + public partial interface IUnplannedFailoverInputProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// Failover direction. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Failover direction.", + SerializedName = @"failoverDirection", + PossibleTypes = new [] { typeof(string) })] + string FailoverDirection { get; set; } + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string ProviderSpecificDetailInstanceType { get; set; } + /// Source site operations status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Source site operations status.", + SerializedName = @"sourceSiteOperations", + PossibleTypes = new [] { typeof(string) })] + string SourceSiteOperation { get; set; } + + } + /// Input definition for unplanned failover input properties. + internal partial interface IUnplannedFailoverInputPropertiesInternal + + { + /// Failover direction. + string FailoverDirection { get; set; } + /// Provider specific settings. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverProviderSpecificInput ProviderSpecificDetail { get; set; } + /// The class type. + string ProviderSpecificDetailInstanceType { get; set; } + /// Source site operations status. + string SourceSiteOperation { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UnplannedFailoverInputProperties.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UnplannedFailoverInputProperties.json.cs new file mode 100644 index 000000000000..65e23dcead30 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UnplannedFailoverInputProperties.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Input definition for unplanned failover input properties. + public partial class UnplannedFailoverInputProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverInputProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverInputProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverInputProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new UnplannedFailoverInputProperties(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._providerSpecificDetail ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._providerSpecificDetail.ToJson(null,serializationMode) : null, "providerSpecificDetails" ,container.Add ); + AddIf( null != (((object)this._failoverDirection)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._failoverDirection.ToString()) : null, "failoverDirection" ,container.Add ); + AddIf( null != (((object)this._sourceSiteOperation)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._sourceSiteOperation.ToString()) : null, "sourceSiteOperations" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal UnplannedFailoverInputProperties(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_providerSpecificDetail = If( json?.PropertyT("providerSpecificDetails"), out var __jsonProviderSpecificDetails) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UnplannedFailoverProviderSpecificInput.FromJson(__jsonProviderSpecificDetails) : ProviderSpecificDetail;} + {_failoverDirection = If( json?.PropertyT("failoverDirection"), out var __jsonFailoverDirection) ? (string)__jsonFailoverDirection : (string)FailoverDirection;} + {_sourceSiteOperation = If( json?.PropertyT("sourceSiteOperations"), out var __jsonSourceSiteOperations) ? (string)__jsonSourceSiteOperations : (string)SourceSiteOperation;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UnplannedFailoverProviderSpecificInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UnplannedFailoverProviderSpecificInput.PowerShell.cs new file mode 100644 index 000000000000..2781fd2f1fe1 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UnplannedFailoverProviderSpecificInput.PowerShell.cs @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Provider specific unplanned failover input. + [System.ComponentModel.TypeConverter(typeof(UnplannedFailoverProviderSpecificInputTypeConverter))] + public partial class UnplannedFailoverProviderSpecificInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverProviderSpecificInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new UnplannedFailoverProviderSpecificInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverProviderSpecificInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new UnplannedFailoverProviderSpecificInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json + /// string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverProviderSpecificInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal UnplannedFailoverProviderSpecificInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal UnplannedFailoverProviderSpecificInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + } + /// Provider specific unplanned failover input. + [System.ComponentModel.TypeConverter(typeof(UnplannedFailoverProviderSpecificInputTypeConverter))] + public partial interface IUnplannedFailoverProviderSpecificInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UnplannedFailoverProviderSpecificInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UnplannedFailoverProviderSpecificInput.TypeConverter.cs new file mode 100644 index 000000000000..e97cd23b425d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UnplannedFailoverProviderSpecificInput.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class UnplannedFailoverProviderSpecificInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverProviderSpecificInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverProviderSpecificInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return UnplannedFailoverProviderSpecificInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return UnplannedFailoverProviderSpecificInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return UnplannedFailoverProviderSpecificInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UnplannedFailoverProviderSpecificInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UnplannedFailoverProviderSpecificInput.cs new file mode 100644 index 000000000000..43adce47d563 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UnplannedFailoverProviderSpecificInput.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Provider specific unplanned failover input. + public partial class UnplannedFailoverProviderSpecificInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverProviderSpecificInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverProviderSpecificInputInternal + { + + /// Backing field for property. + private string _instanceType; + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string InstanceType { get => this._instanceType; set => this._instanceType = value; } + + /// Creates an new instance. + public UnplannedFailoverProviderSpecificInput() + { + + } + } + /// Provider specific unplanned failover input. + public partial interface IUnplannedFailoverProviderSpecificInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string InstanceType { get; set; } + + } + /// Provider specific unplanned failover input. + internal partial interface IUnplannedFailoverProviderSpecificInputInternal + + { + /// The class type. + string InstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UnplannedFailoverProviderSpecificInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UnplannedFailoverProviderSpecificInput.json.cs new file mode 100644 index 000000000000..a20c4408aa9b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UnplannedFailoverProviderSpecificInput.json.cs @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Provider specific unplanned failover input. + public partial class UnplannedFailoverProviderSpecificInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverProviderSpecificInput. + /// Note: the Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverProviderSpecificInput interface + /// is polymorphic, and the precise model class that will get deserialized is determined at runtime based on the payload. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverProviderSpecificInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverProviderSpecificInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + if (!(node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json)) + { + return null; + } + // Polymorphic type -- select the appropriate constructor using the discriminator + + switch ( json.StringProperty("instanceType") ) + { + case "A2A": + { + return new A2AUnplannedFailoverInput(json); + } + case "HyperVReplicaAzure": + { + return new HyperVReplicaAzureUnplannedFailoverInput(json); + } + case "InMageAzureV2": + { + return new InMageAzureV2UnplannedFailoverInput(json); + } + case "InMageRcm": + { + return new InMageRcmUnplannedFailoverInput(json); + } + case "InMage": + { + return new InMageUnplannedFailoverInput(json); + } + } + return new UnplannedFailoverProviderSpecificInput(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._instanceType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._instanceType.ToString()) : null, "instanceType" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal UnplannedFailoverProviderSpecificInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_instanceType = If( json?.PropertyT("instanceType"), out var __jsonInstanceType) ? (string)__jsonInstanceType : (string)InstanceType;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateApplianceForReplicationProtectedItemInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateApplianceForReplicationProtectedItemInput.PowerShell.cs new file mode 100644 index 000000000000..aaeffd71ca27 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateApplianceForReplicationProtectedItemInput.PowerShell.cs @@ -0,0 +1,173 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Update appliance for replication protected item input. + [System.ComponentModel.TypeConverter(typeof(UpdateApplianceForReplicationProtectedItemInputTypeConverter))] + public partial class UpdateApplianceForReplicationProtectedItemInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new UpdateApplianceForReplicationProtectedItemInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new UpdateApplianceForReplicationProtectedItemInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from + /// a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal UpdateApplianceForReplicationProtectedItemInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemInputInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemInputProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemInputInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateApplianceForReplicationProtectedItemInputPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemInputInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemProviderSpecificInput) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemInputInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateApplianceForReplicationProtectedItemProviderSpecificInputTypeConverter.ConvertFrom); + } + if (content.Contains("TargetApplianceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemInputInternal)this).TargetApplianceId = (string) content.GetValueForProperty("TargetApplianceId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemInputInternal)this).TargetApplianceId, global::System.Convert.ToString); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemInputInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemInputInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal UpdateApplianceForReplicationProtectedItemInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemInputInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemInputProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemInputInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateApplianceForReplicationProtectedItemInputPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemInputInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemProviderSpecificInput) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemInputInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateApplianceForReplicationProtectedItemProviderSpecificInputTypeConverter.ConvertFrom); + } + if (content.Contains("TargetApplianceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemInputInternal)this).TargetApplianceId = (string) content.GetValueForProperty("TargetApplianceId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemInputInternal)this).TargetApplianceId, global::System.Convert.ToString); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemInputInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemInputInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + } + /// Update appliance for replication protected item input. + [System.ComponentModel.TypeConverter(typeof(UpdateApplianceForReplicationProtectedItemInputTypeConverter))] + public partial interface IUpdateApplianceForReplicationProtectedItemInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateApplianceForReplicationProtectedItemInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateApplianceForReplicationProtectedItemInput.TypeConverter.cs new file mode 100644 index 000000000000..6ee3f43b3db0 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateApplianceForReplicationProtectedItemInput.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class UpdateApplianceForReplicationProtectedItemInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, + /// otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return UpdateApplianceForReplicationProtectedItemInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return UpdateApplianceForReplicationProtectedItemInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return UpdateApplianceForReplicationProtectedItemInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateApplianceForReplicationProtectedItemInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateApplianceForReplicationProtectedItemInput.cs new file mode 100644 index 000000000000..838afd1d64b2 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateApplianceForReplicationProtectedItemInput.cs @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Update appliance for replication protected item input. + public partial class UpdateApplianceForReplicationProtectedItemInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemInputInternal + { + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemInputProperties Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemInputInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateApplianceForReplicationProtectedItemInputProperties()); set { {_property = value;} } } + + /// Internal Acessors for ProviderSpecificDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemProviderSpecificInput Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemInputInternal.ProviderSpecificDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemInputPropertiesInternal)Property).ProviderSpecificDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemInputPropertiesInternal)Property).ProviderSpecificDetail = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemInputProperties _property; + + /// Update appliance replication protected item properties. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemInputProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateApplianceForReplicationProtectedItemInputProperties()); set => this._property = value; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ProviderSpecificDetailInstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemInputPropertiesInternal)Property).ProviderSpecificDetailInstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemInputPropertiesInternal)Property).ProviderSpecificDetailInstanceType = value ; } + + /// The target appliance Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string TargetApplianceId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemInputPropertiesInternal)Property).TargetApplianceId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemInputPropertiesInternal)Property).TargetApplianceId = value ; } + + /// + /// Creates an new instance. + /// + public UpdateApplianceForReplicationProtectedItemInput() + { + + } + } + /// Update appliance for replication protected item input. + public partial interface IUpdateApplianceForReplicationProtectedItemInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string ProviderSpecificDetailInstanceType { get; set; } + /// The target appliance Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The target appliance Id.", + SerializedName = @"targetApplianceId", + PossibleTypes = new [] { typeof(string) })] + string TargetApplianceId { get; set; } + + } + /// Update appliance for replication protected item input. + internal partial interface IUpdateApplianceForReplicationProtectedItemInputInternal + + { + /// Update appliance replication protected item properties. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemInputProperties Property { get; set; } + /// The provider specific input to update replication protected item. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemProviderSpecificInput ProviderSpecificDetail { get; set; } + /// The class type. + string ProviderSpecificDetailInstanceType { get; set; } + /// The target appliance Id. + string TargetApplianceId { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateApplianceForReplicationProtectedItemInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateApplianceForReplicationProtectedItemInput.json.cs new file mode 100644 index 000000000000..d386b38f505b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateApplianceForReplicationProtectedItemInput.json.cs @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Update appliance for replication protected item input. + public partial class UpdateApplianceForReplicationProtectedItemInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new UpdateApplianceForReplicationProtectedItemInput(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal UpdateApplianceForReplicationProtectedItemInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateApplianceForReplicationProtectedItemInputProperties.FromJson(__jsonProperties) : Property;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateApplianceForReplicationProtectedItemInputProperties.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateApplianceForReplicationProtectedItemInputProperties.PowerShell.cs new file mode 100644 index 000000000000..b84d58e86a09 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateApplianceForReplicationProtectedItemInputProperties.PowerShell.cs @@ -0,0 +1,165 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Update appliance for protected item input properties. + [System.ComponentModel.TypeConverter(typeof(UpdateApplianceForReplicationProtectedItemInputPropertiesTypeConverter))] + public partial class UpdateApplianceForReplicationProtectedItemInputProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemInputProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new UpdateApplianceForReplicationProtectedItemInputProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemInputProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new UpdateApplianceForReplicationProtectedItemInputProperties(content); + } + + /// + /// Creates a new instance of , deserializing the + /// content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemInputProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal UpdateApplianceForReplicationProtectedItemInputProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemInputPropertiesInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemProviderSpecificInput) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemInputPropertiesInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateApplianceForReplicationProtectedItemProviderSpecificInputTypeConverter.ConvertFrom); + } + if (content.Contains("TargetApplianceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemInputPropertiesInternal)this).TargetApplianceId = (string) content.GetValueForProperty("TargetApplianceId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemInputPropertiesInternal)this).TargetApplianceId, global::System.Convert.ToString); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemInputPropertiesInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemInputPropertiesInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal UpdateApplianceForReplicationProtectedItemInputProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemInputPropertiesInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemProviderSpecificInput) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemInputPropertiesInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateApplianceForReplicationProtectedItemProviderSpecificInputTypeConverter.ConvertFrom); + } + if (content.Contains("TargetApplianceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemInputPropertiesInternal)this).TargetApplianceId = (string) content.GetValueForProperty("TargetApplianceId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemInputPropertiesInternal)this).TargetApplianceId, global::System.Convert.ToString); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemInputPropertiesInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemInputPropertiesInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + } + /// Update appliance for protected item input properties. + [System.ComponentModel.TypeConverter(typeof(UpdateApplianceForReplicationProtectedItemInputPropertiesTypeConverter))] + public partial interface IUpdateApplianceForReplicationProtectedItemInputProperties + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateApplianceForReplicationProtectedItemInputProperties.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateApplianceForReplicationProtectedItemInputProperties.TypeConverter.cs new file mode 100644 index 000000000000..30238b40ed66 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateApplianceForReplicationProtectedItemInputProperties.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class UpdateApplianceForReplicationProtectedItemInputPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no + /// suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no + /// suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemInputProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemInputProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return UpdateApplianceForReplicationProtectedItemInputProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return UpdateApplianceForReplicationProtectedItemInputProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return UpdateApplianceForReplicationProtectedItemInputProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateApplianceForReplicationProtectedItemInputProperties.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateApplianceForReplicationProtectedItemInputProperties.cs new file mode 100644 index 000000000000..3a08e8b6c7c4 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateApplianceForReplicationProtectedItemInputProperties.cs @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Update appliance for protected item input properties. + public partial class UpdateApplianceForReplicationProtectedItemInputProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemInputProperties, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemInputPropertiesInternal + { + + /// Internal Acessors for ProviderSpecificDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemProviderSpecificInput Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemInputPropertiesInternal.ProviderSpecificDetail { get => (this._providerSpecificDetail = this._providerSpecificDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateApplianceForReplicationProtectedItemProviderSpecificInput()); set { {_providerSpecificDetail = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemProviderSpecificInput _providerSpecificDetail; + + /// The provider specific input to update replication protected item. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemProviderSpecificInput ProviderSpecificDetail { get => (this._providerSpecificDetail = this._providerSpecificDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateApplianceForReplicationProtectedItemProviderSpecificInput()); set => this._providerSpecificDetail = value; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ProviderSpecificDetailInstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemProviderSpecificInputInternal)ProviderSpecificDetail).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemProviderSpecificInputInternal)ProviderSpecificDetail).InstanceType = value ; } + + /// Backing field for property. + private string _targetApplianceId; + + /// The target appliance Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetApplianceId { get => this._targetApplianceId; set => this._targetApplianceId = value; } + + /// + /// Creates an new instance. + /// + public UpdateApplianceForReplicationProtectedItemInputProperties() + { + + } + } + /// Update appliance for protected item input properties. + public partial interface IUpdateApplianceForReplicationProtectedItemInputProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string ProviderSpecificDetailInstanceType { get; set; } + /// The target appliance Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The target appliance Id.", + SerializedName = @"targetApplianceId", + PossibleTypes = new [] { typeof(string) })] + string TargetApplianceId { get; set; } + + } + /// Update appliance for protected item input properties. + internal partial interface IUpdateApplianceForReplicationProtectedItemInputPropertiesInternal + + { + /// The provider specific input to update replication protected item. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemProviderSpecificInput ProviderSpecificDetail { get; set; } + /// The class type. + string ProviderSpecificDetailInstanceType { get; set; } + /// The target appliance Id. + string TargetApplianceId { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateApplianceForReplicationProtectedItemInputProperties.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateApplianceForReplicationProtectedItemInputProperties.json.cs new file mode 100644 index 000000000000..7658cc8b6fd2 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateApplianceForReplicationProtectedItemInputProperties.json.cs @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Update appliance for protected item input properties. + public partial class UpdateApplianceForReplicationProtectedItemInputProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemInputProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemInputProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemInputProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new UpdateApplianceForReplicationProtectedItemInputProperties(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._providerSpecificDetail ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._providerSpecificDetail.ToJson(null,serializationMode) : null, "providerSpecificDetails" ,container.Add ); + AddIf( null != (((object)this._targetApplianceId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetApplianceId.ToString()) : null, "targetApplianceId" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal UpdateApplianceForReplicationProtectedItemInputProperties(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_providerSpecificDetail = If( json?.PropertyT("providerSpecificDetails"), out var __jsonProviderSpecificDetails) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateApplianceForReplicationProtectedItemProviderSpecificInput.FromJson(__jsonProviderSpecificDetails) : ProviderSpecificDetail;} + {_targetApplianceId = If( json?.PropertyT("targetApplianceId"), out var __jsonTargetApplianceId) ? (string)__jsonTargetApplianceId : (string)TargetApplianceId;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateApplianceForReplicationProtectedItemProviderSpecificInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateApplianceForReplicationProtectedItemProviderSpecificInput.PowerShell.cs new file mode 100644 index 000000000000..6cd8408e177f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateApplianceForReplicationProtectedItemProviderSpecificInput.PowerShell.cs @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Update replication protected item provider specific input. + [System.ComponentModel.TypeConverter(typeof(UpdateApplianceForReplicationProtectedItemProviderSpecificInputTypeConverter))] + public partial class UpdateApplianceForReplicationProtectedItemProviderSpecificInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemProviderSpecificInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new UpdateApplianceForReplicationProtectedItemProviderSpecificInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemProviderSpecificInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new UpdateApplianceForReplicationProtectedItemProviderSpecificInput(content); + } + + /// + /// Creates a new instance of , deserializing + /// the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemProviderSpecificInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal UpdateApplianceForReplicationProtectedItemProviderSpecificInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal UpdateApplianceForReplicationProtectedItemProviderSpecificInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + } + /// Update replication protected item provider specific input. + [System.ComponentModel.TypeConverter(typeof(UpdateApplianceForReplicationProtectedItemProviderSpecificInputTypeConverter))] + public partial interface IUpdateApplianceForReplicationProtectedItemProviderSpecificInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateApplianceForReplicationProtectedItemProviderSpecificInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateApplianceForReplicationProtectedItemProviderSpecificInput.TypeConverter.cs new file mode 100644 index 000000000000..5dbc7191a091 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateApplianceForReplicationProtectedItemProviderSpecificInput.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class UpdateApplianceForReplicationProtectedItemProviderSpecificInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there + /// is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there + /// is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemProviderSpecificInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemProviderSpecificInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return UpdateApplianceForReplicationProtectedItemProviderSpecificInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return UpdateApplianceForReplicationProtectedItemProviderSpecificInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return UpdateApplianceForReplicationProtectedItemProviderSpecificInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateApplianceForReplicationProtectedItemProviderSpecificInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateApplianceForReplicationProtectedItemProviderSpecificInput.cs new file mode 100644 index 000000000000..a83b23429aa6 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateApplianceForReplicationProtectedItemProviderSpecificInput.cs @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Update replication protected item provider specific input. + public partial class UpdateApplianceForReplicationProtectedItemProviderSpecificInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemProviderSpecificInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemProviderSpecificInputInternal + { + + /// Backing field for property. + private string _instanceType; + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string InstanceType { get => this._instanceType; set => this._instanceType = value; } + + /// + /// Creates an new instance. + /// + public UpdateApplianceForReplicationProtectedItemProviderSpecificInput() + { + + } + } + /// Update replication protected item provider specific input. + public partial interface IUpdateApplianceForReplicationProtectedItemProviderSpecificInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string InstanceType { get; set; } + + } + /// Update replication protected item provider specific input. + internal partial interface IUpdateApplianceForReplicationProtectedItemProviderSpecificInputInternal + + { + /// The class type. + string InstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateApplianceForReplicationProtectedItemProviderSpecificInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateApplianceForReplicationProtectedItemProviderSpecificInput.json.cs new file mode 100644 index 000000000000..70ae88e20205 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateApplianceForReplicationProtectedItemProviderSpecificInput.json.cs @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Update replication protected item provider specific input. + public partial class UpdateApplianceForReplicationProtectedItemProviderSpecificInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemProviderSpecificInput. + /// Note: the Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemProviderSpecificInput + /// interface is polymorphic, and the precise model class that will get deserialized is determined at runtime based on the + /// payload. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemProviderSpecificInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemProviderSpecificInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + if (!(node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json)) + { + return null; + } + // Polymorphic type -- select the appropriate constructor using the discriminator + + switch ( json.StringProperty("instanceType") ) + { + case "InMageRcm": + { + return new InMageRcmUpdateApplianceForReplicationProtectedItemInput(json); + } + } + return new UpdateApplianceForReplicationProtectedItemProviderSpecificInput(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._instanceType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._instanceType.ToString()) : null, "instanceType" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal UpdateApplianceForReplicationProtectedItemProviderSpecificInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_instanceType = If( json?.PropertyT("instanceType"), out var __jsonInstanceType) ? (string)__jsonInstanceType : (string)InstanceType;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateDiskInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateDiskInput.PowerShell.cs new file mode 100644 index 000000000000..b3c83ead45d1 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateDiskInput.PowerShell.cs @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Disk input for update. + [System.ComponentModel.TypeConverter(typeof(UpdateDiskInputTypeConverter))] + public partial class UpdateDiskInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateDiskInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new UpdateDiskInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateDiskInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new UpdateDiskInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateDiskInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal UpdateDiskInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DiskId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateDiskInputInternal)this).DiskId = (string) content.GetValueForProperty("DiskId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateDiskInputInternal)this).DiskId, global::System.Convert.ToString); + } + if (content.Contains("TargetDiskName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateDiskInputInternal)this).TargetDiskName = (string) content.GetValueForProperty("TargetDiskName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateDiskInputInternal)this).TargetDiskName, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal UpdateDiskInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DiskId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateDiskInputInternal)this).DiskId = (string) content.GetValueForProperty("DiskId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateDiskInputInternal)this).DiskId, global::System.Convert.ToString); + } + if (content.Contains("TargetDiskName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateDiskInputInternal)this).TargetDiskName = (string) content.GetValueForProperty("TargetDiskName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateDiskInputInternal)this).TargetDiskName, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + } + /// Disk input for update. + [System.ComponentModel.TypeConverter(typeof(UpdateDiskInputTypeConverter))] + public partial interface IUpdateDiskInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateDiskInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateDiskInput.TypeConverter.cs new file mode 100644 index 000000000000..5c6138d74d0b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateDiskInput.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class UpdateDiskInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateDiskInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateDiskInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return UpdateDiskInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return UpdateDiskInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return UpdateDiskInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateDiskInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateDiskInput.cs new file mode 100644 index 000000000000..2dfd5867fa6c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateDiskInput.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Disk input for update. + public partial class UpdateDiskInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateDiskInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateDiskInputInternal + { + + /// Backing field for property. + private string _diskId; + + /// The disk Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string DiskId { get => this._diskId; set => this._diskId = value; } + + /// Backing field for property. + private string _targetDiskName; + + /// The target disk name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetDiskName { get => this._targetDiskName; set => this._targetDiskName = value; } + + /// Creates an new instance. + public UpdateDiskInput() + { + + } + } + /// Disk input for update. + public partial interface IUpdateDiskInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The disk Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The disk Id.", + SerializedName = @"diskId", + PossibleTypes = new [] { typeof(string) })] + string DiskId { get; set; } + /// The target disk name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target disk name.", + SerializedName = @"targetDiskName", + PossibleTypes = new [] { typeof(string) })] + string TargetDiskName { get; set; } + + } + /// Disk input for update. + internal partial interface IUpdateDiskInputInternal + + { + /// The disk Id. + string DiskId { get; set; } + /// The target disk name. + string TargetDiskName { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateDiskInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateDiskInput.json.cs new file mode 100644 index 000000000000..59c7cb59f1e0 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateDiskInput.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Disk input for update. + public partial class UpdateDiskInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateDiskInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateDiskInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateDiskInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new UpdateDiskInput(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._diskId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._diskId.ToString()) : null, "diskId" ,container.Add ); + AddIf( null != (((object)this._targetDiskName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetDiskName.ToString()) : null, "targetDiskName" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal UpdateDiskInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_diskId = If( json?.PropertyT("diskId"), out var __jsonDiskId) ? (string)__jsonDiskId : (string)DiskId;} + {_targetDiskName = If( json?.PropertyT("targetDiskName"), out var __jsonTargetDiskName) ? (string)__jsonTargetDiskName : (string)TargetDiskName;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateMigrationItemInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateMigrationItemInput.PowerShell.cs new file mode 100644 index 000000000000..ec118c705419 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateMigrationItemInput.PowerShell.cs @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Update migration item input. + [System.ComponentModel.TypeConverter(typeof(UpdateMigrationItemInputTypeConverter))] + public partial class UpdateMigrationItemInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMigrationItemInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new UpdateMigrationItemInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMigrationItemInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new UpdateMigrationItemInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMigrationItemInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal UpdateMigrationItemInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMigrationItemInputInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMigrationItemInputProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMigrationItemInputInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateMigrationItemInputPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMigrationItemInputInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMigrationItemProviderSpecificInput) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMigrationItemInputInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateMigrationItemProviderSpecificInputTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMigrationItemInputInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMigrationItemInputInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal UpdateMigrationItemInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMigrationItemInputInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMigrationItemInputProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMigrationItemInputInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateMigrationItemInputPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMigrationItemInputInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMigrationItemProviderSpecificInput) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMigrationItemInputInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateMigrationItemProviderSpecificInputTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMigrationItemInputInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMigrationItemInputInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + } + /// Update migration item input. + [System.ComponentModel.TypeConverter(typeof(UpdateMigrationItemInputTypeConverter))] + public partial interface IUpdateMigrationItemInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateMigrationItemInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateMigrationItemInput.TypeConverter.cs new file mode 100644 index 000000000000..514b6fe5a452 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateMigrationItemInput.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class UpdateMigrationItemInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMigrationItemInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMigrationItemInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return UpdateMigrationItemInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return UpdateMigrationItemInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return UpdateMigrationItemInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateMigrationItemInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateMigrationItemInput.cs new file mode 100644 index 000000000000..8ca1b6c07d1e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateMigrationItemInput.cs @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Update migration item input. + public partial class UpdateMigrationItemInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMigrationItemInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMigrationItemInputInternal + { + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMigrationItemInputProperties Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMigrationItemInputInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateMigrationItemInputProperties()); set { {_property = value;} } } + + /// Internal Acessors for ProviderSpecificDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMigrationItemProviderSpecificInput Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMigrationItemInputInternal.ProviderSpecificDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMigrationItemInputPropertiesInternal)Property).ProviderSpecificDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMigrationItemInputPropertiesInternal)Property).ProviderSpecificDetail = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMigrationItemInputProperties _property; + + /// Update migration item input properties. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMigrationItemInputProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateMigrationItemInputProperties()); set => this._property = value; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ProviderSpecificDetailInstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMigrationItemInputPropertiesInternal)Property).ProviderSpecificDetailInstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMigrationItemInputPropertiesInternal)Property).ProviderSpecificDetailInstanceType = value ?? null; } + + /// Creates an new instance. + public UpdateMigrationItemInput() + { + + } + } + /// Update migration item input. + public partial interface IUpdateMigrationItemInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string ProviderSpecificDetailInstanceType { get; set; } + + } + /// Update migration item input. + internal partial interface IUpdateMigrationItemInputInternal + + { + /// Update migration item input properties. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMigrationItemInputProperties Property { get; set; } + /// The provider specific input to update migration item. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMigrationItemProviderSpecificInput ProviderSpecificDetail { get; set; } + /// The class type. + string ProviderSpecificDetailInstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateMigrationItemInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateMigrationItemInput.json.cs new file mode 100644 index 000000000000..2639295a1436 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateMigrationItemInput.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Update migration item input. + public partial class UpdateMigrationItemInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMigrationItemInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMigrationItemInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMigrationItemInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new UpdateMigrationItemInput(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal UpdateMigrationItemInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateMigrationItemInputProperties.FromJson(__jsonProperties) : Property;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateMigrationItemInputProperties.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateMigrationItemInputProperties.PowerShell.cs new file mode 100644 index 000000000000..d86fa8fc3c7f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateMigrationItemInputProperties.PowerShell.cs @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Update migration item input properties. + [System.ComponentModel.TypeConverter(typeof(UpdateMigrationItemInputPropertiesTypeConverter))] + public partial class UpdateMigrationItemInputProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMigrationItemInputProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new UpdateMigrationItemInputProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMigrationItemInputProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new UpdateMigrationItemInputProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMigrationItemInputProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal UpdateMigrationItemInputProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMigrationItemInputPropertiesInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMigrationItemProviderSpecificInput) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMigrationItemInputPropertiesInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateMigrationItemProviderSpecificInputTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMigrationItemInputPropertiesInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMigrationItemInputPropertiesInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal UpdateMigrationItemInputProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMigrationItemInputPropertiesInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMigrationItemProviderSpecificInput) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMigrationItemInputPropertiesInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateMigrationItemProviderSpecificInputTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMigrationItemInputPropertiesInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMigrationItemInputPropertiesInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + } + /// Update migration item input properties. + [System.ComponentModel.TypeConverter(typeof(UpdateMigrationItemInputPropertiesTypeConverter))] + public partial interface IUpdateMigrationItemInputProperties + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateMigrationItemInputProperties.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateMigrationItemInputProperties.TypeConverter.cs new file mode 100644 index 000000000000..f147550856ae --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateMigrationItemInputProperties.TypeConverter.cs @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class UpdateMigrationItemInputPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMigrationItemInputProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMigrationItemInputProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return UpdateMigrationItemInputProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return UpdateMigrationItemInputProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return UpdateMigrationItemInputProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateMigrationItemInputProperties.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateMigrationItemInputProperties.cs new file mode 100644 index 000000000000..ba81587a3fec --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateMigrationItemInputProperties.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Update migration item input properties. + public partial class UpdateMigrationItemInputProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMigrationItemInputProperties, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMigrationItemInputPropertiesInternal + { + + /// Internal Acessors for ProviderSpecificDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMigrationItemProviderSpecificInput Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMigrationItemInputPropertiesInternal.ProviderSpecificDetail { get => (this._providerSpecificDetail = this._providerSpecificDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateMigrationItemProviderSpecificInput()); set { {_providerSpecificDetail = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMigrationItemProviderSpecificInput _providerSpecificDetail; + + /// The provider specific input to update migration item. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMigrationItemProviderSpecificInput ProviderSpecificDetail { get => (this._providerSpecificDetail = this._providerSpecificDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateMigrationItemProviderSpecificInput()); set => this._providerSpecificDetail = value; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ProviderSpecificDetailInstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMigrationItemProviderSpecificInputInternal)ProviderSpecificDetail).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMigrationItemProviderSpecificInputInternal)ProviderSpecificDetail).InstanceType = value ; } + + /// Creates an new instance. + public UpdateMigrationItemInputProperties() + { + + } + } + /// Update migration item input properties. + public partial interface IUpdateMigrationItemInputProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string ProviderSpecificDetailInstanceType { get; set; } + + } + /// Update migration item input properties. + internal partial interface IUpdateMigrationItemInputPropertiesInternal + + { + /// The provider specific input to update migration item. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMigrationItemProviderSpecificInput ProviderSpecificDetail { get; set; } + /// The class type. + string ProviderSpecificDetailInstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateMigrationItemInputProperties.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateMigrationItemInputProperties.json.cs new file mode 100644 index 000000000000..00620bb3c217 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateMigrationItemInputProperties.json.cs @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Update migration item input properties. + public partial class UpdateMigrationItemInputProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMigrationItemInputProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMigrationItemInputProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMigrationItemInputProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new UpdateMigrationItemInputProperties(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._providerSpecificDetail ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._providerSpecificDetail.ToJson(null,serializationMode) : null, "providerSpecificDetails" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal UpdateMigrationItemInputProperties(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_providerSpecificDetail = If( json?.PropertyT("providerSpecificDetails"), out var __jsonProviderSpecificDetails) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateMigrationItemProviderSpecificInput.FromJson(__jsonProviderSpecificDetails) : ProviderSpecificDetail;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateMigrationItemProviderSpecificInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateMigrationItemProviderSpecificInput.PowerShell.cs new file mode 100644 index 000000000000..c8f051c793d3 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateMigrationItemProviderSpecificInput.PowerShell.cs @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Update migration item provider specific input. + [System.ComponentModel.TypeConverter(typeof(UpdateMigrationItemProviderSpecificInputTypeConverter))] + public partial class UpdateMigrationItemProviderSpecificInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMigrationItemProviderSpecificInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new UpdateMigrationItemProviderSpecificInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMigrationItemProviderSpecificInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new UpdateMigrationItemProviderSpecificInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json + /// string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMigrationItemProviderSpecificInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal UpdateMigrationItemProviderSpecificInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMigrationItemProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMigrationItemProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal UpdateMigrationItemProviderSpecificInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMigrationItemProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMigrationItemProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + } + /// Update migration item provider specific input. + [System.ComponentModel.TypeConverter(typeof(UpdateMigrationItemProviderSpecificInputTypeConverter))] + public partial interface IUpdateMigrationItemProviderSpecificInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateMigrationItemProviderSpecificInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateMigrationItemProviderSpecificInput.TypeConverter.cs new file mode 100644 index 000000000000..5ad6d7c4259c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateMigrationItemProviderSpecificInput.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class UpdateMigrationItemProviderSpecificInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMigrationItemProviderSpecificInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMigrationItemProviderSpecificInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return UpdateMigrationItemProviderSpecificInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return UpdateMigrationItemProviderSpecificInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return UpdateMigrationItemProviderSpecificInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateMigrationItemProviderSpecificInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateMigrationItemProviderSpecificInput.cs new file mode 100644 index 000000000000..f9343902952f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateMigrationItemProviderSpecificInput.cs @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Update migration item provider specific input. + public partial class UpdateMigrationItemProviderSpecificInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMigrationItemProviderSpecificInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMigrationItemProviderSpecificInputInternal + { + + /// Backing field for property. + private string _instanceType; + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string InstanceType { get => this._instanceType; set => this._instanceType = value; } + + /// + /// Creates an new instance. + /// + public UpdateMigrationItemProviderSpecificInput() + { + + } + } + /// Update migration item provider specific input. + public partial interface IUpdateMigrationItemProviderSpecificInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string InstanceType { get; set; } + + } + /// Update migration item provider specific input. + internal partial interface IUpdateMigrationItemProviderSpecificInputInternal + + { + /// The class type. + string InstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateMigrationItemProviderSpecificInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateMigrationItemProviderSpecificInput.json.cs new file mode 100644 index 000000000000..f1480bc96bb2 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateMigrationItemProviderSpecificInput.json.cs @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Update migration item provider specific input. + public partial class UpdateMigrationItemProviderSpecificInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMigrationItemProviderSpecificInput. + /// Note: the Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMigrationItemProviderSpecificInput interface + /// is polymorphic, and the precise model class that will get deserialized is determined at runtime based on the payload. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMigrationItemProviderSpecificInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMigrationItemProviderSpecificInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + if (!(node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json)) + { + return null; + } + // Polymorphic type -- select the appropriate constructor using the discriminator + + switch ( json.StringProperty("instanceType") ) + { + case "VMwareCbt": + { + return new VMwareCbtUpdateMigrationItemInput(json); + } + } + return new UpdateMigrationItemProviderSpecificInput(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._instanceType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._instanceType.ToString()) : null, "instanceType" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal UpdateMigrationItemProviderSpecificInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_instanceType = If( json?.PropertyT("instanceType"), out var __jsonInstanceType) ? (string)__jsonInstanceType : (string)InstanceType;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateMobilityServiceRequest.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateMobilityServiceRequest.PowerShell.cs new file mode 100644 index 000000000000..77f45477746c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateMobilityServiceRequest.PowerShell.cs @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Request to update the mobility service on a protected item. + [System.ComponentModel.TypeConverter(typeof(UpdateMobilityServiceRequestTypeConverter))] + public partial class UpdateMobilityServiceRequest + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMobilityServiceRequest DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new UpdateMobilityServiceRequest(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMobilityServiceRequest DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new UpdateMobilityServiceRequest(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMobilityServiceRequest FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal UpdateMobilityServiceRequest(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMobilityServiceRequestInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMobilityServiceRequestProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMobilityServiceRequestInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateMobilityServiceRequestPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("RunAsAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMobilityServiceRequestInternal)this).RunAsAccountId = (string) content.GetValueForProperty("RunAsAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMobilityServiceRequestInternal)this).RunAsAccountId, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal UpdateMobilityServiceRequest(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMobilityServiceRequestInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMobilityServiceRequestProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMobilityServiceRequestInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateMobilityServiceRequestPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("RunAsAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMobilityServiceRequestInternal)this).RunAsAccountId = (string) content.GetValueForProperty("RunAsAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMobilityServiceRequestInternal)this).RunAsAccountId, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + } + /// Request to update the mobility service on a protected item. + [System.ComponentModel.TypeConverter(typeof(UpdateMobilityServiceRequestTypeConverter))] + public partial interface IUpdateMobilityServiceRequest + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateMobilityServiceRequest.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateMobilityServiceRequest.TypeConverter.cs new file mode 100644 index 000000000000..840d2d9d1e42 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateMobilityServiceRequest.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class UpdateMobilityServiceRequestTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMobilityServiceRequest ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMobilityServiceRequest).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return UpdateMobilityServiceRequest.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return UpdateMobilityServiceRequest.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return UpdateMobilityServiceRequest.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateMobilityServiceRequest.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateMobilityServiceRequest.cs new file mode 100644 index 000000000000..6337121e4e93 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateMobilityServiceRequest.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Request to update the mobility service on a protected item. + public partial class UpdateMobilityServiceRequest : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMobilityServiceRequest, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMobilityServiceRequestInternal + { + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMobilityServiceRequestProperties Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMobilityServiceRequestInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateMobilityServiceRequestProperties()); set { {_property = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMobilityServiceRequestProperties _property; + + /// The properties of the update mobility service request. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMobilityServiceRequestProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateMobilityServiceRequestProperties()); set => this._property = value; } + + /// The CS run as account Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string RunAsAccountId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMobilityServiceRequestPropertiesInternal)Property).RunAsAccountId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMobilityServiceRequestPropertiesInternal)Property).RunAsAccountId = value ?? null; } + + /// Creates an new instance. + public UpdateMobilityServiceRequest() + { + + } + } + /// Request to update the mobility service on a protected item. + public partial interface IUpdateMobilityServiceRequest : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The CS run as account Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The CS run as account Id.", + SerializedName = @"runAsAccountId", + PossibleTypes = new [] { typeof(string) })] + string RunAsAccountId { get; set; } + + } + /// Request to update the mobility service on a protected item. + internal partial interface IUpdateMobilityServiceRequestInternal + + { + /// The properties of the update mobility service request. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMobilityServiceRequestProperties Property { get; set; } + /// The CS run as account Id. + string RunAsAccountId { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateMobilityServiceRequest.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateMobilityServiceRequest.json.cs new file mode 100644 index 000000000000..67bb2064fe21 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateMobilityServiceRequest.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Request to update the mobility service on a protected item. + public partial class UpdateMobilityServiceRequest + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMobilityServiceRequest. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMobilityServiceRequest. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMobilityServiceRequest FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new UpdateMobilityServiceRequest(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal UpdateMobilityServiceRequest(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateMobilityServiceRequestProperties.FromJson(__jsonProperties) : Property;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateMobilityServiceRequestProperties.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateMobilityServiceRequestProperties.PowerShell.cs new file mode 100644 index 000000000000..4d38aad39206 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateMobilityServiceRequestProperties.PowerShell.cs @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// The properties of an update mobility service request. + [System.ComponentModel.TypeConverter(typeof(UpdateMobilityServiceRequestPropertiesTypeConverter))] + public partial class UpdateMobilityServiceRequestProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMobilityServiceRequestProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new UpdateMobilityServiceRequestProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMobilityServiceRequestProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new UpdateMobilityServiceRequestProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json + /// string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMobilityServiceRequestProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal UpdateMobilityServiceRequestProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("RunAsAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMobilityServiceRequestPropertiesInternal)this).RunAsAccountId = (string) content.GetValueForProperty("RunAsAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMobilityServiceRequestPropertiesInternal)this).RunAsAccountId, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal UpdateMobilityServiceRequestProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("RunAsAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMobilityServiceRequestPropertiesInternal)this).RunAsAccountId = (string) content.GetValueForProperty("RunAsAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMobilityServiceRequestPropertiesInternal)this).RunAsAccountId, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + } + /// The properties of an update mobility service request. + [System.ComponentModel.TypeConverter(typeof(UpdateMobilityServiceRequestPropertiesTypeConverter))] + public partial interface IUpdateMobilityServiceRequestProperties + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateMobilityServiceRequestProperties.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateMobilityServiceRequestProperties.TypeConverter.cs new file mode 100644 index 000000000000..f05b4db4f27b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateMobilityServiceRequestProperties.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class UpdateMobilityServiceRequestPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMobilityServiceRequestProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMobilityServiceRequestProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return UpdateMobilityServiceRequestProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return UpdateMobilityServiceRequestProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return UpdateMobilityServiceRequestProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateMobilityServiceRequestProperties.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateMobilityServiceRequestProperties.cs new file mode 100644 index 000000000000..eb5dbea46ec9 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateMobilityServiceRequestProperties.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The properties of an update mobility service request. + public partial class UpdateMobilityServiceRequestProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMobilityServiceRequestProperties, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMobilityServiceRequestPropertiesInternal + { + + /// Backing field for property. + private string _runAsAccountId; + + /// The CS run as account Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RunAsAccountId { get => this._runAsAccountId; set => this._runAsAccountId = value; } + + /// Creates an new instance. + public UpdateMobilityServiceRequestProperties() + { + + } + } + /// The properties of an update mobility service request. + public partial interface IUpdateMobilityServiceRequestProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The CS run as account Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The CS run as account Id.", + SerializedName = @"runAsAccountId", + PossibleTypes = new [] { typeof(string) })] + string RunAsAccountId { get; set; } + + } + /// The properties of an update mobility service request. + internal partial interface IUpdateMobilityServiceRequestPropertiesInternal + + { + /// The CS run as account Id. + string RunAsAccountId { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateMobilityServiceRequestProperties.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateMobilityServiceRequestProperties.json.cs new file mode 100644 index 000000000000..d96c0f2c9727 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateMobilityServiceRequestProperties.json.cs @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The properties of an update mobility service request. + public partial class UpdateMobilityServiceRequestProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMobilityServiceRequestProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMobilityServiceRequestProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMobilityServiceRequestProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new UpdateMobilityServiceRequestProperties(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._runAsAccountId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._runAsAccountId.ToString()) : null, "runAsAccountId" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal UpdateMobilityServiceRequestProperties(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_runAsAccountId = If( json?.PropertyT("runAsAccountId"), out var __jsonRunAsAccountId) ? (string)__jsonRunAsAccountId : (string)RunAsAccountId;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateNetworkMappingInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateNetworkMappingInput.PowerShell.cs new file mode 100644 index 000000000000..96d2fb073a59 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateNetworkMappingInput.PowerShell.cs @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Update network mapping input. + [System.ComponentModel.TypeConverter(typeof(UpdateNetworkMappingInputTypeConverter))] + public partial class UpdateNetworkMappingInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateNetworkMappingInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new UpdateNetworkMappingInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateNetworkMappingInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new UpdateNetworkMappingInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateNetworkMappingInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal UpdateNetworkMappingInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateNetworkMappingInputInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateNetworkMappingInputProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateNetworkMappingInputInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateNetworkMappingInputPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("FabricSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateNetworkMappingInputInternal)this).FabricSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificUpdateNetworkMappingInput) content.GetValueForProperty("FabricSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateNetworkMappingInputInternal)this).FabricSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FabricSpecificUpdateNetworkMappingInputTypeConverter.ConvertFrom); + } + if (content.Contains("RecoveryFabricName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateNetworkMappingInputInternal)this).RecoveryFabricName = (string) content.GetValueForProperty("RecoveryFabricName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateNetworkMappingInputInternal)this).RecoveryFabricName, global::System.Convert.ToString); + } + if (content.Contains("RecoveryNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateNetworkMappingInputInternal)this).RecoveryNetworkId = (string) content.GetValueForProperty("RecoveryNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateNetworkMappingInputInternal)this).RecoveryNetworkId, global::System.Convert.ToString); + } + if (content.Contains("FabricSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateNetworkMappingInputInternal)this).FabricSpecificDetailInstanceType = (string) content.GetValueForProperty("FabricSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateNetworkMappingInputInternal)this).FabricSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal UpdateNetworkMappingInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateNetworkMappingInputInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateNetworkMappingInputProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateNetworkMappingInputInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateNetworkMappingInputPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("FabricSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateNetworkMappingInputInternal)this).FabricSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificUpdateNetworkMappingInput) content.GetValueForProperty("FabricSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateNetworkMappingInputInternal)this).FabricSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FabricSpecificUpdateNetworkMappingInputTypeConverter.ConvertFrom); + } + if (content.Contains("RecoveryFabricName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateNetworkMappingInputInternal)this).RecoveryFabricName = (string) content.GetValueForProperty("RecoveryFabricName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateNetworkMappingInputInternal)this).RecoveryFabricName, global::System.Convert.ToString); + } + if (content.Contains("RecoveryNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateNetworkMappingInputInternal)this).RecoveryNetworkId = (string) content.GetValueForProperty("RecoveryNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateNetworkMappingInputInternal)this).RecoveryNetworkId, global::System.Convert.ToString); + } + if (content.Contains("FabricSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateNetworkMappingInputInternal)this).FabricSpecificDetailInstanceType = (string) content.GetValueForProperty("FabricSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateNetworkMappingInputInternal)this).FabricSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + } + /// Update network mapping input. + [System.ComponentModel.TypeConverter(typeof(UpdateNetworkMappingInputTypeConverter))] + public partial interface IUpdateNetworkMappingInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateNetworkMappingInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateNetworkMappingInput.TypeConverter.cs new file mode 100644 index 000000000000..105466f0dc0c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateNetworkMappingInput.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class UpdateNetworkMappingInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateNetworkMappingInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateNetworkMappingInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return UpdateNetworkMappingInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return UpdateNetworkMappingInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return UpdateNetworkMappingInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateNetworkMappingInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateNetworkMappingInput.cs new file mode 100644 index 000000000000..bce53ddc702c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateNetworkMappingInput.cs @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Update network mapping input. + public partial class UpdateNetworkMappingInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateNetworkMappingInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateNetworkMappingInputInternal + { + + /// The instance type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string FabricSpecificDetailInstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateNetworkMappingInputPropertiesInternal)Property).FabricSpecificDetailInstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateNetworkMappingInputPropertiesInternal)Property).FabricSpecificDetailInstanceType = value ?? null; } + + /// Internal Acessors for FabricSpecificDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificUpdateNetworkMappingInput Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateNetworkMappingInputInternal.FabricSpecificDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateNetworkMappingInputPropertiesInternal)Property).FabricSpecificDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateNetworkMappingInputPropertiesInternal)Property).FabricSpecificDetail = value; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateNetworkMappingInputProperties Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateNetworkMappingInputInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateNetworkMappingInputProperties()); set { {_property = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateNetworkMappingInputProperties _property; + + /// The input properties needed to update network mapping. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateNetworkMappingInputProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateNetworkMappingInputProperties()); set => this._property = value; } + + /// Recovery fabric name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string RecoveryFabricName { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateNetworkMappingInputPropertiesInternal)Property).RecoveryFabricName; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateNetworkMappingInputPropertiesInternal)Property).RecoveryFabricName = value ?? null; } + + /// Recovery network Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string RecoveryNetworkId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateNetworkMappingInputPropertiesInternal)Property).RecoveryNetworkId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateNetworkMappingInputPropertiesInternal)Property).RecoveryNetworkId = value ?? null; } + + /// Creates an new instance. + public UpdateNetworkMappingInput() + { + + } + } + /// Update network mapping input. + public partial interface IUpdateNetworkMappingInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The instance type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The instance type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string FabricSpecificDetailInstanceType { get; set; } + /// Recovery fabric name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Recovery fabric name.", + SerializedName = @"recoveryFabricName", + PossibleTypes = new [] { typeof(string) })] + string RecoveryFabricName { get; set; } + /// Recovery network Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Recovery network Id.", + SerializedName = @"recoveryNetworkId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryNetworkId { get; set; } + + } + /// Update network mapping input. + internal partial interface IUpdateNetworkMappingInputInternal + + { + /// Fabrics specific input network Id. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificUpdateNetworkMappingInput FabricSpecificDetail { get; set; } + /// The instance type. + string FabricSpecificDetailInstanceType { get; set; } + /// The input properties needed to update network mapping. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateNetworkMappingInputProperties Property { get; set; } + /// Recovery fabric name. + string RecoveryFabricName { get; set; } + /// Recovery network Id. + string RecoveryNetworkId { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateNetworkMappingInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateNetworkMappingInput.json.cs new file mode 100644 index 000000000000..0fd0951f518b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateNetworkMappingInput.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Update network mapping input. + public partial class UpdateNetworkMappingInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateNetworkMappingInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateNetworkMappingInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateNetworkMappingInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new UpdateNetworkMappingInput(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal UpdateNetworkMappingInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateNetworkMappingInputProperties.FromJson(__jsonProperties) : Property;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateNetworkMappingInputProperties.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateNetworkMappingInputProperties.PowerShell.cs new file mode 100644 index 000000000000..af313deb0d89 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateNetworkMappingInputProperties.PowerShell.cs @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Common input details for network mapping operation. + [System.ComponentModel.TypeConverter(typeof(UpdateNetworkMappingInputPropertiesTypeConverter))] + public partial class UpdateNetworkMappingInputProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateNetworkMappingInputProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new UpdateNetworkMappingInputProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateNetworkMappingInputProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new UpdateNetworkMappingInputProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateNetworkMappingInputProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal UpdateNetworkMappingInputProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("FabricSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateNetworkMappingInputPropertiesInternal)this).FabricSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificUpdateNetworkMappingInput) content.GetValueForProperty("FabricSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateNetworkMappingInputPropertiesInternal)this).FabricSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FabricSpecificUpdateNetworkMappingInputTypeConverter.ConvertFrom); + } + if (content.Contains("RecoveryFabricName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateNetworkMappingInputPropertiesInternal)this).RecoveryFabricName = (string) content.GetValueForProperty("RecoveryFabricName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateNetworkMappingInputPropertiesInternal)this).RecoveryFabricName, global::System.Convert.ToString); + } + if (content.Contains("RecoveryNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateNetworkMappingInputPropertiesInternal)this).RecoveryNetworkId = (string) content.GetValueForProperty("RecoveryNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateNetworkMappingInputPropertiesInternal)this).RecoveryNetworkId, global::System.Convert.ToString); + } + if (content.Contains("FabricSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateNetworkMappingInputPropertiesInternal)this).FabricSpecificDetailInstanceType = (string) content.GetValueForProperty("FabricSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateNetworkMappingInputPropertiesInternal)this).FabricSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal UpdateNetworkMappingInputProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("FabricSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateNetworkMappingInputPropertiesInternal)this).FabricSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificUpdateNetworkMappingInput) content.GetValueForProperty("FabricSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateNetworkMappingInputPropertiesInternal)this).FabricSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FabricSpecificUpdateNetworkMappingInputTypeConverter.ConvertFrom); + } + if (content.Contains("RecoveryFabricName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateNetworkMappingInputPropertiesInternal)this).RecoveryFabricName = (string) content.GetValueForProperty("RecoveryFabricName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateNetworkMappingInputPropertiesInternal)this).RecoveryFabricName, global::System.Convert.ToString); + } + if (content.Contains("RecoveryNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateNetworkMappingInputPropertiesInternal)this).RecoveryNetworkId = (string) content.GetValueForProperty("RecoveryNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateNetworkMappingInputPropertiesInternal)this).RecoveryNetworkId, global::System.Convert.ToString); + } + if (content.Contains("FabricSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateNetworkMappingInputPropertiesInternal)this).FabricSpecificDetailInstanceType = (string) content.GetValueForProperty("FabricSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateNetworkMappingInputPropertiesInternal)this).FabricSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + } + /// Common input details for network mapping operation. + [System.ComponentModel.TypeConverter(typeof(UpdateNetworkMappingInputPropertiesTypeConverter))] + public partial interface IUpdateNetworkMappingInputProperties + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateNetworkMappingInputProperties.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateNetworkMappingInputProperties.TypeConverter.cs new file mode 100644 index 000000000000..7de8b6c3d06f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateNetworkMappingInputProperties.TypeConverter.cs @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class UpdateNetworkMappingInputPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateNetworkMappingInputProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateNetworkMappingInputProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return UpdateNetworkMappingInputProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return UpdateNetworkMappingInputProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return UpdateNetworkMappingInputProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateNetworkMappingInputProperties.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateNetworkMappingInputProperties.cs new file mode 100644 index 000000000000..655508aac794 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateNetworkMappingInputProperties.cs @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Common input details for network mapping operation. + public partial class UpdateNetworkMappingInputProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateNetworkMappingInputProperties, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateNetworkMappingInputPropertiesInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificUpdateNetworkMappingInput _fabricSpecificDetail; + + /// Fabrics specific input network Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificUpdateNetworkMappingInput FabricSpecificDetail { get => (this._fabricSpecificDetail = this._fabricSpecificDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FabricSpecificUpdateNetworkMappingInput()); set => this._fabricSpecificDetail = value; } + + /// The instance type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string FabricSpecificDetailInstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificUpdateNetworkMappingInputInternal)FabricSpecificDetail).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificUpdateNetworkMappingInputInternal)FabricSpecificDetail).InstanceType = value ?? null; } + + /// Internal Acessors for FabricSpecificDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificUpdateNetworkMappingInput Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateNetworkMappingInputPropertiesInternal.FabricSpecificDetail { get => (this._fabricSpecificDetail = this._fabricSpecificDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FabricSpecificUpdateNetworkMappingInput()); set { {_fabricSpecificDetail = value;} } } + + /// Backing field for property. + private string _recoveryFabricName; + + /// Recovery fabric name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryFabricName { get => this._recoveryFabricName; set => this._recoveryFabricName = value; } + + /// Backing field for property. + private string _recoveryNetworkId; + + /// Recovery network Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryNetworkId { get => this._recoveryNetworkId; set => this._recoveryNetworkId = value; } + + /// Creates an new instance. + public UpdateNetworkMappingInputProperties() + { + + } + } + /// Common input details for network mapping operation. + public partial interface IUpdateNetworkMappingInputProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The instance type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The instance type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string FabricSpecificDetailInstanceType { get; set; } + /// Recovery fabric name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Recovery fabric name.", + SerializedName = @"recoveryFabricName", + PossibleTypes = new [] { typeof(string) })] + string RecoveryFabricName { get; set; } + /// Recovery network Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Recovery network Id.", + SerializedName = @"recoveryNetworkId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryNetworkId { get; set; } + + } + /// Common input details for network mapping operation. + internal partial interface IUpdateNetworkMappingInputPropertiesInternal + + { + /// Fabrics specific input network Id. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificUpdateNetworkMappingInput FabricSpecificDetail { get; set; } + /// The instance type. + string FabricSpecificDetailInstanceType { get; set; } + /// Recovery fabric name. + string RecoveryFabricName { get; set; } + /// Recovery network Id. + string RecoveryNetworkId { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateNetworkMappingInputProperties.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateNetworkMappingInputProperties.json.cs new file mode 100644 index 000000000000..bac33506a6b0 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateNetworkMappingInputProperties.json.cs @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Common input details for network mapping operation. + public partial class UpdateNetworkMappingInputProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateNetworkMappingInputProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateNetworkMappingInputProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateNetworkMappingInputProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new UpdateNetworkMappingInputProperties(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._fabricSpecificDetail ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._fabricSpecificDetail.ToJson(null,serializationMode) : null, "fabricSpecificDetails" ,container.Add ); + AddIf( null != (((object)this._recoveryFabricName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryFabricName.ToString()) : null, "recoveryFabricName" ,container.Add ); + AddIf( null != (((object)this._recoveryNetworkId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryNetworkId.ToString()) : null, "recoveryNetworkId" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal UpdateNetworkMappingInputProperties(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_fabricSpecificDetail = If( json?.PropertyT("fabricSpecificDetails"), out var __jsonFabricSpecificDetails) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FabricSpecificUpdateNetworkMappingInput.FromJson(__jsonFabricSpecificDetails) : FabricSpecificDetail;} + {_recoveryFabricName = If( json?.PropertyT("recoveryFabricName"), out var __jsonRecoveryFabricName) ? (string)__jsonRecoveryFabricName : (string)RecoveryFabricName;} + {_recoveryNetworkId = If( json?.PropertyT("recoveryNetworkId"), out var __jsonRecoveryNetworkId) ? (string)__jsonRecoveryNetworkId : (string)RecoveryNetworkId;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdatePolicyInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdatePolicyInput.PowerShell.cs new file mode 100644 index 000000000000..1264b2cc9427 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdatePolicyInput.PowerShell.cs @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Update policy input. + [System.ComponentModel.TypeConverter(typeof(UpdatePolicyInputTypeConverter))] + public partial class UpdatePolicyInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdatePolicyInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new UpdatePolicyInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdatePolicyInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new UpdatePolicyInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdatePolicyInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal UpdatePolicyInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdatePolicyInputInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdatePolicyInputProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdatePolicyInputInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdatePolicyInputPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("ReplicationProviderSetting")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdatePolicyInputInternal)this).ReplicationProviderSetting = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInput) content.GetValueForProperty("ReplicationProviderSetting",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdatePolicyInputInternal)this).ReplicationProviderSetting, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PolicyProviderSpecificInputTypeConverter.ConvertFrom); + } + if (content.Contains("ReplicationProviderSettingInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdatePolicyInputInternal)this).ReplicationProviderSettingInstanceType = (string) content.GetValueForProperty("ReplicationProviderSettingInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdatePolicyInputInternal)this).ReplicationProviderSettingInstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal UpdatePolicyInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdatePolicyInputInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdatePolicyInputProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdatePolicyInputInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdatePolicyInputPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("ReplicationProviderSetting")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdatePolicyInputInternal)this).ReplicationProviderSetting = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInput) content.GetValueForProperty("ReplicationProviderSetting",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdatePolicyInputInternal)this).ReplicationProviderSetting, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PolicyProviderSpecificInputTypeConverter.ConvertFrom); + } + if (content.Contains("ReplicationProviderSettingInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdatePolicyInputInternal)this).ReplicationProviderSettingInstanceType = (string) content.GetValueForProperty("ReplicationProviderSettingInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdatePolicyInputInternal)this).ReplicationProviderSettingInstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + } + /// Update policy input. + [System.ComponentModel.TypeConverter(typeof(UpdatePolicyInputTypeConverter))] + public partial interface IUpdatePolicyInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdatePolicyInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdatePolicyInput.TypeConverter.cs new file mode 100644 index 000000000000..6887834bcd02 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdatePolicyInput.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class UpdatePolicyInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdatePolicyInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdatePolicyInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return UpdatePolicyInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return UpdatePolicyInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return UpdatePolicyInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdatePolicyInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdatePolicyInput.cs new file mode 100644 index 000000000000..9cc3b068ca96 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdatePolicyInput.cs @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Update policy input. + public partial class UpdatePolicyInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdatePolicyInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdatePolicyInputInternal + { + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdatePolicyInputProperties Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdatePolicyInputInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdatePolicyInputProperties()); set { {_property = value;} } } + + /// Internal Acessors for ReplicationProviderSetting + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInput Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdatePolicyInputInternal.ReplicationProviderSetting { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdatePolicyInputPropertiesInternal)Property).ReplicationProviderSetting; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdatePolicyInputPropertiesInternal)Property).ReplicationProviderSetting = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdatePolicyInputProperties _property; + + /// The ReplicationProviderSettings. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdatePolicyInputProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdatePolicyInputProperties()); set => this._property = value; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ReplicationProviderSettingInstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdatePolicyInputPropertiesInternal)Property).ReplicationProviderSettingInstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdatePolicyInputPropertiesInternal)Property).ReplicationProviderSettingInstanceType = value ?? null; } + + /// Creates an new instance. + public UpdatePolicyInput() + { + + } + } + /// Update policy input. + public partial interface IUpdatePolicyInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string ReplicationProviderSettingInstanceType { get; set; } + + } + /// Update policy input. + internal partial interface IUpdatePolicyInputInternal + + { + /// The ReplicationProviderSettings. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdatePolicyInputProperties Property { get; set; } + /// The ReplicationProviderSettings. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInput ReplicationProviderSetting { get; set; } + /// The class type. + string ReplicationProviderSettingInstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdatePolicyInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdatePolicyInput.json.cs new file mode 100644 index 000000000000..b610a2dd8b41 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdatePolicyInput.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Update policy input. + public partial class UpdatePolicyInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdatePolicyInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdatePolicyInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdatePolicyInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new UpdatePolicyInput(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal UpdatePolicyInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdatePolicyInputProperties.FromJson(__jsonProperties) : Property;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdatePolicyInputProperties.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdatePolicyInputProperties.PowerShell.cs new file mode 100644 index 000000000000..4fabe26d8e7c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdatePolicyInputProperties.PowerShell.cs @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Policy update properties. + [System.ComponentModel.TypeConverter(typeof(UpdatePolicyInputPropertiesTypeConverter))] + public partial class UpdatePolicyInputProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdatePolicyInputProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new UpdatePolicyInputProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdatePolicyInputProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new UpdatePolicyInputProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdatePolicyInputProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal UpdatePolicyInputProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ReplicationProviderSetting")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdatePolicyInputPropertiesInternal)this).ReplicationProviderSetting = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInput) content.GetValueForProperty("ReplicationProviderSetting",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdatePolicyInputPropertiesInternal)this).ReplicationProviderSetting, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PolicyProviderSpecificInputTypeConverter.ConvertFrom); + } + if (content.Contains("ReplicationProviderSettingInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdatePolicyInputPropertiesInternal)this).ReplicationProviderSettingInstanceType = (string) content.GetValueForProperty("ReplicationProviderSettingInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdatePolicyInputPropertiesInternal)this).ReplicationProviderSettingInstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal UpdatePolicyInputProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ReplicationProviderSetting")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdatePolicyInputPropertiesInternal)this).ReplicationProviderSetting = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInput) content.GetValueForProperty("ReplicationProviderSetting",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdatePolicyInputPropertiesInternal)this).ReplicationProviderSetting, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PolicyProviderSpecificInputTypeConverter.ConvertFrom); + } + if (content.Contains("ReplicationProviderSettingInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdatePolicyInputPropertiesInternal)this).ReplicationProviderSettingInstanceType = (string) content.GetValueForProperty("ReplicationProviderSettingInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdatePolicyInputPropertiesInternal)this).ReplicationProviderSettingInstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + } + /// Policy update properties. + [System.ComponentModel.TypeConverter(typeof(UpdatePolicyInputPropertiesTypeConverter))] + public partial interface IUpdatePolicyInputProperties + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdatePolicyInputProperties.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdatePolicyInputProperties.TypeConverter.cs new file mode 100644 index 000000000000..1bdbe5e6bace --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdatePolicyInputProperties.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class UpdatePolicyInputPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdatePolicyInputProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdatePolicyInputProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return UpdatePolicyInputProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return UpdatePolicyInputProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return UpdatePolicyInputProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdatePolicyInputProperties.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdatePolicyInputProperties.cs new file mode 100644 index 000000000000..63942932ea8c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdatePolicyInputProperties.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Policy update properties. + public partial class UpdatePolicyInputProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdatePolicyInputProperties, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdatePolicyInputPropertiesInternal + { + + /// Internal Acessors for ReplicationProviderSetting + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInput Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdatePolicyInputPropertiesInternal.ReplicationProviderSetting { get => (this._replicationProviderSetting = this._replicationProviderSetting ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PolicyProviderSpecificInput()); set { {_replicationProviderSetting = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInput _replicationProviderSetting; + + /// The ReplicationProviderSettings. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInput ReplicationProviderSetting { get => (this._replicationProviderSetting = this._replicationProviderSetting ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PolicyProviderSpecificInput()); set => this._replicationProviderSetting = value; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ReplicationProviderSettingInstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInputInternal)ReplicationProviderSetting).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInputInternal)ReplicationProviderSetting).InstanceType = value ?? null; } + + /// Creates an new instance. + public UpdatePolicyInputProperties() + { + + } + } + /// Policy update properties. + public partial interface IUpdatePolicyInputProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string ReplicationProviderSettingInstanceType { get; set; } + + } + /// Policy update properties. + internal partial interface IUpdatePolicyInputPropertiesInternal + + { + /// The ReplicationProviderSettings. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInput ReplicationProviderSetting { get; set; } + /// The class type. + string ReplicationProviderSettingInstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdatePolicyInputProperties.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdatePolicyInputProperties.json.cs new file mode 100644 index 000000000000..6fc93af44640 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdatePolicyInputProperties.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Policy update properties. + public partial class UpdatePolicyInputProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdatePolicyInputProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdatePolicyInputProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdatePolicyInputProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new UpdatePolicyInputProperties(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._replicationProviderSetting ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._replicationProviderSetting.ToJson(null,serializationMode) : null, "replicationProviderSettings" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal UpdatePolicyInputProperties(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_replicationProviderSetting = If( json?.PropertyT("replicationProviderSettings"), out var __jsonReplicationProviderSettings) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PolicyProviderSpecificInput.FromJson(__jsonReplicationProviderSettings) : ReplicationProviderSetting;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateProtectionContainerMappingInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateProtectionContainerMappingInput.PowerShell.cs new file mode 100644 index 000000000000..51001a295ac5 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateProtectionContainerMappingInput.PowerShell.cs @@ -0,0 +1,165 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Container pairing update input. + [System.ComponentModel.TypeConverter(typeof(UpdateProtectionContainerMappingInputTypeConverter))] + public partial class UpdateProtectionContainerMappingInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateProtectionContainerMappingInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new UpdateProtectionContainerMappingInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateProtectionContainerMappingInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new UpdateProtectionContainerMappingInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json + /// string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateProtectionContainerMappingInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal UpdateProtectionContainerMappingInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateProtectionContainerMappingInputInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateProtectionContainerMappingInputProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateProtectionContainerMappingInputInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateProtectionContainerMappingInputPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificInput")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateProtectionContainerMappingInputInternal)this).ProviderSpecificInput = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificUpdateContainerMappingInput) content.GetValueForProperty("ProviderSpecificInput",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateProtectionContainerMappingInputInternal)this).ProviderSpecificInput, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProviderSpecificUpdateContainerMappingInputTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificInputInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateProtectionContainerMappingInputInternal)this).ProviderSpecificInputInstanceType = (string) content.GetValueForProperty("ProviderSpecificInputInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateProtectionContainerMappingInputInternal)this).ProviderSpecificInputInstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal UpdateProtectionContainerMappingInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateProtectionContainerMappingInputInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateProtectionContainerMappingInputProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateProtectionContainerMappingInputInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateProtectionContainerMappingInputPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificInput")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateProtectionContainerMappingInputInternal)this).ProviderSpecificInput = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificUpdateContainerMappingInput) content.GetValueForProperty("ProviderSpecificInput",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateProtectionContainerMappingInputInternal)this).ProviderSpecificInput, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProviderSpecificUpdateContainerMappingInputTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificInputInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateProtectionContainerMappingInputInternal)this).ProviderSpecificInputInstanceType = (string) content.GetValueForProperty("ProviderSpecificInputInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateProtectionContainerMappingInputInternal)this).ProviderSpecificInputInstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + } + /// Container pairing update input. + [System.ComponentModel.TypeConverter(typeof(UpdateProtectionContainerMappingInputTypeConverter))] + public partial interface IUpdateProtectionContainerMappingInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateProtectionContainerMappingInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateProtectionContainerMappingInput.TypeConverter.cs new file mode 100644 index 000000000000..82279fbb9a67 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateProtectionContainerMappingInput.TypeConverter.cs @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class UpdateProtectionContainerMappingInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateProtectionContainerMappingInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateProtectionContainerMappingInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return UpdateProtectionContainerMappingInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return UpdateProtectionContainerMappingInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return UpdateProtectionContainerMappingInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateProtectionContainerMappingInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateProtectionContainerMappingInput.cs new file mode 100644 index 000000000000..f941ecaace50 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateProtectionContainerMappingInput.cs @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Container pairing update input. + public partial class UpdateProtectionContainerMappingInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateProtectionContainerMappingInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateProtectionContainerMappingInputInternal + { + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateProtectionContainerMappingInputProperties Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateProtectionContainerMappingInputInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateProtectionContainerMappingInputProperties()); set { {_property = value;} } } + + /// Internal Acessors for ProviderSpecificInput + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificUpdateContainerMappingInput Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateProtectionContainerMappingInputInternal.ProviderSpecificInput { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateProtectionContainerMappingInputPropertiesInternal)Property).ProviderSpecificInput; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateProtectionContainerMappingInputPropertiesInternal)Property).ProviderSpecificInput = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateProtectionContainerMappingInputProperties _property; + + /// Update protection container mapping input properties. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateProtectionContainerMappingInputProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateProtectionContainerMappingInputProperties()); set => this._property = value; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ProviderSpecificInputInstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateProtectionContainerMappingInputPropertiesInternal)Property).ProviderSpecificInputInstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateProtectionContainerMappingInputPropertiesInternal)Property).ProviderSpecificInputInstanceType = value ?? null; } + + /// Creates an new instance. + public UpdateProtectionContainerMappingInput() + { + + } + } + /// Container pairing update input. + public partial interface IUpdateProtectionContainerMappingInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string ProviderSpecificInputInstanceType { get; set; } + + } + /// Container pairing update input. + internal partial interface IUpdateProtectionContainerMappingInputInternal + + { + /// Update protection container mapping input properties. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateProtectionContainerMappingInputProperties Property { get; set; } + /// Provider specific input for updating protection container mapping. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificUpdateContainerMappingInput ProviderSpecificInput { get; set; } + /// The class type. + string ProviderSpecificInputInstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateProtectionContainerMappingInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateProtectionContainerMappingInput.json.cs new file mode 100644 index 000000000000..e03edd20fff3 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateProtectionContainerMappingInput.json.cs @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Container pairing update input. + public partial class UpdateProtectionContainerMappingInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateProtectionContainerMappingInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateProtectionContainerMappingInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateProtectionContainerMappingInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new UpdateProtectionContainerMappingInput(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal UpdateProtectionContainerMappingInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateProtectionContainerMappingInputProperties.FromJson(__jsonProperties) : Property;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateProtectionContainerMappingInputProperties.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateProtectionContainerMappingInputProperties.PowerShell.cs new file mode 100644 index 000000000000..3607afb68445 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateProtectionContainerMappingInputProperties.PowerShell.cs @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Container pairing update input. + [System.ComponentModel.TypeConverter(typeof(UpdateProtectionContainerMappingInputPropertiesTypeConverter))] + public partial class UpdateProtectionContainerMappingInputProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateProtectionContainerMappingInputProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new UpdateProtectionContainerMappingInputProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateProtectionContainerMappingInputProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new UpdateProtectionContainerMappingInputProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from + /// a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateProtectionContainerMappingInputProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal UpdateProtectionContainerMappingInputProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProviderSpecificInput")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateProtectionContainerMappingInputPropertiesInternal)this).ProviderSpecificInput = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificUpdateContainerMappingInput) content.GetValueForProperty("ProviderSpecificInput",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateProtectionContainerMappingInputPropertiesInternal)this).ProviderSpecificInput, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProviderSpecificUpdateContainerMappingInputTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificInputInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateProtectionContainerMappingInputPropertiesInternal)this).ProviderSpecificInputInstanceType = (string) content.GetValueForProperty("ProviderSpecificInputInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateProtectionContainerMappingInputPropertiesInternal)this).ProviderSpecificInputInstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal UpdateProtectionContainerMappingInputProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProviderSpecificInput")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateProtectionContainerMappingInputPropertiesInternal)this).ProviderSpecificInput = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificUpdateContainerMappingInput) content.GetValueForProperty("ProviderSpecificInput",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateProtectionContainerMappingInputPropertiesInternal)this).ProviderSpecificInput, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProviderSpecificUpdateContainerMappingInputTypeConverter.ConvertFrom); + } + if (content.Contains("ProviderSpecificInputInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateProtectionContainerMappingInputPropertiesInternal)this).ProviderSpecificInputInstanceType = (string) content.GetValueForProperty("ProviderSpecificInputInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateProtectionContainerMappingInputPropertiesInternal)this).ProviderSpecificInputInstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + } + /// Container pairing update input. + [System.ComponentModel.TypeConverter(typeof(UpdateProtectionContainerMappingInputPropertiesTypeConverter))] + public partial interface IUpdateProtectionContainerMappingInputProperties + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateProtectionContainerMappingInputProperties.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateProtectionContainerMappingInputProperties.TypeConverter.cs new file mode 100644 index 000000000000..6d0862531171 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateProtectionContainerMappingInputProperties.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class UpdateProtectionContainerMappingInputPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, + /// otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateProtectionContainerMappingInputProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateProtectionContainerMappingInputProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return UpdateProtectionContainerMappingInputProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return UpdateProtectionContainerMappingInputProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return UpdateProtectionContainerMappingInputProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateProtectionContainerMappingInputProperties.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateProtectionContainerMappingInputProperties.cs new file mode 100644 index 000000000000..4f1d210e8aa5 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateProtectionContainerMappingInputProperties.cs @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Container pairing update input. + public partial class UpdateProtectionContainerMappingInputProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateProtectionContainerMappingInputProperties, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateProtectionContainerMappingInputPropertiesInternal + { + + /// Internal Acessors for ProviderSpecificInput + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificUpdateContainerMappingInput Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateProtectionContainerMappingInputPropertiesInternal.ProviderSpecificInput { get => (this._providerSpecificInput = this._providerSpecificInput ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProviderSpecificUpdateContainerMappingInput()); set { {_providerSpecificInput = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificUpdateContainerMappingInput _providerSpecificInput; + + /// Provider specific input for updating protection container mapping. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificUpdateContainerMappingInput ProviderSpecificInput { get => (this._providerSpecificInput = this._providerSpecificInput ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProviderSpecificUpdateContainerMappingInput()); set => this._providerSpecificInput = value; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ProviderSpecificInputInstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificUpdateContainerMappingInputInternal)ProviderSpecificInput).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificUpdateContainerMappingInputInternal)ProviderSpecificInput).InstanceType = value ?? null; } + + /// + /// Creates an new instance. + /// + public UpdateProtectionContainerMappingInputProperties() + { + + } + } + /// Container pairing update input. + public partial interface IUpdateProtectionContainerMappingInputProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string ProviderSpecificInputInstanceType { get; set; } + + } + /// Container pairing update input. + internal partial interface IUpdateProtectionContainerMappingInputPropertiesInternal + + { + /// Provider specific input for updating protection container mapping. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificUpdateContainerMappingInput ProviderSpecificInput { get; set; } + /// The class type. + string ProviderSpecificInputInstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateProtectionContainerMappingInputProperties.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateProtectionContainerMappingInputProperties.json.cs new file mode 100644 index 000000000000..c1fbf2d77945 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateProtectionContainerMappingInputProperties.json.cs @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Container pairing update input. + public partial class UpdateProtectionContainerMappingInputProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateProtectionContainerMappingInputProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateProtectionContainerMappingInputProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateProtectionContainerMappingInputProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new UpdateProtectionContainerMappingInputProperties(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._providerSpecificInput ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._providerSpecificInput.ToJson(null,serializationMode) : null, "providerSpecificInput" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal UpdateProtectionContainerMappingInputProperties(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_providerSpecificInput = If( json?.PropertyT("providerSpecificInput"), out var __jsonProviderSpecificInput) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProviderSpecificUpdateContainerMappingInput.FromJson(__jsonProviderSpecificInput) : ProviderSpecificInput;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateRecoveryPlanInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateRecoveryPlanInput.PowerShell.cs new file mode 100644 index 000000000000..2f1c1fc8deb6 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateRecoveryPlanInput.PowerShell.cs @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Update recovery plan input class. + [System.ComponentModel.TypeConverter(typeof(UpdateRecoveryPlanInputTypeConverter))] + public partial class UpdateRecoveryPlanInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateRecoveryPlanInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new UpdateRecoveryPlanInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateRecoveryPlanInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new UpdateRecoveryPlanInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateRecoveryPlanInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal UpdateRecoveryPlanInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateRecoveryPlanInputInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateRecoveryPlanInputProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateRecoveryPlanInputInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateRecoveryPlanInputPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Group")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateRecoveryPlanInputInternal)this).Group = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroup[]) content.GetValueForProperty("Group",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateRecoveryPlanInputInternal)this).Group, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanGroupTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal UpdateRecoveryPlanInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateRecoveryPlanInputInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateRecoveryPlanInputProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateRecoveryPlanInputInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateRecoveryPlanInputPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Group")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateRecoveryPlanInputInternal)this).Group = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroup[]) content.GetValueForProperty("Group",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateRecoveryPlanInputInternal)this).Group, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanGroupTypeConverter.ConvertFrom)); + } + AfterDeserializePSObject(content); + } + } + /// Update recovery plan input class. + [System.ComponentModel.TypeConverter(typeof(UpdateRecoveryPlanInputTypeConverter))] + public partial interface IUpdateRecoveryPlanInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateRecoveryPlanInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateRecoveryPlanInput.TypeConverter.cs new file mode 100644 index 000000000000..496d5f9690a8 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateRecoveryPlanInput.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class UpdateRecoveryPlanInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateRecoveryPlanInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateRecoveryPlanInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return UpdateRecoveryPlanInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return UpdateRecoveryPlanInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return UpdateRecoveryPlanInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateRecoveryPlanInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateRecoveryPlanInput.cs new file mode 100644 index 000000000000..eb04a94e4b76 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateRecoveryPlanInput.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Update recovery plan input class. + public partial class UpdateRecoveryPlanInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateRecoveryPlanInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateRecoveryPlanInputInternal + { + + /// The recovery plan groups. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroup[] Group { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateRecoveryPlanInputPropertiesInternal)Property).Group; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateRecoveryPlanInputPropertiesInternal)Property).Group = value ?? null /* arrayOf */; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateRecoveryPlanInputProperties Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateRecoveryPlanInputInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateRecoveryPlanInputProperties()); set { {_property = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateRecoveryPlanInputProperties _property; + + /// Recovery plan update properties. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateRecoveryPlanInputProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateRecoveryPlanInputProperties()); set => this._property = value; } + + /// Creates an new instance. + public UpdateRecoveryPlanInput() + { + + } + } + /// Update recovery plan input class. + public partial interface IUpdateRecoveryPlanInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The recovery plan groups. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery plan groups.", + SerializedName = @"groups", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroup) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroup[] Group { get; set; } + + } + /// Update recovery plan input class. + internal partial interface IUpdateRecoveryPlanInputInternal + + { + /// The recovery plan groups. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroup[] Group { get; set; } + /// Recovery plan update properties. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateRecoveryPlanInputProperties Property { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateRecoveryPlanInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateRecoveryPlanInput.json.cs new file mode 100644 index 000000000000..5d66e4972b4c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateRecoveryPlanInput.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Update recovery plan input class. + public partial class UpdateRecoveryPlanInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateRecoveryPlanInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateRecoveryPlanInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateRecoveryPlanInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new UpdateRecoveryPlanInput(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal UpdateRecoveryPlanInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateRecoveryPlanInputProperties.FromJson(__jsonProperties) : Property;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateRecoveryPlanInputProperties.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateRecoveryPlanInputProperties.PowerShell.cs new file mode 100644 index 000000000000..b317e164d16f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateRecoveryPlanInputProperties.PowerShell.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Recovery plan update properties. + [System.ComponentModel.TypeConverter(typeof(UpdateRecoveryPlanInputPropertiesTypeConverter))] + public partial class UpdateRecoveryPlanInputProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateRecoveryPlanInputProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new UpdateRecoveryPlanInputProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateRecoveryPlanInputProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new UpdateRecoveryPlanInputProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateRecoveryPlanInputProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal UpdateRecoveryPlanInputProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Group")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateRecoveryPlanInputPropertiesInternal)this).Group = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroup[]) content.GetValueForProperty("Group",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateRecoveryPlanInputPropertiesInternal)this).Group, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanGroupTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal UpdateRecoveryPlanInputProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Group")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateRecoveryPlanInputPropertiesInternal)this).Group = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroup[]) content.GetValueForProperty("Group",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateRecoveryPlanInputPropertiesInternal)this).Group, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanGroupTypeConverter.ConvertFrom)); + } + AfterDeserializePSObject(content); + } + } + /// Recovery plan update properties. + [System.ComponentModel.TypeConverter(typeof(UpdateRecoveryPlanInputPropertiesTypeConverter))] + public partial interface IUpdateRecoveryPlanInputProperties + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateRecoveryPlanInputProperties.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateRecoveryPlanInputProperties.TypeConverter.cs new file mode 100644 index 000000000000..b3c59f0a9891 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateRecoveryPlanInputProperties.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class UpdateRecoveryPlanInputPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateRecoveryPlanInputProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateRecoveryPlanInputProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return UpdateRecoveryPlanInputProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return UpdateRecoveryPlanInputProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return UpdateRecoveryPlanInputProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateRecoveryPlanInputProperties.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateRecoveryPlanInputProperties.cs new file mode 100644 index 000000000000..273a2a8886d0 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateRecoveryPlanInputProperties.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Recovery plan update properties. + public partial class UpdateRecoveryPlanInputProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateRecoveryPlanInputProperties, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateRecoveryPlanInputPropertiesInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroup[] _group; + + /// The recovery plan groups. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroup[] Group { get => this._group; set => this._group = value; } + + /// Creates an new instance. + public UpdateRecoveryPlanInputProperties() + { + + } + } + /// Recovery plan update properties. + public partial interface IUpdateRecoveryPlanInputProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The recovery plan groups. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery plan groups.", + SerializedName = @"groups", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroup) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroup[] Group { get; set; } + + } + /// Recovery plan update properties. + internal partial interface IUpdateRecoveryPlanInputPropertiesInternal + + { + /// The recovery plan groups. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroup[] Group { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateRecoveryPlanInputProperties.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateRecoveryPlanInputProperties.json.cs new file mode 100644 index 000000000000..666fb023acbb --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateRecoveryPlanInputProperties.json.cs @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Recovery plan update properties. + public partial class UpdateRecoveryPlanInputProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateRecoveryPlanInputProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateRecoveryPlanInputProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateRecoveryPlanInputProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new UpdateRecoveryPlanInputProperties(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._group) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._group ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("groups",__w); + } + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal UpdateRecoveryPlanInputProperties(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_group = If( json?.PropertyT("groups"), out var __jsonGroups) ? If( __jsonGroups as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroup) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanGroup.FromJson(__u) )) ))() : null : Group;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateReplicationProtectedItemInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateReplicationProtectedItemInput.PowerShell.cs new file mode 100644 index 000000000000..7f36ecdd003d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateReplicationProtectedItemInput.PowerShell.cs @@ -0,0 +1,236 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Update replication protected item input. + [System.ComponentModel.TypeConverter(typeof(UpdateReplicationProtectedItemInputTypeConverter))] + public partial class UpdateReplicationProtectedItemInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new UpdateReplicationProtectedItemInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new UpdateReplicationProtectedItemInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal UpdateReplicationProtectedItemInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateReplicationProtectedItemInputPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("LicenseType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputInternal)this).LicenseType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.LicenseType?) content.GetValueForProperty("LicenseType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputInternal)this).LicenseType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.LicenseType.CreateFrom); + } + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemProviderInput) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateReplicationProtectedItemProviderInputTypeConverter.ConvertFrom); + } + if (content.Contains("RecoveryAzureVMName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputInternal)this).RecoveryAzureVMName = (string) content.GetValueForProperty("RecoveryAzureVMName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputInternal)this).RecoveryAzureVMName, global::System.Convert.ToString); + } + if (content.Contains("RecoveryAzureVMSize")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputInternal)this).RecoveryAzureVMSize = (string) content.GetValueForProperty("RecoveryAzureVMSize",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputInternal)this).RecoveryAzureVMSize, global::System.Convert.ToString); + } + if (content.Contains("SelectedRecoveryAzureNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputInternal)this).SelectedRecoveryAzureNetworkId = (string) content.GetValueForProperty("SelectedRecoveryAzureNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputInternal)this).SelectedRecoveryAzureNetworkId, global::System.Convert.ToString); + } + if (content.Contains("SelectedTfoAzureNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputInternal)this).SelectedTfoAzureNetworkId = (string) content.GetValueForProperty("SelectedTfoAzureNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputInternal)this).SelectedTfoAzureNetworkId, global::System.Convert.ToString); + } + if (content.Contains("SelectedSourceNicId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputInternal)this).SelectedSourceNicId = (string) content.GetValueForProperty("SelectedSourceNicId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputInternal)this).SelectedSourceNicId, global::System.Convert.ToString); + } + if (content.Contains("EnableRdpOnTargetOption")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputInternal)this).EnableRdpOnTargetOption = (string) content.GetValueForProperty("EnableRdpOnTargetOption",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputInternal)this).EnableRdpOnTargetOption, global::System.Convert.ToString); + } + if (content.Contains("VMNic")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputInternal)this).VMNic = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicInputDetails[]) content.GetValueForProperty("VMNic",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputInternal)this).VMNic, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMNicInputDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("RecoveryAvailabilitySetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputInternal)this).RecoveryAvailabilitySetId = (string) content.GetValueForProperty("RecoveryAvailabilitySetId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputInternal)this).RecoveryAvailabilitySetId, global::System.Convert.ToString); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal UpdateReplicationProtectedItemInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateReplicationProtectedItemInputPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("LicenseType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputInternal)this).LicenseType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.LicenseType?) content.GetValueForProperty("LicenseType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputInternal)this).LicenseType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.LicenseType.CreateFrom); + } + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemProviderInput) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateReplicationProtectedItemProviderInputTypeConverter.ConvertFrom); + } + if (content.Contains("RecoveryAzureVMName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputInternal)this).RecoveryAzureVMName = (string) content.GetValueForProperty("RecoveryAzureVMName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputInternal)this).RecoveryAzureVMName, global::System.Convert.ToString); + } + if (content.Contains("RecoveryAzureVMSize")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputInternal)this).RecoveryAzureVMSize = (string) content.GetValueForProperty("RecoveryAzureVMSize",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputInternal)this).RecoveryAzureVMSize, global::System.Convert.ToString); + } + if (content.Contains("SelectedRecoveryAzureNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputInternal)this).SelectedRecoveryAzureNetworkId = (string) content.GetValueForProperty("SelectedRecoveryAzureNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputInternal)this).SelectedRecoveryAzureNetworkId, global::System.Convert.ToString); + } + if (content.Contains("SelectedTfoAzureNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputInternal)this).SelectedTfoAzureNetworkId = (string) content.GetValueForProperty("SelectedTfoAzureNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputInternal)this).SelectedTfoAzureNetworkId, global::System.Convert.ToString); + } + if (content.Contains("SelectedSourceNicId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputInternal)this).SelectedSourceNicId = (string) content.GetValueForProperty("SelectedSourceNicId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputInternal)this).SelectedSourceNicId, global::System.Convert.ToString); + } + if (content.Contains("EnableRdpOnTargetOption")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputInternal)this).EnableRdpOnTargetOption = (string) content.GetValueForProperty("EnableRdpOnTargetOption",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputInternal)this).EnableRdpOnTargetOption, global::System.Convert.ToString); + } + if (content.Contains("VMNic")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputInternal)this).VMNic = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicInputDetails[]) content.GetValueForProperty("VMNic",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputInternal)this).VMNic, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMNicInputDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("RecoveryAvailabilitySetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputInternal)this).RecoveryAvailabilitySetId = (string) content.GetValueForProperty("RecoveryAvailabilitySetId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputInternal)this).RecoveryAvailabilitySetId, global::System.Convert.ToString); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + } + /// Update replication protected item input. + [System.ComponentModel.TypeConverter(typeof(UpdateReplicationProtectedItemInputTypeConverter))] + public partial interface IUpdateReplicationProtectedItemInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateReplicationProtectedItemInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateReplicationProtectedItemInput.TypeConverter.cs new file mode 100644 index 000000000000..52ce3887c00e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateReplicationProtectedItemInput.TypeConverter.cs @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class UpdateReplicationProtectedItemInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return UpdateReplicationProtectedItemInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return UpdateReplicationProtectedItemInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return UpdateReplicationProtectedItemInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateReplicationProtectedItemInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateReplicationProtectedItemInput.cs new file mode 100644 index 000000000000..736d605b09ae --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateReplicationProtectedItemInput.cs @@ -0,0 +1,206 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Update replication protected item input. + public partial class UpdateReplicationProtectedItemInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputInternal + { + + /// + /// The selected option to enable RDP\SSH on target vm after failover. String value of SrsDataContract.EnableRDPOnTargetOption + /// enum. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string EnableRdpOnTargetOption { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputPropertiesInternal)Property).EnableRdpOnTargetOption; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputPropertiesInternal)Property).EnableRdpOnTargetOption = value ?? null; } + + /// License type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.LicenseType? LicenseType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputPropertiesInternal)Property).LicenseType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputPropertiesInternal)Property).LicenseType = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.LicenseType)""); } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputProperties Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateReplicationProtectedItemInputProperties()); set { {_property = value;} } } + + /// Internal Acessors for ProviderSpecificDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemProviderInput Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputInternal.ProviderSpecificDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputPropertiesInternal)Property).ProviderSpecificDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputPropertiesInternal)Property).ProviderSpecificDetail = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputProperties _property; + + /// Update replication protected item properties. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateReplicationProtectedItemInputProperties()); set => this._property = value; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ProviderSpecificDetailInstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputPropertiesInternal)Property).ProviderSpecificDetailInstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputPropertiesInternal)Property).ProviderSpecificDetailInstanceType = value ?? null; } + + /// The target availability set Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string RecoveryAvailabilitySetId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputPropertiesInternal)Property).RecoveryAvailabilitySetId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputPropertiesInternal)Property).RecoveryAvailabilitySetId = value ?? null; } + + /// Target Azure VM name given by the user. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string RecoveryAzureVMName { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputPropertiesInternal)Property).RecoveryAzureVMName; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputPropertiesInternal)Property).RecoveryAzureVMName = value ?? null; } + + /// Target Azure VM size. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string RecoveryAzureVMSize { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputPropertiesInternal)Property).RecoveryAzureVMSize; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputPropertiesInternal)Property).RecoveryAzureVMSize = value ?? null; } + + /// Target Azure Network Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string SelectedRecoveryAzureNetworkId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputPropertiesInternal)Property).SelectedRecoveryAzureNetworkId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputPropertiesInternal)Property).SelectedRecoveryAzureNetworkId = value ?? null; } + + /// + /// The selected source nic Id which will be used as the primary nic during failover. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string SelectedSourceNicId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputPropertiesInternal)Property).SelectedSourceNicId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputPropertiesInternal)Property).SelectedSourceNicId = value ?? null; } + + /// The Azure Network Id for test failover. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string SelectedTfoAzureNetworkId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputPropertiesInternal)Property).SelectedTfoAzureNetworkId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputPropertiesInternal)Property).SelectedTfoAzureNetworkId = value ?? null; } + + /// The list of VM nic details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicInputDetails[] VMNic { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputPropertiesInternal)Property).VMNic; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputPropertiesInternal)Property).VMNic = value ?? null /* arrayOf */; } + + /// Creates an new instance. + public UpdateReplicationProtectedItemInput() + { + + } + } + /// Update replication protected item input. + public partial interface IUpdateReplicationProtectedItemInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// + /// The selected option to enable RDP\SSH on target vm after failover. String value of SrsDataContract.EnableRDPOnTargetOption + /// enum. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The selected option to enable RDP\SSH on target vm after failover. String value of SrsDataContract.EnableRDPOnTargetOption enum.", + SerializedName = @"enableRdpOnTargetOption", + PossibleTypes = new [] { typeof(string) })] + string EnableRdpOnTargetOption { get; set; } + /// License type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"License type.", + SerializedName = @"licenseType", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.LicenseType) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.LicenseType? LicenseType { get; set; } + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string ProviderSpecificDetailInstanceType { get; set; } + /// The target availability set Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target availability set Id.", + SerializedName = @"recoveryAvailabilitySetId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryAvailabilitySetId { get; set; } + /// Target Azure VM name given by the user. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Target Azure VM name given by the user.", + SerializedName = @"recoveryAzureVMName", + PossibleTypes = new [] { typeof(string) })] + string RecoveryAzureVMName { get; set; } + /// Target Azure VM size. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Target Azure VM size.", + SerializedName = @"recoveryAzureVMSize", + PossibleTypes = new [] { typeof(string) })] + string RecoveryAzureVMSize { get; set; } + /// Target Azure Network Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Target Azure Network Id.", + SerializedName = @"selectedRecoveryAzureNetworkId", + PossibleTypes = new [] { typeof(string) })] + string SelectedRecoveryAzureNetworkId { get; set; } + /// + /// The selected source nic Id which will be used as the primary nic during failover. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The selected source nic Id which will be used as the primary nic during failover.", + SerializedName = @"selectedSourceNicId", + PossibleTypes = new [] { typeof(string) })] + string SelectedSourceNicId { get; set; } + /// The Azure Network Id for test failover. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Azure Network Id for test failover.", + SerializedName = @"selectedTfoAzureNetworkId", + PossibleTypes = new [] { typeof(string) })] + string SelectedTfoAzureNetworkId { get; set; } + /// The list of VM nic details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of VM nic details.", + SerializedName = @"vmNics", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicInputDetails) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicInputDetails[] VMNic { get; set; } + + } + /// Update replication protected item input. + internal partial interface IUpdateReplicationProtectedItemInputInternal + + { + /// + /// The selected option to enable RDP\SSH on target vm after failover. String value of SrsDataContract.EnableRDPOnTargetOption + /// enum. + /// + string EnableRdpOnTargetOption { get; set; } + /// License type. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.LicenseType? LicenseType { get; set; } + /// Update replication protected item properties. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputProperties Property { get; set; } + /// The provider specific input to update replication protected item. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemProviderInput ProviderSpecificDetail { get; set; } + /// The class type. + string ProviderSpecificDetailInstanceType { get; set; } + /// The target availability set Id. + string RecoveryAvailabilitySetId { get; set; } + /// Target Azure VM name given by the user. + string RecoveryAzureVMName { get; set; } + /// Target Azure VM size. + string RecoveryAzureVMSize { get; set; } + /// Target Azure Network Id. + string SelectedRecoveryAzureNetworkId { get; set; } + /// + /// The selected source nic Id which will be used as the primary nic during failover. + /// + string SelectedSourceNicId { get; set; } + /// The Azure Network Id for test failover. + string SelectedTfoAzureNetworkId { get; set; } + /// The list of VM nic details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicInputDetails[] VMNic { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateReplicationProtectedItemInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateReplicationProtectedItemInput.json.cs new file mode 100644 index 000000000000..0c1a0cf003f8 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateReplicationProtectedItemInput.json.cs @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Update replication protected item input. + public partial class UpdateReplicationProtectedItemInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new UpdateReplicationProtectedItemInput(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal UpdateReplicationProtectedItemInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateReplicationProtectedItemInputProperties.FromJson(__jsonProperties) : Property;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateReplicationProtectedItemInputProperties.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateReplicationProtectedItemInputProperties.PowerShell.cs new file mode 100644 index 000000000000..a20c87400954 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateReplicationProtectedItemInputProperties.PowerShell.cs @@ -0,0 +1,229 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Update protected item input properties. + [System.ComponentModel.TypeConverter(typeof(UpdateReplicationProtectedItemInputPropertiesTypeConverter))] + public partial class UpdateReplicationProtectedItemInputProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new UpdateReplicationProtectedItemInputProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new UpdateReplicationProtectedItemInputProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from + /// a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal UpdateReplicationProtectedItemInputProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputPropertiesInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemProviderInput) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputPropertiesInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateReplicationProtectedItemProviderInputTypeConverter.ConvertFrom); + } + if (content.Contains("RecoveryAzureVMName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputPropertiesInternal)this).RecoveryAzureVMName = (string) content.GetValueForProperty("RecoveryAzureVMName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputPropertiesInternal)this).RecoveryAzureVMName, global::System.Convert.ToString); + } + if (content.Contains("RecoveryAzureVMSize")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputPropertiesInternal)this).RecoveryAzureVMSize = (string) content.GetValueForProperty("RecoveryAzureVMSize",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputPropertiesInternal)this).RecoveryAzureVMSize, global::System.Convert.ToString); + } + if (content.Contains("SelectedRecoveryAzureNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputPropertiesInternal)this).SelectedRecoveryAzureNetworkId = (string) content.GetValueForProperty("SelectedRecoveryAzureNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputPropertiesInternal)this).SelectedRecoveryAzureNetworkId, global::System.Convert.ToString); + } + if (content.Contains("SelectedTfoAzureNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputPropertiesInternal)this).SelectedTfoAzureNetworkId = (string) content.GetValueForProperty("SelectedTfoAzureNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputPropertiesInternal)this).SelectedTfoAzureNetworkId, global::System.Convert.ToString); + } + if (content.Contains("SelectedSourceNicId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputPropertiesInternal)this).SelectedSourceNicId = (string) content.GetValueForProperty("SelectedSourceNicId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputPropertiesInternal)this).SelectedSourceNicId, global::System.Convert.ToString); + } + if (content.Contains("EnableRdpOnTargetOption")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputPropertiesInternal)this).EnableRdpOnTargetOption = (string) content.GetValueForProperty("EnableRdpOnTargetOption",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputPropertiesInternal)this).EnableRdpOnTargetOption, global::System.Convert.ToString); + } + if (content.Contains("VMNic")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputPropertiesInternal)this).VMNic = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicInputDetails[]) content.GetValueForProperty("VMNic",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputPropertiesInternal)this).VMNic, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMNicInputDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("LicenseType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputPropertiesInternal)this).LicenseType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.LicenseType?) content.GetValueForProperty("LicenseType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputPropertiesInternal)this).LicenseType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.LicenseType.CreateFrom); + } + if (content.Contains("RecoveryAvailabilitySetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputPropertiesInternal)this).RecoveryAvailabilitySetId = (string) content.GetValueForProperty("RecoveryAvailabilitySetId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputPropertiesInternal)this).RecoveryAvailabilitySetId, global::System.Convert.ToString); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputPropertiesInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputPropertiesInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal UpdateReplicationProtectedItemInputProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProviderSpecificDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputPropertiesInternal)this).ProviderSpecificDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemProviderInput) content.GetValueForProperty("ProviderSpecificDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputPropertiesInternal)this).ProviderSpecificDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateReplicationProtectedItemProviderInputTypeConverter.ConvertFrom); + } + if (content.Contains("RecoveryAzureVMName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputPropertiesInternal)this).RecoveryAzureVMName = (string) content.GetValueForProperty("RecoveryAzureVMName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputPropertiesInternal)this).RecoveryAzureVMName, global::System.Convert.ToString); + } + if (content.Contains("RecoveryAzureVMSize")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputPropertiesInternal)this).RecoveryAzureVMSize = (string) content.GetValueForProperty("RecoveryAzureVMSize",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputPropertiesInternal)this).RecoveryAzureVMSize, global::System.Convert.ToString); + } + if (content.Contains("SelectedRecoveryAzureNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputPropertiesInternal)this).SelectedRecoveryAzureNetworkId = (string) content.GetValueForProperty("SelectedRecoveryAzureNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputPropertiesInternal)this).SelectedRecoveryAzureNetworkId, global::System.Convert.ToString); + } + if (content.Contains("SelectedTfoAzureNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputPropertiesInternal)this).SelectedTfoAzureNetworkId = (string) content.GetValueForProperty("SelectedTfoAzureNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputPropertiesInternal)this).SelectedTfoAzureNetworkId, global::System.Convert.ToString); + } + if (content.Contains("SelectedSourceNicId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputPropertiesInternal)this).SelectedSourceNicId = (string) content.GetValueForProperty("SelectedSourceNicId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputPropertiesInternal)this).SelectedSourceNicId, global::System.Convert.ToString); + } + if (content.Contains("EnableRdpOnTargetOption")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputPropertiesInternal)this).EnableRdpOnTargetOption = (string) content.GetValueForProperty("EnableRdpOnTargetOption",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputPropertiesInternal)this).EnableRdpOnTargetOption, global::System.Convert.ToString); + } + if (content.Contains("VMNic")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputPropertiesInternal)this).VMNic = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicInputDetails[]) content.GetValueForProperty("VMNic",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputPropertiesInternal)this).VMNic, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMNicInputDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("LicenseType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputPropertiesInternal)this).LicenseType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.LicenseType?) content.GetValueForProperty("LicenseType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputPropertiesInternal)this).LicenseType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.LicenseType.CreateFrom); + } + if (content.Contains("RecoveryAvailabilitySetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputPropertiesInternal)this).RecoveryAvailabilitySetId = (string) content.GetValueForProperty("RecoveryAvailabilitySetId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputPropertiesInternal)this).RecoveryAvailabilitySetId, global::System.Convert.ToString); + } + if (content.Contains("ProviderSpecificDetailInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputPropertiesInternal)this).ProviderSpecificDetailInstanceType = (string) content.GetValueForProperty("ProviderSpecificDetailInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputPropertiesInternal)this).ProviderSpecificDetailInstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + } + /// Update protected item input properties. + [System.ComponentModel.TypeConverter(typeof(UpdateReplicationProtectedItemInputPropertiesTypeConverter))] + public partial interface IUpdateReplicationProtectedItemInputProperties + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateReplicationProtectedItemInputProperties.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateReplicationProtectedItemInputProperties.TypeConverter.cs new file mode 100644 index 000000000000..fd190f28923b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateReplicationProtectedItemInputProperties.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class UpdateReplicationProtectedItemInputPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, + /// otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return UpdateReplicationProtectedItemInputProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return UpdateReplicationProtectedItemInputProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return UpdateReplicationProtectedItemInputProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateReplicationProtectedItemInputProperties.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateReplicationProtectedItemInputProperties.cs new file mode 100644 index 000000000000..a240cad59394 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateReplicationProtectedItemInputProperties.cs @@ -0,0 +1,230 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Update protected item input properties. + public partial class UpdateReplicationProtectedItemInputProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputProperties, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputPropertiesInternal + { + + /// Backing field for property. + private string _enableRdpOnTargetOption; + + /// + /// The selected option to enable RDP\SSH on target vm after failover. String value of SrsDataContract.EnableRDPOnTargetOption + /// enum. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string EnableRdpOnTargetOption { get => this._enableRdpOnTargetOption; set => this._enableRdpOnTargetOption = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.LicenseType? _licenseType; + + /// License type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.LicenseType? LicenseType { get => this._licenseType; set => this._licenseType = value; } + + /// Internal Acessors for ProviderSpecificDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemProviderInput Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputPropertiesInternal.ProviderSpecificDetail { get => (this._providerSpecificDetail = this._providerSpecificDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateReplicationProtectedItemProviderInput()); set { {_providerSpecificDetail = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemProviderInput _providerSpecificDetail; + + /// The provider specific input to update replication protected item. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemProviderInput ProviderSpecificDetail { get => (this._providerSpecificDetail = this._providerSpecificDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateReplicationProtectedItemProviderInput()); set => this._providerSpecificDetail = value; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ProviderSpecificDetailInstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemProviderInputInternal)ProviderSpecificDetail).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemProviderInputInternal)ProviderSpecificDetail).InstanceType = value ?? null; } + + /// Backing field for property. + private string _recoveryAvailabilitySetId; + + /// The target availability set Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryAvailabilitySetId { get => this._recoveryAvailabilitySetId; set => this._recoveryAvailabilitySetId = value; } + + /// Backing field for property. + private string _recoveryAzureVMName; + + /// Target Azure VM name given by the user. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryAzureVMName { get => this._recoveryAzureVMName; set => this._recoveryAzureVMName = value; } + + /// Backing field for property. + private string _recoveryAzureVMSize; + + /// Target Azure VM size. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryAzureVMSize { get => this._recoveryAzureVMSize; set => this._recoveryAzureVMSize = value; } + + /// Backing field for property. + private string _selectedRecoveryAzureNetworkId; + + /// Target Azure Network Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string SelectedRecoveryAzureNetworkId { get => this._selectedRecoveryAzureNetworkId; set => this._selectedRecoveryAzureNetworkId = value; } + + /// Backing field for property. + private string _selectedSourceNicId; + + /// + /// The selected source nic Id which will be used as the primary nic during failover. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string SelectedSourceNicId { get => this._selectedSourceNicId; set => this._selectedSourceNicId = value; } + + /// Backing field for property. + private string _selectedTfoAzureNetworkId; + + /// The Azure Network Id for test failover. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string SelectedTfoAzureNetworkId { get => this._selectedTfoAzureNetworkId; set => this._selectedTfoAzureNetworkId = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicInputDetails[] _vMNic; + + /// The list of VM nic details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicInputDetails[] VMNic { get => this._vMNic; set => this._vMNic = value; } + + /// + /// Creates an new instance. + /// + public UpdateReplicationProtectedItemInputProperties() + { + + } + } + /// Update protected item input properties. + public partial interface IUpdateReplicationProtectedItemInputProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// + /// The selected option to enable RDP\SSH on target vm after failover. String value of SrsDataContract.EnableRDPOnTargetOption + /// enum. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The selected option to enable RDP\SSH on target vm after failover. String value of SrsDataContract.EnableRDPOnTargetOption enum.", + SerializedName = @"enableRdpOnTargetOption", + PossibleTypes = new [] { typeof(string) })] + string EnableRdpOnTargetOption { get; set; } + /// License type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"License type.", + SerializedName = @"licenseType", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.LicenseType) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.LicenseType? LicenseType { get; set; } + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string ProviderSpecificDetailInstanceType { get; set; } + /// The target availability set Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target availability set Id.", + SerializedName = @"recoveryAvailabilitySetId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryAvailabilitySetId { get; set; } + /// Target Azure VM name given by the user. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Target Azure VM name given by the user.", + SerializedName = @"recoveryAzureVMName", + PossibleTypes = new [] { typeof(string) })] + string RecoveryAzureVMName { get; set; } + /// Target Azure VM size. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Target Azure VM size.", + SerializedName = @"recoveryAzureVMSize", + PossibleTypes = new [] { typeof(string) })] + string RecoveryAzureVMSize { get; set; } + /// Target Azure Network Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Target Azure Network Id.", + SerializedName = @"selectedRecoveryAzureNetworkId", + PossibleTypes = new [] { typeof(string) })] + string SelectedRecoveryAzureNetworkId { get; set; } + /// + /// The selected source nic Id which will be used as the primary nic during failover. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The selected source nic Id which will be used as the primary nic during failover.", + SerializedName = @"selectedSourceNicId", + PossibleTypes = new [] { typeof(string) })] + string SelectedSourceNicId { get; set; } + /// The Azure Network Id for test failover. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Azure Network Id for test failover.", + SerializedName = @"selectedTfoAzureNetworkId", + PossibleTypes = new [] { typeof(string) })] + string SelectedTfoAzureNetworkId { get; set; } + /// The list of VM nic details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of VM nic details.", + SerializedName = @"vmNics", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicInputDetails) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicInputDetails[] VMNic { get; set; } + + } + /// Update protected item input properties. + internal partial interface IUpdateReplicationProtectedItemInputPropertiesInternal + + { + /// + /// The selected option to enable RDP\SSH on target vm after failover. String value of SrsDataContract.EnableRDPOnTargetOption + /// enum. + /// + string EnableRdpOnTargetOption { get; set; } + /// License type. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.LicenseType? LicenseType { get; set; } + /// The provider specific input to update replication protected item. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemProviderInput ProviderSpecificDetail { get; set; } + /// The class type. + string ProviderSpecificDetailInstanceType { get; set; } + /// The target availability set Id. + string RecoveryAvailabilitySetId { get; set; } + /// Target Azure VM name given by the user. + string RecoveryAzureVMName { get; set; } + /// Target Azure VM size. + string RecoveryAzureVMSize { get; set; } + /// Target Azure Network Id. + string SelectedRecoveryAzureNetworkId { get; set; } + /// + /// The selected source nic Id which will be used as the primary nic during failover. + /// + string SelectedSourceNicId { get; set; } + /// The Azure Network Id for test failover. + string SelectedTfoAzureNetworkId { get; set; } + /// The list of VM nic details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicInputDetails[] VMNic { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateReplicationProtectedItemInputProperties.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateReplicationProtectedItemInputProperties.json.cs new file mode 100644 index 000000000000..8d951c94bbc7 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateReplicationProtectedItemInputProperties.json.cs @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Update protected item input properties. + public partial class UpdateReplicationProtectedItemInputProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInputProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new UpdateReplicationProtectedItemInputProperties(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._providerSpecificDetail ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._providerSpecificDetail.ToJson(null,serializationMode) : null, "providerSpecificDetails" ,container.Add ); + AddIf( null != (((object)this._recoveryAzureVMName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryAzureVMName.ToString()) : null, "recoveryAzureVMName" ,container.Add ); + AddIf( null != (((object)this._recoveryAzureVMSize)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryAzureVMSize.ToString()) : null, "recoveryAzureVMSize" ,container.Add ); + AddIf( null != (((object)this._selectedRecoveryAzureNetworkId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._selectedRecoveryAzureNetworkId.ToString()) : null, "selectedRecoveryAzureNetworkId" ,container.Add ); + AddIf( null != (((object)this._selectedTfoAzureNetworkId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._selectedTfoAzureNetworkId.ToString()) : null, "selectedTfoAzureNetworkId" ,container.Add ); + AddIf( null != (((object)this._selectedSourceNicId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._selectedSourceNicId.ToString()) : null, "selectedSourceNicId" ,container.Add ); + AddIf( null != (((object)this._enableRdpOnTargetOption)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._enableRdpOnTargetOption.ToString()) : null, "enableRdpOnTargetOption" ,container.Add ); + if (null != this._vMNic) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._vMNic ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("vmNics",__w); + } + AddIf( null != (((object)this._licenseType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._licenseType.ToString()) : null, "licenseType" ,container.Add ); + AddIf( null != (((object)this._recoveryAvailabilitySetId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryAvailabilitySetId.ToString()) : null, "recoveryAvailabilitySetId" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal UpdateReplicationProtectedItemInputProperties(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_providerSpecificDetail = If( json?.PropertyT("providerSpecificDetails"), out var __jsonProviderSpecificDetails) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateReplicationProtectedItemProviderInput.FromJson(__jsonProviderSpecificDetails) : ProviderSpecificDetail;} + {_recoveryAzureVMName = If( json?.PropertyT("recoveryAzureVMName"), out var __jsonRecoveryAzureVMName) ? (string)__jsonRecoveryAzureVMName : (string)RecoveryAzureVMName;} + {_recoveryAzureVMSize = If( json?.PropertyT("recoveryAzureVMSize"), out var __jsonRecoveryAzureVMSize) ? (string)__jsonRecoveryAzureVMSize : (string)RecoveryAzureVMSize;} + {_selectedRecoveryAzureNetworkId = If( json?.PropertyT("selectedRecoveryAzureNetworkId"), out var __jsonSelectedRecoveryAzureNetworkId) ? (string)__jsonSelectedRecoveryAzureNetworkId : (string)SelectedRecoveryAzureNetworkId;} + {_selectedTfoAzureNetworkId = If( json?.PropertyT("selectedTfoAzureNetworkId"), out var __jsonSelectedTfoAzureNetworkId) ? (string)__jsonSelectedTfoAzureNetworkId : (string)SelectedTfoAzureNetworkId;} + {_selectedSourceNicId = If( json?.PropertyT("selectedSourceNicId"), out var __jsonSelectedSourceNicId) ? (string)__jsonSelectedSourceNicId : (string)SelectedSourceNicId;} + {_enableRdpOnTargetOption = If( json?.PropertyT("enableRdpOnTargetOption"), out var __jsonEnableRdpOnTargetOption) ? (string)__jsonEnableRdpOnTargetOption : (string)EnableRdpOnTargetOption;} + {_vMNic = If( json?.PropertyT("vmNics"), out var __jsonVMNics) ? If( __jsonVMNics as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicInputDetails) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMNicInputDetails.FromJson(__u) )) ))() : null : VMNic;} + {_licenseType = If( json?.PropertyT("licenseType"), out var __jsonLicenseType) ? (string)__jsonLicenseType : (string)LicenseType;} + {_recoveryAvailabilitySetId = If( json?.PropertyT("recoveryAvailabilitySetId"), out var __jsonRecoveryAvailabilitySetId) ? (string)__jsonRecoveryAvailabilitySetId : (string)RecoveryAvailabilitySetId;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateReplicationProtectedItemProviderInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateReplicationProtectedItemProviderInput.PowerShell.cs new file mode 100644 index 000000000000..7c4ae0c32026 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateReplicationProtectedItemProviderInput.PowerShell.cs @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Update replication protected item provider specific input. + [System.ComponentModel.TypeConverter(typeof(UpdateReplicationProtectedItemProviderInputTypeConverter))] + public partial class UpdateReplicationProtectedItemProviderInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemProviderInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new UpdateReplicationProtectedItemProviderInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemProviderInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new UpdateReplicationProtectedItemProviderInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a + /// json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemProviderInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal UpdateReplicationProtectedItemProviderInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemProviderInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemProviderInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal UpdateReplicationProtectedItemProviderInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemProviderInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemProviderInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + } + /// Update replication protected item provider specific input. + [System.ComponentModel.TypeConverter(typeof(UpdateReplicationProtectedItemProviderInputTypeConverter))] + public partial interface IUpdateReplicationProtectedItemProviderInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateReplicationProtectedItemProviderInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateReplicationProtectedItemProviderInput.TypeConverter.cs new file mode 100644 index 000000000000..e06be8696600 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateReplicationProtectedItemProviderInput.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class UpdateReplicationProtectedItemProviderInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemProviderInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemProviderInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return UpdateReplicationProtectedItemProviderInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return UpdateReplicationProtectedItemProviderInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return UpdateReplicationProtectedItemProviderInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateReplicationProtectedItemProviderInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateReplicationProtectedItemProviderInput.cs new file mode 100644 index 000000000000..072a549a5ff6 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateReplicationProtectedItemProviderInput.cs @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Update replication protected item provider specific input. + public partial class UpdateReplicationProtectedItemProviderInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemProviderInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemProviderInputInternal + { + + /// Backing field for property. + private string _instanceType; + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string InstanceType { get => this._instanceType; set => this._instanceType = value; } + + /// + /// Creates an new instance. + /// + public UpdateReplicationProtectedItemProviderInput() + { + + } + } + /// Update replication protected item provider specific input. + public partial interface IUpdateReplicationProtectedItemProviderInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string InstanceType { get; set; } + + } + /// Update replication protected item provider specific input. + internal partial interface IUpdateReplicationProtectedItemProviderInputInternal + + { + /// The class type. + string InstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateReplicationProtectedItemProviderInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateReplicationProtectedItemProviderInput.json.cs new file mode 100644 index 000000000000..1b26d1887c46 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateReplicationProtectedItemProviderInput.json.cs @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Update replication protected item provider specific input. + public partial class UpdateReplicationProtectedItemProviderInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemProviderInput. + /// Note: the Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemProviderInput + /// interface is polymorphic, and the precise model class that will get deserialized is determined at runtime based on the + /// payload. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemProviderInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemProviderInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + if (!(node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json)) + { + return null; + } + // Polymorphic type -- select the appropriate constructor using the discriminator + + switch ( json.StringProperty("instanceType") ) + { + case "A2A": + { + return new A2AUpdateReplicationProtectedItemInput(json); + } + case "HyperVReplicaAzure": + { + return new HyperVReplicaAzureUpdateReplicationProtectedItemInput(json); + } + case "InMageAzureV2": + { + return new InMageAzureV2UpdateReplicationProtectedItemInput(json); + } + case "InMageRcm": + { + return new InMageRcmUpdateReplicationProtectedItemInput(json); + } + } + return new UpdateReplicationProtectedItemProviderInput(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._instanceType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._instanceType.ToString()) : null, "instanceType" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal UpdateReplicationProtectedItemProviderInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_instanceType = If( json?.PropertyT("instanceType"), out var __jsonInstanceType) ? (string)__jsonInstanceType : (string)InstanceType;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateVCenterRequest.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateVCenterRequest.PowerShell.cs new file mode 100644 index 000000000000..9513468a0d25 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateVCenterRequest.PowerShell.cs @@ -0,0 +1,184 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Input required to update vCenter. + [System.ComponentModel.TypeConverter(typeof(UpdateVCenterRequestTypeConverter))] + public partial class UpdateVCenterRequest + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateVCenterRequest DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new UpdateVCenterRequest(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateVCenterRequest DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new UpdateVCenterRequest(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateVCenterRequest FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal UpdateVCenterRequest(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateVCenterRequestInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateVCenterRequestProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateVCenterRequestInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateVCenterRequestPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("FriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateVCenterRequestInternal)this).FriendlyName = (string) content.GetValueForProperty("FriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateVCenterRequestInternal)this).FriendlyName, global::System.Convert.ToString); + } + if (content.Contains("IPAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateVCenterRequestInternal)this).IPAddress = (string) content.GetValueForProperty("IPAddress",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateVCenterRequestInternal)this).IPAddress, global::System.Convert.ToString); + } + if (content.Contains("ProcessServerId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateVCenterRequestInternal)this).ProcessServerId = (string) content.GetValueForProperty("ProcessServerId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateVCenterRequestInternal)this).ProcessServerId, global::System.Convert.ToString); + } + if (content.Contains("Port")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateVCenterRequestInternal)this).Port = (string) content.GetValueForProperty("Port",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateVCenterRequestInternal)this).Port, global::System.Convert.ToString); + } + if (content.Contains("RunAsAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateVCenterRequestInternal)this).RunAsAccountId = (string) content.GetValueForProperty("RunAsAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateVCenterRequestInternal)this).RunAsAccountId, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal UpdateVCenterRequest(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateVCenterRequestInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateVCenterRequestProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateVCenterRequestInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateVCenterRequestPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("FriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateVCenterRequestInternal)this).FriendlyName = (string) content.GetValueForProperty("FriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateVCenterRequestInternal)this).FriendlyName, global::System.Convert.ToString); + } + if (content.Contains("IPAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateVCenterRequestInternal)this).IPAddress = (string) content.GetValueForProperty("IPAddress",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateVCenterRequestInternal)this).IPAddress, global::System.Convert.ToString); + } + if (content.Contains("ProcessServerId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateVCenterRequestInternal)this).ProcessServerId = (string) content.GetValueForProperty("ProcessServerId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateVCenterRequestInternal)this).ProcessServerId, global::System.Convert.ToString); + } + if (content.Contains("Port")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateVCenterRequestInternal)this).Port = (string) content.GetValueForProperty("Port",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateVCenterRequestInternal)this).Port, global::System.Convert.ToString); + } + if (content.Contains("RunAsAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateVCenterRequestInternal)this).RunAsAccountId = (string) content.GetValueForProperty("RunAsAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateVCenterRequestInternal)this).RunAsAccountId, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + } + /// Input required to update vCenter. + [System.ComponentModel.TypeConverter(typeof(UpdateVCenterRequestTypeConverter))] + public partial interface IUpdateVCenterRequest + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateVCenterRequest.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateVCenterRequest.TypeConverter.cs new file mode 100644 index 000000000000..463ed2730883 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateVCenterRequest.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class UpdateVCenterRequestTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateVCenterRequest ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateVCenterRequest).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return UpdateVCenterRequest.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return UpdateVCenterRequest.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return UpdateVCenterRequest.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateVCenterRequest.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateVCenterRequest.cs new file mode 100644 index 000000000000..2f02521a4ac6 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateVCenterRequest.cs @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Input required to update vCenter. + public partial class UpdateVCenterRequest : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateVCenterRequest, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateVCenterRequestInternal + { + + /// The friendly name of the vCenter. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string FriendlyName { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateVCenterRequestPropertiesInternal)Property).FriendlyName; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateVCenterRequestPropertiesInternal)Property).FriendlyName = value ?? null; } + + /// The IP address of the vCenter to be discovered. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string IPAddress { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateVCenterRequestPropertiesInternal)Property).IPAddress; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateVCenterRequestPropertiesInternal)Property).IPAddress = value ?? null; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateVCenterRequestProperties Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateVCenterRequestInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateVCenterRequestProperties()); set { {_property = value;} } } + + /// The port number for discovery. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string Port { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateVCenterRequestPropertiesInternal)Property).Port; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateVCenterRequestPropertiesInternal)Property).Port = value ?? null; } + + /// The process server Id from where the update can be orchestrated. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ProcessServerId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateVCenterRequestPropertiesInternal)Property).ProcessServerId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateVCenterRequestPropertiesInternal)Property).ProcessServerId = value ?? null; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateVCenterRequestProperties _property; + + /// The update VCenter Request Properties. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateVCenterRequestProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateVCenterRequestProperties()); set => this._property = value; } + + /// The CS account Id which has privileges to update the vCenter. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string RunAsAccountId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateVCenterRequestPropertiesInternal)Property).RunAsAccountId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateVCenterRequestPropertiesInternal)Property).RunAsAccountId = value ?? null; } + + /// Creates an new instance. + public UpdateVCenterRequest() + { + + } + } + /// Input required to update vCenter. + public partial interface IUpdateVCenterRequest : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The friendly name of the vCenter. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The friendly name of the vCenter.", + SerializedName = @"friendlyName", + PossibleTypes = new [] { typeof(string) })] + string FriendlyName { get; set; } + /// The IP address of the vCenter to be discovered. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The IP address of the vCenter to be discovered.", + SerializedName = @"ipAddress", + PossibleTypes = new [] { typeof(string) })] + string IPAddress { get; set; } + /// The port number for discovery. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The port number for discovery.", + SerializedName = @"port", + PossibleTypes = new [] { typeof(string) })] + string Port { get; set; } + /// The process server Id from where the update can be orchestrated. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The process server Id from where the update can be orchestrated.", + SerializedName = @"processServerId", + PossibleTypes = new [] { typeof(string) })] + string ProcessServerId { get; set; } + /// The CS account Id which has privileges to update the vCenter. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The CS account Id which has privileges to update the vCenter.", + SerializedName = @"runAsAccountId", + PossibleTypes = new [] { typeof(string) })] + string RunAsAccountId { get; set; } + + } + /// Input required to update vCenter. + internal partial interface IUpdateVCenterRequestInternal + + { + /// The friendly name of the vCenter. + string FriendlyName { get; set; } + /// The IP address of the vCenter to be discovered. + string IPAddress { get; set; } + /// The port number for discovery. + string Port { get; set; } + /// The process server Id from where the update can be orchestrated. + string ProcessServerId { get; set; } + /// The update VCenter Request Properties. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateVCenterRequestProperties Property { get; set; } + /// The CS account Id which has privileges to update the vCenter. + string RunAsAccountId { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateVCenterRequest.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateVCenterRequest.json.cs new file mode 100644 index 000000000000..38f3242e3a16 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateVCenterRequest.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Input required to update vCenter. + public partial class UpdateVCenterRequest + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateVCenterRequest. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateVCenterRequest. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateVCenterRequest FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new UpdateVCenterRequest(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal UpdateVCenterRequest(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateVCenterRequestProperties.FromJson(__jsonProperties) : Property;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateVCenterRequestProperties.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateVCenterRequestProperties.PowerShell.cs new file mode 100644 index 000000000000..3edbc3f58544 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateVCenterRequestProperties.PowerShell.cs @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// The properties of an update vCenter request. + [System.ComponentModel.TypeConverter(typeof(UpdateVCenterRequestPropertiesTypeConverter))] + public partial class UpdateVCenterRequestProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateVCenterRequestProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new UpdateVCenterRequestProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateVCenterRequestProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new UpdateVCenterRequestProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateVCenterRequestProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal UpdateVCenterRequestProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("FriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateVCenterRequestPropertiesInternal)this).FriendlyName = (string) content.GetValueForProperty("FriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateVCenterRequestPropertiesInternal)this).FriendlyName, global::System.Convert.ToString); + } + if (content.Contains("IPAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateVCenterRequestPropertiesInternal)this).IPAddress = (string) content.GetValueForProperty("IPAddress",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateVCenterRequestPropertiesInternal)this).IPAddress, global::System.Convert.ToString); + } + if (content.Contains("ProcessServerId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateVCenterRequestPropertiesInternal)this).ProcessServerId = (string) content.GetValueForProperty("ProcessServerId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateVCenterRequestPropertiesInternal)this).ProcessServerId, global::System.Convert.ToString); + } + if (content.Contains("Port")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateVCenterRequestPropertiesInternal)this).Port = (string) content.GetValueForProperty("Port",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateVCenterRequestPropertiesInternal)this).Port, global::System.Convert.ToString); + } + if (content.Contains("RunAsAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateVCenterRequestPropertiesInternal)this).RunAsAccountId = (string) content.GetValueForProperty("RunAsAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateVCenterRequestPropertiesInternal)this).RunAsAccountId, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal UpdateVCenterRequestProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("FriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateVCenterRequestPropertiesInternal)this).FriendlyName = (string) content.GetValueForProperty("FriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateVCenterRequestPropertiesInternal)this).FriendlyName, global::System.Convert.ToString); + } + if (content.Contains("IPAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateVCenterRequestPropertiesInternal)this).IPAddress = (string) content.GetValueForProperty("IPAddress",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateVCenterRequestPropertiesInternal)this).IPAddress, global::System.Convert.ToString); + } + if (content.Contains("ProcessServerId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateVCenterRequestPropertiesInternal)this).ProcessServerId = (string) content.GetValueForProperty("ProcessServerId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateVCenterRequestPropertiesInternal)this).ProcessServerId, global::System.Convert.ToString); + } + if (content.Contains("Port")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateVCenterRequestPropertiesInternal)this).Port = (string) content.GetValueForProperty("Port",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateVCenterRequestPropertiesInternal)this).Port, global::System.Convert.ToString); + } + if (content.Contains("RunAsAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateVCenterRequestPropertiesInternal)this).RunAsAccountId = (string) content.GetValueForProperty("RunAsAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateVCenterRequestPropertiesInternal)this).RunAsAccountId, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + } + /// The properties of an update vCenter request. + [System.ComponentModel.TypeConverter(typeof(UpdateVCenterRequestPropertiesTypeConverter))] + public partial interface IUpdateVCenterRequestProperties + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateVCenterRequestProperties.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateVCenterRequestProperties.TypeConverter.cs new file mode 100644 index 000000000000..783d386deaeb --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateVCenterRequestProperties.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class UpdateVCenterRequestPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateVCenterRequestProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateVCenterRequestProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return UpdateVCenterRequestProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return UpdateVCenterRequestProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return UpdateVCenterRequestProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateVCenterRequestProperties.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateVCenterRequestProperties.cs new file mode 100644 index 000000000000..66dc94b9cd6b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateVCenterRequestProperties.cs @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The properties of an update vCenter request. + public partial class UpdateVCenterRequestProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateVCenterRequestProperties, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateVCenterRequestPropertiesInternal + { + + /// Backing field for property. + private string _friendlyName; + + /// The friendly name of the vCenter. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string FriendlyName { get => this._friendlyName; set => this._friendlyName = value; } + + /// Backing field for property. + private string _iPAddress; + + /// The IP address of the vCenter to be discovered. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string IPAddress { get => this._iPAddress; set => this._iPAddress = value; } + + /// Backing field for property. + private string _port; + + /// The port number for discovery. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Port { get => this._port; set => this._port = value; } + + /// Backing field for property. + private string _processServerId; + + /// The process server Id from where the update can be orchestrated. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ProcessServerId { get => this._processServerId; set => this._processServerId = value; } + + /// Backing field for property. + private string _runAsAccountId; + + /// The CS account Id which has privileges to update the vCenter. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RunAsAccountId { get => this._runAsAccountId; set => this._runAsAccountId = value; } + + /// Creates an new instance. + public UpdateVCenterRequestProperties() + { + + } + } + /// The properties of an update vCenter request. + public partial interface IUpdateVCenterRequestProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The friendly name of the vCenter. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The friendly name of the vCenter.", + SerializedName = @"friendlyName", + PossibleTypes = new [] { typeof(string) })] + string FriendlyName { get; set; } + /// The IP address of the vCenter to be discovered. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The IP address of the vCenter to be discovered.", + SerializedName = @"ipAddress", + PossibleTypes = new [] { typeof(string) })] + string IPAddress { get; set; } + /// The port number for discovery. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The port number for discovery.", + SerializedName = @"port", + PossibleTypes = new [] { typeof(string) })] + string Port { get; set; } + /// The process server Id from where the update can be orchestrated. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The process server Id from where the update can be orchestrated.", + SerializedName = @"processServerId", + PossibleTypes = new [] { typeof(string) })] + string ProcessServerId { get; set; } + /// The CS account Id which has privileges to update the vCenter. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The CS account Id which has privileges to update the vCenter.", + SerializedName = @"runAsAccountId", + PossibleTypes = new [] { typeof(string) })] + string RunAsAccountId { get; set; } + + } + /// The properties of an update vCenter request. + internal partial interface IUpdateVCenterRequestPropertiesInternal + + { + /// The friendly name of the vCenter. + string FriendlyName { get; set; } + /// The IP address of the vCenter to be discovered. + string IPAddress { get; set; } + /// The port number for discovery. + string Port { get; set; } + /// The process server Id from where the update can be orchestrated. + string ProcessServerId { get; set; } + /// The CS account Id which has privileges to update the vCenter. + string RunAsAccountId { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateVCenterRequestProperties.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateVCenterRequestProperties.json.cs new file mode 100644 index 000000000000..0062e56cae43 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/UpdateVCenterRequestProperties.json.cs @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The properties of an update vCenter request. + public partial class UpdateVCenterRequestProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateVCenterRequestProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateVCenterRequestProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateVCenterRequestProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new UpdateVCenterRequestProperties(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._friendlyName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._friendlyName.ToString()) : null, "friendlyName" ,container.Add ); + AddIf( null != (((object)this._iPAddress)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._iPAddress.ToString()) : null, "ipAddress" ,container.Add ); + AddIf( null != (((object)this._processServerId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._processServerId.ToString()) : null, "processServerId" ,container.Add ); + AddIf( null != (((object)this._port)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._port.ToString()) : null, "port" ,container.Add ); + AddIf( null != (((object)this._runAsAccountId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._runAsAccountId.ToString()) : null, "runAsAccountId" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal UpdateVCenterRequestProperties(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_friendlyName = If( json?.PropertyT("friendlyName"), out var __jsonFriendlyName) ? (string)__jsonFriendlyName : (string)FriendlyName;} + {_iPAddress = If( json?.PropertyT("ipAddress"), out var __jsonIPAddress) ? (string)__jsonIPAddress : (string)IPAddress;} + {_processServerId = If( json?.PropertyT("processServerId"), out var __jsonProcessServerId) ? (string)__jsonProcessServerId : (string)ProcessServerId;} + {_port = If( json?.PropertyT("port"), out var __jsonPort) ? (string)__jsonPort : (string)Port;} + {_runAsAccountId = If( json?.PropertyT("runAsAccountId"), out var __jsonRunAsAccountId) ? (string)__jsonRunAsAccountId : (string)RunAsAccountId;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VCenter.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VCenter.PowerShell.cs new file mode 100644 index 000000000000..ba6cb81c5d2d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VCenter.PowerShell.cs @@ -0,0 +1,264 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// vCenter definition. + [System.ComponentModel.TypeConverter(typeof(VCenterTypeConverter))] + public partial class VCenter + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenter DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VCenter(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenter DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VCenter(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenter FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VCenter(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VCenterPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("FriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterInternal)this).FriendlyName = (string) content.GetValueForProperty("FriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterInternal)this).FriendlyName, global::System.Convert.ToString); + } + if (content.Contains("InternalId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterInternal)this).InternalId = (string) content.GetValueForProperty("InternalId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterInternal)this).InternalId, global::System.Convert.ToString); + } + if (content.Contains("LastHeartbeat")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterInternal)this).LastHeartbeat = (global::System.DateTime?) content.GetValueForProperty("LastHeartbeat",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterInternal)this).LastHeartbeat, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("DiscoveryStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterInternal)this).DiscoveryStatus = (string) content.GetValueForProperty("DiscoveryStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterInternal)this).DiscoveryStatus, global::System.Convert.ToString); + } + if (content.Contains("ProcessServerId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterInternal)this).ProcessServerId = (string) content.GetValueForProperty("ProcessServerId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterInternal)this).ProcessServerId, global::System.Convert.ToString); + } + if (content.Contains("IPAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterInternal)this).IPAddress = (string) content.GetValueForProperty("IPAddress",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterInternal)this).IPAddress, global::System.Convert.ToString); + } + if (content.Contains("InfrastructureId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterInternal)this).InfrastructureId = (string) content.GetValueForProperty("InfrastructureId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterInternal)this).InfrastructureId, global::System.Convert.ToString); + } + if (content.Contains("Port")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterInternal)this).Port = (string) content.GetValueForProperty("Port",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterInternal)this).Port, global::System.Convert.ToString); + } + if (content.Contains("RunAsAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterInternal)this).RunAsAccountId = (string) content.GetValueForProperty("RunAsAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterInternal)this).RunAsAccountId, global::System.Convert.ToString); + } + if (content.Contains("FabricArmResourceName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterInternal)this).FabricArmResourceName = (string) content.GetValueForProperty("FabricArmResourceName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterInternal)this).FabricArmResourceName, global::System.Convert.ToString); + } + if (content.Contains("HealthError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterInternal)this).HealthError = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[]) content.GetValueForProperty("HealthError",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterInternal)this).HealthError, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthErrorTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal VCenter(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VCenterPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("FriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterInternal)this).FriendlyName = (string) content.GetValueForProperty("FriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterInternal)this).FriendlyName, global::System.Convert.ToString); + } + if (content.Contains("InternalId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterInternal)this).InternalId = (string) content.GetValueForProperty("InternalId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterInternal)this).InternalId, global::System.Convert.ToString); + } + if (content.Contains("LastHeartbeat")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterInternal)this).LastHeartbeat = (global::System.DateTime?) content.GetValueForProperty("LastHeartbeat",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterInternal)this).LastHeartbeat, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("DiscoveryStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterInternal)this).DiscoveryStatus = (string) content.GetValueForProperty("DiscoveryStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterInternal)this).DiscoveryStatus, global::System.Convert.ToString); + } + if (content.Contains("ProcessServerId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterInternal)this).ProcessServerId = (string) content.GetValueForProperty("ProcessServerId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterInternal)this).ProcessServerId, global::System.Convert.ToString); + } + if (content.Contains("IPAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterInternal)this).IPAddress = (string) content.GetValueForProperty("IPAddress",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterInternal)this).IPAddress, global::System.Convert.ToString); + } + if (content.Contains("InfrastructureId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterInternal)this).InfrastructureId = (string) content.GetValueForProperty("InfrastructureId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterInternal)this).InfrastructureId, global::System.Convert.ToString); + } + if (content.Contains("Port")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterInternal)this).Port = (string) content.GetValueForProperty("Port",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterInternal)this).Port, global::System.Convert.ToString); + } + if (content.Contains("RunAsAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterInternal)this).RunAsAccountId = (string) content.GetValueForProperty("RunAsAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterInternal)this).RunAsAccountId, global::System.Convert.ToString); + } + if (content.Contains("FabricArmResourceName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterInternal)this).FabricArmResourceName = (string) content.GetValueForProperty("FabricArmResourceName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterInternal)this).FabricArmResourceName, global::System.Convert.ToString); + } + if (content.Contains("HealthError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterInternal)this).HealthError = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[]) content.GetValueForProperty("HealthError",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterInternal)this).HealthError, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthErrorTypeConverter.ConvertFrom)); + } + AfterDeserializePSObject(content); + } + } + /// vCenter definition. + [System.ComponentModel.TypeConverter(typeof(VCenterTypeConverter))] + public partial interface IVCenter + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VCenter.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VCenter.TypeConverter.cs new file mode 100644 index 000000000000..7cca449333c8 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VCenter.TypeConverter.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VCenterTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenter ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenter).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VCenter.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VCenter.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VCenter.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VCenter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VCenter.cs new file mode 100644 index 000000000000..3fbba37a9c85 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VCenter.cs @@ -0,0 +1,244 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// vCenter definition. + public partial class VCenter : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenter, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResource __resource = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.Resource(); + + /// The VCenter discovery status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string DiscoveryStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterPropertiesInternal)Property).DiscoveryStatus; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterPropertiesInternal)Property).DiscoveryStatus = value ?? null; } + + /// The ARM resource name of the fabric containing this VCenter. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string FabricArmResourceName { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterPropertiesInternal)Property).FabricArmResourceName; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterPropertiesInternal)Property).FabricArmResourceName = value ?? null; } + + /// Friendly name of the vCenter. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string FriendlyName { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterPropertiesInternal)Property).FriendlyName; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterPropertiesInternal)Property).FriendlyName = value ?? null; } + + /// The health errors for this VCenter. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] HealthError { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterPropertiesInternal)Property).HealthError; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterPropertiesInternal)Property).HealthError = value ?? null /* arrayOf */; } + + /// The IP address of the vCenter. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string IPAddress { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterPropertiesInternal)Property).IPAddress; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterPropertiesInternal)Property).IPAddress = value ?? null; } + + /// Resource Id + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Id; } + + /// The infrastructure Id of vCenter. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string InfrastructureId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterPropertiesInternal)Property).InfrastructureId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterPropertiesInternal)Property).InfrastructureId = value ?? null; } + + /// VCenter internal ID. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string InternalId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterPropertiesInternal)Property).InternalId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterPropertiesInternal)Property).InternalId = value ?? null; } + + /// The time when the last heartbeat was received by vCenter. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public global::System.DateTime? LastHeartbeat { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterPropertiesInternal)Property).LastHeartbeat; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterPropertiesInternal)Property).LastHeartbeat = value ?? default(global::System.DateTime); } + + /// Resource Location + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string Location { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Location; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Location = value ?? null; } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Id = value; } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Name = value; } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Type = value; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterProperties Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VCenterProperties()); set { {_property = value;} } } + + /// Resource Name + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Name; } + + /// The port number for discovery. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string Port { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterPropertiesInternal)Property).Port; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterPropertiesInternal)Property).Port = value ?? null; } + + /// The process server Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string ProcessServerId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterPropertiesInternal)Property).ProcessServerId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterPropertiesInternal)Property).ProcessServerId = value ?? null; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterProperties _property; + + /// VCenter related data. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VCenterProperties()); set => this._property = value; } + + /// The account Id which has privileges to discover the vCenter. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string RunAsAccountId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterPropertiesInternal)Property).RunAsAccountId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterPropertiesInternal)Property).RunAsAccountId = value ?? null; } + + /// Resource Type + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Type; } + + /// Creates an new instance. + public VCenter() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__resource), __resource); + await eventListener.AssertObjectIsValid(nameof(__resource), __resource); + } + } + /// vCenter definition. + public partial interface IVCenter : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResource + { + /// The VCenter discovery status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The VCenter discovery status.", + SerializedName = @"discoveryStatus", + PossibleTypes = new [] { typeof(string) })] + string DiscoveryStatus { get; set; } + /// The ARM resource name of the fabric containing this VCenter. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The ARM resource name of the fabric containing this VCenter.", + SerializedName = @"fabricArmResourceName", + PossibleTypes = new [] { typeof(string) })] + string FabricArmResourceName { get; set; } + /// Friendly name of the vCenter. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Friendly name of the vCenter.", + SerializedName = @"friendlyName", + PossibleTypes = new [] { typeof(string) })] + string FriendlyName { get; set; } + /// The health errors for this VCenter. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The health errors for this VCenter.", + SerializedName = @"healthErrors", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] HealthError { get; set; } + /// The IP address of the vCenter. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The IP address of the vCenter.", + SerializedName = @"ipAddress", + PossibleTypes = new [] { typeof(string) })] + string IPAddress { get; set; } + /// The infrastructure Id of vCenter. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The infrastructure Id of vCenter.", + SerializedName = @"infrastructureId", + PossibleTypes = new [] { typeof(string) })] + string InfrastructureId { get; set; } + /// VCenter internal ID. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"VCenter internal ID.", + SerializedName = @"internalId", + PossibleTypes = new [] { typeof(string) })] + string InternalId { get; set; } + /// The time when the last heartbeat was received by vCenter. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The time when the last heartbeat was received by vCenter.", + SerializedName = @"lastHeartbeat", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? LastHeartbeat { get; set; } + /// The port number for discovery. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The port number for discovery.", + SerializedName = @"port", + PossibleTypes = new [] { typeof(string) })] + string Port { get; set; } + /// The process server Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The process server Id.", + SerializedName = @"processServerId", + PossibleTypes = new [] { typeof(string) })] + string ProcessServerId { get; set; } + /// The account Id which has privileges to discover the vCenter. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The account Id which has privileges to discover the vCenter.", + SerializedName = @"runAsAccountId", + PossibleTypes = new [] { typeof(string) })] + string RunAsAccountId { get; set; } + + } + /// vCenter definition. + internal partial interface IVCenterInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal + { + /// The VCenter discovery status. + string DiscoveryStatus { get; set; } + /// The ARM resource name of the fabric containing this VCenter. + string FabricArmResourceName { get; set; } + /// Friendly name of the vCenter. + string FriendlyName { get; set; } + /// The health errors for this VCenter. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] HealthError { get; set; } + /// The IP address of the vCenter. + string IPAddress { get; set; } + /// The infrastructure Id of vCenter. + string InfrastructureId { get; set; } + /// VCenter internal ID. + string InternalId { get; set; } + /// The time when the last heartbeat was received by vCenter. + global::System.DateTime? LastHeartbeat { get; set; } + /// The port number for discovery. + string Port { get; set; } + /// The process server Id. + string ProcessServerId { get; set; } + /// VCenter related data. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterProperties Property { get; set; } + /// The account Id which has privileges to discover the vCenter. + string RunAsAccountId { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VCenter.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VCenter.json.cs new file mode 100644 index 000000000000..e8995818c36c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VCenter.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// vCenter definition. + public partial class VCenter + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenter. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenter. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenter FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new VCenter(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __resource?.ToJson(container, serializationMode); + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal VCenter(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __resource = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.Resource(json); + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VCenterProperties.FromJson(__jsonProperties) : Property;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VCenterCollection.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VCenterCollection.PowerShell.cs new file mode 100644 index 000000000000..012078d1bc24 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VCenterCollection.PowerShell.cs @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Collection of vCenter details. + [System.ComponentModel.TypeConverter(typeof(VCenterCollectionTypeConverter))] + public partial class VCenterCollection + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterCollection DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VCenterCollection(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterCollection DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VCenterCollection(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterCollection FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VCenterCollection(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenter[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VCenterTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterCollectionInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterCollectionInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal VCenterCollection(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenter[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VCenterTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterCollectionInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterCollectionInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + } + /// Collection of vCenter details. + [System.ComponentModel.TypeConverter(typeof(VCenterCollectionTypeConverter))] + public partial interface IVCenterCollection + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VCenterCollection.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VCenterCollection.TypeConverter.cs new file mode 100644 index 000000000000..f063cd1b4eb3 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VCenterCollection.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VCenterCollectionTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterCollection ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterCollection).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VCenterCollection.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VCenterCollection.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VCenterCollection.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VCenterCollection.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VCenterCollection.cs new file mode 100644 index 000000000000..30241ff66b06 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VCenterCollection.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Collection of vCenter details. + public partial class VCenterCollection : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterCollection, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterCollectionInternal + { + + /// Backing field for property. + private string _nextLink; + + /// The value of next link. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string NextLink { get => this._nextLink; set => this._nextLink = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenter[] _value; + + /// The vCenter details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenter[] Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public VCenterCollection() + { + + } + } + /// Collection of vCenter details. + public partial interface IVCenterCollection : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The value of next link. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The value of next link.", + SerializedName = @"nextLink", + PossibleTypes = new [] { typeof(string) })] + string NextLink { get; set; } + /// The vCenter details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The vCenter details.", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenter) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenter[] Value { get; set; } + + } + /// Collection of vCenter details. + internal partial interface IVCenterCollectionInternal + + { + /// The value of next link. + string NextLink { get; set; } + /// The vCenter details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenter[] Value { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VCenterCollection.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VCenterCollection.json.cs new file mode 100644 index 000000000000..03163705a700 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VCenterCollection.json.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Collection of vCenter details. + public partial class VCenterCollection + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterCollection. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterCollection. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterCollection FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new VCenterCollection(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._value) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._value ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("value",__w); + } + AddIf( null != (((object)this._nextLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal VCenterCollection(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenter) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VCenter.FromJson(__u) )) ))() : null : Value;} + {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)NextLink;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VCenterProperties.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VCenterProperties.PowerShell.cs new file mode 100644 index 000000000000..a0922df4aead --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VCenterProperties.PowerShell.cs @@ -0,0 +1,224 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// vCenter properties. + [System.ComponentModel.TypeConverter(typeof(VCenterPropertiesTypeConverter))] + public partial class VCenterProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VCenterProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VCenterProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VCenterProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("FriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterPropertiesInternal)this).FriendlyName = (string) content.GetValueForProperty("FriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterPropertiesInternal)this).FriendlyName, global::System.Convert.ToString); + } + if (content.Contains("InternalId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterPropertiesInternal)this).InternalId = (string) content.GetValueForProperty("InternalId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterPropertiesInternal)this).InternalId, global::System.Convert.ToString); + } + if (content.Contains("LastHeartbeat")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterPropertiesInternal)this).LastHeartbeat = (global::System.DateTime?) content.GetValueForProperty("LastHeartbeat",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterPropertiesInternal)this).LastHeartbeat, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("DiscoveryStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterPropertiesInternal)this).DiscoveryStatus = (string) content.GetValueForProperty("DiscoveryStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterPropertiesInternal)this).DiscoveryStatus, global::System.Convert.ToString); + } + if (content.Contains("ProcessServerId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterPropertiesInternal)this).ProcessServerId = (string) content.GetValueForProperty("ProcessServerId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterPropertiesInternal)this).ProcessServerId, global::System.Convert.ToString); + } + if (content.Contains("IPAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterPropertiesInternal)this).IPAddress = (string) content.GetValueForProperty("IPAddress",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterPropertiesInternal)this).IPAddress, global::System.Convert.ToString); + } + if (content.Contains("InfrastructureId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterPropertiesInternal)this).InfrastructureId = (string) content.GetValueForProperty("InfrastructureId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterPropertiesInternal)this).InfrastructureId, global::System.Convert.ToString); + } + if (content.Contains("Port")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterPropertiesInternal)this).Port = (string) content.GetValueForProperty("Port",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterPropertiesInternal)this).Port, global::System.Convert.ToString); + } + if (content.Contains("RunAsAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterPropertiesInternal)this).RunAsAccountId = (string) content.GetValueForProperty("RunAsAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterPropertiesInternal)this).RunAsAccountId, global::System.Convert.ToString); + } + if (content.Contains("FabricArmResourceName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterPropertiesInternal)this).FabricArmResourceName = (string) content.GetValueForProperty("FabricArmResourceName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterPropertiesInternal)this).FabricArmResourceName, global::System.Convert.ToString); + } + if (content.Contains("HealthError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterPropertiesInternal)this).HealthError = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[]) content.GetValueForProperty("HealthError",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterPropertiesInternal)this).HealthError, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthErrorTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal VCenterProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("FriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterPropertiesInternal)this).FriendlyName = (string) content.GetValueForProperty("FriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterPropertiesInternal)this).FriendlyName, global::System.Convert.ToString); + } + if (content.Contains("InternalId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterPropertiesInternal)this).InternalId = (string) content.GetValueForProperty("InternalId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterPropertiesInternal)this).InternalId, global::System.Convert.ToString); + } + if (content.Contains("LastHeartbeat")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterPropertiesInternal)this).LastHeartbeat = (global::System.DateTime?) content.GetValueForProperty("LastHeartbeat",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterPropertiesInternal)this).LastHeartbeat, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("DiscoveryStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterPropertiesInternal)this).DiscoveryStatus = (string) content.GetValueForProperty("DiscoveryStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterPropertiesInternal)this).DiscoveryStatus, global::System.Convert.ToString); + } + if (content.Contains("ProcessServerId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterPropertiesInternal)this).ProcessServerId = (string) content.GetValueForProperty("ProcessServerId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterPropertiesInternal)this).ProcessServerId, global::System.Convert.ToString); + } + if (content.Contains("IPAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterPropertiesInternal)this).IPAddress = (string) content.GetValueForProperty("IPAddress",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterPropertiesInternal)this).IPAddress, global::System.Convert.ToString); + } + if (content.Contains("InfrastructureId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterPropertiesInternal)this).InfrastructureId = (string) content.GetValueForProperty("InfrastructureId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterPropertiesInternal)this).InfrastructureId, global::System.Convert.ToString); + } + if (content.Contains("Port")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterPropertiesInternal)this).Port = (string) content.GetValueForProperty("Port",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterPropertiesInternal)this).Port, global::System.Convert.ToString); + } + if (content.Contains("RunAsAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterPropertiesInternal)this).RunAsAccountId = (string) content.GetValueForProperty("RunAsAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterPropertiesInternal)this).RunAsAccountId, global::System.Convert.ToString); + } + if (content.Contains("FabricArmResourceName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterPropertiesInternal)this).FabricArmResourceName = (string) content.GetValueForProperty("FabricArmResourceName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterPropertiesInternal)this).FabricArmResourceName, global::System.Convert.ToString); + } + if (content.Contains("HealthError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterPropertiesInternal)this).HealthError = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[]) content.GetValueForProperty("HealthError",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterPropertiesInternal)this).HealthError, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthErrorTypeConverter.ConvertFrom)); + } + AfterDeserializePSObject(content); + } + } + /// vCenter properties. + [System.ComponentModel.TypeConverter(typeof(VCenterPropertiesTypeConverter))] + public partial interface IVCenterProperties + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VCenterProperties.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VCenterProperties.TypeConverter.cs new file mode 100644 index 000000000000..adf0183096c0 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VCenterProperties.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VCenterPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VCenterProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VCenterProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VCenterProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VCenterProperties.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VCenterProperties.cs new file mode 100644 index 000000000000..9360386d2ed4 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VCenterProperties.cs @@ -0,0 +1,221 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// vCenter properties. + public partial class VCenterProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterProperties, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterPropertiesInternal + { + + /// Backing field for property. + private string _discoveryStatus; + + /// The VCenter discovery status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string DiscoveryStatus { get => this._discoveryStatus; set => this._discoveryStatus = value; } + + /// Backing field for property. + private string _fabricArmResourceName; + + /// The ARM resource name of the fabric containing this VCenter. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string FabricArmResourceName { get => this._fabricArmResourceName; set => this._fabricArmResourceName = value; } + + /// Backing field for property. + private string _friendlyName; + + /// Friendly name of the vCenter. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string FriendlyName { get => this._friendlyName; set => this._friendlyName = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] _healthError; + + /// The health errors for this VCenter. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] HealthError { get => this._healthError; set => this._healthError = value; } + + /// Backing field for property. + private string _iPAddress; + + /// The IP address of the vCenter. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string IPAddress { get => this._iPAddress; set => this._iPAddress = value; } + + /// Backing field for property. + private string _infrastructureId; + + /// The infrastructure Id of vCenter. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string InfrastructureId { get => this._infrastructureId; set => this._infrastructureId = value; } + + /// Backing field for property. + private string _internalId; + + /// VCenter internal ID. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string InternalId { get => this._internalId; set => this._internalId = value; } + + /// Backing field for property. + private global::System.DateTime? _lastHeartbeat; + + /// The time when the last heartbeat was received by vCenter. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public global::System.DateTime? LastHeartbeat { get => this._lastHeartbeat; set => this._lastHeartbeat = value; } + + /// Backing field for property. + private string _port; + + /// The port number for discovery. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Port { get => this._port; set => this._port = value; } + + /// Backing field for property. + private string _processServerId; + + /// The process server Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ProcessServerId { get => this._processServerId; set => this._processServerId = value; } + + /// Backing field for property. + private string _runAsAccountId; + + /// The account Id which has privileges to discover the vCenter. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RunAsAccountId { get => this._runAsAccountId; set => this._runAsAccountId = value; } + + /// Creates an new instance. + public VCenterProperties() + { + + } + } + /// vCenter properties. + public partial interface IVCenterProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The VCenter discovery status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The VCenter discovery status.", + SerializedName = @"discoveryStatus", + PossibleTypes = new [] { typeof(string) })] + string DiscoveryStatus { get; set; } + /// The ARM resource name of the fabric containing this VCenter. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The ARM resource name of the fabric containing this VCenter.", + SerializedName = @"fabricArmResourceName", + PossibleTypes = new [] { typeof(string) })] + string FabricArmResourceName { get; set; } + /// Friendly name of the vCenter. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Friendly name of the vCenter.", + SerializedName = @"friendlyName", + PossibleTypes = new [] { typeof(string) })] + string FriendlyName { get; set; } + /// The health errors for this VCenter. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The health errors for this VCenter.", + SerializedName = @"healthErrors", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] HealthError { get; set; } + /// The IP address of the vCenter. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The IP address of the vCenter.", + SerializedName = @"ipAddress", + PossibleTypes = new [] { typeof(string) })] + string IPAddress { get; set; } + /// The infrastructure Id of vCenter. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The infrastructure Id of vCenter.", + SerializedName = @"infrastructureId", + PossibleTypes = new [] { typeof(string) })] + string InfrastructureId { get; set; } + /// VCenter internal ID. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"VCenter internal ID.", + SerializedName = @"internalId", + PossibleTypes = new [] { typeof(string) })] + string InternalId { get; set; } + /// The time when the last heartbeat was received by vCenter. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The time when the last heartbeat was received by vCenter.", + SerializedName = @"lastHeartbeat", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? LastHeartbeat { get; set; } + /// The port number for discovery. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The port number for discovery.", + SerializedName = @"port", + PossibleTypes = new [] { typeof(string) })] + string Port { get; set; } + /// The process server Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The process server Id.", + SerializedName = @"processServerId", + PossibleTypes = new [] { typeof(string) })] + string ProcessServerId { get; set; } + /// The account Id which has privileges to discover the vCenter. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The account Id which has privileges to discover the vCenter.", + SerializedName = @"runAsAccountId", + PossibleTypes = new [] { typeof(string) })] + string RunAsAccountId { get; set; } + + } + /// vCenter properties. + internal partial interface IVCenterPropertiesInternal + + { + /// The VCenter discovery status. + string DiscoveryStatus { get; set; } + /// The ARM resource name of the fabric containing this VCenter. + string FabricArmResourceName { get; set; } + /// Friendly name of the vCenter. + string FriendlyName { get; set; } + /// The health errors for this VCenter. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] HealthError { get; set; } + /// The IP address of the vCenter. + string IPAddress { get; set; } + /// The infrastructure Id of vCenter. + string InfrastructureId { get; set; } + /// VCenter internal ID. + string InternalId { get; set; } + /// The time when the last heartbeat was received by vCenter. + global::System.DateTime? LastHeartbeat { get; set; } + /// The port number for discovery. + string Port { get; set; } + /// The process server Id. + string ProcessServerId { get; set; } + /// The account Id which has privileges to discover the vCenter. + string RunAsAccountId { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VCenterProperties.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VCenterProperties.json.cs new file mode 100644 index 000000000000..efebf37a66d7 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VCenterProperties.json.cs @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// vCenter properties. + public partial class VCenterProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new VCenterProperties(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._friendlyName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._friendlyName.ToString()) : null, "friendlyName" ,container.Add ); + AddIf( null != (((object)this._internalId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._internalId.ToString()) : null, "internalId" ,container.Add ); + AddIf( null != this._lastHeartbeat ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._lastHeartbeat?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "lastHeartbeat" ,container.Add ); + AddIf( null != (((object)this._discoveryStatus)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._discoveryStatus.ToString()) : null, "discoveryStatus" ,container.Add ); + AddIf( null != (((object)this._processServerId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._processServerId.ToString()) : null, "processServerId" ,container.Add ); + AddIf( null != (((object)this._iPAddress)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._iPAddress.ToString()) : null, "ipAddress" ,container.Add ); + AddIf( null != (((object)this._infrastructureId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._infrastructureId.ToString()) : null, "infrastructureId" ,container.Add ); + AddIf( null != (((object)this._port)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._port.ToString()) : null, "port" ,container.Add ); + AddIf( null != (((object)this._runAsAccountId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._runAsAccountId.ToString()) : null, "runAsAccountId" ,container.Add ); + AddIf( null != (((object)this._fabricArmResourceName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._fabricArmResourceName.ToString()) : null, "fabricArmResourceName" ,container.Add ); + if (null != this._healthError) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._healthError ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("healthErrors",__w); + } + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal VCenterProperties(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_friendlyName = If( json?.PropertyT("friendlyName"), out var __jsonFriendlyName) ? (string)__jsonFriendlyName : (string)FriendlyName;} + {_internalId = If( json?.PropertyT("internalId"), out var __jsonInternalId) ? (string)__jsonInternalId : (string)InternalId;} + {_lastHeartbeat = If( json?.PropertyT("lastHeartbeat"), out var __jsonLastHeartbeat) ? global::System.DateTime.TryParse((string)__jsonLastHeartbeat, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonLastHeartbeatValue) ? __jsonLastHeartbeatValue : LastHeartbeat : LastHeartbeat;} + {_discoveryStatus = If( json?.PropertyT("discoveryStatus"), out var __jsonDiscoveryStatus) ? (string)__jsonDiscoveryStatus : (string)DiscoveryStatus;} + {_processServerId = If( json?.PropertyT("processServerId"), out var __jsonProcessServerId) ? (string)__jsonProcessServerId : (string)ProcessServerId;} + {_iPAddress = If( json?.PropertyT("ipAddress"), out var __jsonIPAddress) ? (string)__jsonIPAddress : (string)IPAddress;} + {_infrastructureId = If( json?.PropertyT("infrastructureId"), out var __jsonInfrastructureId) ? (string)__jsonInfrastructureId : (string)InfrastructureId;} + {_port = If( json?.PropertyT("port"), out var __jsonPort) ? (string)__jsonPort : (string)Port;} + {_runAsAccountId = If( json?.PropertyT("runAsAccountId"), out var __jsonRunAsAccountId) ? (string)__jsonRunAsAccountId : (string)RunAsAccountId;} + {_fabricArmResourceName = If( json?.PropertyT("fabricArmResourceName"), out var __jsonFabricArmResourceName) ? (string)__jsonFabricArmResourceName : (string)FabricArmResourceName;} + {_healthError = If( json?.PropertyT("healthErrors"), out var __jsonHealthErrors) ? If( __jsonHealthErrors as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthError.FromJson(__u) )) ))() : null : HealthError;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMNicDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMNicDetails.PowerShell.cs new file mode 100644 index 000000000000..8d777e92c093 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMNicDetails.PowerShell.cs @@ -0,0 +1,288 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Hyper V VM network details. + [System.ComponentModel.TypeConverter(typeof(VMNicDetailsTypeConverter))] + public partial class VMNicDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VMNicDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VMNicDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VMNicDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("NicId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetailsInternal)this).NicId = (string) content.GetValueForProperty("NicId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetailsInternal)this).NicId, global::System.Convert.ToString); + } + if (content.Contains("ReplicaNicId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetailsInternal)this).ReplicaNicId = (string) content.GetValueForProperty("ReplicaNicId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetailsInternal)this).ReplicaNicId, global::System.Convert.ToString); + } + if (content.Contains("SourceNicArmId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetailsInternal)this).SourceNicArmId = (string) content.GetValueForProperty("SourceNicArmId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetailsInternal)this).SourceNicArmId, global::System.Convert.ToString); + } + if (content.Contains("VMNetworkName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetailsInternal)this).VMNetworkName = (string) content.GetValueForProperty("VMNetworkName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetailsInternal)this).VMNetworkName, global::System.Convert.ToString); + } + if (content.Contains("RecoveryVMNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetailsInternal)this).RecoveryVMNetworkId = (string) content.GetValueForProperty("RecoveryVMNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetailsInternal)this).RecoveryVMNetworkId, global::System.Convert.ToString); + } + if (content.Contains("IPConfig")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetailsInternal)this).IPConfig = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigDetails[]) content.GetValueForProperty("IPConfig",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetailsInternal)this).IPConfig, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPConfigDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("SelectionType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetailsInternal)this).SelectionType = (string) content.GetValueForProperty("SelectionType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetailsInternal)this).SelectionType, global::System.Convert.ToString); + } + if (content.Contains("RecoveryNetworkSecurityGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetailsInternal)this).RecoveryNetworkSecurityGroupId = (string) content.GetValueForProperty("RecoveryNetworkSecurityGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetailsInternal)this).RecoveryNetworkSecurityGroupId, global::System.Convert.ToString); + } + if (content.Contains("EnableAcceleratedNetworkingOnRecovery")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetailsInternal)this).EnableAcceleratedNetworkingOnRecovery = (bool?) content.GetValueForProperty("EnableAcceleratedNetworkingOnRecovery",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetailsInternal)this).EnableAcceleratedNetworkingOnRecovery, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("TfoVMNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetailsInternal)this).TfoVMNetworkId = (string) content.GetValueForProperty("TfoVMNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetailsInternal)this).TfoVMNetworkId, global::System.Convert.ToString); + } + if (content.Contains("TfoNetworkSecurityGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetailsInternal)this).TfoNetworkSecurityGroupId = (string) content.GetValueForProperty("TfoNetworkSecurityGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetailsInternal)this).TfoNetworkSecurityGroupId, global::System.Convert.ToString); + } + if (content.Contains("EnableAcceleratedNetworkingOnTfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetailsInternal)this).EnableAcceleratedNetworkingOnTfo = (bool?) content.GetValueForProperty("EnableAcceleratedNetworkingOnTfo",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetailsInternal)this).EnableAcceleratedNetworkingOnTfo, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("RecoveryNicName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetailsInternal)this).RecoveryNicName = (string) content.GetValueForProperty("RecoveryNicName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetailsInternal)this).RecoveryNicName, global::System.Convert.ToString); + } + if (content.Contains("RecoveryNicResourceGroupName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetailsInternal)this).RecoveryNicResourceGroupName = (string) content.GetValueForProperty("RecoveryNicResourceGroupName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetailsInternal)this).RecoveryNicResourceGroupName, global::System.Convert.ToString); + } + if (content.Contains("ReuseExistingNic")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetailsInternal)this).ReuseExistingNic = (bool?) content.GetValueForProperty("ReuseExistingNic",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetailsInternal)this).ReuseExistingNic, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("TfoRecoveryNicName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetailsInternal)this).TfoRecoveryNicName = (string) content.GetValueForProperty("TfoRecoveryNicName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetailsInternal)this).TfoRecoveryNicName, global::System.Convert.ToString); + } + if (content.Contains("TfoRecoveryNicResourceGroupName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetailsInternal)this).TfoRecoveryNicResourceGroupName = (string) content.GetValueForProperty("TfoRecoveryNicResourceGroupName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetailsInternal)this).TfoRecoveryNicResourceGroupName, global::System.Convert.ToString); + } + if (content.Contains("TfoReuseExistingNic")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetailsInternal)this).TfoReuseExistingNic = (bool?) content.GetValueForProperty("TfoReuseExistingNic",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetailsInternal)this).TfoReuseExistingNic, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("TargetNicName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetailsInternal)this).TargetNicName = (string) content.GetValueForProperty("TargetNicName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetailsInternal)this).TargetNicName, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal VMNicDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("NicId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetailsInternal)this).NicId = (string) content.GetValueForProperty("NicId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetailsInternal)this).NicId, global::System.Convert.ToString); + } + if (content.Contains("ReplicaNicId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetailsInternal)this).ReplicaNicId = (string) content.GetValueForProperty("ReplicaNicId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetailsInternal)this).ReplicaNicId, global::System.Convert.ToString); + } + if (content.Contains("SourceNicArmId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetailsInternal)this).SourceNicArmId = (string) content.GetValueForProperty("SourceNicArmId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetailsInternal)this).SourceNicArmId, global::System.Convert.ToString); + } + if (content.Contains("VMNetworkName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetailsInternal)this).VMNetworkName = (string) content.GetValueForProperty("VMNetworkName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetailsInternal)this).VMNetworkName, global::System.Convert.ToString); + } + if (content.Contains("RecoveryVMNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetailsInternal)this).RecoveryVMNetworkId = (string) content.GetValueForProperty("RecoveryVMNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetailsInternal)this).RecoveryVMNetworkId, global::System.Convert.ToString); + } + if (content.Contains("IPConfig")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetailsInternal)this).IPConfig = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigDetails[]) content.GetValueForProperty("IPConfig",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetailsInternal)this).IPConfig, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPConfigDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("SelectionType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetailsInternal)this).SelectionType = (string) content.GetValueForProperty("SelectionType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetailsInternal)this).SelectionType, global::System.Convert.ToString); + } + if (content.Contains("RecoveryNetworkSecurityGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetailsInternal)this).RecoveryNetworkSecurityGroupId = (string) content.GetValueForProperty("RecoveryNetworkSecurityGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetailsInternal)this).RecoveryNetworkSecurityGroupId, global::System.Convert.ToString); + } + if (content.Contains("EnableAcceleratedNetworkingOnRecovery")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetailsInternal)this).EnableAcceleratedNetworkingOnRecovery = (bool?) content.GetValueForProperty("EnableAcceleratedNetworkingOnRecovery",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetailsInternal)this).EnableAcceleratedNetworkingOnRecovery, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("TfoVMNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetailsInternal)this).TfoVMNetworkId = (string) content.GetValueForProperty("TfoVMNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetailsInternal)this).TfoVMNetworkId, global::System.Convert.ToString); + } + if (content.Contains("TfoNetworkSecurityGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetailsInternal)this).TfoNetworkSecurityGroupId = (string) content.GetValueForProperty("TfoNetworkSecurityGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetailsInternal)this).TfoNetworkSecurityGroupId, global::System.Convert.ToString); + } + if (content.Contains("EnableAcceleratedNetworkingOnTfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetailsInternal)this).EnableAcceleratedNetworkingOnTfo = (bool?) content.GetValueForProperty("EnableAcceleratedNetworkingOnTfo",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetailsInternal)this).EnableAcceleratedNetworkingOnTfo, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("RecoveryNicName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetailsInternal)this).RecoveryNicName = (string) content.GetValueForProperty("RecoveryNicName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetailsInternal)this).RecoveryNicName, global::System.Convert.ToString); + } + if (content.Contains("RecoveryNicResourceGroupName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetailsInternal)this).RecoveryNicResourceGroupName = (string) content.GetValueForProperty("RecoveryNicResourceGroupName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetailsInternal)this).RecoveryNicResourceGroupName, global::System.Convert.ToString); + } + if (content.Contains("ReuseExistingNic")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetailsInternal)this).ReuseExistingNic = (bool?) content.GetValueForProperty("ReuseExistingNic",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetailsInternal)this).ReuseExistingNic, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("TfoRecoveryNicName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetailsInternal)this).TfoRecoveryNicName = (string) content.GetValueForProperty("TfoRecoveryNicName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetailsInternal)this).TfoRecoveryNicName, global::System.Convert.ToString); + } + if (content.Contains("TfoRecoveryNicResourceGroupName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetailsInternal)this).TfoRecoveryNicResourceGroupName = (string) content.GetValueForProperty("TfoRecoveryNicResourceGroupName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetailsInternal)this).TfoRecoveryNicResourceGroupName, global::System.Convert.ToString); + } + if (content.Contains("TfoReuseExistingNic")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetailsInternal)this).TfoReuseExistingNic = (bool?) content.GetValueForProperty("TfoReuseExistingNic",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetailsInternal)this).TfoReuseExistingNic, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("TargetNicName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetailsInternal)this).TargetNicName = (string) content.GetValueForProperty("TargetNicName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetailsInternal)this).TargetNicName, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + } + /// Hyper V VM network details. + [System.ComponentModel.TypeConverter(typeof(VMNicDetailsTypeConverter))] + public partial interface IVMNicDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMNicDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMNicDetails.TypeConverter.cs new file mode 100644 index 000000000000..44689f8ff9c9 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMNicDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VMNicDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VMNicDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VMNicDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VMNicDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMNicDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMNicDetails.cs new file mode 100644 index 000000000000..2388f454d835 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMNicDetails.cs @@ -0,0 +1,371 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Hyper V VM network details. + public partial class VMNicDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetailsInternal + { + + /// + /// Backing field for property. + /// + private bool? _enableAcceleratedNetworkingOnRecovery; + + /// A value indicating whether the NIC has accelerated networking enabled. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public bool? EnableAcceleratedNetworkingOnRecovery { get => this._enableAcceleratedNetworkingOnRecovery; set => this._enableAcceleratedNetworkingOnRecovery = value; } + + /// Backing field for property. + private bool? _enableAcceleratedNetworkingOnTfo; + + /// Whether the TFO NIC has accelerated networking enabled. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public bool? EnableAcceleratedNetworkingOnTfo { get => this._enableAcceleratedNetworkingOnTfo; set => this._enableAcceleratedNetworkingOnTfo = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigDetails[] _iPConfig; + + /// The IP configurations of the NIC. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigDetails[] IPConfig { get => this._iPConfig; set => this._iPConfig = value; } + + /// Backing field for property. + private string _nicId; + + /// The nic Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string NicId { get => this._nicId; set => this._nicId = value; } + + /// Backing field for property. + private string _recoveryNetworkSecurityGroupId; + + /// The id of the NSG associated with the NIC. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryNetworkSecurityGroupId { get => this._recoveryNetworkSecurityGroupId; set => this._recoveryNetworkSecurityGroupId = value; } + + /// Backing field for property. + private string _recoveryNicName; + + /// The name of the NIC to be used when creating target NICs. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryNicName { get => this._recoveryNicName; set => this._recoveryNicName = value; } + + /// Backing field for property. + private string _recoveryNicResourceGroupName; + + /// The resource group of the NIC to be used when creating target NICs. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryNicResourceGroupName { get => this._recoveryNicResourceGroupName; set => this._recoveryNicResourceGroupName = value; } + + /// Backing field for property. + private string _recoveryVMNetworkId; + + /// Recovery VM network Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryVMNetworkId { get => this._recoveryVMNetworkId; set => this._recoveryVMNetworkId = value; } + + /// Backing field for property. + private string _replicaNicId; + + /// The replica nic Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ReplicaNicId { get => this._replicaNicId; set => this._replicaNicId = value; } + + /// Backing field for property. + private bool? _reuseExistingNic; + + /// + /// A value indicating whether an existing NIC is allowed to be reused during failover subject to availability. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public bool? ReuseExistingNic { get => this._reuseExistingNic; set => this._reuseExistingNic = value; } + + /// Backing field for property. + private string _selectionType; + + /// Selection type for failover. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string SelectionType { get => this._selectionType; set => this._selectionType = value; } + + /// Backing field for property. + private string _sourceNicArmId; + + /// The source nic ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string SourceNicArmId { get => this._sourceNicArmId; set => this._sourceNicArmId = value; } + + /// Backing field for property. + private string _targetNicName; + + /// Target NIC name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetNicName { get => this._targetNicName; set => this._targetNicName = value; } + + /// Backing field for property. + private string _tfoNetworkSecurityGroupId; + + /// The NSG to be used by NIC during test failover. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TfoNetworkSecurityGroupId { get => this._tfoNetworkSecurityGroupId; set => this._tfoNetworkSecurityGroupId = value; } + + /// Backing field for property. + private string _tfoRecoveryNicName; + + /// The name of the NIC to be used when creating target NICs in TFO. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TfoRecoveryNicName { get => this._tfoRecoveryNicName; set => this._tfoRecoveryNicName = value; } + + /// Backing field for property. + private string _tfoRecoveryNicResourceGroupName; + + /// The resource group of the NIC to be used when creating target NICs in TFO. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TfoRecoveryNicResourceGroupName { get => this._tfoRecoveryNicResourceGroupName; set => this._tfoRecoveryNicResourceGroupName = value; } + + /// Backing field for property. + private bool? _tfoReuseExistingNic; + + /// + /// A value indicating whether an existing NIC is allowed to be reused during test failover subject to availability. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public bool? TfoReuseExistingNic { get => this._tfoReuseExistingNic; set => this._tfoReuseExistingNic = value; } + + /// Backing field for property. + private string _tfoVMNetworkId; + + /// The network to be used by NIC during test failover. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TfoVMNetworkId { get => this._tfoVMNetworkId; set => this._tfoVMNetworkId = value; } + + /// Backing field for property. + private string _vMNetworkName; + + /// VM network name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string VMNetworkName { get => this._vMNetworkName; set => this._vMNetworkName = value; } + + /// Creates an new instance. + public VMNicDetails() + { + + } + } + /// Hyper V VM network details. + public partial interface IVMNicDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// A value indicating whether the NIC has accelerated networking enabled. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether the NIC has accelerated networking enabled.", + SerializedName = @"enableAcceleratedNetworkingOnRecovery", + PossibleTypes = new [] { typeof(bool) })] + bool? EnableAcceleratedNetworkingOnRecovery { get; set; } + /// Whether the TFO NIC has accelerated networking enabled. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Whether the TFO NIC has accelerated networking enabled.", + SerializedName = @"enableAcceleratedNetworkingOnTfo", + PossibleTypes = new [] { typeof(bool) })] + bool? EnableAcceleratedNetworkingOnTfo { get; set; } + /// The IP configurations of the NIC. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The IP configurations of the NIC.", + SerializedName = @"ipConfigs", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigDetails) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigDetails[] IPConfig { get; set; } + /// The nic Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The nic Id.", + SerializedName = @"nicId", + PossibleTypes = new [] { typeof(string) })] + string NicId { get; set; } + /// The id of the NSG associated with the NIC. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The id of the NSG associated with the NIC.", + SerializedName = @"recoveryNetworkSecurityGroupId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryNetworkSecurityGroupId { get; set; } + /// The name of the NIC to be used when creating target NICs. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the NIC to be used when creating target NICs.", + SerializedName = @"recoveryNicName", + PossibleTypes = new [] { typeof(string) })] + string RecoveryNicName { get; set; } + /// The resource group of the NIC to be used when creating target NICs. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The resource group of the NIC to be used when creating target NICs.", + SerializedName = @"recoveryNicResourceGroupName", + PossibleTypes = new [] { typeof(string) })] + string RecoveryNicResourceGroupName { get; set; } + /// Recovery VM network Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Recovery VM network Id.", + SerializedName = @"recoveryVMNetworkId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryVMNetworkId { get; set; } + /// The replica nic Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The replica nic Id.", + SerializedName = @"replicaNicId", + PossibleTypes = new [] { typeof(string) })] + string ReplicaNicId { get; set; } + /// + /// A value indicating whether an existing NIC is allowed to be reused during failover subject to availability. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether an existing NIC is allowed to be reused during failover subject to availability.", + SerializedName = @"reuseExistingNic", + PossibleTypes = new [] { typeof(bool) })] + bool? ReuseExistingNic { get; set; } + /// Selection type for failover. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Selection type for failover.", + SerializedName = @"selectionType", + PossibleTypes = new [] { typeof(string) })] + string SelectionType { get; set; } + /// The source nic ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The source nic ARM Id.", + SerializedName = @"sourceNicArmId", + PossibleTypes = new [] { typeof(string) })] + string SourceNicArmId { get; set; } + /// Target NIC name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Target NIC name.", + SerializedName = @"targetNicName", + PossibleTypes = new [] { typeof(string) })] + string TargetNicName { get; set; } + /// The NSG to be used by NIC during test failover. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The NSG to be used by NIC during test failover.", + SerializedName = @"tfoNetworkSecurityGroupId", + PossibleTypes = new [] { typeof(string) })] + string TfoNetworkSecurityGroupId { get; set; } + /// The name of the NIC to be used when creating target NICs in TFO. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the NIC to be used when creating target NICs in TFO.", + SerializedName = @"tfoRecoveryNicName", + PossibleTypes = new [] { typeof(string) })] + string TfoRecoveryNicName { get; set; } + /// The resource group of the NIC to be used when creating target NICs in TFO. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The resource group of the NIC to be used when creating target NICs in TFO.", + SerializedName = @"tfoRecoveryNicResourceGroupName", + PossibleTypes = new [] { typeof(string) })] + string TfoRecoveryNicResourceGroupName { get; set; } + /// + /// A value indicating whether an existing NIC is allowed to be reused during test failover subject to availability. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether an existing NIC is allowed to be reused during test failover subject to availability.", + SerializedName = @"tfoReuseExistingNic", + PossibleTypes = new [] { typeof(bool) })] + bool? TfoReuseExistingNic { get; set; } + /// The network to be used by NIC during test failover. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The network to be used by NIC during test failover.", + SerializedName = @"tfoVMNetworkId", + PossibleTypes = new [] { typeof(string) })] + string TfoVMNetworkId { get; set; } + /// VM network name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"VM network name.", + SerializedName = @"vMNetworkName", + PossibleTypes = new [] { typeof(string) })] + string VMNetworkName { get; set; } + + } + /// Hyper V VM network details. + internal partial interface IVMNicDetailsInternal + + { + /// A value indicating whether the NIC has accelerated networking enabled. + bool? EnableAcceleratedNetworkingOnRecovery { get; set; } + /// Whether the TFO NIC has accelerated networking enabled. + bool? EnableAcceleratedNetworkingOnTfo { get; set; } + /// The IP configurations of the NIC. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigDetails[] IPConfig { get; set; } + /// The nic Id. + string NicId { get; set; } + /// The id of the NSG associated with the NIC. + string RecoveryNetworkSecurityGroupId { get; set; } + /// The name of the NIC to be used when creating target NICs. + string RecoveryNicName { get; set; } + /// The resource group of the NIC to be used when creating target NICs. + string RecoveryNicResourceGroupName { get; set; } + /// Recovery VM network Id. + string RecoveryVMNetworkId { get; set; } + /// The replica nic Id. + string ReplicaNicId { get; set; } + /// + /// A value indicating whether an existing NIC is allowed to be reused during failover subject to availability. + /// + bool? ReuseExistingNic { get; set; } + /// Selection type for failover. + string SelectionType { get; set; } + /// The source nic ARM Id. + string SourceNicArmId { get; set; } + /// Target NIC name. + string TargetNicName { get; set; } + /// The NSG to be used by NIC during test failover. + string TfoNetworkSecurityGroupId { get; set; } + /// The name of the NIC to be used when creating target NICs in TFO. + string TfoRecoveryNicName { get; set; } + /// The resource group of the NIC to be used when creating target NICs in TFO. + string TfoRecoveryNicResourceGroupName { get; set; } + /// + /// A value indicating whether an existing NIC is allowed to be reused during test failover subject to availability. + /// + bool? TfoReuseExistingNic { get; set; } + /// The network to be used by NIC during test failover. + string TfoVMNetworkId { get; set; } + /// VM network name. + string VMNetworkName { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMNicDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMNicDetails.json.cs new file mode 100644 index 000000000000..c2e2ea755e3a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMNicDetails.json.cs @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Hyper V VM network details. + public partial class VMNicDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new VMNicDetails(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._nicId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._nicId.ToString()) : null, "nicId" ,container.Add ); + AddIf( null != (((object)this._replicaNicId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._replicaNicId.ToString()) : null, "replicaNicId" ,container.Add ); + AddIf( null != (((object)this._sourceNicArmId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._sourceNicArmId.ToString()) : null, "sourceNicArmId" ,container.Add ); + AddIf( null != (((object)this._vMNetworkName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._vMNetworkName.ToString()) : null, "vMNetworkName" ,container.Add ); + AddIf( null != (((object)this._recoveryVMNetworkId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryVMNetworkId.ToString()) : null, "recoveryVMNetworkId" ,container.Add ); + if (null != this._iPConfig) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._iPConfig ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("ipConfigs",__w); + } + AddIf( null != (((object)this._selectionType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._selectionType.ToString()) : null, "selectionType" ,container.Add ); + AddIf( null != (((object)this._recoveryNetworkSecurityGroupId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryNetworkSecurityGroupId.ToString()) : null, "recoveryNetworkSecurityGroupId" ,container.Add ); + AddIf( null != this._enableAcceleratedNetworkingOnRecovery ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonBoolean((bool)this._enableAcceleratedNetworkingOnRecovery) : null, "enableAcceleratedNetworkingOnRecovery" ,container.Add ); + AddIf( null != (((object)this._tfoVMNetworkId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._tfoVMNetworkId.ToString()) : null, "tfoVMNetworkId" ,container.Add ); + AddIf( null != (((object)this._tfoNetworkSecurityGroupId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._tfoNetworkSecurityGroupId.ToString()) : null, "tfoNetworkSecurityGroupId" ,container.Add ); + AddIf( null != this._enableAcceleratedNetworkingOnTfo ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonBoolean((bool)this._enableAcceleratedNetworkingOnTfo) : null, "enableAcceleratedNetworkingOnTfo" ,container.Add ); + AddIf( null != (((object)this._recoveryNicName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryNicName.ToString()) : null, "recoveryNicName" ,container.Add ); + AddIf( null != (((object)this._recoveryNicResourceGroupName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryNicResourceGroupName.ToString()) : null, "recoveryNicResourceGroupName" ,container.Add ); + AddIf( null != this._reuseExistingNic ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonBoolean((bool)this._reuseExistingNic) : null, "reuseExistingNic" ,container.Add ); + AddIf( null != (((object)this._tfoRecoveryNicName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._tfoRecoveryNicName.ToString()) : null, "tfoRecoveryNicName" ,container.Add ); + AddIf( null != (((object)this._tfoRecoveryNicResourceGroupName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._tfoRecoveryNicResourceGroupName.ToString()) : null, "tfoRecoveryNicResourceGroupName" ,container.Add ); + AddIf( null != this._tfoReuseExistingNic ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonBoolean((bool)this._tfoReuseExistingNic) : null, "tfoReuseExistingNic" ,container.Add ); + AddIf( null != (((object)this._targetNicName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetNicName.ToString()) : null, "targetNicName" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal VMNicDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_nicId = If( json?.PropertyT("nicId"), out var __jsonNicId) ? (string)__jsonNicId : (string)NicId;} + {_replicaNicId = If( json?.PropertyT("replicaNicId"), out var __jsonReplicaNicId) ? (string)__jsonReplicaNicId : (string)ReplicaNicId;} + {_sourceNicArmId = If( json?.PropertyT("sourceNicArmId"), out var __jsonSourceNicArmId) ? (string)__jsonSourceNicArmId : (string)SourceNicArmId;} + {_vMNetworkName = If( json?.PropertyT("vMNetworkName"), out var __jsonVMNetworkName) ? (string)__jsonVMNetworkName : (string)VMNetworkName;} + {_recoveryVMNetworkId = If( json?.PropertyT("recoveryVMNetworkId"), out var __jsonRecoveryVMNetworkId) ? (string)__jsonRecoveryVMNetworkId : (string)RecoveryVMNetworkId;} + {_iPConfig = If( json?.PropertyT("ipConfigs"), out var __jsonIPConfigs) ? If( __jsonIPConfigs as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigDetails) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPConfigDetails.FromJson(__u) )) ))() : null : IPConfig;} + {_selectionType = If( json?.PropertyT("selectionType"), out var __jsonSelectionType) ? (string)__jsonSelectionType : (string)SelectionType;} + {_recoveryNetworkSecurityGroupId = If( json?.PropertyT("recoveryNetworkSecurityGroupId"), out var __jsonRecoveryNetworkSecurityGroupId) ? (string)__jsonRecoveryNetworkSecurityGroupId : (string)RecoveryNetworkSecurityGroupId;} + {_enableAcceleratedNetworkingOnRecovery = If( json?.PropertyT("enableAcceleratedNetworkingOnRecovery"), out var __jsonEnableAcceleratedNetworkingOnRecovery) ? (bool?)__jsonEnableAcceleratedNetworkingOnRecovery : EnableAcceleratedNetworkingOnRecovery;} + {_tfoVMNetworkId = If( json?.PropertyT("tfoVMNetworkId"), out var __jsonTfoVMNetworkId) ? (string)__jsonTfoVMNetworkId : (string)TfoVMNetworkId;} + {_tfoNetworkSecurityGroupId = If( json?.PropertyT("tfoNetworkSecurityGroupId"), out var __jsonTfoNetworkSecurityGroupId) ? (string)__jsonTfoNetworkSecurityGroupId : (string)TfoNetworkSecurityGroupId;} + {_enableAcceleratedNetworkingOnTfo = If( json?.PropertyT("enableAcceleratedNetworkingOnTfo"), out var __jsonEnableAcceleratedNetworkingOnTfo) ? (bool?)__jsonEnableAcceleratedNetworkingOnTfo : EnableAcceleratedNetworkingOnTfo;} + {_recoveryNicName = If( json?.PropertyT("recoveryNicName"), out var __jsonRecoveryNicName) ? (string)__jsonRecoveryNicName : (string)RecoveryNicName;} + {_recoveryNicResourceGroupName = If( json?.PropertyT("recoveryNicResourceGroupName"), out var __jsonRecoveryNicResourceGroupName) ? (string)__jsonRecoveryNicResourceGroupName : (string)RecoveryNicResourceGroupName;} + {_reuseExistingNic = If( json?.PropertyT("reuseExistingNic"), out var __jsonReuseExistingNic) ? (bool?)__jsonReuseExistingNic : ReuseExistingNic;} + {_tfoRecoveryNicName = If( json?.PropertyT("tfoRecoveryNicName"), out var __jsonTfoRecoveryNicName) ? (string)__jsonTfoRecoveryNicName : (string)TfoRecoveryNicName;} + {_tfoRecoveryNicResourceGroupName = If( json?.PropertyT("tfoRecoveryNicResourceGroupName"), out var __jsonTfoRecoveryNicResourceGroupName) ? (string)__jsonTfoRecoveryNicResourceGroupName : (string)TfoRecoveryNicResourceGroupName;} + {_tfoReuseExistingNic = If( json?.PropertyT("tfoReuseExistingNic"), out var __jsonTfoReuseExistingNic) ? (bool?)__jsonTfoReuseExistingNic : TfoReuseExistingNic;} + {_targetNicName = If( json?.PropertyT("targetNicName"), out var __jsonTargetNicName) ? (string)__jsonTargetNicName : (string)TargetNicName;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMNicInputDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMNicInputDetails.PowerShell.cs new file mode 100644 index 000000000000..ab4906b2dbff --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMNicInputDetails.PowerShell.cs @@ -0,0 +1,248 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Hyper V VM network input details. + [System.ComponentModel.TypeConverter(typeof(VMNicInputDetailsTypeConverter))] + public partial class VMNicInputDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicInputDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VMNicInputDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicInputDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VMNicInputDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicInputDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VMNicInputDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("NicId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicInputDetailsInternal)this).NicId = (string) content.GetValueForProperty("NicId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicInputDetailsInternal)this).NicId, global::System.Convert.ToString); + } + if (content.Contains("IPConfig")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicInputDetailsInternal)this).IPConfig = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigInputDetails[]) content.GetValueForProperty("IPConfig",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicInputDetailsInternal)this).IPConfig, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPConfigInputDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("SelectionType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicInputDetailsInternal)this).SelectionType = (string) content.GetValueForProperty("SelectionType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicInputDetailsInternal)this).SelectionType, global::System.Convert.ToString); + } + if (content.Contains("RecoveryNetworkSecurityGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicInputDetailsInternal)this).RecoveryNetworkSecurityGroupId = (string) content.GetValueForProperty("RecoveryNetworkSecurityGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicInputDetailsInternal)this).RecoveryNetworkSecurityGroupId, global::System.Convert.ToString); + } + if (content.Contains("EnableAcceleratedNetworkingOnRecovery")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicInputDetailsInternal)this).EnableAcceleratedNetworkingOnRecovery = (bool?) content.GetValueForProperty("EnableAcceleratedNetworkingOnRecovery",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicInputDetailsInternal)this).EnableAcceleratedNetworkingOnRecovery, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("TfoNetworkSecurityGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicInputDetailsInternal)this).TfoNetworkSecurityGroupId = (string) content.GetValueForProperty("TfoNetworkSecurityGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicInputDetailsInternal)this).TfoNetworkSecurityGroupId, global::System.Convert.ToString); + } + if (content.Contains("EnableAcceleratedNetworkingOnTfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicInputDetailsInternal)this).EnableAcceleratedNetworkingOnTfo = (bool?) content.GetValueForProperty("EnableAcceleratedNetworkingOnTfo",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicInputDetailsInternal)this).EnableAcceleratedNetworkingOnTfo, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("RecoveryNicName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicInputDetailsInternal)this).RecoveryNicName = (string) content.GetValueForProperty("RecoveryNicName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicInputDetailsInternal)this).RecoveryNicName, global::System.Convert.ToString); + } + if (content.Contains("RecoveryNicResourceGroupName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicInputDetailsInternal)this).RecoveryNicResourceGroupName = (string) content.GetValueForProperty("RecoveryNicResourceGroupName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicInputDetailsInternal)this).RecoveryNicResourceGroupName, global::System.Convert.ToString); + } + if (content.Contains("ReuseExistingNic")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicInputDetailsInternal)this).ReuseExistingNic = (bool?) content.GetValueForProperty("ReuseExistingNic",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicInputDetailsInternal)this).ReuseExistingNic, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("TfoNicName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicInputDetailsInternal)this).TfoNicName = (string) content.GetValueForProperty("TfoNicName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicInputDetailsInternal)this).TfoNicName, global::System.Convert.ToString); + } + if (content.Contains("TfoNicResourceGroupName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicInputDetailsInternal)this).TfoNicResourceGroupName = (string) content.GetValueForProperty("TfoNicResourceGroupName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicInputDetailsInternal)this).TfoNicResourceGroupName, global::System.Convert.ToString); + } + if (content.Contains("TfoReuseExistingNic")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicInputDetailsInternal)this).TfoReuseExistingNic = (bool?) content.GetValueForProperty("TfoReuseExistingNic",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicInputDetailsInternal)this).TfoReuseExistingNic, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("TargetNicName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicInputDetailsInternal)this).TargetNicName = (string) content.GetValueForProperty("TargetNicName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicInputDetailsInternal)this).TargetNicName, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal VMNicInputDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("NicId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicInputDetailsInternal)this).NicId = (string) content.GetValueForProperty("NicId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicInputDetailsInternal)this).NicId, global::System.Convert.ToString); + } + if (content.Contains("IPConfig")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicInputDetailsInternal)this).IPConfig = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigInputDetails[]) content.GetValueForProperty("IPConfig",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicInputDetailsInternal)this).IPConfig, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPConfigInputDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("SelectionType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicInputDetailsInternal)this).SelectionType = (string) content.GetValueForProperty("SelectionType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicInputDetailsInternal)this).SelectionType, global::System.Convert.ToString); + } + if (content.Contains("RecoveryNetworkSecurityGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicInputDetailsInternal)this).RecoveryNetworkSecurityGroupId = (string) content.GetValueForProperty("RecoveryNetworkSecurityGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicInputDetailsInternal)this).RecoveryNetworkSecurityGroupId, global::System.Convert.ToString); + } + if (content.Contains("EnableAcceleratedNetworkingOnRecovery")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicInputDetailsInternal)this).EnableAcceleratedNetworkingOnRecovery = (bool?) content.GetValueForProperty("EnableAcceleratedNetworkingOnRecovery",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicInputDetailsInternal)this).EnableAcceleratedNetworkingOnRecovery, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("TfoNetworkSecurityGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicInputDetailsInternal)this).TfoNetworkSecurityGroupId = (string) content.GetValueForProperty("TfoNetworkSecurityGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicInputDetailsInternal)this).TfoNetworkSecurityGroupId, global::System.Convert.ToString); + } + if (content.Contains("EnableAcceleratedNetworkingOnTfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicInputDetailsInternal)this).EnableAcceleratedNetworkingOnTfo = (bool?) content.GetValueForProperty("EnableAcceleratedNetworkingOnTfo",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicInputDetailsInternal)this).EnableAcceleratedNetworkingOnTfo, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("RecoveryNicName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicInputDetailsInternal)this).RecoveryNicName = (string) content.GetValueForProperty("RecoveryNicName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicInputDetailsInternal)this).RecoveryNicName, global::System.Convert.ToString); + } + if (content.Contains("RecoveryNicResourceGroupName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicInputDetailsInternal)this).RecoveryNicResourceGroupName = (string) content.GetValueForProperty("RecoveryNicResourceGroupName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicInputDetailsInternal)this).RecoveryNicResourceGroupName, global::System.Convert.ToString); + } + if (content.Contains("ReuseExistingNic")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicInputDetailsInternal)this).ReuseExistingNic = (bool?) content.GetValueForProperty("ReuseExistingNic",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicInputDetailsInternal)this).ReuseExistingNic, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("TfoNicName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicInputDetailsInternal)this).TfoNicName = (string) content.GetValueForProperty("TfoNicName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicInputDetailsInternal)this).TfoNicName, global::System.Convert.ToString); + } + if (content.Contains("TfoNicResourceGroupName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicInputDetailsInternal)this).TfoNicResourceGroupName = (string) content.GetValueForProperty("TfoNicResourceGroupName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicInputDetailsInternal)this).TfoNicResourceGroupName, global::System.Convert.ToString); + } + if (content.Contains("TfoReuseExistingNic")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicInputDetailsInternal)this).TfoReuseExistingNic = (bool?) content.GetValueForProperty("TfoReuseExistingNic",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicInputDetailsInternal)this).TfoReuseExistingNic, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("TargetNicName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicInputDetailsInternal)this).TargetNicName = (string) content.GetValueForProperty("TargetNicName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicInputDetailsInternal)this).TargetNicName, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + } + /// Hyper V VM network input details. + [System.ComponentModel.TypeConverter(typeof(VMNicInputDetailsTypeConverter))] + public partial interface IVMNicInputDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMNicInputDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMNicInputDetails.TypeConverter.cs new file mode 100644 index 000000000000..6c9fe6dfe07f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMNicInputDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VMNicInputDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicInputDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicInputDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VMNicInputDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VMNicInputDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VMNicInputDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMNicInputDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMNicInputDetails.cs new file mode 100644 index 000000000000..3b59ae5e752e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMNicInputDetails.cs @@ -0,0 +1,286 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Hyper V VM network input details. + public partial class VMNicInputDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicInputDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicInputDetailsInternal + { + + /// + /// Backing field for property. + /// + private bool? _enableAcceleratedNetworkingOnRecovery; + + /// Whether the NIC has accelerated networking enabled. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public bool? EnableAcceleratedNetworkingOnRecovery { get => this._enableAcceleratedNetworkingOnRecovery; set => this._enableAcceleratedNetworkingOnRecovery = value; } + + /// Backing field for property. + private bool? _enableAcceleratedNetworkingOnTfo; + + /// Whether the test NIC has accelerated networking enabled. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public bool? EnableAcceleratedNetworkingOnTfo { get => this._enableAcceleratedNetworkingOnTfo; set => this._enableAcceleratedNetworkingOnTfo = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigInputDetails[] _iPConfig; + + /// The IP configurations to be used by NIC during test failover and failover. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigInputDetails[] IPConfig { get => this._iPConfig; set => this._iPConfig = value; } + + /// Backing field for property. + private string _nicId; + + /// The nic Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string NicId { get => this._nicId; set => this._nicId = value; } + + /// Backing field for property. + private string _recoveryNetworkSecurityGroupId; + + /// The id of the NSG associated with the NIC. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryNetworkSecurityGroupId { get => this._recoveryNetworkSecurityGroupId; set => this._recoveryNetworkSecurityGroupId = value; } + + /// Backing field for property. + private string _recoveryNicName; + + /// The name of the NIC to be used when creating target NICs. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryNicName { get => this._recoveryNicName; set => this._recoveryNicName = value; } + + /// Backing field for property. + private string _recoveryNicResourceGroupName; + + /// The resource group of the NIC to be used when creating target NICs. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryNicResourceGroupName { get => this._recoveryNicResourceGroupName; set => this._recoveryNicResourceGroupName = value; } + + /// Backing field for property. + private bool? _reuseExistingNic; + + /// + /// A value indicating whether an existing NIC is allowed to be reused during failover subject to availability. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public bool? ReuseExistingNic { get => this._reuseExistingNic; set => this._reuseExistingNic = value; } + + /// Backing field for property. + private string _selectionType; + + /// Selection type for failover. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string SelectionType { get => this._selectionType; set => this._selectionType = value; } + + /// Backing field for property. + private string _targetNicName; + + /// Target NIC name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetNicName { get => this._targetNicName; set => this._targetNicName = value; } + + /// Backing field for property. + private string _tfoNetworkSecurityGroupId; + + /// The NSG to be used by NIC during test failover. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TfoNetworkSecurityGroupId { get => this._tfoNetworkSecurityGroupId; set => this._tfoNetworkSecurityGroupId = value; } + + /// Backing field for property. + private string _tfoNicName; + + /// The name of the NIC to be used when creating target NICs in TFO. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TfoNicName { get => this._tfoNicName; set => this._tfoNicName = value; } + + /// Backing field for property. + private string _tfoNicResourceGroupName; + + /// The resource group of the NIC to be used when creating target NICs in TFO. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TfoNicResourceGroupName { get => this._tfoNicResourceGroupName; set => this._tfoNicResourceGroupName = value; } + + /// Backing field for property. + private bool? _tfoReuseExistingNic; + + /// + /// A value indicating whether an existing NIC is allowed to be reused during test failover subject to availability. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public bool? TfoReuseExistingNic { get => this._tfoReuseExistingNic; set => this._tfoReuseExistingNic = value; } + + /// Creates an new instance. + public VMNicInputDetails() + { + + } + } + /// Hyper V VM network input details. + public partial interface IVMNicInputDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// Whether the NIC has accelerated networking enabled. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Whether the NIC has accelerated networking enabled.", + SerializedName = @"enableAcceleratedNetworkingOnRecovery", + PossibleTypes = new [] { typeof(bool) })] + bool? EnableAcceleratedNetworkingOnRecovery { get; set; } + /// Whether the test NIC has accelerated networking enabled. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Whether the test NIC has accelerated networking enabled.", + SerializedName = @"enableAcceleratedNetworkingOnTfo", + PossibleTypes = new [] { typeof(bool) })] + bool? EnableAcceleratedNetworkingOnTfo { get; set; } + /// The IP configurations to be used by NIC during test failover and failover. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The IP configurations to be used by NIC during test failover and failover.", + SerializedName = @"ipConfigs", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigInputDetails) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigInputDetails[] IPConfig { get; set; } + /// The nic Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The nic Id.", + SerializedName = @"nicId", + PossibleTypes = new [] { typeof(string) })] + string NicId { get; set; } + /// The id of the NSG associated with the NIC. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The id of the NSG associated with the NIC.", + SerializedName = @"recoveryNetworkSecurityGroupId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryNetworkSecurityGroupId { get; set; } + /// The name of the NIC to be used when creating target NICs. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the NIC to be used when creating target NICs.", + SerializedName = @"recoveryNicName", + PossibleTypes = new [] { typeof(string) })] + string RecoveryNicName { get; set; } + /// The resource group of the NIC to be used when creating target NICs. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The resource group of the NIC to be used when creating target NICs.", + SerializedName = @"recoveryNicResourceGroupName", + PossibleTypes = new [] { typeof(string) })] + string RecoveryNicResourceGroupName { get; set; } + /// + /// A value indicating whether an existing NIC is allowed to be reused during failover subject to availability. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether an existing NIC is allowed to be reused during failover subject to availability.", + SerializedName = @"reuseExistingNic", + PossibleTypes = new [] { typeof(bool) })] + bool? ReuseExistingNic { get; set; } + /// Selection type for failover. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Selection type for failover.", + SerializedName = @"selectionType", + PossibleTypes = new [] { typeof(string) })] + string SelectionType { get; set; } + /// Target NIC name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Target NIC name.", + SerializedName = @"targetNicName", + PossibleTypes = new [] { typeof(string) })] + string TargetNicName { get; set; } + /// The NSG to be used by NIC during test failover. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The NSG to be used by NIC during test failover.", + SerializedName = @"tfoNetworkSecurityGroupId", + PossibleTypes = new [] { typeof(string) })] + string TfoNetworkSecurityGroupId { get; set; } + /// The name of the NIC to be used when creating target NICs in TFO. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the NIC to be used when creating target NICs in TFO.", + SerializedName = @"tfoNicName", + PossibleTypes = new [] { typeof(string) })] + string TfoNicName { get; set; } + /// The resource group of the NIC to be used when creating target NICs in TFO. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The resource group of the NIC to be used when creating target NICs in TFO.", + SerializedName = @"tfoNicResourceGroupName", + PossibleTypes = new [] { typeof(string) })] + string TfoNicResourceGroupName { get; set; } + /// + /// A value indicating whether an existing NIC is allowed to be reused during test failover subject to availability. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether an existing NIC is allowed to be reused during test failover subject to availability.", + SerializedName = @"tfoReuseExistingNic", + PossibleTypes = new [] { typeof(bool) })] + bool? TfoReuseExistingNic { get; set; } + + } + /// Hyper V VM network input details. + internal partial interface IVMNicInputDetailsInternal + + { + /// Whether the NIC has accelerated networking enabled. + bool? EnableAcceleratedNetworkingOnRecovery { get; set; } + /// Whether the test NIC has accelerated networking enabled. + bool? EnableAcceleratedNetworkingOnTfo { get; set; } + /// The IP configurations to be used by NIC during test failover and failover. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigInputDetails[] IPConfig { get; set; } + /// The nic Id. + string NicId { get; set; } + /// The id of the NSG associated with the NIC. + string RecoveryNetworkSecurityGroupId { get; set; } + /// The name of the NIC to be used when creating target NICs. + string RecoveryNicName { get; set; } + /// The resource group of the NIC to be used when creating target NICs. + string RecoveryNicResourceGroupName { get; set; } + /// + /// A value indicating whether an existing NIC is allowed to be reused during failover subject to availability. + /// + bool? ReuseExistingNic { get; set; } + /// Selection type for failover. + string SelectionType { get; set; } + /// Target NIC name. + string TargetNicName { get; set; } + /// The NSG to be used by NIC during test failover. + string TfoNetworkSecurityGroupId { get; set; } + /// The name of the NIC to be used when creating target NICs in TFO. + string TfoNicName { get; set; } + /// The resource group of the NIC to be used when creating target NICs in TFO. + string TfoNicResourceGroupName { get; set; } + /// + /// A value indicating whether an existing NIC is allowed to be reused during test failover subject to availability. + /// + bool? TfoReuseExistingNic { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMNicInputDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMNicInputDetails.json.cs new file mode 100644 index 000000000000..2b22b7493fb4 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMNicInputDetails.json.cs @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Hyper V VM network input details. + public partial class VMNicInputDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicInputDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicInputDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicInputDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new VMNicInputDetails(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._nicId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._nicId.ToString()) : null, "nicId" ,container.Add ); + if (null != this._iPConfig) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._iPConfig ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("ipConfigs",__w); + } + AddIf( null != (((object)this._selectionType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._selectionType.ToString()) : null, "selectionType" ,container.Add ); + AddIf( null != (((object)this._recoveryNetworkSecurityGroupId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryNetworkSecurityGroupId.ToString()) : null, "recoveryNetworkSecurityGroupId" ,container.Add ); + AddIf( null != this._enableAcceleratedNetworkingOnRecovery ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonBoolean((bool)this._enableAcceleratedNetworkingOnRecovery) : null, "enableAcceleratedNetworkingOnRecovery" ,container.Add ); + AddIf( null != (((object)this._tfoNetworkSecurityGroupId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._tfoNetworkSecurityGroupId.ToString()) : null, "tfoNetworkSecurityGroupId" ,container.Add ); + AddIf( null != this._enableAcceleratedNetworkingOnTfo ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonBoolean((bool)this._enableAcceleratedNetworkingOnTfo) : null, "enableAcceleratedNetworkingOnTfo" ,container.Add ); + AddIf( null != (((object)this._recoveryNicName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryNicName.ToString()) : null, "recoveryNicName" ,container.Add ); + AddIf( null != (((object)this._recoveryNicResourceGroupName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryNicResourceGroupName.ToString()) : null, "recoveryNicResourceGroupName" ,container.Add ); + AddIf( null != this._reuseExistingNic ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonBoolean((bool)this._reuseExistingNic) : null, "reuseExistingNic" ,container.Add ); + AddIf( null != (((object)this._tfoNicName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._tfoNicName.ToString()) : null, "tfoNicName" ,container.Add ); + AddIf( null != (((object)this._tfoNicResourceGroupName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._tfoNicResourceGroupName.ToString()) : null, "tfoNicResourceGroupName" ,container.Add ); + AddIf( null != this._tfoReuseExistingNic ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonBoolean((bool)this._tfoReuseExistingNic) : null, "tfoReuseExistingNic" ,container.Add ); + AddIf( null != (((object)this._targetNicName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetNicName.ToString()) : null, "targetNicName" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal VMNicInputDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_nicId = If( json?.PropertyT("nicId"), out var __jsonNicId) ? (string)__jsonNicId : (string)NicId;} + {_iPConfig = If( json?.PropertyT("ipConfigs"), out var __jsonIPConfigs) ? If( __jsonIPConfigs as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IIPConfigInputDetails) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPConfigInputDetails.FromJson(__u) )) ))() : null : IPConfig;} + {_selectionType = If( json?.PropertyT("selectionType"), out var __jsonSelectionType) ? (string)__jsonSelectionType : (string)SelectionType;} + {_recoveryNetworkSecurityGroupId = If( json?.PropertyT("recoveryNetworkSecurityGroupId"), out var __jsonRecoveryNetworkSecurityGroupId) ? (string)__jsonRecoveryNetworkSecurityGroupId : (string)RecoveryNetworkSecurityGroupId;} + {_enableAcceleratedNetworkingOnRecovery = If( json?.PropertyT("enableAcceleratedNetworkingOnRecovery"), out var __jsonEnableAcceleratedNetworkingOnRecovery) ? (bool?)__jsonEnableAcceleratedNetworkingOnRecovery : EnableAcceleratedNetworkingOnRecovery;} + {_tfoNetworkSecurityGroupId = If( json?.PropertyT("tfoNetworkSecurityGroupId"), out var __jsonTfoNetworkSecurityGroupId) ? (string)__jsonTfoNetworkSecurityGroupId : (string)TfoNetworkSecurityGroupId;} + {_enableAcceleratedNetworkingOnTfo = If( json?.PropertyT("enableAcceleratedNetworkingOnTfo"), out var __jsonEnableAcceleratedNetworkingOnTfo) ? (bool?)__jsonEnableAcceleratedNetworkingOnTfo : EnableAcceleratedNetworkingOnTfo;} + {_recoveryNicName = If( json?.PropertyT("recoveryNicName"), out var __jsonRecoveryNicName) ? (string)__jsonRecoveryNicName : (string)RecoveryNicName;} + {_recoveryNicResourceGroupName = If( json?.PropertyT("recoveryNicResourceGroupName"), out var __jsonRecoveryNicResourceGroupName) ? (string)__jsonRecoveryNicResourceGroupName : (string)RecoveryNicResourceGroupName;} + {_reuseExistingNic = If( json?.PropertyT("reuseExistingNic"), out var __jsonReuseExistingNic) ? (bool?)__jsonReuseExistingNic : ReuseExistingNic;} + {_tfoNicName = If( json?.PropertyT("tfoNicName"), out var __jsonTfoNicName) ? (string)__jsonTfoNicName : (string)TfoNicName;} + {_tfoNicResourceGroupName = If( json?.PropertyT("tfoNicResourceGroupName"), out var __jsonTfoNicResourceGroupName) ? (string)__jsonTfoNicResourceGroupName : (string)TfoNicResourceGroupName;} + {_tfoReuseExistingNic = If( json?.PropertyT("tfoReuseExistingNic"), out var __jsonTfoReuseExistingNic) ? (bool?)__jsonTfoReuseExistingNic : TfoReuseExistingNic;} + {_targetNicName = If( json?.PropertyT("targetNicName"), out var __jsonTargetNicName) ? (string)__jsonTargetNicName : (string)TargetNicName;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMNicUpdatesTaskDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMNicUpdatesTaskDetails.PowerShell.cs new file mode 100644 index 000000000000..caf4729c207d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMNicUpdatesTaskDetails.PowerShell.cs @@ -0,0 +1,168 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// This class represents the vm NicUpdates task details. + [System.ComponentModel.TypeConverter(typeof(VMNicUpdatesTaskDetailsTypeConverter))] + public partial class VMNicUpdatesTaskDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicUpdatesTaskDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VMNicUpdatesTaskDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicUpdatesTaskDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VMNicUpdatesTaskDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicUpdatesTaskDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VMNicUpdatesTaskDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("VMId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicUpdatesTaskDetailsInternal)this).VMId = (string) content.GetValueForProperty("VMId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicUpdatesTaskDetailsInternal)this).VMId, global::System.Convert.ToString); + } + if (content.Contains("NicId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicUpdatesTaskDetailsInternal)this).NicId = (string) content.GetValueForProperty("NicId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicUpdatesTaskDetailsInternal)this).NicId, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicUpdatesTaskDetailsInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicUpdatesTaskDetailsInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITaskTypeDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITaskTypeDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal VMNicUpdatesTaskDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("VMId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicUpdatesTaskDetailsInternal)this).VMId = (string) content.GetValueForProperty("VMId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicUpdatesTaskDetailsInternal)this).VMId, global::System.Convert.ToString); + } + if (content.Contains("NicId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicUpdatesTaskDetailsInternal)this).NicId = (string) content.GetValueForProperty("NicId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicUpdatesTaskDetailsInternal)this).NicId, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicUpdatesTaskDetailsInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicUpdatesTaskDetailsInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITaskTypeDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITaskTypeDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + } + /// This class represents the vm NicUpdates task details. + [System.ComponentModel.TypeConverter(typeof(VMNicUpdatesTaskDetailsTypeConverter))] + public partial interface IVMNicUpdatesTaskDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMNicUpdatesTaskDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMNicUpdatesTaskDetails.TypeConverter.cs new file mode 100644 index 000000000000..349694906087 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMNicUpdatesTaskDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VMNicUpdatesTaskDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicUpdatesTaskDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicUpdatesTaskDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VMNicUpdatesTaskDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VMNicUpdatesTaskDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VMNicUpdatesTaskDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMNicUpdatesTaskDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMNicUpdatesTaskDetails.cs new file mode 100644 index 000000000000..c721cf6cb905 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMNicUpdatesTaskDetails.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// This class represents the vm NicUpdates task details. + public partial class VMNicUpdatesTaskDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicUpdatesTaskDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicUpdatesTaskDetailsInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITaskTypeDetails __taskTypeDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.TaskTypeDetails(); + + /// The type of task details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITaskTypeDetailsInternal)__taskTypeDetails).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITaskTypeDetailsInternal)__taskTypeDetails).InstanceType = value ; } + + /// Backing field for property. + private string _name; + + /// Name of the Nic. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Name { get => this._name; set => this._name = value; } + + /// Backing field for property. + private string _nicId; + + /// Nic Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string NicId { get => this._nicId; set => this._nicId = value; } + + /// Backing field for property. + private string _vMId; + + /// Virtual machine Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string VMId { get => this._vMId; set => this._vMId = value; } + + /// Creates an new instance. + public VMNicUpdatesTaskDetails() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__taskTypeDetails), __taskTypeDetails); + await eventListener.AssertObjectIsValid(nameof(__taskTypeDetails), __taskTypeDetails); + } + } + /// This class represents the vm NicUpdates task details. + public partial interface IVMNicUpdatesTaskDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITaskTypeDetails + { + /// Name of the Nic. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Name of the Nic.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string Name { get; set; } + /// Nic Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Nic Id.", + SerializedName = @"nicId", + PossibleTypes = new [] { typeof(string) })] + string NicId { get; set; } + /// Virtual machine Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Virtual machine Id.", + SerializedName = @"vmId", + PossibleTypes = new [] { typeof(string) })] + string VMId { get; set; } + + } + /// This class represents the vm NicUpdates task details. + internal partial interface IVMNicUpdatesTaskDetailsInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITaskTypeDetailsInternal + { + /// Name of the Nic. + string Name { get; set; } + /// Nic Id. + string NicId { get; set; } + /// Virtual machine Id. + string VMId { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMNicUpdatesTaskDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMNicUpdatesTaskDetails.json.cs new file mode 100644 index 000000000000..392a87f458e5 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMNicUpdatesTaskDetails.json.cs @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// This class represents the vm NicUpdates task details. + public partial class VMNicUpdatesTaskDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicUpdatesTaskDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicUpdatesTaskDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicUpdatesTaskDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new VMNicUpdatesTaskDetails(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __taskTypeDetails?.ToJson(container, serializationMode); + AddIf( null != (((object)this._vMId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._vMId.ToString()) : null, "vmId" ,container.Add ); + AddIf( null != (((object)this._nicId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._nicId.ToString()) : null, "nicId" ,container.Add ); + AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal VMNicUpdatesTaskDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __taskTypeDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.TaskTypeDetails(json); + {_vMId = If( json?.PropertyT("vmId"), out var __jsonVMId) ? (string)__jsonVMId : (string)VMId;} + {_nicId = If( json?.PropertyT("nicId"), out var __jsonNicId) ? (string)__jsonNicId : (string)NicId;} + {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)Name;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtContainerCreationInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtContainerCreationInput.PowerShell.cs new file mode 100644 index 000000000000..c94fde2dcbf4 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtContainerCreationInput.PowerShell.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// VMwareCbt container creation input. + [System.ComponentModel.TypeConverter(typeof(VMwareCbtContainerCreationInputTypeConverter))] + public partial class VMwareCbtContainerCreationInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtContainerCreationInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VMwareCbtContainerCreationInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtContainerCreationInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VMwareCbtContainerCreationInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtContainerCreationInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VMwareCbtContainerCreationInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerCreationInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerCreationInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal VMwareCbtContainerCreationInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerCreationInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerCreationInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + } + /// VMwareCbt container creation input. + [System.ComponentModel.TypeConverter(typeof(VMwareCbtContainerCreationInputTypeConverter))] + public partial interface IVMwareCbtContainerCreationInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtContainerCreationInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtContainerCreationInput.TypeConverter.cs new file mode 100644 index 000000000000..7d29ce931055 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtContainerCreationInput.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VMwareCbtContainerCreationInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtContainerCreationInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtContainerCreationInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VMwareCbtContainerCreationInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VMwareCbtContainerCreationInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VMwareCbtContainerCreationInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtContainerCreationInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtContainerCreationInput.cs new file mode 100644 index 000000000000..09c58a413e28 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtContainerCreationInput.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// VMwareCbt container creation input. + public partial class VMwareCbtContainerCreationInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtContainerCreationInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtContainerCreationInputInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerCreationInput __replicationProviderSpecificContainerCreationInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProviderSpecificContainerCreationInput(); + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerCreationInputInternal)__replicationProviderSpecificContainerCreationInput).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerCreationInputInternal)__replicationProviderSpecificContainerCreationInput).InstanceType = value ; } + + /// Creates an new instance. + public VMwareCbtContainerCreationInput() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__replicationProviderSpecificContainerCreationInput), __replicationProviderSpecificContainerCreationInput); + await eventListener.AssertObjectIsValid(nameof(__replicationProviderSpecificContainerCreationInput), __replicationProviderSpecificContainerCreationInput); + } + } + /// VMwareCbt container creation input. + public partial interface IVMwareCbtContainerCreationInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerCreationInput + { + + } + /// VMwareCbt container creation input. + internal partial interface IVMwareCbtContainerCreationInputInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerCreationInputInternal + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtContainerCreationInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtContainerCreationInput.json.cs new file mode 100644 index 000000000000..a782896f66f4 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtContainerCreationInput.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// VMwareCbt container creation input. + public partial class VMwareCbtContainerCreationInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtContainerCreationInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtContainerCreationInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtContainerCreationInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new VMwareCbtContainerCreationInput(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __replicationProviderSpecificContainerCreationInput?.ToJson(container, serializationMode); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal VMwareCbtContainerCreationInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __replicationProviderSpecificContainerCreationInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProviderSpecificContainerCreationInput(json); + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtContainerMappingInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtContainerMappingInput.PowerShell.cs new file mode 100644 index 000000000000..0e3a76650d7c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtContainerMappingInput.PowerShell.cs @@ -0,0 +1,194 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// VMwareCbt container mapping input. + [System.ComponentModel.TypeConverter(typeof(VMwareCbtContainerMappingInputTypeConverter))] + public partial class VMwareCbtContainerMappingInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtContainerMappingInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VMwareCbtContainerMappingInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtContainerMappingInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VMwareCbtContainerMappingInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtContainerMappingInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VMwareCbtContainerMappingInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("KeyVaultId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtContainerMappingInputInternal)this).KeyVaultId = (string) content.GetValueForProperty("KeyVaultId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtContainerMappingInputInternal)this).KeyVaultId, global::System.Convert.ToString); + } + if (content.Contains("KeyVaultUri")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtContainerMappingInputInternal)this).KeyVaultUri = (string) content.GetValueForProperty("KeyVaultUri",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtContainerMappingInputInternal)this).KeyVaultUri, global::System.Convert.ToString); + } + if (content.Contains("StorageAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtContainerMappingInputInternal)this).StorageAccountId = (string) content.GetValueForProperty("StorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtContainerMappingInputInternal)this).StorageAccountId, global::System.Convert.ToString); + } + if (content.Contains("StorageAccountSasSecretName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtContainerMappingInputInternal)this).StorageAccountSasSecretName = (string) content.GetValueForProperty("StorageAccountSasSecretName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtContainerMappingInputInternal)this).StorageAccountSasSecretName, global::System.Convert.ToString); + } + if (content.Contains("ServiceBusConnectionStringSecretName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtContainerMappingInputInternal)this).ServiceBusConnectionStringSecretName = (string) content.GetValueForProperty("ServiceBusConnectionStringSecretName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtContainerMappingInputInternal)this).ServiceBusConnectionStringSecretName, global::System.Convert.ToString); + } + if (content.Contains("TargetLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtContainerMappingInputInternal)this).TargetLocation = (string) content.GetValueForProperty("TargetLocation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtContainerMappingInputInternal)this).TargetLocation, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerMappingInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerMappingInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal VMwareCbtContainerMappingInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("KeyVaultId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtContainerMappingInputInternal)this).KeyVaultId = (string) content.GetValueForProperty("KeyVaultId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtContainerMappingInputInternal)this).KeyVaultId, global::System.Convert.ToString); + } + if (content.Contains("KeyVaultUri")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtContainerMappingInputInternal)this).KeyVaultUri = (string) content.GetValueForProperty("KeyVaultUri",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtContainerMappingInputInternal)this).KeyVaultUri, global::System.Convert.ToString); + } + if (content.Contains("StorageAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtContainerMappingInputInternal)this).StorageAccountId = (string) content.GetValueForProperty("StorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtContainerMappingInputInternal)this).StorageAccountId, global::System.Convert.ToString); + } + if (content.Contains("StorageAccountSasSecretName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtContainerMappingInputInternal)this).StorageAccountSasSecretName = (string) content.GetValueForProperty("StorageAccountSasSecretName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtContainerMappingInputInternal)this).StorageAccountSasSecretName, global::System.Convert.ToString); + } + if (content.Contains("ServiceBusConnectionStringSecretName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtContainerMappingInputInternal)this).ServiceBusConnectionStringSecretName = (string) content.GetValueForProperty("ServiceBusConnectionStringSecretName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtContainerMappingInputInternal)this).ServiceBusConnectionStringSecretName, global::System.Convert.ToString); + } + if (content.Contains("TargetLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtContainerMappingInputInternal)this).TargetLocation = (string) content.GetValueForProperty("TargetLocation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtContainerMappingInputInternal)this).TargetLocation, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerMappingInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerMappingInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + } + /// VMwareCbt container mapping input. + [System.ComponentModel.TypeConverter(typeof(VMwareCbtContainerMappingInputTypeConverter))] + public partial interface IVMwareCbtContainerMappingInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtContainerMappingInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtContainerMappingInput.TypeConverter.cs new file mode 100644 index 000000000000..bb2d4a3d4e4d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtContainerMappingInput.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VMwareCbtContainerMappingInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtContainerMappingInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtContainerMappingInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VMwareCbtContainerMappingInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VMwareCbtContainerMappingInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VMwareCbtContainerMappingInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtContainerMappingInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtContainerMappingInput.cs new file mode 100644 index 000000000000..720239502f35 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtContainerMappingInput.cs @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// VMwareCbt container mapping input. + public partial class VMwareCbtContainerMappingInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtContainerMappingInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtContainerMappingInputInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerMappingInput __replicationProviderSpecificContainerMappingInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProviderSpecificContainerMappingInput(); + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerMappingInputInternal)__replicationProviderSpecificContainerMappingInput).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerMappingInputInternal)__replicationProviderSpecificContainerMappingInput).InstanceType = value ; } + + /// Backing field for property. + private string _keyVaultId; + + /// The target key vault ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string KeyVaultId { get => this._keyVaultId; set => this._keyVaultId = value; } + + /// Backing field for property. + private string _keyVaultUri; + + /// The target key vault URL. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string KeyVaultUri { get => this._keyVaultUri; set => this._keyVaultUri = value; } + + /// Backing field for property. + private string _serviceBusConnectionStringSecretName; + + /// The secret name of the service bus connection string. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ServiceBusConnectionStringSecretName { get => this._serviceBusConnectionStringSecretName; set => this._serviceBusConnectionStringSecretName = value; } + + /// Backing field for property. + private string _storageAccountId; + + /// The storage account ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string StorageAccountId { get => this._storageAccountId; set => this._storageAccountId = value; } + + /// Backing field for property. + private string _storageAccountSasSecretName; + + /// The secret name of the storage account. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string StorageAccountSasSecretName { get => this._storageAccountSasSecretName; set => this._storageAccountSasSecretName = value; } + + /// Backing field for property. + private string _targetLocation; + + /// The target location. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetLocation { get => this._targetLocation; set => this._targetLocation = value; } + + /// Creates an new instance. + public VMwareCbtContainerMappingInput() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__replicationProviderSpecificContainerMappingInput), __replicationProviderSpecificContainerMappingInput); + await eventListener.AssertObjectIsValid(nameof(__replicationProviderSpecificContainerMappingInput), __replicationProviderSpecificContainerMappingInput); + } + } + /// VMwareCbt container mapping input. + public partial interface IVMwareCbtContainerMappingInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerMappingInput + { + /// The target key vault ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target key vault ARM Id.", + SerializedName = @"keyVaultId", + PossibleTypes = new [] { typeof(string) })] + string KeyVaultId { get; set; } + /// The target key vault URL. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target key vault URL.", + SerializedName = @"keyVaultUri", + PossibleTypes = new [] { typeof(string) })] + string KeyVaultUri { get; set; } + /// The secret name of the service bus connection string. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The secret name of the service bus connection string.", + SerializedName = @"serviceBusConnectionStringSecretName", + PossibleTypes = new [] { typeof(string) })] + string ServiceBusConnectionStringSecretName { get; set; } + /// The storage account ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The storage account ARM Id.", + SerializedName = @"storageAccountId", + PossibleTypes = new [] { typeof(string) })] + string StorageAccountId { get; set; } + /// The secret name of the storage account. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The secret name of the storage account.", + SerializedName = @"storageAccountSasSecretName", + PossibleTypes = new [] { typeof(string) })] + string StorageAccountSasSecretName { get; set; } + /// The target location. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The target location.", + SerializedName = @"targetLocation", + PossibleTypes = new [] { typeof(string) })] + string TargetLocation { get; set; } + + } + /// VMwareCbt container mapping input. + internal partial interface IVMwareCbtContainerMappingInputInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerMappingInputInternal + { + /// The target key vault ARM Id. + string KeyVaultId { get; set; } + /// The target key vault URL. + string KeyVaultUri { get; set; } + /// The secret name of the service bus connection string. + string ServiceBusConnectionStringSecretName { get; set; } + /// The storage account ARM Id. + string StorageAccountId { get; set; } + /// The secret name of the storage account. + string StorageAccountSasSecretName { get; set; } + /// The target location. + string TargetLocation { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtContainerMappingInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtContainerMappingInput.json.cs new file mode 100644 index 000000000000..0b61ed35e9b1 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtContainerMappingInput.json.cs @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// VMwareCbt container mapping input. + public partial class VMwareCbtContainerMappingInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtContainerMappingInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtContainerMappingInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtContainerMappingInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new VMwareCbtContainerMappingInput(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __replicationProviderSpecificContainerMappingInput?.ToJson(container, serializationMode); + AddIf( null != (((object)this._keyVaultId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._keyVaultId.ToString()) : null, "keyVaultId" ,container.Add ); + AddIf( null != (((object)this._keyVaultUri)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._keyVaultUri.ToString()) : null, "keyVaultUri" ,container.Add ); + AddIf( null != (((object)this._storageAccountId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._storageAccountId.ToString()) : null, "storageAccountId" ,container.Add ); + AddIf( null != (((object)this._storageAccountSasSecretName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._storageAccountSasSecretName.ToString()) : null, "storageAccountSasSecretName" ,container.Add ); + AddIf( null != (((object)this._serviceBusConnectionStringSecretName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._serviceBusConnectionStringSecretName.ToString()) : null, "serviceBusConnectionStringSecretName" ,container.Add ); + AddIf( null != (((object)this._targetLocation)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetLocation.ToString()) : null, "targetLocation" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal VMwareCbtContainerMappingInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __replicationProviderSpecificContainerMappingInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProviderSpecificContainerMappingInput(json); + {_keyVaultId = If( json?.PropertyT("keyVaultId"), out var __jsonKeyVaultId) ? (string)__jsonKeyVaultId : (string)KeyVaultId;} + {_keyVaultUri = If( json?.PropertyT("keyVaultUri"), out var __jsonKeyVaultUri) ? (string)__jsonKeyVaultUri : (string)KeyVaultUri;} + {_storageAccountId = If( json?.PropertyT("storageAccountId"), out var __jsonStorageAccountId) ? (string)__jsonStorageAccountId : (string)StorageAccountId;} + {_storageAccountSasSecretName = If( json?.PropertyT("storageAccountSasSecretName"), out var __jsonStorageAccountSasSecretName) ? (string)__jsonStorageAccountSasSecretName : (string)StorageAccountSasSecretName;} + {_serviceBusConnectionStringSecretName = If( json?.PropertyT("serviceBusConnectionStringSecretName"), out var __jsonServiceBusConnectionStringSecretName) ? (string)__jsonServiceBusConnectionStringSecretName : (string)ServiceBusConnectionStringSecretName;} + {_targetLocation = If( json?.PropertyT("targetLocation"), out var __jsonTargetLocation) ? (string)__jsonTargetLocation : (string)TargetLocation;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtDiskInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtDiskInput.PowerShell.cs new file mode 100644 index 000000000000..c4775e643ed9 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtDiskInput.PowerShell.cs @@ -0,0 +1,184 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// VMwareCbt disk input. + [System.ComponentModel.TypeConverter(typeof(VMwareCbtDiskInputTypeConverter))] + public partial class VMwareCbtDiskInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtDiskInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VMwareCbtDiskInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtDiskInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VMwareCbtDiskInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtDiskInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VMwareCbtDiskInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DiskId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtDiskInputInternal)this).DiskId = (string) content.GetValueForProperty("DiskId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtDiskInputInternal)this).DiskId, global::System.Convert.ToString); + } + if (content.Contains("DiskType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtDiskInputInternal)this).DiskType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskAccountType?) content.GetValueForProperty("DiskType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtDiskInputInternal)this).DiskType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskAccountType.CreateFrom); + } + if (content.Contains("IsOSDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtDiskInputInternal)this).IsOSDisk = (string) content.GetValueForProperty("IsOSDisk",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtDiskInputInternal)this).IsOSDisk, global::System.Convert.ToString); + } + if (content.Contains("LogStorageAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtDiskInputInternal)this).LogStorageAccountId = (string) content.GetValueForProperty("LogStorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtDiskInputInternal)this).LogStorageAccountId, global::System.Convert.ToString); + } + if (content.Contains("LogStorageAccountSasSecretName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtDiskInputInternal)this).LogStorageAccountSasSecretName = (string) content.GetValueForProperty("LogStorageAccountSasSecretName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtDiskInputInternal)this).LogStorageAccountSasSecretName, global::System.Convert.ToString); + } + if (content.Contains("DiskEncryptionSetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtDiskInputInternal)this).DiskEncryptionSetId = (string) content.GetValueForProperty("DiskEncryptionSetId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtDiskInputInternal)this).DiskEncryptionSetId, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal VMwareCbtDiskInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DiskId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtDiskInputInternal)this).DiskId = (string) content.GetValueForProperty("DiskId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtDiskInputInternal)this).DiskId, global::System.Convert.ToString); + } + if (content.Contains("DiskType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtDiskInputInternal)this).DiskType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskAccountType?) content.GetValueForProperty("DiskType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtDiskInputInternal)this).DiskType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskAccountType.CreateFrom); + } + if (content.Contains("IsOSDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtDiskInputInternal)this).IsOSDisk = (string) content.GetValueForProperty("IsOSDisk",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtDiskInputInternal)this).IsOSDisk, global::System.Convert.ToString); + } + if (content.Contains("LogStorageAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtDiskInputInternal)this).LogStorageAccountId = (string) content.GetValueForProperty("LogStorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtDiskInputInternal)this).LogStorageAccountId, global::System.Convert.ToString); + } + if (content.Contains("LogStorageAccountSasSecretName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtDiskInputInternal)this).LogStorageAccountSasSecretName = (string) content.GetValueForProperty("LogStorageAccountSasSecretName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtDiskInputInternal)this).LogStorageAccountSasSecretName, global::System.Convert.ToString); + } + if (content.Contains("DiskEncryptionSetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtDiskInputInternal)this).DiskEncryptionSetId = (string) content.GetValueForProperty("DiskEncryptionSetId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtDiskInputInternal)this).DiskEncryptionSetId, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + } + /// VMwareCbt disk input. + [System.ComponentModel.TypeConverter(typeof(VMwareCbtDiskInputTypeConverter))] + public partial interface IVMwareCbtDiskInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtDiskInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtDiskInput.TypeConverter.cs new file mode 100644 index 000000000000..491676562e41 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtDiskInput.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VMwareCbtDiskInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtDiskInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtDiskInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VMwareCbtDiskInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VMwareCbtDiskInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VMwareCbtDiskInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtDiskInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtDiskInput.cs new file mode 100644 index 000000000000..d324c25e4cab --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtDiskInput.cs @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// VMwareCbt disk input. + public partial class VMwareCbtDiskInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtDiskInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtDiskInputInternal + { + + /// Backing field for property. + private string _diskEncryptionSetId; + + /// The DiskEncryptionSet ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string DiskEncryptionSetId { get => this._diskEncryptionSetId; set => this._diskEncryptionSetId = value; } + + /// Backing field for property. + private string _diskId; + + /// The disk Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string DiskId { get => this._diskId; set => this._diskId = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskAccountType? _diskType; + + /// The disk type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskAccountType? DiskType { get => this._diskType; set => this._diskType = value; } + + /// Backing field for property. + private string _isOSDisk; + + /// A value indicating whether the disk is the OS disk. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string IsOSDisk { get => this._isOSDisk; set => this._isOSDisk = value; } + + /// Backing field for property. + private string _logStorageAccountId; + + /// The log storage account ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string LogStorageAccountId { get => this._logStorageAccountId; set => this._logStorageAccountId = value; } + + /// Backing field for property. + private string _logStorageAccountSasSecretName; + + /// The key vault secret name of the log storage account. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string LogStorageAccountSasSecretName { get => this._logStorageAccountSasSecretName; set => this._logStorageAccountSasSecretName = value; } + + /// Creates an new instance. + public VMwareCbtDiskInput() + { + + } + } + /// VMwareCbt disk input. + public partial interface IVMwareCbtDiskInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The DiskEncryptionSet ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The DiskEncryptionSet ARM Id.", + SerializedName = @"diskEncryptionSetId", + PossibleTypes = new [] { typeof(string) })] + string DiskEncryptionSetId { get; set; } + /// The disk Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The disk Id.", + SerializedName = @"diskId", + PossibleTypes = new [] { typeof(string) })] + string DiskId { get; set; } + /// The disk type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The disk type.", + SerializedName = @"diskType", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskAccountType) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskAccountType? DiskType { get; set; } + /// A value indicating whether the disk is the OS disk. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"A value indicating whether the disk is the OS disk.", + SerializedName = @"isOSDisk", + PossibleTypes = new [] { typeof(string) })] + string IsOSDisk { get; set; } + /// The log storage account ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The log storage account ARM Id.", + SerializedName = @"logStorageAccountId", + PossibleTypes = new [] { typeof(string) })] + string LogStorageAccountId { get; set; } + /// The key vault secret name of the log storage account. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The key vault secret name of the log storage account.", + SerializedName = @"logStorageAccountSasSecretName", + PossibleTypes = new [] { typeof(string) })] + string LogStorageAccountSasSecretName { get; set; } + + } + /// VMwareCbt disk input. + internal partial interface IVMwareCbtDiskInputInternal + + { + /// The DiskEncryptionSet ARM Id. + string DiskEncryptionSetId { get; set; } + /// The disk Id. + string DiskId { get; set; } + /// The disk type. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskAccountType? DiskType { get; set; } + /// A value indicating whether the disk is the OS disk. + string IsOSDisk { get; set; } + /// The log storage account ARM Id. + string LogStorageAccountId { get; set; } + /// The key vault secret name of the log storage account. + string LogStorageAccountSasSecretName { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtDiskInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtDiskInput.json.cs new file mode 100644 index 000000000000..a586ca1b6dc6 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtDiskInput.json.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// VMwareCbt disk input. + public partial class VMwareCbtDiskInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtDiskInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtDiskInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtDiskInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new VMwareCbtDiskInput(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._diskId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._diskId.ToString()) : null, "diskId" ,container.Add ); + AddIf( null != (((object)this._diskType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._diskType.ToString()) : null, "diskType" ,container.Add ); + AddIf( null != (((object)this._isOSDisk)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._isOSDisk.ToString()) : null, "isOSDisk" ,container.Add ); + AddIf( null != (((object)this._logStorageAccountId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._logStorageAccountId.ToString()) : null, "logStorageAccountId" ,container.Add ); + AddIf( null != (((object)this._logStorageAccountSasSecretName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._logStorageAccountSasSecretName.ToString()) : null, "logStorageAccountSasSecretName" ,container.Add ); + AddIf( null != (((object)this._diskEncryptionSetId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._diskEncryptionSetId.ToString()) : null, "diskEncryptionSetId" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal VMwareCbtDiskInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_diskId = If( json?.PropertyT("diskId"), out var __jsonDiskId) ? (string)__jsonDiskId : (string)DiskId;} + {_diskType = If( json?.PropertyT("diskType"), out var __jsonDiskType) ? (string)__jsonDiskType : (string)DiskType;} + {_isOSDisk = If( json?.PropertyT("isOSDisk"), out var __jsonIsOSDisk) ? (string)__jsonIsOSDisk : (string)IsOSDisk;} + {_logStorageAccountId = If( json?.PropertyT("logStorageAccountId"), out var __jsonLogStorageAccountId) ? (string)__jsonLogStorageAccountId : (string)LogStorageAccountId;} + {_logStorageAccountSasSecretName = If( json?.PropertyT("logStorageAccountSasSecretName"), out var __jsonLogStorageAccountSasSecretName) ? (string)__jsonLogStorageAccountSasSecretName : (string)LogStorageAccountSasSecretName;} + {_diskEncryptionSetId = If( json?.PropertyT("diskEncryptionSetId"), out var __jsonDiskEncryptionSetId) ? (string)__jsonDiskEncryptionSetId : (string)DiskEncryptionSetId;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtEnableMigrationInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtEnableMigrationInput.PowerShell.cs new file mode 100644 index 000000000000..01afd66a8697 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtEnableMigrationInput.PowerShell.cs @@ -0,0 +1,330 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// VMwareCbt specific enable migration input. + [System.ComponentModel.TypeConverter(typeof(VMwareCbtEnableMigrationInputTypeConverter))] + public partial class VMwareCbtEnableMigrationInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VMwareCbtEnableMigrationInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VMwareCbtEnableMigrationInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VMwareCbtEnableMigrationInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("VmwareMachineId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputInternal)this).VmwareMachineId = (string) content.GetValueForProperty("VmwareMachineId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputInternal)this).VmwareMachineId, global::System.Convert.ToString); + } + if (content.Contains("DisksToInclude")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputInternal)this).DisksToInclude = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtDiskInput[]) content.GetValueForProperty("DisksToInclude",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputInternal)this).DisksToInclude, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtDiskInputTypeConverter.ConvertFrom)); + } + if (content.Contains("LicenseType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputInternal)this).LicenseType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.LicenseType?) content.GetValueForProperty("LicenseType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputInternal)this).LicenseType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.LicenseType.CreateFrom); + } + if (content.Contains("SqlServerLicenseType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputInternal)this).SqlServerLicenseType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SqlServerLicenseType?) content.GetValueForProperty("SqlServerLicenseType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputInternal)this).SqlServerLicenseType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SqlServerLicenseType.CreateFrom); + } + if (content.Contains("PerformSqlBulkRegistration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputInternal)this).PerformSqlBulkRegistration = (string) content.GetValueForProperty("PerformSqlBulkRegistration",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputInternal)this).PerformSqlBulkRegistration, global::System.Convert.ToString); + } + if (content.Contains("DataMoverRunAsAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputInternal)this).DataMoverRunAsAccountId = (string) content.GetValueForProperty("DataMoverRunAsAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputInternal)this).DataMoverRunAsAccountId, global::System.Convert.ToString); + } + if (content.Contains("SnapshotRunAsAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputInternal)this).SnapshotRunAsAccountId = (string) content.GetValueForProperty("SnapshotRunAsAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputInternal)this).SnapshotRunAsAccountId, global::System.Convert.ToString); + } + if (content.Contains("TargetVMName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputInternal)this).TargetVMName = (string) content.GetValueForProperty("TargetVMName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputInternal)this).TargetVMName, global::System.Convert.ToString); + } + if (content.Contains("TargetVMSize")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputInternal)this).TargetVMSize = (string) content.GetValueForProperty("TargetVMSize",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputInternal)this).TargetVMSize, global::System.Convert.ToString); + } + if (content.Contains("TargetResourceGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputInternal)this).TargetResourceGroupId = (string) content.GetValueForProperty("TargetResourceGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputInternal)this).TargetResourceGroupId, global::System.Convert.ToString); + } + if (content.Contains("TargetNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputInternal)this).TargetNetworkId = (string) content.GetValueForProperty("TargetNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputInternal)this).TargetNetworkId, global::System.Convert.ToString); + } + if (content.Contains("TestNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputInternal)this).TestNetworkId = (string) content.GetValueForProperty("TestNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputInternal)this).TestNetworkId, global::System.Convert.ToString); + } + if (content.Contains("TargetSubnetName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputInternal)this).TargetSubnetName = (string) content.GetValueForProperty("TargetSubnetName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputInternal)this).TargetSubnetName, global::System.Convert.ToString); + } + if (content.Contains("TestSubnetName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputInternal)this).TestSubnetName = (string) content.GetValueForProperty("TestSubnetName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputInternal)this).TestSubnetName, global::System.Convert.ToString); + } + if (content.Contains("TargetAvailabilitySetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputInternal)this).TargetAvailabilitySetId = (string) content.GetValueForProperty("TargetAvailabilitySetId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputInternal)this).TargetAvailabilitySetId, global::System.Convert.ToString); + } + if (content.Contains("TargetAvailabilityZone")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputInternal)this).TargetAvailabilityZone = (string) content.GetValueForProperty("TargetAvailabilityZone",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputInternal)this).TargetAvailabilityZone, global::System.Convert.ToString); + } + if (content.Contains("TargetProximityPlacementGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputInternal)this).TargetProximityPlacementGroupId = (string) content.GetValueForProperty("TargetProximityPlacementGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputInternal)this).TargetProximityPlacementGroupId, global::System.Convert.ToString); + } + if (content.Contains("TargetBootDiagnosticsStorageAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputInternal)this).TargetBootDiagnosticsStorageAccountId = (string) content.GetValueForProperty("TargetBootDiagnosticsStorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputInternal)this).TargetBootDiagnosticsStorageAccountId, global::System.Convert.ToString); + } + if (content.Contains("PerformAutoResync")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputInternal)this).PerformAutoResync = (string) content.GetValueForProperty("PerformAutoResync",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputInternal)this).PerformAutoResync, global::System.Convert.ToString); + } + if (content.Contains("TargetVMTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputInternal)this).TargetVMTag = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputTargetVmtags) content.GetValueForProperty("TargetVMTag",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputInternal)this).TargetVMTag, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtEnableMigrationInputTargetVmtagsTypeConverter.ConvertFrom); + } + if (content.Contains("SeedDiskTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputInternal)this).SeedDiskTag = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputSeedDiskTags) content.GetValueForProperty("SeedDiskTag",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputInternal)this).SeedDiskTag, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtEnableMigrationInputSeedDiskTagsTypeConverter.ConvertFrom); + } + if (content.Contains("TargetDiskTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputInternal)this).TargetDiskTag = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputTargetDiskTags) content.GetValueForProperty("TargetDiskTag",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputInternal)this).TargetDiskTag, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtEnableMigrationInputTargetDiskTagsTypeConverter.ConvertFrom); + } + if (content.Contains("TargetNicTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputInternal)this).TargetNicTag = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputTargetNicTags) content.GetValueForProperty("TargetNicTag",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputInternal)this).TargetNicTag, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtEnableMigrationInputTargetNicTagsTypeConverter.ConvertFrom); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal VMwareCbtEnableMigrationInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("VmwareMachineId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputInternal)this).VmwareMachineId = (string) content.GetValueForProperty("VmwareMachineId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputInternal)this).VmwareMachineId, global::System.Convert.ToString); + } + if (content.Contains("DisksToInclude")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputInternal)this).DisksToInclude = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtDiskInput[]) content.GetValueForProperty("DisksToInclude",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputInternal)this).DisksToInclude, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtDiskInputTypeConverter.ConvertFrom)); + } + if (content.Contains("LicenseType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputInternal)this).LicenseType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.LicenseType?) content.GetValueForProperty("LicenseType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputInternal)this).LicenseType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.LicenseType.CreateFrom); + } + if (content.Contains("SqlServerLicenseType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputInternal)this).SqlServerLicenseType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SqlServerLicenseType?) content.GetValueForProperty("SqlServerLicenseType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputInternal)this).SqlServerLicenseType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SqlServerLicenseType.CreateFrom); + } + if (content.Contains("PerformSqlBulkRegistration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputInternal)this).PerformSqlBulkRegistration = (string) content.GetValueForProperty("PerformSqlBulkRegistration",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputInternal)this).PerformSqlBulkRegistration, global::System.Convert.ToString); + } + if (content.Contains("DataMoverRunAsAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputInternal)this).DataMoverRunAsAccountId = (string) content.GetValueForProperty("DataMoverRunAsAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputInternal)this).DataMoverRunAsAccountId, global::System.Convert.ToString); + } + if (content.Contains("SnapshotRunAsAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputInternal)this).SnapshotRunAsAccountId = (string) content.GetValueForProperty("SnapshotRunAsAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputInternal)this).SnapshotRunAsAccountId, global::System.Convert.ToString); + } + if (content.Contains("TargetVMName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputInternal)this).TargetVMName = (string) content.GetValueForProperty("TargetVMName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputInternal)this).TargetVMName, global::System.Convert.ToString); + } + if (content.Contains("TargetVMSize")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputInternal)this).TargetVMSize = (string) content.GetValueForProperty("TargetVMSize",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputInternal)this).TargetVMSize, global::System.Convert.ToString); + } + if (content.Contains("TargetResourceGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputInternal)this).TargetResourceGroupId = (string) content.GetValueForProperty("TargetResourceGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputInternal)this).TargetResourceGroupId, global::System.Convert.ToString); + } + if (content.Contains("TargetNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputInternal)this).TargetNetworkId = (string) content.GetValueForProperty("TargetNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputInternal)this).TargetNetworkId, global::System.Convert.ToString); + } + if (content.Contains("TestNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputInternal)this).TestNetworkId = (string) content.GetValueForProperty("TestNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputInternal)this).TestNetworkId, global::System.Convert.ToString); + } + if (content.Contains("TargetSubnetName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputInternal)this).TargetSubnetName = (string) content.GetValueForProperty("TargetSubnetName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputInternal)this).TargetSubnetName, global::System.Convert.ToString); + } + if (content.Contains("TestSubnetName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputInternal)this).TestSubnetName = (string) content.GetValueForProperty("TestSubnetName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputInternal)this).TestSubnetName, global::System.Convert.ToString); + } + if (content.Contains("TargetAvailabilitySetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputInternal)this).TargetAvailabilitySetId = (string) content.GetValueForProperty("TargetAvailabilitySetId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputInternal)this).TargetAvailabilitySetId, global::System.Convert.ToString); + } + if (content.Contains("TargetAvailabilityZone")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputInternal)this).TargetAvailabilityZone = (string) content.GetValueForProperty("TargetAvailabilityZone",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputInternal)this).TargetAvailabilityZone, global::System.Convert.ToString); + } + if (content.Contains("TargetProximityPlacementGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputInternal)this).TargetProximityPlacementGroupId = (string) content.GetValueForProperty("TargetProximityPlacementGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputInternal)this).TargetProximityPlacementGroupId, global::System.Convert.ToString); + } + if (content.Contains("TargetBootDiagnosticsStorageAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputInternal)this).TargetBootDiagnosticsStorageAccountId = (string) content.GetValueForProperty("TargetBootDiagnosticsStorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputInternal)this).TargetBootDiagnosticsStorageAccountId, global::System.Convert.ToString); + } + if (content.Contains("PerformAutoResync")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputInternal)this).PerformAutoResync = (string) content.GetValueForProperty("PerformAutoResync",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputInternal)this).PerformAutoResync, global::System.Convert.ToString); + } + if (content.Contains("TargetVMTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputInternal)this).TargetVMTag = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputTargetVmtags) content.GetValueForProperty("TargetVMTag",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputInternal)this).TargetVMTag, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtEnableMigrationInputTargetVmtagsTypeConverter.ConvertFrom); + } + if (content.Contains("SeedDiskTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputInternal)this).SeedDiskTag = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputSeedDiskTags) content.GetValueForProperty("SeedDiskTag",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputInternal)this).SeedDiskTag, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtEnableMigrationInputSeedDiskTagsTypeConverter.ConvertFrom); + } + if (content.Contains("TargetDiskTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputInternal)this).TargetDiskTag = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputTargetDiskTags) content.GetValueForProperty("TargetDiskTag",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputInternal)this).TargetDiskTag, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtEnableMigrationInputTargetDiskTagsTypeConverter.ConvertFrom); + } + if (content.Contains("TargetNicTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputInternal)this).TargetNicTag = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputTargetNicTags) content.GetValueForProperty("TargetNicTag",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputInternal)this).TargetNicTag, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtEnableMigrationInputTargetNicTagsTypeConverter.ConvertFrom); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + } + /// VMwareCbt specific enable migration input. + [System.ComponentModel.TypeConverter(typeof(VMwareCbtEnableMigrationInputTypeConverter))] + public partial interface IVMwareCbtEnableMigrationInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtEnableMigrationInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtEnableMigrationInput.TypeConverter.cs new file mode 100644 index 000000000000..3d0a79d2b2b1 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtEnableMigrationInput.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VMwareCbtEnableMigrationInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VMwareCbtEnableMigrationInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VMwareCbtEnableMigrationInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VMwareCbtEnableMigrationInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtEnableMigrationInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtEnableMigrationInput.cs new file mode 100644 index 000000000000..313a70e4632f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtEnableMigrationInput.cs @@ -0,0 +1,450 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// VMwareCbt specific enable migration input. + public partial class VMwareCbtEnableMigrationInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationProviderSpecificInput __enableMigrationProviderSpecificInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EnableMigrationProviderSpecificInput(); + + /// Backing field for property. + private string _dataMoverRunAsAccountId; + + /// The data mover run as account Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string DataMoverRunAsAccountId { get => this._dataMoverRunAsAccountId; set => this._dataMoverRunAsAccountId = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtDiskInput[] _disksToInclude; + + /// The disks to include list. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtDiskInput[] DisksToInclude { get => this._disksToInclude; set => this._disksToInclude = value; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationProviderSpecificInputInternal)__enableMigrationProviderSpecificInput).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationProviderSpecificInputInternal)__enableMigrationProviderSpecificInput).InstanceType = value ; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.LicenseType? _licenseType; + + /// License type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.LicenseType? LicenseType { get => this._licenseType; set => this._licenseType = value; } + + /// Backing field for property. + private string _performAutoResync; + + /// A value indicating whether auto resync is to be done. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string PerformAutoResync { get => this._performAutoResync; set => this._performAutoResync = value; } + + /// Backing field for property. + private string _performSqlBulkRegistration; + + /// A value indicating whether bulk SQL RP registration to be done. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string PerformSqlBulkRegistration { get => this._performSqlBulkRegistration; set => this._performSqlBulkRegistration = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputSeedDiskTags _seedDiskTag; + + /// The tags for the seed disks. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputSeedDiskTags SeedDiskTag { get => (this._seedDiskTag = this._seedDiskTag ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtEnableMigrationInputSeedDiskTags()); set => this._seedDiskTag = value; } + + /// Backing field for property. + private string _snapshotRunAsAccountId; + + /// The snapshot run as account Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string SnapshotRunAsAccountId { get => this._snapshotRunAsAccountId; set => this._snapshotRunAsAccountId = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SqlServerLicenseType? _sqlServerLicenseType; + + /// The SQL Server license type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SqlServerLicenseType? SqlServerLicenseType { get => this._sqlServerLicenseType; set => this._sqlServerLicenseType = value; } + + /// Backing field for property. + private string _targetAvailabilitySetId; + + /// The target availability set ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetAvailabilitySetId { get => this._targetAvailabilitySetId; set => this._targetAvailabilitySetId = value; } + + /// Backing field for property. + private string _targetAvailabilityZone; + + /// The target availability zone. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetAvailabilityZone { get => this._targetAvailabilityZone; set => this._targetAvailabilityZone = value; } + + /// + /// Backing field for property. + /// + private string _targetBootDiagnosticsStorageAccountId; + + /// The target boot diagnostics storage account ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetBootDiagnosticsStorageAccountId { get => this._targetBootDiagnosticsStorageAccountId; set => this._targetBootDiagnosticsStorageAccountId = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputTargetDiskTags _targetDiskTag; + + /// The tags for the target disks. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputTargetDiskTags TargetDiskTag { get => (this._targetDiskTag = this._targetDiskTag ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtEnableMigrationInputTargetDiskTags()); set => this._targetDiskTag = value; } + + /// Backing field for property. + private string _targetNetworkId; + + /// The target network ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetNetworkId { get => this._targetNetworkId; set => this._targetNetworkId = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputTargetNicTags _targetNicTag; + + /// The tags for the target NICs. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputTargetNicTags TargetNicTag { get => (this._targetNicTag = this._targetNicTag ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtEnableMigrationInputTargetNicTags()); set => this._targetNicTag = value; } + + /// Backing field for property. + private string _targetProximityPlacementGroupId; + + /// The target proximity placement group ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetProximityPlacementGroupId { get => this._targetProximityPlacementGroupId; set => this._targetProximityPlacementGroupId = value; } + + /// Backing field for property. + private string _targetResourceGroupId; + + /// The target resource group ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetResourceGroupId { get => this._targetResourceGroupId; set => this._targetResourceGroupId = value; } + + /// Backing field for property. + private string _targetSubnetName; + + /// The target subnet name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetSubnetName { get => this._targetSubnetName; set => this._targetSubnetName = value; } + + /// Backing field for property. + private string _targetVMName; + + /// The target VM name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetVMName { get => this._targetVMName; set => this._targetVMName = value; } + + /// Backing field for property. + private string _targetVMSize; + + /// The target VM size. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetVMSize { get => this._targetVMSize; set => this._targetVMSize = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputTargetVmtags _targetVMTag; + + /// The target VM tags. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputTargetVmtags TargetVMTag { get => (this._targetVMTag = this._targetVMTag ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtEnableMigrationInputTargetVmtags()); set => this._targetVMTag = value; } + + /// Backing field for property. + private string _testNetworkId; + + /// The selected test network ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TestNetworkId { get => this._testNetworkId; set => this._testNetworkId = value; } + + /// Backing field for property. + private string _testSubnetName; + + /// The selected test subnet name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TestSubnetName { get => this._testSubnetName; set => this._testSubnetName = value; } + + /// Backing field for property. + private string _vmwareMachineId; + + /// The ARM Id of the VM discovered in VMware. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string VmwareMachineId { get => this._vmwareMachineId; set => this._vmwareMachineId = value; } + + /// Creates an new instance. + public VMwareCbtEnableMigrationInput() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__enableMigrationProviderSpecificInput), __enableMigrationProviderSpecificInput); + await eventListener.AssertObjectIsValid(nameof(__enableMigrationProviderSpecificInput), __enableMigrationProviderSpecificInput); + } + } + /// VMwareCbt specific enable migration input. + public partial interface IVMwareCbtEnableMigrationInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationProviderSpecificInput + { + /// The data mover run as account Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The data mover run as account Id.", + SerializedName = @"dataMoverRunAsAccountId", + PossibleTypes = new [] { typeof(string) })] + string DataMoverRunAsAccountId { get; set; } + /// The disks to include list. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The disks to include list.", + SerializedName = @"disksToInclude", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtDiskInput) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtDiskInput[] DisksToInclude { get; set; } + /// License type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"License type.", + SerializedName = @"licenseType", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.LicenseType) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.LicenseType? LicenseType { get; set; } + /// A value indicating whether auto resync is to be done. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether auto resync is to be done.", + SerializedName = @"performAutoResync", + PossibleTypes = new [] { typeof(string) })] + string PerformAutoResync { get; set; } + /// A value indicating whether bulk SQL RP registration to be done. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether bulk SQL RP registration to be done.", + SerializedName = @"performSqlBulkRegistration", + PossibleTypes = new [] { typeof(string) })] + string PerformSqlBulkRegistration { get; set; } + /// The tags for the seed disks. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The tags for the seed disks.", + SerializedName = @"seedDiskTags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputSeedDiskTags) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputSeedDiskTags SeedDiskTag { get; set; } + /// The snapshot run as account Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The snapshot run as account Id.", + SerializedName = @"snapshotRunAsAccountId", + PossibleTypes = new [] { typeof(string) })] + string SnapshotRunAsAccountId { get; set; } + /// The SQL Server license type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The SQL Server license type.", + SerializedName = @"sqlServerLicenseType", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SqlServerLicenseType) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SqlServerLicenseType? SqlServerLicenseType { get; set; } + /// The target availability set ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target availability set ARM Id.", + SerializedName = @"targetAvailabilitySetId", + PossibleTypes = new [] { typeof(string) })] + string TargetAvailabilitySetId { get; set; } + /// The target availability zone. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target availability zone.", + SerializedName = @"targetAvailabilityZone", + PossibleTypes = new [] { typeof(string) })] + string TargetAvailabilityZone { get; set; } + /// The target boot diagnostics storage account ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target boot diagnostics storage account ARM Id.", + SerializedName = @"targetBootDiagnosticsStorageAccountId", + PossibleTypes = new [] { typeof(string) })] + string TargetBootDiagnosticsStorageAccountId { get; set; } + /// The tags for the target disks. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The tags for the target disks.", + SerializedName = @"targetDiskTags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputTargetDiskTags) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputTargetDiskTags TargetDiskTag { get; set; } + /// The target network ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The target network ARM Id.", + SerializedName = @"targetNetworkId", + PossibleTypes = new [] { typeof(string) })] + string TargetNetworkId { get; set; } + /// The tags for the target NICs. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The tags for the target NICs.", + SerializedName = @"targetNicTags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputTargetNicTags) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputTargetNicTags TargetNicTag { get; set; } + /// The target proximity placement group ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target proximity placement group ARM Id.", + SerializedName = @"targetProximityPlacementGroupId", + PossibleTypes = new [] { typeof(string) })] + string TargetProximityPlacementGroupId { get; set; } + /// The target resource group ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The target resource group ARM Id.", + SerializedName = @"targetResourceGroupId", + PossibleTypes = new [] { typeof(string) })] + string TargetResourceGroupId { get; set; } + /// The target subnet name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target subnet name.", + SerializedName = @"targetSubnetName", + PossibleTypes = new [] { typeof(string) })] + string TargetSubnetName { get; set; } + /// The target VM name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target VM name.", + SerializedName = @"targetVmName", + PossibleTypes = new [] { typeof(string) })] + string TargetVMName { get; set; } + /// The target VM size. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target VM size.", + SerializedName = @"targetVmSize", + PossibleTypes = new [] { typeof(string) })] + string TargetVMSize { get; set; } + /// The target VM tags. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target VM tags.", + SerializedName = @"targetVmTags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputTargetVmtags) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputTargetVmtags TargetVMTag { get; set; } + /// The selected test network ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The selected test network ARM Id.", + SerializedName = @"testNetworkId", + PossibleTypes = new [] { typeof(string) })] + string TestNetworkId { get; set; } + /// The selected test subnet name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The selected test subnet name.", + SerializedName = @"testSubnetName", + PossibleTypes = new [] { typeof(string) })] + string TestSubnetName { get; set; } + /// The ARM Id of the VM discovered in VMware. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ARM Id of the VM discovered in VMware.", + SerializedName = @"vmwareMachineId", + PossibleTypes = new [] { typeof(string) })] + string VmwareMachineId { get; set; } + + } + /// VMwareCbt specific enable migration input. + internal partial interface IVMwareCbtEnableMigrationInputInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationProviderSpecificInputInternal + { + /// The data mover run as account Id. + string DataMoverRunAsAccountId { get; set; } + /// The disks to include list. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtDiskInput[] DisksToInclude { get; set; } + /// License type. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.LicenseType? LicenseType { get; set; } + /// A value indicating whether auto resync is to be done. + string PerformAutoResync { get; set; } + /// A value indicating whether bulk SQL RP registration to be done. + string PerformSqlBulkRegistration { get; set; } + /// The tags for the seed disks. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputSeedDiskTags SeedDiskTag { get; set; } + /// The snapshot run as account Id. + string SnapshotRunAsAccountId { get; set; } + /// The SQL Server license type. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SqlServerLicenseType? SqlServerLicenseType { get; set; } + /// The target availability set ARM Id. + string TargetAvailabilitySetId { get; set; } + /// The target availability zone. + string TargetAvailabilityZone { get; set; } + /// The target boot diagnostics storage account ARM Id. + string TargetBootDiagnosticsStorageAccountId { get; set; } + /// The tags for the target disks. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputTargetDiskTags TargetDiskTag { get; set; } + /// The target network ARM Id. + string TargetNetworkId { get; set; } + /// The tags for the target NICs. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputTargetNicTags TargetNicTag { get; set; } + /// The target proximity placement group ARM Id. + string TargetProximityPlacementGroupId { get; set; } + /// The target resource group ARM Id. + string TargetResourceGroupId { get; set; } + /// The target subnet name. + string TargetSubnetName { get; set; } + /// The target VM name. + string TargetVMName { get; set; } + /// The target VM size. + string TargetVMSize { get; set; } + /// The target VM tags. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputTargetVmtags TargetVMTag { get; set; } + /// The selected test network ARM Id. + string TestNetworkId { get; set; } + /// The selected test subnet name. + string TestSubnetName { get; set; } + /// The ARM Id of the VM discovered in VMware. + string VmwareMachineId { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtEnableMigrationInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtEnableMigrationInput.json.cs new file mode 100644 index 000000000000..07fe313d8db2 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtEnableMigrationInput.json.cs @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// VMwareCbt specific enable migration input. + public partial class VMwareCbtEnableMigrationInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new VMwareCbtEnableMigrationInput(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __enableMigrationProviderSpecificInput?.ToJson(container, serializationMode); + AddIf( null != (((object)this._vmwareMachineId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._vmwareMachineId.ToString()) : null, "vmwareMachineId" ,container.Add ); + if (null != this._disksToInclude) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._disksToInclude ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("disksToInclude",__w); + } + AddIf( null != (((object)this._licenseType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._licenseType.ToString()) : null, "licenseType" ,container.Add ); + AddIf( null != (((object)this._sqlServerLicenseType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._sqlServerLicenseType.ToString()) : null, "sqlServerLicenseType" ,container.Add ); + AddIf( null != (((object)this._performSqlBulkRegistration)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._performSqlBulkRegistration.ToString()) : null, "performSqlBulkRegistration" ,container.Add ); + AddIf( null != (((object)this._dataMoverRunAsAccountId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._dataMoverRunAsAccountId.ToString()) : null, "dataMoverRunAsAccountId" ,container.Add ); + AddIf( null != (((object)this._snapshotRunAsAccountId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._snapshotRunAsAccountId.ToString()) : null, "snapshotRunAsAccountId" ,container.Add ); + AddIf( null != (((object)this._targetVMName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetVMName.ToString()) : null, "targetVmName" ,container.Add ); + AddIf( null != (((object)this._targetVMSize)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetVMSize.ToString()) : null, "targetVmSize" ,container.Add ); + AddIf( null != (((object)this._targetResourceGroupId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetResourceGroupId.ToString()) : null, "targetResourceGroupId" ,container.Add ); + AddIf( null != (((object)this._targetNetworkId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetNetworkId.ToString()) : null, "targetNetworkId" ,container.Add ); + AddIf( null != (((object)this._testNetworkId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._testNetworkId.ToString()) : null, "testNetworkId" ,container.Add ); + AddIf( null != (((object)this._targetSubnetName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetSubnetName.ToString()) : null, "targetSubnetName" ,container.Add ); + AddIf( null != (((object)this._testSubnetName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._testSubnetName.ToString()) : null, "testSubnetName" ,container.Add ); + AddIf( null != (((object)this._targetAvailabilitySetId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetAvailabilitySetId.ToString()) : null, "targetAvailabilitySetId" ,container.Add ); + AddIf( null != (((object)this._targetAvailabilityZone)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetAvailabilityZone.ToString()) : null, "targetAvailabilityZone" ,container.Add ); + AddIf( null != (((object)this._targetProximityPlacementGroupId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetProximityPlacementGroupId.ToString()) : null, "targetProximityPlacementGroupId" ,container.Add ); + AddIf( null != (((object)this._targetBootDiagnosticsStorageAccountId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetBootDiagnosticsStorageAccountId.ToString()) : null, "targetBootDiagnosticsStorageAccountId" ,container.Add ); + AddIf( null != (((object)this._performAutoResync)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._performAutoResync.ToString()) : null, "performAutoResync" ,container.Add ); + AddIf( null != this._targetVMTag ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._targetVMTag.ToJson(null,serializationMode) : null, "targetVmTags" ,container.Add ); + AddIf( null != this._seedDiskTag ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._seedDiskTag.ToJson(null,serializationMode) : null, "seedDiskTags" ,container.Add ); + AddIf( null != this._targetDiskTag ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._targetDiskTag.ToJson(null,serializationMode) : null, "targetDiskTags" ,container.Add ); + AddIf( null != this._targetNicTag ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._targetNicTag.ToJson(null,serializationMode) : null, "targetNicTags" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal VMwareCbtEnableMigrationInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __enableMigrationProviderSpecificInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EnableMigrationProviderSpecificInput(json); + {_vmwareMachineId = If( json?.PropertyT("vmwareMachineId"), out var __jsonVmwareMachineId) ? (string)__jsonVmwareMachineId : (string)VmwareMachineId;} + {_disksToInclude = If( json?.PropertyT("disksToInclude"), out var __jsonDisksToInclude) ? If( __jsonDisksToInclude as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtDiskInput) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtDiskInput.FromJson(__u) )) ))() : null : DisksToInclude;} + {_licenseType = If( json?.PropertyT("licenseType"), out var __jsonLicenseType) ? (string)__jsonLicenseType : (string)LicenseType;} + {_sqlServerLicenseType = If( json?.PropertyT("sqlServerLicenseType"), out var __jsonSqlServerLicenseType) ? (string)__jsonSqlServerLicenseType : (string)SqlServerLicenseType;} + {_performSqlBulkRegistration = If( json?.PropertyT("performSqlBulkRegistration"), out var __jsonPerformSqlBulkRegistration) ? (string)__jsonPerformSqlBulkRegistration : (string)PerformSqlBulkRegistration;} + {_dataMoverRunAsAccountId = If( json?.PropertyT("dataMoverRunAsAccountId"), out var __jsonDataMoverRunAsAccountId) ? (string)__jsonDataMoverRunAsAccountId : (string)DataMoverRunAsAccountId;} + {_snapshotRunAsAccountId = If( json?.PropertyT("snapshotRunAsAccountId"), out var __jsonSnapshotRunAsAccountId) ? (string)__jsonSnapshotRunAsAccountId : (string)SnapshotRunAsAccountId;} + {_targetVMName = If( json?.PropertyT("targetVmName"), out var __jsonTargetVMName) ? (string)__jsonTargetVMName : (string)TargetVMName;} + {_targetVMSize = If( json?.PropertyT("targetVmSize"), out var __jsonTargetVMSize) ? (string)__jsonTargetVMSize : (string)TargetVMSize;} + {_targetResourceGroupId = If( json?.PropertyT("targetResourceGroupId"), out var __jsonTargetResourceGroupId) ? (string)__jsonTargetResourceGroupId : (string)TargetResourceGroupId;} + {_targetNetworkId = If( json?.PropertyT("targetNetworkId"), out var __jsonTargetNetworkId) ? (string)__jsonTargetNetworkId : (string)TargetNetworkId;} + {_testNetworkId = If( json?.PropertyT("testNetworkId"), out var __jsonTestNetworkId) ? (string)__jsonTestNetworkId : (string)TestNetworkId;} + {_targetSubnetName = If( json?.PropertyT("targetSubnetName"), out var __jsonTargetSubnetName) ? (string)__jsonTargetSubnetName : (string)TargetSubnetName;} + {_testSubnetName = If( json?.PropertyT("testSubnetName"), out var __jsonTestSubnetName) ? (string)__jsonTestSubnetName : (string)TestSubnetName;} + {_targetAvailabilitySetId = If( json?.PropertyT("targetAvailabilitySetId"), out var __jsonTargetAvailabilitySetId) ? (string)__jsonTargetAvailabilitySetId : (string)TargetAvailabilitySetId;} + {_targetAvailabilityZone = If( json?.PropertyT("targetAvailabilityZone"), out var __jsonTargetAvailabilityZone) ? (string)__jsonTargetAvailabilityZone : (string)TargetAvailabilityZone;} + {_targetProximityPlacementGroupId = If( json?.PropertyT("targetProximityPlacementGroupId"), out var __jsonTargetProximityPlacementGroupId) ? (string)__jsonTargetProximityPlacementGroupId : (string)TargetProximityPlacementGroupId;} + {_targetBootDiagnosticsStorageAccountId = If( json?.PropertyT("targetBootDiagnosticsStorageAccountId"), out var __jsonTargetBootDiagnosticsStorageAccountId) ? (string)__jsonTargetBootDiagnosticsStorageAccountId : (string)TargetBootDiagnosticsStorageAccountId;} + {_performAutoResync = If( json?.PropertyT("performAutoResync"), out var __jsonPerformAutoResync) ? (string)__jsonPerformAutoResync : (string)PerformAutoResync;} + {_targetVMTag = If( json?.PropertyT("targetVmTags"), out var __jsonTargetVMTags) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtEnableMigrationInputTargetVmtags.FromJson(__jsonTargetVMTags) : TargetVMTag;} + {_seedDiskTag = If( json?.PropertyT("seedDiskTags"), out var __jsonSeedDiskTags) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtEnableMigrationInputSeedDiskTags.FromJson(__jsonSeedDiskTags) : SeedDiskTag;} + {_targetDiskTag = If( json?.PropertyT("targetDiskTags"), out var __jsonTargetDiskTags) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtEnableMigrationInputTargetDiskTags.FromJson(__jsonTargetDiskTags) : TargetDiskTag;} + {_targetNicTag = If( json?.PropertyT("targetNicTags"), out var __jsonTargetNicTags) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtEnableMigrationInputTargetNicTags.FromJson(__jsonTargetNicTags) : TargetNicTag;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtEnableMigrationInputSeedDiskTags.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtEnableMigrationInputSeedDiskTags.PowerShell.cs new file mode 100644 index 000000000000..077f313ddcd6 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtEnableMigrationInputSeedDiskTags.PowerShell.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// The tags for the seed disks. + [System.ComponentModel.TypeConverter(typeof(VMwareCbtEnableMigrationInputSeedDiskTagsTypeConverter))] + public partial class VMwareCbtEnableMigrationInputSeedDiskTags + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputSeedDiskTags DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VMwareCbtEnableMigrationInputSeedDiskTags(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputSeedDiskTags DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VMwareCbtEnableMigrationInputSeedDiskTags(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json + /// string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputSeedDiskTags FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VMwareCbtEnableMigrationInputSeedDiskTags(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal VMwareCbtEnableMigrationInputSeedDiskTags(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializePSObject(content); + } + } + /// The tags for the seed disks. + [System.ComponentModel.TypeConverter(typeof(VMwareCbtEnableMigrationInputSeedDiskTagsTypeConverter))] + public partial interface IVMwareCbtEnableMigrationInputSeedDiskTags + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtEnableMigrationInputSeedDiskTags.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtEnableMigrationInputSeedDiskTags.TypeConverter.cs new file mode 100644 index 000000000000..f77957d4877f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtEnableMigrationInputSeedDiskTags.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VMwareCbtEnableMigrationInputSeedDiskTagsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputSeedDiskTags ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputSeedDiskTags).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VMwareCbtEnableMigrationInputSeedDiskTags.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VMwareCbtEnableMigrationInputSeedDiskTags.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VMwareCbtEnableMigrationInputSeedDiskTags.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtEnableMigrationInputSeedDiskTags.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtEnableMigrationInputSeedDiskTags.cs new file mode 100644 index 000000000000..f7ca08a9cc43 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtEnableMigrationInputSeedDiskTags.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The tags for the seed disks. + public partial class VMwareCbtEnableMigrationInputSeedDiskTags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputSeedDiskTags, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputSeedDiskTagsInternal + { + + /// + /// Creates an new instance. + /// + public VMwareCbtEnableMigrationInputSeedDiskTags() + { + + } + } + /// The tags for the seed disks. + public partial interface IVMwareCbtEnableMigrationInputSeedDiskTags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray + { + + } + /// The tags for the seed disks. + internal partial interface IVMwareCbtEnableMigrationInputSeedDiskTagsInternal + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtEnableMigrationInputSeedDiskTags.dictionary.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtEnableMigrationInputSeedDiskTags.dictionary.cs new file mode 100644 index 000000000000..efc189f6ae46 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtEnableMigrationInputSeedDiskTags.dictionary.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + public partial class VMwareCbtEnableMigrationInputSeedDiskTags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray + { + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + + int Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Values { get => __additionalProperties.Values; } + + public string this[global::System.String index] { get => __additionalProperties[index]; set => __additionalProperties[index] = value; } + + /// + /// + public void Add(global::System.String key, string value) => __additionalProperties.Add( key, value); + + public void Clear() => __additionalProperties.Clear(); + + /// + public bool ContainsKey(global::System.String key) => __additionalProperties.ContainsKey( key); + + /// + public void CopyFrom(global::System.Collections.IDictionary source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public void CopyFrom(global::System.Management.Automation.PSObject source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public bool Remove(global::System.String key) => __additionalProperties.Remove( key); + + /// + /// + public bool TryGetValue(global::System.String key, out string value) => __additionalProperties.TryGetValue( key, out value); + + /// + + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtEnableMigrationInputSeedDiskTags source) => source.__additionalProperties; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtEnableMigrationInputSeedDiskTags.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtEnableMigrationInputSeedDiskTags.json.cs new file mode 100644 index 000000000000..54cd6afae757 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtEnableMigrationInputSeedDiskTags.json.cs @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The tags for the seed disks. + public partial class VMwareCbtEnableMigrationInputSeedDiskTags + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputSeedDiskTags. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputSeedDiskTags. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputSeedDiskTags FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new VMwareCbtEnableMigrationInputSeedDiskTags(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray)this).AdditionalProperties, container); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + /// + internal VMwareCbtEnableMigrationInputSeedDiskTags(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, global::System.Collections.Generic.HashSet exclusions = null) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray)this).AdditionalProperties, null ,exclusions ); + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtEnableMigrationInputTargetDiskTags.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtEnableMigrationInputTargetDiskTags.PowerShell.cs new file mode 100644 index 000000000000..97d7f247e5af --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtEnableMigrationInputTargetDiskTags.PowerShell.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// The tags for the target disks. + [System.ComponentModel.TypeConverter(typeof(VMwareCbtEnableMigrationInputTargetDiskTagsTypeConverter))] + public partial class VMwareCbtEnableMigrationInputTargetDiskTags + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputTargetDiskTags DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VMwareCbtEnableMigrationInputTargetDiskTags(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputTargetDiskTags DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VMwareCbtEnableMigrationInputTargetDiskTags(content); + } + + /// + /// Creates a new instance of , deserializing the content from a + /// json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputTargetDiskTags FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VMwareCbtEnableMigrationInputTargetDiskTags(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal VMwareCbtEnableMigrationInputTargetDiskTags(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializePSObject(content); + } + } + /// The tags for the target disks. + [System.ComponentModel.TypeConverter(typeof(VMwareCbtEnableMigrationInputTargetDiskTagsTypeConverter))] + public partial interface IVMwareCbtEnableMigrationInputTargetDiskTags + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtEnableMigrationInputTargetDiskTags.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtEnableMigrationInputTargetDiskTags.TypeConverter.cs new file mode 100644 index 000000000000..cff72691650d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtEnableMigrationInputTargetDiskTags.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VMwareCbtEnableMigrationInputTargetDiskTagsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputTargetDiskTags ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputTargetDiskTags).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VMwareCbtEnableMigrationInputTargetDiskTags.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VMwareCbtEnableMigrationInputTargetDiskTags.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VMwareCbtEnableMigrationInputTargetDiskTags.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtEnableMigrationInputTargetDiskTags.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtEnableMigrationInputTargetDiskTags.cs new file mode 100644 index 000000000000..58a86bd66d9c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtEnableMigrationInputTargetDiskTags.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The tags for the target disks. + public partial class VMwareCbtEnableMigrationInputTargetDiskTags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputTargetDiskTags, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputTargetDiskTagsInternal + { + + /// + /// Creates an new instance. + /// + public VMwareCbtEnableMigrationInputTargetDiskTags() + { + + } + } + /// The tags for the target disks. + public partial interface IVMwareCbtEnableMigrationInputTargetDiskTags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray + { + + } + /// The tags for the target disks. + internal partial interface IVMwareCbtEnableMigrationInputTargetDiskTagsInternal + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtEnableMigrationInputTargetDiskTags.dictionary.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtEnableMigrationInputTargetDiskTags.dictionary.cs new file mode 100644 index 000000000000..ae4397ca99ea --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtEnableMigrationInputTargetDiskTags.dictionary.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + public partial class VMwareCbtEnableMigrationInputTargetDiskTags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray + { + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + + int Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Values { get => __additionalProperties.Values; } + + public string this[global::System.String index] { get => __additionalProperties[index]; set => __additionalProperties[index] = value; } + + /// + /// + public void Add(global::System.String key, string value) => __additionalProperties.Add( key, value); + + public void Clear() => __additionalProperties.Clear(); + + /// + public bool ContainsKey(global::System.String key) => __additionalProperties.ContainsKey( key); + + /// + public void CopyFrom(global::System.Collections.IDictionary source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public void CopyFrom(global::System.Management.Automation.PSObject source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public bool Remove(global::System.String key) => __additionalProperties.Remove( key); + + /// + /// + public bool TryGetValue(global::System.String key, out string value) => __additionalProperties.TryGetValue( key, out value); + + /// + + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtEnableMigrationInputTargetDiskTags source) => source.__additionalProperties; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtEnableMigrationInputTargetDiskTags.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtEnableMigrationInputTargetDiskTags.json.cs new file mode 100644 index 000000000000..52c18eecfada --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtEnableMigrationInputTargetDiskTags.json.cs @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The tags for the target disks. + public partial class VMwareCbtEnableMigrationInputTargetDiskTags + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputTargetDiskTags. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputTargetDiskTags. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputTargetDiskTags FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new VMwareCbtEnableMigrationInputTargetDiskTags(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray)this).AdditionalProperties, container); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + /// + internal VMwareCbtEnableMigrationInputTargetDiskTags(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, global::System.Collections.Generic.HashSet exclusions = null) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray)this).AdditionalProperties, null ,exclusions ); + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtEnableMigrationInputTargetNicTags.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtEnableMigrationInputTargetNicTags.PowerShell.cs new file mode 100644 index 000000000000..9a478603df46 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtEnableMigrationInputTargetNicTags.PowerShell.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// The tags for the target NICs. + [System.ComponentModel.TypeConverter(typeof(VMwareCbtEnableMigrationInputTargetNicTagsTypeConverter))] + public partial class VMwareCbtEnableMigrationInputTargetNicTags + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputTargetNicTags DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VMwareCbtEnableMigrationInputTargetNicTags(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputTargetNicTags DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VMwareCbtEnableMigrationInputTargetNicTags(content); + } + + /// + /// Creates a new instance of , deserializing the content from a + /// json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputTargetNicTags FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VMwareCbtEnableMigrationInputTargetNicTags(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal VMwareCbtEnableMigrationInputTargetNicTags(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializePSObject(content); + } + } + /// The tags for the target NICs. + [System.ComponentModel.TypeConverter(typeof(VMwareCbtEnableMigrationInputTargetNicTagsTypeConverter))] + public partial interface IVMwareCbtEnableMigrationInputTargetNicTags + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtEnableMigrationInputTargetNicTags.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtEnableMigrationInputTargetNicTags.TypeConverter.cs new file mode 100644 index 000000000000..baafd3ce7861 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtEnableMigrationInputTargetNicTags.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VMwareCbtEnableMigrationInputTargetNicTagsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputTargetNicTags ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputTargetNicTags).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VMwareCbtEnableMigrationInputTargetNicTags.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VMwareCbtEnableMigrationInputTargetNicTags.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VMwareCbtEnableMigrationInputTargetNicTags.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtEnableMigrationInputTargetNicTags.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtEnableMigrationInputTargetNicTags.cs new file mode 100644 index 000000000000..f34ebca8fa5e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtEnableMigrationInputTargetNicTags.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The tags for the target NICs. + public partial class VMwareCbtEnableMigrationInputTargetNicTags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputTargetNicTags, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputTargetNicTagsInternal + { + + /// + /// Creates an new instance. + /// + public VMwareCbtEnableMigrationInputTargetNicTags() + { + + } + } + /// The tags for the target NICs. + public partial interface IVMwareCbtEnableMigrationInputTargetNicTags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray + { + + } + /// The tags for the target NICs. + internal partial interface IVMwareCbtEnableMigrationInputTargetNicTagsInternal + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtEnableMigrationInputTargetNicTags.dictionary.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtEnableMigrationInputTargetNicTags.dictionary.cs new file mode 100644 index 000000000000..7372444dcd89 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtEnableMigrationInputTargetNicTags.dictionary.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + public partial class VMwareCbtEnableMigrationInputTargetNicTags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray + { + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + + int Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Values { get => __additionalProperties.Values; } + + public string this[global::System.String index] { get => __additionalProperties[index]; set => __additionalProperties[index] = value; } + + /// + /// + public void Add(global::System.String key, string value) => __additionalProperties.Add( key, value); + + public void Clear() => __additionalProperties.Clear(); + + /// + public bool ContainsKey(global::System.String key) => __additionalProperties.ContainsKey( key); + + /// + public void CopyFrom(global::System.Collections.IDictionary source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public void CopyFrom(global::System.Management.Automation.PSObject source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public bool Remove(global::System.String key) => __additionalProperties.Remove( key); + + /// + /// + public bool TryGetValue(global::System.String key, out string value) => __additionalProperties.TryGetValue( key, out value); + + /// + + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtEnableMigrationInputTargetNicTags source) => source.__additionalProperties; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtEnableMigrationInputTargetNicTags.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtEnableMigrationInputTargetNicTags.json.cs new file mode 100644 index 000000000000..05d3fc74ad97 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtEnableMigrationInputTargetNicTags.json.cs @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The tags for the target NICs. + public partial class VMwareCbtEnableMigrationInputTargetNicTags + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputTargetNicTags. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputTargetNicTags. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputTargetNicTags FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new VMwareCbtEnableMigrationInputTargetNicTags(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray)this).AdditionalProperties, container); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + /// + internal VMwareCbtEnableMigrationInputTargetNicTags(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, global::System.Collections.Generic.HashSet exclusions = null) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray)this).AdditionalProperties, null ,exclusions ); + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtEnableMigrationInputTargetVmtags.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtEnableMigrationInputTargetVmtags.PowerShell.cs new file mode 100644 index 000000000000..9b05c4f82b2a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtEnableMigrationInputTargetVmtags.PowerShell.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// The target VM tags. + [System.ComponentModel.TypeConverter(typeof(VMwareCbtEnableMigrationInputTargetVmtagsTypeConverter))] + public partial class VMwareCbtEnableMigrationInputTargetVmtags + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputTargetVmtags DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VMwareCbtEnableMigrationInputTargetVmtags(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputTargetVmtags DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VMwareCbtEnableMigrationInputTargetVmtags(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json + /// string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputTargetVmtags FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VMwareCbtEnableMigrationInputTargetVmtags(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal VMwareCbtEnableMigrationInputTargetVmtags(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializePSObject(content); + } + } + /// The target VM tags. + [System.ComponentModel.TypeConverter(typeof(VMwareCbtEnableMigrationInputTargetVmtagsTypeConverter))] + public partial interface IVMwareCbtEnableMigrationInputTargetVmtags + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtEnableMigrationInputTargetVmtags.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtEnableMigrationInputTargetVmtags.TypeConverter.cs new file mode 100644 index 000000000000..57f8f744dec8 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtEnableMigrationInputTargetVmtags.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VMwareCbtEnableMigrationInputTargetVmtagsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputTargetVmtags ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputTargetVmtags).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VMwareCbtEnableMigrationInputTargetVmtags.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VMwareCbtEnableMigrationInputTargetVmtags.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VMwareCbtEnableMigrationInputTargetVmtags.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtEnableMigrationInputTargetVmtags.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtEnableMigrationInputTargetVmtags.cs new file mode 100644 index 000000000000..8add96aecca1 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtEnableMigrationInputTargetVmtags.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The target VM tags. + public partial class VMwareCbtEnableMigrationInputTargetVmtags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputTargetVmtags, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputTargetVmtagsInternal + { + + /// + /// Creates an new instance. + /// + public VMwareCbtEnableMigrationInputTargetVmtags() + { + + } + } + /// The target VM tags. + public partial interface IVMwareCbtEnableMigrationInputTargetVmtags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray + { + + } + /// The target VM tags. + internal partial interface IVMwareCbtEnableMigrationInputTargetVmtagsInternal + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtEnableMigrationInputTargetVmtags.dictionary.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtEnableMigrationInputTargetVmtags.dictionary.cs new file mode 100644 index 000000000000..2a7ea8a57fbc --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtEnableMigrationInputTargetVmtags.dictionary.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + public partial class VMwareCbtEnableMigrationInputTargetVmtags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray + { + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + + int Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Values { get => __additionalProperties.Values; } + + public string this[global::System.String index] { get => __additionalProperties[index]; set => __additionalProperties[index] = value; } + + /// + /// + public void Add(global::System.String key, string value) => __additionalProperties.Add( key, value); + + public void Clear() => __additionalProperties.Clear(); + + /// + public bool ContainsKey(global::System.String key) => __additionalProperties.ContainsKey( key); + + /// + public void CopyFrom(global::System.Collections.IDictionary source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public void CopyFrom(global::System.Management.Automation.PSObject source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public bool Remove(global::System.String key) => __additionalProperties.Remove( key); + + /// + /// + public bool TryGetValue(global::System.String key, out string value) => __additionalProperties.TryGetValue( key, out value); + + /// + + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtEnableMigrationInputTargetVmtags source) => source.__additionalProperties; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtEnableMigrationInputTargetVmtags.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtEnableMigrationInputTargetVmtags.json.cs new file mode 100644 index 000000000000..b17ccf30f323 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtEnableMigrationInputTargetVmtags.json.cs @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The target VM tags. + public partial class VMwareCbtEnableMigrationInputTargetVmtags + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputTargetVmtags. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputTargetVmtags. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEnableMigrationInputTargetVmtags FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new VMwareCbtEnableMigrationInputTargetVmtags(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray)this).AdditionalProperties, container); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + /// + internal VMwareCbtEnableMigrationInputTargetVmtags(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, global::System.Collections.Generic.HashSet exclusions = null) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray)this).AdditionalProperties, null ,exclusions ); + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtEventDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtEventDetails.PowerShell.cs new file mode 100644 index 000000000000..9aac2080648b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtEventDetails.PowerShell.cs @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Event details for VMwareCbt provider. + [System.ComponentModel.TypeConverter(typeof(VMwareCbtEventDetailsTypeConverter))] + public partial class VMwareCbtEventDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEventDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VMwareCbtEventDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEventDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VMwareCbtEventDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEventDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VMwareCbtEventDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("MigrationItemName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEventDetailsInternal)this).MigrationItemName = (string) content.GetValueForProperty("MigrationItemName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEventDetailsInternal)this).MigrationItemName, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal VMwareCbtEventDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("MigrationItemName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEventDetailsInternal)this).MigrationItemName = (string) content.GetValueForProperty("MigrationItemName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEventDetailsInternal)this).MigrationItemName, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + } + /// Event details for VMwareCbt provider. + [System.ComponentModel.TypeConverter(typeof(VMwareCbtEventDetailsTypeConverter))] + public partial interface IVMwareCbtEventDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtEventDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtEventDetails.TypeConverter.cs new file mode 100644 index 000000000000..405f5a19c9bc --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtEventDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VMwareCbtEventDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEventDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEventDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VMwareCbtEventDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VMwareCbtEventDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VMwareCbtEventDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtEventDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtEventDetails.cs new file mode 100644 index 000000000000..0ebeb62e2b04 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtEventDetails.cs @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Event details for VMwareCbt provider. + public partial class VMwareCbtEventDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEventDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEventDetailsInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetails __eventProviderSpecificDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EventProviderSpecificDetails(); + + /// Gets the class type. Overridden in derived classes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetailsInternal)__eventProviderSpecificDetails).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetailsInternal)__eventProviderSpecificDetails).InstanceType = value ; } + + /// Internal Acessors for MigrationItemName + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEventDetailsInternal.MigrationItemName { get => this._migrationItemName; set { {_migrationItemName = value;} } } + + /// Backing field for property. + private string _migrationItemName; + + /// The migration item name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string MigrationItemName { get => this._migrationItemName; } + + /// Creates an new instance. + public VMwareCbtEventDetails() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__eventProviderSpecificDetails), __eventProviderSpecificDetails); + await eventListener.AssertObjectIsValid(nameof(__eventProviderSpecificDetails), __eventProviderSpecificDetails); + } + } + /// Event details for VMwareCbt provider. + public partial interface IVMwareCbtEventDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetails + { + /// The migration item name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The migration item name.", + SerializedName = @"migrationItemName", + PossibleTypes = new [] { typeof(string) })] + string MigrationItemName { get; } + + } + /// Event details for VMwareCbt provider. + internal partial interface IVMwareCbtEventDetailsInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventProviderSpecificDetailsInternal + { + /// The migration item name. + string MigrationItemName { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtEventDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtEventDetails.json.cs new file mode 100644 index 000000000000..0e84ddf3b8ec --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtEventDetails.json.cs @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Event details for VMwareCbt provider. + public partial class VMwareCbtEventDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEventDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEventDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtEventDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new VMwareCbtEventDetails(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __eventProviderSpecificDetails?.ToJson(container, serializationMode); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._migrationItemName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._migrationItemName.ToString()) : null, "migrationItemName" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal VMwareCbtEventDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __eventProviderSpecificDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EventProviderSpecificDetails(json); + {_migrationItemName = If( json?.PropertyT("migrationItemName"), out var __jsonMigrationItemName) ? (string)__jsonMigrationItemName : (string)MigrationItemName;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtMigrateInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtMigrateInput.PowerShell.cs new file mode 100644 index 000000000000..759053afd51c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtMigrateInput.PowerShell.cs @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// VMwareCbt specific migrate input. + [System.ComponentModel.TypeConverter(typeof(VMwareCbtMigrateInputTypeConverter))] + public partial class VMwareCbtMigrateInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrateInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VMwareCbtMigrateInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrateInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VMwareCbtMigrateInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrateInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VMwareCbtMigrateInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("PerformShutdown")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrateInputInternal)this).PerformShutdown = (string) content.GetValueForProperty("PerformShutdown",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrateInputInternal)this).PerformShutdown, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal VMwareCbtMigrateInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("PerformShutdown")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrateInputInternal)this).PerformShutdown = (string) content.GetValueForProperty("PerformShutdown",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrateInputInternal)this).PerformShutdown, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + } + /// VMwareCbt specific migrate input. + [System.ComponentModel.TypeConverter(typeof(VMwareCbtMigrateInputTypeConverter))] + public partial interface IVMwareCbtMigrateInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtMigrateInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtMigrateInput.TypeConverter.cs new file mode 100644 index 000000000000..b93d517a7bd1 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtMigrateInput.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VMwareCbtMigrateInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrateInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrateInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VMwareCbtMigrateInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VMwareCbtMigrateInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VMwareCbtMigrateInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtMigrateInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtMigrateInput.cs new file mode 100644 index 000000000000..14b336fa3525 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtMigrateInput.cs @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// VMwareCbt specific migrate input. + public partial class VMwareCbtMigrateInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrateInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrateInputInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateProviderSpecificInput __migrateProviderSpecificInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.MigrateProviderSpecificInput(); + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateProviderSpecificInputInternal)__migrateProviderSpecificInput).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateProviderSpecificInputInternal)__migrateProviderSpecificInput).InstanceType = value ; } + + /// Backing field for property. + private string _performShutdown; + + /// A value indicating whether VM is to be shutdown. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string PerformShutdown { get => this._performShutdown; set => this._performShutdown = value; } + + /// Creates an new instance. + public VMwareCbtMigrateInput() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__migrateProviderSpecificInput), __migrateProviderSpecificInput); + await eventListener.AssertObjectIsValid(nameof(__migrateProviderSpecificInput), __migrateProviderSpecificInput); + } + } + /// VMwareCbt specific migrate input. + public partial interface IVMwareCbtMigrateInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateProviderSpecificInput + { + /// A value indicating whether VM is to be shutdown. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"A value indicating whether VM is to be shutdown.", + SerializedName = @"performShutdown", + PossibleTypes = new [] { typeof(string) })] + string PerformShutdown { get; set; } + + } + /// VMwareCbt specific migrate input. + internal partial interface IVMwareCbtMigrateInputInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateProviderSpecificInputInternal + { + /// A value indicating whether VM is to be shutdown. + string PerformShutdown { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtMigrateInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtMigrateInput.json.cs new file mode 100644 index 000000000000..71689ba5b05c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtMigrateInput.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// VMwareCbt specific migrate input. + public partial class VMwareCbtMigrateInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrateInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrateInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrateInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new VMwareCbtMigrateInput(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __migrateProviderSpecificInput?.ToJson(container, serializationMode); + AddIf( null != (((object)this._performShutdown)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._performShutdown.ToString()) : null, "performShutdown" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal VMwareCbtMigrateInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __migrateProviderSpecificInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.MigrateProviderSpecificInput(json); + {_performShutdown = If( json?.PropertyT("performShutdown"), out var __jsonPerformShutdown) ? (string)__jsonPerformShutdown : (string)PerformShutdown;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtMigrationDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtMigrationDetails.PowerShell.cs new file mode 100644 index 000000000000..277a97068a86 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtMigrationDetails.PowerShell.cs @@ -0,0 +1,450 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// VMwareCbt provider specific settings. + [System.ComponentModel.TypeConverter(typeof(VMwareCbtMigrationDetailsTypeConverter))] + public partial class VMwareCbtMigrationDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VMwareCbtMigrationDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VMwareCbtMigrationDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VMwareCbtMigrationDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("VmwareMachineId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).VmwareMachineId = (string) content.GetValueForProperty("VmwareMachineId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).VmwareMachineId, global::System.Convert.ToString); + } + if (content.Contains("OSType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).OSType = (string) content.GetValueForProperty("OSType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).OSType, global::System.Convert.ToString); + } + if (content.Contains("FirmwareType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).FirmwareType = (string) content.GetValueForProperty("FirmwareType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).FirmwareType, global::System.Convert.ToString); + } + if (content.Contains("TargetGeneration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).TargetGeneration = (string) content.GetValueForProperty("TargetGeneration",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).TargetGeneration, global::System.Convert.ToString); + } + if (content.Contains("LicenseType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).LicenseType = (string) content.GetValueForProperty("LicenseType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).LicenseType, global::System.Convert.ToString); + } + if (content.Contains("SqlServerLicenseType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).SqlServerLicenseType = (string) content.GetValueForProperty("SqlServerLicenseType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).SqlServerLicenseType, global::System.Convert.ToString); + } + if (content.Contains("DataMoverRunAsAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).DataMoverRunAsAccountId = (string) content.GetValueForProperty("DataMoverRunAsAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).DataMoverRunAsAccountId, global::System.Convert.ToString); + } + if (content.Contains("SnapshotRunAsAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).SnapshotRunAsAccountId = (string) content.GetValueForProperty("SnapshotRunAsAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).SnapshotRunAsAccountId, global::System.Convert.ToString); + } + if (content.Contains("StorageAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).StorageAccountId = (string) content.GetValueForProperty("StorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).StorageAccountId, global::System.Convert.ToString); + } + if (content.Contains("TargetVMName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).TargetVMName = (string) content.GetValueForProperty("TargetVMName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).TargetVMName, global::System.Convert.ToString); + } + if (content.Contains("TargetVMSize")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).TargetVMSize = (string) content.GetValueForProperty("TargetVMSize",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).TargetVMSize, global::System.Convert.ToString); + } + if (content.Contains("TargetLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).TargetLocation = (string) content.GetValueForProperty("TargetLocation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).TargetLocation, global::System.Convert.ToString); + } + if (content.Contains("TargetResourceGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).TargetResourceGroupId = (string) content.GetValueForProperty("TargetResourceGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).TargetResourceGroupId, global::System.Convert.ToString); + } + if (content.Contains("TargetAvailabilitySetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).TargetAvailabilitySetId = (string) content.GetValueForProperty("TargetAvailabilitySetId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).TargetAvailabilitySetId, global::System.Convert.ToString); + } + if (content.Contains("TargetAvailabilityZone")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).TargetAvailabilityZone = (string) content.GetValueForProperty("TargetAvailabilityZone",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).TargetAvailabilityZone, global::System.Convert.ToString); + } + if (content.Contains("TargetProximityPlacementGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).TargetProximityPlacementGroupId = (string) content.GetValueForProperty("TargetProximityPlacementGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).TargetProximityPlacementGroupId, global::System.Convert.ToString); + } + if (content.Contains("TargetBootDiagnosticsStorageAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).TargetBootDiagnosticsStorageAccountId = (string) content.GetValueForProperty("TargetBootDiagnosticsStorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).TargetBootDiagnosticsStorageAccountId, global::System.Convert.ToString); + } + if (content.Contains("TargetVMTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).TargetVMTag = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsTargetVmtags) content.GetValueForProperty("TargetVMTag",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).TargetVMTag, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtMigrationDetailsTargetVmtagsTypeConverter.ConvertFrom); + } + if (content.Contains("ProtectedDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).ProtectedDisk = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectedDiskDetails[]) content.GetValueForProperty("ProtectedDisk",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).ProtectedDisk, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtProtectedDiskDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("TargetNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).TargetNetworkId = (string) content.GetValueForProperty("TargetNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).TargetNetworkId, global::System.Convert.ToString); + } + if (content.Contains("TestNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).TestNetworkId = (string) content.GetValueForProperty("TestNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).TestNetworkId, global::System.Convert.ToString); + } + if (content.Contains("VMNic")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).VMNic = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicDetails[]) content.GetValueForProperty("VMNic",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).VMNic, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtNicDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("TargetNicTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).TargetNicTag = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsTargetNicTags) content.GetValueForProperty("TargetNicTag",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).TargetNicTag, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtMigrationDetailsTargetNicTagsTypeConverter.ConvertFrom); + } + if (content.Contains("MigrationRecoveryPointId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).MigrationRecoveryPointId = (string) content.GetValueForProperty("MigrationRecoveryPointId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).MigrationRecoveryPointId, global::System.Convert.ToString); + } + if (content.Contains("LastRecoveryPointReceived")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).LastRecoveryPointReceived = (global::System.DateTime?) content.GetValueForProperty("LastRecoveryPointReceived",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).LastRecoveryPointReceived, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("LastRecoveryPointId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).LastRecoveryPointId = (string) content.GetValueForProperty("LastRecoveryPointId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).LastRecoveryPointId, global::System.Convert.ToString); + } + if (content.Contains("InitialSeedingProgressPercentage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).InitialSeedingProgressPercentage = (int?) content.GetValueForProperty("InitialSeedingProgressPercentage",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).InitialSeedingProgressPercentage, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("MigrationProgressPercentage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).MigrationProgressPercentage = (int?) content.GetValueForProperty("MigrationProgressPercentage",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).MigrationProgressPercentage, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("ResyncProgressPercentage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).ResyncProgressPercentage = (int?) content.GetValueForProperty("ResyncProgressPercentage",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).ResyncProgressPercentage, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("ResumeProgressPercentage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).ResumeProgressPercentage = (int?) content.GetValueForProperty("ResumeProgressPercentage",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).ResumeProgressPercentage, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("InitialSeedingRetryCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).InitialSeedingRetryCount = (long?) content.GetValueForProperty("InitialSeedingRetryCount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).InitialSeedingRetryCount, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("ResyncRetryCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).ResyncRetryCount = (long?) content.GetValueForProperty("ResyncRetryCount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).ResyncRetryCount, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("ResumeRetryCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).ResumeRetryCount = (long?) content.GetValueForProperty("ResumeRetryCount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).ResumeRetryCount, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("ResyncRequired")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).ResyncRequired = (string) content.GetValueForProperty("ResyncRequired",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).ResyncRequired, global::System.Convert.ToString); + } + if (content.Contains("ResyncState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).ResyncState = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ResyncState?) content.GetValueForProperty("ResyncState",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).ResyncState, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ResyncState.CreateFrom); + } + if (content.Contains("PerformAutoResync")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).PerformAutoResync = (string) content.GetValueForProperty("PerformAutoResync",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).PerformAutoResync, global::System.Convert.ToString); + } + if (content.Contains("SeedDiskTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).SeedDiskTag = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsSeedDiskTags) content.GetValueForProperty("SeedDiskTag",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).SeedDiskTag, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtMigrationDetailsSeedDiskTagsTypeConverter.ConvertFrom); + } + if (content.Contains("TargetDiskTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).TargetDiskTag = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsTargetDiskTags) content.GetValueForProperty("TargetDiskTag",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).TargetDiskTag, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtMigrationDetailsTargetDiskTagsTypeConverter.ConvertFrom); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationProviderSpecificSettingsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationProviderSpecificSettingsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal VMwareCbtMigrationDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("VmwareMachineId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).VmwareMachineId = (string) content.GetValueForProperty("VmwareMachineId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).VmwareMachineId, global::System.Convert.ToString); + } + if (content.Contains("OSType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).OSType = (string) content.GetValueForProperty("OSType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).OSType, global::System.Convert.ToString); + } + if (content.Contains("FirmwareType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).FirmwareType = (string) content.GetValueForProperty("FirmwareType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).FirmwareType, global::System.Convert.ToString); + } + if (content.Contains("TargetGeneration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).TargetGeneration = (string) content.GetValueForProperty("TargetGeneration",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).TargetGeneration, global::System.Convert.ToString); + } + if (content.Contains("LicenseType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).LicenseType = (string) content.GetValueForProperty("LicenseType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).LicenseType, global::System.Convert.ToString); + } + if (content.Contains("SqlServerLicenseType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).SqlServerLicenseType = (string) content.GetValueForProperty("SqlServerLicenseType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).SqlServerLicenseType, global::System.Convert.ToString); + } + if (content.Contains("DataMoverRunAsAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).DataMoverRunAsAccountId = (string) content.GetValueForProperty("DataMoverRunAsAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).DataMoverRunAsAccountId, global::System.Convert.ToString); + } + if (content.Contains("SnapshotRunAsAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).SnapshotRunAsAccountId = (string) content.GetValueForProperty("SnapshotRunAsAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).SnapshotRunAsAccountId, global::System.Convert.ToString); + } + if (content.Contains("StorageAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).StorageAccountId = (string) content.GetValueForProperty("StorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).StorageAccountId, global::System.Convert.ToString); + } + if (content.Contains("TargetVMName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).TargetVMName = (string) content.GetValueForProperty("TargetVMName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).TargetVMName, global::System.Convert.ToString); + } + if (content.Contains("TargetVMSize")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).TargetVMSize = (string) content.GetValueForProperty("TargetVMSize",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).TargetVMSize, global::System.Convert.ToString); + } + if (content.Contains("TargetLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).TargetLocation = (string) content.GetValueForProperty("TargetLocation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).TargetLocation, global::System.Convert.ToString); + } + if (content.Contains("TargetResourceGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).TargetResourceGroupId = (string) content.GetValueForProperty("TargetResourceGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).TargetResourceGroupId, global::System.Convert.ToString); + } + if (content.Contains("TargetAvailabilitySetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).TargetAvailabilitySetId = (string) content.GetValueForProperty("TargetAvailabilitySetId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).TargetAvailabilitySetId, global::System.Convert.ToString); + } + if (content.Contains("TargetAvailabilityZone")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).TargetAvailabilityZone = (string) content.GetValueForProperty("TargetAvailabilityZone",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).TargetAvailabilityZone, global::System.Convert.ToString); + } + if (content.Contains("TargetProximityPlacementGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).TargetProximityPlacementGroupId = (string) content.GetValueForProperty("TargetProximityPlacementGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).TargetProximityPlacementGroupId, global::System.Convert.ToString); + } + if (content.Contains("TargetBootDiagnosticsStorageAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).TargetBootDiagnosticsStorageAccountId = (string) content.GetValueForProperty("TargetBootDiagnosticsStorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).TargetBootDiagnosticsStorageAccountId, global::System.Convert.ToString); + } + if (content.Contains("TargetVMTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).TargetVMTag = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsTargetVmtags) content.GetValueForProperty("TargetVMTag",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).TargetVMTag, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtMigrationDetailsTargetVmtagsTypeConverter.ConvertFrom); + } + if (content.Contains("ProtectedDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).ProtectedDisk = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectedDiskDetails[]) content.GetValueForProperty("ProtectedDisk",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).ProtectedDisk, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtProtectedDiskDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("TargetNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).TargetNetworkId = (string) content.GetValueForProperty("TargetNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).TargetNetworkId, global::System.Convert.ToString); + } + if (content.Contains("TestNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).TestNetworkId = (string) content.GetValueForProperty("TestNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).TestNetworkId, global::System.Convert.ToString); + } + if (content.Contains("VMNic")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).VMNic = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicDetails[]) content.GetValueForProperty("VMNic",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).VMNic, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtNicDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("TargetNicTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).TargetNicTag = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsTargetNicTags) content.GetValueForProperty("TargetNicTag",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).TargetNicTag, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtMigrationDetailsTargetNicTagsTypeConverter.ConvertFrom); + } + if (content.Contains("MigrationRecoveryPointId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).MigrationRecoveryPointId = (string) content.GetValueForProperty("MigrationRecoveryPointId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).MigrationRecoveryPointId, global::System.Convert.ToString); + } + if (content.Contains("LastRecoveryPointReceived")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).LastRecoveryPointReceived = (global::System.DateTime?) content.GetValueForProperty("LastRecoveryPointReceived",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).LastRecoveryPointReceived, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("LastRecoveryPointId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).LastRecoveryPointId = (string) content.GetValueForProperty("LastRecoveryPointId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).LastRecoveryPointId, global::System.Convert.ToString); + } + if (content.Contains("InitialSeedingProgressPercentage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).InitialSeedingProgressPercentage = (int?) content.GetValueForProperty("InitialSeedingProgressPercentage",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).InitialSeedingProgressPercentage, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("MigrationProgressPercentage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).MigrationProgressPercentage = (int?) content.GetValueForProperty("MigrationProgressPercentage",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).MigrationProgressPercentage, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("ResyncProgressPercentage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).ResyncProgressPercentage = (int?) content.GetValueForProperty("ResyncProgressPercentage",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).ResyncProgressPercentage, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("ResumeProgressPercentage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).ResumeProgressPercentage = (int?) content.GetValueForProperty("ResumeProgressPercentage",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).ResumeProgressPercentage, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("InitialSeedingRetryCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).InitialSeedingRetryCount = (long?) content.GetValueForProperty("InitialSeedingRetryCount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).InitialSeedingRetryCount, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("ResyncRetryCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).ResyncRetryCount = (long?) content.GetValueForProperty("ResyncRetryCount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).ResyncRetryCount, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("ResumeRetryCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).ResumeRetryCount = (long?) content.GetValueForProperty("ResumeRetryCount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).ResumeRetryCount, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("ResyncRequired")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).ResyncRequired = (string) content.GetValueForProperty("ResyncRequired",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).ResyncRequired, global::System.Convert.ToString); + } + if (content.Contains("ResyncState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).ResyncState = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ResyncState?) content.GetValueForProperty("ResyncState",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).ResyncState, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ResyncState.CreateFrom); + } + if (content.Contains("PerformAutoResync")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).PerformAutoResync = (string) content.GetValueForProperty("PerformAutoResync",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).PerformAutoResync, global::System.Convert.ToString); + } + if (content.Contains("SeedDiskTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).SeedDiskTag = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsSeedDiskTags) content.GetValueForProperty("SeedDiskTag",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).SeedDiskTag, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtMigrationDetailsSeedDiskTagsTypeConverter.ConvertFrom); + } + if (content.Contains("TargetDiskTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).TargetDiskTag = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsTargetDiskTags) content.GetValueForProperty("TargetDiskTag",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal)this).TargetDiskTag, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtMigrationDetailsTargetDiskTagsTypeConverter.ConvertFrom); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationProviderSpecificSettingsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationProviderSpecificSettingsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + } + /// VMwareCbt provider specific settings. + [System.ComponentModel.TypeConverter(typeof(VMwareCbtMigrationDetailsTypeConverter))] + public partial interface IVMwareCbtMigrationDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtMigrationDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtMigrationDetails.TypeConverter.cs new file mode 100644 index 000000000000..8852949dafb4 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtMigrationDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VMwareCbtMigrationDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VMwareCbtMigrationDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VMwareCbtMigrationDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VMwareCbtMigrationDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtMigrationDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtMigrationDetails.cs new file mode 100644 index 000000000000..48354c284da6 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtMigrationDetails.cs @@ -0,0 +1,771 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// VMwareCbt provider specific settings. + public partial class VMwareCbtMigrationDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationProviderSpecificSettings __migrationProviderSpecificSettings = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.MigrationProviderSpecificSettings(); + + /// Backing field for property. + private string _dataMoverRunAsAccountId; + + /// The data mover run as account Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string DataMoverRunAsAccountId { get => this._dataMoverRunAsAccountId; } + + /// Backing field for property. + private string _firmwareType; + + /// The firmware type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string FirmwareType { get => this._firmwareType; } + + /// Backing field for property. + private int? _initialSeedingProgressPercentage; + + /// The initial seeding progress percentage. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? InitialSeedingProgressPercentage { get => this._initialSeedingProgressPercentage; } + + /// Backing field for property. + private long? _initialSeedingRetryCount; + + /// The initial seeding retry count. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public long? InitialSeedingRetryCount { get => this._initialSeedingRetryCount; } + + /// Gets the instance type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationProviderSpecificSettingsInternal)__migrationProviderSpecificSettings).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationProviderSpecificSettingsInternal)__migrationProviderSpecificSettings).InstanceType = value ; } + + /// Backing field for property. + private string _lastRecoveryPointId; + + /// The last recovery point Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string LastRecoveryPointId { get => this._lastRecoveryPointId; } + + /// Backing field for property. + private global::System.DateTime? _lastRecoveryPointReceived; + + /// The last recovery point received time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public global::System.DateTime? LastRecoveryPointReceived { get => this._lastRecoveryPointReceived; } + + /// Backing field for property. + private string _licenseType; + + /// License Type of the VM to be used. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string LicenseType { get => this._licenseType; set => this._licenseType = value; } + + /// Internal Acessors for DataMoverRunAsAccountId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal.DataMoverRunAsAccountId { get => this._dataMoverRunAsAccountId; set { {_dataMoverRunAsAccountId = value;} } } + + /// Internal Acessors for FirmwareType + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal.FirmwareType { get => this._firmwareType; set { {_firmwareType = value;} } } + + /// Internal Acessors for InitialSeedingProgressPercentage + int? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal.InitialSeedingProgressPercentage { get => this._initialSeedingProgressPercentage; set { {_initialSeedingProgressPercentage = value;} } } + + /// Internal Acessors for InitialSeedingRetryCount + long? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal.InitialSeedingRetryCount { get => this._initialSeedingRetryCount; set { {_initialSeedingRetryCount = value;} } } + + /// Internal Acessors for LastRecoveryPointId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal.LastRecoveryPointId { get => this._lastRecoveryPointId; set { {_lastRecoveryPointId = value;} } } + + /// Internal Acessors for LastRecoveryPointReceived + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal.LastRecoveryPointReceived { get => this._lastRecoveryPointReceived; set { {_lastRecoveryPointReceived = value;} } } + + /// Internal Acessors for MigrationProgressPercentage + int? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal.MigrationProgressPercentage { get => this._migrationProgressPercentage; set { {_migrationProgressPercentage = value;} } } + + /// Internal Acessors for MigrationRecoveryPointId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal.MigrationRecoveryPointId { get => this._migrationRecoveryPointId; set { {_migrationRecoveryPointId = value;} } } + + /// Internal Acessors for OSType + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal.OSType { get => this._oSType; set { {_oSType = value;} } } + + /// Internal Acessors for ResumeProgressPercentage + int? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal.ResumeProgressPercentage { get => this._resumeProgressPercentage; set { {_resumeProgressPercentage = value;} } } + + /// Internal Acessors for ResumeRetryCount + long? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal.ResumeRetryCount { get => this._resumeRetryCount; set { {_resumeRetryCount = value;} } } + + /// Internal Acessors for ResyncProgressPercentage + int? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal.ResyncProgressPercentage { get => this._resyncProgressPercentage; set { {_resyncProgressPercentage = value;} } } + + /// Internal Acessors for ResyncRequired + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal.ResyncRequired { get => this._resyncRequired; set { {_resyncRequired = value;} } } + + /// Internal Acessors for ResyncRetryCount + long? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal.ResyncRetryCount { get => this._resyncRetryCount; set { {_resyncRetryCount = value;} } } + + /// Internal Acessors for ResyncState + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ResyncState? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal.ResyncState { get => this._resyncState; set { {_resyncState = value;} } } + + /// Internal Acessors for SnapshotRunAsAccountId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal.SnapshotRunAsAccountId { get => this._snapshotRunAsAccountId; set { {_snapshotRunAsAccountId = value;} } } + + /// Internal Acessors for StorageAccountId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal.StorageAccountId { get => this._storageAccountId; set { {_storageAccountId = value;} } } + + /// Internal Acessors for TargetGeneration + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal.TargetGeneration { get => this._targetGeneration; set { {_targetGeneration = value;} } } + + /// Internal Acessors for TargetLocation + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal.TargetLocation { get => this._targetLocation; set { {_targetLocation = value;} } } + + /// Internal Acessors for VmwareMachineId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsInternal.VmwareMachineId { get => this._vmwareMachineId; set { {_vmwareMachineId = value;} } } + + /// Backing field for property. + private int? _migrationProgressPercentage; + + /// The migration progress percentage. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? MigrationProgressPercentage { get => this._migrationProgressPercentage; } + + /// Backing field for property. + private string _migrationRecoveryPointId; + + /// The recovery point Id to which the VM was migrated. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string MigrationRecoveryPointId { get => this._migrationRecoveryPointId; } + + /// Backing field for property. + private string _oSType; + + /// The type of the OS on the VM. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string OSType { get => this._oSType; } + + /// Backing field for property. + private string _performAutoResync; + + /// A value indicating whether auto resync is to be done. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string PerformAutoResync { get => this._performAutoResync; set => this._performAutoResync = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectedDiskDetails[] _protectedDisk; + + /// The list of protected disks. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectedDiskDetails[] ProtectedDisk { get => this._protectedDisk; set => this._protectedDisk = value; } + + /// Backing field for property. + private int? _resumeProgressPercentage; + + /// The resume progress percentage. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? ResumeProgressPercentage { get => this._resumeProgressPercentage; } + + /// Backing field for property. + private long? _resumeRetryCount; + + /// The resume retry count. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public long? ResumeRetryCount { get => this._resumeRetryCount; } + + /// Backing field for property. + private int? _resyncProgressPercentage; + + /// The resync progress percentage. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? ResyncProgressPercentage { get => this._resyncProgressPercentage; } + + /// Backing field for property. + private string _resyncRequired; + + /// A value indicating whether resync is required. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ResyncRequired { get => this._resyncRequired; } + + /// Backing field for property. + private long? _resyncRetryCount; + + /// The resync retry count. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public long? ResyncRetryCount { get => this._resyncRetryCount; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ResyncState? _resyncState; + + /// The resync state. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ResyncState? ResyncState { get => this._resyncState; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsSeedDiskTags _seedDiskTag; + + /// The tags for the seed disks. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsSeedDiskTags SeedDiskTag { get => (this._seedDiskTag = this._seedDiskTag ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtMigrationDetailsSeedDiskTags()); set => this._seedDiskTag = value; } + + /// Backing field for property. + private string _snapshotRunAsAccountId; + + /// The snapshot run as account Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string SnapshotRunAsAccountId { get => this._snapshotRunAsAccountId; } + + /// Backing field for property. + private string _sqlServerLicenseType; + + /// The SQL Server license type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string SqlServerLicenseType { get => this._sqlServerLicenseType; set => this._sqlServerLicenseType = value; } + + /// Backing field for property. + private string _storageAccountId; + + /// + /// The replication storage account ARM Id. This is applicable only for the blob based replication test hook. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string StorageAccountId { get => this._storageAccountId; } + + /// Backing field for property. + private string _targetAvailabilitySetId; + + /// The target availability set Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetAvailabilitySetId { get => this._targetAvailabilitySetId; set => this._targetAvailabilitySetId = value; } + + /// Backing field for property. + private string _targetAvailabilityZone; + + /// The target availability zone. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetAvailabilityZone { get => this._targetAvailabilityZone; set => this._targetAvailabilityZone = value; } + + /// + /// Backing field for property. + /// + private string _targetBootDiagnosticsStorageAccountId; + + /// The target boot diagnostics storage account ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetBootDiagnosticsStorageAccountId { get => this._targetBootDiagnosticsStorageAccountId; set => this._targetBootDiagnosticsStorageAccountId = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsTargetDiskTags _targetDiskTag; + + /// The tags for the target disks. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsTargetDiskTags TargetDiskTag { get => (this._targetDiskTag = this._targetDiskTag ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtMigrationDetailsTargetDiskTags()); set => this._targetDiskTag = value; } + + /// Backing field for property. + private string _targetGeneration; + + /// The target generation. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetGeneration { get => this._targetGeneration; } + + /// Backing field for property. + private string _targetLocation; + + /// The target location. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetLocation { get => this._targetLocation; } + + /// Backing field for property. + private string _targetNetworkId; + + /// The target network Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetNetworkId { get => this._targetNetworkId; set => this._targetNetworkId = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsTargetNicTags _targetNicTag; + + /// The tags for the target NICs. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsTargetNicTags TargetNicTag { get => (this._targetNicTag = this._targetNicTag ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtMigrationDetailsTargetNicTags()); set => this._targetNicTag = value; } + + /// Backing field for property. + private string _targetProximityPlacementGroupId; + + /// The target proximity placement group Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetProximityPlacementGroupId { get => this._targetProximityPlacementGroupId; set => this._targetProximityPlacementGroupId = value; } + + /// Backing field for property. + private string _targetResourceGroupId; + + /// The target resource group Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetResourceGroupId { get => this._targetResourceGroupId; set => this._targetResourceGroupId = value; } + + /// Backing field for property. + private string _targetVMName; + + /// Target VM name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetVMName { get => this._targetVMName; set => this._targetVMName = value; } + + /// Backing field for property. + private string _targetVMSize; + + /// The target VM size. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetVMSize { get => this._targetVMSize; set => this._targetVMSize = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsTargetVmtags _targetVMTag; + + /// The target VM tags. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsTargetVmtags TargetVMTag { get => (this._targetVMTag = this._targetVMTag ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtMigrationDetailsTargetVmtags()); set => this._targetVMTag = value; } + + /// Backing field for property. + private string _testNetworkId; + + /// The test network Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TestNetworkId { get => this._testNetworkId; set => this._testNetworkId = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicDetails[] _vMNic; + + /// The network details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicDetails[] VMNic { get => this._vMNic; set => this._vMNic = value; } + + /// Backing field for property. + private string _vmwareMachineId; + + /// The ARM Id of the VM discovered in VMware. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string VmwareMachineId { get => this._vmwareMachineId; } + + /// Creates an new instance. + public VMwareCbtMigrationDetails() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__migrationProviderSpecificSettings), __migrationProviderSpecificSettings); + await eventListener.AssertObjectIsValid(nameof(__migrationProviderSpecificSettings), __migrationProviderSpecificSettings); + } + } + /// VMwareCbt provider specific settings. + public partial interface IVMwareCbtMigrationDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationProviderSpecificSettings + { + /// The data mover run as account Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The data mover run as account Id.", + SerializedName = @"dataMoverRunAsAccountId", + PossibleTypes = new [] { typeof(string) })] + string DataMoverRunAsAccountId { get; } + /// The firmware type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The firmware type.", + SerializedName = @"firmwareType", + PossibleTypes = new [] { typeof(string) })] + string FirmwareType { get; } + /// The initial seeding progress percentage. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The initial seeding progress percentage.", + SerializedName = @"initialSeedingProgressPercentage", + PossibleTypes = new [] { typeof(int) })] + int? InitialSeedingProgressPercentage { get; } + /// The initial seeding retry count. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The initial seeding retry count.", + SerializedName = @"initialSeedingRetryCount", + PossibleTypes = new [] { typeof(long) })] + long? InitialSeedingRetryCount { get; } + /// The last recovery point Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The last recovery point Id.", + SerializedName = @"lastRecoveryPointId", + PossibleTypes = new [] { typeof(string) })] + string LastRecoveryPointId { get; } + /// The last recovery point received time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The last recovery point received time.", + SerializedName = @"lastRecoveryPointReceived", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? LastRecoveryPointReceived { get; } + /// License Type of the VM to be used. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"License Type of the VM to be used.", + SerializedName = @"licenseType", + PossibleTypes = new [] { typeof(string) })] + string LicenseType { get; set; } + /// The migration progress percentage. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The migration progress percentage.", + SerializedName = @"migrationProgressPercentage", + PossibleTypes = new [] { typeof(int) })] + int? MigrationProgressPercentage { get; } + /// The recovery point Id to which the VM was migrated. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The recovery point Id to which the VM was migrated.", + SerializedName = @"migrationRecoveryPointId", + PossibleTypes = new [] { typeof(string) })] + string MigrationRecoveryPointId { get; } + /// The type of the OS on the VM. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The type of the OS on the VM.", + SerializedName = @"osType", + PossibleTypes = new [] { typeof(string) })] + string OSType { get; } + /// A value indicating whether auto resync is to be done. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether auto resync is to be done.", + SerializedName = @"performAutoResync", + PossibleTypes = new [] { typeof(string) })] + string PerformAutoResync { get; set; } + /// The list of protected disks. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of protected disks.", + SerializedName = @"protectedDisks", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectedDiskDetails) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectedDiskDetails[] ProtectedDisk { get; set; } + /// The resume progress percentage. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The resume progress percentage.", + SerializedName = @"resumeProgressPercentage", + PossibleTypes = new [] { typeof(int) })] + int? ResumeProgressPercentage { get; } + /// The resume retry count. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The resume retry count.", + SerializedName = @"resumeRetryCount", + PossibleTypes = new [] { typeof(long) })] + long? ResumeRetryCount { get; } + /// The resync progress percentage. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The resync progress percentage.", + SerializedName = @"resyncProgressPercentage", + PossibleTypes = new [] { typeof(int) })] + int? ResyncProgressPercentage { get; } + /// A value indicating whether resync is required. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"A value indicating whether resync is required.", + SerializedName = @"resyncRequired", + PossibleTypes = new [] { typeof(string) })] + string ResyncRequired { get; } + /// The resync retry count. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The resync retry count.", + SerializedName = @"resyncRetryCount", + PossibleTypes = new [] { typeof(long) })] + long? ResyncRetryCount { get; } + /// The resync state. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The resync state.", + SerializedName = @"resyncState", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ResyncState) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ResyncState? ResyncState { get; } + /// The tags for the seed disks. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The tags for the seed disks.", + SerializedName = @"seedDiskTags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsSeedDiskTags) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsSeedDiskTags SeedDiskTag { get; set; } + /// The snapshot run as account Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The snapshot run as account Id.", + SerializedName = @"snapshotRunAsAccountId", + PossibleTypes = new [] { typeof(string) })] + string SnapshotRunAsAccountId { get; } + /// The SQL Server license type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The SQL Server license type.", + SerializedName = @"sqlServerLicenseType", + PossibleTypes = new [] { typeof(string) })] + string SqlServerLicenseType { get; set; } + /// + /// The replication storage account ARM Id. This is applicable only for the blob based replication test hook. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The replication storage account ARM Id. This is applicable only for the blob based replication test hook.", + SerializedName = @"storageAccountId", + PossibleTypes = new [] { typeof(string) })] + string StorageAccountId { get; } + /// The target availability set Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target availability set Id.", + SerializedName = @"targetAvailabilitySetId", + PossibleTypes = new [] { typeof(string) })] + string TargetAvailabilitySetId { get; set; } + /// The target availability zone. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target availability zone.", + SerializedName = @"targetAvailabilityZone", + PossibleTypes = new [] { typeof(string) })] + string TargetAvailabilityZone { get; set; } + /// The target boot diagnostics storage account ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target boot diagnostics storage account ARM Id.", + SerializedName = @"targetBootDiagnosticsStorageAccountId", + PossibleTypes = new [] { typeof(string) })] + string TargetBootDiagnosticsStorageAccountId { get; set; } + /// The tags for the target disks. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The tags for the target disks.", + SerializedName = @"targetDiskTags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsTargetDiskTags) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsTargetDiskTags TargetDiskTag { get; set; } + /// The target generation. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The target generation.", + SerializedName = @"targetGeneration", + PossibleTypes = new [] { typeof(string) })] + string TargetGeneration { get; } + /// The target location. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The target location.", + SerializedName = @"targetLocation", + PossibleTypes = new [] { typeof(string) })] + string TargetLocation { get; } + /// The target network Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target network Id.", + SerializedName = @"targetNetworkId", + PossibleTypes = new [] { typeof(string) })] + string TargetNetworkId { get; set; } + /// The tags for the target NICs. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The tags for the target NICs.", + SerializedName = @"targetNicTags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsTargetNicTags) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsTargetNicTags TargetNicTag { get; set; } + /// The target proximity placement group Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target proximity placement group Id.", + SerializedName = @"targetProximityPlacementGroupId", + PossibleTypes = new [] { typeof(string) })] + string TargetProximityPlacementGroupId { get; set; } + /// The target resource group Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target resource group Id.", + SerializedName = @"targetResourceGroupId", + PossibleTypes = new [] { typeof(string) })] + string TargetResourceGroupId { get; set; } + /// Target VM name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Target VM name.", + SerializedName = @"targetVmName", + PossibleTypes = new [] { typeof(string) })] + string TargetVMName { get; set; } + /// The target VM size. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target VM size.", + SerializedName = @"targetVmSize", + PossibleTypes = new [] { typeof(string) })] + string TargetVMSize { get; set; } + /// The target VM tags. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target VM tags.", + SerializedName = @"targetVmTags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsTargetVmtags) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsTargetVmtags TargetVMTag { get; set; } + /// The test network Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The test network Id.", + SerializedName = @"testNetworkId", + PossibleTypes = new [] { typeof(string) })] + string TestNetworkId { get; set; } + /// The network details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The network details.", + SerializedName = @"vmNics", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicDetails) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicDetails[] VMNic { get; set; } + /// The ARM Id of the VM discovered in VMware. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The ARM Id of the VM discovered in VMware.", + SerializedName = @"vmwareMachineId", + PossibleTypes = new [] { typeof(string) })] + string VmwareMachineId { get; } + + } + /// VMwareCbt provider specific settings. + internal partial interface IVMwareCbtMigrationDetailsInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationProviderSpecificSettingsInternal + { + /// The data mover run as account Id. + string DataMoverRunAsAccountId { get; set; } + /// The firmware type. + string FirmwareType { get; set; } + /// The initial seeding progress percentage. + int? InitialSeedingProgressPercentage { get; set; } + /// The initial seeding retry count. + long? InitialSeedingRetryCount { get; set; } + /// The last recovery point Id. + string LastRecoveryPointId { get; set; } + /// The last recovery point received time. + global::System.DateTime? LastRecoveryPointReceived { get; set; } + /// License Type of the VM to be used. + string LicenseType { get; set; } + /// The migration progress percentage. + int? MigrationProgressPercentage { get; set; } + /// The recovery point Id to which the VM was migrated. + string MigrationRecoveryPointId { get; set; } + /// The type of the OS on the VM. + string OSType { get; set; } + /// A value indicating whether auto resync is to be done. + string PerformAutoResync { get; set; } + /// The list of protected disks. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectedDiskDetails[] ProtectedDisk { get; set; } + /// The resume progress percentage. + int? ResumeProgressPercentage { get; set; } + /// The resume retry count. + long? ResumeRetryCount { get; set; } + /// The resync progress percentage. + int? ResyncProgressPercentage { get; set; } + /// A value indicating whether resync is required. + string ResyncRequired { get; set; } + /// The resync retry count. + long? ResyncRetryCount { get; set; } + /// The resync state. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ResyncState? ResyncState { get; set; } + /// The tags for the seed disks. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsSeedDiskTags SeedDiskTag { get; set; } + /// The snapshot run as account Id. + string SnapshotRunAsAccountId { get; set; } + /// The SQL Server license type. + string SqlServerLicenseType { get; set; } + /// + /// The replication storage account ARM Id. This is applicable only for the blob based replication test hook. + /// + string StorageAccountId { get; set; } + /// The target availability set Id. + string TargetAvailabilitySetId { get; set; } + /// The target availability zone. + string TargetAvailabilityZone { get; set; } + /// The target boot diagnostics storage account ARM Id. + string TargetBootDiagnosticsStorageAccountId { get; set; } + /// The tags for the target disks. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsTargetDiskTags TargetDiskTag { get; set; } + /// The target generation. + string TargetGeneration { get; set; } + /// The target location. + string TargetLocation { get; set; } + /// The target network Id. + string TargetNetworkId { get; set; } + /// The tags for the target NICs. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsTargetNicTags TargetNicTag { get; set; } + /// The target proximity placement group Id. + string TargetProximityPlacementGroupId { get; set; } + /// The target resource group Id. + string TargetResourceGroupId { get; set; } + /// Target VM name. + string TargetVMName { get; set; } + /// The target VM size. + string TargetVMSize { get; set; } + /// The target VM tags. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsTargetVmtags TargetVMTag { get; set; } + /// The test network Id. + string TestNetworkId { get; set; } + /// The network details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicDetails[] VMNic { get; set; } + /// The ARM Id of the VM discovered in VMware. + string VmwareMachineId { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtMigrationDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtMigrationDetails.json.cs new file mode 100644 index 000000000000..06838db92384 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtMigrationDetails.json.cs @@ -0,0 +1,260 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// VMwareCbt provider specific settings. + public partial class VMwareCbtMigrationDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new VMwareCbtMigrationDetails(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __migrationProviderSpecificSettings?.ToJson(container, serializationMode); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._vmwareMachineId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._vmwareMachineId.ToString()) : null, "vmwareMachineId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._oSType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._oSType.ToString()) : null, "osType" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._firmwareType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._firmwareType.ToString()) : null, "firmwareType" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._targetGeneration)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetGeneration.ToString()) : null, "targetGeneration" ,container.Add ); + } + AddIf( null != (((object)this._licenseType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._licenseType.ToString()) : null, "licenseType" ,container.Add ); + AddIf( null != (((object)this._sqlServerLicenseType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._sqlServerLicenseType.ToString()) : null, "sqlServerLicenseType" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._dataMoverRunAsAccountId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._dataMoverRunAsAccountId.ToString()) : null, "dataMoverRunAsAccountId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._snapshotRunAsAccountId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._snapshotRunAsAccountId.ToString()) : null, "snapshotRunAsAccountId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._storageAccountId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._storageAccountId.ToString()) : null, "storageAccountId" ,container.Add ); + } + AddIf( null != (((object)this._targetVMName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetVMName.ToString()) : null, "targetVmName" ,container.Add ); + AddIf( null != (((object)this._targetVMSize)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetVMSize.ToString()) : null, "targetVmSize" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._targetLocation)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetLocation.ToString()) : null, "targetLocation" ,container.Add ); + } + AddIf( null != (((object)this._targetResourceGroupId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetResourceGroupId.ToString()) : null, "targetResourceGroupId" ,container.Add ); + AddIf( null != (((object)this._targetAvailabilitySetId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetAvailabilitySetId.ToString()) : null, "targetAvailabilitySetId" ,container.Add ); + AddIf( null != (((object)this._targetAvailabilityZone)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetAvailabilityZone.ToString()) : null, "targetAvailabilityZone" ,container.Add ); + AddIf( null != (((object)this._targetProximityPlacementGroupId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetProximityPlacementGroupId.ToString()) : null, "targetProximityPlacementGroupId" ,container.Add ); + AddIf( null != (((object)this._targetBootDiagnosticsStorageAccountId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetBootDiagnosticsStorageAccountId.ToString()) : null, "targetBootDiagnosticsStorageAccountId" ,container.Add ); + AddIf( null != this._targetVMTag ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._targetVMTag.ToJson(null,serializationMode) : null, "targetVmTags" ,container.Add ); + if (null != this._protectedDisk) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._protectedDisk ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("protectedDisks",__w); + } + AddIf( null != (((object)this._targetNetworkId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetNetworkId.ToString()) : null, "targetNetworkId" ,container.Add ); + AddIf( null != (((object)this._testNetworkId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._testNetworkId.ToString()) : null, "testNetworkId" ,container.Add ); + if (null != this._vMNic) + { + var __r = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __s in this._vMNic ) + { + AddIf(__s?.ToJson(null, serializationMode) ,__r.Add); + } + container.Add("vmNics",__r); + } + AddIf( null != this._targetNicTag ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._targetNicTag.ToJson(null,serializationMode) : null, "targetNicTags" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._migrationRecoveryPointId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._migrationRecoveryPointId.ToString()) : null, "migrationRecoveryPointId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._lastRecoveryPointReceived ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._lastRecoveryPointReceived?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "lastRecoveryPointReceived" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._lastRecoveryPointId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._lastRecoveryPointId.ToString()) : null, "lastRecoveryPointId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._initialSeedingProgressPercentage ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._initialSeedingProgressPercentage) : null, "initialSeedingProgressPercentage" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._migrationProgressPercentage ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._migrationProgressPercentage) : null, "migrationProgressPercentage" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._resyncProgressPercentage ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._resyncProgressPercentage) : null, "resyncProgressPercentage" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._resumeProgressPercentage ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._resumeProgressPercentage) : null, "resumeProgressPercentage" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._initialSeedingRetryCount ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((long)this._initialSeedingRetryCount) : null, "initialSeedingRetryCount" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._resyncRetryCount ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((long)this._resyncRetryCount) : null, "resyncRetryCount" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._resumeRetryCount ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((long)this._resumeRetryCount) : null, "resumeRetryCount" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._resyncRequired)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._resyncRequired.ToString()) : null, "resyncRequired" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._resyncState)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._resyncState.ToString()) : null, "resyncState" ,container.Add ); + } + AddIf( null != (((object)this._performAutoResync)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._performAutoResync.ToString()) : null, "performAutoResync" ,container.Add ); + AddIf( null != this._seedDiskTag ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._seedDiskTag.ToJson(null,serializationMode) : null, "seedDiskTags" ,container.Add ); + AddIf( null != this._targetDiskTag ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._targetDiskTag.ToJson(null,serializationMode) : null, "targetDiskTags" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal VMwareCbtMigrationDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __migrationProviderSpecificSettings = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.MigrationProviderSpecificSettings(json); + {_vmwareMachineId = If( json?.PropertyT("vmwareMachineId"), out var __jsonVmwareMachineId) ? (string)__jsonVmwareMachineId : (string)VmwareMachineId;} + {_oSType = If( json?.PropertyT("osType"), out var __jsonOSType) ? (string)__jsonOSType : (string)OSType;} + {_firmwareType = If( json?.PropertyT("firmwareType"), out var __jsonFirmwareType) ? (string)__jsonFirmwareType : (string)FirmwareType;} + {_targetGeneration = If( json?.PropertyT("targetGeneration"), out var __jsonTargetGeneration) ? (string)__jsonTargetGeneration : (string)TargetGeneration;} + {_licenseType = If( json?.PropertyT("licenseType"), out var __jsonLicenseType) ? (string)__jsonLicenseType : (string)LicenseType;} + {_sqlServerLicenseType = If( json?.PropertyT("sqlServerLicenseType"), out var __jsonSqlServerLicenseType) ? (string)__jsonSqlServerLicenseType : (string)SqlServerLicenseType;} + {_dataMoverRunAsAccountId = If( json?.PropertyT("dataMoverRunAsAccountId"), out var __jsonDataMoverRunAsAccountId) ? (string)__jsonDataMoverRunAsAccountId : (string)DataMoverRunAsAccountId;} + {_snapshotRunAsAccountId = If( json?.PropertyT("snapshotRunAsAccountId"), out var __jsonSnapshotRunAsAccountId) ? (string)__jsonSnapshotRunAsAccountId : (string)SnapshotRunAsAccountId;} + {_storageAccountId = If( json?.PropertyT("storageAccountId"), out var __jsonStorageAccountId) ? (string)__jsonStorageAccountId : (string)StorageAccountId;} + {_targetVMName = If( json?.PropertyT("targetVmName"), out var __jsonTargetVMName) ? (string)__jsonTargetVMName : (string)TargetVMName;} + {_targetVMSize = If( json?.PropertyT("targetVmSize"), out var __jsonTargetVMSize) ? (string)__jsonTargetVMSize : (string)TargetVMSize;} + {_targetLocation = If( json?.PropertyT("targetLocation"), out var __jsonTargetLocation) ? (string)__jsonTargetLocation : (string)TargetLocation;} + {_targetResourceGroupId = If( json?.PropertyT("targetResourceGroupId"), out var __jsonTargetResourceGroupId) ? (string)__jsonTargetResourceGroupId : (string)TargetResourceGroupId;} + {_targetAvailabilitySetId = If( json?.PropertyT("targetAvailabilitySetId"), out var __jsonTargetAvailabilitySetId) ? (string)__jsonTargetAvailabilitySetId : (string)TargetAvailabilitySetId;} + {_targetAvailabilityZone = If( json?.PropertyT("targetAvailabilityZone"), out var __jsonTargetAvailabilityZone) ? (string)__jsonTargetAvailabilityZone : (string)TargetAvailabilityZone;} + {_targetProximityPlacementGroupId = If( json?.PropertyT("targetProximityPlacementGroupId"), out var __jsonTargetProximityPlacementGroupId) ? (string)__jsonTargetProximityPlacementGroupId : (string)TargetProximityPlacementGroupId;} + {_targetBootDiagnosticsStorageAccountId = If( json?.PropertyT("targetBootDiagnosticsStorageAccountId"), out var __jsonTargetBootDiagnosticsStorageAccountId) ? (string)__jsonTargetBootDiagnosticsStorageAccountId : (string)TargetBootDiagnosticsStorageAccountId;} + {_targetVMTag = If( json?.PropertyT("targetVmTags"), out var __jsonTargetVMTags) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtMigrationDetailsTargetVmtags.FromJson(__jsonTargetVMTags) : TargetVMTag;} + {_protectedDisk = If( json?.PropertyT("protectedDisks"), out var __jsonProtectedDisks) ? If( __jsonProtectedDisks as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectedDiskDetails) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtProtectedDiskDetails.FromJson(__u) )) ))() : null : ProtectedDisk;} + {_targetNetworkId = If( json?.PropertyT("targetNetworkId"), out var __jsonTargetNetworkId) ? (string)__jsonTargetNetworkId : (string)TargetNetworkId;} + {_testNetworkId = If( json?.PropertyT("testNetworkId"), out var __jsonTestNetworkId) ? (string)__jsonTestNetworkId : (string)TestNetworkId;} + {_vMNic = If( json?.PropertyT("vmNics"), out var __jsonVMNics) ? If( __jsonVMNics as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __q) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__q, (__p)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicDetails) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtNicDetails.FromJson(__p) )) ))() : null : VMNic;} + {_targetNicTag = If( json?.PropertyT("targetNicTags"), out var __jsonTargetNicTags) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtMigrationDetailsTargetNicTags.FromJson(__jsonTargetNicTags) : TargetNicTag;} + {_migrationRecoveryPointId = If( json?.PropertyT("migrationRecoveryPointId"), out var __jsonMigrationRecoveryPointId) ? (string)__jsonMigrationRecoveryPointId : (string)MigrationRecoveryPointId;} + {_lastRecoveryPointReceived = If( json?.PropertyT("lastRecoveryPointReceived"), out var __jsonLastRecoveryPointReceived) ? global::System.DateTime.TryParse((string)__jsonLastRecoveryPointReceived, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonLastRecoveryPointReceivedValue) ? __jsonLastRecoveryPointReceivedValue : LastRecoveryPointReceived : LastRecoveryPointReceived;} + {_lastRecoveryPointId = If( json?.PropertyT("lastRecoveryPointId"), out var __jsonLastRecoveryPointId) ? (string)__jsonLastRecoveryPointId : (string)LastRecoveryPointId;} + {_initialSeedingProgressPercentage = If( json?.PropertyT("initialSeedingProgressPercentage"), out var __jsonInitialSeedingProgressPercentage) ? (int?)__jsonInitialSeedingProgressPercentage : InitialSeedingProgressPercentage;} + {_migrationProgressPercentage = If( json?.PropertyT("migrationProgressPercentage"), out var __jsonMigrationProgressPercentage) ? (int?)__jsonMigrationProgressPercentage : MigrationProgressPercentage;} + {_resyncProgressPercentage = If( json?.PropertyT("resyncProgressPercentage"), out var __jsonResyncProgressPercentage) ? (int?)__jsonResyncProgressPercentage : ResyncProgressPercentage;} + {_resumeProgressPercentage = If( json?.PropertyT("resumeProgressPercentage"), out var __jsonResumeProgressPercentage) ? (int?)__jsonResumeProgressPercentage : ResumeProgressPercentage;} + {_initialSeedingRetryCount = If( json?.PropertyT("initialSeedingRetryCount"), out var __jsonInitialSeedingRetryCount) ? (long?)__jsonInitialSeedingRetryCount : InitialSeedingRetryCount;} + {_resyncRetryCount = If( json?.PropertyT("resyncRetryCount"), out var __jsonResyncRetryCount) ? (long?)__jsonResyncRetryCount : ResyncRetryCount;} + {_resumeRetryCount = If( json?.PropertyT("resumeRetryCount"), out var __jsonResumeRetryCount) ? (long?)__jsonResumeRetryCount : ResumeRetryCount;} + {_resyncRequired = If( json?.PropertyT("resyncRequired"), out var __jsonResyncRequired) ? (string)__jsonResyncRequired : (string)ResyncRequired;} + {_resyncState = If( json?.PropertyT("resyncState"), out var __jsonResyncState) ? (string)__jsonResyncState : (string)ResyncState;} + {_performAutoResync = If( json?.PropertyT("performAutoResync"), out var __jsonPerformAutoResync) ? (string)__jsonPerformAutoResync : (string)PerformAutoResync;} + {_seedDiskTag = If( json?.PropertyT("seedDiskTags"), out var __jsonSeedDiskTags) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtMigrationDetailsSeedDiskTags.FromJson(__jsonSeedDiskTags) : SeedDiskTag;} + {_targetDiskTag = If( json?.PropertyT("targetDiskTags"), out var __jsonTargetDiskTags) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtMigrationDetailsTargetDiskTags.FromJson(__jsonTargetDiskTags) : TargetDiskTag;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtMigrationDetailsSeedDiskTags.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtMigrationDetailsSeedDiskTags.PowerShell.cs new file mode 100644 index 000000000000..0871c76c8fdc --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtMigrationDetailsSeedDiskTags.PowerShell.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// The tags for the seed disks. + [System.ComponentModel.TypeConverter(typeof(VMwareCbtMigrationDetailsSeedDiskTagsTypeConverter))] + public partial class VMwareCbtMigrationDetailsSeedDiskTags + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsSeedDiskTags DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VMwareCbtMigrationDetailsSeedDiskTags(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsSeedDiskTags DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VMwareCbtMigrationDetailsSeedDiskTags(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json + /// string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsSeedDiskTags FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VMwareCbtMigrationDetailsSeedDiskTags(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal VMwareCbtMigrationDetailsSeedDiskTags(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializePSObject(content); + } + } + /// The tags for the seed disks. + [System.ComponentModel.TypeConverter(typeof(VMwareCbtMigrationDetailsSeedDiskTagsTypeConverter))] + public partial interface IVMwareCbtMigrationDetailsSeedDiskTags + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtMigrationDetailsSeedDiskTags.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtMigrationDetailsSeedDiskTags.TypeConverter.cs new file mode 100644 index 000000000000..de6750be9513 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtMigrationDetailsSeedDiskTags.TypeConverter.cs @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VMwareCbtMigrationDetailsSeedDiskTagsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsSeedDiskTags ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsSeedDiskTags).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VMwareCbtMigrationDetailsSeedDiskTags.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VMwareCbtMigrationDetailsSeedDiskTags.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VMwareCbtMigrationDetailsSeedDiskTags.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtMigrationDetailsSeedDiskTags.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtMigrationDetailsSeedDiskTags.cs new file mode 100644 index 000000000000..2a997f21f87e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtMigrationDetailsSeedDiskTags.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The tags for the seed disks. + public partial class VMwareCbtMigrationDetailsSeedDiskTags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsSeedDiskTags, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsSeedDiskTagsInternal + { + + /// Creates an new instance. + public VMwareCbtMigrationDetailsSeedDiskTags() + { + + } + } + /// The tags for the seed disks. + public partial interface IVMwareCbtMigrationDetailsSeedDiskTags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray + { + + } + /// The tags for the seed disks. + internal partial interface IVMwareCbtMigrationDetailsSeedDiskTagsInternal + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtMigrationDetailsSeedDiskTags.dictionary.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtMigrationDetailsSeedDiskTags.dictionary.cs new file mode 100644 index 000000000000..6a64bb63c342 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtMigrationDetailsSeedDiskTags.dictionary.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + public partial class VMwareCbtMigrationDetailsSeedDiskTags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray + { + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + + int Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Values { get => __additionalProperties.Values; } + + public string this[global::System.String index] { get => __additionalProperties[index]; set => __additionalProperties[index] = value; } + + /// + /// + public void Add(global::System.String key, string value) => __additionalProperties.Add( key, value); + + public void Clear() => __additionalProperties.Clear(); + + /// + public bool ContainsKey(global::System.String key) => __additionalProperties.ContainsKey( key); + + /// + public void CopyFrom(global::System.Collections.IDictionary source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public void CopyFrom(global::System.Management.Automation.PSObject source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public bool Remove(global::System.String key) => __additionalProperties.Remove( key); + + /// + /// + public bool TryGetValue(global::System.String key, out string value) => __additionalProperties.TryGetValue( key, out value); + + /// + + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtMigrationDetailsSeedDiskTags source) => source.__additionalProperties; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtMigrationDetailsSeedDiskTags.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtMigrationDetailsSeedDiskTags.json.cs new file mode 100644 index 000000000000..b4eb50b9a32f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtMigrationDetailsSeedDiskTags.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The tags for the seed disks. + public partial class VMwareCbtMigrationDetailsSeedDiskTags + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsSeedDiskTags. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsSeedDiskTags. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsSeedDiskTags FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new VMwareCbtMigrationDetailsSeedDiskTags(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray)this).AdditionalProperties, container); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + /// + internal VMwareCbtMigrationDetailsSeedDiskTags(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, global::System.Collections.Generic.HashSet exclusions = null) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray)this).AdditionalProperties, null ,exclusions ); + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtMigrationDetailsTargetDiskTags.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtMigrationDetailsTargetDiskTags.PowerShell.cs new file mode 100644 index 000000000000..5866e18f9bdd --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtMigrationDetailsTargetDiskTags.PowerShell.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// The tags for the target disks. + [System.ComponentModel.TypeConverter(typeof(VMwareCbtMigrationDetailsTargetDiskTagsTypeConverter))] + public partial class VMwareCbtMigrationDetailsTargetDiskTags + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsTargetDiskTags DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VMwareCbtMigrationDetailsTargetDiskTags(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsTargetDiskTags DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VMwareCbtMigrationDetailsTargetDiskTags(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json + /// string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsTargetDiskTags FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VMwareCbtMigrationDetailsTargetDiskTags(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal VMwareCbtMigrationDetailsTargetDiskTags(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializePSObject(content); + } + } + /// The tags for the target disks. + [System.ComponentModel.TypeConverter(typeof(VMwareCbtMigrationDetailsTargetDiskTagsTypeConverter))] + public partial interface IVMwareCbtMigrationDetailsTargetDiskTags + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtMigrationDetailsTargetDiskTags.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtMigrationDetailsTargetDiskTags.TypeConverter.cs new file mode 100644 index 000000000000..7f0b9a5b8f45 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtMigrationDetailsTargetDiskTags.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VMwareCbtMigrationDetailsTargetDiskTagsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsTargetDiskTags ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsTargetDiskTags).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VMwareCbtMigrationDetailsTargetDiskTags.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VMwareCbtMigrationDetailsTargetDiskTags.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VMwareCbtMigrationDetailsTargetDiskTags.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtMigrationDetailsTargetDiskTags.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtMigrationDetailsTargetDiskTags.cs new file mode 100644 index 000000000000..14196aee9654 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtMigrationDetailsTargetDiskTags.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The tags for the target disks. + public partial class VMwareCbtMigrationDetailsTargetDiskTags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsTargetDiskTags, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsTargetDiskTagsInternal + { + + /// Creates an new instance. + public VMwareCbtMigrationDetailsTargetDiskTags() + { + + } + } + /// The tags for the target disks. + public partial interface IVMwareCbtMigrationDetailsTargetDiskTags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray + { + + } + /// The tags for the target disks. + internal partial interface IVMwareCbtMigrationDetailsTargetDiskTagsInternal + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtMigrationDetailsTargetDiskTags.dictionary.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtMigrationDetailsTargetDiskTags.dictionary.cs new file mode 100644 index 000000000000..d92feb396c21 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtMigrationDetailsTargetDiskTags.dictionary.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + public partial class VMwareCbtMigrationDetailsTargetDiskTags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray + { + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + + int Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Values { get => __additionalProperties.Values; } + + public string this[global::System.String index] { get => __additionalProperties[index]; set => __additionalProperties[index] = value; } + + /// + /// + public void Add(global::System.String key, string value) => __additionalProperties.Add( key, value); + + public void Clear() => __additionalProperties.Clear(); + + /// + public bool ContainsKey(global::System.String key) => __additionalProperties.ContainsKey( key); + + /// + public void CopyFrom(global::System.Collections.IDictionary source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public void CopyFrom(global::System.Management.Automation.PSObject source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public bool Remove(global::System.String key) => __additionalProperties.Remove( key); + + /// + /// + public bool TryGetValue(global::System.String key, out string value) => __additionalProperties.TryGetValue( key, out value); + + /// + + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtMigrationDetailsTargetDiskTags source) => source.__additionalProperties; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtMigrationDetailsTargetDiskTags.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtMigrationDetailsTargetDiskTags.json.cs new file mode 100644 index 000000000000..39fb603929e6 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtMigrationDetailsTargetDiskTags.json.cs @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The tags for the target disks. + public partial class VMwareCbtMigrationDetailsTargetDiskTags + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsTargetDiskTags. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsTargetDiskTags. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsTargetDiskTags FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new VMwareCbtMigrationDetailsTargetDiskTags(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray)this).AdditionalProperties, container); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + /// + internal VMwareCbtMigrationDetailsTargetDiskTags(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, global::System.Collections.Generic.HashSet exclusions = null) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray)this).AdditionalProperties, null ,exclusions ); + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtMigrationDetailsTargetNicTags.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtMigrationDetailsTargetNicTags.PowerShell.cs new file mode 100644 index 000000000000..5631c2da4fb5 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtMigrationDetailsTargetNicTags.PowerShell.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// The tags for the target NICs. + [System.ComponentModel.TypeConverter(typeof(VMwareCbtMigrationDetailsTargetNicTagsTypeConverter))] + public partial class VMwareCbtMigrationDetailsTargetNicTags + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsTargetNicTags DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VMwareCbtMigrationDetailsTargetNicTags(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsTargetNicTags DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VMwareCbtMigrationDetailsTargetNicTags(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json + /// string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsTargetNicTags FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VMwareCbtMigrationDetailsTargetNicTags(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal VMwareCbtMigrationDetailsTargetNicTags(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializePSObject(content); + } + } + /// The tags for the target NICs. + [System.ComponentModel.TypeConverter(typeof(VMwareCbtMigrationDetailsTargetNicTagsTypeConverter))] + public partial interface IVMwareCbtMigrationDetailsTargetNicTags + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtMigrationDetailsTargetNicTags.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtMigrationDetailsTargetNicTags.TypeConverter.cs new file mode 100644 index 000000000000..d1a11b3ccc6f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtMigrationDetailsTargetNicTags.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VMwareCbtMigrationDetailsTargetNicTagsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsTargetNicTags ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsTargetNicTags).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VMwareCbtMigrationDetailsTargetNicTags.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VMwareCbtMigrationDetailsTargetNicTags.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VMwareCbtMigrationDetailsTargetNicTags.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtMigrationDetailsTargetNicTags.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtMigrationDetailsTargetNicTags.cs new file mode 100644 index 000000000000..4c4beabe5522 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtMigrationDetailsTargetNicTags.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The tags for the target NICs. + public partial class VMwareCbtMigrationDetailsTargetNicTags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsTargetNicTags, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsTargetNicTagsInternal + { + + /// Creates an new instance. + public VMwareCbtMigrationDetailsTargetNicTags() + { + + } + } + /// The tags for the target NICs. + public partial interface IVMwareCbtMigrationDetailsTargetNicTags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray + { + + } + /// The tags for the target NICs. + internal partial interface IVMwareCbtMigrationDetailsTargetNicTagsInternal + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtMigrationDetailsTargetNicTags.dictionary.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtMigrationDetailsTargetNicTags.dictionary.cs new file mode 100644 index 000000000000..76d618c4debe --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtMigrationDetailsTargetNicTags.dictionary.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + public partial class VMwareCbtMigrationDetailsTargetNicTags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray + { + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + + int Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Values { get => __additionalProperties.Values; } + + public string this[global::System.String index] { get => __additionalProperties[index]; set => __additionalProperties[index] = value; } + + /// + /// + public void Add(global::System.String key, string value) => __additionalProperties.Add( key, value); + + public void Clear() => __additionalProperties.Clear(); + + /// + public bool ContainsKey(global::System.String key) => __additionalProperties.ContainsKey( key); + + /// + public void CopyFrom(global::System.Collections.IDictionary source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public void CopyFrom(global::System.Management.Automation.PSObject source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public bool Remove(global::System.String key) => __additionalProperties.Remove( key); + + /// + /// + public bool TryGetValue(global::System.String key, out string value) => __additionalProperties.TryGetValue( key, out value); + + /// + + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtMigrationDetailsTargetNicTags source) => source.__additionalProperties; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtMigrationDetailsTargetNicTags.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtMigrationDetailsTargetNicTags.json.cs new file mode 100644 index 000000000000..05c9e5636ea0 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtMigrationDetailsTargetNicTags.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The tags for the target NICs. + public partial class VMwareCbtMigrationDetailsTargetNicTags + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsTargetNicTags. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsTargetNicTags. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsTargetNicTags FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new VMwareCbtMigrationDetailsTargetNicTags(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray)this).AdditionalProperties, container); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + /// + internal VMwareCbtMigrationDetailsTargetNicTags(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, global::System.Collections.Generic.HashSet exclusions = null) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray)this).AdditionalProperties, null ,exclusions ); + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtMigrationDetailsTargetVmtags.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtMigrationDetailsTargetVmtags.PowerShell.cs new file mode 100644 index 000000000000..166d326c8b29 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtMigrationDetailsTargetVmtags.PowerShell.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// The target VM tags. + [System.ComponentModel.TypeConverter(typeof(VMwareCbtMigrationDetailsTargetVmtagsTypeConverter))] + public partial class VMwareCbtMigrationDetailsTargetVmtags + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsTargetVmtags DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VMwareCbtMigrationDetailsTargetVmtags(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsTargetVmtags DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VMwareCbtMigrationDetailsTargetVmtags(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json + /// string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsTargetVmtags FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VMwareCbtMigrationDetailsTargetVmtags(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal VMwareCbtMigrationDetailsTargetVmtags(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializePSObject(content); + } + } + /// The target VM tags. + [System.ComponentModel.TypeConverter(typeof(VMwareCbtMigrationDetailsTargetVmtagsTypeConverter))] + public partial interface IVMwareCbtMigrationDetailsTargetVmtags + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtMigrationDetailsTargetVmtags.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtMigrationDetailsTargetVmtags.TypeConverter.cs new file mode 100644 index 000000000000..517b2495e10e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtMigrationDetailsTargetVmtags.TypeConverter.cs @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VMwareCbtMigrationDetailsTargetVmtagsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsTargetVmtags ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsTargetVmtags).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VMwareCbtMigrationDetailsTargetVmtags.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VMwareCbtMigrationDetailsTargetVmtags.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VMwareCbtMigrationDetailsTargetVmtags.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtMigrationDetailsTargetVmtags.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtMigrationDetailsTargetVmtags.cs new file mode 100644 index 000000000000..886171263096 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtMigrationDetailsTargetVmtags.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The target VM tags. + public partial class VMwareCbtMigrationDetailsTargetVmtags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsTargetVmtags, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsTargetVmtagsInternal + { + + /// Creates an new instance. + public VMwareCbtMigrationDetailsTargetVmtags() + { + + } + } + /// The target VM tags. + public partial interface IVMwareCbtMigrationDetailsTargetVmtags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray + { + + } + /// The target VM tags. + internal partial interface IVMwareCbtMigrationDetailsTargetVmtagsInternal + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtMigrationDetailsTargetVmtags.dictionary.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtMigrationDetailsTargetVmtags.dictionary.cs new file mode 100644 index 000000000000..44dd197bed1a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtMigrationDetailsTargetVmtags.dictionary.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + public partial class VMwareCbtMigrationDetailsTargetVmtags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray + { + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + + int Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Values { get => __additionalProperties.Values; } + + public string this[global::System.String index] { get => __additionalProperties[index]; set => __additionalProperties[index] = value; } + + /// + /// + public void Add(global::System.String key, string value) => __additionalProperties.Add( key, value); + + public void Clear() => __additionalProperties.Clear(); + + /// + public bool ContainsKey(global::System.String key) => __additionalProperties.ContainsKey( key); + + /// + public void CopyFrom(global::System.Collections.IDictionary source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public void CopyFrom(global::System.Management.Automation.PSObject source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public bool Remove(global::System.String key) => __additionalProperties.Remove( key); + + /// + /// + public bool TryGetValue(global::System.String key, out string value) => __additionalProperties.TryGetValue( key, out value); + + /// + + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtMigrationDetailsTargetVmtags source) => source.__additionalProperties; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtMigrationDetailsTargetVmtags.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtMigrationDetailsTargetVmtags.json.cs new file mode 100644 index 000000000000..c040aeb1bca7 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtMigrationDetailsTargetVmtags.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The target VM tags. + public partial class VMwareCbtMigrationDetailsTargetVmtags + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsTargetVmtags. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsTargetVmtags. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtMigrationDetailsTargetVmtags FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new VMwareCbtMigrationDetailsTargetVmtags(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray)this).AdditionalProperties, container); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + /// + internal VMwareCbtMigrationDetailsTargetVmtags(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, global::System.Collections.Generic.HashSet exclusions = null) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray)this).AdditionalProperties, null ,exclusions ); + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtNicDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtNicDetails.PowerShell.cs new file mode 100644 index 000000000000..0786055c5358 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtNicDetails.PowerShell.cs @@ -0,0 +1,248 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// VMwareCbt NIC details. + [System.ComponentModel.TypeConverter(typeof(VMwareCbtNicDetailsTypeConverter))] + public partial class VMwareCbtNicDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VMwareCbtNicDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VMwareCbtNicDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VMwareCbtNicDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("NicId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicDetailsInternal)this).NicId = (string) content.GetValueForProperty("NicId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicDetailsInternal)this).NicId, global::System.Convert.ToString); + } + if (content.Contains("IsPrimaryNic")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicDetailsInternal)this).IsPrimaryNic = (string) content.GetValueForProperty("IsPrimaryNic",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicDetailsInternal)this).IsPrimaryNic, global::System.Convert.ToString); + } + if (content.Contains("SourceIPAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicDetailsInternal)this).SourceIPAddress = (string) content.GetValueForProperty("SourceIPAddress",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicDetailsInternal)this).SourceIPAddress, global::System.Convert.ToString); + } + if (content.Contains("SourceIPAddressType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicDetailsInternal)this).SourceIPAddressType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.EthernetAddressType?) content.GetValueForProperty("SourceIPAddressType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicDetailsInternal)this).SourceIPAddressType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.EthernetAddressType.CreateFrom); + } + if (content.Contains("SourceNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicDetailsInternal)this).SourceNetworkId = (string) content.GetValueForProperty("SourceNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicDetailsInternal)this).SourceNetworkId, global::System.Convert.ToString); + } + if (content.Contains("TargetIPAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicDetailsInternal)this).TargetIPAddress = (string) content.GetValueForProperty("TargetIPAddress",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicDetailsInternal)this).TargetIPAddress, global::System.Convert.ToString); + } + if (content.Contains("TargetIPAddressType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicDetailsInternal)this).TargetIPAddressType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.EthernetAddressType?) content.GetValueForProperty("TargetIPAddressType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicDetailsInternal)this).TargetIPAddressType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.EthernetAddressType.CreateFrom); + } + if (content.Contains("TargetSubnetName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicDetailsInternal)this).TargetSubnetName = (string) content.GetValueForProperty("TargetSubnetName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicDetailsInternal)this).TargetSubnetName, global::System.Convert.ToString); + } + if (content.Contains("TestNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicDetailsInternal)this).TestNetworkId = (string) content.GetValueForProperty("TestNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicDetailsInternal)this).TestNetworkId, global::System.Convert.ToString); + } + if (content.Contains("TestSubnetName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicDetailsInternal)this).TestSubnetName = (string) content.GetValueForProperty("TestSubnetName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicDetailsInternal)this).TestSubnetName, global::System.Convert.ToString); + } + if (content.Contains("TestIPAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicDetailsInternal)this).TestIPAddress = (string) content.GetValueForProperty("TestIPAddress",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicDetailsInternal)this).TestIPAddress, global::System.Convert.ToString); + } + if (content.Contains("TestIPAddressType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicDetailsInternal)this).TestIPAddressType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.EthernetAddressType?) content.GetValueForProperty("TestIPAddressType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicDetailsInternal)this).TestIPAddressType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.EthernetAddressType.CreateFrom); + } + if (content.Contains("TargetNicName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicDetailsInternal)this).TargetNicName = (string) content.GetValueForProperty("TargetNicName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicDetailsInternal)this).TargetNicName, global::System.Convert.ToString); + } + if (content.Contains("IsSelectedForMigration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicDetailsInternal)this).IsSelectedForMigration = (string) content.GetValueForProperty("IsSelectedForMigration",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicDetailsInternal)this).IsSelectedForMigration, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal VMwareCbtNicDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("NicId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicDetailsInternal)this).NicId = (string) content.GetValueForProperty("NicId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicDetailsInternal)this).NicId, global::System.Convert.ToString); + } + if (content.Contains("IsPrimaryNic")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicDetailsInternal)this).IsPrimaryNic = (string) content.GetValueForProperty("IsPrimaryNic",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicDetailsInternal)this).IsPrimaryNic, global::System.Convert.ToString); + } + if (content.Contains("SourceIPAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicDetailsInternal)this).SourceIPAddress = (string) content.GetValueForProperty("SourceIPAddress",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicDetailsInternal)this).SourceIPAddress, global::System.Convert.ToString); + } + if (content.Contains("SourceIPAddressType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicDetailsInternal)this).SourceIPAddressType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.EthernetAddressType?) content.GetValueForProperty("SourceIPAddressType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicDetailsInternal)this).SourceIPAddressType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.EthernetAddressType.CreateFrom); + } + if (content.Contains("SourceNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicDetailsInternal)this).SourceNetworkId = (string) content.GetValueForProperty("SourceNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicDetailsInternal)this).SourceNetworkId, global::System.Convert.ToString); + } + if (content.Contains("TargetIPAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicDetailsInternal)this).TargetIPAddress = (string) content.GetValueForProperty("TargetIPAddress",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicDetailsInternal)this).TargetIPAddress, global::System.Convert.ToString); + } + if (content.Contains("TargetIPAddressType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicDetailsInternal)this).TargetIPAddressType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.EthernetAddressType?) content.GetValueForProperty("TargetIPAddressType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicDetailsInternal)this).TargetIPAddressType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.EthernetAddressType.CreateFrom); + } + if (content.Contains("TargetSubnetName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicDetailsInternal)this).TargetSubnetName = (string) content.GetValueForProperty("TargetSubnetName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicDetailsInternal)this).TargetSubnetName, global::System.Convert.ToString); + } + if (content.Contains("TestNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicDetailsInternal)this).TestNetworkId = (string) content.GetValueForProperty("TestNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicDetailsInternal)this).TestNetworkId, global::System.Convert.ToString); + } + if (content.Contains("TestSubnetName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicDetailsInternal)this).TestSubnetName = (string) content.GetValueForProperty("TestSubnetName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicDetailsInternal)this).TestSubnetName, global::System.Convert.ToString); + } + if (content.Contains("TestIPAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicDetailsInternal)this).TestIPAddress = (string) content.GetValueForProperty("TestIPAddress",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicDetailsInternal)this).TestIPAddress, global::System.Convert.ToString); + } + if (content.Contains("TestIPAddressType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicDetailsInternal)this).TestIPAddressType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.EthernetAddressType?) content.GetValueForProperty("TestIPAddressType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicDetailsInternal)this).TestIPAddressType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.EthernetAddressType.CreateFrom); + } + if (content.Contains("TargetNicName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicDetailsInternal)this).TargetNicName = (string) content.GetValueForProperty("TargetNicName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicDetailsInternal)this).TargetNicName, global::System.Convert.ToString); + } + if (content.Contains("IsSelectedForMigration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicDetailsInternal)this).IsSelectedForMigration = (string) content.GetValueForProperty("IsSelectedForMigration",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicDetailsInternal)this).IsSelectedForMigration, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + } + /// VMwareCbt NIC details. + [System.ComponentModel.TypeConverter(typeof(VMwareCbtNicDetailsTypeConverter))] + public partial interface IVMwareCbtNicDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtNicDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtNicDetails.TypeConverter.cs new file mode 100644 index 000000000000..04bad50121cb --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtNicDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VMwareCbtNicDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VMwareCbtNicDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VMwareCbtNicDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VMwareCbtNicDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtNicDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtNicDetails.cs new file mode 100644 index 000000000000..2ac860d02341 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtNicDetails.cs @@ -0,0 +1,284 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// VMwareCbt NIC details. + public partial class VMwareCbtNicDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicDetailsInternal + { + + /// Backing field for property. + private string _isPrimaryNic; + + /// A value indicating whether this is the primary NIC. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string IsPrimaryNic { get => this._isPrimaryNic; set => this._isPrimaryNic = value; } + + /// Backing field for property. + private string _isSelectedForMigration; + + /// A value indicating whether this NIC is selected for migration. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string IsSelectedForMigration { get => this._isSelectedForMigration; set => this._isSelectedForMigration = value; } + + /// Internal Acessors for NicId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicDetailsInternal.NicId { get => this._nicId; set { {_nicId = value;} } } + + /// Internal Acessors for SourceIPAddress + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicDetailsInternal.SourceIPAddress { get => this._sourceIPAddress; set { {_sourceIPAddress = value;} } } + + /// Internal Acessors for SourceIPAddressType + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.EthernetAddressType? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicDetailsInternal.SourceIPAddressType { get => this._sourceIPAddressType; set { {_sourceIPAddressType = value;} } } + + /// Internal Acessors for SourceNetworkId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicDetailsInternal.SourceNetworkId { get => this._sourceNetworkId; set { {_sourceNetworkId = value;} } } + + /// Backing field for property. + private string _nicId; + + /// The NIC Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string NicId { get => this._nicId; } + + /// Backing field for property. + private string _sourceIPAddress; + + /// The source IP address. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string SourceIPAddress { get => this._sourceIPAddress; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.EthernetAddressType? _sourceIPAddressType; + + /// The source IP address type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.EthernetAddressType? SourceIPAddressType { get => this._sourceIPAddressType; } + + /// Backing field for property. + private string _sourceNetworkId; + + /// Source network Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string SourceNetworkId { get => this._sourceNetworkId; } + + /// Backing field for property. + private string _targetIPAddress; + + /// The target IP address. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetIPAddress { get => this._targetIPAddress; set => this._targetIPAddress = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.EthernetAddressType? _targetIPAddressType; + + /// The target IP address type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.EthernetAddressType? TargetIPAddressType { get => this._targetIPAddressType; set => this._targetIPAddressType = value; } + + /// Backing field for property. + private string _targetNicName; + + /// Target NIC name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetNicName { get => this._targetNicName; set => this._targetNicName = value; } + + /// Backing field for property. + private string _targetSubnetName; + + /// Target subnet name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetSubnetName { get => this._targetSubnetName; set => this._targetSubnetName = value; } + + /// Backing field for property. + private string _testIPAddress; + + /// The test IP address. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TestIPAddress { get => this._testIPAddress; set => this._testIPAddress = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.EthernetAddressType? _testIPAddressType; + + /// The test IP address type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.EthernetAddressType? TestIPAddressType { get => this._testIPAddressType; set => this._testIPAddressType = value; } + + /// Backing field for property. + private string _testNetworkId; + + /// Source network Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TestNetworkId { get => this._testNetworkId; set => this._testNetworkId = value; } + + /// Backing field for property. + private string _testSubnetName; + + /// Test subnet name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TestSubnetName { get => this._testSubnetName; set => this._testSubnetName = value; } + + /// Creates an new instance. + public VMwareCbtNicDetails() + { + + } + } + /// VMwareCbt NIC details. + public partial interface IVMwareCbtNicDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// A value indicating whether this is the primary NIC. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether this is the primary NIC.", + SerializedName = @"isPrimaryNic", + PossibleTypes = new [] { typeof(string) })] + string IsPrimaryNic { get; set; } + /// A value indicating whether this NIC is selected for migration. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether this NIC is selected for migration.", + SerializedName = @"isSelectedForMigration", + PossibleTypes = new [] { typeof(string) })] + string IsSelectedForMigration { get; set; } + /// The NIC Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The NIC Id.", + SerializedName = @"nicId", + PossibleTypes = new [] { typeof(string) })] + string NicId { get; } + /// The source IP address. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The source IP address.", + SerializedName = @"sourceIPAddress", + PossibleTypes = new [] { typeof(string) })] + string SourceIPAddress { get; } + /// The source IP address type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The source IP address type.", + SerializedName = @"sourceIPAddressType", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.EthernetAddressType) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.EthernetAddressType? SourceIPAddressType { get; } + /// Source network Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Source network Id.", + SerializedName = @"sourceNetworkId", + PossibleTypes = new [] { typeof(string) })] + string SourceNetworkId { get; } + /// The target IP address. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target IP address.", + SerializedName = @"targetIPAddress", + PossibleTypes = new [] { typeof(string) })] + string TargetIPAddress { get; set; } + /// The target IP address type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target IP address type.", + SerializedName = @"targetIPAddressType", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.EthernetAddressType) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.EthernetAddressType? TargetIPAddressType { get; set; } + /// Target NIC name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Target NIC name.", + SerializedName = @"targetNicName", + PossibleTypes = new [] { typeof(string) })] + string TargetNicName { get; set; } + /// Target subnet name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Target subnet name.", + SerializedName = @"targetSubnetName", + PossibleTypes = new [] { typeof(string) })] + string TargetSubnetName { get; set; } + /// The test IP address. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The test IP address.", + SerializedName = @"testIPAddress", + PossibleTypes = new [] { typeof(string) })] + string TestIPAddress { get; set; } + /// The test IP address type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The test IP address type.", + SerializedName = @"testIPAddressType", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.EthernetAddressType) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.EthernetAddressType? TestIPAddressType { get; set; } + /// Source network Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Source network Id.", + SerializedName = @"testNetworkId", + PossibleTypes = new [] { typeof(string) })] + string TestNetworkId { get; set; } + /// Test subnet name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Test subnet name.", + SerializedName = @"testSubnetName", + PossibleTypes = new [] { typeof(string) })] + string TestSubnetName { get; set; } + + } + /// VMwareCbt NIC details. + internal partial interface IVMwareCbtNicDetailsInternal + + { + /// A value indicating whether this is the primary NIC. + string IsPrimaryNic { get; set; } + /// A value indicating whether this NIC is selected for migration. + string IsSelectedForMigration { get; set; } + /// The NIC Id. + string NicId { get; set; } + /// The source IP address. + string SourceIPAddress { get; set; } + /// The source IP address type. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.EthernetAddressType? SourceIPAddressType { get; set; } + /// Source network Id. + string SourceNetworkId { get; set; } + /// The target IP address. + string TargetIPAddress { get; set; } + /// The target IP address type. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.EthernetAddressType? TargetIPAddressType { get; set; } + /// Target NIC name. + string TargetNicName { get; set; } + /// Target subnet name. + string TargetSubnetName { get; set; } + /// The test IP address. + string TestIPAddress { get; set; } + /// The test IP address type. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.EthernetAddressType? TestIPAddressType { get; set; } + /// Source network Id. + string TestNetworkId { get; set; } + /// Test subnet name. + string TestSubnetName { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtNicDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtNicDetails.json.cs new file mode 100644 index 000000000000..fdeb179f1685 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtNicDetails.json.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// VMwareCbt NIC details. + public partial class VMwareCbtNicDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new VMwareCbtNicDetails(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._nicId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._nicId.ToString()) : null, "nicId" ,container.Add ); + } + AddIf( null != (((object)this._isPrimaryNic)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._isPrimaryNic.ToString()) : null, "isPrimaryNic" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._sourceIPAddress)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._sourceIPAddress.ToString()) : null, "sourceIPAddress" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._sourceIPAddressType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._sourceIPAddressType.ToString()) : null, "sourceIPAddressType" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._sourceNetworkId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._sourceNetworkId.ToString()) : null, "sourceNetworkId" ,container.Add ); + } + AddIf( null != (((object)this._targetIPAddress)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetIPAddress.ToString()) : null, "targetIPAddress" ,container.Add ); + AddIf( null != (((object)this._targetIPAddressType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetIPAddressType.ToString()) : null, "targetIPAddressType" ,container.Add ); + AddIf( null != (((object)this._targetSubnetName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetSubnetName.ToString()) : null, "targetSubnetName" ,container.Add ); + AddIf( null != (((object)this._testNetworkId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._testNetworkId.ToString()) : null, "testNetworkId" ,container.Add ); + AddIf( null != (((object)this._testSubnetName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._testSubnetName.ToString()) : null, "testSubnetName" ,container.Add ); + AddIf( null != (((object)this._testIPAddress)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._testIPAddress.ToString()) : null, "testIPAddress" ,container.Add ); + AddIf( null != (((object)this._testIPAddressType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._testIPAddressType.ToString()) : null, "testIPAddressType" ,container.Add ); + AddIf( null != (((object)this._targetNicName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetNicName.ToString()) : null, "targetNicName" ,container.Add ); + AddIf( null != (((object)this._isSelectedForMigration)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._isSelectedForMigration.ToString()) : null, "isSelectedForMigration" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal VMwareCbtNicDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_nicId = If( json?.PropertyT("nicId"), out var __jsonNicId) ? (string)__jsonNicId : (string)NicId;} + {_isPrimaryNic = If( json?.PropertyT("isPrimaryNic"), out var __jsonIsPrimaryNic) ? (string)__jsonIsPrimaryNic : (string)IsPrimaryNic;} + {_sourceIPAddress = If( json?.PropertyT("sourceIPAddress"), out var __jsonSourceIPAddress) ? (string)__jsonSourceIPAddress : (string)SourceIPAddress;} + {_sourceIPAddressType = If( json?.PropertyT("sourceIPAddressType"), out var __jsonSourceIPAddressType) ? (string)__jsonSourceIPAddressType : (string)SourceIPAddressType;} + {_sourceNetworkId = If( json?.PropertyT("sourceNetworkId"), out var __jsonSourceNetworkId) ? (string)__jsonSourceNetworkId : (string)SourceNetworkId;} + {_targetIPAddress = If( json?.PropertyT("targetIPAddress"), out var __jsonTargetIPAddress) ? (string)__jsonTargetIPAddress : (string)TargetIPAddress;} + {_targetIPAddressType = If( json?.PropertyT("targetIPAddressType"), out var __jsonTargetIPAddressType) ? (string)__jsonTargetIPAddressType : (string)TargetIPAddressType;} + {_targetSubnetName = If( json?.PropertyT("targetSubnetName"), out var __jsonTargetSubnetName) ? (string)__jsonTargetSubnetName : (string)TargetSubnetName;} + {_testNetworkId = If( json?.PropertyT("testNetworkId"), out var __jsonTestNetworkId) ? (string)__jsonTestNetworkId : (string)TestNetworkId;} + {_testSubnetName = If( json?.PropertyT("testSubnetName"), out var __jsonTestSubnetName) ? (string)__jsonTestSubnetName : (string)TestSubnetName;} + {_testIPAddress = If( json?.PropertyT("testIPAddress"), out var __jsonTestIPAddress) ? (string)__jsonTestIPAddress : (string)TestIPAddress;} + {_testIPAddressType = If( json?.PropertyT("testIPAddressType"), out var __jsonTestIPAddressType) ? (string)__jsonTestIPAddressType : (string)TestIPAddressType;} + {_targetNicName = If( json?.PropertyT("targetNicName"), out var __jsonTargetNicName) ? (string)__jsonTargetNicName : (string)TargetNicName;} + {_isSelectedForMigration = If( json?.PropertyT("isSelectedForMigration"), out var __jsonIsSelectedForMigration) ? (string)__jsonIsSelectedForMigration : (string)IsSelectedForMigration;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtNicInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtNicInput.PowerShell.cs new file mode 100644 index 000000000000..d0f6d2ca1979 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtNicInput.PowerShell.cs @@ -0,0 +1,200 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// VMwareCbt NIC input. + [System.ComponentModel.TypeConverter(typeof(VMwareCbtNicInputTypeConverter))] + public partial class VMwareCbtNicInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VMwareCbtNicInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VMwareCbtNicInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VMwareCbtNicInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("NicId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicInputInternal)this).NicId = (string) content.GetValueForProperty("NicId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicInputInternal)this).NicId, global::System.Convert.ToString); + } + if (content.Contains("IsPrimaryNic")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicInputInternal)this).IsPrimaryNic = (string) content.GetValueForProperty("IsPrimaryNic",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicInputInternal)this).IsPrimaryNic, global::System.Convert.ToString); + } + if (content.Contains("TargetSubnetName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicInputInternal)this).TargetSubnetName = (string) content.GetValueForProperty("TargetSubnetName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicInputInternal)this).TargetSubnetName, global::System.Convert.ToString); + } + if (content.Contains("TargetStaticIPAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicInputInternal)this).TargetStaticIPAddress = (string) content.GetValueForProperty("TargetStaticIPAddress",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicInputInternal)this).TargetStaticIPAddress, global::System.Convert.ToString); + } + if (content.Contains("IsSelectedForMigration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicInputInternal)this).IsSelectedForMigration = (string) content.GetValueForProperty("IsSelectedForMigration",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicInputInternal)this).IsSelectedForMigration, global::System.Convert.ToString); + } + if (content.Contains("TargetNicName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicInputInternal)this).TargetNicName = (string) content.GetValueForProperty("TargetNicName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicInputInternal)this).TargetNicName, global::System.Convert.ToString); + } + if (content.Contains("TestSubnetName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicInputInternal)this).TestSubnetName = (string) content.GetValueForProperty("TestSubnetName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicInputInternal)this).TestSubnetName, global::System.Convert.ToString); + } + if (content.Contains("TestStaticIPAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicInputInternal)this).TestStaticIPAddress = (string) content.GetValueForProperty("TestStaticIPAddress",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicInputInternal)this).TestStaticIPAddress, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal VMwareCbtNicInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("NicId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicInputInternal)this).NicId = (string) content.GetValueForProperty("NicId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicInputInternal)this).NicId, global::System.Convert.ToString); + } + if (content.Contains("IsPrimaryNic")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicInputInternal)this).IsPrimaryNic = (string) content.GetValueForProperty("IsPrimaryNic",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicInputInternal)this).IsPrimaryNic, global::System.Convert.ToString); + } + if (content.Contains("TargetSubnetName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicInputInternal)this).TargetSubnetName = (string) content.GetValueForProperty("TargetSubnetName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicInputInternal)this).TargetSubnetName, global::System.Convert.ToString); + } + if (content.Contains("TargetStaticIPAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicInputInternal)this).TargetStaticIPAddress = (string) content.GetValueForProperty("TargetStaticIPAddress",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicInputInternal)this).TargetStaticIPAddress, global::System.Convert.ToString); + } + if (content.Contains("IsSelectedForMigration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicInputInternal)this).IsSelectedForMigration = (string) content.GetValueForProperty("IsSelectedForMigration",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicInputInternal)this).IsSelectedForMigration, global::System.Convert.ToString); + } + if (content.Contains("TargetNicName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicInputInternal)this).TargetNicName = (string) content.GetValueForProperty("TargetNicName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicInputInternal)this).TargetNicName, global::System.Convert.ToString); + } + if (content.Contains("TestSubnetName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicInputInternal)this).TestSubnetName = (string) content.GetValueForProperty("TestSubnetName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicInputInternal)this).TestSubnetName, global::System.Convert.ToString); + } + if (content.Contains("TestStaticIPAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicInputInternal)this).TestStaticIPAddress = (string) content.GetValueForProperty("TestStaticIPAddress",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicInputInternal)this).TestStaticIPAddress, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + } + /// VMwareCbt NIC input. + [System.ComponentModel.TypeConverter(typeof(VMwareCbtNicInputTypeConverter))] + public partial interface IVMwareCbtNicInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtNicInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtNicInput.TypeConverter.cs new file mode 100644 index 000000000000..5d82f62d62d5 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtNicInput.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VMwareCbtNicInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VMwareCbtNicInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VMwareCbtNicInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VMwareCbtNicInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtNicInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtNicInput.cs new file mode 100644 index 000000000000..e45ba4dc4d7a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtNicInput.cs @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// VMwareCbt NIC input. + public partial class VMwareCbtNicInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicInputInternal + { + + /// Backing field for property. + private string _isPrimaryNic; + + /// A value indicating whether this is the primary NIC. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string IsPrimaryNic { get => this._isPrimaryNic; set => this._isPrimaryNic = value; } + + /// Backing field for property. + private string _isSelectedForMigration; + + /// A value indicating whether this NIC is selected for migration. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string IsSelectedForMigration { get => this._isSelectedForMigration; set => this._isSelectedForMigration = value; } + + /// Backing field for property. + private string _nicId; + + /// The NIC Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string NicId { get => this._nicId; set => this._nicId = value; } + + /// Backing field for property. + private string _targetNicName; + + /// Target NIC name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetNicName { get => this._targetNicName; set => this._targetNicName = value; } + + /// Backing field for property. + private string _targetStaticIPAddress; + + /// The static IP address. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetStaticIPAddress { get => this._targetStaticIPAddress; set => this._targetStaticIPAddress = value; } + + /// Backing field for property. + private string _targetSubnetName; + + /// Target subnet name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetSubnetName { get => this._targetSubnetName; set => this._targetSubnetName = value; } + + /// Backing field for property. + private string _testStaticIPAddress; + + /// The test static IP address. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TestStaticIPAddress { get => this._testStaticIPAddress; set => this._testStaticIPAddress = value; } + + /// Backing field for property. + private string _testSubnetName; + + /// The test subnet name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TestSubnetName { get => this._testSubnetName; set => this._testSubnetName = value; } + + /// Creates an new instance. + public VMwareCbtNicInput() + { + + } + } + /// VMwareCbt NIC input. + public partial interface IVMwareCbtNicInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// A value indicating whether this is the primary NIC. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"A value indicating whether this is the primary NIC.", + SerializedName = @"isPrimaryNic", + PossibleTypes = new [] { typeof(string) })] + string IsPrimaryNic { get; set; } + /// A value indicating whether this NIC is selected for migration. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether this NIC is selected for migration.", + SerializedName = @"isSelectedForMigration", + PossibleTypes = new [] { typeof(string) })] + string IsSelectedForMigration { get; set; } + /// The NIC Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The NIC Id.", + SerializedName = @"nicId", + PossibleTypes = new [] { typeof(string) })] + string NicId { get; set; } + /// Target NIC name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Target NIC name.", + SerializedName = @"targetNicName", + PossibleTypes = new [] { typeof(string) })] + string TargetNicName { get; set; } + /// The static IP address. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The static IP address.", + SerializedName = @"targetStaticIPAddress", + PossibleTypes = new [] { typeof(string) })] + string TargetStaticIPAddress { get; set; } + /// Target subnet name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Target subnet name.", + SerializedName = @"targetSubnetName", + PossibleTypes = new [] { typeof(string) })] + string TargetSubnetName { get; set; } + /// The test static IP address. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The test static IP address.", + SerializedName = @"testStaticIPAddress", + PossibleTypes = new [] { typeof(string) })] + string TestStaticIPAddress { get; set; } + /// The test subnet name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The test subnet name.", + SerializedName = @"testSubnetName", + PossibleTypes = new [] { typeof(string) })] + string TestSubnetName { get; set; } + + } + /// VMwareCbt NIC input. + internal partial interface IVMwareCbtNicInputInternal + + { + /// A value indicating whether this is the primary NIC. + string IsPrimaryNic { get; set; } + /// A value indicating whether this NIC is selected for migration. + string IsSelectedForMigration { get; set; } + /// The NIC Id. + string NicId { get; set; } + /// Target NIC name. + string TargetNicName { get; set; } + /// The static IP address. + string TargetStaticIPAddress { get; set; } + /// Target subnet name. + string TargetSubnetName { get; set; } + /// The test static IP address. + string TestStaticIPAddress { get; set; } + /// The test subnet name. + string TestSubnetName { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtNicInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtNicInput.json.cs new file mode 100644 index 000000000000..1084df1aa6dc --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtNicInput.json.cs @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// VMwareCbt NIC input. + public partial class VMwareCbtNicInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new VMwareCbtNicInput(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._nicId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._nicId.ToString()) : null, "nicId" ,container.Add ); + AddIf( null != (((object)this._isPrimaryNic)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._isPrimaryNic.ToString()) : null, "isPrimaryNic" ,container.Add ); + AddIf( null != (((object)this._targetSubnetName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetSubnetName.ToString()) : null, "targetSubnetName" ,container.Add ); + AddIf( null != (((object)this._targetStaticIPAddress)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetStaticIPAddress.ToString()) : null, "targetStaticIPAddress" ,container.Add ); + AddIf( null != (((object)this._isSelectedForMigration)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._isSelectedForMigration.ToString()) : null, "isSelectedForMigration" ,container.Add ); + AddIf( null != (((object)this._targetNicName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetNicName.ToString()) : null, "targetNicName" ,container.Add ); + AddIf( null != (((object)this._testSubnetName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._testSubnetName.ToString()) : null, "testSubnetName" ,container.Add ); + AddIf( null != (((object)this._testStaticIPAddress)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._testStaticIPAddress.ToString()) : null, "testStaticIPAddress" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal VMwareCbtNicInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_nicId = If( json?.PropertyT("nicId"), out var __jsonNicId) ? (string)__jsonNicId : (string)NicId;} + {_isPrimaryNic = If( json?.PropertyT("isPrimaryNic"), out var __jsonIsPrimaryNic) ? (string)__jsonIsPrimaryNic : (string)IsPrimaryNic;} + {_targetSubnetName = If( json?.PropertyT("targetSubnetName"), out var __jsonTargetSubnetName) ? (string)__jsonTargetSubnetName : (string)TargetSubnetName;} + {_targetStaticIPAddress = If( json?.PropertyT("targetStaticIPAddress"), out var __jsonTargetStaticIPAddress) ? (string)__jsonTargetStaticIPAddress : (string)TargetStaticIPAddress;} + {_isSelectedForMigration = If( json?.PropertyT("isSelectedForMigration"), out var __jsonIsSelectedForMigration) ? (string)__jsonIsSelectedForMigration : (string)IsSelectedForMigration;} + {_targetNicName = If( json?.PropertyT("targetNicName"), out var __jsonTargetNicName) ? (string)__jsonTargetNicName : (string)TargetNicName;} + {_testSubnetName = If( json?.PropertyT("testSubnetName"), out var __jsonTestSubnetName) ? (string)__jsonTestSubnetName : (string)TestSubnetName;} + {_testStaticIPAddress = If( json?.PropertyT("testStaticIPAddress"), out var __jsonTestStaticIPAddress) ? (string)__jsonTestStaticIPAddress : (string)TestStaticIPAddress;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtPolicyCreationInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtPolicyCreationInput.PowerShell.cs new file mode 100644 index 000000000000..ebe57ac1891b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtPolicyCreationInput.PowerShell.cs @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// VMware Cbt policy creation input. + [System.ComponentModel.TypeConverter(typeof(VMwareCbtPolicyCreationInputTypeConverter))] + public partial class VMwareCbtPolicyCreationInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtPolicyCreationInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VMwareCbtPolicyCreationInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtPolicyCreationInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VMwareCbtPolicyCreationInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtPolicyCreationInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VMwareCbtPolicyCreationInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("RecoveryPointHistoryInMinute")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtPolicyCreationInputInternal)this).RecoveryPointHistoryInMinute = (int?) content.GetValueForProperty("RecoveryPointHistoryInMinute",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtPolicyCreationInputInternal)this).RecoveryPointHistoryInMinute, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("CrashConsistentFrequencyInMinute")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtPolicyCreationInputInternal)this).CrashConsistentFrequencyInMinute = (int?) content.GetValueForProperty("CrashConsistentFrequencyInMinute",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtPolicyCreationInputInternal)this).CrashConsistentFrequencyInMinute, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("AppConsistentFrequencyInMinute")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtPolicyCreationInputInternal)this).AppConsistentFrequencyInMinute = (int?) content.GetValueForProperty("AppConsistentFrequencyInMinute",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtPolicyCreationInputInternal)this).AppConsistentFrequencyInMinute, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal VMwareCbtPolicyCreationInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("RecoveryPointHistoryInMinute")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtPolicyCreationInputInternal)this).RecoveryPointHistoryInMinute = (int?) content.GetValueForProperty("RecoveryPointHistoryInMinute",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtPolicyCreationInputInternal)this).RecoveryPointHistoryInMinute, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("CrashConsistentFrequencyInMinute")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtPolicyCreationInputInternal)this).CrashConsistentFrequencyInMinute = (int?) content.GetValueForProperty("CrashConsistentFrequencyInMinute",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtPolicyCreationInputInternal)this).CrashConsistentFrequencyInMinute, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("AppConsistentFrequencyInMinute")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtPolicyCreationInputInternal)this).AppConsistentFrequencyInMinute = (int?) content.GetValueForProperty("AppConsistentFrequencyInMinute",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtPolicyCreationInputInternal)this).AppConsistentFrequencyInMinute, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + } + /// VMware Cbt policy creation input. + [System.ComponentModel.TypeConverter(typeof(VMwareCbtPolicyCreationInputTypeConverter))] + public partial interface IVMwareCbtPolicyCreationInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtPolicyCreationInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtPolicyCreationInput.TypeConverter.cs new file mode 100644 index 000000000000..3f3ef64aaf17 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtPolicyCreationInput.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VMwareCbtPolicyCreationInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtPolicyCreationInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtPolicyCreationInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VMwareCbtPolicyCreationInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VMwareCbtPolicyCreationInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VMwareCbtPolicyCreationInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtPolicyCreationInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtPolicyCreationInput.cs new file mode 100644 index 000000000000..b2e2df69b6be --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtPolicyCreationInput.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// VMware Cbt policy creation input. + public partial class VMwareCbtPolicyCreationInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtPolicyCreationInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtPolicyCreationInputInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInput __policyProviderSpecificInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PolicyProviderSpecificInput(); + + /// Backing field for property. + private int? _appConsistentFrequencyInMinute; + + /// The app consistent snapshot frequency (in minutes). + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? AppConsistentFrequencyInMinute { get => this._appConsistentFrequencyInMinute; set => this._appConsistentFrequencyInMinute = value; } + + /// Backing field for property. + private int? _crashConsistentFrequencyInMinute; + + /// The crash consistent snapshot frequency (in minutes). + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? CrashConsistentFrequencyInMinute { get => this._crashConsistentFrequencyInMinute; set => this._crashConsistentFrequencyInMinute = value; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInputInternal)__policyProviderSpecificInput).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInputInternal)__policyProviderSpecificInput).InstanceType = value ; } + + /// Backing field for property. + private int? _recoveryPointHistoryInMinute; + + /// The duration in minutes until which the recovery points need to be stored. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? RecoveryPointHistoryInMinute { get => this._recoveryPointHistoryInMinute; set => this._recoveryPointHistoryInMinute = value; } + + /// Creates an new instance. + public VMwareCbtPolicyCreationInput() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__policyProviderSpecificInput), __policyProviderSpecificInput); + await eventListener.AssertObjectIsValid(nameof(__policyProviderSpecificInput), __policyProviderSpecificInput); + } + } + /// VMware Cbt policy creation input. + public partial interface IVMwareCbtPolicyCreationInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInput + { + /// The app consistent snapshot frequency (in minutes). + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The app consistent snapshot frequency (in minutes).", + SerializedName = @"appConsistentFrequencyInMinutes", + PossibleTypes = new [] { typeof(int) })] + int? AppConsistentFrequencyInMinute { get; set; } + /// The crash consistent snapshot frequency (in minutes). + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The crash consistent snapshot frequency (in minutes).", + SerializedName = @"crashConsistentFrequencyInMinutes", + PossibleTypes = new [] { typeof(int) })] + int? CrashConsistentFrequencyInMinute { get; set; } + /// The duration in minutes until which the recovery points need to be stored. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The duration in minutes until which the recovery points need to be stored.", + SerializedName = @"recoveryPointHistoryInMinutes", + PossibleTypes = new [] { typeof(int) })] + int? RecoveryPointHistoryInMinute { get; set; } + + } + /// VMware Cbt policy creation input. + internal partial interface IVMwareCbtPolicyCreationInputInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificInputInternal + { + /// The app consistent snapshot frequency (in minutes). + int? AppConsistentFrequencyInMinute { get; set; } + /// The crash consistent snapshot frequency (in minutes). + int? CrashConsistentFrequencyInMinute { get; set; } + /// The duration in minutes until which the recovery points need to be stored. + int? RecoveryPointHistoryInMinute { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtPolicyCreationInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtPolicyCreationInput.json.cs new file mode 100644 index 000000000000..06f6a265ae6b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtPolicyCreationInput.json.cs @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// VMware Cbt policy creation input. + public partial class VMwareCbtPolicyCreationInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtPolicyCreationInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtPolicyCreationInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtPolicyCreationInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new VMwareCbtPolicyCreationInput(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __policyProviderSpecificInput?.ToJson(container, serializationMode); + AddIf( null != this._recoveryPointHistoryInMinute ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._recoveryPointHistoryInMinute) : null, "recoveryPointHistoryInMinutes" ,container.Add ); + AddIf( null != this._crashConsistentFrequencyInMinute ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._crashConsistentFrequencyInMinute) : null, "crashConsistentFrequencyInMinutes" ,container.Add ); + AddIf( null != this._appConsistentFrequencyInMinute ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._appConsistentFrequencyInMinute) : null, "appConsistentFrequencyInMinutes" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal VMwareCbtPolicyCreationInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __policyProviderSpecificInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PolicyProviderSpecificInput(json); + {_recoveryPointHistoryInMinute = If( json?.PropertyT("recoveryPointHistoryInMinutes"), out var __jsonRecoveryPointHistoryInMinutes) ? (int?)__jsonRecoveryPointHistoryInMinutes : RecoveryPointHistoryInMinute;} + {_crashConsistentFrequencyInMinute = If( json?.PropertyT("crashConsistentFrequencyInMinutes"), out var __jsonCrashConsistentFrequencyInMinutes) ? (int?)__jsonCrashConsistentFrequencyInMinutes : CrashConsistentFrequencyInMinute;} + {_appConsistentFrequencyInMinute = If( json?.PropertyT("appConsistentFrequencyInMinutes"), out var __jsonAppConsistentFrequencyInMinutes) ? (int?)__jsonAppConsistentFrequencyInMinutes : AppConsistentFrequencyInMinute;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtProtectedDiskDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtProtectedDiskDetails.PowerShell.cs new file mode 100644 index 000000000000..2ac20cb4f930 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtProtectedDiskDetails.PowerShell.cs @@ -0,0 +1,250 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// VMwareCbt protected disk details. + [System.ComponentModel.TypeConverter(typeof(VMwareCbtProtectedDiskDetailsTypeConverter))] + public partial class VMwareCbtProtectedDiskDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectedDiskDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VMwareCbtProtectedDiskDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectedDiskDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VMwareCbtProtectedDiskDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectedDiskDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VMwareCbtProtectedDiskDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DiskId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectedDiskDetailsInternal)this).DiskId = (string) content.GetValueForProperty("DiskId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectedDiskDetailsInternal)this).DiskId, global::System.Convert.ToString); + } + if (content.Contains("DiskName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectedDiskDetailsInternal)this).DiskName = (string) content.GetValueForProperty("DiskName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectedDiskDetailsInternal)this).DiskName, global::System.Convert.ToString); + } + if (content.Contains("DiskType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectedDiskDetailsInternal)this).DiskType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskAccountType?) content.GetValueForProperty("DiskType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectedDiskDetailsInternal)this).DiskType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskAccountType.CreateFrom); + } + if (content.Contains("DiskPath")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectedDiskDetailsInternal)this).DiskPath = (string) content.GetValueForProperty("DiskPath",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectedDiskDetailsInternal)this).DiskPath, global::System.Convert.ToString); + } + if (content.Contains("IsOSDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectedDiskDetailsInternal)this).IsOSDisk = (string) content.GetValueForProperty("IsOSDisk",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectedDiskDetailsInternal)this).IsOSDisk, global::System.Convert.ToString); + } + if (content.Contains("CapacityInByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectedDiskDetailsInternal)this).CapacityInByte = (long?) content.GetValueForProperty("CapacityInByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectedDiskDetailsInternal)this).CapacityInByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("LogStorageAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectedDiskDetailsInternal)this).LogStorageAccountId = (string) content.GetValueForProperty("LogStorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectedDiskDetailsInternal)this).LogStorageAccountId, global::System.Convert.ToString); + } + if (content.Contains("LogStorageAccountSasSecretName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectedDiskDetailsInternal)this).LogStorageAccountSasSecretName = (string) content.GetValueForProperty("LogStorageAccountSasSecretName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectedDiskDetailsInternal)this).LogStorageAccountSasSecretName, global::System.Convert.ToString); + } + if (content.Contains("DiskEncryptionSetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectedDiskDetailsInternal)this).DiskEncryptionSetId = (string) content.GetValueForProperty("DiskEncryptionSetId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectedDiskDetailsInternal)this).DiskEncryptionSetId, global::System.Convert.ToString); + } + if (content.Contains("SeedManagedDiskId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectedDiskDetailsInternal)this).SeedManagedDiskId = (string) content.GetValueForProperty("SeedManagedDiskId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectedDiskDetailsInternal)this).SeedManagedDiskId, global::System.Convert.ToString); + } + if (content.Contains("SeedBlobUri")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectedDiskDetailsInternal)this).SeedBlobUri = (string) content.GetValueForProperty("SeedBlobUri",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectedDiskDetailsInternal)this).SeedBlobUri, global::System.Convert.ToString); + } + if (content.Contains("TargetManagedDiskId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectedDiskDetailsInternal)this).TargetManagedDiskId = (string) content.GetValueForProperty("TargetManagedDiskId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectedDiskDetailsInternal)this).TargetManagedDiskId, global::System.Convert.ToString); + } + if (content.Contains("TargetBlobUri")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectedDiskDetailsInternal)this).TargetBlobUri = (string) content.GetValueForProperty("TargetBlobUri",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectedDiskDetailsInternal)this).TargetBlobUri, global::System.Convert.ToString); + } + if (content.Contains("TargetDiskName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectedDiskDetailsInternal)this).TargetDiskName = (string) content.GetValueForProperty("TargetDiskName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectedDiskDetailsInternal)this).TargetDiskName, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal VMwareCbtProtectedDiskDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DiskId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectedDiskDetailsInternal)this).DiskId = (string) content.GetValueForProperty("DiskId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectedDiskDetailsInternal)this).DiskId, global::System.Convert.ToString); + } + if (content.Contains("DiskName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectedDiskDetailsInternal)this).DiskName = (string) content.GetValueForProperty("DiskName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectedDiskDetailsInternal)this).DiskName, global::System.Convert.ToString); + } + if (content.Contains("DiskType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectedDiskDetailsInternal)this).DiskType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskAccountType?) content.GetValueForProperty("DiskType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectedDiskDetailsInternal)this).DiskType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskAccountType.CreateFrom); + } + if (content.Contains("DiskPath")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectedDiskDetailsInternal)this).DiskPath = (string) content.GetValueForProperty("DiskPath",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectedDiskDetailsInternal)this).DiskPath, global::System.Convert.ToString); + } + if (content.Contains("IsOSDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectedDiskDetailsInternal)this).IsOSDisk = (string) content.GetValueForProperty("IsOSDisk",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectedDiskDetailsInternal)this).IsOSDisk, global::System.Convert.ToString); + } + if (content.Contains("CapacityInByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectedDiskDetailsInternal)this).CapacityInByte = (long?) content.GetValueForProperty("CapacityInByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectedDiskDetailsInternal)this).CapacityInByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("LogStorageAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectedDiskDetailsInternal)this).LogStorageAccountId = (string) content.GetValueForProperty("LogStorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectedDiskDetailsInternal)this).LogStorageAccountId, global::System.Convert.ToString); + } + if (content.Contains("LogStorageAccountSasSecretName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectedDiskDetailsInternal)this).LogStorageAccountSasSecretName = (string) content.GetValueForProperty("LogStorageAccountSasSecretName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectedDiskDetailsInternal)this).LogStorageAccountSasSecretName, global::System.Convert.ToString); + } + if (content.Contains("DiskEncryptionSetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectedDiskDetailsInternal)this).DiskEncryptionSetId = (string) content.GetValueForProperty("DiskEncryptionSetId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectedDiskDetailsInternal)this).DiskEncryptionSetId, global::System.Convert.ToString); + } + if (content.Contains("SeedManagedDiskId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectedDiskDetailsInternal)this).SeedManagedDiskId = (string) content.GetValueForProperty("SeedManagedDiskId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectedDiskDetailsInternal)this).SeedManagedDiskId, global::System.Convert.ToString); + } + if (content.Contains("SeedBlobUri")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectedDiskDetailsInternal)this).SeedBlobUri = (string) content.GetValueForProperty("SeedBlobUri",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectedDiskDetailsInternal)this).SeedBlobUri, global::System.Convert.ToString); + } + if (content.Contains("TargetManagedDiskId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectedDiskDetailsInternal)this).TargetManagedDiskId = (string) content.GetValueForProperty("TargetManagedDiskId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectedDiskDetailsInternal)this).TargetManagedDiskId, global::System.Convert.ToString); + } + if (content.Contains("TargetBlobUri")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectedDiskDetailsInternal)this).TargetBlobUri = (string) content.GetValueForProperty("TargetBlobUri",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectedDiskDetailsInternal)this).TargetBlobUri, global::System.Convert.ToString); + } + if (content.Contains("TargetDiskName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectedDiskDetailsInternal)this).TargetDiskName = (string) content.GetValueForProperty("TargetDiskName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectedDiskDetailsInternal)this).TargetDiskName, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + } + /// VMwareCbt protected disk details. + [System.ComponentModel.TypeConverter(typeof(VMwareCbtProtectedDiskDetailsTypeConverter))] + public partial interface IVMwareCbtProtectedDiskDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtProtectedDiskDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtProtectedDiskDetails.TypeConverter.cs new file mode 100644 index 000000000000..8d556b34220c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtProtectedDiskDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VMwareCbtProtectedDiskDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectedDiskDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectedDiskDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VMwareCbtProtectedDiskDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VMwareCbtProtectedDiskDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VMwareCbtProtectedDiskDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtProtectedDiskDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtProtectedDiskDetails.cs new file mode 100644 index 000000000000..958c8467c183 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtProtectedDiskDetails.cs @@ -0,0 +1,308 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// VMwareCbt protected disk details. + public partial class VMwareCbtProtectedDiskDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectedDiskDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectedDiskDetailsInternal + { + + /// Backing field for property. + private long? _capacityInByte; + + /// The disk capacity in bytes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public long? CapacityInByte { get => this._capacityInByte; } + + /// Backing field for property. + private string _diskEncryptionSetId; + + /// The DiskEncryptionSet ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string DiskEncryptionSetId { get => this._diskEncryptionSetId; } + + /// Backing field for property. + private string _diskId; + + /// The disk id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string DiskId { get => this._diskId; } + + /// Backing field for property. + private string _diskName; + + /// The disk name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string DiskName { get => this._diskName; } + + /// Backing field for property. + private string _diskPath; + + /// The disk path. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string DiskPath { get => this._diskPath; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskAccountType? _diskType; + + /// The disk type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskAccountType? DiskType { get => this._diskType; set => this._diskType = value; } + + /// Backing field for property. + private string _isOSDisk; + + /// A value indicating whether the disk is the OS disk. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string IsOSDisk { get => this._isOSDisk; } + + /// Backing field for property. + private string _logStorageAccountId; + + /// The log storage account ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string LogStorageAccountId { get => this._logStorageAccountId; } + + /// Backing field for property. + private string _logStorageAccountSasSecretName; + + /// The key vault secret name of the log storage account. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string LogStorageAccountSasSecretName { get => this._logStorageAccountSasSecretName; } + + /// Internal Acessors for CapacityInByte + long? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectedDiskDetailsInternal.CapacityInByte { get => this._capacityInByte; set { {_capacityInByte = value;} } } + + /// Internal Acessors for DiskEncryptionSetId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectedDiskDetailsInternal.DiskEncryptionSetId { get => this._diskEncryptionSetId; set { {_diskEncryptionSetId = value;} } } + + /// Internal Acessors for DiskId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectedDiskDetailsInternal.DiskId { get => this._diskId; set { {_diskId = value;} } } + + /// Internal Acessors for DiskName + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectedDiskDetailsInternal.DiskName { get => this._diskName; set { {_diskName = value;} } } + + /// Internal Acessors for DiskPath + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectedDiskDetailsInternal.DiskPath { get => this._diskPath; set { {_diskPath = value;} } } + + /// Internal Acessors for IsOSDisk + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectedDiskDetailsInternal.IsOSDisk { get => this._isOSDisk; set { {_isOSDisk = value;} } } + + /// Internal Acessors for LogStorageAccountId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectedDiskDetailsInternal.LogStorageAccountId { get => this._logStorageAccountId; set { {_logStorageAccountId = value;} } } + + /// Internal Acessors for LogStorageAccountSasSecretName + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectedDiskDetailsInternal.LogStorageAccountSasSecretName { get => this._logStorageAccountSasSecretName; set { {_logStorageAccountSasSecretName = value;} } } + + /// Internal Acessors for SeedBlobUri + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectedDiskDetailsInternal.SeedBlobUri { get => this._seedBlobUri; set { {_seedBlobUri = value;} } } + + /// Internal Acessors for SeedManagedDiskId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectedDiskDetailsInternal.SeedManagedDiskId { get => this._seedManagedDiskId; set { {_seedManagedDiskId = value;} } } + + /// Internal Acessors for TargetBlobUri + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectedDiskDetailsInternal.TargetBlobUri { get => this._targetBlobUri; set { {_targetBlobUri = value;} } } + + /// Internal Acessors for TargetManagedDiskId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectedDiskDetailsInternal.TargetManagedDiskId { get => this._targetManagedDiskId; set { {_targetManagedDiskId = value;} } } + + /// Backing field for property. + private string _seedBlobUri; + + /// The uri of the seed blob. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string SeedBlobUri { get => this._seedBlobUri; } + + /// Backing field for property. + private string _seedManagedDiskId; + + /// The ARM Id of the seed managed disk. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string SeedManagedDiskId { get => this._seedManagedDiskId; } + + /// Backing field for property. + private string _targetBlobUri; + + /// The uri of the target blob. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetBlobUri { get => this._targetBlobUri; } + + /// Backing field for property. + private string _targetDiskName; + + /// The name for the target managed disk. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetDiskName { get => this._targetDiskName; set => this._targetDiskName = value; } + + /// Backing field for property. + private string _targetManagedDiskId; + + /// The ARM Id of the target managed disk. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetManagedDiskId { get => this._targetManagedDiskId; } + + /// Creates an new instance. + public VMwareCbtProtectedDiskDetails() + { + + } + } + /// VMwareCbt protected disk details. + public partial interface IVMwareCbtProtectedDiskDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The disk capacity in bytes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The disk capacity in bytes.", + SerializedName = @"capacityInBytes", + PossibleTypes = new [] { typeof(long) })] + long? CapacityInByte { get; } + /// The DiskEncryptionSet ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The DiskEncryptionSet ARM Id.", + SerializedName = @"diskEncryptionSetId", + PossibleTypes = new [] { typeof(string) })] + string DiskEncryptionSetId { get; } + /// The disk id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The disk id.", + SerializedName = @"diskId", + PossibleTypes = new [] { typeof(string) })] + string DiskId { get; } + /// The disk name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The disk name.", + SerializedName = @"diskName", + PossibleTypes = new [] { typeof(string) })] + string DiskName { get; } + /// The disk path. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The disk path.", + SerializedName = @"diskPath", + PossibleTypes = new [] { typeof(string) })] + string DiskPath { get; } + /// The disk type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The disk type.", + SerializedName = @"diskType", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskAccountType) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskAccountType? DiskType { get; set; } + /// A value indicating whether the disk is the OS disk. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"A value indicating whether the disk is the OS disk.", + SerializedName = @"isOSDisk", + PossibleTypes = new [] { typeof(string) })] + string IsOSDisk { get; } + /// The log storage account ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The log storage account ARM Id.", + SerializedName = @"logStorageAccountId", + PossibleTypes = new [] { typeof(string) })] + string LogStorageAccountId { get; } + /// The key vault secret name of the log storage account. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The key vault secret name of the log storage account.", + SerializedName = @"logStorageAccountSasSecretName", + PossibleTypes = new [] { typeof(string) })] + string LogStorageAccountSasSecretName { get; } + /// The uri of the seed blob. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The uri of the seed blob.", + SerializedName = @"seedBlobUri", + PossibleTypes = new [] { typeof(string) })] + string SeedBlobUri { get; } + /// The ARM Id of the seed managed disk. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The ARM Id of the seed managed disk.", + SerializedName = @"seedManagedDiskId", + PossibleTypes = new [] { typeof(string) })] + string SeedManagedDiskId { get; } + /// The uri of the target blob. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The uri of the target blob.", + SerializedName = @"targetBlobUri", + PossibleTypes = new [] { typeof(string) })] + string TargetBlobUri { get; } + /// The name for the target managed disk. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name for the target managed disk.", + SerializedName = @"targetDiskName", + PossibleTypes = new [] { typeof(string) })] + string TargetDiskName { get; set; } + /// The ARM Id of the target managed disk. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The ARM Id of the target managed disk.", + SerializedName = @"targetManagedDiskId", + PossibleTypes = new [] { typeof(string) })] + string TargetManagedDiskId { get; } + + } + /// VMwareCbt protected disk details. + internal partial interface IVMwareCbtProtectedDiskDetailsInternal + + { + /// The disk capacity in bytes. + long? CapacityInByte { get; set; } + /// The DiskEncryptionSet ARM Id. + string DiskEncryptionSetId { get; set; } + /// The disk id. + string DiskId { get; set; } + /// The disk name. + string DiskName { get; set; } + /// The disk path. + string DiskPath { get; set; } + /// The disk type. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskAccountType? DiskType { get; set; } + /// A value indicating whether the disk is the OS disk. + string IsOSDisk { get; set; } + /// The log storage account ARM Id. + string LogStorageAccountId { get; set; } + /// The key vault secret name of the log storage account. + string LogStorageAccountSasSecretName { get; set; } + /// The uri of the seed blob. + string SeedBlobUri { get; set; } + /// The ARM Id of the seed managed disk. + string SeedManagedDiskId { get; set; } + /// The uri of the target blob. + string TargetBlobUri { get; set; } + /// The name for the target managed disk. + string TargetDiskName { get; set; } + /// The ARM Id of the target managed disk. + string TargetManagedDiskId { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtProtectedDiskDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtProtectedDiskDetails.json.cs new file mode 100644 index 000000000000..f98774530aab --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtProtectedDiskDetails.json.cs @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// VMwareCbt protected disk details. + public partial class VMwareCbtProtectedDiskDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectedDiskDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectedDiskDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectedDiskDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new VMwareCbtProtectedDiskDetails(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._diskId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._diskId.ToString()) : null, "diskId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._diskName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._diskName.ToString()) : null, "diskName" ,container.Add ); + } + AddIf( null != (((object)this._diskType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._diskType.ToString()) : null, "diskType" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._diskPath)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._diskPath.ToString()) : null, "diskPath" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._isOSDisk)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._isOSDisk.ToString()) : null, "isOSDisk" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._capacityInByte ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((long)this._capacityInByte) : null, "capacityInBytes" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._logStorageAccountId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._logStorageAccountId.ToString()) : null, "logStorageAccountId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._logStorageAccountSasSecretName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._logStorageAccountSasSecretName.ToString()) : null, "logStorageAccountSasSecretName" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._diskEncryptionSetId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._diskEncryptionSetId.ToString()) : null, "diskEncryptionSetId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._seedManagedDiskId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._seedManagedDiskId.ToString()) : null, "seedManagedDiskId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._seedBlobUri)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._seedBlobUri.ToString()) : null, "seedBlobUri" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._targetManagedDiskId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetManagedDiskId.ToString()) : null, "targetManagedDiskId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._targetBlobUri)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetBlobUri.ToString()) : null, "targetBlobUri" ,container.Add ); + } + AddIf( null != (((object)this._targetDiskName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetDiskName.ToString()) : null, "targetDiskName" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal VMwareCbtProtectedDiskDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_diskId = If( json?.PropertyT("diskId"), out var __jsonDiskId) ? (string)__jsonDiskId : (string)DiskId;} + {_diskName = If( json?.PropertyT("diskName"), out var __jsonDiskName) ? (string)__jsonDiskName : (string)DiskName;} + {_diskType = If( json?.PropertyT("diskType"), out var __jsonDiskType) ? (string)__jsonDiskType : (string)DiskType;} + {_diskPath = If( json?.PropertyT("diskPath"), out var __jsonDiskPath) ? (string)__jsonDiskPath : (string)DiskPath;} + {_isOSDisk = If( json?.PropertyT("isOSDisk"), out var __jsonIsOSDisk) ? (string)__jsonIsOSDisk : (string)IsOSDisk;} + {_capacityInByte = If( json?.PropertyT("capacityInBytes"), out var __jsonCapacityInBytes) ? (long?)__jsonCapacityInBytes : CapacityInByte;} + {_logStorageAccountId = If( json?.PropertyT("logStorageAccountId"), out var __jsonLogStorageAccountId) ? (string)__jsonLogStorageAccountId : (string)LogStorageAccountId;} + {_logStorageAccountSasSecretName = If( json?.PropertyT("logStorageAccountSasSecretName"), out var __jsonLogStorageAccountSasSecretName) ? (string)__jsonLogStorageAccountSasSecretName : (string)LogStorageAccountSasSecretName;} + {_diskEncryptionSetId = If( json?.PropertyT("diskEncryptionSetId"), out var __jsonDiskEncryptionSetId) ? (string)__jsonDiskEncryptionSetId : (string)DiskEncryptionSetId;} + {_seedManagedDiskId = If( json?.PropertyT("seedManagedDiskId"), out var __jsonSeedManagedDiskId) ? (string)__jsonSeedManagedDiskId : (string)SeedManagedDiskId;} + {_seedBlobUri = If( json?.PropertyT("seedBlobUri"), out var __jsonSeedBlobUri) ? (string)__jsonSeedBlobUri : (string)SeedBlobUri;} + {_targetManagedDiskId = If( json?.PropertyT("targetManagedDiskId"), out var __jsonTargetManagedDiskId) ? (string)__jsonTargetManagedDiskId : (string)TargetManagedDiskId;} + {_targetBlobUri = If( json?.PropertyT("targetBlobUri"), out var __jsonTargetBlobUri) ? (string)__jsonTargetBlobUri : (string)TargetBlobUri;} + {_targetDiskName = If( json?.PropertyT("targetDiskName"), out var __jsonTargetDiskName) ? (string)__jsonTargetDiskName : (string)TargetDiskName;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtProtectionContainerMappingDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtProtectionContainerMappingDetails.PowerShell.cs new file mode 100644 index 000000000000..4d2253ecaf6c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtProtectionContainerMappingDetails.PowerShell.cs @@ -0,0 +1,205 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// VMwareCbt provider specific container mapping details. + [System.ComponentModel.TypeConverter(typeof(VMwareCbtProtectionContainerMappingDetailsTypeConverter))] + public partial class VMwareCbtProtectionContainerMappingDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectionContainerMappingDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VMwareCbtProtectionContainerMappingDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectionContainerMappingDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VMwareCbtProtectionContainerMappingDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a + /// json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectionContainerMappingDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VMwareCbtProtectionContainerMappingDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("KeyVaultId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectionContainerMappingDetailsInternal)this).KeyVaultId = (string) content.GetValueForProperty("KeyVaultId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectionContainerMappingDetailsInternal)this).KeyVaultId, global::System.Convert.ToString); + } + if (content.Contains("KeyVaultUri")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectionContainerMappingDetailsInternal)this).KeyVaultUri = (string) content.GetValueForProperty("KeyVaultUri",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectionContainerMappingDetailsInternal)this).KeyVaultUri, global::System.Convert.ToString); + } + if (content.Contains("StorageAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectionContainerMappingDetailsInternal)this).StorageAccountId = (string) content.GetValueForProperty("StorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectionContainerMappingDetailsInternal)this).StorageAccountId, global::System.Convert.ToString); + } + if (content.Contains("StorageAccountSasSecretName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectionContainerMappingDetailsInternal)this).StorageAccountSasSecretName = (string) content.GetValueForProperty("StorageAccountSasSecretName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectionContainerMappingDetailsInternal)this).StorageAccountSasSecretName, global::System.Convert.ToString); + } + if (content.Contains("ServiceBusConnectionStringSecretName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectionContainerMappingDetailsInternal)this).ServiceBusConnectionStringSecretName = (string) content.GetValueForProperty("ServiceBusConnectionStringSecretName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectionContainerMappingDetailsInternal)this).ServiceBusConnectionStringSecretName, global::System.Convert.ToString); + } + if (content.Contains("TargetLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectionContainerMappingDetailsInternal)this).TargetLocation = (string) content.GetValueForProperty("TargetLocation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectionContainerMappingDetailsInternal)this).TargetLocation, global::System.Convert.ToString); + } + if (content.Contains("RoleSizeToNicCountMap")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectionContainerMappingDetailsInternal)this).RoleSizeToNicCountMap = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectionContainerMappingDetailsRoleSizeToNicCountMap) content.GetValueForProperty("RoleSizeToNicCountMap",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectionContainerMappingDetailsInternal)this).RoleSizeToNicCountMap, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtProtectionContainerMappingDetailsRoleSizeToNicCountMapTypeConverter.ConvertFrom); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingProviderSpecificDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingProviderSpecificDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal VMwareCbtProtectionContainerMappingDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("KeyVaultId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectionContainerMappingDetailsInternal)this).KeyVaultId = (string) content.GetValueForProperty("KeyVaultId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectionContainerMappingDetailsInternal)this).KeyVaultId, global::System.Convert.ToString); + } + if (content.Contains("KeyVaultUri")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectionContainerMappingDetailsInternal)this).KeyVaultUri = (string) content.GetValueForProperty("KeyVaultUri",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectionContainerMappingDetailsInternal)this).KeyVaultUri, global::System.Convert.ToString); + } + if (content.Contains("StorageAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectionContainerMappingDetailsInternal)this).StorageAccountId = (string) content.GetValueForProperty("StorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectionContainerMappingDetailsInternal)this).StorageAccountId, global::System.Convert.ToString); + } + if (content.Contains("StorageAccountSasSecretName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectionContainerMappingDetailsInternal)this).StorageAccountSasSecretName = (string) content.GetValueForProperty("StorageAccountSasSecretName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectionContainerMappingDetailsInternal)this).StorageAccountSasSecretName, global::System.Convert.ToString); + } + if (content.Contains("ServiceBusConnectionStringSecretName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectionContainerMappingDetailsInternal)this).ServiceBusConnectionStringSecretName = (string) content.GetValueForProperty("ServiceBusConnectionStringSecretName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectionContainerMappingDetailsInternal)this).ServiceBusConnectionStringSecretName, global::System.Convert.ToString); + } + if (content.Contains("TargetLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectionContainerMappingDetailsInternal)this).TargetLocation = (string) content.GetValueForProperty("TargetLocation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectionContainerMappingDetailsInternal)this).TargetLocation, global::System.Convert.ToString); + } + if (content.Contains("RoleSizeToNicCountMap")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectionContainerMappingDetailsInternal)this).RoleSizeToNicCountMap = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectionContainerMappingDetailsRoleSizeToNicCountMap) content.GetValueForProperty("RoleSizeToNicCountMap",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectionContainerMappingDetailsInternal)this).RoleSizeToNicCountMap, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtProtectionContainerMappingDetailsRoleSizeToNicCountMapTypeConverter.ConvertFrom); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingProviderSpecificDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingProviderSpecificDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + } + /// VMwareCbt provider specific container mapping details. + [System.ComponentModel.TypeConverter(typeof(VMwareCbtProtectionContainerMappingDetailsTypeConverter))] + public partial interface IVMwareCbtProtectionContainerMappingDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtProtectionContainerMappingDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtProtectionContainerMappingDetails.TypeConverter.cs new file mode 100644 index 000000000000..72b44a6d3811 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtProtectionContainerMappingDetails.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VMwareCbtProtectionContainerMappingDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectionContainerMappingDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectionContainerMappingDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VMwareCbtProtectionContainerMappingDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VMwareCbtProtectionContainerMappingDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VMwareCbtProtectionContainerMappingDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtProtectionContainerMappingDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtProtectionContainerMappingDetails.cs new file mode 100644 index 000000000000..e0a197326b35 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtProtectionContainerMappingDetails.cs @@ -0,0 +1,199 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// VMwareCbt provider specific container mapping details. + public partial class VMwareCbtProtectionContainerMappingDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectionContainerMappingDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectionContainerMappingDetailsInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingProviderSpecificDetails __protectionContainerMappingProviderSpecificDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProtectionContainerMappingProviderSpecificDetails(); + + /// Gets the class type. Overridden in derived classes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingProviderSpecificDetailsInternal)__protectionContainerMappingProviderSpecificDetails).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingProviderSpecificDetailsInternal)__protectionContainerMappingProviderSpecificDetails).InstanceType = value ; } + + /// Backing field for property. + private string _keyVaultId; + + /// The target key vault ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string KeyVaultId { get => this._keyVaultId; } + + /// Backing field for property. + private string _keyVaultUri; + + /// The target key vault URI. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string KeyVaultUri { get => this._keyVaultUri; } + + /// Internal Acessors for KeyVaultId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectionContainerMappingDetailsInternal.KeyVaultId { get => this._keyVaultId; set { {_keyVaultId = value;} } } + + /// Internal Acessors for KeyVaultUri + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectionContainerMappingDetailsInternal.KeyVaultUri { get => this._keyVaultUri; set { {_keyVaultUri = value;} } } + + /// Internal Acessors for RoleSizeToNicCountMap + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectionContainerMappingDetailsRoleSizeToNicCountMap Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectionContainerMappingDetailsInternal.RoleSizeToNicCountMap { get => (this._roleSizeToNicCountMap = this._roleSizeToNicCountMap ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtProtectionContainerMappingDetailsRoleSizeToNicCountMap()); set { {_roleSizeToNicCountMap = value;} } } + + /// Internal Acessors for ServiceBusConnectionStringSecretName + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectionContainerMappingDetailsInternal.ServiceBusConnectionStringSecretName { get => this._serviceBusConnectionStringSecretName; set { {_serviceBusConnectionStringSecretName = value;} } } + + /// Internal Acessors for StorageAccountId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectionContainerMappingDetailsInternal.StorageAccountId { get => this._storageAccountId; set { {_storageAccountId = value;} } } + + /// Internal Acessors for StorageAccountSasSecretName + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectionContainerMappingDetailsInternal.StorageAccountSasSecretName { get => this._storageAccountSasSecretName; set { {_storageAccountSasSecretName = value;} } } + + /// Internal Acessors for TargetLocation + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectionContainerMappingDetailsInternal.TargetLocation { get => this._targetLocation; set { {_targetLocation = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectionContainerMappingDetailsRoleSizeToNicCountMap _roleSizeToNicCountMap; + + /// The role size to NIC count map. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectionContainerMappingDetailsRoleSizeToNicCountMap RoleSizeToNicCountMap { get => (this._roleSizeToNicCountMap = this._roleSizeToNicCountMap ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtProtectionContainerMappingDetailsRoleSizeToNicCountMap()); } + + /// Backing field for property. + private string _serviceBusConnectionStringSecretName; + + /// The secret name of the service bus connection string. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ServiceBusConnectionStringSecretName { get => this._serviceBusConnectionStringSecretName; } + + /// Backing field for property. + private string _storageAccountId; + + /// The storage account ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string StorageAccountId { get => this._storageAccountId; } + + /// Backing field for property. + private string _storageAccountSasSecretName; + + /// The secret name of the storage account. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string StorageAccountSasSecretName { get => this._storageAccountSasSecretName; } + + /// Backing field for property. + private string _targetLocation; + + /// The target location. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetLocation { get => this._targetLocation; } + + /// + /// Creates an new instance. + /// + public VMwareCbtProtectionContainerMappingDetails() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__protectionContainerMappingProviderSpecificDetails), __protectionContainerMappingProviderSpecificDetails); + await eventListener.AssertObjectIsValid(nameof(__protectionContainerMappingProviderSpecificDetails), __protectionContainerMappingProviderSpecificDetails); + } + } + /// VMwareCbt provider specific container mapping details. + public partial interface IVMwareCbtProtectionContainerMappingDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingProviderSpecificDetails + { + /// The target key vault ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The target key vault ARM Id.", + SerializedName = @"keyVaultId", + PossibleTypes = new [] { typeof(string) })] + string KeyVaultId { get; } + /// The target key vault URI. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The target key vault URI.", + SerializedName = @"keyVaultUri", + PossibleTypes = new [] { typeof(string) })] + string KeyVaultUri { get; } + /// The role size to NIC count map. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The role size to NIC count map.", + SerializedName = @"roleSizeToNicCountMap", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectionContainerMappingDetailsRoleSizeToNicCountMap) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectionContainerMappingDetailsRoleSizeToNicCountMap RoleSizeToNicCountMap { get; } + /// The secret name of the service bus connection string. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The secret name of the service bus connection string.", + SerializedName = @"serviceBusConnectionStringSecretName", + PossibleTypes = new [] { typeof(string) })] + string ServiceBusConnectionStringSecretName { get; } + /// The storage account ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The storage account ARM Id.", + SerializedName = @"storageAccountId", + PossibleTypes = new [] { typeof(string) })] + string StorageAccountId { get; } + /// The secret name of the storage account. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The secret name of the storage account.", + SerializedName = @"storageAccountSasSecretName", + PossibleTypes = new [] { typeof(string) })] + string StorageAccountSasSecretName { get; } + /// The target location. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The target location.", + SerializedName = @"targetLocation", + PossibleTypes = new [] { typeof(string) })] + string TargetLocation { get; } + + } + /// VMwareCbt provider specific container mapping details. + internal partial interface IVMwareCbtProtectionContainerMappingDetailsInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingProviderSpecificDetailsInternal + { + /// The target key vault ARM Id. + string KeyVaultId { get; set; } + /// The target key vault URI. + string KeyVaultUri { get; set; } + /// The role size to NIC count map. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectionContainerMappingDetailsRoleSizeToNicCountMap RoleSizeToNicCountMap { get; set; } + /// The secret name of the service bus connection string. + string ServiceBusConnectionStringSecretName { get; set; } + /// The storage account ARM Id. + string StorageAccountId { get; set; } + /// The secret name of the storage account. + string StorageAccountSasSecretName { get; set; } + /// The target location. + string TargetLocation { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtProtectionContainerMappingDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtProtectionContainerMappingDetails.json.cs new file mode 100644 index 000000000000..3a75cb8c66ac --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtProtectionContainerMappingDetails.json.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// VMwareCbt provider specific container mapping details. + public partial class VMwareCbtProtectionContainerMappingDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectionContainerMappingDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectionContainerMappingDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectionContainerMappingDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new VMwareCbtProtectionContainerMappingDetails(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __protectionContainerMappingProviderSpecificDetails?.ToJson(container, serializationMode); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._keyVaultId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._keyVaultId.ToString()) : null, "keyVaultId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._keyVaultUri)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._keyVaultUri.ToString()) : null, "keyVaultUri" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._storageAccountId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._storageAccountId.ToString()) : null, "storageAccountId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._storageAccountSasSecretName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._storageAccountSasSecretName.ToString()) : null, "storageAccountSasSecretName" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._serviceBusConnectionStringSecretName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._serviceBusConnectionStringSecretName.ToString()) : null, "serviceBusConnectionStringSecretName" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._targetLocation)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetLocation.ToString()) : null, "targetLocation" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._roleSizeToNicCountMap ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._roleSizeToNicCountMap.ToJson(null,serializationMode) : null, "roleSizeToNicCountMap" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal VMwareCbtProtectionContainerMappingDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __protectionContainerMappingProviderSpecificDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProtectionContainerMappingProviderSpecificDetails(json); + {_keyVaultId = If( json?.PropertyT("keyVaultId"), out var __jsonKeyVaultId) ? (string)__jsonKeyVaultId : (string)KeyVaultId;} + {_keyVaultUri = If( json?.PropertyT("keyVaultUri"), out var __jsonKeyVaultUri) ? (string)__jsonKeyVaultUri : (string)KeyVaultUri;} + {_storageAccountId = If( json?.PropertyT("storageAccountId"), out var __jsonStorageAccountId) ? (string)__jsonStorageAccountId : (string)StorageAccountId;} + {_storageAccountSasSecretName = If( json?.PropertyT("storageAccountSasSecretName"), out var __jsonStorageAccountSasSecretName) ? (string)__jsonStorageAccountSasSecretName : (string)StorageAccountSasSecretName;} + {_serviceBusConnectionStringSecretName = If( json?.PropertyT("serviceBusConnectionStringSecretName"), out var __jsonServiceBusConnectionStringSecretName) ? (string)__jsonServiceBusConnectionStringSecretName : (string)ServiceBusConnectionStringSecretName;} + {_targetLocation = If( json?.PropertyT("targetLocation"), out var __jsonTargetLocation) ? (string)__jsonTargetLocation : (string)TargetLocation;} + {_roleSizeToNicCountMap = If( json?.PropertyT("roleSizeToNicCountMap"), out var __jsonRoleSizeToNicCountMap) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtProtectionContainerMappingDetailsRoleSizeToNicCountMap.FromJson(__jsonRoleSizeToNicCountMap) : RoleSizeToNicCountMap;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtProtectionContainerMappingDetailsRoleSizeToNicCountMap.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtProtectionContainerMappingDetailsRoleSizeToNicCountMap.PowerShell.cs new file mode 100644 index 000000000000..d0a5171831b3 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtProtectionContainerMappingDetailsRoleSizeToNicCountMap.PowerShell.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// The role size to NIC count map. + [System.ComponentModel.TypeConverter(typeof(VMwareCbtProtectionContainerMappingDetailsRoleSizeToNicCountMapTypeConverter))] + public partial class VMwareCbtProtectionContainerMappingDetailsRoleSizeToNicCountMap + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectionContainerMappingDetailsRoleSizeToNicCountMap DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VMwareCbtProtectionContainerMappingDetailsRoleSizeToNicCountMap(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectionContainerMappingDetailsRoleSizeToNicCountMap DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VMwareCbtProtectionContainerMappingDetailsRoleSizeToNicCountMap(content); + } + + /// + /// Creates a new instance of , deserializing + /// the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectionContainerMappingDetailsRoleSizeToNicCountMap FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VMwareCbtProtectionContainerMappingDetailsRoleSizeToNicCountMap(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal VMwareCbtProtectionContainerMappingDetailsRoleSizeToNicCountMap(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializePSObject(content); + } + } + /// The role size to NIC count map. + [System.ComponentModel.TypeConverter(typeof(VMwareCbtProtectionContainerMappingDetailsRoleSizeToNicCountMapTypeConverter))] + public partial interface IVMwareCbtProtectionContainerMappingDetailsRoleSizeToNicCountMap + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtProtectionContainerMappingDetailsRoleSizeToNicCountMap.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtProtectionContainerMappingDetailsRoleSizeToNicCountMap.TypeConverter.cs new file mode 100644 index 000000000000..c1a3df5219ef --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtProtectionContainerMappingDetailsRoleSizeToNicCountMap.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VMwareCbtProtectionContainerMappingDetailsRoleSizeToNicCountMapTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there + /// is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there + /// is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectionContainerMappingDetailsRoleSizeToNicCountMap ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectionContainerMappingDetailsRoleSizeToNicCountMap).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VMwareCbtProtectionContainerMappingDetailsRoleSizeToNicCountMap.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VMwareCbtProtectionContainerMappingDetailsRoleSizeToNicCountMap.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VMwareCbtProtectionContainerMappingDetailsRoleSizeToNicCountMap.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtProtectionContainerMappingDetailsRoleSizeToNicCountMap.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtProtectionContainerMappingDetailsRoleSizeToNicCountMap.cs new file mode 100644 index 000000000000..ccb492b81335 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtProtectionContainerMappingDetailsRoleSizeToNicCountMap.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The role size to NIC count map. + public partial class VMwareCbtProtectionContainerMappingDetailsRoleSizeToNicCountMap : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectionContainerMappingDetailsRoleSizeToNicCountMap, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectionContainerMappingDetailsRoleSizeToNicCountMapInternal + { + + /// + /// Creates an new instance. + /// + public VMwareCbtProtectionContainerMappingDetailsRoleSizeToNicCountMap() + { + + } + } + /// The role size to NIC count map. + public partial interface IVMwareCbtProtectionContainerMappingDetailsRoleSizeToNicCountMap : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray + { + + } + /// The role size to NIC count map. + internal partial interface IVMwareCbtProtectionContainerMappingDetailsRoleSizeToNicCountMapInternal + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtProtectionContainerMappingDetailsRoleSizeToNicCountMap.dictionary.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtProtectionContainerMappingDetailsRoleSizeToNicCountMap.dictionary.cs new file mode 100644 index 000000000000..c0cb147e8a84 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtProtectionContainerMappingDetailsRoleSizeToNicCountMap.dictionary.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + public partial class VMwareCbtProtectionContainerMappingDetailsRoleSizeToNicCountMap : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray + { + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + + int Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Values { get => __additionalProperties.Values; } + + public int this[global::System.String index] { get => __additionalProperties[index]; set => __additionalProperties[index] = value; } + + /// + /// + public void Add(global::System.String key, int value) => __additionalProperties.Add( key, value); + + public void Clear() => __additionalProperties.Clear(); + + /// + public bool ContainsKey(global::System.String key) => __additionalProperties.ContainsKey( key); + + /// + public void CopyFrom(global::System.Collections.IDictionary source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public void CopyFrom(global::System.Management.Automation.PSObject source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public bool Remove(global::System.String key) => __additionalProperties.Remove( key); + + /// + /// + public bool TryGetValue(global::System.String key, out int value) => __additionalProperties.TryGetValue( key, out value); + + /// + + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtProtectionContainerMappingDetailsRoleSizeToNicCountMap source) => source.__additionalProperties; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtProtectionContainerMappingDetailsRoleSizeToNicCountMap.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtProtectionContainerMappingDetailsRoleSizeToNicCountMap.json.cs new file mode 100644 index 000000000000..fb976e5b1783 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtProtectionContainerMappingDetailsRoleSizeToNicCountMap.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The role size to NIC count map. + public partial class VMwareCbtProtectionContainerMappingDetailsRoleSizeToNicCountMap + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectionContainerMappingDetailsRoleSizeToNicCountMap. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectionContainerMappingDetailsRoleSizeToNicCountMap. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtProtectionContainerMappingDetailsRoleSizeToNicCountMap FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new VMwareCbtProtectionContainerMappingDetailsRoleSizeToNicCountMap(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray)this).AdditionalProperties, container); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + /// + internal VMwareCbtProtectionContainerMappingDetailsRoleSizeToNicCountMap(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, global::System.Collections.Generic.HashSet exclusions = null) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray)this).AdditionalProperties, null ,exclusions ); + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtResumeReplicationInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtResumeReplicationInput.PowerShell.cs new file mode 100644 index 000000000000..95d92f8beb1b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtResumeReplicationInput.PowerShell.cs @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// VMwareCbt specific resume replication input. + [System.ComponentModel.TypeConverter(typeof(VMwareCbtResumeReplicationInputTypeConverter))] + public partial class VMwareCbtResumeReplicationInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtResumeReplicationInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VMwareCbtResumeReplicationInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtResumeReplicationInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VMwareCbtResumeReplicationInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtResumeReplicationInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VMwareCbtResumeReplicationInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DeleteMigrationResource")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtResumeReplicationInputInternal)this).DeleteMigrationResource = (string) content.GetValueForProperty("DeleteMigrationResource",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtResumeReplicationInputInternal)this).DeleteMigrationResource, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal VMwareCbtResumeReplicationInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DeleteMigrationResource")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtResumeReplicationInputInternal)this).DeleteMigrationResource = (string) content.GetValueForProperty("DeleteMigrationResource",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtResumeReplicationInputInternal)this).DeleteMigrationResource, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + } + /// VMwareCbt specific resume replication input. + [System.ComponentModel.TypeConverter(typeof(VMwareCbtResumeReplicationInputTypeConverter))] + public partial interface IVMwareCbtResumeReplicationInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtResumeReplicationInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtResumeReplicationInput.TypeConverter.cs new file mode 100644 index 000000000000..6d59330c3642 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtResumeReplicationInput.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VMwareCbtResumeReplicationInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtResumeReplicationInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtResumeReplicationInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VMwareCbtResumeReplicationInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VMwareCbtResumeReplicationInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VMwareCbtResumeReplicationInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtResumeReplicationInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtResumeReplicationInput.cs new file mode 100644 index 000000000000..1a9cc1c64247 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtResumeReplicationInput.cs @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// VMwareCbt specific resume replication input. + public partial class VMwareCbtResumeReplicationInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtResumeReplicationInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtResumeReplicationInputInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationProviderSpecificInput __resumeReplicationProviderSpecificInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ResumeReplicationProviderSpecificInput(); + + /// Backing field for property. + private string _deleteMigrationResource; + + /// A value indicating whether Migration resources to be deleted. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string DeleteMigrationResource { get => this._deleteMigrationResource; set => this._deleteMigrationResource = value; } + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationProviderSpecificInputInternal)__resumeReplicationProviderSpecificInput).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationProviderSpecificInputInternal)__resumeReplicationProviderSpecificInput).InstanceType = value ; } + + /// Creates an new instance. + public VMwareCbtResumeReplicationInput() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__resumeReplicationProviderSpecificInput), __resumeReplicationProviderSpecificInput); + await eventListener.AssertObjectIsValid(nameof(__resumeReplicationProviderSpecificInput), __resumeReplicationProviderSpecificInput); + } + } + /// VMwareCbt specific resume replication input. + public partial interface IVMwareCbtResumeReplicationInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationProviderSpecificInput + { + /// A value indicating whether Migration resources to be deleted. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether Migration resources to be deleted.", + SerializedName = @"deleteMigrationResources", + PossibleTypes = new [] { typeof(string) })] + string DeleteMigrationResource { get; set; } + + } + /// VMwareCbt specific resume replication input. + internal partial interface IVMwareCbtResumeReplicationInputInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationProviderSpecificInputInternal + { + /// A value indicating whether Migration resources to be deleted. + string DeleteMigrationResource { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtResumeReplicationInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtResumeReplicationInput.json.cs new file mode 100644 index 000000000000..98d2436ca45a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtResumeReplicationInput.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// VMwareCbt specific resume replication input. + public partial class VMwareCbtResumeReplicationInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtResumeReplicationInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtResumeReplicationInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtResumeReplicationInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new VMwareCbtResumeReplicationInput(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __resumeReplicationProviderSpecificInput?.ToJson(container, serializationMode); + AddIf( null != (((object)this._deleteMigrationResource)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._deleteMigrationResource.ToString()) : null, "deleteMigrationResources" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal VMwareCbtResumeReplicationInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __resumeReplicationProviderSpecificInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ResumeReplicationProviderSpecificInput(json); + {_deleteMigrationResource = If( json?.PropertyT("deleteMigrationResources"), out var __jsonDeleteMigrationResources) ? (string)__jsonDeleteMigrationResources : (string)DeleteMigrationResource;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtResyncInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtResyncInput.PowerShell.cs new file mode 100644 index 000000000000..525f12aabe4d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtResyncInput.PowerShell.cs @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// VMwareCbt specific resync input. + [System.ComponentModel.TypeConverter(typeof(VMwareCbtResyncInputTypeConverter))] + public partial class VMwareCbtResyncInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtResyncInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VMwareCbtResyncInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtResyncInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VMwareCbtResyncInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtResyncInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VMwareCbtResyncInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SkipCbtReset")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtResyncInputInternal)this).SkipCbtReset = (string) content.GetValueForProperty("SkipCbtReset",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtResyncInputInternal)this).SkipCbtReset, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal VMwareCbtResyncInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SkipCbtReset")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtResyncInputInternal)this).SkipCbtReset = (string) content.GetValueForProperty("SkipCbtReset",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtResyncInputInternal)this).SkipCbtReset, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + } + /// VMwareCbt specific resync input. + [System.ComponentModel.TypeConverter(typeof(VMwareCbtResyncInputTypeConverter))] + public partial interface IVMwareCbtResyncInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtResyncInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtResyncInput.TypeConverter.cs new file mode 100644 index 000000000000..c71874f5a15a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtResyncInput.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VMwareCbtResyncInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtResyncInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtResyncInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VMwareCbtResyncInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VMwareCbtResyncInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VMwareCbtResyncInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtResyncInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtResyncInput.cs new file mode 100644 index 000000000000..f64fc79ce796 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtResyncInput.cs @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// VMwareCbt specific resync input. + public partial class VMwareCbtResyncInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtResyncInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtResyncInputInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncProviderSpecificInput __resyncProviderSpecificInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ResyncProviderSpecificInput(); + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncProviderSpecificInputInternal)__resyncProviderSpecificInput).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncProviderSpecificInputInternal)__resyncProviderSpecificInput).InstanceType = value ; } + + /// Backing field for property. + private string _skipCbtReset; + + /// A value indicating whether CBT is to be reset. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string SkipCbtReset { get => this._skipCbtReset; set => this._skipCbtReset = value; } + + /// Creates an new instance. + public VMwareCbtResyncInput() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__resyncProviderSpecificInput), __resyncProviderSpecificInput); + await eventListener.AssertObjectIsValid(nameof(__resyncProviderSpecificInput), __resyncProviderSpecificInput); + } + } + /// VMwareCbt specific resync input. + public partial interface IVMwareCbtResyncInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncProviderSpecificInput + { + /// A value indicating whether CBT is to be reset. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"A value indicating whether CBT is to be reset.", + SerializedName = @"skipCbtReset", + PossibleTypes = new [] { typeof(string) })] + string SkipCbtReset { get; set; } + + } + /// VMwareCbt specific resync input. + internal partial interface IVMwareCbtResyncInputInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncProviderSpecificInputInternal + { + /// A value indicating whether CBT is to be reset. + string SkipCbtReset { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtResyncInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtResyncInput.json.cs new file mode 100644 index 000000000000..f9f9cc56dff6 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtResyncInput.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// VMwareCbt specific resync input. + public partial class VMwareCbtResyncInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtResyncInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtResyncInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtResyncInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new VMwareCbtResyncInput(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __resyncProviderSpecificInput?.ToJson(container, serializationMode); + AddIf( null != (((object)this._skipCbtReset)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._skipCbtReset.ToString()) : null, "skipCbtReset" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal VMwareCbtResyncInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __resyncProviderSpecificInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ResyncProviderSpecificInput(json); + {_skipCbtReset = If( json?.PropertyT("skipCbtReset"), out var __jsonSkipCbtReset) ? (string)__jsonSkipCbtReset : (string)SkipCbtReset;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtTestMigrateInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtTestMigrateInput.PowerShell.cs new file mode 100644 index 000000000000..62bd9077024e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtTestMigrateInput.PowerShell.cs @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// VMwareCbt specific test migrate input. + [System.ComponentModel.TypeConverter(typeof(VMwareCbtTestMigrateInputTypeConverter))] + public partial class VMwareCbtTestMigrateInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtTestMigrateInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VMwareCbtTestMigrateInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtTestMigrateInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VMwareCbtTestMigrateInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtTestMigrateInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VMwareCbtTestMigrateInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("RecoveryPointId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtTestMigrateInputInternal)this).RecoveryPointId = (string) content.GetValueForProperty("RecoveryPointId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtTestMigrateInputInternal)this).RecoveryPointId, global::System.Convert.ToString); + } + if (content.Contains("NetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtTestMigrateInputInternal)this).NetworkId = (string) content.GetValueForProperty("NetworkId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtTestMigrateInputInternal)this).NetworkId, global::System.Convert.ToString); + } + if (content.Contains("VMNic")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtTestMigrateInputInternal)this).VMNic = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicInput[]) content.GetValueForProperty("VMNic",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtTestMigrateInputInternal)this).VMNic, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtNicInputTypeConverter.ConvertFrom)); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal VMwareCbtTestMigrateInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("RecoveryPointId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtTestMigrateInputInternal)this).RecoveryPointId = (string) content.GetValueForProperty("RecoveryPointId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtTestMigrateInputInternal)this).RecoveryPointId, global::System.Convert.ToString); + } + if (content.Contains("NetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtTestMigrateInputInternal)this).NetworkId = (string) content.GetValueForProperty("NetworkId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtTestMigrateInputInternal)this).NetworkId, global::System.Convert.ToString); + } + if (content.Contains("VMNic")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtTestMigrateInputInternal)this).VMNic = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicInput[]) content.GetValueForProperty("VMNic",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtTestMigrateInputInternal)this).VMNic, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtNicInputTypeConverter.ConvertFrom)); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + } + /// VMwareCbt specific test migrate input. + [System.ComponentModel.TypeConverter(typeof(VMwareCbtTestMigrateInputTypeConverter))] + public partial interface IVMwareCbtTestMigrateInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtTestMigrateInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtTestMigrateInput.TypeConverter.cs new file mode 100644 index 000000000000..9d50ec21ebd4 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtTestMigrateInput.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VMwareCbtTestMigrateInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtTestMigrateInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtTestMigrateInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VMwareCbtTestMigrateInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VMwareCbtTestMigrateInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VMwareCbtTestMigrateInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtTestMigrateInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtTestMigrateInput.cs new file mode 100644 index 000000000000..2e8ae17438ac --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtTestMigrateInput.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// VMwareCbt specific test migrate input. + public partial class VMwareCbtTestMigrateInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtTestMigrateInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtTestMigrateInputInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateProviderSpecificInput __testMigrateProviderSpecificInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.TestMigrateProviderSpecificInput(); + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateProviderSpecificInputInternal)__testMigrateProviderSpecificInput).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateProviderSpecificInputInternal)__testMigrateProviderSpecificInput).InstanceType = value ; } + + /// Backing field for property. + private string _networkId; + + /// The test network Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string NetworkId { get => this._networkId; set => this._networkId = value; } + + /// Backing field for property. + private string _recoveryPointId; + + /// The recovery point Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryPointId { get => this._recoveryPointId; set => this._recoveryPointId = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicInput[] _vMNic; + + /// The list of NIC details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicInput[] VMNic { get => this._vMNic; set => this._vMNic = value; } + + /// Creates an new instance. + public VMwareCbtTestMigrateInput() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__testMigrateProviderSpecificInput), __testMigrateProviderSpecificInput); + await eventListener.AssertObjectIsValid(nameof(__testMigrateProviderSpecificInput), __testMigrateProviderSpecificInput); + } + } + /// VMwareCbt specific test migrate input. + public partial interface IVMwareCbtTestMigrateInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateProviderSpecificInput + { + /// The test network Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The test network Id.", + SerializedName = @"networkId", + PossibleTypes = new [] { typeof(string) })] + string NetworkId { get; set; } + /// The recovery point Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The recovery point Id.", + SerializedName = @"recoveryPointId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryPointId { get; set; } + /// The list of NIC details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of NIC details.", + SerializedName = @"vmNics", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicInput) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicInput[] VMNic { get; set; } + + } + /// VMwareCbt specific test migrate input. + internal partial interface IVMwareCbtTestMigrateInputInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateProviderSpecificInputInternal + { + /// The test network Id. + string NetworkId { get; set; } + /// The recovery point Id. + string RecoveryPointId { get; set; } + /// The list of NIC details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicInput[] VMNic { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtTestMigrateInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtTestMigrateInput.json.cs new file mode 100644 index 000000000000..7ddbbbddb8d8 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtTestMigrateInput.json.cs @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// VMwareCbt specific test migrate input. + public partial class VMwareCbtTestMigrateInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtTestMigrateInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtTestMigrateInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtTestMigrateInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new VMwareCbtTestMigrateInput(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __testMigrateProviderSpecificInput?.ToJson(container, serializationMode); + AddIf( null != (((object)this._recoveryPointId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryPointId.ToString()) : null, "recoveryPointId" ,container.Add ); + AddIf( null != (((object)this._networkId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._networkId.ToString()) : null, "networkId" ,container.Add ); + if (null != this._vMNic) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._vMNic ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("vmNics",__w); + } + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal VMwareCbtTestMigrateInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __testMigrateProviderSpecificInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.TestMigrateProviderSpecificInput(json); + {_recoveryPointId = If( json?.PropertyT("recoveryPointId"), out var __jsonRecoveryPointId) ? (string)__jsonRecoveryPointId : (string)RecoveryPointId;} + {_networkId = If( json?.PropertyT("networkId"), out var __jsonNetworkId) ? (string)__jsonNetworkId : (string)NetworkId;} + {_vMNic = If( json?.PropertyT("vmNics"), out var __jsonVMNics) ? If( __jsonVMNics as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicInput) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtNicInput.FromJson(__u) )) ))() : null : VMNic;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtUpdateDiskInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtUpdateDiskInput.PowerShell.cs new file mode 100644 index 000000000000..5034a84c94fc --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtUpdateDiskInput.PowerShell.cs @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// VMwareCbt disk input for update. + [System.ComponentModel.TypeConverter(typeof(VMwareCbtUpdateDiskInputTypeConverter))] + public partial class VMwareCbtUpdateDiskInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateDiskInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VMwareCbtUpdateDiskInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateDiskInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VMwareCbtUpdateDiskInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateDiskInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VMwareCbtUpdateDiskInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DiskId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateDiskInputInternal)this).DiskId = (string) content.GetValueForProperty("DiskId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateDiskInputInternal)this).DiskId, global::System.Convert.ToString); + } + if (content.Contains("TargetDiskName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateDiskInputInternal)this).TargetDiskName = (string) content.GetValueForProperty("TargetDiskName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateDiskInputInternal)this).TargetDiskName, global::System.Convert.ToString); + } + if (content.Contains("IsOSDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateDiskInputInternal)this).IsOSDisk = (string) content.GetValueForProperty("IsOSDisk",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateDiskInputInternal)this).IsOSDisk, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal VMwareCbtUpdateDiskInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DiskId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateDiskInputInternal)this).DiskId = (string) content.GetValueForProperty("DiskId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateDiskInputInternal)this).DiskId, global::System.Convert.ToString); + } + if (content.Contains("TargetDiskName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateDiskInputInternal)this).TargetDiskName = (string) content.GetValueForProperty("TargetDiskName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateDiskInputInternal)this).TargetDiskName, global::System.Convert.ToString); + } + if (content.Contains("IsOSDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateDiskInputInternal)this).IsOSDisk = (string) content.GetValueForProperty("IsOSDisk",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateDiskInputInternal)this).IsOSDisk, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + } + /// VMwareCbt disk input for update. + [System.ComponentModel.TypeConverter(typeof(VMwareCbtUpdateDiskInputTypeConverter))] + public partial interface IVMwareCbtUpdateDiskInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtUpdateDiskInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtUpdateDiskInput.TypeConverter.cs new file mode 100644 index 000000000000..75f83baf9442 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtUpdateDiskInput.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VMwareCbtUpdateDiskInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateDiskInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateDiskInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VMwareCbtUpdateDiskInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VMwareCbtUpdateDiskInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VMwareCbtUpdateDiskInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtUpdateDiskInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtUpdateDiskInput.cs new file mode 100644 index 000000000000..a4b5b23b97ca --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtUpdateDiskInput.cs @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// VMwareCbt disk input for update. + public partial class VMwareCbtUpdateDiskInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateDiskInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateDiskInputInternal + { + + /// Backing field for property. + private string _diskId; + + /// The disk Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string DiskId { get => this._diskId; set => this._diskId = value; } + + /// Backing field for property. + private string _isOSDisk; + + /// A value indicating whether the disk is the OS disk. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string IsOSDisk { get => this._isOSDisk; set => this._isOSDisk = value; } + + /// Backing field for property. + private string _targetDiskName; + + /// The target disk name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetDiskName { get => this._targetDiskName; set => this._targetDiskName = value; } + + /// Creates an new instance. + public VMwareCbtUpdateDiskInput() + { + + } + } + /// VMwareCbt disk input for update. + public partial interface IVMwareCbtUpdateDiskInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The disk Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The disk Id.", + SerializedName = @"diskId", + PossibleTypes = new [] { typeof(string) })] + string DiskId { get; set; } + /// A value indicating whether the disk is the OS disk. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether the disk is the OS disk.", + SerializedName = @"isOSDisk", + PossibleTypes = new [] { typeof(string) })] + string IsOSDisk { get; set; } + /// The target disk name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target disk name.", + SerializedName = @"targetDiskName", + PossibleTypes = new [] { typeof(string) })] + string TargetDiskName { get; set; } + + } + /// VMwareCbt disk input for update. + internal partial interface IVMwareCbtUpdateDiskInputInternal + + { + /// The disk Id. + string DiskId { get; set; } + /// A value indicating whether the disk is the OS disk. + string IsOSDisk { get; set; } + /// The target disk name. + string TargetDiskName { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtUpdateDiskInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtUpdateDiskInput.json.cs new file mode 100644 index 000000000000..e1fb023e721c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtUpdateDiskInput.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// VMwareCbt disk input for update. + public partial class VMwareCbtUpdateDiskInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateDiskInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateDiskInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateDiskInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new VMwareCbtUpdateDiskInput(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._diskId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._diskId.ToString()) : null, "diskId" ,container.Add ); + AddIf( null != (((object)this._targetDiskName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetDiskName.ToString()) : null, "targetDiskName" ,container.Add ); + AddIf( null != (((object)this._isOSDisk)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._isOSDisk.ToString()) : null, "isOSDisk" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal VMwareCbtUpdateDiskInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_diskId = If( json?.PropertyT("diskId"), out var __jsonDiskId) ? (string)__jsonDiskId : (string)DiskId;} + {_targetDiskName = If( json?.PropertyT("targetDiskName"), out var __jsonTargetDiskName) ? (string)__jsonTargetDiskName : (string)TargetDiskName;} + {_isOSDisk = If( json?.PropertyT("isOSDisk"), out var __jsonIsOSDisk) ? (string)__jsonIsOSDisk : (string)IsOSDisk;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtUpdateMigrationItemInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtUpdateMigrationItemInput.PowerShell.cs new file mode 100644 index 000000000000..f0fce9bd6778 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtUpdateMigrationItemInput.PowerShell.cs @@ -0,0 +1,284 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// VMwareCbt specific update migration item input. + [System.ComponentModel.TypeConverter(typeof(VMwareCbtUpdateMigrationItemInputTypeConverter))] + public partial class VMwareCbtUpdateMigrationItemInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VMwareCbtUpdateMigrationItemInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VMwareCbtUpdateMigrationItemInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VMwareCbtUpdateMigrationItemInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("TargetVMName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputInternal)this).TargetVMName = (string) content.GetValueForProperty("TargetVMName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputInternal)this).TargetVMName, global::System.Convert.ToString); + } + if (content.Contains("TargetVMSize")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputInternal)this).TargetVMSize = (string) content.GetValueForProperty("TargetVMSize",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputInternal)this).TargetVMSize, global::System.Convert.ToString); + } + if (content.Contains("TargetResourceGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputInternal)this).TargetResourceGroupId = (string) content.GetValueForProperty("TargetResourceGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputInternal)this).TargetResourceGroupId, global::System.Convert.ToString); + } + if (content.Contains("TargetAvailabilitySetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputInternal)this).TargetAvailabilitySetId = (string) content.GetValueForProperty("TargetAvailabilitySetId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputInternal)this).TargetAvailabilitySetId, global::System.Convert.ToString); + } + if (content.Contains("TargetAvailabilityZone")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputInternal)this).TargetAvailabilityZone = (string) content.GetValueForProperty("TargetAvailabilityZone",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputInternal)this).TargetAvailabilityZone, global::System.Convert.ToString); + } + if (content.Contains("TargetProximityPlacementGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputInternal)this).TargetProximityPlacementGroupId = (string) content.GetValueForProperty("TargetProximityPlacementGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputInternal)this).TargetProximityPlacementGroupId, global::System.Convert.ToString); + } + if (content.Contains("TargetBootDiagnosticsStorageAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputInternal)this).TargetBootDiagnosticsStorageAccountId = (string) content.GetValueForProperty("TargetBootDiagnosticsStorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputInternal)this).TargetBootDiagnosticsStorageAccountId, global::System.Convert.ToString); + } + if (content.Contains("TargetNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputInternal)this).TargetNetworkId = (string) content.GetValueForProperty("TargetNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputInternal)this).TargetNetworkId, global::System.Convert.ToString); + } + if (content.Contains("TestNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputInternal)this).TestNetworkId = (string) content.GetValueForProperty("TestNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputInternal)this).TestNetworkId, global::System.Convert.ToString); + } + if (content.Contains("VMNic")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputInternal)this).VMNic = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicInput[]) content.GetValueForProperty("VMNic",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputInternal)this).VMNic, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtNicInputTypeConverter.ConvertFrom)); + } + if (content.Contains("VMDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputInternal)this).VMDisk = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateDiskInput[]) content.GetValueForProperty("VMDisk",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputInternal)this).VMDisk, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtUpdateDiskInputTypeConverter.ConvertFrom)); + } + if (content.Contains("LicenseType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputInternal)this).LicenseType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.LicenseType?) content.GetValueForProperty("LicenseType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputInternal)this).LicenseType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.LicenseType.CreateFrom); + } + if (content.Contains("SqlServerLicenseType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputInternal)this).SqlServerLicenseType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SqlServerLicenseType?) content.GetValueForProperty("SqlServerLicenseType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputInternal)this).SqlServerLicenseType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SqlServerLicenseType.CreateFrom); + } + if (content.Contains("PerformAutoResync")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputInternal)this).PerformAutoResync = (string) content.GetValueForProperty("PerformAutoResync",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputInternal)this).PerformAutoResync, global::System.Convert.ToString); + } + if (content.Contains("TargetVMTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputInternal)this).TargetVMTag = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputTargetVmtags) content.GetValueForProperty("TargetVMTag",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputInternal)this).TargetVMTag, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtUpdateMigrationItemInputTargetVmtagsTypeConverter.ConvertFrom); + } + if (content.Contains("TargetDiskTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputInternal)this).TargetDiskTag = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputTargetDiskTags) content.GetValueForProperty("TargetDiskTag",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputInternal)this).TargetDiskTag, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtUpdateMigrationItemInputTargetDiskTagsTypeConverter.ConvertFrom); + } + if (content.Contains("TargetNicTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputInternal)this).TargetNicTag = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputTargetNicTags) content.GetValueForProperty("TargetNicTag",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputInternal)this).TargetNicTag, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtUpdateMigrationItemInputTargetNicTagsTypeConverter.ConvertFrom); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMigrationItemProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMigrationItemProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal VMwareCbtUpdateMigrationItemInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("TargetVMName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputInternal)this).TargetVMName = (string) content.GetValueForProperty("TargetVMName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputInternal)this).TargetVMName, global::System.Convert.ToString); + } + if (content.Contains("TargetVMSize")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputInternal)this).TargetVMSize = (string) content.GetValueForProperty("TargetVMSize",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputInternal)this).TargetVMSize, global::System.Convert.ToString); + } + if (content.Contains("TargetResourceGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputInternal)this).TargetResourceGroupId = (string) content.GetValueForProperty("TargetResourceGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputInternal)this).TargetResourceGroupId, global::System.Convert.ToString); + } + if (content.Contains("TargetAvailabilitySetId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputInternal)this).TargetAvailabilitySetId = (string) content.GetValueForProperty("TargetAvailabilitySetId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputInternal)this).TargetAvailabilitySetId, global::System.Convert.ToString); + } + if (content.Contains("TargetAvailabilityZone")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputInternal)this).TargetAvailabilityZone = (string) content.GetValueForProperty("TargetAvailabilityZone",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputInternal)this).TargetAvailabilityZone, global::System.Convert.ToString); + } + if (content.Contains("TargetProximityPlacementGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputInternal)this).TargetProximityPlacementGroupId = (string) content.GetValueForProperty("TargetProximityPlacementGroupId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputInternal)this).TargetProximityPlacementGroupId, global::System.Convert.ToString); + } + if (content.Contains("TargetBootDiagnosticsStorageAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputInternal)this).TargetBootDiagnosticsStorageAccountId = (string) content.GetValueForProperty("TargetBootDiagnosticsStorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputInternal)this).TargetBootDiagnosticsStorageAccountId, global::System.Convert.ToString); + } + if (content.Contains("TargetNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputInternal)this).TargetNetworkId = (string) content.GetValueForProperty("TargetNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputInternal)this).TargetNetworkId, global::System.Convert.ToString); + } + if (content.Contains("TestNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputInternal)this).TestNetworkId = (string) content.GetValueForProperty("TestNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputInternal)this).TestNetworkId, global::System.Convert.ToString); + } + if (content.Contains("VMNic")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputInternal)this).VMNic = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicInput[]) content.GetValueForProperty("VMNic",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputInternal)this).VMNic, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtNicInputTypeConverter.ConvertFrom)); + } + if (content.Contains("VMDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputInternal)this).VMDisk = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateDiskInput[]) content.GetValueForProperty("VMDisk",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputInternal)this).VMDisk, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtUpdateDiskInputTypeConverter.ConvertFrom)); + } + if (content.Contains("LicenseType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputInternal)this).LicenseType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.LicenseType?) content.GetValueForProperty("LicenseType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputInternal)this).LicenseType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.LicenseType.CreateFrom); + } + if (content.Contains("SqlServerLicenseType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputInternal)this).SqlServerLicenseType = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SqlServerLicenseType?) content.GetValueForProperty("SqlServerLicenseType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputInternal)this).SqlServerLicenseType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SqlServerLicenseType.CreateFrom); + } + if (content.Contains("PerformAutoResync")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputInternal)this).PerformAutoResync = (string) content.GetValueForProperty("PerformAutoResync",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputInternal)this).PerformAutoResync, global::System.Convert.ToString); + } + if (content.Contains("TargetVMTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputInternal)this).TargetVMTag = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputTargetVmtags) content.GetValueForProperty("TargetVMTag",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputInternal)this).TargetVMTag, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtUpdateMigrationItemInputTargetVmtagsTypeConverter.ConvertFrom); + } + if (content.Contains("TargetDiskTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputInternal)this).TargetDiskTag = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputTargetDiskTags) content.GetValueForProperty("TargetDiskTag",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputInternal)this).TargetDiskTag, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtUpdateMigrationItemInputTargetDiskTagsTypeConverter.ConvertFrom); + } + if (content.Contains("TargetNicTag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputInternal)this).TargetNicTag = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputTargetNicTags) content.GetValueForProperty("TargetNicTag",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputInternal)this).TargetNicTag, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtUpdateMigrationItemInputTargetNicTagsTypeConverter.ConvertFrom); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMigrationItemProviderSpecificInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMigrationItemProviderSpecificInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + } + /// VMwareCbt specific update migration item input. + [System.ComponentModel.TypeConverter(typeof(VMwareCbtUpdateMigrationItemInputTypeConverter))] + public partial interface IVMwareCbtUpdateMigrationItemInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtUpdateMigrationItemInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtUpdateMigrationItemInput.TypeConverter.cs new file mode 100644 index 000000000000..76ea28e61982 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtUpdateMigrationItemInput.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VMwareCbtUpdateMigrationItemInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VMwareCbtUpdateMigrationItemInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VMwareCbtUpdateMigrationItemInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VMwareCbtUpdateMigrationItemInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtUpdateMigrationItemInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtUpdateMigrationItemInput.cs new file mode 100644 index 000000000000..fae321f2519b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtUpdateMigrationItemInput.cs @@ -0,0 +1,348 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// VMwareCbt specific update migration item input. + public partial class VMwareCbtUpdateMigrationItemInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMigrationItemProviderSpecificInput __updateMigrationItemProviderSpecificInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateMigrationItemProviderSpecificInput(); + + /// The class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMigrationItemProviderSpecificInputInternal)__updateMigrationItemProviderSpecificInput).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMigrationItemProviderSpecificInputInternal)__updateMigrationItemProviderSpecificInput).InstanceType = value ; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.LicenseType? _licenseType; + + /// The license type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.LicenseType? LicenseType { get => this._licenseType; set => this._licenseType = value; } + + /// Backing field for property. + private string _performAutoResync; + + /// A value indicating whether auto resync is to be done. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string PerformAutoResync { get => this._performAutoResync; set => this._performAutoResync = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SqlServerLicenseType? _sqlServerLicenseType; + + /// The SQL Server license type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SqlServerLicenseType? SqlServerLicenseType { get => this._sqlServerLicenseType; set => this._sqlServerLicenseType = value; } + + /// Backing field for property. + private string _targetAvailabilitySetId; + + /// The target availability set ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetAvailabilitySetId { get => this._targetAvailabilitySetId; set => this._targetAvailabilitySetId = value; } + + /// Backing field for property. + private string _targetAvailabilityZone; + + /// The target availability zone. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetAvailabilityZone { get => this._targetAvailabilityZone; set => this._targetAvailabilityZone = value; } + + /// + /// Backing field for property. + /// + private string _targetBootDiagnosticsStorageAccountId; + + /// The target boot diagnostics storage account ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetBootDiagnosticsStorageAccountId { get => this._targetBootDiagnosticsStorageAccountId; set => this._targetBootDiagnosticsStorageAccountId = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputTargetDiskTags _targetDiskTag; + + /// The tags for the target disks. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputTargetDiskTags TargetDiskTag { get => (this._targetDiskTag = this._targetDiskTag ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtUpdateMigrationItemInputTargetDiskTags()); set => this._targetDiskTag = value; } + + /// Backing field for property. + private string _targetNetworkId; + + /// The target network ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetNetworkId { get => this._targetNetworkId; set => this._targetNetworkId = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputTargetNicTags _targetNicTag; + + /// The tags for the target NICs. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputTargetNicTags TargetNicTag { get => (this._targetNicTag = this._targetNicTag ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtUpdateMigrationItemInputTargetNicTags()); set => this._targetNicTag = value; } + + /// Backing field for property. + private string _targetProximityPlacementGroupId; + + /// The target proximity placement group ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetProximityPlacementGroupId { get => this._targetProximityPlacementGroupId; set => this._targetProximityPlacementGroupId = value; } + + /// Backing field for property. + private string _targetResourceGroupId; + + /// The target resource group ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetResourceGroupId { get => this._targetResourceGroupId; set => this._targetResourceGroupId = value; } + + /// Backing field for property. + private string _targetVMName; + + /// The target VM name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetVMName { get => this._targetVMName; set => this._targetVMName = value; } + + /// Backing field for property. + private string _targetVMSize; + + /// The target VM size. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TargetVMSize { get => this._targetVMSize; set => this._targetVMSize = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputTargetVmtags _targetVMTag; + + /// The target VM tags. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputTargetVmtags TargetVMTag { get => (this._targetVMTag = this._targetVMTag ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtUpdateMigrationItemInputTargetVmtags()); set => this._targetVMTag = value; } + + /// Backing field for property. + private string _testNetworkId; + + /// The test network ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string TestNetworkId { get => this._testNetworkId; set => this._testNetworkId = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateDiskInput[] _vMDisk; + + /// The list of disk update properties. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateDiskInput[] VMDisk { get => this._vMDisk; set => this._vMDisk = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicInput[] _vMNic; + + /// The list of NIC details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicInput[] VMNic { get => this._vMNic; set => this._vMNic = value; } + + /// Creates an new instance. + public VMwareCbtUpdateMigrationItemInput() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__updateMigrationItemProviderSpecificInput), __updateMigrationItemProviderSpecificInput); + await eventListener.AssertObjectIsValid(nameof(__updateMigrationItemProviderSpecificInput), __updateMigrationItemProviderSpecificInput); + } + } + /// VMwareCbt specific update migration item input. + public partial interface IVMwareCbtUpdateMigrationItemInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMigrationItemProviderSpecificInput + { + /// The license type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The license type.", + SerializedName = @"licenseType", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.LicenseType) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.LicenseType? LicenseType { get; set; } + /// A value indicating whether auto resync is to be done. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether auto resync is to be done.", + SerializedName = @"performAutoResync", + PossibleTypes = new [] { typeof(string) })] + string PerformAutoResync { get; set; } + /// The SQL Server license type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The SQL Server license type.", + SerializedName = @"sqlServerLicenseType", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SqlServerLicenseType) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SqlServerLicenseType? SqlServerLicenseType { get; set; } + /// The target availability set ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target availability set ARM Id.", + SerializedName = @"targetAvailabilitySetId", + PossibleTypes = new [] { typeof(string) })] + string TargetAvailabilitySetId { get; set; } + /// The target availability zone. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target availability zone.", + SerializedName = @"targetAvailabilityZone", + PossibleTypes = new [] { typeof(string) })] + string TargetAvailabilityZone { get; set; } + /// The target boot diagnostics storage account ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target boot diagnostics storage account ARM Id.", + SerializedName = @"targetBootDiagnosticsStorageAccountId", + PossibleTypes = new [] { typeof(string) })] + string TargetBootDiagnosticsStorageAccountId { get; set; } + /// The tags for the target disks. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The tags for the target disks.", + SerializedName = @"targetDiskTags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputTargetDiskTags) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputTargetDiskTags TargetDiskTag { get; set; } + /// The target network ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target network ARM Id.", + SerializedName = @"targetNetworkId", + PossibleTypes = new [] { typeof(string) })] + string TargetNetworkId { get; set; } + /// The tags for the target NICs. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The tags for the target NICs.", + SerializedName = @"targetNicTags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputTargetNicTags) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputTargetNicTags TargetNicTag { get; set; } + /// The target proximity placement group ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target proximity placement group ARM Id.", + SerializedName = @"targetProximityPlacementGroupId", + PossibleTypes = new [] { typeof(string) })] + string TargetProximityPlacementGroupId { get; set; } + /// The target resource group ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target resource group ARM Id.", + SerializedName = @"targetResourceGroupId", + PossibleTypes = new [] { typeof(string) })] + string TargetResourceGroupId { get; set; } + /// The target VM name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target VM name.", + SerializedName = @"targetVmName", + PossibleTypes = new [] { typeof(string) })] + string TargetVMName { get; set; } + /// The target VM size. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target VM size.", + SerializedName = @"targetVmSize", + PossibleTypes = new [] { typeof(string) })] + string TargetVMSize { get; set; } + /// The target VM tags. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target VM tags.", + SerializedName = @"targetVmTags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputTargetVmtags) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputTargetVmtags TargetVMTag { get; set; } + /// The test network ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The test network ARM Id.", + SerializedName = @"testNetworkId", + PossibleTypes = new [] { typeof(string) })] + string TestNetworkId { get; set; } + /// The list of disk update properties. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of disk update properties.", + SerializedName = @"vmDisks", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateDiskInput) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateDiskInput[] VMDisk { get; set; } + /// The list of NIC details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of NIC details.", + SerializedName = @"vmNics", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicInput) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicInput[] VMNic { get; set; } + + } + /// VMwareCbt specific update migration item input. + internal partial interface IVMwareCbtUpdateMigrationItemInputInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMigrationItemProviderSpecificInputInternal + { + /// The license type. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.LicenseType? LicenseType { get; set; } + /// A value indicating whether auto resync is to be done. + string PerformAutoResync { get; set; } + /// The SQL Server license type. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SqlServerLicenseType? SqlServerLicenseType { get; set; } + /// The target availability set ARM Id. + string TargetAvailabilitySetId { get; set; } + /// The target availability zone. + string TargetAvailabilityZone { get; set; } + /// The target boot diagnostics storage account ARM Id. + string TargetBootDiagnosticsStorageAccountId { get; set; } + /// The tags for the target disks. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputTargetDiskTags TargetDiskTag { get; set; } + /// The target network ARM Id. + string TargetNetworkId { get; set; } + /// The tags for the target NICs. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputTargetNicTags TargetNicTag { get; set; } + /// The target proximity placement group ARM Id. + string TargetProximityPlacementGroupId { get; set; } + /// The target resource group ARM Id. + string TargetResourceGroupId { get; set; } + /// The target VM name. + string TargetVMName { get; set; } + /// The target VM size. + string TargetVMSize { get; set; } + /// The target VM tags. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputTargetVmtags TargetVMTag { get; set; } + /// The test network ARM Id. + string TestNetworkId { get; set; } + /// The list of disk update properties. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateDiskInput[] VMDisk { get; set; } + /// The list of NIC details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicInput[] VMNic { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtUpdateMigrationItemInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtUpdateMigrationItemInput.json.cs new file mode 100644 index 000000000000..f2b0d1e5d850 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtUpdateMigrationItemInput.json.cs @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// VMwareCbt specific update migration item input. + public partial class VMwareCbtUpdateMigrationItemInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new VMwareCbtUpdateMigrationItemInput(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __updateMigrationItemProviderSpecificInput?.ToJson(container, serializationMode); + AddIf( null != (((object)this._targetVMName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetVMName.ToString()) : null, "targetVmName" ,container.Add ); + AddIf( null != (((object)this._targetVMSize)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetVMSize.ToString()) : null, "targetVmSize" ,container.Add ); + AddIf( null != (((object)this._targetResourceGroupId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetResourceGroupId.ToString()) : null, "targetResourceGroupId" ,container.Add ); + AddIf( null != (((object)this._targetAvailabilitySetId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetAvailabilitySetId.ToString()) : null, "targetAvailabilitySetId" ,container.Add ); + AddIf( null != (((object)this._targetAvailabilityZone)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetAvailabilityZone.ToString()) : null, "targetAvailabilityZone" ,container.Add ); + AddIf( null != (((object)this._targetProximityPlacementGroupId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetProximityPlacementGroupId.ToString()) : null, "targetProximityPlacementGroupId" ,container.Add ); + AddIf( null != (((object)this._targetBootDiagnosticsStorageAccountId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetBootDiagnosticsStorageAccountId.ToString()) : null, "targetBootDiagnosticsStorageAccountId" ,container.Add ); + AddIf( null != (((object)this._targetNetworkId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._targetNetworkId.ToString()) : null, "targetNetworkId" ,container.Add ); + AddIf( null != (((object)this._testNetworkId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._testNetworkId.ToString()) : null, "testNetworkId" ,container.Add ); + if (null != this._vMNic) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._vMNic ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("vmNics",__w); + } + if (null != this._vMDisk) + { + var __r = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __s in this._vMDisk ) + { + AddIf(__s?.ToJson(null, serializationMode) ,__r.Add); + } + container.Add("vmDisks",__r); + } + AddIf( null != (((object)this._licenseType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._licenseType.ToString()) : null, "licenseType" ,container.Add ); + AddIf( null != (((object)this._sqlServerLicenseType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._sqlServerLicenseType.ToString()) : null, "sqlServerLicenseType" ,container.Add ); + AddIf( null != (((object)this._performAutoResync)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._performAutoResync.ToString()) : null, "performAutoResync" ,container.Add ); + AddIf( null != this._targetVMTag ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._targetVMTag.ToJson(null,serializationMode) : null, "targetVmTags" ,container.Add ); + AddIf( null != this._targetDiskTag ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._targetDiskTag.ToJson(null,serializationMode) : null, "targetDiskTags" ,container.Add ); + AddIf( null != this._targetNicTag ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._targetNicTag.ToJson(null,serializationMode) : null, "targetNicTags" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal VMwareCbtUpdateMigrationItemInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __updateMigrationItemProviderSpecificInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateMigrationItemProviderSpecificInput(json); + {_targetVMName = If( json?.PropertyT("targetVmName"), out var __jsonTargetVMName) ? (string)__jsonTargetVMName : (string)TargetVMName;} + {_targetVMSize = If( json?.PropertyT("targetVmSize"), out var __jsonTargetVMSize) ? (string)__jsonTargetVMSize : (string)TargetVMSize;} + {_targetResourceGroupId = If( json?.PropertyT("targetResourceGroupId"), out var __jsonTargetResourceGroupId) ? (string)__jsonTargetResourceGroupId : (string)TargetResourceGroupId;} + {_targetAvailabilitySetId = If( json?.PropertyT("targetAvailabilitySetId"), out var __jsonTargetAvailabilitySetId) ? (string)__jsonTargetAvailabilitySetId : (string)TargetAvailabilitySetId;} + {_targetAvailabilityZone = If( json?.PropertyT("targetAvailabilityZone"), out var __jsonTargetAvailabilityZone) ? (string)__jsonTargetAvailabilityZone : (string)TargetAvailabilityZone;} + {_targetProximityPlacementGroupId = If( json?.PropertyT("targetProximityPlacementGroupId"), out var __jsonTargetProximityPlacementGroupId) ? (string)__jsonTargetProximityPlacementGroupId : (string)TargetProximityPlacementGroupId;} + {_targetBootDiagnosticsStorageAccountId = If( json?.PropertyT("targetBootDiagnosticsStorageAccountId"), out var __jsonTargetBootDiagnosticsStorageAccountId) ? (string)__jsonTargetBootDiagnosticsStorageAccountId : (string)TargetBootDiagnosticsStorageAccountId;} + {_targetNetworkId = If( json?.PropertyT("targetNetworkId"), out var __jsonTargetNetworkId) ? (string)__jsonTargetNetworkId : (string)TargetNetworkId;} + {_testNetworkId = If( json?.PropertyT("testNetworkId"), out var __jsonTestNetworkId) ? (string)__jsonTestNetworkId : (string)TestNetworkId;} + {_vMNic = If( json?.PropertyT("vmNics"), out var __jsonVMNics) ? If( __jsonVMNics as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtNicInput) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtNicInput.FromJson(__u) )) ))() : null : VMNic;} + {_vMDisk = If( json?.PropertyT("vmDisks"), out var __jsonVMDisks) ? If( __jsonVMDisks as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __q) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__q, (__p)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateDiskInput) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtUpdateDiskInput.FromJson(__p) )) ))() : null : VMDisk;} + {_licenseType = If( json?.PropertyT("licenseType"), out var __jsonLicenseType) ? (string)__jsonLicenseType : (string)LicenseType;} + {_sqlServerLicenseType = If( json?.PropertyT("sqlServerLicenseType"), out var __jsonSqlServerLicenseType) ? (string)__jsonSqlServerLicenseType : (string)SqlServerLicenseType;} + {_performAutoResync = If( json?.PropertyT("performAutoResync"), out var __jsonPerformAutoResync) ? (string)__jsonPerformAutoResync : (string)PerformAutoResync;} + {_targetVMTag = If( json?.PropertyT("targetVmTags"), out var __jsonTargetVMTags) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtUpdateMigrationItemInputTargetVmtags.FromJson(__jsonTargetVMTags) : TargetVMTag;} + {_targetDiskTag = If( json?.PropertyT("targetDiskTags"), out var __jsonTargetDiskTags) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtUpdateMigrationItemInputTargetDiskTags.FromJson(__jsonTargetDiskTags) : TargetDiskTag;} + {_targetNicTag = If( json?.PropertyT("targetNicTags"), out var __jsonTargetNicTags) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtUpdateMigrationItemInputTargetNicTags.FromJson(__jsonTargetNicTags) : TargetNicTag;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtUpdateMigrationItemInputTargetDiskTags.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtUpdateMigrationItemInputTargetDiskTags.PowerShell.cs new file mode 100644 index 000000000000..1d2c5bb03338 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtUpdateMigrationItemInputTargetDiskTags.PowerShell.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// The tags for the target disks. + [System.ComponentModel.TypeConverter(typeof(VMwareCbtUpdateMigrationItemInputTargetDiskTagsTypeConverter))] + public partial class VMwareCbtUpdateMigrationItemInputTargetDiskTags + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputTargetDiskTags DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VMwareCbtUpdateMigrationItemInputTargetDiskTags(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputTargetDiskTags DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VMwareCbtUpdateMigrationItemInputTargetDiskTags(content); + } + + /// + /// Creates a new instance of , deserializing the content from + /// a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputTargetDiskTags FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VMwareCbtUpdateMigrationItemInputTargetDiskTags(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal VMwareCbtUpdateMigrationItemInputTargetDiskTags(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializePSObject(content); + } + } + /// The tags for the target disks. + [System.ComponentModel.TypeConverter(typeof(VMwareCbtUpdateMigrationItemInputTargetDiskTagsTypeConverter))] + public partial interface IVMwareCbtUpdateMigrationItemInputTargetDiskTags + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtUpdateMigrationItemInputTargetDiskTags.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtUpdateMigrationItemInputTargetDiskTags.TypeConverter.cs new file mode 100644 index 000000000000..4d313de00171 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtUpdateMigrationItemInputTargetDiskTags.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VMwareCbtUpdateMigrationItemInputTargetDiskTagsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, + /// otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputTargetDiskTags ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputTargetDiskTags).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VMwareCbtUpdateMigrationItemInputTargetDiskTags.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VMwareCbtUpdateMigrationItemInputTargetDiskTags.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VMwareCbtUpdateMigrationItemInputTargetDiskTags.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtUpdateMigrationItemInputTargetDiskTags.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtUpdateMigrationItemInputTargetDiskTags.cs new file mode 100644 index 000000000000..94595aec8a10 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtUpdateMigrationItemInputTargetDiskTags.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The tags for the target disks. + public partial class VMwareCbtUpdateMigrationItemInputTargetDiskTags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputTargetDiskTags, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputTargetDiskTagsInternal + { + + /// + /// Creates an new instance. + /// + public VMwareCbtUpdateMigrationItemInputTargetDiskTags() + { + + } + } + /// The tags for the target disks. + public partial interface IVMwareCbtUpdateMigrationItemInputTargetDiskTags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray + { + + } + /// The tags for the target disks. + internal partial interface IVMwareCbtUpdateMigrationItemInputTargetDiskTagsInternal + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtUpdateMigrationItemInputTargetDiskTags.dictionary.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtUpdateMigrationItemInputTargetDiskTags.dictionary.cs new file mode 100644 index 000000000000..c551cd3b4329 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtUpdateMigrationItemInputTargetDiskTags.dictionary.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + public partial class VMwareCbtUpdateMigrationItemInputTargetDiskTags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray + { + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + + int Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Values { get => __additionalProperties.Values; } + + public string this[global::System.String index] { get => __additionalProperties[index]; set => __additionalProperties[index] = value; } + + /// + /// + public void Add(global::System.String key, string value) => __additionalProperties.Add( key, value); + + public void Clear() => __additionalProperties.Clear(); + + /// + public bool ContainsKey(global::System.String key) => __additionalProperties.ContainsKey( key); + + /// + public void CopyFrom(global::System.Collections.IDictionary source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public void CopyFrom(global::System.Management.Automation.PSObject source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public bool Remove(global::System.String key) => __additionalProperties.Remove( key); + + /// + /// + public bool TryGetValue(global::System.String key, out string value) => __additionalProperties.TryGetValue( key, out value); + + /// + + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtUpdateMigrationItemInputTargetDiskTags source) => source.__additionalProperties; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtUpdateMigrationItemInputTargetDiskTags.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtUpdateMigrationItemInputTargetDiskTags.json.cs new file mode 100644 index 000000000000..f3fa118e4aef --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtUpdateMigrationItemInputTargetDiskTags.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The tags for the target disks. + public partial class VMwareCbtUpdateMigrationItemInputTargetDiskTags + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputTargetDiskTags. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputTargetDiskTags. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputTargetDiskTags FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new VMwareCbtUpdateMigrationItemInputTargetDiskTags(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray)this).AdditionalProperties, container); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + /// + internal VMwareCbtUpdateMigrationItemInputTargetDiskTags(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, global::System.Collections.Generic.HashSet exclusions = null) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray)this).AdditionalProperties, null ,exclusions ); + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtUpdateMigrationItemInputTargetNicTags.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtUpdateMigrationItemInputTargetNicTags.PowerShell.cs new file mode 100644 index 000000000000..2b25a60635c3 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtUpdateMigrationItemInputTargetNicTags.PowerShell.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// The tags for the target NICs. + [System.ComponentModel.TypeConverter(typeof(VMwareCbtUpdateMigrationItemInputTargetNicTagsTypeConverter))] + public partial class VMwareCbtUpdateMigrationItemInputTargetNicTags + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputTargetNicTags DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VMwareCbtUpdateMigrationItemInputTargetNicTags(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputTargetNicTags DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VMwareCbtUpdateMigrationItemInputTargetNicTags(content); + } + + /// + /// Creates a new instance of , deserializing the content from + /// a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputTargetNicTags FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VMwareCbtUpdateMigrationItemInputTargetNicTags(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal VMwareCbtUpdateMigrationItemInputTargetNicTags(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializePSObject(content); + } + } + /// The tags for the target NICs. + [System.ComponentModel.TypeConverter(typeof(VMwareCbtUpdateMigrationItemInputTargetNicTagsTypeConverter))] + public partial interface IVMwareCbtUpdateMigrationItemInputTargetNicTags + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtUpdateMigrationItemInputTargetNicTags.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtUpdateMigrationItemInputTargetNicTags.TypeConverter.cs new file mode 100644 index 000000000000..50d4c5fd65a0 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtUpdateMigrationItemInputTargetNicTags.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VMwareCbtUpdateMigrationItemInputTargetNicTagsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, + /// otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputTargetNicTags ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputTargetNicTags).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VMwareCbtUpdateMigrationItemInputTargetNicTags.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VMwareCbtUpdateMigrationItemInputTargetNicTags.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VMwareCbtUpdateMigrationItemInputTargetNicTags.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtUpdateMigrationItemInputTargetNicTags.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtUpdateMigrationItemInputTargetNicTags.cs new file mode 100644 index 000000000000..42d73ffbe73c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtUpdateMigrationItemInputTargetNicTags.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The tags for the target NICs. + public partial class VMwareCbtUpdateMigrationItemInputTargetNicTags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputTargetNicTags, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputTargetNicTagsInternal + { + + /// + /// Creates an new instance. + /// + public VMwareCbtUpdateMigrationItemInputTargetNicTags() + { + + } + } + /// The tags for the target NICs. + public partial interface IVMwareCbtUpdateMigrationItemInputTargetNicTags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray + { + + } + /// The tags for the target NICs. + internal partial interface IVMwareCbtUpdateMigrationItemInputTargetNicTagsInternal + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtUpdateMigrationItemInputTargetNicTags.dictionary.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtUpdateMigrationItemInputTargetNicTags.dictionary.cs new file mode 100644 index 000000000000..7a4b6009a422 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtUpdateMigrationItemInputTargetNicTags.dictionary.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + public partial class VMwareCbtUpdateMigrationItemInputTargetNicTags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray + { + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + + int Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Values { get => __additionalProperties.Values; } + + public string this[global::System.String index] { get => __additionalProperties[index]; set => __additionalProperties[index] = value; } + + /// + /// + public void Add(global::System.String key, string value) => __additionalProperties.Add( key, value); + + public void Clear() => __additionalProperties.Clear(); + + /// + public bool ContainsKey(global::System.String key) => __additionalProperties.ContainsKey( key); + + /// + public void CopyFrom(global::System.Collections.IDictionary source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public void CopyFrom(global::System.Management.Automation.PSObject source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public bool Remove(global::System.String key) => __additionalProperties.Remove( key); + + /// + /// + public bool TryGetValue(global::System.String key, out string value) => __additionalProperties.TryGetValue( key, out value); + + /// + + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtUpdateMigrationItemInputTargetNicTags source) => source.__additionalProperties; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtUpdateMigrationItemInputTargetNicTags.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtUpdateMigrationItemInputTargetNicTags.json.cs new file mode 100644 index 000000000000..d3cb861f0783 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtUpdateMigrationItemInputTargetNicTags.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The tags for the target NICs. + public partial class VMwareCbtUpdateMigrationItemInputTargetNicTags + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputTargetNicTags. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputTargetNicTags. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputTargetNicTags FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new VMwareCbtUpdateMigrationItemInputTargetNicTags(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray)this).AdditionalProperties, container); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + /// + internal VMwareCbtUpdateMigrationItemInputTargetNicTags(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, global::System.Collections.Generic.HashSet exclusions = null) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray)this).AdditionalProperties, null ,exclusions ); + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtUpdateMigrationItemInputTargetVmtags.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtUpdateMigrationItemInputTargetVmtags.PowerShell.cs new file mode 100644 index 000000000000..0e1866873310 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtUpdateMigrationItemInputTargetVmtags.PowerShell.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// The target VM tags. + [System.ComponentModel.TypeConverter(typeof(VMwareCbtUpdateMigrationItemInputTargetVmtagsTypeConverter))] + public partial class VMwareCbtUpdateMigrationItemInputTargetVmtags + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputTargetVmtags DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VMwareCbtUpdateMigrationItemInputTargetVmtags(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputTargetVmtags DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VMwareCbtUpdateMigrationItemInputTargetVmtags(content); + } + + /// + /// Creates a new instance of , deserializing the content from + /// a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputTargetVmtags FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VMwareCbtUpdateMigrationItemInputTargetVmtags(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal VMwareCbtUpdateMigrationItemInputTargetVmtags(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializePSObject(content); + } + } + /// The target VM tags. + [System.ComponentModel.TypeConverter(typeof(VMwareCbtUpdateMigrationItemInputTargetVmtagsTypeConverter))] + public partial interface IVMwareCbtUpdateMigrationItemInputTargetVmtags + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtUpdateMigrationItemInputTargetVmtags.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtUpdateMigrationItemInputTargetVmtags.TypeConverter.cs new file mode 100644 index 000000000000..8c3b0957167f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtUpdateMigrationItemInputTargetVmtags.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VMwareCbtUpdateMigrationItemInputTargetVmtagsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, + /// otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputTargetVmtags ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputTargetVmtags).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VMwareCbtUpdateMigrationItemInputTargetVmtags.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VMwareCbtUpdateMigrationItemInputTargetVmtags.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VMwareCbtUpdateMigrationItemInputTargetVmtags.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtUpdateMigrationItemInputTargetVmtags.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtUpdateMigrationItemInputTargetVmtags.cs new file mode 100644 index 000000000000..82fc41a07102 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtUpdateMigrationItemInputTargetVmtags.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The target VM tags. + public partial class VMwareCbtUpdateMigrationItemInputTargetVmtags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputTargetVmtags, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputTargetVmtagsInternal + { + + /// + /// Creates an new instance. + /// + public VMwareCbtUpdateMigrationItemInputTargetVmtags() + { + + } + } + /// The target VM tags. + public partial interface IVMwareCbtUpdateMigrationItemInputTargetVmtags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray + { + + } + /// The target VM tags. + internal partial interface IVMwareCbtUpdateMigrationItemInputTargetVmtagsInternal + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtUpdateMigrationItemInputTargetVmtags.dictionary.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtUpdateMigrationItemInputTargetVmtags.dictionary.cs new file mode 100644 index 000000000000..defbb55f60ed --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtUpdateMigrationItemInputTargetVmtags.dictionary.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + public partial class VMwareCbtUpdateMigrationItemInputTargetVmtags : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray + { + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + + int Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray.Values { get => __additionalProperties.Values; } + + public string this[global::System.String index] { get => __additionalProperties[index]; set => __additionalProperties[index] = value; } + + /// + /// + public void Add(global::System.String key, string value) => __additionalProperties.Add( key, value); + + public void Clear() => __additionalProperties.Clear(); + + /// + public bool ContainsKey(global::System.String key) => __additionalProperties.ContainsKey( key); + + /// + public void CopyFrom(global::System.Collections.IDictionary source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public void CopyFrom(global::System.Management.Automation.PSObject source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public bool Remove(global::System.String key) => __additionalProperties.Remove( key); + + /// + /// + public bool TryGetValue(global::System.String key, out string value) => __additionalProperties.TryGetValue( key, out value); + + /// + + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VMwareCbtUpdateMigrationItemInputTargetVmtags source) => source.__additionalProperties; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtUpdateMigrationItemInputTargetVmtags.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtUpdateMigrationItemInputTargetVmtags.json.cs new file mode 100644 index 000000000000..a5abce5e353c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareCbtUpdateMigrationItemInputTargetVmtags.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// The target VM tags. + public partial class VMwareCbtUpdateMigrationItemInputTargetVmtags + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputTargetVmtags. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputTargetVmtags. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareCbtUpdateMigrationItemInputTargetVmtags FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new VMwareCbtUpdateMigrationItemInputTargetVmtags(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray)this).AdditionalProperties, container); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + /// + internal VMwareCbtUpdateMigrationItemInputTargetVmtags(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, global::System.Collections.Generic.HashSet exclusions = null) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IAssociativeArray)this).AdditionalProperties, null ,exclusions ); + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareDetails.PowerShell.cs new file mode 100644 index 000000000000..dd2f155286f1 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareDetails.PowerShell.cs @@ -0,0 +1,432 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Store the fabric details specific to the VMware fabric. + [System.ComponentModel.TypeConverter(typeof(VMwareDetailsTypeConverter))] + public partial class VMwareDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VMwareDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VMwareDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VMwareDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("AgentVersionDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).AgentVersionDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVersionDetails) content.GetValueForProperty("AgentVersionDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).AgentVersionDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VersionDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("ProcessServer")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).ProcessServer = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServer[]) content.GetValueForProperty("ProcessServer",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).ProcessServer, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProcessServerTypeConverter.ConvertFrom)); + } + if (content.Contains("MasterTargetServer")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).MasterTargetServer = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServer[]) content.GetValueForProperty("MasterTargetServer",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).MasterTargetServer, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.MasterTargetServerTypeConverter.ConvertFrom)); + } + if (content.Contains("RunAsAccount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).RunAsAccount = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRunAsAccount[]) content.GetValueForProperty("RunAsAccount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).RunAsAccount, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RunAsAccountTypeConverter.ConvertFrom)); + } + if (content.Contains("ReplicationPairCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).ReplicationPairCount = (string) content.GetValueForProperty("ReplicationPairCount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).ReplicationPairCount, global::System.Convert.ToString); + } + if (content.Contains("ProcessServerCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).ProcessServerCount = (string) content.GetValueForProperty("ProcessServerCount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).ProcessServerCount, global::System.Convert.ToString); + } + if (content.Contains("AgentCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).AgentCount = (string) content.GetValueForProperty("AgentCount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).AgentCount, global::System.Convert.ToString); + } + if (content.Contains("ProtectedServer")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).ProtectedServer = (string) content.GetValueForProperty("ProtectedServer",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).ProtectedServer, global::System.Convert.ToString); + } + if (content.Contains("SystemLoad")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).SystemLoad = (string) content.GetValueForProperty("SystemLoad",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).SystemLoad, global::System.Convert.ToString); + } + if (content.Contains("SystemLoadStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).SystemLoadStatus = (string) content.GetValueForProperty("SystemLoadStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).SystemLoadStatus, global::System.Convert.ToString); + } + if (content.Contains("CpuLoad")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).CpuLoad = (string) content.GetValueForProperty("CpuLoad",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).CpuLoad, global::System.Convert.ToString); + } + if (content.Contains("CpuLoadStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).CpuLoadStatus = (string) content.GetValueForProperty("CpuLoadStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).CpuLoadStatus, global::System.Convert.ToString); + } + if (content.Contains("TotalMemoryInByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).TotalMemoryInByte = (long?) content.GetValueForProperty("TotalMemoryInByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).TotalMemoryInByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("AvailableMemoryInByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).AvailableMemoryInByte = (long?) content.GetValueForProperty("AvailableMemoryInByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).AvailableMemoryInByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("MemoryUsageStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).MemoryUsageStatus = (string) content.GetValueForProperty("MemoryUsageStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).MemoryUsageStatus, global::System.Convert.ToString); + } + if (content.Contains("TotalSpaceInByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).TotalSpaceInByte = (long?) content.GetValueForProperty("TotalSpaceInByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).TotalSpaceInByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("AvailableSpaceInByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).AvailableSpaceInByte = (long?) content.GetValueForProperty("AvailableSpaceInByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).AvailableSpaceInByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("SpaceUsageStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).SpaceUsageStatus = (string) content.GetValueForProperty("SpaceUsageStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).SpaceUsageStatus, global::System.Convert.ToString); + } + if (content.Contains("WebLoad")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).WebLoad = (string) content.GetValueForProperty("WebLoad",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).WebLoad, global::System.Convert.ToString); + } + if (content.Contains("WebLoadStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).WebLoadStatus = (string) content.GetValueForProperty("WebLoadStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).WebLoadStatus, global::System.Convert.ToString); + } + if (content.Contains("DatabaseServerLoad")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).DatabaseServerLoad = (string) content.GetValueForProperty("DatabaseServerLoad",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).DatabaseServerLoad, global::System.Convert.ToString); + } + if (content.Contains("DatabaseServerLoadStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).DatabaseServerLoadStatus = (string) content.GetValueForProperty("DatabaseServerLoadStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).DatabaseServerLoadStatus, global::System.Convert.ToString); + } + if (content.Contains("CsServiceStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).CsServiceStatus = (string) content.GetValueForProperty("CsServiceStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).CsServiceStatus, global::System.Convert.ToString); + } + if (content.Contains("IPAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).IPAddress = (string) content.GetValueForProperty("IPAddress",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).IPAddress, global::System.Convert.ToString); + } + if (content.Contains("AgentVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).AgentVersion = (string) content.GetValueForProperty("AgentVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).AgentVersion, global::System.Convert.ToString); + } + if (content.Contains("HostName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).HostName = (string) content.GetValueForProperty("HostName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).HostName, global::System.Convert.ToString); + } + if (content.Contains("LastHeartbeat")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).LastHeartbeat = (global::System.DateTime?) content.GetValueForProperty("LastHeartbeat",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).LastHeartbeat, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("VersionStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).VersionStatus = (string) content.GetValueForProperty("VersionStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).VersionStatus, global::System.Convert.ToString); + } + if (content.Contains("SslCertExpiryDate")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).SslCertExpiryDate = (global::System.DateTime?) content.GetValueForProperty("SslCertExpiryDate",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).SslCertExpiryDate, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SslCertExpiryRemainingDay")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).SslCertExpiryRemainingDay = (int?) content.GetValueForProperty("SslCertExpiryRemainingDay",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).SslCertExpiryRemainingDay, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("PsTemplateVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).PsTemplateVersion = (string) content.GetValueForProperty("PsTemplateVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).PsTemplateVersion, global::System.Convert.ToString); + } + if (content.Contains("AgentExpiryDate")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).AgentExpiryDate = (global::System.DateTime?) content.GetValueForProperty("AgentExpiryDate",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).AgentExpiryDate, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SwitchProviderBlockingErrorDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).SwitchProviderBlockingErrorDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageFabricSwitchProviderBlockingErrorDetails[]) content.GetValueForProperty("SwitchProviderBlockingErrorDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).SwitchProviderBlockingErrorDetail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageFabricSwitchProviderBlockingErrorDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + if (content.Contains("AgentVersionDetailVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).AgentVersionDetailVersion = (string) content.GetValueForProperty("AgentVersionDetailVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).AgentVersionDetailVersion, global::System.Convert.ToString); + } + if (content.Contains("AgentVersionDetailExpiryDate")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).AgentVersionDetailExpiryDate = (global::System.DateTime?) content.GetValueForProperty("AgentVersionDetailExpiryDate",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).AgentVersionDetailExpiryDate, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("AgentVersionDetailStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).AgentVersionDetailStatus = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentVersionStatus?) content.GetValueForProperty("AgentVersionDetailStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).AgentVersionDetailStatus, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentVersionStatus.CreateFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal VMwareDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("AgentVersionDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).AgentVersionDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVersionDetails) content.GetValueForProperty("AgentVersionDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).AgentVersionDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VersionDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("ProcessServer")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).ProcessServer = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServer[]) content.GetValueForProperty("ProcessServer",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).ProcessServer, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProcessServerTypeConverter.ConvertFrom)); + } + if (content.Contains("MasterTargetServer")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).MasterTargetServer = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServer[]) content.GetValueForProperty("MasterTargetServer",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).MasterTargetServer, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.MasterTargetServerTypeConverter.ConvertFrom)); + } + if (content.Contains("RunAsAccount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).RunAsAccount = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRunAsAccount[]) content.GetValueForProperty("RunAsAccount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).RunAsAccount, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RunAsAccountTypeConverter.ConvertFrom)); + } + if (content.Contains("ReplicationPairCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).ReplicationPairCount = (string) content.GetValueForProperty("ReplicationPairCount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).ReplicationPairCount, global::System.Convert.ToString); + } + if (content.Contains("ProcessServerCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).ProcessServerCount = (string) content.GetValueForProperty("ProcessServerCount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).ProcessServerCount, global::System.Convert.ToString); + } + if (content.Contains("AgentCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).AgentCount = (string) content.GetValueForProperty("AgentCount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).AgentCount, global::System.Convert.ToString); + } + if (content.Contains("ProtectedServer")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).ProtectedServer = (string) content.GetValueForProperty("ProtectedServer",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).ProtectedServer, global::System.Convert.ToString); + } + if (content.Contains("SystemLoad")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).SystemLoad = (string) content.GetValueForProperty("SystemLoad",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).SystemLoad, global::System.Convert.ToString); + } + if (content.Contains("SystemLoadStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).SystemLoadStatus = (string) content.GetValueForProperty("SystemLoadStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).SystemLoadStatus, global::System.Convert.ToString); + } + if (content.Contains("CpuLoad")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).CpuLoad = (string) content.GetValueForProperty("CpuLoad",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).CpuLoad, global::System.Convert.ToString); + } + if (content.Contains("CpuLoadStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).CpuLoadStatus = (string) content.GetValueForProperty("CpuLoadStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).CpuLoadStatus, global::System.Convert.ToString); + } + if (content.Contains("TotalMemoryInByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).TotalMemoryInByte = (long?) content.GetValueForProperty("TotalMemoryInByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).TotalMemoryInByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("AvailableMemoryInByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).AvailableMemoryInByte = (long?) content.GetValueForProperty("AvailableMemoryInByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).AvailableMemoryInByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("MemoryUsageStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).MemoryUsageStatus = (string) content.GetValueForProperty("MemoryUsageStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).MemoryUsageStatus, global::System.Convert.ToString); + } + if (content.Contains("TotalSpaceInByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).TotalSpaceInByte = (long?) content.GetValueForProperty("TotalSpaceInByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).TotalSpaceInByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("AvailableSpaceInByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).AvailableSpaceInByte = (long?) content.GetValueForProperty("AvailableSpaceInByte",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).AvailableSpaceInByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("SpaceUsageStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).SpaceUsageStatus = (string) content.GetValueForProperty("SpaceUsageStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).SpaceUsageStatus, global::System.Convert.ToString); + } + if (content.Contains("WebLoad")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).WebLoad = (string) content.GetValueForProperty("WebLoad",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).WebLoad, global::System.Convert.ToString); + } + if (content.Contains("WebLoadStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).WebLoadStatus = (string) content.GetValueForProperty("WebLoadStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).WebLoadStatus, global::System.Convert.ToString); + } + if (content.Contains("DatabaseServerLoad")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).DatabaseServerLoad = (string) content.GetValueForProperty("DatabaseServerLoad",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).DatabaseServerLoad, global::System.Convert.ToString); + } + if (content.Contains("DatabaseServerLoadStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).DatabaseServerLoadStatus = (string) content.GetValueForProperty("DatabaseServerLoadStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).DatabaseServerLoadStatus, global::System.Convert.ToString); + } + if (content.Contains("CsServiceStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).CsServiceStatus = (string) content.GetValueForProperty("CsServiceStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).CsServiceStatus, global::System.Convert.ToString); + } + if (content.Contains("IPAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).IPAddress = (string) content.GetValueForProperty("IPAddress",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).IPAddress, global::System.Convert.ToString); + } + if (content.Contains("AgentVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).AgentVersion = (string) content.GetValueForProperty("AgentVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).AgentVersion, global::System.Convert.ToString); + } + if (content.Contains("HostName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).HostName = (string) content.GetValueForProperty("HostName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).HostName, global::System.Convert.ToString); + } + if (content.Contains("LastHeartbeat")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).LastHeartbeat = (global::System.DateTime?) content.GetValueForProperty("LastHeartbeat",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).LastHeartbeat, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("VersionStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).VersionStatus = (string) content.GetValueForProperty("VersionStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).VersionStatus, global::System.Convert.ToString); + } + if (content.Contains("SslCertExpiryDate")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).SslCertExpiryDate = (global::System.DateTime?) content.GetValueForProperty("SslCertExpiryDate",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).SslCertExpiryDate, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SslCertExpiryRemainingDay")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).SslCertExpiryRemainingDay = (int?) content.GetValueForProperty("SslCertExpiryRemainingDay",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).SslCertExpiryRemainingDay, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("PsTemplateVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).PsTemplateVersion = (string) content.GetValueForProperty("PsTemplateVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).PsTemplateVersion, global::System.Convert.ToString); + } + if (content.Contains("AgentExpiryDate")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).AgentExpiryDate = (global::System.DateTime?) content.GetValueForProperty("AgentExpiryDate",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).AgentExpiryDate, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SwitchProviderBlockingErrorDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).SwitchProviderBlockingErrorDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageFabricSwitchProviderBlockingErrorDetails[]) content.GetValueForProperty("SwitchProviderBlockingErrorDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).SwitchProviderBlockingErrorDetail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageFabricSwitchProviderBlockingErrorDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + if (content.Contains("AgentVersionDetailVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).AgentVersionDetailVersion = (string) content.GetValueForProperty("AgentVersionDetailVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).AgentVersionDetailVersion, global::System.Convert.ToString); + } + if (content.Contains("AgentVersionDetailExpiryDate")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).AgentVersionDetailExpiryDate = (global::System.DateTime?) content.GetValueForProperty("AgentVersionDetailExpiryDate",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).AgentVersionDetailExpiryDate, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("AgentVersionDetailStatus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).AgentVersionDetailStatus = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentVersionStatus?) content.GetValueForProperty("AgentVersionDetailStatus",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal)this).AgentVersionDetailStatus, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentVersionStatus.CreateFrom); + } + AfterDeserializePSObject(content); + } + } + /// Store the fabric details specific to the VMware fabric. + [System.ComponentModel.TypeConverter(typeof(VMwareDetailsTypeConverter))] + public partial interface IVMwareDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareDetails.TypeConverter.cs new file mode 100644 index 000000000000..ed077446ee43 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VMwareDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VMwareDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VMwareDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VMwareDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareDetails.cs new file mode 100644 index 000000000000..7cb9fdf9b5bc --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareDetails.cs @@ -0,0 +1,655 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Store the fabric details specific to the VMware fabric. + public partial class VMwareDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificDetails __fabricSpecificDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FabricSpecificDetails(); + + /// Backing field for property. + private string _agentCount; + + /// The number of source and target servers configured to talk to this CS. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string AgentCount { get => this._agentCount; set => this._agentCount = value; } + + /// Backing field for property. + private global::System.DateTime? _agentExpiryDate; + + /// Agent expiry date. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public global::System.DateTime? AgentExpiryDate { get => this._agentExpiryDate; set => this._agentExpiryDate = value; } + + /// Backing field for property. + private string _agentVersion; + + /// The agent Version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string AgentVersion { get => this._agentVersion; set => this._agentVersion = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVersionDetails _agentVersionDetail; + + /// The agent version details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVersionDetails AgentVersionDetail { get => (this._agentVersionDetail = this._agentVersionDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VersionDetails()); set => this._agentVersionDetail = value; } + + /// Version expiry date. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public global::System.DateTime? AgentVersionDetailExpiryDate { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVersionDetailsInternal)AgentVersionDetail).ExpiryDate; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVersionDetailsInternal)AgentVersionDetail).ExpiryDate = value ?? default(global::System.DateTime); } + + /// A value indicating whether security update required. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentVersionStatus? AgentVersionDetailStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVersionDetailsInternal)AgentVersionDetail).Status; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVersionDetailsInternal)AgentVersionDetail).Status = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentVersionStatus)""); } + + /// The agent version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string AgentVersionDetailVersion { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVersionDetailsInternal)AgentVersionDetail).Version; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVersionDetailsInternal)AgentVersionDetail).Version = value ?? null; } + + /// Backing field for property. + private long? _availableMemoryInByte; + + /// The available memory. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public long? AvailableMemoryInByte { get => this._availableMemoryInByte; set => this._availableMemoryInByte = value; } + + /// Backing field for property. + private long? _availableSpaceInByte; + + /// The available space. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public long? AvailableSpaceInByte { get => this._availableSpaceInByte; set => this._availableSpaceInByte = value; } + + /// Backing field for property. + private string _cpuLoad; + + /// The percentage of the CPU load. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string CpuLoad { get => this._cpuLoad; set => this._cpuLoad = value; } + + /// Backing field for property. + private string _cpuLoadStatus; + + /// The CPU load status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string CpuLoadStatus { get => this._cpuLoadStatus; set => this._cpuLoadStatus = value; } + + /// Backing field for property. + private string _csServiceStatus; + + /// The CS service status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string CsServiceStatus { get => this._csServiceStatus; set => this._csServiceStatus = value; } + + /// Backing field for property. + private string _databaseServerLoad; + + /// The database server load. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string DatabaseServerLoad { get => this._databaseServerLoad; set => this._databaseServerLoad = value; } + + /// Backing field for property. + private string _databaseServerLoadStatus; + + /// The database server load status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string DatabaseServerLoadStatus { get => this._databaseServerLoadStatus; set => this._databaseServerLoadStatus = value; } + + /// Backing field for property. + private string _hostName; + + /// The host name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string HostName { get => this._hostName; set => this._hostName = value; } + + /// Backing field for property. + private string _iPAddress; + + /// The IP address. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string IPAddress { get => this._iPAddress; set => this._iPAddress = value; } + + /// Gets the class type. Overridden in derived classes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificDetailsInternal)__fabricSpecificDetails).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificDetailsInternal)__fabricSpecificDetails).InstanceType = value ; } + + /// Backing field for property. + private global::System.DateTime? _lastHeartbeat; + + /// The last heartbeat received from CS server. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public global::System.DateTime? LastHeartbeat { get => this._lastHeartbeat; set => this._lastHeartbeat = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServer[] _masterTargetServer; + + /// The list of Master Target servers associated with the fabric. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServer[] MasterTargetServer { get => this._masterTargetServer; set => this._masterTargetServer = value; } + + /// Backing field for property. + private string _memoryUsageStatus; + + /// The memory usage status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string MemoryUsageStatus { get => this._memoryUsageStatus; set => this._memoryUsageStatus = value; } + + /// Internal Acessors for AgentVersionDetail + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVersionDetails Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetailsInternal.AgentVersionDetail { get => (this._agentVersionDetail = this._agentVersionDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VersionDetails()); set { {_agentVersionDetail = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServer[] _processServer; + + /// The list of Process Servers associated with the fabric. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServer[] ProcessServer { get => this._processServer; set => this._processServer = value; } + + /// Backing field for property. + private string _processServerCount; + + /// The number of process servers. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ProcessServerCount { get => this._processServerCount; set => this._processServerCount = value; } + + /// Backing field for property. + private string _protectedServer; + + /// The number of protected servers. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ProtectedServer { get => this._protectedServer; set => this._protectedServer = value; } + + /// Backing field for property. + private string _psTemplateVersion; + + /// PS template version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string PsTemplateVersion { get => this._psTemplateVersion; set => this._psTemplateVersion = value; } + + /// Backing field for property. + private string _replicationPairCount; + + /// The number of replication pairs configured in this CS. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ReplicationPairCount { get => this._replicationPairCount; set => this._replicationPairCount = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRunAsAccount[] _runAsAccount; + + /// The list of run as accounts created on the server. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRunAsAccount[] RunAsAccount { get => this._runAsAccount; set => this._runAsAccount = value; } + + /// Backing field for property. + private string _spaceUsageStatus; + + /// The space usage status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string SpaceUsageStatus { get => this._spaceUsageStatus; set => this._spaceUsageStatus = value; } + + /// Backing field for property. + private global::System.DateTime? _sslCertExpiryDate; + + /// CS SSL cert expiry date. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public global::System.DateTime? SslCertExpiryDate { get => this._sslCertExpiryDate; set => this._sslCertExpiryDate = value; } + + /// Backing field for property. + private int? _sslCertExpiryRemainingDay; + + /// CS SSL cert expiry date. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? SslCertExpiryRemainingDay { get => this._sslCertExpiryRemainingDay; set => this._sslCertExpiryRemainingDay = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageFabricSwitchProviderBlockingErrorDetails[] _switchProviderBlockingErrorDetail; + + /// The switch provider blocking error information. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageFabricSwitchProviderBlockingErrorDetails[] SwitchProviderBlockingErrorDetail { get => this._switchProviderBlockingErrorDetail; set => this._switchProviderBlockingErrorDetail = value; } + + /// Backing field for property. + private string _systemLoad; + + /// The percentage of the system load. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string SystemLoad { get => this._systemLoad; set => this._systemLoad = value; } + + /// Backing field for property. + private string _systemLoadStatus; + + /// The system load status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string SystemLoadStatus { get => this._systemLoadStatus; set => this._systemLoadStatus = value; } + + /// Backing field for property. + private long? _totalMemoryInByte; + + /// The total memory. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public long? TotalMemoryInByte { get => this._totalMemoryInByte; set => this._totalMemoryInByte = value; } + + /// Backing field for property. + private long? _totalSpaceInByte; + + /// The total space. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public long? TotalSpaceInByte { get => this._totalSpaceInByte; set => this._totalSpaceInByte = value; } + + /// Backing field for property. + private string _versionStatus; + + /// Version status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string VersionStatus { get => this._versionStatus; set => this._versionStatus = value; } + + /// Backing field for property. + private string _webLoad; + + /// The web load. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string WebLoad { get => this._webLoad; set => this._webLoad = value; } + + /// Backing field for property. + private string _webLoadStatus; + + /// The web load status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string WebLoadStatus { get => this._webLoadStatus; set => this._webLoadStatus = value; } + + /// Creates an new instance. + public VMwareDetails() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__fabricSpecificDetails), __fabricSpecificDetails); + await eventListener.AssertObjectIsValid(nameof(__fabricSpecificDetails), __fabricSpecificDetails); + } + } + /// Store the fabric details specific to the VMware fabric. + public partial interface IVMwareDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificDetails + { + /// The number of source and target servers configured to talk to this CS. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The number of source and target servers configured to talk to this CS.", + SerializedName = @"agentCount", + PossibleTypes = new [] { typeof(string) })] + string AgentCount { get; set; } + /// Agent expiry date. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Agent expiry date.", + SerializedName = @"agentExpiryDate", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? AgentExpiryDate { get; set; } + /// The agent Version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The agent Version.", + SerializedName = @"agentVersion", + PossibleTypes = new [] { typeof(string) })] + string AgentVersion { get; set; } + /// Version expiry date. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Version expiry date.", + SerializedName = @"expiryDate", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? AgentVersionDetailExpiryDate { get; set; } + /// A value indicating whether security update required. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether security update required.", + SerializedName = @"status", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentVersionStatus) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentVersionStatus? AgentVersionDetailStatus { get; set; } + /// The agent version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The agent version.", + SerializedName = @"version", + PossibleTypes = new [] { typeof(string) })] + string AgentVersionDetailVersion { get; set; } + /// The available memory. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The available memory.", + SerializedName = @"availableMemoryInBytes", + PossibleTypes = new [] { typeof(long) })] + long? AvailableMemoryInByte { get; set; } + /// The available space. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The available space.", + SerializedName = @"availableSpaceInBytes", + PossibleTypes = new [] { typeof(long) })] + long? AvailableSpaceInByte { get; set; } + /// The percentage of the CPU load. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The percentage of the CPU load.", + SerializedName = @"cpuLoad", + PossibleTypes = new [] { typeof(string) })] + string CpuLoad { get; set; } + /// The CPU load status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The CPU load status.", + SerializedName = @"cpuLoadStatus", + PossibleTypes = new [] { typeof(string) })] + string CpuLoadStatus { get; set; } + /// The CS service status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The CS service status.", + SerializedName = @"csServiceStatus", + PossibleTypes = new [] { typeof(string) })] + string CsServiceStatus { get; set; } + /// The database server load. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The database server load.", + SerializedName = @"databaseServerLoad", + PossibleTypes = new [] { typeof(string) })] + string DatabaseServerLoad { get; set; } + /// The database server load status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The database server load status.", + SerializedName = @"databaseServerLoadStatus", + PossibleTypes = new [] { typeof(string) })] + string DatabaseServerLoadStatus { get; set; } + /// The host name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The host name.", + SerializedName = @"hostName", + PossibleTypes = new [] { typeof(string) })] + string HostName { get; set; } + /// The IP address. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The IP address.", + SerializedName = @"ipAddress", + PossibleTypes = new [] { typeof(string) })] + string IPAddress { get; set; } + /// The last heartbeat received from CS server. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The last heartbeat received from CS server.", + SerializedName = @"lastHeartbeat", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? LastHeartbeat { get; set; } + /// The list of Master Target servers associated with the fabric. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of Master Target servers associated with the fabric.", + SerializedName = @"masterTargetServers", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServer) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServer[] MasterTargetServer { get; set; } + /// The memory usage status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The memory usage status.", + SerializedName = @"memoryUsageStatus", + PossibleTypes = new [] { typeof(string) })] + string MemoryUsageStatus { get; set; } + /// The list of Process Servers associated with the fabric. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of Process Servers associated with the fabric.", + SerializedName = @"processServers", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServer) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServer[] ProcessServer { get; set; } + /// The number of process servers. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The number of process servers.", + SerializedName = @"processServerCount", + PossibleTypes = new [] { typeof(string) })] + string ProcessServerCount { get; set; } + /// The number of protected servers. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The number of protected servers.", + SerializedName = @"protectedServers", + PossibleTypes = new [] { typeof(string) })] + string ProtectedServer { get; set; } + /// PS template version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"PS template version.", + SerializedName = @"psTemplateVersion", + PossibleTypes = new [] { typeof(string) })] + string PsTemplateVersion { get; set; } + /// The number of replication pairs configured in this CS. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The number of replication pairs configured in this CS.", + SerializedName = @"replicationPairCount", + PossibleTypes = new [] { typeof(string) })] + string ReplicationPairCount { get; set; } + /// The list of run as accounts created on the server. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of run as accounts created on the server.", + SerializedName = @"runAsAccounts", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRunAsAccount) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRunAsAccount[] RunAsAccount { get; set; } + /// The space usage status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The space usage status.", + SerializedName = @"spaceUsageStatus", + PossibleTypes = new [] { typeof(string) })] + string SpaceUsageStatus { get; set; } + /// CS SSL cert expiry date. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"CS SSL cert expiry date.", + SerializedName = @"sslCertExpiryDate", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? SslCertExpiryDate { get; set; } + /// CS SSL cert expiry date. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"CS SSL cert expiry date.", + SerializedName = @"sslCertExpiryRemainingDays", + PossibleTypes = new [] { typeof(int) })] + int? SslCertExpiryRemainingDay { get; set; } + /// The switch provider blocking error information. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The switch provider blocking error information.", + SerializedName = @"switchProviderBlockingErrorDetails", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageFabricSwitchProviderBlockingErrorDetails) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageFabricSwitchProviderBlockingErrorDetails[] SwitchProviderBlockingErrorDetail { get; set; } + /// The percentage of the system load. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The percentage of the system load.", + SerializedName = @"systemLoad", + PossibleTypes = new [] { typeof(string) })] + string SystemLoad { get; set; } + /// The system load status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The system load status.", + SerializedName = @"systemLoadStatus", + PossibleTypes = new [] { typeof(string) })] + string SystemLoadStatus { get; set; } + /// The total memory. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The total memory.", + SerializedName = @"totalMemoryInBytes", + PossibleTypes = new [] { typeof(long) })] + long? TotalMemoryInByte { get; set; } + /// The total space. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The total space.", + SerializedName = @"totalSpaceInBytes", + PossibleTypes = new [] { typeof(long) })] + long? TotalSpaceInByte { get; set; } + /// Version status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Version status.", + SerializedName = @"versionStatus", + PossibleTypes = new [] { typeof(string) })] + string VersionStatus { get; set; } + /// The web load. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The web load.", + SerializedName = @"webLoad", + PossibleTypes = new [] { typeof(string) })] + string WebLoad { get; set; } + /// The web load status. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The web load status.", + SerializedName = @"webLoadStatus", + PossibleTypes = new [] { typeof(string) })] + string WebLoadStatus { get; set; } + + } + /// Store the fabric details specific to the VMware fabric. + internal partial interface IVMwareDetailsInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificDetailsInternal + { + /// The number of source and target servers configured to talk to this CS. + string AgentCount { get; set; } + /// Agent expiry date. + global::System.DateTime? AgentExpiryDate { get; set; } + /// The agent Version. + string AgentVersion { get; set; } + /// The agent version details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVersionDetails AgentVersionDetail { get; set; } + /// Version expiry date. + global::System.DateTime? AgentVersionDetailExpiryDate { get; set; } + /// A value indicating whether security update required. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentVersionStatus? AgentVersionDetailStatus { get; set; } + /// The agent version. + string AgentVersionDetailVersion { get; set; } + /// The available memory. + long? AvailableMemoryInByte { get; set; } + /// The available space. + long? AvailableSpaceInByte { get; set; } + /// The percentage of the CPU load. + string CpuLoad { get; set; } + /// The CPU load status. + string CpuLoadStatus { get; set; } + /// The CS service status. + string CsServiceStatus { get; set; } + /// The database server load. + string DatabaseServerLoad { get; set; } + /// The database server load status. + string DatabaseServerLoadStatus { get; set; } + /// The host name. + string HostName { get; set; } + /// The IP address. + string IPAddress { get; set; } + /// The last heartbeat received from CS server. + global::System.DateTime? LastHeartbeat { get; set; } + /// The list of Master Target servers associated with the fabric. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServer[] MasterTargetServer { get; set; } + /// The memory usage status. + string MemoryUsageStatus { get; set; } + /// The list of Process Servers associated with the fabric. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServer[] ProcessServer { get; set; } + /// The number of process servers. + string ProcessServerCount { get; set; } + /// The number of protected servers. + string ProtectedServer { get; set; } + /// PS template version. + string PsTemplateVersion { get; set; } + /// The number of replication pairs configured in this CS. + string ReplicationPairCount { get; set; } + /// The list of run as accounts created on the server. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRunAsAccount[] RunAsAccount { get; set; } + /// The space usage status. + string SpaceUsageStatus { get; set; } + /// CS SSL cert expiry date. + global::System.DateTime? SslCertExpiryDate { get; set; } + /// CS SSL cert expiry date. + int? SslCertExpiryRemainingDay { get; set; } + /// The switch provider blocking error information. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageFabricSwitchProviderBlockingErrorDetails[] SwitchProviderBlockingErrorDetail { get; set; } + /// The percentage of the system load. + string SystemLoad { get; set; } + /// The system load status. + string SystemLoadStatus { get; set; } + /// The total memory. + long? TotalMemoryInByte { get; set; } + /// The total space. + long? TotalSpaceInByte { get; set; } + /// Version status. + string VersionStatus { get; set; } + /// The web load. + string WebLoad { get; set; } + /// The web load status. + string WebLoadStatus { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareDetails.json.cs new file mode 100644 index 000000000000..437cbd6ad20d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareDetails.json.cs @@ -0,0 +1,206 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Store the fabric details specific to the VMware fabric. + public partial class VMwareDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new VMwareDetails(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __fabricSpecificDetails?.ToJson(container, serializationMode); + AddIf( null != this._agentVersionDetail ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._agentVersionDetail.ToJson(null,serializationMode) : null, "agentVersionDetails" ,container.Add ); + if (null != this._processServer) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._processServer ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("processServers",__w); + } + if (null != this._masterTargetServer) + { + var __r = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __s in this._masterTargetServer ) + { + AddIf(__s?.ToJson(null, serializationMode) ,__r.Add); + } + container.Add("masterTargetServers",__r); + } + if (null != this._runAsAccount) + { + var __m = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __n in this._runAsAccount ) + { + AddIf(__n?.ToJson(null, serializationMode) ,__m.Add); + } + container.Add("runAsAccounts",__m); + } + AddIf( null != (((object)this._replicationPairCount)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._replicationPairCount.ToString()) : null, "replicationPairCount" ,container.Add ); + AddIf( null != (((object)this._processServerCount)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._processServerCount.ToString()) : null, "processServerCount" ,container.Add ); + AddIf( null != (((object)this._agentCount)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._agentCount.ToString()) : null, "agentCount" ,container.Add ); + AddIf( null != (((object)this._protectedServer)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._protectedServer.ToString()) : null, "protectedServers" ,container.Add ); + AddIf( null != (((object)this._systemLoad)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._systemLoad.ToString()) : null, "systemLoad" ,container.Add ); + AddIf( null != (((object)this._systemLoadStatus)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._systemLoadStatus.ToString()) : null, "systemLoadStatus" ,container.Add ); + AddIf( null != (((object)this._cpuLoad)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._cpuLoad.ToString()) : null, "cpuLoad" ,container.Add ); + AddIf( null != (((object)this._cpuLoadStatus)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._cpuLoadStatus.ToString()) : null, "cpuLoadStatus" ,container.Add ); + AddIf( null != this._totalMemoryInByte ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((long)this._totalMemoryInByte) : null, "totalMemoryInBytes" ,container.Add ); + AddIf( null != this._availableMemoryInByte ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((long)this._availableMemoryInByte) : null, "availableMemoryInBytes" ,container.Add ); + AddIf( null != (((object)this._memoryUsageStatus)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._memoryUsageStatus.ToString()) : null, "memoryUsageStatus" ,container.Add ); + AddIf( null != this._totalSpaceInByte ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((long)this._totalSpaceInByte) : null, "totalSpaceInBytes" ,container.Add ); + AddIf( null != this._availableSpaceInByte ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((long)this._availableSpaceInByte) : null, "availableSpaceInBytes" ,container.Add ); + AddIf( null != (((object)this._spaceUsageStatus)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._spaceUsageStatus.ToString()) : null, "spaceUsageStatus" ,container.Add ); + AddIf( null != (((object)this._webLoad)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._webLoad.ToString()) : null, "webLoad" ,container.Add ); + AddIf( null != (((object)this._webLoadStatus)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._webLoadStatus.ToString()) : null, "webLoadStatus" ,container.Add ); + AddIf( null != (((object)this._databaseServerLoad)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._databaseServerLoad.ToString()) : null, "databaseServerLoad" ,container.Add ); + AddIf( null != (((object)this._databaseServerLoadStatus)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._databaseServerLoadStatus.ToString()) : null, "databaseServerLoadStatus" ,container.Add ); + AddIf( null != (((object)this._csServiceStatus)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._csServiceStatus.ToString()) : null, "csServiceStatus" ,container.Add ); + AddIf( null != (((object)this._iPAddress)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._iPAddress.ToString()) : null, "ipAddress" ,container.Add ); + AddIf( null != (((object)this._agentVersion)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._agentVersion.ToString()) : null, "agentVersion" ,container.Add ); + AddIf( null != (((object)this._hostName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._hostName.ToString()) : null, "hostName" ,container.Add ); + AddIf( null != this._lastHeartbeat ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._lastHeartbeat?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "lastHeartbeat" ,container.Add ); + AddIf( null != (((object)this._versionStatus)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._versionStatus.ToString()) : null, "versionStatus" ,container.Add ); + AddIf( null != this._sslCertExpiryDate ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._sslCertExpiryDate?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "sslCertExpiryDate" ,container.Add ); + AddIf( null != this._sslCertExpiryRemainingDay ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._sslCertExpiryRemainingDay) : null, "sslCertExpiryRemainingDays" ,container.Add ); + AddIf( null != (((object)this._psTemplateVersion)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._psTemplateVersion.ToString()) : null, "psTemplateVersion" ,container.Add ); + AddIf( null != this._agentExpiryDate ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._agentExpiryDate?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "agentExpiryDate" ,container.Add ); + if (null != this._switchProviderBlockingErrorDetail) + { + var __h = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __i in this._switchProviderBlockingErrorDetail ) + { + AddIf(__i?.ToJson(null, serializationMode) ,__h.Add); + } + container.Add("switchProviderBlockingErrorDetails",__h); + } + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal VMwareDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __fabricSpecificDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FabricSpecificDetails(json); + {_agentVersionDetail = If( json?.PropertyT("agentVersionDetails"), out var __jsonAgentVersionDetails) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VersionDetails.FromJson(__jsonAgentVersionDetails) : AgentVersionDetail;} + {_processServer = If( json?.PropertyT("processServers"), out var __jsonProcessServers) ? If( __jsonProcessServers as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServer) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProcessServer.FromJson(__u) )) ))() : null : ProcessServer;} + {_masterTargetServer = If( json?.PropertyT("masterTargetServers"), out var __jsonMasterTargetServers) ? If( __jsonMasterTargetServers as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __q) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__q, (__p)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMasterTargetServer) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.MasterTargetServer.FromJson(__p) )) ))() : null : MasterTargetServer;} + {_runAsAccount = If( json?.PropertyT("runAsAccounts"), out var __jsonRunAsAccounts) ? If( __jsonRunAsAccounts as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __l) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__l, (__k)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRunAsAccount) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RunAsAccount.FromJson(__k) )) ))() : null : RunAsAccount;} + {_replicationPairCount = If( json?.PropertyT("replicationPairCount"), out var __jsonReplicationPairCount) ? (string)__jsonReplicationPairCount : (string)ReplicationPairCount;} + {_processServerCount = If( json?.PropertyT("processServerCount"), out var __jsonProcessServerCount) ? (string)__jsonProcessServerCount : (string)ProcessServerCount;} + {_agentCount = If( json?.PropertyT("agentCount"), out var __jsonAgentCount) ? (string)__jsonAgentCount : (string)AgentCount;} + {_protectedServer = If( json?.PropertyT("protectedServers"), out var __jsonProtectedServers) ? (string)__jsonProtectedServers : (string)ProtectedServer;} + {_systemLoad = If( json?.PropertyT("systemLoad"), out var __jsonSystemLoad) ? (string)__jsonSystemLoad : (string)SystemLoad;} + {_systemLoadStatus = If( json?.PropertyT("systemLoadStatus"), out var __jsonSystemLoadStatus) ? (string)__jsonSystemLoadStatus : (string)SystemLoadStatus;} + {_cpuLoad = If( json?.PropertyT("cpuLoad"), out var __jsonCpuLoad) ? (string)__jsonCpuLoad : (string)CpuLoad;} + {_cpuLoadStatus = If( json?.PropertyT("cpuLoadStatus"), out var __jsonCpuLoadStatus) ? (string)__jsonCpuLoadStatus : (string)CpuLoadStatus;} + {_totalMemoryInByte = If( json?.PropertyT("totalMemoryInBytes"), out var __jsonTotalMemoryInBytes) ? (long?)__jsonTotalMemoryInBytes : TotalMemoryInByte;} + {_availableMemoryInByte = If( json?.PropertyT("availableMemoryInBytes"), out var __jsonAvailableMemoryInBytes) ? (long?)__jsonAvailableMemoryInBytes : AvailableMemoryInByte;} + {_memoryUsageStatus = If( json?.PropertyT("memoryUsageStatus"), out var __jsonMemoryUsageStatus) ? (string)__jsonMemoryUsageStatus : (string)MemoryUsageStatus;} + {_totalSpaceInByte = If( json?.PropertyT("totalSpaceInBytes"), out var __jsonTotalSpaceInBytes) ? (long?)__jsonTotalSpaceInBytes : TotalSpaceInByte;} + {_availableSpaceInByte = If( json?.PropertyT("availableSpaceInBytes"), out var __jsonAvailableSpaceInBytes) ? (long?)__jsonAvailableSpaceInBytes : AvailableSpaceInByte;} + {_spaceUsageStatus = If( json?.PropertyT("spaceUsageStatus"), out var __jsonSpaceUsageStatus) ? (string)__jsonSpaceUsageStatus : (string)SpaceUsageStatus;} + {_webLoad = If( json?.PropertyT("webLoad"), out var __jsonWebLoad) ? (string)__jsonWebLoad : (string)WebLoad;} + {_webLoadStatus = If( json?.PropertyT("webLoadStatus"), out var __jsonWebLoadStatus) ? (string)__jsonWebLoadStatus : (string)WebLoadStatus;} + {_databaseServerLoad = If( json?.PropertyT("databaseServerLoad"), out var __jsonDatabaseServerLoad) ? (string)__jsonDatabaseServerLoad : (string)DatabaseServerLoad;} + {_databaseServerLoadStatus = If( json?.PropertyT("databaseServerLoadStatus"), out var __jsonDatabaseServerLoadStatus) ? (string)__jsonDatabaseServerLoadStatus : (string)DatabaseServerLoadStatus;} + {_csServiceStatus = If( json?.PropertyT("csServiceStatus"), out var __jsonCsServiceStatus) ? (string)__jsonCsServiceStatus : (string)CsServiceStatus;} + {_iPAddress = If( json?.PropertyT("ipAddress"), out var __jsonIPAddress) ? (string)__jsonIPAddress : (string)IPAddress;} + {_agentVersion = If( json?.PropertyT("agentVersion"), out var __jsonAgentVersion) ? (string)__jsonAgentVersion : (string)AgentVersion;} + {_hostName = If( json?.PropertyT("hostName"), out var __jsonHostName) ? (string)__jsonHostName : (string)HostName;} + {_lastHeartbeat = If( json?.PropertyT("lastHeartbeat"), out var __jsonLastHeartbeat) ? global::System.DateTime.TryParse((string)__jsonLastHeartbeat, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonLastHeartbeatValue) ? __jsonLastHeartbeatValue : LastHeartbeat : LastHeartbeat;} + {_versionStatus = If( json?.PropertyT("versionStatus"), out var __jsonVersionStatus) ? (string)__jsonVersionStatus : (string)VersionStatus;} + {_sslCertExpiryDate = If( json?.PropertyT("sslCertExpiryDate"), out var __jsonSslCertExpiryDate) ? global::System.DateTime.TryParse((string)__jsonSslCertExpiryDate, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonSslCertExpiryDateValue) ? __jsonSslCertExpiryDateValue : SslCertExpiryDate : SslCertExpiryDate;} + {_sslCertExpiryRemainingDay = If( json?.PropertyT("sslCertExpiryRemainingDays"), out var __jsonSslCertExpiryRemainingDays) ? (int?)__jsonSslCertExpiryRemainingDays : SslCertExpiryRemainingDay;} + {_psTemplateVersion = If( json?.PropertyT("psTemplateVersion"), out var __jsonPsTemplateVersion) ? (string)__jsonPsTemplateVersion : (string)PsTemplateVersion;} + {_agentExpiryDate = If( json?.PropertyT("agentExpiryDate"), out var __jsonAgentExpiryDate) ? global::System.DateTime.TryParse((string)__jsonAgentExpiryDate, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonAgentExpiryDateValue) ? __jsonAgentExpiryDateValue : AgentExpiryDate : AgentExpiryDate;} + {_switchProviderBlockingErrorDetail = If( json?.PropertyT("switchProviderBlockingErrorDetails"), out var __jsonSwitchProviderBlockingErrorDetails) ? If( __jsonSwitchProviderBlockingErrorDetails as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __g) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__g, (__f)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageFabricSwitchProviderBlockingErrorDetails) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageFabricSwitchProviderBlockingErrorDetails.FromJson(__f) )) ))() : null : SwitchProviderBlockingErrorDetail;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareV2FabricCreationInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareV2FabricCreationInput.PowerShell.cs new file mode 100644 index 000000000000..976744094be2 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareV2FabricCreationInput.PowerShell.cs @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// VMwareV2 fabric provider specific settings. + [System.ComponentModel.TypeConverter(typeof(VMwareV2FabricCreationInputTypeConverter))] + public partial class VMwareV2FabricCreationInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareV2FabricCreationInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VMwareV2FabricCreationInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareV2FabricCreationInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VMwareV2FabricCreationInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareV2FabricCreationInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VMwareV2FabricCreationInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("VmwareSiteId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareV2FabricCreationInputInternal)this).VmwareSiteId = (string) content.GetValueForProperty("VmwareSiteId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareV2FabricCreationInputInternal)this).VmwareSiteId, global::System.Convert.ToString); + } + if (content.Contains("PhysicalSiteId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareV2FabricCreationInputInternal)this).PhysicalSiteId = (string) content.GetValueForProperty("PhysicalSiteId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareV2FabricCreationInputInternal)this).PhysicalSiteId, global::System.Convert.ToString); + } + if (content.Contains("MigrationSolutionId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareV2FabricCreationInputInternal)this).MigrationSolutionId = (string) content.GetValueForProperty("MigrationSolutionId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareV2FabricCreationInputInternal)this).MigrationSolutionId, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreationInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreationInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal VMwareV2FabricCreationInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("VmwareSiteId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareV2FabricCreationInputInternal)this).VmwareSiteId = (string) content.GetValueForProperty("VmwareSiteId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareV2FabricCreationInputInternal)this).VmwareSiteId, global::System.Convert.ToString); + } + if (content.Contains("PhysicalSiteId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareV2FabricCreationInputInternal)this).PhysicalSiteId = (string) content.GetValueForProperty("PhysicalSiteId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareV2FabricCreationInputInternal)this).PhysicalSiteId, global::System.Convert.ToString); + } + if (content.Contains("MigrationSolutionId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareV2FabricCreationInputInternal)this).MigrationSolutionId = (string) content.GetValueForProperty("MigrationSolutionId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareV2FabricCreationInputInternal)this).MigrationSolutionId, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreationInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreationInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + } + /// VMwareV2 fabric provider specific settings. + [System.ComponentModel.TypeConverter(typeof(VMwareV2FabricCreationInputTypeConverter))] + public partial interface IVMwareV2FabricCreationInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareV2FabricCreationInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareV2FabricCreationInput.TypeConverter.cs new file mode 100644 index 000000000000..9d92334ca810 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareV2FabricCreationInput.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VMwareV2FabricCreationInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareV2FabricCreationInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareV2FabricCreationInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VMwareV2FabricCreationInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VMwareV2FabricCreationInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VMwareV2FabricCreationInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareV2FabricCreationInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareV2FabricCreationInput.cs new file mode 100644 index 000000000000..96e2d0dcb8d3 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareV2FabricCreationInput.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// VMwareV2 fabric provider specific settings. + public partial class VMwareV2FabricCreationInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareV2FabricCreationInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareV2FabricCreationInputInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreationInput __fabricSpecificCreationInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FabricSpecificCreationInput(); + + /// Gets the class type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreationInputInternal)__fabricSpecificCreationInput).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreationInputInternal)__fabricSpecificCreationInput).InstanceType = value ; } + + /// Backing field for property. + private string _migrationSolutionId; + + /// The ARM Id of the migration solution. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string MigrationSolutionId { get => this._migrationSolutionId; set => this._migrationSolutionId = value; } + + /// Backing field for property. + private string _physicalSiteId; + + /// The ARM Id of the physical site. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string PhysicalSiteId { get => this._physicalSiteId; set => this._physicalSiteId = value; } + + /// Backing field for property. + private string _vmwareSiteId; + + /// The ARM Id of the VMware site. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string VmwareSiteId { get => this._vmwareSiteId; set => this._vmwareSiteId = value; } + + /// Creates an new instance. + public VMwareV2FabricCreationInput() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__fabricSpecificCreationInput), __fabricSpecificCreationInput); + await eventListener.AssertObjectIsValid(nameof(__fabricSpecificCreationInput), __fabricSpecificCreationInput); + } + } + /// VMwareV2 fabric provider specific settings. + public partial interface IVMwareV2FabricCreationInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreationInput + { + /// The ARM Id of the migration solution. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ARM Id of the migration solution.", + SerializedName = @"migrationSolutionId", + PossibleTypes = new [] { typeof(string) })] + string MigrationSolutionId { get; set; } + /// The ARM Id of the physical site. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The ARM Id of the physical site.", + SerializedName = @"physicalSiteId", + PossibleTypes = new [] { typeof(string) })] + string PhysicalSiteId { get; set; } + /// The ARM Id of the VMware site. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The ARM Id of the VMware site.", + SerializedName = @"vmwareSiteId", + PossibleTypes = new [] { typeof(string) })] + string VmwareSiteId { get; set; } + + } + /// VMwareV2 fabric provider specific settings. + internal partial interface IVMwareV2FabricCreationInputInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreationInputInternal + { + /// The ARM Id of the migration solution. + string MigrationSolutionId { get; set; } + /// The ARM Id of the physical site. + string PhysicalSiteId { get; set; } + /// The ARM Id of the VMware site. + string VmwareSiteId { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareV2FabricCreationInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareV2FabricCreationInput.json.cs new file mode 100644 index 000000000000..f91a57662c64 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareV2FabricCreationInput.json.cs @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// VMwareV2 fabric provider specific settings. + public partial class VMwareV2FabricCreationInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareV2FabricCreationInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareV2FabricCreationInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareV2FabricCreationInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new VMwareV2FabricCreationInput(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __fabricSpecificCreationInput?.ToJson(container, serializationMode); + AddIf( null != (((object)this._vmwareSiteId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._vmwareSiteId.ToString()) : null, "vmwareSiteId" ,container.Add ); + AddIf( null != (((object)this._physicalSiteId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._physicalSiteId.ToString()) : null, "physicalSiteId" ,container.Add ); + AddIf( null != (((object)this._migrationSolutionId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._migrationSolutionId.ToString()) : null, "migrationSolutionId" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal VMwareV2FabricCreationInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __fabricSpecificCreationInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FabricSpecificCreationInput(json); + {_vmwareSiteId = If( json?.PropertyT("vmwareSiteId"), out var __jsonVmwareSiteId) ? (string)__jsonVmwareSiteId : (string)VmwareSiteId;} + {_physicalSiteId = If( json?.PropertyT("physicalSiteId"), out var __jsonPhysicalSiteId) ? (string)__jsonPhysicalSiteId : (string)PhysicalSiteId;} + {_migrationSolutionId = If( json?.PropertyT("migrationSolutionId"), out var __jsonMigrationSolutionId) ? (string)__jsonMigrationSolutionId : (string)MigrationSolutionId;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareV2FabricSpecificDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareV2FabricSpecificDetails.PowerShell.cs new file mode 100644 index 000000000000..f50f502f62dc --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareV2FabricSpecificDetails.PowerShell.cs @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// VMwareV2 fabric specific details. + [System.ComponentModel.TypeConverter(typeof(VMwareV2FabricSpecificDetailsTypeConverter))] + public partial class VMwareV2FabricSpecificDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareV2FabricSpecificDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VMwareV2FabricSpecificDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareV2FabricSpecificDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VMwareV2FabricSpecificDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareV2FabricSpecificDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VMwareV2FabricSpecificDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("VmwareSiteId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareV2FabricSpecificDetailsInternal)this).VmwareSiteId = (string) content.GetValueForProperty("VmwareSiteId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareV2FabricSpecificDetailsInternal)this).VmwareSiteId, global::System.Convert.ToString); + } + if (content.Contains("PhysicalSiteId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareV2FabricSpecificDetailsInternal)this).PhysicalSiteId = (string) content.GetValueForProperty("PhysicalSiteId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareV2FabricSpecificDetailsInternal)this).PhysicalSiteId, global::System.Convert.ToString); + } + if (content.Contains("MigrationSolutionId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareV2FabricSpecificDetailsInternal)this).MigrationSolutionId = (string) content.GetValueForProperty("MigrationSolutionId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareV2FabricSpecificDetailsInternal)this).MigrationSolutionId, global::System.Convert.ToString); + } + if (content.Contains("ServiceEndpoint")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareV2FabricSpecificDetailsInternal)this).ServiceEndpoint = (string) content.GetValueForProperty("ServiceEndpoint",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareV2FabricSpecificDetailsInternal)this).ServiceEndpoint, global::System.Convert.ToString); + } + if (content.Contains("ServiceResourceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareV2FabricSpecificDetailsInternal)this).ServiceResourceId = (string) content.GetValueForProperty("ServiceResourceId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareV2FabricSpecificDetailsInternal)this).ServiceResourceId, global::System.Convert.ToString); + } + if (content.Contains("ServiceContainerId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareV2FabricSpecificDetailsInternal)this).ServiceContainerId = (string) content.GetValueForProperty("ServiceContainerId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareV2FabricSpecificDetailsInternal)this).ServiceContainerId, global::System.Convert.ToString); + } + if (content.Contains("ProcessServer")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareV2FabricSpecificDetailsInternal)this).ProcessServer = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetails[]) content.GetValueForProperty("ProcessServer",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareV2FabricSpecificDetailsInternal)this).ProcessServer, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProcessServerDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal VMwareV2FabricSpecificDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("VmwareSiteId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareV2FabricSpecificDetailsInternal)this).VmwareSiteId = (string) content.GetValueForProperty("VmwareSiteId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareV2FabricSpecificDetailsInternal)this).VmwareSiteId, global::System.Convert.ToString); + } + if (content.Contains("PhysicalSiteId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareV2FabricSpecificDetailsInternal)this).PhysicalSiteId = (string) content.GetValueForProperty("PhysicalSiteId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareV2FabricSpecificDetailsInternal)this).PhysicalSiteId, global::System.Convert.ToString); + } + if (content.Contains("MigrationSolutionId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareV2FabricSpecificDetailsInternal)this).MigrationSolutionId = (string) content.GetValueForProperty("MigrationSolutionId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareV2FabricSpecificDetailsInternal)this).MigrationSolutionId, global::System.Convert.ToString); + } + if (content.Contains("ServiceEndpoint")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareV2FabricSpecificDetailsInternal)this).ServiceEndpoint = (string) content.GetValueForProperty("ServiceEndpoint",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareV2FabricSpecificDetailsInternal)this).ServiceEndpoint, global::System.Convert.ToString); + } + if (content.Contains("ServiceResourceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareV2FabricSpecificDetailsInternal)this).ServiceResourceId = (string) content.GetValueForProperty("ServiceResourceId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareV2FabricSpecificDetailsInternal)this).ServiceResourceId, global::System.Convert.ToString); + } + if (content.Contains("ServiceContainerId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareV2FabricSpecificDetailsInternal)this).ServiceContainerId = (string) content.GetValueForProperty("ServiceContainerId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareV2FabricSpecificDetailsInternal)this).ServiceContainerId, global::System.Convert.ToString); + } + if (content.Contains("ProcessServer")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareV2FabricSpecificDetailsInternal)this).ProcessServer = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetails[]) content.GetValueForProperty("ProcessServer",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareV2FabricSpecificDetailsInternal)this).ProcessServer, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProcessServerDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + } + /// VMwareV2 fabric specific details. + [System.ComponentModel.TypeConverter(typeof(VMwareV2FabricSpecificDetailsTypeConverter))] + public partial interface IVMwareV2FabricSpecificDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareV2FabricSpecificDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareV2FabricSpecificDetails.TypeConverter.cs new file mode 100644 index 000000000000..75e0180abab6 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareV2FabricSpecificDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VMwareV2FabricSpecificDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareV2FabricSpecificDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareV2FabricSpecificDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VMwareV2FabricSpecificDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VMwareV2FabricSpecificDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VMwareV2FabricSpecificDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareV2FabricSpecificDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareV2FabricSpecificDetails.cs new file mode 100644 index 000000000000..4ffc3e9b7ce5 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareV2FabricSpecificDetails.cs @@ -0,0 +1,197 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// VMwareV2 fabric specific details. + public partial class VMwareV2FabricSpecificDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareV2FabricSpecificDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareV2FabricSpecificDetailsInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificDetails __fabricSpecificDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FabricSpecificDetails(); + + /// Gets the class type. Overridden in derived classes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificDetailsInternal)__fabricSpecificDetails).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificDetailsInternal)__fabricSpecificDetails).InstanceType = value ; } + + /// Internal Acessors for MigrationSolutionId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareV2FabricSpecificDetailsInternal.MigrationSolutionId { get => this._migrationSolutionId; set { {_migrationSolutionId = value;} } } + + /// Internal Acessors for PhysicalSiteId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareV2FabricSpecificDetailsInternal.PhysicalSiteId { get => this._physicalSiteId; set { {_physicalSiteId = value;} } } + + /// Internal Acessors for ProcessServer + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetails[] Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareV2FabricSpecificDetailsInternal.ProcessServer { get => this._processServer; set { {_processServer = value;} } } + + /// Internal Acessors for ServiceContainerId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareV2FabricSpecificDetailsInternal.ServiceContainerId { get => this._serviceContainerId; set { {_serviceContainerId = value;} } } + + /// Internal Acessors for ServiceEndpoint + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareV2FabricSpecificDetailsInternal.ServiceEndpoint { get => this._serviceEndpoint; set { {_serviceEndpoint = value;} } } + + /// Internal Acessors for ServiceResourceId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareV2FabricSpecificDetailsInternal.ServiceResourceId { get => this._serviceResourceId; set { {_serviceResourceId = value;} } } + + /// Internal Acessors for VmwareSiteId + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareV2FabricSpecificDetailsInternal.VmwareSiteId { get => this._vmwareSiteId; set { {_vmwareSiteId = value;} } } + + /// Backing field for property. + private string _migrationSolutionId; + + /// The Migration solution ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string MigrationSolutionId { get => this._migrationSolutionId; } + + /// Backing field for property. + private string _physicalSiteId; + + /// The ARM Id of the physical site. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string PhysicalSiteId { get => this._physicalSiteId; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetails[] _processServer; + + /// The list of process servers. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetails[] ProcessServer { get => this._processServer; } + + /// Backing field for property. + private string _serviceContainerId; + + /// The service container Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ServiceContainerId { get => this._serviceContainerId; } + + /// Backing field for property. + private string _serviceEndpoint; + + /// The service endpoint. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ServiceEndpoint { get => this._serviceEndpoint; } + + /// Backing field for property. + private string _serviceResourceId; + + /// The service resource Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ServiceResourceId { get => this._serviceResourceId; } + + /// Backing field for property. + private string _vmwareSiteId; + + /// The ARM Id of the VMware site. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string VmwareSiteId { get => this._vmwareSiteId; } + + /// Creates an new instance. + public VMwareV2FabricSpecificDetails() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__fabricSpecificDetails), __fabricSpecificDetails); + await eventListener.AssertObjectIsValid(nameof(__fabricSpecificDetails), __fabricSpecificDetails); + } + } + /// VMwareV2 fabric specific details. + public partial interface IVMwareV2FabricSpecificDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificDetails + { + /// The Migration solution ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The Migration solution ARM Id.", + SerializedName = @"migrationSolutionId", + PossibleTypes = new [] { typeof(string) })] + string MigrationSolutionId { get; } + /// The ARM Id of the physical site. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The ARM Id of the physical site.", + SerializedName = @"physicalSiteId", + PossibleTypes = new [] { typeof(string) })] + string PhysicalSiteId { get; } + /// The list of process servers. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The list of process servers.", + SerializedName = @"processServers", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetails) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetails[] ProcessServer { get; } + /// The service container Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The service container Id.", + SerializedName = @"serviceContainerId", + PossibleTypes = new [] { typeof(string) })] + string ServiceContainerId { get; } + /// The service endpoint. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The service endpoint.", + SerializedName = @"serviceEndpoint", + PossibleTypes = new [] { typeof(string) })] + string ServiceEndpoint { get; } + /// The service resource Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The service resource Id.", + SerializedName = @"serviceResourceId", + PossibleTypes = new [] { typeof(string) })] + string ServiceResourceId { get; } + /// The ARM Id of the VMware site. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The ARM Id of the VMware site.", + SerializedName = @"vmwareSiteId", + PossibleTypes = new [] { typeof(string) })] + string VmwareSiteId { get; } + + } + /// VMwareV2 fabric specific details. + internal partial interface IVMwareV2FabricSpecificDetailsInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificDetailsInternal + { + /// The Migration solution ARM Id. + string MigrationSolutionId { get; set; } + /// The ARM Id of the physical site. + string PhysicalSiteId { get; set; } + /// The list of process servers. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetails[] ProcessServer { get; set; } + /// The service container Id. + string ServiceContainerId { get; set; } + /// The service endpoint. + string ServiceEndpoint { get; set; } + /// The service resource Id. + string ServiceResourceId { get; set; } + /// The ARM Id of the VMware site. + string VmwareSiteId { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareV2FabricSpecificDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareV2FabricSpecificDetails.json.cs new file mode 100644 index 000000000000..d107b057f6e7 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareV2FabricSpecificDetails.json.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// VMwareV2 fabric specific details. + public partial class VMwareV2FabricSpecificDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareV2FabricSpecificDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareV2FabricSpecificDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareV2FabricSpecificDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new VMwareV2FabricSpecificDetails(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __fabricSpecificDetails?.ToJson(container, serializationMode); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._vmwareSiteId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._vmwareSiteId.ToString()) : null, "vmwareSiteId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._physicalSiteId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._physicalSiteId.ToString()) : null, "physicalSiteId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._migrationSolutionId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._migrationSolutionId.ToString()) : null, "migrationSolutionId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._serviceEndpoint)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._serviceEndpoint.ToString()) : null, "serviceEndpoint" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._serviceResourceId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._serviceResourceId.ToString()) : null, "serviceResourceId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._serviceContainerId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._serviceContainerId.ToString()) : null, "serviceContainerId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeReadOnly)) + { + if (null != this._processServer) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._processServer ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("processServers",__w); + } + } + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal VMwareV2FabricSpecificDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __fabricSpecificDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FabricSpecificDetails(json); + {_vmwareSiteId = If( json?.PropertyT("vmwareSiteId"), out var __jsonVmwareSiteId) ? (string)__jsonVmwareSiteId : (string)VmwareSiteId;} + {_physicalSiteId = If( json?.PropertyT("physicalSiteId"), out var __jsonPhysicalSiteId) ? (string)__jsonPhysicalSiteId : (string)PhysicalSiteId;} + {_migrationSolutionId = If( json?.PropertyT("migrationSolutionId"), out var __jsonMigrationSolutionId) ? (string)__jsonMigrationSolutionId : (string)MigrationSolutionId;} + {_serviceEndpoint = If( json?.PropertyT("serviceEndpoint"), out var __jsonServiceEndpoint) ? (string)__jsonServiceEndpoint : (string)ServiceEndpoint;} + {_serviceResourceId = If( json?.PropertyT("serviceResourceId"), out var __jsonServiceResourceId) ? (string)__jsonServiceResourceId : (string)ServiceResourceId;} + {_serviceContainerId = If( json?.PropertyT("serviceContainerId"), out var __jsonServiceContainerId) ? (string)__jsonServiceContainerId : (string)ServiceContainerId;} + {_processServer = If( json?.PropertyT("processServers"), out var __jsonProcessServers) ? If( __jsonProcessServers as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProcessServerDetails) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProcessServerDetails.FromJson(__u) )) ))() : null : ProcessServer;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareVirtualMachineDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareVirtualMachineDetails.PowerShell.cs new file mode 100644 index 000000000000..dd1ab297ff5d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareVirtualMachineDetails.PowerShell.cs @@ -0,0 +1,226 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// VMware provider specific settings. + [System.ComponentModel.TypeConverter(typeof(VMwareVirtualMachineDetailsTypeConverter))] + public partial class VMwareVirtualMachineDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareVirtualMachineDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VMwareVirtualMachineDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareVirtualMachineDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VMwareVirtualMachineDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareVirtualMachineDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VMwareVirtualMachineDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("AgentGeneratedId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareVirtualMachineDetailsInternal)this).AgentGeneratedId = (string) content.GetValueForProperty("AgentGeneratedId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareVirtualMachineDetailsInternal)this).AgentGeneratedId, global::System.Convert.ToString); + } + if (content.Contains("AgentInstalled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareVirtualMachineDetailsInternal)this).AgentInstalled = (string) content.GetValueForProperty("AgentInstalled",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareVirtualMachineDetailsInternal)this).AgentInstalled, global::System.Convert.ToString); + } + if (content.Contains("OSType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareVirtualMachineDetailsInternal)this).OSType = (string) content.GetValueForProperty("OSType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareVirtualMachineDetailsInternal)this).OSType, global::System.Convert.ToString); + } + if (content.Contains("AgentVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareVirtualMachineDetailsInternal)this).AgentVersion = (string) content.GetValueForProperty("AgentVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareVirtualMachineDetailsInternal)this).AgentVersion, global::System.Convert.ToString); + } + if (content.Contains("IPAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareVirtualMachineDetailsInternal)this).IPAddress = (string) content.GetValueForProperty("IPAddress",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareVirtualMachineDetailsInternal)this).IPAddress, global::System.Convert.ToString); + } + if (content.Contains("PoweredOn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareVirtualMachineDetailsInternal)this).PoweredOn = (string) content.GetValueForProperty("PoweredOn",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareVirtualMachineDetailsInternal)this).PoweredOn, global::System.Convert.ToString); + } + if (content.Contains("VCenterInfrastructureId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareVirtualMachineDetailsInternal)this).VCenterInfrastructureId = (string) content.GetValueForProperty("VCenterInfrastructureId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareVirtualMachineDetailsInternal)this).VCenterInfrastructureId, global::System.Convert.ToString); + } + if (content.Contains("DiscoveryType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareVirtualMachineDetailsInternal)this).DiscoveryType = (string) content.GetValueForProperty("DiscoveryType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareVirtualMachineDetailsInternal)this).DiscoveryType, global::System.Convert.ToString); + } + if (content.Contains("DiskDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareVirtualMachineDetailsInternal)this).DiskDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskDetails[]) content.GetValueForProperty("DiskDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareVirtualMachineDetailsInternal)this).DiskDetail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageDiskDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("ValidationError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareVirtualMachineDetailsInternal)this).ValidationError = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[]) content.GetValueForProperty("ValidationError",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareVirtualMachineDetailsInternal)this).ValidationError, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigurationSettingsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigurationSettingsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal VMwareVirtualMachineDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("AgentGeneratedId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareVirtualMachineDetailsInternal)this).AgentGeneratedId = (string) content.GetValueForProperty("AgentGeneratedId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareVirtualMachineDetailsInternal)this).AgentGeneratedId, global::System.Convert.ToString); + } + if (content.Contains("AgentInstalled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareVirtualMachineDetailsInternal)this).AgentInstalled = (string) content.GetValueForProperty("AgentInstalled",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareVirtualMachineDetailsInternal)this).AgentInstalled, global::System.Convert.ToString); + } + if (content.Contains("OSType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareVirtualMachineDetailsInternal)this).OSType = (string) content.GetValueForProperty("OSType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareVirtualMachineDetailsInternal)this).OSType, global::System.Convert.ToString); + } + if (content.Contains("AgentVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareVirtualMachineDetailsInternal)this).AgentVersion = (string) content.GetValueForProperty("AgentVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareVirtualMachineDetailsInternal)this).AgentVersion, global::System.Convert.ToString); + } + if (content.Contains("IPAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareVirtualMachineDetailsInternal)this).IPAddress = (string) content.GetValueForProperty("IPAddress",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareVirtualMachineDetailsInternal)this).IPAddress, global::System.Convert.ToString); + } + if (content.Contains("PoweredOn")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareVirtualMachineDetailsInternal)this).PoweredOn = (string) content.GetValueForProperty("PoweredOn",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareVirtualMachineDetailsInternal)this).PoweredOn, global::System.Convert.ToString); + } + if (content.Contains("VCenterInfrastructureId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareVirtualMachineDetailsInternal)this).VCenterInfrastructureId = (string) content.GetValueForProperty("VCenterInfrastructureId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareVirtualMachineDetailsInternal)this).VCenterInfrastructureId, global::System.Convert.ToString); + } + if (content.Contains("DiscoveryType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareVirtualMachineDetailsInternal)this).DiscoveryType = (string) content.GetValueForProperty("DiscoveryType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareVirtualMachineDetailsInternal)this).DiscoveryType, global::System.Convert.ToString); + } + if (content.Contains("DiskDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareVirtualMachineDetailsInternal)this).DiskDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskDetails[]) content.GetValueForProperty("DiskDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareVirtualMachineDetailsInternal)this).DiskDetail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageDiskDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("ValidationError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareVirtualMachineDetailsInternal)this).ValidationError = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[]) content.GetValueForProperty("ValidationError",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareVirtualMachineDetailsInternal)this).ValidationError, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigurationSettingsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigurationSettingsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + } + /// VMware provider specific settings. + [System.ComponentModel.TypeConverter(typeof(VMwareVirtualMachineDetailsTypeConverter))] + public partial interface IVMwareVirtualMachineDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareVirtualMachineDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareVirtualMachineDetails.TypeConverter.cs new file mode 100644 index 000000000000..e645c206f237 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareVirtualMachineDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VMwareVirtualMachineDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareVirtualMachineDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareVirtualMachineDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VMwareVirtualMachineDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VMwareVirtualMachineDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VMwareVirtualMachineDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareVirtualMachineDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareVirtualMachineDetails.cs new file mode 100644 index 000000000000..da5f51916740 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareVirtualMachineDetails.cs @@ -0,0 +1,239 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// VMware provider specific settings. + public partial class VMwareVirtualMachineDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareVirtualMachineDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareVirtualMachineDetailsInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigurationSettings __configurationSettings = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ConfigurationSettings(); + + /// Backing field for property. + private string _agentGeneratedId; + + /// + /// The ID generated by the InMage agent after it gets installed on guest. This is the ID to be used during InMage CreateProtection. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string AgentGeneratedId { get => this._agentGeneratedId; set => this._agentGeneratedId = value; } + + /// Backing field for property. + private string _agentInstalled; + + /// The value indicating if InMage scout agent is installed on guest. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string AgentInstalled { get => this._agentInstalled; set => this._agentInstalled = value; } + + /// Backing field for property. + private string _agentVersion; + + /// The agent version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string AgentVersion { get => this._agentVersion; set => this._agentVersion = value; } + + /// Backing field for property. + private string _discoveryType; + + /// + /// A value indicating the discovery type of the machine. Value can be vCenter or physical. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string DiscoveryType { get => this._discoveryType; set => this._discoveryType = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskDetails[] _diskDetail; + + /// The disk details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskDetails[] DiskDetail { get => this._diskDetail; set => this._diskDetail = value; } + + /// Backing field for property. + private string _iPAddress; + + /// The IP address. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string IPAddress { get => this._iPAddress; set => this._iPAddress = value; } + + /// Gets the class type. Overridden in derived classes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigurationSettingsInternal)__configurationSettings).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigurationSettingsInternal)__configurationSettings).InstanceType = value ; } + + /// Backing field for property. + private string _oSType; + + /// The OsType installed on VM. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string OSType { get => this._oSType; set => this._oSType = value; } + + /// Backing field for property. + private string _poweredOn; + + /// The value indicating whether VM is powered on. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string PoweredOn { get => this._poweredOn; set => this._poweredOn = value; } + + /// Backing field for property. + private string _vCenterInfrastructureId; + + /// The VCenter infrastructure Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string VCenterInfrastructureId { get => this._vCenterInfrastructureId; set => this._vCenterInfrastructureId = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] _validationError; + + /// The validation errors. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] ValidationError { get => this._validationError; set => this._validationError = value; } + + /// Creates an new instance. + public VMwareVirtualMachineDetails() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__configurationSettings), __configurationSettings); + await eventListener.AssertObjectIsValid(nameof(__configurationSettings), __configurationSettings); + } + } + /// VMware provider specific settings. + public partial interface IVMwareVirtualMachineDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigurationSettings + { + /// + /// The ID generated by the InMage agent after it gets installed on guest. This is the ID to be used during InMage CreateProtection. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The ID generated by the InMage agent after it gets installed on guest. This is the ID to be used during InMage CreateProtection.", + SerializedName = @"agentGeneratedId", + PossibleTypes = new [] { typeof(string) })] + string AgentGeneratedId { get; set; } + /// The value indicating if InMage scout agent is installed on guest. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The value indicating if InMage scout agent is installed on guest.", + SerializedName = @"agentInstalled", + PossibleTypes = new [] { typeof(string) })] + string AgentInstalled { get; set; } + /// The agent version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The agent version.", + SerializedName = @"agentVersion", + PossibleTypes = new [] { typeof(string) })] + string AgentVersion { get; set; } + /// + /// A value indicating the discovery type of the machine. Value can be vCenter or physical. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating the discovery type of the machine. Value can be vCenter or physical.", + SerializedName = @"discoveryType", + PossibleTypes = new [] { typeof(string) })] + string DiscoveryType { get; set; } + /// The disk details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The disk details.", + SerializedName = @"diskDetails", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskDetails) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskDetails[] DiskDetail { get; set; } + /// The IP address. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The IP address.", + SerializedName = @"ipAddress", + PossibleTypes = new [] { typeof(string) })] + string IPAddress { get; set; } + /// The OsType installed on VM. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The OsType installed on VM.", + SerializedName = @"osType", + PossibleTypes = new [] { typeof(string) })] + string OSType { get; set; } + /// The value indicating whether VM is powered on. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The value indicating whether VM is powered on.", + SerializedName = @"poweredOn", + PossibleTypes = new [] { typeof(string) })] + string PoweredOn { get; set; } + /// The VCenter infrastructure Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The VCenter infrastructure Id.", + SerializedName = @"vCenterInfrastructureId", + PossibleTypes = new [] { typeof(string) })] + string VCenterInfrastructureId { get; set; } + /// The validation errors. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The validation errors.", + SerializedName = @"validationErrors", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] ValidationError { get; set; } + + } + /// VMware provider specific settings. + internal partial interface IVMwareVirtualMachineDetailsInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigurationSettingsInternal + { + /// + /// The ID generated by the InMage agent after it gets installed on guest. This is the ID to be used during InMage CreateProtection. + /// + string AgentGeneratedId { get; set; } + /// The value indicating if InMage scout agent is installed on guest. + string AgentInstalled { get; set; } + /// The agent version. + string AgentVersion { get; set; } + /// + /// A value indicating the discovery type of the machine. Value can be vCenter or physical. + /// + string DiscoveryType { get; set; } + /// The disk details. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskDetails[] DiskDetail { get; set; } + /// The IP address. + string IPAddress { get; set; } + /// The OsType installed on VM. + string OSType { get; set; } + /// The value indicating whether VM is powered on. + string PoweredOn { get; set; } + /// The VCenter infrastructure Id. + string VCenterInfrastructureId { get; set; } + /// The validation errors. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] ValidationError { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareVirtualMachineDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareVirtualMachineDetails.json.cs new file mode 100644 index 000000000000..e1a56ecec663 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VMwareVirtualMachineDetails.json.cs @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// VMware provider specific settings. + public partial class VMwareVirtualMachineDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareVirtualMachineDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareVirtualMachineDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMwareVirtualMachineDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new VMwareVirtualMachineDetails(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __configurationSettings?.ToJson(container, serializationMode); + AddIf( null != (((object)this._agentGeneratedId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._agentGeneratedId.ToString()) : null, "agentGeneratedId" ,container.Add ); + AddIf( null != (((object)this._agentInstalled)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._agentInstalled.ToString()) : null, "agentInstalled" ,container.Add ); + AddIf( null != (((object)this._oSType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._oSType.ToString()) : null, "osType" ,container.Add ); + AddIf( null != (((object)this._agentVersion)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._agentVersion.ToString()) : null, "agentVersion" ,container.Add ); + AddIf( null != (((object)this._iPAddress)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._iPAddress.ToString()) : null, "ipAddress" ,container.Add ); + AddIf( null != (((object)this._poweredOn)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._poweredOn.ToString()) : null, "poweredOn" ,container.Add ); + AddIf( null != (((object)this._vCenterInfrastructureId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._vCenterInfrastructureId.ToString()) : null, "vCenterInfrastructureId" ,container.Add ); + AddIf( null != (((object)this._discoveryType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._discoveryType.ToString()) : null, "discoveryType" ,container.Add ); + if (null != this._diskDetail) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._diskDetail ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("diskDetails",__w); + } + if (null != this._validationError) + { + var __r = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __s in this._validationError ) + { + AddIf(__s?.ToJson(null, serializationMode) ,__r.Add); + } + container.Add("validationErrors",__r); + } + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal VMwareVirtualMachineDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __configurationSettings = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ConfigurationSettings(json); + {_agentGeneratedId = If( json?.PropertyT("agentGeneratedId"), out var __jsonAgentGeneratedId) ? (string)__jsonAgentGeneratedId : (string)AgentGeneratedId;} + {_agentInstalled = If( json?.PropertyT("agentInstalled"), out var __jsonAgentInstalled) ? (string)__jsonAgentInstalled : (string)AgentInstalled;} + {_oSType = If( json?.PropertyT("osType"), out var __jsonOSType) ? (string)__jsonOSType : (string)OSType;} + {_agentVersion = If( json?.PropertyT("agentVersion"), out var __jsonAgentVersion) ? (string)__jsonAgentVersion : (string)AgentVersion;} + {_iPAddress = If( json?.PropertyT("ipAddress"), out var __jsonIPAddress) ? (string)__jsonIPAddress : (string)IPAddress;} + {_poweredOn = If( json?.PropertyT("poweredOn"), out var __jsonPoweredOn) ? (string)__jsonPoweredOn : (string)PoweredOn;} + {_vCenterInfrastructureId = If( json?.PropertyT("vCenterInfrastructureId"), out var __jsonVCenterInfrastructureId) ? (string)__jsonVCenterInfrastructureId : (string)VCenterInfrastructureId;} + {_discoveryType = If( json?.PropertyT("discoveryType"), out var __jsonDiscoveryType) ? (string)__jsonDiscoveryType : (string)DiscoveryType;} + {_diskDetail = If( json?.PropertyT("diskDetails"), out var __jsonDiskDetails) ? If( __jsonDiskDetails as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IInMageDiskDetails) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.InMageDiskDetails.FromJson(__u) )) ))() : null : DiskDetail;} + {_validationError = If( json?.PropertyT("validationErrors"), out var __jsonValidationErrors) ? If( __jsonValidationErrors as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __q) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__q, (__p)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthError.FromJson(__p) )) ))() : null : ValidationError;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VaultHealthDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VaultHealthDetails.PowerShell.cs new file mode 100644 index 000000000000..f062ac70f3b7 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VaultHealthDetails.PowerShell.cs @@ -0,0 +1,280 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Vault health details definition. + [System.ComponentModel.TypeConverter(typeof(VaultHealthDetailsTypeConverter))] + public partial class VaultHealthDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VaultHealthDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VaultHealthDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VaultHealthDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthDetailsInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthDetailsInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VaultHealthPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("ProtectedItemsHealth")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthDetailsInternal)this).ProtectedItemsHealth = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummary) content.GetValueForProperty("ProtectedItemsHealth",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthDetailsInternal)this).ProtectedItemsHealth, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ResourceHealthSummaryTypeConverter.ConvertFrom); + } + if (content.Contains("FabricsHealth")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthDetailsInternal)this).FabricsHealth = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummary) content.GetValueForProperty("FabricsHealth",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthDetailsInternal)this).FabricsHealth, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ResourceHealthSummaryTypeConverter.ConvertFrom); + } + if (content.Contains("ContainersHealth")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthDetailsInternal)this).ContainersHealth = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummary) content.GetValueForProperty("ContainersHealth",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthDetailsInternal)this).ContainersHealth, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ResourceHealthSummaryTypeConverter.ConvertFrom); + } + if (content.Contains("VaultError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthDetailsInternal)this).VaultError = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[]) content.GetValueForProperty("VaultError",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthDetailsInternal)this).VaultError, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("ProtectedItemHealthResourceCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthDetailsInternal)this).ProtectedItemHealthResourceCount = (int?) content.GetValueForProperty("ProtectedItemHealthResourceCount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthDetailsInternal)this).ProtectedItemHealthResourceCount, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("ProtectedItemHealthIssue")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthDetailsInternal)this).ProtectedItemHealthIssue = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorSummary[]) content.GetValueForProperty("ProtectedItemHealthIssue",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthDetailsInternal)this).ProtectedItemHealthIssue, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthErrorSummaryTypeConverter.ConvertFrom)); + } + if (content.Contains("ProtectedItemHealthCategorizedResourceCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthDetailsInternal)this).ProtectedItemHealthCategorizedResourceCount = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummaryCategorizedResourceCounts) content.GetValueForProperty("ProtectedItemHealthCategorizedResourceCount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthDetailsInternal)this).ProtectedItemHealthCategorizedResourceCount, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ResourceHealthSummaryCategorizedResourceCountsTypeConverter.ConvertFrom); + } + if (content.Contains("FabricHealthResourceCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthDetailsInternal)this).FabricHealthResourceCount = (int?) content.GetValueForProperty("FabricHealthResourceCount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthDetailsInternal)this).FabricHealthResourceCount, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("FabricHealthIssue")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthDetailsInternal)this).FabricHealthIssue = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorSummary[]) content.GetValueForProperty("FabricHealthIssue",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthDetailsInternal)this).FabricHealthIssue, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthErrorSummaryTypeConverter.ConvertFrom)); + } + if (content.Contains("FabricHealthCategorizedResourceCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthDetailsInternal)this).FabricHealthCategorizedResourceCount = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummaryCategorizedResourceCounts) content.GetValueForProperty("FabricHealthCategorizedResourceCount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthDetailsInternal)this).FabricHealthCategorizedResourceCount, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ResourceHealthSummaryCategorizedResourceCountsTypeConverter.ConvertFrom); + } + if (content.Contains("ContainerHealthResourceCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthDetailsInternal)this).ContainerHealthResourceCount = (int?) content.GetValueForProperty("ContainerHealthResourceCount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthDetailsInternal)this).ContainerHealthResourceCount, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("ContainerHealthIssue")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthDetailsInternal)this).ContainerHealthIssue = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorSummary[]) content.GetValueForProperty("ContainerHealthIssue",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthDetailsInternal)this).ContainerHealthIssue, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthErrorSummaryTypeConverter.ConvertFrom)); + } + if (content.Contains("ContainerHealthCategorizedResourceCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthDetailsInternal)this).ContainerHealthCategorizedResourceCount = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummaryCategorizedResourceCounts) content.GetValueForProperty("ContainerHealthCategorizedResourceCount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthDetailsInternal)this).ContainerHealthCategorizedResourceCount, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ResourceHealthSummaryCategorizedResourceCountsTypeConverter.ConvertFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal VaultHealthDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthDetailsInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthDetailsInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VaultHealthPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("ProtectedItemsHealth")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthDetailsInternal)this).ProtectedItemsHealth = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummary) content.GetValueForProperty("ProtectedItemsHealth",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthDetailsInternal)this).ProtectedItemsHealth, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ResourceHealthSummaryTypeConverter.ConvertFrom); + } + if (content.Contains("FabricsHealth")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthDetailsInternal)this).FabricsHealth = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummary) content.GetValueForProperty("FabricsHealth",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthDetailsInternal)this).FabricsHealth, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ResourceHealthSummaryTypeConverter.ConvertFrom); + } + if (content.Contains("ContainersHealth")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthDetailsInternal)this).ContainersHealth = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummary) content.GetValueForProperty("ContainersHealth",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthDetailsInternal)this).ContainersHealth, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ResourceHealthSummaryTypeConverter.ConvertFrom); + } + if (content.Contains("VaultError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthDetailsInternal)this).VaultError = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[]) content.GetValueForProperty("VaultError",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthDetailsInternal)this).VaultError, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("ProtectedItemHealthResourceCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthDetailsInternal)this).ProtectedItemHealthResourceCount = (int?) content.GetValueForProperty("ProtectedItemHealthResourceCount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthDetailsInternal)this).ProtectedItemHealthResourceCount, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("ProtectedItemHealthIssue")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthDetailsInternal)this).ProtectedItemHealthIssue = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorSummary[]) content.GetValueForProperty("ProtectedItemHealthIssue",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthDetailsInternal)this).ProtectedItemHealthIssue, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthErrorSummaryTypeConverter.ConvertFrom)); + } + if (content.Contains("ProtectedItemHealthCategorizedResourceCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthDetailsInternal)this).ProtectedItemHealthCategorizedResourceCount = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummaryCategorizedResourceCounts) content.GetValueForProperty("ProtectedItemHealthCategorizedResourceCount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthDetailsInternal)this).ProtectedItemHealthCategorizedResourceCount, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ResourceHealthSummaryCategorizedResourceCountsTypeConverter.ConvertFrom); + } + if (content.Contains("FabricHealthResourceCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthDetailsInternal)this).FabricHealthResourceCount = (int?) content.GetValueForProperty("FabricHealthResourceCount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthDetailsInternal)this).FabricHealthResourceCount, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("FabricHealthIssue")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthDetailsInternal)this).FabricHealthIssue = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorSummary[]) content.GetValueForProperty("FabricHealthIssue",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthDetailsInternal)this).FabricHealthIssue, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthErrorSummaryTypeConverter.ConvertFrom)); + } + if (content.Contains("FabricHealthCategorizedResourceCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthDetailsInternal)this).FabricHealthCategorizedResourceCount = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummaryCategorizedResourceCounts) content.GetValueForProperty("FabricHealthCategorizedResourceCount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthDetailsInternal)this).FabricHealthCategorizedResourceCount, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ResourceHealthSummaryCategorizedResourceCountsTypeConverter.ConvertFrom); + } + if (content.Contains("ContainerHealthResourceCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthDetailsInternal)this).ContainerHealthResourceCount = (int?) content.GetValueForProperty("ContainerHealthResourceCount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthDetailsInternal)this).ContainerHealthResourceCount, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("ContainerHealthIssue")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthDetailsInternal)this).ContainerHealthIssue = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorSummary[]) content.GetValueForProperty("ContainerHealthIssue",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthDetailsInternal)this).ContainerHealthIssue, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthErrorSummaryTypeConverter.ConvertFrom)); + } + if (content.Contains("ContainerHealthCategorizedResourceCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthDetailsInternal)this).ContainerHealthCategorizedResourceCount = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummaryCategorizedResourceCounts) content.GetValueForProperty("ContainerHealthCategorizedResourceCount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthDetailsInternal)this).ContainerHealthCategorizedResourceCount, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ResourceHealthSummaryCategorizedResourceCountsTypeConverter.ConvertFrom); + } + AfterDeserializePSObject(content); + } + } + /// Vault health details definition. + [System.ComponentModel.TypeConverter(typeof(VaultHealthDetailsTypeConverter))] + public partial interface IVaultHealthDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VaultHealthDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VaultHealthDetails.TypeConverter.cs new file mode 100644 index 000000000000..f5216700f8e6 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VaultHealthDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VaultHealthDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VaultHealthDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VaultHealthDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VaultHealthDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VaultHealthDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VaultHealthDetails.cs new file mode 100644 index 000000000000..969d6ae63222 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VaultHealthDetails.cs @@ -0,0 +1,245 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Vault health details definition. + public partial class VaultHealthDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthDetailsInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResource __resource = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.Resource(); + + /// The categorized resource counts. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummaryCategorizedResourceCounts ContainerHealthCategorizedResourceCount { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthPropertiesInternal)Property).ContainerHealthCategorizedResourceCount; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthPropertiesInternal)Property).ContainerHealthCategorizedResourceCount = value ?? null /* model class */; } + + /// The list of summary of health errors across the resources under the container. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorSummary[] ContainerHealthIssue { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthPropertiesInternal)Property).ContainerHealthIssue; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthPropertiesInternal)Property).ContainerHealthIssue = value ?? null /* arrayOf */; } + + /// The count of total resources under the container. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public int? ContainerHealthResourceCount { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthPropertiesInternal)Property).ContainerHealthResourceCount; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthPropertiesInternal)Property).ContainerHealthResourceCount = value ?? default(int); } + + /// The categorized resource counts. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummaryCategorizedResourceCounts FabricHealthCategorizedResourceCount { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthPropertiesInternal)Property).FabricHealthCategorizedResourceCount; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthPropertiesInternal)Property).FabricHealthCategorizedResourceCount = value ?? null /* model class */; } + + /// The list of summary of health errors across the resources under the container. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorSummary[] FabricHealthIssue { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthPropertiesInternal)Property).FabricHealthIssue; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthPropertiesInternal)Property).FabricHealthIssue = value ?? null /* arrayOf */; } + + /// The count of total resources under the container. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public int? FabricHealthResourceCount { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthPropertiesInternal)Property).FabricHealthResourceCount; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthPropertiesInternal)Property).FabricHealthResourceCount = value ?? default(int); } + + /// Resource Id + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Id; } + + /// Resource Location + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string Location { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Location; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Location = value ?? null; } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Id = value; } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Name = value; } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Type = value; } + + /// Internal Acessors for ContainersHealth + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummary Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthDetailsInternal.ContainersHealth { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthPropertiesInternal)Property).ContainersHealth; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthPropertiesInternal)Property).ContainersHealth = value; } + + /// Internal Acessors for FabricsHealth + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummary Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthDetailsInternal.FabricsHealth { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthPropertiesInternal)Property).FabricsHealth; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthPropertiesInternal)Property).FabricsHealth = value; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthProperties Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthDetailsInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VaultHealthProperties()); set { {_property = value;} } } + + /// Internal Acessors for ProtectedItemsHealth + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummary Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthDetailsInternal.ProtectedItemsHealth { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthPropertiesInternal)Property).ProtectedItemsHealth; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthPropertiesInternal)Property).ProtectedItemsHealth = value; } + + /// Resource Name + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Name; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthProperties _property; + + /// The vault health related data. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VaultHealthProperties()); set => this._property = value; } + + /// The categorized resource counts. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummaryCategorizedResourceCounts ProtectedItemHealthCategorizedResourceCount { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthPropertiesInternal)Property).ProtectedItemHealthCategorizedResourceCount; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthPropertiesInternal)Property).ProtectedItemHealthCategorizedResourceCount = value ?? null /* model class */; } + + /// The list of summary of health errors across the resources under the container. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorSummary[] ProtectedItemHealthIssue { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthPropertiesInternal)Property).ProtectedItemHealthIssue; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthPropertiesInternal)Property).ProtectedItemHealthIssue = value ?? null /* arrayOf */; } + + /// The count of total resources under the container. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public int? ProtectedItemHealthResourceCount { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthPropertiesInternal)Property).ProtectedItemHealthResourceCount; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthPropertiesInternal)Property).ProtectedItemHealthResourceCount = value ?? default(int); } + + /// Resource Type + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Type; } + + /// The list of errors on the vault. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] VaultError { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthPropertiesInternal)Property).VaultError; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthPropertiesInternal)Property).VaultError = value ?? null /* arrayOf */; } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__resource), __resource); + await eventListener.AssertObjectIsValid(nameof(__resource), __resource); + } + + /// Creates an new instance. + public VaultHealthDetails() + { + + } + } + /// Vault health details definition. + public partial interface IVaultHealthDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResource + { + /// The categorized resource counts. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The categorized resource counts.", + SerializedName = @"categorizedResourceCounts", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummaryCategorizedResourceCounts) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummaryCategorizedResourceCounts ContainerHealthCategorizedResourceCount { get; set; } + /// The list of summary of health errors across the resources under the container. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of summary of health errors across the resources under the container.", + SerializedName = @"issues", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorSummary) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorSummary[] ContainerHealthIssue { get; set; } + /// The count of total resources under the container. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The count of total resources under the container.", + SerializedName = @"resourceCount", + PossibleTypes = new [] { typeof(int) })] + int? ContainerHealthResourceCount { get; set; } + /// The categorized resource counts. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The categorized resource counts.", + SerializedName = @"categorizedResourceCounts", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummaryCategorizedResourceCounts) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummaryCategorizedResourceCounts FabricHealthCategorizedResourceCount { get; set; } + /// The list of summary of health errors across the resources under the container. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of summary of health errors across the resources under the container.", + SerializedName = @"issues", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorSummary) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorSummary[] FabricHealthIssue { get; set; } + /// The count of total resources under the container. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The count of total resources under the container.", + SerializedName = @"resourceCount", + PossibleTypes = new [] { typeof(int) })] + int? FabricHealthResourceCount { get; set; } + /// The categorized resource counts. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The categorized resource counts.", + SerializedName = @"categorizedResourceCounts", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummaryCategorizedResourceCounts) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummaryCategorizedResourceCounts ProtectedItemHealthCategorizedResourceCount { get; set; } + /// The list of summary of health errors across the resources under the container. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of summary of health errors across the resources under the container.", + SerializedName = @"issues", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorSummary) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorSummary[] ProtectedItemHealthIssue { get; set; } + /// The count of total resources under the container. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The count of total resources under the container.", + SerializedName = @"resourceCount", + PossibleTypes = new [] { typeof(int) })] + int? ProtectedItemHealthResourceCount { get; set; } + /// The list of errors on the vault. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of errors on the vault.", + SerializedName = @"vaultErrors", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] VaultError { get; set; } + + } + /// Vault health details definition. + internal partial interface IVaultHealthDetailsInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal + { + /// The categorized resource counts. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummaryCategorizedResourceCounts ContainerHealthCategorizedResourceCount { get; set; } + /// The list of summary of health errors across the resources under the container. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorSummary[] ContainerHealthIssue { get; set; } + /// The count of total resources under the container. + int? ContainerHealthResourceCount { get; set; } + /// The list of the health detail of the containers in the vault. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummary ContainersHealth { get; set; } + /// The categorized resource counts. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummaryCategorizedResourceCounts FabricHealthCategorizedResourceCount { get; set; } + /// The list of summary of health errors across the resources under the container. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorSummary[] FabricHealthIssue { get; set; } + /// The count of total resources under the container. + int? FabricHealthResourceCount { get; set; } + /// The list of the health detail of the fabrics in the vault. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummary FabricsHealth { get; set; } + /// The vault health related data. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthProperties Property { get; set; } + /// The categorized resource counts. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummaryCategorizedResourceCounts ProtectedItemHealthCategorizedResourceCount { get; set; } + /// The list of summary of health errors across the resources under the container. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorSummary[] ProtectedItemHealthIssue { get; set; } + /// The count of total resources under the container. + int? ProtectedItemHealthResourceCount { get; set; } + /// The list of the health detail of the protected items in the vault. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummary ProtectedItemsHealth { get; set; } + /// The list of errors on the vault. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] VaultError { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VaultHealthDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VaultHealthDetails.json.cs new file mode 100644 index 000000000000..4e8bfec99d73 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VaultHealthDetails.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Vault health details definition. + public partial class VaultHealthDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new VaultHealthDetails(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __resource?.ToJson(container, serializationMode); + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal VaultHealthDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __resource = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.Resource(json); + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VaultHealthProperties.FromJson(__jsonProperties) : Property;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VaultHealthProperties.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VaultHealthProperties.PowerShell.cs new file mode 100644 index 000000000000..79dabb2ff09e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VaultHealthProperties.PowerShell.cs @@ -0,0 +1,240 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// class to define the health summary of the Vault. + [System.ComponentModel.TypeConverter(typeof(VaultHealthPropertiesTypeConverter))] + public partial class VaultHealthProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VaultHealthProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VaultHealthProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VaultHealthProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProtectedItemsHealth")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthPropertiesInternal)this).ProtectedItemsHealth = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummary) content.GetValueForProperty("ProtectedItemsHealth",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthPropertiesInternal)this).ProtectedItemsHealth, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ResourceHealthSummaryTypeConverter.ConvertFrom); + } + if (content.Contains("FabricsHealth")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthPropertiesInternal)this).FabricsHealth = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummary) content.GetValueForProperty("FabricsHealth",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthPropertiesInternal)this).FabricsHealth, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ResourceHealthSummaryTypeConverter.ConvertFrom); + } + if (content.Contains("ContainersHealth")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthPropertiesInternal)this).ContainersHealth = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummary) content.GetValueForProperty("ContainersHealth",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthPropertiesInternal)this).ContainersHealth, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ResourceHealthSummaryTypeConverter.ConvertFrom); + } + if (content.Contains("VaultError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthPropertiesInternal)this).VaultError = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[]) content.GetValueForProperty("VaultError",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthPropertiesInternal)this).VaultError, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("ProtectedItemHealthResourceCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthPropertiesInternal)this).ProtectedItemHealthResourceCount = (int?) content.GetValueForProperty("ProtectedItemHealthResourceCount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthPropertiesInternal)this).ProtectedItemHealthResourceCount, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("ProtectedItemHealthIssue")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthPropertiesInternal)this).ProtectedItemHealthIssue = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorSummary[]) content.GetValueForProperty("ProtectedItemHealthIssue",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthPropertiesInternal)this).ProtectedItemHealthIssue, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthErrorSummaryTypeConverter.ConvertFrom)); + } + if (content.Contains("ProtectedItemHealthCategorizedResourceCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthPropertiesInternal)this).ProtectedItemHealthCategorizedResourceCount = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummaryCategorizedResourceCounts) content.GetValueForProperty("ProtectedItemHealthCategorizedResourceCount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthPropertiesInternal)this).ProtectedItemHealthCategorizedResourceCount, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ResourceHealthSummaryCategorizedResourceCountsTypeConverter.ConvertFrom); + } + if (content.Contains("FabricHealthResourceCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthPropertiesInternal)this).FabricHealthResourceCount = (int?) content.GetValueForProperty("FabricHealthResourceCount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthPropertiesInternal)this).FabricHealthResourceCount, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("FabricHealthIssue")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthPropertiesInternal)this).FabricHealthIssue = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorSummary[]) content.GetValueForProperty("FabricHealthIssue",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthPropertiesInternal)this).FabricHealthIssue, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthErrorSummaryTypeConverter.ConvertFrom)); + } + if (content.Contains("FabricHealthCategorizedResourceCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthPropertiesInternal)this).FabricHealthCategorizedResourceCount = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummaryCategorizedResourceCounts) content.GetValueForProperty("FabricHealthCategorizedResourceCount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthPropertiesInternal)this).FabricHealthCategorizedResourceCount, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ResourceHealthSummaryCategorizedResourceCountsTypeConverter.ConvertFrom); + } + if (content.Contains("ContainerHealthResourceCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthPropertiesInternal)this).ContainerHealthResourceCount = (int?) content.GetValueForProperty("ContainerHealthResourceCount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthPropertiesInternal)this).ContainerHealthResourceCount, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("ContainerHealthIssue")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthPropertiesInternal)this).ContainerHealthIssue = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorSummary[]) content.GetValueForProperty("ContainerHealthIssue",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthPropertiesInternal)this).ContainerHealthIssue, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthErrorSummaryTypeConverter.ConvertFrom)); + } + if (content.Contains("ContainerHealthCategorizedResourceCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthPropertiesInternal)this).ContainerHealthCategorizedResourceCount = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummaryCategorizedResourceCounts) content.GetValueForProperty("ContainerHealthCategorizedResourceCount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthPropertiesInternal)this).ContainerHealthCategorizedResourceCount, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ResourceHealthSummaryCategorizedResourceCountsTypeConverter.ConvertFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal VaultHealthProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProtectedItemsHealth")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthPropertiesInternal)this).ProtectedItemsHealth = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummary) content.GetValueForProperty("ProtectedItemsHealth",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthPropertiesInternal)this).ProtectedItemsHealth, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ResourceHealthSummaryTypeConverter.ConvertFrom); + } + if (content.Contains("FabricsHealth")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthPropertiesInternal)this).FabricsHealth = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummary) content.GetValueForProperty("FabricsHealth",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthPropertiesInternal)this).FabricsHealth, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ResourceHealthSummaryTypeConverter.ConvertFrom); + } + if (content.Contains("ContainersHealth")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthPropertiesInternal)this).ContainersHealth = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummary) content.GetValueForProperty("ContainersHealth",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthPropertiesInternal)this).ContainersHealth, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ResourceHealthSummaryTypeConverter.ConvertFrom); + } + if (content.Contains("VaultError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthPropertiesInternal)this).VaultError = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[]) content.GetValueForProperty("VaultError",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthPropertiesInternal)this).VaultError, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthErrorTypeConverter.ConvertFrom)); + } + if (content.Contains("ProtectedItemHealthResourceCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthPropertiesInternal)this).ProtectedItemHealthResourceCount = (int?) content.GetValueForProperty("ProtectedItemHealthResourceCount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthPropertiesInternal)this).ProtectedItemHealthResourceCount, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("ProtectedItemHealthIssue")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthPropertiesInternal)this).ProtectedItemHealthIssue = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorSummary[]) content.GetValueForProperty("ProtectedItemHealthIssue",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthPropertiesInternal)this).ProtectedItemHealthIssue, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthErrorSummaryTypeConverter.ConvertFrom)); + } + if (content.Contains("ProtectedItemHealthCategorizedResourceCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthPropertiesInternal)this).ProtectedItemHealthCategorizedResourceCount = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummaryCategorizedResourceCounts) content.GetValueForProperty("ProtectedItemHealthCategorizedResourceCount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthPropertiesInternal)this).ProtectedItemHealthCategorizedResourceCount, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ResourceHealthSummaryCategorizedResourceCountsTypeConverter.ConvertFrom); + } + if (content.Contains("FabricHealthResourceCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthPropertiesInternal)this).FabricHealthResourceCount = (int?) content.GetValueForProperty("FabricHealthResourceCount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthPropertiesInternal)this).FabricHealthResourceCount, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("FabricHealthIssue")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthPropertiesInternal)this).FabricHealthIssue = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorSummary[]) content.GetValueForProperty("FabricHealthIssue",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthPropertiesInternal)this).FabricHealthIssue, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthErrorSummaryTypeConverter.ConvertFrom)); + } + if (content.Contains("FabricHealthCategorizedResourceCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthPropertiesInternal)this).FabricHealthCategorizedResourceCount = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummaryCategorizedResourceCounts) content.GetValueForProperty("FabricHealthCategorizedResourceCount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthPropertiesInternal)this).FabricHealthCategorizedResourceCount, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ResourceHealthSummaryCategorizedResourceCountsTypeConverter.ConvertFrom); + } + if (content.Contains("ContainerHealthResourceCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthPropertiesInternal)this).ContainerHealthResourceCount = (int?) content.GetValueForProperty("ContainerHealthResourceCount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthPropertiesInternal)this).ContainerHealthResourceCount, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("ContainerHealthIssue")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthPropertiesInternal)this).ContainerHealthIssue = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorSummary[]) content.GetValueForProperty("ContainerHealthIssue",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthPropertiesInternal)this).ContainerHealthIssue, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthErrorSummaryTypeConverter.ConvertFrom)); + } + if (content.Contains("ContainerHealthCategorizedResourceCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthPropertiesInternal)this).ContainerHealthCategorizedResourceCount = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummaryCategorizedResourceCounts) content.GetValueForProperty("ContainerHealthCategorizedResourceCount",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthPropertiesInternal)this).ContainerHealthCategorizedResourceCount, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ResourceHealthSummaryCategorizedResourceCountsTypeConverter.ConvertFrom); + } + AfterDeserializePSObject(content); + } + } + /// class to define the health summary of the Vault. + [System.ComponentModel.TypeConverter(typeof(VaultHealthPropertiesTypeConverter))] + public partial interface IVaultHealthProperties + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VaultHealthProperties.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VaultHealthProperties.TypeConverter.cs new file mode 100644 index 000000000000..4a614788c0dc --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VaultHealthProperties.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VaultHealthPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VaultHealthProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VaultHealthProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VaultHealthProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VaultHealthProperties.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VaultHealthProperties.cs new file mode 100644 index 000000000000..2413b9e80e53 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VaultHealthProperties.cs @@ -0,0 +1,213 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// class to define the health summary of the Vault. + public partial class VaultHealthProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthProperties, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthPropertiesInternal + { + + /// The categorized resource counts. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummaryCategorizedResourceCounts ContainerHealthCategorizedResourceCount { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummaryInternal)ContainersHealth).CategorizedResourceCount; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummaryInternal)ContainersHealth).CategorizedResourceCount = value ?? null /* model class */; } + + /// The list of summary of health errors across the resources under the container. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorSummary[] ContainerHealthIssue { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummaryInternal)ContainersHealth).Issue; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummaryInternal)ContainersHealth).Issue = value ?? null /* arrayOf */; } + + /// The count of total resources under the container. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public int? ContainerHealthResourceCount { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummaryInternal)ContainersHealth).ResourceCount; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummaryInternal)ContainersHealth).ResourceCount = value ?? default(int); } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummary _containersHealth; + + /// The list of the health detail of the containers in the vault. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummary ContainersHealth { get => (this._containersHealth = this._containersHealth ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ResourceHealthSummary()); set => this._containersHealth = value; } + + /// The categorized resource counts. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummaryCategorizedResourceCounts FabricHealthCategorizedResourceCount { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummaryInternal)FabricsHealth).CategorizedResourceCount; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummaryInternal)FabricsHealth).CategorizedResourceCount = value ?? null /* model class */; } + + /// The list of summary of health errors across the resources under the container. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorSummary[] FabricHealthIssue { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummaryInternal)FabricsHealth).Issue; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummaryInternal)FabricsHealth).Issue = value ?? null /* arrayOf */; } + + /// The count of total resources under the container. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public int? FabricHealthResourceCount { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummaryInternal)FabricsHealth).ResourceCount; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummaryInternal)FabricsHealth).ResourceCount = value ?? default(int); } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummary _fabricsHealth; + + /// The list of the health detail of the fabrics in the vault. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummary FabricsHealth { get => (this._fabricsHealth = this._fabricsHealth ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ResourceHealthSummary()); set => this._fabricsHealth = value; } + + /// Internal Acessors for ContainersHealth + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummary Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthPropertiesInternal.ContainersHealth { get => (this._containersHealth = this._containersHealth ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ResourceHealthSummary()); set { {_containersHealth = value;} } } + + /// Internal Acessors for FabricsHealth + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummary Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthPropertiesInternal.FabricsHealth { get => (this._fabricsHealth = this._fabricsHealth ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ResourceHealthSummary()); set { {_fabricsHealth = value;} } } + + /// Internal Acessors for ProtectedItemsHealth + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummary Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthPropertiesInternal.ProtectedItemsHealth { get => (this._protectedItemsHealth = this._protectedItemsHealth ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ResourceHealthSummary()); set { {_protectedItemsHealth = value;} } } + + /// The categorized resource counts. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummaryCategorizedResourceCounts ProtectedItemHealthCategorizedResourceCount { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummaryInternal)ProtectedItemsHealth).CategorizedResourceCount; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummaryInternal)ProtectedItemsHealth).CategorizedResourceCount = value ?? null /* model class */; } + + /// The list of summary of health errors across the resources under the container. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorSummary[] ProtectedItemHealthIssue { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummaryInternal)ProtectedItemsHealth).Issue; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummaryInternal)ProtectedItemsHealth).Issue = value ?? null /* arrayOf */; } + + /// The count of total resources under the container. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public int? ProtectedItemHealthResourceCount { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummaryInternal)ProtectedItemsHealth).ResourceCount; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummaryInternal)ProtectedItemsHealth).ResourceCount = value ?? default(int); } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummary _protectedItemsHealth; + + /// The list of the health detail of the protected items in the vault. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummary ProtectedItemsHealth { get => (this._protectedItemsHealth = this._protectedItemsHealth ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ResourceHealthSummary()); set => this._protectedItemsHealth = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] _vaultError; + + /// The list of errors on the vault. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] VaultError { get => this._vaultError; set => this._vaultError = value; } + + /// Creates an new instance. + public VaultHealthProperties() + { + + } + } + /// class to define the health summary of the Vault. + public partial interface IVaultHealthProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The categorized resource counts. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The categorized resource counts.", + SerializedName = @"categorizedResourceCounts", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummaryCategorizedResourceCounts) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummaryCategorizedResourceCounts ContainerHealthCategorizedResourceCount { get; set; } + /// The list of summary of health errors across the resources under the container. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of summary of health errors across the resources under the container.", + SerializedName = @"issues", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorSummary) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorSummary[] ContainerHealthIssue { get; set; } + /// The count of total resources under the container. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The count of total resources under the container.", + SerializedName = @"resourceCount", + PossibleTypes = new [] { typeof(int) })] + int? ContainerHealthResourceCount { get; set; } + /// The categorized resource counts. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The categorized resource counts.", + SerializedName = @"categorizedResourceCounts", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummaryCategorizedResourceCounts) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummaryCategorizedResourceCounts FabricHealthCategorizedResourceCount { get; set; } + /// The list of summary of health errors across the resources under the container. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of summary of health errors across the resources under the container.", + SerializedName = @"issues", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorSummary) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorSummary[] FabricHealthIssue { get; set; } + /// The count of total resources under the container. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The count of total resources under the container.", + SerializedName = @"resourceCount", + PossibleTypes = new [] { typeof(int) })] + int? FabricHealthResourceCount { get; set; } + /// The categorized resource counts. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The categorized resource counts.", + SerializedName = @"categorizedResourceCounts", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummaryCategorizedResourceCounts) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummaryCategorizedResourceCounts ProtectedItemHealthCategorizedResourceCount { get; set; } + /// The list of summary of health errors across the resources under the container. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of summary of health errors across the resources under the container.", + SerializedName = @"issues", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorSummary) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorSummary[] ProtectedItemHealthIssue { get; set; } + /// The count of total resources under the container. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The count of total resources under the container.", + SerializedName = @"resourceCount", + PossibleTypes = new [] { typeof(int) })] + int? ProtectedItemHealthResourceCount { get; set; } + /// The list of errors on the vault. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of errors on the vault.", + SerializedName = @"vaultErrors", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] VaultError { get; set; } + + } + /// class to define the health summary of the Vault. + internal partial interface IVaultHealthPropertiesInternal + + { + /// The categorized resource counts. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummaryCategorizedResourceCounts ContainerHealthCategorizedResourceCount { get; set; } + /// The list of summary of health errors across the resources under the container. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorSummary[] ContainerHealthIssue { get; set; } + /// The count of total resources under the container. + int? ContainerHealthResourceCount { get; set; } + /// The list of the health detail of the containers in the vault. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummary ContainersHealth { get; set; } + /// The categorized resource counts. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummaryCategorizedResourceCounts FabricHealthCategorizedResourceCount { get; set; } + /// The list of summary of health errors across the resources under the container. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorSummary[] FabricHealthIssue { get; set; } + /// The count of total resources under the container. + int? FabricHealthResourceCount { get; set; } + /// The list of the health detail of the fabrics in the vault. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummary FabricsHealth { get; set; } + /// The categorized resource counts. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummaryCategorizedResourceCounts ProtectedItemHealthCategorizedResourceCount { get; set; } + /// The list of summary of health errors across the resources under the container. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthErrorSummary[] ProtectedItemHealthIssue { get; set; } + /// The count of total resources under the container. + int? ProtectedItemHealthResourceCount { get; set; } + /// The list of the health detail of the protected items in the vault. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceHealthSummary ProtectedItemsHealth { get; set; } + /// The list of errors on the vault. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError[] VaultError { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VaultHealthProperties.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VaultHealthProperties.json.cs new file mode 100644 index 000000000000..3b0e817435cf --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VaultHealthProperties.json.cs @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// class to define the health summary of the Vault. + public partial class VaultHealthProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new VaultHealthProperties(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._protectedItemsHealth ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._protectedItemsHealth.ToJson(null,serializationMode) : null, "protectedItemsHealth" ,container.Add ); + AddIf( null != this._fabricsHealth ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._fabricsHealth.ToJson(null,serializationMode) : null, "fabricsHealth" ,container.Add ); + AddIf( null != this._containersHealth ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._containersHealth.ToJson(null,serializationMode) : null, "containersHealth" ,container.Add ); + if (null != this._vaultError) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._vaultError ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("vaultErrors",__w); + } + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal VaultHealthProperties(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_protectedItemsHealth = If( json?.PropertyT("protectedItemsHealth"), out var __jsonProtectedItemsHealth) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ResourceHealthSummary.FromJson(__jsonProtectedItemsHealth) : ProtectedItemsHealth;} + {_fabricsHealth = If( json?.PropertyT("fabricsHealth"), out var __jsonFabricsHealth) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ResourceHealthSummary.FromJson(__jsonFabricsHealth) : FabricsHealth;} + {_containersHealth = If( json?.PropertyT("containersHealth"), out var __jsonContainersHealth) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ResourceHealthSummary.FromJson(__jsonContainersHealth) : ContainersHealth;} + {_vaultError = If( json?.PropertyT("vaultErrors"), out var __jsonVaultErrors) ? If( __jsonVaultErrors as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHealthError) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HealthError.FromJson(__u) )) ))() : null : VaultError;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VaultSetting.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VaultSetting.PowerShell.cs new file mode 100644 index 000000000000..66e6fd031040 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VaultSetting.PowerShell.cs @@ -0,0 +1,192 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Vault setting. + [System.ComponentModel.TypeConverter(typeof(VaultSettingTypeConverter))] + public partial class VaultSetting + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSetting DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VaultSetting(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSetting DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VaultSetting(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSetting FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VaultSetting(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VaultSettingPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("MigrationSolutionId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingInternal)this).MigrationSolutionId = (string) content.GetValueForProperty("MigrationSolutionId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingInternal)this).MigrationSolutionId, global::System.Convert.ToString); + } + if (content.Contains("VmwareToAzureProviderType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingInternal)this).VmwareToAzureProviderType = (string) content.GetValueForProperty("VmwareToAzureProviderType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingInternal)this).VmwareToAzureProviderType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal VaultSetting(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VaultSettingPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("MigrationSolutionId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingInternal)this).MigrationSolutionId = (string) content.GetValueForProperty("MigrationSolutionId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingInternal)this).MigrationSolutionId, global::System.Convert.ToString); + } + if (content.Contains("VmwareToAzureProviderType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingInternal)this).VmwareToAzureProviderType = (string) content.GetValueForProperty("VmwareToAzureProviderType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingInternal)this).VmwareToAzureProviderType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + } + /// Vault setting. + [System.ComponentModel.TypeConverter(typeof(VaultSettingTypeConverter))] + public partial interface IVaultSetting + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VaultSetting.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VaultSetting.TypeConverter.cs new file mode 100644 index 000000000000..019f32103e7a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VaultSetting.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VaultSettingTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSetting ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSetting).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VaultSetting.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VaultSetting.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VaultSetting.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VaultSetting.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VaultSetting.cs new file mode 100644 index 000000000000..738884bd7b1f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VaultSetting.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Vault setting. + public partial class VaultSetting : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSetting, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResource __resource = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.Resource(); + + /// Resource Id + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Id; } + + /// Resource Location + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string Location { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Location; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Location = value ?? null; } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Id = value; } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Name = value; } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Type = value; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingProperties Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VaultSettingProperties()); set { {_property = value;} } } + + /// The migration solution ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string MigrationSolutionId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingPropertiesInternal)Property).MigrationSolutionId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingPropertiesInternal)Property).MigrationSolutionId = value ?? null; } + + /// Resource Name + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Name; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingProperties _property; + + /// The vault setting properties. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VaultSettingProperties()); set => this._property = value; } + + /// Resource Type + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal)__resource).Type; } + + /// VMware to Azure provider type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string VmwareToAzureProviderType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingPropertiesInternal)Property).VmwareToAzureProviderType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingPropertiesInternal)Property).VmwareToAzureProviderType = value ?? null; } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__resource), __resource); + await eventListener.AssertObjectIsValid(nameof(__resource), __resource); + } + + /// Creates an new instance. + public VaultSetting() + { + + } + } + /// Vault setting. + public partial interface IVaultSetting : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResource + { + /// The migration solution ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The migration solution ARM Id.", + SerializedName = @"migrationSolutionId", + PossibleTypes = new [] { typeof(string) })] + string MigrationSolutionId { get; set; } + /// VMware to Azure provider type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"VMware to Azure provider type.", + SerializedName = @"vmwareToAzureProviderType", + PossibleTypes = new [] { typeof(string) })] + string VmwareToAzureProviderType { get; set; } + + } + /// Vault setting. + internal partial interface IVaultSettingInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResourceInternal + { + /// The migration solution ARM Id. + string MigrationSolutionId { get; set; } + /// The vault setting properties. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingProperties Property { get; set; } + /// VMware to Azure provider type. + string VmwareToAzureProviderType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VaultSetting.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VaultSetting.json.cs new file mode 100644 index 000000000000..2a634f42d356 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VaultSetting.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Vault setting. + public partial class VaultSetting + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSetting. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSetting. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSetting FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new VaultSetting(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __resource?.ToJson(container, serializationMode); + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal VaultSetting(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __resource = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.Resource(json); + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VaultSettingProperties.FromJson(__jsonProperties) : Property;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VaultSettingCollection.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VaultSettingCollection.PowerShell.cs new file mode 100644 index 000000000000..e60803632f22 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VaultSettingCollection.PowerShell.cs @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Vault setting collection. + [System.ComponentModel.TypeConverter(typeof(VaultSettingCollectionTypeConverter))] + public partial class VaultSettingCollection + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingCollection DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VaultSettingCollection(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingCollection DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VaultSettingCollection(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingCollection FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VaultSettingCollection(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSetting[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VaultSettingTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingCollectionInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingCollectionInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal VaultSettingCollection(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSetting[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VaultSettingTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingCollectionInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingCollectionInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + } + /// Vault setting collection. + [System.ComponentModel.TypeConverter(typeof(VaultSettingCollectionTypeConverter))] + public partial interface IVaultSettingCollection + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VaultSettingCollection.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VaultSettingCollection.TypeConverter.cs new file mode 100644 index 000000000000..02d56f93a367 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VaultSettingCollection.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VaultSettingCollectionTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingCollection ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingCollection).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VaultSettingCollection.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VaultSettingCollection.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VaultSettingCollection.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VaultSettingCollection.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VaultSettingCollection.cs new file mode 100644 index 000000000000..95f259238350 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VaultSettingCollection.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Vault setting collection. + public partial class VaultSettingCollection : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingCollection, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingCollectionInternal + { + + /// Backing field for property. + private string _nextLink; + + /// The value of next link. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string NextLink { get => this._nextLink; set => this._nextLink = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSetting[] _value; + + /// The list of vault setting. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSetting[] Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public VaultSettingCollection() + { + + } + } + /// Vault setting collection. + public partial interface IVaultSettingCollection : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The value of next link. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The value of next link.", + SerializedName = @"nextLink", + PossibleTypes = new [] { typeof(string) })] + string NextLink { get; set; } + /// The list of vault setting. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of vault setting.", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSetting) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSetting[] Value { get; set; } + + } + /// Vault setting collection. + internal partial interface IVaultSettingCollectionInternal + + { + /// The value of next link. + string NextLink { get; set; } + /// The list of vault setting. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSetting[] Value { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VaultSettingCollection.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VaultSettingCollection.json.cs new file mode 100644 index 000000000000..a35c1b4801ae --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VaultSettingCollection.json.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Vault setting collection. + public partial class VaultSettingCollection + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingCollection. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingCollection. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingCollection FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new VaultSettingCollection(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._value) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.XNodeArray(); + foreach( var __x in this._value ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("value",__w); + } + AddIf( null != (((object)this._nextLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal VaultSettingCollection(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSetting) (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VaultSetting.FromJson(__u) )) ))() : null : Value;} + {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)NextLink;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VaultSettingCreationInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VaultSettingCreationInput.PowerShell.cs new file mode 100644 index 000000000000..58ced7c745e7 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VaultSettingCreationInput.PowerShell.cs @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Input to create vault setting. + [System.ComponentModel.TypeConverter(typeof(VaultSettingCreationInputTypeConverter))] + public partial class VaultSettingCreationInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingCreationInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VaultSettingCreationInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingCreationInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VaultSettingCreationInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingCreationInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VaultSettingCreationInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingCreationInputInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingCreationInputProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingCreationInputInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VaultSettingCreationInputPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("MigrationSolutionId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingCreationInputInternal)this).MigrationSolutionId = (string) content.GetValueForProperty("MigrationSolutionId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingCreationInputInternal)this).MigrationSolutionId, global::System.Convert.ToString); + } + if (content.Contains("VmwareToAzureProviderType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingCreationInputInternal)this).VmwareToAzureProviderType = (string) content.GetValueForProperty("VmwareToAzureProviderType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingCreationInputInternal)this).VmwareToAzureProviderType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal VaultSettingCreationInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingCreationInputInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingCreationInputProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingCreationInputInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VaultSettingCreationInputPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("MigrationSolutionId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingCreationInputInternal)this).MigrationSolutionId = (string) content.GetValueForProperty("MigrationSolutionId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingCreationInputInternal)this).MigrationSolutionId, global::System.Convert.ToString); + } + if (content.Contains("VmwareToAzureProviderType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingCreationInputInternal)this).VmwareToAzureProviderType = (string) content.GetValueForProperty("VmwareToAzureProviderType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingCreationInputInternal)this).VmwareToAzureProviderType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + } + /// Input to create vault setting. + [System.ComponentModel.TypeConverter(typeof(VaultSettingCreationInputTypeConverter))] + public partial interface IVaultSettingCreationInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VaultSettingCreationInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VaultSettingCreationInput.TypeConverter.cs new file mode 100644 index 000000000000..d158e744840e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VaultSettingCreationInput.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VaultSettingCreationInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingCreationInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingCreationInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VaultSettingCreationInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VaultSettingCreationInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VaultSettingCreationInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VaultSettingCreationInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VaultSettingCreationInput.cs new file mode 100644 index 000000000000..a0c87b707a5f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VaultSettingCreationInput.cs @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Input to create vault setting. + public partial class VaultSettingCreationInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingCreationInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingCreationInputInternal + { + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingCreationInputProperties Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingCreationInputInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VaultSettingCreationInputProperties()); set { {_property = value;} } } + + /// The migration solution Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string MigrationSolutionId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingCreationInputPropertiesInternal)Property).MigrationSolutionId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingCreationInputPropertiesInternal)Property).MigrationSolutionId = value ?? null; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingCreationInputProperties _property; + + /// Vault setting creation input properties. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingCreationInputProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VaultSettingCreationInputProperties()); set => this._property = value; } + + /// VMware to Azure provider type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inlined)] + public string VmwareToAzureProviderType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingCreationInputPropertiesInternal)Property).VmwareToAzureProviderType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingCreationInputPropertiesInternal)Property).VmwareToAzureProviderType = value ?? null; } + + /// Creates an new instance. + public VaultSettingCreationInput() + { + + } + } + /// Input to create vault setting. + public partial interface IVaultSettingCreationInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The migration solution Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The migration solution Id.", + SerializedName = @"migrationSolutionId", + PossibleTypes = new [] { typeof(string) })] + string MigrationSolutionId { get; set; } + /// VMware to Azure provider type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"VMware to Azure provider type.", + SerializedName = @"vmwareToAzureProviderType", + PossibleTypes = new [] { typeof(string) })] + string VmwareToAzureProviderType { get; set; } + + } + /// Input to create vault setting. + internal partial interface IVaultSettingCreationInputInternal + + { + /// The migration solution Id. + string MigrationSolutionId { get; set; } + /// Vault setting creation input properties. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingCreationInputProperties Property { get; set; } + /// VMware to Azure provider type. + string VmwareToAzureProviderType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VaultSettingCreationInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VaultSettingCreationInput.json.cs new file mode 100644 index 000000000000..543e237d22e7 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VaultSettingCreationInput.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Input to create vault setting. + public partial class VaultSettingCreationInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingCreationInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingCreationInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingCreationInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new VaultSettingCreationInput(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal VaultSettingCreationInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VaultSettingCreationInputProperties.FromJson(__jsonProperties) : Property;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VaultSettingCreationInputProperties.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VaultSettingCreationInputProperties.PowerShell.cs new file mode 100644 index 000000000000..59d0487ae1cf --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VaultSettingCreationInputProperties.PowerShell.cs @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Input to create vault setting. + [System.ComponentModel.TypeConverter(typeof(VaultSettingCreationInputPropertiesTypeConverter))] + public partial class VaultSettingCreationInputProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingCreationInputProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VaultSettingCreationInputProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingCreationInputProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VaultSettingCreationInputProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingCreationInputProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VaultSettingCreationInputProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("MigrationSolutionId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingCreationInputPropertiesInternal)this).MigrationSolutionId = (string) content.GetValueForProperty("MigrationSolutionId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingCreationInputPropertiesInternal)this).MigrationSolutionId, global::System.Convert.ToString); + } + if (content.Contains("VmwareToAzureProviderType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingCreationInputPropertiesInternal)this).VmwareToAzureProviderType = (string) content.GetValueForProperty("VmwareToAzureProviderType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingCreationInputPropertiesInternal)this).VmwareToAzureProviderType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal VaultSettingCreationInputProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("MigrationSolutionId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingCreationInputPropertiesInternal)this).MigrationSolutionId = (string) content.GetValueForProperty("MigrationSolutionId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingCreationInputPropertiesInternal)this).MigrationSolutionId, global::System.Convert.ToString); + } + if (content.Contains("VmwareToAzureProviderType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingCreationInputPropertiesInternal)this).VmwareToAzureProviderType = (string) content.GetValueForProperty("VmwareToAzureProviderType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingCreationInputPropertiesInternal)this).VmwareToAzureProviderType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + } + /// Input to create vault setting. + [System.ComponentModel.TypeConverter(typeof(VaultSettingCreationInputPropertiesTypeConverter))] + public partial interface IVaultSettingCreationInputProperties + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VaultSettingCreationInputProperties.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VaultSettingCreationInputProperties.TypeConverter.cs new file mode 100644 index 000000000000..82c8fc6a70a5 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VaultSettingCreationInputProperties.TypeConverter.cs @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VaultSettingCreationInputPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingCreationInputProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingCreationInputProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VaultSettingCreationInputProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VaultSettingCreationInputProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VaultSettingCreationInputProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VaultSettingCreationInputProperties.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VaultSettingCreationInputProperties.cs new file mode 100644 index 000000000000..26dc4390047b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VaultSettingCreationInputProperties.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Input to create vault setting. + public partial class VaultSettingCreationInputProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingCreationInputProperties, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingCreationInputPropertiesInternal + { + + /// Backing field for property. + private string _migrationSolutionId; + + /// The migration solution Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string MigrationSolutionId { get => this._migrationSolutionId; set => this._migrationSolutionId = value; } + + /// Backing field for property. + private string _vmwareToAzureProviderType; + + /// VMware to Azure provider type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string VmwareToAzureProviderType { get => this._vmwareToAzureProviderType; set => this._vmwareToAzureProviderType = value; } + + /// Creates an new instance. + public VaultSettingCreationInputProperties() + { + + } + } + /// Input to create vault setting. + public partial interface IVaultSettingCreationInputProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The migration solution Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The migration solution Id.", + SerializedName = @"migrationSolutionId", + PossibleTypes = new [] { typeof(string) })] + string MigrationSolutionId { get; set; } + /// VMware to Azure provider type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"VMware to Azure provider type.", + SerializedName = @"vmwareToAzureProviderType", + PossibleTypes = new [] { typeof(string) })] + string VmwareToAzureProviderType { get; set; } + + } + /// Input to create vault setting. + internal partial interface IVaultSettingCreationInputPropertiesInternal + + { + /// The migration solution Id. + string MigrationSolutionId { get; set; } + /// VMware to Azure provider type. + string VmwareToAzureProviderType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VaultSettingCreationInputProperties.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VaultSettingCreationInputProperties.json.cs new file mode 100644 index 000000000000..99fec638f15a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VaultSettingCreationInputProperties.json.cs @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Input to create vault setting. + public partial class VaultSettingCreationInputProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingCreationInputProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingCreationInputProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingCreationInputProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new VaultSettingCreationInputProperties(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._migrationSolutionId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._migrationSolutionId.ToString()) : null, "migrationSolutionId" ,container.Add ); + AddIf( null != (((object)this._vmwareToAzureProviderType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._vmwareToAzureProviderType.ToString()) : null, "vmwareToAzureProviderType" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal VaultSettingCreationInputProperties(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_migrationSolutionId = If( json?.PropertyT("migrationSolutionId"), out var __jsonMigrationSolutionId) ? (string)__jsonMigrationSolutionId : (string)MigrationSolutionId;} + {_vmwareToAzureProviderType = If( json?.PropertyT("vmwareToAzureProviderType"), out var __jsonVmwareToAzureProviderType) ? (string)__jsonVmwareToAzureProviderType : (string)VmwareToAzureProviderType;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VaultSettingProperties.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VaultSettingProperties.PowerShell.cs new file mode 100644 index 000000000000..a8b27a59f778 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VaultSettingProperties.PowerShell.cs @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Vault setting properties. + [System.ComponentModel.TypeConverter(typeof(VaultSettingPropertiesTypeConverter))] + public partial class VaultSettingProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VaultSettingProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VaultSettingProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VaultSettingProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("MigrationSolutionId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingPropertiesInternal)this).MigrationSolutionId = (string) content.GetValueForProperty("MigrationSolutionId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingPropertiesInternal)this).MigrationSolutionId, global::System.Convert.ToString); + } + if (content.Contains("VmwareToAzureProviderType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingPropertiesInternal)this).VmwareToAzureProviderType = (string) content.GetValueForProperty("VmwareToAzureProviderType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingPropertiesInternal)this).VmwareToAzureProviderType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal VaultSettingProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("MigrationSolutionId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingPropertiesInternal)this).MigrationSolutionId = (string) content.GetValueForProperty("MigrationSolutionId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingPropertiesInternal)this).MigrationSolutionId, global::System.Convert.ToString); + } + if (content.Contains("VmwareToAzureProviderType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingPropertiesInternal)this).VmwareToAzureProviderType = (string) content.GetValueForProperty("VmwareToAzureProviderType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingPropertiesInternal)this).VmwareToAzureProviderType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + } + /// Vault setting properties. + [System.ComponentModel.TypeConverter(typeof(VaultSettingPropertiesTypeConverter))] + public partial interface IVaultSettingProperties + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VaultSettingProperties.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VaultSettingProperties.TypeConverter.cs new file mode 100644 index 000000000000..b6719ad95c76 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VaultSettingProperties.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VaultSettingPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VaultSettingProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VaultSettingProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VaultSettingProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VaultSettingProperties.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VaultSettingProperties.cs new file mode 100644 index 000000000000..7b3543990320 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VaultSettingProperties.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Vault setting properties. + public partial class VaultSettingProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingProperties, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingPropertiesInternal + { + + /// Backing field for property. + private string _migrationSolutionId; + + /// The migration solution ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string MigrationSolutionId { get => this._migrationSolutionId; set => this._migrationSolutionId = value; } + + /// Backing field for property. + private string _vmwareToAzureProviderType; + + /// VMware to Azure provider type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string VmwareToAzureProviderType { get => this._vmwareToAzureProviderType; set => this._vmwareToAzureProviderType = value; } + + /// Creates an new instance. + public VaultSettingProperties() + { + + } + } + /// Vault setting properties. + public partial interface IVaultSettingProperties : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The migration solution ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The migration solution ARM Id.", + SerializedName = @"migrationSolutionId", + PossibleTypes = new [] { typeof(string) })] + string MigrationSolutionId { get; set; } + /// VMware to Azure provider type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"VMware to Azure provider type.", + SerializedName = @"vmwareToAzureProviderType", + PossibleTypes = new [] { typeof(string) })] + string VmwareToAzureProviderType { get; set; } + + } + /// Vault setting properties. + internal partial interface IVaultSettingPropertiesInternal + + { + /// The migration solution ARM Id. + string MigrationSolutionId { get; set; } + /// VMware to Azure provider type. + string VmwareToAzureProviderType { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VaultSettingProperties.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VaultSettingProperties.json.cs new file mode 100644 index 000000000000..62cb80caf24f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VaultSettingProperties.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Vault setting properties. + public partial class VaultSettingProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new VaultSettingProperties(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._migrationSolutionId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._migrationSolutionId.ToString()) : null, "migrationSolutionId" ,container.Add ); + AddIf( null != (((object)this._vmwareToAzureProviderType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._vmwareToAzureProviderType.ToString()) : null, "vmwareToAzureProviderType" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal VaultSettingProperties(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_migrationSolutionId = If( json?.PropertyT("migrationSolutionId"), out var __jsonMigrationSolutionId) ? (string)__jsonMigrationSolutionId : (string)MigrationSolutionId;} + {_vmwareToAzureProviderType = If( json?.PropertyT("vmwareToAzureProviderType"), out var __jsonVmwareToAzureProviderType) ? (string)__jsonVmwareToAzureProviderType : (string)VmwareToAzureProviderType;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VersionDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VersionDetails.PowerShell.cs new file mode 100644 index 000000000000..072e2f314024 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VersionDetails.PowerShell.cs @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Version related details. + [System.ComponentModel.TypeConverter(typeof(VersionDetailsTypeConverter))] + public partial class VersionDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVersionDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VersionDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVersionDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VersionDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVersionDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VersionDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Version")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVersionDetailsInternal)this).Version = (string) content.GetValueForProperty("Version",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVersionDetailsInternal)this).Version, global::System.Convert.ToString); + } + if (content.Contains("ExpiryDate")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVersionDetailsInternal)this).ExpiryDate = (global::System.DateTime?) content.GetValueForProperty("ExpiryDate",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVersionDetailsInternal)this).ExpiryDate, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("Status")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVersionDetailsInternal)this).Status = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentVersionStatus?) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVersionDetailsInternal)this).Status, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentVersionStatus.CreateFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal VersionDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Version")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVersionDetailsInternal)this).Version = (string) content.GetValueForProperty("Version",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVersionDetailsInternal)this).Version, global::System.Convert.ToString); + } + if (content.Contains("ExpiryDate")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVersionDetailsInternal)this).ExpiryDate = (global::System.DateTime?) content.GetValueForProperty("ExpiryDate",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVersionDetailsInternal)this).ExpiryDate, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("Status")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVersionDetailsInternal)this).Status = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentVersionStatus?) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVersionDetailsInternal)this).Status, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentVersionStatus.CreateFrom); + } + AfterDeserializePSObject(content); + } + } + /// Version related details. + [System.ComponentModel.TypeConverter(typeof(VersionDetailsTypeConverter))] + public partial interface IVersionDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VersionDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VersionDetails.TypeConverter.cs new file mode 100644 index 000000000000..0a4d4d55cbfb --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VersionDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VersionDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVersionDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVersionDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VersionDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VersionDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VersionDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VersionDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VersionDetails.cs new file mode 100644 index 000000000000..6fb9858f1e49 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VersionDetails.cs @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Version related details. + public partial class VersionDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVersionDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVersionDetailsInternal + { + + /// Backing field for property. + private global::System.DateTime? _expiryDate; + + /// Version expiry date. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public global::System.DateTime? ExpiryDate { get => this._expiryDate; set => this._expiryDate = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentVersionStatus? _status; + + /// A value indicating whether security update required. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentVersionStatus? Status { get => this._status; set => this._status = value; } + + /// Backing field for property. + private string _version; + + /// The agent version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Version { get => this._version; set => this._version = value; } + + /// Creates an new instance. + public VersionDetails() + { + + } + } + /// Version related details. + public partial interface IVersionDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// Version expiry date. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Version expiry date.", + SerializedName = @"expiryDate", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? ExpiryDate { get; set; } + /// A value indicating whether security update required. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether security update required.", + SerializedName = @"status", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentVersionStatus) })] + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentVersionStatus? Status { get; set; } + /// The agent version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The agent version.", + SerializedName = @"version", + PossibleTypes = new [] { typeof(string) })] + string Version { get; set; } + + } + /// Version related details. + internal partial interface IVersionDetailsInternal + + { + /// Version expiry date. + global::System.DateTime? ExpiryDate { get; set; } + /// A value indicating whether security update required. + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentVersionStatus? Status { get; set; } + /// The agent version. + string Version { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VersionDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VersionDetails.json.cs new file mode 100644 index 000000000000..bf213d340daf --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VersionDetails.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Version related details. + public partial class VersionDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVersionDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVersionDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVersionDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new VersionDetails(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._version)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._version.ToString()) : null, "version" ,container.Add ); + AddIf( null != this._expiryDate ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._expiryDate?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "expiryDate" ,container.Add ); + AddIf( null != (((object)this._status)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._status.ToString()) : null, "status" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal VersionDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_version = If( json?.PropertyT("version"), out var __jsonVersion) ? (string)__jsonVersion : (string)Version;} + {_expiryDate = If( json?.PropertyT("expiryDate"), out var __jsonExpiryDate) ? global::System.DateTime.TryParse((string)__jsonExpiryDate, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonExpiryDateValue) ? __jsonExpiryDateValue : ExpiryDate : ExpiryDate;} + {_status = If( json?.PropertyT("status"), out var __jsonStatus) ? (string)__jsonStatus : (string)Status;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VirtualMachineTaskDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VirtualMachineTaskDetails.PowerShell.cs new file mode 100644 index 000000000000..69af06c10da8 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VirtualMachineTaskDetails.PowerShell.cs @@ -0,0 +1,218 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// This class represents the virtual machine task details. + [System.ComponentModel.TypeConverter(typeof(VirtualMachineTaskDetailsTypeConverter))] + public partial class VirtualMachineTaskDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVirtualMachineTaskDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VirtualMachineTaskDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVirtualMachineTaskDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VirtualMachineTaskDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVirtualMachineTaskDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VirtualMachineTaskDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SkippedReason")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVirtualMachineTaskDetailsInternal)this).SkippedReason = (string) content.GetValueForProperty("SkippedReason",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVirtualMachineTaskDetailsInternal)this).SkippedReason, global::System.Convert.ToString); + } + if (content.Contains("SkippedReasonString")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVirtualMachineTaskDetailsInternal)this).SkippedReasonString = (string) content.GetValueForProperty("SkippedReasonString",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVirtualMachineTaskDetailsInternal)this).SkippedReasonString, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITaskTypeDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITaskTypeDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + if (content.Contains("JobTaskJobId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)this).JobTaskJobId = (string) content.GetValueForProperty("JobTaskJobId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)this).JobTaskJobId, global::System.Convert.ToString); + } + if (content.Contains("JobTaskJobFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)this).JobTaskJobFriendlyName = (string) content.GetValueForProperty("JobTaskJobFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)this).JobTaskJobFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("JobTaskTargetObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)this).JobTaskTargetObjectId = (string) content.GetValueForProperty("JobTaskTargetObjectId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)this).JobTaskTargetObjectId, global::System.Convert.ToString); + } + if (content.Contains("JobTaskTargetObjectName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)this).JobTaskTargetObjectName = (string) content.GetValueForProperty("JobTaskTargetObjectName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)this).JobTaskTargetObjectName, global::System.Convert.ToString); + } + if (content.Contains("JobTaskTargetInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)this).JobTaskTargetInstanceType = (string) content.GetValueForProperty("JobTaskTargetInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)this).JobTaskTargetInstanceType, global::System.Convert.ToString); + } + if (content.Contains("JobTaskJobScenarioName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)this).JobTaskJobScenarioName = (string) content.GetValueForProperty("JobTaskJobScenarioName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)this).JobTaskJobScenarioName, global::System.Convert.ToString); + } + if (content.Contains("JobTask")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)this).JobTask = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobEntity) content.GetValueForProperty("JobTask",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)this).JobTask, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.JobEntityTypeConverter.ConvertFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal VirtualMachineTaskDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SkippedReason")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVirtualMachineTaskDetailsInternal)this).SkippedReason = (string) content.GetValueForProperty("SkippedReason",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVirtualMachineTaskDetailsInternal)this).SkippedReason, global::System.Convert.ToString); + } + if (content.Contains("SkippedReasonString")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVirtualMachineTaskDetailsInternal)this).SkippedReasonString = (string) content.GetValueForProperty("SkippedReasonString",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVirtualMachineTaskDetailsInternal)this).SkippedReasonString, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITaskTypeDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITaskTypeDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + if (content.Contains("JobTaskJobId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)this).JobTaskJobId = (string) content.GetValueForProperty("JobTaskJobId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)this).JobTaskJobId, global::System.Convert.ToString); + } + if (content.Contains("JobTaskJobFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)this).JobTaskJobFriendlyName = (string) content.GetValueForProperty("JobTaskJobFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)this).JobTaskJobFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("JobTaskTargetObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)this).JobTaskTargetObjectId = (string) content.GetValueForProperty("JobTaskTargetObjectId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)this).JobTaskTargetObjectId, global::System.Convert.ToString); + } + if (content.Contains("JobTaskTargetObjectName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)this).JobTaskTargetObjectName = (string) content.GetValueForProperty("JobTaskTargetObjectName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)this).JobTaskTargetObjectName, global::System.Convert.ToString); + } + if (content.Contains("JobTaskTargetInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)this).JobTaskTargetInstanceType = (string) content.GetValueForProperty("JobTaskTargetInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)this).JobTaskTargetInstanceType, global::System.Convert.ToString); + } + if (content.Contains("JobTaskJobScenarioName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)this).JobTaskJobScenarioName = (string) content.GetValueForProperty("JobTaskJobScenarioName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)this).JobTaskJobScenarioName, global::System.Convert.ToString); + } + if (content.Contains("JobTask")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)this).JobTask = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobEntity) content.GetValueForProperty("JobTask",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)this).JobTask, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.JobEntityTypeConverter.ConvertFrom); + } + AfterDeserializePSObject(content); + } + } + /// This class represents the virtual machine task details. + [System.ComponentModel.TypeConverter(typeof(VirtualMachineTaskDetailsTypeConverter))] + public partial interface IVirtualMachineTaskDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VirtualMachineTaskDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VirtualMachineTaskDetails.TypeConverter.cs new file mode 100644 index 000000000000..a148658594a8 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VirtualMachineTaskDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VirtualMachineTaskDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVirtualMachineTaskDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVirtualMachineTaskDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VirtualMachineTaskDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VirtualMachineTaskDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VirtualMachineTaskDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VirtualMachineTaskDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VirtualMachineTaskDetails.cs new file mode 100644 index 000000000000..a12035395fdb --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VirtualMachineTaskDetails.cs @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// This class represents the virtual machine task details. + public partial class VirtualMachineTaskDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVirtualMachineTaskDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVirtualMachineTaskDetailsInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetails __jobTaskDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.JobTaskDetails(); + + /// The type of task details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITaskTypeDetailsInternal)__jobTaskDetails).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITaskTypeDetailsInternal)__jobTaskDetails).InstanceType = value ; } + + /// The job entity. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobEntity JobTask { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)__jobTaskDetails).JobTask; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)__jobTaskDetails).JobTask = value ?? null /* model class */; } + + /// The job display name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string JobTaskJobFriendlyName { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)__jobTaskDetails).JobTaskJobFriendlyName; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)__jobTaskDetails).JobTaskJobFriendlyName = value ?? null; } + + /// The job id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string JobTaskJobId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)__jobTaskDetails).JobTaskJobId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)__jobTaskDetails).JobTaskJobId = value ?? null; } + + /// The job name. Enum type ScenarioName. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string JobTaskJobScenarioName { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)__jobTaskDetails).JobTaskJobScenarioName; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)__jobTaskDetails).JobTaskJobScenarioName = value ?? null; } + + /// The workflow affected object type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string JobTaskTargetInstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)__jobTaskDetails).JobTaskTargetInstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)__jobTaskDetails).JobTaskTargetInstanceType = value ?? null; } + + /// The object id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string JobTaskTargetObjectId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)__jobTaskDetails).JobTaskTargetObjectId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)__jobTaskDetails).JobTaskTargetObjectId = value ?? null; } + + /// The object name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string JobTaskTargetObjectName { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)__jobTaskDetails).JobTaskTargetObjectName; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal)__jobTaskDetails).JobTaskTargetObjectName = value ?? null; } + + /// Backing field for property. + private string _skippedReason; + + /// The skipped reason. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string SkippedReason { get => this._skippedReason; set => this._skippedReason = value; } + + /// Backing field for property. + private string _skippedReasonString; + + /// The skipped reason string. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string SkippedReasonString { get => this._skippedReasonString; set => this._skippedReasonString = value; } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__jobTaskDetails), __jobTaskDetails); + await eventListener.AssertObjectIsValid(nameof(__jobTaskDetails), __jobTaskDetails); + } + + /// Creates an new instance. + public VirtualMachineTaskDetails() + { + + } + } + /// This class represents the virtual machine task details. + public partial interface IVirtualMachineTaskDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetails + { + /// The skipped reason. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The skipped reason.", + SerializedName = @"skippedReason", + PossibleTypes = new [] { typeof(string) })] + string SkippedReason { get; set; } + /// The skipped reason string. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The skipped reason string.", + SerializedName = @"skippedReasonString", + PossibleTypes = new [] { typeof(string) })] + string SkippedReasonString { get; set; } + + } + /// This class represents the virtual machine task details. + internal partial interface IVirtualMachineTaskDetailsInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobTaskDetailsInternal + { + /// The skipped reason. + string SkippedReason { get; set; } + /// The skipped reason string. + string SkippedReasonString { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VirtualMachineTaskDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VirtualMachineTaskDetails.json.cs new file mode 100644 index 000000000000..993908d63cfc --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VirtualMachineTaskDetails.json.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// This class represents the virtual machine task details. + public partial class VirtualMachineTaskDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVirtualMachineTaskDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVirtualMachineTaskDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVirtualMachineTaskDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new VirtualMachineTaskDetails(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __jobTaskDetails?.ToJson(container, serializationMode); + AddIf( null != (((object)this._skippedReason)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._skippedReason.ToString()) : null, "skippedReason" ,container.Add ); + AddIf( null != (((object)this._skippedReasonString)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._skippedReasonString.ToString()) : null, "skippedReasonString" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal VirtualMachineTaskDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __jobTaskDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.JobTaskDetails(json); + {_skippedReason = If( json?.PropertyT("skippedReason"), out var __jsonSkippedReason) ? (string)__jsonSkippedReason : (string)SkippedReason;} + {_skippedReasonString = If( json?.PropertyT("skippedReasonString"), out var __jsonSkippedReasonString) ? (string)__jsonSkippedReasonString : (string)SkippedReasonString;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmmDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmmDetails.PowerShell.cs new file mode 100644 index 000000000000..24e566cd13e7 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmmDetails.PowerShell.cs @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// VMM fabric specific details. + [System.ComponentModel.TypeConverter(typeof(VmmDetailsTypeConverter))] + public partial class VmmDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmmDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VmmDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmmDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VmmDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmmDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VmmDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal VmmDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + } + /// VMM fabric specific details. + [System.ComponentModel.TypeConverter(typeof(VmmDetailsTypeConverter))] + public partial interface IVmmDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmmDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmmDetails.TypeConverter.cs new file mode 100644 index 000000000000..a71f0ad1f2ce --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmmDetails.TypeConverter.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VmmDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmmDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmmDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VmmDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VmmDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VmmDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmmDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmmDetails.cs new file mode 100644 index 000000000000..906463faefd1 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmmDetails.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// VMM fabric specific details. + public partial class VmmDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmmDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmmDetailsInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificDetails __fabricSpecificDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FabricSpecificDetails(); + + /// Gets the class type. Overridden in derived classes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificDetailsInternal)__fabricSpecificDetails).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificDetailsInternal)__fabricSpecificDetails).InstanceType = value ; } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__fabricSpecificDetails), __fabricSpecificDetails); + await eventListener.AssertObjectIsValid(nameof(__fabricSpecificDetails), __fabricSpecificDetails); + } + + /// Creates an new instance. + public VmmDetails() + { + + } + } + /// VMM fabric specific details. + public partial interface IVmmDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificDetails + { + + } + /// VMM fabric specific details. + internal partial interface IVmmDetailsInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificDetailsInternal + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmmDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmmDetails.json.cs new file mode 100644 index 000000000000..e07c1ff937cc --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmmDetails.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// VMM fabric specific details. + public partial class VmmDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmmDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmmDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmmDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new VmmDetails(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __fabricSpecificDetails?.ToJson(container, serializationMode); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal VmmDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __fabricSpecificDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FabricSpecificDetails(json); + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmmToAzureCreateNetworkMappingInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmmToAzureCreateNetworkMappingInput.PowerShell.cs new file mode 100644 index 000000000000..60021d35b1e7 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmmToAzureCreateNetworkMappingInput.PowerShell.cs @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// Create network mappings input properties/behavior specific to Vmm to Azure Network mapping. + /// + [System.ComponentModel.TypeConverter(typeof(VmmToAzureCreateNetworkMappingInputTypeConverter))] + public partial class VmmToAzureCreateNetworkMappingInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmmToAzureCreateNetworkMappingInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VmmToAzureCreateNetworkMappingInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmmToAzureCreateNetworkMappingInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VmmToAzureCreateNetworkMappingInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmmToAzureCreateNetworkMappingInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VmmToAzureCreateNetworkMappingInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreateNetworkMappingInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreateNetworkMappingInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal VmmToAzureCreateNetworkMappingInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreateNetworkMappingInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreateNetworkMappingInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + } + /// Create network mappings input properties/behavior specific to Vmm to Azure Network mapping. + [System.ComponentModel.TypeConverter(typeof(VmmToAzureCreateNetworkMappingInputTypeConverter))] + public partial interface IVmmToAzureCreateNetworkMappingInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmmToAzureCreateNetworkMappingInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmmToAzureCreateNetworkMappingInput.TypeConverter.cs new file mode 100644 index 000000000000..c9820129cae6 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmmToAzureCreateNetworkMappingInput.TypeConverter.cs @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VmmToAzureCreateNetworkMappingInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmmToAzureCreateNetworkMappingInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmmToAzureCreateNetworkMappingInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VmmToAzureCreateNetworkMappingInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VmmToAzureCreateNetworkMappingInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VmmToAzureCreateNetworkMappingInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmmToAzureCreateNetworkMappingInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmmToAzureCreateNetworkMappingInput.cs new file mode 100644 index 000000000000..077d1e38ab5d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmmToAzureCreateNetworkMappingInput.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// + /// Create network mappings input properties/behavior specific to Vmm to Azure Network mapping. + /// + public partial class VmmToAzureCreateNetworkMappingInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmmToAzureCreateNetworkMappingInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmmToAzureCreateNetworkMappingInputInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreateNetworkMappingInput __fabricSpecificCreateNetworkMappingInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FabricSpecificCreateNetworkMappingInput(); + + /// The instance type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreateNetworkMappingInputInternal)__fabricSpecificCreateNetworkMappingInput).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreateNetworkMappingInputInternal)__fabricSpecificCreateNetworkMappingInput).InstanceType = value ; } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__fabricSpecificCreateNetworkMappingInput), __fabricSpecificCreateNetworkMappingInput); + await eventListener.AssertObjectIsValid(nameof(__fabricSpecificCreateNetworkMappingInput), __fabricSpecificCreateNetworkMappingInput); + } + + /// Creates an new instance. + public VmmToAzureCreateNetworkMappingInput() + { + + } + } + /// Create network mappings input properties/behavior specific to Vmm to Azure Network mapping. + public partial interface IVmmToAzureCreateNetworkMappingInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreateNetworkMappingInput + { + + } + /// Create network mappings input properties/behavior specific to Vmm to Azure Network mapping. + internal partial interface IVmmToAzureCreateNetworkMappingInputInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreateNetworkMappingInputInternal + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmmToAzureCreateNetworkMappingInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmmToAzureCreateNetworkMappingInput.json.cs new file mode 100644 index 000000000000..5b2472355517 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmmToAzureCreateNetworkMappingInput.json.cs @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// + /// Create network mappings input properties/behavior specific to Vmm to Azure Network mapping. + /// + public partial class VmmToAzureCreateNetworkMappingInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmmToAzureCreateNetworkMappingInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmmToAzureCreateNetworkMappingInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmmToAzureCreateNetworkMappingInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new VmmToAzureCreateNetworkMappingInput(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __fabricSpecificCreateNetworkMappingInput?.ToJson(container, serializationMode); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal VmmToAzureCreateNetworkMappingInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __fabricSpecificCreateNetworkMappingInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FabricSpecificCreateNetworkMappingInput(json); + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmmToAzureNetworkMappingSettings.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmmToAzureNetworkMappingSettings.PowerShell.cs new file mode 100644 index 000000000000..e3eeba88bf0b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmmToAzureNetworkMappingSettings.PowerShell.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// E2A Network Mapping fabric specific settings. + [System.ComponentModel.TypeConverter(typeof(VmmToAzureNetworkMappingSettingsTypeConverter))] + public partial class VmmToAzureNetworkMappingSettings + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmmToAzureNetworkMappingSettings DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VmmToAzureNetworkMappingSettings(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmmToAzureNetworkMappingSettings DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VmmToAzureNetworkMappingSettings(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmmToAzureNetworkMappingSettings FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VmmToAzureNetworkMappingSettings(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingFabricSpecificSettingsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingFabricSpecificSettingsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal VmmToAzureNetworkMappingSettings(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingFabricSpecificSettingsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingFabricSpecificSettingsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + } + /// E2A Network Mapping fabric specific settings. + [System.ComponentModel.TypeConverter(typeof(VmmToAzureNetworkMappingSettingsTypeConverter))] + public partial interface IVmmToAzureNetworkMappingSettings + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmmToAzureNetworkMappingSettings.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmmToAzureNetworkMappingSettings.TypeConverter.cs new file mode 100644 index 000000000000..94fec5de2367 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmmToAzureNetworkMappingSettings.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VmmToAzureNetworkMappingSettingsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmmToAzureNetworkMappingSettings ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmmToAzureNetworkMappingSettings).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VmmToAzureNetworkMappingSettings.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VmmToAzureNetworkMappingSettings.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VmmToAzureNetworkMappingSettings.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmmToAzureNetworkMappingSettings.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmmToAzureNetworkMappingSettings.cs new file mode 100644 index 000000000000..cac4e5c4e71f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmmToAzureNetworkMappingSettings.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// E2A Network Mapping fabric specific settings. + public partial class VmmToAzureNetworkMappingSettings : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmmToAzureNetworkMappingSettings, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmmToAzureNetworkMappingSettingsInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingFabricSpecificSettings __networkMappingFabricSpecificSettings = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.NetworkMappingFabricSpecificSettings(); + + /// Gets the Instance type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingFabricSpecificSettingsInternal)__networkMappingFabricSpecificSettings).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingFabricSpecificSettingsInternal)__networkMappingFabricSpecificSettings).InstanceType = value ; } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__networkMappingFabricSpecificSettings), __networkMappingFabricSpecificSettings); + await eventListener.AssertObjectIsValid(nameof(__networkMappingFabricSpecificSettings), __networkMappingFabricSpecificSettings); + } + + /// Creates an new instance. + public VmmToAzureNetworkMappingSettings() + { + + } + } + /// E2A Network Mapping fabric specific settings. + public partial interface IVmmToAzureNetworkMappingSettings : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingFabricSpecificSettings + { + + } + /// E2A Network Mapping fabric specific settings. + internal partial interface IVmmToAzureNetworkMappingSettingsInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingFabricSpecificSettingsInternal + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmmToAzureNetworkMappingSettings.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmmToAzureNetworkMappingSettings.json.cs new file mode 100644 index 000000000000..a961fe865277 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmmToAzureNetworkMappingSettings.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// E2A Network Mapping fabric specific settings. + public partial class VmmToAzureNetworkMappingSettings + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmmToAzureNetworkMappingSettings. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmmToAzureNetworkMappingSettings. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmmToAzureNetworkMappingSettings FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new VmmToAzureNetworkMappingSettings(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __networkMappingFabricSpecificSettings?.ToJson(container, serializationMode); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal VmmToAzureNetworkMappingSettings(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __networkMappingFabricSpecificSettings = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.NetworkMappingFabricSpecificSettings(json); + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmmToAzureUpdateNetworkMappingInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmmToAzureUpdateNetworkMappingInput.PowerShell.cs new file mode 100644 index 000000000000..c4f5a91f6115 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmmToAzureUpdateNetworkMappingInput.PowerShell.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Update network mappings input properties/behavior specific to vmm to azure. + [System.ComponentModel.TypeConverter(typeof(VmmToAzureUpdateNetworkMappingInputTypeConverter))] + public partial class VmmToAzureUpdateNetworkMappingInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmmToAzureUpdateNetworkMappingInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VmmToAzureUpdateNetworkMappingInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmmToAzureUpdateNetworkMappingInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VmmToAzureUpdateNetworkMappingInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmmToAzureUpdateNetworkMappingInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VmmToAzureUpdateNetworkMappingInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificUpdateNetworkMappingInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificUpdateNetworkMappingInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal VmmToAzureUpdateNetworkMappingInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificUpdateNetworkMappingInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificUpdateNetworkMappingInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + } + /// Update network mappings input properties/behavior specific to vmm to azure. + [System.ComponentModel.TypeConverter(typeof(VmmToAzureUpdateNetworkMappingInputTypeConverter))] + public partial interface IVmmToAzureUpdateNetworkMappingInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmmToAzureUpdateNetworkMappingInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmmToAzureUpdateNetworkMappingInput.TypeConverter.cs new file mode 100644 index 000000000000..b40384445588 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmmToAzureUpdateNetworkMappingInput.TypeConverter.cs @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VmmToAzureUpdateNetworkMappingInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmmToAzureUpdateNetworkMappingInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmmToAzureUpdateNetworkMappingInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VmmToAzureUpdateNetworkMappingInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VmmToAzureUpdateNetworkMappingInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VmmToAzureUpdateNetworkMappingInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmmToAzureUpdateNetworkMappingInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmmToAzureUpdateNetworkMappingInput.cs new file mode 100644 index 000000000000..bee6abe9e492 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmmToAzureUpdateNetworkMappingInput.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Update network mappings input properties/behavior specific to vmm to azure. + public partial class VmmToAzureUpdateNetworkMappingInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmmToAzureUpdateNetworkMappingInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmmToAzureUpdateNetworkMappingInputInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificUpdateNetworkMappingInput __fabricSpecificUpdateNetworkMappingInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FabricSpecificUpdateNetworkMappingInput(); + + /// The instance type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificUpdateNetworkMappingInputInternal)__fabricSpecificUpdateNetworkMappingInput).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificUpdateNetworkMappingInputInternal)__fabricSpecificUpdateNetworkMappingInput).InstanceType = value ; } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__fabricSpecificUpdateNetworkMappingInput), __fabricSpecificUpdateNetworkMappingInput); + await eventListener.AssertObjectIsValid(nameof(__fabricSpecificUpdateNetworkMappingInput), __fabricSpecificUpdateNetworkMappingInput); + } + + /// Creates an new instance. + public VmmToAzureUpdateNetworkMappingInput() + { + + } + } + /// Update network mappings input properties/behavior specific to vmm to azure. + public partial interface IVmmToAzureUpdateNetworkMappingInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificUpdateNetworkMappingInput + { + + } + /// Update network mappings input properties/behavior specific to vmm to azure. + internal partial interface IVmmToAzureUpdateNetworkMappingInputInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificUpdateNetworkMappingInputInternal + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmmToAzureUpdateNetworkMappingInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmmToAzureUpdateNetworkMappingInput.json.cs new file mode 100644 index 000000000000..a73c2b85c93e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmmToAzureUpdateNetworkMappingInput.json.cs @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Update network mappings input properties/behavior specific to vmm to azure. + public partial class VmmToAzureUpdateNetworkMappingInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmmToAzureUpdateNetworkMappingInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmmToAzureUpdateNetworkMappingInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmmToAzureUpdateNetworkMappingInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new VmmToAzureUpdateNetworkMappingInput(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __fabricSpecificUpdateNetworkMappingInput?.ToJson(container, serializationMode); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal VmmToAzureUpdateNetworkMappingInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __fabricSpecificUpdateNetworkMappingInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FabricSpecificUpdateNetworkMappingInput(json); + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmmToVmmCreateNetworkMappingInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmmToVmmCreateNetworkMappingInput.PowerShell.cs new file mode 100644 index 000000000000..6f5bb56a56a5 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmmToVmmCreateNetworkMappingInput.PowerShell.cs @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// Create network mappings input properties/behavior specific to vmm to vmm Network mapping. + /// + [System.ComponentModel.TypeConverter(typeof(VmmToVmmCreateNetworkMappingInputTypeConverter))] + public partial class VmmToVmmCreateNetworkMappingInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmmToVmmCreateNetworkMappingInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VmmToVmmCreateNetworkMappingInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmmToVmmCreateNetworkMappingInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VmmToVmmCreateNetworkMappingInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmmToVmmCreateNetworkMappingInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VmmToVmmCreateNetworkMappingInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreateNetworkMappingInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreateNetworkMappingInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal VmmToVmmCreateNetworkMappingInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreateNetworkMappingInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreateNetworkMappingInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + } + /// Create network mappings input properties/behavior specific to vmm to vmm Network mapping. + [System.ComponentModel.TypeConverter(typeof(VmmToVmmCreateNetworkMappingInputTypeConverter))] + public partial interface IVmmToVmmCreateNetworkMappingInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmmToVmmCreateNetworkMappingInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmmToVmmCreateNetworkMappingInput.TypeConverter.cs new file mode 100644 index 000000000000..7617acaced67 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmmToVmmCreateNetworkMappingInput.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VmmToVmmCreateNetworkMappingInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmmToVmmCreateNetworkMappingInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmmToVmmCreateNetworkMappingInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VmmToVmmCreateNetworkMappingInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VmmToVmmCreateNetworkMappingInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VmmToVmmCreateNetworkMappingInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmmToVmmCreateNetworkMappingInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmmToVmmCreateNetworkMappingInput.cs new file mode 100644 index 000000000000..2997482e9be3 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmmToVmmCreateNetworkMappingInput.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// + /// Create network mappings input properties/behavior specific to vmm to vmm Network mapping. + /// + public partial class VmmToVmmCreateNetworkMappingInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmmToVmmCreateNetworkMappingInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmmToVmmCreateNetworkMappingInputInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreateNetworkMappingInput __fabricSpecificCreateNetworkMappingInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FabricSpecificCreateNetworkMappingInput(); + + /// The instance type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreateNetworkMappingInputInternal)__fabricSpecificCreateNetworkMappingInput).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreateNetworkMappingInputInternal)__fabricSpecificCreateNetworkMappingInput).InstanceType = value ; } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__fabricSpecificCreateNetworkMappingInput), __fabricSpecificCreateNetworkMappingInput); + await eventListener.AssertObjectIsValid(nameof(__fabricSpecificCreateNetworkMappingInput), __fabricSpecificCreateNetworkMappingInput); + } + + /// Creates an new instance. + public VmmToVmmCreateNetworkMappingInput() + { + + } + } + /// Create network mappings input properties/behavior specific to vmm to vmm Network mapping. + public partial interface IVmmToVmmCreateNetworkMappingInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreateNetworkMappingInput + { + + } + /// Create network mappings input properties/behavior specific to vmm to vmm Network mapping. + internal partial interface IVmmToVmmCreateNetworkMappingInputInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificCreateNetworkMappingInputInternal + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmmToVmmCreateNetworkMappingInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmmToVmmCreateNetworkMappingInput.json.cs new file mode 100644 index 000000000000..0bf5f878d02b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmmToVmmCreateNetworkMappingInput.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// + /// Create network mappings input properties/behavior specific to vmm to vmm Network mapping. + /// + public partial class VmmToVmmCreateNetworkMappingInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmmToVmmCreateNetworkMappingInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmmToVmmCreateNetworkMappingInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmmToVmmCreateNetworkMappingInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new VmmToVmmCreateNetworkMappingInput(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __fabricSpecificCreateNetworkMappingInput?.ToJson(container, serializationMode); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal VmmToVmmCreateNetworkMappingInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __fabricSpecificCreateNetworkMappingInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FabricSpecificCreateNetworkMappingInput(json); + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmmToVmmNetworkMappingSettings.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmmToVmmNetworkMappingSettings.PowerShell.cs new file mode 100644 index 000000000000..6e292efd6b82 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmmToVmmNetworkMappingSettings.PowerShell.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// E2E Network Mapping fabric specific settings. + [System.ComponentModel.TypeConverter(typeof(VmmToVmmNetworkMappingSettingsTypeConverter))] + public partial class VmmToVmmNetworkMappingSettings + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmmToVmmNetworkMappingSettings DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VmmToVmmNetworkMappingSettings(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmmToVmmNetworkMappingSettings DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VmmToVmmNetworkMappingSettings(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmmToVmmNetworkMappingSettings FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VmmToVmmNetworkMappingSettings(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingFabricSpecificSettingsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingFabricSpecificSettingsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal VmmToVmmNetworkMappingSettings(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingFabricSpecificSettingsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingFabricSpecificSettingsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + } + /// E2E Network Mapping fabric specific settings. + [System.ComponentModel.TypeConverter(typeof(VmmToVmmNetworkMappingSettingsTypeConverter))] + public partial interface IVmmToVmmNetworkMappingSettings + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmmToVmmNetworkMappingSettings.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmmToVmmNetworkMappingSettings.TypeConverter.cs new file mode 100644 index 000000000000..25a94c229b3b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmmToVmmNetworkMappingSettings.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VmmToVmmNetworkMappingSettingsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmmToVmmNetworkMappingSettings ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmmToVmmNetworkMappingSettings).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VmmToVmmNetworkMappingSettings.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VmmToVmmNetworkMappingSettings.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VmmToVmmNetworkMappingSettings.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmmToVmmNetworkMappingSettings.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmmToVmmNetworkMappingSettings.cs new file mode 100644 index 000000000000..e5b23fd53760 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmmToVmmNetworkMappingSettings.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// E2E Network Mapping fabric specific settings. + public partial class VmmToVmmNetworkMappingSettings : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmmToVmmNetworkMappingSettings, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmmToVmmNetworkMappingSettingsInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingFabricSpecificSettings __networkMappingFabricSpecificSettings = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.NetworkMappingFabricSpecificSettings(); + + /// Gets the Instance type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingFabricSpecificSettingsInternal)__networkMappingFabricSpecificSettings).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingFabricSpecificSettingsInternal)__networkMappingFabricSpecificSettings).InstanceType = value ; } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__networkMappingFabricSpecificSettings), __networkMappingFabricSpecificSettings); + await eventListener.AssertObjectIsValid(nameof(__networkMappingFabricSpecificSettings), __networkMappingFabricSpecificSettings); + } + + /// Creates an new instance. + public VmmToVmmNetworkMappingSettings() + { + + } + } + /// E2E Network Mapping fabric specific settings. + public partial interface IVmmToVmmNetworkMappingSettings : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingFabricSpecificSettings + { + + } + /// E2E Network Mapping fabric specific settings. + internal partial interface IVmmToVmmNetworkMappingSettingsInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingFabricSpecificSettingsInternal + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmmToVmmNetworkMappingSettings.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmmToVmmNetworkMappingSettings.json.cs new file mode 100644 index 000000000000..6f8d7c125949 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmmToVmmNetworkMappingSettings.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// E2E Network Mapping fabric specific settings. + public partial class VmmToVmmNetworkMappingSettings + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmmToVmmNetworkMappingSettings. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmmToVmmNetworkMappingSettings. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmmToVmmNetworkMappingSettings FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new VmmToVmmNetworkMappingSettings(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __networkMappingFabricSpecificSettings?.ToJson(container, serializationMode); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal VmmToVmmNetworkMappingSettings(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __networkMappingFabricSpecificSettings = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.NetworkMappingFabricSpecificSettings(json); + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmmToVmmUpdateNetworkMappingInput.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmmToVmmUpdateNetworkMappingInput.PowerShell.cs new file mode 100644 index 000000000000..a29581cdd717 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmmToVmmUpdateNetworkMappingInput.PowerShell.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// Update network mappings input properties/behavior specific to vmm to vmm. + [System.ComponentModel.TypeConverter(typeof(VmmToVmmUpdateNetworkMappingInputTypeConverter))] + public partial class VmmToVmmUpdateNetworkMappingInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmmToVmmUpdateNetworkMappingInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VmmToVmmUpdateNetworkMappingInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmmToVmmUpdateNetworkMappingInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VmmToVmmUpdateNetworkMappingInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmmToVmmUpdateNetworkMappingInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VmmToVmmUpdateNetworkMappingInput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificUpdateNetworkMappingInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificUpdateNetworkMappingInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal VmmToVmmUpdateNetworkMappingInput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificUpdateNetworkMappingInputInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificUpdateNetworkMappingInputInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + } + /// Update network mappings input properties/behavior specific to vmm to vmm. + [System.ComponentModel.TypeConverter(typeof(VmmToVmmUpdateNetworkMappingInputTypeConverter))] + public partial interface IVmmToVmmUpdateNetworkMappingInput + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmmToVmmUpdateNetworkMappingInput.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmmToVmmUpdateNetworkMappingInput.TypeConverter.cs new file mode 100644 index 000000000000..70bacf22c471 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmmToVmmUpdateNetworkMappingInput.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VmmToVmmUpdateNetworkMappingInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmmToVmmUpdateNetworkMappingInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmmToVmmUpdateNetworkMappingInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VmmToVmmUpdateNetworkMappingInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VmmToVmmUpdateNetworkMappingInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VmmToVmmUpdateNetworkMappingInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmmToVmmUpdateNetworkMappingInput.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmmToVmmUpdateNetworkMappingInput.cs new file mode 100644 index 000000000000..4011039eb3d1 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmmToVmmUpdateNetworkMappingInput.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Update network mappings input properties/behavior specific to vmm to vmm. + public partial class VmmToVmmUpdateNetworkMappingInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmmToVmmUpdateNetworkMappingInput, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmmToVmmUpdateNetworkMappingInputInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificUpdateNetworkMappingInput __fabricSpecificUpdateNetworkMappingInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FabricSpecificUpdateNetworkMappingInput(); + + /// The instance type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificUpdateNetworkMappingInputInternal)__fabricSpecificUpdateNetworkMappingInput).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificUpdateNetworkMappingInputInternal)__fabricSpecificUpdateNetworkMappingInput).InstanceType = value ; } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__fabricSpecificUpdateNetworkMappingInput), __fabricSpecificUpdateNetworkMappingInput); + await eventListener.AssertObjectIsValid(nameof(__fabricSpecificUpdateNetworkMappingInput), __fabricSpecificUpdateNetworkMappingInput); + } + + /// Creates an new instance. + public VmmToVmmUpdateNetworkMappingInput() + { + + } + } + /// Update network mappings input properties/behavior specific to vmm to vmm. + public partial interface IVmmToVmmUpdateNetworkMappingInput : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificUpdateNetworkMappingInput + { + + } + /// Update network mappings input properties/behavior specific to vmm to vmm. + internal partial interface IVmmToVmmUpdateNetworkMappingInputInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricSpecificUpdateNetworkMappingInputInternal + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmmToVmmUpdateNetworkMappingInput.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmmToVmmUpdateNetworkMappingInput.json.cs new file mode 100644 index 000000000000..595a7839e6e5 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmmToVmmUpdateNetworkMappingInput.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// Update network mappings input properties/behavior specific to vmm to vmm. + public partial class VmmToVmmUpdateNetworkMappingInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmmToVmmUpdateNetworkMappingInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmmToVmmUpdateNetworkMappingInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmmToVmmUpdateNetworkMappingInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new VmmToVmmUpdateNetworkMappingInput(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __fabricSpecificUpdateNetworkMappingInput?.ToJson(container, serializationMode); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal VmmToVmmUpdateNetworkMappingInput(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __fabricSpecificUpdateNetworkMappingInput = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FabricSpecificUpdateNetworkMappingInput(json); + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmmVirtualMachineDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmmVirtualMachineDetails.PowerShell.cs new file mode 100644 index 000000000000..41204aa5a120 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmmVirtualMachineDetails.PowerShell.cs @@ -0,0 +1,258 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// VMM fabric provider specific VM settings. + [System.ComponentModel.TypeConverter(typeof(VmmVirtualMachineDetailsTypeConverter))] + public partial class VmmVirtualMachineDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmmVirtualMachineDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VmmVirtualMachineDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmmVirtualMachineDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VmmVirtualMachineDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmmVirtualMachineDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VmmVirtualMachineDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigurationSettingsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigurationSettingsInternal)this).InstanceType, global::System.Convert.ToString); + } + if (content.Contains("OSDetailOstype")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).OSDetailOstype = (string) content.GetValueForProperty("OSDetailOstype",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).OSDetailOstype, global::System.Convert.ToString); + } + if (content.Contains("OSDetailProductType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).OSDetailProductType = (string) content.GetValueForProperty("OSDetailProductType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).OSDetailProductType, global::System.Convert.ToString); + } + if (content.Contains("OSDetailOsedition")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).OSDetailOsedition = (string) content.GetValueForProperty("OSDetailOsedition",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).OSDetailOsedition, global::System.Convert.ToString); + } + if (content.Contains("OSDetailOsversion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).OSDetailOsversion = (string) content.GetValueForProperty("OSDetailOsversion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).OSDetailOsversion, global::System.Convert.ToString); + } + if (content.Contains("OSDetailOsmajorVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).OSDetailOsmajorVersion = (string) content.GetValueForProperty("OSDetailOsmajorVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).OSDetailOsmajorVersion, global::System.Convert.ToString); + } + if (content.Contains("OSDetailOsminorVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).OSDetailOsminorVersion = (string) content.GetValueForProperty("OSDetailOsminorVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).OSDetailOsminorVersion, global::System.Convert.ToString); + } + if (content.Contains("OSDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).OSDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDetails) content.GetValueForProperty("OSDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).OSDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.OSDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("SourceItemId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).SourceItemId = (string) content.GetValueForProperty("SourceItemId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).SourceItemId, global::System.Convert.ToString); + } + if (content.Contains("Generation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).Generation = (string) content.GetValueForProperty("Generation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).Generation, global::System.Convert.ToString); + } + if (content.Contains("DiskDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).DiskDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskDetails[]) content.GetValueForProperty("DiskDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).DiskDetail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DiskDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("HasPhysicalDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).HasPhysicalDisk = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PresenceStatus?) content.GetValueForProperty("HasPhysicalDisk",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).HasPhysicalDisk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PresenceStatus.CreateFrom); + } + if (content.Contains("HasFibreChannelAdapter")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).HasFibreChannelAdapter = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PresenceStatus?) content.GetValueForProperty("HasFibreChannelAdapter",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).HasFibreChannelAdapter, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PresenceStatus.CreateFrom); + } + if (content.Contains("HasSharedVhd")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).HasSharedVhd = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PresenceStatus?) content.GetValueForProperty("HasSharedVhd",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).HasSharedVhd, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PresenceStatus.CreateFrom); + } + if (content.Contains("HyperVHostId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).HyperVHostId = (string) content.GetValueForProperty("HyperVHostId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).HyperVHostId, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal VmmVirtualMachineDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigurationSettingsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigurationSettingsInternal)this).InstanceType, global::System.Convert.ToString); + } + if (content.Contains("OSDetailOstype")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).OSDetailOstype = (string) content.GetValueForProperty("OSDetailOstype",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).OSDetailOstype, global::System.Convert.ToString); + } + if (content.Contains("OSDetailProductType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).OSDetailProductType = (string) content.GetValueForProperty("OSDetailProductType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).OSDetailProductType, global::System.Convert.ToString); + } + if (content.Contains("OSDetailOsedition")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).OSDetailOsedition = (string) content.GetValueForProperty("OSDetailOsedition",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).OSDetailOsedition, global::System.Convert.ToString); + } + if (content.Contains("OSDetailOsversion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).OSDetailOsversion = (string) content.GetValueForProperty("OSDetailOsversion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).OSDetailOsversion, global::System.Convert.ToString); + } + if (content.Contains("OSDetailOsmajorVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).OSDetailOsmajorVersion = (string) content.GetValueForProperty("OSDetailOsmajorVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).OSDetailOsmajorVersion, global::System.Convert.ToString); + } + if (content.Contains("OSDetailOsminorVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).OSDetailOsminorVersion = (string) content.GetValueForProperty("OSDetailOsminorVersion",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).OSDetailOsminorVersion, global::System.Convert.ToString); + } + if (content.Contains("OSDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).OSDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDetails) content.GetValueForProperty("OSDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).OSDetail, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.OSDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("SourceItemId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).SourceItemId = (string) content.GetValueForProperty("SourceItemId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).SourceItemId, global::System.Convert.ToString); + } + if (content.Contains("Generation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).Generation = (string) content.GetValueForProperty("Generation",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).Generation, global::System.Convert.ToString); + } + if (content.Contains("DiskDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).DiskDetail = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskDetails[]) content.GetValueForProperty("DiskDetail",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).DiskDetail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DiskDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("HasPhysicalDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).HasPhysicalDisk = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PresenceStatus?) content.GetValueForProperty("HasPhysicalDisk",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).HasPhysicalDisk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PresenceStatus.CreateFrom); + } + if (content.Contains("HasFibreChannelAdapter")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).HasFibreChannelAdapter = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PresenceStatus?) content.GetValueForProperty("HasFibreChannelAdapter",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).HasFibreChannelAdapter, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PresenceStatus.CreateFrom); + } + if (content.Contains("HasSharedVhd")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).HasSharedVhd = (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PresenceStatus?) content.GetValueForProperty("HasSharedVhd",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).HasSharedVhd, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PresenceStatus.CreateFrom); + } + if (content.Contains("HyperVHostId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).HyperVHostId = (string) content.GetValueForProperty("HyperVHostId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)this).HyperVHostId, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + } + /// VMM fabric provider specific VM settings. + [System.ComponentModel.TypeConverter(typeof(VmmVirtualMachineDetailsTypeConverter))] + public partial interface IVmmVirtualMachineDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmmVirtualMachineDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmmVirtualMachineDetails.TypeConverter.cs new file mode 100644 index 000000000000..d50be2c46170 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmmVirtualMachineDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VmmVirtualMachineDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmmVirtualMachineDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmmVirtualMachineDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VmmVirtualMachineDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VmmVirtualMachineDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VmmVirtualMachineDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmmVirtualMachineDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmmVirtualMachineDetails.cs new file mode 100644 index 000000000000..256be80aa84a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmmVirtualMachineDetails.cs @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// VMM fabric provider specific VM settings. + public partial class VmmVirtualMachineDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmmVirtualMachineDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmmVirtualMachineDetailsInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetails __hyperVVirtualMachineDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVVirtualMachineDetails(); + + /// The Last successful failover time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiskDetails[] DiskDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)__hyperVVirtualMachineDetails).DiskDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)__hyperVVirtualMachineDetails).DiskDetail = value ?? null /* arrayOf */; } + + /// The id of the object in fabric. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string Generation { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)__hyperVVirtualMachineDetails).Generation; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)__hyperVVirtualMachineDetails).Generation = value ?? null; } + + /// + /// A value indicating whether the VM has a fibre channel adapter attached. String value of SrsDataContract.PresenceStatus + /// enum. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PresenceStatus? HasFibreChannelAdapter { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)__hyperVVirtualMachineDetails).HasFibreChannelAdapter; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)__hyperVVirtualMachineDetails).HasFibreChannelAdapter = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PresenceStatus)""); } + + /// + /// A value indicating whether the VM has a physical disk attached. String value of SrsDataContract.PresenceStatus enum. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PresenceStatus? HasPhysicalDisk { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)__hyperVVirtualMachineDetails).HasPhysicalDisk; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)__hyperVVirtualMachineDetails).HasPhysicalDisk = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PresenceStatus)""); } + + /// + /// A value indicating whether the VM has a shared VHD attached. String value of SrsDataContract.PresenceStatus enum. + /// + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PresenceStatus? HasSharedVhd { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)__hyperVVirtualMachineDetails).HasSharedVhd; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)__hyperVVirtualMachineDetails).HasSharedVhd = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PresenceStatus)""); } + + /// The Id of the hyper-v host in fabric. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string HyperVHostId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)__hyperVVirtualMachineDetails).HyperVHostId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)__hyperVVirtualMachineDetails).HyperVHostId = value ?? null; } + + /// Gets the class type. Overridden in derived classes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigurationSettingsInternal)__hyperVVirtualMachineDetails).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigurationSettingsInternal)__hyperVVirtualMachineDetails).InstanceType = value ; } + + /// The Last replication time. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOSDetails OSDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)__hyperVVirtualMachineDetails).OSDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)__hyperVVirtualMachineDetails).OSDetail = value ?? null /* model class */; } + + /// The OSEdition. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string OSDetailOsedition { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)__hyperVVirtualMachineDetails).OSDetailOsedition; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)__hyperVVirtualMachineDetails).OSDetailOsedition = value ?? null; } + + /// The OS Major Version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string OSDetailOsmajorVersion { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)__hyperVVirtualMachineDetails).OSDetailOsmajorVersion; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)__hyperVVirtualMachineDetails).OSDetailOsmajorVersion = value ?? null; } + + /// The OS Minor Version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string OSDetailOsminorVersion { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)__hyperVVirtualMachineDetails).OSDetailOsminorVersion; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)__hyperVVirtualMachineDetails).OSDetailOsminorVersion = value ?? null; } + + /// VM Disk details. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string OSDetailOstype { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)__hyperVVirtualMachineDetails).OSDetailOstype; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)__hyperVVirtualMachineDetails).OSDetailOstype = value ?? null; } + + /// The OS Version. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string OSDetailOsversion { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)__hyperVVirtualMachineDetails).OSDetailOsversion; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)__hyperVVirtualMachineDetails).OSDetailOsversion = value ?? null; } + + /// Product type. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string OSDetailProductType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)__hyperVVirtualMachineDetails).OSDetailProductType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)__hyperVVirtualMachineDetails).OSDetailProductType = value ?? null; } + + /// The source id of the object. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string SourceItemId { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)__hyperVVirtualMachineDetails).SourceItemId; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal)__hyperVVirtualMachineDetails).SourceItemId = value ?? null; } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__hyperVVirtualMachineDetails), __hyperVVirtualMachineDetails); + await eventListener.AssertObjectIsValid(nameof(__hyperVVirtualMachineDetails), __hyperVVirtualMachineDetails); + } + + /// Creates an new instance. + public VmmVirtualMachineDetails() + { + + } + } + /// VMM fabric provider specific VM settings. + public partial interface IVmmVirtualMachineDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetails + { + + } + /// VMM fabric provider specific VM settings. + internal partial interface IVmmVirtualMachineDetailsInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IHyperVVirtualMachineDetailsInternal + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmmVirtualMachineDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmmVirtualMachineDetails.json.cs new file mode 100644 index 000000000000..b24ef41bbbec --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmmVirtualMachineDetails.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// VMM fabric provider specific VM settings. + public partial class VmmVirtualMachineDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmmVirtualMachineDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmmVirtualMachineDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmmVirtualMachineDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new VmmVirtualMachineDetails(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __hyperVVirtualMachineDetails?.ToJson(container, serializationMode); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal VmmVirtualMachineDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __hyperVVirtualMachineDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.HyperVVirtualMachineDetails(json); + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmwareCbtPolicyDetails.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmwareCbtPolicyDetails.PowerShell.cs new file mode 100644 index 000000000000..818a33387649 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmwareCbtPolicyDetails.PowerShell.cs @@ -0,0 +1,168 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// VMware Cbt specific policy details. + [System.ComponentModel.TypeConverter(typeof(VmwareCbtPolicyDetailsTypeConverter))] + public partial class VmwareCbtPolicyDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmwareCbtPolicyDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VmwareCbtPolicyDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmwareCbtPolicyDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VmwareCbtPolicyDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmwareCbtPolicyDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VmwareCbtPolicyDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("RecoveryPointHistoryInMinute")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmwareCbtPolicyDetailsInternal)this).RecoveryPointHistoryInMinute = (int?) content.GetValueForProperty("RecoveryPointHistoryInMinute",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmwareCbtPolicyDetailsInternal)this).RecoveryPointHistoryInMinute, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("AppConsistentFrequencyInMinute")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmwareCbtPolicyDetailsInternal)this).AppConsistentFrequencyInMinute = (int?) content.GetValueForProperty("AppConsistentFrequencyInMinute",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmwareCbtPolicyDetailsInternal)this).AppConsistentFrequencyInMinute, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("CrashConsistentFrequencyInMinute")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmwareCbtPolicyDetailsInternal)this).CrashConsistentFrequencyInMinute = (int?) content.GetValueForProperty("CrashConsistentFrequencyInMinute",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmwareCbtPolicyDetailsInternal)this).CrashConsistentFrequencyInMinute, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal VmwareCbtPolicyDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("RecoveryPointHistoryInMinute")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmwareCbtPolicyDetailsInternal)this).RecoveryPointHistoryInMinute = (int?) content.GetValueForProperty("RecoveryPointHistoryInMinute",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmwareCbtPolicyDetailsInternal)this).RecoveryPointHistoryInMinute, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("AppConsistentFrequencyInMinute")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmwareCbtPolicyDetailsInternal)this).AppConsistentFrequencyInMinute = (int?) content.GetValueForProperty("AppConsistentFrequencyInMinute",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmwareCbtPolicyDetailsInternal)this).AppConsistentFrequencyInMinute, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("CrashConsistentFrequencyInMinute")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmwareCbtPolicyDetailsInternal)this).CrashConsistentFrequencyInMinute = (int?) content.GetValueForProperty("CrashConsistentFrequencyInMinute",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmwareCbtPolicyDetailsInternal)this).CrashConsistentFrequencyInMinute, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetailsInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + } + /// VMware Cbt specific policy details. + [System.ComponentModel.TypeConverter(typeof(VmwareCbtPolicyDetailsTypeConverter))] + public partial interface IVmwareCbtPolicyDetails + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmwareCbtPolicyDetails.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmwareCbtPolicyDetails.TypeConverter.cs new file mode 100644 index 000000000000..1b589d461697 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmwareCbtPolicyDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VmwareCbtPolicyDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmwareCbtPolicyDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmwareCbtPolicyDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VmwareCbtPolicyDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VmwareCbtPolicyDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VmwareCbtPolicyDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmwareCbtPolicyDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmwareCbtPolicyDetails.cs new file mode 100644 index 000000000000..3609e486807d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmwareCbtPolicyDetails.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// VMware Cbt specific policy details. + public partial class VmwareCbtPolicyDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmwareCbtPolicyDetails, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmwareCbtPolicyDetailsInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetails __policyProviderSpecificDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PolicyProviderSpecificDetails(); + + /// Backing field for property. + private int? _appConsistentFrequencyInMinute; + + /// The app consistent snapshot frequency in minutes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? AppConsistentFrequencyInMinute { get => this._appConsistentFrequencyInMinute; set => this._appConsistentFrequencyInMinute = value; } + + /// Backing field for property. + private int? _crashConsistentFrequencyInMinute; + + /// The crash consistent snapshot frequency in minutes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? CrashConsistentFrequencyInMinute { get => this._crashConsistentFrequencyInMinute; set => this._crashConsistentFrequencyInMinute = value; } + + /// Gets the class type. Overridden in derived classes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetailsInternal)__policyProviderSpecificDetails).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetailsInternal)__policyProviderSpecificDetails).InstanceType = value ; } + + /// Backing field for property. + private int? _recoveryPointHistoryInMinute; + + /// The duration in minutes until which the recovery points need to be stored. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public int? RecoveryPointHistoryInMinute { get => this._recoveryPointHistoryInMinute; set => this._recoveryPointHistoryInMinute = value; } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__policyProviderSpecificDetails), __policyProviderSpecificDetails); + await eventListener.AssertObjectIsValid(nameof(__policyProviderSpecificDetails), __policyProviderSpecificDetails); + } + + /// Creates an new instance. + public VmwareCbtPolicyDetails() + { + + } + } + /// VMware Cbt specific policy details. + public partial interface IVmwareCbtPolicyDetails : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetails + { + /// The app consistent snapshot frequency in minutes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The app consistent snapshot frequency in minutes.", + SerializedName = @"appConsistentFrequencyInMinutes", + PossibleTypes = new [] { typeof(int) })] + int? AppConsistentFrequencyInMinute { get; set; } + /// The crash consistent snapshot frequency in minutes. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The crash consistent snapshot frequency in minutes.", + SerializedName = @"crashConsistentFrequencyInMinutes", + PossibleTypes = new [] { typeof(int) })] + int? CrashConsistentFrequencyInMinute { get; set; } + /// The duration in minutes until which the recovery points need to be stored. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The duration in minutes until which the recovery points need to be stored.", + SerializedName = @"recoveryPointHistoryInMinutes", + PossibleTypes = new [] { typeof(int) })] + int? RecoveryPointHistoryInMinute { get; set; } + + } + /// VMware Cbt specific policy details. + internal partial interface IVmwareCbtPolicyDetailsInternal : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyProviderSpecificDetailsInternal + { + /// The app consistent snapshot frequency in minutes. + int? AppConsistentFrequencyInMinute { get; set; } + /// The crash consistent snapshot frequency in minutes. + int? CrashConsistentFrequencyInMinute { get; set; } + /// The duration in minutes until which the recovery points need to be stored. + int? RecoveryPointHistoryInMinute { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmwareCbtPolicyDetails.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmwareCbtPolicyDetails.json.cs new file mode 100644 index 000000000000..55c843fb95ec --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/Api202301/VmwareCbtPolicyDetails.json.cs @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// VMware Cbt specific policy details. + public partial class VmwareCbtPolicyDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmwareCbtPolicyDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmwareCbtPolicyDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVmwareCbtPolicyDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new VmwareCbtPolicyDetails(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __policyProviderSpecificDetails?.ToJson(container, serializationMode); + AddIf( null != this._recoveryPointHistoryInMinute ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._recoveryPointHistoryInMinute) : null, "recoveryPointHistoryInMinutes" ,container.Add ); + AddIf( null != this._appConsistentFrequencyInMinute ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._appConsistentFrequencyInMinute) : null, "appConsistentFrequencyInMinutes" ,container.Add ); + AddIf( null != this._crashConsistentFrequencyInMinute ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNumber((int)this._crashConsistentFrequencyInMinute) : null, "crashConsistentFrequencyInMinutes" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal VmwareCbtPolicyDetails(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __policyProviderSpecificDetails = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PolicyProviderSpecificDetails(json); + {_recoveryPointHistoryInMinute = If( json?.PropertyT("recoveryPointHistoryInMinutes"), out var __jsonRecoveryPointHistoryInMinutes) ? (int?)__jsonRecoveryPointHistoryInMinutes : RecoveryPointHistoryInMinute;} + {_appConsistentFrequencyInMinute = If( json?.PropertyT("appConsistentFrequencyInMinutes"), out var __jsonAppConsistentFrequencyInMinutes) ? (int?)__jsonAppConsistentFrequencyInMinutes : AppConsistentFrequencyInMinute;} + {_crashConsistentFrequencyInMinute = If( json?.PropertyT("crashConsistentFrequencyInMinutes"), out var __jsonCrashConsistentFrequencyInMinutes) ? (int?)__jsonCrashConsistentFrequencyInMinutes : CrashConsistentFrequencyInMinute;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/ReplicationProtectedItemsUpdateMobilityServiceAcceptedResponseHeaders.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/ReplicationProtectedItemsUpdateMobilityServiceAcceptedResponseHeaders.PowerShell.cs new file mode 100644 index 000000000000..9ab928fc7bd5 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/ReplicationProtectedItemsUpdateMobilityServiceAcceptedResponseHeaders.PowerShell.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + [System.ComponentModel.TypeConverter(typeof(ReplicationProtectedItemsUpdateMobilityServiceAcceptedResponseHeadersTypeConverter))] + public partial class ReplicationProtectedItemsUpdateMobilityServiceAcceptedResponseHeaders + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.IReplicationProtectedItemsUpdateMobilityServiceAcceptedResponseHeaders DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ReplicationProtectedItemsUpdateMobilityServiceAcceptedResponseHeaders(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.IReplicationProtectedItemsUpdateMobilityServiceAcceptedResponseHeaders DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ReplicationProtectedItemsUpdateMobilityServiceAcceptedResponseHeaders(content); + } + + /// + /// Creates a new instance of , deserializing + /// the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.IReplicationProtectedItemsUpdateMobilityServiceAcceptedResponseHeaders FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ReplicationProtectedItemsUpdateMobilityServiceAcceptedResponseHeaders(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.IReplicationProtectedItemsUpdateMobilityServiceAcceptedResponseHeadersInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.IReplicationProtectedItemsUpdateMobilityServiceAcceptedResponseHeadersInternal)this).Location, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ReplicationProtectedItemsUpdateMobilityServiceAcceptedResponseHeaders(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.IReplicationProtectedItemsUpdateMobilityServiceAcceptedResponseHeadersInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.IReplicationProtectedItemsUpdateMobilityServiceAcceptedResponseHeadersInternal)this).Location, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + [System.ComponentModel.TypeConverter(typeof(ReplicationProtectedItemsUpdateMobilityServiceAcceptedResponseHeadersTypeConverter))] + public partial interface IReplicationProtectedItemsUpdateMobilityServiceAcceptedResponseHeaders + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/ReplicationProtectedItemsUpdateMobilityServiceAcceptedResponseHeaders.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/ReplicationProtectedItemsUpdateMobilityServiceAcceptedResponseHeaders.TypeConverter.cs new file mode 100644 index 000000000000..f830b61fd16f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/ReplicationProtectedItemsUpdateMobilityServiceAcceptedResponseHeaders.TypeConverter.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ReplicationProtectedItemsUpdateMobilityServiceAcceptedResponseHeadersTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if + /// there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if + /// there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.IReplicationProtectedItemsUpdateMobilityServiceAcceptedResponseHeaders ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.IReplicationProtectedItemsUpdateMobilityServiceAcceptedResponseHeaders).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ReplicationProtectedItemsUpdateMobilityServiceAcceptedResponseHeaders.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ReplicationProtectedItemsUpdateMobilityServiceAcceptedResponseHeaders.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ReplicationProtectedItemsUpdateMobilityServiceAcceptedResponseHeaders.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/ReplicationProtectedItemsUpdateMobilityServiceAcceptedResponseHeaders.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/ReplicationProtectedItemsUpdateMobilityServiceAcceptedResponseHeaders.cs new file mode 100644 index 000000000000..0983f0c4e2bf --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/ReplicationProtectedItemsUpdateMobilityServiceAcceptedResponseHeaders.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + public partial class ReplicationProtectedItemsUpdateMobilityServiceAcceptedResponseHeaders : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.IReplicationProtectedItemsUpdateMobilityServiceAcceptedResponseHeaders, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.IReplicationProtectedItemsUpdateMobilityServiceAcceptedResponseHeadersInternal, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IHeaderSerializable + { + + /// Backing field for property. + private string _location; + + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Location { get => this._location; set => this._location = value; } + + /// + void Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IHeaderSerializable.ReadHeaders(global::System.Net.Http.Headers.HttpResponseHeaders headers) + { + if (headers.TryGetValues("Location", out var __locationHeader0)) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.IReplicationProtectedItemsUpdateMobilityServiceAcceptedResponseHeadersInternal)this).Location = System.Linq.Enumerable.FirstOrDefault(__locationHeader0) is string __headerLocationHeader0 ? __headerLocationHeader0 : (string)null; + } + } + + /// + /// Creates an new instance. + /// + public ReplicationProtectedItemsUpdateMobilityServiceAcceptedResponseHeaders() + { + + } + } + public partial interface IReplicationProtectedItemsUpdateMobilityServiceAcceptedResponseHeaders + + { + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"", + SerializedName = @"Location", + PossibleTypes = new [] { typeof(string) })] + string Location { get; set; } + + } + internal partial interface IReplicationProtectedItemsUpdateMobilityServiceAcceptedResponseHeadersInternal + + { + string Location { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/ReplicationProtectedItemsUpdateMobilityServiceAcceptedResponseHeaders.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/ReplicationProtectedItemsUpdateMobilityServiceAcceptedResponseHeaders.json.cs new file mode 100644 index 000000000000..5ed5f2b50d85 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/ReplicationProtectedItemsUpdateMobilityServiceAcceptedResponseHeaders.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + public partial class ReplicationProtectedItemsUpdateMobilityServiceAcceptedResponseHeaders + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.IReplicationProtectedItemsUpdateMobilityServiceAcceptedResponseHeaders. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.IReplicationProtectedItemsUpdateMobilityServiceAcceptedResponseHeaders. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.IReplicationProtectedItemsUpdateMobilityServiceAcceptedResponseHeaders FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new ReplicationProtectedItemsUpdateMobilityServiceAcceptedResponseHeaders(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal ReplicationProtectedItemsUpdateMobilityServiceAcceptedResponseHeaders(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + AfterFromJson(json); + } + + /// + /// Serializes this instance of into + /// a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/SiteRecoveryIdentity.PowerShell.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/SiteRecoveryIdentity.PowerShell.cs new file mode 100644 index 000000000000..5b95a7e84222 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/SiteRecoveryIdentity.PowerShell.cs @@ -0,0 +1,350 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + [System.ComponentModel.TypeConverter(typeof(SiteRecoveryIdentityTypeConverter))] + public partial class SiteRecoveryIdentity + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new SiteRecoveryIdentity(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new SiteRecoveryIdentity(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal SiteRecoveryIdentity(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ResourceGroupName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).ResourceGroupName = (string) content.GetValueForProperty("ResourceGroupName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).ResourceGroupName, global::System.Convert.ToString); + } + if (content.Contains("SubscriptionId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).SubscriptionId = (string) content.GetValueForProperty("SubscriptionId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).SubscriptionId, global::System.Convert.ToString); + } + if (content.Contains("ResourceName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).ResourceName = (string) content.GetValueForProperty("ResourceName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).ResourceName, global::System.Convert.ToString); + } + if (content.Contains("AlertSettingName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).AlertSettingName = (string) content.GetValueForProperty("AlertSettingName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).AlertSettingName, global::System.Convert.ToString); + } + if (content.Contains("VirtualMachineName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).VirtualMachineName = (string) content.GetValueForProperty("VirtualMachineName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).VirtualMachineName, global::System.Convert.ToString); + } + if (content.Contains("EventName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).EventName = (string) content.GetValueForProperty("EventName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).EventName, global::System.Convert.ToString); + } + if (content.Contains("FabricName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).FabricName = (string) content.GetValueForProperty("FabricName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).FabricName, global::System.Convert.ToString); + } + if (content.Contains("LogicalNetworkName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).LogicalNetworkName = (string) content.GetValueForProperty("LogicalNetworkName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).LogicalNetworkName, global::System.Convert.ToString); + } + if (content.Contains("NetworkName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).NetworkName = (string) content.GetValueForProperty("NetworkName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).NetworkName, global::System.Convert.ToString); + } + if (content.Contains("NetworkMappingName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).NetworkMappingName = (string) content.GetValueForProperty("NetworkMappingName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).NetworkMappingName, global::System.Convert.ToString); + } + if (content.Contains("ProtectionContainerName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).ProtectionContainerName = (string) content.GetValueForProperty("ProtectionContainerName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).ProtectionContainerName, global::System.Convert.ToString); + } + if (content.Contains("MigrationItemName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).MigrationItemName = (string) content.GetValueForProperty("MigrationItemName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).MigrationItemName, global::System.Convert.ToString); + } + if (content.Contains("MigrationRecoveryPointName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).MigrationRecoveryPointName = (string) content.GetValueForProperty("MigrationRecoveryPointName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).MigrationRecoveryPointName, global::System.Convert.ToString); + } + if (content.Contains("ProtectableItemName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).ProtectableItemName = (string) content.GetValueForProperty("ProtectableItemName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).ProtectableItemName, global::System.Convert.ToString); + } + if (content.Contains("ReplicatedProtectedItemName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).ReplicatedProtectedItemName = (string) content.GetValueForProperty("ReplicatedProtectedItemName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).ReplicatedProtectedItemName, global::System.Convert.ToString); + } + if (content.Contains("RecoveryPointName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).RecoveryPointName = (string) content.GetValueForProperty("RecoveryPointName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).RecoveryPointName, global::System.Convert.ToString); + } + if (content.Contains("MappingName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).MappingName = (string) content.GetValueForProperty("MappingName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).MappingName, global::System.Convert.ToString); + } + if (content.Contains("ProviderName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).ProviderName = (string) content.GetValueForProperty("ProviderName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).ProviderName, global::System.Convert.ToString); + } + if (content.Contains("StorageClassificationName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).StorageClassificationName = (string) content.GetValueForProperty("StorageClassificationName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).StorageClassificationName, global::System.Convert.ToString); + } + if (content.Contains("StorageClassificationMappingName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).StorageClassificationMappingName = (string) content.GetValueForProperty("StorageClassificationMappingName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).StorageClassificationMappingName, global::System.Convert.ToString); + } + if (content.Contains("VcenterName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).VcenterName = (string) content.GetValueForProperty("VcenterName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).VcenterName, global::System.Convert.ToString); + } + if (content.Contains("JobName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).JobName = (string) content.GetValueForProperty("JobName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).JobName, global::System.Convert.ToString); + } + if (content.Contains("PolicyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).PolicyName = (string) content.GetValueForProperty("PolicyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).PolicyName, global::System.Convert.ToString); + } + if (content.Contains("IntentObjectName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).IntentObjectName = (string) content.GetValueForProperty("IntentObjectName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).IntentObjectName, global::System.Convert.ToString); + } + if (content.Contains("RecoveryPlanName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).RecoveryPlanName = (string) content.GetValueForProperty("RecoveryPlanName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).RecoveryPlanName, global::System.Convert.ToString); + } + if (content.Contains("VaultSettingName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).VaultSettingName = (string) content.GetValueForProperty("VaultSettingName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).VaultSettingName, global::System.Convert.ToString); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).Id, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal SiteRecoveryIdentity(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ResourceGroupName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).ResourceGroupName = (string) content.GetValueForProperty("ResourceGroupName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).ResourceGroupName, global::System.Convert.ToString); + } + if (content.Contains("SubscriptionId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).SubscriptionId = (string) content.GetValueForProperty("SubscriptionId",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).SubscriptionId, global::System.Convert.ToString); + } + if (content.Contains("ResourceName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).ResourceName = (string) content.GetValueForProperty("ResourceName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).ResourceName, global::System.Convert.ToString); + } + if (content.Contains("AlertSettingName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).AlertSettingName = (string) content.GetValueForProperty("AlertSettingName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).AlertSettingName, global::System.Convert.ToString); + } + if (content.Contains("VirtualMachineName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).VirtualMachineName = (string) content.GetValueForProperty("VirtualMachineName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).VirtualMachineName, global::System.Convert.ToString); + } + if (content.Contains("EventName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).EventName = (string) content.GetValueForProperty("EventName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).EventName, global::System.Convert.ToString); + } + if (content.Contains("FabricName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).FabricName = (string) content.GetValueForProperty("FabricName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).FabricName, global::System.Convert.ToString); + } + if (content.Contains("LogicalNetworkName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).LogicalNetworkName = (string) content.GetValueForProperty("LogicalNetworkName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).LogicalNetworkName, global::System.Convert.ToString); + } + if (content.Contains("NetworkName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).NetworkName = (string) content.GetValueForProperty("NetworkName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).NetworkName, global::System.Convert.ToString); + } + if (content.Contains("NetworkMappingName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).NetworkMappingName = (string) content.GetValueForProperty("NetworkMappingName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).NetworkMappingName, global::System.Convert.ToString); + } + if (content.Contains("ProtectionContainerName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).ProtectionContainerName = (string) content.GetValueForProperty("ProtectionContainerName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).ProtectionContainerName, global::System.Convert.ToString); + } + if (content.Contains("MigrationItemName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).MigrationItemName = (string) content.GetValueForProperty("MigrationItemName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).MigrationItemName, global::System.Convert.ToString); + } + if (content.Contains("MigrationRecoveryPointName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).MigrationRecoveryPointName = (string) content.GetValueForProperty("MigrationRecoveryPointName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).MigrationRecoveryPointName, global::System.Convert.ToString); + } + if (content.Contains("ProtectableItemName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).ProtectableItemName = (string) content.GetValueForProperty("ProtectableItemName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).ProtectableItemName, global::System.Convert.ToString); + } + if (content.Contains("ReplicatedProtectedItemName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).ReplicatedProtectedItemName = (string) content.GetValueForProperty("ReplicatedProtectedItemName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).ReplicatedProtectedItemName, global::System.Convert.ToString); + } + if (content.Contains("RecoveryPointName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).RecoveryPointName = (string) content.GetValueForProperty("RecoveryPointName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).RecoveryPointName, global::System.Convert.ToString); + } + if (content.Contains("MappingName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).MappingName = (string) content.GetValueForProperty("MappingName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).MappingName, global::System.Convert.ToString); + } + if (content.Contains("ProviderName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).ProviderName = (string) content.GetValueForProperty("ProviderName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).ProviderName, global::System.Convert.ToString); + } + if (content.Contains("StorageClassificationName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).StorageClassificationName = (string) content.GetValueForProperty("StorageClassificationName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).StorageClassificationName, global::System.Convert.ToString); + } + if (content.Contains("StorageClassificationMappingName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).StorageClassificationMappingName = (string) content.GetValueForProperty("StorageClassificationMappingName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).StorageClassificationMappingName, global::System.Convert.ToString); + } + if (content.Contains("VcenterName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).VcenterName = (string) content.GetValueForProperty("VcenterName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).VcenterName, global::System.Convert.ToString); + } + if (content.Contains("JobName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).JobName = (string) content.GetValueForProperty("JobName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).JobName, global::System.Convert.ToString); + } + if (content.Contains("PolicyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).PolicyName = (string) content.GetValueForProperty("PolicyName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).PolicyName, global::System.Convert.ToString); + } + if (content.Contains("IntentObjectName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).IntentObjectName = (string) content.GetValueForProperty("IntentObjectName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).IntentObjectName, global::System.Convert.ToString); + } + if (content.Contains("RecoveryPlanName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).RecoveryPlanName = (string) content.GetValueForProperty("RecoveryPlanName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).RecoveryPlanName, global::System.Convert.ToString); + } + if (content.Contains("VaultSettingName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).VaultSettingName = (string) content.GetValueForProperty("VaultSettingName",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).VaultSettingName, global::System.Convert.ToString); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal)this).Id, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + [System.ComponentModel.TypeConverter(typeof(SiteRecoveryIdentityTypeConverter))] + public partial interface ISiteRecoveryIdentity + + { + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/SiteRecoveryIdentity.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/SiteRecoveryIdentity.TypeConverter.cs new file mode 100644 index 000000000000..f1997c33e87d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/SiteRecoveryIdentity.TypeConverter.cs @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class SiteRecoveryIdentityTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + // we allow string conversion too. + if (type == typeof(global::System.String)) + { + return true; + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + // support direct string to id type conversion. + if (type == typeof(global::System.String)) + { + return new SiteRecoveryIdentity { Id = sourceValue }; + } + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return SiteRecoveryIdentity.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return SiteRecoveryIdentity.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return SiteRecoveryIdentity.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/SiteRecoveryIdentity.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/SiteRecoveryIdentity.cs new file mode 100644 index 000000000000..d8ca2c44d9b0 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/SiteRecoveryIdentity.cs @@ -0,0 +1,490 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + public partial class SiteRecoveryIdentity : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentityInternal + { + + /// Backing field for property. + private string _alertSettingName; + + /// The name of the email notification configuration. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string AlertSettingName { get => this._alertSettingName; set => this._alertSettingName = value; } + + /// Backing field for property. + private string _eventName; + + /// The name of the Azure Site Recovery event. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string EventName { get => this._eventName; set => this._eventName = value; } + + /// Backing field for property. + private string _fabricName; + + /// Fabric name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// Backing field for property. + private string _id; + + /// Resource identity path + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string Id { get => this._id; set => this._id = value; } + + /// Backing field for property. + private string _intentObjectName; + + /// Replication protection intent name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string IntentObjectName { get => this._intentObjectName; set => this._intentObjectName = value; } + + /// Backing field for property. + private string _jobName; + + /// Job identifier. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string JobName { get => this._jobName; set => this._jobName = value; } + + /// Backing field for property. + private string _logicalNetworkName; + + /// Logical network name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string LogicalNetworkName { get => this._logicalNetworkName; set => this._logicalNetworkName = value; } + + /// Backing field for property. + private string _mappingName; + + /// Protection Container mapping name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string MappingName { get => this._mappingName; set => this._mappingName = value; } + + /// Backing field for property. + private string _migrationItemName; + + /// Migration item name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string MigrationItemName { get => this._migrationItemName; set => this._migrationItemName = value; } + + /// Backing field for property. + private string _migrationRecoveryPointName; + + /// The migration recovery point name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string MigrationRecoveryPointName { get => this._migrationRecoveryPointName; set => this._migrationRecoveryPointName = value; } + + /// Backing field for property. + private string _networkMappingName; + + /// Network mapping name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string NetworkMappingName { get => this._networkMappingName; set => this._networkMappingName = value; } + + /// Backing field for property. + private string _networkName; + + /// Primary network name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string NetworkName { get => this._networkName; set => this._networkName = value; } + + /// Backing field for property. + private string _policyName; + + /// Replication policy name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string PolicyName { get => this._policyName; set => this._policyName = value; } + + /// Backing field for property. + private string _protectableItemName; + + /// Protectable item name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ProtectableItemName { get => this._protectableItemName; set => this._protectableItemName = value; } + + /// Backing field for property. + private string _protectionContainerName; + + /// Protection container name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ProtectionContainerName { get => this._protectionContainerName; set => this._protectionContainerName = value; } + + /// Backing field for property. + private string _providerName; + + /// Recovery services provider name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ProviderName { get => this._providerName; set => this._providerName = value; } + + /// Backing field for property. + private string _recoveryPlanName; + + /// Name of the recovery plan. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryPlanName { get => this._recoveryPlanName; set => this._recoveryPlanName = value; } + + /// Backing field for property. + private string _recoveryPointName; + + /// The recovery point name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string RecoveryPointName { get => this._recoveryPointName; set => this._recoveryPointName = value; } + + /// Backing field for property. + private string _replicatedProtectedItemName; + + /// Replication protected item name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ReplicatedProtectedItemName { get => this._replicatedProtectedItemName; set => this._replicatedProtectedItemName = value; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _storageClassificationMappingName; + + /// Storage classification mapping name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string StorageClassificationMappingName { get => this._storageClassificationMappingName; set => this._storageClassificationMappingName = value; } + + /// Backing field for property. + private string _storageClassificationName; + + /// Storage classification name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string StorageClassificationName { get => this._storageClassificationName; set => this._storageClassificationName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Backing field for property. + private string _vaultSettingName; + + /// Vault setting name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string VaultSettingName { get => this._vaultSettingName; set => this._vaultSettingName = value; } + + /// Backing field for property. + private string _vcenterName; + + /// vcenter name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string VcenterName { get => this._vcenterName; set => this._vcenterName = value; } + + /// Backing field for property. + private string _virtualMachineName; + + /// Virtual Machine name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Origin(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.PropertyOrigin.Owned)] + public string VirtualMachineName { get => this._virtualMachineName; set => this._virtualMachineName = value; } + + /// Creates an new instance. + public SiteRecoveryIdentity() + { + + } + } + public partial interface ISiteRecoveryIdentity : + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable + { + /// The name of the email notification configuration. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the email notification configuration.", + SerializedName = @"alertSettingName", + PossibleTypes = new [] { typeof(string) })] + string AlertSettingName { get; set; } + /// The name of the Azure Site Recovery event. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the Azure Site Recovery event.", + SerializedName = @"eventName", + PossibleTypes = new [] { typeof(string) })] + string EventName { get; set; } + /// Fabric name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Fabric name.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + string FabricName { get; set; } + /// Resource identity path + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Resource identity path", + SerializedName = @"id", + PossibleTypes = new [] { typeof(string) })] + string Id { get; set; } + /// Replication protection intent name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Replication protection intent name.", + SerializedName = @"intentObjectName", + PossibleTypes = new [] { typeof(string) })] + string IntentObjectName { get; set; } + /// Job identifier. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Job identifier.", + SerializedName = @"jobName", + PossibleTypes = new [] { typeof(string) })] + string JobName { get; set; } + /// Logical network name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Logical network name.", + SerializedName = @"logicalNetworkName", + PossibleTypes = new [] { typeof(string) })] + string LogicalNetworkName { get; set; } + /// Protection Container mapping name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Protection Container mapping name.", + SerializedName = @"mappingName", + PossibleTypes = new [] { typeof(string) })] + string MappingName { get; set; } + /// Migration item name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Migration item name.", + SerializedName = @"migrationItemName", + PossibleTypes = new [] { typeof(string) })] + string MigrationItemName { get; set; } + /// The migration recovery point name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The migration recovery point name.", + SerializedName = @"migrationRecoveryPointName", + PossibleTypes = new [] { typeof(string) })] + string MigrationRecoveryPointName { get; set; } + /// Network mapping name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Network mapping name.", + SerializedName = @"networkMappingName", + PossibleTypes = new [] { typeof(string) })] + string NetworkMappingName { get; set; } + /// Primary network name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Primary network name.", + SerializedName = @"networkName", + PossibleTypes = new [] { typeof(string) })] + string NetworkName { get; set; } + /// Replication policy name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Replication policy name.", + SerializedName = @"policyName", + PossibleTypes = new [] { typeof(string) })] + string PolicyName { get; set; } + /// Protectable item name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Protectable item name.", + SerializedName = @"protectableItemName", + PossibleTypes = new [] { typeof(string) })] + string ProtectableItemName { get; set; } + /// Protection container name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Protection container name.", + SerializedName = @"protectionContainerName", + PossibleTypes = new [] { typeof(string) })] + string ProtectionContainerName { get; set; } + /// Recovery services provider name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Recovery services provider name.", + SerializedName = @"providerName", + PossibleTypes = new [] { typeof(string) })] + string ProviderName { get; set; } + /// Name of the recovery plan. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Name of the recovery plan.", + SerializedName = @"recoveryPlanName", + PossibleTypes = new [] { typeof(string) })] + string RecoveryPlanName { get; set; } + /// The recovery point name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery point name.", + SerializedName = @"recoveryPointName", + PossibleTypes = new [] { typeof(string) })] + string RecoveryPointName { get; set; } + /// Replication protected item name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Replication protected item name.", + SerializedName = @"replicatedProtectedItemName", + PossibleTypes = new [] { typeof(string) })] + string ReplicatedProtectedItemName { get; set; } + /// The name of the resource group where the recovery services vault is present. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + string ResourceGroupName { get; set; } + /// The name of the recovery services vault. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + string ResourceName { get; set; } + /// Storage classification mapping name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Storage classification mapping name.", + SerializedName = @"storageClassificationMappingName", + PossibleTypes = new [] { typeof(string) })] + string StorageClassificationMappingName { get; set; } + /// Storage classification name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Storage classification name.", + SerializedName = @"storageClassificationName", + PossibleTypes = new [] { typeof(string) })] + string StorageClassificationName { get; set; } + /// The subscription Id. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + string SubscriptionId { get; set; } + /// Vault setting name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Vault setting name.", + SerializedName = @"vaultSettingName", + PossibleTypes = new [] { typeof(string) })] + string VaultSettingName { get; set; } + /// vcenter name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"vcenter name.", + SerializedName = @"vcenterName", + PossibleTypes = new [] { typeof(string) })] + string VcenterName { get; set; } + /// Virtual Machine name. + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Virtual Machine name.", + SerializedName = @"virtualMachineName", + PossibleTypes = new [] { typeof(string) })] + string VirtualMachineName { get; set; } + + } + internal partial interface ISiteRecoveryIdentityInternal + + { + /// The name of the email notification configuration. + string AlertSettingName { get; set; } + /// The name of the Azure Site Recovery event. + string EventName { get; set; } + /// Fabric name. + string FabricName { get; set; } + /// Resource identity path + string Id { get; set; } + /// Replication protection intent name. + string IntentObjectName { get; set; } + /// Job identifier. + string JobName { get; set; } + /// Logical network name. + string LogicalNetworkName { get; set; } + /// Protection Container mapping name. + string MappingName { get; set; } + /// Migration item name. + string MigrationItemName { get; set; } + /// The migration recovery point name. + string MigrationRecoveryPointName { get; set; } + /// Network mapping name. + string NetworkMappingName { get; set; } + /// Primary network name. + string NetworkName { get; set; } + /// Replication policy name. + string PolicyName { get; set; } + /// Protectable item name. + string ProtectableItemName { get; set; } + /// Protection container name. + string ProtectionContainerName { get; set; } + /// Recovery services provider name. + string ProviderName { get; set; } + /// Name of the recovery plan. + string RecoveryPlanName { get; set; } + /// The recovery point name. + string RecoveryPointName { get; set; } + /// Replication protected item name. + string ReplicatedProtectedItemName { get; set; } + /// The name of the resource group where the recovery services vault is present. + string ResourceGroupName { get; set; } + /// The name of the recovery services vault. + string ResourceName { get; set; } + /// Storage classification mapping name. + string StorageClassificationMappingName { get; set; } + /// Storage classification name. + string StorageClassificationName { get; set; } + /// The subscription Id. + string SubscriptionId { get; set; } + /// Vault setting name. + string VaultSettingName { get; set; } + /// vcenter name. + string VcenterName { get; set; } + /// Virtual Machine name. + string VirtualMachineName { get; set; } + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Models/SiteRecoveryIdentity.json.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Models/SiteRecoveryIdentity.json.cs new file mode 100644 index 000000000000..bc4482d7ce87 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Models/SiteRecoveryIdentity.json.cs @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + public partial class SiteRecoveryIdentity + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new SiteRecoveryIdentity(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject instance to deserialize from. + internal SiteRecoveryIdentity(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_resourceGroupName = If( json?.PropertyT("resourceGroupName"), out var __jsonResourceGroupName) ? (string)__jsonResourceGroupName : (string)ResourceGroupName;} + {_subscriptionId = If( json?.PropertyT("subscriptionId"), out var __jsonSubscriptionId) ? (string)__jsonSubscriptionId : (string)SubscriptionId;} + {_resourceName = If( json?.PropertyT("resourceName"), out var __jsonResourceName) ? (string)__jsonResourceName : (string)ResourceName;} + {_alertSettingName = If( json?.PropertyT("alertSettingName"), out var __jsonAlertSettingName) ? (string)__jsonAlertSettingName : (string)AlertSettingName;} + {_virtualMachineName = If( json?.PropertyT("virtualMachineName"), out var __jsonVirtualMachineName) ? (string)__jsonVirtualMachineName : (string)VirtualMachineName;} + {_eventName = If( json?.PropertyT("eventName"), out var __jsonEventName) ? (string)__jsonEventName : (string)EventName;} + {_fabricName = If( json?.PropertyT("fabricName"), out var __jsonFabricName) ? (string)__jsonFabricName : (string)FabricName;} + {_logicalNetworkName = If( json?.PropertyT("logicalNetworkName"), out var __jsonLogicalNetworkName) ? (string)__jsonLogicalNetworkName : (string)LogicalNetworkName;} + {_networkName = If( json?.PropertyT("networkName"), out var __jsonNetworkName) ? (string)__jsonNetworkName : (string)NetworkName;} + {_networkMappingName = If( json?.PropertyT("networkMappingName"), out var __jsonNetworkMappingName) ? (string)__jsonNetworkMappingName : (string)NetworkMappingName;} + {_protectionContainerName = If( json?.PropertyT("protectionContainerName"), out var __jsonProtectionContainerName) ? (string)__jsonProtectionContainerName : (string)ProtectionContainerName;} + {_migrationItemName = If( json?.PropertyT("migrationItemName"), out var __jsonMigrationItemName) ? (string)__jsonMigrationItemName : (string)MigrationItemName;} + {_migrationRecoveryPointName = If( json?.PropertyT("migrationRecoveryPointName"), out var __jsonMigrationRecoveryPointName) ? (string)__jsonMigrationRecoveryPointName : (string)MigrationRecoveryPointName;} + {_protectableItemName = If( json?.PropertyT("protectableItemName"), out var __jsonProtectableItemName) ? (string)__jsonProtectableItemName : (string)ProtectableItemName;} + {_replicatedProtectedItemName = If( json?.PropertyT("replicatedProtectedItemName"), out var __jsonReplicatedProtectedItemName) ? (string)__jsonReplicatedProtectedItemName : (string)ReplicatedProtectedItemName;} + {_recoveryPointName = If( json?.PropertyT("recoveryPointName"), out var __jsonRecoveryPointName) ? (string)__jsonRecoveryPointName : (string)RecoveryPointName;} + {_mappingName = If( json?.PropertyT("mappingName"), out var __jsonMappingName) ? (string)__jsonMappingName : (string)MappingName;} + {_providerName = If( json?.PropertyT("providerName"), out var __jsonProviderName) ? (string)__jsonProviderName : (string)ProviderName;} + {_storageClassificationName = If( json?.PropertyT("storageClassificationName"), out var __jsonStorageClassificationName) ? (string)__jsonStorageClassificationName : (string)StorageClassificationName;} + {_storageClassificationMappingName = If( json?.PropertyT("storageClassificationMappingName"), out var __jsonStorageClassificationMappingName) ? (string)__jsonStorageClassificationMappingName : (string)StorageClassificationMappingName;} + {_vcenterName = If( json?.PropertyT("vcenterName"), out var __jsonVcenterName) ? (string)__jsonVcenterName : (string)VcenterName;} + {_jobName = If( json?.PropertyT("jobName"), out var __jsonJobName) ? (string)__jsonJobName : (string)JobName;} + {_policyName = If( json?.PropertyT("policyName"), out var __jsonPolicyName) ? (string)__jsonPolicyName : (string)PolicyName;} + {_intentObjectName = If( json?.PropertyT("intentObjectName"), out var __jsonIntentObjectName) ? (string)__jsonIntentObjectName : (string)IntentObjectName;} + {_recoveryPlanName = If( json?.PropertyT("recoveryPlanName"), out var __jsonRecoveryPlanName) ? (string)__jsonRecoveryPlanName : (string)RecoveryPlanName;} + {_vaultSettingName = If( json?.PropertyT("vaultSettingName"), out var __jsonVaultSettingName) ? (string)__jsonVaultSettingName : (string)VaultSettingName;} + {_id = If( json?.PropertyT("id"), out var __jsonId) ? (string)__jsonId : (string)Id;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._resourceGroupName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._resourceGroupName.ToString()) : null, "resourceGroupName" ,container.Add ); + AddIf( null != (((object)this._subscriptionId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._subscriptionId.ToString()) : null, "subscriptionId" ,container.Add ); + AddIf( null != (((object)this._resourceName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._resourceName.ToString()) : null, "resourceName" ,container.Add ); + AddIf( null != (((object)this._alertSettingName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._alertSettingName.ToString()) : null, "alertSettingName" ,container.Add ); + AddIf( null != (((object)this._virtualMachineName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._virtualMachineName.ToString()) : null, "virtualMachineName" ,container.Add ); + AddIf( null != (((object)this._eventName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._eventName.ToString()) : null, "eventName" ,container.Add ); + AddIf( null != (((object)this._fabricName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._fabricName.ToString()) : null, "fabricName" ,container.Add ); + AddIf( null != (((object)this._logicalNetworkName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._logicalNetworkName.ToString()) : null, "logicalNetworkName" ,container.Add ); + AddIf( null != (((object)this._networkName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._networkName.ToString()) : null, "networkName" ,container.Add ); + AddIf( null != (((object)this._networkMappingName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._networkMappingName.ToString()) : null, "networkMappingName" ,container.Add ); + AddIf( null != (((object)this._protectionContainerName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._protectionContainerName.ToString()) : null, "protectionContainerName" ,container.Add ); + AddIf( null != (((object)this._migrationItemName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._migrationItemName.ToString()) : null, "migrationItemName" ,container.Add ); + AddIf( null != (((object)this._migrationRecoveryPointName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._migrationRecoveryPointName.ToString()) : null, "migrationRecoveryPointName" ,container.Add ); + AddIf( null != (((object)this._protectableItemName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._protectableItemName.ToString()) : null, "protectableItemName" ,container.Add ); + AddIf( null != (((object)this._replicatedProtectedItemName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._replicatedProtectedItemName.ToString()) : null, "replicatedProtectedItemName" ,container.Add ); + AddIf( null != (((object)this._recoveryPointName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryPointName.ToString()) : null, "recoveryPointName" ,container.Add ); + AddIf( null != (((object)this._mappingName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._mappingName.ToString()) : null, "mappingName" ,container.Add ); + AddIf( null != (((object)this._providerName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._providerName.ToString()) : null, "providerName" ,container.Add ); + AddIf( null != (((object)this._storageClassificationName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._storageClassificationName.ToString()) : null, "storageClassificationName" ,container.Add ); + AddIf( null != (((object)this._storageClassificationMappingName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._storageClassificationMappingName.ToString()) : null, "storageClassificationMappingName" ,container.Add ); + AddIf( null != (((object)this._vcenterName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._vcenterName.ToString()) : null, "vcenterName" ,container.Add ); + AddIf( null != (((object)this._jobName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._jobName.ToString()) : null, "jobName" ,container.Add ); + AddIf( null != (((object)this._policyName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._policyName.ToString()) : null, "policyName" ,container.Add ); + AddIf( null != (((object)this._intentObjectName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._intentObjectName.ToString()) : null, "intentObjectName" ,container.Add ); + AddIf( null != (((object)this._recoveryPlanName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._recoveryPlanName.ToString()) : null, "recoveryPlanName" ,container.Add ); + AddIf( null != (((object)this._vaultSettingName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._vaultSettingName.ToString()) : null, "vaultSettingName" ,container.Add ); + AddIf( null != (((object)this._id)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonString(this._id.ToString()) : null, "id" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/SiteRecoveryManagementClient.cs b/swaggerci/recoveryservicessiterecovery/generated/api/SiteRecoveryManagementClient.cs new file mode 100644 index 000000000000..11c3877ad3f6 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/SiteRecoveryManagementClient.cs @@ -0,0 +1,32058 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + /// + /// Low-level API implementation for the SiteRecoveryManagementClient service. + /// + public partial class SiteRecoveryManagementClient + { + + /// Gets a recovery point for a migration item. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Fabric unique name. + /// Protection container name. + /// Migration item name. + /// The migration recovery point name. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task MigrationRecoveryPointsGet(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string migrationItemName, string migrationRecoveryPointName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + + "/replicationProtectionContainers/" + + global::System.Uri.EscapeDataString(protectionContainerName) + + "/replicationMigrationItems/" + + global::System.Uri.EscapeDataString(migrationItemName) + + "/migrationRecoveryPoints/" + + global::System.Uri.EscapeDataString(migrationRecoveryPointName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.MigrationRecoveryPointsGet_Call(request,onOk,eventListener,sender); + } + } + + /// Gets a recovery point for a migration item. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task MigrationRecoveryPointsGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationFabrics/(?[^/]+)/replicationProtectionContainers/(?[^/]+)/replicationMigrationItems/(?[^/]+)/migrationRecoveryPoints/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/migrationRecoveryPoints/{migrationRecoveryPointName}'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var fabricName = _match.Groups["fabricName"].Value; + var protectionContainerName = _match.Groups["protectionContainerName"].Value; + var migrationItemName = _match.Groups["migrationItemName"].Value; + var migrationRecoveryPointName = _match.Groups["migrationRecoveryPointName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationFabrics/" + + fabricName + + "/replicationProtectionContainers/" + + protectionContainerName + + "/replicationMigrationItems/" + + migrationItemName + + "/migrationRecoveryPoints/" + + migrationRecoveryPointName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.MigrationRecoveryPointsGet_Call(request,onOk,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task MigrationRecoveryPointsGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.MigrationRecoveryPoint.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get + /// validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Fabric unique name. + /// Protection container name. + /// Migration item name. + /// The migration recovery point name. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task MigrationRecoveryPointsGet_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string migrationItemName, string migrationRecoveryPointName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(fabricName),fabricName); + await eventListener.AssertNotNull(nameof(protectionContainerName),protectionContainerName); + await eventListener.AssertNotNull(nameof(migrationItemName),migrationItemName); + await eventListener.AssertNotNull(nameof(migrationRecoveryPointName),migrationRecoveryPointName); + } + } + + /// Gets the recovery points for a migration item. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Fabric unique name. + /// Protection container name. + /// Migration item name. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task MigrationRecoveryPointsListByReplicationMigrationItems(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string migrationItemName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + + "/replicationProtectionContainers/" + + global::System.Uri.EscapeDataString(protectionContainerName) + + "/replicationMigrationItems/" + + global::System.Uri.EscapeDataString(migrationItemName) + + "/migrationRecoveryPoints" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.MigrationRecoveryPointsListByReplicationMigrationItems_Call(request,onOk,eventListener,sender); + } + } + + /// Gets the recovery points for a migration item. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task MigrationRecoveryPointsListByReplicationMigrationItemsViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationFabrics/(?[^/]+)/replicationProtectionContainers/(?[^/]+)/replicationMigrationItems/(?[^/]+)/migrationRecoveryPoints$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/migrationRecoveryPoints'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var fabricName = _match.Groups["fabricName"].Value; + var protectionContainerName = _match.Groups["protectionContainerName"].Value; + var migrationItemName = _match.Groups["migrationItemName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationFabrics/" + + fabricName + + "/replicationProtectionContainers/" + + protectionContainerName + + "/replicationMigrationItems/" + + migrationItemName + + "/migrationRecoveryPoints" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.MigrationRecoveryPointsListByReplicationMigrationItems_Call(request,onOk,eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task MigrationRecoveryPointsListByReplicationMigrationItems_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.MigrationRecoveryPointCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the + /// actual call, but you will get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Fabric unique name. + /// Protection container name. + /// Migration item name. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task MigrationRecoveryPointsListByReplicationMigrationItems_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string migrationItemName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(fabricName),fabricName); + await eventListener.AssertNotNull(nameof(protectionContainerName),protectionContainerName); + await eventListener.AssertNotNull(nameof(migrationItemName),migrationItemName); + } + } + + /// Operation to return the list of available operations. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task OperationsList(string resourceGroupName, string subscriptionId, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/operations" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.OperationsList_Call(request,onOk,eventListener,sender); + } + } + + /// Operation to return the list of available operations. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task OperationsListViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/operations$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/operations'"); + } + + // replace URI parameters with values from identity + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/operations" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.OperationsList_Call(request,onOk,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task OperationsList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.OperationsDiscoveryCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task OperationsList_Validate(string resourceGroupName, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + } + } + + /// Get the details of specified recovery point. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// The fabric name. + /// The protection container name. + /// The replication protected item name. + /// The recovery point name. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task RecoveryPointsGet(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string replicatedProtectedItemName, string recoveryPointName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + + "/replicationProtectionContainers/" + + global::System.Uri.EscapeDataString(protectionContainerName) + + "/replicationProtectedItems/" + + global::System.Uri.EscapeDataString(replicatedProtectedItemName) + + "/recoveryPoints/" + + global::System.Uri.EscapeDataString(recoveryPointName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.RecoveryPointsGet_Call(request,onOk,eventListener,sender); + } + } + + /// Get the details of specified recovery point. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task RecoveryPointsGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationFabrics/(?[^/]+)/replicationProtectionContainers/(?[^/]+)/replicationProtectedItems/(?[^/]+)/recoveryPoints/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/recoveryPoints/{recoveryPointName}'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var fabricName = _match.Groups["fabricName"].Value; + var protectionContainerName = _match.Groups["protectionContainerName"].Value; + var replicatedProtectedItemName = _match.Groups["replicatedProtectedItemName"].Value; + var recoveryPointName = _match.Groups["recoveryPointName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationFabrics/" + + fabricName + + "/replicationProtectionContainers/" + + protectionContainerName + + "/replicationProtectedItems/" + + replicatedProtectedItemName + + "/recoveryPoints/" + + recoveryPointName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.RecoveryPointsGet_Call(request,onOk,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task RecoveryPointsGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPoint.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// The fabric name. + /// The protection container name. + /// The replication protected item name. + /// The recovery point name. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task RecoveryPointsGet_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string replicatedProtectedItemName, string recoveryPointName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(fabricName),fabricName); + await eventListener.AssertNotNull(nameof(protectionContainerName),protectionContainerName); + await eventListener.AssertNotNull(nameof(replicatedProtectedItemName),replicatedProtectedItemName); + await eventListener.AssertNotNull(nameof(recoveryPointName),recoveryPointName); + } + } + + /// Lists the available recovery points for a replication protected item. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// The fabric name. + /// The protection container name. + /// The replication protected item name. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task RecoveryPointsListByReplicationProtectedItems(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string replicatedProtectedItemName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + + "/replicationProtectionContainers/" + + global::System.Uri.EscapeDataString(protectionContainerName) + + "/replicationProtectedItems/" + + global::System.Uri.EscapeDataString(replicatedProtectedItemName) + + "/recoveryPoints" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.RecoveryPointsListByReplicationProtectedItems_Call(request,onOk,eventListener,sender); + } + } + + /// Lists the available recovery points for a replication protected item. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task RecoveryPointsListByReplicationProtectedItemsViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationFabrics/(?[^/]+)/replicationProtectionContainers/(?[^/]+)/replicationProtectedItems/(?[^/]+)/recoveryPoints$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/recoveryPoints'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var fabricName = _match.Groups["fabricName"].Value; + var protectionContainerName = _match.Groups["protectionContainerName"].Value; + var replicatedProtectedItemName = _match.Groups["replicatedProtectedItemName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationFabrics/" + + fabricName + + "/replicationProtectionContainers/" + + protectionContainerName + + "/replicationProtectedItems/" + + replicatedProtectedItemName + + "/recoveryPoints" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.RecoveryPointsListByReplicationProtectedItems_Call(request,onOk,eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task RecoveryPointsListByReplicationProtectedItems_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPointCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, + /// but you will get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// The fabric name. + /// The protection container name. + /// The replication protected item name. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task RecoveryPointsListByReplicationProtectedItems_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string replicatedProtectedItemName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(fabricName),fabricName); + await eventListener.AssertNotNull(nameof(protectionContainerName),protectionContainerName); + await eventListener.AssertNotNull(nameof(replicatedProtectedItemName),replicatedProtectedItemName); + } + } + + /// Create or update an email notification(alert) configuration. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// The name of the email notification(alert) configuration. + /// The input to configure the email notification(alert). + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationAlertSettingsCreate(string resourceName, string resourceGroupName, string subscriptionId, string alertSettingName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigureAlertRequest body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationAlertSettings/" + + global::System.Uri.EscapeDataString(alertSettingName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationAlertSettingsCreate_Call(request,onOk,eventListener,sender); + } + } + + /// Create or update an email notification(alert) configuration. + /// + /// The input to configure the email notification(alert). + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationAlertSettingsCreateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigureAlertRequest body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationAlertSettings/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationAlertSettings/{alertSettingName}'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var alertSettingName = _match.Groups["alertSettingName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationAlertSettings/" + + alertSettingName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationAlertSettingsCreate_Call(request,onOk,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationAlertSettingsCreate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.Alert.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will + /// get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// The name of the email notification(alert) configuration. + /// The input to configure the email notification(alert). + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationAlertSettingsCreate_Validate(string resourceName, string resourceGroupName, string subscriptionId, string alertSettingName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigureAlertRequest body, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(alertSettingName),alertSettingName); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// Gets the details of the specified email notification(alert) configuration. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// The name of the email notification configuration. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationAlertSettingsGet(string resourceName, string resourceGroupName, string subscriptionId, string alertSettingName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationAlertSettings/" + + global::System.Uri.EscapeDataString(alertSettingName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationAlertSettingsGet_Call(request,onOk,eventListener,sender); + } + } + + /// Gets the details of the specified email notification(alert) configuration. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationAlertSettingsGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationAlertSettings/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationAlertSettings/{alertSettingName}'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var alertSettingName = _match.Groups["alertSettingName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationAlertSettings/" + + alertSettingName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationAlertSettingsGet_Call(request,onOk,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationAlertSettingsGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.Alert.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will + /// get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// The name of the email notification configuration. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationAlertSettingsGet_Validate(string resourceName, string resourceGroupName, string subscriptionId, string alertSettingName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(alertSettingName),alertSettingName); + } + } + + /// Gets the list of email notification(alert) configurations for the vault. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationAlertSettingsList(string resourceName, string resourceGroupName, string subscriptionId, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationAlertSettings" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationAlertSettingsList_Call(request,onOk,eventListener,sender); + } + } + + /// Gets the list of email notification(alert) configurations for the vault. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationAlertSettingsListViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationAlertSettings$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationAlertSettings'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationAlertSettings" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationAlertSettingsList_Call(request,onOk,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationAlertSettingsList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AlertCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will + /// get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationAlertSettingsList_Validate(string resourceName, string resourceGroupName, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + } + } + + /// Gets the list of Azure Site Recovery appliances for the vault. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// OData filter options. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationAppliancesList(string resourceName, string resourceGroupName, string subscriptionId, string Filter, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationAppliances" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + + "&" + + (string.IsNullOrEmpty(Filter) ? global::System.String.Empty : "$filter=" + global::System.Uri.EscapeDataString(Filter)) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationAppliancesList_Call(request,onOk,eventListener,sender); + } + } + + /// Gets the list of Azure Site Recovery appliances for the vault. + /// + /// OData filter options. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationAppliancesListViaIdentity(global::System.String viaIdentity, string Filter, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationAppliances$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationAppliances'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationAppliances" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + + "&" + + (string.IsNullOrEmpty(Filter) ? global::System.String.Empty : "$filter=" + global::System.Uri.EscapeDataString(Filter)) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationAppliancesList_Call(request,onOk,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationAppliancesList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ApplianceCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get + /// validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// OData filter options. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationAppliancesList_Validate(string resourceName, string resourceGroupName, string subscriptionId, string Filter, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(Filter),Filter); + } + } + + /// + /// Validates whether a given VM can be protected or not in which case returns list of errors. + /// + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Virtual Machine name. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationEligibilityResultsGet(string resourceGroupName, string subscriptionId, string virtualMachineName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Compute/virtualMachines/" + + global::System.Uri.EscapeDataString(virtualMachineName) + + "/providers/Microsoft.RecoveryServices/replicationEligibilityResults/default" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationEligibilityResultsGet_Call(request,onOk,eventListener,sender); + } + } + + /// + /// Validates whether a given VM can be protected or not in which case returns list of errors. + /// + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationEligibilityResultsGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Compute/virtualMachines/(?[^/]+)/providers/Microsoft.RecoveryServices/replicationEligibilityResults/default$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{virtualMachineName}/providers/Microsoft.RecoveryServices/replicationEligibilityResults/default'"); + } + + // replace URI parameters with values from identity + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var virtualMachineName = _match.Groups["virtualMachineName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Compute/virtualMachines/" + + virtualMachineName + + "/providers/Microsoft.RecoveryServices/replicationEligibilityResults/default" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationEligibilityResultsGet_Call(request,onOk,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationEligibilityResultsGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationEligibilityResults.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you + /// will get validation events back. + /// + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Virtual Machine name. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationEligibilityResultsGet_Validate(string resourceGroupName, string subscriptionId, string virtualMachineName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(virtualMachineName),virtualMachineName); + } + } + + /// + /// Validates whether a given VM can be protected or not in which case returns list of errors. + /// + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Virtual Machine name. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationEligibilityResultsList(string resourceGroupName, string subscriptionId, string virtualMachineName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Compute/virtualMachines/" + + global::System.Uri.EscapeDataString(virtualMachineName) + + "/providers/Microsoft.RecoveryServices/replicationEligibilityResults" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationEligibilityResultsList_Call(request,onOk,eventListener,sender); + } + } + + /// + /// Validates whether a given VM can be protected or not in which case returns list of errors. + /// + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationEligibilityResultsListViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Compute/virtualMachines/(?[^/]+)/providers/Microsoft.RecoveryServices/replicationEligibilityResults$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{virtualMachineName}/providers/Microsoft.RecoveryServices/replicationEligibilityResults'"); + } + + // replace URI parameters with values from identity + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var virtualMachineName = _match.Groups["virtualMachineName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Compute/virtualMachines/" + + virtualMachineName + + "/providers/Microsoft.RecoveryServices/replicationEligibilityResults" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationEligibilityResultsList_Call(request,onOk,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationEligibilityResultsList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationEligibilityResultsCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you + /// will get validation events back. + /// + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Virtual Machine name. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationEligibilityResultsList_Validate(string resourceGroupName, string subscriptionId, string virtualMachineName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(virtualMachineName),virtualMachineName); + } + } + + /// The operation to get the details of an Azure Site recovery event. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// The name of the Azure Site Recovery event. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationEventsGet(string resourceName, string resourceGroupName, string subscriptionId, string eventName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationEvents/" + + global::System.Uri.EscapeDataString(eventName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationEventsGet_Call(request,onOk,eventListener,sender); + } + } + + /// The operation to get the details of an Azure Site recovery event. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationEventsGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationEvents/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationEvents/{eventName}'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var eventName = _match.Groups["eventName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationEvents/" + + eventName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationEventsGet_Call(request,onOk,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationEventsGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.Event.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// The name of the Azure Site Recovery event. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationEventsGet_Validate(string resourceName, string resourceGroupName, string subscriptionId, string eventName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(eventName),eventName); + } + } + + /// Gets the list of Azure Site Recovery events for the vault. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// OData filter options. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationEventsList(string resourceName, string resourceGroupName, string subscriptionId, string Filter, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationEvents" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + + "&" + + (string.IsNullOrEmpty(Filter) ? global::System.String.Empty : "$filter=" + global::System.Uri.EscapeDataString(Filter)) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationEventsList_Call(request,onOk,eventListener,sender); + } + } + + /// Gets the list of Azure Site Recovery events for the vault. + /// + /// OData filter options. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationEventsListViaIdentity(global::System.String viaIdentity, string Filter, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationEvents$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationEvents'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationEvents" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + + "&" + + (string.IsNullOrEmpty(Filter) ? global::System.String.Empty : "$filter=" + global::System.Uri.EscapeDataString(Filter)) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationEventsList_Call(request,onOk,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationEventsList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EventCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// OData filter options. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationEventsList_Validate(string resourceName, string resourceGroupName, string subscriptionId, string Filter, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(Filter),Filter); + } + } + + /// The operation to perform a consistency check on the fabric. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Fabric name. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationFabricsCheckConsistency(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + + "/checkConsistency" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationFabricsCheckConsistency_Call(request,onOk,eventListener,sender); + } + } + + /// The operation to perform a consistency check on the fabric. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationFabricsCheckConsistencyViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationFabrics/(?[^/]+)/checkConsistency$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/checkConsistency'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var fabricName = _match.Groups["fabricName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationFabrics/" + + fabricName + + "/checkConsistency" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationFabricsCheckConsistency_Call(request,onOk,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationFabricsCheckConsistency_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: default + var _finalUri = _response.GetFirstHeader(@"Location"); + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + if (!string.IsNullOrWhiteSpace(_finalUri)) + { + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.Fabric.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you + /// will get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Fabric name. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationFabricsCheckConsistency_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(fabricName),fabricName); + } + } + + /// The operation to create an Azure Site Recovery fabric (for e.g. Hyper-V site). + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Name of the ASR fabric. + /// Fabric creation input. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationFabricsCreate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricCreationInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationFabricsCreate_Call(request,onOk,eventListener,sender); + } + } + + /// The operation to create an Azure Site Recovery fabric (for e.g. Hyper-V site). + /// + /// Fabric creation input. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationFabricsCreateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricCreationInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationFabrics/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var fabricName = _match.Groups["fabricName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationFabrics/" + + fabricName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationFabricsCreate_Call(request,onOk,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationFabricsCreate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: default + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + if (!string.IsNullOrWhiteSpace(_originalUri)) + { + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_originalUri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.Fabric.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get + /// validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Name of the ASR fabric. + /// Fabric creation input. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationFabricsCreate_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricCreationInput body, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(fabricName),fabricName); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// The operation to delete or remove an Azure Site Recovery fabric. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// ASR fabric to delete. + /// a delegate that is called when the remote service returns 204 (NoContent). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationFabricsDelete(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + + "/remove" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationFabricsDelete_Call(request,onNoContent,eventListener,sender); + } + } + + /// The operation to delete or remove an Azure Site Recovery fabric. + /// + /// a delegate that is called when the remote service returns 204 (NoContent). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationFabricsDeleteViaIdentity(global::System.String viaIdentity, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationFabrics/(?[^/]+)/remove$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/remove'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var fabricName = _match.Groups["fabricName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationFabrics/" + + fabricName + + "/remove" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationFabricsDelete_Call(request,onNoContent,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 204 (NoContent). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationFabricsDelete_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: default + var _finalUri = _response.GetFirstHeader(@"Location"); + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + if (!string.IsNullOrWhiteSpace(_finalUri)) + { + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.NoContent: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onNoContent(_response); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get + /// validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// ASR fabric to delete. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationFabricsDelete_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(fabricName),fabricName); + } + } + + /// Gets the details of an Azure Site Recovery fabric. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Fabric name. + /// OData filter options. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationFabricsGet(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string Filter, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + + "&" + + (string.IsNullOrEmpty(Filter) ? global::System.String.Empty : "$filter=" + global::System.Uri.EscapeDataString(Filter)) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationFabricsGet_Call(request,onOk,eventListener,sender); + } + } + + /// Gets the details of an Azure Site Recovery fabric. + /// + /// OData filter options. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationFabricsGetViaIdentity(global::System.String viaIdentity, string Filter, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationFabrics/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var fabricName = _match.Groups["fabricName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationFabrics/" + + fabricName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + + "&" + + (string.IsNullOrEmpty(Filter) ? global::System.String.Empty : "$filter=" + global::System.Uri.EscapeDataString(Filter)) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationFabricsGet_Call(request,onOk,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationFabricsGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.Fabric.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Fabric name. + /// OData filter options. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationFabricsGet_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string Filter, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(fabricName),fabricName); + await eventListener.AssertNotNull(nameof(Filter),Filter); + } + } + + /// Gets a list of the Azure Site Recovery fabrics in the vault. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationFabricsList(string resourceName, string resourceGroupName, string subscriptionId, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationFabrics" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationFabricsList_Call(request,onOk,eventListener,sender); + } + } + + /// Gets a list of the Azure Site Recovery fabrics in the vault. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationFabricsListViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationFabrics$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationFabrics" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationFabricsList_Call(request,onOk,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationFabricsList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FabricCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationFabricsList_Validate(string resourceName, string resourceGroupName, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + } + } + + /// The operation to migrate an Azure Site Recovery fabric to AAD. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// ASR fabric to migrate. + /// a delegate that is called when the remote service returns 204 (NoContent). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationFabricsMigrateToAad(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + + "/migratetoaad" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationFabricsMigrateToAad_Call(request,onNoContent,eventListener,sender); + } + } + + /// The operation to migrate an Azure Site Recovery fabric to AAD. + /// + /// a delegate that is called when the remote service returns 204 (NoContent). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationFabricsMigrateToAadViaIdentity(global::System.String viaIdentity, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationFabrics/(?[^/]+)/migratetoaad$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/migratetoaad'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var fabricName = _match.Groups["fabricName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationFabrics/" + + fabricName + + "/migratetoaad" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationFabricsMigrateToAad_Call(request,onNoContent,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 204 (NoContent). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationFabricsMigrateToAad_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: default + var _finalUri = _response.GetFirstHeader(@"Location"); + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + if (!string.IsNullOrWhiteSpace(_finalUri)) + { + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.NoContent: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onNoContent(_response); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will + /// get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// ASR fabric to migrate. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationFabricsMigrateToAad_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(fabricName),fabricName); + } + } + + /// The operation to purge(force delete) an Azure Site Recovery fabric. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// ASR fabric to purge. + /// a delegate that is called when the remote service returns 204 (NoContent). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationFabricsPurge(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Delete, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationFabricsPurge_Call(request,onNoContent,eventListener,sender); + } + } + + /// The operation to purge(force delete) an Azure Site Recovery fabric. + /// + /// a delegate that is called when the remote service returns 204 (NoContent). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationFabricsPurgeViaIdentity(global::System.String viaIdentity, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationFabrics/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var fabricName = _match.Groups["fabricName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationFabrics/" + + fabricName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Delete, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationFabricsPurge_Call(request,onNoContent,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 204 (NoContent). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationFabricsPurge_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: default + var _finalUri = _response.GetFirstHeader(@"Location"); + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + if (!string.IsNullOrWhiteSpace(_finalUri)) + { + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.NoContent: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onNoContent(_response); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get + /// validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// ASR fabric to purge. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationFabricsPurge_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(fabricName),fabricName); + } + } + + /// + /// The operation to move replications from a process server to another process server. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// The name of the fabric containing the process server. + /// The input to the failover process server operation. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationFabricsReassociateGateway(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverProcessServerRequest body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + + "/reassociateGateway" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationFabricsReassociateGateway_Call(request,onOk,eventListener,sender); + } + } + + /// + /// The operation to move replications from a process server to another process server. + /// + /// + /// The input to the failover process server operation. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationFabricsReassociateGatewayViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverProcessServerRequest body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationFabrics/(?[^/]+)/reassociateGateway$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/reassociateGateway'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var fabricName = _match.Groups["fabricName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationFabrics/" + + fabricName + + "/reassociateGateway" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationFabricsReassociateGateway_Call(request,onOk,eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationFabricsReassociateGateway_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: default + var _finalUri = _response.GetFirstHeader(@"Location"); + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + if (!string.IsNullOrWhiteSpace(_finalUri)) + { + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.Fabric.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but + /// you will get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// The name of the fabric containing the process server. + /// The input to the failover process server operation. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationFabricsReassociateGateway_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverProcessServerRequest body, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(fabricName),fabricName); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// Renews the connection certificate for the ASR replication fabric. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// fabric name to renew certs for. + /// Renew certificate input. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationFabricsRenewCertificate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRenewCertificateInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + + "/renewCertificate" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationFabricsRenewCertificate_Call(request,onOk,eventListener,sender); + } + } + + /// Renews the connection certificate for the ASR replication fabric. + /// + /// Renew certificate input. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationFabricsRenewCertificateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRenewCertificateInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationFabrics/(?[^/]+)/renewCertificate$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/renewCertificate'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var fabricName = _match.Groups["fabricName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationFabrics/" + + fabricName + + "/renewCertificate" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationFabricsRenewCertificate_Call(request,onOk,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationFabricsRenewCertificate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: default + var _finalUri = _response.GetFirstHeader(@"Location"); + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + if (!string.IsNullOrWhiteSpace(_finalUri)) + { + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.Fabric.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you + /// will get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// fabric name to renew certs for. + /// Renew certificate input. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationFabricsRenewCertificate_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRenewCertificateInput body, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(fabricName),fabricName); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// The operation to cancel an Azure Site Recovery job. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Job identifier. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationJobsCancel(string resourceName, string resourceGroupName, string subscriptionId, string jobName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationJobs/" + + global::System.Uri.EscapeDataString(jobName) + + "/cancel" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationJobsCancel_Call(request,onOk,eventListener,sender); + } + } + + /// The operation to cancel an Azure Site Recovery job. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationJobsCancelViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationJobs/(?[^/]+)/cancel$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationJobs/{jobName}/cancel'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var jobName = _match.Groups["jobName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationJobs/" + + jobName + + "/cancel" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationJobsCancel_Call(request,onOk,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationJobsCancel_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: default + var _finalUri = _response.GetFirstHeader(@"Location"); + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + if (!string.IsNullOrWhiteSpace(_finalUri)) + { + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.Job.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Job identifier. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationJobsCancel_Validate(string resourceName, string resourceGroupName, string subscriptionId, string jobName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(jobName),jobName); + } + } + + /// + /// The operation to export the details of the Azure Site Recovery jobs of the vault. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// job query filter. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationJobsExport(string resourceName, string resourceGroupName, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobQueryParameter body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationJobs/export" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationJobsExport_Call(request,onOk,eventListener,sender); + } + } + + /// + /// The operation to export the details of the Azure Site Recovery jobs of the vault. + /// + /// + /// job query filter. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationJobsExportViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobQueryParameter body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationJobs/export$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationJobs/export'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationJobs/export" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationJobsExport_Call(request,onOk,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationJobsExport_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: default + var _finalUri = _response.GetFirstHeader(@"Location"); + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + if (!string.IsNullOrWhiteSpace(_finalUri)) + { + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.Job.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// job query filter. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationJobsExport_Validate(string resourceName, string resourceGroupName, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobQueryParameter body, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// Get the details of an Azure Site Recovery job. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Job identifier. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationJobsGet(string resourceName, string resourceGroupName, string subscriptionId, string jobName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationJobs/" + + global::System.Uri.EscapeDataString(jobName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationJobsGet_Call(request,onOk,eventListener,sender); + } + } + + /// Get the details of an Azure Site Recovery job. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationJobsGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationJobs/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationJobs/{jobName}'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var jobName = _match.Groups["jobName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationJobs/" + + jobName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationJobsGet_Call(request,onOk,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationJobsGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.Job.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Job identifier. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationJobsGet_Validate(string resourceName, string resourceGroupName, string subscriptionId, string jobName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(jobName),jobName); + } + } + + /// Gets the list of Azure Site Recovery Jobs for the vault. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// OData filter options. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationJobsList(string resourceName, string resourceGroupName, string subscriptionId, string Filter, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationJobs" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + + "&" + + (string.IsNullOrEmpty(Filter) ? global::System.String.Empty : "$filter=" + global::System.Uri.EscapeDataString(Filter)) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationJobsList_Call(request,onOk,eventListener,sender); + } + } + + /// Gets the list of Azure Site Recovery Jobs for the vault. + /// + /// OData filter options. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationJobsListViaIdentity(global::System.String viaIdentity, string Filter, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationJobs$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationJobs'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationJobs" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + + "&" + + (string.IsNullOrEmpty(Filter) ? global::System.String.Empty : "$filter=" + global::System.Uri.EscapeDataString(Filter)) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationJobsList_Call(request,onOk,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationJobsList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.JobCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// OData filter options. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationJobsList_Validate(string resourceName, string resourceGroupName, string subscriptionId, string Filter, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(Filter),Filter); + } + } + + /// The operation to restart an Azure Site Recovery job. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Job identifier. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationJobsRestart(string resourceName, string resourceGroupName, string subscriptionId, string jobName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationJobs/" + + global::System.Uri.EscapeDataString(jobName) + + "/restart" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationJobsRestart_Call(request,onOk,eventListener,sender); + } + } + + /// The operation to restart an Azure Site Recovery job. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationJobsRestartViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationJobs/(?[^/]+)/restart$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationJobs/{jobName}/restart'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var jobName = _match.Groups["jobName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationJobs/" + + jobName + + "/restart" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationJobsRestart_Call(request,onOk,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationJobsRestart_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: default + var _finalUri = _response.GetFirstHeader(@"Location"); + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + if (!string.IsNullOrWhiteSpace(_finalUri)) + { + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.Job.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Job identifier. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationJobsRestart_Validate(string resourceName, string resourceGroupName, string subscriptionId, string jobName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(jobName),jobName); + } + } + + /// The operation to resume an Azure Site Recovery job. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Job identifier. + /// Resume rob comments. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationJobsResume(string resourceName, string resourceGroupName, string subscriptionId, string jobName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeJobParams body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationJobs/" + + global::System.Uri.EscapeDataString(jobName) + + "/resume" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationJobsResume_Call(request,onOk,eventListener,sender); + } + } + + /// The operation to resume an Azure Site Recovery job. + /// + /// Resume rob comments. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationJobsResumeViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeJobParams body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationJobs/(?[^/]+)/resume$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationJobs/{jobName}/resume'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var jobName = _match.Groups["jobName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationJobs/" + + jobName + + "/resume" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationJobsResume_Call(request,onOk,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationJobsResume_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: default + var _finalUri = _response.GetFirstHeader(@"Location"); + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + if (!string.IsNullOrWhiteSpace(_finalUri)) + { + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.Job.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Job identifier. + /// Resume rob comments. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationJobsResume_Validate(string resourceName, string resourceGroupName, string subscriptionId, string jobName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeJobParams body, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(jobName),jobName); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// Gets the details of a logical network. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Server Id. + /// Logical network name. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationLogicalNetworksGet(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string logicalNetworkName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + + "/replicationLogicalNetworks/" + + global::System.Uri.EscapeDataString(logicalNetworkName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationLogicalNetworksGet_Call(request,onOk,eventListener,sender); + } + } + + /// Gets the details of a logical network. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationLogicalNetworksGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationFabrics/(?[^/]+)/replicationLogicalNetworks/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationLogicalNetworks/{logicalNetworkName}'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var fabricName = _match.Groups["fabricName"].Value; + var logicalNetworkName = _match.Groups["logicalNetworkName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationFabrics/" + + fabricName + + "/replicationLogicalNetworks/" + + logicalNetworkName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationLogicalNetworksGet_Call(request,onOk,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationLogicalNetworksGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.LogicalNetwork.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will + /// get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Server Id. + /// Logical network name. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationLogicalNetworksGet_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string logicalNetworkName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(fabricName),fabricName); + await eventListener.AssertNotNull(nameof(logicalNetworkName),logicalNetworkName); + } + } + + /// Lists all the logical networks of the Azure Site Recovery fabric. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Server Id. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationLogicalNetworksListByReplicationFabrics(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + + "/replicationLogicalNetworks" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationLogicalNetworksListByReplicationFabrics_Call(request,onOk,eventListener,sender); + } + } + + /// Lists all the logical networks of the Azure Site Recovery fabric. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationLogicalNetworksListByReplicationFabricsViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationFabrics/(?[^/]+)/replicationLogicalNetworks$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationLogicalNetworks'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var fabricName = _match.Groups["fabricName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationFabrics/" + + fabricName + + "/replicationLogicalNetworks" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationLogicalNetworksListByReplicationFabrics_Call(request,onOk,eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationLogicalNetworksListByReplicationFabrics_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.LogicalNetworkCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual + /// call, but you will get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Server Id. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationLogicalNetworksListByReplicationFabrics_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(fabricName),fabricName); + } + } + + /// The operation to create an ASR migration item (enable migration). + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Fabric name. + /// Protection container name. + /// Migration item name. + /// Enable migration input. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationMigrationItemsCreate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string migrationItemName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + + "/replicationProtectionContainers/" + + global::System.Uri.EscapeDataString(protectionContainerName) + + "/replicationMigrationItems/" + + global::System.Uri.EscapeDataString(migrationItemName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationMigrationItemsCreate_Call(request,onOk,eventListener,sender); + } + } + + /// The operation to create an ASR migration item (enable migration). + /// + /// Enable migration input. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationMigrationItemsCreateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationFabrics/(?[^/]+)/replicationProtectionContainers/(?[^/]+)/replicationMigrationItems/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var fabricName = _match.Groups["fabricName"].Value; + var protectionContainerName = _match.Groups["protectionContainerName"].Value; + var migrationItemName = _match.Groups["migrationItemName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationFabrics/" + + fabricName + + "/replicationProtectionContainers/" + + protectionContainerName + + "/replicationMigrationItems/" + + migrationItemName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationMigrationItemsCreate_Call(request,onOk,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationMigrationItemsCreate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: default + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + if (!string.IsNullOrWhiteSpace(_originalUri)) + { + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_originalUri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.MigrationItem.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will + /// get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Fabric name. + /// Protection container name. + /// Migration item name. + /// Enable migration input. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationMigrationItemsCreate_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string migrationItemName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationInput body, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(fabricName),fabricName); + await eventListener.AssertNotNull(nameof(protectionContainerName),protectionContainerName); + await eventListener.AssertNotNull(nameof(migrationItemName),migrationItemName); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// The operation to delete an ASR migration item. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Fabric name. + /// Protection container name. + /// Migration item name. + /// The delete option. + /// a delegate that is called when the remote service returns 204 (NoContent). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationMigrationItemsDelete(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string migrationItemName, string deleteOption, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + + "/replicationProtectionContainers/" + + global::System.Uri.EscapeDataString(protectionContainerName) + + "/replicationMigrationItems/" + + global::System.Uri.EscapeDataString(migrationItemName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + + "&" + + (string.IsNullOrEmpty(deleteOption) ? global::System.String.Empty : "deleteOption=" + global::System.Uri.EscapeDataString(deleteOption)) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Delete, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationMigrationItemsDelete_Call(request,onNoContent,eventListener,sender); + } + } + + /// The operation to delete an ASR migration item. + /// + /// The delete option. + /// a delegate that is called when the remote service returns 204 (NoContent). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationMigrationItemsDeleteViaIdentity(global::System.String viaIdentity, string deleteOption, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationFabrics/(?[^/]+)/replicationProtectionContainers/(?[^/]+)/replicationMigrationItems/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var fabricName = _match.Groups["fabricName"].Value; + var protectionContainerName = _match.Groups["protectionContainerName"].Value; + var migrationItemName = _match.Groups["migrationItemName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationFabrics/" + + fabricName + + "/replicationProtectionContainers/" + + protectionContainerName + + "/replicationMigrationItems/" + + migrationItemName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + + "&" + + (string.IsNullOrEmpty(deleteOption) ? global::System.String.Empty : "deleteOption=" + global::System.Uri.EscapeDataString(deleteOption)) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Delete, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationMigrationItemsDelete_Call(request,onNoContent,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 204 (NoContent). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationMigrationItemsDelete_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: default + var _finalUri = _response.GetFirstHeader(@"Location"); + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + if (!string.IsNullOrWhiteSpace(_finalUri)) + { + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.NoContent: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onNoContent(_response); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will + /// get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Fabric name. + /// Protection container name. + /// Migration item name. + /// The delete option. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationMigrationItemsDelete_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string migrationItemName, string deleteOption, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(fabricName),fabricName); + await eventListener.AssertNotNull(nameof(protectionContainerName),protectionContainerName); + await eventListener.AssertNotNull(nameof(migrationItemName),migrationItemName); + await eventListener.AssertNotNull(nameof(deleteOption),deleteOption); + } + } + + /// Gets the details of a migration item. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Fabric unique name. + /// Protection container name. + /// Migration item name. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationMigrationItemsGet(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string migrationItemName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + + "/replicationProtectionContainers/" + + global::System.Uri.EscapeDataString(protectionContainerName) + + "/replicationMigrationItems/" + + global::System.Uri.EscapeDataString(migrationItemName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationMigrationItemsGet_Call(request,onOk,eventListener,sender); + } + } + + /// Gets the details of a migration item. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationMigrationItemsGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationFabrics/(?[^/]+)/replicationProtectionContainers/(?[^/]+)/replicationMigrationItems/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var fabricName = _match.Groups["fabricName"].Value; + var protectionContainerName = _match.Groups["protectionContainerName"].Value; + var migrationItemName = _match.Groups["migrationItemName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationFabrics/" + + fabricName + + "/replicationProtectionContainers/" + + protectionContainerName + + "/replicationMigrationItems/" + + migrationItemName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationMigrationItemsGet_Call(request,onOk,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationMigrationItemsGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.MigrationItem.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will + /// get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Fabric unique name. + /// Protection container name. + /// Migration item name. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationMigrationItemsGet_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string migrationItemName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(fabricName),fabricName); + await eventListener.AssertNotNull(nameof(protectionContainerName),protectionContainerName); + await eventListener.AssertNotNull(nameof(migrationItemName),migrationItemName); + } + } + + /// Gets the list of migration items in the vault. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// The pagination token. + /// The page size. + /// OData filter options. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationMigrationItemsList(string resourceName, string resourceGroupName, string subscriptionId, string skipToken, string takeToken, string Filter, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationMigrationItems" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + + "&" + + (string.IsNullOrEmpty(skipToken) ? global::System.String.Empty : "skipToken=" + global::System.Uri.EscapeDataString(skipToken)) + + "&" + + (string.IsNullOrEmpty(takeToken) ? global::System.String.Empty : "takeToken=" + global::System.Uri.EscapeDataString(takeToken)) + + "&" + + (string.IsNullOrEmpty(Filter) ? global::System.String.Empty : "$filter=" + global::System.Uri.EscapeDataString(Filter)) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationMigrationItemsList_Call(request,onOk,eventListener,sender); + } + } + + /// Gets the list of ASR migration items in the protection container. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Fabric name. + /// Protection container name. + /// The pagination token. + /// The page size. + /// OData filter options. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationMigrationItemsListByReplicationProtectionContainers(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string skipToken, string takeToken, string Filter, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + + "/replicationProtectionContainers/" + + global::System.Uri.EscapeDataString(protectionContainerName) + + "/replicationMigrationItems" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + + "&" + + (string.IsNullOrEmpty(skipToken) ? global::System.String.Empty : "skipToken=" + global::System.Uri.EscapeDataString(skipToken)) + + "&" + + (string.IsNullOrEmpty(takeToken) ? global::System.String.Empty : "takeToken=" + global::System.Uri.EscapeDataString(takeToken)) + + "&" + + (string.IsNullOrEmpty(Filter) ? global::System.String.Empty : "$filter=" + global::System.Uri.EscapeDataString(Filter)) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationMigrationItemsListByReplicationProtectionContainers_Call(request,onOk,eventListener,sender); + } + } + + /// Gets the list of ASR migration items in the protection container. + /// + /// The pagination token. + /// The page size. + /// OData filter options. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationMigrationItemsListByReplicationProtectionContainersViaIdentity(global::System.String viaIdentity, string skipToken, string takeToken, string Filter, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationFabrics/(?[^/]+)/replicationProtectionContainers/(?[^/]+)/replicationMigrationItems$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var fabricName = _match.Groups["fabricName"].Value; + var protectionContainerName = _match.Groups["protectionContainerName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationFabrics/" + + fabricName + + "/replicationProtectionContainers/" + + protectionContainerName + + "/replicationMigrationItems" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + + "&" + + (string.IsNullOrEmpty(skipToken) ? global::System.String.Empty : "skipToken=" + global::System.Uri.EscapeDataString(skipToken)) + + "&" + + (string.IsNullOrEmpty(takeToken) ? global::System.String.Empty : "takeToken=" + global::System.Uri.EscapeDataString(takeToken)) + + "&" + + (string.IsNullOrEmpty(Filter) ? global::System.String.Empty : "$filter=" + global::System.Uri.EscapeDataString(Filter)) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationMigrationItemsListByReplicationProtectionContainers_Call(request,onOk,eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationMigrationItemsListByReplicationProtectionContainers_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.MigrationItemCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this + /// like the actual call, but you will get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Fabric name. + /// Protection container name. + /// The pagination token. + /// The page size. + /// OData filter options. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationMigrationItemsListByReplicationProtectionContainers_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string skipToken, string takeToken, string Filter, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(fabricName),fabricName); + await eventListener.AssertNotNull(nameof(protectionContainerName),protectionContainerName); + await eventListener.AssertNotNull(nameof(skipToken),skipToken); + await eventListener.AssertNotNull(nameof(takeToken),takeToken); + await eventListener.AssertNotNull(nameof(Filter),Filter); + } + } + + /// Gets the list of migration items in the vault. + /// + /// The pagination token. + /// The page size. + /// OData filter options. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationMigrationItemsListViaIdentity(global::System.String viaIdentity, string skipToken, string takeToken, string Filter, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationMigrationItems$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationMigrationItems'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationMigrationItems" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + + "&" + + (string.IsNullOrEmpty(skipToken) ? global::System.String.Empty : "skipToken=" + global::System.Uri.EscapeDataString(skipToken)) + + "&" + + (string.IsNullOrEmpty(takeToken) ? global::System.String.Empty : "takeToken=" + global::System.Uri.EscapeDataString(takeToken)) + + "&" + + (string.IsNullOrEmpty(Filter) ? global::System.String.Empty : "$filter=" + global::System.Uri.EscapeDataString(Filter)) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationMigrationItemsList_Call(request,onOk,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationMigrationItemsList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.MigrationItemCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will + /// get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// The pagination token. + /// The page size. + /// OData filter options. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationMigrationItemsList_Validate(string resourceName, string resourceGroupName, string subscriptionId, string skipToken, string takeToken, string Filter, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(skipToken),skipToken); + await eventListener.AssertNotNull(nameof(takeToken),takeToken); + await eventListener.AssertNotNull(nameof(Filter),Filter); + } + } + + /// The operation to initiate migration of the item. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Fabric name. + /// Protection container name. + /// Migration item name. + /// Migrate input. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationMigrationItemsMigrate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string migrationItemName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + + "/replicationProtectionContainers/" + + global::System.Uri.EscapeDataString(protectionContainerName) + + "/replicationMigrationItems/" + + global::System.Uri.EscapeDataString(migrationItemName) + + "/migrate" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationMigrationItemsMigrate_Call(request,onOk,eventListener,sender); + } + } + + /// The operation to initiate migration of the item. + /// + /// Migrate input. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationMigrationItemsMigrateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationFabrics/(?[^/]+)/replicationProtectionContainers/(?[^/]+)/replicationMigrationItems/(?[^/]+)/migrate$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/migrate'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var fabricName = _match.Groups["fabricName"].Value; + var protectionContainerName = _match.Groups["protectionContainerName"].Value; + var migrationItemName = _match.Groups["migrationItemName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationFabrics/" + + fabricName + + "/replicationProtectionContainers/" + + protectionContainerName + + "/replicationMigrationItems/" + + migrationItemName + + "/migrate" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationMigrationItemsMigrate_Call(request,onOk,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationMigrationItemsMigrate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: default + var _finalUri = _response.GetFirstHeader(@"Location"); + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + if (!string.IsNullOrWhiteSpace(_finalUri)) + { + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.MigrationItem.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you + /// will get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Fabric name. + /// Protection container name. + /// Migration item name. + /// Migrate input. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationMigrationItemsMigrate_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string migrationItemName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateInput body, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(fabricName),fabricName); + await eventListener.AssertNotNull(nameof(protectionContainerName),protectionContainerName); + await eventListener.AssertNotNull(nameof(migrationItemName),migrationItemName); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// The operation to initiate pause replication of the item. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Fabric name. + /// Protection container name. + /// Migration item name. + /// Pause replication input. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationMigrationItemsPauseReplication(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string migrationItemName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPauseReplicationInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + + "/replicationProtectionContainers/" + + global::System.Uri.EscapeDataString(protectionContainerName) + + "/replicationMigrationItems/" + + global::System.Uri.EscapeDataString(migrationItemName) + + "/pauseReplication" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationMigrationItemsPauseReplication_Call(request,onOk,eventListener,sender); + } + } + + /// The operation to initiate pause replication of the item. + /// + /// Pause replication input. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationMigrationItemsPauseReplicationViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPauseReplicationInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationFabrics/(?[^/]+)/replicationProtectionContainers/(?[^/]+)/replicationMigrationItems/(?[^/]+)/pauseReplication$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/pauseReplication'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var fabricName = _match.Groups["fabricName"].Value; + var protectionContainerName = _match.Groups["protectionContainerName"].Value; + var migrationItemName = _match.Groups["migrationItemName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationFabrics/" + + fabricName + + "/replicationProtectionContainers/" + + protectionContainerName + + "/replicationMigrationItems/" + + migrationItemName + + "/pauseReplication" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationMigrationItemsPauseReplication_Call(request,onOk,eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationMigrationItemsPauseReplication_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: default + var _finalUri = _response.GetFirstHeader(@"Location"); + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + if (!string.IsNullOrWhiteSpace(_finalUri)) + { + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.MigrationItem.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, + /// but you will get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Fabric name. + /// Protection container name. + /// Migration item name. + /// Pause replication input. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationMigrationItemsPauseReplication_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string migrationItemName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPauseReplicationInput body, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(fabricName),fabricName); + await eventListener.AssertNotNull(nameof(protectionContainerName),protectionContainerName); + await eventListener.AssertNotNull(nameof(migrationItemName),migrationItemName); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// The operation to initiate resume replication of the item. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Fabric name. + /// Protection container name. + /// Migration item name. + /// Resume replication input. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationMigrationItemsResumeReplication(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string migrationItemName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + + "/replicationProtectionContainers/" + + global::System.Uri.EscapeDataString(protectionContainerName) + + "/replicationMigrationItems/" + + global::System.Uri.EscapeDataString(migrationItemName) + + "/resumeReplication" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationMigrationItemsResumeReplication_Call(request,onOk,eventListener,sender); + } + } + + /// The operation to initiate resume replication of the item. + /// + /// Resume replication input. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationMigrationItemsResumeReplicationViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationFabrics/(?[^/]+)/replicationProtectionContainers/(?[^/]+)/replicationMigrationItems/(?[^/]+)/resumeReplication$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/resumeReplication'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var fabricName = _match.Groups["fabricName"].Value; + var protectionContainerName = _match.Groups["protectionContainerName"].Value; + var migrationItemName = _match.Groups["migrationItemName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationFabrics/" + + fabricName + + "/replicationProtectionContainers/" + + protectionContainerName + + "/replicationMigrationItems/" + + migrationItemName + + "/resumeReplication" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationMigrationItemsResumeReplication_Call(request,onOk,eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationMigrationItemsResumeReplication_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: default + var _finalUri = _response.GetFirstHeader(@"Location"); + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + if (!string.IsNullOrWhiteSpace(_finalUri)) + { + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.MigrationItem.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, + /// but you will get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Fabric name. + /// Protection container name. + /// Migration item name. + /// Resume replication input. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationMigrationItemsResumeReplication_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string migrationItemName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationInput body, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(fabricName),fabricName); + await eventListener.AssertNotNull(nameof(protectionContainerName),protectionContainerName); + await eventListener.AssertNotNull(nameof(migrationItemName),migrationItemName); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// The operation to resynchronize replication of an ASR migration item. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Fabric name. + /// Protection container name. + /// Migration item name. + /// Resync input. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationMigrationItemsResync(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string migrationItemName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + + "/replicationProtectionContainers/" + + global::System.Uri.EscapeDataString(protectionContainerName) + + "/replicationMigrationItems/" + + global::System.Uri.EscapeDataString(migrationItemName) + + "/resync" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationMigrationItemsResync_Call(request,onOk,eventListener,sender); + } + } + + /// The operation to resynchronize replication of an ASR migration item. + /// + /// Resync input. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationMigrationItemsResyncViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationFabrics/(?[^/]+)/replicationProtectionContainers/(?[^/]+)/replicationMigrationItems/(?[^/]+)/resync$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/resync'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var fabricName = _match.Groups["fabricName"].Value; + var protectionContainerName = _match.Groups["protectionContainerName"].Value; + var migrationItemName = _match.Groups["migrationItemName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationFabrics/" + + fabricName + + "/replicationProtectionContainers/" + + protectionContainerName + + "/replicationMigrationItems/" + + migrationItemName + + "/resync" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationMigrationItemsResync_Call(request,onOk,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationMigrationItemsResync_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: default + var _finalUri = _response.GetFirstHeader(@"Location"); + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + if (!string.IsNullOrWhiteSpace(_finalUri)) + { + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.MigrationItem.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will + /// get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Fabric name. + /// Protection container name. + /// Migration item name. + /// Resync input. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationMigrationItemsResync_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string migrationItemName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncInput body, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(fabricName),fabricName); + await eventListener.AssertNotNull(nameof(protectionContainerName),protectionContainerName); + await eventListener.AssertNotNull(nameof(migrationItemName),migrationItemName); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// The operation to initiate test migration of the item. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Fabric name. + /// Protection container name. + /// Migration item name. + /// Test migrate input. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationMigrationItemsTestMigrate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string migrationItemName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + + "/replicationProtectionContainers/" + + global::System.Uri.EscapeDataString(protectionContainerName) + + "/replicationMigrationItems/" + + global::System.Uri.EscapeDataString(migrationItemName) + + "/testMigrate" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationMigrationItemsTestMigrate_Call(request,onOk,eventListener,sender); + } + } + + /// The operation to initiate test migrate cleanup. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Fabric name. + /// Protection container name. + /// Migration item name. + /// Test migrate cleanup input. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationMigrationItemsTestMigrateCleanup(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string migrationItemName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateCleanupInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + + "/replicationProtectionContainers/" + + global::System.Uri.EscapeDataString(protectionContainerName) + + "/replicationMigrationItems/" + + global::System.Uri.EscapeDataString(migrationItemName) + + "/testMigrateCleanup" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationMigrationItemsTestMigrateCleanup_Call(request,onOk,eventListener,sender); + } + } + + /// The operation to initiate test migrate cleanup. + /// + /// Test migrate cleanup input. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationMigrationItemsTestMigrateCleanupViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateCleanupInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationFabrics/(?[^/]+)/replicationProtectionContainers/(?[^/]+)/replicationMigrationItems/(?[^/]+)/testMigrateCleanup$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/testMigrateCleanup'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var fabricName = _match.Groups["fabricName"].Value; + var protectionContainerName = _match.Groups["protectionContainerName"].Value; + var migrationItemName = _match.Groups["migrationItemName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationFabrics/" + + fabricName + + "/replicationProtectionContainers/" + + protectionContainerName + + "/replicationMigrationItems/" + + migrationItemName + + "/testMigrateCleanup" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationMigrationItemsTestMigrateCleanup_Call(request,onOk,eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationMigrationItemsTestMigrateCleanup_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: default + var _finalUri = _response.GetFirstHeader(@"Location"); + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + if (!string.IsNullOrWhiteSpace(_finalUri)) + { + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.MigrationItem.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, + /// but you will get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Fabric name. + /// Protection container name. + /// Migration item name. + /// Test migrate cleanup input. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationMigrationItemsTestMigrateCleanup_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string migrationItemName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateCleanupInput body, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(fabricName),fabricName); + await eventListener.AssertNotNull(nameof(protectionContainerName),protectionContainerName); + await eventListener.AssertNotNull(nameof(migrationItemName),migrationItemName); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// The operation to initiate test migration of the item. + /// + /// Test migrate input. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationMigrationItemsTestMigrateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationFabrics/(?[^/]+)/replicationProtectionContainers/(?[^/]+)/replicationMigrationItems/(?[^/]+)/testMigrate$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/testMigrate'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var fabricName = _match.Groups["fabricName"].Value; + var protectionContainerName = _match.Groups["protectionContainerName"].Value; + var migrationItemName = _match.Groups["migrationItemName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationFabrics/" + + fabricName + + "/replicationProtectionContainers/" + + protectionContainerName + + "/replicationMigrationItems/" + + migrationItemName + + "/testMigrate" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationMigrationItemsTestMigrate_Call(request,onOk,eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationMigrationItemsTestMigrate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: default + var _finalUri = _response.GetFirstHeader(@"Location"); + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + if (!string.IsNullOrWhiteSpace(_finalUri)) + { + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.MigrationItem.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but + /// you will get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Fabric name. + /// Protection container name. + /// Migration item name. + /// Test migrate input. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationMigrationItemsTestMigrate_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string migrationItemName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateInput body, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(fabricName),fabricName); + await eventListener.AssertNotNull(nameof(protectionContainerName),protectionContainerName); + await eventListener.AssertNotNull(nameof(migrationItemName),migrationItemName); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// The operation to update the recovery settings of an ASR migration item. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Fabric name. + /// Protection container name. + /// Migration item name. + /// Update migration item input. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationMigrationItemsUpdate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string migrationItemName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMigrationItemInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + + "/replicationProtectionContainers/" + + global::System.Uri.EscapeDataString(protectionContainerName) + + "/replicationMigrationItems/" + + global::System.Uri.EscapeDataString(migrationItemName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationMigrationItemsUpdate_Call(request,onOk,eventListener,sender); + } + } + + /// The operation to update the recovery settings of an ASR migration item. + /// + /// Update migration item input. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationMigrationItemsUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMigrationItemInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationFabrics/(?[^/]+)/replicationProtectionContainers/(?[^/]+)/replicationMigrationItems/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var fabricName = _match.Groups["fabricName"].Value; + var protectionContainerName = _match.Groups["protectionContainerName"].Value; + var migrationItemName = _match.Groups["migrationItemName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationFabrics/" + + fabricName + + "/replicationProtectionContainers/" + + protectionContainerName + + "/replicationMigrationItems/" + + migrationItemName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationMigrationItemsUpdate_Call(request,onOk,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationMigrationItemsUpdate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: default + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + if (!string.IsNullOrWhiteSpace(_originalUri)) + { + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_originalUri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.MigrationItem.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will + /// get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Fabric name. + /// Protection container name. + /// Migration item name. + /// Update migration item input. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationMigrationItemsUpdate_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string migrationItemName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMigrationItemInput body, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(fabricName),fabricName); + await eventListener.AssertNotNull(nameof(protectionContainerName),protectionContainerName); + await eventListener.AssertNotNull(nameof(migrationItemName),migrationItemName); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// The operation to create an ASR network mapping. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Primary fabric name. + /// Primary network name. + /// Network mapping name. + /// Create network mapping input. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationNetworkMappingsCreate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string networkName, string networkMappingName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateNetworkMappingInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + + "/replicationNetworks/" + + global::System.Uri.EscapeDataString(networkName) + + "/replicationNetworkMappings/" + + global::System.Uri.EscapeDataString(networkMappingName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationNetworkMappingsCreate_Call(request,onOk,eventListener,sender); + } + } + + /// The operation to create an ASR network mapping. + /// + /// Create network mapping input. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationNetworkMappingsCreateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateNetworkMappingInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationFabrics/(?[^/]+)/replicationNetworks/(?[^/]+)/replicationNetworkMappings/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}/replicationNetworkMappings/{networkMappingName}'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var fabricName = _match.Groups["fabricName"].Value; + var networkName = _match.Groups["networkName"].Value; + var networkMappingName = _match.Groups["networkMappingName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationFabrics/" + + fabricName + + "/replicationNetworks/" + + networkName + + "/replicationNetworkMappings/" + + networkMappingName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationNetworkMappingsCreate_Call(request,onOk,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationNetworkMappingsCreate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: default + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + if (!string.IsNullOrWhiteSpace(_originalUri)) + { + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_originalUri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.NetworkMapping.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you + /// will get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Primary fabric name. + /// Primary network name. + /// Network mapping name. + /// Create network mapping input. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationNetworkMappingsCreate_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string networkName, string networkMappingName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateNetworkMappingInput body, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(fabricName),fabricName); + await eventListener.AssertNotNull(nameof(networkName),networkName); + await eventListener.AssertNotNull(nameof(networkMappingName),networkMappingName); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// The operation to delete a network mapping. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Primary fabric name. + /// Primary network name. + /// ARM Resource Name for network mapping. + /// a delegate that is called when the remote service returns 204 (NoContent). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationNetworkMappingsDelete(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string networkName, string networkMappingName, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + + "/replicationNetworks/" + + global::System.Uri.EscapeDataString(networkName) + + "/replicationNetworkMappings/" + + global::System.Uri.EscapeDataString(networkMappingName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Delete, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationNetworkMappingsDelete_Call(request,onNoContent,eventListener,sender); + } + } + + /// The operation to delete a network mapping. + /// + /// a delegate that is called when the remote service returns 204 (NoContent). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationNetworkMappingsDeleteViaIdentity(global::System.String viaIdentity, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationFabrics/(?[^/]+)/replicationNetworks/(?[^/]+)/replicationNetworkMappings/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}/replicationNetworkMappings/{networkMappingName}'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var fabricName = _match.Groups["fabricName"].Value; + var networkName = _match.Groups["networkName"].Value; + var networkMappingName = _match.Groups["networkMappingName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationFabrics/" + + fabricName + + "/replicationNetworks/" + + networkName + + "/replicationNetworkMappings/" + + networkMappingName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Delete, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationNetworkMappingsDelete_Call(request,onNoContent,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 204 (NoContent). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationNetworkMappingsDelete_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: default + var _finalUri = _response.GetFirstHeader(@"Location"); + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + if (!string.IsNullOrWhiteSpace(_finalUri)) + { + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.NoContent: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onNoContent(_response); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you + /// will get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Primary fabric name. + /// Primary network name. + /// ARM Resource Name for network mapping. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationNetworkMappingsDelete_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string networkName, string networkMappingName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(fabricName),fabricName); + await eventListener.AssertNotNull(nameof(networkName),networkName); + await eventListener.AssertNotNull(nameof(networkMappingName),networkMappingName); + } + } + + /// Gets the details of an ASR network mapping. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Primary fabric name. + /// Primary network name. + /// Network mapping name. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationNetworkMappingsGet(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string networkName, string networkMappingName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + + "/replicationNetworks/" + + global::System.Uri.EscapeDataString(networkName) + + "/replicationNetworkMappings/" + + global::System.Uri.EscapeDataString(networkMappingName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationNetworkMappingsGet_Call(request,onOk,eventListener,sender); + } + } + + /// Gets the details of an ASR network mapping. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationNetworkMappingsGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationFabrics/(?[^/]+)/replicationNetworks/(?[^/]+)/replicationNetworkMappings/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}/replicationNetworkMappings/{networkMappingName}'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var fabricName = _match.Groups["fabricName"].Value; + var networkName = _match.Groups["networkName"].Value; + var networkMappingName = _match.Groups["networkMappingName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationFabrics/" + + fabricName + + "/replicationNetworks/" + + networkName + + "/replicationNetworkMappings/" + + networkMappingName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationNetworkMappingsGet_Call(request,onOk,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationNetworkMappingsGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.NetworkMapping.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will + /// get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Primary fabric name. + /// Primary network name. + /// Network mapping name. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationNetworkMappingsGet_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string networkName, string networkMappingName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(fabricName),fabricName); + await eventListener.AssertNotNull(nameof(networkName),networkName); + await eventListener.AssertNotNull(nameof(networkMappingName),networkMappingName); + } + } + + /// Lists all ASR network mappings in the vault. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationNetworkMappingsList(string resourceName, string resourceGroupName, string subscriptionId, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationNetworkMappings" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationNetworkMappingsList_Call(request,onOk,eventListener,sender); + } + } + + /// Lists all ASR network mappings for the specified network. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Primary fabric name. + /// Primary network name. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationNetworkMappingsListByReplicationNetworks(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string networkName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + + "/replicationNetworks/" + + global::System.Uri.EscapeDataString(networkName) + + "/replicationNetworkMappings" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationNetworkMappingsListByReplicationNetworks_Call(request,onOk,eventListener,sender); + } + } + + /// Lists all ASR network mappings for the specified network. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationNetworkMappingsListByReplicationNetworksViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationFabrics/(?[^/]+)/replicationNetworks/(?[^/]+)/replicationNetworkMappings$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}/replicationNetworkMappings'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var fabricName = _match.Groups["fabricName"].Value; + var networkName = _match.Groups["networkName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationFabrics/" + + fabricName + + "/replicationNetworks/" + + networkName + + "/replicationNetworkMappings" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationNetworkMappingsListByReplicationNetworks_Call(request,onOk,eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationNetworkMappingsListByReplicationNetworks_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.NetworkMappingCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual + /// call, but you will get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Primary fabric name. + /// Primary network name. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationNetworkMappingsListByReplicationNetworks_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string networkName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(fabricName),fabricName); + await eventListener.AssertNotNull(nameof(networkName),networkName); + } + } + + /// Lists all ASR network mappings in the vault. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationNetworkMappingsListViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationNetworkMappings$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationNetworkMappings'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationNetworkMappings" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationNetworkMappingsList_Call(request,onOk,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationNetworkMappingsList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.NetworkMappingCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will + /// get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationNetworkMappingsList_Validate(string resourceName, string resourceGroupName, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + } + } + + /// The operation to update an ASR network mapping. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Primary fabric name. + /// Primary network name. + /// Network mapping name. + /// Update network mapping input. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationNetworkMappingsUpdate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string networkName, string networkMappingName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateNetworkMappingInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + + "/replicationNetworks/" + + global::System.Uri.EscapeDataString(networkName) + + "/replicationNetworkMappings/" + + global::System.Uri.EscapeDataString(networkMappingName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationNetworkMappingsUpdate_Call(request,onOk,eventListener,sender); + } + } + + /// The operation to update an ASR network mapping. + /// + /// Update network mapping input. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationNetworkMappingsUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateNetworkMappingInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationFabrics/(?[^/]+)/replicationNetworks/(?[^/]+)/replicationNetworkMappings/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}/replicationNetworkMappings/{networkMappingName}'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var fabricName = _match.Groups["fabricName"].Value; + var networkName = _match.Groups["networkName"].Value; + var networkMappingName = _match.Groups["networkMappingName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationFabrics/" + + fabricName + + "/replicationNetworks/" + + networkName + + "/replicationNetworkMappings/" + + networkMappingName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationNetworkMappingsUpdate_Call(request,onOk,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationNetworkMappingsUpdate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: default + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + if (!string.IsNullOrWhiteSpace(_originalUri)) + { + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_originalUri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.NetworkMapping.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you + /// will get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Primary fabric name. + /// Primary network name. + /// Network mapping name. + /// Update network mapping input. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationNetworkMappingsUpdate_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string networkName, string networkMappingName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateNetworkMappingInput body, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(fabricName),fabricName); + await eventListener.AssertNotNull(nameof(networkName),networkName); + await eventListener.AssertNotNull(nameof(networkMappingName),networkMappingName); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// Gets the details of a network. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Server Id. + /// Primary network name. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationNetworksGet(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string networkName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + + "/replicationNetworks/" + + global::System.Uri.EscapeDataString(networkName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationNetworksGet_Call(request,onOk,eventListener,sender); + } + } + + /// Gets the details of a network. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationNetworksGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationFabrics/(?[^/]+)/replicationNetworks/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var fabricName = _match.Groups["fabricName"].Value; + var networkName = _match.Groups["networkName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationFabrics/" + + fabricName + + "/replicationNetworks/" + + networkName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationNetworksGet_Call(request,onOk,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationNetworksGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.Network.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Server Id. + /// Primary network name. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationNetworksGet_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string networkName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(fabricName),fabricName); + await eventListener.AssertNotNull(nameof(networkName),networkName); + } + } + + /// Lists the networks available in a vault. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationNetworksList(string resourceName, string resourceGroupName, string subscriptionId, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationNetworks" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationNetworksList_Call(request,onOk,eventListener,sender); + } + } + + /// Lists the networks available for a fabric. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Fabric name. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationNetworksListByReplicationFabrics(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + + "/replicationNetworks" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationNetworksListByReplicationFabrics_Call(request,onOk,eventListener,sender); + } + } + + /// Lists the networks available for a fabric. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationNetworksListByReplicationFabricsViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationFabrics/(?[^/]+)/replicationNetworks$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var fabricName = _match.Groups["fabricName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationFabrics/" + + fabricName + + "/replicationNetworks" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationNetworksListByReplicationFabrics_Call(request,onOk,eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationNetworksListByReplicationFabrics_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.NetworkCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, + /// but you will get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Fabric name. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationNetworksListByReplicationFabrics_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(fabricName),fabricName); + } + } + + /// Lists the networks available in a vault. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationNetworksListViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationNetworks$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationNetworks'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationNetworks" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationNetworksList_Call(request,onOk,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationNetworksList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.NetworkCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get + /// validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationNetworksList_Validate(string resourceName, string resourceGroupName, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + } + } + + /// The operation to create a replication policy. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Replication policy name. + /// Create policy input. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationPoliciesCreate(string resourceName, string resourceGroupName, string subscriptionId, string policyName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreatePolicyInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationPolicies/" + + global::System.Uri.EscapeDataString(policyName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationPoliciesCreate_Call(request,onOk,eventListener,sender); + } + } + + /// The operation to create a replication policy. + /// + /// Create policy input. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationPoliciesCreateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreatePolicyInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationPolicies/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationPolicies/{policyName}'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var policyName = _match.Groups["policyName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationPolicies/" + + policyName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationPoliciesCreate_Call(request,onOk,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationPoliciesCreate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: default + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + if (!string.IsNullOrWhiteSpace(_originalUri)) + { + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_originalUri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.Policy.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get + /// validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Replication policy name. + /// Create policy input. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationPoliciesCreate_Validate(string resourceName, string resourceGroupName, string subscriptionId, string policyName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreatePolicyInput body, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(policyName),policyName); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// The operation to delete a replication policy. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Replication policy name. + /// a delegate that is called when the remote service returns 204 (NoContent). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationPoliciesDelete(string resourceName, string resourceGroupName, string subscriptionId, string policyName, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationPolicies/" + + global::System.Uri.EscapeDataString(policyName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Delete, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationPoliciesDelete_Call(request,onNoContent,eventListener,sender); + } + } + + /// The operation to delete a replication policy. + /// + /// a delegate that is called when the remote service returns 204 (NoContent). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationPoliciesDeleteViaIdentity(global::System.String viaIdentity, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationPolicies/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationPolicies/{policyName}'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var policyName = _match.Groups["policyName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationPolicies/" + + policyName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Delete, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationPoliciesDelete_Call(request,onNoContent,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 204 (NoContent). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationPoliciesDelete_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: default + var _finalUri = _response.GetFirstHeader(@"Location"); + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + if (!string.IsNullOrWhiteSpace(_finalUri)) + { + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.NoContent: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onNoContent(_response); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get + /// validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Replication policy name. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationPoliciesDelete_Validate(string resourceName, string resourceGroupName, string subscriptionId, string policyName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(policyName),policyName); + } + } + + /// Gets the details of a replication policy. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Replication policy name. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationPoliciesGet(string resourceName, string resourceGroupName, string subscriptionId, string policyName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationPolicies/" + + global::System.Uri.EscapeDataString(policyName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationPoliciesGet_Call(request,onOk,eventListener,sender); + } + } + + /// Gets the details of a replication policy. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationPoliciesGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationPolicies/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationPolicies/{policyName}'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var policyName = _match.Groups["policyName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationPolicies/" + + policyName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationPoliciesGet_Call(request,onOk,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationPoliciesGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.Policy.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Replication policy name. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationPoliciesGet_Validate(string resourceName, string resourceGroupName, string subscriptionId, string policyName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(policyName),policyName); + } + } + + /// Lists the replication policies for a vault. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationPoliciesList(string resourceName, string resourceGroupName, string subscriptionId, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationPolicies" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationPoliciesList_Call(request,onOk,eventListener,sender); + } + } + + /// Lists the replication policies for a vault. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationPoliciesListViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationPolicies$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationPolicies'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationPolicies" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationPoliciesList_Call(request,onOk,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationPoliciesList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PolicyCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get + /// validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationPoliciesList_Validate(string resourceName, string resourceGroupName, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + } + } + + /// The operation to update a replication policy. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Policy Id. + /// Update Policy Input. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationPoliciesUpdate(string resourceName, string resourceGroupName, string subscriptionId, string policyName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdatePolicyInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationPolicies/" + + global::System.Uri.EscapeDataString(policyName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationPoliciesUpdate_Call(request,onOk,eventListener,sender); + } + } + + /// The operation to update a replication policy. + /// + /// Update Policy Input. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationPoliciesUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdatePolicyInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationPolicies/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationPolicies/{policyName}'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var policyName = _match.Groups["policyName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationPolicies/" + + policyName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationPoliciesUpdate_Call(request,onOk,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationPoliciesUpdate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: default + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + if (!string.IsNullOrWhiteSpace(_originalUri)) + { + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_originalUri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.Policy.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get + /// validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Policy Id. + /// Update Policy Input. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationPoliciesUpdate_Validate(string resourceName, string resourceGroupName, string subscriptionId, string policyName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdatePolicyInput body, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(policyName),policyName); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// The operation to get the details of a protectable item. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Fabric name. + /// Protection container name. + /// Protectable item name. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationProtectableItemsGet(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string protectableItemName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + + "/replicationProtectionContainers/" + + global::System.Uri.EscapeDataString(protectionContainerName) + + "/replicationProtectableItems/" + + global::System.Uri.EscapeDataString(protectableItemName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationProtectableItemsGet_Call(request,onOk,eventListener,sender); + } + } + + /// The operation to get the details of a protectable item. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationProtectableItemsGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationFabrics/(?[^/]+)/replicationProtectionContainers/(?[^/]+)/replicationProtectableItems/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectableItems/{protectableItemName}'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var fabricName = _match.Groups["fabricName"].Value; + var protectionContainerName = _match.Groups["protectionContainerName"].Value; + var protectableItemName = _match.Groups["protectableItemName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationFabrics/" + + fabricName + + "/replicationProtectionContainers/" + + protectionContainerName + + "/replicationProtectableItems/" + + protectableItemName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationProtectableItemsGet_Call(request,onOk,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationProtectableItemsGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProtectableItem.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will + /// get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Fabric name. + /// Protection container name. + /// Protectable item name. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationProtectableItemsGet_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string protectableItemName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(fabricName),fabricName); + await eventListener.AssertNotNull(nameof(protectionContainerName),protectionContainerName); + await eventListener.AssertNotNull(nameof(protectableItemName),protectableItemName); + } + } + + /// Lists the protectable items in a protection container. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Fabric name. + /// Protection container name. + /// OData filter options. + /// take OData query parameter. + /// skipToken OData query parameter. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationProtectableItemsListByReplicationProtectionContainers(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string Filter, string Take, string SkipToken, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + + "/replicationProtectionContainers/" + + global::System.Uri.EscapeDataString(protectionContainerName) + + "/replicationProtectableItems" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + + "&" + + (string.IsNullOrEmpty(Filter) ? global::System.String.Empty : "$filter=" + global::System.Uri.EscapeDataString(Filter)) + + "&" + + (string.IsNullOrEmpty(Take) ? global::System.String.Empty : "$take=" + global::System.Uri.EscapeDataString(Take)) + + "&" + + (string.IsNullOrEmpty(SkipToken) ? global::System.String.Empty : "$skipToken=" + global::System.Uri.EscapeDataString(SkipToken)) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationProtectableItemsListByReplicationProtectionContainers_Call(request,onOk,eventListener,sender); + } + } + + /// Lists the protectable items in a protection container. + /// + /// OData filter options. + /// take OData query parameter. + /// skipToken OData query parameter. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationProtectableItemsListByReplicationProtectionContainersViaIdentity(global::System.String viaIdentity, string Filter, string Take, string SkipToken, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationFabrics/(?[^/]+)/replicationProtectionContainers/(?[^/]+)/replicationProtectableItems$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectableItems'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var fabricName = _match.Groups["fabricName"].Value; + var protectionContainerName = _match.Groups["protectionContainerName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationFabrics/" + + fabricName + + "/replicationProtectionContainers/" + + protectionContainerName + + "/replicationProtectableItems" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + + "&" + + (string.IsNullOrEmpty(Filter) ? global::System.String.Empty : "$filter=" + global::System.Uri.EscapeDataString(Filter)) + + "&" + + (string.IsNullOrEmpty(Take) ? global::System.String.Empty : "$take=" + global::System.Uri.EscapeDataString(Take)) + + "&" + + (string.IsNullOrEmpty(SkipToken) ? global::System.String.Empty : "$skipToken=" + global::System.Uri.EscapeDataString(SkipToken)) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationProtectableItemsListByReplicationProtectionContainers_Call(request,onOk,eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationProtectableItemsListByReplicationProtectionContainers_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProtectableItemCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this + /// like the actual call, but you will get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Fabric name. + /// Protection container name. + /// OData filter options. + /// take OData query parameter. + /// skipToken OData query parameter. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationProtectableItemsListByReplicationProtectionContainers_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string Filter, string Take, string SkipToken, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(fabricName),fabricName); + await eventListener.AssertNotNull(nameof(protectionContainerName),protectionContainerName); + await eventListener.AssertNotNull(nameof(Filter),Filter); + await eventListener.AssertNotNull(nameof(Take),Take); + await eventListener.AssertNotNull(nameof(SkipToken),SkipToken); + } + } + + /// Operation to add disks(s) to the replication protected item. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Unique fabric name. + /// Protection container name. + /// Replication protected item name. + /// Add disks input. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationProtectedItemsAddDisks(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string replicatedProtectedItemName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + + "/replicationProtectionContainers/" + + global::System.Uri.EscapeDataString(protectionContainerName) + + "/replicationProtectedItems/" + + global::System.Uri.EscapeDataString(replicatedProtectedItemName) + + "/addDisks" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationProtectedItemsAddDisks_Call(request,onOk,eventListener,sender); + } + } + + /// Operation to add disks(s) to the replication protected item. + /// + /// Add disks input. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationProtectedItemsAddDisksViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationFabrics/(?[^/]+)/replicationProtectionContainers/(?[^/]+)/replicationProtectedItems/(?[^/]+)/addDisks$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/addDisks'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var fabricName = _match.Groups["fabricName"].Value; + var protectionContainerName = _match.Groups["protectionContainerName"].Value; + var replicatedProtectedItemName = _match.Groups["replicatedProtectedItemName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationFabrics/" + + fabricName + + "/replicationProtectionContainers/" + + protectionContainerName + + "/replicationProtectedItems/" + + replicatedProtectedItemName + + "/addDisks" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationProtectedItemsAddDisks_Call(request,onOk,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationProtectedItemsAddDisks_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: default + var _finalUri = _response.GetFirstHeader(@"Location"); + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + if (!string.IsNullOrWhiteSpace(_finalUri)) + { + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProtectedItem.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you + /// will get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Unique fabric name. + /// Protection container name. + /// Replication protected item name. + /// Add disks input. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationProtectedItemsAddDisks_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string replicatedProtectedItemName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksInput body, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(fabricName),fabricName); + await eventListener.AssertNotNull(nameof(protectionContainerName),protectionContainerName); + await eventListener.AssertNotNull(nameof(replicatedProtectedItemName),replicatedProtectedItemName); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// + /// The operation to change the recovery point of a failed over replication protected item. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// The ARM fabric name. + /// The protection container name. + /// The replicated protected item name. + /// The ApplyRecoveryPointInput. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationProtectedItemsApplyRecoveryPoint(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string replicatedProtectedItemName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + + "/replicationProtectionContainers/" + + global::System.Uri.EscapeDataString(protectionContainerName) + + "/replicationProtectedItems/" + + global::System.Uri.EscapeDataString(replicatedProtectedItemName) + + "/applyRecoveryPoint" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationProtectedItemsApplyRecoveryPoint_Call(request,onOk,eventListener,sender); + } + } + + /// + /// The operation to change the recovery point of a failed over replication protected item. + /// + /// + /// The ApplyRecoveryPointInput. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationProtectedItemsApplyRecoveryPointViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationFabrics/(?[^/]+)/replicationProtectionContainers/(?[^/]+)/replicationProtectedItems/(?[^/]+)/applyRecoveryPoint$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/applyRecoveryPoint'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var fabricName = _match.Groups["fabricName"].Value; + var protectionContainerName = _match.Groups["protectionContainerName"].Value; + var replicatedProtectedItemName = _match.Groups["replicatedProtectedItemName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationFabrics/" + + fabricName + + "/replicationProtectionContainers/" + + protectionContainerName + + "/replicationProtectedItems/" + + replicatedProtectedItemName + + "/applyRecoveryPoint" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationProtectedItemsApplyRecoveryPoint_Call(request,onOk,eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationProtectedItemsApplyRecoveryPoint_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: default + var _finalUri = _response.GetFirstHeader(@"Location"); + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + if (!string.IsNullOrWhiteSpace(_finalUri)) + { + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProtectedItem.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, + /// but you will get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// The ARM fabric name. + /// The protection container name. + /// The replicated protected item name. + /// The ApplyRecoveryPointInput. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationProtectedItemsApplyRecoveryPoint_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string replicatedProtectedItemName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointInput body, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(fabricName),fabricName); + await eventListener.AssertNotNull(nameof(protectionContainerName),protectionContainerName); + await eventListener.AssertNotNull(nameof(replicatedProtectedItemName),replicatedProtectedItemName); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// The operation to create an ASR replication protected item (Enable replication). + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Name of the fabric. + /// Protection container name. + /// A name for the replication protected item. + /// Enable Protection Input. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationProtectedItemsCreate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string replicatedProtectedItemName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + + "/replicationProtectionContainers/" + + global::System.Uri.EscapeDataString(protectionContainerName) + + "/replicationProtectedItems/" + + global::System.Uri.EscapeDataString(replicatedProtectedItemName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationProtectedItemsCreate_Call(request,onOk,eventListener,sender); + } + } + + /// The operation to create an ASR replication protected item (Enable replication). + /// + /// Enable Protection Input. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationProtectedItemsCreateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationFabrics/(?[^/]+)/replicationProtectionContainers/(?[^/]+)/replicationProtectedItems/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var fabricName = _match.Groups["fabricName"].Value; + var protectionContainerName = _match.Groups["protectionContainerName"].Value; + var replicatedProtectedItemName = _match.Groups["replicatedProtectedItemName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationFabrics/" + + fabricName + + "/replicationProtectionContainers/" + + protectionContainerName + + "/replicationProtectedItems/" + + replicatedProtectedItemName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationProtectedItemsCreate_Call(request,onOk,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationProtectedItemsCreate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: default + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + if (!string.IsNullOrWhiteSpace(_originalUri)) + { + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_originalUri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProtectedItem.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will + /// get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Name of the fabric. + /// Protection container name. + /// A name for the replication protected item. + /// Enable Protection Input. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationProtectedItemsCreate_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string replicatedProtectedItemName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionInput body, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(fabricName),fabricName); + await eventListener.AssertNotNull(nameof(protectionContainerName),protectionContainerName); + await eventListener.AssertNotNull(nameof(replicatedProtectedItemName),replicatedProtectedItemName); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// + /// The operation to disable replication on a replication protected item. This will also remove the item. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Fabric name. + /// Protection container name. + /// Replication protected item name. + /// Disable protection input. + /// a delegate that is called when the remote service returns 204 (NoContent). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationProtectedItemsDelete(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string replicatedProtectedItemName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionInput body, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + + "/replicationProtectionContainers/" + + global::System.Uri.EscapeDataString(protectionContainerName) + + "/replicationProtectedItems/" + + global::System.Uri.EscapeDataString(replicatedProtectedItemName) + + "/remove" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationProtectedItemsDelete_Call(request,onNoContent,eventListener,sender); + } + } + + /// + /// The operation to disable replication on a replication protected item. This will also remove the item. + /// + /// + /// Disable protection input. + /// a delegate that is called when the remote service returns 204 (NoContent). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationProtectedItemsDeleteViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionInput body, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationFabrics/(?[^/]+)/replicationProtectionContainers/(?[^/]+)/replicationProtectedItems/(?[^/]+)/remove$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/remove'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var fabricName = _match.Groups["fabricName"].Value; + var protectionContainerName = _match.Groups["protectionContainerName"].Value; + var replicatedProtectedItemName = _match.Groups["replicatedProtectedItemName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationFabrics/" + + fabricName + + "/replicationProtectionContainers/" + + protectionContainerName + + "/replicationProtectedItems/" + + replicatedProtectedItemName + + "/remove" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationProtectedItemsDelete_Call(request,onNoContent,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 204 (NoContent). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationProtectedItemsDelete_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: default + var _finalUri = _response.GetFirstHeader(@"Location"); + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + if (!string.IsNullOrWhiteSpace(_finalUri)) + { + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.NoContent: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onNoContent(_response); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will + /// get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Fabric name. + /// Protection container name. + /// Replication protected item name. + /// Disable protection input. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationProtectedItemsDelete_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string replicatedProtectedItemName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionInput body, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(fabricName),fabricName); + await eventListener.AssertNotNull(nameof(protectionContainerName),protectionContainerName); + await eventListener.AssertNotNull(nameof(replicatedProtectedItemName),replicatedProtectedItemName); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// Operation to cancel the failover of the replication protected item. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Unique fabric name. + /// Protection container name. + /// Replication protected item name. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationProtectedItemsFailoverCancel(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string replicatedProtectedItemName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + + "/replicationProtectionContainers/" + + global::System.Uri.EscapeDataString(protectionContainerName) + + "/replicationProtectedItems/" + + global::System.Uri.EscapeDataString(replicatedProtectedItemName) + + "/failoverCancel" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationProtectedItemsFailoverCancel_Call(request,onOk,eventListener,sender); + } + } + + /// Operation to cancel the failover of the replication protected item. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationProtectedItemsFailoverCancelViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationFabrics/(?[^/]+)/replicationProtectionContainers/(?[^/]+)/replicationProtectedItems/(?[^/]+)/failoverCancel$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/failoverCancel'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var fabricName = _match.Groups["fabricName"].Value; + var protectionContainerName = _match.Groups["protectionContainerName"].Value; + var replicatedProtectedItemName = _match.Groups["replicatedProtectedItemName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationFabrics/" + + fabricName + + "/replicationProtectionContainers/" + + protectionContainerName + + "/replicationProtectedItems/" + + replicatedProtectedItemName + + "/failoverCancel" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationProtectedItemsFailoverCancel_Call(request,onOk,eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationProtectedItemsFailoverCancel_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: default + var _finalUri = _response.GetFirstHeader(@"Location"); + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + if (!string.IsNullOrWhiteSpace(_finalUri)) + { + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProtectedItem.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but + /// you will get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Unique fabric name. + /// Protection container name. + /// Replication protected item name. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationProtectedItemsFailoverCancel_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string replicatedProtectedItemName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(fabricName),fabricName); + await eventListener.AssertNotNull(nameof(protectionContainerName),protectionContainerName); + await eventListener.AssertNotNull(nameof(replicatedProtectedItemName),replicatedProtectedItemName); + } + } + + /// Operation to commit the failover of the replication protected item. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Unique fabric name. + /// Protection container name. + /// Replication protected item name. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationProtectedItemsFailoverCommit(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string replicatedProtectedItemName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + + "/replicationProtectionContainers/" + + global::System.Uri.EscapeDataString(protectionContainerName) + + "/replicationProtectedItems/" + + global::System.Uri.EscapeDataString(replicatedProtectedItemName) + + "/failoverCommit" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationProtectedItemsFailoverCommit_Call(request,onOk,eventListener,sender); + } + } + + /// Operation to commit the failover of the replication protected item. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationProtectedItemsFailoverCommitViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationFabrics/(?[^/]+)/replicationProtectionContainers/(?[^/]+)/replicationProtectedItems/(?[^/]+)/failoverCommit$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/failoverCommit'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var fabricName = _match.Groups["fabricName"].Value; + var protectionContainerName = _match.Groups["protectionContainerName"].Value; + var replicatedProtectedItemName = _match.Groups["replicatedProtectedItemName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationFabrics/" + + fabricName + + "/replicationProtectionContainers/" + + protectionContainerName + + "/replicationProtectedItems/" + + replicatedProtectedItemName + + "/failoverCommit" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationProtectedItemsFailoverCommit_Call(request,onOk,eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationProtectedItemsFailoverCommit_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: default + var _finalUri = _response.GetFirstHeader(@"Location"); + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + if (!string.IsNullOrWhiteSpace(_finalUri)) + { + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProtectedItem.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but + /// you will get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Unique fabric name. + /// Protection container name. + /// Replication protected item name. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationProtectedItemsFailoverCommit_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string replicatedProtectedItemName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(fabricName),fabricName); + await eventListener.AssertNotNull(nameof(protectionContainerName),protectionContainerName); + await eventListener.AssertNotNull(nameof(replicatedProtectedItemName),replicatedProtectedItemName); + } + } + + /// Gets the details of an ASR replication protected item. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Fabric unique name. + /// Protection container name. + /// Replication protected item name. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationProtectedItemsGet(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string replicatedProtectedItemName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + + "/replicationProtectionContainers/" + + global::System.Uri.EscapeDataString(protectionContainerName) + + "/replicationProtectedItems/" + + global::System.Uri.EscapeDataString(replicatedProtectedItemName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationProtectedItemsGet_Call(request,onOk,eventListener,sender); + } + } + + /// Gets the details of an ASR replication protected item. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationProtectedItemsGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationFabrics/(?[^/]+)/replicationProtectionContainers/(?[^/]+)/replicationProtectedItems/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var fabricName = _match.Groups["fabricName"].Value; + var protectionContainerName = _match.Groups["protectionContainerName"].Value; + var replicatedProtectedItemName = _match.Groups["replicatedProtectedItemName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationFabrics/" + + fabricName + + "/replicationProtectionContainers/" + + protectionContainerName + + "/replicationProtectedItems/" + + replicatedProtectedItemName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationProtectedItemsGet_Call(request,onOk,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationProtectedItemsGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProtectedItem.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will + /// get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Fabric unique name. + /// Protection container name. + /// Replication protected item name. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationProtectedItemsGet_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string replicatedProtectedItemName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(fabricName),fabricName); + await eventListener.AssertNotNull(nameof(protectionContainerName),protectionContainerName); + await eventListener.AssertNotNull(nameof(replicatedProtectedItemName),replicatedProtectedItemName); + } + } + + /// Gets the list of ASR replication protected items in the vault. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// The pagination token. Possible values: "FabricId" or "FabricId_CloudId" or null. + /// OData filter options. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationProtectedItemsList(string resourceName, string resourceGroupName, string subscriptionId, string skipToken, string Filter, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationProtectedItems" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + + "&" + + (string.IsNullOrEmpty(skipToken) ? global::System.String.Empty : "skipToken=" + global::System.Uri.EscapeDataString(skipToken)) + + "&" + + (string.IsNullOrEmpty(Filter) ? global::System.String.Empty : "$filter=" + global::System.Uri.EscapeDataString(Filter)) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationProtectedItemsList_Call(request,onOk,eventListener,sender); + } + } + + /// Gets the list of ASR replication protected items in the protection container. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Fabric name. + /// Protection container name. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationProtectedItemsListByReplicationProtectionContainers(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + + "/replicationProtectionContainers/" + + global::System.Uri.EscapeDataString(protectionContainerName) + + "/replicationProtectedItems" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationProtectedItemsListByReplicationProtectionContainers_Call(request,onOk,eventListener,sender); + } + } + + /// Gets the list of ASR replication protected items in the protection container. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationProtectedItemsListByReplicationProtectionContainersViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationFabrics/(?[^/]+)/replicationProtectionContainers/(?[^/]+)/replicationProtectedItems$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var fabricName = _match.Groups["fabricName"].Value; + var protectionContainerName = _match.Groups["protectionContainerName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationFabrics/" + + fabricName + + "/replicationProtectionContainers/" + + protectionContainerName + + "/replicationProtectedItems" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationProtectedItemsListByReplicationProtectionContainers_Call(request,onOk,eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationProtectedItemsListByReplicationProtectionContainers_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProtectedItemCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this + /// like the actual call, but you will get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Fabric name. + /// Protection container name. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationProtectedItemsListByReplicationProtectionContainers_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(fabricName),fabricName); + await eventListener.AssertNotNull(nameof(protectionContainerName),protectionContainerName); + } + } + + /// Gets the list of ASR replication protected items in the vault. + /// + /// The pagination token. Possible values: "FabricId" or "FabricId_CloudId" or null. + /// OData filter options. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationProtectedItemsListViaIdentity(global::System.String viaIdentity, string skipToken, string Filter, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationProtectedItems$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationProtectedItems'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationProtectedItems" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + + "&" + + (string.IsNullOrEmpty(skipToken) ? global::System.String.Empty : "skipToken=" + global::System.Uri.EscapeDataString(skipToken)) + + "&" + + (string.IsNullOrEmpty(Filter) ? global::System.String.Empty : "$filter=" + global::System.Uri.EscapeDataString(Filter)) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationProtectedItemsList_Call(request,onOk,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationProtectedItemsList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProtectedItemCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will + /// get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// The pagination token. Possible values: "FabricId" or "FabricId_CloudId" or null. + /// OData filter options. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationProtectedItemsList_Validate(string resourceName, string resourceGroupName, string subscriptionId, string skipToken, string Filter, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(skipToken),skipToken); + await eventListener.AssertNotNull(nameof(Filter),Filter); + } + } + + /// Operation to initiate a planned failover of the replication protected item. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Unique fabric name. + /// Protection container name. + /// Replication protected item name. + /// Planned failover input. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationProtectedItemsPlannedFailover(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string replicatedProtectedItemName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + + "/replicationProtectionContainers/" + + global::System.Uri.EscapeDataString(protectionContainerName) + + "/replicationProtectedItems/" + + global::System.Uri.EscapeDataString(replicatedProtectedItemName) + + "/plannedFailover" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationProtectedItemsPlannedFailover_Call(request,onOk,eventListener,sender); + } + } + + /// Operation to initiate a planned failover of the replication protected item. + /// + /// Planned failover input. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationProtectedItemsPlannedFailoverViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationFabrics/(?[^/]+)/replicationProtectionContainers/(?[^/]+)/replicationProtectedItems/(?[^/]+)/plannedFailover$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/plannedFailover'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var fabricName = _match.Groups["fabricName"].Value; + var protectionContainerName = _match.Groups["protectionContainerName"].Value; + var replicatedProtectedItemName = _match.Groups["replicatedProtectedItemName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationFabrics/" + + fabricName + + "/replicationProtectionContainers/" + + protectionContainerName + + "/replicationProtectedItems/" + + replicatedProtectedItemName + + "/plannedFailover" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationProtectedItemsPlannedFailover_Call(request,onOk,eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationProtectedItemsPlannedFailover_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: default + var _finalUri = _response.GetFirstHeader(@"Location"); + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + if (!string.IsNullOrWhiteSpace(_finalUri)) + { + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProtectedItem.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, + /// but you will get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Unique fabric name. + /// Protection container name. + /// Replication protected item name. + /// Planned failover input. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationProtectedItemsPlannedFailover_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string replicatedProtectedItemName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverInput body, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(fabricName),fabricName); + await eventListener.AssertNotNull(nameof(protectionContainerName),protectionContainerName); + await eventListener.AssertNotNull(nameof(replicatedProtectedItemName),replicatedProtectedItemName); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// + /// 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. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Fabric name. + /// Protection container name. + /// Replication protected item name. + /// a delegate that is called when the remote service returns 204 (NoContent). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationProtectedItemsPurge(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string replicatedProtectedItemName, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + + "/replicationProtectionContainers/" + + global::System.Uri.EscapeDataString(protectionContainerName) + + "/replicationProtectedItems/" + + global::System.Uri.EscapeDataString(replicatedProtectedItemName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Delete, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationProtectedItemsPurge_Call(request,onNoContent,eventListener,sender); + } + } + + /// + /// 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. + /// + /// + /// a delegate that is called when the remote service returns 204 (NoContent). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationProtectedItemsPurgeViaIdentity(global::System.String viaIdentity, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationFabrics/(?[^/]+)/replicationProtectionContainers/(?[^/]+)/replicationProtectedItems/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var fabricName = _match.Groups["fabricName"].Value; + var protectionContainerName = _match.Groups["protectionContainerName"].Value; + var replicatedProtectedItemName = _match.Groups["replicatedProtectedItemName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationFabrics/" + + fabricName + + "/replicationProtectionContainers/" + + protectionContainerName + + "/replicationProtectedItems/" + + replicatedProtectedItemName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Delete, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationProtectedItemsPurge_Call(request,onNoContent,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 204 (NoContent). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationProtectedItemsPurge_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: default + var _finalUri = _response.GetFirstHeader(@"Location"); + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + if (!string.IsNullOrWhiteSpace(_finalUri)) + { + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.NoContent: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onNoContent(_response); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will + /// get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Fabric name. + /// Protection container name. + /// Replication protected item name. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationProtectedItemsPurge_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string replicatedProtectedItemName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(fabricName),fabricName); + await eventListener.AssertNotNull(nameof(protectionContainerName),protectionContainerName); + await eventListener.AssertNotNull(nameof(replicatedProtectedItemName),replicatedProtectedItemName); + } + } + + /// Operation to remove disk(s) from the replication protected item. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Unique fabric name. + /// Protection container name. + /// Replication protected item name. + /// Remove disks input. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationProtectedItemsRemoveDisks(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string replicatedProtectedItemName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + + "/replicationProtectionContainers/" + + global::System.Uri.EscapeDataString(protectionContainerName) + + "/replicationProtectedItems/" + + global::System.Uri.EscapeDataString(replicatedProtectedItemName) + + "/removeDisks" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationProtectedItemsRemoveDisks_Call(request,onOk,eventListener,sender); + } + } + + /// Operation to remove disk(s) from the replication protected item. + /// + /// Remove disks input. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationProtectedItemsRemoveDisksViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationFabrics/(?[^/]+)/replicationProtectionContainers/(?[^/]+)/replicationProtectedItems/(?[^/]+)/removeDisks$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/removeDisks'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var fabricName = _match.Groups["fabricName"].Value; + var protectionContainerName = _match.Groups["protectionContainerName"].Value; + var replicatedProtectedItemName = _match.Groups["replicatedProtectedItemName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationFabrics/" + + fabricName + + "/replicationProtectionContainers/" + + protectionContainerName + + "/replicationProtectedItems/" + + replicatedProtectedItemName + + "/removeDisks" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationProtectedItemsRemoveDisks_Call(request,onOk,eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationProtectedItemsRemoveDisks_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: default + var _finalUri = _response.GetFirstHeader(@"Location"); + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + if (!string.IsNullOrWhiteSpace(_finalUri)) + { + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProtectedItem.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but + /// you will get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Unique fabric name. + /// Protection container name. + /// Replication protected item name. + /// Remove disks input. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationProtectedItemsRemoveDisks_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string replicatedProtectedItemName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksInput body, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(fabricName),fabricName); + await eventListener.AssertNotNull(nameof(protectionContainerName),protectionContainerName); + await eventListener.AssertNotNull(nameof(replicatedProtectedItemName),replicatedProtectedItemName); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// + /// The operation to start resynchronize/repair replication for a replication protected item requiring resynchronization. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// The name of the fabric. + /// The name of the container. + /// The name of the replication protected item. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationProtectedItemsRepairReplication(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string replicatedProtectedItemName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + + "/replicationProtectionContainers/" + + global::System.Uri.EscapeDataString(protectionContainerName) + + "/replicationProtectedItems/" + + global::System.Uri.EscapeDataString(replicatedProtectedItemName) + + "/repairReplication" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationProtectedItemsRepairReplication_Call(request,onOk,eventListener,sender); + } + } + + /// + /// The operation to start resynchronize/repair replication for a replication protected item requiring resynchronization. + /// + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationProtectedItemsRepairReplicationViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationFabrics/(?[^/]+)/replicationProtectionContainers/(?[^/]+)/replicationProtectedItems/(?[^/]+)/repairReplication$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/repairReplication'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var fabricName = _match.Groups["fabricName"].Value; + var protectionContainerName = _match.Groups["protectionContainerName"].Value; + var replicatedProtectedItemName = _match.Groups["replicatedProtectedItemName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationFabrics/" + + fabricName + + "/replicationProtectionContainers/" + + protectionContainerName + + "/replicationProtectedItems/" + + replicatedProtectedItemName + + "/repairReplication" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationProtectedItemsRepairReplication_Call(request,onOk,eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationProtectedItemsRepairReplication_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: default + var _finalUri = _response.GetFirstHeader(@"Location"); + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + if (!string.IsNullOrWhiteSpace(_finalUri)) + { + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProtectedItem.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, + /// but you will get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// The name of the fabric. + /// The name of the container. + /// The name of the replication protected item. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationProtectedItemsRepairReplication_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string replicatedProtectedItemName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(fabricName),fabricName); + await eventListener.AssertNotNull(nameof(protectionContainerName),protectionContainerName); + await eventListener.AssertNotNull(nameof(replicatedProtectedItemName),replicatedProtectedItemName); + } + } + + /// + /// Operation to reprotect or reverse replicate a failed over replication protected item. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Unique fabric name. + /// Protection container name. + /// Replication protected item name. + /// Reverse replication input. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationProtectedItemsReprotect(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string replicatedProtectedItemName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + + "/replicationProtectionContainers/" + + global::System.Uri.EscapeDataString(protectionContainerName) + + "/replicationProtectedItems/" + + global::System.Uri.EscapeDataString(replicatedProtectedItemName) + + "/reProtect" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationProtectedItemsReprotect_Call(request,onOk,eventListener,sender); + } + } + + /// + /// Operation to reprotect or reverse replicate a failed over replication protected item. + /// + /// + /// Reverse replication input. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationProtectedItemsReprotectViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationFabrics/(?[^/]+)/replicationProtectionContainers/(?[^/]+)/replicationProtectedItems/(?[^/]+)/reProtect$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/reProtect'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var fabricName = _match.Groups["fabricName"].Value; + var protectionContainerName = _match.Groups["protectionContainerName"].Value; + var replicatedProtectedItemName = _match.Groups["replicatedProtectedItemName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationFabrics/" + + fabricName + + "/replicationProtectionContainers/" + + protectionContainerName + + "/replicationProtectedItems/" + + replicatedProtectedItemName + + "/reProtect" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationProtectedItemsReprotect_Call(request,onOk,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationProtectedItemsReprotect_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: default + var _finalUri = _response.GetFirstHeader(@"Location"); + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + if (!string.IsNullOrWhiteSpace(_finalUri)) + { + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProtectedItem.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you + /// will get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Unique fabric name. + /// Protection container name. + /// Replication protected item name. + /// Reverse replication input. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationProtectedItemsReprotect_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string replicatedProtectedItemName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationInput body, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(fabricName),fabricName); + await eventListener.AssertNotNull(nameof(protectionContainerName),protectionContainerName); + await eventListener.AssertNotNull(nameof(replicatedProtectedItemName),replicatedProtectedItemName); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// Operation to resolve health issues of the replication protected item. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Unique fabric name. + /// Protection container name. + /// Replication protected item name. + /// Health issue input object. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationProtectedItemsResolveHealthErrors(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string replicatedProtectedItemName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResolveHealthInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + + "/replicationProtectionContainers/" + + global::System.Uri.EscapeDataString(protectionContainerName) + + "/replicationProtectedItems/" + + global::System.Uri.EscapeDataString(replicatedProtectedItemName) + + "/resolveHealthErrors" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationProtectedItemsResolveHealthErrors_Call(request,onOk,eventListener,sender); + } + } + + /// Operation to resolve health issues of the replication protected item. + /// + /// Health issue input object. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationProtectedItemsResolveHealthErrorsViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResolveHealthInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationFabrics/(?[^/]+)/replicationProtectionContainers/(?[^/]+)/replicationProtectedItems/(?[^/]+)/resolveHealthErrors$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/resolveHealthErrors'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var fabricName = _match.Groups["fabricName"].Value; + var protectionContainerName = _match.Groups["protectionContainerName"].Value; + var replicatedProtectedItemName = _match.Groups["replicatedProtectedItemName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationFabrics/" + + fabricName + + "/replicationProtectionContainers/" + + protectionContainerName + + "/replicationProtectedItems/" + + replicatedProtectedItemName + + "/resolveHealthErrors" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationProtectedItemsResolveHealthErrors_Call(request,onOk,eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationProtectedItemsResolveHealthErrors_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: default + var _finalUri = _response.GetFirstHeader(@"Location"); + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + if (!string.IsNullOrWhiteSpace(_finalUri)) + { + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProtectedItem.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, + /// but you will get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Unique fabric name. + /// Protection container name. + /// Replication protected item name. + /// Health issue input object. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationProtectedItemsResolveHealthErrors_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string replicatedProtectedItemName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResolveHealthInput body, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(fabricName),fabricName); + await eventListener.AssertNotNull(nameof(protectionContainerName),protectionContainerName); + await eventListener.AssertNotNull(nameof(replicatedProtectedItemName),replicatedProtectedItemName); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// Operation to initiate a switch provider of the replication protected item. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Unique fabric name. + /// Protection container name. + /// Replication protected item name. + /// Switch provider input. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationProtectedItemsSwitchProvider(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string replicatedProtectedItemName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + + "/replicationProtectionContainers/" + + global::System.Uri.EscapeDataString(protectionContainerName) + + "/replicationProtectedItems/" + + global::System.Uri.EscapeDataString(replicatedProtectedItemName) + + "/switchProvider" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationProtectedItemsSwitchProvider_Call(request,onOk,eventListener,sender); + } + } + + /// Operation to initiate a switch provider of the replication protected item. + /// + /// Switch provider input. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationProtectedItemsSwitchProviderViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationFabrics/(?[^/]+)/replicationProtectionContainers/(?[^/]+)/replicationProtectedItems/(?[^/]+)/switchProvider$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/switchProvider'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var fabricName = _match.Groups["fabricName"].Value; + var protectionContainerName = _match.Groups["protectionContainerName"].Value; + var replicatedProtectedItemName = _match.Groups["replicatedProtectedItemName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationFabrics/" + + fabricName + + "/replicationProtectionContainers/" + + protectionContainerName + + "/replicationProtectedItems/" + + replicatedProtectedItemName + + "/switchProvider" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationProtectedItemsSwitchProvider_Call(request,onOk,eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationProtectedItemsSwitchProvider_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: azure-async-operation + var _finalUri = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProtectedItem.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but + /// you will get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Unique fabric name. + /// Protection container name. + /// Replication protected item name. + /// Switch provider input. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationProtectedItemsSwitchProvider_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string replicatedProtectedItemName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderInput body, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(fabricName),fabricName); + await eventListener.AssertNotNull(nameof(protectionContainerName),protectionContainerName); + await eventListener.AssertNotNull(nameof(replicatedProtectedItemName),replicatedProtectedItemName); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// Operation to perform a test failover of the replication protected item. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Unique fabric name. + /// Protection container name. + /// Replication protected item name. + /// Test failover input. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationProtectedItemsTestFailover(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string replicatedProtectedItemName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + + "/replicationProtectionContainers/" + + global::System.Uri.EscapeDataString(protectionContainerName) + + "/replicationProtectedItems/" + + global::System.Uri.EscapeDataString(replicatedProtectedItemName) + + "/testFailover" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationProtectedItemsTestFailover_Call(request,onOk,eventListener,sender); + } + } + + /// Operation to clean up the test failover of a replication protected item. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Unique fabric name. + /// Protection container name. + /// Replication protected item name. + /// Test failover cleanup input. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationProtectedItemsTestFailoverCleanup(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string replicatedProtectedItemName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverCleanupInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + + "/replicationProtectionContainers/" + + global::System.Uri.EscapeDataString(protectionContainerName) + + "/replicationProtectedItems/" + + global::System.Uri.EscapeDataString(replicatedProtectedItemName) + + "/testFailoverCleanup" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationProtectedItemsTestFailoverCleanup_Call(request,onOk,eventListener,sender); + } + } + + /// Operation to clean up the test failover of a replication protected item. + /// + /// Test failover cleanup input. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationProtectedItemsTestFailoverCleanupViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverCleanupInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationFabrics/(?[^/]+)/replicationProtectionContainers/(?[^/]+)/replicationProtectedItems/(?[^/]+)/testFailoverCleanup$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/testFailoverCleanup'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var fabricName = _match.Groups["fabricName"].Value; + var protectionContainerName = _match.Groups["protectionContainerName"].Value; + var replicatedProtectedItemName = _match.Groups["replicatedProtectedItemName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationFabrics/" + + fabricName + + "/replicationProtectionContainers/" + + protectionContainerName + + "/replicationProtectedItems/" + + replicatedProtectedItemName + + "/testFailoverCleanup" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationProtectedItemsTestFailoverCleanup_Call(request,onOk,eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationProtectedItemsTestFailoverCleanup_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: default + var _finalUri = _response.GetFirstHeader(@"Location"); + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + if (!string.IsNullOrWhiteSpace(_finalUri)) + { + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProtectedItem.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, + /// but you will get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Unique fabric name. + /// Protection container name. + /// Replication protected item name. + /// Test failover cleanup input. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationProtectedItemsTestFailoverCleanup_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string replicatedProtectedItemName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverCleanupInput body, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(fabricName),fabricName); + await eventListener.AssertNotNull(nameof(protectionContainerName),protectionContainerName); + await eventListener.AssertNotNull(nameof(replicatedProtectedItemName),replicatedProtectedItemName); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// Operation to perform a test failover of the replication protected item. + /// + /// Test failover input. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationProtectedItemsTestFailoverViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationFabrics/(?[^/]+)/replicationProtectionContainers/(?[^/]+)/replicationProtectedItems/(?[^/]+)/testFailover$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/testFailover'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var fabricName = _match.Groups["fabricName"].Value; + var protectionContainerName = _match.Groups["protectionContainerName"].Value; + var replicatedProtectedItemName = _match.Groups["replicatedProtectedItemName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationFabrics/" + + fabricName + + "/replicationProtectionContainers/" + + protectionContainerName + + "/replicationProtectedItems/" + + replicatedProtectedItemName + + "/testFailover" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationProtectedItemsTestFailover_Call(request,onOk,eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationProtectedItemsTestFailover_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: default + var _finalUri = _response.GetFirstHeader(@"Location"); + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + if (!string.IsNullOrWhiteSpace(_finalUri)) + { + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProtectedItem.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but + /// you will get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Unique fabric name. + /// Protection container name. + /// Replication protected item name. + /// Test failover input. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationProtectedItemsTestFailover_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string replicatedProtectedItemName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverInput body, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(fabricName),fabricName); + await eventListener.AssertNotNull(nameof(protectionContainerName),protectionContainerName); + await eventListener.AssertNotNull(nameof(replicatedProtectedItemName),replicatedProtectedItemName); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// Operation to initiate a failover of the replication protected item. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Unique fabric name. + /// Protection container name. + /// Replication protected item name. + /// Failover input. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationProtectedItemsUnplannedFailover(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string replicatedProtectedItemName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + + "/replicationProtectionContainers/" + + global::System.Uri.EscapeDataString(protectionContainerName) + + "/replicationProtectedItems/" + + global::System.Uri.EscapeDataString(replicatedProtectedItemName) + + "/unplannedFailover" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationProtectedItemsUnplannedFailover_Call(request,onOk,eventListener,sender); + } + } + + /// Operation to initiate a failover of the replication protected item. + /// + /// Failover input. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationProtectedItemsUnplannedFailoverViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationFabrics/(?[^/]+)/replicationProtectionContainers/(?[^/]+)/replicationProtectedItems/(?[^/]+)/unplannedFailover$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/unplannedFailover'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var fabricName = _match.Groups["fabricName"].Value; + var protectionContainerName = _match.Groups["protectionContainerName"].Value; + var replicatedProtectedItemName = _match.Groups["replicatedProtectedItemName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationFabrics/" + + fabricName + + "/replicationProtectionContainers/" + + protectionContainerName + + "/replicationProtectedItems/" + + replicatedProtectedItemName + + "/unplannedFailover" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationProtectedItemsUnplannedFailover_Call(request,onOk,eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationProtectedItemsUnplannedFailover_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: default + var _finalUri = _response.GetFirstHeader(@"Location"); + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + if (!string.IsNullOrWhiteSpace(_finalUri)) + { + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProtectedItem.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, + /// but you will get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Unique fabric name. + /// Protection container name. + /// Replication protected item name. + /// Failover input. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationProtectedItemsUnplannedFailover_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string replicatedProtectedItemName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverInput body, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(fabricName),fabricName); + await eventListener.AssertNotNull(nameof(protectionContainerName),protectionContainerName); + await eventListener.AssertNotNull(nameof(replicatedProtectedItemName),replicatedProtectedItemName); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// + /// The operation to update the recovery settings of an ASR replication protected item. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Fabric name. + /// Protection container name. + /// Replication protected item name. + /// Update protection input. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationProtectedItemsUpdate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string replicatedProtectedItemName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + + "/replicationProtectionContainers/" + + global::System.Uri.EscapeDataString(protectionContainerName) + + "/replicationProtectedItems/" + + global::System.Uri.EscapeDataString(replicatedProtectedItemName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationProtectedItemsUpdate_Call(request,onOk,eventListener,sender); + } + } + + /// The operation to update appliance of an ASR replication protected item. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Fabric name. + /// Protection container name. + /// Replication protected item name. + /// Appliance update protection input. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationProtectedItemsUpdateAppliance(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string replicatedProtectedItemName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + + "/replicationProtectionContainers/" + + global::System.Uri.EscapeDataString(protectionContainerName) + + "/replicationProtectedItems/" + + global::System.Uri.EscapeDataString(replicatedProtectedItemName) + + "/updateAppliance" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationProtectedItemsUpdateAppliance_Call(request,onOk,eventListener,sender); + } + } + + /// The operation to update appliance of an ASR replication protected item. + /// + /// Appliance update protection input. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationProtectedItemsUpdateApplianceViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationFabrics/(?[^/]+)/replicationProtectionContainers/(?[^/]+)/replicationProtectedItems/(?[^/]+)/updateAppliance$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/updateAppliance'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var fabricName = _match.Groups["fabricName"].Value; + var protectionContainerName = _match.Groups["protectionContainerName"].Value; + var replicatedProtectedItemName = _match.Groups["replicatedProtectedItemName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationFabrics/" + + fabricName + + "/replicationProtectionContainers/" + + protectionContainerName + + "/replicationProtectedItems/" + + replicatedProtectedItemName + + "/updateAppliance" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationProtectedItemsUpdateAppliance_Call(request,onOk,eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationProtectedItemsUpdateAppliance_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: default + var _finalUri = _response.GetFirstHeader(@"Location"); + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + if (!string.IsNullOrWhiteSpace(_finalUri)) + { + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProtectedItem.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, + /// but you will get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Fabric name. + /// Protection container name. + /// Replication protected item name. + /// Appliance update protection input. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationProtectedItemsUpdateAppliance_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string replicatedProtectedItemName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemInput body, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(fabricName),fabricName); + await eventListener.AssertNotNull(nameof(protectionContainerName),protectionContainerName); + await eventListener.AssertNotNull(nameof(replicatedProtectedItemName),replicatedProtectedItemName); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// + /// The operation to update(push update) the installed mobility service software on a replication protected item to the latest + /// available version. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// The name of the fabric containing the protected item. + /// The name of the container containing the protected item. + /// The name of the protected item on which the agent is to be updated. + /// Request to update the mobility service on the protected item. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationProtectedItemsUpdateMobilityService(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string replicatedProtectedItemName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMobilityServiceRequest body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + + "/replicationProtectionContainers/" + + global::System.Uri.EscapeDataString(protectionContainerName) + + "/replicationProtectedItems/" + + global::System.Uri.EscapeDataString(replicatedProtectedItemName) + + "/updateMobilityService" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationProtectedItemsUpdateMobilityService_Call(request,onOk,eventListener,sender); + } + } + + /// + /// The operation to update(push update) the installed mobility service software on a replication protected item to the latest + /// available version. + /// + /// + /// Request to update the mobility service on the protected item. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationProtectedItemsUpdateMobilityServiceViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMobilityServiceRequest body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationFabrics/(?[^/]+)/replicationProtectionContainers/(?[^/]+)/replicationProtectedItems/(?[^/]+)/updateMobilityService$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/updateMobilityService'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var fabricName = _match.Groups["fabricName"].Value; + var protectionContainerName = _match.Groups["protectionContainerName"].Value; + var replicatedProtectedItemName = _match.Groups["replicatedProtectedItemName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationFabrics/" + + fabricName + + "/replicationProtectionContainers/" + + protectionContainerName + + "/replicationProtectedItems/" + + replicatedProtectedItemName + + "/updateMobilityService" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationProtectedItemsUpdateMobilityService_Call(request,onOk,eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationProtectedItemsUpdateMobilityService_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: location + var _finalUri = _response.GetFirstHeader(@"Location"); + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProtectedItem.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual + /// call, but you will get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// The name of the fabric containing the protected item. + /// The name of the container containing the protected item. + /// The name of the protected item on which the agent is to be updated. + /// Request to update the mobility service on the protected item. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationProtectedItemsUpdateMobilityService_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string replicatedProtectedItemName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMobilityServiceRequest body, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(fabricName),fabricName); + await eventListener.AssertNotNull(nameof(protectionContainerName),protectionContainerName); + await eventListener.AssertNotNull(nameof(replicatedProtectedItemName),replicatedProtectedItemName); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// + /// The operation to update the recovery settings of an ASR replication protected item. + /// + /// + /// Update protection input. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationProtectedItemsUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationFabrics/(?[^/]+)/replicationProtectionContainers/(?[^/]+)/replicationProtectedItems/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var fabricName = _match.Groups["fabricName"].Value; + var protectionContainerName = _match.Groups["protectionContainerName"].Value; + var replicatedProtectedItemName = _match.Groups["replicatedProtectedItemName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationFabrics/" + + fabricName + + "/replicationProtectionContainers/" + + protectionContainerName + + "/replicationProtectedItems/" + + replicatedProtectedItemName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationProtectedItemsUpdate_Call(request,onOk,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationProtectedItemsUpdate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: default + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + if (!string.IsNullOrWhiteSpace(_originalUri)) + { + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_originalUri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProtectedItem.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will + /// get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Fabric name. + /// Protection container name. + /// Replication protected item name. + /// Update protection input. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationProtectedItemsUpdate_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string replicatedProtectedItemName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInput body, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(fabricName),fabricName); + await eventListener.AssertNotNull(nameof(protectionContainerName),protectionContainerName); + await eventListener.AssertNotNull(nameof(replicatedProtectedItemName),replicatedProtectedItemName); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// The operation to create a protection container mapping. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Fabric name. + /// Protection container name. + /// Protection container mapping name. + /// Mapping creation input. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationProtectionContainerMappingsCreate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string mappingName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerMappingInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + + "/replicationProtectionContainers/" + + global::System.Uri.EscapeDataString(protectionContainerName) + + "/replicationProtectionContainerMappings/" + + global::System.Uri.EscapeDataString(mappingName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationProtectionContainerMappingsCreate_Call(request,onOk,eventListener,sender); + } + } + + /// The operation to create a protection container mapping. + /// + /// Mapping creation input. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationProtectionContainerMappingsCreateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerMappingInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationFabrics/(?[^/]+)/replicationProtectionContainers/(?[^/]+)/replicationProtectionContainerMappings/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings/{mappingName}'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var fabricName = _match.Groups["fabricName"].Value; + var protectionContainerName = _match.Groups["protectionContainerName"].Value; + var mappingName = _match.Groups["mappingName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationFabrics/" + + fabricName + + "/replicationProtectionContainers/" + + protectionContainerName + + "/replicationProtectionContainerMappings/" + + mappingName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationProtectionContainerMappingsCreate_Call(request,onOk,eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationProtectionContainerMappingsCreate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: default + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + if (!string.IsNullOrWhiteSpace(_originalUri)) + { + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_originalUri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProtectionContainerMapping.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, + /// but you will get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Fabric name. + /// Protection container name. + /// Protection container mapping name. + /// Mapping creation input. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationProtectionContainerMappingsCreate_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string mappingName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerMappingInput body, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(fabricName),fabricName); + await eventListener.AssertNotNull(nameof(protectionContainerName),protectionContainerName); + await eventListener.AssertNotNull(nameof(mappingName),mappingName); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// The operation to delete or remove a protection container mapping. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Fabric name. + /// Protection container name. + /// Protection container mapping name. + /// Removal input. + /// a delegate that is called when the remote service returns 204 (NoContent). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationProtectionContainerMappingsDelete(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string mappingName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveProtectionContainerMappingInput body, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + + "/replicationProtectionContainers/" + + global::System.Uri.EscapeDataString(protectionContainerName) + + "/replicationProtectionContainerMappings/" + + global::System.Uri.EscapeDataString(mappingName) + + "/remove" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationProtectionContainerMappingsDelete_Call(request,onNoContent,eventListener,sender); + } + } + + /// The operation to delete or remove a protection container mapping. + /// + /// Removal input. + /// a delegate that is called when the remote service returns 204 (NoContent). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationProtectionContainerMappingsDeleteViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveProtectionContainerMappingInput body, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationFabrics/(?[^/]+)/replicationProtectionContainers/(?[^/]+)/replicationProtectionContainerMappings/(?[^/]+)/remove$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings/{mappingName}/remove'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var fabricName = _match.Groups["fabricName"].Value; + var protectionContainerName = _match.Groups["protectionContainerName"].Value; + var mappingName = _match.Groups["mappingName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationFabrics/" + + fabricName + + "/replicationProtectionContainers/" + + protectionContainerName + + "/replicationProtectionContainerMappings/" + + mappingName + + "/remove" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationProtectionContainerMappingsDelete_Call(request,onNoContent,eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 204 (NoContent). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationProtectionContainerMappingsDelete_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: default + var _finalUri = _response.GetFirstHeader(@"Location"); + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + if (!string.IsNullOrWhiteSpace(_finalUri)) + { + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.NoContent: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onNoContent(_response); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, + /// but you will get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Fabric name. + /// Protection container name. + /// Protection container mapping name. + /// Removal input. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationProtectionContainerMappingsDelete_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string mappingName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveProtectionContainerMappingInput body, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(fabricName),fabricName); + await eventListener.AssertNotNull(nameof(protectionContainerName),protectionContainerName); + await eventListener.AssertNotNull(nameof(mappingName),mappingName); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// Gets the details of a protection container mapping. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Fabric name. + /// Protection container name. + /// Protection Container mapping name. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationProtectionContainerMappingsGet(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string mappingName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + + "/replicationProtectionContainers/" + + global::System.Uri.EscapeDataString(protectionContainerName) + + "/replicationProtectionContainerMappings/" + + global::System.Uri.EscapeDataString(mappingName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationProtectionContainerMappingsGet_Call(request,onOk,eventListener,sender); + } + } + + /// Gets the details of a protection container mapping. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationProtectionContainerMappingsGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationFabrics/(?[^/]+)/replicationProtectionContainers/(?[^/]+)/replicationProtectionContainerMappings/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings/{mappingName}'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var fabricName = _match.Groups["fabricName"].Value; + var protectionContainerName = _match.Groups["protectionContainerName"].Value; + var mappingName = _match.Groups["mappingName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationFabrics/" + + fabricName + + "/replicationProtectionContainers/" + + protectionContainerName + + "/replicationProtectionContainerMappings/" + + mappingName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationProtectionContainerMappingsGet_Call(request,onOk,eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationProtectionContainerMappingsGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProtectionContainerMapping.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, + /// but you will get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Fabric name. + /// Protection container name. + /// Protection Container mapping name. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationProtectionContainerMappingsGet_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string mappingName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(fabricName),fabricName); + await eventListener.AssertNotNull(nameof(protectionContainerName),protectionContainerName); + await eventListener.AssertNotNull(nameof(mappingName),mappingName); + } + } + + /// Lists the protection container mappings in the vault. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationProtectionContainerMappingsList(string resourceName, string resourceGroupName, string subscriptionId, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationProtectionContainerMappings" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationProtectionContainerMappingsList_Call(request,onOk,eventListener,sender); + } + } + + /// Lists the protection container mappings for a protection container. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Fabric name. + /// Protection container name. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationProtectionContainerMappingsListByReplicationProtectionContainers(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + + "/replicationProtectionContainers/" + + global::System.Uri.EscapeDataString(protectionContainerName) + + "/replicationProtectionContainerMappings" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationProtectionContainerMappingsListByReplicationProtectionContainers_Call(request,onOk,eventListener,sender); + } + } + + /// Lists the protection container mappings for a protection container. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationProtectionContainerMappingsListByReplicationProtectionContainersViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationFabrics/(?[^/]+)/replicationProtectionContainers/(?[^/]+)/replicationProtectionContainerMappings$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var fabricName = _match.Groups["fabricName"].Value; + var protectionContainerName = _match.Groups["protectionContainerName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationFabrics/" + + fabricName + + "/replicationProtectionContainers/" + + protectionContainerName + + "/replicationProtectionContainerMappings" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationProtectionContainerMappingsListByReplicationProtectionContainers_Call(request,onOk,eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationProtectionContainerMappingsListByReplicationProtectionContainers_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProtectionContainerMappingCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. + /// Call this like the actual call, but you will get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Fabric name. + /// Protection container name. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationProtectionContainerMappingsListByReplicationProtectionContainers_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(fabricName),fabricName); + await eventListener.AssertNotNull(nameof(protectionContainerName),protectionContainerName); + } + } + + /// Lists the protection container mappings in the vault. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationProtectionContainerMappingsListViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationProtectionContainerMappings$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationProtectionContainerMappings'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationProtectionContainerMappings" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationProtectionContainerMappingsList_Call(request,onOk,eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationProtectionContainerMappingsList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProtectionContainerMappingCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, + /// but you will get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationProtectionContainerMappingsList_Validate(string resourceName, string resourceGroupName, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + } + } + + /// The operation to purge(force delete) a protection container mapping. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Fabric name. + /// Protection container name. + /// Protection container mapping name. + /// a delegate that is called when the remote service returns 204 (NoContent). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationProtectionContainerMappingsPurge(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string mappingName, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + + "/replicationProtectionContainers/" + + global::System.Uri.EscapeDataString(protectionContainerName) + + "/replicationProtectionContainerMappings/" + + global::System.Uri.EscapeDataString(mappingName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Delete, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationProtectionContainerMappingsPurge_Call(request,onNoContent,eventListener,sender); + } + } + + /// The operation to purge(force delete) a protection container mapping. + /// + /// a delegate that is called when the remote service returns 204 (NoContent). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationProtectionContainerMappingsPurgeViaIdentity(global::System.String viaIdentity, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationFabrics/(?[^/]+)/replicationProtectionContainers/(?[^/]+)/replicationProtectionContainerMappings/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings/{mappingName}'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var fabricName = _match.Groups["fabricName"].Value; + var protectionContainerName = _match.Groups["protectionContainerName"].Value; + var mappingName = _match.Groups["mappingName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationFabrics/" + + fabricName + + "/replicationProtectionContainers/" + + protectionContainerName + + "/replicationProtectionContainerMappings/" + + mappingName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Delete, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationProtectionContainerMappingsPurge_Call(request,onNoContent,eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 204 (NoContent). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationProtectionContainerMappingsPurge_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: default + var _finalUri = _response.GetFirstHeader(@"Location"); + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + if (!string.IsNullOrWhiteSpace(_finalUri)) + { + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.NoContent: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onNoContent(_response); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, + /// but you will get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Fabric name. + /// Protection container name. + /// Protection container mapping name. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationProtectionContainerMappingsPurge_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string mappingName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(fabricName),fabricName); + await eventListener.AssertNotNull(nameof(protectionContainerName),protectionContainerName); + await eventListener.AssertNotNull(nameof(mappingName),mappingName); + } + } + + /// The operation to update protection container mapping. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Fabric name. + /// Protection container name. + /// Protection container mapping name. + /// Mapping update input. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationProtectionContainerMappingsUpdate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string mappingName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateProtectionContainerMappingInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + + "/replicationProtectionContainers/" + + global::System.Uri.EscapeDataString(protectionContainerName) + + "/replicationProtectionContainerMappings/" + + global::System.Uri.EscapeDataString(mappingName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationProtectionContainerMappingsUpdate_Call(request,onOk,eventListener,sender); + } + } + + /// The operation to update protection container mapping. + /// + /// Mapping update input. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationProtectionContainerMappingsUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateProtectionContainerMappingInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationFabrics/(?[^/]+)/replicationProtectionContainers/(?[^/]+)/replicationProtectionContainerMappings/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings/{mappingName}'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var fabricName = _match.Groups["fabricName"].Value; + var protectionContainerName = _match.Groups["protectionContainerName"].Value; + var mappingName = _match.Groups["mappingName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationFabrics/" + + fabricName + + "/replicationProtectionContainers/" + + protectionContainerName + + "/replicationProtectionContainerMappings/" + + mappingName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationProtectionContainerMappingsUpdate_Call(request,onOk,eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationProtectionContainerMappingsUpdate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: default + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + if (!string.IsNullOrWhiteSpace(_originalUri)) + { + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_originalUri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProtectionContainerMapping.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, + /// but you will get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Fabric name. + /// Protection container name. + /// Protection container mapping name. + /// Mapping update input. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationProtectionContainerMappingsUpdate_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string mappingName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateProtectionContainerMappingInput body, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(fabricName),fabricName); + await eventListener.AssertNotNull(nameof(protectionContainerName),protectionContainerName); + await eventListener.AssertNotNull(nameof(mappingName),mappingName); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// Operation to create a protection container. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Unique fabric ARM name. + /// Unique protection container ARM name. + /// Creation input. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationProtectionContainersCreate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + + "/replicationProtectionContainers/" + + global::System.Uri.EscapeDataString(protectionContainerName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationProtectionContainersCreate_Call(request,onOk,eventListener,sender); + } + } + + /// Operation to create a protection container. + /// + /// Creation input. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationProtectionContainersCreateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationFabrics/(?[^/]+)/replicationProtectionContainers/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var fabricName = _match.Groups["fabricName"].Value; + var protectionContainerName = _match.Groups["protectionContainerName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationFabrics/" + + fabricName + + "/replicationProtectionContainers/" + + protectionContainerName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationProtectionContainersCreate_Call(request,onOk,eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationProtectionContainersCreate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: default + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + if (!string.IsNullOrWhiteSpace(_originalUri)) + { + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_originalUri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProtectionContainer.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but + /// you will get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Unique fabric ARM name. + /// Unique protection container ARM name. + /// Creation input. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationProtectionContainersCreate_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerInput body, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(fabricName),fabricName); + await eventListener.AssertNotNull(nameof(protectionContainerName),protectionContainerName); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// Operation to remove a protection container. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Unique fabric ARM name. + /// Unique protection container ARM name. + /// a delegate that is called when the remote service returns 204 (NoContent). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationProtectionContainersDelete(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + + "/replicationProtectionContainers/" + + global::System.Uri.EscapeDataString(protectionContainerName) + + "/remove" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationProtectionContainersDelete_Call(request,onNoContent,eventListener,sender); + } + } + + /// Operation to remove a protection container. + /// + /// a delegate that is called when the remote service returns 204 (NoContent). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationProtectionContainersDeleteViaIdentity(global::System.String viaIdentity, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationFabrics/(?[^/]+)/replicationProtectionContainers/(?[^/]+)/remove$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/remove'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var fabricName = _match.Groups["fabricName"].Value; + var protectionContainerName = _match.Groups["protectionContainerName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationFabrics/" + + fabricName + + "/replicationProtectionContainers/" + + protectionContainerName + + "/remove" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationProtectionContainersDelete_Call(request,onNoContent,eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 204 (NoContent). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationProtectionContainersDelete_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: default + var _finalUri = _response.GetFirstHeader(@"Location"); + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + if (!string.IsNullOrWhiteSpace(_finalUri)) + { + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.NoContent: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onNoContent(_response); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but + /// you will get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Unique fabric ARM name. + /// Unique protection container ARM name. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationProtectionContainersDelete_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(fabricName),fabricName); + await eventListener.AssertNotNull(nameof(protectionContainerName),protectionContainerName); + } + } + + /// + /// The operation to a add a protectable item to a protection container(Add physical server). + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// The name of the fabric. + /// The name of the protection container. + /// The request object to add a protectable item. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationProtectionContainersDiscoverProtectableItem(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiscoverProtectableItemRequest body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + + "/replicationProtectionContainers/" + + global::System.Uri.EscapeDataString(protectionContainerName) + + "/discoverProtectableItem" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationProtectionContainersDiscoverProtectableItem_Call(request,onOk,eventListener,sender); + } + } + + /// + /// The operation to a add a protectable item to a protection container(Add physical server). + /// + /// + /// The request object to add a protectable item. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationProtectionContainersDiscoverProtectableItemViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiscoverProtectableItemRequest body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationFabrics/(?[^/]+)/replicationProtectionContainers/(?[^/]+)/discoverProtectableItem$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/discoverProtectableItem'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var fabricName = _match.Groups["fabricName"].Value; + var protectionContainerName = _match.Groups["protectionContainerName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationFabrics/" + + fabricName + + "/replicationProtectionContainers/" + + protectionContainerName + + "/discoverProtectableItem" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationProtectionContainersDiscoverProtectableItem_Call(request,onOk,eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationProtectionContainersDiscoverProtectableItem_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: default + var _finalUri = _response.GetFirstHeader(@"Location"); + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + if (!string.IsNullOrWhiteSpace(_finalUri)) + { + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProtectionContainer.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the + /// actual call, but you will get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// The name of the fabric. + /// The name of the protection container. + /// The request object to add a protectable item. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationProtectionContainersDiscoverProtectableItem_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiscoverProtectableItemRequest body, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(fabricName),fabricName); + await eventListener.AssertNotNull(nameof(protectionContainerName),protectionContainerName); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// Gets the details of a protection container. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Fabric name. + /// Protection container name. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationProtectionContainersGet(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + + "/replicationProtectionContainers/" + + global::System.Uri.EscapeDataString(protectionContainerName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationProtectionContainersGet_Call(request,onOk,eventListener,sender); + } + } + + /// Gets the details of a protection container. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationProtectionContainersGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationFabrics/(?[^/]+)/replicationProtectionContainers/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var fabricName = _match.Groups["fabricName"].Value; + var protectionContainerName = _match.Groups["protectionContainerName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationFabrics/" + + fabricName + + "/replicationProtectionContainers/" + + protectionContainerName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationProtectionContainersGet_Call(request,onOk,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationProtectionContainersGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProtectionContainer.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you + /// will get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Fabric name. + /// Protection container name. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationProtectionContainersGet_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(fabricName),fabricName); + await eventListener.AssertNotNull(nameof(protectionContainerName),protectionContainerName); + } + } + + /// Lists the protection containers in a vault. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationProtectionContainersList(string resourceName, string resourceGroupName, string subscriptionId, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationProtectionContainers" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationProtectionContainersList_Call(request,onOk,eventListener,sender); + } + } + + /// Lists the protection containers in the specified fabric. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Fabric name. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationProtectionContainersListByReplicationFabrics(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + + "/replicationProtectionContainers" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationProtectionContainersListByReplicationFabrics_Call(request,onOk,eventListener,sender); + } + } + + /// Lists the protection containers in the specified fabric. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationProtectionContainersListByReplicationFabricsViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationFabrics/(?[^/]+)/replicationProtectionContainers$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var fabricName = _match.Groups["fabricName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationFabrics/" + + fabricName + + "/replicationProtectionContainers" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationProtectionContainersListByReplicationFabrics_Call(request,onOk,eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationProtectionContainersListByReplicationFabrics_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProtectionContainerCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the + /// actual call, but you will get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Fabric name. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationProtectionContainersListByReplicationFabrics_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(fabricName),fabricName); + } + } + + /// Lists the protection containers in a vault. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationProtectionContainersListViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationProtectionContainers$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationProtectionContainers'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationProtectionContainers" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationProtectionContainersList_Call(request,onOk,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationProtectionContainersList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProtectionContainerCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you + /// will get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationProtectionContainersList_Validate(string resourceName, string resourceGroupName, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + } + } + + /// + /// Operation to switch protection from one container to another or one replication provider to another. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Unique fabric name. + /// Protection container name. + /// Switch protection input. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationProtectionContainersSwitchProtection(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + + "/replicationProtectionContainers/" + + global::System.Uri.EscapeDataString(protectionContainerName) + + "/switchprotection" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationProtectionContainersSwitchProtection_Call(request,onOk,eventListener,sender); + } + } + + /// + /// Operation to switch protection from one container to another or one replication provider to another. + /// + /// + /// Switch protection input. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationProtectionContainersSwitchProtectionViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationFabrics/(?[^/]+)/replicationProtectionContainers/(?[^/]+)/switchprotection$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/switchprotection'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var fabricName = _match.Groups["fabricName"].Value; + var protectionContainerName = _match.Groups["protectionContainerName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationFabrics/" + + fabricName + + "/replicationProtectionContainers/" + + protectionContainerName + + "/switchprotection" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationProtectionContainersSwitchProtection_Call(request,onOk,eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationProtectionContainersSwitchProtection_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: default + var _finalUri = _response.GetFirstHeader(@"Location"); + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + if (!string.IsNullOrWhiteSpace(_finalUri)) + { + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ProtectionContainer.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual + /// call, but you will get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Unique fabric name. + /// Protection container name. + /// Switch protection input. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationProtectionContainersSwitchProtection_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionInput body, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(fabricName),fabricName); + await eventListener.AssertNotNull(nameof(protectionContainerName),protectionContainerName); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// The operation to create an ASR replication protection intent item. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// A name for the replication protection item. + /// Create Protection Intent Input. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationProtectionIntentsCreate(string resourceName, string resourceGroupName, string subscriptionId, string intentObjectName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionIntentInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationProtectionIntents/" + + global::System.Uri.EscapeDataString(intentObjectName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationProtectionIntentsCreate_Call(request,onOk,eventListener,sender); + } + } + + /// The operation to create an ASR replication protection intent item. + /// + /// Create Protection Intent Input. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationProtectionIntentsCreateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionIntentInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationProtectionIntents/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationProtectionIntents/{intentObjectName}'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var intentObjectName = _match.Groups["intentObjectName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationProtectionIntents/" + + intentObjectName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationProtectionIntentsCreate_Call(request,onOk,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationProtectionIntentsCreate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProtectionIntent.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you + /// will get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// A name for the replication protection item. + /// Create Protection Intent Input. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationProtectionIntentsCreate_Validate(string resourceName, string resourceGroupName, string subscriptionId, string intentObjectName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionIntentInput body, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(intentObjectName),intentObjectName); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// Gets the details of an ASR replication protection intent. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Replication protection intent name. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationProtectionIntentsGet(string resourceName, string resourceGroupName, string subscriptionId, string intentObjectName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationProtectionIntents/" + + global::System.Uri.EscapeDataString(intentObjectName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationProtectionIntentsGet_Call(request,onOk,eventListener,sender); + } + } + + /// Gets the details of an ASR replication protection intent. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationProtectionIntentsGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationProtectionIntents/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationProtectionIntents/{intentObjectName}'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var intentObjectName = _match.Groups["intentObjectName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationProtectionIntents/" + + intentObjectName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationProtectionIntentsGet_Call(request,onOk,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationProtectionIntentsGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProtectionIntent.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will + /// get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Replication protection intent name. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationProtectionIntentsGet_Validate(string resourceName, string resourceGroupName, string subscriptionId, string intentObjectName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(intentObjectName),intentObjectName); + } + } + + /// Gets the list of ASR replication protection intent objects in the vault. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// The pagination token. + /// The page size. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationProtectionIntentsList(string resourceName, string resourceGroupName, string subscriptionId, string skipToken, string takeToken, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationProtectionIntents" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + + "&" + + (string.IsNullOrEmpty(skipToken) ? global::System.String.Empty : "skipToken=" + global::System.Uri.EscapeDataString(skipToken)) + + "&" + + (string.IsNullOrEmpty(takeToken) ? global::System.String.Empty : "takeToken=" + global::System.Uri.EscapeDataString(takeToken)) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationProtectionIntentsList_Call(request,onOk,eventListener,sender); + } + } + + /// Gets the list of ASR replication protection intent objects in the vault. + /// + /// The pagination token. + /// The page size. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationProtectionIntentsListViaIdentity(global::System.String viaIdentity, string skipToken, string takeToken, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationProtectionIntents$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationProtectionIntents'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationProtectionIntents" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + + "&" + + (string.IsNullOrEmpty(skipToken) ? global::System.String.Empty : "skipToken=" + global::System.Uri.EscapeDataString(skipToken)) + + "&" + + (string.IsNullOrEmpty(takeToken) ? global::System.String.Empty : "takeToken=" + global::System.Uri.EscapeDataString(takeToken)) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationProtectionIntentsList_Call(request,onOk,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationProtectionIntentsList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReplicationProtectionIntentCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you + /// will get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// The pagination token. + /// The page size. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationProtectionIntentsList_Validate(string resourceName, string resourceGroupName, string subscriptionId, string skipToken, string takeToken, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(skipToken),skipToken); + await eventListener.AssertNotNull(nameof(takeToken),takeToken); + } + } + + /// The operation to create a recovery plan. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Recovery plan name. + /// Recovery Plan creation input. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationRecoveryPlansCreate(string resourceName, string resourceGroupName, string subscriptionId, string recoveryPlanName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateRecoveryPlanInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationRecoveryPlans/" + + global::System.Uri.EscapeDataString(recoveryPlanName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationRecoveryPlansCreate_Call(request,onOk,eventListener,sender); + } + } + + /// The operation to create a recovery plan. + /// + /// Recovery Plan creation input. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationRecoveryPlansCreateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateRecoveryPlanInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationRecoveryPlans/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var recoveryPlanName = _match.Groups["recoveryPlanName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationRecoveryPlans/" + + recoveryPlanName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationRecoveryPlansCreate_Call(request,onOk,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationRecoveryPlansCreate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: default + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + if (!string.IsNullOrWhiteSpace(_originalUri)) + { + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_originalUri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlan.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will + /// get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Recovery plan name. + /// Recovery Plan creation input. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationRecoveryPlansCreate_Validate(string resourceName, string resourceGroupName, string subscriptionId, string recoveryPlanName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateRecoveryPlanInput body, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(recoveryPlanName),recoveryPlanName); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// Delete a recovery plan. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Recovery plan name. + /// a delegate that is called when the remote service returns 204 (NoContent). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationRecoveryPlansDelete(string resourceName, string resourceGroupName, string subscriptionId, string recoveryPlanName, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationRecoveryPlans/" + + global::System.Uri.EscapeDataString(recoveryPlanName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Delete, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationRecoveryPlansDelete_Call(request,onNoContent,eventListener,sender); + } + } + + /// Delete a recovery plan. + /// + /// a delegate that is called when the remote service returns 204 (NoContent). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationRecoveryPlansDeleteViaIdentity(global::System.String viaIdentity, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationRecoveryPlans/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var recoveryPlanName = _match.Groups["recoveryPlanName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationRecoveryPlans/" + + recoveryPlanName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Delete, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationRecoveryPlansDelete_Call(request,onNoContent,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 204 (NoContent). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationRecoveryPlansDelete_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: default + var _finalUri = _response.GetFirstHeader(@"Location"); + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + if (!string.IsNullOrWhiteSpace(_finalUri)) + { + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.NoContent: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onNoContent(_response); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will + /// get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Recovery plan name. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationRecoveryPlansDelete_Validate(string resourceName, string resourceGroupName, string subscriptionId, string recoveryPlanName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(recoveryPlanName),recoveryPlanName); + } + } + + /// The operation to cancel the failover of a recovery plan. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Recovery plan name. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationRecoveryPlansFailoverCancel(string resourceName, string resourceGroupName, string subscriptionId, string recoveryPlanName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationRecoveryPlans/" + + global::System.Uri.EscapeDataString(recoveryPlanName) + + "/failoverCancel" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationRecoveryPlansFailoverCancel_Call(request,onOk,eventListener,sender); + } + } + + /// The operation to cancel the failover of a recovery plan. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationRecoveryPlansFailoverCancelViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationRecoveryPlans/(?[^/]+)/failoverCancel$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/failoverCancel'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var recoveryPlanName = _match.Groups["recoveryPlanName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationRecoveryPlans/" + + recoveryPlanName + + "/failoverCancel" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationRecoveryPlansFailoverCancel_Call(request,onOk,eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationRecoveryPlansFailoverCancel_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: default + var _finalUri = _response.GetFirstHeader(@"Location"); + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + if (!string.IsNullOrWhiteSpace(_finalUri)) + { + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlan.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but + /// you will get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Recovery plan name. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationRecoveryPlansFailoverCancel_Validate(string resourceName, string resourceGroupName, string subscriptionId, string recoveryPlanName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(recoveryPlanName),recoveryPlanName); + } + } + + /// The operation to commit the failover of a recovery plan. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Recovery plan name. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationRecoveryPlansFailoverCommit(string resourceName, string resourceGroupName, string subscriptionId, string recoveryPlanName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationRecoveryPlans/" + + global::System.Uri.EscapeDataString(recoveryPlanName) + + "/failoverCommit" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationRecoveryPlansFailoverCommit_Call(request,onOk,eventListener,sender); + } + } + + /// The operation to commit the failover of a recovery plan. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationRecoveryPlansFailoverCommitViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationRecoveryPlans/(?[^/]+)/failoverCommit$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/failoverCommit'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var recoveryPlanName = _match.Groups["recoveryPlanName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationRecoveryPlans/" + + recoveryPlanName + + "/failoverCommit" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationRecoveryPlansFailoverCommit_Call(request,onOk,eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationRecoveryPlansFailoverCommit_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: default + var _finalUri = _response.GetFirstHeader(@"Location"); + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + if (!string.IsNullOrWhiteSpace(_finalUri)) + { + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlan.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but + /// you will get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Recovery plan name. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationRecoveryPlansFailoverCommit_Validate(string resourceName, string resourceGroupName, string subscriptionId, string recoveryPlanName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(recoveryPlanName),recoveryPlanName); + } + } + + /// Gets the details of the recovery plan. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Name of the recovery plan. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationRecoveryPlansGet(string resourceName, string resourceGroupName, string subscriptionId, string recoveryPlanName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationRecoveryPlans/" + + global::System.Uri.EscapeDataString(recoveryPlanName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationRecoveryPlansGet_Call(request,onOk,eventListener,sender); + } + } + + /// Gets the details of the recovery plan. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationRecoveryPlansGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationRecoveryPlans/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var recoveryPlanName = _match.Groups["recoveryPlanName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationRecoveryPlans/" + + recoveryPlanName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationRecoveryPlansGet_Call(request,onOk,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationRecoveryPlansGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlan.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will + /// get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Name of the recovery plan. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationRecoveryPlansGet_Validate(string resourceName, string resourceGroupName, string subscriptionId, string recoveryPlanName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(recoveryPlanName),recoveryPlanName); + } + } + + /// Lists the recovery plans in the vault. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationRecoveryPlansList(string resourceName, string resourceGroupName, string subscriptionId, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationRecoveryPlans" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationRecoveryPlansList_Call(request,onOk,eventListener,sender); + } + } + + /// Lists the recovery plans in the vault. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationRecoveryPlansListViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationRecoveryPlans$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationRecoveryPlans" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationRecoveryPlansList_Call(request,onOk,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationRecoveryPlansList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will + /// get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationRecoveryPlansList_Validate(string resourceName, string resourceGroupName, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + } + } + + /// The operation to start the planned failover of a recovery plan. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Recovery plan name. + /// Failover input. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationRecoveryPlansPlannedFailover(string resourceName, string resourceGroupName, string subscriptionId, string recoveryPlanName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPlannedFailoverInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationRecoveryPlans/" + + global::System.Uri.EscapeDataString(recoveryPlanName) + + "/plannedFailover" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationRecoveryPlansPlannedFailover_Call(request,onOk,eventListener,sender); + } + } + + /// The operation to start the planned failover of a recovery plan. + /// + /// Failover input. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationRecoveryPlansPlannedFailoverViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPlannedFailoverInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationRecoveryPlans/(?[^/]+)/plannedFailover$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/plannedFailover'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var recoveryPlanName = _match.Groups["recoveryPlanName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationRecoveryPlans/" + + recoveryPlanName + + "/plannedFailover" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationRecoveryPlansPlannedFailover_Call(request,onOk,eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationRecoveryPlansPlannedFailover_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: default + var _finalUri = _response.GetFirstHeader(@"Location"); + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + if (!string.IsNullOrWhiteSpace(_finalUri)) + { + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlan.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but + /// you will get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Recovery plan name. + /// Failover input. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationRecoveryPlansPlannedFailover_Validate(string resourceName, string resourceGroupName, string subscriptionId, string recoveryPlanName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPlannedFailoverInput body, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(recoveryPlanName),recoveryPlanName); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// The operation to reprotect(reverse replicate) a recovery plan. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Recovery plan name. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationRecoveryPlansReprotect(string resourceName, string resourceGroupName, string subscriptionId, string recoveryPlanName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationRecoveryPlans/" + + global::System.Uri.EscapeDataString(recoveryPlanName) + + "/reProtect" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationRecoveryPlansReprotect_Call(request,onOk,eventListener,sender); + } + } + + /// The operation to reprotect(reverse replicate) a recovery plan. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationRecoveryPlansReprotectViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationRecoveryPlans/(?[^/]+)/reProtect$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/reProtect'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var recoveryPlanName = _match.Groups["recoveryPlanName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationRecoveryPlans/" + + recoveryPlanName + + "/reProtect" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationRecoveryPlansReprotect_Call(request,onOk,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationRecoveryPlansReprotect_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: default + var _finalUri = _response.GetFirstHeader(@"Location"); + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + if (!string.IsNullOrWhiteSpace(_finalUri)) + { + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlan.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you + /// will get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Recovery plan name. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationRecoveryPlansReprotect_Validate(string resourceName, string resourceGroupName, string subscriptionId, string recoveryPlanName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(recoveryPlanName),recoveryPlanName); + } + } + + /// The operation to start the test failover of a recovery plan. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Recovery plan name. + /// Recovery plan test failover input. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationRecoveryPlansTestFailover(string resourceName, string resourceGroupName, string subscriptionId, string recoveryPlanName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationRecoveryPlans/" + + global::System.Uri.EscapeDataString(recoveryPlanName) + + "/testFailover" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationRecoveryPlansTestFailover_Call(request,onOk,eventListener,sender); + } + } + + /// The operation to cleanup test failover of a recovery plan. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Recovery plan name. + /// Recovery plan test failover cleanup input. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationRecoveryPlansTestFailoverCleanup(string resourceName, string resourceGroupName, string subscriptionId, string recoveryPlanName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverCleanupInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationRecoveryPlans/" + + global::System.Uri.EscapeDataString(recoveryPlanName) + + "/testFailoverCleanup" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationRecoveryPlansTestFailoverCleanup_Call(request,onOk,eventListener,sender); + } + } + + /// The operation to cleanup test failover of a recovery plan. + /// + /// Recovery plan test failover cleanup input. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationRecoveryPlansTestFailoverCleanupViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverCleanupInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationRecoveryPlans/(?[^/]+)/testFailoverCleanup$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/testFailoverCleanup'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var recoveryPlanName = _match.Groups["recoveryPlanName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationRecoveryPlans/" + + recoveryPlanName + + "/testFailoverCleanup" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationRecoveryPlansTestFailoverCleanup_Call(request,onOk,eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationRecoveryPlansTestFailoverCleanup_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: default + var _finalUri = _response.GetFirstHeader(@"Location"); + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + if (!string.IsNullOrWhiteSpace(_finalUri)) + { + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlan.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, + /// but you will get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Recovery plan name. + /// Recovery plan test failover cleanup input. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationRecoveryPlansTestFailoverCleanup_Validate(string resourceName, string resourceGroupName, string subscriptionId, string recoveryPlanName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverCleanupInput body, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(recoveryPlanName),recoveryPlanName); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// The operation to start the test failover of a recovery plan. + /// + /// Recovery plan test failover input. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationRecoveryPlansTestFailoverViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationRecoveryPlans/(?[^/]+)/testFailover$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/testFailover'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var recoveryPlanName = _match.Groups["recoveryPlanName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationRecoveryPlans/" + + recoveryPlanName + + "/testFailover" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationRecoveryPlansTestFailover_Call(request,onOk,eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationRecoveryPlansTestFailover_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: default + var _finalUri = _response.GetFirstHeader(@"Location"); + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + if (!string.IsNullOrWhiteSpace(_finalUri)) + { + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlan.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but + /// you will get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Recovery plan name. + /// Recovery plan test failover input. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationRecoveryPlansTestFailover_Validate(string resourceName, string resourceGroupName, string subscriptionId, string recoveryPlanName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverInput body, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(recoveryPlanName),recoveryPlanName); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// The operation to start the unplanned failover of a recovery plan. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Recovery plan name. + /// Recovery plan unplanned failover input. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationRecoveryPlansUnplannedFailover(string resourceName, string resourceGroupName, string subscriptionId, string recoveryPlanName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanUnplannedFailoverInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationRecoveryPlans/" + + global::System.Uri.EscapeDataString(recoveryPlanName) + + "/unplannedFailover" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationRecoveryPlansUnplannedFailover_Call(request,onOk,eventListener,sender); + } + } + + /// The operation to start the unplanned failover of a recovery plan. + /// + /// Recovery plan unplanned failover input. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationRecoveryPlansUnplannedFailoverViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanUnplannedFailoverInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationRecoveryPlans/(?[^/]+)/unplannedFailover$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/unplannedFailover'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var recoveryPlanName = _match.Groups["recoveryPlanName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationRecoveryPlans/" + + recoveryPlanName + + "/unplannedFailover" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationRecoveryPlansUnplannedFailover_Call(request,onOk,eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationRecoveryPlansUnplannedFailover_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: default + var _finalUri = _response.GetFirstHeader(@"Location"); + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + if (!string.IsNullOrWhiteSpace(_finalUri)) + { + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlan.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, + /// but you will get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Recovery plan name. + /// Recovery plan unplanned failover input. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationRecoveryPlansUnplannedFailover_Validate(string resourceName, string resourceGroupName, string subscriptionId, string recoveryPlanName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanUnplannedFailoverInput body, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(recoveryPlanName),recoveryPlanName); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// The operation to update a recovery plan. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Recovery plan name. + /// Update recovery plan input. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationRecoveryPlansUpdate(string resourceName, string resourceGroupName, string subscriptionId, string recoveryPlanName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateRecoveryPlanInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationRecoveryPlans/" + + global::System.Uri.EscapeDataString(recoveryPlanName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationRecoveryPlansUpdate_Call(request,onOk,eventListener,sender); + } + } + + /// The operation to update a recovery plan. + /// + /// Update recovery plan input. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationRecoveryPlansUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateRecoveryPlanInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationRecoveryPlans/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var recoveryPlanName = _match.Groups["recoveryPlanName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationRecoveryPlans/" + + recoveryPlanName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationRecoveryPlansUpdate_Call(request,onOk,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationRecoveryPlansUpdate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: default + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + if (!string.IsNullOrWhiteSpace(_originalUri)) + { + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_originalUri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlan.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will + /// get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Recovery plan name. + /// Update recovery plan input. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationRecoveryPlansUpdate_Validate(string resourceName, string resourceGroupName, string subscriptionId, string recoveryPlanName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateRecoveryPlanInput body, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(recoveryPlanName),recoveryPlanName); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// The operation to add a recovery services provider. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Fabric name. + /// Recovery services provider name. + /// Add provider input. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationRecoveryServicesProvidersCreate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string providerName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + + "/replicationRecoveryServicesProviders/" + + global::System.Uri.EscapeDataString(providerName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationRecoveryServicesProvidersCreate_Call(request,onOk,eventListener,sender); + } + } + + /// The operation to add a recovery services provider. + /// + /// Add provider input. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationRecoveryServicesProvidersCreateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationFabrics/(?[^/]+)/replicationRecoveryServicesProviders/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders/{providerName}'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var fabricName = _match.Groups["fabricName"].Value; + var providerName = _match.Groups["providerName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationFabrics/" + + fabricName + + "/replicationRecoveryServicesProviders/" + + providerName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationRecoveryServicesProvidersCreate_Call(request,onOk,eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationRecoveryServicesProvidersCreate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: default + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + if (!string.IsNullOrWhiteSpace(_originalUri)) + { + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_originalUri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryServicesProvider.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, + /// but you will get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Fabric name. + /// Recovery services provider name. + /// Add provider input. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationRecoveryServicesProvidersCreate_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string providerName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInput body, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(fabricName),fabricName); + await eventListener.AssertNotNull(nameof(providerName),providerName); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// + /// The operation to removes/delete(unregister) a recovery services provider from the vault. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Fabric name. + /// Recovery services provider name. + /// a delegate that is called when the remote service returns 204 (NoContent). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationRecoveryServicesProvidersDelete(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string providerName, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + + "/replicationRecoveryServicesProviders/" + + global::System.Uri.EscapeDataString(providerName) + + "/remove" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationRecoveryServicesProvidersDelete_Call(request,onNoContent,eventListener,sender); + } + } + + /// + /// The operation to removes/delete(unregister) a recovery services provider from the vault. + /// + /// + /// a delegate that is called when the remote service returns 204 (NoContent). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationRecoveryServicesProvidersDeleteViaIdentity(global::System.String viaIdentity, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationFabrics/(?[^/]+)/replicationRecoveryServicesProviders/(?[^/]+)/remove$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders/{providerName}/remove'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var fabricName = _match.Groups["fabricName"].Value; + var providerName = _match.Groups["providerName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationFabrics/" + + fabricName + + "/replicationRecoveryServicesProviders/" + + providerName + + "/remove" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationRecoveryServicesProvidersDelete_Call(request,onNoContent,eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 204 (NoContent). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationRecoveryServicesProvidersDelete_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: default + var _finalUri = _response.GetFirstHeader(@"Location"); + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + if (!string.IsNullOrWhiteSpace(_finalUri)) + { + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.NoContent: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onNoContent(_response); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, + /// but you will get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Fabric name. + /// Recovery services provider name. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationRecoveryServicesProvidersDelete_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string providerName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(fabricName),fabricName); + await eventListener.AssertNotNull(nameof(providerName),providerName); + } + } + + /// Gets the details of registered recovery services provider. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Fabric name. + /// Recovery services provider name. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationRecoveryServicesProvidersGet(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string providerName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + + "/replicationRecoveryServicesProviders/" + + global::System.Uri.EscapeDataString(providerName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationRecoveryServicesProvidersGet_Call(request,onOk,eventListener,sender); + } + } + + /// Gets the details of registered recovery services provider. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationRecoveryServicesProvidersGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationFabrics/(?[^/]+)/replicationRecoveryServicesProviders/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders/{providerName}'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var fabricName = _match.Groups["fabricName"].Value; + var providerName = _match.Groups["providerName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationFabrics/" + + fabricName + + "/replicationRecoveryServicesProviders/" + + providerName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationRecoveryServicesProvidersGet_Call(request,onOk,eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationRecoveryServicesProvidersGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryServicesProvider.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but + /// you will get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Fabric name. + /// Recovery services provider name. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationRecoveryServicesProvidersGet_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string providerName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(fabricName),fabricName); + await eventListener.AssertNotNull(nameof(providerName),providerName); + } + } + + /// Lists the registered recovery services providers in the vault. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationRecoveryServicesProvidersList(string resourceName, string resourceGroupName, string subscriptionId, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationRecoveryServicesProviders" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationRecoveryServicesProvidersList_Call(request,onOk,eventListener,sender); + } + } + + /// Lists the registered recovery services providers for the specified fabric. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Fabric name. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationRecoveryServicesProvidersListByReplicationFabrics(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + + "/replicationRecoveryServicesProviders" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationRecoveryServicesProvidersListByReplicationFabrics_Call(request,onOk,eventListener,sender); + } + } + + /// Lists the registered recovery services providers for the specified fabric. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationRecoveryServicesProvidersListByReplicationFabricsViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationFabrics/(?[^/]+)/replicationRecoveryServicesProviders$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var fabricName = _match.Groups["fabricName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationFabrics/" + + fabricName + + "/replicationRecoveryServicesProviders" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationRecoveryServicesProvidersListByReplicationFabrics_Call(request,onOk,eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationRecoveryServicesProvidersListByReplicationFabrics_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryServicesProviderCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like + /// the actual call, but you will get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Fabric name. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationRecoveryServicesProvidersListByReplicationFabrics_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(fabricName),fabricName); + } + } + + /// Lists the registered recovery services providers in the vault. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationRecoveryServicesProvidersListViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationRecoveryServicesProviders$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryServicesProviders'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationRecoveryServicesProviders" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationRecoveryServicesProvidersList_Call(request,onOk,eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationRecoveryServicesProvidersList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryServicesProviderCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, + /// but you will get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationRecoveryServicesProvidersList_Validate(string resourceName, string resourceGroupName, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + } + } + + /// + /// The operation to purge(force delete) a recovery services provider from the vault. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Fabric name. + /// Recovery services provider name. + /// a delegate that is called when the remote service returns 204 (NoContent). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationRecoveryServicesProvidersPurge(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string providerName, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + + "/replicationRecoveryServicesProviders/" + + global::System.Uri.EscapeDataString(providerName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Delete, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationRecoveryServicesProvidersPurge_Call(request,onNoContent,eventListener,sender); + } + } + + /// + /// The operation to purge(force delete) a recovery services provider from the vault. + /// + /// + /// a delegate that is called when the remote service returns 204 (NoContent). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationRecoveryServicesProvidersPurgeViaIdentity(global::System.String viaIdentity, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationFabrics/(?[^/]+)/replicationRecoveryServicesProviders/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders/{providerName}'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var fabricName = _match.Groups["fabricName"].Value; + var providerName = _match.Groups["providerName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationFabrics/" + + fabricName + + "/replicationRecoveryServicesProviders/" + + providerName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Delete, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationRecoveryServicesProvidersPurge_Call(request,onNoContent,eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 204 (NoContent). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationRecoveryServicesProvidersPurge_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: default + var _finalUri = _response.GetFirstHeader(@"Location"); + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + if (!string.IsNullOrWhiteSpace(_finalUri)) + { + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.NoContent: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onNoContent(_response); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, + /// but you will get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Fabric name. + /// Recovery services provider name. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationRecoveryServicesProvidersPurge_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string providerName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(fabricName),fabricName); + await eventListener.AssertNotNull(nameof(providerName),providerName); + } + } + + /// The operation to refresh the information from the recovery services provider. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Fabric name. + /// Recovery services provider name. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationRecoveryServicesProvidersRefreshProvider(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string providerName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + + "/replicationRecoveryServicesProviders/" + + global::System.Uri.EscapeDataString(providerName) + + "/refreshProvider" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationRecoveryServicesProvidersRefreshProvider_Call(request,onOk,eventListener,sender); + } + } + + /// The operation to refresh the information from the recovery services provider. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationRecoveryServicesProvidersRefreshProviderViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationFabrics/(?[^/]+)/replicationRecoveryServicesProviders/(?[^/]+)/refreshProvider$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders/{providerName}/refreshProvider'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var fabricName = _match.Groups["fabricName"].Value; + var providerName = _match.Groups["providerName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationFabrics/" + + fabricName + + "/replicationRecoveryServicesProviders/" + + providerName + + "/refreshProvider" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationRecoveryServicesProvidersRefreshProvider_Call(request,onOk,eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationRecoveryServicesProvidersRefreshProvider_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: default + var _finalUri = _response.GetFirstHeader(@"Location"); + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + if (!string.IsNullOrWhiteSpace(_finalUri)) + { + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryServicesProvider.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual + /// call, but you will get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Fabric name. + /// Recovery services provider name. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationRecoveryServicesProvidersRefreshProvider_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string providerName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(fabricName),fabricName); + await eventListener.AssertNotNull(nameof(providerName),providerName); + } + } + + /// The operation to create a storage classification mapping. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Fabric name. + /// Storage classification name. + /// Storage classification mapping name. + /// Pairing input. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationStorageClassificationMappingsCreate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string storageClassificationName, string storageClassificationMappingName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMappingInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + + "/replicationStorageClassifications/" + + global::System.Uri.EscapeDataString(storageClassificationName) + + "/replicationStorageClassificationMappings/" + + global::System.Uri.EscapeDataString(storageClassificationMappingName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationStorageClassificationMappingsCreate_Call(request,onOk,eventListener,sender); + } + } + + /// The operation to create a storage classification mapping. + /// + /// Pairing input. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationStorageClassificationMappingsCreateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMappingInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationFabrics/(?[^/]+)/replicationStorageClassifications/(?[^/]+)/replicationStorageClassificationMappings/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationStorageClassifications/{storageClassificationName}/replicationStorageClassificationMappings/{storageClassificationMappingName}'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var fabricName = _match.Groups["fabricName"].Value; + var storageClassificationName = _match.Groups["storageClassificationName"].Value; + var storageClassificationMappingName = _match.Groups["storageClassificationMappingName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationFabrics/" + + fabricName + + "/replicationStorageClassifications/" + + storageClassificationName + + "/replicationStorageClassificationMappings/" + + storageClassificationMappingName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationStorageClassificationMappingsCreate_Call(request,onOk,eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationStorageClassificationMappingsCreate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: default + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + if (!string.IsNullOrWhiteSpace(_originalUri)) + { + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_originalUri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.StorageClassificationMapping.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual + /// call, but you will get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Fabric name. + /// Storage classification name. + /// Storage classification mapping name. + /// Pairing input. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationStorageClassificationMappingsCreate_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string storageClassificationName, string storageClassificationMappingName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMappingInput body, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(fabricName),fabricName); + await eventListener.AssertNotNull(nameof(storageClassificationName),storageClassificationName); + await eventListener.AssertNotNull(nameof(storageClassificationMappingName),storageClassificationMappingName); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// The operation to delete a storage classification mapping. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Fabric name. + /// Storage classification name. + /// Storage classification mapping name. + /// a delegate that is called when the remote service returns 204 (NoContent). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationStorageClassificationMappingsDelete(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string storageClassificationName, string storageClassificationMappingName, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + + "/replicationStorageClassifications/" + + global::System.Uri.EscapeDataString(storageClassificationName) + + "/replicationStorageClassificationMappings/" + + global::System.Uri.EscapeDataString(storageClassificationMappingName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Delete, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationStorageClassificationMappingsDelete_Call(request,onNoContent,eventListener,sender); + } + } + + /// The operation to delete a storage classification mapping. + /// + /// a delegate that is called when the remote service returns 204 (NoContent). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationStorageClassificationMappingsDeleteViaIdentity(global::System.String viaIdentity, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationFabrics/(?[^/]+)/replicationStorageClassifications/(?[^/]+)/replicationStorageClassificationMappings/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationStorageClassifications/{storageClassificationName}/replicationStorageClassificationMappings/{storageClassificationMappingName}'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var fabricName = _match.Groups["fabricName"].Value; + var storageClassificationName = _match.Groups["storageClassificationName"].Value; + var storageClassificationMappingName = _match.Groups["storageClassificationMappingName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationFabrics/" + + fabricName + + "/replicationStorageClassifications/" + + storageClassificationName + + "/replicationStorageClassificationMappings/" + + storageClassificationMappingName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Delete, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationStorageClassificationMappingsDelete_Call(request,onNoContent,eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 204 (NoContent). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationStorageClassificationMappingsDelete_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: default + var _finalUri = _response.GetFirstHeader(@"Location"); + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + if (!string.IsNullOrWhiteSpace(_finalUri)) + { + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.NoContent: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onNoContent(_response); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual + /// call, but you will get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Fabric name. + /// Storage classification name. + /// Storage classification mapping name. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationStorageClassificationMappingsDelete_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string storageClassificationName, string storageClassificationMappingName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(fabricName),fabricName); + await eventListener.AssertNotNull(nameof(storageClassificationName),storageClassificationName); + await eventListener.AssertNotNull(nameof(storageClassificationMappingName),storageClassificationMappingName); + } + } + + /// Gets the details of the specified storage classification mapping. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Fabric name. + /// Storage classification name. + /// Storage classification mapping name. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationStorageClassificationMappingsGet(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string storageClassificationName, string storageClassificationMappingName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + + "/replicationStorageClassifications/" + + global::System.Uri.EscapeDataString(storageClassificationName) + + "/replicationStorageClassificationMappings/" + + global::System.Uri.EscapeDataString(storageClassificationMappingName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationStorageClassificationMappingsGet_Call(request,onOk,eventListener,sender); + } + } + + /// Gets the details of the specified storage classification mapping. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationStorageClassificationMappingsGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationFabrics/(?[^/]+)/replicationStorageClassifications/(?[^/]+)/replicationStorageClassificationMappings/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationStorageClassifications/{storageClassificationName}/replicationStorageClassificationMappings/{storageClassificationMappingName}'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var fabricName = _match.Groups["fabricName"].Value; + var storageClassificationName = _match.Groups["storageClassificationName"].Value; + var storageClassificationMappingName = _match.Groups["storageClassificationMappingName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationFabrics/" + + fabricName + + "/replicationStorageClassifications/" + + storageClassificationName + + "/replicationStorageClassificationMappings/" + + storageClassificationMappingName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationStorageClassificationMappingsGet_Call(request,onOk,eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationStorageClassificationMappingsGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.StorageClassificationMapping.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, + /// but you will get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Fabric name. + /// Storage classification name. + /// Storage classification mapping name. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationStorageClassificationMappingsGet_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string storageClassificationName, string storageClassificationMappingName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(fabricName),fabricName); + await eventListener.AssertNotNull(nameof(storageClassificationName),storageClassificationName); + await eventListener.AssertNotNull(nameof(storageClassificationMappingName),storageClassificationMappingName); + } + } + + /// Lists the storage classification mappings in the vault. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationStorageClassificationMappingsList(string resourceName, string resourceGroupName, string subscriptionId, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationStorageClassificationMappings" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationStorageClassificationMappingsList_Call(request,onOk,eventListener,sender); + } + } + + /// Lists the storage classification mappings for the fabric. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Fabric name. + /// Storage classification name. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationStorageClassificationMappingsListByReplicationStorageClassifications(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string storageClassificationName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + + "/replicationStorageClassifications/" + + global::System.Uri.EscapeDataString(storageClassificationName) + + "/replicationStorageClassificationMappings" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationStorageClassificationMappingsListByReplicationStorageClassifications_Call(request,onOk,eventListener,sender); + } + } + + /// Lists the storage classification mappings for the fabric. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationStorageClassificationMappingsListByReplicationStorageClassificationsViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationFabrics/(?[^/]+)/replicationStorageClassifications/(?[^/]+)/replicationStorageClassificationMappings$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationStorageClassifications/{storageClassificationName}/replicationStorageClassificationMappings'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var fabricName = _match.Groups["fabricName"].Value; + var storageClassificationName = _match.Groups["storageClassificationName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationFabrics/" + + fabricName + + "/replicationStorageClassifications/" + + storageClassificationName + + "/replicationStorageClassificationMappings" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationStorageClassificationMappingsListByReplicationStorageClassifications_Call(request,onOk,eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationStorageClassificationMappingsListByReplicationStorageClassifications_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.StorageClassificationMappingCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. + /// Call this like the actual call, but you will get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Fabric name. + /// Storage classification name. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationStorageClassificationMappingsListByReplicationStorageClassifications_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string storageClassificationName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(fabricName),fabricName); + await eventListener.AssertNotNull(nameof(storageClassificationName),storageClassificationName); + } + } + + /// Lists the storage classification mappings in the vault. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationStorageClassificationMappingsListViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationStorageClassificationMappings$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationStorageClassificationMappings'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationStorageClassificationMappings" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationStorageClassificationMappingsList_Call(request,onOk,eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationStorageClassificationMappingsList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.StorageClassificationMappingCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, + /// but you will get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationStorageClassificationMappingsList_Validate(string resourceName, string resourceGroupName, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + } + } + + /// Gets the details of the specified storage classification. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Fabric name. + /// Storage classification name. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationStorageClassificationsGet(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string storageClassificationName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + + "/replicationStorageClassifications/" + + global::System.Uri.EscapeDataString(storageClassificationName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationStorageClassificationsGet_Call(request,onOk,eventListener,sender); + } + } + + /// Gets the details of the specified storage classification. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationStorageClassificationsGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationFabrics/(?[^/]+)/replicationStorageClassifications/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationStorageClassifications/{storageClassificationName}'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var fabricName = _match.Groups["fabricName"].Value; + var storageClassificationName = _match.Groups["storageClassificationName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationFabrics/" + + fabricName + + "/replicationStorageClassifications/" + + storageClassificationName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationStorageClassificationsGet_Call(request,onOk,eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationStorageClassificationsGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.StorageClassification.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but + /// you will get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Fabric name. + /// Storage classification name. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationStorageClassificationsGet_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string storageClassificationName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(fabricName),fabricName); + await eventListener.AssertNotNull(nameof(storageClassificationName),storageClassificationName); + } + } + + /// Lists the storage classifications in the vault. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationStorageClassificationsList(string resourceName, string resourceGroupName, string subscriptionId, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationStorageClassifications" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationStorageClassificationsList_Call(request,onOk,eventListener,sender); + } + } + + /// Lists the storage classifications available in the specified fabric. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Site name of interest. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationStorageClassificationsListByReplicationFabrics(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + + "/replicationStorageClassifications" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationStorageClassificationsListByReplicationFabrics_Call(request,onOk,eventListener,sender); + } + } + + /// Lists the storage classifications available in the specified fabric. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationStorageClassificationsListByReplicationFabricsViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationFabrics/(?[^/]+)/replicationStorageClassifications$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationStorageClassifications'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var fabricName = _match.Groups["fabricName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationFabrics/" + + fabricName + + "/replicationStorageClassifications" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationStorageClassificationsListByReplicationFabrics_Call(request,onOk,eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationStorageClassificationsListByReplicationFabrics_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.StorageClassificationCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like + /// the actual call, but you will get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Site name of interest. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationStorageClassificationsListByReplicationFabrics_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(fabricName),fabricName); + } + } + + /// Lists the storage classifications in the vault. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationStorageClassificationsListViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationStorageClassifications$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationStorageClassifications'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationStorageClassifications" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationStorageClassificationsList_Call(request,onOk,eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationStorageClassificationsList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.StorageClassificationCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but + /// you will get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationStorageClassificationsList_Validate(string resourceName, string resourceGroupName, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + } + } + + /// Gets the health details of the vault. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationVaultHealthGet(string resourceName, string resourceGroupName, string subscriptionId, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationVaultHealth" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationVaultHealthGet_Call(request,onOk,eventListener,sender); + } + } + + /// Gets the health details of the vault. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationVaultHealthGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationVaultHealth$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationVaultHealth'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationVaultHealth" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationVaultHealthGet_Call(request,onOk,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationVaultHealthGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VaultHealthDetails.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get + /// validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationVaultHealthGet_Validate(string resourceName, string resourceGroupName, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + } + } + + /// Refreshes health summary of the vault. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationVaultHealthRefresh(string resourceName, string resourceGroupName, string subscriptionId, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationVaultHealth/default/refresh" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationVaultHealthRefresh_Call(request,onOk,eventListener,sender); + } + } + + /// Refreshes health summary of the vault. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationVaultHealthRefreshViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationVaultHealth/default/refresh$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationVaultHealth/default/refresh'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationVaultHealth/default/refresh" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationVaultHealthRefresh_Call(request,onOk,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationVaultHealthRefresh_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: default + var _finalUri = _response.GetFirstHeader(@"Location"); + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + if (!string.IsNullOrWhiteSpace(_finalUri)) + { + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VaultHealthDetails.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will + /// get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationVaultHealthRefresh_Validate(string resourceName, string resourceGroupName, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + } + } + + /// The operation to configure vault setting. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Vault setting name. + /// Vault setting creation input. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationVaultSettingCreate(string resourceName, string resourceGroupName, string subscriptionId, string vaultSettingName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingCreationInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationVaultSettings/" + + global::System.Uri.EscapeDataString(vaultSettingName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationVaultSettingCreate_Call(request,onOk,eventListener,sender); + } + } + + /// The operation to configure vault setting. + /// + /// Vault setting creation input. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationVaultSettingCreateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingCreationInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationVaultSettings/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationVaultSettings/{vaultSettingName}'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var vaultSettingName = _match.Groups["vaultSettingName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationVaultSettings/" + + vaultSettingName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationVaultSettingCreate_Call(request,onOk,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationVaultSettingCreate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: default + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + if (!string.IsNullOrWhiteSpace(_originalUri)) + { + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_originalUri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VaultSetting.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will + /// get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Vault setting name. + /// Vault setting creation input. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationVaultSettingCreate_Validate(string resourceName, string resourceGroupName, string subscriptionId, string vaultSettingName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingCreationInput body, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(vaultSettingName),vaultSettingName); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// Gets the vault setting. This includes the Migration Hub connection settings. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Vault setting name. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationVaultSettingGet(string resourceName, string resourceGroupName, string subscriptionId, string vaultSettingName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationVaultSettings/" + + global::System.Uri.EscapeDataString(vaultSettingName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationVaultSettingGet_Call(request,onOk,eventListener,sender); + } + } + + /// Gets the vault setting. This includes the Migration Hub connection settings. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationVaultSettingGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationVaultSettings/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationVaultSettings/{vaultSettingName}'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var vaultSettingName = _match.Groups["vaultSettingName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationVaultSettings/" + + vaultSettingName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationVaultSettingGet_Call(request,onOk,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationVaultSettingGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VaultSetting.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get + /// validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Vault setting name. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationVaultSettingGet_Validate(string resourceName, string resourceGroupName, string subscriptionId, string vaultSettingName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(vaultSettingName),vaultSettingName); + } + } + + /// + /// Gets the list of vault setting. This includes the Migration Hub connection settings. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationVaultSettingList(string resourceName, string resourceGroupName, string subscriptionId, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationVaultSettings" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationVaultSettingList_Call(request,onOk,eventListener,sender); + } + } + + /// + /// Gets the list of vault setting. This includes the Migration Hub connection settings. + /// + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationVaultSettingListViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationVaultSettings$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationVaultSettings'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationVaultSettings" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationVaultSettingList_Call(request,onOk,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationVaultSettingList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VaultSettingCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will + /// get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationVaultSettingList_Validate(string resourceName, string resourceGroupName, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + } + } + + /// The operation to create a vCenter object.. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Fabric name. + /// vcenter name. + /// The input to the add vCenter operation. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationvCentersCreate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string vcenterName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddVCenterRequest body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + + "/replicationvCenters/" + + global::System.Uri.EscapeDataString(vcenterName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationvCentersCreate_Call(request,onOk,eventListener,sender); + } + } + + /// The operation to create a vCenter object.. + /// + /// The input to the add vCenter operation. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationvCentersCreateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddVCenterRequest body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationFabrics/(?[^/]+)/replicationvCenters/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationvCenters/{vcenterName}'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var fabricName = _match.Groups["fabricName"].Value; + var vcenterName = _match.Groups["vcenterName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationFabrics/" + + fabricName + + "/replicationvCenters/" + + vcenterName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationvCentersCreate_Call(request,onOk,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationvCentersCreate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: default + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + if (!string.IsNullOrWhiteSpace(_originalUri)) + { + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_originalUri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VCenter.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get + /// validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Fabric name. + /// vcenter name. + /// The input to the add vCenter operation. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationvCentersCreate_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string vcenterName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddVCenterRequest body, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(fabricName),fabricName); + await eventListener.AssertNotNull(nameof(vcenterName),vcenterName); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// The operation to remove(unregister) a registered vCenter server from the vault. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Fabric name. + /// vcenter name. + /// a delegate that is called when the remote service returns 204 (NoContent). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationvCentersDelete(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string vcenterName, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + + "/replicationvCenters/" + + global::System.Uri.EscapeDataString(vcenterName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Delete, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationvCentersDelete_Call(request,onNoContent,eventListener,sender); + } + } + + /// The operation to remove(unregister) a registered vCenter server from the vault. + /// + /// a delegate that is called when the remote service returns 204 (NoContent). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationvCentersDeleteViaIdentity(global::System.String viaIdentity, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationFabrics/(?[^/]+)/replicationvCenters/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationvCenters/{vcenterName}'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var fabricName = _match.Groups["fabricName"].Value; + var vcenterName = _match.Groups["vcenterName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationFabrics/" + + fabricName + + "/replicationvCenters/" + + vcenterName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Delete, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationvCentersDelete_Call(request,onNoContent,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 204 (NoContent). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationvCentersDelete_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: default + var _finalUri = _response.GetFirstHeader(@"Location"); + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + if (!string.IsNullOrWhiteSpace(_finalUri)) + { + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.NoContent: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onNoContent(_response); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get + /// validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Fabric name. + /// vcenter name. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationvCentersDelete_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string vcenterName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(fabricName),fabricName); + await eventListener.AssertNotNull(nameof(vcenterName),vcenterName); + } + } + + /// Gets the details of a registered vCenter server(Add vCenter server). + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Fabric name. + /// vcenter name. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationvCentersGet(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string vcenterName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + + "/replicationvCenters/" + + global::System.Uri.EscapeDataString(vcenterName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationvCentersGet_Call(request,onOk,eventListener,sender); + } + } + + /// Gets the details of a registered vCenter server(Add vCenter server). + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationvCentersGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationFabrics/(?[^/]+)/replicationvCenters/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationvCenters/{vcenterName}'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var fabricName = _match.Groups["fabricName"].Value; + var vcenterName = _match.Groups["vcenterName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationFabrics/" + + fabricName + + "/replicationvCenters/" + + vcenterName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationvCentersGet_Call(request,onOk,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationvCentersGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VCenter.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Fabric name. + /// vcenter name. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationvCentersGet_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string vcenterName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(fabricName),fabricName); + await eventListener.AssertNotNull(nameof(vcenterName),vcenterName); + } + } + + /// Lists the vCenter servers registered in the vault. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationvCentersList(string resourceName, string resourceGroupName, string subscriptionId, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationvCenters" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationvCentersList_Call(request,onOk,eventListener,sender); + } + } + + /// Lists the vCenter servers registered in a fabric. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Fabric name. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationvCentersListByReplicationFabrics(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + + "/replicationvCenters" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationvCentersListByReplicationFabrics_Call(request,onOk,eventListener,sender); + } + } + + /// Lists the vCenter servers registered in a fabric. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationvCentersListByReplicationFabricsViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationFabrics/(?[^/]+)/replicationvCenters$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationvCenters'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var fabricName = _match.Groups["fabricName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationFabrics/" + + fabricName + + "/replicationvCenters" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationvCentersListByReplicationFabrics_Call(request,onOk,eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationvCentersListByReplicationFabrics_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VCenterCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, + /// but you will get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Fabric name. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationvCentersListByReplicationFabrics_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(fabricName),fabricName); + } + } + + /// Lists the vCenter servers registered in the vault. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationvCentersListViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationvCenters$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationvCenters'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationvCenters" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationvCentersList_Call(request,onOk,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationvCentersList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VCenterCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get + /// validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationvCentersList_Validate(string resourceName, string resourceGroupName, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + } + } + + /// The operation to update a registered vCenter. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Fabric name. + /// vcenter name. + /// The input to the update vCenter operation. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationvCentersUpdate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string vcenterName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateVCenterRequest body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + + "/replicationvCenters/" + + global::System.Uri.EscapeDataString(vcenterName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationvCentersUpdate_Call(request,onOk,eventListener,sender); + } + } + + /// The operation to update a registered vCenter. + /// + /// The input to the update vCenter operation. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationvCentersUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateVCenterRequest body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationFabrics/(?[^/]+)/replicationvCenters/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationvCenters/{vcenterName}'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var fabricName = _match.Groups["fabricName"].Value; + var vcenterName = _match.Groups["vcenterName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationFabrics/" + + fabricName + + "/replicationvCenters/" + + vcenterName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationvCentersUpdate_Call(request,onOk,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationvCentersUpdate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: default + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (request.Method == System.Net.Http.HttpMethod.Put && _response.StatusCode == global::System.Net.HttpStatusCode.OK || _response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + var error = false; + try { + if( Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + if (error) { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + if (!string.IsNullOrWhiteSpace(_originalUri)) + { + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_originalUri), Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VCenter.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get + /// validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Fabric name. + /// vcenter name. + /// The input to the update vCenter operation. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task ReplicationvCentersUpdate_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string vcenterName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateVCenterRequest body, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(fabricName),fabricName); + await eventListener.AssertNotNull(nameof(vcenterName),vcenterName); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// Gets the data of supported operating systems by SRS. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// The instance type. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task SupportedOperatingSystemsGet(string resourceName, string resourceGroupName, string subscriptionId, string instanceType, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationSupportedOperatingSystems" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + + "&" + + (string.IsNullOrEmpty(instanceType) ? global::System.String.Empty : "instanceType=" + global::System.Uri.EscapeDataString(instanceType)) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.SupportedOperatingSystemsGet_Call(request,onOk,eventListener,sender); + } + } + + /// Gets the data of supported operating systems by SRS. + /// + /// The instance type. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task SupportedOperatingSystemsGetViaIdentity(global::System.String viaIdentity, string instanceType, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationSupportedOperatingSystems$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationSupportedOperatingSystems'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationSupportedOperatingSystems" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + + "&" + + (string.IsNullOrEmpty(instanceType) ? global::System.String.Empty : "instanceType=" + global::System.Uri.EscapeDataString(instanceType)) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.SupportedOperatingSystemsGet_Call(request,onOk,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task SupportedOperatingSystemsGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.SupportedOperatingSystems.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will + /// get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// The instance type. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task SupportedOperatingSystemsGet_Validate(string resourceName, string resourceGroupName, string subscriptionId, string instanceType, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(instanceType),instanceType); + } + } + + /// Lists the available target compute sizes for a replication protected item. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Fabric name. + /// protection container name. + /// Replication protected item name. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task TargetComputeSizesListByReplicationProtectedItems(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string replicatedProtectedItemName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.RecoveryServices/vaults/" + + global::System.Uri.EscapeDataString(resourceName) + + "/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + + "/replicationProtectionContainers/" + + global::System.Uri.EscapeDataString(protectionContainerName) + + "/replicationProtectedItems/" + + global::System.Uri.EscapeDataString(replicatedProtectedItemName) + + "/targetComputeSizes" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.TargetComputeSizesListByReplicationProtectedItems_Call(request,onOk,eventListener,sender); + } + } + + /// Lists the available target compute sizes for a replication protected item. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task TargetComputeSizesListByReplicationProtectedItemsViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.RecoveryServices/vaults/(?[^/]+)/replicationFabrics/(?[^/]+)/replicationProtectionContainers/(?[^/]+)/replicationProtectedItems/(?[^/]+)/targetComputeSizes$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/targetComputeSizes'"); + } + + // replace URI parameters with values from identity + var resourceName = _match.Groups["resourceName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var fabricName = _match.Groups["fabricName"].Value; + var protectionContainerName = _match.Groups["protectionContainerName"].Value; + var replicatedProtectedItemName = _match.Groups["replicatedProtectedItemName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationFabrics/" + + fabricName + + "/replicationProtectionContainers/" + + protectionContainerName + + "/replicationProtectedItems/" + + replicatedProtectedItemName + + "/targetComputeSizes" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.TargetComputeSizesListByReplicationProtectedItems_Call(request,onOk,eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task TargetComputeSizesListByReplicationProtectedItems_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.TargetComputeSizeCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual + /// call, but you will get validation events back. + /// + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// The subscription Id. + /// Fabric name. + /// protection container name. + /// Replication protected item name. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task TargetComputeSizesListByReplicationProtectedItems_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string replicatedProtectedItemName, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceName),resourceName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(fabricName),fabricName); + await eventListener.AssertNotNull(nameof(protectionContainerName),protectionContainerName); + await eventListener.AssertNotNull(nameof(replicatedProtectedItemName),replicatedProtectedItemName); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/A2ARecoveryAvailabilityType.Completer.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/A2ARecoveryAvailabilityType.Completer.cs new file mode 100644 index 000000000000..c706767d186b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/A2ARecoveryAvailabilityType.Completer.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// The recovery availability type of the virtual machine. + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.A2ARecoveryAvailabilityTypeTypeConverter))] + public partial struct A2ARecoveryAvailabilityType : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Single".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Single'", "Single", global::System.Management.Automation.CompletionResultType.ParameterValue, "Single"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "AvailabilitySet".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'AvailabilitySet'", "AvailabilitySet", global::System.Management.Automation.CompletionResultType.ParameterValue, "AvailabilitySet"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "AvailabilityZone".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'AvailabilityZone'", "AvailabilityZone", global::System.Management.Automation.CompletionResultType.ParameterValue, "AvailabilityZone"); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/A2ARecoveryAvailabilityType.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/A2ARecoveryAvailabilityType.TypeConverter.cs new file mode 100644 index 000000000000..d0317ee1c28d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/A2ARecoveryAvailabilityType.TypeConverter.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// The recovery availability type of the virtual machine. + public partial class A2ARecoveryAvailabilityTypeTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => A2ARecoveryAvailabilityType.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/A2ARecoveryAvailabilityType.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/A2ARecoveryAvailabilityType.cs new file mode 100644 index 000000000000..95828dcf126d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/A2ARecoveryAvailabilityType.cs @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// The recovery availability type of the virtual machine. + public partial struct A2ARecoveryAvailabilityType : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.A2ARecoveryAvailabilityType AvailabilitySet = @"AvailabilitySet"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.A2ARecoveryAvailabilityType AvailabilityZone = @"AvailabilityZone"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.A2ARecoveryAvailabilityType Single = @"Single"; + + /// + /// the value for an instance of the Enum. + /// + private string _value { get; set; } + + /// + /// Creates an instance of the Enum class. + /// + /// the value to create an instance for. + private A2ARecoveryAvailabilityType(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Conversion from arbitrary object to A2ARecoveryAvailabilityType + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new A2ARecoveryAvailabilityType(global::System.Convert.ToString(value)); + } + + /// Compares values of enum type A2ARecoveryAvailabilityType + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.A2ARecoveryAvailabilityType e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type A2ARecoveryAvailabilityType (override for Object) + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is A2ARecoveryAvailabilityType && Equals((A2ARecoveryAvailabilityType)obj); + } + + /// Returns hashCode for enum A2ARecoveryAvailabilityType + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Returns string representation for A2ARecoveryAvailabilityType + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to A2ARecoveryAvailabilityType + /// the value to convert to an instance of . + + public static implicit operator A2ARecoveryAvailabilityType(string value) + { + return new A2ARecoveryAvailabilityType(value); + } + + /// Implicit operator to convert A2ARecoveryAvailabilityType to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.A2ARecoveryAvailabilityType e) + { + return e._value; + } + + /// Overriding != operator for enum A2ARecoveryAvailabilityType + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.A2ARecoveryAvailabilityType e1, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.A2ARecoveryAvailabilityType e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum A2ARecoveryAvailabilityType + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.A2ARecoveryAvailabilityType e1, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.A2ARecoveryAvailabilityType e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/A2ARpRecoveryPointType.Completer.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/A2ARpRecoveryPointType.Completer.cs new file mode 100644 index 000000000000..b58e076895ea --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/A2ARpRecoveryPointType.Completer.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// The recovery point type. + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.A2ARpRecoveryPointTypeTypeConverter))] + public partial struct A2ARpRecoveryPointType : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Latest".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Latest'", "Latest", global::System.Management.Automation.CompletionResultType.ParameterValue, "Latest"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "LatestApplicationConsistent".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'LatestApplicationConsistent'", "LatestApplicationConsistent", global::System.Management.Automation.CompletionResultType.ParameterValue, "LatestApplicationConsistent"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "LatestCrashConsistent".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'LatestCrashConsistent'", "LatestCrashConsistent", global::System.Management.Automation.CompletionResultType.ParameterValue, "LatestCrashConsistent"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "LatestProcessed".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'LatestProcessed'", "LatestProcessed", global::System.Management.Automation.CompletionResultType.ParameterValue, "LatestProcessed"); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/A2ARpRecoveryPointType.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/A2ARpRecoveryPointType.TypeConverter.cs new file mode 100644 index 000000000000..e382c48438f2 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/A2ARpRecoveryPointType.TypeConverter.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// The recovery point type. + public partial class A2ARpRecoveryPointTypeTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => A2ARpRecoveryPointType.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/A2ARpRecoveryPointType.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/A2ARpRecoveryPointType.cs new file mode 100644 index 000000000000..2c4fc2a5f685 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/A2ARpRecoveryPointType.cs @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// The recovery point type. + public partial struct A2ARpRecoveryPointType : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.A2ARpRecoveryPointType Latest = @"Latest"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.A2ARpRecoveryPointType LatestApplicationConsistent = @"LatestApplicationConsistent"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.A2ARpRecoveryPointType LatestCrashConsistent = @"LatestCrashConsistent"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.A2ARpRecoveryPointType LatestProcessed = @"LatestProcessed"; + + /// the value for an instance of the Enum. + private string _value { get; set; } + + /// Creates an instance of the Enum class. + /// the value to create an instance for. + private A2ARpRecoveryPointType(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Conversion from arbitrary object to A2ARpRecoveryPointType + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new A2ARpRecoveryPointType(global::System.Convert.ToString(value)); + } + + /// Compares values of enum type A2ARpRecoveryPointType + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.A2ARpRecoveryPointType e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type A2ARpRecoveryPointType (override for Object) + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is A2ARpRecoveryPointType && Equals((A2ARpRecoveryPointType)obj); + } + + /// Returns hashCode for enum A2ARpRecoveryPointType + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Returns string representation for A2ARpRecoveryPointType + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to A2ARpRecoveryPointType + /// the value to convert to an instance of . + + public static implicit operator A2ARpRecoveryPointType(string value) + { + return new A2ARpRecoveryPointType(value); + } + + /// Implicit operator to convert A2ARpRecoveryPointType to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.A2ARpRecoveryPointType e) + { + return e._value; + } + + /// Overriding != operator for enum A2ARpRecoveryPointType + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.A2ARpRecoveryPointType e1, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.A2ARpRecoveryPointType e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum A2ARpRecoveryPointType + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.A2ARpRecoveryPointType e1, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.A2ARpRecoveryPointType e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/AgentAutoUpdateStatus.Completer.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/AgentAutoUpdateStatus.Completer.cs new file mode 100644 index 000000000000..c000858f95f8 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/AgentAutoUpdateStatus.Completer.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// A value indicating whether the auto update is enabled. + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentAutoUpdateStatusTypeConverter))] + public partial struct AgentAutoUpdateStatus : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Disabled".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Disabled'", "Disabled", global::System.Management.Automation.CompletionResultType.ParameterValue, "Disabled"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Enabled".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Enabled'", "Enabled", global::System.Management.Automation.CompletionResultType.ParameterValue, "Enabled"); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/AgentAutoUpdateStatus.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/AgentAutoUpdateStatus.TypeConverter.cs new file mode 100644 index 000000000000..f6d364917b20 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/AgentAutoUpdateStatus.TypeConverter.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// A value indicating whether the auto update is enabled. + public partial class AgentAutoUpdateStatusTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => AgentAutoUpdateStatus.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/AgentAutoUpdateStatus.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/AgentAutoUpdateStatus.cs new file mode 100644 index 000000000000..0e3153b1183c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/AgentAutoUpdateStatus.cs @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// A value indicating whether the auto update is enabled. + public partial struct AgentAutoUpdateStatus : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentAutoUpdateStatus Disabled = @"Disabled"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentAutoUpdateStatus Enabled = @"Enabled"; + + /// the value for an instance of the Enum. + private string _value { get; set; } + + /// Creates an instance of the Enum class. + /// the value to create an instance for. + private AgentAutoUpdateStatus(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Conversion from arbitrary object to AgentAutoUpdateStatus + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new AgentAutoUpdateStatus(global::System.Convert.ToString(value)); + } + + /// Compares values of enum type AgentAutoUpdateStatus + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentAutoUpdateStatus e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type AgentAutoUpdateStatus (override for Object) + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is AgentAutoUpdateStatus && Equals((AgentAutoUpdateStatus)obj); + } + + /// Returns hashCode for enum AgentAutoUpdateStatus + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Returns string representation for AgentAutoUpdateStatus + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to AgentAutoUpdateStatus + /// the value to convert to an instance of . + + public static implicit operator AgentAutoUpdateStatus(string value) + { + return new AgentAutoUpdateStatus(value); + } + + /// Implicit operator to convert AgentAutoUpdateStatus to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentAutoUpdateStatus e) + { + return e._value; + } + + /// Overriding != operator for enum AgentAutoUpdateStatus + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentAutoUpdateStatus e1, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentAutoUpdateStatus e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum AgentAutoUpdateStatus + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentAutoUpdateStatus e1, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentAutoUpdateStatus e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/AgentUpgradeBlockedReason.Completer.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/AgentUpgradeBlockedReason.Completer.cs new file mode 100644 index 000000000000..7c55bcf8dfab --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/AgentUpgradeBlockedReason.Completer.cs @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// Argument completer implementation for AgentUpgradeBlockedReason. + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentUpgradeBlockedReasonTypeConverter))] + public partial struct AgentUpgradeBlockedReason : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "AlreadyOnLatestVersion".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'AlreadyOnLatestVersion'", "AlreadyOnLatestVersion", global::System.Management.Automation.CompletionResultType.ParameterValue, "AlreadyOnLatestVersion"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "RebootRequired".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'RebootRequired'", "RebootRequired", global::System.Management.Automation.CompletionResultType.ParameterValue, "RebootRequired"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "AgentNoHeartbeat".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'AgentNoHeartbeat'", "AgentNoHeartbeat", global::System.Management.Automation.CompletionResultType.ParameterValue, "AgentNoHeartbeat"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "RcmProxyNoHeartbeat".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'RcmProxyNoHeartbeat'", "RcmProxyNoHeartbeat", global::System.Management.Automation.CompletionResultType.ParameterValue, "RcmProxyNoHeartbeat"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "ProcessServerNoHeartbeat".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'ProcessServerNoHeartbeat'", "ProcessServerNoHeartbeat", global::System.Management.Automation.CompletionResultType.ParameterValue, "ProcessServerNoHeartbeat"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "IncompatibleApplianceVersion".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'IncompatibleApplianceVersion'", "IncompatibleApplianceVersion", global::System.Management.Automation.CompletionResultType.ParameterValue, "IncompatibleApplianceVersion"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "NotProtected".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'NotProtected'", "NotProtected", global::System.Management.Automation.CompletionResultType.ParameterValue, "NotProtected"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "UnsupportedProtectionScenario".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'UnsupportedProtectionScenario'", "UnsupportedProtectionScenario", global::System.Management.Automation.CompletionResultType.ParameterValue, "UnsupportedProtectionScenario"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "DistroIsNotReported".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'DistroIsNotReported'", "DistroIsNotReported", global::System.Management.Automation.CompletionResultType.ParameterValue, "DistroIsNotReported"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "DistroNotSupportedForUpgrade".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'DistroNotSupportedForUpgrade'", "DistroNotSupportedForUpgrade", global::System.Management.Automation.CompletionResultType.ParameterValue, "DistroNotSupportedForUpgrade"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "MissingUpgradePath".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'MissingUpgradePath'", "MissingUpgradePath", global::System.Management.Automation.CompletionResultType.ParameterValue, "MissingUpgradePath"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "InvalidAgentVersion".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'InvalidAgentVersion'", "InvalidAgentVersion", global::System.Management.Automation.CompletionResultType.ParameterValue, "InvalidAgentVersion"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "InvalidDriverVersion".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'InvalidDriverVersion'", "InvalidDriverVersion", global::System.Management.Automation.CompletionResultType.ParameterValue, "InvalidDriverVersion"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Unknown".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Unknown'", "Unknown", global::System.Management.Automation.CompletionResultType.ParameterValue, "Unknown"); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/AgentUpgradeBlockedReason.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/AgentUpgradeBlockedReason.TypeConverter.cs new file mode 100644 index 000000000000..7cf97f3f3882 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/AgentUpgradeBlockedReason.TypeConverter.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// TypeConverter implementation for AgentUpgradeBlockedReason. + public partial class AgentUpgradeBlockedReasonTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => AgentUpgradeBlockedReason.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/AgentUpgradeBlockedReason.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/AgentUpgradeBlockedReason.cs new file mode 100644 index 000000000000..d3f72d41682a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/AgentUpgradeBlockedReason.cs @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + public partial struct AgentUpgradeBlockedReason : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentUpgradeBlockedReason AgentNoHeartbeat = @"AgentNoHeartbeat"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentUpgradeBlockedReason AlreadyOnLatestVersion = @"AlreadyOnLatestVersion"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentUpgradeBlockedReason DistroIsNotReported = @"DistroIsNotReported"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentUpgradeBlockedReason DistroNotSupportedForUpgrade = @"DistroNotSupportedForUpgrade"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentUpgradeBlockedReason IncompatibleApplianceVersion = @"IncompatibleApplianceVersion"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentUpgradeBlockedReason InvalidAgentVersion = @"InvalidAgentVersion"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentUpgradeBlockedReason InvalidDriverVersion = @"InvalidDriverVersion"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentUpgradeBlockedReason MissingUpgradePath = @"MissingUpgradePath"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentUpgradeBlockedReason NotProtected = @"NotProtected"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentUpgradeBlockedReason ProcessServerNoHeartbeat = @"ProcessServerNoHeartbeat"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentUpgradeBlockedReason RcmProxyNoHeartbeat = @"RcmProxyNoHeartbeat"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentUpgradeBlockedReason RebootRequired = @"RebootRequired"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentUpgradeBlockedReason Unknown = @"Unknown"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentUpgradeBlockedReason UnsupportedProtectionScenario = @"UnsupportedProtectionScenario"; + + /// the value for an instance of the Enum. + private string _value { get; set; } + + /// Creates an instance of the Enum class. + /// the value to create an instance for. + private AgentUpgradeBlockedReason(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Conversion from arbitrary object to AgentUpgradeBlockedReason + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new AgentUpgradeBlockedReason(global::System.Convert.ToString(value)); + } + + /// Compares values of enum type AgentUpgradeBlockedReason + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentUpgradeBlockedReason e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type AgentUpgradeBlockedReason (override for Object) + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is AgentUpgradeBlockedReason && Equals((AgentUpgradeBlockedReason)obj); + } + + /// Returns hashCode for enum AgentUpgradeBlockedReason + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Returns string representation for AgentUpgradeBlockedReason + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to AgentUpgradeBlockedReason + /// the value to convert to an instance of . + + public static implicit operator AgentUpgradeBlockedReason(string value) + { + return new AgentUpgradeBlockedReason(value); + } + + /// Implicit operator to convert AgentUpgradeBlockedReason to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentUpgradeBlockedReason e) + { + return e._value; + } + + /// Overriding != operator for enum AgentUpgradeBlockedReason + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentUpgradeBlockedReason e1, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentUpgradeBlockedReason e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum AgentUpgradeBlockedReason + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentUpgradeBlockedReason e1, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentUpgradeBlockedReason e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/AgentVersionStatus.Completer.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/AgentVersionStatus.Completer.cs new file mode 100644 index 000000000000..668d452e1a7e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/AgentVersionStatus.Completer.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// A value indicating whether security update required. + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentVersionStatusTypeConverter))] + public partial struct AgentVersionStatus : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Supported".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Supported'", "Supported", global::System.Management.Automation.CompletionResultType.ParameterValue, "Supported"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "NotSupported".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'NotSupported'", "NotSupported", global::System.Management.Automation.CompletionResultType.ParameterValue, "NotSupported"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Deprecated".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Deprecated'", "Deprecated", global::System.Management.Automation.CompletionResultType.ParameterValue, "Deprecated"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "UpdateRequired".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'UpdateRequired'", "UpdateRequired", global::System.Management.Automation.CompletionResultType.ParameterValue, "UpdateRequired"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "SecurityUpdateRequired".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'SecurityUpdateRequired'", "SecurityUpdateRequired", global::System.Management.Automation.CompletionResultType.ParameterValue, "SecurityUpdateRequired"); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/AgentVersionStatus.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/AgentVersionStatus.TypeConverter.cs new file mode 100644 index 000000000000..8cd7e8fcf07e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/AgentVersionStatus.TypeConverter.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// A value indicating whether security update required. + public partial class AgentVersionStatusTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => AgentVersionStatus.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/AgentVersionStatus.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/AgentVersionStatus.cs new file mode 100644 index 000000000000..6d21264b47f2 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/AgentVersionStatus.cs @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// A value indicating whether security update required. + public partial struct AgentVersionStatus : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentVersionStatus Deprecated = @"Deprecated"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentVersionStatus NotSupported = @"NotSupported"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentVersionStatus SecurityUpdateRequired = @"SecurityUpdateRequired"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentVersionStatus Supported = @"Supported"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentVersionStatus UpdateRequired = @"UpdateRequired"; + + /// the value for an instance of the Enum. + private string _value { get; set; } + + /// Creates an instance of the Enum class. + /// the value to create an instance for. + private AgentVersionStatus(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Conversion from arbitrary object to AgentVersionStatus + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new AgentVersionStatus(global::System.Convert.ToString(value)); + } + + /// Compares values of enum type AgentVersionStatus + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentVersionStatus e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type AgentVersionStatus (override for Object) + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is AgentVersionStatus && Equals((AgentVersionStatus)obj); + } + + /// Returns hashCode for enum AgentVersionStatus + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Returns string representation for AgentVersionStatus + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to AgentVersionStatus + /// the value to convert to an instance of . + + public static implicit operator AgentVersionStatus(string value) + { + return new AgentVersionStatus(value); + } + + /// Implicit operator to convert AgentVersionStatus to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentVersionStatus e) + { + return e._value; + } + + /// Overriding != operator for enum AgentVersionStatus + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentVersionStatus e1, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentVersionStatus e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum AgentVersionStatus + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentVersionStatus e1, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AgentVersionStatus e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/AlternateLocationRecoveryOption.Completer.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/AlternateLocationRecoveryOption.Completer.cs new file mode 100644 index 000000000000..03bf71b88d45 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/AlternateLocationRecoveryOption.Completer.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// The ALR option. + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AlternateLocationRecoveryOptionTypeConverter))] + public partial struct AlternateLocationRecoveryOption : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "CreateVmIfNotFound".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'CreateVmIfNotFound'", "CreateVmIfNotFound", global::System.Management.Automation.CompletionResultType.ParameterValue, "CreateVmIfNotFound"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "NoAction".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'NoAction'", "NoAction", global::System.Management.Automation.CompletionResultType.ParameterValue, "NoAction"); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/AlternateLocationRecoveryOption.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/AlternateLocationRecoveryOption.TypeConverter.cs new file mode 100644 index 000000000000..90a9c64dfb09 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/AlternateLocationRecoveryOption.TypeConverter.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// The ALR option. + public partial class AlternateLocationRecoveryOptionTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => AlternateLocationRecoveryOption.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/AlternateLocationRecoveryOption.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/AlternateLocationRecoveryOption.cs new file mode 100644 index 000000000000..2d445b151729 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/AlternateLocationRecoveryOption.cs @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// The ALR option. + public partial struct AlternateLocationRecoveryOption : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AlternateLocationRecoveryOption CreateVMIfNotFound = @"CreateVmIfNotFound"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AlternateLocationRecoveryOption NoAction = @"NoAction"; + + /// + /// the value for an instance of the Enum. + /// + private string _value { get; set; } + + /// + /// Creates an instance of the Enum class. + /// + /// the value to create an instance for. + private AlternateLocationRecoveryOption(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Conversion from arbitrary object to AlternateLocationRecoveryOption + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new AlternateLocationRecoveryOption(global::System.Convert.ToString(value)); + } + + /// Compares values of enum type AlternateLocationRecoveryOption + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AlternateLocationRecoveryOption e) + { + return _value.Equals(e._value); + } + + /// + /// Compares values of enum type AlternateLocationRecoveryOption (override for Object) + /// + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is AlternateLocationRecoveryOption && Equals((AlternateLocationRecoveryOption)obj); + } + + /// Returns hashCode for enum AlternateLocationRecoveryOption + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Returns string representation for AlternateLocationRecoveryOption + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to AlternateLocationRecoveryOption + /// the value to convert to an instance of . + + public static implicit operator AlternateLocationRecoveryOption(string value) + { + return new AlternateLocationRecoveryOption(value); + } + + /// Implicit operator to convert AlternateLocationRecoveryOption to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AlternateLocationRecoveryOption e) + { + return e._value; + } + + /// Overriding != operator for enum AlternateLocationRecoveryOption + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AlternateLocationRecoveryOption e1, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AlternateLocationRecoveryOption e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum AlternateLocationRecoveryOption + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AlternateLocationRecoveryOption e1, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AlternateLocationRecoveryOption e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/AutoProtectionOfDataDisk.Completer.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/AutoProtectionOfDataDisk.Completer.cs new file mode 100644 index 000000000000..db0e7a7000fa --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/AutoProtectionOfDataDisk.Completer.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// A value indicating whether the auto protection is enabled. + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AutoProtectionOfDataDiskTypeConverter))] + public partial struct AutoProtectionOfDataDisk : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Disabled".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Disabled'", "Disabled", global::System.Management.Automation.CompletionResultType.ParameterValue, "Disabled"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Enabled".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Enabled'", "Enabled", global::System.Management.Automation.CompletionResultType.ParameterValue, "Enabled"); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/AutoProtectionOfDataDisk.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/AutoProtectionOfDataDisk.TypeConverter.cs new file mode 100644 index 000000000000..94f49f479011 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/AutoProtectionOfDataDisk.TypeConverter.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// A value indicating whether the auto protection is enabled. + public partial class AutoProtectionOfDataDiskTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => AutoProtectionOfDataDisk.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/AutoProtectionOfDataDisk.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/AutoProtectionOfDataDisk.cs new file mode 100644 index 000000000000..65eadccb934a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/AutoProtectionOfDataDisk.cs @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// A value indicating whether the auto protection is enabled. + public partial struct AutoProtectionOfDataDisk : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AutoProtectionOfDataDisk Disabled = @"Disabled"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AutoProtectionOfDataDisk Enabled = @"Enabled"; + + /// the value for an instance of the Enum. + private string _value { get; set; } + + /// Creates an instance of the Enum class. + /// the value to create an instance for. + private AutoProtectionOfDataDisk(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Conversion from arbitrary object to AutoProtectionOfDataDisk + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new AutoProtectionOfDataDisk(global::System.Convert.ToString(value)); + } + + /// Compares values of enum type AutoProtectionOfDataDisk + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AutoProtectionOfDataDisk e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type AutoProtectionOfDataDisk (override for Object) + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is AutoProtectionOfDataDisk && Equals((AutoProtectionOfDataDisk)obj); + } + + /// Returns hashCode for enum AutoProtectionOfDataDisk + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Returns string representation for AutoProtectionOfDataDisk + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to AutoProtectionOfDataDisk + /// the value to convert to an instance of . + + public static implicit operator AutoProtectionOfDataDisk(string value) + { + return new AutoProtectionOfDataDisk(value); + } + + /// Implicit operator to convert AutoProtectionOfDataDisk to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AutoProtectionOfDataDisk e) + { + return e._value; + } + + /// Overriding != operator for enum AutoProtectionOfDataDisk + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AutoProtectionOfDataDisk e1, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AutoProtectionOfDataDisk e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum AutoProtectionOfDataDisk + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AutoProtectionOfDataDisk e1, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AutoProtectionOfDataDisk e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/AutomationAccountAuthenticationType.Completer.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/AutomationAccountAuthenticationType.Completer.cs new file mode 100644 index 000000000000..8f6d85d40397 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/AutomationAccountAuthenticationType.Completer.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// A value indicating the type authentication to use for automation Account. + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AutomationAccountAuthenticationTypeTypeConverter))] + public partial struct AutomationAccountAuthenticationType : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "RunAsAccount".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'RunAsAccount'", "RunAsAccount", global::System.Management.Automation.CompletionResultType.ParameterValue, "RunAsAccount"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "SystemAssignedIdentity".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'SystemAssignedIdentity'", "SystemAssignedIdentity", global::System.Management.Automation.CompletionResultType.ParameterValue, "SystemAssignedIdentity"); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/AutomationAccountAuthenticationType.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/AutomationAccountAuthenticationType.TypeConverter.cs new file mode 100644 index 000000000000..30e3362b8be7 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/AutomationAccountAuthenticationType.TypeConverter.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// A value indicating the type authentication to use for automation Account. + public partial class AutomationAccountAuthenticationTypeTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => AutomationAccountAuthenticationType.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/AutomationAccountAuthenticationType.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/AutomationAccountAuthenticationType.cs new file mode 100644 index 000000000000..9dc0cdec2f4a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/AutomationAccountAuthenticationType.cs @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// A value indicating the type authentication to use for automation Account. + public partial struct AutomationAccountAuthenticationType : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AutomationAccountAuthenticationType RunAsAccount = @"RunAsAccount"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AutomationAccountAuthenticationType SystemAssignedIdentity = @"SystemAssignedIdentity"; + + /// + /// the value for an instance of the Enum. + /// + private string _value { get; set; } + + /// + /// Creates an instance of the Enum class. + /// + /// the value to create an instance for. + private AutomationAccountAuthenticationType(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Conversion from arbitrary object to AutomationAccountAuthenticationType + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new AutomationAccountAuthenticationType(global::System.Convert.ToString(value)); + } + + /// Compares values of enum type AutomationAccountAuthenticationType + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AutomationAccountAuthenticationType e) + { + return _value.Equals(e._value); + } + + /// + /// Compares values of enum type AutomationAccountAuthenticationType (override for Object) + /// + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is AutomationAccountAuthenticationType && Equals((AutomationAccountAuthenticationType)obj); + } + + /// Returns hashCode for enum AutomationAccountAuthenticationType + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Returns string representation for AutomationAccountAuthenticationType + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to AutomationAccountAuthenticationType + /// the value to convert to an instance of . + + public static implicit operator AutomationAccountAuthenticationType(string value) + { + return new AutomationAccountAuthenticationType(value); + } + + /// Implicit operator to convert AutomationAccountAuthenticationType to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AutomationAccountAuthenticationType e) + { + return e._value; + } + + /// Overriding != operator for enum AutomationAccountAuthenticationType + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AutomationAccountAuthenticationType e1, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AutomationAccountAuthenticationType e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum AutomationAccountAuthenticationType + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AutomationAccountAuthenticationType e1, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.AutomationAccountAuthenticationType e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/DataSyncStatus.Completer.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/DataSyncStatus.Completer.cs new file mode 100644 index 000000000000..40089d4b132d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/DataSyncStatus.Completer.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// The data sync option. + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DataSyncStatusTypeConverter))] + public partial struct DataSyncStatus : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "ForDownTime".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'ForDownTime'", "ForDownTime", global::System.Management.Automation.CompletionResultType.ParameterValue, "ForDownTime"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "ForSynchronization".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'ForSynchronization'", "ForSynchronization", global::System.Management.Automation.CompletionResultType.ParameterValue, "ForSynchronization"); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/DataSyncStatus.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/DataSyncStatus.TypeConverter.cs new file mode 100644 index 000000000000..aa78e860197b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/DataSyncStatus.TypeConverter.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// The data sync option. + public partial class DataSyncStatusTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => DataSyncStatus.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/DataSyncStatus.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/DataSyncStatus.cs new file mode 100644 index 000000000000..93dbac665945 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/DataSyncStatus.cs @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// The data sync option. + public partial struct DataSyncStatus : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DataSyncStatus ForDownTime = @"ForDownTime"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DataSyncStatus ForSynchronization = @"ForSynchronization"; + + /// the value for an instance of the Enum. + private string _value { get; set; } + + /// Conversion from arbitrary object to DataSyncStatus + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new DataSyncStatus(global::System.Convert.ToString(value)); + } + + /// Creates an instance of the Enum class. + /// the value to create an instance for. + private DataSyncStatus(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Compares values of enum type DataSyncStatus + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DataSyncStatus e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type DataSyncStatus (override for Object) + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is DataSyncStatus && Equals((DataSyncStatus)obj); + } + + /// Returns hashCode for enum DataSyncStatus + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Returns string representation for DataSyncStatus + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to DataSyncStatus + /// the value to convert to an instance of . + + public static implicit operator DataSyncStatus(string value) + { + return new DataSyncStatus(value); + } + + /// Implicit operator to convert DataSyncStatus to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DataSyncStatus e) + { + return e._value; + } + + /// Overriding != operator for enum DataSyncStatus + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DataSyncStatus e1, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DataSyncStatus e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum DataSyncStatus + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DataSyncStatus e1, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DataSyncStatus e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/DisableProtectionReason.Completer.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/DisableProtectionReason.Completer.cs new file mode 100644 index 000000000000..ae973285837b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/DisableProtectionReason.Completer.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// Disable protection reason. It can have values NotSpecified/MigrationComplete. + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DisableProtectionReasonTypeConverter))] + public partial struct DisableProtectionReason : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "NotSpecified".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'NotSpecified'", "NotSpecified", global::System.Management.Automation.CompletionResultType.ParameterValue, "NotSpecified"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "MigrationComplete".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'MigrationComplete'", "MigrationComplete", global::System.Management.Automation.CompletionResultType.ParameterValue, "MigrationComplete"); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/DisableProtectionReason.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/DisableProtectionReason.TypeConverter.cs new file mode 100644 index 000000000000..9cf645d9cd09 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/DisableProtectionReason.TypeConverter.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// Disable protection reason. It can have values NotSpecified/MigrationComplete. + public partial class DisableProtectionReasonTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => DisableProtectionReason.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/DisableProtectionReason.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/DisableProtectionReason.cs new file mode 100644 index 000000000000..b342b87decb7 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/DisableProtectionReason.cs @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// Disable protection reason. It can have values NotSpecified/MigrationComplete. + public partial struct DisableProtectionReason : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DisableProtectionReason MigrationComplete = @"MigrationComplete"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DisableProtectionReason NotSpecified = @"NotSpecified"; + + /// the value for an instance of the Enum. + private string _value { get; set; } + + /// Conversion from arbitrary object to DisableProtectionReason + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new DisableProtectionReason(global::System.Convert.ToString(value)); + } + + /// Creates an instance of the Enum class. + /// the value to create an instance for. + private DisableProtectionReason(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Compares values of enum type DisableProtectionReason + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DisableProtectionReason e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type DisableProtectionReason (override for Object) + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is DisableProtectionReason && Equals((DisableProtectionReason)obj); + } + + /// Returns hashCode for enum DisableProtectionReason + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Returns string representation for DisableProtectionReason + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to DisableProtectionReason + /// the value to convert to an instance of . + + public static implicit operator DisableProtectionReason(string value) + { + return new DisableProtectionReason(value); + } + + /// Implicit operator to convert DisableProtectionReason to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DisableProtectionReason e) + { + return e._value; + } + + /// Overriding != operator for enum DisableProtectionReason + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DisableProtectionReason e1, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DisableProtectionReason e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum DisableProtectionReason + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DisableProtectionReason e1, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DisableProtectionReason e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/DiskAccountType.Completer.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/DiskAccountType.Completer.cs new file mode 100644 index 000000000000..75fdb49312e5 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/DiskAccountType.Completer.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// The DiskType. + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskAccountTypeTypeConverter))] + public partial struct DiskAccountType : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Standard_LRS".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Standard_LRS'", "Standard_LRS", global::System.Management.Automation.CompletionResultType.ParameterValue, "Standard_LRS"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Premium_LRS".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Premium_LRS'", "Premium_LRS", global::System.Management.Automation.CompletionResultType.ParameterValue, "Premium_LRS"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "StandardSSD_LRS".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'StandardSSD_LRS'", "StandardSSD_LRS", global::System.Management.Automation.CompletionResultType.ParameterValue, "StandardSSD_LRS"); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/DiskAccountType.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/DiskAccountType.TypeConverter.cs new file mode 100644 index 000000000000..df10b20d6ec7 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/DiskAccountType.TypeConverter.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// The DiskType. + public partial class DiskAccountTypeTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => DiskAccountType.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/DiskAccountType.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/DiskAccountType.cs new file mode 100644 index 000000000000..e0f063e0c4af --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/DiskAccountType.cs @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// The DiskType. + public partial struct DiskAccountType : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskAccountType PremiumLrs = @"Premium_LRS"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskAccountType StandardLrs = @"Standard_LRS"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskAccountType StandardSsdLrs = @"StandardSSD_LRS"; + + /// the value for an instance of the Enum. + private string _value { get; set; } + + /// Conversion from arbitrary object to DiskAccountType + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new DiskAccountType(global::System.Convert.ToString(value)); + } + + /// Creates an instance of the Enum class. + /// the value to create an instance for. + private DiskAccountType(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Compares values of enum type DiskAccountType + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskAccountType e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type DiskAccountType (override for Object) + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is DiskAccountType && Equals((DiskAccountType)obj); + } + + /// Returns hashCode for enum DiskAccountType + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Returns string representation for DiskAccountType + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to DiskAccountType + /// the value to convert to an instance of . + + public static implicit operator DiskAccountType(string value) + { + return new DiskAccountType(value); + } + + /// Implicit operator to convert DiskAccountType to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskAccountType e) + { + return e._value; + } + + /// Overriding != operator for enum DiskAccountType + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskAccountType e1, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskAccountType e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum DiskAccountType + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskAccountType e1, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskAccountType e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/DiskReplicationProgressHealth.Completer.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/DiskReplicationProgressHealth.Completer.cs new file mode 100644 index 000000000000..9d74fe240e54 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/DiskReplicationProgressHealth.Completer.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// The progress health. + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskReplicationProgressHealthTypeConverter))] + public partial struct DiskReplicationProgressHealth : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "None".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'None'", "None", global::System.Management.Automation.CompletionResultType.ParameterValue, "None"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "InProgress".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'InProgress'", "InProgress", global::System.Management.Automation.CompletionResultType.ParameterValue, "InProgress"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "SlowProgress".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'SlowProgress'", "SlowProgress", global::System.Management.Automation.CompletionResultType.ParameterValue, "SlowProgress"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "NoProgress".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'NoProgress'", "NoProgress", global::System.Management.Automation.CompletionResultType.ParameterValue, "NoProgress"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Queued".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Queued'", "Queued", global::System.Management.Automation.CompletionResultType.ParameterValue, "Queued"); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/DiskReplicationProgressHealth.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/DiskReplicationProgressHealth.TypeConverter.cs new file mode 100644 index 000000000000..f37e7e47000a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/DiskReplicationProgressHealth.TypeConverter.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// The progress health. + public partial class DiskReplicationProgressHealthTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => DiskReplicationProgressHealth.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/DiskReplicationProgressHealth.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/DiskReplicationProgressHealth.cs new file mode 100644 index 000000000000..f9cd47bba753 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/DiskReplicationProgressHealth.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// The progress health. + public partial struct DiskReplicationProgressHealth : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskReplicationProgressHealth InProgress = @"InProgress"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskReplicationProgressHealth NoProgress = @"NoProgress"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskReplicationProgressHealth None = @"None"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskReplicationProgressHealth Queued = @"Queued"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskReplicationProgressHealth SlowProgress = @"SlowProgress"; + + /// + /// the value for an instance of the Enum. + /// + private string _value { get; set; } + + /// Conversion from arbitrary object to DiskReplicationProgressHealth + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new DiskReplicationProgressHealth(global::System.Convert.ToString(value)); + } + + /// + /// Creates an instance of the Enum class. + /// + /// the value to create an instance for. + private DiskReplicationProgressHealth(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Compares values of enum type DiskReplicationProgressHealth + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskReplicationProgressHealth e) + { + return _value.Equals(e._value); + } + + /// + /// Compares values of enum type DiskReplicationProgressHealth (override for Object) + /// + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is DiskReplicationProgressHealth && Equals((DiskReplicationProgressHealth)obj); + } + + /// Returns hashCode for enum DiskReplicationProgressHealth + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Returns string representation for DiskReplicationProgressHealth + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to DiskReplicationProgressHealth + /// the value to convert to an instance of . + + public static implicit operator DiskReplicationProgressHealth(string value) + { + return new DiskReplicationProgressHealth(value); + } + + /// Implicit operator to convert DiskReplicationProgressHealth to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskReplicationProgressHealth e) + { + return e._value; + } + + /// Overriding != operator for enum DiskReplicationProgressHealth + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskReplicationProgressHealth e1, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskReplicationProgressHealth e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum DiskReplicationProgressHealth + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskReplicationProgressHealth e1, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DiskReplicationProgressHealth e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/EthernetAddressType.Completer.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/EthernetAddressType.Completer.cs new file mode 100644 index 000000000000..1943d450869c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/EthernetAddressType.Completer.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// The source IP address type. + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.EthernetAddressTypeTypeConverter))] + public partial struct EthernetAddressType : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Dynamic".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Dynamic'", "Dynamic", global::System.Management.Automation.CompletionResultType.ParameterValue, "Dynamic"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Static".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Static'", "Static", global::System.Management.Automation.CompletionResultType.ParameterValue, "Static"); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/EthernetAddressType.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/EthernetAddressType.TypeConverter.cs new file mode 100644 index 000000000000..2f3293533813 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/EthernetAddressType.TypeConverter.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// The source IP address type. + public partial class EthernetAddressTypeTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => EthernetAddressType.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/EthernetAddressType.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/EthernetAddressType.cs new file mode 100644 index 000000000000..0d1d10d2c24e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/EthernetAddressType.cs @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// The source IP address type. + public partial struct EthernetAddressType : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.EthernetAddressType Dynamic = @"Dynamic"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.EthernetAddressType Static = @"Static"; + + /// the value for an instance of the Enum. + private string _value { get; set; } + + /// Conversion from arbitrary object to EthernetAddressType + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new EthernetAddressType(global::System.Convert.ToString(value)); + } + + /// Compares values of enum type EthernetAddressType + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.EthernetAddressType e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type EthernetAddressType (override for Object) + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is EthernetAddressType && Equals((EthernetAddressType)obj); + } + + /// Creates an instance of the Enum class. + /// the value to create an instance for. + private EthernetAddressType(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Returns hashCode for enum EthernetAddressType + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Returns string representation for EthernetAddressType + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to EthernetAddressType + /// the value to convert to an instance of . + + public static implicit operator EthernetAddressType(string value) + { + return new EthernetAddressType(value); + } + + /// Implicit operator to convert EthernetAddressType to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.EthernetAddressType e) + { + return e._value; + } + + /// Overriding != operator for enum EthernetAddressType + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.EthernetAddressType e1, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.EthernetAddressType e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum EthernetAddressType + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.EthernetAddressType e1, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.EthernetAddressType e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/ExportJobOutputSerializationType.Completer.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/ExportJobOutputSerializationType.Completer.cs new file mode 100644 index 000000000000..19c041a42cbf --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/ExportJobOutputSerializationType.Completer.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// The output type of the jobs. + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ExportJobOutputSerializationTypeTypeConverter))] + public partial struct ExportJobOutputSerializationType : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Json".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Json'", "Json", global::System.Management.Automation.CompletionResultType.ParameterValue, "Json"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Xml".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Xml'", "Xml", global::System.Management.Automation.CompletionResultType.ParameterValue, "Xml"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Excel".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Excel'", "Excel", global::System.Management.Automation.CompletionResultType.ParameterValue, "Excel"); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/ExportJobOutputSerializationType.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/ExportJobOutputSerializationType.TypeConverter.cs new file mode 100644 index 000000000000..83bb263e0645 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/ExportJobOutputSerializationType.TypeConverter.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// The output type of the jobs. + public partial class ExportJobOutputSerializationTypeTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ExportJobOutputSerializationType.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/ExportJobOutputSerializationType.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/ExportJobOutputSerializationType.cs new file mode 100644 index 000000000000..ca3ad12cb77e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/ExportJobOutputSerializationType.cs @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// The output type of the jobs. + public partial struct ExportJobOutputSerializationType : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ExportJobOutputSerializationType Excel = @"Excel"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ExportJobOutputSerializationType Json = @"Json"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ExportJobOutputSerializationType Xml = @"Xml"; + + /// + /// the value for an instance of the Enum. + /// + private string _value { get; set; } + + /// Conversion from arbitrary object to ExportJobOutputSerializationType + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new ExportJobOutputSerializationType(global::System.Convert.ToString(value)); + } + + /// Compares values of enum type ExportJobOutputSerializationType + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ExportJobOutputSerializationType e) + { + return _value.Equals(e._value); + } + + /// + /// Compares values of enum type ExportJobOutputSerializationType (override for Object) + /// + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is ExportJobOutputSerializationType && Equals((ExportJobOutputSerializationType)obj); + } + + /// + /// Creates an instance of the Enum class. + /// + /// the value to create an instance for. + private ExportJobOutputSerializationType(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Returns hashCode for enum ExportJobOutputSerializationType + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Returns string representation for ExportJobOutputSerializationType + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to ExportJobOutputSerializationType + /// the value to convert to an instance of . + + public static implicit operator ExportJobOutputSerializationType(string value) + { + return new ExportJobOutputSerializationType(value); + } + + /// Implicit operator to convert ExportJobOutputSerializationType to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ExportJobOutputSerializationType e) + { + return e._value; + } + + /// Overriding != operator for enum ExportJobOutputSerializationType + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ExportJobOutputSerializationType e1, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ExportJobOutputSerializationType e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum ExportJobOutputSerializationType + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ExportJobOutputSerializationType e1, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ExportJobOutputSerializationType e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/FailoverDeploymentModel.Completer.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/FailoverDeploymentModel.Completer.cs new file mode 100644 index 000000000000..98dd50fff285 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/FailoverDeploymentModel.Completer.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// The failover deployment model. + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.FailoverDeploymentModelTypeConverter))] + public partial struct FailoverDeploymentModel : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "NotApplicable".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'NotApplicable'", "NotApplicable", global::System.Management.Automation.CompletionResultType.ParameterValue, "NotApplicable"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Classic".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Classic'", "Classic", global::System.Management.Automation.CompletionResultType.ParameterValue, "Classic"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "ResourceManager".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'ResourceManager'", "ResourceManager", global::System.Management.Automation.CompletionResultType.ParameterValue, "ResourceManager"); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/FailoverDeploymentModel.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/FailoverDeploymentModel.TypeConverter.cs new file mode 100644 index 000000000000..1077712e3f31 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/FailoverDeploymentModel.TypeConverter.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// The failover deployment model. + public partial class FailoverDeploymentModelTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => FailoverDeploymentModel.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/FailoverDeploymentModel.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/FailoverDeploymentModel.cs new file mode 100644 index 000000000000..0816290e0a67 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/FailoverDeploymentModel.cs @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// The failover deployment model. + public partial struct FailoverDeploymentModel : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.FailoverDeploymentModel Classic = @"Classic"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.FailoverDeploymentModel NotApplicable = @"NotApplicable"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.FailoverDeploymentModel ResourceManager = @"ResourceManager"; + + /// the value for an instance of the Enum. + private string _value { get; set; } + + /// Conversion from arbitrary object to FailoverDeploymentModel + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new FailoverDeploymentModel(global::System.Convert.ToString(value)); + } + + /// Compares values of enum type FailoverDeploymentModel + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.FailoverDeploymentModel e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type FailoverDeploymentModel (override for Object) + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is FailoverDeploymentModel && Equals((FailoverDeploymentModel)obj); + } + + /// Creates an instance of the Enum class. + /// the value to create an instance for. + private FailoverDeploymentModel(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Returns hashCode for enum FailoverDeploymentModel + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Returns string representation for FailoverDeploymentModel + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to FailoverDeploymentModel + /// the value to convert to an instance of . + + public static implicit operator FailoverDeploymentModel(string value) + { + return new FailoverDeploymentModel(value); + } + + /// Implicit operator to convert FailoverDeploymentModel to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.FailoverDeploymentModel e) + { + return e._value; + } + + /// Overriding != operator for enum FailoverDeploymentModel + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.FailoverDeploymentModel e1, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.FailoverDeploymentModel e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum FailoverDeploymentModel + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.FailoverDeploymentModel e1, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.FailoverDeploymentModel e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/HealthErrorCategory.Completer.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/HealthErrorCategory.Completer.cs new file mode 100644 index 000000000000..54f560adff9a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/HealthErrorCategory.Completer.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// The category of the health error. + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.HealthErrorCategoryTypeConverter))] + public partial struct HealthErrorCategory : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "None".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'None'", "None", global::System.Management.Automation.CompletionResultType.ParameterValue, "None"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Replication".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Replication'", "Replication", global::System.Management.Automation.CompletionResultType.ParameterValue, "Replication"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "TestFailover".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'TestFailover'", "TestFailover", global::System.Management.Automation.CompletionResultType.ParameterValue, "TestFailover"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Configuration".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Configuration'", "Configuration", global::System.Management.Automation.CompletionResultType.ParameterValue, "Configuration"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "FabricInfrastructure".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'FabricInfrastructure'", "FabricInfrastructure", global::System.Management.Automation.CompletionResultType.ParameterValue, "FabricInfrastructure"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "VersionExpiry".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'VersionExpiry'", "VersionExpiry", global::System.Management.Automation.CompletionResultType.ParameterValue, "VersionExpiry"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "AgentAutoUpdateInfra".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'AgentAutoUpdateInfra'", "AgentAutoUpdateInfra", global::System.Management.Automation.CompletionResultType.ParameterValue, "AgentAutoUpdateInfra"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "AgentAutoUpdateArtifactDeleted".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'AgentAutoUpdateArtifactDeleted'", "AgentAutoUpdateArtifactDeleted", global::System.Management.Automation.CompletionResultType.ParameterValue, "AgentAutoUpdateArtifactDeleted"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "AgentAutoUpdateRunAsAccount".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'AgentAutoUpdateRunAsAccount'", "AgentAutoUpdateRunAsAccount", global::System.Management.Automation.CompletionResultType.ParameterValue, "AgentAutoUpdateRunAsAccount"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "AgentAutoUpdateRunAsAccountExpiry".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'AgentAutoUpdateRunAsAccountExpiry'", "AgentAutoUpdateRunAsAccountExpiry", global::System.Management.Automation.CompletionResultType.ParameterValue, "AgentAutoUpdateRunAsAccountExpiry"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "AgentAutoUpdateRunAsAccountExpired".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'AgentAutoUpdateRunAsAccountExpired'", "AgentAutoUpdateRunAsAccountExpired", global::System.Management.Automation.CompletionResultType.ParameterValue, "AgentAutoUpdateRunAsAccountExpired"); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/HealthErrorCategory.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/HealthErrorCategory.TypeConverter.cs new file mode 100644 index 000000000000..039ee1a81dac --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/HealthErrorCategory.TypeConverter.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// The category of the health error. + public partial class HealthErrorCategoryTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => HealthErrorCategory.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/HealthErrorCategory.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/HealthErrorCategory.cs new file mode 100644 index 000000000000..539fd15fd7ad --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/HealthErrorCategory.cs @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// The category of the health error. + public partial struct HealthErrorCategory : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.HealthErrorCategory AgentAutoUpdateArtifactDeleted = @"AgentAutoUpdateArtifactDeleted"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.HealthErrorCategory AgentAutoUpdateInfra = @"AgentAutoUpdateInfra"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.HealthErrorCategory AgentAutoUpdateRunAsAccount = @"AgentAutoUpdateRunAsAccount"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.HealthErrorCategory AgentAutoUpdateRunAsAccountExpired = @"AgentAutoUpdateRunAsAccountExpired"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.HealthErrorCategory AgentAutoUpdateRunAsAccountExpiry = @"AgentAutoUpdateRunAsAccountExpiry"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.HealthErrorCategory Configuration = @"Configuration"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.HealthErrorCategory FabricInfrastructure = @"FabricInfrastructure"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.HealthErrorCategory None = @"None"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.HealthErrorCategory Replication = @"Replication"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.HealthErrorCategory TestFailover = @"TestFailover"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.HealthErrorCategory VersionExpiry = @"VersionExpiry"; + + /// the value for an instance of the Enum. + private string _value { get; set; } + + /// Conversion from arbitrary object to HealthErrorCategory + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new HealthErrorCategory(global::System.Convert.ToString(value)); + } + + /// Compares values of enum type HealthErrorCategory + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.HealthErrorCategory e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type HealthErrorCategory (override for Object) + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is HealthErrorCategory && Equals((HealthErrorCategory)obj); + } + + /// Returns hashCode for enum HealthErrorCategory + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Creates an instance of the Enum class. + /// the value to create an instance for. + private HealthErrorCategory(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Returns string representation for HealthErrorCategory + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to HealthErrorCategory + /// the value to convert to an instance of . + + public static implicit operator HealthErrorCategory(string value) + { + return new HealthErrorCategory(value); + } + + /// Implicit operator to convert HealthErrorCategory to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.HealthErrorCategory e) + { + return e._value; + } + + /// Overriding != operator for enum HealthErrorCategory + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.HealthErrorCategory e1, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.HealthErrorCategory e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum HealthErrorCategory + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.HealthErrorCategory e1, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.HealthErrorCategory e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/HealthErrorCustomerResolvability.Completer.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/HealthErrorCustomerResolvability.Completer.cs new file mode 100644 index 000000000000..f6708908ade5 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/HealthErrorCustomerResolvability.Completer.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// Value indicating whether the health error is customer resolvable. + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.HealthErrorCustomerResolvabilityTypeConverter))] + public partial struct HealthErrorCustomerResolvability : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Allowed".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Allowed'", "Allowed", global::System.Management.Automation.CompletionResultType.ParameterValue, "Allowed"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "NotAllowed".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'NotAllowed'", "NotAllowed", global::System.Management.Automation.CompletionResultType.ParameterValue, "NotAllowed"); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/HealthErrorCustomerResolvability.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/HealthErrorCustomerResolvability.TypeConverter.cs new file mode 100644 index 000000000000..ba0979dda9fc --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/HealthErrorCustomerResolvability.TypeConverter.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// Value indicating whether the health error is customer resolvable. + public partial class HealthErrorCustomerResolvabilityTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => HealthErrorCustomerResolvability.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/HealthErrorCustomerResolvability.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/HealthErrorCustomerResolvability.cs new file mode 100644 index 000000000000..322151e6dc69 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/HealthErrorCustomerResolvability.cs @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// Value indicating whether the health error is customer resolvable. + public partial struct HealthErrorCustomerResolvability : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.HealthErrorCustomerResolvability Allowed = @"Allowed"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.HealthErrorCustomerResolvability NotAllowed = @"NotAllowed"; + + /// + /// the value for an instance of the Enum. + /// + private string _value { get; set; } + + /// Conversion from arbitrary object to HealthErrorCustomerResolvability + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new HealthErrorCustomerResolvability(global::System.Convert.ToString(value)); + } + + /// Compares values of enum type HealthErrorCustomerResolvability + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.HealthErrorCustomerResolvability e) + { + return _value.Equals(e._value); + } + + /// + /// Compares values of enum type HealthErrorCustomerResolvability (override for Object) + /// + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is HealthErrorCustomerResolvability && Equals((HealthErrorCustomerResolvability)obj); + } + + /// Returns hashCode for enum HealthErrorCustomerResolvability + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// + /// Creates an instance of the Enum class. + /// + /// the value to create an instance for. + private HealthErrorCustomerResolvability(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Returns string representation for HealthErrorCustomerResolvability + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to HealthErrorCustomerResolvability + /// the value to convert to an instance of . + + public static implicit operator HealthErrorCustomerResolvability(string value) + { + return new HealthErrorCustomerResolvability(value); + } + + /// Implicit operator to convert HealthErrorCustomerResolvability to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.HealthErrorCustomerResolvability e) + { + return e._value; + } + + /// Overriding != operator for enum HealthErrorCustomerResolvability + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.HealthErrorCustomerResolvability e1, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.HealthErrorCustomerResolvability e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum HealthErrorCustomerResolvability + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.HealthErrorCustomerResolvability e1, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.HealthErrorCustomerResolvability e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/HyperVReplicaAzureRpRecoveryPointType.Completer.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/HyperVReplicaAzureRpRecoveryPointType.Completer.cs new file mode 100644 index 000000000000..24508fd231bf --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/HyperVReplicaAzureRpRecoveryPointType.Completer.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// The recovery point type. + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.HyperVReplicaAzureRpRecoveryPointTypeTypeConverter))] + public partial struct HyperVReplicaAzureRpRecoveryPointType : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Latest".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Latest'", "Latest", global::System.Management.Automation.CompletionResultType.ParameterValue, "Latest"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "LatestApplicationConsistent".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'LatestApplicationConsistent'", "LatestApplicationConsistent", global::System.Management.Automation.CompletionResultType.ParameterValue, "LatestApplicationConsistent"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "LatestProcessed".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'LatestProcessed'", "LatestProcessed", global::System.Management.Automation.CompletionResultType.ParameterValue, "LatestProcessed"); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/HyperVReplicaAzureRpRecoveryPointType.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/HyperVReplicaAzureRpRecoveryPointType.TypeConverter.cs new file mode 100644 index 000000000000..b36e208d94a8 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/HyperVReplicaAzureRpRecoveryPointType.TypeConverter.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// The recovery point type. + public partial class HyperVReplicaAzureRpRecoveryPointTypeTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => HyperVReplicaAzureRpRecoveryPointType.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/HyperVReplicaAzureRpRecoveryPointType.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/HyperVReplicaAzureRpRecoveryPointType.cs new file mode 100644 index 000000000000..44b95b3a1639 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/HyperVReplicaAzureRpRecoveryPointType.cs @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// The recovery point type. + public partial struct HyperVReplicaAzureRpRecoveryPointType : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.HyperVReplicaAzureRpRecoveryPointType Latest = @"Latest"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.HyperVReplicaAzureRpRecoveryPointType LatestApplicationConsistent = @"LatestApplicationConsistent"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.HyperVReplicaAzureRpRecoveryPointType LatestProcessed = @"LatestProcessed"; + + /// + /// the value for an instance of the Enum. + /// + private string _value { get; set; } + + /// Conversion from arbitrary object to HyperVReplicaAzureRpRecoveryPointType + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new HyperVReplicaAzureRpRecoveryPointType(global::System.Convert.ToString(value)); + } + + /// Compares values of enum type HyperVReplicaAzureRpRecoveryPointType + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.HyperVReplicaAzureRpRecoveryPointType e) + { + return _value.Equals(e._value); + } + + /// + /// Compares values of enum type HyperVReplicaAzureRpRecoveryPointType (override for Object) + /// + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is HyperVReplicaAzureRpRecoveryPointType && Equals((HyperVReplicaAzureRpRecoveryPointType)obj); + } + + /// Returns hashCode for enum HyperVReplicaAzureRpRecoveryPointType + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// + /// Creates an instance of the Enum class. + /// + /// the value to create an instance for. + private HyperVReplicaAzureRpRecoveryPointType(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Returns string representation for HyperVReplicaAzureRpRecoveryPointType + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to HyperVReplicaAzureRpRecoveryPointType + /// the value to convert to an instance of . + + public static implicit operator HyperVReplicaAzureRpRecoveryPointType(string value) + { + return new HyperVReplicaAzureRpRecoveryPointType(value); + } + + /// Implicit operator to convert HyperVReplicaAzureRpRecoveryPointType to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.HyperVReplicaAzureRpRecoveryPointType e) + { + return e._value; + } + + /// Overriding != operator for enum HyperVReplicaAzureRpRecoveryPointType + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.HyperVReplicaAzureRpRecoveryPointType e1, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.HyperVReplicaAzureRpRecoveryPointType e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum HyperVReplicaAzureRpRecoveryPointType + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.HyperVReplicaAzureRpRecoveryPointType e1, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.HyperVReplicaAzureRpRecoveryPointType e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/InMageRcmFailbackRecoveryPointType.Completer.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/InMageRcmFailbackRecoveryPointType.Completer.cs new file mode 100644 index 000000000000..2f216c12db25 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/InMageRcmFailbackRecoveryPointType.Completer.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// The recovery point type. + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.InMageRcmFailbackRecoveryPointTypeTypeConverter))] + public partial struct InMageRcmFailbackRecoveryPointType : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "ApplicationConsistent".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'ApplicationConsistent'", "ApplicationConsistent", global::System.Management.Automation.CompletionResultType.ParameterValue, "ApplicationConsistent"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "CrashConsistent".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'CrashConsistent'", "CrashConsistent", global::System.Management.Automation.CompletionResultType.ParameterValue, "CrashConsistent"); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/InMageRcmFailbackRecoveryPointType.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/InMageRcmFailbackRecoveryPointType.TypeConverter.cs new file mode 100644 index 000000000000..10d50f8cf770 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/InMageRcmFailbackRecoveryPointType.TypeConverter.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// The recovery point type. + public partial class InMageRcmFailbackRecoveryPointTypeTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => InMageRcmFailbackRecoveryPointType.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/InMageRcmFailbackRecoveryPointType.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/InMageRcmFailbackRecoveryPointType.cs new file mode 100644 index 000000000000..0bb561d86bc8 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/InMageRcmFailbackRecoveryPointType.cs @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// The recovery point type. + public partial struct InMageRcmFailbackRecoveryPointType : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.InMageRcmFailbackRecoveryPointType ApplicationConsistent = @"ApplicationConsistent"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.InMageRcmFailbackRecoveryPointType CrashConsistent = @"CrashConsistent"; + + /// + /// the value for an instance of the Enum. + /// + private string _value { get; set; } + + /// Conversion from arbitrary object to InMageRcmFailbackRecoveryPointType + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new InMageRcmFailbackRecoveryPointType(global::System.Convert.ToString(value)); + } + + /// Compares values of enum type InMageRcmFailbackRecoveryPointType + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.InMageRcmFailbackRecoveryPointType e) + { + return _value.Equals(e._value); + } + + /// + /// Compares values of enum type InMageRcmFailbackRecoveryPointType (override for Object) + /// + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is InMageRcmFailbackRecoveryPointType && Equals((InMageRcmFailbackRecoveryPointType)obj); + } + + /// Returns hashCode for enum InMageRcmFailbackRecoveryPointType + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// + /// Creates an instance of the Enum class. + /// + /// the value to create an instance for. + private InMageRcmFailbackRecoveryPointType(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Returns string representation for InMageRcmFailbackRecoveryPointType + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to InMageRcmFailbackRecoveryPointType + /// the value to convert to an instance of . + + public static implicit operator InMageRcmFailbackRecoveryPointType(string value) + { + return new InMageRcmFailbackRecoveryPointType(value); + } + + /// Implicit operator to convert InMageRcmFailbackRecoveryPointType to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.InMageRcmFailbackRecoveryPointType e) + { + return e._value; + } + + /// Overriding != operator for enum InMageRcmFailbackRecoveryPointType + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.InMageRcmFailbackRecoveryPointType e1, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.InMageRcmFailbackRecoveryPointType e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum InMageRcmFailbackRecoveryPointType + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.InMageRcmFailbackRecoveryPointType e1, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.InMageRcmFailbackRecoveryPointType e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/InMageV2RpRecoveryPointType.Completer.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/InMageV2RpRecoveryPointType.Completer.cs new file mode 100644 index 000000000000..fa2c9d39873e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/InMageV2RpRecoveryPointType.Completer.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// The recovery point type. + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.InMageV2RpRecoveryPointTypeTypeConverter))] + public partial struct InMageV2RpRecoveryPointType : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Latest".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Latest'", "Latest", global::System.Management.Automation.CompletionResultType.ParameterValue, "Latest"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "LatestApplicationConsistent".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'LatestApplicationConsistent'", "LatestApplicationConsistent", global::System.Management.Automation.CompletionResultType.ParameterValue, "LatestApplicationConsistent"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "LatestCrashConsistent".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'LatestCrashConsistent'", "LatestCrashConsistent", global::System.Management.Automation.CompletionResultType.ParameterValue, "LatestCrashConsistent"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "LatestProcessed".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'LatestProcessed'", "LatestProcessed", global::System.Management.Automation.CompletionResultType.ParameterValue, "LatestProcessed"); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/InMageV2RpRecoveryPointType.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/InMageV2RpRecoveryPointType.TypeConverter.cs new file mode 100644 index 000000000000..2b098545d1c5 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/InMageV2RpRecoveryPointType.TypeConverter.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// The recovery point type. + public partial class InMageV2RpRecoveryPointTypeTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => InMageV2RpRecoveryPointType.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/InMageV2RpRecoveryPointType.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/InMageV2RpRecoveryPointType.cs new file mode 100644 index 000000000000..aed9b79bdae8 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/InMageV2RpRecoveryPointType.cs @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// The recovery point type. + public partial struct InMageV2RpRecoveryPointType : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.InMageV2RpRecoveryPointType Latest = @"Latest"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.InMageV2RpRecoveryPointType LatestApplicationConsistent = @"LatestApplicationConsistent"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.InMageV2RpRecoveryPointType LatestCrashConsistent = @"LatestCrashConsistent"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.InMageV2RpRecoveryPointType LatestProcessed = @"LatestProcessed"; + + /// + /// the value for an instance of the Enum. + /// + private string _value { get; set; } + + /// Conversion from arbitrary object to InMageV2RpRecoveryPointType + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new InMageV2RpRecoveryPointType(global::System.Convert.ToString(value)); + } + + /// Compares values of enum type InMageV2RpRecoveryPointType + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.InMageV2RpRecoveryPointType e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type InMageV2RpRecoveryPointType (override for Object) + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is InMageV2RpRecoveryPointType && Equals((InMageV2RpRecoveryPointType)obj); + } + + /// Returns hashCode for enum InMageV2RpRecoveryPointType + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// + /// Creates an instance of the Enum class. + /// + /// the value to create an instance for. + private InMageV2RpRecoveryPointType(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Returns string representation for InMageV2RpRecoveryPointType + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to InMageV2RpRecoveryPointType + /// the value to convert to an instance of . + + public static implicit operator InMageV2RpRecoveryPointType(string value) + { + return new InMageV2RpRecoveryPointType(value); + } + + /// Implicit operator to convert InMageV2RpRecoveryPointType to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.InMageV2RpRecoveryPointType e) + { + return e._value; + } + + /// Overriding != operator for enum InMageV2RpRecoveryPointType + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.InMageV2RpRecoveryPointType e1, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.InMageV2RpRecoveryPointType e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum InMageV2RpRecoveryPointType + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.InMageV2RpRecoveryPointType e1, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.InMageV2RpRecoveryPointType e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/LicenseType.Completer.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/LicenseType.Completer.cs new file mode 100644 index 000000000000..795d475318b0 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/LicenseType.Completer.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// License type. + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.LicenseTypeTypeConverter))] + public partial struct LicenseType : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "NotSpecified".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'NotSpecified'", "NotSpecified", global::System.Management.Automation.CompletionResultType.ParameterValue, "NotSpecified"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "NoLicenseType".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'NoLicenseType'", "NoLicenseType", global::System.Management.Automation.CompletionResultType.ParameterValue, "NoLicenseType"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "WindowsServer".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'WindowsServer'", "WindowsServer", global::System.Management.Automation.CompletionResultType.ParameterValue, "WindowsServer"); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/LicenseType.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/LicenseType.TypeConverter.cs new file mode 100644 index 000000000000..a96f50e5e01c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/LicenseType.TypeConverter.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// License type. + public partial class LicenseTypeTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => LicenseType.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/LicenseType.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/LicenseType.cs new file mode 100644 index 000000000000..7820a5a1d716 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/LicenseType.cs @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// License type. + public partial struct LicenseType : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.LicenseType NoLicenseType = @"NoLicenseType"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.LicenseType NotSpecified = @"NotSpecified"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.LicenseType WindowsServer = @"WindowsServer"; + + /// the value for an instance of the Enum. + private string _value { get; set; } + + /// Conversion from arbitrary object to LicenseType + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new LicenseType(global::System.Convert.ToString(value)); + } + + /// Compares values of enum type LicenseType + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.LicenseType e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type LicenseType (override for Object) + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is LicenseType && Equals((LicenseType)obj); + } + + /// Returns hashCode for enum LicenseType + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Creates an instance of the Enum class. + /// the value to create an instance for. + private LicenseType(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Returns string representation for LicenseType + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to LicenseType + /// the value to convert to an instance of . + + public static implicit operator LicenseType(string value) + { + return new LicenseType(value); + } + + /// Implicit operator to convert LicenseType to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.LicenseType e) + { + return e._value; + } + + /// Overriding != operator for enum LicenseType + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.LicenseType e1, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.LicenseType e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum LicenseType + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.LicenseType e1, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.LicenseType e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/MigrationItemOperation.Completer.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/MigrationItemOperation.Completer.cs new file mode 100644 index 000000000000..436a0cf0cf03 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/MigrationItemOperation.Completer.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// Argument completer implementation for MigrationItemOperation. + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationItemOperationTypeConverter))] + public partial struct MigrationItemOperation : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "DisableMigration".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'DisableMigration'", "DisableMigration", global::System.Management.Automation.CompletionResultType.ParameterValue, "DisableMigration"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "TestMigrate".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'TestMigrate'", "TestMigrate", global::System.Management.Automation.CompletionResultType.ParameterValue, "TestMigrate"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "TestMigrateCleanup".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'TestMigrateCleanup'", "TestMigrateCleanup", global::System.Management.Automation.CompletionResultType.ParameterValue, "TestMigrateCleanup"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Migrate".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Migrate'", "Migrate", global::System.Management.Automation.CompletionResultType.ParameterValue, "Migrate"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "StartResync".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'StartResync'", "StartResync", global::System.Management.Automation.CompletionResultType.ParameterValue, "StartResync"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "PauseReplication".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'PauseReplication'", "PauseReplication", global::System.Management.Automation.CompletionResultType.ParameterValue, "PauseReplication"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "ResumeReplication".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'ResumeReplication'", "ResumeReplication", global::System.Management.Automation.CompletionResultType.ParameterValue, "ResumeReplication"); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/MigrationItemOperation.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/MigrationItemOperation.TypeConverter.cs new file mode 100644 index 000000000000..e3a87887559c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/MigrationItemOperation.TypeConverter.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// TypeConverter implementation for MigrationItemOperation. + public partial class MigrationItemOperationTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => MigrationItemOperation.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/MigrationItemOperation.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/MigrationItemOperation.cs new file mode 100644 index 000000000000..79e00a806216 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/MigrationItemOperation.cs @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + public partial struct MigrationItemOperation : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationItemOperation DisableMigration = @"DisableMigration"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationItemOperation Migrate = @"Migrate"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationItemOperation PauseReplication = @"PauseReplication"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationItemOperation ResumeReplication = @"ResumeReplication"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationItemOperation StartResync = @"StartResync"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationItemOperation TestMigrate = @"TestMigrate"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationItemOperation TestMigrateCleanup = @"TestMigrateCleanup"; + + /// the value for an instance of the Enum. + private string _value { get; set; } + + /// Conversion from arbitrary object to MigrationItemOperation + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new MigrationItemOperation(global::System.Convert.ToString(value)); + } + + /// Compares values of enum type MigrationItemOperation + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationItemOperation e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type MigrationItemOperation (override for Object) + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is MigrationItemOperation && Equals((MigrationItemOperation)obj); + } + + /// Returns hashCode for enum MigrationItemOperation + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Creates an instance of the Enum class. + /// the value to create an instance for. + private MigrationItemOperation(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Returns string representation for MigrationItemOperation + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to MigrationItemOperation + /// the value to convert to an instance of . + + public static implicit operator MigrationItemOperation(string value) + { + return new MigrationItemOperation(value); + } + + /// Implicit operator to convert MigrationItemOperation to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationItemOperation e) + { + return e._value; + } + + /// Overriding != operator for enum MigrationItemOperation + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationItemOperation e1, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationItemOperation e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum MigrationItemOperation + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationItemOperation e1, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationItemOperation e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/MigrationRecoveryPointType.Completer.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/MigrationRecoveryPointType.Completer.cs new file mode 100644 index 000000000000..075649d44e54 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/MigrationRecoveryPointType.Completer.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// The recovery point type. + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationRecoveryPointTypeTypeConverter))] + public partial struct MigrationRecoveryPointType : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "NotSpecified".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'NotSpecified'", "NotSpecified", global::System.Management.Automation.CompletionResultType.ParameterValue, "NotSpecified"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "ApplicationConsistent".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'ApplicationConsistent'", "ApplicationConsistent", global::System.Management.Automation.CompletionResultType.ParameterValue, "ApplicationConsistent"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "CrashConsistent".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'CrashConsistent'", "CrashConsistent", global::System.Management.Automation.CompletionResultType.ParameterValue, "CrashConsistent"); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/MigrationRecoveryPointType.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/MigrationRecoveryPointType.TypeConverter.cs new file mode 100644 index 000000000000..cfb62ac6ab82 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/MigrationRecoveryPointType.TypeConverter.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// The recovery point type. + public partial class MigrationRecoveryPointTypeTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => MigrationRecoveryPointType.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/MigrationRecoveryPointType.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/MigrationRecoveryPointType.cs new file mode 100644 index 000000000000..ed9c9d834910 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/MigrationRecoveryPointType.cs @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// The recovery point type. + public partial struct MigrationRecoveryPointType : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationRecoveryPointType ApplicationConsistent = @"ApplicationConsistent"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationRecoveryPointType CrashConsistent = @"CrashConsistent"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationRecoveryPointType NotSpecified = @"NotSpecified"; + + /// + /// the value for an instance of the Enum. + /// + private string _value { get; set; } + + /// Conversion from arbitrary object to MigrationRecoveryPointType + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new MigrationRecoveryPointType(global::System.Convert.ToString(value)); + } + + /// Compares values of enum type MigrationRecoveryPointType + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationRecoveryPointType e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type MigrationRecoveryPointType (override for Object) + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is MigrationRecoveryPointType && Equals((MigrationRecoveryPointType)obj); + } + + /// Returns hashCode for enum MigrationRecoveryPointType + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Creates an instance of the Enum class. + /// the value to create an instance for. + private MigrationRecoveryPointType(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Returns string representation for MigrationRecoveryPointType + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to MigrationRecoveryPointType + /// the value to convert to an instance of . + + public static implicit operator MigrationRecoveryPointType(string value) + { + return new MigrationRecoveryPointType(value); + } + + /// Implicit operator to convert MigrationRecoveryPointType to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationRecoveryPointType e) + { + return e._value; + } + + /// Overriding != operator for enum MigrationRecoveryPointType + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationRecoveryPointType e1, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationRecoveryPointType e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum MigrationRecoveryPointType + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationRecoveryPointType e1, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationRecoveryPointType e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/MigrationState.Completer.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/MigrationState.Completer.cs new file mode 100644 index 000000000000..7c99773948d9 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/MigrationState.Completer.cs @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// The migration status. + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationStateTypeConverter))] + public partial struct MigrationState : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "None".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'None'", "None", global::System.Management.Automation.CompletionResultType.ParameterValue, "None"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "EnableMigrationInProgress".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'EnableMigrationInProgress'", "EnableMigrationInProgress", global::System.Management.Automation.CompletionResultType.ParameterValue, "EnableMigrationInProgress"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "EnableMigrationFailed".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'EnableMigrationFailed'", "EnableMigrationFailed", global::System.Management.Automation.CompletionResultType.ParameterValue, "EnableMigrationFailed"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "DisableMigrationInProgress".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'DisableMigrationInProgress'", "DisableMigrationInProgress", global::System.Management.Automation.CompletionResultType.ParameterValue, "DisableMigrationInProgress"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "DisableMigrationFailed".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'DisableMigrationFailed'", "DisableMigrationFailed", global::System.Management.Automation.CompletionResultType.ParameterValue, "DisableMigrationFailed"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "InitialSeedingInProgress".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'InitialSeedingInProgress'", "InitialSeedingInProgress", global::System.Management.Automation.CompletionResultType.ParameterValue, "InitialSeedingInProgress"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "InitialSeedingFailed".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'InitialSeedingFailed'", "InitialSeedingFailed", global::System.Management.Automation.CompletionResultType.ParameterValue, "InitialSeedingFailed"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Replicating".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Replicating'", "Replicating", global::System.Management.Automation.CompletionResultType.ParameterValue, "Replicating"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "MigrationInProgress".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'MigrationInProgress'", "MigrationInProgress", global::System.Management.Automation.CompletionResultType.ParameterValue, "MigrationInProgress"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "MigrationSucceeded".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'MigrationSucceeded'", "MigrationSucceeded", global::System.Management.Automation.CompletionResultType.ParameterValue, "MigrationSucceeded"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "MigrationFailed".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'MigrationFailed'", "MigrationFailed", global::System.Management.Automation.CompletionResultType.ParameterValue, "MigrationFailed"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "ResumeInProgress".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'ResumeInProgress'", "ResumeInProgress", global::System.Management.Automation.CompletionResultType.ParameterValue, "ResumeInProgress"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "ResumeInitiated".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'ResumeInitiated'", "ResumeInitiated", global::System.Management.Automation.CompletionResultType.ParameterValue, "ResumeInitiated"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "SuspendingProtection".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'SuspendingProtection'", "SuspendingProtection", global::System.Management.Automation.CompletionResultType.ParameterValue, "SuspendingProtection"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "ProtectionSuspended".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'ProtectionSuspended'", "ProtectionSuspended", global::System.Management.Automation.CompletionResultType.ParameterValue, "ProtectionSuspended"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "MigrationCompletedWithInformation".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'MigrationCompletedWithInformation'", "MigrationCompletedWithInformation", global::System.Management.Automation.CompletionResultType.ParameterValue, "MigrationCompletedWithInformation"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "MigrationPartiallySucceeded".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'MigrationPartiallySucceeded'", "MigrationPartiallySucceeded", global::System.Management.Automation.CompletionResultType.ParameterValue, "MigrationPartiallySucceeded"); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/MigrationState.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/MigrationState.TypeConverter.cs new file mode 100644 index 000000000000..762640f329d4 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/MigrationState.TypeConverter.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// The migration status. + public partial class MigrationStateTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => MigrationState.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/MigrationState.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/MigrationState.cs new file mode 100644 index 000000000000..1dcc6e87ed3b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/MigrationState.cs @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// The migration status. + public partial struct MigrationState : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationState DisableMigrationFailed = @"DisableMigrationFailed"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationState DisableMigrationInProgress = @"DisableMigrationInProgress"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationState EnableMigrationFailed = @"EnableMigrationFailed"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationState EnableMigrationInProgress = @"EnableMigrationInProgress"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationState InitialSeedingFailed = @"InitialSeedingFailed"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationState InitialSeedingInProgress = @"InitialSeedingInProgress"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationState MigrationCompletedWithInformation = @"MigrationCompletedWithInformation"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationState MigrationFailed = @"MigrationFailed"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationState MigrationInProgress = @"MigrationInProgress"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationState MigrationPartiallySucceeded = @"MigrationPartiallySucceeded"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationState MigrationSucceeded = @"MigrationSucceeded"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationState None = @"None"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationState ProtectionSuspended = @"ProtectionSuspended"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationState Replicating = @"Replicating"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationState ResumeInProgress = @"ResumeInProgress"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationState ResumeInitiated = @"ResumeInitiated"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationState SuspendingProtection = @"SuspendingProtection"; + + /// the value for an instance of the Enum. + private string _value { get; set; } + + /// Conversion from arbitrary object to MigrationState + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new MigrationState(global::System.Convert.ToString(value)); + } + + /// Compares values of enum type MigrationState + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationState e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type MigrationState (override for Object) + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is MigrationState && Equals((MigrationState)obj); + } + + /// Returns hashCode for enum MigrationState + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Creates an instance of the Enum class. + /// the value to create an instance for. + private MigrationState(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Returns string representation for MigrationState + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to MigrationState + /// the value to convert to an instance of . + + public static implicit operator MigrationState(string value) + { + return new MigrationState(value); + } + + /// Implicit operator to convert MigrationState to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationState e) + { + return e._value; + } + + /// Overriding != operator for enum MigrationState + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationState e1, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationState e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum MigrationState + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationState e1, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MigrationState e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/MobilityAgentUpgradeState.Completer.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/MobilityAgentUpgradeState.Completer.cs new file mode 100644 index 000000000000..2003c4385aef --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/MobilityAgentUpgradeState.Completer.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// The agent auto upgrade state. + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MobilityAgentUpgradeStateTypeConverter))] + public partial struct MobilityAgentUpgradeState : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "None".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'None'", "None", global::System.Management.Automation.CompletionResultType.ParameterValue, "None"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Started".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Started'", "Started", global::System.Management.Automation.CompletionResultType.ParameterValue, "Started"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Completed".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Completed'", "Completed", global::System.Management.Automation.CompletionResultType.ParameterValue, "Completed"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Commit".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Commit'", "Commit", global::System.Management.Automation.CompletionResultType.ParameterValue, "Commit"); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/MobilityAgentUpgradeState.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/MobilityAgentUpgradeState.TypeConverter.cs new file mode 100644 index 000000000000..86ea6b74d8f5 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/MobilityAgentUpgradeState.TypeConverter.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// The agent auto upgrade state. + public partial class MobilityAgentUpgradeStateTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => MobilityAgentUpgradeState.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/MobilityAgentUpgradeState.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/MobilityAgentUpgradeState.cs new file mode 100644 index 000000000000..65bc96d3faae --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/MobilityAgentUpgradeState.cs @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// The agent auto upgrade state. + public partial struct MobilityAgentUpgradeState : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MobilityAgentUpgradeState Commit = @"Commit"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MobilityAgentUpgradeState Completed = @"Completed"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MobilityAgentUpgradeState None = @"None"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MobilityAgentUpgradeState Started = @"Started"; + + /// the value for an instance of the Enum. + private string _value { get; set; } + + /// Conversion from arbitrary object to MobilityAgentUpgradeState + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new MobilityAgentUpgradeState(global::System.Convert.ToString(value)); + } + + /// Compares values of enum type MobilityAgentUpgradeState + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MobilityAgentUpgradeState e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type MobilityAgentUpgradeState (override for Object) + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is MobilityAgentUpgradeState && Equals((MobilityAgentUpgradeState)obj); + } + + /// Returns hashCode for enum MobilityAgentUpgradeState + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Creates an instance of the Enum class. + /// the value to create an instance for. + private MobilityAgentUpgradeState(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Returns string representation for MobilityAgentUpgradeState + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to MobilityAgentUpgradeState + /// the value to convert to an instance of . + + public static implicit operator MobilityAgentUpgradeState(string value) + { + return new MobilityAgentUpgradeState(value); + } + + /// Implicit operator to convert MobilityAgentUpgradeState to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MobilityAgentUpgradeState e) + { + return e._value; + } + + /// Overriding != operator for enum MobilityAgentUpgradeState + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MobilityAgentUpgradeState e1, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MobilityAgentUpgradeState e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum MobilityAgentUpgradeState + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MobilityAgentUpgradeState e1, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MobilityAgentUpgradeState e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/MultiVMGroupCreateOption.Completer.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/MultiVMGroupCreateOption.Completer.cs new file mode 100644 index 000000000000..0c7a4505c7a3 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/MultiVMGroupCreateOption.Completer.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// Whether Multi VM group is auto created or specified by user. + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MultiVMGroupCreateOptionTypeConverter))] + public partial struct MultiVMGroupCreateOption : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "AutoCreated".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'AutoCreated'", "AutoCreated", global::System.Management.Automation.CompletionResultType.ParameterValue, "AutoCreated"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "UserSpecified".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'UserSpecified'", "UserSpecified", global::System.Management.Automation.CompletionResultType.ParameterValue, "UserSpecified"); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/MultiVMGroupCreateOption.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/MultiVMGroupCreateOption.TypeConverter.cs new file mode 100644 index 000000000000..97427d77bd16 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/MultiVMGroupCreateOption.TypeConverter.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// Whether Multi VM group is auto created or specified by user. + public partial class MultiVMGroupCreateOptionTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => MultiVMGroupCreateOption.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/MultiVMGroupCreateOption.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/MultiVMGroupCreateOption.cs new file mode 100644 index 000000000000..da2de74f6981 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/MultiVMGroupCreateOption.cs @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// Whether Multi VM group is auto created or specified by user. + public partial struct MultiVMGroupCreateOption : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MultiVMGroupCreateOption AutoCreated = @"AutoCreated"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MultiVMGroupCreateOption UserSpecified = @"UserSpecified"; + + /// the value for an instance of the Enum. + private string _value { get; set; } + + /// Conversion from arbitrary object to MultiVMGroupCreateOption + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new MultiVMGroupCreateOption(global::System.Convert.ToString(value)); + } + + /// Compares values of enum type MultiVMGroupCreateOption + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MultiVMGroupCreateOption e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type MultiVMGroupCreateOption (override for Object) + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is MultiVMGroupCreateOption && Equals((MultiVMGroupCreateOption)obj); + } + + /// Returns hashCode for enum MultiVMGroupCreateOption + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Creates an instance of the Enum class. + /// the value to create an instance for. + private MultiVMGroupCreateOption(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Returns string representation for MultiVMGroupCreateOption + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to MultiVMGroupCreateOption + /// the value to convert to an instance of . + + public static implicit operator MultiVMGroupCreateOption(string value) + { + return new MultiVMGroupCreateOption(value); + } + + /// Implicit operator to convert MultiVMGroupCreateOption to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MultiVMGroupCreateOption e) + { + return e._value; + } + + /// Overriding != operator for enum MultiVMGroupCreateOption + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MultiVMGroupCreateOption e1, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MultiVMGroupCreateOption e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum MultiVMGroupCreateOption + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MultiVMGroupCreateOption e1, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MultiVMGroupCreateOption e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/MultiVMSyncPointOption.Completer.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/MultiVMSyncPointOption.Completer.cs new file mode 100644 index 000000000000..8d79b991c2be --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/MultiVMSyncPointOption.Completer.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// + /// A value indicating whether multi VM sync enabled VMs should use multi VM sync points for failover. + /// + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MultiVMSyncPointOptionTypeConverter))] + public partial struct MultiVMSyncPointOption : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "UseMultiVmSyncRecoveryPoint".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'UseMultiVmSyncRecoveryPoint'", "UseMultiVmSyncRecoveryPoint", global::System.Management.Automation.CompletionResultType.ParameterValue, "UseMultiVmSyncRecoveryPoint"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "UsePerVmRecoveryPoint".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'UsePerVmRecoveryPoint'", "UsePerVmRecoveryPoint", global::System.Management.Automation.CompletionResultType.ParameterValue, "UsePerVmRecoveryPoint"); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/MultiVMSyncPointOption.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/MultiVMSyncPointOption.TypeConverter.cs new file mode 100644 index 000000000000..90a727155e4a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/MultiVMSyncPointOption.TypeConverter.cs @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// + /// A value indicating whether multi VM sync enabled VMs should use multi VM sync points for failover. + /// + public partial class MultiVMSyncPointOptionTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => MultiVMSyncPointOption.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/MultiVMSyncPointOption.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/MultiVMSyncPointOption.cs new file mode 100644 index 000000000000..35bef5663a59 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/MultiVMSyncPointOption.cs @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// + /// A value indicating whether multi VM sync enabled VMs should use multi VM sync points for failover. + /// + public partial struct MultiVMSyncPointOption : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MultiVMSyncPointOption UseMultiVMSyncRecoveryPoint = @"UseMultiVmSyncRecoveryPoint"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MultiVMSyncPointOption UsePerVMRecoveryPoint = @"UsePerVmRecoveryPoint"; + + /// the value for an instance of the Enum. + private string _value { get; set; } + + /// Conversion from arbitrary object to MultiVMSyncPointOption + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new MultiVMSyncPointOption(global::System.Convert.ToString(value)); + } + + /// Compares values of enum type MultiVMSyncPointOption + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MultiVMSyncPointOption e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type MultiVMSyncPointOption (override for Object) + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is MultiVMSyncPointOption && Equals((MultiVMSyncPointOption)obj); + } + + /// Returns hashCode for enum MultiVMSyncPointOption + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Creates an instance of the Enum class. + /// the value to create an instance for. + private MultiVMSyncPointOption(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Returns string representation for MultiVMSyncPointOption + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to MultiVMSyncPointOption + /// the value to convert to an instance of . + + public static implicit operator MultiVMSyncPointOption(string value) + { + return new MultiVMSyncPointOption(value); + } + + /// Implicit operator to convert MultiVMSyncPointOption to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MultiVMSyncPointOption e) + { + return e._value; + } + + /// Overriding != operator for enum MultiVMSyncPointOption + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MultiVMSyncPointOption e1, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MultiVMSyncPointOption e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum MultiVMSyncPointOption + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MultiVMSyncPointOption e1, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.MultiVMSyncPointOption e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/PlannedFailoverStatus.Completer.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/PlannedFailoverStatus.Completer.cs new file mode 100644 index 000000000000..a8b9c6d14a78 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/PlannedFailoverStatus.Completer.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// The last planned failover status. + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PlannedFailoverStatusTypeConverter))] + public partial struct PlannedFailoverStatus : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Succeeded".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Succeeded'", "Succeeded", global::System.Management.Automation.CompletionResultType.ParameterValue, "Succeeded"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Failed".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Failed'", "Failed", global::System.Management.Automation.CompletionResultType.ParameterValue, "Failed"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Cancelled".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Cancelled'", "Cancelled", global::System.Management.Automation.CompletionResultType.ParameterValue, "Cancelled"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Unknown".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Unknown'", "Unknown", global::System.Management.Automation.CompletionResultType.ParameterValue, "Unknown"); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/PlannedFailoverStatus.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/PlannedFailoverStatus.TypeConverter.cs new file mode 100644 index 000000000000..68ff5f989842 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/PlannedFailoverStatus.TypeConverter.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// The last planned failover status. + public partial class PlannedFailoverStatusTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => PlannedFailoverStatus.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/PlannedFailoverStatus.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/PlannedFailoverStatus.cs new file mode 100644 index 000000000000..1f84c24f9477 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/PlannedFailoverStatus.cs @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// The last planned failover status. + public partial struct PlannedFailoverStatus : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PlannedFailoverStatus Cancelled = @"Cancelled"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PlannedFailoverStatus Failed = @"Failed"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PlannedFailoverStatus Succeeded = @"Succeeded"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PlannedFailoverStatus Unknown = @"Unknown"; + + /// the value for an instance of the Enum. + private string _value { get; set; } + + /// Conversion from arbitrary object to PlannedFailoverStatus + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new PlannedFailoverStatus(global::System.Convert.ToString(value)); + } + + /// Compares values of enum type PlannedFailoverStatus + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PlannedFailoverStatus e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type PlannedFailoverStatus (override for Object) + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is PlannedFailoverStatus && Equals((PlannedFailoverStatus)obj); + } + + /// Returns hashCode for enum PlannedFailoverStatus + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Creates an instance of the Enum class. + /// the value to create an instance for. + private PlannedFailoverStatus(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Returns string representation for PlannedFailoverStatus + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to PlannedFailoverStatus + /// the value to convert to an instance of . + + public static implicit operator PlannedFailoverStatus(string value) + { + return new PlannedFailoverStatus(value); + } + + /// Implicit operator to convert PlannedFailoverStatus to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PlannedFailoverStatus e) + { + return e._value; + } + + /// Overriding != operator for enum PlannedFailoverStatus + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PlannedFailoverStatus e1, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PlannedFailoverStatus e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum PlannedFailoverStatus + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PlannedFailoverStatus e1, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PlannedFailoverStatus e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/PossibleOperationsDirections.Completer.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/PossibleOperationsDirections.Completer.cs new file mode 100644 index 000000000000..e1424fb734d3 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/PossibleOperationsDirections.Completer.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// Argument completer implementation for PossibleOperationsDirections. + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirectionsTypeConverter))] + public partial struct PossibleOperationsDirections : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "PrimaryToRecovery".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'PrimaryToRecovery'", "PrimaryToRecovery", global::System.Management.Automation.CompletionResultType.ParameterValue, "PrimaryToRecovery"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "RecoveryToPrimary".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'RecoveryToPrimary'", "RecoveryToPrimary", global::System.Management.Automation.CompletionResultType.ParameterValue, "RecoveryToPrimary"); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/PossibleOperationsDirections.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/PossibleOperationsDirections.TypeConverter.cs new file mode 100644 index 000000000000..b87b430bd54b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/PossibleOperationsDirections.TypeConverter.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// TypeConverter implementation for PossibleOperationsDirections. + public partial class PossibleOperationsDirectionsTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => PossibleOperationsDirections.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/PossibleOperationsDirections.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/PossibleOperationsDirections.cs new file mode 100644 index 000000000000..c74120521fe3 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/PossibleOperationsDirections.cs @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + public partial struct PossibleOperationsDirections : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections PrimaryToRecovery = @"PrimaryToRecovery"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections RecoveryToPrimary = @"RecoveryToPrimary"; + + /// + /// the value for an instance of the Enum. + /// + private string _value { get; set; } + + /// Conversion from arbitrary object to PossibleOperationsDirections + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new PossibleOperationsDirections(global::System.Convert.ToString(value)); + } + + /// Compares values of enum type PossibleOperationsDirections + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type PossibleOperationsDirections (override for Object) + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is PossibleOperationsDirections && Equals((PossibleOperationsDirections)obj); + } + + /// Returns hashCode for enum PossibleOperationsDirections + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// + /// Creates an instance of the Enum class. + /// + /// the value to create an instance for. + private PossibleOperationsDirections(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Returns string representation for PossibleOperationsDirections + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to PossibleOperationsDirections + /// the value to convert to an instance of . + + public static implicit operator PossibleOperationsDirections(string value) + { + return new PossibleOperationsDirections(value); + } + + /// Implicit operator to convert PossibleOperationsDirections to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections e) + { + return e._value; + } + + /// Overriding != operator for enum PossibleOperationsDirections + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections e1, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum PossibleOperationsDirections + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections e1, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/PresenceStatus.Completer.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/PresenceStatus.Completer.cs new file mode 100644 index 000000000000..c20ed7afb70f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/PresenceStatus.Completer.cs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// + /// A value indicating whether the VM has a physical disk attached. String value of SrsDataContract.PresenceStatus enum. + /// + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PresenceStatusTypeConverter))] + public partial struct PresenceStatus : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Unknown".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Unknown'", "Unknown", global::System.Management.Automation.CompletionResultType.ParameterValue, "Unknown"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Present".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Present'", "Present", global::System.Management.Automation.CompletionResultType.ParameterValue, "Present"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "NotPresent".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'NotPresent'", "NotPresent", global::System.Management.Automation.CompletionResultType.ParameterValue, "NotPresent"); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/PresenceStatus.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/PresenceStatus.TypeConverter.cs new file mode 100644 index 000000000000..26a6f7322c01 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/PresenceStatus.TypeConverter.cs @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// + /// A value indicating whether the VM has a physical disk attached. String value of SrsDataContract.PresenceStatus enum. + /// + public partial class PresenceStatusTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => PresenceStatus.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/PresenceStatus.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/PresenceStatus.cs new file mode 100644 index 000000000000..3ef205122e79 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/PresenceStatus.cs @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// + /// A value indicating whether the VM has a physical disk attached. String value of SrsDataContract.PresenceStatus enum. + /// + public partial struct PresenceStatus : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PresenceStatus NotPresent = @"NotPresent"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PresenceStatus Present = @"Present"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PresenceStatus Unknown = @"Unknown"; + + /// the value for an instance of the Enum. + private string _value { get; set; } + + /// Conversion from arbitrary object to PresenceStatus + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new PresenceStatus(global::System.Convert.ToString(value)); + } + + /// Compares values of enum type PresenceStatus + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PresenceStatus e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type PresenceStatus (override for Object) + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is PresenceStatus && Equals((PresenceStatus)obj); + } + + /// Returns hashCode for enum PresenceStatus + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Creates an instance of the Enum class. + /// the value to create an instance for. + private PresenceStatus(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Returns string representation for PresenceStatus + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to PresenceStatus + /// the value to convert to an instance of . + + public static implicit operator PresenceStatus(string value) + { + return new PresenceStatus(value); + } + + /// Implicit operator to convert PresenceStatus to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PresenceStatus e) + { + return e._value; + } + + /// Overriding != operator for enum PresenceStatus + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PresenceStatus e1, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PresenceStatus e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum PresenceStatus + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PresenceStatus e1, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PresenceStatus e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/ProtectionHealth.Completer.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/ProtectionHealth.Completer.cs new file mode 100644 index 000000000000..291ebce42a06 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/ProtectionHealth.Completer.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// The health. + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealthTypeConverter))] + public partial struct ProtectionHealth : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "None".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'None'", "None", global::System.Management.Automation.CompletionResultType.ParameterValue, "None"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Normal".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Normal'", "Normal", global::System.Management.Automation.CompletionResultType.ParameterValue, "Normal"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Warning".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Warning'", "Warning", global::System.Management.Automation.CompletionResultType.ParameterValue, "Warning"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Critical".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Critical'", "Critical", global::System.Management.Automation.CompletionResultType.ParameterValue, "Critical"); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/ProtectionHealth.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/ProtectionHealth.TypeConverter.cs new file mode 100644 index 000000000000..6594b01607e1 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/ProtectionHealth.TypeConverter.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// The health. + public partial class ProtectionHealthTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ProtectionHealth.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/ProtectionHealth.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/ProtectionHealth.cs new file mode 100644 index 000000000000..279e3dc9f5ab --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/ProtectionHealth.cs @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// The health. + public partial struct ProtectionHealth : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth Critical = @"Critical"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth None = @"None"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth Normal = @"Normal"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth Warning = @"Warning"; + + /// the value for an instance of the Enum. + private string _value { get; set; } + + /// Conversion from arbitrary object to ProtectionHealth + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new ProtectionHealth(global::System.Convert.ToString(value)); + } + + /// Compares values of enum type ProtectionHealth + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type ProtectionHealth (override for Object) + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is ProtectionHealth && Equals((ProtectionHealth)obj); + } + + /// Returns hashCode for enum ProtectionHealth + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Creates an instance of the Enum class. + /// the value to create an instance for. + private ProtectionHealth(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Returns string representation for ProtectionHealth + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to ProtectionHealth + /// the value to convert to an instance of . + + public static implicit operator ProtectionHealth(string value) + { + return new ProtectionHealth(value); + } + + /// Implicit operator to convert ProtectionHealth to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth e) + { + return e._value; + } + + /// Overriding != operator for enum ProtectionHealth + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth e1, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum ProtectionHealth + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth e1, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ProtectionHealth e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/RcmComponentStatus.Completer.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/RcmComponentStatus.Completer.cs new file mode 100644 index 000000000000..71a57bf31443 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/RcmComponentStatus.Completer.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// The throughput status. + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RcmComponentStatusTypeConverter))] + public partial struct RcmComponentStatus : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Healthy".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Healthy'", "Healthy", global::System.Management.Automation.CompletionResultType.ParameterValue, "Healthy"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Warning".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Warning'", "Warning", global::System.Management.Automation.CompletionResultType.ParameterValue, "Warning"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Critical".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Critical'", "Critical", global::System.Management.Automation.CompletionResultType.ParameterValue, "Critical"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Unknown".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Unknown'", "Unknown", global::System.Management.Automation.CompletionResultType.ParameterValue, "Unknown"); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/RcmComponentStatus.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/RcmComponentStatus.TypeConverter.cs new file mode 100644 index 000000000000..fab9bf673642 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/RcmComponentStatus.TypeConverter.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// The throughput status. + public partial class RcmComponentStatusTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => RcmComponentStatus.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/RcmComponentStatus.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/RcmComponentStatus.cs new file mode 100644 index 000000000000..89c74e098c7e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/RcmComponentStatus.cs @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// The throughput status. + public partial struct RcmComponentStatus : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RcmComponentStatus Critical = @"Critical"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RcmComponentStatus Healthy = @"Healthy"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RcmComponentStatus Unknown = @"Unknown"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RcmComponentStatus Warning = @"Warning"; + + /// the value for an instance of the Enum. + private string _value { get; set; } + + /// Conversion from arbitrary object to RcmComponentStatus + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new RcmComponentStatus(global::System.Convert.ToString(value)); + } + + /// Compares values of enum type RcmComponentStatus + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RcmComponentStatus e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type RcmComponentStatus (override for Object) + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is RcmComponentStatus && Equals((RcmComponentStatus)obj); + } + + /// Returns hashCode for enum RcmComponentStatus + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Creates an instance of the Enum class. + /// the value to create an instance for. + private RcmComponentStatus(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Returns string representation for RcmComponentStatus + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to RcmComponentStatus + /// the value to convert to an instance of . + + public static implicit operator RcmComponentStatus(string value) + { + return new RcmComponentStatus(value); + } + + /// Implicit operator to convert RcmComponentStatus to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RcmComponentStatus e) + { + return e._value; + } + + /// Overriding != operator for enum RcmComponentStatus + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RcmComponentStatus e1, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RcmComponentStatus e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum RcmComponentStatus + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RcmComponentStatus e1, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RcmComponentStatus e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/RecoveryPlanActionLocation.Completer.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/RecoveryPlanActionLocation.Completer.cs new file mode 100644 index 000000000000..207f8195b3f1 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/RecoveryPlanActionLocation.Completer.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// The fabric location. + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPlanActionLocationTypeConverter))] + public partial struct RecoveryPlanActionLocation : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Primary".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Primary'", "Primary", global::System.Management.Automation.CompletionResultType.ParameterValue, "Primary"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Recovery".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Recovery'", "Recovery", global::System.Management.Automation.CompletionResultType.ParameterValue, "Recovery"); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/RecoveryPlanActionLocation.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/RecoveryPlanActionLocation.TypeConverter.cs new file mode 100644 index 000000000000..2bd1a1382b59 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/RecoveryPlanActionLocation.TypeConverter.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// The fabric location. + public partial class RecoveryPlanActionLocationTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => RecoveryPlanActionLocation.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/RecoveryPlanActionLocation.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/RecoveryPlanActionLocation.cs new file mode 100644 index 000000000000..a1ab617482cf --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/RecoveryPlanActionLocation.cs @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// The fabric location. + public partial struct RecoveryPlanActionLocation : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPlanActionLocation Primary = @"Primary"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPlanActionLocation Recovery = @"Recovery"; + + /// + /// the value for an instance of the Enum. + /// + private string _value { get; set; } + + /// Conversion from arbitrary object to RecoveryPlanActionLocation + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new RecoveryPlanActionLocation(global::System.Convert.ToString(value)); + } + + /// Compares values of enum type RecoveryPlanActionLocation + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPlanActionLocation e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type RecoveryPlanActionLocation (override for Object) + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is RecoveryPlanActionLocation && Equals((RecoveryPlanActionLocation)obj); + } + + /// Returns hashCode for enum RecoveryPlanActionLocation + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Creates an instance of the Enum class. + /// the value to create an instance for. + private RecoveryPlanActionLocation(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Returns string representation for RecoveryPlanActionLocation + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to RecoveryPlanActionLocation + /// the value to convert to an instance of . + + public static implicit operator RecoveryPlanActionLocation(string value) + { + return new RecoveryPlanActionLocation(value); + } + + /// Implicit operator to convert RecoveryPlanActionLocation to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPlanActionLocation e) + { + return e._value; + } + + /// Overriding != operator for enum RecoveryPlanActionLocation + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPlanActionLocation e1, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPlanActionLocation e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum RecoveryPlanActionLocation + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPlanActionLocation e1, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPlanActionLocation e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/RecoveryPlanGroupType.Completer.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/RecoveryPlanGroupType.Completer.cs new file mode 100644 index 000000000000..4d6d9b50fe2d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/RecoveryPlanGroupType.Completer.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// The group type. + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPlanGroupTypeTypeConverter))] + public partial struct RecoveryPlanGroupType : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Shutdown".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Shutdown'", "Shutdown", global::System.Management.Automation.CompletionResultType.ParameterValue, "Shutdown"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Boot".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Boot'", "Boot", global::System.Management.Automation.CompletionResultType.ParameterValue, "Boot"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Failover".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Failover'", "Failover", global::System.Management.Automation.CompletionResultType.ParameterValue, "Failover"); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/RecoveryPlanGroupType.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/RecoveryPlanGroupType.TypeConverter.cs new file mode 100644 index 000000000000..8c97425251c4 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/RecoveryPlanGroupType.TypeConverter.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// The group type. + public partial class RecoveryPlanGroupTypeTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => RecoveryPlanGroupType.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/RecoveryPlanGroupType.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/RecoveryPlanGroupType.cs new file mode 100644 index 000000000000..c1751d9e671f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/RecoveryPlanGroupType.cs @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// The group type. + public partial struct RecoveryPlanGroupType : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPlanGroupType Boot = @"Boot"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPlanGroupType Failover = @"Failover"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPlanGroupType Shutdown = @"Shutdown"; + + /// the value for an instance of the Enum. + private string _value { get; set; } + + /// Conversion from arbitrary object to RecoveryPlanGroupType + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new RecoveryPlanGroupType(global::System.Convert.ToString(value)); + } + + /// Compares values of enum type RecoveryPlanGroupType + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPlanGroupType e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type RecoveryPlanGroupType (override for Object) + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is RecoveryPlanGroupType && Equals((RecoveryPlanGroupType)obj); + } + + /// Returns hashCode for enum RecoveryPlanGroupType + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Creates an instance of the Enum class. + /// the value to create an instance for. + private RecoveryPlanGroupType(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Returns string representation for RecoveryPlanGroupType + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to RecoveryPlanGroupType + /// the value to convert to an instance of . + + public static implicit operator RecoveryPlanGroupType(string value) + { + return new RecoveryPlanGroupType(value); + } + + /// Implicit operator to convert RecoveryPlanGroupType to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPlanGroupType e) + { + return e._value; + } + + /// Overriding != operator for enum RecoveryPlanGroupType + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPlanGroupType e1, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPlanGroupType e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum RecoveryPlanGroupType + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPlanGroupType e1, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPlanGroupType e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/RecoveryPlanPointType.Completer.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/RecoveryPlanPointType.Completer.cs new file mode 100644 index 000000000000..9f76356fbd32 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/RecoveryPlanPointType.Completer.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// The recovery point type. + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPlanPointTypeTypeConverter))] + public partial struct RecoveryPlanPointType : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Latest".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Latest'", "Latest", global::System.Management.Automation.CompletionResultType.ParameterValue, "Latest"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "LatestApplicationConsistent".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'LatestApplicationConsistent'", "LatestApplicationConsistent", global::System.Management.Automation.CompletionResultType.ParameterValue, "LatestApplicationConsistent"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "LatestCrashConsistent".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'LatestCrashConsistent'", "LatestCrashConsistent", global::System.Management.Automation.CompletionResultType.ParameterValue, "LatestCrashConsistent"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "LatestProcessed".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'LatestProcessed'", "LatestProcessed", global::System.Management.Automation.CompletionResultType.ParameterValue, "LatestProcessed"); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/RecoveryPlanPointType.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/RecoveryPlanPointType.TypeConverter.cs new file mode 100644 index 000000000000..56b47e1f10b9 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/RecoveryPlanPointType.TypeConverter.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// The recovery point type. + public partial class RecoveryPlanPointTypeTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => RecoveryPlanPointType.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/RecoveryPlanPointType.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/RecoveryPlanPointType.cs new file mode 100644 index 000000000000..d66e4363aaef --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/RecoveryPlanPointType.cs @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// The recovery point type. + public partial struct RecoveryPlanPointType : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPlanPointType Latest = @"Latest"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPlanPointType LatestApplicationConsistent = @"LatestApplicationConsistent"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPlanPointType LatestCrashConsistent = @"LatestCrashConsistent"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPlanPointType LatestProcessed = @"LatestProcessed"; + + /// the value for an instance of the Enum. + private string _value { get; set; } + + /// Conversion from arbitrary object to RecoveryPlanPointType + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new RecoveryPlanPointType(global::System.Convert.ToString(value)); + } + + /// Compares values of enum type RecoveryPlanPointType + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPlanPointType e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type RecoveryPlanPointType (override for Object) + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is RecoveryPlanPointType && Equals((RecoveryPlanPointType)obj); + } + + /// Returns hashCode for enum RecoveryPlanPointType + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Creates an instance of the Enum class. + /// the value to create an instance for. + private RecoveryPlanPointType(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Returns string representation for RecoveryPlanPointType + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to RecoveryPlanPointType + /// the value to convert to an instance of . + + public static implicit operator RecoveryPlanPointType(string value) + { + return new RecoveryPlanPointType(value); + } + + /// Implicit operator to convert RecoveryPlanPointType to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPlanPointType e) + { + return e._value; + } + + /// Overriding != operator for enum RecoveryPlanPointType + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPlanPointType e1, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPlanPointType e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum RecoveryPlanPointType + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPlanPointType e1, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPlanPointType e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/RecoveryPointSyncType.Completer.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/RecoveryPointSyncType.Completer.cs new file mode 100644 index 000000000000..bf525515f99c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/RecoveryPointSyncType.Completer.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// A value indicating whether the recovery point is multi VM consistent. + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPointSyncTypeTypeConverter))] + public partial struct RecoveryPointSyncType : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "MultiVmSyncRecoveryPoint".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'MultiVmSyncRecoveryPoint'", "MultiVmSyncRecoveryPoint", global::System.Management.Automation.CompletionResultType.ParameterValue, "MultiVmSyncRecoveryPoint"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "PerVmRecoveryPoint".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'PerVmRecoveryPoint'", "PerVmRecoveryPoint", global::System.Management.Automation.CompletionResultType.ParameterValue, "PerVmRecoveryPoint"); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/RecoveryPointSyncType.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/RecoveryPointSyncType.TypeConverter.cs new file mode 100644 index 000000000000..80dcba4160fe --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/RecoveryPointSyncType.TypeConverter.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// A value indicating whether the recovery point is multi VM consistent. + public partial class RecoveryPointSyncTypeTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => RecoveryPointSyncType.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/RecoveryPointSyncType.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/RecoveryPointSyncType.cs new file mode 100644 index 000000000000..af1da6dbeaac --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/RecoveryPointSyncType.cs @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// A value indicating whether the recovery point is multi VM consistent. + public partial struct RecoveryPointSyncType : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPointSyncType MultiVMSyncRecoveryPoint = @"MultiVmSyncRecoveryPoint"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPointSyncType PerVMRecoveryPoint = @"PerVmRecoveryPoint"; + + /// the value for an instance of the Enum. + private string _value { get; set; } + + /// Conversion from arbitrary object to RecoveryPointSyncType + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new RecoveryPointSyncType(global::System.Convert.ToString(value)); + } + + /// Compares values of enum type RecoveryPointSyncType + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPointSyncType e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type RecoveryPointSyncType (override for Object) + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is RecoveryPointSyncType && Equals((RecoveryPointSyncType)obj); + } + + /// Returns hashCode for enum RecoveryPointSyncType + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Creates an instance of the Enum class. + /// the value to create an instance for. + private RecoveryPointSyncType(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Returns string representation for RecoveryPointSyncType + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to RecoveryPointSyncType + /// the value to convert to an instance of . + + public static implicit operator RecoveryPointSyncType(string value) + { + return new RecoveryPointSyncType(value); + } + + /// Implicit operator to convert RecoveryPointSyncType to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPointSyncType e) + { + return e._value; + } + + /// Overriding != operator for enum RecoveryPointSyncType + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPointSyncType e1, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPointSyncType e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum RecoveryPointSyncType + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPointSyncType e1, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPointSyncType e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/RecoveryPointType.Completer.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/RecoveryPointType.Completer.cs new file mode 100644 index 000000000000..ab2acc457b8f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/RecoveryPointType.Completer.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// + /// 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. + /// + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPointTypeTypeConverter))] + public partial struct RecoveryPointType : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "LatestTime".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'LatestTime'", "LatestTime", global::System.Management.Automation.CompletionResultType.ParameterValue, "LatestTime"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "LatestTag".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'LatestTag'", "LatestTag", global::System.Management.Automation.CompletionResultType.ParameterValue, "LatestTag"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Custom".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Custom'", "Custom", global::System.Management.Automation.CompletionResultType.ParameterValue, "Custom"); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/RecoveryPointType.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/RecoveryPointType.TypeConverter.cs new file mode 100644 index 000000000000..4c97b0a3e969 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/RecoveryPointType.TypeConverter.cs @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// + /// 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. + /// + public partial class RecoveryPointTypeTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => RecoveryPointType.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/RecoveryPointType.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/RecoveryPointType.cs new file mode 100644 index 000000000000..bcac24f302f4 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/RecoveryPointType.cs @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// + /// 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. + /// + public partial struct RecoveryPointType : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPointType Custom = @"Custom"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPointType LatestTag = @"LatestTag"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPointType LatestTime = @"LatestTime"; + + /// the value for an instance of the Enum. + private string _value { get; set; } + + /// Conversion from arbitrary object to RecoveryPointType + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new RecoveryPointType(global::System.Convert.ToString(value)); + } + + /// Compares values of enum type RecoveryPointType + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPointType e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type RecoveryPointType (override for Object) + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is RecoveryPointType && Equals((RecoveryPointType)obj); + } + + /// Returns hashCode for enum RecoveryPointType + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Creates an instance of the Enum class. + /// the value to create an instance for. + private RecoveryPointType(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Returns string representation for RecoveryPointType + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to RecoveryPointType + /// the value to convert to an instance of . + + public static implicit operator RecoveryPointType(string value) + { + return new RecoveryPointType(value); + } + + /// Implicit operator to convert RecoveryPointType to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPointType e) + { + return e._value; + } + + /// Overriding != operator for enum RecoveryPointType + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPointType e1, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPointType e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum RecoveryPointType + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPointType e1, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RecoveryPointType e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/ReplicationProtectedItemOperation.Completer.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/ReplicationProtectedItemOperation.Completer.cs new file mode 100644 index 000000000000..c1daf49a50df --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/ReplicationProtectedItemOperation.Completer.cs @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// Argument completer implementation for ReplicationProtectedItemOperation. + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ReplicationProtectedItemOperationTypeConverter))] + public partial struct ReplicationProtectedItemOperation : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "ReverseReplicate".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'ReverseReplicate'", "ReverseReplicate", global::System.Management.Automation.CompletionResultType.ParameterValue, "ReverseReplicate"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Commit".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Commit'", "Commit", global::System.Management.Automation.CompletionResultType.ParameterValue, "Commit"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "PlannedFailover".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'PlannedFailover'", "PlannedFailover", global::System.Management.Automation.CompletionResultType.ParameterValue, "PlannedFailover"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "UnplannedFailover".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'UnplannedFailover'", "UnplannedFailover", global::System.Management.Automation.CompletionResultType.ParameterValue, "UnplannedFailover"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "DisableProtection".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'DisableProtection'", "DisableProtection", global::System.Management.Automation.CompletionResultType.ParameterValue, "DisableProtection"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "TestFailover".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'TestFailover'", "TestFailover", global::System.Management.Automation.CompletionResultType.ParameterValue, "TestFailover"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "TestFailoverCleanup".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'TestFailoverCleanup'", "TestFailoverCleanup", global::System.Management.Automation.CompletionResultType.ParameterValue, "TestFailoverCleanup"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Failback".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Failback'", "Failback", global::System.Management.Automation.CompletionResultType.ParameterValue, "Failback"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "FinalizeFailback".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'FinalizeFailback'", "FinalizeFailback", global::System.Management.Automation.CompletionResultType.ParameterValue, "FinalizeFailback"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "CancelFailover".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'CancelFailover'", "CancelFailover", global::System.Management.Automation.CompletionResultType.ParameterValue, "CancelFailover"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "ChangePit".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'ChangePit'", "ChangePit", global::System.Management.Automation.CompletionResultType.ParameterValue, "ChangePit"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "RepairReplication".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'RepairReplication'", "RepairReplication", global::System.Management.Automation.CompletionResultType.ParameterValue, "RepairReplication"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "SwitchProtection".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'SwitchProtection'", "SwitchProtection", global::System.Management.Automation.CompletionResultType.ParameterValue, "SwitchProtection"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "CompleteMigration".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'CompleteMigration'", "CompleteMigration", global::System.Management.Automation.CompletionResultType.ParameterValue, "CompleteMigration"); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/ReplicationProtectedItemOperation.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/ReplicationProtectedItemOperation.TypeConverter.cs new file mode 100644 index 000000000000..26771578a7d0 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/ReplicationProtectedItemOperation.TypeConverter.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// TypeConverter implementation for ReplicationProtectedItemOperation. + public partial class ReplicationProtectedItemOperationTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ReplicationProtectedItemOperation.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/ReplicationProtectedItemOperation.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/ReplicationProtectedItemOperation.cs new file mode 100644 index 000000000000..16e9f5c7b1b3 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/ReplicationProtectedItemOperation.cs @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + public partial struct ReplicationProtectedItemOperation : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ReplicationProtectedItemOperation CancelFailover = @"CancelFailover"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ReplicationProtectedItemOperation ChangePit = @"ChangePit"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ReplicationProtectedItemOperation Commit = @"Commit"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ReplicationProtectedItemOperation CompleteMigration = @"CompleteMigration"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ReplicationProtectedItemOperation DisableProtection = @"DisableProtection"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ReplicationProtectedItemOperation Failback = @"Failback"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ReplicationProtectedItemOperation FinalizeFailback = @"FinalizeFailback"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ReplicationProtectedItemOperation PlannedFailover = @"PlannedFailover"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ReplicationProtectedItemOperation RepairReplication = @"RepairReplication"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ReplicationProtectedItemOperation ReverseReplicate = @"ReverseReplicate"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ReplicationProtectedItemOperation SwitchProtection = @"SwitchProtection"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ReplicationProtectedItemOperation TestFailover = @"TestFailover"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ReplicationProtectedItemOperation TestFailoverCleanup = @"TestFailoverCleanup"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ReplicationProtectedItemOperation UnplannedFailover = @"UnplannedFailover"; + + /// + /// the value for an instance of the Enum. + /// + private string _value { get; set; } + + /// Conversion from arbitrary object to ReplicationProtectedItemOperation + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new ReplicationProtectedItemOperation(global::System.Convert.ToString(value)); + } + + /// Compares values of enum type ReplicationProtectedItemOperation + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ReplicationProtectedItemOperation e) + { + return _value.Equals(e._value); + } + + /// + /// Compares values of enum type ReplicationProtectedItemOperation (override for Object) + /// + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is ReplicationProtectedItemOperation && Equals((ReplicationProtectedItemOperation)obj); + } + + /// Returns hashCode for enum ReplicationProtectedItemOperation + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// + /// Creates an instance of the Enum class. + /// + /// the value to create an instance for. + private ReplicationProtectedItemOperation(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Returns string representation for ReplicationProtectedItemOperation + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to ReplicationProtectedItemOperation + /// the value to convert to an instance of . + + public static implicit operator ReplicationProtectedItemOperation(string value) + { + return new ReplicationProtectedItemOperation(value); + } + + /// Implicit operator to convert ReplicationProtectedItemOperation to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ReplicationProtectedItemOperation e) + { + return e._value; + } + + /// Overriding != operator for enum ReplicationProtectedItemOperation + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ReplicationProtectedItemOperation e1, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ReplicationProtectedItemOperation e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum ReplicationProtectedItemOperation + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ReplicationProtectedItemOperation e1, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ReplicationProtectedItemOperation e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/ResyncState.Completer.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/ResyncState.Completer.cs new file mode 100644 index 000000000000..edb06927c81e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/ResyncState.Completer.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// The resync state. + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ResyncStateTypeConverter))] + public partial struct ResyncState : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "None".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'None'", "None", global::System.Management.Automation.CompletionResultType.ParameterValue, "None"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "PreparedForResynchronization".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'PreparedForResynchronization'", "PreparedForResynchronization", global::System.Management.Automation.CompletionResultType.ParameterValue, "PreparedForResynchronization"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "StartedResynchronization".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'StartedResynchronization'", "StartedResynchronization", global::System.Management.Automation.CompletionResultType.ParameterValue, "StartedResynchronization"); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/ResyncState.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/ResyncState.TypeConverter.cs new file mode 100644 index 000000000000..fd3d33d08c61 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/ResyncState.TypeConverter.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// The resync state. + public partial class ResyncStateTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ResyncState.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/ResyncState.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/ResyncState.cs new file mode 100644 index 000000000000..a3a109862f2d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/ResyncState.cs @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// The resync state. + public partial struct ResyncState : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ResyncState None = @"None"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ResyncState PreparedForResynchronization = @"PreparedForResynchronization"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ResyncState StartedResynchronization = @"StartedResynchronization"; + + /// the value for an instance of the Enum. + private string _value { get; set; } + + /// Conversion from arbitrary object to ResyncState + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new ResyncState(global::System.Convert.ToString(value)); + } + + /// Compares values of enum type ResyncState + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ResyncState e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type ResyncState (override for Object) + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is ResyncState && Equals((ResyncState)obj); + } + + /// Returns hashCode for enum ResyncState + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Creates an instance of the Enum class. + /// the value to create an instance for. + private ResyncState(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Returns string representation for ResyncState + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to ResyncState + /// the value to convert to an instance of . + + public static implicit operator ResyncState(string value) + { + return new ResyncState(value); + } + + /// Implicit operator to convert ResyncState to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ResyncState e) + { + return e._value; + } + + /// Overriding != operator for enum ResyncState + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ResyncState e1, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ResyncState e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum ResyncState + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ResyncState e1, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ResyncState e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/RpInMageRecoveryPointType.Completer.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/RpInMageRecoveryPointType.Completer.cs new file mode 100644 index 000000000000..8c0a4d0e1e3e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/RpInMageRecoveryPointType.Completer.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// The recovery point type. + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RpInMageRecoveryPointTypeTypeConverter))] + public partial struct RpInMageRecoveryPointType : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "LatestTime".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'LatestTime'", "LatestTime", global::System.Management.Automation.CompletionResultType.ParameterValue, "LatestTime"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "LatestTag".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'LatestTag'", "LatestTag", global::System.Management.Automation.CompletionResultType.ParameterValue, "LatestTag"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Custom".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Custom'", "Custom", global::System.Management.Automation.CompletionResultType.ParameterValue, "Custom"); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/RpInMageRecoveryPointType.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/RpInMageRecoveryPointType.TypeConverter.cs new file mode 100644 index 000000000000..18f8e2fa8767 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/RpInMageRecoveryPointType.TypeConverter.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// The recovery point type. + public partial class RpInMageRecoveryPointTypeTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => RpInMageRecoveryPointType.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/RpInMageRecoveryPointType.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/RpInMageRecoveryPointType.cs new file mode 100644 index 000000000000..dd1eb38bb1fd --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/RpInMageRecoveryPointType.cs @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// The recovery point type. + public partial struct RpInMageRecoveryPointType : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RpInMageRecoveryPointType Custom = @"Custom"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RpInMageRecoveryPointType LatestTag = @"LatestTag"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RpInMageRecoveryPointType LatestTime = @"LatestTime"; + + /// the value for an instance of the Enum. + private string _value { get; set; } + + /// Conversion from arbitrary object to RpInMageRecoveryPointType + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new RpInMageRecoveryPointType(global::System.Convert.ToString(value)); + } + + /// Compares values of enum type RpInMageRecoveryPointType + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RpInMageRecoveryPointType e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type RpInMageRecoveryPointType (override for Object) + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is RpInMageRecoveryPointType && Equals((RpInMageRecoveryPointType)obj); + } + + /// Returns hashCode for enum RpInMageRecoveryPointType + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Creates an instance of the Enum class. + /// the value to create an instance for. + private RpInMageRecoveryPointType(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Returns string representation for RpInMageRecoveryPointType + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to RpInMageRecoveryPointType + /// the value to convert to an instance of . + + public static implicit operator RpInMageRecoveryPointType(string value) + { + return new RpInMageRecoveryPointType(value); + } + + /// Implicit operator to convert RpInMageRecoveryPointType to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RpInMageRecoveryPointType e) + { + return e._value; + } + + /// Overriding != operator for enum RpInMageRecoveryPointType + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RpInMageRecoveryPointType e1, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RpInMageRecoveryPointType e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum RpInMageRecoveryPointType + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RpInMageRecoveryPointType e1, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.RpInMageRecoveryPointType e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/SetMultiVMSyncStatus.Completer.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/SetMultiVMSyncStatus.Completer.cs new file mode 100644 index 000000000000..4da8e912ebbb --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/SetMultiVMSyncStatus.Completer.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// + /// A value indicating whether multi-VM sync has to be enabled. Value should be 'Enabled' or 'Disabled'. + /// + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SetMultiVMSyncStatusTypeConverter))] + public partial struct SetMultiVMSyncStatus : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Enable".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Enable'", "Enable", global::System.Management.Automation.CompletionResultType.ParameterValue, "Enable"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Disable".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Disable'", "Disable", global::System.Management.Automation.CompletionResultType.ParameterValue, "Disable"); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/SetMultiVMSyncStatus.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/SetMultiVMSyncStatus.TypeConverter.cs new file mode 100644 index 000000000000..71a9bf2ab6a4 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/SetMultiVMSyncStatus.TypeConverter.cs @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// + /// A value indicating whether multi-VM sync has to be enabled. Value should be 'Enabled' or 'Disabled'. + /// + public partial class SetMultiVMSyncStatusTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => SetMultiVMSyncStatus.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/SetMultiVMSyncStatus.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/SetMultiVMSyncStatus.cs new file mode 100644 index 000000000000..8e98cf080eb2 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/SetMultiVMSyncStatus.cs @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// + /// A value indicating whether multi-VM sync has to be enabled. Value should be 'Enabled' or 'Disabled'. + /// + public partial struct SetMultiVMSyncStatus : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SetMultiVMSyncStatus Disable = @"Disable"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SetMultiVMSyncStatus Enable = @"Enable"; + + /// the value for an instance of the Enum. + private string _value { get; set; } + + /// Conversion from arbitrary object to SetMultiVMSyncStatus + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new SetMultiVMSyncStatus(global::System.Convert.ToString(value)); + } + + /// Compares values of enum type SetMultiVMSyncStatus + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SetMultiVMSyncStatus e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type SetMultiVMSyncStatus (override for Object) + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is SetMultiVMSyncStatus && Equals((SetMultiVMSyncStatus)obj); + } + + /// Returns hashCode for enum SetMultiVMSyncStatus + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Creates an instance of the Enum class. + /// the value to create an instance for. + private SetMultiVMSyncStatus(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Returns string representation for SetMultiVMSyncStatus + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to SetMultiVMSyncStatus + /// the value to convert to an instance of . + + public static implicit operator SetMultiVMSyncStatus(string value) + { + return new SetMultiVMSyncStatus(value); + } + + /// Implicit operator to convert SetMultiVMSyncStatus to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SetMultiVMSyncStatus e) + { + return e._value; + } + + /// Overriding != operator for enum SetMultiVMSyncStatus + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SetMultiVMSyncStatus e1, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SetMultiVMSyncStatus e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum SetMultiVMSyncStatus + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SetMultiVMSyncStatus e1, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SetMultiVMSyncStatus e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/Severity.Completer.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/Severity.Completer.cs new file mode 100644 index 000000000000..188f08aca40d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/Severity.Completer.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// Severity of error. + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SeverityTypeConverter))] + public partial struct Severity : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "NONE".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'NONE'", "NONE", global::System.Management.Automation.CompletionResultType.ParameterValue, "NONE"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Warning".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Warning'", "Warning", global::System.Management.Automation.CompletionResultType.ParameterValue, "Warning"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Error".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Error'", "Error", global::System.Management.Automation.CompletionResultType.ParameterValue, "Error"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Info".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Info'", "Info", global::System.Management.Automation.CompletionResultType.ParameterValue, "Info"); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/Severity.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/Severity.TypeConverter.cs new file mode 100644 index 000000000000..7c445fb1952b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/Severity.TypeConverter.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// Severity of error. + public partial class SeverityTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => Severity.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/Severity.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/Severity.cs new file mode 100644 index 000000000000..6b8db995de70 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/Severity.cs @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// Severity of error. + public partial struct Severity : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.Severity Error = @"Error"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.Severity Info = @"Info"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.Severity None = @"NONE"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.Severity Warning = @"Warning"; + + /// the value for an instance of the Enum. + private string _value { get; set; } + + /// Conversion from arbitrary object to Severity + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new Severity(global::System.Convert.ToString(value)); + } + + /// Compares values of enum type Severity + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.Severity e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type Severity (override for Object) + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is Severity && Equals((Severity)obj); + } + + /// Returns hashCode for enum Severity + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Creates an instance of the Enum class. + /// the value to create an instance for. + private Severity(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Returns string representation for Severity + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to Severity + /// the value to convert to an instance of . + + public static implicit operator Severity(string value) + { + return new Severity(value); + } + + /// Implicit operator to convert Severity to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.Severity e) + { + return e._value; + } + + /// Overriding != operator for enum Severity + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.Severity e1, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.Severity e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum Severity + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.Severity e1, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.Severity e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/SourceSiteOperations.Completer.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/SourceSiteOperations.Completer.cs new file mode 100644 index 000000000000..66f7b5e52c19 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/SourceSiteOperations.Completer.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// A value indicating whether source site operations are required. + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SourceSiteOperationsTypeConverter))] + public partial struct SourceSiteOperations : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Required".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Required'", "Required", global::System.Management.Automation.CompletionResultType.ParameterValue, "Required"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "NotRequired".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'NotRequired'", "NotRequired", global::System.Management.Automation.CompletionResultType.ParameterValue, "NotRequired"); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/SourceSiteOperations.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/SourceSiteOperations.TypeConverter.cs new file mode 100644 index 000000000000..79779df41055 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/SourceSiteOperations.TypeConverter.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// A value indicating whether source site operations are required. + public partial class SourceSiteOperationsTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => SourceSiteOperations.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/SourceSiteOperations.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/SourceSiteOperations.cs new file mode 100644 index 000000000000..ac1fe2920927 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/SourceSiteOperations.cs @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// A value indicating whether source site operations are required. + public partial struct SourceSiteOperations : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SourceSiteOperations NotRequired = @"NotRequired"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SourceSiteOperations Required = @"Required"; + + /// the value for an instance of the Enum. + private string _value { get; set; } + + /// Conversion from arbitrary object to SourceSiteOperations + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new SourceSiteOperations(global::System.Convert.ToString(value)); + } + + /// Compares values of enum type SourceSiteOperations + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SourceSiteOperations e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type SourceSiteOperations (override for Object) + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is SourceSiteOperations && Equals((SourceSiteOperations)obj); + } + + /// Returns hashCode for enum SourceSiteOperations + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Creates an instance of the Enum class. + /// the value to create an instance for. + private SourceSiteOperations(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Returns string representation for SourceSiteOperations + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to SourceSiteOperations + /// the value to convert to an instance of . + + public static implicit operator SourceSiteOperations(string value) + { + return new SourceSiteOperations(value); + } + + /// Implicit operator to convert SourceSiteOperations to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SourceSiteOperations e) + { + return e._value; + } + + /// Overriding != operator for enum SourceSiteOperations + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SourceSiteOperations e1, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SourceSiteOperations e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum SourceSiteOperations + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SourceSiteOperations e1, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SourceSiteOperations e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/SqlServerLicenseType.Completer.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/SqlServerLicenseType.Completer.cs new file mode 100644 index 000000000000..6e04841770e1 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/SqlServerLicenseType.Completer.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// The SQL Server license type. + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SqlServerLicenseTypeTypeConverter))] + public partial struct SqlServerLicenseType : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "NotSpecified".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'NotSpecified'", "NotSpecified", global::System.Management.Automation.CompletionResultType.ParameterValue, "NotSpecified"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "NoLicenseType".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'NoLicenseType'", "NoLicenseType", global::System.Management.Automation.CompletionResultType.ParameterValue, "NoLicenseType"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "PAYG".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'PAYG'", "PAYG", global::System.Management.Automation.CompletionResultType.ParameterValue, "PAYG"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "AHUB".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'AHUB'", "AHUB", global::System.Management.Automation.CompletionResultType.ParameterValue, "AHUB"); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/SqlServerLicenseType.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/SqlServerLicenseType.TypeConverter.cs new file mode 100644 index 000000000000..529dc041dba9 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/SqlServerLicenseType.TypeConverter.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// The SQL Server license type. + public partial class SqlServerLicenseTypeTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => SqlServerLicenseType.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/SqlServerLicenseType.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/SqlServerLicenseType.cs new file mode 100644 index 000000000000..14386c4edf19 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/SqlServerLicenseType.cs @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// The SQL Server license type. + public partial struct SqlServerLicenseType : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SqlServerLicenseType Ahub = @"AHUB"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SqlServerLicenseType NoLicenseType = @"NoLicenseType"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SqlServerLicenseType NotSpecified = @"NotSpecified"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SqlServerLicenseType Payg = @"PAYG"; + + /// the value for an instance of the Enum. + private string _value { get; set; } + + /// Conversion from arbitrary object to SqlServerLicenseType + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new SqlServerLicenseType(global::System.Convert.ToString(value)); + } + + /// Compares values of enum type SqlServerLicenseType + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SqlServerLicenseType e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type SqlServerLicenseType (override for Object) + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is SqlServerLicenseType && Equals((SqlServerLicenseType)obj); + } + + /// Returns hashCode for enum SqlServerLicenseType + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Creates an instance of the Enum class. + /// the value to create an instance for. + private SqlServerLicenseType(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Returns string representation for SqlServerLicenseType + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to SqlServerLicenseType + /// the value to convert to an instance of . + + public static implicit operator SqlServerLicenseType(string value) + { + return new SqlServerLicenseType(value); + } + + /// Implicit operator to convert SqlServerLicenseType to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SqlServerLicenseType e) + { + return e._value; + } + + /// Overriding != operator for enum SqlServerLicenseType + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SqlServerLicenseType e1, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SqlServerLicenseType e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum SqlServerLicenseType + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SqlServerLicenseType e1, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SqlServerLicenseType e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/TestMigrationState.Completer.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/TestMigrationState.Completer.cs new file mode 100644 index 000000000000..444f73376a8c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/TestMigrationState.Completer.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// The test migrate state. + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.TestMigrationStateTypeConverter))] + public partial struct TestMigrationState : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "None".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'None'", "None", global::System.Management.Automation.CompletionResultType.ParameterValue, "None"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "TestMigrationInProgress".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'TestMigrationInProgress'", "TestMigrationInProgress", global::System.Management.Automation.CompletionResultType.ParameterValue, "TestMigrationInProgress"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "TestMigrationSucceeded".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'TestMigrationSucceeded'", "TestMigrationSucceeded", global::System.Management.Automation.CompletionResultType.ParameterValue, "TestMigrationSucceeded"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "TestMigrationFailed".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'TestMigrationFailed'", "TestMigrationFailed", global::System.Management.Automation.CompletionResultType.ParameterValue, "TestMigrationFailed"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "TestMigrationCleanupInProgress".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'TestMigrationCleanupInProgress'", "TestMigrationCleanupInProgress", global::System.Management.Automation.CompletionResultType.ParameterValue, "TestMigrationCleanupInProgress"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "TestMigrationCompletedWithInformation".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'TestMigrationCompletedWithInformation'", "TestMigrationCompletedWithInformation", global::System.Management.Automation.CompletionResultType.ParameterValue, "TestMigrationCompletedWithInformation"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "TestMigrationPartiallySucceeded".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'TestMigrationPartiallySucceeded'", "TestMigrationPartiallySucceeded", global::System.Management.Automation.CompletionResultType.ParameterValue, "TestMigrationPartiallySucceeded"); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/TestMigrationState.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/TestMigrationState.TypeConverter.cs new file mode 100644 index 000000000000..e9e9d081ca50 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/TestMigrationState.TypeConverter.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// The test migrate state. + public partial class TestMigrationStateTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => TestMigrationState.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/TestMigrationState.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/TestMigrationState.cs new file mode 100644 index 000000000000..ced029ac80da --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/TestMigrationState.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// The test migrate state. + public partial struct TestMigrationState : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.TestMigrationState None = @"None"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.TestMigrationState TestMigrationCleanupInProgress = @"TestMigrationCleanupInProgress"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.TestMigrationState TestMigrationCompletedWithInformation = @"TestMigrationCompletedWithInformation"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.TestMigrationState TestMigrationFailed = @"TestMigrationFailed"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.TestMigrationState TestMigrationInProgress = @"TestMigrationInProgress"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.TestMigrationState TestMigrationPartiallySucceeded = @"TestMigrationPartiallySucceeded"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.TestMigrationState TestMigrationSucceeded = @"TestMigrationSucceeded"; + + /// the value for an instance of the Enum. + private string _value { get; set; } + + /// Conversion from arbitrary object to TestMigrationState + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new TestMigrationState(global::System.Convert.ToString(value)); + } + + /// Compares values of enum type TestMigrationState + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.TestMigrationState e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type TestMigrationState (override for Object) + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is TestMigrationState && Equals((TestMigrationState)obj); + } + + /// Returns hashCode for enum TestMigrationState + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Creates an instance of the Enum class. + /// the value to create an instance for. + private TestMigrationState(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Returns string representation for TestMigrationState + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to TestMigrationState + /// the value to convert to an instance of . + + public static implicit operator TestMigrationState(string value) + { + return new TestMigrationState(value); + } + + /// Implicit operator to convert TestMigrationState to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.TestMigrationState e) + { + return e._value; + } + + /// Overriding != operator for enum TestMigrationState + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.TestMigrationState e1, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.TestMigrationState e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum TestMigrationState + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.TestMigrationState e1, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.TestMigrationState e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/VMEncryptionType.Completer.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/VMEncryptionType.Completer.cs new file mode 100644 index 000000000000..c3161d742a52 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/VMEncryptionType.Completer.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// The encryption type of the VM. + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.VMEncryptionTypeTypeConverter))] + public partial struct VMEncryptionType : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "NotEncrypted".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'NotEncrypted'", "NotEncrypted", global::System.Management.Automation.CompletionResultType.ParameterValue, "NotEncrypted"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "OnePassEncrypted".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'OnePassEncrypted'", "OnePassEncrypted", global::System.Management.Automation.CompletionResultType.ParameterValue, "OnePassEncrypted"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "TwoPassEncrypted".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'TwoPassEncrypted'", "TwoPassEncrypted", global::System.Management.Automation.CompletionResultType.ParameterValue, "TwoPassEncrypted"); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/VMEncryptionType.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/VMEncryptionType.TypeConverter.cs new file mode 100644 index 000000000000..6e8d5f913a2d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/VMEncryptionType.TypeConverter.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// The encryption type of the VM. + public partial class VMEncryptionTypeTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => VMEncryptionType.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/VMEncryptionType.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/VMEncryptionType.cs new file mode 100644 index 000000000000..343a615597eb --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/VMEncryptionType.cs @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// The encryption type of the VM. + public partial struct VMEncryptionType : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.VMEncryptionType NotEncrypted = @"NotEncrypted"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.VMEncryptionType OnePassEncrypted = @"OnePassEncrypted"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.VMEncryptionType TwoPassEncrypted = @"TwoPassEncrypted"; + + /// the value for an instance of the Enum. + private string _value { get; set; } + + /// Conversion from arbitrary object to VMEncryptionType + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new VMEncryptionType(global::System.Convert.ToString(value)); + } + + /// Compares values of enum type VMEncryptionType + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.VMEncryptionType e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type VMEncryptionType (override for Object) + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is VMEncryptionType && Equals((VMEncryptionType)obj); + } + + /// Returns hashCode for enum VMEncryptionType + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Returns string representation for VMEncryptionType + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Creates an instance of the Enum class. + /// the value to create an instance for. + private VMEncryptionType(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Implicit operator to convert string to VMEncryptionType + /// the value to convert to an instance of . + + public static implicit operator VMEncryptionType(string value) + { + return new VMEncryptionType(value); + } + + /// Implicit operator to convert VMEncryptionType to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.VMEncryptionType e) + { + return e._value; + } + + /// Overriding != operator for enum VMEncryptionType + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.VMEncryptionType e1, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.VMEncryptionType e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum VMEncryptionType + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.VMEncryptionType e1, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.VMEncryptionType e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/VMReplicationProgressHealth.Completer.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/VMReplicationProgressHealth.Completer.cs new file mode 100644 index 000000000000..08836693be01 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/VMReplicationProgressHealth.Completer.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// The initial replication progress health. + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.VMReplicationProgressHealthTypeConverter))] + public partial struct VMReplicationProgressHealth : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "None".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'None'", "None", global::System.Management.Automation.CompletionResultType.ParameterValue, "None"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "InProgress".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'InProgress'", "InProgress", global::System.Management.Automation.CompletionResultType.ParameterValue, "InProgress"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "SlowProgress".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'SlowProgress'", "SlowProgress", global::System.Management.Automation.CompletionResultType.ParameterValue, "SlowProgress"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "NoProgress".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'NoProgress'", "NoProgress", global::System.Management.Automation.CompletionResultType.ParameterValue, "NoProgress"); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/VMReplicationProgressHealth.TypeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/VMReplicationProgressHealth.TypeConverter.cs new file mode 100644 index 000000000000..464ba8ff3f8a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/VMReplicationProgressHealth.TypeConverter.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// The initial replication progress health. + public partial class VMReplicationProgressHealthTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => VMReplicationProgressHealth.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/api/Support/VMReplicationProgressHealth.cs b/swaggerci/recoveryservicessiterecovery/generated/api/Support/VMReplicationProgressHealth.cs new file mode 100644 index 000000000000..8a41982ad9c7 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/api/Support/VMReplicationProgressHealth.cs @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support +{ + + /// The initial replication progress health. + public partial struct VMReplicationProgressHealth : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.VMReplicationProgressHealth InProgress = @"InProgress"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.VMReplicationProgressHealth NoProgress = @"NoProgress"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.VMReplicationProgressHealth None = @"None"; + + public static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.VMReplicationProgressHealth SlowProgress = @"SlowProgress"; + + /// + /// the value for an instance of the Enum. + /// + private string _value { get; set; } + + /// Conversion from arbitrary object to VMReplicationProgressHealth + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new VMReplicationProgressHealth(global::System.Convert.ToString(value)); + } + + /// Compares values of enum type VMReplicationProgressHealth + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.VMReplicationProgressHealth e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type VMReplicationProgressHealth (override for Object) + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is VMReplicationProgressHealth && Equals((VMReplicationProgressHealth)obj); + } + + /// Returns hashCode for enum VMReplicationProgressHealth + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Returns string representation for VMReplicationProgressHealth + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// + /// Creates an instance of the Enum class. + /// + /// the value to create an instance for. + private VMReplicationProgressHealth(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Implicit operator to convert string to VMReplicationProgressHealth + /// the value to convert to an instance of . + + public static implicit operator VMReplicationProgressHealth(string value) + { + return new VMReplicationProgressHealth(value); + } + + /// Implicit operator to convert VMReplicationProgressHealth to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.VMReplicationProgressHealth e) + { + return e._value; + } + + /// Overriding != operator for enum VMReplicationProgressHealth + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.VMReplicationProgressHealth e1, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.VMReplicationProgressHealth e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum VMReplicationProgressHealth + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.VMReplicationProgressHealth e1, Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.VMReplicationProgressHealth e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/AddAzSiteRecoveryReplicationProtectedItemDisk_Add.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/AddAzSiteRecoveryReplicationProtectedItemDisk_Add.cs new file mode 100644 index 000000000000..5e73628b134d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/AddAzSiteRecoveryReplicationProtectedItemDisk_Add.cs @@ -0,0 +1,474 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Operation to add disks(s) to the replication protected item. + /// + /// [OpenAPI] AddDisks=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/addDisks" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Add, @"AzSiteRecoveryReplicationProtectedItemDisk_Add", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Operation to add disks(s) to the replication protected item.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class AddAzSiteRecoveryReplicationProtectedItemDisk_Add : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksInput _addDisksInput; + + /// Input for add disk(s) operation. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Input for add disk(s) operation.", ValueFromPipeline = true)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Input for add disk(s) operation.", + SerializedName = @"addDisksInput", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksInput) })] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksInput AddDisksInput { get => this._addDisksInput; set => this._addDisksInput = value; } + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// Unique fabric name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Unique fabric name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Unique fabric name.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _protectionContainerName; + + /// Protection container name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Protection container name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Protection container name.", + SerializedName = @"protectionContainerName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ProtectionContainerName { get => this._protectionContainerName; set => this._protectionContainerName = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _replicatedProtectedItemName; + + /// Replication protected item name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Replication protected item name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Replication protected item name.", + SerializedName = @"replicatedProtectedItemName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ReplicatedProtectedItemName { get => this._replicatedProtectedItemName; set => this._replicatedProtectedItemName = value; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// Intializes a new instance of the cmdlet class. + /// + public AddAzSiteRecoveryReplicationProtectedItemDisk_Add() + { + + } + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of AddAzSiteRecoveryReplicationProtectedItemDisk_Add + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.AddAzSiteRecoveryReplicationProtectedItemDisk_Add Clone() + { + var clone = new AddAzSiteRecoveryReplicationProtectedItemDisk_Add(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + clone.FabricName = this.FabricName; + clone.ProtectionContainerName = this.ProtectionContainerName; + clone.ReplicatedProtectedItemName = this.ReplicatedProtectedItemName; + clone.AddDisksInput = this.AddDisksInput; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationProtectedItemsAddDisks' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationProtectedItemsAddDisks(ResourceName, ResourceGroupName, SubscriptionId, FabricName, ProtectionContainerName, ReplicatedProtectedItemName, AddDisksInput, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName,ProtectionContainerName=ProtectionContainerName,ReplicatedProtectedItemName=ReplicatedProtectedItemName,body=AddDisksInput}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/AddAzSiteRecoveryReplicationProtectedItemDisk_AddExpanded.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/AddAzSiteRecoveryReplicationProtectedItemDisk_AddExpanded.cs new file mode 100644 index 000000000000..ab8e79e1a9b5 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/AddAzSiteRecoveryReplicationProtectedItemDisk_AddExpanded.cs @@ -0,0 +1,477 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Operation to add disks(s) to the replication protected item. + /// + /// [OpenAPI] AddDisks=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/addDisks" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Add, @"AzSiteRecoveryReplicationProtectedItemDisk_AddExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Operation to add disks(s) to the replication protected item.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class AddAzSiteRecoveryReplicationProtectedItemDisk_AddExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// Input for add disk(s) operation. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksInput _addDisksInputBody = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AddDisksInput(); + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// Unique fabric name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Unique fabric name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Unique fabric name.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _protectionContainerName; + + /// Protection container name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Protection container name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Protection container name.", + SerializedName = @"protectionContainerName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ProtectionContainerName { get => this._protectionContainerName; set => this._protectionContainerName = value; } + + /// The class type. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The class type.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + public string ProviderSpecificDetailInstanceType { get => _addDisksInputBody.ProviderSpecificDetailInstanceType ?? null; set => _addDisksInputBody.ProviderSpecificDetailInstanceType = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _replicatedProtectedItemName; + + /// Replication protected item name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Replication protected item name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Replication protected item name.", + SerializedName = @"replicatedProtectedItemName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ReplicatedProtectedItemName { get => this._replicatedProtectedItemName; set => this._replicatedProtectedItemName = value; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// Intializes a new instance of the cmdlet class. + /// + public AddAzSiteRecoveryReplicationProtectedItemDisk_AddExpanded() + { + + } + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of AddAzSiteRecoveryReplicationProtectedItemDisk_AddExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.AddAzSiteRecoveryReplicationProtectedItemDisk_AddExpanded Clone() + { + var clone = new AddAzSiteRecoveryReplicationProtectedItemDisk_AddExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._addDisksInputBody = this._addDisksInputBody; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + clone.FabricName = this.FabricName; + clone.ProtectionContainerName = this.ProtectionContainerName; + clone.ReplicatedProtectedItemName = this.ReplicatedProtectedItemName; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationProtectedItemsAddDisks' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationProtectedItemsAddDisks(ResourceName, ResourceGroupName, SubscriptionId, FabricName, ProtectionContainerName, ReplicatedProtectedItemName, _addDisksInputBody, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName,ProtectionContainerName=ProtectionContainerName,ReplicatedProtectedItemName=ReplicatedProtectedItemName,body=_addDisksInputBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/AddAzSiteRecoveryReplicationProtectedItemDisk_AddViaIdentity.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/AddAzSiteRecoveryReplicationProtectedItemDisk_AddViaIdentity.cs new file mode 100644 index 000000000000..faea1b8b3c44 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/AddAzSiteRecoveryReplicationProtectedItemDisk_AddViaIdentity.cs @@ -0,0 +1,422 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Operation to add disks(s) to the replication protected item. + /// + /// [OpenAPI] AddDisks=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/addDisks" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Add, @"AzSiteRecoveryReplicationProtectedItemDisk_AddViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Operation to add disks(s) to the replication protected item.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class AddAzSiteRecoveryReplicationProtectedItemDisk_AddViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksInput _addDisksInput; + + /// Input for add disk(s) operation. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Input for add disk(s) operation.", ValueFromPipeline = true)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Input for add disk(s) operation.", + SerializedName = @"addDisksInput", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksInput) })] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksInput AddDisksInput { get => this._addDisksInput; set => this._addDisksInput = value; } + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// Intializes a new instance of the cmdlet class. + /// + public AddAzSiteRecoveryReplicationProtectedItemDisk_AddViaIdentity() + { + + } + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of AddAzSiteRecoveryReplicationProtectedItemDisk_AddViaIdentity + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.AddAzSiteRecoveryReplicationProtectedItemDisk_AddViaIdentity Clone() + { + var clone = new AddAzSiteRecoveryReplicationProtectedItemDisk_AddViaIdentity(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.AddDisksInput = this.AddDisksInput; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationProtectedItemsAddDisks' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationProtectedItemsAddDisksViaIdentity(InputObject.Id, AddDisksInput, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.FabricName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.FabricName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ProtectionContainerName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ProtectionContainerName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ReplicatedProtectedItemName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ReplicatedProtectedItemName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationProtectedItemsAddDisks(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.FabricName ?? null, InputObject.ProtectionContainerName ?? null, InputObject.ReplicatedProtectedItemName ?? null, AddDisksInput, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=AddDisksInput}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/AddAzSiteRecoveryReplicationProtectedItemDisk_AddViaIdentityExpanded.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/AddAzSiteRecoveryReplicationProtectedItemDisk_AddViaIdentityExpanded.cs new file mode 100644 index 000000000000..c61099cb4909 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/AddAzSiteRecoveryReplicationProtectedItemDisk_AddViaIdentityExpanded.cs @@ -0,0 +1,424 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Operation to add disks(s) to the replication protected item. + /// + /// [OpenAPI] AddDisks=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/addDisks" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Add, @"AzSiteRecoveryReplicationProtectedItemDisk_AddViaIdentityExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Operation to add disks(s) to the replication protected item.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class AddAzSiteRecoveryReplicationProtectedItemDisk_AddViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// Input for add disk(s) operation. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddDisksInput _addDisksInputBody = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AddDisksInput(); + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The class type. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The class type.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + public string ProviderSpecificDetailInstanceType { get => _addDisksInputBody.ProviderSpecificDetailInstanceType ?? null; set => _addDisksInputBody.ProviderSpecificDetailInstanceType = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// Intializes a new instance of the cmdlet + /// class. + /// + public AddAzSiteRecoveryReplicationProtectedItemDisk_AddViaIdentityExpanded() + { + + } + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of AddAzSiteRecoveryReplicationProtectedItemDisk_AddViaIdentityExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.AddAzSiteRecoveryReplicationProtectedItemDisk_AddViaIdentityExpanded Clone() + { + var clone = new AddAzSiteRecoveryReplicationProtectedItemDisk_AddViaIdentityExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._addDisksInputBody = this._addDisksInputBody; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationProtectedItemsAddDisks' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationProtectedItemsAddDisksViaIdentity(InputObject.Id, _addDisksInputBody, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.FabricName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.FabricName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ProtectionContainerName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ProtectionContainerName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ReplicatedProtectedItemName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ReplicatedProtectedItemName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationProtectedItemsAddDisks(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.FabricName ?? null, InputObject.ProtectionContainerName ?? null, InputObject.ReplicatedProtectedItemName ?? null, _addDisksInputBody, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=_addDisksInputBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/AddAzSiteRecoveryReplicationProtectedItemRecoveryPoint_Apply.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/AddAzSiteRecoveryReplicationProtectedItemRecoveryPoint_Apply.cs new file mode 100644 index 000000000000..0e7e4332e088 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/AddAzSiteRecoveryReplicationProtectedItemRecoveryPoint_Apply.cs @@ -0,0 +1,478 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// + /// The operation to change the recovery point of a failed over replication protected item. + /// + /// + /// [OpenAPI] ApplyRecoveryPoint=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/applyRecoveryPoint" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Add, @"AzSiteRecoveryReplicationProtectedItemRecoveryPoint_Apply", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to change the recovery point of a failed over replication protected item.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class AddAzSiteRecoveryReplicationProtectedItemRecoveryPoint_Apply : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointInput _applyRecoveryPointInput; + + /// Input to apply recovery point. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Input to apply recovery point.", ValueFromPipeline = true)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Input to apply recovery point.", + SerializedName = @"applyRecoveryPointInput", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointInput) })] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointInput ApplyRecoveryPointInput { get => this._applyRecoveryPointInput; set => this._applyRecoveryPointInput = value; } + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// The ARM fabric name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ARM fabric name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ARM fabric name.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _protectionContainerName; + + /// The protection container name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The protection container name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The protection container name.", + SerializedName = @"protectionContainerName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ProtectionContainerName { get => this._protectionContainerName; set => this._protectionContainerName = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _replicatedProtectedItemName; + + /// The replicated protected item name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The replicated protected item name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The replicated protected item name.", + SerializedName = @"replicatedProtectedItemName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ReplicatedProtectedItemName { get => this._replicatedProtectedItemName; set => this._replicatedProtectedItemName = value; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// Intializes a new instance of the cmdlet class. + /// + public AddAzSiteRecoveryReplicationProtectedItemRecoveryPoint_Apply() + { + + } + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of AddAzSiteRecoveryReplicationProtectedItemRecoveryPoint_Apply + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.AddAzSiteRecoveryReplicationProtectedItemRecoveryPoint_Apply Clone() + { + var clone = new AddAzSiteRecoveryReplicationProtectedItemRecoveryPoint_Apply(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + clone.FabricName = this.FabricName; + clone.ProtectionContainerName = this.ProtectionContainerName; + clone.ReplicatedProtectedItemName = this.ReplicatedProtectedItemName; + clone.ApplyRecoveryPointInput = this.ApplyRecoveryPointInput; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationProtectedItemsApplyRecoveryPoint' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationProtectedItemsApplyRecoveryPoint(ResourceName, ResourceGroupName, SubscriptionId, FabricName, ProtectionContainerName, ReplicatedProtectedItemName, ApplyRecoveryPointInput, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName,ProtectionContainerName=ProtectionContainerName,ReplicatedProtectedItemName=ReplicatedProtectedItemName,body=ApplyRecoveryPointInput}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/AddAzSiteRecoveryReplicationProtectedItemRecoveryPoint_ApplyExpanded.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/AddAzSiteRecoveryReplicationProtectedItemRecoveryPoint_ApplyExpanded.cs new file mode 100644 index 000000000000..b4bb8cda64f7 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/AddAzSiteRecoveryReplicationProtectedItemRecoveryPoint_ApplyExpanded.cs @@ -0,0 +1,491 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// + /// The operation to change the recovery point of a failed over replication protected item. + /// + /// + /// [OpenAPI] ApplyRecoveryPoint=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/applyRecoveryPoint" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Add, @"AzSiteRecoveryReplicationProtectedItemRecoveryPoint_ApplyExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to change the recovery point of a failed over replication protected item.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class AddAzSiteRecoveryReplicationProtectedItemRecoveryPoint_ApplyExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// Input to apply recovery point. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointInput _applyRecoveryPointInputBody = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ApplyRecoveryPointInput(); + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// The ARM fabric name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ARM fabric name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ARM fabric name.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _protectionContainerName; + + /// The protection container name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The protection container name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The protection container name.", + SerializedName = @"protectionContainerName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ProtectionContainerName { get => this._protectionContainerName; set => this._protectionContainerName = value; } + + /// The class type. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The class type.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + public string ProviderSpecificDetailInstanceType { get => _applyRecoveryPointInputBody.ProviderSpecificDetailInstanceType ?? null; set => _applyRecoveryPointInputBody.ProviderSpecificDetailInstanceType = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// The recovery point Id. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The recovery point Id.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery point Id.", + SerializedName = @"recoveryPointId", + PossibleTypes = new [] { typeof(string) })] + public string RecoveryPointId { get => _applyRecoveryPointInputBody.RecoveryPointId ?? null; set => _applyRecoveryPointInputBody.RecoveryPointId = value; } + + /// Backing field for property. + private string _replicatedProtectedItemName; + + /// The replicated protected item name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The replicated protected item name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The replicated protected item name.", + SerializedName = @"replicatedProtectedItemName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ReplicatedProtectedItemName { get => this._replicatedProtectedItemName; set => this._replicatedProtectedItemName = value; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// Intializes a new instance of the cmdlet + /// class. + /// + public AddAzSiteRecoveryReplicationProtectedItemRecoveryPoint_ApplyExpanded() + { + + } + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of AddAzSiteRecoveryReplicationProtectedItemRecoveryPoint_ApplyExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.AddAzSiteRecoveryReplicationProtectedItemRecoveryPoint_ApplyExpanded Clone() + { + var clone = new AddAzSiteRecoveryReplicationProtectedItemRecoveryPoint_ApplyExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._applyRecoveryPointInputBody = this._applyRecoveryPointInputBody; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + clone.FabricName = this.FabricName; + clone.ProtectionContainerName = this.ProtectionContainerName; + clone.ReplicatedProtectedItemName = this.ReplicatedProtectedItemName; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationProtectedItemsApplyRecoveryPoint' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationProtectedItemsApplyRecoveryPoint(ResourceName, ResourceGroupName, SubscriptionId, FabricName, ProtectionContainerName, ReplicatedProtectedItemName, _applyRecoveryPointInputBody, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName,ProtectionContainerName=ProtectionContainerName,ReplicatedProtectedItemName=ReplicatedProtectedItemName,body=_applyRecoveryPointInputBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/AddAzSiteRecoveryReplicationProtectedItemRecoveryPoint_ApplyViaIdentity.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/AddAzSiteRecoveryReplicationProtectedItemRecoveryPoint_ApplyViaIdentity.cs new file mode 100644 index 000000000000..9e57419ddcfa --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/AddAzSiteRecoveryReplicationProtectedItemRecoveryPoint_ApplyViaIdentity.cs @@ -0,0 +1,425 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// + /// The operation to change the recovery point of a failed over replication protected item. + /// + /// + /// [OpenAPI] ApplyRecoveryPoint=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/applyRecoveryPoint" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Add, @"AzSiteRecoveryReplicationProtectedItemRecoveryPoint_ApplyViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to change the recovery point of a failed over replication protected item.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class AddAzSiteRecoveryReplicationProtectedItemRecoveryPoint_ApplyViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointInput _applyRecoveryPointInput; + + /// Input to apply recovery point. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Input to apply recovery point.", ValueFromPipeline = true)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Input to apply recovery point.", + SerializedName = @"applyRecoveryPointInput", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointInput) })] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointInput ApplyRecoveryPointInput { get => this._applyRecoveryPointInput; set => this._applyRecoveryPointInput = value; } + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// Intializes a new instance of the + /// cmdlet class. + /// + public AddAzSiteRecoveryReplicationProtectedItemRecoveryPoint_ApplyViaIdentity() + { + + } + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of AddAzSiteRecoveryReplicationProtectedItemRecoveryPoint_ApplyViaIdentity + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.AddAzSiteRecoveryReplicationProtectedItemRecoveryPoint_ApplyViaIdentity Clone() + { + var clone = new AddAzSiteRecoveryReplicationProtectedItemRecoveryPoint_ApplyViaIdentity(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.ApplyRecoveryPointInput = this.ApplyRecoveryPointInput; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationProtectedItemsApplyRecoveryPoint' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationProtectedItemsApplyRecoveryPointViaIdentity(InputObject.Id, ApplyRecoveryPointInput, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.FabricName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.FabricName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ProtectionContainerName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ProtectionContainerName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ReplicatedProtectedItemName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ReplicatedProtectedItemName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationProtectedItemsApplyRecoveryPoint(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.FabricName ?? null, InputObject.ProtectionContainerName ?? null, InputObject.ReplicatedProtectedItemName ?? null, ApplyRecoveryPointInput, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=ApplyRecoveryPointInput}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/AddAzSiteRecoveryReplicationProtectedItemRecoveryPoint_ApplyViaIdentityExpanded.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/AddAzSiteRecoveryReplicationProtectedItemRecoveryPoint_ApplyViaIdentityExpanded.cs new file mode 100644 index 000000000000..52b8970f2ff3 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/AddAzSiteRecoveryReplicationProtectedItemRecoveryPoint_ApplyViaIdentityExpanded.cs @@ -0,0 +1,437 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// + /// The operation to change the recovery point of a failed over replication protected item. + /// + /// + /// [OpenAPI] ApplyRecoveryPoint=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/applyRecoveryPoint" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Add, @"AzSiteRecoveryReplicationProtectedItemRecoveryPoint_ApplyViaIdentityExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to change the recovery point of a failed over replication protected item.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class AddAzSiteRecoveryReplicationProtectedItemRecoveryPoint_ApplyViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// Input to apply recovery point. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplyRecoveryPointInput _applyRecoveryPointInputBody = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ApplyRecoveryPointInput(); + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The class type. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The class type.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + public string ProviderSpecificDetailInstanceType { get => _applyRecoveryPointInputBody.ProviderSpecificDetailInstanceType ?? null; set => _applyRecoveryPointInputBody.ProviderSpecificDetailInstanceType = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// The recovery point Id. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The recovery point Id.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery point Id.", + SerializedName = @"recoveryPointId", + PossibleTypes = new [] { typeof(string) })] + public string RecoveryPointId { get => _applyRecoveryPointInputBody.RecoveryPointId ?? null; set => _applyRecoveryPointInputBody.RecoveryPointId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// Intializes a new instance of the cmdlet class. + /// + public AddAzSiteRecoveryReplicationProtectedItemRecoveryPoint_ApplyViaIdentityExpanded() + { + + } + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of AddAzSiteRecoveryReplicationProtectedItemRecoveryPoint_ApplyViaIdentityExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.AddAzSiteRecoveryReplicationProtectedItemRecoveryPoint_ApplyViaIdentityExpanded Clone() + { + var clone = new AddAzSiteRecoveryReplicationProtectedItemRecoveryPoint_ApplyViaIdentityExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._applyRecoveryPointInputBody = this._applyRecoveryPointInputBody; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationProtectedItemsApplyRecoveryPoint' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationProtectedItemsApplyRecoveryPointViaIdentity(InputObject.Id, _applyRecoveryPointInputBody, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.FabricName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.FabricName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ProtectionContainerName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ProtectionContainerName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ReplicatedProtectedItemName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ReplicatedProtectedItemName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationProtectedItemsApplyRecoveryPoint(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.FabricName ?? null, InputObject.ProtectionContainerName ?? null, InputObject.ReplicatedProtectedItemName ?? null, _applyRecoveryPointInputBody, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=_applyRecoveryPointInputBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/ClearAzSiteRecoveryReplicationFabric_Purge.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/ClearAzSiteRecoveryReplicationFabric_Purge.cs new file mode 100644 index 000000000000..146bcb0374de --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/ClearAzSiteRecoveryReplicationFabric_Purge.cs @@ -0,0 +1,435 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to purge(force delete) an Azure Site Recovery fabric. + /// + /// [OpenAPI] Purge=>DELETE:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Clear, @"AzSiteRecoveryReplicationFabric_Purge", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to purge(force delete) an Azure Site Recovery fabric.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class ClearAzSiteRecoveryReplicationFabric_Purge : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// ASR fabric to purge. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "ASR fabric to purge.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"ASR fabric to purge.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public ClearAzSiteRecoveryReplicationFabric_Purge() + { + + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of ClearAzSiteRecoveryReplicationFabric_Purge + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.ClearAzSiteRecoveryReplicationFabric_Purge Clone() + { + var clone = new ClearAzSiteRecoveryReplicationFabric_Purge(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + clone.FabricName = this.FabricName; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationFabricsPurge' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationFabricsPurge(ResourceName, ResourceGroupName, SubscriptionId, FabricName, onNoContent, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/ClearAzSiteRecoveryReplicationFabric_PurgeViaIdentity.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/ClearAzSiteRecoveryReplicationFabric_PurgeViaIdentity.cs new file mode 100644 index 000000000000..c72cf0267f76 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/ClearAzSiteRecoveryReplicationFabric_PurgeViaIdentity.cs @@ -0,0 +1,403 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to purge(force delete) an Azure Site Recovery fabric. + /// + /// [OpenAPI] Purge=>DELETE:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Clear, @"AzSiteRecoveryReplicationFabric_PurgeViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to purge(force delete) an Azure Site Recovery fabric.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class ClearAzSiteRecoveryReplicationFabric_PurgeViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public ClearAzSiteRecoveryReplicationFabric_PurgeViaIdentity() + { + + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of ClearAzSiteRecoveryReplicationFabric_PurgeViaIdentity + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.ClearAzSiteRecoveryReplicationFabric_PurgeViaIdentity Clone() + { + var clone = new ClearAzSiteRecoveryReplicationFabric_PurgeViaIdentity(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationFabricsPurge' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationFabricsPurgeViaIdentity(InputObject.Id, onNoContent, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.FabricName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.FabricName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationFabricsPurge(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.FabricName ?? null, onNoContent, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/ClearAzSiteRecoveryReplicationProtectedItem_Purge.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/ClearAzSiteRecoveryReplicationProtectedItem_Purge.cs new file mode 100644 index 000000000000..57f7c07d26a1 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/ClearAzSiteRecoveryReplicationProtectedItem_Purge.cs @@ -0,0 +1,468 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// + /// 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. + /// + /// + /// [OpenAPI] Purge=>DELETE:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Clear, @"AzSiteRecoveryReplicationProtectedItem_Purge", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"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.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class ClearAzSiteRecoveryReplicationProtectedItem_Purge : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// Fabric name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Fabric name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Fabric name.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _protectionContainerName; + + /// Protection container name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Protection container name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Protection container name.", + SerializedName = @"protectionContainerName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ProtectionContainerName { get => this._protectionContainerName; set => this._protectionContainerName = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _replicatedProtectedItemName; + + /// Replication protected item name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Replication protected item name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Replication protected item name.", + SerializedName = @"replicatedProtectedItemName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ReplicatedProtectedItemName { get => this._replicatedProtectedItemName; set => this._replicatedProtectedItemName = value; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public ClearAzSiteRecoveryReplicationProtectedItem_Purge() + { + + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of ClearAzSiteRecoveryReplicationProtectedItem_Purge + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.ClearAzSiteRecoveryReplicationProtectedItem_Purge Clone() + { + var clone = new ClearAzSiteRecoveryReplicationProtectedItem_Purge(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + clone.FabricName = this.FabricName; + clone.ProtectionContainerName = this.ProtectionContainerName; + clone.ReplicatedProtectedItemName = this.ReplicatedProtectedItemName; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationProtectedItemsPurge' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationProtectedItemsPurge(ResourceName, ResourceGroupName, SubscriptionId, FabricName, ProtectionContainerName, ReplicatedProtectedItemName, onNoContent, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName,ProtectionContainerName=ProtectionContainerName,ReplicatedProtectedItemName=ReplicatedProtectedItemName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/ClearAzSiteRecoveryReplicationProtectedItem_PurgeViaIdentity.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/ClearAzSiteRecoveryReplicationProtectedItem_PurgeViaIdentity.cs new file mode 100644 index 000000000000..76a110a66e22 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/ClearAzSiteRecoveryReplicationProtectedItem_PurgeViaIdentity.cs @@ -0,0 +1,416 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// + /// 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. + /// + /// + /// [OpenAPI] Purge=>DELETE:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Clear, @"AzSiteRecoveryReplicationProtectedItem_PurgeViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"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.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class ClearAzSiteRecoveryReplicationProtectedItem_PurgeViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public ClearAzSiteRecoveryReplicationProtectedItem_PurgeViaIdentity() + { + + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of ClearAzSiteRecoveryReplicationProtectedItem_PurgeViaIdentity + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.ClearAzSiteRecoveryReplicationProtectedItem_PurgeViaIdentity Clone() + { + var clone = new ClearAzSiteRecoveryReplicationProtectedItem_PurgeViaIdentity(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationProtectedItemsPurge' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationProtectedItemsPurgeViaIdentity(InputObject.Id, onNoContent, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.FabricName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.FabricName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ProtectionContainerName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ProtectionContainerName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ReplicatedProtectedItemName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ReplicatedProtectedItemName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationProtectedItemsPurge(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.FabricName ?? null, InputObject.ProtectionContainerName ?? null, InputObject.ReplicatedProtectedItemName ?? null, onNoContent, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/ClearAzSiteRecoveryReplicationProtectionContainerMapping_Purge.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/ClearAzSiteRecoveryReplicationProtectionContainerMapping_Purge.cs new file mode 100644 index 000000000000..50b653a6e071 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/ClearAzSiteRecoveryReplicationProtectionContainerMapping_Purge.cs @@ -0,0 +1,468 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to purge(force delete) a protection container mapping. + /// + /// [OpenAPI] Purge=>DELETE:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings/{mappingName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Clear, @"AzSiteRecoveryReplicationProtectionContainerMapping_Purge", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to purge(force delete) a protection container mapping.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class ClearAzSiteRecoveryReplicationProtectionContainerMapping_Purge : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// Fabric name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Fabric name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Fabric name.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// Backing field for property. + private string _mappingName; + + /// Protection container mapping name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Protection container mapping name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Protection container mapping name.", + SerializedName = @"mappingName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string MappingName { get => this._mappingName; set => this._mappingName = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _protectionContainerName; + + /// Protection container name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Protection container name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Protection container name.", + SerializedName = @"protectionContainerName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ProtectionContainerName { get => this._protectionContainerName; set => this._protectionContainerName = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// + /// Intializes a new instance of the cmdlet + /// class. + /// + public ClearAzSiteRecoveryReplicationProtectionContainerMapping_Purge() + { + + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of ClearAzSiteRecoveryReplicationProtectionContainerMapping_Purge + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.ClearAzSiteRecoveryReplicationProtectionContainerMapping_Purge Clone() + { + var clone = new ClearAzSiteRecoveryReplicationProtectionContainerMapping_Purge(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + clone.FabricName = this.FabricName; + clone.ProtectionContainerName = this.ProtectionContainerName; + clone.MappingName = this.MappingName; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationProtectionContainerMappingsPurge' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationProtectionContainerMappingsPurge(ResourceName, ResourceGroupName, SubscriptionId, FabricName, ProtectionContainerName, MappingName, onNoContent, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName,ProtectionContainerName=ProtectionContainerName,MappingName=MappingName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/ClearAzSiteRecoveryReplicationProtectionContainerMapping_PurgeViaIdentity.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/ClearAzSiteRecoveryReplicationProtectionContainerMapping_PurgeViaIdentity.cs new file mode 100644 index 000000000000..a3e433a44064 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/ClearAzSiteRecoveryReplicationProtectionContainerMapping_PurgeViaIdentity.cs @@ -0,0 +1,414 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to purge(force delete) a protection container mapping. + /// + /// [OpenAPI] Purge=>DELETE:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings/{mappingName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Clear, @"AzSiteRecoveryReplicationProtectionContainerMapping_PurgeViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to purge(force delete) a protection container mapping.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class ClearAzSiteRecoveryReplicationProtectionContainerMapping_PurgeViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public ClearAzSiteRecoveryReplicationProtectionContainerMapping_PurgeViaIdentity() + { + + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of ClearAzSiteRecoveryReplicationProtectionContainerMapping_PurgeViaIdentity + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.ClearAzSiteRecoveryReplicationProtectionContainerMapping_PurgeViaIdentity Clone() + { + var clone = new ClearAzSiteRecoveryReplicationProtectionContainerMapping_PurgeViaIdentity(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationProtectionContainerMappingsPurge' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationProtectionContainerMappingsPurgeViaIdentity(InputObject.Id, onNoContent, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.FabricName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.FabricName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ProtectionContainerName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ProtectionContainerName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.MappingName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.MappingName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationProtectionContainerMappingsPurge(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.FabricName ?? null, InputObject.ProtectionContainerName ?? null, InputObject.MappingName ?? null, onNoContent, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/ClearAzSiteRecoveryReplicationRecoveryServicesProvider_Purge.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/ClearAzSiteRecoveryReplicationRecoveryServicesProvider_Purge.cs new file mode 100644 index 000000000000..e80c9c0ca6e8 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/ClearAzSiteRecoveryReplicationRecoveryServicesProvider_Purge.cs @@ -0,0 +1,454 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// + /// The operation to purge(force delete) a recovery services provider from the vault. + /// + /// + /// [OpenAPI] Purge=>DELETE:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders/{providerName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Clear, @"AzSiteRecoveryReplicationRecoveryServicesProvider_Purge", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to purge(force delete) a recovery services provider from the vault.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class ClearAzSiteRecoveryReplicationRecoveryServicesProvider_Purge : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// Fabric name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Fabric name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Fabric name.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _providerName; + + /// Recovery services provider name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Recovery services provider name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Recovery services provider name.", + SerializedName = @"providerName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ProviderName { get => this._providerName; set => this._providerName = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public ClearAzSiteRecoveryReplicationRecoveryServicesProvider_Purge() + { + + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of ClearAzSiteRecoveryReplicationRecoveryServicesProvider_Purge + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.ClearAzSiteRecoveryReplicationRecoveryServicesProvider_Purge Clone() + { + var clone = new ClearAzSiteRecoveryReplicationRecoveryServicesProvider_Purge(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + clone.FabricName = this.FabricName; + clone.ProviderName = this.ProviderName; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationRecoveryServicesProvidersPurge' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationRecoveryServicesProvidersPurge(ResourceName, ResourceGroupName, SubscriptionId, FabricName, ProviderName, onNoContent, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName,ProviderName=ProviderName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/ClearAzSiteRecoveryReplicationRecoveryServicesProvider_PurgeViaIdentity.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/ClearAzSiteRecoveryReplicationRecoveryServicesProvider_PurgeViaIdentity.cs new file mode 100644 index 000000000000..a7e16f4f38eb --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/ClearAzSiteRecoveryReplicationRecoveryServicesProvider_PurgeViaIdentity.cs @@ -0,0 +1,412 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// + /// The operation to purge(force delete) a recovery services provider from the vault. + /// + /// + /// [OpenAPI] Purge=>DELETE:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders/{providerName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Clear, @"AzSiteRecoveryReplicationRecoveryServicesProvider_PurgeViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to purge(force delete) a recovery services provider from the vault.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class ClearAzSiteRecoveryReplicationRecoveryServicesProvider_PurgeViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// + /// Intializes a new instance of the + /// cmdlet class. + /// + public ClearAzSiteRecoveryReplicationRecoveryServicesProvider_PurgeViaIdentity() + { + + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of ClearAzSiteRecoveryReplicationRecoveryServicesProvider_PurgeViaIdentity + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.ClearAzSiteRecoveryReplicationRecoveryServicesProvider_PurgeViaIdentity Clone() + { + var clone = new ClearAzSiteRecoveryReplicationRecoveryServicesProvider_PurgeViaIdentity(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationRecoveryServicesProvidersPurge' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationRecoveryServicesProvidersPurgeViaIdentity(InputObject.Id, onNoContent, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.FabricName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.FabricName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ProviderName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ProviderName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationRecoveryServicesProvidersPurge(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.FabricName ?? null, InputObject.ProviderName ?? null, onNoContent, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/ExportAzSiteRecoveryReplicationJob_Export.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/ExportAzSiteRecoveryReplicationJob_Export.cs new file mode 100644 index 000000000000..5cbf68cb9f61 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/ExportAzSiteRecoveryReplicationJob_Export.cs @@ -0,0 +1,431 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// + /// The operation to export the details of the Azure Site Recovery jobs of the vault. + /// + /// + /// [OpenAPI] Export=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationJobs/export" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Export, @"AzSiteRecoveryReplicationJob_Export", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJob))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to export the details of the Azure Site Recovery jobs of the vault.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class ExportAzSiteRecoveryReplicationJob_Export : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobQueryParameter _jobQueryParameter; + + /// Query parameter to enumerate jobs. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Query parameter to enumerate jobs.", ValueFromPipeline = true)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Query parameter to enumerate jobs.", + SerializedName = @"jobQueryParameter", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobQueryParameter) })] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobQueryParameter JobQueryParameter { get => this._jobQueryParameter; set => this._jobQueryParameter = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJob + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of ExportAzSiteRecoveryReplicationJob_Export + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.ExportAzSiteRecoveryReplicationJob_Export Clone() + { + var clone = new ExportAzSiteRecoveryReplicationJob_Export(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + clone.JobQueryParameter = this.JobQueryParameter; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public ExportAzSiteRecoveryReplicationJob_Export() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationJobsExport' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationJobsExport(ResourceName, ResourceGroupName, SubscriptionId, JobQueryParameter, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,body=JobQueryParameter}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJob + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJob + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/ExportAzSiteRecoveryReplicationJob_ExportExpanded.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/ExportAzSiteRecoveryReplicationJob_ExportExpanded.cs new file mode 100644 index 000000000000..f7af96eca321 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/ExportAzSiteRecoveryReplicationJob_ExportExpanded.cs @@ -0,0 +1,510 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// + /// The operation to export the details of the Azure Site Recovery jobs of the vault. + /// + /// + /// [OpenAPI] Export=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationJobs/export" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Export, @"AzSiteRecoveryReplicationJob_ExportExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJob))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to export the details of the Azure Site Recovery jobs of the vault.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class ExportAzSiteRecoveryReplicationJob_ExportExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Query parameter to enumerate jobs. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobQueryParameter _jobQueryParameterBody = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.JobQueryParameter(); + + /// The type of objects. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The type of objects.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The type of objects.", + SerializedName = @"affectedObjectTypes", + PossibleTypes = new [] { typeof(string) })] + public string AffectedObjectType { get => _jobQueryParameterBody.AffectedObjectType ?? null; set => _jobQueryParameterBody.AffectedObjectType = value; } + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Date time to get jobs upto. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Date time to get jobs upto.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Date time to get jobs upto.", + SerializedName = @"endTime", + PossibleTypes = new [] { typeof(string) })] + public string EndTime { get => _jobQueryParameterBody.EndTime ?? null; set => _jobQueryParameterBody.EndTime = value; } + + /// The Id of the fabric to search jobs under. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The Id of the fabric to search jobs under.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Id of the fabric to search jobs under.", + SerializedName = @"fabricId", + PossibleTypes = new [] { typeof(string) })] + public string FabricId { get => _jobQueryParameterBody.FabricId ?? null; set => _jobQueryParameterBody.FabricId = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// The job Name. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The job Name.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The job Name.", + SerializedName = @"jobName", + PossibleTypes = new [] { typeof(string) })] + public string JobName { get => _jobQueryParameterBody.JobName ?? null; set => _jobQueryParameterBody.JobName = value; } + + /// The output type of the jobs. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The output type of the jobs.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The output type of the jobs.", + SerializedName = @"jobOutputType", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ExportJobOutputSerializationType) })] + [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ExportJobOutputSerializationType))] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ExportJobOutputSerializationType JobOutputType { get => _jobQueryParameterBody.JobOutputType ?? ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ExportJobOutputSerializationType)""); set => _jobQueryParameterBody.JobOutputType = value; } + + /// The states of the job to be filtered can be in. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The states of the job to be filtered can be in.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The states of the job to be filtered can be in.", + SerializedName = @"jobStatus", + PossibleTypes = new [] { typeof(string) })] + public string JobStatus { get => _jobQueryParameterBody.JobStatus ?? null; set => _jobQueryParameterBody.JobStatus = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Date time to get jobs from. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Date time to get jobs from.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Date time to get jobs from.", + SerializedName = @"startTime", + PossibleTypes = new [] { typeof(string) })] + public string StartTime { get => _jobQueryParameterBody.StartTime ?? null; set => _jobQueryParameterBody.StartTime = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// The timezone offset for the location of the request (in minutes). + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The timezone offset for the location of the request (in minutes).")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The timezone offset for the location of the request (in minutes).", + SerializedName = @"timezoneOffset", + PossibleTypes = new [] { typeof(double) })] + public double TimezoneOffset { get => _jobQueryParameterBody.TimezoneOffset ?? default(double); set => _jobQueryParameterBody.TimezoneOffset = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJob + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of ExportAzSiteRecoveryReplicationJob_ExportExpanded + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.ExportAzSiteRecoveryReplicationJob_ExportExpanded Clone() + { + var clone = new ExportAzSiteRecoveryReplicationJob_ExportExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._jobQueryParameterBody = this._jobQueryParameterBody; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public ExportAzSiteRecoveryReplicationJob_ExportExpanded() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationJobsExport' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationJobsExport(ResourceName, ResourceGroupName, SubscriptionId, _jobQueryParameterBody, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,body=_jobQueryParameterBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJob + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJob + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/ExportAzSiteRecoveryReplicationJob_ExportViaIdentity.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/ExportAzSiteRecoveryReplicationJob_ExportViaIdentity.cs new file mode 100644 index 000000000000..d3fcb0af4595 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/ExportAzSiteRecoveryReplicationJob_ExportViaIdentity.cs @@ -0,0 +1,410 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// + /// The operation to export the details of the Azure Site Recovery jobs of the vault. + /// + /// + /// [OpenAPI] Export=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationJobs/export" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Export, @"AzSiteRecoveryReplicationJob_ExportViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJob))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to export the details of the Azure Site Recovery jobs of the vault.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class ExportAzSiteRecoveryReplicationJob_ExportViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobQueryParameter _jobQueryParameter; + + /// Query parameter to enumerate jobs. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Query parameter to enumerate jobs.", ValueFromPipeline = true)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Query parameter to enumerate jobs.", + SerializedName = @"jobQueryParameter", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobQueryParameter) })] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobQueryParameter JobQueryParameter { get => this._jobQueryParameter; set => this._jobQueryParameter = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJob + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of ExportAzSiteRecoveryReplicationJob_ExportViaIdentity + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.ExportAzSiteRecoveryReplicationJob_ExportViaIdentity Clone() + { + var clone = new ExportAzSiteRecoveryReplicationJob_ExportViaIdentity(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.JobQueryParameter = this.JobQueryParameter; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public ExportAzSiteRecoveryReplicationJob_ExportViaIdentity() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationJobsExport' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationJobsExportViaIdentity(InputObject.Id, JobQueryParameter, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationJobsExport(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, JobQueryParameter, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=JobQueryParameter}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJob + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJob + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/ExportAzSiteRecoveryReplicationJob_ExportViaIdentityExpanded.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/ExportAzSiteRecoveryReplicationJob_ExportViaIdentityExpanded.cs new file mode 100644 index 000000000000..ff3fe4cc629b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/ExportAzSiteRecoveryReplicationJob_ExportViaIdentityExpanded.cs @@ -0,0 +1,491 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// + /// The operation to export the details of the Azure Site Recovery jobs of the vault. + /// + /// + /// [OpenAPI] Export=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationJobs/export" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Export, @"AzSiteRecoveryReplicationJob_ExportViaIdentityExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJob))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to export the details of the Azure Site Recovery jobs of the vault.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class ExportAzSiteRecoveryReplicationJob_ExportViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Query parameter to enumerate jobs. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobQueryParameter _jobQueryParameterBody = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.JobQueryParameter(); + + /// The type of objects. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The type of objects.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The type of objects.", + SerializedName = @"affectedObjectTypes", + PossibleTypes = new [] { typeof(string) })] + public string AffectedObjectType { get => _jobQueryParameterBody.AffectedObjectType ?? null; set => _jobQueryParameterBody.AffectedObjectType = value; } + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Date time to get jobs upto. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Date time to get jobs upto.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Date time to get jobs upto.", + SerializedName = @"endTime", + PossibleTypes = new [] { typeof(string) })] + public string EndTime { get => _jobQueryParameterBody.EndTime ?? null; set => _jobQueryParameterBody.EndTime = value; } + + /// The Id of the fabric to search jobs under. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The Id of the fabric to search jobs under.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Id of the fabric to search jobs under.", + SerializedName = @"fabricId", + PossibleTypes = new [] { typeof(string) })] + public string FabricId { get => _jobQueryParameterBody.FabricId ?? null; set => _jobQueryParameterBody.FabricId = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// The job Name. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The job Name.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The job Name.", + SerializedName = @"jobName", + PossibleTypes = new [] { typeof(string) })] + public string JobName { get => _jobQueryParameterBody.JobName ?? null; set => _jobQueryParameterBody.JobName = value; } + + /// The output type of the jobs. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The output type of the jobs.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The output type of the jobs.", + SerializedName = @"jobOutputType", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ExportJobOutputSerializationType) })] + [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ExportJobOutputSerializationType))] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ExportJobOutputSerializationType JobOutputType { get => _jobQueryParameterBody.JobOutputType ?? ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.ExportJobOutputSerializationType)""); set => _jobQueryParameterBody.JobOutputType = value; } + + /// The states of the job to be filtered can be in. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The states of the job to be filtered can be in.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The states of the job to be filtered can be in.", + SerializedName = @"jobStatus", + PossibleTypes = new [] { typeof(string) })] + public string JobStatus { get => _jobQueryParameterBody.JobStatus ?? null; set => _jobQueryParameterBody.JobStatus = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Date time to get jobs from. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Date time to get jobs from.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Date time to get jobs from.", + SerializedName = @"startTime", + PossibleTypes = new [] { typeof(string) })] + public string StartTime { get => _jobQueryParameterBody.StartTime ?? null; set => _jobQueryParameterBody.StartTime = value; } + + /// The timezone offset for the location of the request (in minutes). + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The timezone offset for the location of the request (in minutes).")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The timezone offset for the location of the request (in minutes).", + SerializedName = @"timezoneOffset", + PossibleTypes = new [] { typeof(double) })] + public double TimezoneOffset { get => _jobQueryParameterBody.TimezoneOffset ?? default(double); set => _jobQueryParameterBody.TimezoneOffset = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJob + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of ExportAzSiteRecoveryReplicationJob_ExportViaIdentityExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.ExportAzSiteRecoveryReplicationJob_ExportViaIdentityExpanded Clone() + { + var clone = new ExportAzSiteRecoveryReplicationJob_ExportViaIdentityExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._jobQueryParameterBody = this._jobQueryParameterBody; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public ExportAzSiteRecoveryReplicationJob_ExportViaIdentityExpanded() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationJobsExport' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationJobsExportViaIdentity(InputObject.Id, _jobQueryParameterBody, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationJobsExport(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, _jobQueryParameterBody, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=_jobQueryParameterBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJob + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJob + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/FindAzSiteRecoveryReplicationProtectionContainerProtectableItem_Discover.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/FindAzSiteRecoveryReplicationProtectionContainerProtectableItem_Discover.cs new file mode 100644 index 000000000000..22e3eec7b8c4 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/FindAzSiteRecoveryReplicationProtectionContainerProtectableItem_Discover.cs @@ -0,0 +1,464 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// + /// The operation to a add a protectable item to a protection container(Add physical server). + /// + /// + /// [OpenAPI] DiscoverProtectableItem=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/discoverProtectableItem" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Find, @"AzSiteRecoveryReplicationProtectionContainerProtectableItem_Discover", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainer))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to a add a protectable item to a protection container(Add physical server).")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class FindAzSiteRecoveryReplicationProtectionContainerProtectableItem_Discover : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiscoverProtectableItemRequest _discoverProtectableItemRequest; + + /// Request to add a physical machine as a protectable item in a container. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Request to add a physical machine as a protectable item in a container.", ValueFromPipeline = true)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Request to add a physical machine as a protectable item in a container.", + SerializedName = @"discoverProtectableItemRequest", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiscoverProtectableItemRequest) })] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiscoverProtectableItemRequest DiscoverProtectableItemRequest { get => this._discoverProtectableItemRequest; set => this._discoverProtectableItemRequest = value; } + + /// Backing field for property. + private string _fabricName; + + /// The name of the fabric. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the fabric.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the fabric.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _protectionContainerName; + + /// The name of the protection container. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the protection container.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the protection container.", + SerializedName = @"protectionContainerName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ProtectionContainerName { get => this._protectionContainerName; set => this._protectionContainerName = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainer + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of FindAzSiteRecoveryReplicationProtectionContainerProtectableItem_Discover + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.FindAzSiteRecoveryReplicationProtectionContainerProtectableItem_Discover Clone() + { + var clone = new FindAzSiteRecoveryReplicationProtectionContainerProtectableItem_Discover(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + clone.FabricName = this.FabricName; + clone.ProtectionContainerName = this.ProtectionContainerName; + clone.DiscoverProtectableItemRequest = this.DiscoverProtectableItemRequest; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public FindAzSiteRecoveryReplicationProtectionContainerProtectableItem_Discover() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationProtectionContainersDiscoverProtectableItem' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationProtectionContainersDiscoverProtectableItem(ResourceName, ResourceGroupName, SubscriptionId, FabricName, ProtectionContainerName, DiscoverProtectableItemRequest, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName,ProtectionContainerName=ProtectionContainerName,body=DiscoverProtectableItemRequest}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainer + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainer + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/FindAzSiteRecoveryReplicationProtectionContainerProtectableItem_DiscoverExpanded.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/FindAzSiteRecoveryReplicationProtectionContainerProtectableItem_DiscoverExpanded.cs new file mode 100644 index 000000000000..7b6e34766222 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/FindAzSiteRecoveryReplicationProtectionContainerProtectableItem_DiscoverExpanded.cs @@ -0,0 +1,487 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// + /// The operation to a add a protectable item to a protection container(Add physical server). + /// + /// + /// [OpenAPI] DiscoverProtectableItem=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/discoverProtectableItem" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Find, @"AzSiteRecoveryReplicationProtectionContainerProtectableItem_DiscoverExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainer))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to a add a protectable item to a protection container(Add physical server).")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class FindAzSiteRecoveryReplicationProtectionContainerProtectableItem_DiscoverExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Request to add a physical machine as a protectable item in a container. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiscoverProtectableItemRequest _discoverProtectableItemRequestBody = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DiscoverProtectableItemRequest(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// The name of the fabric. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the fabric.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the fabric.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// The friendly name of the physical machine. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The friendly name of the physical machine.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The friendly name of the physical machine.", + SerializedName = @"friendlyName", + PossibleTypes = new [] { typeof(string) })] + public string FriendlyName { get => _discoverProtectableItemRequestBody.FriendlyName ?? null; set => _discoverProtectableItemRequestBody.FriendlyName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// The IP address of the physical machine to be discovered. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The IP address of the physical machine to be discovered.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The IP address of the physical machine to be discovered.", + SerializedName = @"ipAddress", + PossibleTypes = new [] { typeof(string) })] + public string IPAddress { get => _discoverProtectableItemRequestBody.IPAddress ?? null; set => _discoverProtectableItemRequestBody.IPAddress = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// The OS type on the physical machine. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The OS type on the physical machine.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The OS type on the physical machine.", + SerializedName = @"osType", + PossibleTypes = new [] { typeof(string) })] + public string OSType { get => _discoverProtectableItemRequestBody.OSType ?? null; set => _discoverProtectableItemRequestBody.OSType = value; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _protectionContainerName; + + /// The name of the protection container. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the protection container.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the protection container.", + SerializedName = @"protectionContainerName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ProtectionContainerName { get => this._protectionContainerName; set => this._protectionContainerName = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainer + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of FindAzSiteRecoveryReplicationProtectionContainerProtectableItem_DiscoverExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.FindAzSiteRecoveryReplicationProtectionContainerProtectableItem_DiscoverExpanded Clone() + { + var clone = new FindAzSiteRecoveryReplicationProtectionContainerProtectableItem_DiscoverExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._discoverProtectableItemRequestBody = this._discoverProtectableItemRequestBody; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + clone.FabricName = this.FabricName; + clone.ProtectionContainerName = this.ProtectionContainerName; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public FindAzSiteRecoveryReplicationProtectionContainerProtectableItem_DiscoverExpanded() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationProtectionContainersDiscoverProtectableItem' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationProtectionContainersDiscoverProtectableItem(ResourceName, ResourceGroupName, SubscriptionId, FabricName, ProtectionContainerName, _discoverProtectableItemRequestBody, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName,ProtectionContainerName=ProtectionContainerName,body=_discoverProtectableItemRequestBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainer + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainer + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/FindAzSiteRecoveryReplicationProtectionContainerProtectableItem_DiscoverViaIdentity.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/FindAzSiteRecoveryReplicationProtectionContainerProtectableItem_DiscoverViaIdentity.cs new file mode 100644 index 000000000000..824113985899 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/FindAzSiteRecoveryReplicationProtectionContainerProtectableItem_DiscoverViaIdentity.cs @@ -0,0 +1,421 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// + /// The operation to a add a protectable item to a protection container(Add physical server). + /// + /// + /// [OpenAPI] DiscoverProtectableItem=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/discoverProtectableItem" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Find, @"AzSiteRecoveryReplicationProtectionContainerProtectableItem_DiscoverViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainer))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to a add a protectable item to a protection container(Add physical server).")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class FindAzSiteRecoveryReplicationProtectionContainerProtectableItem_DiscoverViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiscoverProtectableItemRequest _discoverProtectableItemRequest; + + /// Request to add a physical machine as a protectable item in a container. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Request to add a physical machine as a protectable item in a container.", ValueFromPipeline = true)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Request to add a physical machine as a protectable item in a container.", + SerializedName = @"discoverProtectableItemRequest", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiscoverProtectableItemRequest) })] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiscoverProtectableItemRequest DiscoverProtectableItemRequest { get => this._discoverProtectableItemRequest; set => this._discoverProtectableItemRequest = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainer + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of FindAzSiteRecoveryReplicationProtectionContainerProtectableItem_DiscoverViaIdentity + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.FindAzSiteRecoveryReplicationProtectionContainerProtectableItem_DiscoverViaIdentity Clone() + { + var clone = new FindAzSiteRecoveryReplicationProtectionContainerProtectableItem_DiscoverViaIdentity(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.DiscoverProtectableItemRequest = this.DiscoverProtectableItemRequest; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public FindAzSiteRecoveryReplicationProtectionContainerProtectableItem_DiscoverViaIdentity() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationProtectionContainersDiscoverProtectableItem' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationProtectionContainersDiscoverProtectableItemViaIdentity(InputObject.Id, DiscoverProtectableItemRequest, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.FabricName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.FabricName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ProtectionContainerName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ProtectionContainerName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationProtectionContainersDiscoverProtectableItem(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.FabricName ?? null, InputObject.ProtectionContainerName ?? null, DiscoverProtectableItemRequest, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=DiscoverProtectableItemRequest}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainer + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainer + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/FindAzSiteRecoveryReplicationProtectionContainerProtectableItem_DiscoverViaIdentityExpanded.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/FindAzSiteRecoveryReplicationProtectionContainerProtectableItem_DiscoverViaIdentityExpanded.cs new file mode 100644 index 000000000000..6a1ef28878f0 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/FindAzSiteRecoveryReplicationProtectionContainerProtectableItem_DiscoverViaIdentityExpanded.cs @@ -0,0 +1,444 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// + /// The operation to a add a protectable item to a protection container(Add physical server). + /// + /// + /// [OpenAPI] DiscoverProtectableItem=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/discoverProtectableItem" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Find, @"AzSiteRecoveryReplicationProtectionContainerProtectableItem_DiscoverViaIdentityExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainer))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to a add a protectable item to a protection container(Add physical server).")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class FindAzSiteRecoveryReplicationProtectionContainerProtectableItem_DiscoverViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Request to add a physical machine as a protectable item in a container. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDiscoverProtectableItemRequest _discoverProtectableItemRequestBody = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DiscoverProtectableItemRequest(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// The friendly name of the physical machine. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The friendly name of the physical machine.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The friendly name of the physical machine.", + SerializedName = @"friendlyName", + PossibleTypes = new [] { typeof(string) })] + public string FriendlyName { get => _discoverProtectableItemRequestBody.FriendlyName ?? null; set => _discoverProtectableItemRequestBody.FriendlyName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// The IP address of the physical machine to be discovered. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The IP address of the physical machine to be discovered.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The IP address of the physical machine to be discovered.", + SerializedName = @"ipAddress", + PossibleTypes = new [] { typeof(string) })] + public string IPAddress { get => _discoverProtectableItemRequestBody.IPAddress ?? null; set => _discoverProtectableItemRequestBody.IPAddress = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// The OS type on the physical machine. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The OS type on the physical machine.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The OS type on the physical machine.", + SerializedName = @"osType", + PossibleTypes = new [] { typeof(string) })] + public string OSType { get => _discoverProtectableItemRequestBody.OSType ?? null; set => _discoverProtectableItemRequestBody.OSType = value; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainer + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of FindAzSiteRecoveryReplicationProtectionContainerProtectableItem_DiscoverViaIdentityExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.FindAzSiteRecoveryReplicationProtectionContainerProtectableItem_DiscoverViaIdentityExpanded Clone() + { + var clone = new FindAzSiteRecoveryReplicationProtectionContainerProtectableItem_DiscoverViaIdentityExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._discoverProtectableItemRequestBody = this._discoverProtectableItemRequestBody; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public FindAzSiteRecoveryReplicationProtectionContainerProtectableItem_DiscoverViaIdentityExpanded() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationProtectionContainersDiscoverProtectableItem' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationProtectionContainersDiscoverProtectableItemViaIdentity(InputObject.Id, _discoverProtectableItemRequestBody, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.FabricName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.FabricName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ProtectionContainerName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ProtectionContainerName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationProtectionContainersDiscoverProtectableItem(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.FabricName ?? null, InputObject.ProtectionContainerName ?? null, _discoverProtectableItemRequestBody, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=_discoverProtectableItemRequestBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainer + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainer + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryMigrationRecoveryPoint_Get.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryMigrationRecoveryPoint_Get.cs new file mode 100644 index 000000000000..d567ce5b94b5 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryMigrationRecoveryPoint_Get.cs @@ -0,0 +1,406 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Gets a recovery point for a migration item. + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/migrationRecoveryPoints/{migrationRecoveryPointName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSiteRecoveryMigrationRecoveryPoint_Get")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationRecoveryPoint))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Gets a recovery point for a migration item.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class GetAzSiteRecoveryMigrationRecoveryPoint_Get : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// Fabric unique name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Fabric unique name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Fabric unique name.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _migrationItemName; + + /// Migration item name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Migration item name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Migration item name.", + SerializedName = @"migrationItemName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string MigrationItemName { get => this._migrationItemName; set => this._migrationItemName = value; } + + /// Backing field for property. + private string _name; + + /// The migration recovery point name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The migration recovery point name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The migration recovery point name.", + SerializedName = @"migrationRecoveryPointName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("MigrationRecoveryPointName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _protectionContainerName; + + /// Protection container name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Protection container name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Protection container name.", + SerializedName = @"protectionContainerName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ProtectionContainerName { get => this._protectionContainerName; set => this._protectionContainerName = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationRecoveryPoint + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzSiteRecoveryMigrationRecoveryPoint_Get() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.MigrationRecoveryPointsGet(ResourceName, ResourceGroupName, SubscriptionId, FabricName, ProtectionContainerName, MigrationItemName, Name, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName,ProtectionContainerName=ProtectionContainerName,MigrationItemName=MigrationItemName,Name=Name}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationRecoveryPoint + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationRecoveryPoint + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryMigrationRecoveryPoint_GetViaIdentity.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryMigrationRecoveryPoint_GetViaIdentity.cs new file mode 100644 index 000000000000..f144483a22e6 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryMigrationRecoveryPoint_GetViaIdentity.cs @@ -0,0 +1,344 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Gets a recovery point for a migration item. + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/migrationRecoveryPoints/{migrationRecoveryPointName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSiteRecoveryMigrationRecoveryPoint_GetViaIdentity")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationRecoveryPoint))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Gets a recovery point for a migration item.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class GetAzSiteRecoveryMigrationRecoveryPoint_GetViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationRecoveryPoint + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzSiteRecoveryMigrationRecoveryPoint_GetViaIdentity() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.MigrationRecoveryPointsGetViaIdentity(InputObject.Id, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.FabricName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.FabricName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ProtectionContainerName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ProtectionContainerName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.MigrationItemName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.MigrationItemName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.MigrationRecoveryPointName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.MigrationRecoveryPointName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.MigrationRecoveryPointsGet(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.FabricName ?? null, InputObject.ProtectionContainerName ?? null, InputObject.MigrationItemName ?? null, InputObject.MigrationRecoveryPointName ?? null, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationRecoveryPoint + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationRecoveryPoint + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryMigrationRecoveryPoint_List.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryMigrationRecoveryPoint_List.cs new file mode 100644 index 000000000000..037fef8d9a9e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryMigrationRecoveryPoint_List.cs @@ -0,0 +1,413 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Gets the recovery points for a migration item. + /// + /// [OpenAPI] ListByReplicationMigrationItems=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/migrationRecoveryPoints" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSiteRecoveryMigrationRecoveryPoint_List")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationRecoveryPoint))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Gets the recovery points for a migration item.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class GetAzSiteRecoveryMigrationRecoveryPoint_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// Fabric unique name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Fabric unique name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Fabric unique name.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _migrationItemName; + + /// Migration item name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Migration item name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Migration item name.", + SerializedName = @"migrationItemName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string MigrationItemName { get => this._migrationItemName; set => this._migrationItemName = value; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _protectionContainerName; + + /// Protection container name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Protection container name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Protection container name.", + SerializedName = @"protectionContainerName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ProtectionContainerName { get => this._protectionContainerName; set => this._protectionContainerName = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationRecoveryPointCollection + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzSiteRecoveryMigrationRecoveryPoint_List() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.MigrationRecoveryPointsListByReplicationMigrationItems(ResourceName, ResourceGroupName, SubscriptionId, FabricName, ProtectionContainerName, MigrationItemName, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName,ProtectionContainerName=ProtectionContainerName,MigrationItemName=MigrationItemName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationRecoveryPointCollection + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + var result = await response; + WriteObject(result.Value,true); + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (_nextLink != null) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.MigrationRecoveryPointsListByReplicationMigrationItems_Call(requestMessage, onOk, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryOperation_List.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryOperation_List.cs new file mode 100644 index 000000000000..1122a9b7b180 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryOperation_List.cs @@ -0,0 +1,358 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Operation to return the list of available operations. + /// + /// [OpenAPI] List=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/operations" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSiteRecoveryOperation_List")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOperationsDiscovery))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Operation to return the list of available operations.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class GetAzSiteRecoveryOperation_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOperationsDiscoveryCollection + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzSiteRecoveryOperation_List() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.OperationsList(ResourceGroupName, SubscriptionId, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOperationsDiscoveryCollection + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + var result = await response; + WriteObject(result.Value,true); + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (_nextLink != null) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.OperationsList_Call(requestMessage, onOk, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryPoint_Get.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryPoint_Get.cs new file mode 100644 index 000000000000..3015614c6398 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryPoint_Get.cs @@ -0,0 +1,406 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Get the details of specified recovery point. + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/recoveryPoints/{recoveryPointName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSiteRecoveryPoint_Get")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPoint))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Get the details of specified recovery point.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class GetAzSiteRecoveryPoint_Get : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// The fabric name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The fabric name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The fabric name.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// The recovery point name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The recovery point name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The recovery point name.", + SerializedName = @"recoveryPointName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("RecoveryPointName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _protectionContainerName; + + /// The protection container name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The protection container name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The protection container name.", + SerializedName = @"protectionContainerName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ProtectionContainerName { get => this._protectionContainerName; set => this._protectionContainerName = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _replicatedProtectedItemName; + + /// The replication protected item name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The replication protected item name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The replication protected item name.", + SerializedName = @"replicatedProtectedItemName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ReplicatedProtectedItemName { get => this._replicatedProtectedItemName; set => this._replicatedProtectedItemName = value; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPoint + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzSiteRecoveryPoint_Get() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.RecoveryPointsGet(ResourceName, ResourceGroupName, SubscriptionId, FabricName, ProtectionContainerName, ReplicatedProtectedItemName, Name, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName,ProtectionContainerName=ProtectionContainerName,ReplicatedProtectedItemName=ReplicatedProtectedItemName,Name=Name}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPoint + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPoint + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryPoint_GetViaIdentity.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryPoint_GetViaIdentity.cs new file mode 100644 index 000000000000..b1d882065323 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryPoint_GetViaIdentity.cs @@ -0,0 +1,344 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Get the details of specified recovery point. + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/recoveryPoints/{recoveryPointName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSiteRecoveryPoint_GetViaIdentity")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPoint))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Get the details of specified recovery point.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class GetAzSiteRecoveryPoint_GetViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPoint + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzSiteRecoveryPoint_GetViaIdentity() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.RecoveryPointsGetViaIdentity(InputObject.Id, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.FabricName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.FabricName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ProtectionContainerName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ProtectionContainerName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ReplicatedProtectedItemName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ReplicatedProtectedItemName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.RecoveryPointName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.RecoveryPointName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.RecoveryPointsGet(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.FabricName ?? null, InputObject.ProtectionContainerName ?? null, InputObject.ReplicatedProtectedItemName ?? null, InputObject.RecoveryPointName ?? null, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPoint + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPoint + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryPoint_List.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryPoint_List.cs new file mode 100644 index 000000000000..7d41d7415130 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryPoint_List.cs @@ -0,0 +1,413 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Lists the available recovery points for a replication protected item. + /// + /// [OpenAPI] ListByReplicationProtectedItems=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/recoveryPoints" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSiteRecoveryPoint_List")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPoint))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Lists the available recovery points for a replication protected item.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class GetAzSiteRecoveryPoint_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// The fabric name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The fabric name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The fabric name.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _protectionContainerName; + + /// The protection container name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The protection container name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The protection container name.", + SerializedName = @"protectionContainerName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ProtectionContainerName { get => this._protectionContainerName; set => this._protectionContainerName = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _replicatedProtectedItemName; + + /// The replication protected item name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The replication protected item name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The replication protected item name.", + SerializedName = @"replicatedProtectedItemName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ReplicatedProtectedItemName { get => this._replicatedProtectedItemName; set => this._replicatedProtectedItemName = value; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPointCollection + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzSiteRecoveryPoint_List() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.RecoveryPointsListByReplicationProtectedItems(ResourceName, ResourceGroupName, SubscriptionId, FabricName, ProtectionContainerName, ReplicatedProtectedItemName, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName,ProtectionContainerName=ProtectionContainerName,ReplicatedProtectedItemName=ReplicatedProtectedItemName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPointCollection + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + var result = await response; + WriteObject(result.Value,true); + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (_nextLink != null) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.RecoveryPointsListByReplicationProtectedItems_Call(requestMessage, onOk, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationAlertSetting_Get.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationAlertSetting_Get.cs new file mode 100644 index 000000000000..7246ba987a02 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationAlertSetting_Get.cs @@ -0,0 +1,363 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Gets the details of the specified email notification(alert) configuration. + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationAlertSettings/{alertSettingName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSiteRecoveryReplicationAlertSetting_Get")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlert))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Gets the details of the specified email notification(alert) configuration.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class GetAzSiteRecoveryReplicationAlertSetting_Get : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Backing field for property. + private string _alertSettingName; + + /// The name of the email notification configuration. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the email notification configuration.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the email notification configuration.", + SerializedName = @"alertSettingName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string AlertSettingName { get => this._alertSettingName; set => this._alertSettingName = value; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlert + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzSiteRecoveryReplicationAlertSetting_Get() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationAlertSettingsGet(ResourceName, ResourceGroupName, SubscriptionId, AlertSettingName, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,AlertSettingName=AlertSettingName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlert + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlert + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationAlertSetting_GetViaIdentity.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationAlertSetting_GetViaIdentity.cs new file mode 100644 index 000000000000..6eb1bb2c5707 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationAlertSetting_GetViaIdentity.cs @@ -0,0 +1,332 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Gets the details of the specified email notification(alert) configuration. + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationAlertSettings/{alertSettingName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSiteRecoveryReplicationAlertSetting_GetViaIdentity")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlert))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Gets the details of the specified email notification(alert) configuration.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class GetAzSiteRecoveryReplicationAlertSetting_GetViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlert + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzSiteRecoveryReplicationAlertSetting_GetViaIdentity() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationAlertSettingsGetViaIdentity(InputObject.Id, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.AlertSettingName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.AlertSettingName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationAlertSettingsGet(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.AlertSettingName ?? null, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlert + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlert + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationAlertSetting_List.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationAlertSetting_List.cs new file mode 100644 index 000000000000..e2657a21a414 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationAlertSetting_List.cs @@ -0,0 +1,371 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Gets the list of email notification(alert) configurations for the vault. + /// + /// [OpenAPI] List=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationAlertSettings" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSiteRecoveryReplicationAlertSetting_List")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlert))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Gets the list of email notification(alert) configurations for the vault.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class GetAzSiteRecoveryReplicationAlertSetting_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlertCollection + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzSiteRecoveryReplicationAlertSetting_List() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationAlertSettingsList(ResourceName, ResourceGroupName, SubscriptionId, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlertCollection + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + var result = await response; + WriteObject(result.Value,true); + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (_nextLink != null) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationAlertSettingsList_Call(requestMessage, onOk, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationAppliance_List.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationAppliance_List.cs new file mode 100644 index 000000000000..ed39068c3946 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationAppliance_List.cs @@ -0,0 +1,385 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Gets the list of Azure Site Recovery appliances for the vault. + /// + /// [OpenAPI] List=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationAppliances" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSiteRecoveryReplicationAppliance_List")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationAppliance))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Gets the list of Azure Site Recovery appliances for the vault.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class GetAzSiteRecoveryReplicationAppliance_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _filter; + + /// OData filter options. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "OData filter options.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"OData filter options.", + SerializedName = @"$filter", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Query)] + public string Filter { get => this._filter; set => this._filter = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplianceCollection + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzSiteRecoveryReplicationAppliance_List() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationAppliancesList(ResourceName, ResourceGroupName, SubscriptionId, this.InvocationInformation.BoundParameters.ContainsKey("Filter") ? Filter : null, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,Filter=this.InvocationInformation.BoundParameters.ContainsKey("Filter") ? Filter : null}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IApplianceCollection + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + var result = await response; + WriteObject(result.Value,true); + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (_nextLink != null) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationAppliancesList_Call(requestMessage, onOk, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationEligibilityResult_Get.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationEligibilityResult_Get.cs new file mode 100644 index 000000000000..1c2c4cfd51b8 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationEligibilityResult_Get.cs @@ -0,0 +1,351 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// + /// Validates whether a given VM can be protected or not in which case returns list of errors. + /// + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{virtualMachineName}/providers/Microsoft.RecoveryServices/replicationEligibilityResults/default" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSiteRecoveryReplicationEligibilityResult_Get")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResults))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Validates whether a given VM can be protected or not in which case returns list of errors.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class GetAzSiteRecoveryReplicationEligibilityResult_Get : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Backing field for property. + private string _virtualMachineName; + + /// Virtual Machine name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Virtual Machine name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Virtual Machine name.", + SerializedName = @"virtualMachineName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string VirtualMachineName { get => this._virtualMachineName; set => this._virtualMachineName = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResults + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzSiteRecoveryReplicationEligibilityResult_Get() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationEligibilityResultsGet(ResourceGroupName, SubscriptionId, VirtualMachineName, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,VirtualMachineName=VirtualMachineName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResults + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResults + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationEligibilityResult_GetViaIdentity.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationEligibilityResult_GetViaIdentity.cs new file mode 100644 index 000000000000..90da0e7eedc1 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationEligibilityResult_GetViaIdentity.cs @@ -0,0 +1,330 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// + /// Validates whether a given VM can be protected or not in which case returns list of errors. + /// + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{virtualMachineName}/providers/Microsoft.RecoveryServices/replicationEligibilityResults/default" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSiteRecoveryReplicationEligibilityResult_GetViaIdentity")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResults))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Validates whether a given VM can be protected or not in which case returns list of errors.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class GetAzSiteRecoveryReplicationEligibilityResult_GetViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResults + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzSiteRecoveryReplicationEligibilityResult_GetViaIdentity() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationEligibilityResultsGetViaIdentity(InputObject.Id, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.VirtualMachineName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.VirtualMachineName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationEligibilityResultsGet(InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.VirtualMachineName ?? null, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResults + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResults + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationEligibilityResult_List.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationEligibilityResult_List.cs new file mode 100644 index 000000000000..7e0361d94b04 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationEligibilityResult_List.cs @@ -0,0 +1,352 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// + /// Validates whether a given VM can be protected or not in which case returns list of errors. + /// + /// + /// [OpenAPI] List=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{virtualMachineName}/providers/Microsoft.RecoveryServices/replicationEligibilityResults" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSiteRecoveryReplicationEligibilityResult_List")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResults))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Validates whether a given VM can be protected or not in which case returns list of errors.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class GetAzSiteRecoveryReplicationEligibilityResult_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Backing field for property. + private string _virtualMachineName; + + /// Virtual Machine name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Virtual Machine name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Virtual Machine name.", + SerializedName = @"virtualMachineName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string VirtualMachineName { get => this._virtualMachineName; set => this._virtualMachineName = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsCollection + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzSiteRecoveryReplicationEligibilityResult_List() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationEligibilityResultsList(ResourceGroupName, SubscriptionId, VirtualMachineName, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,VirtualMachineName=VirtualMachineName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationEligibilityResultsCollection + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // nested-array / value / + WriteObject((await response).Value, true); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationEvent_Get.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationEvent_Get.cs new file mode 100644 index 000000000000..891b68b70023 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationEvent_Get.cs @@ -0,0 +1,363 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to get the details of an Azure Site recovery event. + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationEvents/{eventName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSiteRecoveryReplicationEvent_Get")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEvent))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to get the details of an Azure Site recovery event.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class GetAzSiteRecoveryReplicationEvent_Get : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _eventName; + + /// The name of the Azure Site Recovery event. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the Azure Site Recovery event.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the Azure Site Recovery event.", + SerializedName = @"eventName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string EventName { get => this._eventName; set => this._eventName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEvent + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzSiteRecoveryReplicationEvent_Get() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationEventsGet(ResourceName, ResourceGroupName, SubscriptionId, EventName, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,EventName=EventName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEvent + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEvent + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationEvent_GetViaIdentity.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationEvent_GetViaIdentity.cs new file mode 100644 index 000000000000..803eb4b6d346 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationEvent_GetViaIdentity.cs @@ -0,0 +1,332 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to get the details of an Azure Site recovery event. + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationEvents/{eventName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSiteRecoveryReplicationEvent_GetViaIdentity")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEvent))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to get the details of an Azure Site recovery event.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class GetAzSiteRecoveryReplicationEvent_GetViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEvent + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzSiteRecoveryReplicationEvent_GetViaIdentity() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationEventsGetViaIdentity(InputObject.Id, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.EventName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.EventName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationEventsGet(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.EventName ?? null, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEvent + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEvent + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationEvent_List.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationEvent_List.cs new file mode 100644 index 000000000000..98b79db58d65 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationEvent_List.cs @@ -0,0 +1,385 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Gets the list of Azure Site Recovery events for the vault. + /// + /// [OpenAPI] List=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationEvents" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSiteRecoveryReplicationEvent_List")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEvent))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Gets the list of Azure Site Recovery events for the vault.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class GetAzSiteRecoveryReplicationEvent_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _filter; + + /// OData filter options. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "OData filter options.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"OData filter options.", + SerializedName = @"$filter", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Query)] + public string Filter { get => this._filter; set => this._filter = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventCollection + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzSiteRecoveryReplicationEvent_List() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationEventsList(ResourceName, ResourceGroupName, SubscriptionId, this.InvocationInformation.BoundParameters.ContainsKey("Filter") ? Filter : null, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,Filter=this.InvocationInformation.BoundParameters.ContainsKey("Filter") ? Filter : null}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEventCollection + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + var result = await response; + WriteObject(result.Value,true); + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (_nextLink != null) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationEventsList_Call(requestMessage, onOk, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationFabric_Get.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationFabric_Get.cs new file mode 100644 index 000000000000..c110986d073f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationFabric_Get.cs @@ -0,0 +1,377 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Gets the details of an Azure Site Recovery fabric. + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSiteRecoveryReplicationFabric_Get")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabric))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Gets the details of an Azure Site Recovery fabric.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class GetAzSiteRecoveryReplicationFabric_Get : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// Fabric name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Fabric name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Fabric name.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// Backing field for property. + private string _filter; + + /// OData filter options. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "OData filter options.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"OData filter options.", + SerializedName = @"$filter", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Query)] + public string Filter { get => this._filter; set => this._filter = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabric + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzSiteRecoveryReplicationFabric_Get() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationFabricsGet(ResourceName, ResourceGroupName, SubscriptionId, FabricName, this.InvocationInformation.BoundParameters.ContainsKey("Filter") ? Filter : null, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName,Filter=this.InvocationInformation.BoundParameters.ContainsKey("Filter") ? Filter : null}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabric + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabric + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationFabric_GetViaIdentity.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationFabric_GetViaIdentity.cs new file mode 100644 index 000000000000..bdfafd3af8c2 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationFabric_GetViaIdentity.cs @@ -0,0 +1,346 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Gets the details of an Azure Site Recovery fabric. + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSiteRecoveryReplicationFabric_GetViaIdentity")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabric))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Gets the details of an Azure Site Recovery fabric.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class GetAzSiteRecoveryReplicationFabric_GetViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _filter; + + /// OData filter options. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "OData filter options.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"OData filter options.", + SerializedName = @"$filter", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Query)] + public string Filter { get => this._filter; set => this._filter = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabric + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzSiteRecoveryReplicationFabric_GetViaIdentity() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationFabricsGetViaIdentity(InputObject.Id, this.InvocationInformation.BoundParameters.ContainsKey("Filter") ? Filter : null, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.FabricName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.FabricName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationFabricsGet(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.FabricName ?? null, this.InvocationInformation.BoundParameters.ContainsKey("Filter") ? Filter : null, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { Filter=this.InvocationInformation.BoundParameters.ContainsKey("Filter") ? Filter : null}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabric + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabric + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationFabric_List.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationFabric_List.cs new file mode 100644 index 000000000000..24f166772aef --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationFabric_List.cs @@ -0,0 +1,371 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Gets a list of the Azure Site Recovery fabrics in the vault. + /// + /// [OpenAPI] List=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSiteRecoveryReplicationFabric_List")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabric))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Gets a list of the Azure Site Recovery fabrics in the vault.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class GetAzSiteRecoveryReplicationFabric_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricCollection + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzSiteRecoveryReplicationFabric_List() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationFabricsList(ResourceName, ResourceGroupName, SubscriptionId, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricCollection + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + var result = await response; + WriteObject(result.Value,true); + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (_nextLink != null) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationFabricsList_Call(requestMessage, onOk, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationJob_Get.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationJob_Get.cs new file mode 100644 index 000000000000..10bc14c35036 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationJob_Get.cs @@ -0,0 +1,363 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Get the details of an Azure Site Recovery job. + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationJobs/{jobName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSiteRecoveryReplicationJob_Get")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJob))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Get the details of an Azure Site Recovery job.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class GetAzSiteRecoveryReplicationJob_Get : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// Backing field for property. + private string _jobName; + + /// Job identifier. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Job identifier.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Job identifier.", + SerializedName = @"jobName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string JobName { get => this._jobName; set => this._jobName = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJob + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzSiteRecoveryReplicationJob_Get() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationJobsGet(ResourceName, ResourceGroupName, SubscriptionId, JobName, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,JobName=JobName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJob + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJob + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationJob_GetViaIdentity.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationJob_GetViaIdentity.cs new file mode 100644 index 000000000000..21bc923ee496 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationJob_GetViaIdentity.cs @@ -0,0 +1,332 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Get the details of an Azure Site Recovery job. + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationJobs/{jobName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSiteRecoveryReplicationJob_GetViaIdentity")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJob))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Get the details of an Azure Site Recovery job.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class GetAzSiteRecoveryReplicationJob_GetViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJob + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzSiteRecoveryReplicationJob_GetViaIdentity() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationJobsGetViaIdentity(InputObject.Id, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.JobName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.JobName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationJobsGet(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.JobName ?? null, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJob + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJob + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationJob_List.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationJob_List.cs new file mode 100644 index 000000000000..2b4f8ccd6d55 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationJob_List.cs @@ -0,0 +1,385 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Gets the list of Azure Site Recovery Jobs for the vault. + /// + /// [OpenAPI] List=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationJobs" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSiteRecoveryReplicationJob_List")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJob))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Gets the list of Azure Site Recovery Jobs for the vault.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class GetAzSiteRecoveryReplicationJob_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _filter; + + /// OData filter options. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "OData filter options.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"OData filter options.", + SerializedName = @"$filter", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Query)] + public string Filter { get => this._filter; set => this._filter = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobCollection + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzSiteRecoveryReplicationJob_List() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationJobsList(ResourceName, ResourceGroupName, SubscriptionId, this.InvocationInformation.BoundParameters.ContainsKey("Filter") ? Filter : null, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,Filter=this.InvocationInformation.BoundParameters.ContainsKey("Filter") ? Filter : null}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJobCollection + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + var result = await response; + WriteObject(result.Value,true); + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (_nextLink != null) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationJobsList_Call(requestMessage, onOk, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationLogicalNetwork_Get.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationLogicalNetwork_Get.cs new file mode 100644 index 000000000000..4e70be66c79a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationLogicalNetwork_Get.cs @@ -0,0 +1,377 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Gets the details of a logical network. + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationLogicalNetworks/{logicalNetworkName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSiteRecoveryReplicationLogicalNetwork_Get")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetwork))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Gets the details of a logical network.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class GetAzSiteRecoveryReplicationLogicalNetwork_Get : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// Server Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Server Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Server Id.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// Backing field for property. + private string _logicalNetworkName; + + /// Logical network name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Logical network name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Logical network name.", + SerializedName = @"logicalNetworkName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string LogicalNetworkName { get => this._logicalNetworkName; set => this._logicalNetworkName = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetwork + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzSiteRecoveryReplicationLogicalNetwork_Get() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationLogicalNetworksGet(ResourceName, ResourceGroupName, SubscriptionId, FabricName, LogicalNetworkName, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName,LogicalNetworkName=LogicalNetworkName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetwork + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetwork + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationLogicalNetwork_GetViaIdentity.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationLogicalNetwork_GetViaIdentity.cs new file mode 100644 index 000000000000..9f73e139193f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationLogicalNetwork_GetViaIdentity.cs @@ -0,0 +1,336 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Gets the details of a logical network. + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationLogicalNetworks/{logicalNetworkName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSiteRecoveryReplicationLogicalNetwork_GetViaIdentity")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetwork))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Gets the details of a logical network.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class GetAzSiteRecoveryReplicationLogicalNetwork_GetViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetwork + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzSiteRecoveryReplicationLogicalNetwork_GetViaIdentity() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationLogicalNetworksGetViaIdentity(InputObject.Id, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.FabricName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.FabricName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.LogicalNetworkName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.LogicalNetworkName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationLogicalNetworksGet(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.FabricName ?? null, InputObject.LogicalNetworkName ?? null, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetwork + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetwork + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationLogicalNetwork_List.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationLogicalNetwork_List.cs new file mode 100644 index 000000000000..de5e02f5cba7 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationLogicalNetwork_List.cs @@ -0,0 +1,385 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Lists all the logical networks of the Azure Site Recovery fabric. + /// + /// [OpenAPI] ListByReplicationFabrics=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationLogicalNetworks" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSiteRecoveryReplicationLogicalNetwork_List")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetwork))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Lists all the logical networks of the Azure Site Recovery fabric.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class GetAzSiteRecoveryReplicationLogicalNetwork_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// Server Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Server Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Server Id.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetworkCollection + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzSiteRecoveryReplicationLogicalNetwork_List() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationLogicalNetworksListByReplicationFabrics(ResourceName, ResourceGroupName, SubscriptionId, FabricName, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ILogicalNetworkCollection + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + var result = await response; + WriteObject(result.Value,true); + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (_nextLink != null) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationLogicalNetworksListByReplicationFabrics_Call(requestMessage, onOk, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationMigrationItem_Get.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationMigrationItem_Get.cs new file mode 100644 index 000000000000..f673ce5e48dd --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationMigrationItem_Get.cs @@ -0,0 +1,391 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Gets the details of a migration item. + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSiteRecoveryReplicationMigrationItem_Get")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Gets the details of a migration item.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class GetAzSiteRecoveryReplicationMigrationItem_Get : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// Fabric unique name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Fabric unique name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Fabric unique name.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _migrationItemName; + + /// Migration item name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Migration item name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Migration item name.", + SerializedName = @"migrationItemName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string MigrationItemName { get => this._migrationItemName; set => this._migrationItemName = value; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _protectionContainerName; + + /// Protection container name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Protection container name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Protection container name.", + SerializedName = @"protectionContainerName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ProtectionContainerName { get => this._protectionContainerName; set => this._protectionContainerName = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzSiteRecoveryReplicationMigrationItem_Get() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationMigrationItemsGet(ResourceName, ResourceGroupName, SubscriptionId, FabricName, ProtectionContainerName, MigrationItemName, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName,ProtectionContainerName=ProtectionContainerName,MigrationItemName=MigrationItemName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationMigrationItem_GetViaIdentity.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationMigrationItem_GetViaIdentity.cs new file mode 100644 index 000000000000..de890e520fd4 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationMigrationItem_GetViaIdentity.cs @@ -0,0 +1,340 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Gets the details of a migration item. + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSiteRecoveryReplicationMigrationItem_GetViaIdentity")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Gets the details of a migration item.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class GetAzSiteRecoveryReplicationMigrationItem_GetViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzSiteRecoveryReplicationMigrationItem_GetViaIdentity() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationMigrationItemsGetViaIdentity(InputObject.Id, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.FabricName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.FabricName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ProtectionContainerName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ProtectionContainerName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.MigrationItemName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.MigrationItemName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationMigrationItemsGet(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.FabricName ?? null, InputObject.ProtectionContainerName ?? null, InputObject.MigrationItemName ?? null, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationMigrationItem_List.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationMigrationItem_List.cs new file mode 100644 index 000000000000..c04e87f5f99c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationMigrationItem_List.cs @@ -0,0 +1,441 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Gets the list of ASR migration items in the protection container. + /// + /// [OpenAPI] ListByReplicationProtectionContainers=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSiteRecoveryReplicationMigrationItem_List")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Gets the list of ASR migration items in the protection container.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class GetAzSiteRecoveryReplicationMigrationItem_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// Fabric name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Fabric name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Fabric name.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// Backing field for property. + private string _filter; + + /// OData filter options. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "OData filter options.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"OData filter options.", + SerializedName = @"$filter", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Query)] + public string Filter { get => this._filter; set => this._filter = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _protectionContainerName; + + /// Protection container name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Protection container name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Protection container name.", + SerializedName = @"protectionContainerName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ProtectionContainerName { get => this._protectionContainerName; set => this._protectionContainerName = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _skipToken; + + /// The pagination token. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The pagination token.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The pagination token.", + SerializedName = @"skipToken", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Query)] + public string SkipToken { get => this._skipToken; set => this._skipToken = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Backing field for property. + private string _takeToken; + + /// The page size. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The page size.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The page size.", + SerializedName = @"takeToken", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Query)] + public string TakeToken { get => this._takeToken; set => this._takeToken = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemCollection + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzSiteRecoveryReplicationMigrationItem_List() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationMigrationItemsListByReplicationProtectionContainers(ResourceName, ResourceGroupName, SubscriptionId, FabricName, ProtectionContainerName, this.InvocationInformation.BoundParameters.ContainsKey("SkipToken") ? SkipToken : null, this.InvocationInformation.BoundParameters.ContainsKey("TakeToken") ? TakeToken : null, this.InvocationInformation.BoundParameters.ContainsKey("Filter") ? Filter : null, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName,ProtectionContainerName=ProtectionContainerName,SkipToken=this.InvocationInformation.BoundParameters.ContainsKey("SkipToken") ? SkipToken : null,TakeToken=this.InvocationInformation.BoundParameters.ContainsKey("TakeToken") ? TakeToken : null,Filter=this.InvocationInformation.BoundParameters.ContainsKey("Filter") ? Filter : null}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemCollection + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + var result = await response; + WriteObject(result.Value,true); + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (_nextLink != null) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationMigrationItemsListByReplicationProtectionContainers_Call(requestMessage, onOk, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationMigrationItem_List1.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationMigrationItem_List1.cs new file mode 100644 index 000000000000..ed42572976b6 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationMigrationItem_List1.cs @@ -0,0 +1,413 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Gets the list of migration items in the vault. + /// + /// [OpenAPI] List=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationMigrationItems" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSiteRecoveryReplicationMigrationItem_List1")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Gets the list of migration items in the vault.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class GetAzSiteRecoveryReplicationMigrationItem_List1 : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _filter; + + /// OData filter options. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "OData filter options.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"OData filter options.", + SerializedName = @"$filter", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Query)] + public string Filter { get => this._filter; set => this._filter = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _skipToken; + + /// The pagination token. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The pagination token.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The pagination token.", + SerializedName = @"skipToken", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Query)] + public string SkipToken { get => this._skipToken; set => this._skipToken = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Backing field for property. + private string _takeToken; + + /// The page size. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The page size.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The page size.", + SerializedName = @"takeToken", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Query)] + public string TakeToken { get => this._takeToken; set => this._takeToken = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemCollection + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzSiteRecoveryReplicationMigrationItem_List1() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationMigrationItemsList(ResourceName, ResourceGroupName, SubscriptionId, this.InvocationInformation.BoundParameters.ContainsKey("SkipToken") ? SkipToken : null, this.InvocationInformation.BoundParameters.ContainsKey("TakeToken") ? TakeToken : null, this.InvocationInformation.BoundParameters.ContainsKey("Filter") ? Filter : null, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,SkipToken=this.InvocationInformation.BoundParameters.ContainsKey("SkipToken") ? SkipToken : null,TakeToken=this.InvocationInformation.BoundParameters.ContainsKey("TakeToken") ? TakeToken : null,Filter=this.InvocationInformation.BoundParameters.ContainsKey("Filter") ? Filter : null}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItemCollection + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + var result = await response; + WriteObject(result.Value,true); + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (_nextLink != null) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationMigrationItemsList_Call(requestMessage, onOk, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationNetworkMapping_Get.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationNetworkMapping_Get.cs new file mode 100644 index 000000000000..1b70ed16ce25 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationNetworkMapping_Get.cs @@ -0,0 +1,391 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Gets the details of an ASR network mapping. + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}/replicationNetworkMappings/{networkMappingName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSiteRecoveryReplicationNetworkMapping_Get")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMapping))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Gets the details of an ASR network mapping.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class GetAzSiteRecoveryReplicationNetworkMapping_Get : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// Primary fabric name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Primary fabric name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Primary fabric name.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _networkMappingName; + + /// Network mapping name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Network mapping name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Network mapping name.", + SerializedName = @"networkMappingName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string NetworkMappingName { get => this._networkMappingName; set => this._networkMappingName = value; } + + /// Backing field for property. + private string _networkName; + + /// Primary network name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Primary network name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Primary network name.", + SerializedName = @"networkName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string NetworkName { get => this._networkName; set => this._networkName = value; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMapping + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzSiteRecoveryReplicationNetworkMapping_Get() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationNetworkMappingsGet(ResourceName, ResourceGroupName, SubscriptionId, FabricName, NetworkName, NetworkMappingName, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName,NetworkName=NetworkName,NetworkMappingName=NetworkMappingName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMapping + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMapping + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationNetworkMapping_GetViaIdentity.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationNetworkMapping_GetViaIdentity.cs new file mode 100644 index 000000000000..8cdec1abaabe --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationNetworkMapping_GetViaIdentity.cs @@ -0,0 +1,340 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Gets the details of an ASR network mapping. + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}/replicationNetworkMappings/{networkMappingName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSiteRecoveryReplicationNetworkMapping_GetViaIdentity")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMapping))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Gets the details of an ASR network mapping.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class GetAzSiteRecoveryReplicationNetworkMapping_GetViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMapping + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzSiteRecoveryReplicationNetworkMapping_GetViaIdentity() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationNetworkMappingsGetViaIdentity(InputObject.Id, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.FabricName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.FabricName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.NetworkName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.NetworkName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.NetworkMappingName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.NetworkMappingName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationNetworkMappingsGet(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.FabricName ?? null, InputObject.NetworkName ?? null, InputObject.NetworkMappingName ?? null, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMapping + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMapping + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationNetworkMapping_List.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationNetworkMapping_List.cs new file mode 100644 index 000000000000..a8b2bee4d286 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationNetworkMapping_List.cs @@ -0,0 +1,399 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Lists all ASR network mappings for the specified network. + /// + /// [OpenAPI] ListByReplicationNetworks=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}/replicationNetworkMappings" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSiteRecoveryReplicationNetworkMapping_List")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMapping))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Lists all ASR network mappings for the specified network.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class GetAzSiteRecoveryReplicationNetworkMapping_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// Primary fabric name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Primary fabric name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Primary fabric name.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _networkName; + + /// Primary network name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Primary network name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Primary network name.", + SerializedName = @"networkName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string NetworkName { get => this._networkName; set => this._networkName = value; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingCollection + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzSiteRecoveryReplicationNetworkMapping_List() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationNetworkMappingsListByReplicationNetworks(ResourceName, ResourceGroupName, SubscriptionId, FabricName, NetworkName, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName,NetworkName=NetworkName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingCollection + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + var result = await response; + WriteObject(result.Value,true); + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (_nextLink != null) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationNetworkMappingsListByReplicationNetworks_Call(requestMessage, onOk, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationNetworkMapping_List1.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationNetworkMapping_List1.cs new file mode 100644 index 000000000000..f6072b2fe1a1 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationNetworkMapping_List1.cs @@ -0,0 +1,371 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Lists all ASR network mappings in the vault. + /// + /// [OpenAPI] List=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationNetworkMappings" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSiteRecoveryReplicationNetworkMapping_List1")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMapping))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Lists all ASR network mappings in the vault.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class GetAzSiteRecoveryReplicationNetworkMapping_List1 : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingCollection + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzSiteRecoveryReplicationNetworkMapping_List1() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationNetworkMappingsList(ResourceName, ResourceGroupName, SubscriptionId, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMappingCollection + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + var result = await response; + WriteObject(result.Value,true); + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (_nextLink != null) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationNetworkMappingsList_Call(requestMessage, onOk, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationNetwork_Get.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationNetwork_Get.cs new file mode 100644 index 000000000000..f94702aa70c4 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationNetwork_Get.cs @@ -0,0 +1,377 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Gets the details of a network. + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSiteRecoveryReplicationNetwork_Get")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetwork))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Gets the details of a network.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class GetAzSiteRecoveryReplicationNetwork_Get : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// Server Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Server Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Server Id.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _networkName; + + /// Primary network name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Primary network name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Primary network name.", + SerializedName = @"networkName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string NetworkName { get => this._networkName; set => this._networkName = value; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetwork + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzSiteRecoveryReplicationNetwork_Get() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationNetworksGet(ResourceName, ResourceGroupName, SubscriptionId, FabricName, NetworkName, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName,NetworkName=NetworkName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetwork + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetwork + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationNetwork_GetViaIdentity.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationNetwork_GetViaIdentity.cs new file mode 100644 index 000000000000..321224d8ffa9 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationNetwork_GetViaIdentity.cs @@ -0,0 +1,336 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Gets the details of a network. + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSiteRecoveryReplicationNetwork_GetViaIdentity")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetwork))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Gets the details of a network.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class GetAzSiteRecoveryReplicationNetwork_GetViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetwork + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzSiteRecoveryReplicationNetwork_GetViaIdentity() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationNetworksGetViaIdentity(InputObject.Id, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.FabricName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.FabricName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.NetworkName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.NetworkName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationNetworksGet(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.FabricName ?? null, InputObject.NetworkName ?? null, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetwork + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetwork + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationNetwork_List.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationNetwork_List.cs new file mode 100644 index 000000000000..28dab5e5208a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationNetwork_List.cs @@ -0,0 +1,385 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Lists the networks available for a fabric. + /// + /// [OpenAPI] ListByReplicationFabrics=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSiteRecoveryReplicationNetwork_List")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetwork))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Lists the networks available for a fabric.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class GetAzSiteRecoveryReplicationNetwork_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// Fabric name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Fabric name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Fabric name.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkCollection + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzSiteRecoveryReplicationNetwork_List() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationNetworksListByReplicationFabrics(ResourceName, ResourceGroupName, SubscriptionId, FabricName, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkCollection + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + var result = await response; + WriteObject(result.Value,true); + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (_nextLink != null) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationNetworksListByReplicationFabrics_Call(requestMessage, onOk, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationNetwork_List1.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationNetwork_List1.cs new file mode 100644 index 000000000000..a61cbd5946dc --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationNetwork_List1.cs @@ -0,0 +1,371 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Lists the networks available in a vault. + /// + /// [OpenAPI] List=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationNetworks" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSiteRecoveryReplicationNetwork_List1")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetwork))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Lists the networks available in a vault.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class GetAzSiteRecoveryReplicationNetwork_List1 : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkCollection + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzSiteRecoveryReplicationNetwork_List1() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationNetworksList(ResourceName, ResourceGroupName, SubscriptionId, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkCollection + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + var result = await response; + WriteObject(result.Value,true); + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (_nextLink != null) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationNetworksList_Call(requestMessage, onOk, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationPolicy_Get.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationPolicy_Get.cs new file mode 100644 index 000000000000..8bec14b01de0 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationPolicy_Get.cs @@ -0,0 +1,363 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Gets the details of a replication policy. + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationPolicies/{policyName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSiteRecoveryReplicationPolicy_Get")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicy))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Gets the details of a replication policy.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class GetAzSiteRecoveryReplicationPolicy_Get : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _policyName; + + /// Replication policy name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Replication policy name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Replication policy name.", + SerializedName = @"policyName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string PolicyName { get => this._policyName; set => this._policyName = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicy + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzSiteRecoveryReplicationPolicy_Get() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationPoliciesGet(ResourceName, ResourceGroupName, SubscriptionId, PolicyName, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,PolicyName=PolicyName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicy + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicy + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationPolicy_GetViaIdentity.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationPolicy_GetViaIdentity.cs new file mode 100644 index 000000000000..e9c2ef016d98 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationPolicy_GetViaIdentity.cs @@ -0,0 +1,332 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Gets the details of a replication policy. + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationPolicies/{policyName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSiteRecoveryReplicationPolicy_GetViaIdentity")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicy))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Gets the details of a replication policy.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class GetAzSiteRecoveryReplicationPolicy_GetViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicy + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzSiteRecoveryReplicationPolicy_GetViaIdentity() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationPoliciesGetViaIdentity(InputObject.Id, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.PolicyName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.PolicyName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationPoliciesGet(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.PolicyName ?? null, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicy + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicy + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationPolicy_List.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationPolicy_List.cs new file mode 100644 index 000000000000..2802a6aefab7 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationPolicy_List.cs @@ -0,0 +1,371 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Lists the replication policies for a vault. + /// + /// [OpenAPI] List=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationPolicies" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSiteRecoveryReplicationPolicy_List")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicy))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Lists the replication policies for a vault.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class GetAzSiteRecoveryReplicationPolicy_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyCollection + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzSiteRecoveryReplicationPolicy_List() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationPoliciesList(ResourceName, ResourceGroupName, SubscriptionId, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicyCollection + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + var result = await response; + WriteObject(result.Value,true); + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (_nextLink != null) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationPoliciesList_Call(requestMessage, onOk, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationProtectableItem_Get.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationProtectableItem_Get.cs new file mode 100644 index 000000000000..df8017e31b29 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationProtectableItem_Get.cs @@ -0,0 +1,391 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to get the details of a protectable item. + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectableItems/{protectableItemName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSiteRecoveryReplicationProtectableItem_Get")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItem))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to get the details of a protectable item.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class GetAzSiteRecoveryReplicationProtectableItem_Get : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// Fabric name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Fabric name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Fabric name.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _protectableItemName; + + /// Protectable item name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Protectable item name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Protectable item name.", + SerializedName = @"protectableItemName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ProtectableItemName { get => this._protectableItemName; set => this._protectableItemName = value; } + + /// Backing field for property. + private string _protectionContainerName; + + /// Protection container name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Protection container name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Protection container name.", + SerializedName = @"protectionContainerName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ProtectionContainerName { get => this._protectionContainerName; set => this._protectionContainerName = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItem + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzSiteRecoveryReplicationProtectableItem_Get() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationProtectableItemsGet(ResourceName, ResourceGroupName, SubscriptionId, FabricName, ProtectionContainerName, ProtectableItemName, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName,ProtectionContainerName=ProtectionContainerName,ProtectableItemName=ProtectableItemName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItem + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItem + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationProtectableItem_GetViaIdentity.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationProtectableItem_GetViaIdentity.cs new file mode 100644 index 000000000000..35a36c738842 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationProtectableItem_GetViaIdentity.cs @@ -0,0 +1,340 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to get the details of a protectable item. + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectableItems/{protectableItemName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSiteRecoveryReplicationProtectableItem_GetViaIdentity")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItem))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to get the details of a protectable item.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class GetAzSiteRecoveryReplicationProtectableItem_GetViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItem + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzSiteRecoveryReplicationProtectableItem_GetViaIdentity() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationProtectableItemsGetViaIdentity(InputObject.Id, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.FabricName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.FabricName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ProtectionContainerName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ProtectionContainerName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ProtectableItemName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ProtectableItemName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationProtectableItemsGet(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.FabricName ?? null, InputObject.ProtectionContainerName ?? null, InputObject.ProtectableItemName ?? null, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItem + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItem + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationProtectableItem_List.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationProtectableItem_List.cs new file mode 100644 index 000000000000..353c1c65ab41 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationProtectableItem_List.cs @@ -0,0 +1,441 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Lists the protectable items in a protection container. + /// + /// [OpenAPI] ListByReplicationProtectionContainers=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectableItems" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSiteRecoveryReplicationProtectableItem_List")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItem))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Lists the protectable items in a protection container.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class GetAzSiteRecoveryReplicationProtectableItem_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// Fabric name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Fabric name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Fabric name.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// Backing field for property. + private string _filter; + + /// OData filter options. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "OData filter options.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"OData filter options.", + SerializedName = @"$filter", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Query)] + public string Filter { get => this._filter; set => this._filter = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _protectionContainerName; + + /// Protection container name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Protection container name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Protection container name.", + SerializedName = @"protectionContainerName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ProtectionContainerName { get => this._protectionContainerName; set => this._protectionContainerName = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _skipToken; + + /// skipToken OData query parameter. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "skipToken OData query parameter.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"skipToken OData query parameter.", + SerializedName = @"$skipToken", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Query)] + public string SkipToken { get => this._skipToken; set => this._skipToken = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Backing field for property. + private string _take; + + /// take OData query parameter. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "take OData query parameter.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"take OData query parameter.", + SerializedName = @"$take", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Query)] + public string Take { get => this._take; set => this._take = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemCollection + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzSiteRecoveryReplicationProtectableItem_List() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationProtectableItemsListByReplicationProtectionContainers(ResourceName, ResourceGroupName, SubscriptionId, FabricName, ProtectionContainerName, this.InvocationInformation.BoundParameters.ContainsKey("Filter") ? Filter : null, this.InvocationInformation.BoundParameters.ContainsKey("Take") ? Take : null, this.InvocationInformation.BoundParameters.ContainsKey("SkipToken") ? SkipToken : null, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName,ProtectionContainerName=ProtectionContainerName,Filter=this.InvocationInformation.BoundParameters.ContainsKey("Filter") ? Filter : null,Take=this.InvocationInformation.BoundParameters.ContainsKey("Take") ? Take : null,SkipToken=this.InvocationInformation.BoundParameters.ContainsKey("SkipToken") ? SkipToken : null}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectableItemCollection + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + var result = await response; + WriteObject(result.Value,true); + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (_nextLink != null) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationProtectableItemsListByReplicationProtectionContainers_Call(requestMessage, onOk, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationProtectedItem_Get.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationProtectedItem_Get.cs new file mode 100644 index 000000000000..611bfb4c040f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationProtectedItem_Get.cs @@ -0,0 +1,391 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Gets the details of an ASR replication protected item. + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSiteRecoveryReplicationProtectedItem_Get")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Gets the details of an ASR replication protected item.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class GetAzSiteRecoveryReplicationProtectedItem_Get : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// Fabric unique name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Fabric unique name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Fabric unique name.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _protectionContainerName; + + /// Protection container name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Protection container name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Protection container name.", + SerializedName = @"protectionContainerName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ProtectionContainerName { get => this._protectionContainerName; set => this._protectionContainerName = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _replicatedProtectedItemName; + + /// Replication protected item name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Replication protected item name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Replication protected item name.", + SerializedName = @"replicatedProtectedItemName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ReplicatedProtectedItemName { get => this._replicatedProtectedItemName; set => this._replicatedProtectedItemName = value; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzSiteRecoveryReplicationProtectedItem_Get() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationProtectedItemsGet(ResourceName, ResourceGroupName, SubscriptionId, FabricName, ProtectionContainerName, ReplicatedProtectedItemName, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName,ProtectionContainerName=ProtectionContainerName,ReplicatedProtectedItemName=ReplicatedProtectedItemName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationProtectedItem_GetViaIdentity.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationProtectedItem_GetViaIdentity.cs new file mode 100644 index 000000000000..9dcc705a97db --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationProtectedItem_GetViaIdentity.cs @@ -0,0 +1,340 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Gets the details of an ASR replication protected item. + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSiteRecoveryReplicationProtectedItem_GetViaIdentity")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Gets the details of an ASR replication protected item.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class GetAzSiteRecoveryReplicationProtectedItem_GetViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzSiteRecoveryReplicationProtectedItem_GetViaIdentity() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationProtectedItemsGetViaIdentity(InputObject.Id, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.FabricName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.FabricName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ProtectionContainerName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ProtectionContainerName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ReplicatedProtectedItemName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ReplicatedProtectedItemName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationProtectedItemsGet(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.FabricName ?? null, InputObject.ProtectionContainerName ?? null, InputObject.ReplicatedProtectedItemName ?? null, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationProtectedItem_List.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationProtectedItem_List.cs new file mode 100644 index 000000000000..e014e22c3f0d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationProtectedItem_List.cs @@ -0,0 +1,399 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Gets the list of ASR replication protected items in the protection container. + /// + /// [OpenAPI] ListByReplicationProtectionContainers=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSiteRecoveryReplicationProtectedItem_List")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Gets the list of ASR replication protected items in the protection container.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class GetAzSiteRecoveryReplicationProtectedItem_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// Fabric name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Fabric name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Fabric name.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _protectionContainerName; + + /// Protection container name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Protection container name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Protection container name.", + SerializedName = @"protectionContainerName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ProtectionContainerName { get => this._protectionContainerName; set => this._protectionContainerName = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemCollection + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzSiteRecoveryReplicationProtectedItem_List() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationProtectedItemsListByReplicationProtectionContainers(ResourceName, ResourceGroupName, SubscriptionId, FabricName, ProtectionContainerName, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName,ProtectionContainerName=ProtectionContainerName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemCollection + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + var result = await response; + WriteObject(result.Value,true); + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (_nextLink != null) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationProtectedItemsListByReplicationProtectionContainers_Call(requestMessage, onOk, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationProtectedItem_List1.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationProtectedItem_List1.cs new file mode 100644 index 000000000000..3c3a2d57f228 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationProtectedItem_List1.cs @@ -0,0 +1,401 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Gets the list of ASR replication protected items in the vault. + /// + /// [OpenAPI] List=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationProtectedItems" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSiteRecoveryReplicationProtectedItem_List1")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Gets the list of ASR replication protected items in the vault.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class GetAzSiteRecoveryReplicationProtectedItem_List1 : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _filter; + + /// OData filter options. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "OData filter options.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"OData filter options.", + SerializedName = @"$filter", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Query)] + public string Filter { get => this._filter; set => this._filter = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _skipToken; + + /// + /// The pagination token. Possible values: "FabricId" or "FabricId_CloudId" or null. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The pagination token. Possible values: \"FabricId\" or \"FabricId_CloudId\" or null.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The pagination token. Possible values: ""FabricId"" or ""FabricId_CloudId"" or null.", + SerializedName = @"skipToken", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Query)] + public string SkipToken { get => this._skipToken; set => this._skipToken = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemCollection + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzSiteRecoveryReplicationProtectedItem_List1() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationProtectedItemsList(ResourceName, ResourceGroupName, SubscriptionId, this.InvocationInformation.BoundParameters.ContainsKey("SkipToken") ? SkipToken : null, this.InvocationInformation.BoundParameters.ContainsKey("Filter") ? Filter : null, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,SkipToken=this.InvocationInformation.BoundParameters.ContainsKey("SkipToken") ? SkipToken : null,Filter=this.InvocationInformation.BoundParameters.ContainsKey("Filter") ? Filter : null}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItemCollection + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + var result = await response; + WriteObject(result.Value,true); + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (_nextLink != null) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationProtectedItemsList_Call(requestMessage, onOk, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationProtectionContainerMapping_Get.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationProtectionContainerMapping_Get.cs new file mode 100644 index 000000000000..3c7e9878bebb --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationProtectionContainerMapping_Get.cs @@ -0,0 +1,391 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Gets the details of a protection container mapping. + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings/{mappingName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSiteRecoveryReplicationProtectionContainerMapping_Get")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMapping))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Gets the details of a protection container mapping.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class GetAzSiteRecoveryReplicationProtectionContainerMapping_Get : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// Fabric name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Fabric name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Fabric name.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// Backing field for property. + private string _mappingName; + + /// Protection Container mapping name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Protection Container mapping name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Protection Container mapping name.", + SerializedName = @"mappingName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string MappingName { get => this._mappingName; set => this._mappingName = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _protectionContainerName; + + /// Protection container name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Protection container name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Protection container name.", + SerializedName = @"protectionContainerName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ProtectionContainerName { get => this._protectionContainerName; set => this._protectionContainerName = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMapping + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzSiteRecoveryReplicationProtectionContainerMapping_Get() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationProtectionContainerMappingsGet(ResourceName, ResourceGroupName, SubscriptionId, FabricName, ProtectionContainerName, MappingName, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName,ProtectionContainerName=ProtectionContainerName,MappingName=MappingName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMapping + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMapping + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationProtectionContainerMapping_GetViaIdentity.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationProtectionContainerMapping_GetViaIdentity.cs new file mode 100644 index 000000000000..82073c9cdfa8 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationProtectionContainerMapping_GetViaIdentity.cs @@ -0,0 +1,341 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Gets the details of a protection container mapping. + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings/{mappingName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSiteRecoveryReplicationProtectionContainerMapping_GetViaIdentity")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMapping))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Gets the details of a protection container mapping.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class GetAzSiteRecoveryReplicationProtectionContainerMapping_GetViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMapping + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the + /// cmdlet class. + /// + public GetAzSiteRecoveryReplicationProtectionContainerMapping_GetViaIdentity() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationProtectionContainerMappingsGetViaIdentity(InputObject.Id, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.FabricName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.FabricName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ProtectionContainerName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ProtectionContainerName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.MappingName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.MappingName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationProtectionContainerMappingsGet(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.FabricName ?? null, InputObject.ProtectionContainerName ?? null, InputObject.MappingName ?? null, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMapping + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMapping + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationProtectionContainerMapping_List.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationProtectionContainerMapping_List.cs new file mode 100644 index 000000000000..789767080bc3 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationProtectionContainerMapping_List.cs @@ -0,0 +1,399 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Lists the protection container mappings for a protection container. + /// + /// [OpenAPI] ListByReplicationProtectionContainers=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSiteRecoveryReplicationProtectionContainerMapping_List")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMapping))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Lists the protection container mappings for a protection container.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class GetAzSiteRecoveryReplicationProtectionContainerMapping_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// Fabric name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Fabric name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Fabric name.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _protectionContainerName; + + /// Protection container name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Protection container name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Protection container name.", + SerializedName = @"protectionContainerName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ProtectionContainerName { get => this._protectionContainerName; set => this._protectionContainerName = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingCollection + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzSiteRecoveryReplicationProtectionContainerMapping_List() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationProtectionContainerMappingsListByReplicationProtectionContainers(ResourceName, ResourceGroupName, SubscriptionId, FabricName, ProtectionContainerName, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName,ProtectionContainerName=ProtectionContainerName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingCollection + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + var result = await response; + WriteObject(result.Value,true); + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (_nextLink != null) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationProtectionContainerMappingsListByReplicationProtectionContainers_Call(requestMessage, onOk, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationProtectionContainerMapping_List1.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationProtectionContainerMapping_List1.cs new file mode 100644 index 000000000000..04f3ccbb7e8d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationProtectionContainerMapping_List1.cs @@ -0,0 +1,371 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Lists the protection container mappings in the vault. + /// + /// [OpenAPI] List=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationProtectionContainerMappings" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSiteRecoveryReplicationProtectionContainerMapping_List1")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMapping))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Lists the protection container mappings in the vault.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class GetAzSiteRecoveryReplicationProtectionContainerMapping_List1 : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingCollection + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzSiteRecoveryReplicationProtectionContainerMapping_List1() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationProtectionContainerMappingsList(ResourceName, ResourceGroupName, SubscriptionId, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMappingCollection + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + var result = await response; + WriteObject(result.Value,true); + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (_nextLink != null) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationProtectionContainerMappingsList_Call(requestMessage, onOk, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationProtectionContainer_Get.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationProtectionContainer_Get.cs new file mode 100644 index 000000000000..b25dfa1231d2 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationProtectionContainer_Get.cs @@ -0,0 +1,377 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Gets the details of a protection container. + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSiteRecoveryReplicationProtectionContainer_Get")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainer))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Gets the details of a protection container.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class GetAzSiteRecoveryReplicationProtectionContainer_Get : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// Fabric name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Fabric name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Fabric name.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _protectionContainerName; + + /// Protection container name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Protection container name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Protection container name.", + SerializedName = @"protectionContainerName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ProtectionContainerName { get => this._protectionContainerName; set => this._protectionContainerName = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainer + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzSiteRecoveryReplicationProtectionContainer_Get() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationProtectionContainersGet(ResourceName, ResourceGroupName, SubscriptionId, FabricName, ProtectionContainerName, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName,ProtectionContainerName=ProtectionContainerName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainer + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainer + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationProtectionContainer_GetViaIdentity.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationProtectionContainer_GetViaIdentity.cs new file mode 100644 index 000000000000..d2fe4296d6ea --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationProtectionContainer_GetViaIdentity.cs @@ -0,0 +1,337 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Gets the details of a protection container. + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSiteRecoveryReplicationProtectionContainer_GetViaIdentity")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainer))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Gets the details of a protection container.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class GetAzSiteRecoveryReplicationProtectionContainer_GetViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainer + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet + /// class. + /// + public GetAzSiteRecoveryReplicationProtectionContainer_GetViaIdentity() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationProtectionContainersGetViaIdentity(InputObject.Id, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.FabricName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.FabricName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ProtectionContainerName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ProtectionContainerName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationProtectionContainersGet(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.FabricName ?? null, InputObject.ProtectionContainerName ?? null, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainer + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainer + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationProtectionContainer_List.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationProtectionContainer_List.cs new file mode 100644 index 000000000000..047bfdb4d443 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationProtectionContainer_List.cs @@ -0,0 +1,385 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Lists the protection containers in the specified fabric. + /// + /// [OpenAPI] ListByReplicationFabrics=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSiteRecoveryReplicationProtectionContainer_List")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainer))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Lists the protection containers in the specified fabric.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class GetAzSiteRecoveryReplicationProtectionContainer_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// Fabric name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Fabric name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Fabric name.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerCollection + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzSiteRecoveryReplicationProtectionContainer_List() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationProtectionContainersListByReplicationFabrics(ResourceName, ResourceGroupName, SubscriptionId, FabricName, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerCollection + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + var result = await response; + WriteObject(result.Value,true); + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (_nextLink != null) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationProtectionContainersListByReplicationFabrics_Call(requestMessage, onOk, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationProtectionContainer_List1.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationProtectionContainer_List1.cs new file mode 100644 index 000000000000..3b7655ac2684 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationProtectionContainer_List1.cs @@ -0,0 +1,371 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Lists the protection containers in a vault. + /// + /// [OpenAPI] List=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationProtectionContainers" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSiteRecoveryReplicationProtectionContainer_List1")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainer))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Lists the protection containers in a vault.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class GetAzSiteRecoveryReplicationProtectionContainer_List1 : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerCollection + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzSiteRecoveryReplicationProtectionContainer_List1() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationProtectionContainersList(ResourceName, ResourceGroupName, SubscriptionId, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerCollection + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + var result = await response; + WriteObject(result.Value,true); + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (_nextLink != null) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationProtectionContainersList_Call(requestMessage, onOk, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationProtectionIntent_Get.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationProtectionIntent_Get.cs new file mode 100644 index 000000000000..b094a1f8121d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationProtectionIntent_Get.cs @@ -0,0 +1,363 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Gets the details of an ASR replication protection intent. + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationProtectionIntents/{intentObjectName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSiteRecoveryReplicationProtectionIntent_Get")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntent))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Gets the details of an ASR replication protection intent.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class GetAzSiteRecoveryReplicationProtectionIntent_Get : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private string _intentObjectName; + + /// Replication protection intent name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Replication protection intent name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Replication protection intent name.", + SerializedName = @"intentObjectName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string IntentObjectName { get => this._intentObjectName; set => this._intentObjectName = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntent + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzSiteRecoveryReplicationProtectionIntent_Get() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationProtectionIntentsGet(ResourceName, ResourceGroupName, SubscriptionId, IntentObjectName, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,IntentObjectName=IntentObjectName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntent + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntent + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationProtectionIntent_GetViaIdentity.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationProtectionIntent_GetViaIdentity.cs new file mode 100644 index 000000000000..0abfd52aa5e9 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationProtectionIntent_GetViaIdentity.cs @@ -0,0 +1,332 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Gets the details of an ASR replication protection intent. + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationProtectionIntents/{intentObjectName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSiteRecoveryReplicationProtectionIntent_GetViaIdentity")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntent))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Gets the details of an ASR replication protection intent.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class GetAzSiteRecoveryReplicationProtectionIntent_GetViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntent + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzSiteRecoveryReplicationProtectionIntent_GetViaIdentity() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationProtectionIntentsGetViaIdentity(InputObject.Id, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.IntentObjectName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.IntentObjectName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationProtectionIntentsGet(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.IntentObjectName ?? null, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntent + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntent + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationProtectionIntent_List.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationProtectionIntent_List.cs new file mode 100644 index 000000000000..e5a6a6efb04a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationProtectionIntent_List.cs @@ -0,0 +1,399 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Gets the list of ASR replication protection intent objects in the vault. + /// + /// [OpenAPI] List=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationProtectionIntents" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSiteRecoveryReplicationProtectionIntent_List")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntent))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Gets the list of ASR replication protection intent objects in the vault.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class GetAzSiteRecoveryReplicationProtectionIntent_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _skipToken; + + /// The pagination token. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The pagination token.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The pagination token.", + SerializedName = @"skipToken", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Query)] + public string SkipToken { get => this._skipToken; set => this._skipToken = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Backing field for property. + private string _takeToken; + + /// The page size. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The page size.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The page size.", + SerializedName = @"takeToken", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Query)] + public string TakeToken { get => this._takeToken; set => this._takeToken = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentCollection + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzSiteRecoveryReplicationProtectionIntent_List() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationProtectionIntentsList(ResourceName, ResourceGroupName, SubscriptionId, this.InvocationInformation.BoundParameters.ContainsKey("SkipToken") ? SkipToken : null, this.InvocationInformation.BoundParameters.ContainsKey("TakeToken") ? TakeToken : null, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,SkipToken=this.InvocationInformation.BoundParameters.ContainsKey("SkipToken") ? SkipToken : null,TakeToken=this.InvocationInformation.BoundParameters.ContainsKey("TakeToken") ? TakeToken : null}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntentCollection + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + var result = await response; + WriteObject(result.Value,true); + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (_nextLink != null) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationProtectionIntentsList_Call(requestMessage, onOk, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationRecoveryPlan_Get.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationRecoveryPlan_Get.cs new file mode 100644 index 000000000000..720d98db0516 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationRecoveryPlan_Get.cs @@ -0,0 +1,363 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Gets the details of the recovery plan. + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSiteRecoveryReplicationRecoveryPlan_Get")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Gets the details of the recovery plan.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class GetAzSiteRecoveryReplicationRecoveryPlan_Get : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _recoveryPlanName; + + /// Name of the recovery plan. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name of the recovery plan.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name of the recovery plan.", + SerializedName = @"recoveryPlanName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string RecoveryPlanName { get => this._recoveryPlanName; set => this._recoveryPlanName = value; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzSiteRecoveryReplicationRecoveryPlan_Get() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationRecoveryPlansGet(ResourceName, ResourceGroupName, SubscriptionId, RecoveryPlanName, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,RecoveryPlanName=RecoveryPlanName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationRecoveryPlan_GetViaIdentity.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationRecoveryPlan_GetViaIdentity.cs new file mode 100644 index 000000000000..a5f6efd4acc7 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationRecoveryPlan_GetViaIdentity.cs @@ -0,0 +1,332 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Gets the details of the recovery plan. + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSiteRecoveryReplicationRecoveryPlan_GetViaIdentity")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Gets the details of the recovery plan.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class GetAzSiteRecoveryReplicationRecoveryPlan_GetViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzSiteRecoveryReplicationRecoveryPlan_GetViaIdentity() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationRecoveryPlansGetViaIdentity(InputObject.Id, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.RecoveryPlanName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.RecoveryPlanName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationRecoveryPlansGet(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.RecoveryPlanName ?? null, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationRecoveryPlan_List.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationRecoveryPlan_List.cs new file mode 100644 index 000000000000..a776e80a5e93 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationRecoveryPlan_List.cs @@ -0,0 +1,371 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Lists the recovery plans in the vault. + /// + /// [OpenAPI] List=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSiteRecoveryReplicationRecoveryPlan_List")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Lists the recovery plans in the vault.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class GetAzSiteRecoveryReplicationRecoveryPlan_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanCollection + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzSiteRecoveryReplicationRecoveryPlan_List() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationRecoveryPlansList(ResourceName, ResourceGroupName, SubscriptionId, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanCollection + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + var result = await response; + WriteObject(result.Value,true); + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (_nextLink != null) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationRecoveryPlansList_Call(requestMessage, onOk, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationRecoveryServiceProvider_List.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationRecoveryServiceProvider_List.cs new file mode 100644 index 000000000000..6b191d11d99c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationRecoveryServiceProvider_List.cs @@ -0,0 +1,385 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Lists the registered recovery services providers for the specified fabric. + /// + /// [OpenAPI] ListByReplicationFabrics=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSiteRecoveryReplicationRecoveryServiceProvider_List")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProvider))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Lists the registered recovery services providers for the specified fabric.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class GetAzSiteRecoveryReplicationRecoveryServiceProvider_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// Fabric name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Fabric name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Fabric name.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderCollection + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzSiteRecoveryReplicationRecoveryServiceProvider_List() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationRecoveryServicesProvidersListByReplicationFabrics(ResourceName, ResourceGroupName, SubscriptionId, FabricName, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderCollection + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + var result = await response; + WriteObject(result.Value,true); + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (_nextLink != null) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationRecoveryServicesProvidersListByReplicationFabrics_Call(requestMessage, onOk, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationRecoveryServicesProvider_Get.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationRecoveryServicesProvider_Get.cs new file mode 100644 index 000000000000..ffe2c047991a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationRecoveryServicesProvider_Get.cs @@ -0,0 +1,377 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Gets the details of registered recovery services provider. + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders/{providerName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSiteRecoveryReplicationRecoveryServicesProvider_Get")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProvider))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Gets the details of registered recovery services provider.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class GetAzSiteRecoveryReplicationRecoveryServicesProvider_Get : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// Fabric name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Fabric name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Fabric name.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _providerName; + + /// Recovery services provider name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Recovery services provider name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Recovery services provider name.", + SerializedName = @"providerName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ProviderName { get => this._providerName; set => this._providerName = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProvider + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzSiteRecoveryReplicationRecoveryServicesProvider_Get() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationRecoveryServicesProvidersGet(ResourceName, ResourceGroupName, SubscriptionId, FabricName, ProviderName, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName,ProviderName=ProviderName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProvider + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProvider + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationRecoveryServicesProvider_GetViaIdentity.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationRecoveryServicesProvider_GetViaIdentity.cs new file mode 100644 index 000000000000..ed89987947f8 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationRecoveryServicesProvider_GetViaIdentity.cs @@ -0,0 +1,337 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Gets the details of registered recovery services provider. + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders/{providerName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSiteRecoveryReplicationRecoveryServicesProvider_GetViaIdentity")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProvider))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Gets the details of registered recovery services provider.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class GetAzSiteRecoveryReplicationRecoveryServicesProvider_GetViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProvider + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet + /// class. + /// + public GetAzSiteRecoveryReplicationRecoveryServicesProvider_GetViaIdentity() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationRecoveryServicesProvidersGetViaIdentity(InputObject.Id, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.FabricName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.FabricName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ProviderName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ProviderName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationRecoveryServicesProvidersGet(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.FabricName ?? null, InputObject.ProviderName ?? null, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProvider + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProvider + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationRecoveryServicesProvider_List.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationRecoveryServicesProvider_List.cs new file mode 100644 index 000000000000..c0f9dbe8f031 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationRecoveryServicesProvider_List.cs @@ -0,0 +1,371 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Lists the registered recovery services providers in the vault. + /// + /// [OpenAPI] List=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryServicesProviders" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSiteRecoveryReplicationRecoveryServicesProvider_List")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProvider))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Lists the registered recovery services providers in the vault.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class GetAzSiteRecoveryReplicationRecoveryServicesProvider_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderCollection + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzSiteRecoveryReplicationRecoveryServicesProvider_List() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationRecoveryServicesProvidersList(ResourceName, ResourceGroupName, SubscriptionId, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProviderCollection + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + var result = await response; + WriteObject(result.Value,true); + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (_nextLink != null) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationRecoveryServicesProvidersList_Call(requestMessage, onOk, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationStorageClassificationMapping_Get.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationStorageClassificationMapping_Get.cs new file mode 100644 index 000000000000..a41624d78405 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationStorageClassificationMapping_Get.cs @@ -0,0 +1,391 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Gets the details of the specified storage classification mapping. + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationStorageClassifications/{storageClassificationName}/replicationStorageClassificationMappings/{storageClassificationMappingName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSiteRecoveryReplicationStorageClassificationMapping_Get")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMapping))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Gets the details of the specified storage classification mapping.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class GetAzSiteRecoveryReplicationStorageClassificationMapping_Get : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// Fabric name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Fabric name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Fabric name.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _storageClassificationMappingName; + + /// Storage classification mapping name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Storage classification mapping name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Storage classification mapping name.", + SerializedName = @"storageClassificationMappingName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string StorageClassificationMappingName { get => this._storageClassificationMappingName; set => this._storageClassificationMappingName = value; } + + /// Backing field for property. + private string _storageClassificationName; + + /// Storage classification name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Storage classification name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Storage classification name.", + SerializedName = @"storageClassificationName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string StorageClassificationName { get => this._storageClassificationName; set => this._storageClassificationName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMapping + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzSiteRecoveryReplicationStorageClassificationMapping_Get() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationStorageClassificationMappingsGet(ResourceName, ResourceGroupName, SubscriptionId, FabricName, StorageClassificationName, StorageClassificationMappingName, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName,StorageClassificationName=StorageClassificationName,StorageClassificationMappingName=StorageClassificationMappingName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMapping + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMapping + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationStorageClassificationMapping_GetViaIdentity.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationStorageClassificationMapping_GetViaIdentity.cs new file mode 100644 index 000000000000..cf5a700bc2ad --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationStorageClassificationMapping_GetViaIdentity.cs @@ -0,0 +1,341 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Gets the details of the specified storage classification mapping. + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationStorageClassifications/{storageClassificationName}/replicationStorageClassificationMappings/{storageClassificationMappingName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSiteRecoveryReplicationStorageClassificationMapping_GetViaIdentity")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMapping))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Gets the details of the specified storage classification mapping.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class GetAzSiteRecoveryReplicationStorageClassificationMapping_GetViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMapping + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the + /// cmdlet class. + /// + public GetAzSiteRecoveryReplicationStorageClassificationMapping_GetViaIdentity() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationStorageClassificationMappingsGetViaIdentity(InputObject.Id, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.FabricName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.FabricName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.StorageClassificationName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.StorageClassificationName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.StorageClassificationMappingName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.StorageClassificationMappingName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationStorageClassificationMappingsGet(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.FabricName ?? null, InputObject.StorageClassificationName ?? null, InputObject.StorageClassificationMappingName ?? null, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMapping + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMapping + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationStorageClassificationMapping_List.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationStorageClassificationMapping_List.cs new file mode 100644 index 000000000000..b3566a9a9210 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationStorageClassificationMapping_List.cs @@ -0,0 +1,399 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Lists the storage classification mappings for the fabric. + /// + /// [OpenAPI] ListByReplicationStorageClassifications=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationStorageClassifications/{storageClassificationName}/replicationStorageClassificationMappings" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSiteRecoveryReplicationStorageClassificationMapping_List")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMapping))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Lists the storage classification mappings for the fabric.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class GetAzSiteRecoveryReplicationStorageClassificationMapping_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// Fabric name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Fabric name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Fabric name.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _storageClassificationName; + + /// Storage classification name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Storage classification name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Storage classification name.", + SerializedName = @"storageClassificationName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string StorageClassificationName { get => this._storageClassificationName; set => this._storageClassificationName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMappingCollection + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzSiteRecoveryReplicationStorageClassificationMapping_List() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationStorageClassificationMappingsListByReplicationStorageClassifications(ResourceName, ResourceGroupName, SubscriptionId, FabricName, StorageClassificationName, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName,StorageClassificationName=StorageClassificationName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMappingCollection + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + var result = await response; + WriteObject(result.Value,true); + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (_nextLink != null) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationStorageClassificationMappingsListByReplicationStorageClassifications_Call(requestMessage, onOk, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationStorageClassificationMapping_List1.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationStorageClassificationMapping_List1.cs new file mode 100644 index 000000000000..00e776b69110 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationStorageClassificationMapping_List1.cs @@ -0,0 +1,372 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Lists the storage classification mappings in the vault. + /// + /// [OpenAPI] List=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationStorageClassificationMappings" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSiteRecoveryReplicationStorageClassificationMapping_List1")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMapping))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Lists the storage classification mappings in the vault.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class GetAzSiteRecoveryReplicationStorageClassificationMapping_List1 : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMappingCollection + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet + /// class. + /// + public GetAzSiteRecoveryReplicationStorageClassificationMapping_List1() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationStorageClassificationMappingsList(ResourceName, ResourceGroupName, SubscriptionId, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMappingCollection + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + var result = await response; + WriteObject(result.Value,true); + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (_nextLink != null) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationStorageClassificationMappingsList_Call(requestMessage, onOk, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationStorageClassification_Get.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationStorageClassification_Get.cs new file mode 100644 index 000000000000..3859cafcaa91 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationStorageClassification_Get.cs @@ -0,0 +1,377 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Gets the details of the specified storage classification. + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationStorageClassifications/{storageClassificationName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSiteRecoveryReplicationStorageClassification_Get")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassification))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Gets the details of the specified storage classification.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class GetAzSiteRecoveryReplicationStorageClassification_Get : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// Fabric name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Fabric name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Fabric name.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _storageClassificationName; + + /// Storage classification name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Storage classification name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Storage classification name.", + SerializedName = @"storageClassificationName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string StorageClassificationName { get => this._storageClassificationName; set => this._storageClassificationName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassification + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzSiteRecoveryReplicationStorageClassification_Get() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationStorageClassificationsGet(ResourceName, ResourceGroupName, SubscriptionId, FabricName, StorageClassificationName, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName,StorageClassificationName=StorageClassificationName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassification + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassification + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationStorageClassification_GetViaIdentity.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationStorageClassification_GetViaIdentity.cs new file mode 100644 index 000000000000..c1289c143d0b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationStorageClassification_GetViaIdentity.cs @@ -0,0 +1,337 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Gets the details of the specified storage classification. + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationStorageClassifications/{storageClassificationName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSiteRecoveryReplicationStorageClassification_GetViaIdentity")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassification))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Gets the details of the specified storage classification.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class GetAzSiteRecoveryReplicationStorageClassification_GetViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassification + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet + /// class. + /// + public GetAzSiteRecoveryReplicationStorageClassification_GetViaIdentity() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationStorageClassificationsGetViaIdentity(InputObject.Id, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.FabricName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.FabricName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.StorageClassificationName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.StorageClassificationName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationStorageClassificationsGet(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.FabricName ?? null, InputObject.StorageClassificationName ?? null, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassification + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassification + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationStorageClassification_List.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationStorageClassification_List.cs new file mode 100644 index 000000000000..4528ecce24f2 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationStorageClassification_List.cs @@ -0,0 +1,385 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Lists the storage classifications available in the specified fabric. + /// + /// [OpenAPI] ListByReplicationFabrics=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationStorageClassifications" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSiteRecoveryReplicationStorageClassification_List")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassification))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Lists the storage classifications available in the specified fabric.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class GetAzSiteRecoveryReplicationStorageClassification_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// Site name of interest. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Site name of interest.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Site name of interest.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationCollection + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzSiteRecoveryReplicationStorageClassification_List() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationStorageClassificationsListByReplicationFabrics(ResourceName, ResourceGroupName, SubscriptionId, FabricName, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationCollection + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + var result = await response; + WriteObject(result.Value,true); + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (_nextLink != null) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationStorageClassificationsListByReplicationFabrics_Call(requestMessage, onOk, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationStorageClassification_List1.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationStorageClassification_List1.cs new file mode 100644 index 000000000000..3dd6b45e9a3f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationStorageClassification_List1.cs @@ -0,0 +1,371 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Lists the storage classifications in the vault. + /// + /// [OpenAPI] List=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationStorageClassifications" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSiteRecoveryReplicationStorageClassification_List1")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassification))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Lists the storage classifications in the vault.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class GetAzSiteRecoveryReplicationStorageClassification_List1 : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationCollection + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzSiteRecoveryReplicationStorageClassification_List1() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationStorageClassificationsList(ResourceName, ResourceGroupName, SubscriptionId, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationCollection + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + var result = await response; + WriteObject(result.Value,true); + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (_nextLink != null) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationStorageClassificationsList_Call(requestMessage, onOk, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationVaultHealth_Get.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationVaultHealth_Get.cs new file mode 100644 index 000000000000..d3d881dfbb0a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationVaultHealth_Get.cs @@ -0,0 +1,349 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Gets the health details of the vault. + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationVaultHealth" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSiteRecoveryReplicationVaultHealth_Get")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthDetails))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Gets the health details of the vault.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class GetAzSiteRecoveryReplicationVaultHealth_Get : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthDetails + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzSiteRecoveryReplicationVaultHealth_Get() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationVaultHealthGet(ResourceName, ResourceGroupName, SubscriptionId, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthDetails + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthDetails + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationVaultHealth_GetViaIdentity.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationVaultHealth_GetViaIdentity.cs new file mode 100644 index 000000000000..dd4493e59ebf --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationVaultHealth_GetViaIdentity.cs @@ -0,0 +1,328 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Gets the health details of the vault. + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationVaultHealth" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSiteRecoveryReplicationVaultHealth_GetViaIdentity")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthDetails))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Gets the health details of the vault.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class GetAzSiteRecoveryReplicationVaultHealth_GetViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthDetails + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzSiteRecoveryReplicationVaultHealth_GetViaIdentity() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationVaultHealthGetViaIdentity(InputObject.Id, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationVaultHealthGet(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthDetails + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthDetails + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationVaultSetting_Get.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationVaultSetting_Get.cs new file mode 100644 index 000000000000..f1b1e7156010 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationVaultSetting_Get.cs @@ -0,0 +1,363 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Gets the vault setting. This includes the Migration Hub connection settings. + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationVaultSettings/{vaultSettingName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSiteRecoveryReplicationVaultSetting_Get")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSetting))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Gets the vault setting. This includes the Migration Hub connection settings.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class GetAzSiteRecoveryReplicationVaultSetting_Get : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Backing field for property. + private string _vaultSettingName; + + /// Vault setting name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Vault setting name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Vault setting name.", + SerializedName = @"vaultSettingName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string VaultSettingName { get => this._vaultSettingName; set => this._vaultSettingName = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSetting + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzSiteRecoveryReplicationVaultSetting_Get() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationVaultSettingGet(ResourceName, ResourceGroupName, SubscriptionId, VaultSettingName, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,VaultSettingName=VaultSettingName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSetting + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSetting + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationVaultSetting_GetViaIdentity.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationVaultSetting_GetViaIdentity.cs new file mode 100644 index 000000000000..83e17c809264 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationVaultSetting_GetViaIdentity.cs @@ -0,0 +1,332 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Gets the vault setting. This includes the Migration Hub connection settings. + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationVaultSettings/{vaultSettingName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSiteRecoveryReplicationVaultSetting_GetViaIdentity")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSetting))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Gets the vault setting. This includes the Migration Hub connection settings.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class GetAzSiteRecoveryReplicationVaultSetting_GetViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSetting + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzSiteRecoveryReplicationVaultSetting_GetViaIdentity() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationVaultSettingGetViaIdentity(InputObject.Id, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.VaultSettingName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.VaultSettingName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationVaultSettingGet(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.VaultSettingName ?? null, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSetting + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSetting + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationVaultSetting_List.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationVaultSetting_List.cs new file mode 100644 index 000000000000..00e4542ea089 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationVaultSetting_List.cs @@ -0,0 +1,373 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// + /// Gets the list of vault setting. This includes the Migration Hub connection settings. + /// + /// + /// [OpenAPI] List=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationVaultSettings" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSiteRecoveryReplicationVaultSetting_List")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSetting))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Gets the list of vault setting. This includes the Migration Hub connection settings.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class GetAzSiteRecoveryReplicationVaultSetting_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingCollection + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzSiteRecoveryReplicationVaultSetting_List() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationVaultSettingList(ResourceName, ResourceGroupName, SubscriptionId, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingCollection + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + var result = await response; + WriteObject(result.Value,true); + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (_nextLink != null) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationVaultSettingList_Call(requestMessage, onOk, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationvCenter_Get.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationvCenter_Get.cs new file mode 100644 index 000000000000..542c967a90b3 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationvCenter_Get.cs @@ -0,0 +1,377 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Gets the details of a registered vCenter server(Add vCenter server). + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationvCenters/{vcenterName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSiteRecoveryReplicationvCenter_Get")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenter))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Gets the details of a registered vCenter server(Add vCenter server).")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class GetAzSiteRecoveryReplicationvCenter_Get : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// Fabric name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Fabric name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Fabric name.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Backing field for property. + private string _vcenterName; + + /// vcenter name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "vcenter name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"vcenter name.", + SerializedName = @"vcenterName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string VcenterName { get => this._vcenterName; set => this._vcenterName = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenter + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzSiteRecoveryReplicationvCenter_Get() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationvCentersGet(ResourceName, ResourceGroupName, SubscriptionId, FabricName, VcenterName, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName,VcenterName=VcenterName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenter + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenter + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationvCenter_GetViaIdentity.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationvCenter_GetViaIdentity.cs new file mode 100644 index 000000000000..f33b9adca3e0 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationvCenter_GetViaIdentity.cs @@ -0,0 +1,336 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Gets the details of a registered vCenter server(Add vCenter server). + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationvCenters/{vcenterName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSiteRecoveryReplicationvCenter_GetViaIdentity")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenter))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Gets the details of a registered vCenter server(Add vCenter server).")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class GetAzSiteRecoveryReplicationvCenter_GetViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenter + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzSiteRecoveryReplicationvCenter_GetViaIdentity() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationvCentersGetViaIdentity(InputObject.Id, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.FabricName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.FabricName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.VcenterName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.VcenterName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationvCentersGet(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.FabricName ?? null, InputObject.VcenterName ?? null, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenter + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenter + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationvCenter_List.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationvCenter_List.cs new file mode 100644 index 000000000000..c3f75ced0c1a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationvCenter_List.cs @@ -0,0 +1,385 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Lists the vCenter servers registered in a fabric. + /// + /// [OpenAPI] ListByReplicationFabrics=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationvCenters" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSiteRecoveryReplicationvCenter_List")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenter))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Lists the vCenter servers registered in a fabric.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class GetAzSiteRecoveryReplicationvCenter_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// Fabric name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Fabric name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Fabric name.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterCollection + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzSiteRecoveryReplicationvCenter_List() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationvCentersListByReplicationFabrics(ResourceName, ResourceGroupName, SubscriptionId, FabricName, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterCollection + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + var result = await response; + WriteObject(result.Value,true); + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (_nextLink != null) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationvCentersListByReplicationFabrics_Call(requestMessage, onOk, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationvCenter_List1.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationvCenter_List1.cs new file mode 100644 index 000000000000..fefc72a8cc4d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryReplicationvCenter_List1.cs @@ -0,0 +1,371 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Lists the vCenter servers registered in the vault. + /// + /// [OpenAPI] List=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationvCenters" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSiteRecoveryReplicationvCenter_List1")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenter))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Lists the vCenter servers registered in the vault.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class GetAzSiteRecoveryReplicationvCenter_List1 : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterCollection + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzSiteRecoveryReplicationvCenter_List1() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationvCentersList(ResourceName, ResourceGroupName, SubscriptionId, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenterCollection + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + var result = await response; + WriteObject(result.Value,true); + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (_nextLink != null) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationvCentersList_Call(requestMessage, onOk, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoverySupportedOperatingSystem_Get.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoverySupportedOperatingSystem_Get.cs new file mode 100644 index 000000000000..a5771f3480bf --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoverySupportedOperatingSystem_Get.cs @@ -0,0 +1,363 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Gets the data of supported operating systems by SRS. + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationSupportedOperatingSystems" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSiteRecoverySupportedOperatingSystem_Get")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOperatingSystems))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Gets the data of supported operating systems by SRS.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class GetAzSiteRecoverySupportedOperatingSystem_Get : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private string _instanceType; + + /// The instance type. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The instance type.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The instance type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Query)] + public string InstanceType { get => this._instanceType; set => this._instanceType = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOperatingSystems + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzSiteRecoverySupportedOperatingSystem_Get() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.SupportedOperatingSystemsGet(ResourceName, ResourceGroupName, SubscriptionId, this.InvocationInformation.BoundParameters.ContainsKey("InstanceType") ? InstanceType : null, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,InstanceType=this.InvocationInformation.BoundParameters.ContainsKey("InstanceType") ? InstanceType : null}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOperatingSystems + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOperatingSystems + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoverySupportedOperatingSystem_GetViaIdentity.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoverySupportedOperatingSystem_GetViaIdentity.cs new file mode 100644 index 000000000000..db4295cc5f3a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoverySupportedOperatingSystem_GetViaIdentity.cs @@ -0,0 +1,342 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Gets the data of supported operating systems by SRS. + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationSupportedOperatingSystems" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSiteRecoverySupportedOperatingSystem_GetViaIdentity")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOperatingSystems))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Gets the data of supported operating systems by SRS.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class GetAzSiteRecoverySupportedOperatingSystem_GetViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Backing field for property. + private string _instanceType; + + /// The instance type. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The instance type.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The instance type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Query)] + public string InstanceType { get => this._instanceType; set => this._instanceType = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOperatingSystems + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzSiteRecoverySupportedOperatingSystem_GetViaIdentity() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.SupportedOperatingSystemsGetViaIdentity(InputObject.Id, this.InvocationInformation.BoundParameters.ContainsKey("InstanceType") ? InstanceType : null, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.SupportedOperatingSystemsGet(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, this.InvocationInformation.BoundParameters.ContainsKey("InstanceType") ? InstanceType : null, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { InstanceType=this.InvocationInformation.BoundParameters.ContainsKey("InstanceType") ? InstanceType : null}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOperatingSystems + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISupportedOperatingSystems + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryTargetComputeSize_List.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryTargetComputeSize_List.cs new file mode 100644 index 000000000000..1a789b7d322e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/GetAzSiteRecoveryTargetComputeSize_List.cs @@ -0,0 +1,413 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Lists the available target compute sizes for a replication protected item. + /// + /// [OpenAPI] ListByReplicationProtectedItems=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/targetComputeSizes" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzSiteRecoveryTargetComputeSize_List")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSize))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Lists the available target compute sizes for a replication protected item.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class GetAzSiteRecoveryTargetComputeSize_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// Fabric name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Fabric name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Fabric name.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _protectionContainerName; + + /// protection container name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "protection container name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"protection container name.", + SerializedName = @"protectionContainerName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ProtectionContainerName { get => this._protectionContainerName; set => this._protectionContainerName = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _replicatedProtectedItemName; + + /// Replication protected item name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Replication protected item name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Replication protected item name.", + SerializedName = @"replicatedProtectedItemName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ReplicatedProtectedItemName { get => this._replicatedProtectedItemName; set => this._replicatedProtectedItemName = value; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizeCollection + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzSiteRecoveryTargetComputeSize_List() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.TargetComputeSizesListByReplicationProtectedItems(ResourceName, ResourceGroupName, SubscriptionId, FabricName, ProtectionContainerName, ReplicatedProtectedItemName, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName,ProtectionContainerName=ProtectionContainerName,ReplicatedProtectedItemName=ReplicatedProtectedItemName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITargetComputeSizeCollection + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + var result = await response; + WriteObject(result.Value,true); + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (_nextLink != null) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.TargetComputeSizesListByReplicationProtectedItems_Call(requestMessage, onOk, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryCommitReplicationProtectedItemFailover_Commit.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryCommitReplicationProtectedItemFailover_Commit.cs new file mode 100644 index 000000000000..d39c330f07fe --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryCommitReplicationProtectedItemFailover_Commit.cs @@ -0,0 +1,463 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Operation to commit the failover of the replication protected item. + /// + /// [OpenAPI] FailoverCommit=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/failoverCommit" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Invoke, @"AzSiteRecoveryCommitReplicationProtectedItemFailover_Commit", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Operation to commit the failover of the replication protected item.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class InvokeAzSiteRecoveryCommitReplicationProtectedItemFailover_Commit : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// Unique fabric name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Unique fabric name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Unique fabric name.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _protectionContainerName; + + /// Protection container name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Protection container name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Protection container name.", + SerializedName = @"protectionContainerName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ProtectionContainerName { get => this._protectionContainerName; set => this._protectionContainerName = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _replicatedProtectedItemName; + + /// Replication protected item name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Replication protected item name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Replication protected item name.", + SerializedName = @"replicatedProtectedItemName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ReplicatedProtectedItemName { get => this._replicatedProtectedItemName; set => this._replicatedProtectedItemName = value; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of InvokeAzSiteRecoveryCommitReplicationProtectedItemFailover_Commit + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.InvokeAzSiteRecoveryCommitReplicationProtectedItemFailover_Commit Clone() + { + var clone = new InvokeAzSiteRecoveryCommitReplicationProtectedItemFailover_Commit(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + clone.FabricName = this.FabricName; + clone.ProtectionContainerName = this.ProtectionContainerName; + clone.ReplicatedProtectedItemName = this.ReplicatedProtectedItemName; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet + /// class. + /// + public InvokeAzSiteRecoveryCommitReplicationProtectedItemFailover_Commit() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationProtectedItemsFailoverCommit' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationProtectedItemsFailoverCommit(ResourceName, ResourceGroupName, SubscriptionId, FabricName, ProtectionContainerName, ReplicatedProtectedItemName, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName,ProtectionContainerName=ProtectionContainerName,ReplicatedProtectedItemName=ReplicatedProtectedItemName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryCommitReplicationProtectedItemFailover_CommitViaIdentity.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryCommitReplicationProtectedItemFailover_CommitViaIdentity.cs new file mode 100644 index 000000000000..8d9d607c2f73 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryCommitReplicationProtectedItemFailover_CommitViaIdentity.cs @@ -0,0 +1,409 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Operation to commit the failover of the replication protected item. + /// + /// [OpenAPI] FailoverCommit=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/failoverCommit" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Invoke, @"AzSiteRecoveryCommitReplicationProtectedItemFailover_CommitViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Operation to commit the failover of the replication protected item.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class InvokeAzSiteRecoveryCommitReplicationProtectedItemFailover_CommitViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of InvokeAzSiteRecoveryCommitReplicationProtectedItemFailover_CommitViaIdentity + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.InvokeAzSiteRecoveryCommitReplicationProtectedItemFailover_CommitViaIdentity Clone() + { + var clone = new InvokeAzSiteRecoveryCommitReplicationProtectedItemFailover_CommitViaIdentity(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public InvokeAzSiteRecoveryCommitReplicationProtectedItemFailover_CommitViaIdentity() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationProtectedItemsFailoverCommit' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationProtectedItemsFailoverCommitViaIdentity(InputObject.Id, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.FabricName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.FabricName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ProtectionContainerName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ProtectionContainerName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ReplicatedProtectedItemName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ReplicatedProtectedItemName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationProtectedItemsFailoverCommit(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.FabricName ?? null, InputObject.ProtectionContainerName ?? null, InputObject.ReplicatedProtectedItemName ?? null, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryCommitReplicationRecoveryPlanFailover_Commit.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryCommitReplicationRecoveryPlanFailover_Commit.cs new file mode 100644 index 000000000000..feb359a70c96 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryCommitReplicationRecoveryPlanFailover_Commit.cs @@ -0,0 +1,433 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to commit the failover of a recovery plan. + /// + /// [OpenAPI] FailoverCommit=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/failoverCommit" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Invoke, @"AzSiteRecoveryCommitReplicationRecoveryPlanFailover_Commit", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to commit the failover of a recovery plan.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class InvokeAzSiteRecoveryCommitReplicationRecoveryPlanFailover_Commit : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _recoveryPlanName; + + /// Recovery plan name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Recovery plan name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Recovery plan name.", + SerializedName = @"recoveryPlanName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string RecoveryPlanName { get => this._recoveryPlanName; set => this._recoveryPlanName = value; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of InvokeAzSiteRecoveryCommitReplicationRecoveryPlanFailover_Commit + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.InvokeAzSiteRecoveryCommitReplicationRecoveryPlanFailover_Commit Clone() + { + var clone = new InvokeAzSiteRecoveryCommitReplicationRecoveryPlanFailover_Commit(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + clone.RecoveryPlanName = this.RecoveryPlanName; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet + /// class. + /// + public InvokeAzSiteRecoveryCommitReplicationRecoveryPlanFailover_Commit() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationRecoveryPlansFailoverCommit' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationRecoveryPlansFailoverCommit(ResourceName, ResourceGroupName, SubscriptionId, RecoveryPlanName, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,RecoveryPlanName=RecoveryPlanName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryCommitReplicationRecoveryPlanFailover_CommitViaIdentity.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryCommitReplicationRecoveryPlanFailover_CommitViaIdentity.cs new file mode 100644 index 000000000000..6afb55167798 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryCommitReplicationRecoveryPlanFailover_CommitViaIdentity.cs @@ -0,0 +1,401 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to commit the failover of a recovery plan. + /// + /// [OpenAPI] FailoverCommit=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/failoverCommit" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Invoke, @"AzSiteRecoveryCommitReplicationRecoveryPlanFailover_CommitViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to commit the failover of a recovery plan.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class InvokeAzSiteRecoveryCommitReplicationRecoveryPlanFailover_CommitViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of InvokeAzSiteRecoveryCommitReplicationRecoveryPlanFailover_CommitViaIdentity + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.InvokeAzSiteRecoveryCommitReplicationRecoveryPlanFailover_CommitViaIdentity Clone() + { + var clone = new InvokeAzSiteRecoveryCommitReplicationRecoveryPlanFailover_CommitViaIdentity(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public InvokeAzSiteRecoveryCommitReplicationRecoveryPlanFailover_CommitViaIdentity() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationRecoveryPlansFailoverCommit' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationRecoveryPlansFailoverCommitViaIdentity(InputObject.Id, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.RecoveryPlanName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.RecoveryPlanName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationRecoveryPlansFailoverCommit(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.RecoveryPlanName ?? null, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryPlannedReplicationProtectedItemFailover_Planned.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryPlannedReplicationProtectedItemFailover_Planned.cs new file mode 100644 index 000000000000..8aa850b7dcd4 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryPlannedReplicationProtectedItemFailover_Planned.cs @@ -0,0 +1,477 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Operation to initiate a planned failover of the replication protected item. + /// + /// [OpenAPI] PlannedFailover=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/plannedFailover" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Invoke, @"AzSiteRecoveryPlannedReplicationProtectedItemFailover_Planned", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Operation to initiate a planned failover of the replication protected item.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class InvokeAzSiteRecoveryPlannedReplicationProtectedItemFailover_Planned : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// Unique fabric name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Unique fabric name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Unique fabric name.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverInput _failoverInput; + + /// Input definition for planned failover. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Input definition for planned failover.", ValueFromPipeline = true)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Input definition for planned failover.", + SerializedName = @"failoverInput", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverInput) })] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverInput FailoverInput { get => this._failoverInput; set => this._failoverInput = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _protectionContainerName; + + /// Protection container name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Protection container name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Protection container name.", + SerializedName = @"protectionContainerName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ProtectionContainerName { get => this._protectionContainerName; set => this._protectionContainerName = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _replicatedProtectedItemName; + + /// Replication protected item name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Replication protected item name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Replication protected item name.", + SerializedName = @"replicatedProtectedItemName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ReplicatedProtectedItemName { get => this._replicatedProtectedItemName; set => this._replicatedProtectedItemName = value; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of InvokeAzSiteRecoveryPlannedReplicationProtectedItemFailover_Planned + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.InvokeAzSiteRecoveryPlannedReplicationProtectedItemFailover_Planned Clone() + { + var clone = new InvokeAzSiteRecoveryPlannedReplicationProtectedItemFailover_Planned(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + clone.FabricName = this.FabricName; + clone.ProtectionContainerName = this.ProtectionContainerName; + clone.ReplicatedProtectedItemName = this.ReplicatedProtectedItemName; + clone.FailoverInput = this.FailoverInput; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet + /// class. + /// + public InvokeAzSiteRecoveryPlannedReplicationProtectedItemFailover_Planned() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationProtectedItemsPlannedFailover' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationProtectedItemsPlannedFailover(ResourceName, ResourceGroupName, SubscriptionId, FabricName, ProtectionContainerName, ReplicatedProtectedItemName, FailoverInput, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName,ProtectionContainerName=ProtectionContainerName,ReplicatedProtectedItemName=ReplicatedProtectedItemName,body=FailoverInput}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryPlannedReplicationProtectedItemFailover_PlannedExpanded.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryPlannedReplicationProtectedItemFailover_PlannedExpanded.cs new file mode 100644 index 000000000000..fd22e581d80c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryPlannedReplicationProtectedItemFailover_PlannedExpanded.cs @@ -0,0 +1,489 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Operation to initiate a planned failover of the replication protected item. + /// + /// [OpenAPI] PlannedFailover=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/plannedFailover" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Invoke, @"AzSiteRecoveryPlannedReplicationProtectedItemFailover_PlannedExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Operation to initiate a planned failover of the replication protected item.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class InvokeAzSiteRecoveryPlannedReplicationProtectedItemFailover_PlannedExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Input definition for planned failover. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverInput _failoverInputBody = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PlannedFailoverInput(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// Unique fabric name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Unique fabric name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Unique fabric name.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// Failover direction. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Failover direction.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Failover direction.", + SerializedName = @"failoverDirection", + PossibleTypes = new [] { typeof(string) })] + public string FailoverDirection { get => _failoverInputBody.FailoverDirection ?? null; set => _failoverInputBody.FailoverDirection = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _protectionContainerName; + + /// Protection container name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Protection container name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Protection container name.", + SerializedName = @"protectionContainerName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ProtectionContainerName { get => this._protectionContainerName; set => this._protectionContainerName = value; } + + /// The class type. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The class type.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + public string ProviderSpecificDetailInstanceType { get => _failoverInputBody.ProviderSpecificDetailInstanceType ?? null; set => _failoverInputBody.ProviderSpecificDetailInstanceType = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _replicatedProtectedItemName; + + /// Replication protected item name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Replication protected item name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Replication protected item name.", + SerializedName = @"replicatedProtectedItemName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ReplicatedProtectedItemName { get => this._replicatedProtectedItemName; set => this._replicatedProtectedItemName = value; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of InvokeAzSiteRecoveryPlannedReplicationProtectedItemFailover_PlannedExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.InvokeAzSiteRecoveryPlannedReplicationProtectedItemFailover_PlannedExpanded Clone() + { + var clone = new InvokeAzSiteRecoveryPlannedReplicationProtectedItemFailover_PlannedExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._failoverInputBody = this._failoverInputBody; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + clone.FabricName = this.FabricName; + clone.ProtectionContainerName = this.ProtectionContainerName; + clone.ReplicatedProtectedItemName = this.ReplicatedProtectedItemName; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public InvokeAzSiteRecoveryPlannedReplicationProtectedItemFailover_PlannedExpanded() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationProtectedItemsPlannedFailover' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationProtectedItemsPlannedFailover(ResourceName, ResourceGroupName, SubscriptionId, FabricName, ProtectionContainerName, ReplicatedProtectedItemName, _failoverInputBody, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName,ProtectionContainerName=ProtectionContainerName,ReplicatedProtectedItemName=ReplicatedProtectedItemName,body=_failoverInputBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryPlannedReplicationProtectedItemFailover_PlannedViaIdentity.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryPlannedReplicationProtectedItemFailover_PlannedViaIdentity.cs new file mode 100644 index 000000000000..d9bc919a07f2 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryPlannedReplicationProtectedItemFailover_PlannedViaIdentity.cs @@ -0,0 +1,423 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Operation to initiate a planned failover of the replication protected item. + /// + /// [OpenAPI] PlannedFailover=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/plannedFailover" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Invoke, @"AzSiteRecoveryPlannedReplicationProtectedItemFailover_PlannedViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Operation to initiate a planned failover of the replication protected item.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class InvokeAzSiteRecoveryPlannedReplicationProtectedItemFailover_PlannedViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverInput _failoverInput; + + /// Input definition for planned failover. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Input definition for planned failover.", ValueFromPipeline = true)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Input definition for planned failover.", + SerializedName = @"failoverInput", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverInput) })] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverInput FailoverInput { get => this._failoverInput; set => this._failoverInput = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of InvokeAzSiteRecoveryPlannedReplicationProtectedItemFailover_PlannedViaIdentity + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.InvokeAzSiteRecoveryPlannedReplicationProtectedItemFailover_PlannedViaIdentity Clone() + { + var clone = new InvokeAzSiteRecoveryPlannedReplicationProtectedItemFailover_PlannedViaIdentity(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.FailoverInput = this.FailoverInput; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public InvokeAzSiteRecoveryPlannedReplicationProtectedItemFailover_PlannedViaIdentity() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationProtectedItemsPlannedFailover' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationProtectedItemsPlannedFailoverViaIdentity(InputObject.Id, FailoverInput, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.FabricName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.FabricName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ProtectionContainerName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ProtectionContainerName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ReplicatedProtectedItemName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ReplicatedProtectedItemName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationProtectedItemsPlannedFailover(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.FabricName ?? null, InputObject.ProtectionContainerName ?? null, InputObject.ReplicatedProtectedItemName ?? null, FailoverInput, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=FailoverInput}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryPlannedReplicationProtectedItemFailover_PlannedViaIdentityExpanded.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryPlannedReplicationProtectedItemFailover_PlannedViaIdentityExpanded.cs new file mode 100644 index 000000000000..d8de5dfea7f7 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryPlannedReplicationProtectedItemFailover_PlannedViaIdentityExpanded.cs @@ -0,0 +1,435 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Operation to initiate a planned failover of the replication protected item. + /// + /// [OpenAPI] PlannedFailover=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/plannedFailover" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Invoke, @"AzSiteRecoveryPlannedReplicationProtectedItemFailover_PlannedViaIdentityExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Operation to initiate a planned failover of the replication protected item.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class InvokeAzSiteRecoveryPlannedReplicationProtectedItemFailover_PlannedViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Input definition for planned failover. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPlannedFailoverInput _failoverInputBody = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PlannedFailoverInput(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Failover direction. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Failover direction.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Failover direction.", + SerializedName = @"failoverDirection", + PossibleTypes = new [] { typeof(string) })] + public string FailoverDirection { get => _failoverInputBody.FailoverDirection ?? null; set => _failoverInputBody.FailoverDirection = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The class type. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The class type.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + public string ProviderSpecificDetailInstanceType { get => _failoverInputBody.ProviderSpecificDetailInstanceType ?? null; set => _failoverInputBody.ProviderSpecificDetailInstanceType = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of InvokeAzSiteRecoveryPlannedReplicationProtectedItemFailover_PlannedViaIdentityExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.InvokeAzSiteRecoveryPlannedReplicationProtectedItemFailover_PlannedViaIdentityExpanded Clone() + { + var clone = new InvokeAzSiteRecoveryPlannedReplicationProtectedItemFailover_PlannedViaIdentityExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._failoverInputBody = this._failoverInputBody; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public InvokeAzSiteRecoveryPlannedReplicationProtectedItemFailover_PlannedViaIdentityExpanded() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationProtectedItemsPlannedFailover' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationProtectedItemsPlannedFailoverViaIdentity(InputObject.Id, _failoverInputBody, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.FabricName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.FabricName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ProtectionContainerName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ProtectionContainerName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ReplicatedProtectedItemName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ReplicatedProtectedItemName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationProtectedItemsPlannedFailover(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.FabricName ?? null, InputObject.ProtectionContainerName ?? null, InputObject.ReplicatedProtectedItemName ?? null, _failoverInputBody, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=_failoverInputBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryPlannedReplicationRecoveryPlanFailover_Planned.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryPlannedReplicationRecoveryPlanFailover_Planned.cs new file mode 100644 index 000000000000..4a282d1fc2d8 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryPlannedReplicationRecoveryPlanFailover_Planned.cs @@ -0,0 +1,447 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to start the planned failover of a recovery plan. + /// + /// [OpenAPI] PlannedFailover=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/plannedFailover" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Invoke, @"AzSiteRecoveryPlannedReplicationRecoveryPlanFailover_Planned", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to start the planned failover of a recovery plan.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class InvokeAzSiteRecoveryPlannedReplicationRecoveryPlanFailover_Planned : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPlannedFailoverInput _input; + + /// Recovery plan planned failover input. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Recovery plan planned failover input.", ValueFromPipeline = true)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Recovery plan planned failover input.", + SerializedName = @"input", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPlannedFailoverInput) })] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPlannedFailoverInput Input { get => this._input; set => this._input = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _recoveryPlanName; + + /// Recovery plan name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Recovery plan name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Recovery plan name.", + SerializedName = @"recoveryPlanName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string RecoveryPlanName { get => this._recoveryPlanName; set => this._recoveryPlanName = value; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of InvokeAzSiteRecoveryPlannedReplicationRecoveryPlanFailover_Planned + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.InvokeAzSiteRecoveryPlannedReplicationRecoveryPlanFailover_Planned Clone() + { + var clone = new InvokeAzSiteRecoveryPlannedReplicationRecoveryPlanFailover_Planned(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + clone.RecoveryPlanName = this.RecoveryPlanName; + clone.Input = this.Input; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet + /// class. + /// + public InvokeAzSiteRecoveryPlannedReplicationRecoveryPlanFailover_Planned() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationRecoveryPlansPlannedFailover' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationRecoveryPlansPlannedFailover(ResourceName, ResourceGroupName, SubscriptionId, RecoveryPlanName, Input, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,RecoveryPlanName=RecoveryPlanName,body=Input}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryPlannedReplicationRecoveryPlanFailover_PlannedExpanded.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryPlannedReplicationRecoveryPlanFailover_PlannedExpanded.cs new file mode 100644 index 000000000000..35116ef34d34 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryPlannedReplicationRecoveryPlanFailover_PlannedExpanded.cs @@ -0,0 +1,461 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to start the planned failover of a recovery plan. + /// + /// [OpenAPI] PlannedFailover=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/plannedFailover" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Invoke, @"AzSiteRecoveryPlannedReplicationRecoveryPlanFailover_PlannedExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to start the planned failover of a recovery plan.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class InvokeAzSiteRecoveryPlannedReplicationRecoveryPlanFailover_PlannedExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Recovery plan planned failover input. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPlannedFailoverInput _inputBody = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanPlannedFailoverInput(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// The failover direction. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The failover direction.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The failover direction.", + SerializedName = @"failoverDirection", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections) })] + [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections))] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections FailoverDirection { get => _inputBody.FailoverDirection; set => _inputBody.FailoverDirection = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The provider specific properties. + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The provider specific properties.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The provider specific properties.", + SerializedName = @"providerSpecificDetails", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInput) })] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInput[] ProviderSpecificDetail { get => _inputBody.ProviderSpecificDetail ?? null /* arrayOf */; set => _inputBody.ProviderSpecificDetail = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _recoveryPlanName; + + /// Recovery plan name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Recovery plan name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Recovery plan name.", + SerializedName = @"recoveryPlanName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string RecoveryPlanName { get => this._recoveryPlanName; set => this._recoveryPlanName = value; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of InvokeAzSiteRecoveryPlannedReplicationRecoveryPlanFailover_PlannedExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.InvokeAzSiteRecoveryPlannedReplicationRecoveryPlanFailover_PlannedExpanded Clone() + { + var clone = new InvokeAzSiteRecoveryPlannedReplicationRecoveryPlanFailover_PlannedExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._inputBody = this._inputBody; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + clone.RecoveryPlanName = this.RecoveryPlanName; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public InvokeAzSiteRecoveryPlannedReplicationRecoveryPlanFailover_PlannedExpanded() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationRecoveryPlansPlannedFailover' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationRecoveryPlansPlannedFailover(ResourceName, ResourceGroupName, SubscriptionId, RecoveryPlanName, _inputBody, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,RecoveryPlanName=RecoveryPlanName,body=_inputBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryPlannedReplicationRecoveryPlanFailover_PlannedViaIdentity.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryPlannedReplicationRecoveryPlanFailover_PlannedViaIdentity.cs new file mode 100644 index 000000000000..c8879d3a00b0 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryPlannedReplicationRecoveryPlanFailover_PlannedViaIdentity.cs @@ -0,0 +1,415 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to start the planned failover of a recovery plan. + /// + /// [OpenAPI] PlannedFailover=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/plannedFailover" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Invoke, @"AzSiteRecoveryPlannedReplicationRecoveryPlanFailover_PlannedViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to start the planned failover of a recovery plan.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class InvokeAzSiteRecoveryPlannedReplicationRecoveryPlanFailover_PlannedViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPlannedFailoverInput _input; + + /// Recovery plan planned failover input. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Recovery plan planned failover input.", ValueFromPipeline = true)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Recovery plan planned failover input.", + SerializedName = @"input", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPlannedFailoverInput) })] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPlannedFailoverInput Input { get => this._input; set => this._input = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of InvokeAzSiteRecoveryPlannedReplicationRecoveryPlanFailover_PlannedViaIdentity + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.InvokeAzSiteRecoveryPlannedReplicationRecoveryPlanFailover_PlannedViaIdentity Clone() + { + var clone = new InvokeAzSiteRecoveryPlannedReplicationRecoveryPlanFailover_PlannedViaIdentity(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.Input = this.Input; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public InvokeAzSiteRecoveryPlannedReplicationRecoveryPlanFailover_PlannedViaIdentity() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationRecoveryPlansPlannedFailover' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationRecoveryPlansPlannedFailoverViaIdentity(InputObject.Id, Input, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.RecoveryPlanName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.RecoveryPlanName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationRecoveryPlansPlannedFailover(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.RecoveryPlanName ?? null, Input, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=Input}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryPlannedReplicationRecoveryPlanFailover_PlannedViaIdentityExpanded.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryPlannedReplicationRecoveryPlanFailover_PlannedViaIdentityExpanded.cs new file mode 100644 index 000000000000..57c9f9e8cfea --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryPlannedReplicationRecoveryPlanFailover_PlannedViaIdentityExpanded.cs @@ -0,0 +1,429 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to start the planned failover of a recovery plan. + /// + /// [OpenAPI] PlannedFailover=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/plannedFailover" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Invoke, @"AzSiteRecoveryPlannedReplicationRecoveryPlanFailover_PlannedViaIdentityExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to start the planned failover of a recovery plan.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class InvokeAzSiteRecoveryPlannedReplicationRecoveryPlanFailover_PlannedViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Recovery plan planned failover input. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanPlannedFailoverInput _inputBody = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanPlannedFailoverInput(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// The failover direction. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The failover direction.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The failover direction.", + SerializedName = @"failoverDirection", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections) })] + [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections))] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections FailoverDirection { get => _inputBody.FailoverDirection; set => _inputBody.FailoverDirection = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The provider specific properties. + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The provider specific properties.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The provider specific properties.", + SerializedName = @"providerSpecificDetails", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInput) })] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInput[] ProviderSpecificDetail { get => _inputBody.ProviderSpecificDetail ?? null /* arrayOf */; set => _inputBody.ProviderSpecificDetail = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of InvokeAzSiteRecoveryPlannedReplicationRecoveryPlanFailover_PlannedViaIdentityExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.InvokeAzSiteRecoveryPlannedReplicationRecoveryPlanFailover_PlannedViaIdentityExpanded Clone() + { + var clone = new InvokeAzSiteRecoveryPlannedReplicationRecoveryPlanFailover_PlannedViaIdentityExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._inputBody = this._inputBody; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public InvokeAzSiteRecoveryPlannedReplicationRecoveryPlanFailover_PlannedViaIdentityExpanded() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationRecoveryPlansPlannedFailover' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationRecoveryPlansPlannedFailoverViaIdentity(InputObject.Id, _inputBody, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.RecoveryPlanName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.RecoveryPlanName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationRecoveryPlansPlannedFailover(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.RecoveryPlanName ?? null, _inputBody, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=_inputBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryRenewReplicationFabricCertificate_Renew.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryRenewReplicationFabricCertificate_Renew.cs new file mode 100644 index 000000000000..2fb58b491d71 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryRenewReplicationFabricCertificate_Renew.cs @@ -0,0 +1,446 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Renews the connection certificate for the ASR replication fabric. + /// + /// [OpenAPI] RenewCertificate=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/renewCertificate" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Invoke, @"AzSiteRecoveryRenewReplicationFabricCertificate_Renew", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabric))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Renews the connection certificate for the ASR replication fabric.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class InvokeAzSiteRecoveryRenewReplicationFabricCertificate_Renew : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// fabric name to renew certs for. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "fabric name to renew certs for.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"fabric name to renew certs for.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRenewCertificateInput _renewCertificate; + + /// Certificate renewal input. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Certificate renewal input.", ValueFromPipeline = true)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Certificate renewal input.", + SerializedName = @"renewCertificate", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRenewCertificateInput) })] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRenewCertificateInput RenewCertificate { get => this._renewCertificate; set => this._renewCertificate = value; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabric + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of InvokeAzSiteRecoveryRenewReplicationFabricCertificate_Renew + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.InvokeAzSiteRecoveryRenewReplicationFabricCertificate_Renew Clone() + { + var clone = new InvokeAzSiteRecoveryRenewReplicationFabricCertificate_Renew(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + clone.FabricName = this.FabricName; + clone.RenewCertificate = this.RenewCertificate; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public InvokeAzSiteRecoveryRenewReplicationFabricCertificate_Renew() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationFabricsRenewCertificate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationFabricsRenewCertificate(ResourceName, ResourceGroupName, SubscriptionId, FabricName, RenewCertificate, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName,body=RenewCertificate}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabric + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabric + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryRenewReplicationFabricCertificate_RenewExpanded.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryRenewReplicationFabricCertificate_RenewExpanded.cs new file mode 100644 index 000000000000..870dcc890915 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryRenewReplicationFabricCertificate_RenewExpanded.cs @@ -0,0 +1,448 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Renews the connection certificate for the ASR replication fabric. + /// + /// [OpenAPI] RenewCertificate=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/renewCertificate" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Invoke, @"AzSiteRecoveryRenewReplicationFabricCertificate_RenewExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabric))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Renews the connection certificate for the ASR replication fabric.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class InvokeAzSiteRecoveryRenewReplicationFabricCertificate_RenewExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Certificate renewal input. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRenewCertificateInput _renewCertificateBody = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RenewCertificateInput(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// fabric name to renew certs for. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "fabric name to renew certs for.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"fabric name to renew certs for.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Renew certificate type. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Renew certificate type.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Renew certificate type.", + SerializedName = @"renewCertificateType", + PossibleTypes = new [] { typeof(string) })] + public string RenewCertificateType { get => _renewCertificateBody.RenewCertificateType ?? null; set => _renewCertificateBody.RenewCertificateType = value; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabric + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of InvokeAzSiteRecoveryRenewReplicationFabricCertificate_RenewExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.InvokeAzSiteRecoveryRenewReplicationFabricCertificate_RenewExpanded Clone() + { + var clone = new InvokeAzSiteRecoveryRenewReplicationFabricCertificate_RenewExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._renewCertificateBody = this._renewCertificateBody; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + clone.FabricName = this.FabricName; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet + /// class. + /// + public InvokeAzSiteRecoveryRenewReplicationFabricCertificate_RenewExpanded() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationFabricsRenewCertificate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationFabricsRenewCertificate(ResourceName, ResourceGroupName, SubscriptionId, FabricName, _renewCertificateBody, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName,body=_renewCertificateBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabric + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabric + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryRenewReplicationFabricCertificate_RenewViaIdentity.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryRenewReplicationFabricCertificate_RenewViaIdentity.cs new file mode 100644 index 000000000000..0a47720c68bb --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryRenewReplicationFabricCertificate_RenewViaIdentity.cs @@ -0,0 +1,415 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Renews the connection certificate for the ASR replication fabric. + /// + /// [OpenAPI] RenewCertificate=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/renewCertificate" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Invoke, @"AzSiteRecoveryRenewReplicationFabricCertificate_RenewViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabric))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Renews the connection certificate for the ASR replication fabric.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class InvokeAzSiteRecoveryRenewReplicationFabricCertificate_RenewViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRenewCertificateInput _renewCertificate; + + /// Certificate renewal input. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Certificate renewal input.", ValueFromPipeline = true)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Certificate renewal input.", + SerializedName = @"renewCertificate", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRenewCertificateInput) })] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRenewCertificateInput RenewCertificate { get => this._renewCertificate; set => this._renewCertificate = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabric + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of InvokeAzSiteRecoveryRenewReplicationFabricCertificate_RenewViaIdentity + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.InvokeAzSiteRecoveryRenewReplicationFabricCertificate_RenewViaIdentity Clone() + { + var clone = new InvokeAzSiteRecoveryRenewReplicationFabricCertificate_RenewViaIdentity(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.RenewCertificate = this.RenewCertificate; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the + /// cmdlet class. + /// + public InvokeAzSiteRecoveryRenewReplicationFabricCertificate_RenewViaIdentity() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationFabricsRenewCertificate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationFabricsRenewCertificateViaIdentity(InputObject.Id, RenewCertificate, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.FabricName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.FabricName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationFabricsRenewCertificate(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.FabricName ?? null, RenewCertificate, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=RenewCertificate}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabric + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabric + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryRenewReplicationFabricCertificate_RenewViaIdentityExpanded.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryRenewReplicationFabricCertificate_RenewViaIdentityExpanded.cs new file mode 100644 index 000000000000..12b079c70f35 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryRenewReplicationFabricCertificate_RenewViaIdentityExpanded.cs @@ -0,0 +1,416 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Renews the connection certificate for the ASR replication fabric. + /// + /// [OpenAPI] RenewCertificate=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/renewCertificate" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Invoke, @"AzSiteRecoveryRenewReplicationFabricCertificate_RenewViaIdentityExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabric))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Renews the connection certificate for the ASR replication fabric.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class InvokeAzSiteRecoveryRenewReplicationFabricCertificate_RenewViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Certificate renewal input. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRenewCertificateInput _renewCertificateBody = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RenewCertificateInput(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Renew certificate type. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Renew certificate type.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Renew certificate type.", + SerializedName = @"renewCertificateType", + PossibleTypes = new [] { typeof(string) })] + public string RenewCertificateType { get => _renewCertificateBody.RenewCertificateType ?? null; set => _renewCertificateBody.RenewCertificateType = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabric + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of InvokeAzSiteRecoveryRenewReplicationFabricCertificate_RenewViaIdentityExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.InvokeAzSiteRecoveryRenewReplicationFabricCertificate_RenewViaIdentityExpanded Clone() + { + var clone = new InvokeAzSiteRecoveryRenewReplicationFabricCertificate_RenewViaIdentityExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._renewCertificateBody = this._renewCertificateBody; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public InvokeAzSiteRecoveryRenewReplicationFabricCertificate_RenewViaIdentityExpanded() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationFabricsRenewCertificate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationFabricsRenewCertificateViaIdentity(InputObject.Id, _renewCertificateBody, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.FabricName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.FabricName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationFabricsRenewCertificate(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.FabricName ?? null, _renewCertificateBody, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=_renewCertificateBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabric + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabric + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryReprotectReplicationProtectedItem_Reprotect.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryReprotectReplicationProtectedItem_Reprotect.cs new file mode 100644 index 000000000000..35acd980a4e3 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryReprotectReplicationProtectedItem_Reprotect.cs @@ -0,0 +1,479 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// + /// Operation to reprotect or reverse replicate a failed over replication protected item. + /// + /// + /// [OpenAPI] Reprotect=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/reProtect" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Invoke, @"AzSiteRecoveryReprotectReplicationProtectedItem_Reprotect", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Operation to reprotect or reverse replicate a failed over replication protected item.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class InvokeAzSiteRecoveryReprotectReplicationProtectedItem_Reprotect : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// Unique fabric name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Unique fabric name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Unique fabric name.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _protectionContainerName; + + /// Protection container name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Protection container name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Protection container name.", + SerializedName = @"protectionContainerName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ProtectionContainerName { get => this._protectionContainerName; set => this._protectionContainerName = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _replicatedProtectedItemName; + + /// Replication protected item name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Replication protected item name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Replication protected item name.", + SerializedName = @"replicatedProtectedItemName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ReplicatedProtectedItemName { get => this._replicatedProtectedItemName; set => this._replicatedProtectedItemName = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationInput _reprotectInput; + + /// Reverse replication input. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Reverse replication input.", ValueFromPipeline = true)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Reverse replication input.", + SerializedName = @"reprotectInput", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationInput) })] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationInput ReprotectInput { get => this._reprotectInput; set => this._reprotectInput = value; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of InvokeAzSiteRecoveryReprotectReplicationProtectedItem_Reprotect + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.InvokeAzSiteRecoveryReprotectReplicationProtectedItem_Reprotect Clone() + { + var clone = new InvokeAzSiteRecoveryReprotectReplicationProtectedItem_Reprotect(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + clone.FabricName = this.FabricName; + clone.ProtectionContainerName = this.ProtectionContainerName; + clone.ReplicatedProtectedItemName = this.ReplicatedProtectedItemName; + clone.ReprotectInput = this.ReprotectInput; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet + /// class. + /// + public InvokeAzSiteRecoveryReprotectReplicationProtectedItem_Reprotect() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationProtectedItemsReprotect' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationProtectedItemsReprotect(ResourceName, ResourceGroupName, SubscriptionId, FabricName, ProtectionContainerName, ReplicatedProtectedItemName, ReprotectInput, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName,ProtectionContainerName=ProtectionContainerName,ReplicatedProtectedItemName=ReplicatedProtectedItemName,body=ReprotectInput}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryReprotectReplicationProtectedItem_ReprotectExpanded.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryReprotectReplicationProtectedItem_ReprotectExpanded.cs new file mode 100644 index 000000000000..69a5c01cee23 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryReprotectReplicationProtectedItem_ReprotectExpanded.cs @@ -0,0 +1,491 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// + /// Operation to reprotect or reverse replicate a failed over replication protected item. + /// + /// + /// [OpenAPI] Reprotect=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/reProtect" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Invoke, @"AzSiteRecoveryReprotectReplicationProtectedItem_ReprotectExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Operation to reprotect or reverse replicate a failed over replication protected item.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class InvokeAzSiteRecoveryReprotectReplicationProtectedItem_ReprotectExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Reverse replication input. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationInput _reprotectInputBody = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReverseReplicationInput(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// Unique fabric name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Unique fabric name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Unique fabric name.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// Failover direction. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Failover direction.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Failover direction.", + SerializedName = @"failoverDirection", + PossibleTypes = new [] { typeof(string) })] + public string FailoverDirection { get => _reprotectInputBody.FailoverDirection ?? null; set => _reprotectInputBody.FailoverDirection = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _protectionContainerName; + + /// Protection container name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Protection container name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Protection container name.", + SerializedName = @"protectionContainerName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ProtectionContainerName { get => this._protectionContainerName; set => this._protectionContainerName = value; } + + /// The class type. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The class type.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + public string ProviderSpecificDetailInstanceType { get => _reprotectInputBody.ProviderSpecificDetailInstanceType ?? null; set => _reprotectInputBody.ProviderSpecificDetailInstanceType = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _replicatedProtectedItemName; + + /// Replication protected item name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Replication protected item name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Replication protected item name.", + SerializedName = @"replicatedProtectedItemName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ReplicatedProtectedItemName { get => this._replicatedProtectedItemName; set => this._replicatedProtectedItemName = value; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of InvokeAzSiteRecoveryReprotectReplicationProtectedItem_ReprotectExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.InvokeAzSiteRecoveryReprotectReplicationProtectedItem_ReprotectExpanded Clone() + { + var clone = new InvokeAzSiteRecoveryReprotectReplicationProtectedItem_ReprotectExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._reprotectInputBody = this._reprotectInputBody; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + clone.FabricName = this.FabricName; + clone.ProtectionContainerName = this.ProtectionContainerName; + clone.ReplicatedProtectedItemName = this.ReplicatedProtectedItemName; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the + /// cmdlet class. + /// + public InvokeAzSiteRecoveryReprotectReplicationProtectedItem_ReprotectExpanded() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationProtectedItemsReprotect' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationProtectedItemsReprotect(ResourceName, ResourceGroupName, SubscriptionId, FabricName, ProtectionContainerName, ReplicatedProtectedItemName, _reprotectInputBody, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName,ProtectionContainerName=ProtectionContainerName,ReplicatedProtectedItemName=ReplicatedProtectedItemName,body=_reprotectInputBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryReprotectReplicationProtectedItem_ReprotectViaIdentity.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryReprotectReplicationProtectedItem_ReprotectViaIdentity.cs new file mode 100644 index 000000000000..71665e916e92 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryReprotectReplicationProtectedItem_ReprotectViaIdentity.cs @@ -0,0 +1,425 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// + /// Operation to reprotect or reverse replicate a failed over replication protected item. + /// + /// + /// [OpenAPI] Reprotect=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/reProtect" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Invoke, @"AzSiteRecoveryReprotectReplicationProtectedItem_ReprotectViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Operation to reprotect or reverse replicate a failed over replication protected item.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class InvokeAzSiteRecoveryReprotectReplicationProtectedItem_ReprotectViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationInput _reprotectInput; + + /// Reverse replication input. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Reverse replication input.", ValueFromPipeline = true)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Reverse replication input.", + SerializedName = @"reprotectInput", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationInput) })] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationInput ReprotectInput { get => this._reprotectInput; set => this._reprotectInput = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of InvokeAzSiteRecoveryReprotectReplicationProtectedItem_ReprotectViaIdentity + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.InvokeAzSiteRecoveryReprotectReplicationProtectedItem_ReprotectViaIdentity Clone() + { + var clone = new InvokeAzSiteRecoveryReprotectReplicationProtectedItem_ReprotectViaIdentity(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.ReprotectInput = this.ReprotectInput; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public InvokeAzSiteRecoveryReprotectReplicationProtectedItem_ReprotectViaIdentity() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationProtectedItemsReprotect' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationProtectedItemsReprotectViaIdentity(InputObject.Id, ReprotectInput, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.FabricName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.FabricName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ProtectionContainerName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ProtectionContainerName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ReplicatedProtectedItemName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ReplicatedProtectedItemName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationProtectedItemsReprotect(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.FabricName ?? null, InputObject.ProtectionContainerName ?? null, InputObject.ReplicatedProtectedItemName ?? null, ReprotectInput, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=ReprotectInput}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryReprotectReplicationProtectedItem_ReprotectViaIdentityExpanded.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryReprotectReplicationProtectedItem_ReprotectViaIdentityExpanded.cs new file mode 100644 index 000000000000..e98c2aba2296 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryReprotectReplicationProtectedItem_ReprotectViaIdentityExpanded.cs @@ -0,0 +1,437 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// + /// Operation to reprotect or reverse replicate a failed over replication protected item. + /// + /// + /// [OpenAPI] Reprotect=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/reProtect" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Invoke, @"AzSiteRecoveryReprotectReplicationProtectedItem_ReprotectViaIdentityExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Operation to reprotect or reverse replicate a failed over replication protected item.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class InvokeAzSiteRecoveryReprotectReplicationProtectedItem_ReprotectViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Reverse replication input. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReverseReplicationInput _reprotectInputBody = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ReverseReplicationInput(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Failover direction. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Failover direction.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Failover direction.", + SerializedName = @"failoverDirection", + PossibleTypes = new [] { typeof(string) })] + public string FailoverDirection { get => _reprotectInputBody.FailoverDirection ?? null; set => _reprotectInputBody.FailoverDirection = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The class type. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The class type.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + public string ProviderSpecificDetailInstanceType { get => _reprotectInputBody.ProviderSpecificDetailInstanceType ?? null; set => _reprotectInputBody.ProviderSpecificDetailInstanceType = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of InvokeAzSiteRecoveryReprotectReplicationProtectedItem_ReprotectViaIdentityExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.InvokeAzSiteRecoveryReprotectReplicationProtectedItem_ReprotectViaIdentityExpanded Clone() + { + var clone = new InvokeAzSiteRecoveryReprotectReplicationProtectedItem_ReprotectViaIdentityExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._reprotectInputBody = this._reprotectInputBody; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public InvokeAzSiteRecoveryReprotectReplicationProtectedItem_ReprotectViaIdentityExpanded() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationProtectedItemsReprotect' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationProtectedItemsReprotectViaIdentity(InputObject.Id, _reprotectInputBody, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.FabricName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.FabricName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ProtectionContainerName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ProtectionContainerName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ReplicatedProtectedItemName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ReplicatedProtectedItemName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationProtectedItemsReprotect(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.FabricName ?? null, InputObject.ProtectionContainerName ?? null, InputObject.ReplicatedProtectedItemName ?? null, _reprotectInputBody, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=_reprotectInputBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryReprotectReplicationRecoveryPlan_Reprotect.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryReprotectReplicationRecoveryPlan_Reprotect.cs new file mode 100644 index 000000000000..21c71e11be44 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryReprotectReplicationRecoveryPlan_Reprotect.cs @@ -0,0 +1,433 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to reprotect(reverse replicate) a recovery plan. + /// + /// [OpenAPI] Reprotect=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/reProtect" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Invoke, @"AzSiteRecoveryReprotectReplicationRecoveryPlan_Reprotect", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to reprotect(reverse replicate) a recovery plan.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class InvokeAzSiteRecoveryReprotectReplicationRecoveryPlan_Reprotect : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _recoveryPlanName; + + /// Recovery plan name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Recovery plan name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Recovery plan name.", + SerializedName = @"recoveryPlanName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string RecoveryPlanName { get => this._recoveryPlanName; set => this._recoveryPlanName = value; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of InvokeAzSiteRecoveryReprotectReplicationRecoveryPlan_Reprotect + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.InvokeAzSiteRecoveryReprotectReplicationRecoveryPlan_Reprotect Clone() + { + var clone = new InvokeAzSiteRecoveryReprotectReplicationRecoveryPlan_Reprotect(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + clone.RecoveryPlanName = this.RecoveryPlanName; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet + /// class. + /// + public InvokeAzSiteRecoveryReprotectReplicationRecoveryPlan_Reprotect() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationRecoveryPlansReprotect' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationRecoveryPlansReprotect(ResourceName, ResourceGroupName, SubscriptionId, RecoveryPlanName, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,RecoveryPlanName=RecoveryPlanName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryReprotectReplicationRecoveryPlan_ReprotectViaIdentity.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryReprotectReplicationRecoveryPlan_ReprotectViaIdentity.cs new file mode 100644 index 000000000000..fca55d805680 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryReprotectReplicationRecoveryPlan_ReprotectViaIdentity.cs @@ -0,0 +1,401 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to reprotect(reverse replicate) a recovery plan. + /// + /// [OpenAPI] Reprotect=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/reProtect" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Invoke, @"AzSiteRecoveryReprotectReplicationRecoveryPlan_ReprotectViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to reprotect(reverse replicate) a recovery plan.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class InvokeAzSiteRecoveryReprotectReplicationRecoveryPlan_ReprotectViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of InvokeAzSiteRecoveryReprotectReplicationRecoveryPlan_ReprotectViaIdentity + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.InvokeAzSiteRecoveryReprotectReplicationRecoveryPlan_ReprotectViaIdentity Clone() + { + var clone = new InvokeAzSiteRecoveryReprotectReplicationRecoveryPlan_ReprotectViaIdentity(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public InvokeAzSiteRecoveryReprotectReplicationRecoveryPlan_ReprotectViaIdentity() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationRecoveryPlansReprotect' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationRecoveryPlansReprotectViaIdentity(InputObject.Id, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.RecoveryPlanName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.RecoveryPlanName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationRecoveryPlansReprotect(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.RecoveryPlanName ?? null, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryResyncReplicationMigrationItem_Resync.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryResyncReplicationMigrationItem_Resync.cs new file mode 100644 index 000000000000..91b65e92e09f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryResyncReplicationMigrationItem_Resync.cs @@ -0,0 +1,476 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to resynchronize replication of an ASR migration item. + /// + /// [OpenAPI] Resync=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/resync" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Invoke, @"AzSiteRecoveryResyncReplicationMigrationItem_Resync", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to resynchronize replication of an ASR migration item.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class InvokeAzSiteRecoveryResyncReplicationMigrationItem_Resync : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// Fabric name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Fabric name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Fabric name.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncInput _input; + + /// Resync input. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Resync input.", ValueFromPipeline = true)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Resync input.", + SerializedName = @"input", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncInput) })] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncInput Input { get => this._input; set => this._input = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _migrationItemName; + + /// Migration item name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Migration item name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Migration item name.", + SerializedName = @"migrationItemName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string MigrationItemName { get => this._migrationItemName; set => this._migrationItemName = value; } + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _protectionContainerName; + + /// Protection container name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Protection container name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Protection container name.", + SerializedName = @"protectionContainerName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ProtectionContainerName { get => this._protectionContainerName; set => this._protectionContainerName = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of InvokeAzSiteRecoveryResyncReplicationMigrationItem_Resync + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.InvokeAzSiteRecoveryResyncReplicationMigrationItem_Resync Clone() + { + var clone = new InvokeAzSiteRecoveryResyncReplicationMigrationItem_Resync(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + clone.FabricName = this.FabricName; + clone.ProtectionContainerName = this.ProtectionContainerName; + clone.MigrationItemName = this.MigrationItemName; + clone.Input = this.Input; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public InvokeAzSiteRecoveryResyncReplicationMigrationItem_Resync() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationMigrationItemsResync' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationMigrationItemsResync(ResourceName, ResourceGroupName, SubscriptionId, FabricName, ProtectionContainerName, MigrationItemName, Input, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName,ProtectionContainerName=ProtectionContainerName,MigrationItemName=MigrationItemName,body=Input}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryResyncReplicationMigrationItem_ResyncExpanded.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryResyncReplicationMigrationItem_ResyncExpanded.cs new file mode 100644 index 000000000000..52bafde23333 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryResyncReplicationMigrationItem_ResyncExpanded.cs @@ -0,0 +1,478 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to resynchronize replication of an ASR migration item. + /// + /// [OpenAPI] Resync=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/resync" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Invoke, @"AzSiteRecoveryResyncReplicationMigrationItem_ResyncExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to resynchronize replication of an ASR migration item.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class InvokeAzSiteRecoveryResyncReplicationMigrationItem_ResyncExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Resync input. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncInput _inputBody = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ResyncInput(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// Fabric name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Fabric name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Fabric name.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _migrationItemName; + + /// Migration item name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Migration item name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Migration item name.", + SerializedName = @"migrationItemName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string MigrationItemName { get => this._migrationItemName; set => this._migrationItemName = value; } + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _protectionContainerName; + + /// Protection container name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Protection container name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Protection container name.", + SerializedName = @"protectionContainerName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ProtectionContainerName { get => this._protectionContainerName; set => this._protectionContainerName = value; } + + /// The class type. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The class type.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + public string ProviderSpecificDetailInstanceType { get => _inputBody.ProviderSpecificDetailInstanceType ?? null; set => _inputBody.ProviderSpecificDetailInstanceType = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of InvokeAzSiteRecoveryResyncReplicationMigrationItem_ResyncExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.InvokeAzSiteRecoveryResyncReplicationMigrationItem_ResyncExpanded Clone() + { + var clone = new InvokeAzSiteRecoveryResyncReplicationMigrationItem_ResyncExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._inputBody = this._inputBody; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + clone.FabricName = this.FabricName; + clone.ProtectionContainerName = this.ProtectionContainerName; + clone.MigrationItemName = this.MigrationItemName; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet + /// class. + /// + public InvokeAzSiteRecoveryResyncReplicationMigrationItem_ResyncExpanded() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationMigrationItemsResync' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationMigrationItemsResync(ResourceName, ResourceGroupName, SubscriptionId, FabricName, ProtectionContainerName, MigrationItemName, _inputBody, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName,ProtectionContainerName=ProtectionContainerName,MigrationItemName=MigrationItemName,body=_inputBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryResyncReplicationMigrationItem_ResyncViaIdentity.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryResyncReplicationMigrationItem_ResyncViaIdentity.cs new file mode 100644 index 000000000000..01713a84c1bd --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryResyncReplicationMigrationItem_ResyncViaIdentity.cs @@ -0,0 +1,423 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to resynchronize replication of an ASR migration item. + /// + /// [OpenAPI] Resync=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/resync" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Invoke, @"AzSiteRecoveryResyncReplicationMigrationItem_ResyncViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to resynchronize replication of an ASR migration item.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class InvokeAzSiteRecoveryResyncReplicationMigrationItem_ResyncViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncInput _input; + + /// Resync input. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Resync input.", ValueFromPipeline = true)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Resync input.", + SerializedName = @"input", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncInput) })] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncInput Input { get => this._input; set => this._input = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of InvokeAzSiteRecoveryResyncReplicationMigrationItem_ResyncViaIdentity + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.InvokeAzSiteRecoveryResyncReplicationMigrationItem_ResyncViaIdentity Clone() + { + var clone = new InvokeAzSiteRecoveryResyncReplicationMigrationItem_ResyncViaIdentity(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.Input = this.Input; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet + /// class. + /// + public InvokeAzSiteRecoveryResyncReplicationMigrationItem_ResyncViaIdentity() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationMigrationItemsResync' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationMigrationItemsResyncViaIdentity(InputObject.Id, Input, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.FabricName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.FabricName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ProtectionContainerName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ProtectionContainerName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.MigrationItemName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.MigrationItemName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationMigrationItemsResync(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.FabricName ?? null, InputObject.ProtectionContainerName ?? null, InputObject.MigrationItemName ?? null, Input, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=Input}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryResyncReplicationMigrationItem_ResyncViaIdentityExpanded.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryResyncReplicationMigrationItem_ResyncViaIdentityExpanded.cs new file mode 100644 index 000000000000..a595a8d3c279 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryResyncReplicationMigrationItem_ResyncViaIdentityExpanded.cs @@ -0,0 +1,424 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to resynchronize replication of an ASR migration item. + /// + /// [OpenAPI] Resync=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/resync" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Invoke, @"AzSiteRecoveryResyncReplicationMigrationItem_ResyncViaIdentityExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to resynchronize replication of an ASR migration item.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class InvokeAzSiteRecoveryResyncReplicationMigrationItem_ResyncViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Resync input. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResyncInput _inputBody = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ResyncInput(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The class type. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The class type.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + public string ProviderSpecificDetailInstanceType { get => _inputBody.ProviderSpecificDetailInstanceType ?? null; set => _inputBody.ProviderSpecificDetailInstanceType = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of InvokeAzSiteRecoveryResyncReplicationMigrationItem_ResyncViaIdentityExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.InvokeAzSiteRecoveryResyncReplicationMigrationItem_ResyncViaIdentityExpanded Clone() + { + var clone = new InvokeAzSiteRecoveryResyncReplicationMigrationItem_ResyncViaIdentityExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._inputBody = this._inputBody; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public InvokeAzSiteRecoveryResyncReplicationMigrationItem_ResyncViaIdentityExpanded() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationMigrationItemsResync' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationMigrationItemsResyncViaIdentity(InputObject.Id, _inputBody, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.FabricName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.FabricName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ProtectionContainerName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ProtectionContainerName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.MigrationItemName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.MigrationItemName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationMigrationItemsResync(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.FabricName ?? null, InputObject.ProtectionContainerName ?? null, InputObject.MigrationItemName ?? null, _inputBody, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=_inputBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryUnplannedReplicationProtectedItemFailover_Unplanned.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryUnplannedReplicationProtectedItemFailover_Unplanned.cs new file mode 100644 index 000000000000..c4a7aff08791 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryUnplannedReplicationProtectedItemFailover_Unplanned.cs @@ -0,0 +1,477 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Operation to initiate a failover of the replication protected item. + /// + /// [OpenAPI] UnplannedFailover=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/unplannedFailover" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Invoke, @"AzSiteRecoveryUnplannedReplicationProtectedItemFailover_Unplanned", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Operation to initiate a failover of the replication protected item.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class InvokeAzSiteRecoveryUnplannedReplicationProtectedItemFailover_Unplanned : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// Unique fabric name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Unique fabric name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Unique fabric name.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverInput _failoverInput; + + /// Input definition for unplanned failover. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Input definition for unplanned failover.", ValueFromPipeline = true)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Input definition for unplanned failover.", + SerializedName = @"failoverInput", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverInput) })] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverInput FailoverInput { get => this._failoverInput; set => this._failoverInput = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _protectionContainerName; + + /// Protection container name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Protection container name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Protection container name.", + SerializedName = @"protectionContainerName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ProtectionContainerName { get => this._protectionContainerName; set => this._protectionContainerName = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _replicatedProtectedItemName; + + /// Replication protected item name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Replication protected item name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Replication protected item name.", + SerializedName = @"replicatedProtectedItemName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ReplicatedProtectedItemName { get => this._replicatedProtectedItemName; set => this._replicatedProtectedItemName = value; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of InvokeAzSiteRecoveryUnplannedReplicationProtectedItemFailover_Unplanned + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.InvokeAzSiteRecoveryUnplannedReplicationProtectedItemFailover_Unplanned Clone() + { + var clone = new InvokeAzSiteRecoveryUnplannedReplicationProtectedItemFailover_Unplanned(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + clone.FabricName = this.FabricName; + clone.ProtectionContainerName = this.ProtectionContainerName; + clone.ReplicatedProtectedItemName = this.ReplicatedProtectedItemName; + clone.FailoverInput = this.FailoverInput; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the + /// cmdlet class. + /// + public InvokeAzSiteRecoveryUnplannedReplicationProtectedItemFailover_Unplanned() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationProtectedItemsUnplannedFailover' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationProtectedItemsUnplannedFailover(ResourceName, ResourceGroupName, SubscriptionId, FabricName, ProtectionContainerName, ReplicatedProtectedItemName, FailoverInput, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName,ProtectionContainerName=ProtectionContainerName,ReplicatedProtectedItemName=ReplicatedProtectedItemName,body=FailoverInput}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryUnplannedReplicationProtectedItemFailover_UnplannedExpanded.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryUnplannedReplicationProtectedItemFailover_UnplannedExpanded.cs new file mode 100644 index 000000000000..51c6d88ef81b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryUnplannedReplicationProtectedItemFailover_UnplannedExpanded.cs @@ -0,0 +1,500 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Operation to initiate a failover of the replication protected item. + /// + /// [OpenAPI] UnplannedFailover=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/unplannedFailover" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Invoke, @"AzSiteRecoveryUnplannedReplicationProtectedItemFailover_UnplannedExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Operation to initiate a failover of the replication protected item.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class InvokeAzSiteRecoveryUnplannedReplicationProtectedItemFailover_UnplannedExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Input definition for unplanned failover. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverInput _failoverInputBody = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UnplannedFailoverInput(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// Unique fabric name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Unique fabric name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Unique fabric name.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// Failover direction. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Failover direction.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Failover direction.", + SerializedName = @"failoverDirection", + PossibleTypes = new [] { typeof(string) })] + public string FailoverDirection { get => _failoverInputBody.FailoverDirection ?? null; set => _failoverInputBody.FailoverDirection = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _protectionContainerName; + + /// Protection container name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Protection container name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Protection container name.", + SerializedName = @"protectionContainerName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ProtectionContainerName { get => this._protectionContainerName; set => this._protectionContainerName = value; } + + /// The class type. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The class type.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + public string ProviderSpecificDetailInstanceType { get => _failoverInputBody.ProviderSpecificDetailInstanceType ?? null; set => _failoverInputBody.ProviderSpecificDetailInstanceType = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _replicatedProtectedItemName; + + /// Replication protected item name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Replication protected item name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Replication protected item name.", + SerializedName = @"replicatedProtectedItemName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ReplicatedProtectedItemName { get => this._replicatedProtectedItemName; set => this._replicatedProtectedItemName = value; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Source site operations status. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Source site operations status.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Source site operations status.", + SerializedName = @"sourceSiteOperations", + PossibleTypes = new [] { typeof(string) })] + public string SourceSiteOperation { get => _failoverInputBody.SourceSiteOperation ?? null; set => _failoverInputBody.SourceSiteOperation = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of InvokeAzSiteRecoveryUnplannedReplicationProtectedItemFailover_UnplannedExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.InvokeAzSiteRecoveryUnplannedReplicationProtectedItemFailover_UnplannedExpanded Clone() + { + var clone = new InvokeAzSiteRecoveryUnplannedReplicationProtectedItemFailover_UnplannedExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._failoverInputBody = this._failoverInputBody; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + clone.FabricName = this.FabricName; + clone.ProtectionContainerName = this.ProtectionContainerName; + clone.ReplicatedProtectedItemName = this.ReplicatedProtectedItemName; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public InvokeAzSiteRecoveryUnplannedReplicationProtectedItemFailover_UnplannedExpanded() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationProtectedItemsUnplannedFailover' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationProtectedItemsUnplannedFailover(ResourceName, ResourceGroupName, SubscriptionId, FabricName, ProtectionContainerName, ReplicatedProtectedItemName, _failoverInputBody, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName,ProtectionContainerName=ProtectionContainerName,ReplicatedProtectedItemName=ReplicatedProtectedItemName,body=_failoverInputBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryUnplannedReplicationProtectedItemFailover_UnplannedViaIdentity.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryUnplannedReplicationProtectedItemFailover_UnplannedViaIdentity.cs new file mode 100644 index 000000000000..7df9727d83b9 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryUnplannedReplicationProtectedItemFailover_UnplannedViaIdentity.cs @@ -0,0 +1,423 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Operation to initiate a failover of the replication protected item. + /// + /// [OpenAPI] UnplannedFailover=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/unplannedFailover" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Invoke, @"AzSiteRecoveryUnplannedReplicationProtectedItemFailover_UnplannedViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Operation to initiate a failover of the replication protected item.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class InvokeAzSiteRecoveryUnplannedReplicationProtectedItemFailover_UnplannedViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverInput _failoverInput; + + /// Input definition for unplanned failover. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Input definition for unplanned failover.", ValueFromPipeline = true)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Input definition for unplanned failover.", + SerializedName = @"failoverInput", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverInput) })] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverInput FailoverInput { get => this._failoverInput; set => this._failoverInput = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of InvokeAzSiteRecoveryUnplannedReplicationProtectedItemFailover_UnplannedViaIdentity + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.InvokeAzSiteRecoveryUnplannedReplicationProtectedItemFailover_UnplannedViaIdentity Clone() + { + var clone = new InvokeAzSiteRecoveryUnplannedReplicationProtectedItemFailover_UnplannedViaIdentity(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.FailoverInput = this.FailoverInput; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public InvokeAzSiteRecoveryUnplannedReplicationProtectedItemFailover_UnplannedViaIdentity() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationProtectedItemsUnplannedFailover' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationProtectedItemsUnplannedFailoverViaIdentity(InputObject.Id, FailoverInput, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.FabricName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.FabricName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ProtectionContainerName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ProtectionContainerName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ReplicatedProtectedItemName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ReplicatedProtectedItemName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationProtectedItemsUnplannedFailover(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.FabricName ?? null, InputObject.ProtectionContainerName ?? null, InputObject.ReplicatedProtectedItemName ?? null, FailoverInput, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=FailoverInput}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryUnplannedReplicationProtectedItemFailover_UnplannedViaIdentityExpanded.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryUnplannedReplicationProtectedItemFailover_UnplannedViaIdentityExpanded.cs new file mode 100644 index 000000000000..9bebcd496ad1 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryUnplannedReplicationProtectedItemFailover_UnplannedViaIdentityExpanded.cs @@ -0,0 +1,446 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Operation to initiate a failover of the replication protected item. + /// + /// [OpenAPI] UnplannedFailover=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/unplannedFailover" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Invoke, @"AzSiteRecoveryUnplannedReplicationProtectedItemFailover_UnplannedViaIdentityExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Operation to initiate a failover of the replication protected item.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class InvokeAzSiteRecoveryUnplannedReplicationProtectedItemFailover_UnplannedViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Input definition for unplanned failover. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUnplannedFailoverInput _failoverInputBody = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UnplannedFailoverInput(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Failover direction. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Failover direction.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Failover direction.", + SerializedName = @"failoverDirection", + PossibleTypes = new [] { typeof(string) })] + public string FailoverDirection { get => _failoverInputBody.FailoverDirection ?? null; set => _failoverInputBody.FailoverDirection = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The class type. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The class type.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + public string ProviderSpecificDetailInstanceType { get => _failoverInputBody.ProviderSpecificDetailInstanceType ?? null; set => _failoverInputBody.ProviderSpecificDetailInstanceType = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Source site operations status. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Source site operations status.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Source site operations status.", + SerializedName = @"sourceSiteOperations", + PossibleTypes = new [] { typeof(string) })] + public string SourceSiteOperation { get => _failoverInputBody.SourceSiteOperation ?? null; set => _failoverInputBody.SourceSiteOperation = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of InvokeAzSiteRecoveryUnplannedReplicationProtectedItemFailover_UnplannedViaIdentityExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.InvokeAzSiteRecoveryUnplannedReplicationProtectedItemFailover_UnplannedViaIdentityExpanded Clone() + { + var clone = new InvokeAzSiteRecoveryUnplannedReplicationProtectedItemFailover_UnplannedViaIdentityExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._failoverInputBody = this._failoverInputBody; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public InvokeAzSiteRecoveryUnplannedReplicationProtectedItemFailover_UnplannedViaIdentityExpanded() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationProtectedItemsUnplannedFailover' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationProtectedItemsUnplannedFailoverViaIdentity(InputObject.Id, _failoverInputBody, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.FabricName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.FabricName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ProtectionContainerName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ProtectionContainerName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ReplicatedProtectedItemName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ReplicatedProtectedItemName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationProtectedItemsUnplannedFailover(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.FabricName ?? null, InputObject.ProtectionContainerName ?? null, InputObject.ReplicatedProtectedItemName ?? null, _failoverInputBody, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=_failoverInputBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryUnplannedReplicationRecoveryPlanFailover_Unplanned.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryUnplannedReplicationRecoveryPlanFailover_Unplanned.cs new file mode 100644 index 000000000000..b29172761e7f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryUnplannedReplicationRecoveryPlanFailover_Unplanned.cs @@ -0,0 +1,447 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to start the unplanned failover of a recovery plan. + /// + /// [OpenAPI] UnplannedFailover=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/unplannedFailover" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Invoke, @"AzSiteRecoveryUnplannedReplicationRecoveryPlanFailover_Unplanned", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to start the unplanned failover of a recovery plan.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class InvokeAzSiteRecoveryUnplannedReplicationRecoveryPlanFailover_Unplanned : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanUnplannedFailoverInput _input; + + /// Recovery plan unplanned failover input. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Recovery plan unplanned failover input.", ValueFromPipeline = true)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Recovery plan unplanned failover input.", + SerializedName = @"input", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanUnplannedFailoverInput) })] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanUnplannedFailoverInput Input { get => this._input; set => this._input = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _recoveryPlanName; + + /// Recovery plan name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Recovery plan name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Recovery plan name.", + SerializedName = @"recoveryPlanName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string RecoveryPlanName { get => this._recoveryPlanName; set => this._recoveryPlanName = value; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of InvokeAzSiteRecoveryUnplannedReplicationRecoveryPlanFailover_Unplanned + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.InvokeAzSiteRecoveryUnplannedReplicationRecoveryPlanFailover_Unplanned Clone() + { + var clone = new InvokeAzSiteRecoveryUnplannedReplicationRecoveryPlanFailover_Unplanned(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + clone.RecoveryPlanName = this.RecoveryPlanName; + clone.Input = this.Input; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the + /// cmdlet class. + /// + public InvokeAzSiteRecoveryUnplannedReplicationRecoveryPlanFailover_Unplanned() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationRecoveryPlansUnplannedFailover' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationRecoveryPlansUnplannedFailover(ResourceName, ResourceGroupName, SubscriptionId, RecoveryPlanName, Input, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,RecoveryPlanName=RecoveryPlanName,body=Input}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryUnplannedReplicationRecoveryPlanFailover_UnplannedExpanded.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryUnplannedReplicationRecoveryPlanFailover_UnplannedExpanded.cs new file mode 100644 index 000000000000..e08518334d12 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryUnplannedReplicationRecoveryPlanFailover_UnplannedExpanded.cs @@ -0,0 +1,473 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to start the unplanned failover of a recovery plan. + /// + /// [OpenAPI] UnplannedFailover=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/unplannedFailover" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Invoke, @"AzSiteRecoveryUnplannedReplicationRecoveryPlanFailover_UnplannedExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to start the unplanned failover of a recovery plan.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class InvokeAzSiteRecoveryUnplannedReplicationRecoveryPlanFailover_UnplannedExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Recovery plan unplanned failover input. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanUnplannedFailoverInput _inputBody = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanUnplannedFailoverInput(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// The failover direction. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The failover direction.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The failover direction.", + SerializedName = @"failoverDirection", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections) })] + [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections))] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections FailoverDirection { get => _inputBody.FailoverDirection; set => _inputBody.FailoverDirection = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The provider specific properties. + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The provider specific properties.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The provider specific properties.", + SerializedName = @"providerSpecificDetails", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInput) })] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInput[] ProviderSpecificDetail { get => _inputBody.ProviderSpecificDetail ?? null /* arrayOf */; set => _inputBody.ProviderSpecificDetail = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _recoveryPlanName; + + /// Recovery plan name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Recovery plan name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Recovery plan name.", + SerializedName = @"recoveryPlanName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string RecoveryPlanName { get => this._recoveryPlanName; set => this._recoveryPlanName = value; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// A value indicating whether source site operations are required. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "A value indicating whether source site operations are required.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"A value indicating whether source site operations are required.", + SerializedName = @"sourceSiteOperations", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SourceSiteOperations) })] + [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SourceSiteOperations))] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SourceSiteOperations SourceSiteOperation { get => _inputBody.SourceSiteOperation; set => _inputBody.SourceSiteOperation = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of InvokeAzSiteRecoveryUnplannedReplicationRecoveryPlanFailover_UnplannedExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.InvokeAzSiteRecoveryUnplannedReplicationRecoveryPlanFailover_UnplannedExpanded Clone() + { + var clone = new InvokeAzSiteRecoveryUnplannedReplicationRecoveryPlanFailover_UnplannedExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._inputBody = this._inputBody; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + clone.RecoveryPlanName = this.RecoveryPlanName; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public InvokeAzSiteRecoveryUnplannedReplicationRecoveryPlanFailover_UnplannedExpanded() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationRecoveryPlansUnplannedFailover' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationRecoveryPlansUnplannedFailover(ResourceName, ResourceGroupName, SubscriptionId, RecoveryPlanName, _inputBody, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,RecoveryPlanName=RecoveryPlanName,body=_inputBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryUnplannedReplicationRecoveryPlanFailover_UnplannedViaIdentity.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryUnplannedReplicationRecoveryPlanFailover_UnplannedViaIdentity.cs new file mode 100644 index 000000000000..0b8b9a5f5a26 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryUnplannedReplicationRecoveryPlanFailover_UnplannedViaIdentity.cs @@ -0,0 +1,415 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to start the unplanned failover of a recovery plan. + /// + /// [OpenAPI] UnplannedFailover=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/unplannedFailover" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Invoke, @"AzSiteRecoveryUnplannedReplicationRecoveryPlanFailover_UnplannedViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to start the unplanned failover of a recovery plan.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class InvokeAzSiteRecoveryUnplannedReplicationRecoveryPlanFailover_UnplannedViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanUnplannedFailoverInput _input; + + /// Recovery plan unplanned failover input. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Recovery plan unplanned failover input.", ValueFromPipeline = true)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Recovery plan unplanned failover input.", + SerializedName = @"input", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanUnplannedFailoverInput) })] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanUnplannedFailoverInput Input { get => this._input; set => this._input = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of InvokeAzSiteRecoveryUnplannedReplicationRecoveryPlanFailover_UnplannedViaIdentity + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.InvokeAzSiteRecoveryUnplannedReplicationRecoveryPlanFailover_UnplannedViaIdentity Clone() + { + var clone = new InvokeAzSiteRecoveryUnplannedReplicationRecoveryPlanFailover_UnplannedViaIdentity(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.Input = this.Input; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public InvokeAzSiteRecoveryUnplannedReplicationRecoveryPlanFailover_UnplannedViaIdentity() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationRecoveryPlansUnplannedFailover' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationRecoveryPlansUnplannedFailoverViaIdentity(InputObject.Id, Input, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.RecoveryPlanName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.RecoveryPlanName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationRecoveryPlansUnplannedFailover(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.RecoveryPlanName ?? null, Input, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=Input}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryUnplannedReplicationRecoveryPlanFailover_UnplannedViaIdentityExpanded.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryUnplannedReplicationRecoveryPlanFailover_UnplannedViaIdentityExpanded.cs new file mode 100644 index 000000000000..82af932fca96 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/InvokeAzSiteRecoveryUnplannedReplicationRecoveryPlanFailover_UnplannedViaIdentityExpanded.cs @@ -0,0 +1,441 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to start the unplanned failover of a recovery plan. + /// + /// [OpenAPI] UnplannedFailover=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/unplannedFailover" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Invoke, @"AzSiteRecoveryUnplannedReplicationRecoveryPlanFailover_UnplannedViaIdentityExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to start the unplanned failover of a recovery plan.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class InvokeAzSiteRecoveryUnplannedReplicationRecoveryPlanFailover_UnplannedViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Recovery plan unplanned failover input. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanUnplannedFailoverInput _inputBody = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanUnplannedFailoverInput(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// The failover direction. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The failover direction.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The failover direction.", + SerializedName = @"failoverDirection", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections) })] + [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections))] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections FailoverDirection { get => _inputBody.FailoverDirection; set => _inputBody.FailoverDirection = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The provider specific properties. + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The provider specific properties.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The provider specific properties.", + SerializedName = @"providerSpecificDetails", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInput) })] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInput[] ProviderSpecificDetail { get => _inputBody.ProviderSpecificDetail ?? null /* arrayOf */; set => _inputBody.ProviderSpecificDetail = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// A value indicating whether source site operations are required. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "A value indicating whether source site operations are required.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"A value indicating whether source site operations are required.", + SerializedName = @"sourceSiteOperations", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SourceSiteOperations) })] + [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SourceSiteOperations))] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.SourceSiteOperations SourceSiteOperation { get => _inputBody.SourceSiteOperation; set => _inputBody.SourceSiteOperation = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of InvokeAzSiteRecoveryUnplannedReplicationRecoveryPlanFailover_UnplannedViaIdentityExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.InvokeAzSiteRecoveryUnplannedReplicationRecoveryPlanFailover_UnplannedViaIdentityExpanded Clone() + { + var clone = new InvokeAzSiteRecoveryUnplannedReplicationRecoveryPlanFailover_UnplannedViaIdentityExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._inputBody = this._inputBody; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public InvokeAzSiteRecoveryUnplannedReplicationRecoveryPlanFailover_UnplannedViaIdentityExpanded() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationRecoveryPlansUnplannedFailover' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationRecoveryPlansUnplannedFailoverViaIdentity(InputObject.Id, _inputBody, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.RecoveryPlanName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.RecoveryPlanName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationRecoveryPlansUnplannedFailover(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.RecoveryPlanName ?? null, _inputBody, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=_inputBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/MoveAzSiteRecoveryReplicationFabricGateway_Reassociate.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/MoveAzSiteRecoveryReplicationFabricGateway_Reassociate.cs new file mode 100644 index 000000000000..86513ac2a10f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/MoveAzSiteRecoveryReplicationFabricGateway_Reassociate.cs @@ -0,0 +1,446 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// + /// The operation to move replications from a process server to another process server. + /// + /// + /// [OpenAPI] ReassociateGateway=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/reassociateGateway" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Move, @"AzSiteRecoveryReplicationFabricGateway_Reassociate", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabric))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to move replications from a process server to another process server.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class MoveAzSiteRecoveryReplicationFabricGateway_Reassociate : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// The name of the fabric containing the process server. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the fabric containing the process server.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the fabric containing the process server.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverProcessServerRequest _failoverProcessServerRequest; + + /// Request to failover a process server. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Request to failover a process server.", ValueFromPipeline = true)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Request to failover a process server.", + SerializedName = @"failoverProcessServerRequest", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverProcessServerRequest) })] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverProcessServerRequest FailoverProcessServerRequest { get => this._failoverProcessServerRequest; set => this._failoverProcessServerRequest = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabric + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of MoveAzSiteRecoveryReplicationFabricGateway_Reassociate + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.MoveAzSiteRecoveryReplicationFabricGateway_Reassociate Clone() + { + var clone = new MoveAzSiteRecoveryReplicationFabricGateway_Reassociate(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + clone.FabricName = this.FabricName; + clone.FailoverProcessServerRequest = this.FailoverProcessServerRequest; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public MoveAzSiteRecoveryReplicationFabricGateway_Reassociate() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationFabricsReassociateGateway' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationFabricsReassociateGateway(ResourceName, ResourceGroupName, SubscriptionId, FabricName, FailoverProcessServerRequest, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName,body=FailoverProcessServerRequest}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabric + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabric + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/MoveAzSiteRecoveryReplicationFabricGateway_ReassociateExpanded.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/MoveAzSiteRecoveryReplicationFabricGateway_ReassociateExpanded.cs new file mode 100644 index 000000000000..556d0d18a6dc --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/MoveAzSiteRecoveryReplicationFabricGateway_ReassociateExpanded.cs @@ -0,0 +1,495 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// + /// The operation to move replications from a process server to another process server. + /// + /// + /// [OpenAPI] ReassociateGateway=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/reassociateGateway" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Move, @"AzSiteRecoveryReplicationFabricGateway_ReassociateExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabric))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to move replications from a process server to another process server.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class MoveAzSiteRecoveryReplicationFabricGateway_ReassociateExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Request to failover a process server. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverProcessServerRequest _failoverProcessServerRequestBody = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FailoverProcessServerRequest(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// The container identifier. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The container identifier.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The container identifier.", + SerializedName = @"containerName", + PossibleTypes = new [] { typeof(string) })] + public string ContainerName { get => _failoverProcessServerRequestBody.ContainerName ?? null; set => _failoverProcessServerRequestBody.ContainerName = value; } + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// The name of the fabric containing the process server. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the fabric containing the process server.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the fabric containing the process server.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// The source process server. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The source process server.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The source process server.", + SerializedName = @"sourceProcessServerId", + PossibleTypes = new [] { typeof(string) })] + public string SourceProcessServerId { get => _failoverProcessServerRequestBody.SourceProcessServerId ?? null; set => _failoverProcessServerRequestBody.SourceProcessServerId = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// The new process server. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The new process server.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The new process server.", + SerializedName = @"targetProcessServerId", + PossibleTypes = new [] { typeof(string) })] + public string TargetProcessServerId { get => _failoverProcessServerRequestBody.TargetProcessServerId ?? null; set => _failoverProcessServerRequestBody.TargetProcessServerId = value; } + + /// A value for failover type. It can be systemlevel/serverlevel. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "A value for failover type. It can be systemlevel/serverlevel.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value for failover type. It can be systemlevel/serverlevel.", + SerializedName = @"updateType", + PossibleTypes = new [] { typeof(string) })] + public string UpdateType { get => _failoverProcessServerRequestBody.UpdateType ?? null; set => _failoverProcessServerRequestBody.UpdateType = value; } + + /// The VMS to migrate. + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The VMS to migrate.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The VMS to migrate.", + SerializedName = @"vmsToMigrate", + PossibleTypes = new [] { typeof(string) })] + public string[] VmsToMigrate { get => _failoverProcessServerRequestBody.VmsToMigrate ?? null /* arrayOf */; set => _failoverProcessServerRequestBody.VmsToMigrate = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabric + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of MoveAzSiteRecoveryReplicationFabricGateway_ReassociateExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.MoveAzSiteRecoveryReplicationFabricGateway_ReassociateExpanded Clone() + { + var clone = new MoveAzSiteRecoveryReplicationFabricGateway_ReassociateExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._failoverProcessServerRequestBody = this._failoverProcessServerRequestBody; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + clone.FabricName = this.FabricName; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// + /// Intializes a new instance of the cmdlet + /// class. + /// + public MoveAzSiteRecoveryReplicationFabricGateway_ReassociateExpanded() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationFabricsReassociateGateway' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationFabricsReassociateGateway(ResourceName, ResourceGroupName, SubscriptionId, FabricName, _failoverProcessServerRequestBody, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName,body=_failoverProcessServerRequestBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabric + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabric + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/MoveAzSiteRecoveryReplicationFabricGateway_ReassociateViaIdentity.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/MoveAzSiteRecoveryReplicationFabricGateway_ReassociateViaIdentity.cs new file mode 100644 index 000000000000..3f073d504a89 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/MoveAzSiteRecoveryReplicationFabricGateway_ReassociateViaIdentity.cs @@ -0,0 +1,417 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// + /// The operation to move replications from a process server to another process server. + /// + /// + /// [OpenAPI] ReassociateGateway=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/reassociateGateway" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Move, @"AzSiteRecoveryReplicationFabricGateway_ReassociateViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabric))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to move replications from a process server to another process server.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class MoveAzSiteRecoveryReplicationFabricGateway_ReassociateViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverProcessServerRequest _failoverProcessServerRequest; + + /// Request to failover a process server. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Request to failover a process server.", ValueFromPipeline = true)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Request to failover a process server.", + SerializedName = @"failoverProcessServerRequest", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverProcessServerRequest) })] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverProcessServerRequest FailoverProcessServerRequest { get => this._failoverProcessServerRequest; set => this._failoverProcessServerRequest = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabric + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of MoveAzSiteRecoveryReplicationFabricGateway_ReassociateViaIdentity + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.MoveAzSiteRecoveryReplicationFabricGateway_ReassociateViaIdentity Clone() + { + var clone = new MoveAzSiteRecoveryReplicationFabricGateway_ReassociateViaIdentity(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.FailoverProcessServerRequest = this.FailoverProcessServerRequest; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// + /// Intializes a new instance of the cmdlet + /// class. + /// + public MoveAzSiteRecoveryReplicationFabricGateway_ReassociateViaIdentity() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationFabricsReassociateGateway' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationFabricsReassociateGatewayViaIdentity(InputObject.Id, FailoverProcessServerRequest, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.FabricName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.FabricName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationFabricsReassociateGateway(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.FabricName ?? null, FailoverProcessServerRequest, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=FailoverProcessServerRequest}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabric + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabric + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/MoveAzSiteRecoveryReplicationFabricGateway_ReassociateViaIdentityExpanded.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/MoveAzSiteRecoveryReplicationFabricGateway_ReassociateViaIdentityExpanded.cs new file mode 100644 index 000000000000..6a584e9e8ce9 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/MoveAzSiteRecoveryReplicationFabricGateway_ReassociateViaIdentityExpanded.cs @@ -0,0 +1,463 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// + /// The operation to move replications from a process server to another process server. + /// + /// + /// [OpenAPI] ReassociateGateway=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/reassociateGateway" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Move, @"AzSiteRecoveryReplicationFabricGateway_ReassociateViaIdentityExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabric))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to move replications from a process server to another process server.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class MoveAzSiteRecoveryReplicationFabricGateway_ReassociateViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Request to failover a process server. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFailoverProcessServerRequest _failoverProcessServerRequestBody = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FailoverProcessServerRequest(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// The container identifier. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The container identifier.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The container identifier.", + SerializedName = @"containerName", + PossibleTypes = new [] { typeof(string) })] + public string ContainerName { get => _failoverProcessServerRequestBody.ContainerName ?? null; set => _failoverProcessServerRequestBody.ContainerName = value; } + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// The source process server. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The source process server.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The source process server.", + SerializedName = @"sourceProcessServerId", + PossibleTypes = new [] { typeof(string) })] + public string SourceProcessServerId { get => _failoverProcessServerRequestBody.SourceProcessServerId ?? null; set => _failoverProcessServerRequestBody.SourceProcessServerId = value; } + + /// The new process server. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The new process server.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The new process server.", + SerializedName = @"targetProcessServerId", + PossibleTypes = new [] { typeof(string) })] + public string TargetProcessServerId { get => _failoverProcessServerRequestBody.TargetProcessServerId ?? null; set => _failoverProcessServerRequestBody.TargetProcessServerId = value; } + + /// A value for failover type. It can be systemlevel/serverlevel. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "A value for failover type. It can be systemlevel/serverlevel.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value for failover type. It can be systemlevel/serverlevel.", + SerializedName = @"updateType", + PossibleTypes = new [] { typeof(string) })] + public string UpdateType { get => _failoverProcessServerRequestBody.UpdateType ?? null; set => _failoverProcessServerRequestBody.UpdateType = value; } + + /// The VMS to migrate. + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The VMS to migrate.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The VMS to migrate.", + SerializedName = @"vmsToMigrate", + PossibleTypes = new [] { typeof(string) })] + public string[] VmsToMigrate { get => _failoverProcessServerRequestBody.VmsToMigrate ?? null /* arrayOf */; set => _failoverProcessServerRequestBody.VmsToMigrate = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabric + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of MoveAzSiteRecoveryReplicationFabricGateway_ReassociateViaIdentityExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.MoveAzSiteRecoveryReplicationFabricGateway_ReassociateViaIdentityExpanded Clone() + { + var clone = new MoveAzSiteRecoveryReplicationFabricGateway_ReassociateViaIdentityExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._failoverProcessServerRequestBody = this._failoverProcessServerRequestBody; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public MoveAzSiteRecoveryReplicationFabricGateway_ReassociateViaIdentityExpanded() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationFabricsReassociateGateway' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationFabricsReassociateGatewayViaIdentity(InputObject.Id, _failoverProcessServerRequestBody, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.FabricName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.FabricName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationFabricsReassociateGateway(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.FabricName ?? null, _failoverProcessServerRequestBody, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=_failoverProcessServerRequestBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabric + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabric + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/MoveAzSiteRecoveryReplicationFabricToAad_Migrate.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/MoveAzSiteRecoveryReplicationFabricToAad_Migrate.cs new file mode 100644 index 000000000000..89d4b93fb7bc --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/MoveAzSiteRecoveryReplicationFabricToAad_Migrate.cs @@ -0,0 +1,435 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to migrate an Azure Site Recovery fabric to AAD. + /// + /// [OpenAPI] MigrateToAad=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/migratetoaad" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Move, @"AzSiteRecoveryReplicationFabricToAad_Migrate", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to migrate an Azure Site Recovery fabric to AAD.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class MoveAzSiteRecoveryReplicationFabricToAad_Migrate : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// ASR fabric to migrate. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "ASR fabric to migrate.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"ASR fabric to migrate.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of MoveAzSiteRecoveryReplicationFabricToAad_Migrate + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.MoveAzSiteRecoveryReplicationFabricToAad_Migrate Clone() + { + var clone = new MoveAzSiteRecoveryReplicationFabricToAad_Migrate(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + clone.FabricName = this.FabricName; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public MoveAzSiteRecoveryReplicationFabricToAad_Migrate() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationFabricsMigrateToAad' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationFabricsMigrateToAad(ResourceName, ResourceGroupName, SubscriptionId, FabricName, onNoContent, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/MoveAzSiteRecoveryReplicationFabricToAad_MigrateViaIdentity.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/MoveAzSiteRecoveryReplicationFabricToAad_MigrateViaIdentity.cs new file mode 100644 index 000000000000..95fa6a688fb5 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/MoveAzSiteRecoveryReplicationFabricToAad_MigrateViaIdentity.cs @@ -0,0 +1,405 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to migrate an Azure Site Recovery fabric to AAD. + /// + /// [OpenAPI] MigrateToAad=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/migratetoaad" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Move, @"AzSiteRecoveryReplicationFabricToAad_MigrateViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to migrate an Azure Site Recovery fabric to AAD.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class MoveAzSiteRecoveryReplicationFabricToAad_MigrateViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of MoveAzSiteRecoveryReplicationFabricToAad_MigrateViaIdentity + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.MoveAzSiteRecoveryReplicationFabricToAad_MigrateViaIdentity Clone() + { + var clone = new MoveAzSiteRecoveryReplicationFabricToAad_MigrateViaIdentity(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public MoveAzSiteRecoveryReplicationFabricToAad_MigrateViaIdentity() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationFabricsMigrateToAad' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationFabricsMigrateToAadViaIdentity(InputObject.Id, onNoContent, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.FabricName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.FabricName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationFabricsMigrateToAad(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.FabricName ?? null, onNoContent, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/MoveAzSiteRecoveryReplicationMigrationItem_Migrate.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/MoveAzSiteRecoveryReplicationMigrationItem_Migrate.cs new file mode 100644 index 000000000000..91b01d7d7cd3 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/MoveAzSiteRecoveryReplicationMigrationItem_Migrate.cs @@ -0,0 +1,474 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to initiate migration of the item. + /// + /// [OpenAPI] Migrate=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/migrate" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Move, @"AzSiteRecoveryReplicationMigrationItem_Migrate", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to initiate migration of the item.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class MoveAzSiteRecoveryReplicationMigrationItem_Migrate : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// Fabric name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Fabric name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Fabric name.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateInput _migrateInput; + + /// Input for migrate. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Input for migrate.", ValueFromPipeline = true)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Input for migrate.", + SerializedName = @"migrateInput", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateInput) })] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateInput MigrateInput { get => this._migrateInput; set => this._migrateInput = value; } + + /// Backing field for property. + private string _migrationItemName; + + /// Migration item name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Migration item name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Migration item name.", + SerializedName = @"migrationItemName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string MigrationItemName { get => this._migrationItemName; set => this._migrationItemName = value; } + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _protectionContainerName; + + /// Protection container name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Protection container name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Protection container name.", + SerializedName = @"protectionContainerName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ProtectionContainerName { get => this._protectionContainerName; set => this._protectionContainerName = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of MoveAzSiteRecoveryReplicationMigrationItem_Migrate + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.MoveAzSiteRecoveryReplicationMigrationItem_Migrate Clone() + { + var clone = new MoveAzSiteRecoveryReplicationMigrationItem_Migrate(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + clone.FabricName = this.FabricName; + clone.ProtectionContainerName = this.ProtectionContainerName; + clone.MigrationItemName = this.MigrationItemName; + clone.MigrateInput = this.MigrateInput; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public MoveAzSiteRecoveryReplicationMigrationItem_Migrate() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationMigrationItemsMigrate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationMigrationItemsMigrate(ResourceName, ResourceGroupName, SubscriptionId, FabricName, ProtectionContainerName, MigrationItemName, MigrateInput, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName,ProtectionContainerName=ProtectionContainerName,MigrationItemName=MigrationItemName,body=MigrateInput}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/MoveAzSiteRecoveryReplicationMigrationItem_MigrateExpanded.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/MoveAzSiteRecoveryReplicationMigrationItem_MigrateExpanded.cs new file mode 100644 index 000000000000..82ca585f3585 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/MoveAzSiteRecoveryReplicationMigrationItem_MigrateExpanded.cs @@ -0,0 +1,477 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to initiate migration of the item. + /// + /// [OpenAPI] Migrate=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/migrate" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Move, @"AzSiteRecoveryReplicationMigrationItem_MigrateExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to initiate migration of the item.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class MoveAzSiteRecoveryReplicationMigrationItem_MigrateExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Input for migrate. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateInput _migrateInputBody = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.MigrateInput(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// Fabric name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Fabric name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Fabric name.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _migrationItemName; + + /// Migration item name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Migration item name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Migration item name.", + SerializedName = @"migrationItemName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string MigrationItemName { get => this._migrationItemName; set => this._migrationItemName = value; } + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _protectionContainerName; + + /// Protection container name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Protection container name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Protection container name.", + SerializedName = @"protectionContainerName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ProtectionContainerName { get => this._protectionContainerName; set => this._protectionContainerName = value; } + + /// The class type. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The class type.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + public string ProviderSpecificDetailInstanceType { get => _migrateInputBody.ProviderSpecificDetailInstanceType ?? null; set => _migrateInputBody.ProviderSpecificDetailInstanceType = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of MoveAzSiteRecoveryReplicationMigrationItem_MigrateExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.MoveAzSiteRecoveryReplicationMigrationItem_MigrateExpanded Clone() + { + var clone = new MoveAzSiteRecoveryReplicationMigrationItem_MigrateExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._migrateInputBody = this._migrateInputBody; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + clone.FabricName = this.FabricName; + clone.ProtectionContainerName = this.ProtectionContainerName; + clone.MigrationItemName = this.MigrationItemName; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public MoveAzSiteRecoveryReplicationMigrationItem_MigrateExpanded() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationMigrationItemsMigrate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationMigrationItemsMigrate(ResourceName, ResourceGroupName, SubscriptionId, FabricName, ProtectionContainerName, MigrationItemName, _migrateInputBody, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName,ProtectionContainerName=ProtectionContainerName,MigrationItemName=MigrationItemName,body=_migrateInputBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/MoveAzSiteRecoveryReplicationMigrationItem_MigrateViaIdentity.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/MoveAzSiteRecoveryReplicationMigrationItem_MigrateViaIdentity.cs new file mode 100644 index 000000000000..c07cec6d9958 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/MoveAzSiteRecoveryReplicationMigrationItem_MigrateViaIdentity.cs @@ -0,0 +1,422 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to initiate migration of the item. + /// + /// [OpenAPI] Migrate=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/migrate" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Move, @"AzSiteRecoveryReplicationMigrationItem_MigrateViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to initiate migration of the item.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class MoveAzSiteRecoveryReplicationMigrationItem_MigrateViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateInput _migrateInput; + + /// Input for migrate. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Input for migrate.", ValueFromPipeline = true)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Input for migrate.", + SerializedName = @"migrateInput", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateInput) })] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateInput MigrateInput { get => this._migrateInput; set => this._migrateInput = value; } + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of MoveAzSiteRecoveryReplicationMigrationItem_MigrateViaIdentity + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.MoveAzSiteRecoveryReplicationMigrationItem_MigrateViaIdentity Clone() + { + var clone = new MoveAzSiteRecoveryReplicationMigrationItem_MigrateViaIdentity(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.MigrateInput = this.MigrateInput; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public MoveAzSiteRecoveryReplicationMigrationItem_MigrateViaIdentity() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationMigrationItemsMigrate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationMigrationItemsMigrateViaIdentity(InputObject.Id, MigrateInput, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.FabricName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.FabricName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ProtectionContainerName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ProtectionContainerName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.MigrationItemName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.MigrationItemName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationMigrationItemsMigrate(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.FabricName ?? null, InputObject.ProtectionContainerName ?? null, InputObject.MigrationItemName ?? null, MigrateInput, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=MigrateInput}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/MoveAzSiteRecoveryReplicationMigrationItem_MigrateViaIdentityExpanded.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/MoveAzSiteRecoveryReplicationMigrationItem_MigrateViaIdentityExpanded.cs new file mode 100644 index 000000000000..8ef19c0a66e8 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/MoveAzSiteRecoveryReplicationMigrationItem_MigrateViaIdentityExpanded.cs @@ -0,0 +1,424 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to initiate migration of the item. + /// + /// [OpenAPI] Migrate=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/migrate" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Move, @"AzSiteRecoveryReplicationMigrationItem_MigrateViaIdentityExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to initiate migration of the item.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class MoveAzSiteRecoveryReplicationMigrationItem_MigrateViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Input for migrate. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrateInput _migrateInputBody = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.MigrateInput(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The class type. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The class type.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + public string ProviderSpecificDetailInstanceType { get => _migrateInputBody.ProviderSpecificDetailInstanceType ?? null; set => _migrateInputBody.ProviderSpecificDetailInstanceType = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of MoveAzSiteRecoveryReplicationMigrationItem_MigrateViaIdentityExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.MoveAzSiteRecoveryReplicationMigrationItem_MigrateViaIdentityExpanded Clone() + { + var clone = new MoveAzSiteRecoveryReplicationMigrationItem_MigrateViaIdentityExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._migrateInputBody = this._migrateInputBody; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// + /// Intializes a new instance of the + /// cmdlet class. + /// + public MoveAzSiteRecoveryReplicationMigrationItem_MigrateViaIdentityExpanded() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationMigrationItemsMigrate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationMigrationItemsMigrateViaIdentity(InputObject.Id, _migrateInputBody, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.FabricName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.FabricName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ProtectionContainerName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ProtectionContainerName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.MigrationItemName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.MigrationItemName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationMigrationItemsMigrate(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.FabricName ?? null, InputObject.ProtectionContainerName ?? null, InputObject.MigrationItemName ?? null, _migrateInputBody, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=_migrateInputBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/NewAzSiteRecoveryReplicationAlertSetting_CreateExpanded.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/NewAzSiteRecoveryReplicationAlertSetting_CreateExpanded.cs new file mode 100644 index 000000000000..3d2fb49b27f2 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/NewAzSiteRecoveryReplicationAlertSetting_CreateExpanded.cs @@ -0,0 +1,400 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Create or update an email notification(alert) configuration. + /// + /// [OpenAPI] Create=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationAlertSettings/{alertSettingName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzSiteRecoveryReplicationAlertSetting_CreateExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlert))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Create or update an email notification(alert) configuration.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class NewAzSiteRecoveryReplicationAlertSetting_CreateExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Request to configure alerts for the system. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IConfigureAlertRequest _requestBody = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ConfigureAlertRequest(); + + /// Backing field for property. + private string _alertSettingName; + + /// The name of the email notification(alert) configuration. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the email notification(alert) configuration.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the email notification(alert) configuration.", + SerializedName = @"alertSettingName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string AlertSettingName { get => this._alertSettingName; set => this._alertSettingName = value; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// The custom email address for sending emails. + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The custom email address for sending emails.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The custom email address for sending emails.", + SerializedName = @"customEmailAddresses", + PossibleTypes = new [] { typeof(string) })] + public string[] CustomEmailAddress { get => _requestBody.CustomEmailAddress ?? null /* arrayOf */; set => _requestBody.CustomEmailAddress = value; } + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// The locale for the email notification. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The locale for the email notification.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The locale for the email notification.", + SerializedName = @"locale", + PossibleTypes = new [] { typeof(string) })] + public string Locale { get => _requestBody.Locale ?? null; set => _requestBody.Locale = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// A value indicating whether to send email to subscription administrator. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "A value indicating whether to send email to subscription administrator.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A value indicating whether to send email to subscription administrator.", + SerializedName = @"sendToOwners", + PossibleTypes = new [] { typeof(string) })] + public string SendToOwner { get => _requestBody.SendToOwner ?? null; set => _requestBody.SendToOwner = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlert + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public NewAzSiteRecoveryReplicationAlertSetting_CreateExpanded() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationAlertSettingsCreate' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationAlertSettingsCreate(ResourceName, ResourceGroupName, SubscriptionId, AlertSettingName, _requestBody, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,AlertSettingName=AlertSettingName,body=_requestBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlert + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAlert + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/NewAzSiteRecoveryReplicationFabric_CreateExpanded.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/NewAzSiteRecoveryReplicationFabric_CreateExpanded.cs new file mode 100644 index 000000000000..09621f3b22df --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/NewAzSiteRecoveryReplicationFabric_CreateExpanded.cs @@ -0,0 +1,445 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to create an Azure Site Recovery fabric (for e.g. Hyper-V site). + /// + /// [OpenAPI] Create=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzSiteRecoveryReplicationFabric_CreateExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabric))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to create an Azure Site Recovery fabric (for e.g. Hyper-V site).")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class NewAzSiteRecoveryReplicationFabric_CreateExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Site details provided during the time of site creation. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabricCreationInput _inputBody = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.FabricCreationInput(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// Gets the class type. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Gets the class type.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets the class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + public string CustomDetailInstanceType { get => _inputBody.CustomDetailInstanceType ?? null; set => _inputBody.CustomDetailInstanceType = value; } + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// Name of the ASR fabric. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name of the ASR fabric.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name of the ASR fabric.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabric + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of NewAzSiteRecoveryReplicationFabric_CreateExpanded + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.NewAzSiteRecoveryReplicationFabric_CreateExpanded Clone() + { + var clone = new NewAzSiteRecoveryReplicationFabric_CreateExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._inputBody = this._inputBody; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + clone.FabricName = this.FabricName; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public NewAzSiteRecoveryReplicationFabric_CreateExpanded() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationFabricsCreate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationFabricsCreate(ResourceName, ResourceGroupName, SubscriptionId, FabricName, _inputBody, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName,body=_inputBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabric + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabric + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/NewAzSiteRecoveryReplicationMigrationItem_CreateExpanded.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/NewAzSiteRecoveryReplicationMigrationItem_CreateExpanded.cs new file mode 100644 index 000000000000..0b435b92ca32 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/NewAzSiteRecoveryReplicationMigrationItem_CreateExpanded.cs @@ -0,0 +1,488 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to create an ASR migration item (enable migration). + /// + /// [OpenAPI] Create=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzSiteRecoveryReplicationMigrationItem_CreateExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to create an ASR migration item (enable migration).")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class NewAzSiteRecoveryReplicationMigrationItem_CreateExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Enable migration input. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableMigrationInput _inputBody = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EnableMigrationInput(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// Fabric name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Fabric name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Fabric name.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _migrationItemName; + + /// Migration item name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Migration item name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Migration item name.", + SerializedName = @"migrationItemName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string MigrationItemName { get => this._migrationItemName; set => this._migrationItemName = value; } + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The policy Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The policy Id.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The policy Id.", + SerializedName = @"policyId", + PossibleTypes = new [] { typeof(string) })] + public string PolicyId { get => _inputBody.PolicyId ?? null; set => _inputBody.PolicyId = value; } + + /// Backing field for property. + private string _protectionContainerName; + + /// Protection container name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Protection container name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Protection container name.", + SerializedName = @"protectionContainerName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ProtectionContainerName { get => this._protectionContainerName; set => this._protectionContainerName = value; } + + /// The class type. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The class type.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + public string ProviderSpecificDetailInstanceType { get => _inputBody.ProviderSpecificDetailInstanceType ?? null; set => _inputBody.ProviderSpecificDetailInstanceType = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of NewAzSiteRecoveryReplicationMigrationItem_CreateExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.NewAzSiteRecoveryReplicationMigrationItem_CreateExpanded Clone() + { + var clone = new NewAzSiteRecoveryReplicationMigrationItem_CreateExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._inputBody = this._inputBody; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + clone.FabricName = this.FabricName; + clone.ProtectionContainerName = this.ProtectionContainerName; + clone.MigrationItemName = this.MigrationItemName; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public NewAzSiteRecoveryReplicationMigrationItem_CreateExpanded() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationMigrationItemsCreate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationMigrationItemsCreate(ResourceName, ResourceGroupName, SubscriptionId, FabricName, ProtectionContainerName, MigrationItemName, _inputBody, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName,ProtectionContainerName=ProtectionContainerName,MigrationItemName=MigrationItemName,body=_inputBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/NewAzSiteRecoveryReplicationNetworkMapping_CreateExpanded.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/NewAzSiteRecoveryReplicationNetworkMapping_CreateExpanded.cs new file mode 100644 index 000000000000..d9c14cd92f66 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/NewAzSiteRecoveryReplicationNetworkMapping_CreateExpanded.cs @@ -0,0 +1,499 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to create an ASR network mapping. + /// + /// [OpenAPI] Create=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}/replicationNetworkMappings/{networkMappingName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzSiteRecoveryReplicationNetworkMapping_CreateExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMapping))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to create an ASR network mapping.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class NewAzSiteRecoveryReplicationNetworkMapping_CreateExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Create network mappings input. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateNetworkMappingInput _inputBody = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.CreateNetworkMappingInput(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// Primary fabric name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Primary fabric name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Primary fabric name.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// The instance type. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The instance type.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The instance type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + public string FabricSpecificDetailInstanceType { get => _inputBody.FabricSpecificDetailInstanceType ?? null; set => _inputBody.FabricSpecificDetailInstanceType = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _networkMappingName; + + /// Network mapping name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Network mapping name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Network mapping name.", + SerializedName = @"networkMappingName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string NetworkMappingName { get => this._networkMappingName; set => this._networkMappingName = value; } + + /// Backing field for property. + private string _networkName; + + /// Primary network name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Primary network name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Primary network name.", + SerializedName = @"networkName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string NetworkName { get => this._networkName; set => this._networkName = value; } + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Recovery fabric Name. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Recovery fabric Name.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Recovery fabric Name.", + SerializedName = @"recoveryFabricName", + PossibleTypes = new [] { typeof(string) })] + public string RecoveryFabricName { get => _inputBody.RecoveryFabricName ?? null; set => _inputBody.RecoveryFabricName = value; } + + /// Recovery network Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Recovery network Id.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Recovery network Id.", + SerializedName = @"recoveryNetworkId", + PossibleTypes = new [] { typeof(string) })] + public string RecoveryNetworkId { get => _inputBody.RecoveryNetworkId ?? null; set => _inputBody.RecoveryNetworkId = value; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMapping + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of NewAzSiteRecoveryReplicationNetworkMapping_CreateExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.NewAzSiteRecoveryReplicationNetworkMapping_CreateExpanded Clone() + { + var clone = new NewAzSiteRecoveryReplicationNetworkMapping_CreateExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._inputBody = this._inputBody; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + clone.FabricName = this.FabricName; + clone.NetworkName = this.NetworkName; + clone.NetworkMappingName = this.NetworkMappingName; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public NewAzSiteRecoveryReplicationNetworkMapping_CreateExpanded() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationNetworkMappingsCreate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationNetworkMappingsCreate(ResourceName, ResourceGroupName, SubscriptionId, FabricName, NetworkName, NetworkMappingName, _inputBody, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName,NetworkName=NetworkName,NetworkMappingName=NetworkMappingName,body=_inputBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMapping + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMapping + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/NewAzSiteRecoveryReplicationPolicy_CreateExpanded.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/NewAzSiteRecoveryReplicationPolicy_CreateExpanded.cs new file mode 100644 index 000000000000..fa5ea2f37217 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/NewAzSiteRecoveryReplicationPolicy_CreateExpanded.cs @@ -0,0 +1,445 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to create a replication policy. + /// + /// [OpenAPI] Create=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationPolicies/{policyName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzSiteRecoveryReplicationPolicy_CreateExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicy))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to create a replication policy.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class NewAzSiteRecoveryReplicationPolicy_CreateExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Protection Policy input. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreatePolicyInput _inputBody = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.CreatePolicyInput(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _policyName; + + /// Replication policy name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Replication policy name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Replication policy name.", + SerializedName = @"policyName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string PolicyName { get => this._policyName; set => this._policyName = value; } + + /// The class type. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The class type.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + public string ProviderSpecificInputInstanceType { get => _inputBody.ProviderSpecificInputInstanceType ?? null; set => _inputBody.ProviderSpecificInputInstanceType = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicy + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of NewAzSiteRecoveryReplicationPolicy_CreateExpanded + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.NewAzSiteRecoveryReplicationPolicy_CreateExpanded Clone() + { + var clone = new NewAzSiteRecoveryReplicationPolicy_CreateExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._inputBody = this._inputBody; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + clone.PolicyName = this.PolicyName; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public NewAzSiteRecoveryReplicationPolicy_CreateExpanded() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationPoliciesCreate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationPoliciesCreate(ResourceName, ResourceGroupName, SubscriptionId, PolicyName, _inputBody, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,PolicyName=PolicyName,body=_inputBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicy + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicy + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/NewAzSiteRecoveryReplicationProtectedItem_CreateExpanded.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/NewAzSiteRecoveryReplicationProtectedItem_CreateExpanded.cs new file mode 100644 index 000000000000..3d20a8e1a7c8 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/NewAzSiteRecoveryReplicationProtectedItem_CreateExpanded.cs @@ -0,0 +1,499 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to create an ASR replication protected item (Enable replication). + /// + /// [OpenAPI] Create=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzSiteRecoveryReplicationProtectedItem_CreateExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to create an ASR replication protected item (Enable replication).")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class NewAzSiteRecoveryReplicationProtectedItem_CreateExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Enable protection input. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IEnableProtectionInput _inputBody = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.EnableProtectionInput(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// Name of the fabric. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name of the fabric.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name of the fabric.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The Policy Id. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The Policy Id.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Policy Id.", + SerializedName = @"policyId", + PossibleTypes = new [] { typeof(string) })] + public string PolicyId { get => _inputBody.PolicyId ?? null; set => _inputBody.PolicyId = value; } + + /// The protectable item Id. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The protectable item Id.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The protectable item Id.", + SerializedName = @"protectableItemId", + PossibleTypes = new [] { typeof(string) })] + public string ProtectableItemId { get => _inputBody.ProtectableItemId ?? null; set => _inputBody.ProtectableItemId = value; } + + /// Backing field for property. + private string _protectionContainerName; + + /// Protection container name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Protection container name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Protection container name.", + SerializedName = @"protectionContainerName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ProtectionContainerName { get => this._protectionContainerName; set => this._protectionContainerName = value; } + + /// The class type. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The class type.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + public string ProviderSpecificDetailInstanceType { get => _inputBody.ProviderSpecificDetailInstanceType ?? null; set => _inputBody.ProviderSpecificDetailInstanceType = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _replicatedProtectedItemName; + + /// A name for the replication protected item. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "A name for the replication protected item.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"A name for the replication protected item.", + SerializedName = @"replicatedProtectedItemName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ReplicatedProtectedItemName { get => this._replicatedProtectedItemName; set => this._replicatedProtectedItemName = value; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of NewAzSiteRecoveryReplicationProtectedItem_CreateExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.NewAzSiteRecoveryReplicationProtectedItem_CreateExpanded Clone() + { + var clone = new NewAzSiteRecoveryReplicationProtectedItem_CreateExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._inputBody = this._inputBody; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + clone.FabricName = this.FabricName; + clone.ProtectionContainerName = this.ProtectionContainerName; + clone.ReplicatedProtectedItemName = this.ReplicatedProtectedItemName; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public NewAzSiteRecoveryReplicationProtectedItem_CreateExpanded() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationProtectedItemsCreate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationProtectedItemsCreate(ResourceName, ResourceGroupName, SubscriptionId, FabricName, ProtectionContainerName, ReplicatedProtectedItemName, _inputBody, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName,ProtectionContainerName=ProtectionContainerName,ReplicatedProtectedItemName=ReplicatedProtectedItemName,body=_inputBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/NewAzSiteRecoveryReplicationProtectionContainerMapping_CreateExpanded.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/NewAzSiteRecoveryReplicationProtectionContainerMapping_CreateExpanded.cs new file mode 100644 index 000000000000..1c046672d704 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/NewAzSiteRecoveryReplicationProtectionContainerMapping_CreateExpanded.cs @@ -0,0 +1,500 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to create a protection container mapping. + /// + /// [OpenAPI] Create=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings/{mappingName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzSiteRecoveryReplicationProtectionContainerMapping_CreateExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMapping))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to create a protection container mapping.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class NewAzSiteRecoveryReplicationProtectionContainerMapping_CreateExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Configure pairing input. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerMappingInput _creationInputBody = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.CreateProtectionContainerMappingInput(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// Fabric name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Fabric name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Fabric name.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// Backing field for property. + private string _mappingName; + + /// Protection container mapping name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Protection container mapping name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Protection container mapping name.", + SerializedName = @"mappingName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string MappingName { get => this._mappingName; set => this._mappingName = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// Applicable policy. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Applicable policy.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Applicable policy.", + SerializedName = @"policyId", + PossibleTypes = new [] { typeof(string) })] + public string PolicyId { get => _creationInputBody.PolicyId ?? null; set => _creationInputBody.PolicyId = value; } + + /// Backing field for property. + private string _protectionContainerName; + + /// Protection container name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Protection container name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Protection container name.", + SerializedName = @"protectionContainerName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ProtectionContainerName { get => this._protectionContainerName; set => this._protectionContainerName = value; } + + /// The class type. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The class type.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + public string ProviderSpecificInputInstanceType { get => _creationInputBody.ProviderSpecificInputInstanceType ?? null; set => _creationInputBody.ProviderSpecificInputInstanceType = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// The target unique protection container name. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The target unique protection container name.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target unique protection container name.", + SerializedName = @"targetProtectionContainerId", + PossibleTypes = new [] { typeof(string) })] + public string TargetProtectionContainerId { get => _creationInputBody.TargetProtectionContainerId ?? null; set => _creationInputBody.TargetProtectionContainerId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMapping + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of NewAzSiteRecoveryReplicationProtectionContainerMapping_CreateExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.NewAzSiteRecoveryReplicationProtectionContainerMapping_CreateExpanded Clone() + { + var clone = new NewAzSiteRecoveryReplicationProtectionContainerMapping_CreateExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._creationInputBody = this._creationInputBody; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + clone.FabricName = this.FabricName; + clone.ProtectionContainerName = this.ProtectionContainerName; + clone.MappingName = this.MappingName; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// + /// Intializes a new instance of the + /// cmdlet class. + /// + public NewAzSiteRecoveryReplicationProtectionContainerMapping_CreateExpanded() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationProtectionContainerMappingsCreate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationProtectionContainerMappingsCreate(ResourceName, ResourceGroupName, SubscriptionId, FabricName, ProtectionContainerName, MappingName, _creationInputBody, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName,ProtectionContainerName=ProtectionContainerName,MappingName=MappingName,body=_creationInputBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMapping + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMapping + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/NewAzSiteRecoveryReplicationProtectionContainer_CreateExpanded.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/NewAzSiteRecoveryReplicationProtectionContainer_CreateExpanded.cs new file mode 100644 index 000000000000..dc1c7fff7c8d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/NewAzSiteRecoveryReplicationProtectionContainer_CreateExpanded.cs @@ -0,0 +1,464 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Operation to create a protection container. + /// + /// [OpenAPI] Create=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzSiteRecoveryReplicationProtectionContainer_CreateExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainer))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Operation to create a protection container.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class NewAzSiteRecoveryReplicationProtectionContainer_CreateExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Create protection container input. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionContainerInput _creationInputBody = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.CreateProtectionContainerInput(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// Unique fabric ARM name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Unique fabric ARM name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Unique fabric ARM name.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _protectionContainerName; + + /// Unique protection container ARM name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Unique protection container ARM name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Unique protection container ARM name.", + SerializedName = @"protectionContainerName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ProtectionContainerName { get => this._protectionContainerName; set => this._protectionContainerName = value; } + + /// Provider specific inputs for container creation. + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Provider specific inputs for container creation.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Provider specific inputs for container creation.", + SerializedName = @"providerSpecificInput", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerCreationInput) })] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProviderSpecificContainerCreationInput[] ProviderSpecificInput { get => _creationInputBody.ProviderSpecificInput ?? null /* arrayOf */; set => _creationInputBody.ProviderSpecificInput = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainer + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of NewAzSiteRecoveryReplicationProtectionContainer_CreateExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.NewAzSiteRecoveryReplicationProtectionContainer_CreateExpanded Clone() + { + var clone = new NewAzSiteRecoveryReplicationProtectionContainer_CreateExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._creationInputBody = this._creationInputBody; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + clone.FabricName = this.FabricName; + clone.ProtectionContainerName = this.ProtectionContainerName; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// + /// Intializes a new instance of the cmdlet + /// class. + /// + public NewAzSiteRecoveryReplicationProtectionContainer_CreateExpanded() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationProtectionContainersCreate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationProtectionContainersCreate(ResourceName, ResourceGroupName, SubscriptionId, FabricName, ProtectionContainerName, _creationInputBody, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName,ProtectionContainerName=ProtectionContainerName,body=_creationInputBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainer + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainer + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/NewAzSiteRecoveryReplicationProtectionIntent_CreateExpanded.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/NewAzSiteRecoveryReplicationProtectionIntent_CreateExpanded.cs new file mode 100644 index 000000000000..09d5a8efc29d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/NewAzSiteRecoveryReplicationProtectionIntent_CreateExpanded.cs @@ -0,0 +1,377 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to create an ASR replication protection intent item. + /// + /// [OpenAPI] Create=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationProtectionIntents/{intentObjectName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzSiteRecoveryReplicationProtectionIntent_CreateExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntent))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to create an ASR replication protection intent item.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class NewAzSiteRecoveryReplicationProtectionIntent_CreateExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Create protection intent input. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateProtectionIntentInput _inputBody = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.CreateProtectionIntentInput(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private string _intentObjectName; + + /// A name for the replication protection item. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "A name for the replication protection item.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"A name for the replication protection item.", + SerializedName = @"intentObjectName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string IntentObjectName { get => this._intentObjectName; set => this._intentObjectName = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The class type. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The class type.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + public string ProviderSpecificDetailInstanceType { get => _inputBody.ProviderSpecificDetailInstanceType ?? null; set => _inputBody.ProviderSpecificDetailInstanceType = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntent + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public NewAzSiteRecoveryReplicationProtectionIntent_CreateExpanded() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationProtectionIntentsCreate' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationProtectionIntentsCreate(ResourceName, ResourceGroupName, SubscriptionId, IntentObjectName, _inputBody, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,IntentObjectName=IntentObjectName,body=_inputBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntent + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectionIntent + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/NewAzSiteRecoveryReplicationRecoveryPlan_CreateExpanded.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/NewAzSiteRecoveryReplicationRecoveryPlan_CreateExpanded.cs new file mode 100644 index 000000000000..a81c0acfba04 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/NewAzSiteRecoveryReplicationRecoveryPlan_CreateExpanded.cs @@ -0,0 +1,492 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to create a recovery plan. + /// + /// [OpenAPI] Create=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzSiteRecoveryReplicationRecoveryPlan_CreateExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to create a recovery plan.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class NewAzSiteRecoveryReplicationRecoveryPlan_CreateExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Create recovery plan input class. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ICreateRecoveryPlanInput _inputBody = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.CreateRecoveryPlanInput(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// The failover deployment model. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The failover deployment model.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The failover deployment model.", + SerializedName = @"failoverDeploymentModel", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.FailoverDeploymentModel) })] + [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.FailoverDeploymentModel))] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.FailoverDeploymentModel FailoverDeploymentModel { get => _inputBody.FailoverDeploymentModel ?? ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.FailoverDeploymentModel)""); set => _inputBody.FailoverDeploymentModel = value; } + + /// The recovery plan groups. + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The recovery plan groups.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The recovery plan groups.", + SerializedName = @"groups", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroup) })] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroup[] Group { get => _inputBody.Group ?? null /* arrayOf */; set => _inputBody.Group = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The primary fabric Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The primary fabric Id.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The primary fabric Id.", + SerializedName = @"primaryFabricId", + PossibleTypes = new [] { typeof(string) })] + public string PrimaryFabricId { get => _inputBody.PrimaryFabricId ?? null; set => _inputBody.PrimaryFabricId = value; } + + /// The provider specific input. + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The provider specific input.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The provider specific input.", + SerializedName = @"providerSpecificInput", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificInput) })] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificInput[] ProviderSpecificInput { get => _inputBody.ProviderSpecificInput ?? null /* arrayOf */; set => _inputBody.ProviderSpecificInput = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// The recovery fabric Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The recovery fabric Id.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The recovery fabric Id.", + SerializedName = @"recoveryFabricId", + PossibleTypes = new [] { typeof(string) })] + public string RecoveryFabricId { get => _inputBody.RecoveryFabricId ?? null; set => _inputBody.RecoveryFabricId = value; } + + /// Backing field for property. + private string _recoveryPlanName; + + /// Recovery plan name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Recovery plan name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Recovery plan name.", + SerializedName = @"recoveryPlanName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string RecoveryPlanName { get => this._recoveryPlanName; set => this._recoveryPlanName = value; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of NewAzSiteRecoveryReplicationRecoveryPlan_CreateExpanded + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.NewAzSiteRecoveryReplicationRecoveryPlan_CreateExpanded Clone() + { + var clone = new NewAzSiteRecoveryReplicationRecoveryPlan_CreateExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._inputBody = this._inputBody; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + clone.RecoveryPlanName = this.RecoveryPlanName; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public NewAzSiteRecoveryReplicationRecoveryPlan_CreateExpanded() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationRecoveryPlansCreate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationRecoveryPlansCreate(ResourceName, ResourceGroupName, SubscriptionId, RecoveryPlanName, _inputBody, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,RecoveryPlanName=RecoveryPlanName,body=_inputBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/NewAzSiteRecoveryReplicationRecoveryServicesProvider_CreateExpanded.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/NewAzSiteRecoveryReplicationRecoveryServicesProvider_CreateExpanded.cs new file mode 100644 index 000000000000..e7f598b36a3b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/NewAzSiteRecoveryReplicationRecoveryServicesProvider_CreateExpanded.cs @@ -0,0 +1,686 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to add a recovery services provider. + /// + /// [OpenAPI] Create=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders/{providerName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzSiteRecoveryReplicationRecoveryServicesProvider_CreateExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProvider))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to add a recovery services provider.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class NewAzSiteRecoveryReplicationRecoveryServicesProvider_CreateExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// Input required to add a provider. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddRecoveryServicesProviderInput _addProviderInputBody = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AddRecoveryServicesProviderInput(); + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// The base authority for Azure Active Directory authentication. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The base authority for Azure Active Directory authentication.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The base authority for Azure Active Directory authentication.", + SerializedName = @"aadAuthority", + PossibleTypes = new [] { typeof(string) })] + public string AuthenticationIdentityInputAadAuthority { get => _addProviderInputBody.AuthenticationIdentityInputAadAuthority ?? null; set => _addProviderInputBody.AuthenticationIdentityInputAadAuthority = value; } + + /// + /// The application/client Id for the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The application/client Id for the service principal with which the on-premise management/data plane components would communicate with our Azure services.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The application/client Id for the service principal with which the on-premise management/data plane components would communicate with our Azure services.", + SerializedName = @"applicationId", + PossibleTypes = new [] { typeof(string) })] + public string AuthenticationIdentityInputApplicationId { get => _addProviderInputBody.AuthenticationIdentityInputApplicationId ?? null; set => _addProviderInputBody.AuthenticationIdentityInputApplicationId = value; } + + /// + /// The intended Audience of the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The intended Audience of the service principal with which the on-premise management/data plane components would communicate with our Azure services.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The intended Audience of the service principal with which the on-premise management/data plane components would communicate with our Azure services.", + SerializedName = @"audience", + PossibleTypes = new [] { typeof(string) })] + public string AuthenticationIdentityInputAudience { get => _addProviderInputBody.AuthenticationIdentityInputAudience ?? null; set => _addProviderInputBody.AuthenticationIdentityInputAudience = value; } + + /// + /// The object Id of the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The object Id of the service principal with which the on-premise management/data plane components would communicate with our Azure services.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The object Id of the service principal with which the on-premise management/data plane components would communicate with our Azure services.", + SerializedName = @"objectId", + PossibleTypes = new [] { typeof(string) })] + public string AuthenticationIdentityInputObjectId { get => _addProviderInputBody.AuthenticationIdentityInputObjectId ?? null; set => _addProviderInputBody.AuthenticationIdentityInputObjectId = value; } + + /// + /// The tenant Id for the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The tenant Id for the service principal with which the on-premise management/data plane components would communicate with our Azure services.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The tenant Id for the service principal with which the on-premise management/data plane components would communicate with our Azure services.", + SerializedName = @"tenantId", + PossibleTypes = new [] { typeof(string) })] + public string AuthenticationIdentityInputTenantId { get => _addProviderInputBody.AuthenticationIdentityInputTenantId ?? null; set => _addProviderInputBody.AuthenticationIdentityInputTenantId = value; } + + /// The Bios Id of the machine. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The Bios Id of the machine.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Bios Id of the machine.", + SerializedName = @"biosId", + PossibleTypes = new [] { typeof(string) })] + public string BiosId { get => _addProviderInputBody.BiosId ?? null; set => _addProviderInputBody.BiosId = value; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// The base authority for Azure Active Directory authentication. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The base authority for Azure Active Directory authentication.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The base authority for Azure Active Directory authentication.", + SerializedName = @"aadAuthority", + PossibleTypes = new [] { typeof(string) })] + public string DataPlaneAuthenticationIdentityInputAadAuthority { get => _addProviderInputBody.DataPlaneAuthenticationIdentityInputAadAuthority ?? null; set => _addProviderInputBody.DataPlaneAuthenticationIdentityInputAadAuthority = value; } + + /// + /// The application/client Id for the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The application/client Id for the service principal with which the on-premise management/data plane components would communicate with our Azure services.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The application/client Id for the service principal with which the on-premise management/data plane components would communicate with our Azure services.", + SerializedName = @"applicationId", + PossibleTypes = new [] { typeof(string) })] + public string DataPlaneAuthenticationIdentityInputApplicationId { get => _addProviderInputBody.DataPlaneAuthenticationIdentityInputApplicationId ?? null; set => _addProviderInputBody.DataPlaneAuthenticationIdentityInputApplicationId = value; } + + /// + /// The intended Audience of the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The intended Audience of the service principal with which the on-premise management/data plane components would communicate with our Azure services.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The intended Audience of the service principal with which the on-premise management/data plane components would communicate with our Azure services.", + SerializedName = @"audience", + PossibleTypes = new [] { typeof(string) })] + public string DataPlaneAuthenticationIdentityInputAudience { get => _addProviderInputBody.DataPlaneAuthenticationIdentityInputAudience ?? null; set => _addProviderInputBody.DataPlaneAuthenticationIdentityInputAudience = value; } + + /// + /// The object Id of the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The object Id of the service principal with which the on-premise management/data plane components would communicate with our Azure services.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The object Id of the service principal with which the on-premise management/data plane components would communicate with our Azure services.", + SerializedName = @"objectId", + PossibleTypes = new [] { typeof(string) })] + public string DataPlaneAuthenticationIdentityInputObjectId { get => _addProviderInputBody.DataPlaneAuthenticationIdentityInputObjectId ?? null; set => _addProviderInputBody.DataPlaneAuthenticationIdentityInputObjectId = value; } + + /// + /// The tenant Id for the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The tenant Id for the service principal with which the on-premise management/data plane components would communicate with our Azure services.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The tenant Id for the service principal with which the on-premise management/data plane components would communicate with our Azure services.", + SerializedName = @"tenantId", + PossibleTypes = new [] { typeof(string) })] + public string DataPlaneAuthenticationIdentityInputTenantId { get => _addProviderInputBody.DataPlaneAuthenticationIdentityInputTenantId ?? null; set => _addProviderInputBody.DataPlaneAuthenticationIdentityInputTenantId = value; } + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// Fabric name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Fabric name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Fabric name.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// The Id of the machine where the provider is getting added. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The Id of the machine where the provider is getting added.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Id of the machine where the provider is getting added.", + SerializedName = @"machineId", + PossibleTypes = new [] { typeof(string) })] + public string MachineId { get => _addProviderInputBody.MachineId ?? null; set => _addProviderInputBody.MachineId = value; } + + /// The name of the machine where the provider is getting added. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the machine where the provider is getting added.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the machine where the provider is getting added.", + SerializedName = @"machineName", + PossibleTypes = new [] { typeof(string) })] + public string MachineName { get => _addProviderInputBody.MachineName ?? null; set => _addProviderInputBody.MachineName = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _providerName; + + /// Recovery services provider name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Recovery services provider name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Recovery services provider name.", + SerializedName = @"providerName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ProviderName { get => this._providerName; set => this._providerName = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// The base authority for Azure Active Directory authentication. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The base authority for Azure Active Directory authentication.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The base authority for Azure Active Directory authentication.", + SerializedName = @"aadAuthority", + PossibleTypes = new [] { typeof(string) })] + public string ResourceAccessIdentityInputAadAuthority { get => _addProviderInputBody.ResourceAccessIdentityInputAadAuthority ?? null; set => _addProviderInputBody.ResourceAccessIdentityInputAadAuthority = value; } + + /// + /// The application/client Id for the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The application/client Id for the service principal with which the on-premise management/data plane components would communicate with our Azure services.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The application/client Id for the service principal with which the on-premise management/data plane components would communicate with our Azure services.", + SerializedName = @"applicationId", + PossibleTypes = new [] { typeof(string) })] + public string ResourceAccessIdentityInputApplicationId { get => _addProviderInputBody.ResourceAccessIdentityInputApplicationId ?? null; set => _addProviderInputBody.ResourceAccessIdentityInputApplicationId = value; } + + /// + /// The intended Audience of the service principal with which the on-premise management/data plane components would communicate + /// with our Azure services. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The intended Audience of the service principal with which the on-premise management/data plane components would communicate with our Azure services.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The intended Audience of the service principal with which the on-premise management/data plane components would communicate with our Azure services.", + SerializedName = @"audience", + PossibleTypes = new [] { typeof(string) })] + public string ResourceAccessIdentityInputAudience { get => _addProviderInputBody.ResourceAccessIdentityInputAudience ?? null; set => _addProviderInputBody.ResourceAccessIdentityInputAudience = value; } + + /// + /// The object Id of the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The object Id of the service principal with which the on-premise management/data plane components would communicate with our Azure services.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The object Id of the service principal with which the on-premise management/data plane components would communicate with our Azure services.", + SerializedName = @"objectId", + PossibleTypes = new [] { typeof(string) })] + public string ResourceAccessIdentityInputObjectId { get => _addProviderInputBody.ResourceAccessIdentityInputObjectId ?? null; set => _addProviderInputBody.ResourceAccessIdentityInputObjectId = value; } + + /// + /// The tenant Id for the service principal with which the on-premise management/data plane components would communicate with + /// our Azure services. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The tenant Id for the service principal with which the on-premise management/data plane components would communicate with our Azure services.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The tenant Id for the service principal with which the on-premise management/data plane components would communicate with our Azure services.", + SerializedName = @"tenantId", + PossibleTypes = new [] { typeof(string) })] + public string ResourceAccessIdentityInputTenantId { get => _addProviderInputBody.ResourceAccessIdentityInputTenantId ?? null; set => _addProviderInputBody.ResourceAccessIdentityInputTenantId = value; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProvider + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of NewAzSiteRecoveryReplicationRecoveryServicesProvider_CreateExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.NewAzSiteRecoveryReplicationRecoveryServicesProvider_CreateExpanded Clone() + { + var clone = new NewAzSiteRecoveryReplicationRecoveryServicesProvider_CreateExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._addProviderInputBody = this._addProviderInputBody; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + clone.FabricName = this.FabricName; + clone.ProviderName = this.ProviderName; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// + /// Intializes a new instance of the cmdlet + /// class. + /// + public NewAzSiteRecoveryReplicationRecoveryServicesProvider_CreateExpanded() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationRecoveryServicesProvidersCreate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationRecoveryServicesProvidersCreate(ResourceName, ResourceGroupName, SubscriptionId, FabricName, ProviderName, _addProviderInputBody, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName,ProviderName=ProviderName,body=_addProviderInputBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProvider + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProvider + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/NewAzSiteRecoveryReplicationStorageClassificationMapping_CreateExpanded.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/NewAzSiteRecoveryReplicationStorageClassificationMapping_CreateExpanded.cs new file mode 100644 index 000000000000..a00e59f837fc --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/NewAzSiteRecoveryReplicationStorageClassificationMapping_CreateExpanded.cs @@ -0,0 +1,478 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to create a storage classification mapping. + /// + /// [OpenAPI] Create=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationStorageClassifications/{storageClassificationName}/replicationStorageClassificationMappings/{storageClassificationMappingName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzSiteRecoveryReplicationStorageClassificationMapping_CreateExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMapping))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to create a storage classification mapping.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class NewAzSiteRecoveryReplicationStorageClassificationMapping_CreateExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Storage mapping input. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMappingInput _pairingInputBody = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.StorageClassificationMappingInput(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// Fabric name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Fabric name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Fabric name.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _storageClassificationMappingName; + + /// Storage classification mapping name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Storage classification mapping name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Storage classification mapping name.", + SerializedName = @"storageClassificationMappingName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string StorageClassificationMappingName { get => this._storageClassificationMappingName; set => this._storageClassificationMappingName = value; } + + /// Backing field for property. + private string _storageClassificationName; + + /// Storage classification name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Storage classification name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Storage classification name.", + SerializedName = @"storageClassificationName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string StorageClassificationName { get => this._storageClassificationName; set => this._storageClassificationName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// The ID of the storage object. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The ID of the storage object.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The ID of the storage object.", + SerializedName = @"targetStorageClassificationId", + PossibleTypes = new [] { typeof(string) })] + public string TargetStorageClassificationId { get => _pairingInputBody.TargetStorageClassificationId ?? null; set => _pairingInputBody.TargetStorageClassificationId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMapping + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of NewAzSiteRecoveryReplicationStorageClassificationMapping_CreateExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.NewAzSiteRecoveryReplicationStorageClassificationMapping_CreateExpanded Clone() + { + var clone = new NewAzSiteRecoveryReplicationStorageClassificationMapping_CreateExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._pairingInputBody = this._pairingInputBody; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + clone.FabricName = this.FabricName; + clone.StorageClassificationName = this.StorageClassificationName; + clone.StorageClassificationMappingName = this.StorageClassificationMappingName; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// + /// Intializes a new instance of the + /// cmdlet class. + /// + public NewAzSiteRecoveryReplicationStorageClassificationMapping_CreateExpanded() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationStorageClassificationMappingsCreate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationStorageClassificationMappingsCreate(ResourceName, ResourceGroupName, SubscriptionId, FabricName, StorageClassificationName, StorageClassificationMappingName, _pairingInputBody, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName,StorageClassificationName=StorageClassificationName,StorageClassificationMappingName=StorageClassificationMappingName,body=_pairingInputBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMapping + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IStorageClassificationMapping + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/NewAzSiteRecoveryReplicationVaultSetting_CreateExpanded.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/NewAzSiteRecoveryReplicationVaultSetting_CreateExpanded.cs new file mode 100644 index 000000000000..e83495bc6ba2 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/NewAzSiteRecoveryReplicationVaultSetting_CreateExpanded.cs @@ -0,0 +1,456 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to configure vault setting. + /// + /// [OpenAPI] Create=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationVaultSettings/{vaultSettingName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzSiteRecoveryReplicationVaultSetting_CreateExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSetting))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to configure vault setting.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class NewAzSiteRecoveryReplicationVaultSetting_CreateExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Input to create vault setting. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSettingCreationInput _inputBody = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.VaultSettingCreationInput(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// The migration solution Id. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The migration solution Id.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The migration solution Id.", + SerializedName = @"migrationSolutionId", + PossibleTypes = new [] { typeof(string) })] + public string MigrationSolutionId { get => _inputBody.MigrationSolutionId ?? null; set => _inputBody.MigrationSolutionId = value; } + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Backing field for property. + private string _vaultSettingName; + + /// Vault setting name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Vault setting name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Vault setting name.", + SerializedName = @"vaultSettingName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string VaultSettingName { get => this._vaultSettingName; set => this._vaultSettingName = value; } + + /// VMware to Azure provider type. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "VMware to Azure provider type.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"VMware to Azure provider type.", + SerializedName = @"vmwareToAzureProviderType", + PossibleTypes = new [] { typeof(string) })] + public string VmwareToAzureProviderType { get => _inputBody.VmwareToAzureProviderType ?? null; set => _inputBody.VmwareToAzureProviderType = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSetting + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of NewAzSiteRecoveryReplicationVaultSetting_CreateExpanded + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.NewAzSiteRecoveryReplicationVaultSetting_CreateExpanded Clone() + { + var clone = new NewAzSiteRecoveryReplicationVaultSetting_CreateExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._inputBody = this._inputBody; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + clone.VaultSettingName = this.VaultSettingName; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public NewAzSiteRecoveryReplicationVaultSetting_CreateExpanded() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationVaultSettingCreate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationVaultSettingCreate(ResourceName, ResourceGroupName, SubscriptionId, VaultSettingName, _inputBody, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,VaultSettingName=VaultSettingName,body=_inputBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSetting + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultSetting + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/NewAzSiteRecoveryReplicationvCenter_CreateExpanded.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/NewAzSiteRecoveryReplicationvCenter_CreateExpanded.cs new file mode 100644 index 000000000000..4900eecdcc3f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/NewAzSiteRecoveryReplicationvCenter_CreateExpanded.cs @@ -0,0 +1,504 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to create a vCenter object.. + /// + /// [OpenAPI] Create=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationvCenters/{vcenterName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzSiteRecoveryReplicationvCenter_CreateExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenter))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to create a vCenter object..")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class NewAzSiteRecoveryReplicationvCenter_CreateExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// Input required to add vCenter. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IAddVCenterRequest _addVCenterRequestBody = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.AddVCenterRequest(); + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// Fabric name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Fabric name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Fabric name.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// The friendly name of the vCenter. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The friendly name of the vCenter.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The friendly name of the vCenter.", + SerializedName = @"friendlyName", + PossibleTypes = new [] { typeof(string) })] + public string FriendlyName { get => _addVCenterRequestBody.FriendlyName ?? null; set => _addVCenterRequestBody.FriendlyName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// The IP address of the vCenter to be discovered. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The IP address of the vCenter to be discovered.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The IP address of the vCenter to be discovered.", + SerializedName = @"ipAddress", + PossibleTypes = new [] { typeof(string) })] + public string IPAddress { get => _addVCenterRequestBody.IPAddress ?? null; set => _addVCenterRequestBody.IPAddress = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The port number for discovery. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The port number for discovery.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The port number for discovery.", + SerializedName = @"port", + PossibleTypes = new [] { typeof(string) })] + public string Port { get => _addVCenterRequestBody.Port ?? null; set => _addVCenterRequestBody.Port = value; } + + /// The process server Id from where the discovery is orchestrated. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The process server Id from where the discovery is orchestrated.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The process server Id from where the discovery is orchestrated.", + SerializedName = @"processServerId", + PossibleTypes = new [] { typeof(string) })] + public string ProcessServerId { get => _addVCenterRequestBody.ProcessServerId ?? null; set => _addVCenterRequestBody.ProcessServerId = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// The account Id which has privileges to discover the vCenter. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The account Id which has privileges to discover the vCenter.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The account Id which has privileges to discover the vCenter.", + SerializedName = @"runAsAccountId", + PossibleTypes = new [] { typeof(string) })] + public string RunAsAccountId { get => _addVCenterRequestBody.RunAsAccountId ?? null; set => _addVCenterRequestBody.RunAsAccountId = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Backing field for property. + private string _vcenterName; + + /// vcenter name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "vcenter name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"vcenter name.", + SerializedName = @"vcenterName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string VcenterName { get => this._vcenterName; set => this._vcenterName = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenter + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of NewAzSiteRecoveryReplicationvCenter_CreateExpanded + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.NewAzSiteRecoveryReplicationvCenter_CreateExpanded Clone() + { + var clone = new NewAzSiteRecoveryReplicationvCenter_CreateExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._addVCenterRequestBody = this._addVCenterRequestBody; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + clone.FabricName = this.FabricName; + clone.VcenterName = this.VcenterName; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public NewAzSiteRecoveryReplicationvCenter_CreateExpanded() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationvCentersCreate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationvCentersCreate(ResourceName, ResourceGroupName, SubscriptionId, FabricName, VcenterName, _addVCenterRequestBody, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName,VcenterName=VcenterName,body=_addVCenterRequestBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenter + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenter + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RemoveAzSiteRecoveryReplicationFabric_Delete.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RemoveAzSiteRecoveryReplicationFabric_Delete.cs new file mode 100644 index 000000000000..6ae21c040911 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RemoveAzSiteRecoveryReplicationFabric_Delete.cs @@ -0,0 +1,435 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to delete or remove an Azure Site Recovery fabric. + /// + /// [OpenAPI] Delete=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/remove" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzSiteRecoveryReplicationFabric_Delete", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to delete or remove an Azure Site Recovery fabric.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class RemoveAzSiteRecoveryReplicationFabric_Delete : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// ASR fabric to delete. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "ASR fabric to delete.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"ASR fabric to delete.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of RemoveAzSiteRecoveryReplicationFabric_Delete + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.RemoveAzSiteRecoveryReplicationFabric_Delete Clone() + { + var clone = new RemoveAzSiteRecoveryReplicationFabric_Delete(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + clone.FabricName = this.FabricName; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationFabricsDelete' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationFabricsDelete(ResourceName, ResourceGroupName, SubscriptionId, FabricName, onNoContent, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public RemoveAzSiteRecoveryReplicationFabric_Delete() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RemoveAzSiteRecoveryReplicationFabric_DeleteViaIdentity.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RemoveAzSiteRecoveryReplicationFabric_DeleteViaIdentity.cs new file mode 100644 index 000000000000..bccaada4429e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RemoveAzSiteRecoveryReplicationFabric_DeleteViaIdentity.cs @@ -0,0 +1,403 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to delete or remove an Azure Site Recovery fabric. + /// + /// [OpenAPI] Delete=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/remove" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzSiteRecoveryReplicationFabric_DeleteViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to delete or remove an Azure Site Recovery fabric.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class RemoveAzSiteRecoveryReplicationFabric_DeleteViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of RemoveAzSiteRecoveryReplicationFabric_DeleteViaIdentity + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.RemoveAzSiteRecoveryReplicationFabric_DeleteViaIdentity Clone() + { + var clone = new RemoveAzSiteRecoveryReplicationFabric_DeleteViaIdentity(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationFabricsDelete' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationFabricsDeleteViaIdentity(InputObject.Id, onNoContent, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.FabricName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.FabricName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationFabricsDelete(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.FabricName ?? null, onNoContent, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public RemoveAzSiteRecoveryReplicationFabric_DeleteViaIdentity() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RemoveAzSiteRecoveryReplicationMigrationItem_Delete.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RemoveAzSiteRecoveryReplicationMigrationItem_Delete.cs new file mode 100644 index 000000000000..8ec91063bc55 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RemoveAzSiteRecoveryReplicationMigrationItem_Delete.cs @@ -0,0 +1,480 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to delete an ASR migration item. + /// + /// [OpenAPI] Delete=>DELETE:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzSiteRecoveryReplicationMigrationItem_Delete", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to delete an ASR migration item.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class RemoveAzSiteRecoveryReplicationMigrationItem_Delete : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _deleteOption; + + /// The delete option. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The delete option.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The delete option.", + SerializedName = @"deleteOption", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Query)] + public string DeleteOption { get => this._deleteOption; set => this._deleteOption = value; } + + /// Backing field for property. + private string _fabricName; + + /// Fabric name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Fabric name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Fabric name.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _migrationItemName; + + /// Migration item name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Migration item name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Migration item name.", + SerializedName = @"migrationItemName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string MigrationItemName { get => this._migrationItemName; set => this._migrationItemName = value; } + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _protectionContainerName; + + /// Protection container name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Protection container name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Protection container name.", + SerializedName = @"protectionContainerName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ProtectionContainerName { get => this._protectionContainerName; set => this._protectionContainerName = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of RemoveAzSiteRecoveryReplicationMigrationItem_Delete + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.RemoveAzSiteRecoveryReplicationMigrationItem_Delete Clone() + { + var clone = new RemoveAzSiteRecoveryReplicationMigrationItem_Delete(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + clone.FabricName = this.FabricName; + clone.ProtectionContainerName = this.ProtectionContainerName; + clone.MigrationItemName = this.MigrationItemName; + clone.DeleteOption = this.DeleteOption; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationMigrationItemsDelete' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationMigrationItemsDelete(ResourceName, ResourceGroupName, SubscriptionId, FabricName, ProtectionContainerName, MigrationItemName, this.InvocationInformation.BoundParameters.ContainsKey("DeleteOption") ? DeleteOption : null, onNoContent, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName,ProtectionContainerName=ProtectionContainerName,MigrationItemName=MigrationItemName,DeleteOption=this.InvocationInformation.BoundParameters.ContainsKey("DeleteOption") ? DeleteOption : null}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public RemoveAzSiteRecoveryReplicationMigrationItem_Delete() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RemoveAzSiteRecoveryReplicationMigrationItem_DeleteViaIdentity.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RemoveAzSiteRecoveryReplicationMigrationItem_DeleteViaIdentity.cs new file mode 100644 index 000000000000..8f5a024f2552 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RemoveAzSiteRecoveryReplicationMigrationItem_DeleteViaIdentity.cs @@ -0,0 +1,429 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to delete an ASR migration item. + /// + /// [OpenAPI] Delete=>DELETE:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzSiteRecoveryReplicationMigrationItem_DeleteViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to delete an ASR migration item.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class RemoveAzSiteRecoveryReplicationMigrationItem_DeleteViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _deleteOption; + + /// The delete option. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The delete option.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The delete option.", + SerializedName = @"deleteOption", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Query)] + public string DeleteOption { get => this._deleteOption; set => this._deleteOption = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of RemoveAzSiteRecoveryReplicationMigrationItem_DeleteViaIdentity + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.RemoveAzSiteRecoveryReplicationMigrationItem_DeleteViaIdentity Clone() + { + var clone = new RemoveAzSiteRecoveryReplicationMigrationItem_DeleteViaIdentity(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.DeleteOption = this.DeleteOption; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationMigrationItemsDelete' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationMigrationItemsDeleteViaIdentity(InputObject.Id, this.InvocationInformation.BoundParameters.ContainsKey("DeleteOption") ? DeleteOption : null, onNoContent, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.FabricName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.FabricName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ProtectionContainerName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ProtectionContainerName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.MigrationItemName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.MigrationItemName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationMigrationItemsDelete(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.FabricName ?? null, InputObject.ProtectionContainerName ?? null, InputObject.MigrationItemName ?? null, this.InvocationInformation.BoundParameters.ContainsKey("DeleteOption") ? DeleteOption : null, onNoContent, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { DeleteOption=this.InvocationInformation.BoundParameters.ContainsKey("DeleteOption") ? DeleteOption : null}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet + /// class. + /// + public RemoveAzSiteRecoveryReplicationMigrationItem_DeleteViaIdentity() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RemoveAzSiteRecoveryReplicationNetworkMapping_Delete.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RemoveAzSiteRecoveryReplicationNetworkMapping_Delete.cs new file mode 100644 index 000000000000..b04795ed4f4d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RemoveAzSiteRecoveryReplicationNetworkMapping_Delete.cs @@ -0,0 +1,465 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to delete a network mapping. + /// + /// [OpenAPI] Delete=>DELETE:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}/replicationNetworkMappings/{networkMappingName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzSiteRecoveryReplicationNetworkMapping_Delete", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to delete a network mapping.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class RemoveAzSiteRecoveryReplicationNetworkMapping_Delete : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// Primary fabric name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Primary fabric name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Primary fabric name.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _networkMappingName; + + /// ARM Resource Name for network mapping. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "ARM Resource Name for network mapping.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"ARM Resource Name for network mapping.", + SerializedName = @"networkMappingName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string NetworkMappingName { get => this._networkMappingName; set => this._networkMappingName = value; } + + /// Backing field for property. + private string _networkName; + + /// Primary network name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Primary network name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Primary network name.", + SerializedName = @"networkName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string NetworkName { get => this._networkName; set => this._networkName = value; } + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of RemoveAzSiteRecoveryReplicationNetworkMapping_Delete + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.RemoveAzSiteRecoveryReplicationNetworkMapping_Delete Clone() + { + var clone = new RemoveAzSiteRecoveryReplicationNetworkMapping_Delete(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + clone.FabricName = this.FabricName; + clone.NetworkName = this.NetworkName; + clone.NetworkMappingName = this.NetworkMappingName; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationNetworkMappingsDelete' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationNetworkMappingsDelete(ResourceName, ResourceGroupName, SubscriptionId, FabricName, NetworkName, NetworkMappingName, onNoContent, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName,NetworkName=NetworkName,NetworkMappingName=NetworkMappingName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public RemoveAzSiteRecoveryReplicationNetworkMapping_Delete() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RemoveAzSiteRecoveryReplicationNetworkMapping_DeleteViaIdentity.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RemoveAzSiteRecoveryReplicationNetworkMapping_DeleteViaIdentity.cs new file mode 100644 index 000000000000..eeb9ddbcdbad --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RemoveAzSiteRecoveryReplicationNetworkMapping_DeleteViaIdentity.cs @@ -0,0 +1,414 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to delete a network mapping. + /// + /// [OpenAPI] Delete=>DELETE:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}/replicationNetworkMappings/{networkMappingName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzSiteRecoveryReplicationNetworkMapping_DeleteViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to delete a network mapping.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class RemoveAzSiteRecoveryReplicationNetworkMapping_DeleteViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of RemoveAzSiteRecoveryReplicationNetworkMapping_DeleteViaIdentity + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.RemoveAzSiteRecoveryReplicationNetworkMapping_DeleteViaIdentity Clone() + { + var clone = new RemoveAzSiteRecoveryReplicationNetworkMapping_DeleteViaIdentity(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationNetworkMappingsDelete' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationNetworkMappingsDeleteViaIdentity(InputObject.Id, onNoContent, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.FabricName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.FabricName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.NetworkName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.NetworkName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.NetworkMappingName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.NetworkMappingName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationNetworkMappingsDelete(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.FabricName ?? null, InputObject.NetworkName ?? null, InputObject.NetworkMappingName ?? null, onNoContent, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet + /// class. + /// + public RemoveAzSiteRecoveryReplicationNetworkMapping_DeleteViaIdentity() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RemoveAzSiteRecoveryReplicationPolicy_Delete.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RemoveAzSiteRecoveryReplicationPolicy_Delete.cs new file mode 100644 index 000000000000..eb3303be9491 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RemoveAzSiteRecoveryReplicationPolicy_Delete.cs @@ -0,0 +1,435 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to delete a replication policy. + /// + /// [OpenAPI] Delete=>DELETE:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationPolicies/{policyName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzSiteRecoveryReplicationPolicy_Delete", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to delete a replication policy.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class RemoveAzSiteRecoveryReplicationPolicy_Delete : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _policyName; + + /// Replication policy name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Replication policy name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Replication policy name.", + SerializedName = @"policyName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string PolicyName { get => this._policyName; set => this._policyName = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of RemoveAzSiteRecoveryReplicationPolicy_Delete + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.RemoveAzSiteRecoveryReplicationPolicy_Delete Clone() + { + var clone = new RemoveAzSiteRecoveryReplicationPolicy_Delete(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + clone.PolicyName = this.PolicyName; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationPoliciesDelete' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationPoliciesDelete(ResourceName, ResourceGroupName, SubscriptionId, PolicyName, onNoContent, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,PolicyName=PolicyName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public RemoveAzSiteRecoveryReplicationPolicy_Delete() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RemoveAzSiteRecoveryReplicationPolicy_DeleteViaIdentity.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RemoveAzSiteRecoveryReplicationPolicy_DeleteViaIdentity.cs new file mode 100644 index 000000000000..2891eeea4204 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RemoveAzSiteRecoveryReplicationPolicy_DeleteViaIdentity.cs @@ -0,0 +1,403 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to delete a replication policy. + /// + /// [OpenAPI] Delete=>DELETE:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationPolicies/{policyName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzSiteRecoveryReplicationPolicy_DeleteViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to delete a replication policy.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class RemoveAzSiteRecoveryReplicationPolicy_DeleteViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of RemoveAzSiteRecoveryReplicationPolicy_DeleteViaIdentity + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.RemoveAzSiteRecoveryReplicationPolicy_DeleteViaIdentity Clone() + { + var clone = new RemoveAzSiteRecoveryReplicationPolicy_DeleteViaIdentity(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationPoliciesDelete' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationPoliciesDeleteViaIdentity(InputObject.Id, onNoContent, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.PolicyName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.PolicyName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationPoliciesDelete(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.PolicyName ?? null, onNoContent, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public RemoveAzSiteRecoveryReplicationPolicy_DeleteViaIdentity() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RemoveAzSiteRecoveryReplicationProtectedItemDisk_Remove.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RemoveAzSiteRecoveryReplicationProtectedItemDisk_Remove.cs new file mode 100644 index 000000000000..cb916331f25a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RemoveAzSiteRecoveryReplicationProtectedItemDisk_Remove.cs @@ -0,0 +1,474 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Operation to remove disk(s) from the replication protected item. + /// + /// [OpenAPI] RemoveDisks=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/removeDisks" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzSiteRecoveryReplicationProtectedItemDisk_Remove", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Operation to remove disk(s) from the replication protected item.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class RemoveAzSiteRecoveryReplicationProtectedItemDisk_Remove : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// Unique fabric name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Unique fabric name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Unique fabric name.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _protectionContainerName; + + /// Protection container name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Protection container name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Protection container name.", + SerializedName = @"protectionContainerName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ProtectionContainerName { get => this._protectionContainerName; set => this._protectionContainerName = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksInput _removeDisksInput; + + /// Input for remove disk(s) operation. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Input for remove disk(s) operation.", ValueFromPipeline = true)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Input for remove disk(s) operation.", + SerializedName = @"removeDisksInput", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksInput) })] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksInput RemoveDisksInput { get => this._removeDisksInput; set => this._removeDisksInput = value; } + + /// Backing field for property. + private string _replicatedProtectedItemName; + + /// Replication protected item name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Replication protected item name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Replication protected item name.", + SerializedName = @"replicatedProtectedItemName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ReplicatedProtectedItemName { get => this._replicatedProtectedItemName; set => this._replicatedProtectedItemName = value; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of RemoveAzSiteRecoveryReplicationProtectedItemDisk_Remove + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.RemoveAzSiteRecoveryReplicationProtectedItemDisk_Remove Clone() + { + var clone = new RemoveAzSiteRecoveryReplicationProtectedItemDisk_Remove(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + clone.FabricName = this.FabricName; + clone.ProtectionContainerName = this.ProtectionContainerName; + clone.ReplicatedProtectedItemName = this.ReplicatedProtectedItemName; + clone.RemoveDisksInput = this.RemoveDisksInput; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationProtectedItemsRemoveDisks' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationProtectedItemsRemoveDisks(ResourceName, ResourceGroupName, SubscriptionId, FabricName, ProtectionContainerName, ReplicatedProtectedItemName, RemoveDisksInput, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName,ProtectionContainerName=ProtectionContainerName,ReplicatedProtectedItemName=ReplicatedProtectedItemName,body=RemoveDisksInput}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public RemoveAzSiteRecoveryReplicationProtectedItemDisk_Remove() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RemoveAzSiteRecoveryReplicationProtectedItemDisk_RemoveExpanded.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RemoveAzSiteRecoveryReplicationProtectedItemDisk_RemoveExpanded.cs new file mode 100644 index 000000000000..1d7d61762fa1 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RemoveAzSiteRecoveryReplicationProtectedItemDisk_RemoveExpanded.cs @@ -0,0 +1,478 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Operation to remove disk(s) from the replication protected item. + /// + /// [OpenAPI] RemoveDisks=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/removeDisks" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzSiteRecoveryReplicationProtectedItemDisk_RemoveExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Operation to remove disk(s) from the replication protected item.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class RemoveAzSiteRecoveryReplicationProtectedItemDisk_RemoveExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Input for remove disk(s) operation. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksInput _removeDisksInputBody = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RemoveDisksInput(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// Unique fabric name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Unique fabric name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Unique fabric name.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _protectionContainerName; + + /// Protection container name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Protection container name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Protection container name.", + SerializedName = @"protectionContainerName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ProtectionContainerName { get => this._protectionContainerName; set => this._protectionContainerName = value; } + + /// The class type. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The class type.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + public string ProviderSpecificDetailInstanceType { get => _removeDisksInputBody.ProviderSpecificDetailInstanceType ?? null; set => _removeDisksInputBody.ProviderSpecificDetailInstanceType = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _replicatedProtectedItemName; + + /// Replication protected item name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Replication protected item name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Replication protected item name.", + SerializedName = @"replicatedProtectedItemName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ReplicatedProtectedItemName { get => this._replicatedProtectedItemName; set => this._replicatedProtectedItemName = value; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of RemoveAzSiteRecoveryReplicationProtectedItemDisk_RemoveExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.RemoveAzSiteRecoveryReplicationProtectedItemDisk_RemoveExpanded Clone() + { + var clone = new RemoveAzSiteRecoveryReplicationProtectedItemDisk_RemoveExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._removeDisksInputBody = this._removeDisksInputBody; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + clone.FabricName = this.FabricName; + clone.ProtectionContainerName = this.ProtectionContainerName; + clone.ReplicatedProtectedItemName = this.ReplicatedProtectedItemName; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationProtectedItemsRemoveDisks' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationProtectedItemsRemoveDisks(ResourceName, ResourceGroupName, SubscriptionId, FabricName, ProtectionContainerName, ReplicatedProtectedItemName, _removeDisksInputBody, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName,ProtectionContainerName=ProtectionContainerName,ReplicatedProtectedItemName=ReplicatedProtectedItemName,body=_removeDisksInputBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet + /// class. + /// + public RemoveAzSiteRecoveryReplicationProtectedItemDisk_RemoveExpanded() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RemoveAzSiteRecoveryReplicationProtectedItemDisk_RemoveViaIdentity.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RemoveAzSiteRecoveryReplicationProtectedItemDisk_RemoveViaIdentity.cs new file mode 100644 index 000000000000..f5eeb83ddc68 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RemoveAzSiteRecoveryReplicationProtectedItemDisk_RemoveViaIdentity.cs @@ -0,0 +1,423 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Operation to remove disk(s) from the replication protected item. + /// + /// [OpenAPI] RemoveDisks=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/removeDisks" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzSiteRecoveryReplicationProtectedItemDisk_RemoveViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Operation to remove disk(s) from the replication protected item.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class RemoveAzSiteRecoveryReplicationProtectedItemDisk_RemoveViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksInput _removeDisksInput; + + /// Input for remove disk(s) operation. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Input for remove disk(s) operation.", ValueFromPipeline = true)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Input for remove disk(s) operation.", + SerializedName = @"removeDisksInput", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksInput) })] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksInput RemoveDisksInput { get => this._removeDisksInput; set => this._removeDisksInput = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of RemoveAzSiteRecoveryReplicationProtectedItemDisk_RemoveViaIdentity + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.RemoveAzSiteRecoveryReplicationProtectedItemDisk_RemoveViaIdentity Clone() + { + var clone = new RemoveAzSiteRecoveryReplicationProtectedItemDisk_RemoveViaIdentity(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.RemoveDisksInput = this.RemoveDisksInput; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationProtectedItemsRemoveDisks' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationProtectedItemsRemoveDisksViaIdentity(InputObject.Id, RemoveDisksInput, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.FabricName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.FabricName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ProtectionContainerName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ProtectionContainerName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ReplicatedProtectedItemName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ReplicatedProtectedItemName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationProtectedItemsRemoveDisks(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.FabricName ?? null, InputObject.ProtectionContainerName ?? null, InputObject.ReplicatedProtectedItemName ?? null, RemoveDisksInput, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=RemoveDisksInput}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet + /// class. + /// + public RemoveAzSiteRecoveryReplicationProtectedItemDisk_RemoveViaIdentity() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RemoveAzSiteRecoveryReplicationProtectedItemDisk_RemoveViaIdentityExpanded.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RemoveAzSiteRecoveryReplicationProtectedItemDisk_RemoveViaIdentityExpanded.cs new file mode 100644 index 000000000000..20e18a75fe21 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RemoveAzSiteRecoveryReplicationProtectedItemDisk_RemoveViaIdentityExpanded.cs @@ -0,0 +1,424 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Operation to remove disk(s) from the replication protected item. + /// + /// [OpenAPI] RemoveDisks=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/removeDisks" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzSiteRecoveryReplicationProtectedItemDisk_RemoveViaIdentityExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Operation to remove disk(s) from the replication protected item.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class RemoveAzSiteRecoveryReplicationProtectedItemDisk_RemoveViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Input for remove disk(s) operation. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveDisksInput _removeDisksInputBody = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RemoveDisksInput(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The class type. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The class type.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + public string ProviderSpecificDetailInstanceType { get => _removeDisksInputBody.ProviderSpecificDetailInstanceType ?? null; set => _removeDisksInputBody.ProviderSpecificDetailInstanceType = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of RemoveAzSiteRecoveryReplicationProtectedItemDisk_RemoveViaIdentityExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.RemoveAzSiteRecoveryReplicationProtectedItemDisk_RemoveViaIdentityExpanded Clone() + { + var clone = new RemoveAzSiteRecoveryReplicationProtectedItemDisk_RemoveViaIdentityExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._removeDisksInputBody = this._removeDisksInputBody; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationProtectedItemsRemoveDisks' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationProtectedItemsRemoveDisksViaIdentity(InputObject.Id, _removeDisksInputBody, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.FabricName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.FabricName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ProtectionContainerName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ProtectionContainerName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ReplicatedProtectedItemName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ReplicatedProtectedItemName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationProtectedItemsRemoveDisks(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.FabricName ?? null, InputObject.ProtectionContainerName ?? null, InputObject.ReplicatedProtectedItemName ?? null, _removeDisksInputBody, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=_removeDisksInputBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public RemoveAzSiteRecoveryReplicationProtectedItemDisk_RemoveViaIdentityExpanded() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RemoveAzSiteRecoveryReplicationProtectedItem_Delete.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RemoveAzSiteRecoveryReplicationProtectedItem_Delete.cs new file mode 100644 index 000000000000..6ad7a56a6679 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RemoveAzSiteRecoveryReplicationProtectedItem_Delete.cs @@ -0,0 +1,481 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// + /// The operation to disable replication on a replication protected item. This will also remove the item. + /// + /// + /// [OpenAPI] Delete=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/remove" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzSiteRecoveryReplicationProtectedItem_Delete", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to disable replication on a replication protected item. This will also remove the item.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class RemoveAzSiteRecoveryReplicationProtectedItem_Delete : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionInput _disableProtectionInput; + + /// Disable protection input. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Disable protection input.", ValueFromPipeline = true)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Disable protection input.", + SerializedName = @"disableProtectionInput", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionInput) })] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionInput DisableProtectionInput { get => this._disableProtectionInput; set => this._disableProtectionInput = value; } + + /// Backing field for property. + private string _fabricName; + + /// Fabric name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Fabric name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Fabric name.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _protectionContainerName; + + /// Protection container name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Protection container name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Protection container name.", + SerializedName = @"protectionContainerName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ProtectionContainerName { get => this._protectionContainerName; set => this._protectionContainerName = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _replicatedProtectedItemName; + + /// Replication protected item name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Replication protected item name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Replication protected item name.", + SerializedName = @"replicatedProtectedItemName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ReplicatedProtectedItemName { get => this._replicatedProtectedItemName; set => this._replicatedProtectedItemName = value; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of RemoveAzSiteRecoveryReplicationProtectedItem_Delete + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.RemoveAzSiteRecoveryReplicationProtectedItem_Delete Clone() + { + var clone = new RemoveAzSiteRecoveryReplicationProtectedItem_Delete(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + clone.FabricName = this.FabricName; + clone.ProtectionContainerName = this.ProtectionContainerName; + clone.ReplicatedProtectedItemName = this.ReplicatedProtectedItemName; + clone.DisableProtectionInput = this.DisableProtectionInput; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationProtectedItemsDelete' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationProtectedItemsDelete(ResourceName, ResourceGroupName, SubscriptionId, FabricName, ProtectionContainerName, ReplicatedProtectedItemName, DisableProtectionInput, onNoContent, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName,ProtectionContainerName=ProtectionContainerName,ReplicatedProtectedItemName=ReplicatedProtectedItemName,body=DisableProtectionInput}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public RemoveAzSiteRecoveryReplicationProtectedItem_Delete() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RemoveAzSiteRecoveryReplicationProtectedItem_DeleteExpanded.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RemoveAzSiteRecoveryReplicationProtectedItem_DeleteExpanded.cs new file mode 100644 index 000000000000..16730d9e446c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RemoveAzSiteRecoveryReplicationProtectedItem_DeleteExpanded.cs @@ -0,0 +1,496 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// + /// The operation to disable replication on a replication protected item. This will also remove the item. + /// + /// + /// [OpenAPI] Delete=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/remove" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzSiteRecoveryReplicationProtectedItem_DeleteExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to disable replication on a replication protected item. This will also remove the item.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class RemoveAzSiteRecoveryReplicationProtectedItem_DeleteExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Disable protection input. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionInput _disableProtectionInputBody = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DisableProtectionInput(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Disable protection reason. It can have values NotSpecified/MigrationComplete. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Disable protection reason. It can have values NotSpecified/MigrationComplete.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Disable protection reason. It can have values NotSpecified/MigrationComplete.", + SerializedName = @"disableProtectionReason", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DisableProtectionReason) })] + [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DisableProtectionReason))] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DisableProtectionReason DisableProtectionReason { get => _disableProtectionInputBody.DisableProtectionReason ?? ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DisableProtectionReason)""); set => _disableProtectionInputBody.DisableProtectionReason = value; } + + /// Backing field for property. + private string _fabricName; + + /// Fabric name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Fabric name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Fabric name.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _protectionContainerName; + + /// Protection container name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Protection container name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Protection container name.", + SerializedName = @"protectionContainerName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ProtectionContainerName { get => this._protectionContainerName; set => this._protectionContainerName = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _replicatedProtectedItemName; + + /// Replication protected item name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Replication protected item name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Replication protected item name.", + SerializedName = @"replicatedProtectedItemName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ReplicatedProtectedItemName { get => this._replicatedProtectedItemName; set => this._replicatedProtectedItemName = value; } + + /// The class type. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The class type.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + public string ReplicationProviderInputInstanceType { get => _disableProtectionInputBody.ReplicationProviderInputInstanceType ?? null; set => _disableProtectionInputBody.ReplicationProviderInputInstanceType = value; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of RemoveAzSiteRecoveryReplicationProtectedItem_DeleteExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.RemoveAzSiteRecoveryReplicationProtectedItem_DeleteExpanded Clone() + { + var clone = new RemoveAzSiteRecoveryReplicationProtectedItem_DeleteExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._disableProtectionInputBody = this._disableProtectionInputBody; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + clone.FabricName = this.FabricName; + clone.ProtectionContainerName = this.ProtectionContainerName; + clone.ReplicatedProtectedItemName = this.ReplicatedProtectedItemName; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationProtectedItemsDelete' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationProtectedItemsDelete(ResourceName, ResourceGroupName, SubscriptionId, FabricName, ProtectionContainerName, ReplicatedProtectedItemName, _disableProtectionInputBody, onNoContent, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName,ProtectionContainerName=ProtectionContainerName,ReplicatedProtectedItemName=ReplicatedProtectedItemName,body=_disableProtectionInputBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public RemoveAzSiteRecoveryReplicationProtectedItem_DeleteExpanded() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RemoveAzSiteRecoveryReplicationProtectedItem_DeleteViaIdentity.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RemoveAzSiteRecoveryReplicationProtectedItem_DeleteViaIdentity.cs new file mode 100644 index 000000000000..0f9fe17b6e9e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RemoveAzSiteRecoveryReplicationProtectedItem_DeleteViaIdentity.cs @@ -0,0 +1,430 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// + /// The operation to disable replication on a replication protected item. This will also remove the item. + /// + /// + /// [OpenAPI] Delete=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/remove" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzSiteRecoveryReplicationProtectedItem_DeleteViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to disable replication on a replication protected item. This will also remove the item.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class RemoveAzSiteRecoveryReplicationProtectedItem_DeleteViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionInput _disableProtectionInput; + + /// Disable protection input. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Disable protection input.", ValueFromPipeline = true)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Disable protection input.", + SerializedName = @"disableProtectionInput", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionInput) })] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionInput DisableProtectionInput { get => this._disableProtectionInput; set => this._disableProtectionInput = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of RemoveAzSiteRecoveryReplicationProtectedItem_DeleteViaIdentity + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.RemoveAzSiteRecoveryReplicationProtectedItem_DeleteViaIdentity Clone() + { + var clone = new RemoveAzSiteRecoveryReplicationProtectedItem_DeleteViaIdentity(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.DisableProtectionInput = this.DisableProtectionInput; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationProtectedItemsDelete' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationProtectedItemsDeleteViaIdentity(InputObject.Id, DisableProtectionInput, onNoContent, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.FabricName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.FabricName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ProtectionContainerName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ProtectionContainerName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ReplicatedProtectedItemName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ReplicatedProtectedItemName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationProtectedItemsDelete(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.FabricName ?? null, InputObject.ProtectionContainerName ?? null, InputObject.ReplicatedProtectedItemName ?? null, DisableProtectionInput, onNoContent, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=DisableProtectionInput}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet + /// class. + /// + public RemoveAzSiteRecoveryReplicationProtectedItem_DeleteViaIdentity() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RemoveAzSiteRecoveryReplicationProtectedItem_DeleteViaIdentityExpanded.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RemoveAzSiteRecoveryReplicationProtectedItem_DeleteViaIdentityExpanded.cs new file mode 100644 index 000000000000..4b63d400fb9a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RemoveAzSiteRecoveryReplicationProtectedItem_DeleteViaIdentityExpanded.cs @@ -0,0 +1,443 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// + /// The operation to disable replication on a replication protected item. This will also remove the item. + /// + /// + /// [OpenAPI] Delete=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/remove" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzSiteRecoveryReplicationProtectedItem_DeleteViaIdentityExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to disable replication on a replication protected item. This will also remove the item.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class RemoveAzSiteRecoveryReplicationProtectedItem_DeleteViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Disable protection input. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IDisableProtectionInput _disableProtectionInputBody = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.DisableProtectionInput(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Disable protection reason. It can have values NotSpecified/MigrationComplete. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Disable protection reason. It can have values NotSpecified/MigrationComplete.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Disable protection reason. It can have values NotSpecified/MigrationComplete.", + SerializedName = @"disableProtectionReason", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DisableProtectionReason) })] + [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DisableProtectionReason))] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DisableProtectionReason DisableProtectionReason { get => _disableProtectionInputBody.DisableProtectionReason ?? ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.DisableProtectionReason)""); set => _disableProtectionInputBody.DisableProtectionReason = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// The class type. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The class type.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + public string ReplicationProviderInputInstanceType { get => _disableProtectionInputBody.ReplicationProviderInputInstanceType ?? null; set => _disableProtectionInputBody.ReplicationProviderInputInstanceType = value; } + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of RemoveAzSiteRecoveryReplicationProtectedItem_DeleteViaIdentityExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.RemoveAzSiteRecoveryReplicationProtectedItem_DeleteViaIdentityExpanded Clone() + { + var clone = new RemoveAzSiteRecoveryReplicationProtectedItem_DeleteViaIdentityExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._disableProtectionInputBody = this._disableProtectionInputBody; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationProtectedItemsDelete' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationProtectedItemsDeleteViaIdentity(InputObject.Id, _disableProtectionInputBody, onNoContent, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.FabricName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.FabricName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ProtectionContainerName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ProtectionContainerName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ReplicatedProtectedItemName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ReplicatedProtectedItemName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationProtectedItemsDelete(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.FabricName ?? null, InputObject.ProtectionContainerName ?? null, InputObject.ReplicatedProtectedItemName ?? null, _disableProtectionInputBody, onNoContent, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=_disableProtectionInputBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the + /// cmdlet class. + /// + public RemoveAzSiteRecoveryReplicationProtectedItem_DeleteViaIdentityExpanded() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RemoveAzSiteRecoveryReplicationProtectionContainerMapping_Delete.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RemoveAzSiteRecoveryReplicationProtectionContainerMapping_Delete.cs new file mode 100644 index 000000000000..bb95aeaa8002 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RemoveAzSiteRecoveryReplicationProtectionContainerMapping_Delete.cs @@ -0,0 +1,482 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to delete or remove a protection container mapping. + /// + /// [OpenAPI] Delete=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings/{mappingName}/remove" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzSiteRecoveryReplicationProtectionContainerMapping_Delete", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to delete or remove a protection container mapping.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class RemoveAzSiteRecoveryReplicationProtectionContainerMapping_Delete : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// Fabric name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Fabric name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Fabric name.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// Backing field for property. + private string _mappingName; + + /// Protection container mapping name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Protection container mapping name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Protection container mapping name.", + SerializedName = @"mappingName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string MappingName { get => this._mappingName; set => this._mappingName = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _protectionContainerName; + + /// Protection container name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Protection container name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Protection container name.", + SerializedName = @"protectionContainerName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ProtectionContainerName { get => this._protectionContainerName; set => this._protectionContainerName = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveProtectionContainerMappingInput _removalInput; + + /// Container unpairing input. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Container unpairing input.", ValueFromPipeline = true)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Container unpairing input.", + SerializedName = @"removalInput", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveProtectionContainerMappingInput) })] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveProtectionContainerMappingInput RemovalInput { get => this._removalInput; set => this._removalInput = value; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of RemoveAzSiteRecoveryReplicationProtectionContainerMapping_Delete + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.RemoveAzSiteRecoveryReplicationProtectionContainerMapping_Delete Clone() + { + var clone = new RemoveAzSiteRecoveryReplicationProtectionContainerMapping_Delete(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + clone.FabricName = this.FabricName; + clone.ProtectionContainerName = this.ProtectionContainerName; + clone.MappingName = this.MappingName; + clone.RemovalInput = this.RemovalInput; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationProtectionContainerMappingsDelete' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationProtectionContainerMappingsDelete(ResourceName, ResourceGroupName, SubscriptionId, FabricName, ProtectionContainerName, MappingName, RemovalInput, onNoContent, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName,ProtectionContainerName=ProtectionContainerName,MappingName=MappingName,body=RemovalInput}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet + /// class. + /// + public RemoveAzSiteRecoveryReplicationProtectionContainerMapping_Delete() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RemoveAzSiteRecoveryReplicationProtectionContainerMapping_DeleteExpanded.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RemoveAzSiteRecoveryReplicationProtectionContainerMapping_DeleteExpanded.cs new file mode 100644 index 000000000000..373c95d69058 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RemoveAzSiteRecoveryReplicationProtectionContainerMapping_DeleteExpanded.cs @@ -0,0 +1,483 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to delete or remove a protection container mapping. + /// + /// [OpenAPI] Delete=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings/{mappingName}/remove" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzSiteRecoveryReplicationProtectionContainerMapping_DeleteExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to delete or remove a protection container mapping.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class RemoveAzSiteRecoveryReplicationProtectionContainerMapping_DeleteExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Container unpairing input. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveProtectionContainerMappingInput _removalInputBody = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RemoveProtectionContainerMappingInput(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// Fabric name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Fabric name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Fabric name.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// Backing field for property. + private string _mappingName; + + /// Protection container mapping name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Protection container mapping name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Protection container mapping name.", + SerializedName = @"mappingName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string MappingName { get => this._mappingName; set => this._mappingName = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _protectionContainerName; + + /// Protection container name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Protection container name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Protection container name.", + SerializedName = @"protectionContainerName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ProtectionContainerName { get => this._protectionContainerName; set => this._protectionContainerName = value; } + + /// The class type. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The class type.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + public string ProviderSpecificInputInstanceType { get => _removalInputBody.ProviderSpecificInputInstanceType ?? null; set => _removalInputBody.ProviderSpecificInputInstanceType = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of RemoveAzSiteRecoveryReplicationProtectionContainerMapping_DeleteExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.RemoveAzSiteRecoveryReplicationProtectionContainerMapping_DeleteExpanded Clone() + { + var clone = new RemoveAzSiteRecoveryReplicationProtectionContainerMapping_DeleteExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._removalInputBody = this._removalInputBody; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + clone.FabricName = this.FabricName; + clone.ProtectionContainerName = this.ProtectionContainerName; + clone.MappingName = this.MappingName; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationProtectionContainerMappingsDelete' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationProtectionContainerMappingsDelete(ResourceName, ResourceGroupName, SubscriptionId, FabricName, ProtectionContainerName, MappingName, _removalInputBody, onNoContent, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName,ProtectionContainerName=ProtectionContainerName,MappingName=MappingName,body=_removalInputBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public RemoveAzSiteRecoveryReplicationProtectionContainerMapping_DeleteExpanded() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RemoveAzSiteRecoveryReplicationProtectionContainerMapping_DeleteViaIdentity.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RemoveAzSiteRecoveryReplicationProtectionContainerMapping_DeleteViaIdentity.cs new file mode 100644 index 000000000000..eeaf39501316 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RemoveAzSiteRecoveryReplicationProtectionContainerMapping_DeleteViaIdentity.cs @@ -0,0 +1,428 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to delete or remove a protection container mapping. + /// + /// [OpenAPI] Delete=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings/{mappingName}/remove" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzSiteRecoveryReplicationProtectionContainerMapping_DeleteViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to delete or remove a protection container mapping.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class RemoveAzSiteRecoveryReplicationProtectionContainerMapping_DeleteViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveProtectionContainerMappingInput _removalInput; + + /// Container unpairing input. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Container unpairing input.", ValueFromPipeline = true)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Container unpairing input.", + SerializedName = @"removalInput", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveProtectionContainerMappingInput) })] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveProtectionContainerMappingInput RemovalInput { get => this._removalInput; set => this._removalInput = value; } + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of RemoveAzSiteRecoveryReplicationProtectionContainerMapping_DeleteViaIdentity + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.RemoveAzSiteRecoveryReplicationProtectionContainerMapping_DeleteViaIdentity Clone() + { + var clone = new RemoveAzSiteRecoveryReplicationProtectionContainerMapping_DeleteViaIdentity(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.RemovalInput = this.RemovalInput; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationProtectionContainerMappingsDelete' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationProtectionContainerMappingsDeleteViaIdentity(InputObject.Id, RemovalInput, onNoContent, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.FabricName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.FabricName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ProtectionContainerName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ProtectionContainerName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.MappingName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.MappingName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationProtectionContainerMappingsDelete(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.FabricName ?? null, InputObject.ProtectionContainerName ?? null, InputObject.MappingName ?? null, RemovalInput, onNoContent, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=RemovalInput}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public RemoveAzSiteRecoveryReplicationProtectionContainerMapping_DeleteViaIdentity() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RemoveAzSiteRecoveryReplicationProtectionContainerMapping_DeleteViaIdentityExpanded.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RemoveAzSiteRecoveryReplicationProtectionContainerMapping_DeleteViaIdentityExpanded.cs new file mode 100644 index 000000000000..e94f16564b93 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RemoveAzSiteRecoveryReplicationProtectionContainerMapping_DeleteViaIdentityExpanded.cs @@ -0,0 +1,429 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to delete or remove a protection container mapping. + /// + /// [OpenAPI] Delete=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings/{mappingName}/remove" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzSiteRecoveryReplicationProtectionContainerMapping_DeleteViaIdentityExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to delete or remove a protection container mapping.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class RemoveAzSiteRecoveryReplicationProtectionContainerMapping_DeleteViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Container unpairing input. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRemoveProtectionContainerMappingInput _removalInputBody = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RemoveProtectionContainerMappingInput(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The class type. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The class type.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + public string ProviderSpecificInputInstanceType { get => _removalInputBody.ProviderSpecificInputInstanceType ?? null; set => _removalInputBody.ProviderSpecificInputInstanceType = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of RemoveAzSiteRecoveryReplicationProtectionContainerMapping_DeleteViaIdentityExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.RemoveAzSiteRecoveryReplicationProtectionContainerMapping_DeleteViaIdentityExpanded Clone() + { + var clone = new RemoveAzSiteRecoveryReplicationProtectionContainerMapping_DeleteViaIdentityExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._removalInputBody = this._removalInputBody; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationProtectionContainerMappingsDelete' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationProtectionContainerMappingsDeleteViaIdentity(InputObject.Id, _removalInputBody, onNoContent, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.FabricName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.FabricName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ProtectionContainerName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ProtectionContainerName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.MappingName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.MappingName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationProtectionContainerMappingsDelete(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.FabricName ?? null, InputObject.ProtectionContainerName ?? null, InputObject.MappingName ?? null, _removalInputBody, onNoContent, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=_removalInputBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public RemoveAzSiteRecoveryReplicationProtectionContainerMapping_DeleteViaIdentityExpanded() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RemoveAzSiteRecoveryReplicationProtectionContainer_Delete.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RemoveAzSiteRecoveryReplicationProtectionContainer_Delete.cs new file mode 100644 index 000000000000..ae17fbc8a976 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RemoveAzSiteRecoveryReplicationProtectionContainer_Delete.cs @@ -0,0 +1,452 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Operation to remove a protection container. + /// + /// [OpenAPI] Delete=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/remove" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzSiteRecoveryReplicationProtectionContainer_Delete", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Operation to remove a protection container.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class RemoveAzSiteRecoveryReplicationProtectionContainer_Delete : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// Unique fabric ARM name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Unique fabric ARM name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Unique fabric ARM name.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _protectionContainerName; + + /// Unique protection container ARM name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Unique protection container ARM name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Unique protection container ARM name.", + SerializedName = @"protectionContainerName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ProtectionContainerName { get => this._protectionContainerName; set => this._protectionContainerName = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of RemoveAzSiteRecoveryReplicationProtectionContainer_Delete + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.RemoveAzSiteRecoveryReplicationProtectionContainer_Delete Clone() + { + var clone = new RemoveAzSiteRecoveryReplicationProtectionContainer_Delete(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + clone.FabricName = this.FabricName; + clone.ProtectionContainerName = this.ProtectionContainerName; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationProtectionContainersDelete' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationProtectionContainersDelete(ResourceName, ResourceGroupName, SubscriptionId, FabricName, ProtectionContainerName, onNoContent, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName,ProtectionContainerName=ProtectionContainerName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public RemoveAzSiteRecoveryReplicationProtectionContainer_Delete() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RemoveAzSiteRecoveryReplicationProtectionContainer_DeleteViaIdentity.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RemoveAzSiteRecoveryReplicationProtectionContainer_DeleteViaIdentity.cs new file mode 100644 index 000000000000..bfcdf85bf04e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RemoveAzSiteRecoveryReplicationProtectionContainer_DeleteViaIdentity.cs @@ -0,0 +1,410 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Operation to remove a protection container. + /// + /// [OpenAPI] Delete=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/remove" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzSiteRecoveryReplicationProtectionContainer_DeleteViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Operation to remove a protection container.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class RemoveAzSiteRecoveryReplicationProtectionContainer_DeleteViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of RemoveAzSiteRecoveryReplicationProtectionContainer_DeleteViaIdentity + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.RemoveAzSiteRecoveryReplicationProtectionContainer_DeleteViaIdentity Clone() + { + var clone = new RemoveAzSiteRecoveryReplicationProtectionContainer_DeleteViaIdentity(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationProtectionContainersDelete' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationProtectionContainersDeleteViaIdentity(InputObject.Id, onNoContent, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.FabricName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.FabricName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ProtectionContainerName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ProtectionContainerName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationProtectionContainersDelete(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.FabricName ?? null, InputObject.ProtectionContainerName ?? null, onNoContent, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet + /// class. + /// + public RemoveAzSiteRecoveryReplicationProtectionContainer_DeleteViaIdentity() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RemoveAzSiteRecoveryReplicationRecoveryPlan_Delete.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RemoveAzSiteRecoveryReplicationRecoveryPlan_Delete.cs new file mode 100644 index 000000000000..9037bd4e49ed --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RemoveAzSiteRecoveryReplicationRecoveryPlan_Delete.cs @@ -0,0 +1,435 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Delete a recovery plan. + /// + /// [OpenAPI] Delete=>DELETE:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzSiteRecoveryReplicationRecoveryPlan_Delete", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Delete a recovery plan.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class RemoveAzSiteRecoveryReplicationRecoveryPlan_Delete : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _recoveryPlanName; + + /// Recovery plan name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Recovery plan name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Recovery plan name.", + SerializedName = @"recoveryPlanName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string RecoveryPlanName { get => this._recoveryPlanName; set => this._recoveryPlanName = value; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of RemoveAzSiteRecoveryReplicationRecoveryPlan_Delete + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.RemoveAzSiteRecoveryReplicationRecoveryPlan_Delete Clone() + { + var clone = new RemoveAzSiteRecoveryReplicationRecoveryPlan_Delete(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + clone.RecoveryPlanName = this.RecoveryPlanName; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationRecoveryPlansDelete' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationRecoveryPlansDelete(ResourceName, ResourceGroupName, SubscriptionId, RecoveryPlanName, onNoContent, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,RecoveryPlanName=RecoveryPlanName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public RemoveAzSiteRecoveryReplicationRecoveryPlan_Delete() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RemoveAzSiteRecoveryReplicationRecoveryPlan_DeleteViaIdentity.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RemoveAzSiteRecoveryReplicationRecoveryPlan_DeleteViaIdentity.cs new file mode 100644 index 000000000000..ed43b00cb1f9 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RemoveAzSiteRecoveryReplicationRecoveryPlan_DeleteViaIdentity.cs @@ -0,0 +1,405 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Delete a recovery plan. + /// + /// [OpenAPI] Delete=>DELETE:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzSiteRecoveryReplicationRecoveryPlan_DeleteViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Delete a recovery plan.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class RemoveAzSiteRecoveryReplicationRecoveryPlan_DeleteViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of RemoveAzSiteRecoveryReplicationRecoveryPlan_DeleteViaIdentity + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.RemoveAzSiteRecoveryReplicationRecoveryPlan_DeleteViaIdentity Clone() + { + var clone = new RemoveAzSiteRecoveryReplicationRecoveryPlan_DeleteViaIdentity(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationRecoveryPlansDelete' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationRecoveryPlansDeleteViaIdentity(InputObject.Id, onNoContent, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.RecoveryPlanName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.RecoveryPlanName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationRecoveryPlansDelete(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.RecoveryPlanName ?? null, onNoContent, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public RemoveAzSiteRecoveryReplicationRecoveryPlan_DeleteViaIdentity() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RemoveAzSiteRecoveryReplicationRecoveryServicesProvider_Delete.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RemoveAzSiteRecoveryReplicationRecoveryServicesProvider_Delete.cs new file mode 100644 index 000000000000..3d67814e0bcb --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RemoveAzSiteRecoveryReplicationRecoveryServicesProvider_Delete.cs @@ -0,0 +1,455 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// + /// The operation to removes/delete(unregister) a recovery services provider from the vault. + /// + /// + /// [OpenAPI] Delete=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders/{providerName}/remove" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzSiteRecoveryReplicationRecoveryServicesProvider_Delete", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to removes/delete(unregister) a recovery services provider from the vault.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class RemoveAzSiteRecoveryReplicationRecoveryServicesProvider_Delete : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// Fabric name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Fabric name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Fabric name.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _providerName; + + /// Recovery services provider name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Recovery services provider name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Recovery services provider name.", + SerializedName = @"providerName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ProviderName { get => this._providerName; set => this._providerName = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of RemoveAzSiteRecoveryReplicationRecoveryServicesProvider_Delete + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.RemoveAzSiteRecoveryReplicationRecoveryServicesProvider_Delete Clone() + { + var clone = new RemoveAzSiteRecoveryReplicationRecoveryServicesProvider_Delete(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + clone.FabricName = this.FabricName; + clone.ProviderName = this.ProviderName; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationRecoveryServicesProvidersDelete' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationRecoveryServicesProvidersDelete(ResourceName, ResourceGroupName, SubscriptionId, FabricName, ProviderName, onNoContent, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName,ProviderName=ProviderName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet + /// class. + /// + public RemoveAzSiteRecoveryReplicationRecoveryServicesProvider_Delete() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RemoveAzSiteRecoveryReplicationRecoveryServicesProvider_DeleteViaIdentity.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RemoveAzSiteRecoveryReplicationRecoveryServicesProvider_DeleteViaIdentity.cs new file mode 100644 index 000000000000..55e2b664693d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RemoveAzSiteRecoveryReplicationRecoveryServicesProvider_DeleteViaIdentity.cs @@ -0,0 +1,412 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// + /// The operation to removes/delete(unregister) a recovery services provider from the vault. + /// + /// + /// [OpenAPI] Delete=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders/{providerName}/remove" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzSiteRecoveryReplicationRecoveryServicesProvider_DeleteViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to removes/delete(unregister) a recovery services provider from the vault.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class RemoveAzSiteRecoveryReplicationRecoveryServicesProvider_DeleteViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of RemoveAzSiteRecoveryReplicationRecoveryServicesProvider_DeleteViaIdentity + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.RemoveAzSiteRecoveryReplicationRecoveryServicesProvider_DeleteViaIdentity Clone() + { + var clone = new RemoveAzSiteRecoveryReplicationRecoveryServicesProvider_DeleteViaIdentity(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationRecoveryServicesProvidersDelete' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationRecoveryServicesProvidersDeleteViaIdentity(InputObject.Id, onNoContent, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.FabricName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.FabricName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ProviderName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ProviderName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationRecoveryServicesProvidersDelete(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.FabricName ?? null, InputObject.ProviderName ?? null, onNoContent, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public RemoveAzSiteRecoveryReplicationRecoveryServicesProvider_DeleteViaIdentity() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RemoveAzSiteRecoveryReplicationStorageClassificationMapping_Delete.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RemoveAzSiteRecoveryReplicationStorageClassificationMapping_Delete.cs new file mode 100644 index 000000000000..c5eb4f7cf86c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RemoveAzSiteRecoveryReplicationStorageClassificationMapping_Delete.cs @@ -0,0 +1,468 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to delete a storage classification mapping. + /// + /// [OpenAPI] Delete=>DELETE:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationStorageClassifications/{storageClassificationName}/replicationStorageClassificationMappings/{storageClassificationMappingName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzSiteRecoveryReplicationStorageClassificationMapping_Delete", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to delete a storage classification mapping.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class RemoveAzSiteRecoveryReplicationStorageClassificationMapping_Delete : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// Fabric name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Fabric name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Fabric name.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _storageClassificationMappingName; + + /// Storage classification mapping name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Storage classification mapping name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Storage classification mapping name.", + SerializedName = @"storageClassificationMappingName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string StorageClassificationMappingName { get => this._storageClassificationMappingName; set => this._storageClassificationMappingName = value; } + + /// Backing field for property. + private string _storageClassificationName; + + /// Storage classification name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Storage classification name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Storage classification name.", + SerializedName = @"storageClassificationName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string StorageClassificationName { get => this._storageClassificationName; set => this._storageClassificationName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of RemoveAzSiteRecoveryReplicationStorageClassificationMapping_Delete + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.RemoveAzSiteRecoveryReplicationStorageClassificationMapping_Delete Clone() + { + var clone = new RemoveAzSiteRecoveryReplicationStorageClassificationMapping_Delete(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + clone.FabricName = this.FabricName; + clone.StorageClassificationName = this.StorageClassificationName; + clone.StorageClassificationMappingName = this.StorageClassificationMappingName; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationStorageClassificationMappingsDelete' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationStorageClassificationMappingsDelete(ResourceName, ResourceGroupName, SubscriptionId, FabricName, StorageClassificationName, StorageClassificationMappingName, onNoContent, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName,StorageClassificationName=StorageClassificationName,StorageClassificationMappingName=StorageClassificationMappingName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet + /// class. + /// + public RemoveAzSiteRecoveryReplicationStorageClassificationMapping_Delete() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RemoveAzSiteRecoveryReplicationStorageClassificationMapping_DeleteViaIdentity.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RemoveAzSiteRecoveryReplicationStorageClassificationMapping_DeleteViaIdentity.cs new file mode 100644 index 000000000000..1252598b5b61 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RemoveAzSiteRecoveryReplicationStorageClassificationMapping_DeleteViaIdentity.cs @@ -0,0 +1,414 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to delete a storage classification mapping. + /// + /// [OpenAPI] Delete=>DELETE:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationStorageClassifications/{storageClassificationName}/replicationStorageClassificationMappings/{storageClassificationMappingName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzSiteRecoveryReplicationStorageClassificationMapping_DeleteViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to delete a storage classification mapping.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class RemoveAzSiteRecoveryReplicationStorageClassificationMapping_DeleteViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of RemoveAzSiteRecoveryReplicationStorageClassificationMapping_DeleteViaIdentity + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.RemoveAzSiteRecoveryReplicationStorageClassificationMapping_DeleteViaIdentity Clone() + { + var clone = new RemoveAzSiteRecoveryReplicationStorageClassificationMapping_DeleteViaIdentity(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationStorageClassificationMappingsDelete' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationStorageClassificationMappingsDeleteViaIdentity(InputObject.Id, onNoContent, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.FabricName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.FabricName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.StorageClassificationName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.StorageClassificationName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.StorageClassificationMappingName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.StorageClassificationMappingName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationStorageClassificationMappingsDelete(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.FabricName ?? null, InputObject.StorageClassificationName ?? null, InputObject.StorageClassificationMappingName ?? null, onNoContent, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public RemoveAzSiteRecoveryReplicationStorageClassificationMapping_DeleteViaIdentity() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RemoveAzSiteRecoveryReplicationvCenter_Delete.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RemoveAzSiteRecoveryReplicationvCenter_Delete.cs new file mode 100644 index 000000000000..aa4767895298 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RemoveAzSiteRecoveryReplicationvCenter_Delete.cs @@ -0,0 +1,450 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to remove(unregister) a registered vCenter server from the vault. + /// + /// [OpenAPI] Delete=>DELETE:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationvCenters/{vcenterName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzSiteRecoveryReplicationvCenter_Delete", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to remove(unregister) a registered vCenter server from the vault.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class RemoveAzSiteRecoveryReplicationvCenter_Delete : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// Fabric name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Fabric name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Fabric name.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Backing field for property. + private string _vcenterName; + + /// vcenter name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "vcenter name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"vcenter name.", + SerializedName = @"vcenterName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string VcenterName { get => this._vcenterName; set => this._vcenterName = value; } + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of RemoveAzSiteRecoveryReplicationvCenter_Delete + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.RemoveAzSiteRecoveryReplicationvCenter_Delete Clone() + { + var clone = new RemoveAzSiteRecoveryReplicationvCenter_Delete(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + clone.FabricName = this.FabricName; + clone.VcenterName = this.VcenterName; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationvCentersDelete' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationvCentersDelete(ResourceName, ResourceGroupName, SubscriptionId, FabricName, VcenterName, onNoContent, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName,VcenterName=VcenterName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public RemoveAzSiteRecoveryReplicationvCenter_Delete() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RemoveAzSiteRecoveryReplicationvCenter_DeleteViaIdentity.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RemoveAzSiteRecoveryReplicationvCenter_DeleteViaIdentity.cs new file mode 100644 index 000000000000..9dbd4ffdafb7 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RemoveAzSiteRecoveryReplicationvCenter_DeleteViaIdentity.cs @@ -0,0 +1,409 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to remove(unregister) a registered vCenter server from the vault. + /// + /// [OpenAPI] Delete=>DELETE:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationvCenters/{vcenterName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzSiteRecoveryReplicationvCenter_DeleteViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to remove(unregister) a registered vCenter server from the vault.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class RemoveAzSiteRecoveryReplicationvCenter_DeleteViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of RemoveAzSiteRecoveryReplicationvCenter_DeleteViaIdentity + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.RemoveAzSiteRecoveryReplicationvCenter_DeleteViaIdentity Clone() + { + var clone = new RemoveAzSiteRecoveryReplicationvCenter_DeleteViaIdentity(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationvCentersDelete' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationvCentersDeleteViaIdentity(InputObject.Id, onNoContent, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.FabricName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.FabricName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.VcenterName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.VcenterName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationvCentersDelete(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.FabricName ?? null, InputObject.VcenterName ?? null, onNoContent, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public RemoveAzSiteRecoveryReplicationvCenter_DeleteViaIdentity() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RepairAzSiteRecoveryReplicationProtectedItemReplication_Repair.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RepairAzSiteRecoveryReplicationProtectedItemReplication_Repair.cs new file mode 100644 index 000000000000..4f1041e57ec9 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RepairAzSiteRecoveryReplicationProtectedItemReplication_Repair.cs @@ -0,0 +1,465 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// + /// The operation to start resynchronize/repair replication for a replication protected item requiring resynchronization. + /// + /// + /// [OpenAPI] RepairReplication=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/repairReplication" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsDiagnostic.Repair, @"AzSiteRecoveryReplicationProtectedItemReplication_Repair", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to start resynchronize/repair replication for a replication protected item requiring resynchronization.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class RepairAzSiteRecoveryReplicationProtectedItemReplication_Repair : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// The name of the fabric. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the fabric.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the fabric.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _protectionContainerName; + + /// The name of the container. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the container.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the container.", + SerializedName = @"protectionContainerName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ProtectionContainerName { get => this._protectionContainerName; set => this._protectionContainerName = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _replicatedProtectedItemName; + + /// The name of the replication protected item. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the replication protected item.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the replication protected item.", + SerializedName = @"replicatedProtectedItemName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ReplicatedProtectedItemName { get => this._replicatedProtectedItemName; set => this._replicatedProtectedItemName = value; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of RepairAzSiteRecoveryReplicationProtectedItemReplication_Repair + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.RepairAzSiteRecoveryReplicationProtectedItemReplication_Repair Clone() + { + var clone = new RepairAzSiteRecoveryReplicationProtectedItemReplication_Repair(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + clone.FabricName = this.FabricName; + clone.ProtectionContainerName = this.ProtectionContainerName; + clone.ReplicatedProtectedItemName = this.ReplicatedProtectedItemName; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationProtectedItemsRepairReplication' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationProtectedItemsRepairReplication(ResourceName, ResourceGroupName, SubscriptionId, FabricName, ProtectionContainerName, ReplicatedProtectedItemName, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName,ProtectionContainerName=ProtectionContainerName,ReplicatedProtectedItemName=ReplicatedProtectedItemName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet + /// class. + /// + public RepairAzSiteRecoveryReplicationProtectedItemReplication_Repair() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RepairAzSiteRecoveryReplicationProtectedItemReplication_RepairViaIdentity.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RepairAzSiteRecoveryReplicationProtectedItemReplication_RepairViaIdentity.cs new file mode 100644 index 000000000000..e9763dc3b373 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RepairAzSiteRecoveryReplicationProtectedItemReplication_RepairViaIdentity.cs @@ -0,0 +1,411 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// + /// The operation to start resynchronize/repair replication for a replication protected item requiring resynchronization. + /// + /// + /// [OpenAPI] RepairReplication=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/repairReplication" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsDiagnostic.Repair, @"AzSiteRecoveryReplicationProtectedItemReplication_RepairViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to start resynchronize/repair replication for a replication protected item requiring resynchronization.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class RepairAzSiteRecoveryReplicationProtectedItemReplication_RepairViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of RepairAzSiteRecoveryReplicationProtectedItemReplication_RepairViaIdentity + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.RepairAzSiteRecoveryReplicationProtectedItemReplication_RepairViaIdentity Clone() + { + var clone = new RepairAzSiteRecoveryReplicationProtectedItemReplication_RepairViaIdentity(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationProtectedItemsRepairReplication' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationProtectedItemsRepairReplicationViaIdentity(InputObject.Id, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.FabricName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.FabricName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ProtectionContainerName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ProtectionContainerName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ReplicatedProtectedItemName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ReplicatedProtectedItemName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationProtectedItemsRepairReplication(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.FabricName ?? null, InputObject.ProtectionContainerName ?? null, InputObject.ReplicatedProtectedItemName ?? null, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public RepairAzSiteRecoveryReplicationProtectedItemReplication_RepairViaIdentity() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/ResolveAzSiteRecoveryReplicationProtectedItemHealthError_Resolve.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/ResolveAzSiteRecoveryReplicationProtectedItemHealthError_Resolve.cs new file mode 100644 index 000000000000..6a6dcea51511 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/ResolveAzSiteRecoveryReplicationProtectedItemHealthError_Resolve.cs @@ -0,0 +1,477 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Operation to resolve health issues of the replication protected item. + /// + /// [OpenAPI] ResolveHealthErrors=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/resolveHealthErrors" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsDiagnostic.Resolve, @"AzSiteRecoveryReplicationProtectedItemHealthError_Resolve", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Operation to resolve health issues of the replication protected item.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class ResolveAzSiteRecoveryReplicationProtectedItemHealthError_Resolve : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// Unique fabric name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Unique fabric name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Unique fabric name.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _protectionContainerName; + + /// Protection container name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Protection container name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Protection container name.", + SerializedName = @"protectionContainerName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ProtectionContainerName { get => this._protectionContainerName; set => this._protectionContainerName = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _replicatedProtectedItemName; + + /// Replication protected item name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Replication protected item name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Replication protected item name.", + SerializedName = @"replicatedProtectedItemName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ReplicatedProtectedItemName { get => this._replicatedProtectedItemName; set => this._replicatedProtectedItemName = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResolveHealthInput _resolveHealthInput; + + /// Resolve health input. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Resolve health input.", ValueFromPipeline = true)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Resolve health input.", + SerializedName = @"resolveHealthInput", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResolveHealthInput) })] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResolveHealthInput ResolveHealthInput { get => this._resolveHealthInput; set => this._resolveHealthInput = value; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of ResolveAzSiteRecoveryReplicationProtectedItemHealthError_Resolve + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.ResolveAzSiteRecoveryReplicationProtectedItemHealthError_Resolve Clone() + { + var clone = new ResolveAzSiteRecoveryReplicationProtectedItemHealthError_Resolve(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + clone.FabricName = this.FabricName; + clone.ProtectionContainerName = this.ProtectionContainerName; + clone.ReplicatedProtectedItemName = this.ReplicatedProtectedItemName; + clone.ResolveHealthInput = this.ResolveHealthInput; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationProtectedItemsResolveHealthErrors' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationProtectedItemsResolveHealthErrors(ResourceName, ResourceGroupName, SubscriptionId, FabricName, ProtectionContainerName, ReplicatedProtectedItemName, ResolveHealthInput, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName,ProtectionContainerName=ProtectionContainerName,ReplicatedProtectedItemName=ReplicatedProtectedItemName,body=ResolveHealthInput}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet + /// class. + /// + public ResolveAzSiteRecoveryReplicationProtectedItemHealthError_Resolve() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/ResolveAzSiteRecoveryReplicationProtectedItemHealthError_ResolveExpanded.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/ResolveAzSiteRecoveryReplicationProtectedItemHealthError_ResolveExpanded.cs new file mode 100644 index 000000000000..df36e15555d7 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/ResolveAzSiteRecoveryReplicationProtectedItemHealthError_ResolveExpanded.cs @@ -0,0 +1,479 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Operation to resolve health issues of the replication protected item. + /// + /// [OpenAPI] ResolveHealthErrors=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/resolveHealthErrors" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsDiagnostic.Resolve, @"AzSiteRecoveryReplicationProtectedItemHealthError_ResolveExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Operation to resolve health issues of the replication protected item.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class ResolveAzSiteRecoveryReplicationProtectedItemHealthError_ResolveExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Resolve health input. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResolveHealthInput _resolveHealthInputBody = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ResolveHealthInput(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// Unique fabric name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Unique fabric name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Unique fabric name.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// Health errors. + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Health errors.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Health errors.", + SerializedName = @"healthErrors", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResolveHealthError) })] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResolveHealthError[] HealthError { get => _resolveHealthInputBody.HealthError ?? null /* arrayOf */; set => _resolveHealthInputBody.HealthError = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _protectionContainerName; + + /// Protection container name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Protection container name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Protection container name.", + SerializedName = @"protectionContainerName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ProtectionContainerName { get => this._protectionContainerName; set => this._protectionContainerName = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _replicatedProtectedItemName; + + /// Replication protected item name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Replication protected item name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Replication protected item name.", + SerializedName = @"replicatedProtectedItemName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ReplicatedProtectedItemName { get => this._replicatedProtectedItemName; set => this._replicatedProtectedItemName = value; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of ResolveAzSiteRecoveryReplicationProtectedItemHealthError_ResolveExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.ResolveAzSiteRecoveryReplicationProtectedItemHealthError_ResolveExpanded Clone() + { + var clone = new ResolveAzSiteRecoveryReplicationProtectedItemHealthError_ResolveExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._resolveHealthInputBody = this._resolveHealthInputBody; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + clone.FabricName = this.FabricName; + clone.ProtectionContainerName = this.ProtectionContainerName; + clone.ReplicatedProtectedItemName = this.ReplicatedProtectedItemName; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationProtectedItemsResolveHealthErrors' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationProtectedItemsResolveHealthErrors(ResourceName, ResourceGroupName, SubscriptionId, FabricName, ProtectionContainerName, ReplicatedProtectedItemName, _resolveHealthInputBody, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName,ProtectionContainerName=ProtectionContainerName,ReplicatedProtectedItemName=ReplicatedProtectedItemName,body=_resolveHealthInputBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public ResolveAzSiteRecoveryReplicationProtectedItemHealthError_ResolveExpanded() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/ResolveAzSiteRecoveryReplicationProtectedItemHealthError_ResolveViaIdentity.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/ResolveAzSiteRecoveryReplicationProtectedItemHealthError_ResolveViaIdentity.cs new file mode 100644 index 000000000000..002e371f27b6 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/ResolveAzSiteRecoveryReplicationProtectedItemHealthError_ResolveViaIdentity.cs @@ -0,0 +1,423 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Operation to resolve health issues of the replication protected item. + /// + /// [OpenAPI] ResolveHealthErrors=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/resolveHealthErrors" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsDiagnostic.Resolve, @"AzSiteRecoveryReplicationProtectedItemHealthError_ResolveViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Operation to resolve health issues of the replication protected item.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class ResolveAzSiteRecoveryReplicationProtectedItemHealthError_ResolveViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResolveHealthInput _resolveHealthInput; + + /// Resolve health input. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Resolve health input.", ValueFromPipeline = true)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Resolve health input.", + SerializedName = @"resolveHealthInput", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResolveHealthInput) })] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResolveHealthInput ResolveHealthInput { get => this._resolveHealthInput; set => this._resolveHealthInput = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of ResolveAzSiteRecoveryReplicationProtectedItemHealthError_ResolveViaIdentity + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.ResolveAzSiteRecoveryReplicationProtectedItemHealthError_ResolveViaIdentity Clone() + { + var clone = new ResolveAzSiteRecoveryReplicationProtectedItemHealthError_ResolveViaIdentity(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.ResolveHealthInput = this.ResolveHealthInput; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationProtectedItemsResolveHealthErrors' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationProtectedItemsResolveHealthErrorsViaIdentity(InputObject.Id, ResolveHealthInput, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.FabricName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.FabricName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ProtectionContainerName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ProtectionContainerName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ReplicatedProtectedItemName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ReplicatedProtectedItemName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationProtectedItemsResolveHealthErrors(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.FabricName ?? null, InputObject.ProtectionContainerName ?? null, InputObject.ReplicatedProtectedItemName ?? null, ResolveHealthInput, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=ResolveHealthInput}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public ResolveAzSiteRecoveryReplicationProtectedItemHealthError_ResolveViaIdentity() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/ResolveAzSiteRecoveryReplicationProtectedItemHealthError_ResolveViaIdentityExpanded.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/ResolveAzSiteRecoveryReplicationProtectedItemHealthError_ResolveViaIdentityExpanded.cs new file mode 100644 index 000000000000..3e23a0ad337e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/ResolveAzSiteRecoveryReplicationProtectedItemHealthError_ResolveViaIdentityExpanded.cs @@ -0,0 +1,425 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Operation to resolve health issues of the replication protected item. + /// + /// [OpenAPI] ResolveHealthErrors=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/resolveHealthErrors" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsDiagnostic.Resolve, @"AzSiteRecoveryReplicationProtectedItemHealthError_ResolveViaIdentityExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Operation to resolve health issues of the replication protected item.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class ResolveAzSiteRecoveryReplicationProtectedItemHealthError_ResolveViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Resolve health input. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResolveHealthInput _resolveHealthInputBody = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ResolveHealthInput(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Health errors. + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Health errors.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Health errors.", + SerializedName = @"healthErrors", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResolveHealthError) })] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResolveHealthError[] HealthError { get => _resolveHealthInputBody.HealthError ?? null /* arrayOf */; set => _resolveHealthInputBody.HealthError = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of ResolveAzSiteRecoveryReplicationProtectedItemHealthError_ResolveViaIdentityExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.ResolveAzSiteRecoveryReplicationProtectedItemHealthError_ResolveViaIdentityExpanded Clone() + { + var clone = new ResolveAzSiteRecoveryReplicationProtectedItemHealthError_ResolveViaIdentityExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._resolveHealthInputBody = this._resolveHealthInputBody; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationProtectedItemsResolveHealthErrors' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationProtectedItemsResolveHealthErrorsViaIdentity(InputObject.Id, _resolveHealthInputBody, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.FabricName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.FabricName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ProtectionContainerName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ProtectionContainerName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ReplicatedProtectedItemName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ReplicatedProtectedItemName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationProtectedItemsResolveHealthErrors(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.FabricName ?? null, InputObject.ProtectionContainerName ?? null, InputObject.ReplicatedProtectedItemName ?? null, _resolveHealthInputBody, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=_resolveHealthInputBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public ResolveAzSiteRecoveryReplicationProtectedItemHealthError_ResolveViaIdentityExpanded() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RestartAzSiteRecoveryReplicationJob_Restart.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RestartAzSiteRecoveryReplicationJob_Restart.cs new file mode 100644 index 000000000000..6fbdee8b404b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RestartAzSiteRecoveryReplicationJob_Restart.cs @@ -0,0 +1,430 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to restart an Azure Site Recovery job. + /// + /// [OpenAPI] Restart=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationJobs/{jobName}/restart" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Restart, @"AzSiteRecoveryReplicationJob_Restart", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJob))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to restart an Azure Site Recovery job.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class RestartAzSiteRecoveryReplicationJob_Restart : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// Backing field for property. + private string _jobName; + + /// Job identifier. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Job identifier.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Job identifier.", + SerializedName = @"jobName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string JobName { get => this._jobName; set => this._jobName = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJob + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of RestartAzSiteRecoveryReplicationJob_Restart + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.RestartAzSiteRecoveryReplicationJob_Restart Clone() + { + var clone = new RestartAzSiteRecoveryReplicationJob_Restart(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + clone.JobName = this.JobName; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationJobsRestart' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationJobsRestart(ResourceName, ResourceGroupName, SubscriptionId, JobName, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,JobName=JobName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public RestartAzSiteRecoveryReplicationJob_Restart() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJob + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJob + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RestartAzSiteRecoveryReplicationJob_RestartViaIdentity.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RestartAzSiteRecoveryReplicationJob_RestartViaIdentity.cs new file mode 100644 index 000000000000..0ba0c378ca9a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/RestartAzSiteRecoveryReplicationJob_RestartViaIdentity.cs @@ -0,0 +1,398 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to restart an Azure Site Recovery job. + /// + /// [OpenAPI] Restart=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationJobs/{jobName}/restart" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Restart, @"AzSiteRecoveryReplicationJob_RestartViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJob))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to restart an Azure Site Recovery job.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class RestartAzSiteRecoveryReplicationJob_RestartViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJob + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of RestartAzSiteRecoveryReplicationJob_RestartViaIdentity + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.RestartAzSiteRecoveryReplicationJob_RestartViaIdentity Clone() + { + var clone = new RestartAzSiteRecoveryReplicationJob_RestartViaIdentity(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationJobsRestart' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationJobsRestartViaIdentity(InputObject.Id, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.JobName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.JobName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationJobsRestart(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.JobName ?? null, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public RestartAzSiteRecoveryReplicationJob_RestartViaIdentity() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJob + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJob + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/ResumeAzSiteRecoveryReplicationJob_Resume.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/ResumeAzSiteRecoveryReplicationJob_Resume.cs new file mode 100644 index 000000000000..b4030e05ae43 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/ResumeAzSiteRecoveryReplicationJob_Resume.cs @@ -0,0 +1,444 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to resume an Azure Site Recovery job. + /// + /// [OpenAPI] Resume=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationJobs/{jobName}/resume" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Resume, @"AzSiteRecoveryReplicationJob_Resume", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJob))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to resume an Azure Site Recovery job.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class ResumeAzSiteRecoveryReplicationJob_Resume : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// Backing field for property. + private string _jobName; + + /// Job identifier. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Job identifier.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Job identifier.", + SerializedName = @"jobName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string JobName { get => this._jobName; set => this._jobName = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeJobParams _resumeJobParam; + + /// Resume job params. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Resume job params.", ValueFromPipeline = true)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Resume job params.", + SerializedName = @"resumeJobParams", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeJobParams) })] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeJobParams ResumeJobParam { get => this._resumeJobParam; set => this._resumeJobParam = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJob + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of ResumeAzSiteRecoveryReplicationJob_Resume + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.ResumeAzSiteRecoveryReplicationJob_Resume Clone() + { + var clone = new ResumeAzSiteRecoveryReplicationJob_Resume(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + clone.JobName = this.JobName; + clone.ResumeJobParam = this.ResumeJobParam; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationJobsResume' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationJobsResume(ResourceName, ResourceGroupName, SubscriptionId, JobName, ResumeJobParam, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,JobName=JobName,body=ResumeJobParam}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public ResumeAzSiteRecoveryReplicationJob_Resume() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJob + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJob + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/ResumeAzSiteRecoveryReplicationJob_ResumeExpanded.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/ResumeAzSiteRecoveryReplicationJob_ResumeExpanded.cs new file mode 100644 index 000000000000..be0b1fe5601e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/ResumeAzSiteRecoveryReplicationJob_ResumeExpanded.cs @@ -0,0 +1,445 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to resume an Azure Site Recovery job. + /// + /// [OpenAPI] Resume=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationJobs/{jobName}/resume" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Resume, @"AzSiteRecoveryReplicationJob_ResumeExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJob))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to resume an Azure Site Recovery job.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class ResumeAzSiteRecoveryReplicationJob_ResumeExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Resume job params. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeJobParams _resumeJobParamsBody = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ResumeJobParams(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// Resume job comments. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Resume job comments.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Resume job comments.", + SerializedName = @"comments", + PossibleTypes = new [] { typeof(string) })] + public string Comment { get => _resumeJobParamsBody.Comment ?? null; set => _resumeJobParamsBody.Comment = value; } + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// Backing field for property. + private string _jobName; + + /// Job identifier. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Job identifier.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Job identifier.", + SerializedName = @"jobName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string JobName { get => this._jobName; set => this._jobName = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJob + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of ResumeAzSiteRecoveryReplicationJob_ResumeExpanded + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.ResumeAzSiteRecoveryReplicationJob_ResumeExpanded Clone() + { + var clone = new ResumeAzSiteRecoveryReplicationJob_ResumeExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._resumeJobParamsBody = this._resumeJobParamsBody; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + clone.JobName = this.JobName; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationJobsResume' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationJobsResume(ResourceName, ResourceGroupName, SubscriptionId, JobName, _resumeJobParamsBody, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,JobName=JobName,body=_resumeJobParamsBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public ResumeAzSiteRecoveryReplicationJob_ResumeExpanded() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJob + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJob + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/ResumeAzSiteRecoveryReplicationJob_ResumeViaIdentity.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/ResumeAzSiteRecoveryReplicationJob_ResumeViaIdentity.cs new file mode 100644 index 000000000000..6bbf1eb27109 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/ResumeAzSiteRecoveryReplicationJob_ResumeViaIdentity.cs @@ -0,0 +1,412 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to resume an Azure Site Recovery job. + /// + /// [OpenAPI] Resume=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationJobs/{jobName}/resume" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Resume, @"AzSiteRecoveryReplicationJob_ResumeViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJob))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to resume an Azure Site Recovery job.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class ResumeAzSiteRecoveryReplicationJob_ResumeViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeJobParams _resumeJobParam; + + /// Resume job params. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Resume job params.", ValueFromPipeline = true)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Resume job params.", + SerializedName = @"resumeJobParams", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeJobParams) })] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeJobParams ResumeJobParam { get => this._resumeJobParam; set => this._resumeJobParam = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJob + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of ResumeAzSiteRecoveryReplicationJob_ResumeViaIdentity + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.ResumeAzSiteRecoveryReplicationJob_ResumeViaIdentity Clone() + { + var clone = new ResumeAzSiteRecoveryReplicationJob_ResumeViaIdentity(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.ResumeJobParam = this.ResumeJobParam; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationJobsResume' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationJobsResumeViaIdentity(InputObject.Id, ResumeJobParam, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.JobName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.JobName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationJobsResume(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.JobName ?? null, ResumeJobParam, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=ResumeJobParam}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public ResumeAzSiteRecoveryReplicationJob_ResumeViaIdentity() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJob + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJob + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/ResumeAzSiteRecoveryReplicationJob_ResumeViaIdentityExpanded.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/ResumeAzSiteRecoveryReplicationJob_ResumeViaIdentityExpanded.cs new file mode 100644 index 000000000000..881c0ea288d7 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/ResumeAzSiteRecoveryReplicationJob_ResumeViaIdentityExpanded.cs @@ -0,0 +1,415 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to resume an Azure Site Recovery job. + /// + /// [OpenAPI] Resume=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationJobs/{jobName}/resume" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Resume, @"AzSiteRecoveryReplicationJob_ResumeViaIdentityExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJob))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to resume an Azure Site Recovery job.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class ResumeAzSiteRecoveryReplicationJob_ResumeViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Resume job params. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeJobParams _resumeJobParamsBody = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ResumeJobParams(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// Resume job comments. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Resume job comments.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Resume job comments.", + SerializedName = @"comments", + PossibleTypes = new [] { typeof(string) })] + public string Comment { get => _resumeJobParamsBody.Comment ?? null; set => _resumeJobParamsBody.Comment = value; } + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJob + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of ResumeAzSiteRecoveryReplicationJob_ResumeViaIdentityExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.ResumeAzSiteRecoveryReplicationJob_ResumeViaIdentityExpanded Clone() + { + var clone = new ResumeAzSiteRecoveryReplicationJob_ResumeViaIdentityExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._resumeJobParamsBody = this._resumeJobParamsBody; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationJobsResume' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationJobsResumeViaIdentity(InputObject.Id, _resumeJobParamsBody, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.JobName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.JobName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationJobsResume(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.JobName ?? null, _resumeJobParamsBody, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=_resumeJobParamsBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public ResumeAzSiteRecoveryReplicationJob_ResumeViaIdentityExpanded() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJob + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJob + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/ResumeAzSiteRecoveryReplicationMigrationItemReplication_Resume.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/ResumeAzSiteRecoveryReplicationMigrationItemReplication_Resume.cs new file mode 100644 index 000000000000..2e270cca7a08 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/ResumeAzSiteRecoveryReplicationMigrationItemReplication_Resume.cs @@ -0,0 +1,477 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to initiate resume replication of the item. + /// + /// [OpenAPI] ResumeReplication=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/resumeReplication" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Resume, @"AzSiteRecoveryReplicationMigrationItemReplication_Resume", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to initiate resume replication of the item.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class ResumeAzSiteRecoveryReplicationMigrationItemReplication_Resume : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// Fabric name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Fabric name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Fabric name.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _migrationItemName; + + /// Migration item name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Migration item name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Migration item name.", + SerializedName = @"migrationItemName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string MigrationItemName { get => this._migrationItemName; set => this._migrationItemName = value; } + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _protectionContainerName; + + /// Protection container name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Protection container name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Protection container name.", + SerializedName = @"protectionContainerName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ProtectionContainerName { get => this._protectionContainerName; set => this._protectionContainerName = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationInput _resumeReplicationInput; + + /// Resume replication input. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Resume replication input.", ValueFromPipeline = true)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Resume replication input.", + SerializedName = @"resumeReplicationInput", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationInput) })] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationInput ResumeReplicationInput { get => this._resumeReplicationInput; set => this._resumeReplicationInput = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of ResumeAzSiteRecoveryReplicationMigrationItemReplication_Resume + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.ResumeAzSiteRecoveryReplicationMigrationItemReplication_Resume Clone() + { + var clone = new ResumeAzSiteRecoveryReplicationMigrationItemReplication_Resume(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + clone.FabricName = this.FabricName; + clone.ProtectionContainerName = this.ProtectionContainerName; + clone.MigrationItemName = this.MigrationItemName; + clone.ResumeReplicationInput = this.ResumeReplicationInput; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationMigrationItemsResumeReplication' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationMigrationItemsResumeReplication(ResourceName, ResourceGroupName, SubscriptionId, FabricName, ProtectionContainerName, MigrationItemName, ResumeReplicationInput, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName,ProtectionContainerName=ProtectionContainerName,MigrationItemName=MigrationItemName,body=ResumeReplicationInput}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet + /// class. + /// + public ResumeAzSiteRecoveryReplicationMigrationItemReplication_Resume() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/ResumeAzSiteRecoveryReplicationMigrationItemReplication_ResumeExpanded.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/ResumeAzSiteRecoveryReplicationMigrationItemReplication_ResumeExpanded.cs new file mode 100644 index 000000000000..687984f0d038 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/ResumeAzSiteRecoveryReplicationMigrationItemReplication_ResumeExpanded.cs @@ -0,0 +1,478 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to initiate resume replication of the item. + /// + /// [OpenAPI] ResumeReplication=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/resumeReplication" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Resume, @"AzSiteRecoveryReplicationMigrationItemReplication_ResumeExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to initiate resume replication of the item.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class ResumeAzSiteRecoveryReplicationMigrationItemReplication_ResumeExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Resume replication input. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationInput _resumeReplicationInputBody = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ResumeReplicationInput(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// Fabric name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Fabric name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Fabric name.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _migrationItemName; + + /// Migration item name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Migration item name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Migration item name.", + SerializedName = @"migrationItemName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string MigrationItemName { get => this._migrationItemName; set => this._migrationItemName = value; } + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _protectionContainerName; + + /// Protection container name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Protection container name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Protection container name.", + SerializedName = @"protectionContainerName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ProtectionContainerName { get => this._protectionContainerName; set => this._protectionContainerName = value; } + + /// The class type. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The class type.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + public string ProviderSpecificDetailInstanceType { get => _resumeReplicationInputBody.ProviderSpecificDetailInstanceType ?? null; set => _resumeReplicationInputBody.ProviderSpecificDetailInstanceType = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of ResumeAzSiteRecoveryReplicationMigrationItemReplication_ResumeExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.ResumeAzSiteRecoveryReplicationMigrationItemReplication_ResumeExpanded Clone() + { + var clone = new ResumeAzSiteRecoveryReplicationMigrationItemReplication_ResumeExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._resumeReplicationInputBody = this._resumeReplicationInputBody; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + clone.FabricName = this.FabricName; + clone.ProtectionContainerName = this.ProtectionContainerName; + clone.MigrationItemName = this.MigrationItemName; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationMigrationItemsResumeReplication' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationMigrationItemsResumeReplication(ResourceName, ResourceGroupName, SubscriptionId, FabricName, ProtectionContainerName, MigrationItemName, _resumeReplicationInputBody, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName,ProtectionContainerName=ProtectionContainerName,MigrationItemName=MigrationItemName,body=_resumeReplicationInputBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the + /// cmdlet class. + /// + public ResumeAzSiteRecoveryReplicationMigrationItemReplication_ResumeExpanded() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/ResumeAzSiteRecoveryReplicationMigrationItemReplication_ResumeViaIdentity.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/ResumeAzSiteRecoveryReplicationMigrationItemReplication_ResumeViaIdentity.cs new file mode 100644 index 000000000000..3df1eff22fee --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/ResumeAzSiteRecoveryReplicationMigrationItemReplication_ResumeViaIdentity.cs @@ -0,0 +1,423 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to initiate resume replication of the item. + /// + /// [OpenAPI] ResumeReplication=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/resumeReplication" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Resume, @"AzSiteRecoveryReplicationMigrationItemReplication_ResumeViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to initiate resume replication of the item.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class ResumeAzSiteRecoveryReplicationMigrationItemReplication_ResumeViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationInput _resumeReplicationInput; + + /// Resume replication input. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Resume replication input.", ValueFromPipeline = true)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Resume replication input.", + SerializedName = @"resumeReplicationInput", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationInput) })] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationInput ResumeReplicationInput { get => this._resumeReplicationInput; set => this._resumeReplicationInput = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of ResumeAzSiteRecoveryReplicationMigrationItemReplication_ResumeViaIdentity + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.ResumeAzSiteRecoveryReplicationMigrationItemReplication_ResumeViaIdentity Clone() + { + var clone = new ResumeAzSiteRecoveryReplicationMigrationItemReplication_ResumeViaIdentity(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.ResumeReplicationInput = this.ResumeReplicationInput; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationMigrationItemsResumeReplication' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationMigrationItemsResumeReplicationViaIdentity(InputObject.Id, ResumeReplicationInput, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.FabricName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.FabricName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ProtectionContainerName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ProtectionContainerName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.MigrationItemName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.MigrationItemName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationMigrationItemsResumeReplication(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.FabricName ?? null, InputObject.ProtectionContainerName ?? null, InputObject.MigrationItemName ?? null, ResumeReplicationInput, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=ResumeReplicationInput}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public ResumeAzSiteRecoveryReplicationMigrationItemReplication_ResumeViaIdentity() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/ResumeAzSiteRecoveryReplicationMigrationItemReplication_ResumeViaIdentityExpanded.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/ResumeAzSiteRecoveryReplicationMigrationItemReplication_ResumeViaIdentityExpanded.cs new file mode 100644 index 000000000000..0e532faecafc --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/ResumeAzSiteRecoveryReplicationMigrationItemReplication_ResumeViaIdentityExpanded.cs @@ -0,0 +1,424 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to initiate resume replication of the item. + /// + /// [OpenAPI] ResumeReplication=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/resumeReplication" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Resume, @"AzSiteRecoveryReplicationMigrationItemReplication_ResumeViaIdentityExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to initiate resume replication of the item.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class ResumeAzSiteRecoveryReplicationMigrationItemReplication_ResumeViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Resume replication input. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IResumeReplicationInput _resumeReplicationInputBody = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ResumeReplicationInput(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The class type. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The class type.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + public string ProviderSpecificDetailInstanceType { get => _resumeReplicationInputBody.ProviderSpecificDetailInstanceType ?? null; set => _resumeReplicationInputBody.ProviderSpecificDetailInstanceType = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of ResumeAzSiteRecoveryReplicationMigrationItemReplication_ResumeViaIdentityExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.ResumeAzSiteRecoveryReplicationMigrationItemReplication_ResumeViaIdentityExpanded Clone() + { + var clone = new ResumeAzSiteRecoveryReplicationMigrationItemReplication_ResumeViaIdentityExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._resumeReplicationInputBody = this._resumeReplicationInputBody; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationMigrationItemsResumeReplication' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationMigrationItemsResumeReplicationViaIdentity(InputObject.Id, _resumeReplicationInputBody, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.FabricName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.FabricName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ProtectionContainerName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ProtectionContainerName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.MigrationItemName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.MigrationItemName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationMigrationItemsResumeReplication(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.FabricName ?? null, InputObject.ProtectionContainerName ?? null, InputObject.MigrationItemName ?? null, _resumeReplicationInputBody, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=_resumeReplicationInputBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public ResumeAzSiteRecoveryReplicationMigrationItemReplication_ResumeViaIdentityExpanded() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/StopAzSiteRecoveryReplicationJob_Cancel.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/StopAzSiteRecoveryReplicationJob_Cancel.cs new file mode 100644 index 000000000000..42207451c52d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/StopAzSiteRecoveryReplicationJob_Cancel.cs @@ -0,0 +1,430 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to cancel an Azure Site Recovery job. + /// + /// [OpenAPI] Cancel=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationJobs/{jobName}/cancel" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Stop, @"AzSiteRecoveryReplicationJob_Cancel", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJob))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to cancel an Azure Site Recovery job.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class StopAzSiteRecoveryReplicationJob_Cancel : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// Backing field for property. + private string _jobName; + + /// Job identifier. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Job identifier.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Job identifier.", + SerializedName = @"jobName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string JobName { get => this._jobName; set => this._jobName = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJob + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of StopAzSiteRecoveryReplicationJob_Cancel + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.StopAzSiteRecoveryReplicationJob_Cancel Clone() + { + var clone = new StopAzSiteRecoveryReplicationJob_Cancel(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + clone.JobName = this.JobName; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationJobsCancel' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationJobsCancel(ResourceName, ResourceGroupName, SubscriptionId, JobName, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,JobName=JobName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public StopAzSiteRecoveryReplicationJob_Cancel() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJob + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJob + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/StopAzSiteRecoveryReplicationJob_CancelViaIdentity.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/StopAzSiteRecoveryReplicationJob_CancelViaIdentity.cs new file mode 100644 index 000000000000..e805015a0884 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/StopAzSiteRecoveryReplicationJob_CancelViaIdentity.cs @@ -0,0 +1,398 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to cancel an Azure Site Recovery job. + /// + /// [OpenAPI] Cancel=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationJobs/{jobName}/cancel" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Stop, @"AzSiteRecoveryReplicationJob_CancelViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJob))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to cancel an Azure Site Recovery job.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class StopAzSiteRecoveryReplicationJob_CancelViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJob + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of StopAzSiteRecoveryReplicationJob_CancelViaIdentity + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.StopAzSiteRecoveryReplicationJob_CancelViaIdentity Clone() + { + var clone = new StopAzSiteRecoveryReplicationJob_CancelViaIdentity(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationJobsCancel' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationJobsCancelViaIdentity(InputObject.Id, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.JobName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.JobName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationJobsCancel(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.JobName ?? null, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public StopAzSiteRecoveryReplicationJob_CancelViaIdentity() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJob + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IJob + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/StopAzSiteRecoveryReplicationProtectedItemFailover_Cancel.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/StopAzSiteRecoveryReplicationProtectedItemFailover_Cancel.cs new file mode 100644 index 000000000000..f3792095e941 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/StopAzSiteRecoveryReplicationProtectedItemFailover_Cancel.cs @@ -0,0 +1,462 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Operation to cancel the failover of the replication protected item. + /// + /// [OpenAPI] FailoverCancel=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/failoverCancel" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Stop, @"AzSiteRecoveryReplicationProtectedItemFailover_Cancel", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Operation to cancel the failover of the replication protected item.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class StopAzSiteRecoveryReplicationProtectedItemFailover_Cancel : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// Unique fabric name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Unique fabric name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Unique fabric name.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _protectionContainerName; + + /// Protection container name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Protection container name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Protection container name.", + SerializedName = @"protectionContainerName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ProtectionContainerName { get => this._protectionContainerName; set => this._protectionContainerName = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _replicatedProtectedItemName; + + /// Replication protected item name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Replication protected item name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Replication protected item name.", + SerializedName = @"replicatedProtectedItemName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ReplicatedProtectedItemName { get => this._replicatedProtectedItemName; set => this._replicatedProtectedItemName = value; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of StopAzSiteRecoveryReplicationProtectedItemFailover_Cancel + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.StopAzSiteRecoveryReplicationProtectedItemFailover_Cancel Clone() + { + var clone = new StopAzSiteRecoveryReplicationProtectedItemFailover_Cancel(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + clone.FabricName = this.FabricName; + clone.ProtectionContainerName = this.ProtectionContainerName; + clone.ReplicatedProtectedItemName = this.ReplicatedProtectedItemName; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationProtectedItemsFailoverCancel' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationProtectedItemsFailoverCancel(ResourceName, ResourceGroupName, SubscriptionId, FabricName, ProtectionContainerName, ReplicatedProtectedItemName, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName,ProtectionContainerName=ProtectionContainerName,ReplicatedProtectedItemName=ReplicatedProtectedItemName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public StopAzSiteRecoveryReplicationProtectedItemFailover_Cancel() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/StopAzSiteRecoveryReplicationProtectedItemFailover_CancelViaIdentity.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/StopAzSiteRecoveryReplicationProtectedItemFailover_CancelViaIdentity.cs new file mode 100644 index 000000000000..2993eceff08e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/StopAzSiteRecoveryReplicationProtectedItemFailover_CancelViaIdentity.cs @@ -0,0 +1,409 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Operation to cancel the failover of the replication protected item. + /// + /// [OpenAPI] FailoverCancel=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/failoverCancel" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Stop, @"AzSiteRecoveryReplicationProtectedItemFailover_CancelViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Operation to cancel the failover of the replication protected item.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class StopAzSiteRecoveryReplicationProtectedItemFailover_CancelViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of StopAzSiteRecoveryReplicationProtectedItemFailover_CancelViaIdentity + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.StopAzSiteRecoveryReplicationProtectedItemFailover_CancelViaIdentity Clone() + { + var clone = new StopAzSiteRecoveryReplicationProtectedItemFailover_CancelViaIdentity(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationProtectedItemsFailoverCancel' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationProtectedItemsFailoverCancelViaIdentity(InputObject.Id, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.FabricName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.FabricName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ProtectionContainerName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ProtectionContainerName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ReplicatedProtectedItemName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ReplicatedProtectedItemName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationProtectedItemsFailoverCancel(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.FabricName ?? null, InputObject.ProtectionContainerName ?? null, InputObject.ReplicatedProtectedItemName ?? null, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet + /// class. + /// + public StopAzSiteRecoveryReplicationProtectedItemFailover_CancelViaIdentity() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/StopAzSiteRecoveryReplicationRecoveryPlanFailover_Cancel.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/StopAzSiteRecoveryReplicationRecoveryPlanFailover_Cancel.cs new file mode 100644 index 000000000000..3966ac6ab3ff --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/StopAzSiteRecoveryReplicationRecoveryPlanFailover_Cancel.cs @@ -0,0 +1,432 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to cancel the failover of a recovery plan. + /// + /// [OpenAPI] FailoverCancel=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/failoverCancel" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Stop, @"AzSiteRecoveryReplicationRecoveryPlanFailover_Cancel", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to cancel the failover of a recovery plan.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class StopAzSiteRecoveryReplicationRecoveryPlanFailover_Cancel : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _recoveryPlanName; + + /// Recovery plan name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Recovery plan name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Recovery plan name.", + SerializedName = @"recoveryPlanName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string RecoveryPlanName { get => this._recoveryPlanName; set => this._recoveryPlanName = value; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of StopAzSiteRecoveryReplicationRecoveryPlanFailover_Cancel + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.StopAzSiteRecoveryReplicationRecoveryPlanFailover_Cancel Clone() + { + var clone = new StopAzSiteRecoveryReplicationRecoveryPlanFailover_Cancel(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + clone.RecoveryPlanName = this.RecoveryPlanName; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationRecoveryPlansFailoverCancel' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationRecoveryPlansFailoverCancel(ResourceName, ResourceGroupName, SubscriptionId, RecoveryPlanName, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,RecoveryPlanName=RecoveryPlanName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public StopAzSiteRecoveryReplicationRecoveryPlanFailover_Cancel() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/StopAzSiteRecoveryReplicationRecoveryPlanFailover_CancelViaIdentity.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/StopAzSiteRecoveryReplicationRecoveryPlanFailover_CancelViaIdentity.cs new file mode 100644 index 000000000000..867e40623a1a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/StopAzSiteRecoveryReplicationRecoveryPlanFailover_CancelViaIdentity.cs @@ -0,0 +1,401 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to cancel the failover of a recovery plan. + /// + /// [OpenAPI] FailoverCancel=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/failoverCancel" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Stop, @"AzSiteRecoveryReplicationRecoveryPlanFailover_CancelViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to cancel the failover of a recovery plan.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class StopAzSiteRecoveryReplicationRecoveryPlanFailover_CancelViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of StopAzSiteRecoveryReplicationRecoveryPlanFailover_CancelViaIdentity + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.StopAzSiteRecoveryReplicationRecoveryPlanFailover_CancelViaIdentity Clone() + { + var clone = new StopAzSiteRecoveryReplicationRecoveryPlanFailover_CancelViaIdentity(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationRecoveryPlansFailoverCancel' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationRecoveryPlansFailoverCancelViaIdentity(InputObject.Id, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.RecoveryPlanName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.RecoveryPlanName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationRecoveryPlansFailoverCancel(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.RecoveryPlanName ?? null, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet + /// class. + /// + public StopAzSiteRecoveryReplicationRecoveryPlanFailover_CancelViaIdentity() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/SuspendAzSiteRecoveryReplicationMigrationItemReplication_Pause.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/SuspendAzSiteRecoveryReplicationMigrationItemReplication_Pause.cs new file mode 100644 index 000000000000..4e682378e159 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/SuspendAzSiteRecoveryReplicationMigrationItemReplication_Pause.cs @@ -0,0 +1,477 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to initiate pause replication of the item. + /// + /// [OpenAPI] PauseReplication=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/pauseReplication" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Suspend, @"AzSiteRecoveryReplicationMigrationItemReplication_Pause", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to initiate pause replication of the item.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class SuspendAzSiteRecoveryReplicationMigrationItemReplication_Pause : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// Fabric name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Fabric name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Fabric name.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _migrationItemName; + + /// Migration item name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Migration item name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Migration item name.", + SerializedName = @"migrationItemName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string MigrationItemName { get => this._migrationItemName; set => this._migrationItemName = value; } + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPauseReplicationInput _pauseReplicationInput; + + /// Pause replication input. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Pause replication input.", ValueFromPipeline = true)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Pause replication input.", + SerializedName = @"pauseReplicationInput", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPauseReplicationInput) })] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPauseReplicationInput PauseReplicationInput { get => this._pauseReplicationInput; set => this._pauseReplicationInput = value; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _protectionContainerName; + + /// Protection container name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Protection container name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Protection container name.", + SerializedName = @"protectionContainerName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ProtectionContainerName { get => this._protectionContainerName; set => this._protectionContainerName = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of SuspendAzSiteRecoveryReplicationMigrationItemReplication_Pause + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.SuspendAzSiteRecoveryReplicationMigrationItemReplication_Pause Clone() + { + var clone = new SuspendAzSiteRecoveryReplicationMigrationItemReplication_Pause(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + clone.FabricName = this.FabricName; + clone.ProtectionContainerName = this.ProtectionContainerName; + clone.MigrationItemName = this.MigrationItemName; + clone.PauseReplicationInput = this.PauseReplicationInput; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationMigrationItemsPauseReplication' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationMigrationItemsPauseReplication(ResourceName, ResourceGroupName, SubscriptionId, FabricName, ProtectionContainerName, MigrationItemName, PauseReplicationInput, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName,ProtectionContainerName=ProtectionContainerName,MigrationItemName=MigrationItemName,body=PauseReplicationInput}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the cmdlet + /// class. + /// + public SuspendAzSiteRecoveryReplicationMigrationItemReplication_Pause() + { + + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/SuspendAzSiteRecoveryReplicationMigrationItemReplication_PauseExpanded.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/SuspendAzSiteRecoveryReplicationMigrationItemReplication_PauseExpanded.cs new file mode 100644 index 000000000000..7ecd4cda70ca --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/SuspendAzSiteRecoveryReplicationMigrationItemReplication_PauseExpanded.cs @@ -0,0 +1,478 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to initiate pause replication of the item. + /// + /// [OpenAPI] PauseReplication=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/pauseReplication" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Suspend, @"AzSiteRecoveryReplicationMigrationItemReplication_PauseExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to initiate pause replication of the item.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class SuspendAzSiteRecoveryReplicationMigrationItemReplication_PauseExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Pause replication input. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPauseReplicationInput _pauseReplicationInputBody = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PauseReplicationInput(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// Fabric name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Fabric name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Fabric name.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// The class type. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The class type.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + public string InstanceType { get => _pauseReplicationInputBody.InstanceType ?? null; set => _pauseReplicationInputBody.InstanceType = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _migrationItemName; + + /// Migration item name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Migration item name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Migration item name.", + SerializedName = @"migrationItemName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string MigrationItemName { get => this._migrationItemName; set => this._migrationItemName = value; } + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _protectionContainerName; + + /// Protection container name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Protection container name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Protection container name.", + SerializedName = @"protectionContainerName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ProtectionContainerName { get => this._protectionContainerName; set => this._protectionContainerName = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of SuspendAzSiteRecoveryReplicationMigrationItemReplication_PauseExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.SuspendAzSiteRecoveryReplicationMigrationItemReplication_PauseExpanded Clone() + { + var clone = new SuspendAzSiteRecoveryReplicationMigrationItemReplication_PauseExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._pauseReplicationInputBody = this._pauseReplicationInputBody; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + clone.FabricName = this.FabricName; + clone.ProtectionContainerName = this.ProtectionContainerName; + clone.MigrationItemName = this.MigrationItemName; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationMigrationItemsPauseReplication' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationMigrationItemsPauseReplication(ResourceName, ResourceGroupName, SubscriptionId, FabricName, ProtectionContainerName, MigrationItemName, _pauseReplicationInputBody, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName,ProtectionContainerName=ProtectionContainerName,MigrationItemName=MigrationItemName,body=_pauseReplicationInputBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the + /// cmdlet class. + /// + public SuspendAzSiteRecoveryReplicationMigrationItemReplication_PauseExpanded() + { + + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/SuspendAzSiteRecoveryReplicationMigrationItemReplication_PauseViaIdentity.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/SuspendAzSiteRecoveryReplicationMigrationItemReplication_PauseViaIdentity.cs new file mode 100644 index 000000000000..7e82e439ed9c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/SuspendAzSiteRecoveryReplicationMigrationItemReplication_PauseViaIdentity.cs @@ -0,0 +1,423 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to initiate pause replication of the item. + /// + /// [OpenAPI] PauseReplication=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/pauseReplication" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Suspend, @"AzSiteRecoveryReplicationMigrationItemReplication_PauseViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to initiate pause replication of the item.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class SuspendAzSiteRecoveryReplicationMigrationItemReplication_PauseViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPauseReplicationInput _pauseReplicationInput; + + /// Pause replication input. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Pause replication input.", ValueFromPipeline = true)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Pause replication input.", + SerializedName = @"pauseReplicationInput", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPauseReplicationInput) })] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPauseReplicationInput PauseReplicationInput { get => this._pauseReplicationInput; set => this._pauseReplicationInput = value; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of SuspendAzSiteRecoveryReplicationMigrationItemReplication_PauseViaIdentity + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.SuspendAzSiteRecoveryReplicationMigrationItemReplication_PauseViaIdentity Clone() + { + var clone = new SuspendAzSiteRecoveryReplicationMigrationItemReplication_PauseViaIdentity(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.PauseReplicationInput = this.PauseReplicationInput; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationMigrationItemsPauseReplication' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationMigrationItemsPauseReplicationViaIdentity(InputObject.Id, PauseReplicationInput, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.FabricName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.FabricName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ProtectionContainerName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ProtectionContainerName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.MigrationItemName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.MigrationItemName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationMigrationItemsPauseReplication(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.FabricName ?? null, InputObject.ProtectionContainerName ?? null, InputObject.MigrationItemName ?? null, PauseReplicationInput, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=PauseReplicationInput}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public SuspendAzSiteRecoveryReplicationMigrationItemReplication_PauseViaIdentity() + { + + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/SuspendAzSiteRecoveryReplicationMigrationItemReplication_PauseViaIdentityExpanded.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/SuspendAzSiteRecoveryReplicationMigrationItemReplication_PauseViaIdentityExpanded.cs new file mode 100644 index 000000000000..1729a2902352 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/SuspendAzSiteRecoveryReplicationMigrationItemReplication_PauseViaIdentityExpanded.cs @@ -0,0 +1,424 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to initiate pause replication of the item. + /// + /// [OpenAPI] PauseReplication=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/pauseReplication" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Suspend, @"AzSiteRecoveryReplicationMigrationItemReplication_PauseViaIdentityExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to initiate pause replication of the item.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class SuspendAzSiteRecoveryReplicationMigrationItemReplication_PauseViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Pause replication input. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPauseReplicationInput _pauseReplicationInputBody = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.PauseReplicationInput(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// The class type. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The class type.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + public string InstanceType { get => _pauseReplicationInputBody.InstanceType ?? null; set => _pauseReplicationInputBody.InstanceType = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of SuspendAzSiteRecoveryReplicationMigrationItemReplication_PauseViaIdentityExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.SuspendAzSiteRecoveryReplicationMigrationItemReplication_PauseViaIdentityExpanded Clone() + { + var clone = new SuspendAzSiteRecoveryReplicationMigrationItemReplication_PauseViaIdentityExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._pauseReplicationInputBody = this._pauseReplicationInputBody; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationMigrationItemsPauseReplication' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationMigrationItemsPauseReplicationViaIdentity(InputObject.Id, _pauseReplicationInputBody, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.FabricName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.FabricName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ProtectionContainerName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ProtectionContainerName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.MigrationItemName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.MigrationItemName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationMigrationItemsPauseReplication(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.FabricName ?? null, InputObject.ProtectionContainerName ?? null, InputObject.MigrationItemName ?? null, _pauseReplicationInputBody, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=_pauseReplicationInputBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public SuspendAzSiteRecoveryReplicationMigrationItemReplication_PauseViaIdentityExpanded() + { + + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/SwitchAzSiteRecoveryReplicationProtectedItemProvider_Switch.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/SwitchAzSiteRecoveryReplicationProtectedItemProvider_Switch.cs new file mode 100644 index 000000000000..74cbb929ab8c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/SwitchAzSiteRecoveryReplicationProtectedItemProvider_Switch.cs @@ -0,0 +1,476 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Operation to initiate a switch provider of the replication protected item. + /// + /// [OpenAPI] SwitchProvider=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/switchProvider" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Switch, @"AzSiteRecoveryReplicationProtectedItemProvider_Switch", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Operation to initiate a switch provider of the replication protected item.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class SwitchAzSiteRecoveryReplicationProtectedItemProvider_Switch : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// Unique fabric name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Unique fabric name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Unique fabric name.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _protectionContainerName; + + /// Protection container name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Protection container name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Protection container name.", + SerializedName = @"protectionContainerName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ProtectionContainerName { get => this._protectionContainerName; set => this._protectionContainerName = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _replicatedProtectedItemName; + + /// Replication protected item name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Replication protected item name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Replication protected item name.", + SerializedName = @"replicatedProtectedItemName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ReplicatedProtectedItemName { get => this._replicatedProtectedItemName; set => this._replicatedProtectedItemName = value; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderInput _switchProviderInput; + + /// Input definition for switch provider. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Input definition for switch provider.", ValueFromPipeline = true)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Input definition for switch provider.", + SerializedName = @"switchProviderInput", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderInput) })] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderInput SwitchProviderInput { get => this._switchProviderInput; set => this._switchProviderInput = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of SwitchAzSiteRecoveryReplicationProtectedItemProvider_Switch + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.SwitchAzSiteRecoveryReplicationProtectedItemProvider_Switch Clone() + { + var clone = new SwitchAzSiteRecoveryReplicationProtectedItemProvider_Switch(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + clone.FabricName = this.FabricName; + clone.ProtectionContainerName = this.ProtectionContainerName; + clone.ReplicatedProtectedItemName = this.ReplicatedProtectedItemName; + clone.SwitchProviderInput = this.SwitchProviderInput; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationProtectedItemsSwitchProvider' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationProtectedItemsSwitchProvider(ResourceName, ResourceGroupName, SubscriptionId, FabricName, ProtectionContainerName, ReplicatedProtectedItemName, SwitchProviderInput, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName,ProtectionContainerName=ProtectionContainerName,ReplicatedProtectedItemName=ReplicatedProtectedItemName,body=SwitchProviderInput}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public SwitchAzSiteRecoveryReplicationProtectedItemProvider_Switch() + { + + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/SwitchAzSiteRecoveryReplicationProtectedItemProvider_SwitchExpanded.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/SwitchAzSiteRecoveryReplicationProtectedItemProvider_SwitchExpanded.cs new file mode 100644 index 000000000000..fd969f7adbd5 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/SwitchAzSiteRecoveryReplicationProtectedItemProvider_SwitchExpanded.cs @@ -0,0 +1,489 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Operation to initiate a switch provider of the replication protected item. + /// + /// [OpenAPI] SwitchProvider=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/switchProvider" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Switch, @"AzSiteRecoveryReplicationProtectedItemProvider_SwitchExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Operation to initiate a switch provider of the replication protected item.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class SwitchAzSiteRecoveryReplicationProtectedItemProvider_SwitchExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Input definition for switch provider. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderInput _switchProviderInputBody = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.SwitchProviderInput(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// Unique fabric name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Unique fabric name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Unique fabric name.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _protectionContainerName; + + /// Protection container name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Protection container name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Protection container name.", + SerializedName = @"protectionContainerName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ProtectionContainerName { get => this._protectionContainerName; set => this._protectionContainerName = value; } + + /// The class type. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The class type.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + public string ProviderSpecificDetailInstanceType { get => _switchProviderInputBody.ProviderSpecificDetailInstanceType ?? null; set => _switchProviderInputBody.ProviderSpecificDetailInstanceType = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _replicatedProtectedItemName; + + /// Replication protected item name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Replication protected item name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Replication protected item name.", + SerializedName = @"replicatedProtectedItemName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ReplicatedProtectedItemName { get => this._replicatedProtectedItemName; set => this._replicatedProtectedItemName = value; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Target provider type. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Target provider type.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Target provider type.", + SerializedName = @"targetInstanceType", + PossibleTypes = new [] { typeof(string) })] + public string TargetInstanceType { get => _switchProviderInputBody.TargetInstanceType ?? null; set => _switchProviderInputBody.TargetInstanceType = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of SwitchAzSiteRecoveryReplicationProtectedItemProvider_SwitchExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.SwitchAzSiteRecoveryReplicationProtectedItemProvider_SwitchExpanded Clone() + { + var clone = new SwitchAzSiteRecoveryReplicationProtectedItemProvider_SwitchExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._switchProviderInputBody = this._switchProviderInputBody; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + clone.FabricName = this.FabricName; + clone.ProtectionContainerName = this.ProtectionContainerName; + clone.ReplicatedProtectedItemName = this.ReplicatedProtectedItemName; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationProtectedItemsSwitchProvider' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationProtectedItemsSwitchProvider(ResourceName, ResourceGroupName, SubscriptionId, FabricName, ProtectionContainerName, ReplicatedProtectedItemName, _switchProviderInputBody, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName,ProtectionContainerName=ProtectionContainerName,ReplicatedProtectedItemName=ReplicatedProtectedItemName,body=_switchProviderInputBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the cmdlet + /// class. + /// + public SwitchAzSiteRecoveryReplicationProtectedItemProvider_SwitchExpanded() + { + + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/SwitchAzSiteRecoveryReplicationProtectedItemProvider_SwitchViaIdentity.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/SwitchAzSiteRecoveryReplicationProtectedItemProvider_SwitchViaIdentity.cs new file mode 100644 index 000000000000..2f8dc90d39fd --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/SwitchAzSiteRecoveryReplicationProtectedItemProvider_SwitchViaIdentity.cs @@ -0,0 +1,423 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Operation to initiate a switch provider of the replication protected item. + /// + /// [OpenAPI] SwitchProvider=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/switchProvider" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Switch, @"AzSiteRecoveryReplicationProtectedItemProvider_SwitchViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Operation to initiate a switch provider of the replication protected item.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class SwitchAzSiteRecoveryReplicationProtectedItemProvider_SwitchViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderInput _switchProviderInput; + + /// Input definition for switch provider. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Input definition for switch provider.", ValueFromPipeline = true)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Input definition for switch provider.", + SerializedName = @"switchProviderInput", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderInput) })] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderInput SwitchProviderInput { get => this._switchProviderInput; set => this._switchProviderInput = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of SwitchAzSiteRecoveryReplicationProtectedItemProvider_SwitchViaIdentity + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.SwitchAzSiteRecoveryReplicationProtectedItemProvider_SwitchViaIdentity Clone() + { + var clone = new SwitchAzSiteRecoveryReplicationProtectedItemProvider_SwitchViaIdentity(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.SwitchProviderInput = this.SwitchProviderInput; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationProtectedItemsSwitchProvider' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationProtectedItemsSwitchProviderViaIdentity(InputObject.Id, SwitchProviderInput, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.FabricName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.FabricName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ProtectionContainerName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ProtectionContainerName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ReplicatedProtectedItemName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ReplicatedProtectedItemName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationProtectedItemsSwitchProvider(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.FabricName ?? null, InputObject.ProtectionContainerName ?? null, InputObject.ReplicatedProtectedItemName ?? null, SwitchProviderInput, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=SwitchProviderInput}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the + /// cmdlet class. + /// + public SwitchAzSiteRecoveryReplicationProtectedItemProvider_SwitchViaIdentity() + { + + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/SwitchAzSiteRecoveryReplicationProtectedItemProvider_SwitchViaIdentityExpanded.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/SwitchAzSiteRecoveryReplicationProtectedItemProvider_SwitchViaIdentityExpanded.cs new file mode 100644 index 000000000000..c9949019a488 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/SwitchAzSiteRecoveryReplicationProtectedItemProvider_SwitchViaIdentityExpanded.cs @@ -0,0 +1,435 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Operation to initiate a switch provider of the replication protected item. + /// + /// [OpenAPI] SwitchProvider=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/switchProvider" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Switch, @"AzSiteRecoveryReplicationProtectedItemProvider_SwitchViaIdentityExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Operation to initiate a switch provider of the replication protected item.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class SwitchAzSiteRecoveryReplicationProtectedItemProvider_SwitchViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Input definition for switch provider. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProviderInput _switchProviderInputBody = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.SwitchProviderInput(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The class type. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The class type.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + public string ProviderSpecificDetailInstanceType { get => _switchProviderInputBody.ProviderSpecificDetailInstanceType ?? null; set => _switchProviderInputBody.ProviderSpecificDetailInstanceType = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Target provider type. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Target provider type.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Target provider type.", + SerializedName = @"targetInstanceType", + PossibleTypes = new [] { typeof(string) })] + public string TargetInstanceType { get => _switchProviderInputBody.TargetInstanceType ?? null; set => _switchProviderInputBody.TargetInstanceType = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of SwitchAzSiteRecoveryReplicationProtectedItemProvider_SwitchViaIdentityExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.SwitchAzSiteRecoveryReplicationProtectedItemProvider_SwitchViaIdentityExpanded Clone() + { + var clone = new SwitchAzSiteRecoveryReplicationProtectedItemProvider_SwitchViaIdentityExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._switchProviderInputBody = this._switchProviderInputBody; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationProtectedItemsSwitchProvider' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationProtectedItemsSwitchProviderViaIdentity(InputObject.Id, _switchProviderInputBody, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.FabricName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.FabricName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ProtectionContainerName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ProtectionContainerName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ReplicatedProtectedItemName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ReplicatedProtectedItemName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationProtectedItemsSwitchProvider(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.FabricName ?? null, InputObject.ProtectionContainerName ?? null, InputObject.ReplicatedProtectedItemName ?? null, _switchProviderInputBody, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=_switchProviderInputBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public SwitchAzSiteRecoveryReplicationProtectedItemProvider_SwitchViaIdentityExpanded() + { + + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/SwitchAzSiteRecoveryReplicationProtectionContainerProtection_Switch.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/SwitchAzSiteRecoveryReplicationProtectionContainerProtection_Switch.cs new file mode 100644 index 000000000000..4282852a1008 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/SwitchAzSiteRecoveryReplicationProtectionContainerProtection_Switch.cs @@ -0,0 +1,464 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// + /// Operation to switch protection from one container to another or one replication provider to another. + /// + /// + /// [OpenAPI] SwitchProtection=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/switchprotection" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Switch, @"AzSiteRecoveryReplicationProtectionContainerProtection_Switch", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainer))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Operation to switch protection from one container to another or one replication provider to another.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class SwitchAzSiteRecoveryReplicationProtectionContainerProtection_Switch : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// Unique fabric name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Unique fabric name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Unique fabric name.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _protectionContainerName; + + /// Protection container name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Protection container name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Protection container name.", + SerializedName = @"protectionContainerName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ProtectionContainerName { get => this._protectionContainerName; set => this._protectionContainerName = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionInput _switchInput; + + /// Switch protection input. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Switch protection input.", ValueFromPipeline = true)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Switch protection input.", + SerializedName = @"switchInput", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionInput) })] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionInput SwitchInput { get => this._switchInput; set => this._switchInput = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainer + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of SwitchAzSiteRecoveryReplicationProtectionContainerProtection_Switch + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.SwitchAzSiteRecoveryReplicationProtectionContainerProtection_Switch Clone() + { + var clone = new SwitchAzSiteRecoveryReplicationProtectionContainerProtection_Switch(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + clone.FabricName = this.FabricName; + clone.ProtectionContainerName = this.ProtectionContainerName; + clone.SwitchInput = this.SwitchInput; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationProtectionContainersSwitchProtection' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationProtectionContainersSwitchProtection(ResourceName, ResourceGroupName, SubscriptionId, FabricName, ProtectionContainerName, SwitchInput, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName,ProtectionContainerName=ProtectionContainerName,body=SwitchInput}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the cmdlet + /// class. + /// + public SwitchAzSiteRecoveryReplicationProtectionContainerProtection_Switch() + { + + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainer + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainer + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/SwitchAzSiteRecoveryReplicationProtectionContainerProtection_SwitchExpanded.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/SwitchAzSiteRecoveryReplicationProtectionContainerProtection_SwitchExpanded.cs new file mode 100644 index 000000000000..bcec78b2e6c3 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/SwitchAzSiteRecoveryReplicationProtectionContainerProtection_SwitchExpanded.cs @@ -0,0 +1,476 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// + /// Operation to switch protection from one container to another or one replication provider to another. + /// + /// + /// [OpenAPI] SwitchProtection=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/switchprotection" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Switch, @"AzSiteRecoveryReplicationProtectionContainerProtection_SwitchExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainer))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Operation to switch protection from one container to another or one replication provider to another.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class SwitchAzSiteRecoveryReplicationProtectionContainerProtection_SwitchExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Switch protection input. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionInput _switchInputBody = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.SwitchProtectionInput(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// Unique fabric name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Unique fabric name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Unique fabric name.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _protectionContainerName; + + /// Protection container name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Protection container name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Protection container name.", + SerializedName = @"protectionContainerName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ProtectionContainerName { get => this._protectionContainerName; set => this._protectionContainerName = value; } + + /// Gets the Instance type. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Gets the Instance type.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets the Instance type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + public string ProviderSpecificDetailInstanceType { get => _switchInputBody.ProviderSpecificDetailInstanceType ?? null; set => _switchInputBody.ProviderSpecificDetailInstanceType = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// The unique replication protected item name. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The unique replication protected item name.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The unique replication protected item name.", + SerializedName = @"replicationProtectedItemName", + PossibleTypes = new [] { typeof(string) })] + public string ReplicationProtectedItemName { get => _switchInputBody.ReplicationProtectedItemName ?? null; set => _switchInputBody.ReplicationProtectedItemName = value; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainer + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of SwitchAzSiteRecoveryReplicationProtectionContainerProtection_SwitchExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.SwitchAzSiteRecoveryReplicationProtectionContainerProtection_SwitchExpanded Clone() + { + var clone = new SwitchAzSiteRecoveryReplicationProtectionContainerProtection_SwitchExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._switchInputBody = this._switchInputBody; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + clone.FabricName = this.FabricName; + clone.ProtectionContainerName = this.ProtectionContainerName; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationProtectionContainersSwitchProtection' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationProtectionContainersSwitchProtection(ResourceName, ResourceGroupName, SubscriptionId, FabricName, ProtectionContainerName, _switchInputBody, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName,ProtectionContainerName=ProtectionContainerName,body=_switchInputBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public SwitchAzSiteRecoveryReplicationProtectionContainerProtection_SwitchExpanded() + { + + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainer + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainer + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/SwitchAzSiteRecoveryReplicationProtectionContainerProtection_SwitchViaIdentity.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/SwitchAzSiteRecoveryReplicationProtectionContainerProtection_SwitchViaIdentity.cs new file mode 100644 index 000000000000..ebde129a06c4 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/SwitchAzSiteRecoveryReplicationProtectionContainerProtection_SwitchViaIdentity.cs @@ -0,0 +1,421 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// + /// Operation to switch protection from one container to another or one replication provider to another. + /// + /// + /// [OpenAPI] SwitchProtection=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/switchprotection" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Switch, @"AzSiteRecoveryReplicationProtectionContainerProtection_SwitchViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainer))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Operation to switch protection from one container to another or one replication provider to another.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class SwitchAzSiteRecoveryReplicationProtectionContainerProtection_SwitchViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionInput _switchInput; + + /// Switch protection input. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Switch protection input.", ValueFromPipeline = true)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Switch protection input.", + SerializedName = @"switchInput", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionInput) })] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionInput SwitchInput { get => this._switchInput; set => this._switchInput = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainer + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of SwitchAzSiteRecoveryReplicationProtectionContainerProtection_SwitchViaIdentity + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.SwitchAzSiteRecoveryReplicationProtectionContainerProtection_SwitchViaIdentity Clone() + { + var clone = new SwitchAzSiteRecoveryReplicationProtectionContainerProtection_SwitchViaIdentity(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.SwitchInput = this.SwitchInput; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationProtectionContainersSwitchProtection' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationProtectionContainersSwitchProtectionViaIdentity(InputObject.Id, SwitchInput, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.FabricName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.FabricName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ProtectionContainerName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ProtectionContainerName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationProtectionContainersSwitchProtection(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.FabricName ?? null, InputObject.ProtectionContainerName ?? null, SwitchInput, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=SwitchInput}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public SwitchAzSiteRecoveryReplicationProtectionContainerProtection_SwitchViaIdentity() + { + + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainer + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainer + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/SwitchAzSiteRecoveryReplicationProtectionContainerProtection_SwitchViaIdentityExpanded.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/SwitchAzSiteRecoveryReplicationProtectionContainerProtection_SwitchViaIdentityExpanded.cs new file mode 100644 index 000000000000..5a5f49f5f7fd --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/SwitchAzSiteRecoveryReplicationProtectionContainerProtection_SwitchViaIdentityExpanded.cs @@ -0,0 +1,433 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// + /// Operation to switch protection from one container to another or one replication provider to another. + /// + /// + /// [OpenAPI] SwitchProtection=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/switchprotection" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Switch, @"AzSiteRecoveryReplicationProtectionContainerProtection_SwitchViaIdentityExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainer))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Operation to switch protection from one container to another or one replication provider to another.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class SwitchAzSiteRecoveryReplicationProtectionContainerProtection_SwitchViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Switch protection input. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ISwitchProtectionInput _switchInputBody = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.SwitchProtectionInput(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// Gets the Instance type. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Gets the Instance type.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets the Instance type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + public string ProviderSpecificDetailInstanceType { get => _switchInputBody.ProviderSpecificDetailInstanceType ?? null; set => _switchInputBody.ProviderSpecificDetailInstanceType = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// The unique replication protected item name. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The unique replication protected item name.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The unique replication protected item name.", + SerializedName = @"replicationProtectedItemName", + PossibleTypes = new [] { typeof(string) })] + public string ReplicationProtectedItemName { get => _switchInputBody.ReplicationProtectedItemName ?? null; set => _switchInputBody.ReplicationProtectedItemName = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainer + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of SwitchAzSiteRecoveryReplicationProtectionContainerProtection_SwitchViaIdentityExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.SwitchAzSiteRecoveryReplicationProtectionContainerProtection_SwitchViaIdentityExpanded Clone() + { + var clone = new SwitchAzSiteRecoveryReplicationProtectionContainerProtection_SwitchViaIdentityExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._switchInputBody = this._switchInputBody; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationProtectionContainersSwitchProtection' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationProtectionContainersSwitchProtectionViaIdentity(InputObject.Id, _switchInputBody, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.FabricName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.FabricName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ProtectionContainerName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ProtectionContainerName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationProtectionContainersSwitchProtection(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.FabricName ?? null, InputObject.ProtectionContainerName ?? null, _switchInputBody, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=_switchInputBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public SwitchAzSiteRecoveryReplicationProtectionContainerProtection_SwitchViaIdentityExpanded() + { + + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainer + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainer + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/TestAzSiteRecoveryReplicationFabricConsistency_Check.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/TestAzSiteRecoveryReplicationFabricConsistency_Check.cs new file mode 100644 index 000000000000..229021851b6b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/TestAzSiteRecoveryReplicationFabricConsistency_Check.cs @@ -0,0 +1,430 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to perform a consistency check on the fabric. + /// + /// [OpenAPI] CheckConsistency=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/checkConsistency" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsDiagnostic.Test, @"AzSiteRecoveryReplicationFabricConsistency_Check", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabric))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to perform a consistency check on the fabric.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class TestAzSiteRecoveryReplicationFabricConsistency_Check : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// Fabric name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Fabric name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Fabric name.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabric + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of TestAzSiteRecoveryReplicationFabricConsistency_Check + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.TestAzSiteRecoveryReplicationFabricConsistency_Check Clone() + { + var clone = new TestAzSiteRecoveryReplicationFabricConsistency_Check(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + clone.FabricName = this.FabricName; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationFabricsCheckConsistency' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationFabricsCheckConsistency(ResourceName, ResourceGroupName, SubscriptionId, FabricName, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public TestAzSiteRecoveryReplicationFabricConsistency_Check() + { + + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabric + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabric + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/TestAzSiteRecoveryReplicationFabricConsistency_CheckViaIdentity.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/TestAzSiteRecoveryReplicationFabricConsistency_CheckViaIdentity.cs new file mode 100644 index 000000000000..fe70be6ed141 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/TestAzSiteRecoveryReplicationFabricConsistency_CheckViaIdentity.cs @@ -0,0 +1,401 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to perform a consistency check on the fabric. + /// + /// [OpenAPI] CheckConsistency=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/checkConsistency" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsDiagnostic.Test, @"AzSiteRecoveryReplicationFabricConsistency_CheckViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabric))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to perform a consistency check on the fabric.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class TestAzSiteRecoveryReplicationFabricConsistency_CheckViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabric + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of TestAzSiteRecoveryReplicationFabricConsistency_CheckViaIdentity + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.TestAzSiteRecoveryReplicationFabricConsistency_CheckViaIdentity Clone() + { + var clone = new TestAzSiteRecoveryReplicationFabricConsistency_CheckViaIdentity(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationFabricsCheckConsistency' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationFabricsCheckConsistencyViaIdentity(InputObject.Id, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.FabricName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.FabricName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationFabricsCheckConsistency(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.FabricName ?? null, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the cmdlet + /// class. + /// + public TestAzSiteRecoveryReplicationFabricConsistency_CheckViaIdentity() + { + + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabric + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IFabric + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/TestAzSiteRecoveryReplicationMigrationItemMigrateCleanup_Test.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/TestAzSiteRecoveryReplicationMigrationItemMigrateCleanup_Test.cs new file mode 100644 index 000000000000..972556807512 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/TestAzSiteRecoveryReplicationMigrationItemMigrateCleanup_Test.cs @@ -0,0 +1,476 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to initiate test migrate cleanup. + /// + /// [OpenAPI] TestMigrateCleanup=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/testMigrateCleanup" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsDiagnostic.Test, @"AzSiteRecoveryReplicationMigrationItemMigrateCleanup_Test", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to initiate test migrate cleanup.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class TestAzSiteRecoveryReplicationMigrationItemMigrateCleanup_Test : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// Fabric name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Fabric name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Fabric name.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _migrationItemName; + + /// Migration item name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Migration item name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Migration item name.", + SerializedName = @"migrationItemName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string MigrationItemName { get => this._migrationItemName; set => this._migrationItemName = value; } + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _protectionContainerName; + + /// Protection container name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Protection container name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Protection container name.", + SerializedName = @"protectionContainerName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ProtectionContainerName { get => this._protectionContainerName; set => this._protectionContainerName = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateCleanupInput _testMigrateCleanupInput; + + /// Input for test migrate cleanup. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Input for test migrate cleanup.", ValueFromPipeline = true)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Input for test migrate cleanup.", + SerializedName = @"testMigrateCleanupInput", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateCleanupInput) })] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateCleanupInput TestMigrateCleanupInput { get => this._testMigrateCleanupInput; set => this._testMigrateCleanupInput = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of TestAzSiteRecoveryReplicationMigrationItemMigrateCleanup_Test + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.TestAzSiteRecoveryReplicationMigrationItemMigrateCleanup_Test Clone() + { + var clone = new TestAzSiteRecoveryReplicationMigrationItemMigrateCleanup_Test(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + clone.FabricName = this.FabricName; + clone.ProtectionContainerName = this.ProtectionContainerName; + clone.MigrationItemName = this.MigrationItemName; + clone.TestMigrateCleanupInput = this.TestMigrateCleanupInput; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationMigrationItemsTestMigrateCleanup' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationMigrationItemsTestMigrateCleanup(ResourceName, ResourceGroupName, SubscriptionId, FabricName, ProtectionContainerName, MigrationItemName, TestMigrateCleanupInput, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName,ProtectionContainerName=ProtectionContainerName,MigrationItemName=MigrationItemName,body=TestMigrateCleanupInput}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public TestAzSiteRecoveryReplicationMigrationItemMigrateCleanup_Test() + { + + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/TestAzSiteRecoveryReplicationMigrationItemMigrateCleanup_TestExpanded.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/TestAzSiteRecoveryReplicationMigrationItemMigrateCleanup_TestExpanded.cs new file mode 100644 index 000000000000..618b8ec1b0b9 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/TestAzSiteRecoveryReplicationMigrationItemMigrateCleanup_TestExpanded.cs @@ -0,0 +1,478 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to initiate test migrate cleanup. + /// + /// [OpenAPI] TestMigrateCleanup=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/testMigrateCleanup" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsDiagnostic.Test, @"AzSiteRecoveryReplicationMigrationItemMigrateCleanup_TestExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to initiate test migrate cleanup.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class TestAzSiteRecoveryReplicationMigrationItemMigrateCleanup_TestExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Input for test migrate cleanup. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateCleanupInput _testMigrateCleanupInputBody = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.TestMigrateCleanupInput(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// Test migrate cleanup comments. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Test migrate cleanup comments.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Test migrate cleanup comments.", + SerializedName = @"comments", + PossibleTypes = new [] { typeof(string) })] + public string Comment { get => _testMigrateCleanupInputBody.Comment ?? null; set => _testMigrateCleanupInputBody.Comment = value; } + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// Fabric name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Fabric name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Fabric name.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _migrationItemName; + + /// Migration item name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Migration item name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Migration item name.", + SerializedName = @"migrationItemName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string MigrationItemName { get => this._migrationItemName; set => this._migrationItemName = value; } + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _protectionContainerName; + + /// Protection container name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Protection container name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Protection container name.", + SerializedName = @"protectionContainerName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ProtectionContainerName { get => this._protectionContainerName; set => this._protectionContainerName = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of TestAzSiteRecoveryReplicationMigrationItemMigrateCleanup_TestExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.TestAzSiteRecoveryReplicationMigrationItemMigrateCleanup_TestExpanded Clone() + { + var clone = new TestAzSiteRecoveryReplicationMigrationItemMigrateCleanup_TestExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._testMigrateCleanupInputBody = this._testMigrateCleanupInputBody; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + clone.FabricName = this.FabricName; + clone.ProtectionContainerName = this.ProtectionContainerName; + clone.MigrationItemName = this.MigrationItemName; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationMigrationItemsTestMigrateCleanup' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationMigrationItemsTestMigrateCleanup(ResourceName, ResourceGroupName, SubscriptionId, FabricName, ProtectionContainerName, MigrationItemName, _testMigrateCleanupInputBody, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName,ProtectionContainerName=ProtectionContainerName,MigrationItemName=MigrationItemName,body=_testMigrateCleanupInputBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the + /// cmdlet class. + /// + public TestAzSiteRecoveryReplicationMigrationItemMigrateCleanup_TestExpanded() + { + + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/TestAzSiteRecoveryReplicationMigrationItemMigrateCleanup_TestViaIdentity.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/TestAzSiteRecoveryReplicationMigrationItemMigrateCleanup_TestViaIdentity.cs new file mode 100644 index 000000000000..d3c07417bbd1 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/TestAzSiteRecoveryReplicationMigrationItemMigrateCleanup_TestViaIdentity.cs @@ -0,0 +1,423 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to initiate test migrate cleanup. + /// + /// [OpenAPI] TestMigrateCleanup=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/testMigrateCleanup" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsDiagnostic.Test, @"AzSiteRecoveryReplicationMigrationItemMigrateCleanup_TestViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to initiate test migrate cleanup.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class TestAzSiteRecoveryReplicationMigrationItemMigrateCleanup_TestViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateCleanupInput _testMigrateCleanupInput; + + /// Input for test migrate cleanup. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Input for test migrate cleanup.", ValueFromPipeline = true)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Input for test migrate cleanup.", + SerializedName = @"testMigrateCleanupInput", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateCleanupInput) })] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateCleanupInput TestMigrateCleanupInput { get => this._testMigrateCleanupInput; set => this._testMigrateCleanupInput = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of TestAzSiteRecoveryReplicationMigrationItemMigrateCleanup_TestViaIdentity + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.TestAzSiteRecoveryReplicationMigrationItemMigrateCleanup_TestViaIdentity Clone() + { + var clone = new TestAzSiteRecoveryReplicationMigrationItemMigrateCleanup_TestViaIdentity(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.TestMigrateCleanupInput = this.TestMigrateCleanupInput; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationMigrationItemsTestMigrateCleanup' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationMigrationItemsTestMigrateCleanupViaIdentity(InputObject.Id, TestMigrateCleanupInput, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.FabricName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.FabricName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ProtectionContainerName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ProtectionContainerName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.MigrationItemName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.MigrationItemName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationMigrationItemsTestMigrateCleanup(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.FabricName ?? null, InputObject.ProtectionContainerName ?? null, InputObject.MigrationItemName ?? null, TestMigrateCleanupInput, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=TestMigrateCleanupInput}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public TestAzSiteRecoveryReplicationMigrationItemMigrateCleanup_TestViaIdentity() + { + + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/TestAzSiteRecoveryReplicationMigrationItemMigrateCleanup_TestViaIdentityExpanded.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/TestAzSiteRecoveryReplicationMigrationItemMigrateCleanup_TestViaIdentityExpanded.cs new file mode 100644 index 000000000000..dd77f7e3d165 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/TestAzSiteRecoveryReplicationMigrationItemMigrateCleanup_TestViaIdentityExpanded.cs @@ -0,0 +1,424 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to initiate test migrate cleanup. + /// + /// [OpenAPI] TestMigrateCleanup=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/testMigrateCleanup" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsDiagnostic.Test, @"AzSiteRecoveryReplicationMigrationItemMigrateCleanup_TestViaIdentityExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to initiate test migrate cleanup.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class TestAzSiteRecoveryReplicationMigrationItemMigrateCleanup_TestViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Input for test migrate cleanup. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateCleanupInput _testMigrateCleanupInputBody = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.TestMigrateCleanupInput(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// Test migrate cleanup comments. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Test migrate cleanup comments.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Test migrate cleanup comments.", + SerializedName = @"comments", + PossibleTypes = new [] { typeof(string) })] + public string Comment { get => _testMigrateCleanupInputBody.Comment ?? null; set => _testMigrateCleanupInputBody.Comment = value; } + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of TestAzSiteRecoveryReplicationMigrationItemMigrateCleanup_TestViaIdentityExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.TestAzSiteRecoveryReplicationMigrationItemMigrateCleanup_TestViaIdentityExpanded Clone() + { + var clone = new TestAzSiteRecoveryReplicationMigrationItemMigrateCleanup_TestViaIdentityExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._testMigrateCleanupInputBody = this._testMigrateCleanupInputBody; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationMigrationItemsTestMigrateCleanup' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationMigrationItemsTestMigrateCleanupViaIdentity(InputObject.Id, _testMigrateCleanupInputBody, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.FabricName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.FabricName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ProtectionContainerName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ProtectionContainerName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.MigrationItemName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.MigrationItemName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationMigrationItemsTestMigrateCleanup(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.FabricName ?? null, InputObject.ProtectionContainerName ?? null, InputObject.MigrationItemName ?? null, _testMigrateCleanupInputBody, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=_testMigrateCleanupInputBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public TestAzSiteRecoveryReplicationMigrationItemMigrateCleanup_TestViaIdentityExpanded() + { + + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/TestAzSiteRecoveryReplicationMigrationItemMigrate_Test.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/TestAzSiteRecoveryReplicationMigrationItemMigrate_Test.cs new file mode 100644 index 000000000000..af1dccf7784f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/TestAzSiteRecoveryReplicationMigrationItemMigrate_Test.cs @@ -0,0 +1,474 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to initiate test migration of the item. + /// + /// [OpenAPI] TestMigrate=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/testMigrate" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsDiagnostic.Test, @"AzSiteRecoveryReplicationMigrationItemMigrate_Test", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to initiate test migration of the item.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class TestAzSiteRecoveryReplicationMigrationItemMigrate_Test : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// Fabric name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Fabric name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Fabric name.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _migrationItemName; + + /// Migration item name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Migration item name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Migration item name.", + SerializedName = @"migrationItemName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string MigrationItemName { get => this._migrationItemName; set => this._migrationItemName = value; } + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _protectionContainerName; + + /// Protection container name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Protection container name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Protection container name.", + SerializedName = @"protectionContainerName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ProtectionContainerName { get => this._protectionContainerName; set => this._protectionContainerName = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateInput _testMigrateInput; + + /// Input for test migrate. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Input for test migrate.", ValueFromPipeline = true)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Input for test migrate.", + SerializedName = @"testMigrateInput", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateInput) })] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateInput TestMigrateInput { get => this._testMigrateInput; set => this._testMigrateInput = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of TestAzSiteRecoveryReplicationMigrationItemMigrate_Test + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.TestAzSiteRecoveryReplicationMigrationItemMigrate_Test Clone() + { + var clone = new TestAzSiteRecoveryReplicationMigrationItemMigrate_Test(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + clone.FabricName = this.FabricName; + clone.ProtectionContainerName = this.ProtectionContainerName; + clone.MigrationItemName = this.MigrationItemName; + clone.TestMigrateInput = this.TestMigrateInput; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationMigrationItemsTestMigrate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationMigrationItemsTestMigrate(ResourceName, ResourceGroupName, SubscriptionId, FabricName, ProtectionContainerName, MigrationItemName, TestMigrateInput, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName,ProtectionContainerName=ProtectionContainerName,MigrationItemName=MigrationItemName,body=TestMigrateInput}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public TestAzSiteRecoveryReplicationMigrationItemMigrate_Test() + { + + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/TestAzSiteRecoveryReplicationMigrationItemMigrate_TestExpanded.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/TestAzSiteRecoveryReplicationMigrationItemMigrate_TestExpanded.cs new file mode 100644 index 000000000000..6e1d2442021d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/TestAzSiteRecoveryReplicationMigrationItemMigrate_TestExpanded.cs @@ -0,0 +1,478 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to initiate test migration of the item. + /// + /// [OpenAPI] TestMigrate=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/testMigrate" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsDiagnostic.Test, @"AzSiteRecoveryReplicationMigrationItemMigrate_TestExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to initiate test migration of the item.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class TestAzSiteRecoveryReplicationMigrationItemMigrate_TestExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Input for test migrate. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateInput _testMigrateInputBody = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.TestMigrateInput(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// Fabric name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Fabric name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Fabric name.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _migrationItemName; + + /// Migration item name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Migration item name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Migration item name.", + SerializedName = @"migrationItemName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string MigrationItemName { get => this._migrationItemName; set => this._migrationItemName = value; } + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _protectionContainerName; + + /// Protection container name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Protection container name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Protection container name.", + SerializedName = @"protectionContainerName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ProtectionContainerName { get => this._protectionContainerName; set => this._protectionContainerName = value; } + + /// The class type. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The class type.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + public string ProviderSpecificDetailInstanceType { get => _testMigrateInputBody.ProviderSpecificDetailInstanceType ?? null; set => _testMigrateInputBody.ProviderSpecificDetailInstanceType = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of TestAzSiteRecoveryReplicationMigrationItemMigrate_TestExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.TestAzSiteRecoveryReplicationMigrationItemMigrate_TestExpanded Clone() + { + var clone = new TestAzSiteRecoveryReplicationMigrationItemMigrate_TestExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._testMigrateInputBody = this._testMigrateInputBody; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + clone.FabricName = this.FabricName; + clone.ProtectionContainerName = this.ProtectionContainerName; + clone.MigrationItemName = this.MigrationItemName; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationMigrationItemsTestMigrate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationMigrationItemsTestMigrate(ResourceName, ResourceGroupName, SubscriptionId, FabricName, ProtectionContainerName, MigrationItemName, _testMigrateInputBody, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName,ProtectionContainerName=ProtectionContainerName,MigrationItemName=MigrationItemName,body=_testMigrateInputBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the cmdlet + /// class. + /// + public TestAzSiteRecoveryReplicationMigrationItemMigrate_TestExpanded() + { + + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/TestAzSiteRecoveryReplicationMigrationItemMigrate_TestViaIdentity.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/TestAzSiteRecoveryReplicationMigrationItemMigrate_TestViaIdentity.cs new file mode 100644 index 000000000000..32ccdca47ea7 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/TestAzSiteRecoveryReplicationMigrationItemMigrate_TestViaIdentity.cs @@ -0,0 +1,423 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to initiate test migration of the item. + /// + /// [OpenAPI] TestMigrate=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/testMigrate" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsDiagnostic.Test, @"AzSiteRecoveryReplicationMigrationItemMigrate_TestViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to initiate test migration of the item.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class TestAzSiteRecoveryReplicationMigrationItemMigrate_TestViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateInput _testMigrateInput; + + /// Input for test migrate. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Input for test migrate.", ValueFromPipeline = true)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Input for test migrate.", + SerializedName = @"testMigrateInput", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateInput) })] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateInput TestMigrateInput { get => this._testMigrateInput; set => this._testMigrateInput = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of TestAzSiteRecoveryReplicationMigrationItemMigrate_TestViaIdentity + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.TestAzSiteRecoveryReplicationMigrationItemMigrate_TestViaIdentity Clone() + { + var clone = new TestAzSiteRecoveryReplicationMigrationItemMigrate_TestViaIdentity(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.TestMigrateInput = this.TestMigrateInput; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationMigrationItemsTestMigrate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationMigrationItemsTestMigrateViaIdentity(InputObject.Id, TestMigrateInput, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.FabricName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.FabricName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ProtectionContainerName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ProtectionContainerName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.MigrationItemName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.MigrationItemName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationMigrationItemsTestMigrate(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.FabricName ?? null, InputObject.ProtectionContainerName ?? null, InputObject.MigrationItemName ?? null, TestMigrateInput, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=TestMigrateInput}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the cmdlet + /// class. + /// + public TestAzSiteRecoveryReplicationMigrationItemMigrate_TestViaIdentity() + { + + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/TestAzSiteRecoveryReplicationMigrationItemMigrate_TestViaIdentityExpanded.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/TestAzSiteRecoveryReplicationMigrationItemMigrate_TestViaIdentityExpanded.cs new file mode 100644 index 000000000000..50e98500c339 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/TestAzSiteRecoveryReplicationMigrationItemMigrate_TestViaIdentityExpanded.cs @@ -0,0 +1,424 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to initiate test migration of the item. + /// + /// [OpenAPI] TestMigrate=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/testMigrate" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsDiagnostic.Test, @"AzSiteRecoveryReplicationMigrationItemMigrate_TestViaIdentityExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to initiate test migration of the item.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class TestAzSiteRecoveryReplicationMigrationItemMigrate_TestViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Input for test migrate. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestMigrateInput _testMigrateInputBody = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.TestMigrateInput(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The class type. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The class type.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + public string ProviderSpecificDetailInstanceType { get => _testMigrateInputBody.ProviderSpecificDetailInstanceType ?? null; set => _testMigrateInputBody.ProviderSpecificDetailInstanceType = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of TestAzSiteRecoveryReplicationMigrationItemMigrate_TestViaIdentityExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.TestAzSiteRecoveryReplicationMigrationItemMigrate_TestViaIdentityExpanded Clone() + { + var clone = new TestAzSiteRecoveryReplicationMigrationItemMigrate_TestViaIdentityExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._testMigrateInputBody = this._testMigrateInputBody; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationMigrationItemsTestMigrate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationMigrationItemsTestMigrateViaIdentity(InputObject.Id, _testMigrateInputBody, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.FabricName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.FabricName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ProtectionContainerName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ProtectionContainerName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.MigrationItemName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.MigrationItemName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationMigrationItemsTestMigrate(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.FabricName ?? null, InputObject.ProtectionContainerName ?? null, InputObject.MigrationItemName ?? null, _testMigrateInputBody, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=_testMigrateInputBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public TestAzSiteRecoveryReplicationMigrationItemMigrate_TestViaIdentityExpanded() + { + + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/TestAzSiteRecoveryReplicationProtectedItemFailoverCleanup_Test.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/TestAzSiteRecoveryReplicationProtectedItemFailoverCleanup_Test.cs new file mode 100644 index 000000000000..53a27e87d0be --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/TestAzSiteRecoveryReplicationProtectedItemFailoverCleanup_Test.cs @@ -0,0 +1,477 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Operation to clean up the test failover of a replication protected item. + /// + /// [OpenAPI] TestFailoverCleanup=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/testFailoverCleanup" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsDiagnostic.Test, @"AzSiteRecoveryReplicationProtectedItemFailoverCleanup_Test", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Operation to clean up the test failover of a replication protected item.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class TestAzSiteRecoveryReplicationProtectedItemFailoverCleanup_Test : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverCleanupInput _cleanupInput; + + /// Input definition for test failover cleanup. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Input definition for test failover cleanup.", ValueFromPipeline = true)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Input definition for test failover cleanup.", + SerializedName = @"cleanupInput", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverCleanupInput) })] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverCleanupInput CleanupInput { get => this._cleanupInput; set => this._cleanupInput = value; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// Unique fabric name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Unique fabric name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Unique fabric name.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _protectionContainerName; + + /// Protection container name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Protection container name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Protection container name.", + SerializedName = @"protectionContainerName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ProtectionContainerName { get => this._protectionContainerName; set => this._protectionContainerName = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _replicatedProtectedItemName; + + /// Replication protected item name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Replication protected item name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Replication protected item name.", + SerializedName = @"replicatedProtectedItemName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ReplicatedProtectedItemName { get => this._replicatedProtectedItemName; set => this._replicatedProtectedItemName = value; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of TestAzSiteRecoveryReplicationProtectedItemFailoverCleanup_Test + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.TestAzSiteRecoveryReplicationProtectedItemFailoverCleanup_Test Clone() + { + var clone = new TestAzSiteRecoveryReplicationProtectedItemFailoverCleanup_Test(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + clone.FabricName = this.FabricName; + clone.ProtectionContainerName = this.ProtectionContainerName; + clone.ReplicatedProtectedItemName = this.ReplicatedProtectedItemName; + clone.CleanupInput = this.CleanupInput; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationProtectedItemsTestFailoverCleanup' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationProtectedItemsTestFailoverCleanup(ResourceName, ResourceGroupName, SubscriptionId, FabricName, ProtectionContainerName, ReplicatedProtectedItemName, CleanupInput, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName,ProtectionContainerName=ProtectionContainerName,ReplicatedProtectedItemName=ReplicatedProtectedItemName,body=CleanupInput}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the cmdlet + /// class. + /// + public TestAzSiteRecoveryReplicationProtectedItemFailoverCleanup_Test() + { + + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/TestAzSiteRecoveryReplicationProtectedItemFailoverCleanup_TestExpanded.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/TestAzSiteRecoveryReplicationProtectedItemFailoverCleanup_TestExpanded.cs new file mode 100644 index 000000000000..128be8914ffc --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/TestAzSiteRecoveryReplicationProtectedItemFailoverCleanup_TestExpanded.cs @@ -0,0 +1,478 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Operation to clean up the test failover of a replication protected item. + /// + /// [OpenAPI] TestFailoverCleanup=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/testFailoverCleanup" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsDiagnostic.Test, @"AzSiteRecoveryReplicationProtectedItemFailoverCleanup_TestExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Operation to clean up the test failover of a replication protected item.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class TestAzSiteRecoveryReplicationProtectedItemFailoverCleanup_TestExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Input definition for test failover cleanup. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverCleanupInput _cleanupInputBody = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.TestFailoverCleanupInput(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// Test failover cleanup comments. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Test failover cleanup comments.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Test failover cleanup comments.", + SerializedName = @"comments", + PossibleTypes = new [] { typeof(string) })] + public string Comment { get => _cleanupInputBody.Comment ?? null; set => _cleanupInputBody.Comment = value; } + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// Unique fabric name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Unique fabric name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Unique fabric name.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _protectionContainerName; + + /// Protection container name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Protection container name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Protection container name.", + SerializedName = @"protectionContainerName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ProtectionContainerName { get => this._protectionContainerName; set => this._protectionContainerName = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _replicatedProtectedItemName; + + /// Replication protected item name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Replication protected item name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Replication protected item name.", + SerializedName = @"replicatedProtectedItemName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ReplicatedProtectedItemName { get => this._replicatedProtectedItemName; set => this._replicatedProtectedItemName = value; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of TestAzSiteRecoveryReplicationProtectedItemFailoverCleanup_TestExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.TestAzSiteRecoveryReplicationProtectedItemFailoverCleanup_TestExpanded Clone() + { + var clone = new TestAzSiteRecoveryReplicationProtectedItemFailoverCleanup_TestExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._cleanupInputBody = this._cleanupInputBody; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + clone.FabricName = this.FabricName; + clone.ProtectionContainerName = this.ProtectionContainerName; + clone.ReplicatedProtectedItemName = this.ReplicatedProtectedItemName; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationProtectedItemsTestFailoverCleanup' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationProtectedItemsTestFailoverCleanup(ResourceName, ResourceGroupName, SubscriptionId, FabricName, ProtectionContainerName, ReplicatedProtectedItemName, _cleanupInputBody, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName,ProtectionContainerName=ProtectionContainerName,ReplicatedProtectedItemName=ReplicatedProtectedItemName,body=_cleanupInputBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the + /// cmdlet class. + /// + public TestAzSiteRecoveryReplicationProtectedItemFailoverCleanup_TestExpanded() + { + + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/TestAzSiteRecoveryReplicationProtectedItemFailoverCleanup_TestViaIdentity.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/TestAzSiteRecoveryReplicationProtectedItemFailoverCleanup_TestViaIdentity.cs new file mode 100644 index 000000000000..5cf231b66a98 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/TestAzSiteRecoveryReplicationProtectedItemFailoverCleanup_TestViaIdentity.cs @@ -0,0 +1,423 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Operation to clean up the test failover of a replication protected item. + /// + /// [OpenAPI] TestFailoverCleanup=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/testFailoverCleanup" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsDiagnostic.Test, @"AzSiteRecoveryReplicationProtectedItemFailoverCleanup_TestViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Operation to clean up the test failover of a replication protected item.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class TestAzSiteRecoveryReplicationProtectedItemFailoverCleanup_TestViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverCleanupInput _cleanupInput; + + /// Input definition for test failover cleanup. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Input definition for test failover cleanup.", ValueFromPipeline = true)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Input definition for test failover cleanup.", + SerializedName = @"cleanupInput", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverCleanupInput) })] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverCleanupInput CleanupInput { get => this._cleanupInput; set => this._cleanupInput = value; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of TestAzSiteRecoveryReplicationProtectedItemFailoverCleanup_TestViaIdentity + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.TestAzSiteRecoveryReplicationProtectedItemFailoverCleanup_TestViaIdentity Clone() + { + var clone = new TestAzSiteRecoveryReplicationProtectedItemFailoverCleanup_TestViaIdentity(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.CleanupInput = this.CleanupInput; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationProtectedItemsTestFailoverCleanup' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationProtectedItemsTestFailoverCleanupViaIdentity(InputObject.Id, CleanupInput, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.FabricName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.FabricName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ProtectionContainerName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ProtectionContainerName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ReplicatedProtectedItemName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ReplicatedProtectedItemName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationProtectedItemsTestFailoverCleanup(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.FabricName ?? null, InputObject.ProtectionContainerName ?? null, InputObject.ReplicatedProtectedItemName ?? null, CleanupInput, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=CleanupInput}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public TestAzSiteRecoveryReplicationProtectedItemFailoverCleanup_TestViaIdentity() + { + + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/TestAzSiteRecoveryReplicationProtectedItemFailoverCleanup_TestViaIdentityExpanded.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/TestAzSiteRecoveryReplicationProtectedItemFailoverCleanup_TestViaIdentityExpanded.cs new file mode 100644 index 000000000000..c97acfa04427 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/TestAzSiteRecoveryReplicationProtectedItemFailoverCleanup_TestViaIdentityExpanded.cs @@ -0,0 +1,424 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Operation to clean up the test failover of a replication protected item. + /// + /// [OpenAPI] TestFailoverCleanup=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/testFailoverCleanup" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsDiagnostic.Test, @"AzSiteRecoveryReplicationProtectedItemFailoverCleanup_TestViaIdentityExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Operation to clean up the test failover of a replication protected item.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class TestAzSiteRecoveryReplicationProtectedItemFailoverCleanup_TestViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Input definition for test failover cleanup. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverCleanupInput _cleanupInputBody = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.TestFailoverCleanupInput(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// Test failover cleanup comments. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Test failover cleanup comments.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Test failover cleanup comments.", + SerializedName = @"comments", + PossibleTypes = new [] { typeof(string) })] + public string Comment { get => _cleanupInputBody.Comment ?? null; set => _cleanupInputBody.Comment = value; } + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of TestAzSiteRecoveryReplicationProtectedItemFailoverCleanup_TestViaIdentityExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.TestAzSiteRecoveryReplicationProtectedItemFailoverCleanup_TestViaIdentityExpanded Clone() + { + var clone = new TestAzSiteRecoveryReplicationProtectedItemFailoverCleanup_TestViaIdentityExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._cleanupInputBody = this._cleanupInputBody; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationProtectedItemsTestFailoverCleanup' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationProtectedItemsTestFailoverCleanupViaIdentity(InputObject.Id, _cleanupInputBody, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.FabricName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.FabricName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ProtectionContainerName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ProtectionContainerName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ReplicatedProtectedItemName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ReplicatedProtectedItemName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationProtectedItemsTestFailoverCleanup(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.FabricName ?? null, InputObject.ProtectionContainerName ?? null, InputObject.ReplicatedProtectedItemName ?? null, _cleanupInputBody, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=_cleanupInputBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public TestAzSiteRecoveryReplicationProtectedItemFailoverCleanup_TestViaIdentityExpanded() + { + + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/TestAzSiteRecoveryReplicationProtectedItemFailover_Test.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/TestAzSiteRecoveryReplicationProtectedItemFailover_Test.cs new file mode 100644 index 000000000000..4aa85a57babb --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/TestAzSiteRecoveryReplicationProtectedItemFailover_Test.cs @@ -0,0 +1,474 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Operation to perform a test failover of the replication protected item. + /// + /// [OpenAPI] TestFailover=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/testFailover" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsDiagnostic.Test, @"AzSiteRecoveryReplicationProtectedItemFailover_Test", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Operation to perform a test failover of the replication protected item.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class TestAzSiteRecoveryReplicationProtectedItemFailover_Test : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// Unique fabric name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Unique fabric name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Unique fabric name.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _protectionContainerName; + + /// Protection container name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Protection container name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Protection container name.", + SerializedName = @"protectionContainerName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ProtectionContainerName { get => this._protectionContainerName; set => this._protectionContainerName = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _replicatedProtectedItemName; + + /// Replication protected item name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Replication protected item name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Replication protected item name.", + SerializedName = @"replicatedProtectedItemName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ReplicatedProtectedItemName { get => this._replicatedProtectedItemName; set => this._replicatedProtectedItemName = value; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverInput _testfailoverInput; + + /// Input definition for test failover. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Input definition for test failover.", ValueFromPipeline = true)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Input definition for test failover.", + SerializedName = @"testfailoverInput", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverInput) })] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverInput TestfailoverInput { get => this._testfailoverInput; set => this._testfailoverInput = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of TestAzSiteRecoveryReplicationProtectedItemFailover_Test + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.TestAzSiteRecoveryReplicationProtectedItemFailover_Test Clone() + { + var clone = new TestAzSiteRecoveryReplicationProtectedItemFailover_Test(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + clone.FabricName = this.FabricName; + clone.ProtectionContainerName = this.ProtectionContainerName; + clone.ReplicatedProtectedItemName = this.ReplicatedProtectedItemName; + clone.TestfailoverInput = this.TestfailoverInput; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationProtectedItemsTestFailover' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationProtectedItemsTestFailover(ResourceName, ResourceGroupName, SubscriptionId, FabricName, ProtectionContainerName, ReplicatedProtectedItemName, TestfailoverInput, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName,ProtectionContainerName=ProtectionContainerName,ReplicatedProtectedItemName=ReplicatedProtectedItemName,body=TestfailoverInput}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public TestAzSiteRecoveryReplicationProtectedItemFailover_Test() + { + + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/TestAzSiteRecoveryReplicationProtectedItemFailover_TestExpanded.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/TestAzSiteRecoveryReplicationProtectedItemFailover_TestExpanded.cs new file mode 100644 index 000000000000..99ce6511db9d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/TestAzSiteRecoveryReplicationProtectedItemFailover_TestExpanded.cs @@ -0,0 +1,511 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Operation to perform a test failover of the replication protected item. + /// + /// [OpenAPI] TestFailover=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/testFailover" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsDiagnostic.Test, @"AzSiteRecoveryReplicationProtectedItemFailover_TestExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Operation to perform a test failover of the replication protected item.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class TestAzSiteRecoveryReplicationProtectedItemFailover_TestExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Input definition for test failover. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverInput _testfailoverInputBody = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.TestFailoverInput(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// Unique fabric name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Unique fabric name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Unique fabric name.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// Test failover direction. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Test failover direction.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Test failover direction.", + SerializedName = @"failoverDirection", + PossibleTypes = new [] { typeof(string) })] + public string FailoverDirection { get => _testfailoverInputBody.FailoverDirection ?? null; set => _testfailoverInputBody.FailoverDirection = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// The id of the network to be used for test failover. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The id of the network to be used for test failover.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The id of the network to be used for test failover.", + SerializedName = @"networkId", + PossibleTypes = new [] { typeof(string) })] + public string NetworkId { get => _testfailoverInputBody.NetworkId ?? null; set => _testfailoverInputBody.NetworkId = value; } + + /// Network type to be used for test failover. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Network type to be used for test failover.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Network type to be used for test failover.", + SerializedName = @"networkType", + PossibleTypes = new [] { typeof(string) })] + public string NetworkType { get => _testfailoverInputBody.NetworkType ?? null; set => _testfailoverInputBody.NetworkType = value; } + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _protectionContainerName; + + /// Protection container name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Protection container name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Protection container name.", + SerializedName = @"protectionContainerName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ProtectionContainerName { get => this._protectionContainerName; set => this._protectionContainerName = value; } + + /// The class type. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The class type.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + public string ProviderSpecificDetailInstanceType { get => _testfailoverInputBody.ProviderSpecificDetailInstanceType ?? null; set => _testfailoverInputBody.ProviderSpecificDetailInstanceType = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _replicatedProtectedItemName; + + /// Replication protected item name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Replication protected item name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Replication protected item name.", + SerializedName = @"replicatedProtectedItemName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ReplicatedProtectedItemName { get => this._replicatedProtectedItemName; set => this._replicatedProtectedItemName = value; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of TestAzSiteRecoveryReplicationProtectedItemFailover_TestExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.TestAzSiteRecoveryReplicationProtectedItemFailover_TestExpanded Clone() + { + var clone = new TestAzSiteRecoveryReplicationProtectedItemFailover_TestExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._testfailoverInputBody = this._testfailoverInputBody; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + clone.FabricName = this.FabricName; + clone.ProtectionContainerName = this.ProtectionContainerName; + clone.ReplicatedProtectedItemName = this.ReplicatedProtectedItemName; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationProtectedItemsTestFailover' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationProtectedItemsTestFailover(ResourceName, ResourceGroupName, SubscriptionId, FabricName, ProtectionContainerName, ReplicatedProtectedItemName, _testfailoverInputBody, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName,ProtectionContainerName=ProtectionContainerName,ReplicatedProtectedItemName=ReplicatedProtectedItemName,body=_testfailoverInputBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the cmdlet + /// class. + /// + public TestAzSiteRecoveryReplicationProtectedItemFailover_TestExpanded() + { + + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/TestAzSiteRecoveryReplicationProtectedItemFailover_TestViaIdentity.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/TestAzSiteRecoveryReplicationProtectedItemFailover_TestViaIdentity.cs new file mode 100644 index 000000000000..be88bc6f6129 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/TestAzSiteRecoveryReplicationProtectedItemFailover_TestViaIdentity.cs @@ -0,0 +1,423 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Operation to perform a test failover of the replication protected item. + /// + /// [OpenAPI] TestFailover=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/testFailover" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsDiagnostic.Test, @"AzSiteRecoveryReplicationProtectedItemFailover_TestViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Operation to perform a test failover of the replication protected item.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class TestAzSiteRecoveryReplicationProtectedItemFailover_TestViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverInput _testfailoverInput; + + /// Input definition for test failover. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Input definition for test failover.", ValueFromPipeline = true)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Input definition for test failover.", + SerializedName = @"testfailoverInput", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverInput) })] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverInput TestfailoverInput { get => this._testfailoverInput; set => this._testfailoverInput = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of TestAzSiteRecoveryReplicationProtectedItemFailover_TestViaIdentity + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.TestAzSiteRecoveryReplicationProtectedItemFailover_TestViaIdentity Clone() + { + var clone = new TestAzSiteRecoveryReplicationProtectedItemFailover_TestViaIdentity(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.TestfailoverInput = this.TestfailoverInput; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationProtectedItemsTestFailover' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationProtectedItemsTestFailoverViaIdentity(InputObject.Id, TestfailoverInput, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.FabricName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.FabricName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ProtectionContainerName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ProtectionContainerName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ReplicatedProtectedItemName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ReplicatedProtectedItemName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationProtectedItemsTestFailover(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.FabricName ?? null, InputObject.ProtectionContainerName ?? null, InputObject.ReplicatedProtectedItemName ?? null, TestfailoverInput, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=TestfailoverInput}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the cmdlet + /// class. + /// + public TestAzSiteRecoveryReplicationProtectedItemFailover_TestViaIdentity() + { + + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/TestAzSiteRecoveryReplicationProtectedItemFailover_TestViaIdentityExpanded.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/TestAzSiteRecoveryReplicationProtectedItemFailover_TestViaIdentityExpanded.cs new file mode 100644 index 000000000000..2b5a06f0e065 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/TestAzSiteRecoveryReplicationProtectedItemFailover_TestViaIdentityExpanded.cs @@ -0,0 +1,457 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Operation to perform a test failover of the replication protected item. + /// + /// [OpenAPI] TestFailover=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/testFailover" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsDiagnostic.Test, @"AzSiteRecoveryReplicationProtectedItemFailover_TestViaIdentityExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Operation to perform a test failover of the replication protected item.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class TestAzSiteRecoveryReplicationProtectedItemFailover_TestViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Input definition for test failover. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.ITestFailoverInput _testfailoverInputBody = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.TestFailoverInput(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Test failover direction. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Test failover direction.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Test failover direction.", + SerializedName = @"failoverDirection", + PossibleTypes = new [] { typeof(string) })] + public string FailoverDirection { get => _testfailoverInputBody.FailoverDirection ?? null; set => _testfailoverInputBody.FailoverDirection = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// The id of the network to be used for test failover. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The id of the network to be used for test failover.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The id of the network to be used for test failover.", + SerializedName = @"networkId", + PossibleTypes = new [] { typeof(string) })] + public string NetworkId { get => _testfailoverInputBody.NetworkId ?? null; set => _testfailoverInputBody.NetworkId = value; } + + /// Network type to be used for test failover. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Network type to be used for test failover.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Network type to be used for test failover.", + SerializedName = @"networkType", + PossibleTypes = new [] { typeof(string) })] + public string NetworkType { get => _testfailoverInputBody.NetworkType ?? null; set => _testfailoverInputBody.NetworkType = value; } + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The class type. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The class type.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + public string ProviderSpecificDetailInstanceType { get => _testfailoverInputBody.ProviderSpecificDetailInstanceType ?? null; set => _testfailoverInputBody.ProviderSpecificDetailInstanceType = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of TestAzSiteRecoveryReplicationProtectedItemFailover_TestViaIdentityExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.TestAzSiteRecoveryReplicationProtectedItemFailover_TestViaIdentityExpanded Clone() + { + var clone = new TestAzSiteRecoveryReplicationProtectedItemFailover_TestViaIdentityExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._testfailoverInputBody = this._testfailoverInputBody; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationProtectedItemsTestFailover' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationProtectedItemsTestFailoverViaIdentity(InputObject.Id, _testfailoverInputBody, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.FabricName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.FabricName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ProtectionContainerName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ProtectionContainerName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ReplicatedProtectedItemName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ReplicatedProtectedItemName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationProtectedItemsTestFailover(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.FabricName ?? null, InputObject.ProtectionContainerName ?? null, InputObject.ReplicatedProtectedItemName ?? null, _testfailoverInputBody, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=_testfailoverInputBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public TestAzSiteRecoveryReplicationProtectedItemFailover_TestViaIdentityExpanded() + { + + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/TestAzSiteRecoveryReplicationRecoveryPlanFailoverCleanup_Test.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/TestAzSiteRecoveryReplicationRecoveryPlanFailoverCleanup_Test.cs new file mode 100644 index 000000000000..33e1d04487bd --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/TestAzSiteRecoveryReplicationRecoveryPlanFailoverCleanup_Test.cs @@ -0,0 +1,446 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to cleanup test failover of a recovery plan. + /// + /// [OpenAPI] TestFailoverCleanup=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/testFailoverCleanup" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsDiagnostic.Test, @"AzSiteRecoveryReplicationRecoveryPlanFailoverCleanup_Test", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to cleanup test failover of a recovery plan.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class TestAzSiteRecoveryReplicationRecoveryPlanFailoverCleanup_Test : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverCleanupInput _input; + + /// Recovery plan test failover cleanup input. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Recovery plan test failover cleanup input.", ValueFromPipeline = true)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Recovery plan test failover cleanup input.", + SerializedName = @"input", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverCleanupInput) })] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverCleanupInput Input { get => this._input; set => this._input = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _recoveryPlanName; + + /// Recovery plan name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Recovery plan name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Recovery plan name.", + SerializedName = @"recoveryPlanName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string RecoveryPlanName { get => this._recoveryPlanName; set => this._recoveryPlanName = value; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of TestAzSiteRecoveryReplicationRecoveryPlanFailoverCleanup_Test + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.TestAzSiteRecoveryReplicationRecoveryPlanFailoverCleanup_Test Clone() + { + var clone = new TestAzSiteRecoveryReplicationRecoveryPlanFailoverCleanup_Test(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + clone.RecoveryPlanName = this.RecoveryPlanName; + clone.Input = this.Input; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationRecoveryPlansTestFailoverCleanup' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationRecoveryPlansTestFailoverCleanup(ResourceName, ResourceGroupName, SubscriptionId, RecoveryPlanName, Input, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,RecoveryPlanName=RecoveryPlanName,body=Input}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public TestAzSiteRecoveryReplicationRecoveryPlanFailoverCleanup_Test() + { + + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/TestAzSiteRecoveryReplicationRecoveryPlanFailoverCleanup_TestExpanded.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/TestAzSiteRecoveryReplicationRecoveryPlanFailoverCleanup_TestExpanded.cs new file mode 100644 index 000000000000..11ad7ca2f648 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/TestAzSiteRecoveryReplicationRecoveryPlanFailoverCleanup_TestExpanded.cs @@ -0,0 +1,448 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to cleanup test failover of a recovery plan. + /// + /// [OpenAPI] TestFailoverCleanup=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/testFailoverCleanup" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsDiagnostic.Test, @"AzSiteRecoveryReplicationRecoveryPlanFailoverCleanup_TestExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to cleanup test failover of a recovery plan.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class TestAzSiteRecoveryReplicationRecoveryPlanFailoverCleanup_TestExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Recovery plan test failover cleanup input. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverCleanupInput _inputBody = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanTestFailoverCleanupInput(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// The test failover cleanup comments. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The test failover cleanup comments.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The test failover cleanup comments.", + SerializedName = @"comments", + PossibleTypes = new [] { typeof(string) })] + public string Comment { get => _inputBody.Comment ?? null; set => _inputBody.Comment = value; } + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _recoveryPlanName; + + /// Recovery plan name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Recovery plan name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Recovery plan name.", + SerializedName = @"recoveryPlanName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string RecoveryPlanName { get => this._recoveryPlanName; set => this._recoveryPlanName = value; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of TestAzSiteRecoveryReplicationRecoveryPlanFailoverCleanup_TestExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.TestAzSiteRecoveryReplicationRecoveryPlanFailoverCleanup_TestExpanded Clone() + { + var clone = new TestAzSiteRecoveryReplicationRecoveryPlanFailoverCleanup_TestExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._inputBody = this._inputBody; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + clone.RecoveryPlanName = this.RecoveryPlanName; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationRecoveryPlansTestFailoverCleanup' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationRecoveryPlansTestFailoverCleanup(ResourceName, ResourceGroupName, SubscriptionId, RecoveryPlanName, _inputBody, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,RecoveryPlanName=RecoveryPlanName,body=_inputBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the + /// cmdlet class. + /// + public TestAzSiteRecoveryReplicationRecoveryPlanFailoverCleanup_TestExpanded() + { + + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/TestAzSiteRecoveryReplicationRecoveryPlanFailoverCleanup_TestViaIdentity.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/TestAzSiteRecoveryReplicationRecoveryPlanFailoverCleanup_TestViaIdentity.cs new file mode 100644 index 000000000000..f047cce23a75 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/TestAzSiteRecoveryReplicationRecoveryPlanFailoverCleanup_TestViaIdentity.cs @@ -0,0 +1,415 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to cleanup test failover of a recovery plan. + /// + /// [OpenAPI] TestFailoverCleanup=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/testFailoverCleanup" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsDiagnostic.Test, @"AzSiteRecoveryReplicationRecoveryPlanFailoverCleanup_TestViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to cleanup test failover of a recovery plan.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class TestAzSiteRecoveryReplicationRecoveryPlanFailoverCleanup_TestViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverCleanupInput _input; + + /// Recovery plan test failover cleanup input. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Recovery plan test failover cleanup input.", ValueFromPipeline = true)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Recovery plan test failover cleanup input.", + SerializedName = @"input", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverCleanupInput) })] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverCleanupInput Input { get => this._input; set => this._input = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of TestAzSiteRecoveryReplicationRecoveryPlanFailoverCleanup_TestViaIdentity + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.TestAzSiteRecoveryReplicationRecoveryPlanFailoverCleanup_TestViaIdentity Clone() + { + var clone = new TestAzSiteRecoveryReplicationRecoveryPlanFailoverCleanup_TestViaIdentity(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.Input = this.Input; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationRecoveryPlansTestFailoverCleanup' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationRecoveryPlansTestFailoverCleanupViaIdentity(InputObject.Id, Input, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.RecoveryPlanName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.RecoveryPlanName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationRecoveryPlansTestFailoverCleanup(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.RecoveryPlanName ?? null, Input, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=Input}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public TestAzSiteRecoveryReplicationRecoveryPlanFailoverCleanup_TestViaIdentity() + { + + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/TestAzSiteRecoveryReplicationRecoveryPlanFailoverCleanup_TestViaIdentityExpanded.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/TestAzSiteRecoveryReplicationRecoveryPlanFailoverCleanup_TestViaIdentityExpanded.cs new file mode 100644 index 000000000000..d739851778d3 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/TestAzSiteRecoveryReplicationRecoveryPlanFailoverCleanup_TestViaIdentityExpanded.cs @@ -0,0 +1,416 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to cleanup test failover of a recovery plan. + /// + /// [OpenAPI] TestFailoverCleanup=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/testFailoverCleanup" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsDiagnostic.Test, @"AzSiteRecoveryReplicationRecoveryPlanFailoverCleanup_TestViaIdentityExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to cleanup test failover of a recovery plan.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class TestAzSiteRecoveryReplicationRecoveryPlanFailoverCleanup_TestViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Recovery plan test failover cleanup input. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverCleanupInput _inputBody = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanTestFailoverCleanupInput(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// The test failover cleanup comments. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The test failover cleanup comments.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The test failover cleanup comments.", + SerializedName = @"comments", + PossibleTypes = new [] { typeof(string) })] + public string Comment { get => _inputBody.Comment ?? null; set => _inputBody.Comment = value; } + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of TestAzSiteRecoveryReplicationRecoveryPlanFailoverCleanup_TestViaIdentityExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.TestAzSiteRecoveryReplicationRecoveryPlanFailoverCleanup_TestViaIdentityExpanded Clone() + { + var clone = new TestAzSiteRecoveryReplicationRecoveryPlanFailoverCleanup_TestViaIdentityExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._inputBody = this._inputBody; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationRecoveryPlansTestFailoverCleanup' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationRecoveryPlansTestFailoverCleanupViaIdentity(InputObject.Id, _inputBody, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.RecoveryPlanName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.RecoveryPlanName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationRecoveryPlansTestFailoverCleanup(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.RecoveryPlanName ?? null, _inputBody, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=_inputBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public TestAzSiteRecoveryReplicationRecoveryPlanFailoverCleanup_TestViaIdentityExpanded() + { + + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/TestAzSiteRecoveryReplicationRecoveryPlanFailover_Test.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/TestAzSiteRecoveryReplicationRecoveryPlanFailover_Test.cs new file mode 100644 index 000000000000..f39dc5e6ab1c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/TestAzSiteRecoveryReplicationRecoveryPlanFailover_Test.cs @@ -0,0 +1,444 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to start the test failover of a recovery plan. + /// + /// [OpenAPI] TestFailover=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/testFailover" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsDiagnostic.Test, @"AzSiteRecoveryReplicationRecoveryPlanFailover_Test", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to start the test failover of a recovery plan.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class TestAzSiteRecoveryReplicationRecoveryPlanFailover_Test : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverInput _input; + + /// Recovery plan test failover input. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Recovery plan test failover input.", ValueFromPipeline = true)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Recovery plan test failover input.", + SerializedName = @"input", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverInput) })] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverInput Input { get => this._input; set => this._input = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _recoveryPlanName; + + /// Recovery plan name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Recovery plan name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Recovery plan name.", + SerializedName = @"recoveryPlanName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string RecoveryPlanName { get => this._recoveryPlanName; set => this._recoveryPlanName = value; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of TestAzSiteRecoveryReplicationRecoveryPlanFailover_Test + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.TestAzSiteRecoveryReplicationRecoveryPlanFailover_Test Clone() + { + var clone = new TestAzSiteRecoveryReplicationRecoveryPlanFailover_Test(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + clone.RecoveryPlanName = this.RecoveryPlanName; + clone.Input = this.Input; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationRecoveryPlansTestFailover' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationRecoveryPlansTestFailover(ResourceName, ResourceGroupName, SubscriptionId, RecoveryPlanName, Input, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,RecoveryPlanName=RecoveryPlanName,body=Input}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public TestAzSiteRecoveryReplicationRecoveryPlanFailover_Test() + { + + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/TestAzSiteRecoveryReplicationRecoveryPlanFailover_TestExpanded.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/TestAzSiteRecoveryReplicationRecoveryPlanFailover_TestExpanded.cs new file mode 100644 index 000000000000..8b02e5f33668 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/TestAzSiteRecoveryReplicationRecoveryPlanFailover_TestExpanded.cs @@ -0,0 +1,483 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to start the test failover of a recovery plan. + /// + /// [OpenAPI] TestFailover=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/testFailover" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsDiagnostic.Test, @"AzSiteRecoveryReplicationRecoveryPlanFailover_TestExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to start the test failover of a recovery plan.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class TestAzSiteRecoveryReplicationRecoveryPlanFailover_TestExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Recovery plan test failover input. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverInput _inputBody = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanTestFailoverInput(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// The failover direction. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The failover direction.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The failover direction.", + SerializedName = @"failoverDirection", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections) })] + [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections))] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections FailoverDirection { get => _inputBody.FailoverDirection; set => _inputBody.FailoverDirection = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// The Id of the network to be used for test failover. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The Id of the network to be used for test failover.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Id of the network to be used for test failover.", + SerializedName = @"networkId", + PossibleTypes = new [] { typeof(string) })] + public string NetworkId { get => _inputBody.NetworkId ?? null; set => _inputBody.NetworkId = value; } + + /// The network type to be used for test failover. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The network type to be used for test failover.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The network type to be used for test failover.", + SerializedName = @"networkType", + PossibleTypes = new [] { typeof(string) })] + public string NetworkType { get => _inputBody.NetworkType ?? null; set => _inputBody.NetworkType = value; } + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The provider specific properties. + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The provider specific properties.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The provider specific properties.", + SerializedName = @"providerSpecificDetails", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInput) })] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInput[] ProviderSpecificDetail { get => _inputBody.ProviderSpecificDetail ?? null /* arrayOf */; set => _inputBody.ProviderSpecificDetail = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _recoveryPlanName; + + /// Recovery plan name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Recovery plan name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Recovery plan name.", + SerializedName = @"recoveryPlanName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string RecoveryPlanName { get => this._recoveryPlanName; set => this._recoveryPlanName = value; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of TestAzSiteRecoveryReplicationRecoveryPlanFailover_TestExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.TestAzSiteRecoveryReplicationRecoveryPlanFailover_TestExpanded Clone() + { + var clone = new TestAzSiteRecoveryReplicationRecoveryPlanFailover_TestExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._inputBody = this._inputBody; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + clone.RecoveryPlanName = this.RecoveryPlanName; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationRecoveryPlansTestFailover' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationRecoveryPlansTestFailover(ResourceName, ResourceGroupName, SubscriptionId, RecoveryPlanName, _inputBody, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,RecoveryPlanName=RecoveryPlanName,body=_inputBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the cmdlet + /// class. + /// + public TestAzSiteRecoveryReplicationRecoveryPlanFailover_TestExpanded() + { + + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/TestAzSiteRecoveryReplicationRecoveryPlanFailover_TestViaIdentity.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/TestAzSiteRecoveryReplicationRecoveryPlanFailover_TestViaIdentity.cs new file mode 100644 index 000000000000..cb8982059316 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/TestAzSiteRecoveryReplicationRecoveryPlanFailover_TestViaIdentity.cs @@ -0,0 +1,415 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to start the test failover of a recovery plan. + /// + /// [OpenAPI] TestFailover=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/testFailover" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsDiagnostic.Test, @"AzSiteRecoveryReplicationRecoveryPlanFailover_TestViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to start the test failover of a recovery plan.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class TestAzSiteRecoveryReplicationRecoveryPlanFailover_TestViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverInput _input; + + /// Recovery plan test failover input. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Recovery plan test failover input.", ValueFromPipeline = true)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Recovery plan test failover input.", + SerializedName = @"input", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverInput) })] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverInput Input { get => this._input; set => this._input = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of TestAzSiteRecoveryReplicationRecoveryPlanFailover_TestViaIdentity + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.TestAzSiteRecoveryReplicationRecoveryPlanFailover_TestViaIdentity Clone() + { + var clone = new TestAzSiteRecoveryReplicationRecoveryPlanFailover_TestViaIdentity(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.Input = this.Input; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationRecoveryPlansTestFailover' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationRecoveryPlansTestFailoverViaIdentity(InputObject.Id, Input, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.RecoveryPlanName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.RecoveryPlanName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationRecoveryPlansTestFailover(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.RecoveryPlanName ?? null, Input, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=Input}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the cmdlet + /// class. + /// + public TestAzSiteRecoveryReplicationRecoveryPlanFailover_TestViaIdentity() + { + + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/TestAzSiteRecoveryReplicationRecoveryPlanFailover_TestViaIdentityExpanded.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/TestAzSiteRecoveryReplicationRecoveryPlanFailover_TestViaIdentityExpanded.cs new file mode 100644 index 000000000000..09ab9bb994b7 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/TestAzSiteRecoveryReplicationRecoveryPlanFailover_TestViaIdentityExpanded.cs @@ -0,0 +1,451 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to start the test failover of a recovery plan. + /// + /// [OpenAPI] TestFailover=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/testFailover" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsDiagnostic.Test, @"AzSiteRecoveryReplicationRecoveryPlanFailover_TestViaIdentityExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to start the test failover of a recovery plan.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class TestAzSiteRecoveryReplicationRecoveryPlanFailover_TestViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Recovery plan test failover input. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanTestFailoverInput _inputBody = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.RecoveryPlanTestFailoverInput(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// The failover direction. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The failover direction.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The failover direction.", + SerializedName = @"failoverDirection", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections) })] + [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections))] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.PossibleOperationsDirections FailoverDirection { get => _inputBody.FailoverDirection; set => _inputBody.FailoverDirection = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// The Id of the network to be used for test failover. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The Id of the network to be used for test failover.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Id of the network to be used for test failover.", + SerializedName = @"networkId", + PossibleTypes = new [] { typeof(string) })] + public string NetworkId { get => _inputBody.NetworkId ?? null; set => _inputBody.NetworkId = value; } + + /// The network type to be used for test failover. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The network type to be used for test failover.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The network type to be used for test failover.", + SerializedName = @"networkType", + PossibleTypes = new [] { typeof(string) })] + public string NetworkType { get => _inputBody.NetworkType ?? null; set => _inputBody.NetworkType = value; } + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The provider specific properties. + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The provider specific properties.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The provider specific properties.", + SerializedName = @"providerSpecificDetails", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInput) })] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanProviderSpecificFailoverInput[] ProviderSpecificDetail { get => _inputBody.ProviderSpecificDetail ?? null /* arrayOf */; set => _inputBody.ProviderSpecificDetail = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of TestAzSiteRecoveryReplicationRecoveryPlanFailover_TestViaIdentityExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.TestAzSiteRecoveryReplicationRecoveryPlanFailover_TestViaIdentityExpanded Clone() + { + var clone = new TestAzSiteRecoveryReplicationRecoveryPlanFailover_TestViaIdentityExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._inputBody = this._inputBody; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationRecoveryPlansTestFailover' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationRecoveryPlansTestFailoverViaIdentity(InputObject.Id, _inputBody, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.RecoveryPlanName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.RecoveryPlanName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationRecoveryPlansTestFailover(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.RecoveryPlanName ?? null, _inputBody, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=_inputBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public TestAzSiteRecoveryReplicationRecoveryPlanFailover_TestViaIdentityExpanded() + { + + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/UpdateAzSiteRecoveryReplicationMigrationItem_UpdateExpanded.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/UpdateAzSiteRecoveryReplicationMigrationItem_UpdateExpanded.cs new file mode 100644 index 000000000000..bcec208aeaf7 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/UpdateAzSiteRecoveryReplicationMigrationItem_UpdateExpanded.cs @@ -0,0 +1,477 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to update the recovery settings of an ASR migration item. + /// + /// [OpenAPI] Update=>PATCH:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzSiteRecoveryReplicationMigrationItem_UpdateExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to update the recovery settings of an ASR migration item.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class UpdateAzSiteRecoveryReplicationMigrationItem_UpdateExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Update migration item input. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMigrationItemInput _inputBody = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateMigrationItemInput(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// Fabric name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Fabric name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Fabric name.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _migrationItemName; + + /// Migration item name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Migration item name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Migration item name.", + SerializedName = @"migrationItemName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string MigrationItemName { get => this._migrationItemName; set => this._migrationItemName = value; } + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _protectionContainerName; + + /// Protection container name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Protection container name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Protection container name.", + SerializedName = @"protectionContainerName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ProtectionContainerName { get => this._protectionContainerName; set => this._protectionContainerName = value; } + + /// The class type. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The class type.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + public string ProviderSpecificDetailInstanceType { get => _inputBody.ProviderSpecificDetailInstanceType ?? null; set => _inputBody.ProviderSpecificDetailInstanceType = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of UpdateAzSiteRecoveryReplicationMigrationItem_UpdateExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.UpdateAzSiteRecoveryReplicationMigrationItem_UpdateExpanded Clone() + { + var clone = new UpdateAzSiteRecoveryReplicationMigrationItem_UpdateExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._inputBody = this._inputBody; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + clone.FabricName = this.FabricName; + clone.ProtectionContainerName = this.ProtectionContainerName; + clone.MigrationItemName = this.MigrationItemName; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationMigrationItemsUpdate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationMigrationItemsUpdate(ResourceName, ResourceGroupName, SubscriptionId, FabricName, ProtectionContainerName, MigrationItemName, _inputBody, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName,ProtectionContainerName=ProtectionContainerName,MigrationItemName=MigrationItemName,body=_inputBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public UpdateAzSiteRecoveryReplicationMigrationItem_UpdateExpanded() + { + + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/UpdateAzSiteRecoveryReplicationMigrationItem_UpdateViaIdentityExpanded.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/UpdateAzSiteRecoveryReplicationMigrationItem_UpdateViaIdentityExpanded.cs new file mode 100644 index 000000000000..cd86e8c236a7 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/UpdateAzSiteRecoveryReplicationMigrationItem_UpdateViaIdentityExpanded.cs @@ -0,0 +1,424 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to update the recovery settings of an ASR migration item. + /// + /// [OpenAPI] Update=>PATCH:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzSiteRecoveryReplicationMigrationItem_UpdateViaIdentityExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to update the recovery settings of an ASR migration item.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class UpdateAzSiteRecoveryReplicationMigrationItem_UpdateViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Update migration item input. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMigrationItemInput _inputBody = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateMigrationItemInput(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The class type. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The class type.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + public string ProviderSpecificDetailInstanceType { get => _inputBody.ProviderSpecificDetailInstanceType ?? null; set => _inputBody.ProviderSpecificDetailInstanceType = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of UpdateAzSiteRecoveryReplicationMigrationItem_UpdateViaIdentityExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.UpdateAzSiteRecoveryReplicationMigrationItem_UpdateViaIdentityExpanded Clone() + { + var clone = new UpdateAzSiteRecoveryReplicationMigrationItem_UpdateViaIdentityExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._inputBody = this._inputBody; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationMigrationItemsUpdate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationMigrationItemsUpdateViaIdentity(InputObject.Id, _inputBody, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.FabricName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.FabricName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ProtectionContainerName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ProtectionContainerName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.MigrationItemName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.MigrationItemName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationMigrationItemsUpdate(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.FabricName ?? null, InputObject.ProtectionContainerName ?? null, InputObject.MigrationItemName ?? null, _inputBody, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=_inputBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the + /// cmdlet class. + /// + public UpdateAzSiteRecoveryReplicationMigrationItem_UpdateViaIdentityExpanded() + { + + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IMigrationItem + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/UpdateAzSiteRecoveryReplicationNetworkMapping_UpdateExpanded.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/UpdateAzSiteRecoveryReplicationNetworkMapping_UpdateExpanded.cs new file mode 100644 index 000000000000..ee6517b719b8 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/UpdateAzSiteRecoveryReplicationNetworkMapping_UpdateExpanded.cs @@ -0,0 +1,499 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to update an ASR network mapping. + /// + /// [OpenAPI] Update=>PATCH:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}/replicationNetworkMappings/{networkMappingName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzSiteRecoveryReplicationNetworkMapping_UpdateExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMapping))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to update an ASR network mapping.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class UpdateAzSiteRecoveryReplicationNetworkMapping_UpdateExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Update network mapping input. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateNetworkMappingInput _inputBody = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateNetworkMappingInput(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// Primary fabric name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Primary fabric name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Primary fabric name.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// The instance type. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The instance type.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The instance type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + public string FabricSpecificDetailInstanceType { get => _inputBody.FabricSpecificDetailInstanceType ?? null; set => _inputBody.FabricSpecificDetailInstanceType = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _networkMappingName; + + /// Network mapping name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Network mapping name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Network mapping name.", + SerializedName = @"networkMappingName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string NetworkMappingName { get => this._networkMappingName; set => this._networkMappingName = value; } + + /// Backing field for property. + private string _networkName; + + /// Primary network name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Primary network name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Primary network name.", + SerializedName = @"networkName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string NetworkName { get => this._networkName; set => this._networkName = value; } + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Recovery fabric name. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Recovery fabric name.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Recovery fabric name.", + SerializedName = @"recoveryFabricName", + PossibleTypes = new [] { typeof(string) })] + public string RecoveryFabricName { get => _inputBody.RecoveryFabricName ?? null; set => _inputBody.RecoveryFabricName = value; } + + /// Recovery network Id. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Recovery network Id.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Recovery network Id.", + SerializedName = @"recoveryNetworkId", + PossibleTypes = new [] { typeof(string) })] + public string RecoveryNetworkId { get => _inputBody.RecoveryNetworkId ?? null; set => _inputBody.RecoveryNetworkId = value; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMapping + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of UpdateAzSiteRecoveryReplicationNetworkMapping_UpdateExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.UpdateAzSiteRecoveryReplicationNetworkMapping_UpdateExpanded Clone() + { + var clone = new UpdateAzSiteRecoveryReplicationNetworkMapping_UpdateExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._inputBody = this._inputBody; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + clone.FabricName = this.FabricName; + clone.NetworkName = this.NetworkName; + clone.NetworkMappingName = this.NetworkMappingName; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationNetworkMappingsUpdate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationNetworkMappingsUpdate(ResourceName, ResourceGroupName, SubscriptionId, FabricName, NetworkName, NetworkMappingName, _inputBody, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName,NetworkName=NetworkName,NetworkMappingName=NetworkMappingName,body=_inputBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public UpdateAzSiteRecoveryReplicationNetworkMapping_UpdateExpanded() + { + + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMapping + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMapping + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/UpdateAzSiteRecoveryReplicationNetworkMapping_UpdateViaIdentityExpanded.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/UpdateAzSiteRecoveryReplicationNetworkMapping_UpdateViaIdentityExpanded.cs new file mode 100644 index 000000000000..4e4324d03cca --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/UpdateAzSiteRecoveryReplicationNetworkMapping_UpdateViaIdentityExpanded.cs @@ -0,0 +1,446 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to update an ASR network mapping. + /// + /// [OpenAPI] Update=>PATCH:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}/replicationNetworkMappings/{networkMappingName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzSiteRecoveryReplicationNetworkMapping_UpdateViaIdentityExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMapping))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to update an ASR network mapping.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class UpdateAzSiteRecoveryReplicationNetworkMapping_UpdateViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Update network mapping input. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateNetworkMappingInput _inputBody = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateNetworkMappingInput(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// The instance type. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The instance type.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The instance type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + public string FabricSpecificDetailInstanceType { get => _inputBody.FabricSpecificDetailInstanceType ?? null; set => _inputBody.FabricSpecificDetailInstanceType = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Recovery fabric name. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Recovery fabric name.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Recovery fabric name.", + SerializedName = @"recoveryFabricName", + PossibleTypes = new [] { typeof(string) })] + public string RecoveryFabricName { get => _inputBody.RecoveryFabricName ?? null; set => _inputBody.RecoveryFabricName = value; } + + /// Recovery network Id. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Recovery network Id.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Recovery network Id.", + SerializedName = @"recoveryNetworkId", + PossibleTypes = new [] { typeof(string) })] + public string RecoveryNetworkId { get => _inputBody.RecoveryNetworkId ?? null; set => _inputBody.RecoveryNetworkId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMapping + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of UpdateAzSiteRecoveryReplicationNetworkMapping_UpdateViaIdentityExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.UpdateAzSiteRecoveryReplicationNetworkMapping_UpdateViaIdentityExpanded Clone() + { + var clone = new UpdateAzSiteRecoveryReplicationNetworkMapping_UpdateViaIdentityExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._inputBody = this._inputBody; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationNetworkMappingsUpdate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationNetworkMappingsUpdateViaIdentity(InputObject.Id, _inputBody, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.FabricName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.FabricName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.NetworkName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.NetworkName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.NetworkMappingName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.NetworkMappingName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationNetworkMappingsUpdate(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.FabricName ?? null, InputObject.NetworkName ?? null, InputObject.NetworkMappingName ?? null, _inputBody, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=_inputBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the + /// cmdlet class. + /// + public UpdateAzSiteRecoveryReplicationNetworkMapping_UpdateViaIdentityExpanded() + { + + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMapping + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.INetworkMapping + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/UpdateAzSiteRecoveryReplicationPolicy_UpdateExpanded.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/UpdateAzSiteRecoveryReplicationPolicy_UpdateExpanded.cs new file mode 100644 index 000000000000..698072d5f4ad --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/UpdateAzSiteRecoveryReplicationPolicy_UpdateExpanded.cs @@ -0,0 +1,445 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to update a replication policy. + /// + /// [OpenAPI] Update=>PATCH:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationPolicies/{policyName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzSiteRecoveryReplicationPolicy_UpdateExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicy))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to update a replication policy.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class UpdateAzSiteRecoveryReplicationPolicy_UpdateExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Update policy input. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdatePolicyInput _inputBody = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdatePolicyInput(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _policyName; + + /// Policy Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Policy Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Policy Id.", + SerializedName = @"policyName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string PolicyName { get => this._policyName; set => this._policyName = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// The class type. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The class type.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + public string ReplicationProviderSettingInstanceType { get => _inputBody.ReplicationProviderSettingInstanceType ?? null; set => _inputBody.ReplicationProviderSettingInstanceType = value; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicy + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of UpdateAzSiteRecoveryReplicationPolicy_UpdateExpanded + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.UpdateAzSiteRecoveryReplicationPolicy_UpdateExpanded Clone() + { + var clone = new UpdateAzSiteRecoveryReplicationPolicy_UpdateExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._inputBody = this._inputBody; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + clone.PolicyName = this.PolicyName; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationPoliciesUpdate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationPoliciesUpdate(ResourceName, ResourceGroupName, SubscriptionId, PolicyName, _inputBody, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,PolicyName=PolicyName,body=_inputBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public UpdateAzSiteRecoveryReplicationPolicy_UpdateExpanded() + { + + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicy + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicy + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/UpdateAzSiteRecoveryReplicationPolicy_UpdateViaIdentityExpanded.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/UpdateAzSiteRecoveryReplicationPolicy_UpdateViaIdentityExpanded.cs new file mode 100644 index 000000000000..adfeddafcb8f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/UpdateAzSiteRecoveryReplicationPolicy_UpdateViaIdentityExpanded.cs @@ -0,0 +1,416 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to update a replication policy. + /// + /// [OpenAPI] Update=>PATCH:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationPolicies/{policyName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzSiteRecoveryReplicationPolicy_UpdateViaIdentityExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicy))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to update a replication policy.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class UpdateAzSiteRecoveryReplicationPolicy_UpdateViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Update policy input. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdatePolicyInput _inputBody = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdatePolicyInput(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// The class type. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The class type.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + public string ReplicationProviderSettingInstanceType { get => _inputBody.ReplicationProviderSettingInstanceType ?? null; set => _inputBody.ReplicationProviderSettingInstanceType = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicy + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of UpdateAzSiteRecoveryReplicationPolicy_UpdateViaIdentityExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.UpdateAzSiteRecoveryReplicationPolicy_UpdateViaIdentityExpanded Clone() + { + var clone = new UpdateAzSiteRecoveryReplicationPolicy_UpdateViaIdentityExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._inputBody = this._inputBody; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationPoliciesUpdate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationPoliciesUpdateViaIdentity(InputObject.Id, _inputBody, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.PolicyName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.PolicyName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationPoliciesUpdate(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.PolicyName ?? null, _inputBody, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=_inputBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the cmdlet + /// class. + /// + public UpdateAzSiteRecoveryReplicationPolicy_UpdateViaIdentityExpanded() + { + + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicy + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IPolicy + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/UpdateAzSiteRecoveryReplicationProtectedItemAppliance_UpdateExpanded.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/UpdateAzSiteRecoveryReplicationProtectedItemAppliance_UpdateExpanded.cs new file mode 100644 index 000000000000..1dba9b247677 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/UpdateAzSiteRecoveryReplicationProtectedItemAppliance_UpdateExpanded.cs @@ -0,0 +1,489 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to update appliance of an ASR replication protected item. + /// + /// [OpenAPI] UpdateAppliance=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/updateAppliance" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzSiteRecoveryReplicationProtectedItemAppliance_UpdateExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to update appliance of an ASR replication protected item.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class UpdateAzSiteRecoveryReplicationProtectedItemAppliance_UpdateExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// Update appliance for replication protected item input. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemInput _applianceUpdateInputBody = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateApplianceForReplicationProtectedItemInput(); + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// Fabric name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Fabric name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Fabric name.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _protectionContainerName; + + /// Protection container name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Protection container name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Protection container name.", + SerializedName = @"protectionContainerName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ProtectionContainerName { get => this._protectionContainerName; set => this._protectionContainerName = value; } + + /// The class type. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The class type.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + public string ProviderSpecificDetailInstanceType { get => _applianceUpdateInputBody.ProviderSpecificDetailInstanceType ?? null; set => _applianceUpdateInputBody.ProviderSpecificDetailInstanceType = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _replicatedProtectedItemName; + + /// Replication protected item name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Replication protected item name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Replication protected item name.", + SerializedName = @"replicatedProtectedItemName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ReplicatedProtectedItemName { get => this._replicatedProtectedItemName; set => this._replicatedProtectedItemName = value; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// The target appliance Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The target appliance Id.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The target appliance Id.", + SerializedName = @"targetApplianceId", + PossibleTypes = new [] { typeof(string) })] + public string TargetApplianceId { get => _applianceUpdateInputBody.TargetApplianceId ?? null; set => _applianceUpdateInputBody.TargetApplianceId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of UpdateAzSiteRecoveryReplicationProtectedItemAppliance_UpdateExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.UpdateAzSiteRecoveryReplicationProtectedItemAppliance_UpdateExpanded Clone() + { + var clone = new UpdateAzSiteRecoveryReplicationProtectedItemAppliance_UpdateExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._applianceUpdateInputBody = this._applianceUpdateInputBody; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + clone.FabricName = this.FabricName; + clone.ProtectionContainerName = this.ProtectionContainerName; + clone.ReplicatedProtectedItemName = this.ReplicatedProtectedItemName; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationProtectedItemsUpdateAppliance' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationProtectedItemsUpdateAppliance(ResourceName, ResourceGroupName, SubscriptionId, FabricName, ProtectionContainerName, ReplicatedProtectedItemName, _applianceUpdateInputBody, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName,ProtectionContainerName=ProtectionContainerName,ReplicatedProtectedItemName=ReplicatedProtectedItemName,body=_applianceUpdateInputBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the cmdlet + /// class. + /// + public UpdateAzSiteRecoveryReplicationProtectedItemAppliance_UpdateExpanded() + { + + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/UpdateAzSiteRecoveryReplicationProtectedItemAppliance_UpdateViaIdentityExpanded.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/UpdateAzSiteRecoveryReplicationProtectedItemAppliance_UpdateViaIdentityExpanded.cs new file mode 100644 index 000000000000..c1ab729c0ed5 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/UpdateAzSiteRecoveryReplicationProtectedItemAppliance_UpdateViaIdentityExpanded.cs @@ -0,0 +1,435 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to update appliance of an ASR replication protected item. + /// + /// [OpenAPI] UpdateAppliance=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/updateAppliance" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzSiteRecoveryReplicationProtectedItemAppliance_UpdateViaIdentityExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to update appliance of an ASR replication protected item.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class UpdateAzSiteRecoveryReplicationProtectedItemAppliance_UpdateViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// Update appliance for replication protected item input. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateApplianceForReplicationProtectedItemInput _applianceUpdateInputBody = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateApplianceForReplicationProtectedItemInput(); + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The class type. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The class type.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + public string ProviderSpecificDetailInstanceType { get => _applianceUpdateInputBody.ProviderSpecificDetailInstanceType ?? null; set => _applianceUpdateInputBody.ProviderSpecificDetailInstanceType = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// The target appliance Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The target appliance Id.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The target appliance Id.", + SerializedName = @"targetApplianceId", + PossibleTypes = new [] { typeof(string) })] + public string TargetApplianceId { get => _applianceUpdateInputBody.TargetApplianceId ?? null; set => _applianceUpdateInputBody.TargetApplianceId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of UpdateAzSiteRecoveryReplicationProtectedItemAppliance_UpdateViaIdentityExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.UpdateAzSiteRecoveryReplicationProtectedItemAppliance_UpdateViaIdentityExpanded Clone() + { + var clone = new UpdateAzSiteRecoveryReplicationProtectedItemAppliance_UpdateViaIdentityExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._applianceUpdateInputBody = this._applianceUpdateInputBody; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationProtectedItemsUpdateAppliance' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationProtectedItemsUpdateApplianceViaIdentity(InputObject.Id, _applianceUpdateInputBody, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.FabricName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.FabricName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ProtectionContainerName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ProtectionContainerName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ReplicatedProtectedItemName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ReplicatedProtectedItemName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationProtectedItemsUpdateAppliance(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.FabricName ?? null, InputObject.ProtectionContainerName ?? null, InputObject.ReplicatedProtectedItemName ?? null, _applianceUpdateInputBody, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=_applianceUpdateInputBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public UpdateAzSiteRecoveryReplicationProtectedItemAppliance_UpdateViaIdentityExpanded() + { + + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/UpdateAzSiteRecoveryReplicationProtectedItemMobilityService_UpdateExpanded.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/UpdateAzSiteRecoveryReplicationProtectedItemMobilityService_UpdateExpanded.cs new file mode 100644 index 000000000000..2dba77f35ed1 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/UpdateAzSiteRecoveryReplicationProtectedItemMobilityService_UpdateExpanded.cs @@ -0,0 +1,481 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// + /// The operation to update(push update) the installed mobility service software on a replication protected item to the latest + /// available version. + /// + /// + /// [OpenAPI] UpdateMobilityService=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/updateMobilityService" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzSiteRecoveryReplicationProtectedItemMobilityService_UpdateExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to update(push update) the installed mobility service software on a replication protected item to the latest available version.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class UpdateAzSiteRecoveryReplicationProtectedItemMobilityService_UpdateExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Request to update the mobility service on a protected item. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMobilityServiceRequest _updateMobilityServiceRequestBody = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateMobilityServiceRequest(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// The name of the fabric containing the protected item. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the fabric containing the protected item.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the fabric containing the protected item.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _protectionContainerName; + + /// The name of the container containing the protected item. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the container containing the protected item.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the container containing the protected item.", + SerializedName = @"protectionContainerName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ProtectionContainerName { get => this._protectionContainerName; set => this._protectionContainerName = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _replicatedProtectedItemName; + + /// The name of the protected item on which the agent is to be updated. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the protected item on which the agent is to be updated.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the protected item on which the agent is to be updated.", + SerializedName = @"replicatedProtectedItemName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ReplicatedProtectedItemName { get => this._replicatedProtectedItemName; set => this._replicatedProtectedItemName = value; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// The CS run as account Id. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The CS run as account Id.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The CS run as account Id.", + SerializedName = @"runAsAccountId", + PossibleTypes = new [] { typeof(string) })] + public string RunAsAccountId { get => _updateMobilityServiceRequestBody.RunAsAccountId ?? null; set => _updateMobilityServiceRequestBody.RunAsAccountId = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of UpdateAzSiteRecoveryReplicationProtectedItemMobilityService_UpdateExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.UpdateAzSiteRecoveryReplicationProtectedItemMobilityService_UpdateExpanded Clone() + { + var clone = new UpdateAzSiteRecoveryReplicationProtectedItemMobilityService_UpdateExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._updateMobilityServiceRequestBody = this._updateMobilityServiceRequestBody; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + clone.FabricName = this.FabricName; + clone.ProtectionContainerName = this.ProtectionContainerName; + clone.ReplicatedProtectedItemName = this.ReplicatedProtectedItemName; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationProtectedItemsUpdateMobilityService' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationProtectedItemsUpdateMobilityService(ResourceName, ResourceGroupName, SubscriptionId, FabricName, ProtectionContainerName, ReplicatedProtectedItemName, _updateMobilityServiceRequestBody, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName,ProtectionContainerName=ProtectionContainerName,ReplicatedProtectedItemName=ReplicatedProtectedItemName,body=_updateMobilityServiceRequestBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public UpdateAzSiteRecoveryReplicationProtectedItemMobilityService_UpdateExpanded() + { + + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/UpdateAzSiteRecoveryReplicationProtectedItemMobilityService_UpdateViaIdentityExpanded.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/UpdateAzSiteRecoveryReplicationProtectedItemMobilityService_UpdateViaIdentityExpanded.cs new file mode 100644 index 000000000000..57bceca88c6b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/UpdateAzSiteRecoveryReplicationProtectedItemMobilityService_UpdateViaIdentityExpanded.cs @@ -0,0 +1,427 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// + /// The operation to update(push update) the installed mobility service software on a replication protected item to the latest + /// available version. + /// + /// + /// [OpenAPI] UpdateMobilityService=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/updateMobilityService" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzSiteRecoveryReplicationProtectedItemMobilityService_UpdateViaIdentityExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to update(push update) the installed mobility service software on a replication protected item to the latest available version.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class UpdateAzSiteRecoveryReplicationProtectedItemMobilityService_UpdateViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Request to update the mobility service on a protected item. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateMobilityServiceRequest _updateMobilityServiceRequestBody = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateMobilityServiceRequest(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// The CS run as account Id. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The CS run as account Id.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The CS run as account Id.", + SerializedName = @"runAsAccountId", + PossibleTypes = new [] { typeof(string) })] + public string RunAsAccountId { get => _updateMobilityServiceRequestBody.RunAsAccountId ?? null; set => _updateMobilityServiceRequestBody.RunAsAccountId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of UpdateAzSiteRecoveryReplicationProtectedItemMobilityService_UpdateViaIdentityExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.UpdateAzSiteRecoveryReplicationProtectedItemMobilityService_UpdateViaIdentityExpanded Clone() + { + var clone = new UpdateAzSiteRecoveryReplicationProtectedItemMobilityService_UpdateViaIdentityExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._updateMobilityServiceRequestBody = this._updateMobilityServiceRequestBody; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationProtectedItemsUpdateMobilityService' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationProtectedItemsUpdateMobilityServiceViaIdentity(InputObject.Id, _updateMobilityServiceRequestBody, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.FabricName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.FabricName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ProtectionContainerName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ProtectionContainerName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ReplicatedProtectedItemName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ReplicatedProtectedItemName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationProtectedItemsUpdateMobilityService(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.FabricName ?? null, InputObject.ProtectionContainerName ?? null, InputObject.ReplicatedProtectedItemName ?? null, _updateMobilityServiceRequestBody, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=_updateMobilityServiceRequestBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public UpdateAzSiteRecoveryReplicationProtectedItemMobilityService_UpdateViaIdentityExpanded() + { + + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/UpdateAzSiteRecoveryReplicationProtectedItem_UpdateExpanded.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/UpdateAzSiteRecoveryReplicationProtectedItem_UpdateExpanded.cs new file mode 100644 index 000000000000..333461900782 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/UpdateAzSiteRecoveryReplicationProtectedItem_UpdateExpanded.cs @@ -0,0 +1,585 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// + /// The operation to update the recovery settings of an ASR replication protected item. + /// + /// + /// [OpenAPI] Update=>PATCH:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzSiteRecoveryReplicationProtectedItem_UpdateExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to update the recovery settings of an ASR replication protected item.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class UpdateAzSiteRecoveryReplicationProtectedItem_UpdateExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Update replication protected item input. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInput _updateProtectionInputBody = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateReplicationProtectedItemInput(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// + /// The selected option to enable RDP\SSH on target vm after failover. String value of SrsDataContract.EnableRDPOnTargetOption + /// enum. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The selected option to enable RDP\\SSH on target vm after failover. String value of SrsDataContract.EnableRDPOnTargetOption enum.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The selected option to enable RDP\SSH on target vm after failover. String value of SrsDataContract.EnableRDPOnTargetOption enum.", + SerializedName = @"enableRdpOnTargetOption", + PossibleTypes = new [] { typeof(string) })] + public string EnableRdpOnTargetOption { get => _updateProtectionInputBody.EnableRdpOnTargetOption ?? null; set => _updateProtectionInputBody.EnableRdpOnTargetOption = value; } + + /// Backing field for property. + private string _fabricName; + + /// Fabric name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Fabric name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Fabric name.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// License type. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "License type.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"License type.", + SerializedName = @"licenseType", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.LicenseType) })] + [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.LicenseType))] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.LicenseType LicenseType { get => _updateProtectionInputBody.LicenseType ?? ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.LicenseType)""); set => _updateProtectionInputBody.LicenseType = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _protectionContainerName; + + /// Protection container name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Protection container name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Protection container name.", + SerializedName = @"protectionContainerName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ProtectionContainerName { get => this._protectionContainerName; set => this._protectionContainerName = value; } + + /// The class type. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The class type.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + public string ProviderSpecificDetailInstanceType { get => _updateProtectionInputBody.ProviderSpecificDetailInstanceType ?? null; set => _updateProtectionInputBody.ProviderSpecificDetailInstanceType = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// The target availability set Id. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The target availability set Id.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target availability set Id.", + SerializedName = @"recoveryAvailabilitySetId", + PossibleTypes = new [] { typeof(string) })] + public string RecoveryAvailabilitySetId { get => _updateProtectionInputBody.RecoveryAvailabilitySetId ?? null; set => _updateProtectionInputBody.RecoveryAvailabilitySetId = value; } + + /// Target Azure VM name given by the user. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Target Azure VM name given by the user.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Target Azure VM name given by the user.", + SerializedName = @"recoveryAzureVMName", + PossibleTypes = new [] { typeof(string) })] + public string RecoveryAzureVMName { get => _updateProtectionInputBody.RecoveryAzureVMName ?? null; set => _updateProtectionInputBody.RecoveryAzureVMName = value; } + + /// Target Azure VM size. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Target Azure VM size.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Target Azure VM size.", + SerializedName = @"recoveryAzureVMSize", + PossibleTypes = new [] { typeof(string) })] + public string RecoveryAzureVMSize { get => _updateProtectionInputBody.RecoveryAzureVMSize ?? null; set => _updateProtectionInputBody.RecoveryAzureVMSize = value; } + + /// Backing field for property. + private string _replicatedProtectedItemName; + + /// Replication protected item name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Replication protected item name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Replication protected item name.", + SerializedName = @"replicatedProtectedItemName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ReplicatedProtectedItemName { get => this._replicatedProtectedItemName; set => this._replicatedProtectedItemName = value; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Target Azure Network Id. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Target Azure Network Id.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Target Azure Network Id.", + SerializedName = @"selectedRecoveryAzureNetworkId", + PossibleTypes = new [] { typeof(string) })] + public string SelectedRecoveryAzureNetworkId { get => _updateProtectionInputBody.SelectedRecoveryAzureNetworkId ?? null; set => _updateProtectionInputBody.SelectedRecoveryAzureNetworkId = value; } + + /// + /// The selected source nic Id which will be used as the primary nic during failover. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The selected source nic Id which will be used as the primary nic during failover.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The selected source nic Id which will be used as the primary nic during failover.", + SerializedName = @"selectedSourceNicId", + PossibleTypes = new [] { typeof(string) })] + public string SelectedSourceNicId { get => _updateProtectionInputBody.SelectedSourceNicId ?? null; set => _updateProtectionInputBody.SelectedSourceNicId = value; } + + /// The Azure Network Id for test failover. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The Azure Network Id for test failover.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Azure Network Id for test failover.", + SerializedName = @"selectedTfoAzureNetworkId", + PossibleTypes = new [] { typeof(string) })] + public string SelectedTfoAzureNetworkId { get => _updateProtectionInputBody.SelectedTfoAzureNetworkId ?? null; set => _updateProtectionInputBody.SelectedTfoAzureNetworkId = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// The list of VM nic details. + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The list of VM nic details.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of VM nic details.", + SerializedName = @"vmNics", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicInputDetails) })] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicInputDetails[] VMNic { get => _updateProtectionInputBody.VMNic ?? null /* arrayOf */; set => _updateProtectionInputBody.VMNic = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of UpdateAzSiteRecoveryReplicationProtectedItem_UpdateExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.UpdateAzSiteRecoveryReplicationProtectedItem_UpdateExpanded Clone() + { + var clone = new UpdateAzSiteRecoveryReplicationProtectedItem_UpdateExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._updateProtectionInputBody = this._updateProtectionInputBody; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + clone.FabricName = this.FabricName; + clone.ProtectionContainerName = this.ProtectionContainerName; + clone.ReplicatedProtectedItemName = this.ReplicatedProtectedItemName; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationProtectedItemsUpdate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationProtectedItemsUpdate(ResourceName, ResourceGroupName, SubscriptionId, FabricName, ProtectionContainerName, ReplicatedProtectedItemName, _updateProtectionInputBody, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName,ProtectionContainerName=ProtectionContainerName,ReplicatedProtectedItemName=ReplicatedProtectedItemName,body=_updateProtectionInputBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public UpdateAzSiteRecoveryReplicationProtectedItem_UpdateExpanded() + { + + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/UpdateAzSiteRecoveryReplicationProtectedItem_UpdateViaIdentityExpanded.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/UpdateAzSiteRecoveryReplicationProtectedItem_UpdateViaIdentityExpanded.cs new file mode 100644 index 000000000000..1f94d4146058 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/UpdateAzSiteRecoveryReplicationProtectedItem_UpdateViaIdentityExpanded.cs @@ -0,0 +1,532 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// + /// The operation to update the recovery settings of an ASR replication protected item. + /// + /// + /// [OpenAPI] Update=>PATCH:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzSiteRecoveryReplicationProtectedItem_UpdateViaIdentityExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to update the recovery settings of an ASR replication protected item.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class UpdateAzSiteRecoveryReplicationProtectedItem_UpdateViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Update replication protected item input. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateReplicationProtectedItemInput _updateProtectionInputBody = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateReplicationProtectedItemInput(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// + /// The selected option to enable RDP\SSH on target vm after failover. String value of SrsDataContract.EnableRDPOnTargetOption + /// enum. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The selected option to enable RDP\\SSH on target vm after failover. String value of SrsDataContract.EnableRDPOnTargetOption enum.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The selected option to enable RDP\SSH on target vm after failover. String value of SrsDataContract.EnableRDPOnTargetOption enum.", + SerializedName = @"enableRdpOnTargetOption", + PossibleTypes = new [] { typeof(string) })] + public string EnableRdpOnTargetOption { get => _updateProtectionInputBody.EnableRdpOnTargetOption ?? null; set => _updateProtectionInputBody.EnableRdpOnTargetOption = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// License type. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "License type.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"License type.", + SerializedName = @"licenseType", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.LicenseType) })] + [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.LicenseType))] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.LicenseType LicenseType { get => _updateProtectionInputBody.LicenseType ?? ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support.LicenseType)""); set => _updateProtectionInputBody.LicenseType = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The class type. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The class type.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + public string ProviderSpecificDetailInstanceType { get => _updateProtectionInputBody.ProviderSpecificDetailInstanceType ?? null; set => _updateProtectionInputBody.ProviderSpecificDetailInstanceType = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// The target availability set Id. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The target availability set Id.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target availability set Id.", + SerializedName = @"recoveryAvailabilitySetId", + PossibleTypes = new [] { typeof(string) })] + public string RecoveryAvailabilitySetId { get => _updateProtectionInputBody.RecoveryAvailabilitySetId ?? null; set => _updateProtectionInputBody.RecoveryAvailabilitySetId = value; } + + /// Target Azure VM name given by the user. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Target Azure VM name given by the user.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Target Azure VM name given by the user.", + SerializedName = @"recoveryAzureVMName", + PossibleTypes = new [] { typeof(string) })] + public string RecoveryAzureVMName { get => _updateProtectionInputBody.RecoveryAzureVMName ?? null; set => _updateProtectionInputBody.RecoveryAzureVMName = value; } + + /// Target Azure VM size. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Target Azure VM size.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Target Azure VM size.", + SerializedName = @"recoveryAzureVMSize", + PossibleTypes = new [] { typeof(string) })] + public string RecoveryAzureVMSize { get => _updateProtectionInputBody.RecoveryAzureVMSize ?? null; set => _updateProtectionInputBody.RecoveryAzureVMSize = value; } + + /// Target Azure Network Id. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Target Azure Network Id.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Target Azure Network Id.", + SerializedName = @"selectedRecoveryAzureNetworkId", + PossibleTypes = new [] { typeof(string) })] + public string SelectedRecoveryAzureNetworkId { get => _updateProtectionInputBody.SelectedRecoveryAzureNetworkId ?? null; set => _updateProtectionInputBody.SelectedRecoveryAzureNetworkId = value; } + + /// + /// The selected source nic Id which will be used as the primary nic during failover. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The selected source nic Id which will be used as the primary nic during failover.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The selected source nic Id which will be used as the primary nic during failover.", + SerializedName = @"selectedSourceNicId", + PossibleTypes = new [] { typeof(string) })] + public string SelectedSourceNicId { get => _updateProtectionInputBody.SelectedSourceNicId ?? null; set => _updateProtectionInputBody.SelectedSourceNicId = value; } + + /// The Azure Network Id for test failover. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The Azure Network Id for test failover.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Azure Network Id for test failover.", + SerializedName = @"selectedTfoAzureNetworkId", + PossibleTypes = new [] { typeof(string) })] + public string SelectedTfoAzureNetworkId { get => _updateProtectionInputBody.SelectedTfoAzureNetworkId ?? null; set => _updateProtectionInputBody.SelectedTfoAzureNetworkId = value; } + + /// The list of VM nic details. + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The list of VM nic details.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of VM nic details.", + SerializedName = @"vmNics", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicInputDetails) })] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVMNicInputDetails[] VMNic { get => _updateProtectionInputBody.VMNic ?? null /* arrayOf */; set => _updateProtectionInputBody.VMNic = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of UpdateAzSiteRecoveryReplicationProtectedItem_UpdateViaIdentityExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.UpdateAzSiteRecoveryReplicationProtectedItem_UpdateViaIdentityExpanded Clone() + { + var clone = new UpdateAzSiteRecoveryReplicationProtectedItem_UpdateViaIdentityExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._updateProtectionInputBody = this._updateProtectionInputBody; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationProtectedItemsUpdate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationProtectedItemsUpdateViaIdentity(InputObject.Id, _updateProtectionInputBody, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.FabricName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.FabricName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ProtectionContainerName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ProtectionContainerName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ReplicatedProtectedItemName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ReplicatedProtectedItemName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationProtectedItemsUpdate(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.FabricName ?? null, InputObject.ProtectionContainerName ?? null, InputObject.ReplicatedProtectedItemName ?? null, _updateProtectionInputBody, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=_updateProtectionInputBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the + /// cmdlet class. + /// + public UpdateAzSiteRecoveryReplicationProtectedItem_UpdateViaIdentityExpanded() + { + + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IReplicationProtectedItem + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/UpdateAzSiteRecoveryReplicationProtectionContainerMapping_UpdateExpanded.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/UpdateAzSiteRecoveryReplicationProtectionContainerMapping_UpdateExpanded.cs new file mode 100644 index 000000000000..3e1f2373e0f2 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/UpdateAzSiteRecoveryReplicationProtectionContainerMapping_UpdateExpanded.cs @@ -0,0 +1,478 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to update protection container mapping. + /// + /// [OpenAPI] Update=>PATCH:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings/{mappingName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzSiteRecoveryReplicationProtectionContainerMapping_UpdateExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMapping))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to update protection container mapping.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class UpdateAzSiteRecoveryReplicationProtectionContainerMapping_UpdateExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Container pairing update input. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateProtectionContainerMappingInput _updateInputBody = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateProtectionContainerMappingInput(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// Fabric name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Fabric name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Fabric name.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// Backing field for property. + private string _mappingName; + + /// Protection container mapping name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Protection container mapping name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Protection container mapping name.", + SerializedName = @"mappingName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string MappingName { get => this._mappingName; set => this._mappingName = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _protectionContainerName; + + /// Protection container name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Protection container name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Protection container name.", + SerializedName = @"protectionContainerName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ProtectionContainerName { get => this._protectionContainerName; set => this._protectionContainerName = value; } + + /// The class type. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The class type.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + public string ProviderSpecificInputInstanceType { get => _updateInputBody.ProviderSpecificInputInstanceType ?? null; set => _updateInputBody.ProviderSpecificInputInstanceType = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMapping + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of UpdateAzSiteRecoveryReplicationProtectionContainerMapping_UpdateExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.UpdateAzSiteRecoveryReplicationProtectionContainerMapping_UpdateExpanded Clone() + { + var clone = new UpdateAzSiteRecoveryReplicationProtectionContainerMapping_UpdateExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._updateInputBody = this._updateInputBody; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + clone.FabricName = this.FabricName; + clone.ProtectionContainerName = this.ProtectionContainerName; + clone.MappingName = this.MappingName; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationProtectionContainerMappingsUpdate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationProtectionContainerMappingsUpdate(ResourceName, ResourceGroupName, SubscriptionId, FabricName, ProtectionContainerName, MappingName, _updateInputBody, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName,ProtectionContainerName=ProtectionContainerName,MappingName=MappingName,body=_updateInputBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public UpdateAzSiteRecoveryReplicationProtectionContainerMapping_UpdateExpanded() + { + + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMapping + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMapping + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/UpdateAzSiteRecoveryReplicationProtectionContainerMapping_UpdateViaIdentityExpanded.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/UpdateAzSiteRecoveryReplicationProtectionContainerMapping_UpdateViaIdentityExpanded.cs new file mode 100644 index 000000000000..4c2a006aa89e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/UpdateAzSiteRecoveryReplicationProtectionContainerMapping_UpdateViaIdentityExpanded.cs @@ -0,0 +1,424 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to update protection container mapping. + /// + /// [OpenAPI] Update=>PATCH:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings/{mappingName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzSiteRecoveryReplicationProtectionContainerMapping_UpdateViaIdentityExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMapping))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to update protection container mapping.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class UpdateAzSiteRecoveryReplicationProtectionContainerMapping_UpdateViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Container pairing update input. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateProtectionContainerMappingInput _updateInputBody = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateProtectionContainerMappingInput(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The class type. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The class type.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The class type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + public string ProviderSpecificInputInstanceType { get => _updateInputBody.ProviderSpecificInputInstanceType ?? null; set => _updateInputBody.ProviderSpecificInputInstanceType = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMapping + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of UpdateAzSiteRecoveryReplicationProtectionContainerMapping_UpdateViaIdentityExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.UpdateAzSiteRecoveryReplicationProtectionContainerMapping_UpdateViaIdentityExpanded Clone() + { + var clone = new UpdateAzSiteRecoveryReplicationProtectionContainerMapping_UpdateViaIdentityExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._updateInputBody = this._updateInputBody; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationProtectionContainerMappingsUpdate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationProtectionContainerMappingsUpdateViaIdentity(InputObject.Id, _updateInputBody, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.FabricName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.FabricName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ProtectionContainerName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ProtectionContainerName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.MappingName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.MappingName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationProtectionContainerMappingsUpdate(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.FabricName ?? null, InputObject.ProtectionContainerName ?? null, InputObject.MappingName ?? null, _updateInputBody, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=_updateInputBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public UpdateAzSiteRecoveryReplicationProtectionContainerMapping_UpdateViaIdentityExpanded() + { + + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMapping + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IProtectionContainerMapping + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/UpdateAzSiteRecoveryReplicationRecoveryPlan_UpdateExpanded.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/UpdateAzSiteRecoveryReplicationRecoveryPlan_UpdateExpanded.cs new file mode 100644 index 000000000000..62616a451293 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/UpdateAzSiteRecoveryReplicationRecoveryPlan_UpdateExpanded.cs @@ -0,0 +1,448 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to update a recovery plan. + /// + /// [OpenAPI] Update=>PATCH:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzSiteRecoveryReplicationRecoveryPlan_UpdateExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to update a recovery plan.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class UpdateAzSiteRecoveryReplicationRecoveryPlan_UpdateExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Update recovery plan input class. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateRecoveryPlanInput _inputBody = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateRecoveryPlanInput(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// The recovery plan groups. + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The recovery plan groups.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery plan groups.", + SerializedName = @"groups", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroup) })] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroup[] Group { get => _inputBody.Group ?? null /* arrayOf */; set => _inputBody.Group = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _recoveryPlanName; + + /// Recovery plan name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Recovery plan name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Recovery plan name.", + SerializedName = @"recoveryPlanName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string RecoveryPlanName { get => this._recoveryPlanName; set => this._recoveryPlanName = value; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of UpdateAzSiteRecoveryReplicationRecoveryPlan_UpdateExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.UpdateAzSiteRecoveryReplicationRecoveryPlan_UpdateExpanded Clone() + { + var clone = new UpdateAzSiteRecoveryReplicationRecoveryPlan_UpdateExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._inputBody = this._inputBody; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + clone.RecoveryPlanName = this.RecoveryPlanName; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationRecoveryPlansUpdate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationRecoveryPlansUpdate(ResourceName, ResourceGroupName, SubscriptionId, RecoveryPlanName, _inputBody, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,RecoveryPlanName=RecoveryPlanName,body=_inputBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public UpdateAzSiteRecoveryReplicationRecoveryPlan_UpdateExpanded() + { + + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/UpdateAzSiteRecoveryReplicationRecoveryPlan_UpdateViaIdentityExpanded.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/UpdateAzSiteRecoveryReplicationRecoveryPlan_UpdateViaIdentityExpanded.cs new file mode 100644 index 000000000000..021bf60b8260 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/UpdateAzSiteRecoveryReplicationRecoveryPlan_UpdateViaIdentityExpanded.cs @@ -0,0 +1,417 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to update a recovery plan. + /// + /// [OpenAPI] Update=>PATCH:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzSiteRecoveryReplicationRecoveryPlan_UpdateViaIdentityExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to update a recovery plan.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class UpdateAzSiteRecoveryReplicationRecoveryPlan_UpdateViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Update recovery plan input class. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateRecoveryPlanInput _inputBody = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateRecoveryPlanInput(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// The recovery plan groups. + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The recovery plan groups.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recovery plan groups.", + SerializedName = @"groups", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroup) })] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlanGroup[] Group { get => _inputBody.Group ?? null /* arrayOf */; set => _inputBody.Group = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of UpdateAzSiteRecoveryReplicationRecoveryPlan_UpdateViaIdentityExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.UpdateAzSiteRecoveryReplicationRecoveryPlan_UpdateViaIdentityExpanded Clone() + { + var clone = new UpdateAzSiteRecoveryReplicationRecoveryPlan_UpdateViaIdentityExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._inputBody = this._inputBody; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationRecoveryPlansUpdate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationRecoveryPlansUpdateViaIdentity(InputObject.Id, _inputBody, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.RecoveryPlanName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.RecoveryPlanName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationRecoveryPlansUpdate(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.RecoveryPlanName ?? null, _inputBody, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=_inputBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the + /// cmdlet class. + /// + public UpdateAzSiteRecoveryReplicationRecoveryPlan_UpdateViaIdentityExpanded() + { + + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryPlan + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/UpdateAzSiteRecoveryReplicationRecoveryServiceProvider_Refresh.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/UpdateAzSiteRecoveryReplicationRecoveryServiceProvider_Refresh.cs new file mode 100644 index 000000000000..ae1988923dd2 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/UpdateAzSiteRecoveryReplicationRecoveryServiceProvider_Refresh.cs @@ -0,0 +1,448 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to refresh the information from the recovery services provider. + /// + /// [OpenAPI] RefreshProvider=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders/{providerName}/refreshProvider" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzSiteRecoveryReplicationRecoveryServiceProvider_Refresh", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProvider))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to refresh the information from the recovery services provider.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class UpdateAzSiteRecoveryReplicationRecoveryServiceProvider_Refresh : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// Fabric name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Fabric name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Fabric name.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _providerName; + + /// Recovery services provider name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Recovery services provider name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Recovery services provider name.", + SerializedName = @"providerName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ProviderName { get => this._providerName; set => this._providerName = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProvider + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of UpdateAzSiteRecoveryReplicationRecoveryServiceProvider_Refresh + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.UpdateAzSiteRecoveryReplicationRecoveryServiceProvider_Refresh Clone() + { + var clone = new UpdateAzSiteRecoveryReplicationRecoveryServiceProvider_Refresh(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + clone.FabricName = this.FabricName; + clone.ProviderName = this.ProviderName; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationRecoveryServicesProvidersRefreshProvider' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationRecoveryServicesProvidersRefreshProvider(ResourceName, ResourceGroupName, SubscriptionId, FabricName, ProviderName, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName,ProviderName=ProviderName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the cmdlet + /// class. + /// + public UpdateAzSiteRecoveryReplicationRecoveryServiceProvider_Refresh() + { + + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProvider + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProvider + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/UpdateAzSiteRecoveryReplicationRecoveryServiceProvider_RefreshViaIdentity.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/UpdateAzSiteRecoveryReplicationRecoveryServiceProvider_RefreshViaIdentity.cs new file mode 100644 index 000000000000..f131e1f98200 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/UpdateAzSiteRecoveryReplicationRecoveryServiceProvider_RefreshViaIdentity.cs @@ -0,0 +1,405 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to refresh the information from the recovery services provider. + /// + /// [OpenAPI] RefreshProvider=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders/{providerName}/refreshProvider" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzSiteRecoveryReplicationRecoveryServiceProvider_RefreshViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProvider))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to refresh the information from the recovery services provider.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class UpdateAzSiteRecoveryReplicationRecoveryServiceProvider_RefreshViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProvider + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of UpdateAzSiteRecoveryReplicationRecoveryServiceProvider_RefreshViaIdentity + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.UpdateAzSiteRecoveryReplicationRecoveryServiceProvider_RefreshViaIdentity Clone() + { + var clone = new UpdateAzSiteRecoveryReplicationRecoveryServiceProvider_RefreshViaIdentity(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationRecoveryServicesProvidersRefreshProvider' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationRecoveryServicesProvidersRefreshProviderViaIdentity(InputObject.Id, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.FabricName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.FabricName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ProviderName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ProviderName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationRecoveryServicesProvidersRefreshProvider(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.FabricName ?? null, InputObject.ProviderName ?? null, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public UpdateAzSiteRecoveryReplicationRecoveryServiceProvider_RefreshViaIdentity() + { + + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProvider + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IRecoveryServicesProvider + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/UpdateAzSiteRecoveryReplicationVaultHealth_Refresh.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/UpdateAzSiteRecoveryReplicationVaultHealth_Refresh.cs new file mode 100644 index 000000000000..803d7ac1527c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/UpdateAzSiteRecoveryReplicationVaultHealth_Refresh.cs @@ -0,0 +1,415 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Refreshes health summary of the vault. + /// + /// [OpenAPI] Refresh=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationVaultHealth/default/refresh" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzSiteRecoveryReplicationVaultHealth_Refresh", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthDetails))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Refreshes health summary of the vault.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class UpdateAzSiteRecoveryReplicationVaultHealth_Refresh : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthDetails + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of UpdateAzSiteRecoveryReplicationVaultHealth_Refresh + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.UpdateAzSiteRecoveryReplicationVaultHealth_Refresh Clone() + { + var clone = new UpdateAzSiteRecoveryReplicationVaultHealth_Refresh(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationVaultHealthRefresh' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationVaultHealthRefresh(ResourceName, ResourceGroupName, SubscriptionId, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public UpdateAzSiteRecoveryReplicationVaultHealth_Refresh() + { + + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthDetails + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthDetails + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/UpdateAzSiteRecoveryReplicationVaultHealth_RefreshViaIdentity.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/UpdateAzSiteRecoveryReplicationVaultHealth_RefreshViaIdentity.cs new file mode 100644 index 000000000000..03fb51b22201 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/UpdateAzSiteRecoveryReplicationVaultHealth_RefreshViaIdentity.cs @@ -0,0 +1,396 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// Refreshes health summary of the vault. + /// + /// [OpenAPI] Refresh=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationVaultHealth/default/refresh" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzSiteRecoveryReplicationVaultHealth_RefreshViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthDetails))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"Refreshes health summary of the vault.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class UpdateAzSiteRecoveryReplicationVaultHealth_RefreshViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthDetails + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of UpdateAzSiteRecoveryReplicationVaultHealth_RefreshViaIdentity + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.UpdateAzSiteRecoveryReplicationVaultHealth_RefreshViaIdentity Clone() + { + var clone = new UpdateAzSiteRecoveryReplicationVaultHealth_RefreshViaIdentity(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationVaultHealthRefresh' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationVaultHealthRefreshViaIdentity(InputObject.Id, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationVaultHealthRefresh(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public UpdateAzSiteRecoveryReplicationVaultHealth_RefreshViaIdentity() + { + + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthDetails + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVaultHealthDetails + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/UpdateAzSiteRecoveryReplicationvCenter_UpdateExpanded.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/UpdateAzSiteRecoveryReplicationvCenter_UpdateExpanded.cs new file mode 100644 index 000000000000..ab69f61f1924 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/UpdateAzSiteRecoveryReplicationvCenter_UpdateExpanded.cs @@ -0,0 +1,504 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to update a registered vCenter. + /// + /// [OpenAPI] Update=>PATCH:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationvCenters/{vcenterName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzSiteRecoveryReplicationvCenter_UpdateExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenter))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to update a registered vCenter.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class UpdateAzSiteRecoveryReplicationvCenter_UpdateExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Input required to update vCenter. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateVCenterRequest _updateVCenterRequestBody = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateVCenterRequest(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricName; + + /// Fabric name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Fabric name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Fabric name.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string FabricName { get => this._fabricName; set => this._fabricName = value; } + + /// The friendly name of the vCenter. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The friendly name of the vCenter.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The friendly name of the vCenter.", + SerializedName = @"friendlyName", + PossibleTypes = new [] { typeof(string) })] + public string FriendlyName { get => _updateVCenterRequestBody.FriendlyName ?? null; set => _updateVCenterRequestBody.FriendlyName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// The IP address of the vCenter to be discovered. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The IP address of the vCenter to be discovered.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The IP address of the vCenter to be discovered.", + SerializedName = @"ipAddress", + PossibleTypes = new [] { typeof(string) })] + public string IPAddress { get => _updateVCenterRequestBody.IPAddress ?? null; set => _updateVCenterRequestBody.IPAddress = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The port number for discovery. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The port number for discovery.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The port number for discovery.", + SerializedName = @"port", + PossibleTypes = new [] { typeof(string) })] + public string Port { get => _updateVCenterRequestBody.Port ?? null; set => _updateVCenterRequestBody.Port = value; } + + /// The process server Id from where the update can be orchestrated. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The process server Id from where the update can be orchestrated.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The process server Id from where the update can be orchestrated.", + SerializedName = @"processServerId", + PossibleTypes = new [] { typeof(string) })] + public string ProcessServerId { get => _updateVCenterRequestBody.ProcessServerId ?? null; set => _updateVCenterRequestBody.ProcessServerId = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group where the recovery services vault is present. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group where the recovery services vault is present.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group where the recovery services vault is present.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _resourceName; + + /// The name of the recovery services vault. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the recovery services vault.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recovery services vault.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// The CS account Id which has privileges to update the vCenter. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The CS account Id which has privileges to update the vCenter.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The CS account Id which has privileges to update the vCenter.", + SerializedName = @"runAsAccountId", + PossibleTypes = new [] { typeof(string) })] + public string RunAsAccountId { get => _updateVCenterRequestBody.RunAsAccountId ?? null; set => _updateVCenterRequestBody.RunAsAccountId = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription Id. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription Id.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription Id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Backing field for property. + private string _vcenterName; + + /// vcenter name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "vcenter name.")] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"vcenter name.", + SerializedName = @"vcenterName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public string VcenterName { get => this._vcenterName; set => this._vcenterName = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenter + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of UpdateAzSiteRecoveryReplicationvCenter_UpdateExpanded + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.UpdateAzSiteRecoveryReplicationvCenter_UpdateExpanded Clone() + { + var clone = new UpdateAzSiteRecoveryReplicationvCenter_UpdateExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._updateVCenterRequestBody = this._updateVCenterRequestBody; + clone.ResourceName = this.ResourceName; + clone.ResourceGroupName = this.ResourceGroupName; + clone.SubscriptionId = this.SubscriptionId; + clone.FabricName = this.FabricName; + clone.VcenterName = this.VcenterName; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationvCentersUpdate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationvCentersUpdate(ResourceName, ResourceGroupName, SubscriptionId, FabricName, VcenterName, _updateVCenterRequestBody, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceName=ResourceName,ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId,FabricName=FabricName,VcenterName=VcenterName,body=_updateVCenterRequestBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public UpdateAzSiteRecoveryReplicationvCenter_UpdateExpanded() + { + + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenter + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenter + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/cmdlets/UpdateAzSiteRecoveryReplicationvCenter_UpdateViaIdentityExpanded.cs b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/UpdateAzSiteRecoveryReplicationvCenter_UpdateViaIdentityExpanded.cs new file mode 100644 index 000000000000..b7b97829e783 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/cmdlets/UpdateAzSiteRecoveryReplicationvCenter_UpdateViaIdentityExpanded.cs @@ -0,0 +1,464 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + using System; + + /// The operation to update a registered vCenter. + /// + /// [OpenAPI] Update=>PATCH:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationvCenters/{vcenterName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzSiteRecoveryReplicationvCenter_UpdateViaIdentityExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenter))] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Description(@"The operation to update a registered vCenter.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Generated] + public partial class UpdateAzSiteRecoveryReplicationvCenter_UpdateViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Input required to update vCenter. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IUpdateVCenterRequest _updateVCenterRequestBody = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.UpdateVCenterRequest(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.SiteRecoveryManagementClient Client => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// The friendly name of the vCenter. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The friendly name of the vCenter.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The friendly name of the vCenter.", + SerializedName = @"friendlyName", + PossibleTypes = new [] { typeof(string) })] + public string FriendlyName { get => _updateVCenterRequestBody.FriendlyName ?? null; set => _updateVCenterRequestBody.FriendlyName = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// The IP address of the vCenter to be discovered. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The IP address of the vCenter to be discovered.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The IP address of the vCenter to be discovered.", + SerializedName = @"ipAddress", + PossibleTypes = new [] { typeof(string) })] + public string IPAddress { get => _updateVCenterRequestBody.IPAddress ?? null; set => _updateVCenterRequestBody.IPAddress = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.ISiteRecoveryIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.HttpPipeline Pipeline { get; set; } + + /// The port number for discovery. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The port number for discovery.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The port number for discovery.", + SerializedName = @"port", + PossibleTypes = new [] { typeof(string) })] + public string Port { get => _updateVCenterRequestBody.Port ?? null; set => _updateVCenterRequestBody.Port = value; } + + /// The process server Id from where the update can be orchestrated. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The process server Id from where the update can be orchestrated.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The process server Id from where the update can be orchestrated.", + SerializedName = @"processServerId", + PossibleTypes = new [] { typeof(string) })] + public string ProcessServerId { get => _updateVCenterRequestBody.ProcessServerId ?? null; set => _updateVCenterRequestBody.ProcessServerId = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// The CS account Id which has privileges to update the vCenter. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The CS account Id which has privileges to update the vCenter.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category(global::Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The CS account Id which has privileges to update the vCenter.", + SerializedName = @"runAsAccountId", + PossibleTypes = new [] { typeof(string) })] + public string RunAsAccountId { get => _updateVCenterRequestBody.RunAsAccountId ?? null; set => _updateVCenterRequestBody.RunAsAccountId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenter + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of UpdateAzSiteRecoveryReplicationvCenter_UpdateViaIdentityExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Cmdlets.UpdateAzSiteRecoveryReplicationvCenter_UpdateViaIdentityExpanded Clone() + { + var clone = new UpdateAzSiteRecoveryReplicationvCenter_UpdateViaIdentityExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._updateVCenterRequestBody = this._updateVCenterRequestBody; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationvCentersUpdate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationvCentersUpdateViaIdentity(InputObject.Id, _updateVCenterRequestBody, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.ResourceName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.FabricName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.FabricName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.VcenterName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.VcenterName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationvCentersUpdate(InputObject.ResourceName ?? null, InputObject.ResourceGroupName ?? null, InputObject.SubscriptionId ?? null, InputObject.FabricName ?? null, InputObject.VcenterName ?? null, _updateVCenterRequestBody, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=_updateVCenterRequestBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the cmdlet + /// class. + /// + public UpdateAzSiteRecoveryReplicationvCenter_UpdateViaIdentityExpanded() + { + + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenter + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IVCenter + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Accounts.format.ps1xml b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Accounts.format.ps1xml new file mode 100644 index 000000000000..ae0c12dd4efa --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Accounts.format.ps1xml @@ -0,0 +1,496 @@ + + + + + AzureErrorRecords + + Microsoft.Azure.Commands.Profile.Errors.AzureErrorRecord + Microsoft.Azure.Commands.Profile.Errors.AzureExceptionRecord + Microsoft.Azure.Commands.Profile.Errors.AzureRestExceptionRecord + + + + + + Microsoft.Azure.Commands.Profile.Errors.AzureRestExceptionRecord + + AzureErrorRecords + + + $_.InvocationInfo.HistoryId + + + + + + + + ErrorCategory + + + ErrorDetail + + + + "{" + $_.InvocationInfo.MyCommand + "}" + + + + $_.InvocationInfo.Line + + + + $_.InvocationInfo.PositionMessage + + + + $_.InvocationInfo.BoundParameters + + + + $_.InvocationInfo.UnboundParameters + + + + $_.InvocationInfo.HistoryId + + + + + + + AzureErrorRecords + $_.GetType() -eq [Microsoft.Azure.Commands.Profile.Errors.AzureRestExceptionRecord] + + + + + RequestId + + + Message + + + ServerMessage + + + ServerResponse + + + RequestMessage + + + + "{" + $_.InvocationInfo.MyCommand + "}" + + + + $_.InvocationInfo.Line + + + + $_.InvocationInfo.PositionMessage + + + StackTrace + + + + $_.InvocationInfo.HistoryId + + + + + + + AzureErrorRecords + $_.GetType() -eq [Microsoft.Azure.Commands.Profile.Errors.AzureExceptionRecord] + + + + + Message + + + StackTrace + + + + $_.Exception.GetType() + + + + "{" + $_.InvocationInfo.MyCommand + "}" + + + + $_.InvocationInfo.Line + + + + $_.InvocationInfo.PositionMessage + + + + $_.InvocationInfo.HistoryId + + + + + + + + Microsoft.Azure.Commands.Profile.CommonModule.PSAzureServiceProfile + + Microsoft.Azure.Commands.Profile.CommonModule.PSAzureServiceProfile + + + + + Left + + + + Left + + + + + + + + Left + Name + + + Left + Description + + + + + + + + Microsoft.Azure.Commands.Profile.Models.PSAccessToken + + Microsoft.Azure.Commands.Profile.Models.PSAccessToken + + + + + + + Token + + + ExpiresOn + + + Type + + + TenantId + + + UserId + + + + + + + + Microsoft.Azure.Commands.Profile.Models.PSAzureSubscriptionPolicy + + Microsoft.Azure.Commands.Profile.Models.PSAzureSubscriptionPolicy + + + + + Left + + + + Left + + + + Left + + + + + + + + Left + locationPlacementId + + + Left + QuotaId + + + Left + SpendingLimit + + + + + + + + Microsoft.Azure.Commands.Profile.Models.PSAzureRmAccount + + Microsoft.Azure.Commands.Profile.Models.PSAzureRmAccount + + + + + + + Id + + + Type + + + Tenants + + + Credential + + + TenantMap + + + CertificateThumbprint + + + + $_.ExtendedProperties.GetEnumerator() + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Accounts.generated.format.ps1xml b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Accounts.generated.format.ps1xml new file mode 100644 index 000000000000..a81dae94b4db --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Accounts.generated.format.ps1xml @@ -0,0 +1,468 @@ + + + + + Microsoft.Azure.Commands.Profile.Models.PSAzureEnvironment + + Microsoft.Azure.Commands.Profile.Models.PSAzureEnvironment + + + + + Left + + + + Left + + + + Left + + + + Left + + + + + + + + Left + Name + + + Left + ResourceManagerUrl + + + Left + ActiveDirectoryAuthority + + + Left + Type + + + + + + + + Microsoft.Azure.Commands.Profile.Models.PSAzureSubscription + + Microsoft.Azure.Commands.Profile.Models.PSAzureSubscription + + + + + Left + + + + Left + + + + Left + + + + Left + + + + + + + + Left + Name + + + Left + Id + + + Left + TenantId + + + Left + State + + + + + + + + Microsoft.Azure.Commands.Profile.Models.Core.PSAzureProfile + + Microsoft.Azure.Commands.Profile.Models.Core.PSAzureProfile + + + + + Left + + + + Left + + + + Left + + + + Left + + + + + + + + Left + $_.Context.Account.ToString() + + + Left + $_.Context.Subscription.Name + + + Left + $_.Context.Tenant.ToString() + + + Left + $_.Context.Environment.ToString() + + + + + + + + Microsoft.Azure.Commands.Profile.Models.Core.PSAzureContext + + Microsoft.Azure.Commands.Profile.Models.Core.PSAzureContext + + + + + 40 + Left + + + + Left + + + + Left + + + + Left + + + + Left + + + + + + + + Left + Name + + + Left + Account + + + Left + $_.Subscription.Name + + + Left + Environment + + + Left + $_.Tenant.ToString() + + + + + + + + Microsoft.Azure.Commands.Profile.Models.PSAzureTenant + + Microsoft.Azure.Commands.Profile.Models.PSAzureTenant + + + + + Left + + + + Left + + + + Left + + + + Left + + + + + + + + Left + Id + + + Left + $_.Name + + + Left + $_.TenantCategory + + + Left + $_.Domains + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Accounts.types.ps1xml b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Accounts.types.ps1xml new file mode 100644 index 000000000000..e3b670a7daff --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Accounts.types.ps1xml @@ -0,0 +1,303 @@ + + + + Microsoft.Azure.Commands.Profile.Models.Core.PSAzureProfile + + + PSStandardMembers + + + SerializationDepth + 10 + + + + + + + Microsoft.Azure.Commands.Profile.Models.Core.PSAzureContext + + + PSStandardMembers + + + SerializationDepth + 10 + + + + + + + Microsoft.Azure.Commands.Common.Authentication.Core.AuthenticationStoreTokenCache + + + PSStandardMembers + + + SerializationMethod + SpecificProperties + + + PropertySerializationSet + + CacheData + + + + + + + + Microsoft.Azure.Commands.Common.Authentication.Core.ProtectedFileTokenCache + + + PSStandardMembers + + + SerializationMethod + SpecificProperties + + + PropertySerializationSet + + CacheData + + + + + + + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + + PSStandardMembers + + + SerializationDepth + 10 + + + + + + Microsoft.Azure.Commands.Profile.Models.AzureContextConverter + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Az.Accounts.nuspec b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Az.Accounts.nuspec new file mode 100644 index 000000000000..7516aaac75bf --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Az.Accounts.nuspec @@ -0,0 +1,20 @@ + + + + Az.Accounts + 2.7.5 + Microsoft Corporation + Microsoft Corporation + true + https://aka.ms/azps-license + https://github.com/Azure/azure-powershell + Microsoft Azure PowerShell - Accounts credential management cmdlets for Azure Resource Manager in Windows PowerShell and PowerShell Core. + +For more information on account credential management, please visit the following: https://learn.microsoft.com/powershell/azure/authenticate-azureps + * Added 'SshCredentialFactory' to support get ssh credential of vm from msal. +* Fixed the bug of cmdlet fails when -DefaultProfile is set to service principal login context. [#16617] +* Fixed the issue that authorization does not work in Dogfood environment + Microsoft Corporation. All rights reserved. + Azure ResourceManager ARM Accounts Authentication Environment Subscription PSModule PSIncludes_Cmdlet PSCmdlet_Disable-AzDataCollection PSCmdlet_Disable-AzContextAutosave PSCmdlet_Enable-AzDataCollection PSCmdlet_Enable-AzContextAutosave PSCmdlet_Remove-AzEnvironment PSCmdlet_Get-AzEnvironment PSCmdlet_Set-AzEnvironment PSCmdlet_Add-AzEnvironment PSCmdlet_Get-AzSubscription PSCmdlet_Connect-AzAccount PSCmdlet_Get-AzContext PSCmdlet_Set-AzContext PSCmdlet_Import-AzContext PSCmdlet_Save-AzContext PSCmdlet_Get-AzTenant PSCmdlet_Send-Feedback PSCmdlet_Resolve-AzError PSCmdlet_Select-AzContext PSCmdlet_Rename-AzContext PSCmdlet_Remove-AzContext PSCmdlet_Clear-AzContext PSCmdlet_Disconnect-AzAccount PSCmdlet_Get-AzContextAutosaveSetting PSCmdlet_Set-AzDefault PSCmdlet_Get-AzDefault PSCmdlet_Clear-AzDefault PSCmdlet_Register-AzModule PSCmdlet_Enable-AzureRmAlias PSCmdlet_Disable-AzureRmAlias PSCmdlet_Uninstall-AzureRm PSCmdlet_Invoke-AzRestMethod PSCmdlet_Get-AzAccessToken PSCmdlet_Open-AzSurveyLink PSCommand_Disable-AzDataCollection PSCommand_Disable-AzContextAutosave PSCommand_Enable-AzDataCollection PSCommand_Enable-AzContextAutosave PSCommand_Remove-AzEnvironment PSCommand_Get-AzEnvironment PSCommand_Set-AzEnvironment PSCommand_Add-AzEnvironment PSCommand_Get-AzSubscription PSCommand_Connect-AzAccount PSCommand_Get-AzContext PSCommand_Set-AzContext PSCommand_Import-AzContext PSCommand_Save-AzContext PSCommand_Get-AzTenant PSCommand_Send-Feedback PSCommand_Resolve-AzError PSCommand_Select-AzContext PSCommand_Rename-AzContext PSCommand_Remove-AzContext PSCommand_Clear-AzContext PSCommand_Disconnect-AzAccount PSCommand_Get-AzContextAutosaveSetting PSCommand_Set-AzDefault PSCommand_Get-AzDefault PSCommand_Clear-AzDefault PSCommand_Register-AzModule PSCommand_Enable-AzureRmAlias PSCommand_Disable-AzureRmAlias PSCommand_Uninstall-AzureRm PSCommand_Invoke-AzRestMethod PSCommand_Get-AzAccessToken PSCommand_Open-AzSurveyLink PSCommand_Add-AzAccount PSCommand_Login-AzAccount PSCommand_Remove-AzAccount PSCommand_Logout-AzAccount PSCommand_Select-AzSubscription PSCommand_Resolve-Error PSCommand_Save-AzProfile PSCommand_Get-AzDomain PSCommand_Invoke-AzRest + + \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Az.Accounts.psd1 b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Az.Accounts.psd1 new file mode 100644 index 000000000000..42bdacfe31b9 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Az.Accounts.psd1 @@ -0,0 +1,387 @@ +# +# Module manifest for module 'Az.Accounts' +# +# Generated by: Microsoft Corporation +# +# Generated on: 3/31/2022 +# + +@{ + +# Script module or binary module file associated with this manifest. +RootModule = 'Az.Accounts.psm1' + +# Version number of this module. +ModuleVersion = '2.7.5' + +# Supported PSEditions +CompatiblePSEditions = 'Core', 'Desktop' + +# ID used to uniquely identify this module +GUID = '17a2feff-488b-47f9-8729-e2cec094624c' + +# Author of this module +Author = 'Microsoft Corporation' + +# Company or vendor of this module +CompanyName = 'Microsoft Corporation' + +# Copyright statement for this module +Copyright = 'Microsoft Corporation. All rights reserved.' + +# Description of the functionality provided by this module +Description = 'Microsoft Azure PowerShell - Accounts credential management cmdlets for Azure Resource Manager in Windows PowerShell and PowerShell Core. + +For more information on account credential management, please visit the following: https://learn.microsoft.com/powershell/azure/authenticate-azureps' + +# Minimum version of the PowerShell engine required by this module +PowerShellVersion = '5.1' + +# Name of the PowerShell host required by this module +# PowerShellHostName = '' + +# Minimum version of the PowerShell host required by this module +# PowerShellHostVersion = '' + +# Minimum version of Microsoft .NET Framework required by this module. This prerequisite is valid for the PowerShell Desktop edition only. +DotNetFrameworkVersion = '4.7.2' + +# Minimum version of the common language runtime (CLR) required by this module. This prerequisite is valid for the PowerShell Desktop edition only. +# ClrVersion = '' + +# Processor architecture (None, X86, Amd64) required by this module +# ProcessorArchitecture = '' + +# Modules that must be imported into the global environment prior to importing this module +# RequiredModules = @() + +# Assemblies that must be loaded prior to importing this module +RequiredAssemblies = 'Microsoft.Azure.PowerShell.Authentication.Abstractions.dll', + 'Microsoft.Azure.PowerShell.Authentication.dll', + 'Microsoft.Azure.PowerShell.Authenticators.dll', + 'Microsoft.Azure.PowerShell.Authentication.ResourceManager.dll', + 'Microsoft.Azure.PowerShell.Clients.Authorization.dll', + 'Microsoft.Azure.PowerShell.Clients.Compute.dll', + 'Microsoft.Azure.PowerShell.Clients.Graph.Rbac.dll', + 'Microsoft.Azure.PowerShell.Clients.Monitor.dll', + 'Microsoft.Azure.PowerShell.Clients.Network.dll', + 'Microsoft.Azure.PowerShell.Clients.PolicyInsights.dll', + 'Microsoft.Azure.PowerShell.Clients.ResourceManager.dll', + 'Microsoft.Azure.PowerShell.Common.dll', + 'Microsoft.Azure.PowerShell.Storage.dll', + 'Microsoft.Azure.PowerShell.Clients.Storage.Management.dll', + 'Microsoft.Azure.PowerShell.Clients.KeyVault.dll', + 'Microsoft.Azure.PowerShell.Clients.Websites.dll', + 'Hyak.Common.dll', 'Microsoft.ApplicationInsights.dll', + 'Microsoft.Azure.Common.dll', 'Microsoft.Rest.ClientRuntime.dll', + 'Microsoft.Rest.ClientRuntime.Azure.dll', + 'Microsoft.WindowsAzure.Storage.dll', + 'Microsoft.WindowsAzure.Storage.DataMovement.dll', + 'Microsoft.Azure.PowerShell.Clients.Aks.dll', + 'Microsoft.Azure.PowerShell.Strategies.dll', + 'Microsoft.Azure.PowerShell.Common.Share.dll' + +# Script files (.ps1) that are run in the caller's environment prior to importing this module. +# ScriptsToProcess = @() + +# Type files (.ps1xml) to be loaded when importing this module +# TypesToProcess = @() + +# Format files (.ps1xml) to be loaded when importing this module +FormatsToProcess = 'Accounts.format.ps1xml', 'Accounts.generated.format.ps1xml' + +# Modules to import as nested modules of the module specified in RootModule/ModuleToProcess +NestedModules = @() + +# Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export. +FunctionsToExport = @() + +# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export. +CmdletsToExport = 'Disable-AzDataCollection', 'Disable-AzContextAutosave', + 'Enable-AzDataCollection', 'Enable-AzContextAutosave', + 'Remove-AzEnvironment', 'Get-AzEnvironment', 'Set-AzEnvironment', + 'Add-AzEnvironment', 'Get-AzSubscription', 'Connect-AzAccount', + 'Get-AzContext', 'Set-AzContext', 'Import-AzContext', 'Save-AzContext', + 'Get-AzTenant', 'Send-Feedback', 'Resolve-AzError', 'Select-AzContext', + 'Rename-AzContext', 'Remove-AzContext', 'Clear-AzContext', + 'Disconnect-AzAccount', 'Get-AzContextAutosaveSetting', + 'Set-AzDefault', 'Get-AzDefault', 'Clear-AzDefault', + 'Register-AzModule', 'Enable-AzureRmAlias', 'Disable-AzureRmAlias', + 'Uninstall-AzureRm', 'Invoke-AzRestMethod', 'Get-AzAccessToken', + 'Open-AzSurveyLink' + +# Variables to export from this module +# VariablesToExport = @() + +# Aliases to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no aliases to export. +AliasesToExport = 'Add-AzAccount', 'Login-AzAccount', 'Remove-AzAccount', + 'Logout-AzAccount', 'Select-AzSubscription', 'Resolve-Error', + 'Save-AzProfile', 'Get-AzDomain', 'Invoke-AzRest' + +# DSC resources to export from this module +# DscResourcesToExport = @() + +# List of all modules packaged with this module +# ModuleList = @() + +# List of all files packaged with this module +# FileList = @() + +# Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell. +PrivateData = @{ + + PSData = @{ + + # Tags applied to this module. These help with module discovery in online galleries. + Tags = 'Azure','ResourceManager','ARM','Accounts','Authentication','Environment','Subscription' + + # A URL to the license for this module. + LicenseUri = 'https://aka.ms/azps-license' + + # A URL to the main website for this project. + ProjectUri = 'https://github.com/Azure/azure-powershell' + + # A URL to an icon representing this module. + # IconUri = '' + + # ReleaseNotes of this module + ReleaseNotes = '* Added ''SshCredentialFactory'' to support get ssh credential of vm from msal. +* Fixed the bug of cmdlet fails when -DefaultProfile is set to service principal login context. [#16617] +* Fixed the issue that authorization does not work in Dogfood environment' + + # Prerelease string of this module + # Prerelease = '' + + # Flag to indicate whether the module requires explicit user acceptance for install/update/save + # RequireLicenseAcceptance = $false + + # External dependent modules of this module + # ExternalModuleDependencies = @() + + } # End of PSData hashtable + + } # End of PrivateData hashtable + +# HelpInfo URI of this module +# HelpInfoURI = '' + +# Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix. +# DefaultCommandPrefix = '' + +} + + +# SIG # Begin signature block +# MIInoQYJKoZIhvcNAQcCoIInkjCCJ44CAQExDzANBglghkgBZQMEAgEFADB5Bgor +# BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG +# KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCBfih7Yjug0H4t7 +# yWl+P37e8ytBZAxLWrUP62/jyADYPKCCDYEwggX/MIID56ADAgECAhMzAAACUosz +# qviV8znbAAAAAAJSMA0GCSqGSIb3DQEBCwUAMH4xCzAJBgNVBAYTAlVTMRMwEQYD +# VQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdSZWRtb25kMR4wHAYDVQQKExVNaWNy +# b3NvZnQgQ29ycG9yYXRpb24xKDAmBgNVBAMTH01pY3Jvc29mdCBDb2RlIFNpZ25p +# bmcgUENBIDIwMTEwHhcNMjEwOTAyMTgzMjU5WhcNMjIwOTAxMTgzMjU5WjB0MQsw +# CQYDVQQGEwJVUzETMBEGA1UECBMKV2FzaGluZ3RvbjEQMA4GA1UEBxMHUmVkbW9u +# ZDEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMR4wHAYDVQQDExVNaWNy +# b3NvZnQgQ29ycG9yYXRpb24wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIB +# AQDQ5M+Ps/X7BNuv5B/0I6uoDwj0NJOo1KrVQqO7ggRXccklyTrWL4xMShjIou2I +# sbYnF67wXzVAq5Om4oe+LfzSDOzjcb6ms00gBo0OQaqwQ1BijyJ7NvDf80I1fW9O +# L76Kt0Wpc2zrGhzcHdb7upPrvxvSNNUvxK3sgw7YTt31410vpEp8yfBEl/hd8ZzA +# v47DCgJ5j1zm295s1RVZHNp6MoiQFVOECm4AwK2l28i+YER1JO4IplTH44uvzX9o +# RnJHaMvWzZEpozPy4jNO2DDqbcNs4zh7AWMhE1PWFVA+CHI/En5nASvCvLmuR/t8 +# q4bc8XR8QIZJQSp+2U6m2ldNAgMBAAGjggF+MIIBejAfBgNVHSUEGDAWBgorBgEE +# AYI3TAgBBggrBgEFBQcDAzAdBgNVHQ4EFgQUNZJaEUGL2Guwt7ZOAu4efEYXedEw +# UAYDVR0RBEkwR6RFMEMxKTAnBgNVBAsTIE1pY3Jvc29mdCBPcGVyYXRpb25zIFB1 +# ZXJ0byBSaWNvMRYwFAYDVQQFEw0yMzAwMTIrNDY3NTk3MB8GA1UdIwQYMBaAFEhu +# ZOVQBdOCqhc3NyK1bajKdQKVMFQGA1UdHwRNMEswSaBHoEWGQ2h0dHA6Ly93d3cu +# bWljcm9zb2Z0LmNvbS9wa2lvcHMvY3JsL01pY0NvZFNpZ1BDQTIwMTFfMjAxMS0w +# Ny0wOC5jcmwwYQYIKwYBBQUHAQEEVTBTMFEGCCsGAQUFBzAChkVodHRwOi8vd3d3 +# Lm1pY3Jvc29mdC5jb20vcGtpb3BzL2NlcnRzL01pY0NvZFNpZ1BDQTIwMTFfMjAx +# MS0wNy0wOC5jcnQwDAYDVR0TAQH/BAIwADANBgkqhkiG9w0BAQsFAAOCAgEAFkk3 +# uSxkTEBh1NtAl7BivIEsAWdgX1qZ+EdZMYbQKasY6IhSLXRMxF1B3OKdR9K/kccp +# kvNcGl8D7YyYS4mhCUMBR+VLrg3f8PUj38A9V5aiY2/Jok7WZFOAmjPRNNGnyeg7 +# l0lTiThFqE+2aOs6+heegqAdelGgNJKRHLWRuhGKuLIw5lkgx9Ky+QvZrn/Ddi8u +# TIgWKp+MGG8xY6PBvvjgt9jQShlnPrZ3UY8Bvwy6rynhXBaV0V0TTL0gEx7eh/K1 +# o8Miaru6s/7FyqOLeUS4vTHh9TgBL5DtxCYurXbSBVtL1Fj44+Od/6cmC9mmvrti +# yG709Y3Rd3YdJj2f3GJq7Y7KdWq0QYhatKhBeg4fxjhg0yut2g6aM1mxjNPrE48z +# 6HWCNGu9gMK5ZudldRw4a45Z06Aoktof0CqOyTErvq0YjoE4Xpa0+87T/PVUXNqf +# 7Y+qSU7+9LtLQuMYR4w3cSPjuNusvLf9gBnch5RqM7kaDtYWDgLyB42EfsxeMqwK +# WwA+TVi0HrWRqfSx2olbE56hJcEkMjOSKz3sRuupFCX3UroyYf52L+2iVTrda8XW +# esPG62Mnn3T8AuLfzeJFuAbfOSERx7IFZO92UPoXE1uEjL5skl1yTZB3MubgOA4F +# 8KoRNhviFAEST+nG8c8uIsbZeb08SeYQMqjVEmkwggd6MIIFYqADAgECAgphDpDS +# AAAAAAADMA0GCSqGSIb3DQEBCwUAMIGIMQswCQYDVQQGEwJVUzETMBEGA1UECBMK +# V2FzaGluZ3RvbjEQMA4GA1UEBxMHUmVkbW9uZDEeMBwGA1UEChMVTWljcm9zb2Z0 +# IENvcnBvcmF0aW9uMTIwMAYDVQQDEylNaWNyb3NvZnQgUm9vdCBDZXJ0aWZpY2F0 +# ZSBBdXRob3JpdHkgMjAxMTAeFw0xMTA3MDgyMDU5MDlaFw0yNjA3MDgyMTA5MDla +# MH4xCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdS +# ZWRtb25kMR4wHAYDVQQKExVNaWNyb3NvZnQgQ29ycG9yYXRpb24xKDAmBgNVBAMT +# H01pY3Jvc29mdCBDb2RlIFNpZ25pbmcgUENBIDIwMTEwggIiMA0GCSqGSIb3DQEB +# AQUAA4ICDwAwggIKAoICAQCr8PpyEBwurdhuqoIQTTS68rZYIZ9CGypr6VpQqrgG +# OBoESbp/wwwe3TdrxhLYC/A4wpkGsMg51QEUMULTiQ15ZId+lGAkbK+eSZzpaF7S +# 35tTsgosw6/ZqSuuegmv15ZZymAaBelmdugyUiYSL+erCFDPs0S3XdjELgN1q2jz +# y23zOlyhFvRGuuA4ZKxuZDV4pqBjDy3TQJP4494HDdVceaVJKecNvqATd76UPe/7 +# 4ytaEB9NViiienLgEjq3SV7Y7e1DkYPZe7J7hhvZPrGMXeiJT4Qa8qEvWeSQOy2u +# M1jFtz7+MtOzAz2xsq+SOH7SnYAs9U5WkSE1JcM5bmR/U7qcD60ZI4TL9LoDho33 +# X/DQUr+MlIe8wCF0JV8YKLbMJyg4JZg5SjbPfLGSrhwjp6lm7GEfauEoSZ1fiOIl +# XdMhSz5SxLVXPyQD8NF6Wy/VI+NwXQ9RRnez+ADhvKwCgl/bwBWzvRvUVUvnOaEP +# 6SNJvBi4RHxF5MHDcnrgcuck379GmcXvwhxX24ON7E1JMKerjt/sW5+v/N2wZuLB +# l4F77dbtS+dJKacTKKanfWeA5opieF+yL4TXV5xcv3coKPHtbcMojyyPQDdPweGF +# RInECUzF1KVDL3SV9274eCBYLBNdYJWaPk8zhNqwiBfenk70lrC8RqBsmNLg1oiM +# CwIDAQABo4IB7TCCAekwEAYJKwYBBAGCNxUBBAMCAQAwHQYDVR0OBBYEFEhuZOVQ +# BdOCqhc3NyK1bajKdQKVMBkGCSsGAQQBgjcUAgQMHgoAUwB1AGIAQwBBMAsGA1Ud +# DwQEAwIBhjAPBgNVHRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFHItOgIxkEO5FAVO +# 4eqnxzHRI4k0MFoGA1UdHwRTMFEwT6BNoEuGSWh0dHA6Ly9jcmwubWljcm9zb2Z0 +# LmNvbS9wa2kvY3JsL3Byb2R1Y3RzL01pY1Jvb0NlckF1dDIwMTFfMjAxMV8wM18y +# Mi5jcmwwXgYIKwYBBQUHAQEEUjBQME4GCCsGAQUFBzAChkJodHRwOi8vd3d3Lm1p +# Y3Jvc29mdC5jb20vcGtpL2NlcnRzL01pY1Jvb0NlckF1dDIwMTFfMjAxMV8wM18y +# Mi5jcnQwgZ8GA1UdIASBlzCBlDCBkQYJKwYBBAGCNy4DMIGDMD8GCCsGAQUFBwIB +# FjNodHRwOi8vd3d3Lm1pY3Jvc29mdC5jb20vcGtpb3BzL2RvY3MvcHJpbWFyeWNw +# cy5odG0wQAYIKwYBBQUHAgIwNB4yIB0ATABlAGcAYQBsAF8AcABvAGwAaQBjAHkA +# XwBzAHQAYQB0AGUAbQBlAG4AdAAuIB0wDQYJKoZIhvcNAQELBQADggIBAGfyhqWY +# 4FR5Gi7T2HRnIpsLlhHhY5KZQpZ90nkMkMFlXy4sPvjDctFtg/6+P+gKyju/R6mj +# 82nbY78iNaWXXWWEkH2LRlBV2AySfNIaSxzzPEKLUtCw/WvjPgcuKZvmPRul1LUd +# d5Q54ulkyUQ9eHoj8xN9ppB0g430yyYCRirCihC7pKkFDJvtaPpoLpWgKj8qa1hJ +# Yx8JaW5amJbkg/TAj/NGK978O9C9Ne9uJa7lryft0N3zDq+ZKJeYTQ49C/IIidYf +# wzIY4vDFLc5bnrRJOQrGCsLGra7lstnbFYhRRVg4MnEnGn+x9Cf43iw6IGmYslmJ +# aG5vp7d0w0AFBqYBKig+gj8TTWYLwLNN9eGPfxxvFX1Fp3blQCplo8NdUmKGwx1j +# NpeG39rz+PIWoZon4c2ll9DuXWNB41sHnIc+BncG0QaxdR8UvmFhtfDcxhsEvt9B +# xw4o7t5lL+yX9qFcltgA1qFGvVnzl6UJS0gQmYAf0AApxbGbpT9Fdx41xtKiop96 +# eiL6SJUfq/tHI4D1nvi/a7dLl+LrdXga7Oo3mXkYS//WsyNodeav+vyL6wuA6mk7 +# r/ww7QRMjt/fdW1jkT3RnVZOT7+AVyKheBEyIXrvQQqxP/uozKRdwaGIm1dxVk5I +# RcBCyZt2WwqASGv9eZ/BvW1taslScxMNelDNMYIZdjCCGXICAQEwgZUwfjELMAkG +# A1UEBhMCVVMxEzARBgNVBAgTCldhc2hpbmd0b24xEDAOBgNVBAcTB1JlZG1vbmQx +# HjAcBgNVBAoTFU1pY3Jvc29mdCBDb3Jwb3JhdGlvbjEoMCYGA1UEAxMfTWljcm9z +# b2Z0IENvZGUgU2lnbmluZyBQQ0EgMjAxMQITMwAAAlKLM6r4lfM52wAAAAACUjAN +# BglghkgBZQMEAgEFAKCBrjAZBgkqhkiG9w0BCQMxDAYKKwYBBAGCNwIBBDAcBgor +# BgEEAYI3AgELMQ4wDAYKKwYBBAGCNwIBFTAvBgkqhkiG9w0BCQQxIgQgXA6GKgxI +# VhLOuEe05JK0ofRRaS3Iixk8S4yAEDyheGcwQgYKKwYBBAGCNwIBDDE0MDKgFIAS +# AE0AaQBjAHIAbwBzAG8AZgB0oRqAGGh0dHA6Ly93d3cubWljcm9zb2Z0LmNvbTAN +# BgkqhkiG9w0BAQEFAASCAQCk7+MONSYp7vxlpfSvtfVGPGdZ5LuxWlb4eimh/TgO +# qAAMDghpYUB8mFe46dAf/OoVHrcxhCfAof+aWlMkEqZTwIZ6p0XsXZ72jDLDFLgf +# WJNQ605jndPQx7/b3tDvqqI1sCHz4CvYnqiQn4/JpHjiE4321HRDFjhWv1lhTpMx +# Xaifyrvwc1OwLcSqMrEPSShevbYOH54J0MG+qI+t+AQ9D/WQdL/5HBJZ8PDZ2n9b +# I4FxGwm0aeTSnAiV602r8db+jebwv/5ypKfkok4IzN9qdQY1y3jXdP9MfEK2nCod +# Mbuby8eakQsarqZJovnvBOsZANYE8UafuSbYMQtJaEtnoYIXADCCFvwGCisGAQQB +# gjcDAwExghbsMIIW6AYJKoZIhvcNAQcCoIIW2TCCFtUCAQMxDzANBglghkgBZQME +# AgEFADCCAVEGCyqGSIb3DQEJEAEEoIIBQASCATwwggE4AgEBBgorBgEEAYRZCgMB +# MDEwDQYJYIZIAWUDBAIBBQAEIPieBDiQ8jeOJOjc2VK1Wl36ph7izu7GPD9rSN/j +# BxeOAgZiFm2JbrQYEzIwMjIwMzMxMTAyMDU2LjYzNlowBIACAfSggdCkgc0wgcox +# CzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdSZWRt +# b25kMR4wHAYDVQQKExVNaWNyb3NvZnQgQ29ycG9yYXRpb24xJTAjBgNVBAsTHE1p +# Y3Jvc29mdCBBbWVyaWNhIE9wZXJhdGlvbnMxJjAkBgNVBAsTHVRoYWxlcyBUU1Mg +# RVNOOjEyQkMtRTNBRS03NEVCMSUwIwYDVQQDExxNaWNyb3NvZnQgVGltZS1TdGFt +# cCBTZXJ2aWNloIIRVzCCBwwwggT0oAMCAQICEzMAAAGhAYVVmblUXYoAAQAAAaEw +# DQYJKoZIhvcNAQELBQAwfDELMAkGA1UEBhMCVVMxEzARBgNVBAgTCldhc2hpbmd0 +# b24xEDAOBgNVBAcTB1JlZG1vbmQxHjAcBgNVBAoTFU1pY3Jvc29mdCBDb3Jwb3Jh +# dGlvbjEmMCQGA1UEAxMdTWljcm9zb2Z0IFRpbWUtU3RhbXAgUENBIDIwMTAwHhcN +# MjExMjAyMTkwNTI0WhcNMjMwMjI4MTkwNTI0WjCByjELMAkGA1UEBhMCVVMxEzAR +# BgNVBAgTCldhc2hpbmd0b24xEDAOBgNVBAcTB1JlZG1vbmQxHjAcBgNVBAoTFU1p +# Y3Jvc29mdCBDb3Jwb3JhdGlvbjElMCMGA1UECxMcTWljcm9zb2Z0IEFtZXJpY2Eg +# T3BlcmF0aW9uczEmMCQGA1UECxMdVGhhbGVzIFRTUyBFU046MTJCQy1FM0FFLTc0 +# RUIxJTAjBgNVBAMTHE1pY3Jvc29mdCBUaW1lLVN0YW1wIFNlcnZpY2UwggIiMA0G +# CSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDayTxe5WukkrYxxVuHLYW9BEWCD9kk +# jnnHsOKwGddIPbZlLY+l5ovLDNf+BEMQKAZQI3DX91l1yCDuP9X7tOPC48ZRGXA/ +# bf9ql0FK5438gIl7cV528XeEOFwc/A+UbIUfW296Omg8Z62xaQv3jrG4U/priArF +# /er1UA1HNuIGUyqjlygiSPwK2NnFApi1JD+Uef5c47kh7pW1Kj7RnchpFeY9MekP +# QRia7cEaUYU4sqCiJVdDJpefLvPT9EdthlQx75ldx+AwZf2a9T7uQRSBh8tpxPdI +# DDkKiWMwjKTrAY09A3I/jidqPuc8PvX+sqxqyZEN2h4GA0Edjmk64nkIukAK18K5 +# nALDLO9SMTxpAwQIHRDtZeTClvAPCEoy1vtPD7f+eqHqStuu+XCkfRjXEpX9+h9f +# rsB0/BgD5CBf3ELLAa8TefMfHZWEJRTPNrbXMKizSrUSkVv/3HP/ZsJpwaz5My2R +# byc3Ah9bT76eBJkyfT5FN9v/KQ0HnxhRMs6HHhTmNx+LztYci+vHf0D3QH1eCjZW +# ZRjp1mOyxpPU2mDMG6gelvJse1JzRADo7YIok/J3Ccbm8MbBbm85iogFltFHecHF +# EFwrsDGBFnNYHMhcbarQNA+gY2e2l9fAkX3MjI7Uklkoz74/P6KIqe5jcd9FPCbb +# SbYH9OLsteeYOQIDAQABo4IBNjCCATIwHQYDVR0OBBYEFBa/IDLbY475VQyKiZSw +# 47l0/cypMB8GA1UdIwQYMBaAFJ+nFV0AXmJdg/Tl0mWnG1M1GelyMF8GA1UdHwRY +# MFYwVKBSoFCGTmh0dHA6Ly93d3cubWljcm9zb2Z0LmNvbS9wa2lvcHMvY3JsL01p +# Y3Jvc29mdCUyMFRpbWUtU3RhbXAlMjBQQ0ElMjAyMDEwKDEpLmNybDBsBggrBgEF +# BQcBAQRgMF4wXAYIKwYBBQUHMAKGUGh0dHA6Ly93d3cubWljcm9zb2Z0LmNvbS9w +# a2lvcHMvY2VydHMvTWljcm9zb2Z0JTIwVGltZS1TdGFtcCUyMFBDQSUyMDIwMTAo +# MSkuY3J0MAwGA1UdEwEB/wQCMAAwEwYDVR0lBAwwCgYIKwYBBQUHAwgwDQYJKoZI +# hvcNAQELBQADggIBACDDIxElfXlG5YKcKrLPSS+f3JWZprwKEiASvivaHTBRlXtA +# s+TkadcsEei+9w5vmF5tCUzTH4c0nCI7bZxnsL+S6XsiOs3Z1V4WX+IwoXUJ4zLv +# s0+mT4vjGDtYfKQ/bsmJKar2c99m/fHv1Wm2CTcyaePvi86Jh3UyLjdRILWbtzs4 +# oImFMwwKbzHdPopxrBhgi+C1YZshosWLlgzyuxjUl+qNg1m52MJmf11loI7D9HJo +# aQzd+rf928Y8rvULmg2h/G50o+D0UJ1Fa/cJJaHfB3sfKw9X6GrtXYGjmM3+g+Ah +# aVsfupKXNtOFu5tnLKvAH5OIjEDYV1YKmlXuBuhbYassygPFMmNgG2Ank3drEcDc +# ZhCXXqpRszNo1F6Gu5JCpQZXbOJM9Ue5PlJKtmImAYIGsw+pnHy/r5ggSYOp4g5Z +# 1oU9GhVCM3V0T9adee6OUXBk1rE4dZc/UsPlj0qoiljL+lN1A5gkmmz7k5tIObVG +# B7dJdz8J0FwXRE5qYu1AdvauVbZwGQkL1x8aK/svjEQW0NUyJ29znDHiXl5vLoRT +# jjFpshUBi2+IY+mNqbLmj24j5eT+bjDlE3HmNtLPpLcMDYqZ1H+6U6YmaiNmac2j +# RXDAaeEE/uoDMt2dArfJP7M+MDv3zzNNTINeuNEtDVgm9zwfgIUCXnDZuVtiMIIH +# cTCCBVmgAwIBAgITMwAAABXF52ueAptJmQAAAAAAFTANBgkqhkiG9w0BAQsFADCB +# iDELMAkGA1UEBhMCVVMxEzARBgNVBAgTCldhc2hpbmd0b24xEDAOBgNVBAcTB1Jl +# ZG1vbmQxHjAcBgNVBAoTFU1pY3Jvc29mdCBDb3Jwb3JhdGlvbjEyMDAGA1UEAxMp +# TWljcm9zb2Z0IFJvb3QgQ2VydGlmaWNhdGUgQXV0aG9yaXR5IDIwMTAwHhcNMjEw +# OTMwMTgyMjI1WhcNMzAwOTMwMTgzMjI1WjB8MQswCQYDVQQGEwJVUzETMBEGA1UE +# CBMKV2FzaGluZ3RvbjEQMA4GA1UEBxMHUmVkbW9uZDEeMBwGA1UEChMVTWljcm9z +# b2Z0IENvcnBvcmF0aW9uMSYwJAYDVQQDEx1NaWNyb3NvZnQgVGltZS1TdGFtcCBQ +# Q0EgMjAxMDCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAOThpkzntHIh +# C3miy9ckeb0O1YLT/e6cBwfSqWxOdcjKNVf2AX9sSuDivbk+F2Az/1xPx2b3lVNx +# WuJ+Slr+uDZnhUYjDLWNE893MsAQGOhgfWpSg0S3po5GawcU88V29YZQ3MFEyHFc +# UTE3oAo4bo3t1w/YJlN8OWECesSq/XJprx2rrPY2vjUmZNqYO7oaezOtgFt+jBAc +# nVL+tuhiJdxqD89d9P6OU8/W7IVWTe/dvI2k45GPsjksUZzpcGkNyjYtcI4xyDUo +# veO0hyTD4MmPfrVUj9z6BVWYbWg7mka97aSueik3rMvrg0XnRm7KMtXAhjBcTyzi +# YrLNueKNiOSWrAFKu75xqRdbZ2De+JKRHh09/SDPc31BmkZ1zcRfNN0Sidb9pSB9 +# fvzZnkXftnIv231fgLrbqn427DZM9ituqBJR6L8FA6PRc6ZNN3SUHDSCD/AQ8rdH +# GO2n6Jl8P0zbr17C89XYcz1DTsEzOUyOArxCaC4Q6oRRRuLRvWoYWmEBc8pnol7X +# KHYC4jMYctenIPDC+hIK12NvDMk2ZItboKaDIV1fMHSRlJTYuVD5C4lh8zYGNRiE +# R9vcG9H9stQcxWv2XFJRXRLbJbqvUAV6bMURHXLvjflSxIUXk8A8FdsaN8cIFRg/ +# eKtFtvUeh17aj54WcmnGrnu3tz5q4i6tAgMBAAGjggHdMIIB2TASBgkrBgEEAYI3 +# FQEEBQIDAQABMCMGCSsGAQQBgjcVAgQWBBQqp1L+ZMSavoKRPEY1Kc8Q/y8E7jAd +# BgNVHQ4EFgQUn6cVXQBeYl2D9OXSZacbUzUZ6XIwXAYDVR0gBFUwUzBRBgwrBgEE +# AYI3TIN9AQEwQTA/BggrBgEFBQcCARYzaHR0cDovL3d3dy5taWNyb3NvZnQuY29t +# L3BraW9wcy9Eb2NzL1JlcG9zaXRvcnkuaHRtMBMGA1UdJQQMMAoGCCsGAQUFBwMI +# MBkGCSsGAQQBgjcUAgQMHgoAUwB1AGIAQwBBMAsGA1UdDwQEAwIBhjAPBgNVHRMB +# Af8EBTADAQH/MB8GA1UdIwQYMBaAFNX2VsuP6KJcYmjRPZSQW9fOmhjEMFYGA1Ud +# HwRPME0wS6BJoEeGRWh0dHA6Ly9jcmwubWljcm9zb2Z0LmNvbS9wa2kvY3JsL3By +# b2R1Y3RzL01pY1Jvb0NlckF1dF8yMDEwLTA2LTIzLmNybDBaBggrBgEFBQcBAQRO +# MEwwSgYIKwYBBQUHMAKGPmh0dHA6Ly93d3cubWljcm9zb2Z0LmNvbS9wa2kvY2Vy +# dHMvTWljUm9vQ2VyQXV0XzIwMTAtMDYtMjMuY3J0MA0GCSqGSIb3DQEBCwUAA4IC +# AQCdVX38Kq3hLB9nATEkW+Geckv8qW/qXBS2Pk5HZHixBpOXPTEztTnXwnE2P9pk +# bHzQdTltuw8x5MKP+2zRoZQYIu7pZmc6U03dmLq2HnjYNi6cqYJWAAOwBb6J6Gng +# ugnue99qb74py27YP0h1AdkY3m2CDPVtI1TkeFN1JFe53Z/zjj3G82jfZfakVqr3 +# lbYoVSfQJL1AoL8ZthISEV09J+BAljis9/kpicO8F7BUhUKz/AyeixmJ5/ALaoHC +# gRlCGVJ1ijbCHcNhcy4sa3tuPywJeBTpkbKpW99Jo3QMvOyRgNI95ko+ZjtPu4b6 +# MhrZlvSP9pEB9s7GdP32THJvEKt1MMU0sHrYUP4KWN1APMdUbZ1jdEgssU5HLcEU +# BHG/ZPkkvnNtyo4JvbMBV0lUZNlz138eW0QBjloZkWsNn6Qo3GcZKCS6OEuabvsh +# VGtqRRFHqfG3rsjoiV5PndLQTHa1V1QJsWkBRH58oWFsc/4Ku+xBZj1p/cvBQUl+ +# fpO+y/g75LcVv7TOPqUxUYS8vwLBgqJ7Fx0ViY1w/ue10CgaiQuPNtq6TPmb/wrp +# NPgkNWcr4A245oyZ1uEi6vAnQj0llOZ0dFtq0Z4+7X6gMTN9vMvpe784cETRkPHI +# qzqKOghif9lwY1NNje6CbaUFEMFxBmoQtB1VM1izoXBm8qGCAs4wggI3AgEBMIH4 +# oYHQpIHNMIHKMQswCQYDVQQGEwJVUzETMBEGA1UECBMKV2FzaGluZ3RvbjEQMA4G +# A1UEBxMHUmVkbW9uZDEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMSUw +# IwYDVQQLExxNaWNyb3NvZnQgQW1lcmljYSBPcGVyYXRpb25zMSYwJAYDVQQLEx1U +# aGFsZXMgVFNTIEVTTjoxMkJDLUUzQUUtNzRFQjElMCMGA1UEAxMcTWljcm9zb2Z0 +# IFRpbWUtU3RhbXAgU2VydmljZaIjCgEBMAcGBSsOAwIaAxUAG3F2jO4LEMVLwgKG +# XdYMN4FBgOCggYMwgYCkfjB8MQswCQYDVQQGEwJVUzETMBEGA1UECBMKV2FzaGlu +# Z3RvbjEQMA4GA1UEBxMHUmVkbW9uZDEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBv +# cmF0aW9uMSYwJAYDVQQDEx1NaWNyb3NvZnQgVGltZS1TdGFtcCBQQ0EgMjAxMDAN +# BgkqhkiG9w0BAQUFAAIFAOXvuD8wIhgPMjAyMjAzMzExMzE4NTVaGA8yMDIyMDQw +# MTEzMTg1NVowdzA9BgorBgEEAYRZCgQBMS8wLTAKAgUA5e+4PwIBADAKAgEAAgIP +# IwIB/zAHAgEAAgIRnzAKAgUA5fEJvwIBADA2BgorBgEEAYRZCgQCMSgwJjAMBgor +# BgEEAYRZCgMCoAowCAIBAAIDB6EgoQowCAIBAAIDAYagMA0GCSqGSIb3DQEBBQUA +# A4GBANc53MLryLt1FD+jkakQydkemUps4QiN8HJxJ36VPuc2XRhvcn0Fhp1Pi8Hk +# gg08sFJoJ2vT/9g5J39zdjQpnbNGMkfmEi+qT6hbGq0ta5rnt1wDG2pVMuMn7N2Q +# 8CytKi6ZynWVbiCNuQtxsuwdgM7bRwcf510Wwp7iQUeNjJZzMYIEDTCCBAkCAQEw +# gZMwfDELMAkGA1UEBhMCVVMxEzARBgNVBAgTCldhc2hpbmd0b24xEDAOBgNVBAcT +# B1JlZG1vbmQxHjAcBgNVBAoTFU1pY3Jvc29mdCBDb3Jwb3JhdGlvbjEmMCQGA1UE +# AxMdTWljcm9zb2Z0IFRpbWUtU3RhbXAgUENBIDIwMTACEzMAAAGhAYVVmblUXYoA +# AQAAAaEwDQYJYIZIAWUDBAIBBQCgggFKMBoGCSqGSIb3DQEJAzENBgsqhkiG9w0B +# CRABBDAvBgkqhkiG9w0BCQQxIgQg7aLPwq2FhUC9oleuUeRc4uk9d+4UFLvls0ps +# 5tQU14wwgfoGCyqGSIb3DQEJEAIvMYHqMIHnMIHkMIG9BCDrCFTxOoGCaCCCjoRy +# Be1JSQrMJeCCTyErziiJ347QhDCBmDCBgKR+MHwxCzAJBgNVBAYTAlVTMRMwEQYD +# VQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdSZWRtb25kMR4wHAYDVQQKExVNaWNy +# b3NvZnQgQ29ycG9yYXRpb24xJjAkBgNVBAMTHU1pY3Jvc29mdCBUaW1lLVN0YW1w +# IFBDQSAyMDEwAhMzAAABoQGFVZm5VF2KAAEAAAGhMCIEIOKn52EgS+EFhqx/FxY8 +# xYD6qqUYqtVZ3iZ47g3sjJRaMA0GCSqGSIb3DQEBCwUABIICACJi4QGIi9yhn8uf +# NlWbdGQNP0UkTWxJRMnAe4eQUYbcHoOxPxguwy7r8VfTZOdKBxfy7/LKo5XGmAo2 +# hmZSsLHjtT0zzkZti2AFeCRmZ8DMVaGfR9sWBr0OwlRS3HMDigpWyI5jP/tD529k +# jh0/BYwKg2TGRk6ZmdFWXuQf0lVb/LytEUyFbziq4hoxhKc4IQ3oCcOm1xaVZzbe +# SgzPg3j4QfHAucYgfxJoIUP1lKTRclmUc2ERYmHchaUxeYIdiDHx5lpEdNsh0acm +# LgV307ncxLeN1Ih2E6By+Dknm8OppqVYOSvcjcjqHY+fU7ci/FuvyUVDQv6xe2ZS +# K6qCMCrPWtoOlE3ms+LE5kHVQ1JOs0v7mVVP8xfO+fkArk3RuUl/1gaGxi5Ljheg +# l+51jV5PMM4Vha9KoWfU2306ZLt/I1Rftq1sCOD5ysLnhTQuInQMRpfXlY/rvTPu +# 9jzQ4q4Ty7WPp004gh+9hLIm0s0nmZmM8jyTRUFrK1SfHglBOKgdrcuJfmEuPKxL +# foRg/LzuUjcXvdtO3oozIaVWsTxGx6laY2DkMPnqYaj/oBwla86bNyQT94YTTGWq +# 3mCwt0/H4E3Mn1OXLVIGO3NrzZwTFFN2uqRmcTQ0AKiXU3ar4b8F/ykpQOvTV6x/ +# U7Jz/JaISbEvO3mUarzheUPqVmWq +# SIG # End signature block diff --git a/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Az.Accounts.psm1 b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Az.Accounts.psm1 new file mode 100644 index 000000000000..67107181add7 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Az.Accounts.psm1 @@ -0,0 +1,375 @@ +# +# Script module for module 'Az.Accounts' that is executed when 'Az.Accounts' is imported in a PowerShell session. +# +# Generated by: Microsoft Corporation +# +# Generated on: 03/31/2022 09:26:49 +# + +$PSDefaultParameterValues.Clear() +Set-StrictMode -Version Latest + +function Test-DotNet +{ + try + { + if ((Get-PSDrive 'HKLM' -ErrorAction Ignore) -and (-not (Get-ChildItem 'HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full\' -ErrorAction Stop | Get-ItemPropertyValue -ErrorAction Stop -Name Release | Where-Object { $_ -ge 461808 }))) + { + throw ".NET Framework versions lower than 4.7.2 are not supported in Az. Please upgrade to .NET Framework 4.7.2 or higher." + } + } + catch [System.Management.Automation.DriveNotFoundException] + { + Write-Verbose ".NET Framework version check failed." + } +} + +function Preload-Assembly { + param ( + [string] + $AssemblyDirectory + ) + if($PSEdition -eq 'Desktop' -and (Test-Path $AssemblyDirectory -ErrorAction Ignore)) + { + try + { + Get-ChildItem -ErrorAction Stop -Path $AssemblyDirectory -Filter "*.dll" | ForEach-Object { + try + { + Add-Type -Path $_.FullName -ErrorAction Ignore | Out-Null + } + catch { + Write-Verbose $_ + } + } + } + catch {} + } +} + +if ($true -and ($PSEdition -eq 'Desktop')) +{ + if ($PSVersionTable.PSVersion -lt [Version]'5.1') + { + throw "PowerShell versions lower than 5.1 are not supported in Az. Please upgrade to PowerShell 5.1 or higher." + } + + Test-DotNet +} + +if ($true -and ($PSEdition -eq 'Core')) +{ + if ($PSVersionTable.PSVersion -lt [Version]'6.2.4') + { + throw "Current Az version doesn't support PowerShell Core versions lower than 6.2.4. Please upgrade to PowerShell Core 6.2.4 or higher." + } + if ($PSVersionTable.PSVersion -lt [Version]'7.0.6') + { + Write-Warning "This version of Az.Accounts is only supported on Windows PowerShell 5.1 and PowerShell 7.0.6 or greater, open https://aka.ms/install-powershell to learn how to upgrade. For further information, go to https://aka.ms/azpslifecycle." + } +} + +if (Test-Path -Path "$PSScriptRoot\StartupScripts" -ErrorAction Ignore) +{ + Get-ChildItem "$PSScriptRoot\StartupScripts" -ErrorAction Stop | ForEach-Object { + . $_.FullName + } +} + +if (Get-Module AzureRM.profile -ErrorAction Ignore) +{ + Write-Warning ("AzureRM.Profile already loaded. Az and AzureRM modules cannot be imported in the same session or used in the same script or runbook. If you are running PowerShell in an environment you control you can use the 'Uninstall-AzureRm' cmdlet to remove all AzureRm modules from your machine. " + + "If you are running in Azure Automation, take care that none of your runbooks import both Az and AzureRM modules. More information can be found here: https://aka.ms/azps-migration-guide.") + throw ("AzureRM.Profile already loaded. Az and AzureRM modules cannot be imported in the same session or used in the same script or runbook. If you are running PowerShell in an environment you control you can use the 'Uninstall-AzureRm' cmdlet to remove all AzureRm modules from your machine. " + + "If you are running in Azure Automation, take care that none of your runbooks import both Az and AzureRM modules. More information can be found here: https://aka.ms/azps-migration-guide.") +} + +$preloadPath = (Join-Path $PSScriptRoot -ChildPath "PreloadAssemblies") +Preload-Assembly -AssemblyDirectory $preloadPath +$preloadPath = (Join-Path $PSScriptRoot -ChildPath "ModuleAlcAssemblies") +Preload-Assembly -AssemblyDirectory $preloadPath + +$netCorePath = (Join-Path $PSScriptRoot -ChildPath "NetCoreAssemblies") +if($PSEdition -eq 'Core' -and (Test-Path $netCorePath -ErrorAction Ignore)) +{ + try + { + $loadedAssemblies = ([System.AppDomain]::CurrentDomain.GetAssemblies() | ForEach-Object {New-Object -TypeName System.Reflection.AssemblyName -ArgumentList $_.FullName} ) + Get-ChildItem -ErrorAction Stop -Path $netCorePath -Filter "*.dll" | ForEach-Object { + $assemblyName = ([System.Reflection.AssemblyName]::GetAssemblyName($_.FullName)) + $matches = ($loadedAssemblies | Where-Object {$_.Name -eq $assemblyName.Name}) + if (-not $matches) + { + try + { + Add-Type -Path $_.FullName -ErrorAction Ignore | Out-Null + } + catch { + Write-Verbose $_ + } + } + } + } + catch {} +} + + +Import-Module (Join-Path -Path $PSScriptRoot -ChildPath Microsoft.Azure.PowerShell.Cmdlets.Accounts.dll) + + +if (Test-Path -Path "$PSScriptRoot\PostImportScripts" -ErrorAction Ignore) +{ + Get-ChildItem "$PSScriptRoot\PostImportScripts" -ErrorAction Stop | ForEach-Object { + . $_.FullName + } +} + +$FilteredCommands = @() + +if ($Env:ACC_CLOUD -eq $null) +{ + $FilteredCommands | ForEach-Object { + + $existingDefault = $false + foreach ($key in $global:PSDefaultParameterValues.Keys) + { + if ($_ -like "$key") + { + $existingDefault = $true + } + } + + if (!$existingDefault) + { + $global:PSDefaultParameterValues.Add($_, + { + if ((Get-Command Get-AzContext -ErrorAction Ignore) -eq $null) + { + $context = Get-AzureRmContext + } + else + { + $context = Get-AzContext + } + if (($context -ne $null) -and $context.ExtendedProperties.ContainsKey("Default Resource Group")) { + $context.ExtendedProperties["Default Resource Group"] + } + }) + } + } +} + +# SIG # Begin signature block +# MIInugYJKoZIhvcNAQcCoIInqzCCJ6cCAQExDzANBglghkgBZQMEAgEFADB5Bgor +# BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG +# KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCBnXoRblwqGgp4a +# USzJaf5Wf+Tu+eUWmfecChJ7ENNasaCCDYEwggX/MIID56ADAgECAhMzAAACUosz +# qviV8znbAAAAAAJSMA0GCSqGSIb3DQEBCwUAMH4xCzAJBgNVBAYTAlVTMRMwEQYD +# VQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdSZWRtb25kMR4wHAYDVQQKExVNaWNy +# b3NvZnQgQ29ycG9yYXRpb24xKDAmBgNVBAMTH01pY3Jvc29mdCBDb2RlIFNpZ25p +# bmcgUENBIDIwMTEwHhcNMjEwOTAyMTgzMjU5WhcNMjIwOTAxMTgzMjU5WjB0MQsw +# CQYDVQQGEwJVUzETMBEGA1UECBMKV2FzaGluZ3RvbjEQMA4GA1UEBxMHUmVkbW9u +# ZDEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMR4wHAYDVQQDExVNaWNy +# b3NvZnQgQ29ycG9yYXRpb24wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIB +# AQDQ5M+Ps/X7BNuv5B/0I6uoDwj0NJOo1KrVQqO7ggRXccklyTrWL4xMShjIou2I +# sbYnF67wXzVAq5Om4oe+LfzSDOzjcb6ms00gBo0OQaqwQ1BijyJ7NvDf80I1fW9O +# L76Kt0Wpc2zrGhzcHdb7upPrvxvSNNUvxK3sgw7YTt31410vpEp8yfBEl/hd8ZzA +# v47DCgJ5j1zm295s1RVZHNp6MoiQFVOECm4AwK2l28i+YER1JO4IplTH44uvzX9o +# RnJHaMvWzZEpozPy4jNO2DDqbcNs4zh7AWMhE1PWFVA+CHI/En5nASvCvLmuR/t8 +# q4bc8XR8QIZJQSp+2U6m2ldNAgMBAAGjggF+MIIBejAfBgNVHSUEGDAWBgorBgEE +# AYI3TAgBBggrBgEFBQcDAzAdBgNVHQ4EFgQUNZJaEUGL2Guwt7ZOAu4efEYXedEw +# UAYDVR0RBEkwR6RFMEMxKTAnBgNVBAsTIE1pY3Jvc29mdCBPcGVyYXRpb25zIFB1 +# ZXJ0byBSaWNvMRYwFAYDVQQFEw0yMzAwMTIrNDY3NTk3MB8GA1UdIwQYMBaAFEhu +# ZOVQBdOCqhc3NyK1bajKdQKVMFQGA1UdHwRNMEswSaBHoEWGQ2h0dHA6Ly93d3cu +# bWljcm9zb2Z0LmNvbS9wa2lvcHMvY3JsL01pY0NvZFNpZ1BDQTIwMTFfMjAxMS0w +# Ny0wOC5jcmwwYQYIKwYBBQUHAQEEVTBTMFEGCCsGAQUFBzAChkVodHRwOi8vd3d3 +# Lm1pY3Jvc29mdC5jb20vcGtpb3BzL2NlcnRzL01pY0NvZFNpZ1BDQTIwMTFfMjAx +# MS0wNy0wOC5jcnQwDAYDVR0TAQH/BAIwADANBgkqhkiG9w0BAQsFAAOCAgEAFkk3 +# uSxkTEBh1NtAl7BivIEsAWdgX1qZ+EdZMYbQKasY6IhSLXRMxF1B3OKdR9K/kccp +# kvNcGl8D7YyYS4mhCUMBR+VLrg3f8PUj38A9V5aiY2/Jok7WZFOAmjPRNNGnyeg7 +# l0lTiThFqE+2aOs6+heegqAdelGgNJKRHLWRuhGKuLIw5lkgx9Ky+QvZrn/Ddi8u +# TIgWKp+MGG8xY6PBvvjgt9jQShlnPrZ3UY8Bvwy6rynhXBaV0V0TTL0gEx7eh/K1 +# o8Miaru6s/7FyqOLeUS4vTHh9TgBL5DtxCYurXbSBVtL1Fj44+Od/6cmC9mmvrti +# yG709Y3Rd3YdJj2f3GJq7Y7KdWq0QYhatKhBeg4fxjhg0yut2g6aM1mxjNPrE48z +# 6HWCNGu9gMK5ZudldRw4a45Z06Aoktof0CqOyTErvq0YjoE4Xpa0+87T/PVUXNqf +# 7Y+qSU7+9LtLQuMYR4w3cSPjuNusvLf9gBnch5RqM7kaDtYWDgLyB42EfsxeMqwK +# WwA+TVi0HrWRqfSx2olbE56hJcEkMjOSKz3sRuupFCX3UroyYf52L+2iVTrda8XW +# esPG62Mnn3T8AuLfzeJFuAbfOSERx7IFZO92UPoXE1uEjL5skl1yTZB3MubgOA4F +# 8KoRNhviFAEST+nG8c8uIsbZeb08SeYQMqjVEmkwggd6MIIFYqADAgECAgphDpDS +# AAAAAAADMA0GCSqGSIb3DQEBCwUAMIGIMQswCQYDVQQGEwJVUzETMBEGA1UECBMK +# V2FzaGluZ3RvbjEQMA4GA1UEBxMHUmVkbW9uZDEeMBwGA1UEChMVTWljcm9zb2Z0 +# IENvcnBvcmF0aW9uMTIwMAYDVQQDEylNaWNyb3NvZnQgUm9vdCBDZXJ0aWZpY2F0 +# ZSBBdXRob3JpdHkgMjAxMTAeFw0xMTA3MDgyMDU5MDlaFw0yNjA3MDgyMTA5MDla +# MH4xCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdS +# ZWRtb25kMR4wHAYDVQQKExVNaWNyb3NvZnQgQ29ycG9yYXRpb24xKDAmBgNVBAMT +# H01pY3Jvc29mdCBDb2RlIFNpZ25pbmcgUENBIDIwMTEwggIiMA0GCSqGSIb3DQEB +# AQUAA4ICDwAwggIKAoICAQCr8PpyEBwurdhuqoIQTTS68rZYIZ9CGypr6VpQqrgG +# OBoESbp/wwwe3TdrxhLYC/A4wpkGsMg51QEUMULTiQ15ZId+lGAkbK+eSZzpaF7S +# 35tTsgosw6/ZqSuuegmv15ZZymAaBelmdugyUiYSL+erCFDPs0S3XdjELgN1q2jz +# y23zOlyhFvRGuuA4ZKxuZDV4pqBjDy3TQJP4494HDdVceaVJKecNvqATd76UPe/7 +# 4ytaEB9NViiienLgEjq3SV7Y7e1DkYPZe7J7hhvZPrGMXeiJT4Qa8qEvWeSQOy2u +# M1jFtz7+MtOzAz2xsq+SOH7SnYAs9U5WkSE1JcM5bmR/U7qcD60ZI4TL9LoDho33 +# X/DQUr+MlIe8wCF0JV8YKLbMJyg4JZg5SjbPfLGSrhwjp6lm7GEfauEoSZ1fiOIl +# XdMhSz5SxLVXPyQD8NF6Wy/VI+NwXQ9RRnez+ADhvKwCgl/bwBWzvRvUVUvnOaEP +# 6SNJvBi4RHxF5MHDcnrgcuck379GmcXvwhxX24ON7E1JMKerjt/sW5+v/N2wZuLB +# l4F77dbtS+dJKacTKKanfWeA5opieF+yL4TXV5xcv3coKPHtbcMojyyPQDdPweGF +# RInECUzF1KVDL3SV9274eCBYLBNdYJWaPk8zhNqwiBfenk70lrC8RqBsmNLg1oiM +# CwIDAQABo4IB7TCCAekwEAYJKwYBBAGCNxUBBAMCAQAwHQYDVR0OBBYEFEhuZOVQ +# BdOCqhc3NyK1bajKdQKVMBkGCSsGAQQBgjcUAgQMHgoAUwB1AGIAQwBBMAsGA1Ud +# DwQEAwIBhjAPBgNVHRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFHItOgIxkEO5FAVO +# 4eqnxzHRI4k0MFoGA1UdHwRTMFEwT6BNoEuGSWh0dHA6Ly9jcmwubWljcm9zb2Z0 +# LmNvbS9wa2kvY3JsL3Byb2R1Y3RzL01pY1Jvb0NlckF1dDIwMTFfMjAxMV8wM18y +# Mi5jcmwwXgYIKwYBBQUHAQEEUjBQME4GCCsGAQUFBzAChkJodHRwOi8vd3d3Lm1p +# Y3Jvc29mdC5jb20vcGtpL2NlcnRzL01pY1Jvb0NlckF1dDIwMTFfMjAxMV8wM18y +# Mi5jcnQwgZ8GA1UdIASBlzCBlDCBkQYJKwYBBAGCNy4DMIGDMD8GCCsGAQUFBwIB +# FjNodHRwOi8vd3d3Lm1pY3Jvc29mdC5jb20vcGtpb3BzL2RvY3MvcHJpbWFyeWNw +# cy5odG0wQAYIKwYBBQUHAgIwNB4yIB0ATABlAGcAYQBsAF8AcABvAGwAaQBjAHkA +# XwBzAHQAYQB0AGUAbQBlAG4AdAAuIB0wDQYJKoZIhvcNAQELBQADggIBAGfyhqWY +# 4FR5Gi7T2HRnIpsLlhHhY5KZQpZ90nkMkMFlXy4sPvjDctFtg/6+P+gKyju/R6mj +# 82nbY78iNaWXXWWEkH2LRlBV2AySfNIaSxzzPEKLUtCw/WvjPgcuKZvmPRul1LUd +# d5Q54ulkyUQ9eHoj8xN9ppB0g430yyYCRirCihC7pKkFDJvtaPpoLpWgKj8qa1hJ +# Yx8JaW5amJbkg/TAj/NGK978O9C9Ne9uJa7lryft0N3zDq+ZKJeYTQ49C/IIidYf +# wzIY4vDFLc5bnrRJOQrGCsLGra7lstnbFYhRRVg4MnEnGn+x9Cf43iw6IGmYslmJ +# aG5vp7d0w0AFBqYBKig+gj8TTWYLwLNN9eGPfxxvFX1Fp3blQCplo8NdUmKGwx1j +# NpeG39rz+PIWoZon4c2ll9DuXWNB41sHnIc+BncG0QaxdR8UvmFhtfDcxhsEvt9B +# xw4o7t5lL+yX9qFcltgA1qFGvVnzl6UJS0gQmYAf0AApxbGbpT9Fdx41xtKiop96 +# eiL6SJUfq/tHI4D1nvi/a7dLl+LrdXga7Oo3mXkYS//WsyNodeav+vyL6wuA6mk7 +# r/ww7QRMjt/fdW1jkT3RnVZOT7+AVyKheBEyIXrvQQqxP/uozKRdwaGIm1dxVk5I +# RcBCyZt2WwqASGv9eZ/BvW1taslScxMNelDNMYIZjzCCGYsCAQEwgZUwfjELMAkG +# A1UEBhMCVVMxEzARBgNVBAgTCldhc2hpbmd0b24xEDAOBgNVBAcTB1JlZG1vbmQx +# HjAcBgNVBAoTFU1pY3Jvc29mdCBDb3Jwb3JhdGlvbjEoMCYGA1UEAxMfTWljcm9z +# b2Z0IENvZGUgU2lnbmluZyBQQ0EgMjAxMQITMwAAAlKLM6r4lfM52wAAAAACUjAN +# BglghkgBZQMEAgEFAKCBrjAZBgkqhkiG9w0BCQMxDAYKKwYBBAGCNwIBBDAcBgor +# BgEEAYI3AgELMQ4wDAYKKwYBBAGCNwIBFTAvBgkqhkiG9w0BCQQxIgQgqwm8h/dw +# FED0y+xGCWSaD8Fc1mZMgPkryh2zfSvZwxIwQgYKKwYBBAGCNwIBDDE0MDKgFIAS +# AE0AaQBjAHIAbwBzAG8AZgB0oRqAGGh0dHA6Ly93d3cubWljcm9zb2Z0LmNvbTAN +# BgkqhkiG9w0BAQEFAASCAQBvXNrKAkE7o84rJI6+XFvnA65dqlWCZBeFhG6YGpde +# Nom1mPdcfauabmxLKg7N5GG1FBWXuYDu1aEyDhiXzPG6ET+/ikXTGfN9J0D9g5Wx +# a2SeSIJ0XfsllBKKwOKl4OhoY3y5Kjjk08Cw75aE5BR8Ux0FWciN8n+nztakOyN9 +# tf7I5nmgbrHvJC5az2N9aR5DejRvjPDcNCnRkepz3nnA+FQNFbXaKqjgJz9oRBgA +# K2SAZDQnnK3B3MAv7qJX6GyeUhen7kwXZC0OV2RjyPRC+f8SiV/OF/ZsaFe4nXps +# RJqg5f5sUjCHFS5g8yK9Zy6D7EZKJJA4yk8YgRpdxOiuoYIXGTCCFxUGCisGAQQB +# gjcDAwExghcFMIIXAQYJKoZIhvcNAQcCoIIW8jCCFu4CAQMxDzANBglghkgBZQME +# AgEFADCCAVkGCyqGSIb3DQEJEAEEoIIBSASCAUQwggFAAgEBBgorBgEEAYRZCgMB +# MDEwDQYJYIZIAWUDBAIBBQAEIAn/Ph2Du7oUABZfi9Z4pWXxedNUse800UpCJBeG +# +id6AgZiF5hUHpsYEzIwMjIwMzMxMTAwMDEyLjU2OFowBIACAfSggdikgdUwgdIx +# CzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdSZWRt +# b25kMR4wHAYDVQQKExVNaWNyb3NvZnQgQ29ycG9yYXRpb24xLTArBgNVBAsTJE1p +# Y3Jvc29mdCBJcmVsYW5kIE9wZXJhdGlvbnMgTGltaXRlZDEmMCQGA1UECxMdVGhh +# bGVzIFRTUyBFU046RkM0MS00QkQ0LUQyMjAxJTAjBgNVBAMTHE1pY3Jvc29mdCBU +# aW1lLVN0YW1wIFNlcnZpY2WgghFoMIIHFDCCBPygAwIBAgITMwAAAY5Z20YAqBCU +# zAABAAABjjANBgkqhkiG9w0BAQsFADB8MQswCQYDVQQGEwJVUzETMBEGA1UECBMK +# V2FzaGluZ3RvbjEQMA4GA1UEBxMHUmVkbW9uZDEeMBwGA1UEChMVTWljcm9zb2Z0 +# IENvcnBvcmF0aW9uMSYwJAYDVQQDEx1NaWNyb3NvZnQgVGltZS1TdGFtcCBQQ0Eg +# MjAxMDAeFw0yMTEwMjgxOTI3NDVaFw0yMzAxMjYxOTI3NDVaMIHSMQswCQYDVQQG +# EwJVUzETMBEGA1UECBMKV2FzaGluZ3RvbjEQMA4GA1UEBxMHUmVkbW9uZDEeMBwG +# A1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMS0wKwYDVQQLEyRNaWNyb3NvZnQg +# SXJlbGFuZCBPcGVyYXRpb25zIExpbWl0ZWQxJjAkBgNVBAsTHVRoYWxlcyBUU1Mg +# RVNOOkZDNDEtNEJENC1EMjIwMSUwIwYDVQQDExxNaWNyb3NvZnQgVGltZS1TdGFt +# cCBTZXJ2aWNlMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAqiMCq6OM +# zLa5wrtcf7Bf9f1WXW9kpqbOBzgPJvaGLrZG7twgwqTRWf1FkjpJKBOG5QPIRy7a +# 6IFVAy0W+tBaFX4In4DbBf2tGubyY9+hRU+hRewPJH5CYOvpPh77FfGM63+OlwRX +# p5YER6tC0WRKn3mryWpt4CwADuGv0LD2QjnhhgtRVidsiDnn9+aLjMuNapUhstGq +# Cr7JcQZt0ZrPUHW/TqTJymeU1eqgNorEbTed6UQyLaTVAmhXNQXDChfa526nW7RQ +# 7L4tXX9Lc0oguiCSkPlu5drNA6NM8z+UXQOAHxVfIQXmi+Y3SV2hr2dcxby9nlTz +# Yvf4ZDr5Wpcwt7tTdRIJibXHsXWMKrmOziliGDToLx34a/ctZE4NOLnlrKQWN9ZG +# +Ox5zRarK1EhShahM0uQNhb6BJjp3+c0eNzMFJ2qLZqDp2/3Yl5Q+4k+MDHLTipP +# 6VBdxcdVfd4mgrVTx3afO5KNfgMngGGfhSawGraRW28EhrLOspmIxii92E7vjncJ +# 2tcjhLCjBArVpPh3cZG5g3ZVy5iiAaoDaswpNgnMFAK5Un1reK+MFhPi9iMnvUPw +# tTDDJt5YED5DAT3mBUxp5QH3t7RhZwAJNLWLtpTeGF7ub81sSKYv2ardazAe9XLS +# 10tV2oOPrcniGJzlXW7VPvxqQNxe8lCDA20CAwEAAaOCATYwggEyMB0GA1UdDgQW +# BBTsQfkz9gT44N/5G8vNHayep+aV5DAfBgNVHSMEGDAWgBSfpxVdAF5iXYP05dJl +# pxtTNRnpcjBfBgNVHR8EWDBWMFSgUqBQhk5odHRwOi8vd3d3Lm1pY3Jvc29mdC5j +# b20vcGtpb3BzL2NybC9NaWNyb3NvZnQlMjBUaW1lLVN0YW1wJTIwUENBJTIwMjAx +# MCgxKS5jcmwwbAYIKwYBBQUHAQEEYDBeMFwGCCsGAQUFBzAChlBodHRwOi8vd3d3 +# Lm1pY3Jvc29mdC5jb20vcGtpb3BzL2NlcnRzL01pY3Jvc29mdCUyMFRpbWUtU3Rh +# bXAlMjBQQ0ElMjAyMDEwKDEpLmNydDAMBgNVHRMBAf8EAjAAMBMGA1UdJQQMMAoG +# CCsGAQUFBwMIMA0GCSqGSIb3DQEBCwUAA4ICAQA1UK9xzIeTlKhSbLn0bekR5gYh +# 6bB1XQpluCqCA15skZ37UilaFJw8+GklDLzlNhSP2mOiOzVyCq8kkpqnfUc01ZaB +# ezQxg77qevj2iMyg39YJfeiCIhxYOFugwepYrPO8MlB/oue/VhIiDb1eNYTlPSmv +# 3palsgtkrb0oo0F0uWmX4EQVGKRo0UENtZetVIxa0J9DpUdjQWPeEh9cEM+RgE26 +# 5w5WAVb+WNx0iWiF4iTbCmrWaVEOX92dNqBm9bT1U7nGwN5CygpNAgEaYnrTMx1N +# 4AjxObACDN5DdvGlu/O0DfMWVc6qk6iKDFC6WpXQSkMlrlXII/Nhp+0+noU6tfEp +# HKLt7fYm9of5i/QomcCwo/ekiOCjYktp393ovoC1O2uLtbLnMVlE5raBLBNSbINZ +# 6QLxiA41lXnVVLIzDihUL8MU9CMvG4sdbhk2FX8zvrsP5PeBIw1faenMZuz0V3UX +# CtU5Okx5fmioWiiLZSCi1ljaxX+BEwQiinCi+vE59bTYI5FbuR8tDuGLiVu/JSpV +# FXrzWMP2Kn11sCLAGEjqJYUmO1tRY29Kd7HcIj2niSB0PQOCjYlnCnywnDinqS1C +# XvRsisjVlS1Rp4Tmuks+pGxiMGzF58zcb+hoFKyONuL3b+tgxTAz3sF3BVX9uk9M +# 5F+OEoeyLyGfLekNAjCCB3EwggVZoAMCAQICEzMAAAAVxedrngKbSZkAAAAAABUw +# DQYJKoZIhvcNAQELBQAwgYgxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpXYXNoaW5n +# dG9uMRAwDgYDVQQHEwdSZWRtb25kMR4wHAYDVQQKExVNaWNyb3NvZnQgQ29ycG9y +# YXRpb24xMjAwBgNVBAMTKU1pY3Jvc29mdCBSb290IENlcnRpZmljYXRlIEF1dGhv +# cml0eSAyMDEwMB4XDTIxMDkzMDE4MjIyNVoXDTMwMDkzMDE4MzIyNVowfDELMAkG +# A1UEBhMCVVMxEzARBgNVBAgTCldhc2hpbmd0b24xEDAOBgNVBAcTB1JlZG1vbmQx +# HjAcBgNVBAoTFU1pY3Jvc29mdCBDb3Jwb3JhdGlvbjEmMCQGA1UEAxMdTWljcm9z +# b2Z0IFRpbWUtU3RhbXAgUENBIDIwMTAwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAw +# ggIKAoICAQDk4aZM57RyIQt5osvXJHm9DtWC0/3unAcH0qlsTnXIyjVX9gF/bErg +# 4r25PhdgM/9cT8dm95VTcVrifkpa/rg2Z4VGIwy1jRPPdzLAEBjoYH1qUoNEt6aO +# RmsHFPPFdvWGUNzBRMhxXFExN6AKOG6N7dcP2CZTfDlhAnrEqv1yaa8dq6z2Nr41 +# JmTamDu6GnszrYBbfowQHJ1S/rboYiXcag/PXfT+jlPP1uyFVk3v3byNpOORj7I5 +# LFGc6XBpDco2LXCOMcg1KL3jtIckw+DJj361VI/c+gVVmG1oO5pGve2krnopN6zL +# 64NF50ZuyjLVwIYwXE8s4mKyzbnijYjklqwBSru+cakXW2dg3viSkR4dPf0gz3N9 +# QZpGdc3EXzTdEonW/aUgfX782Z5F37ZyL9t9X4C626p+Nuw2TPYrbqgSUei/BQOj +# 0XOmTTd0lBw0gg/wEPK3Rxjtp+iZfD9M269ewvPV2HM9Q07BMzlMjgK8QmguEOqE +# UUbi0b1qGFphAXPKZ6Je1yh2AuIzGHLXpyDwwvoSCtdjbwzJNmSLW6CmgyFdXzB0 +# kZSU2LlQ+QuJYfM2BjUYhEfb3BvR/bLUHMVr9lxSUV0S2yW6r1AFemzFER1y7435 +# UsSFF5PAPBXbGjfHCBUYP3irRbb1Hode2o+eFnJpxq57t7c+auIurQIDAQABo4IB +# 3TCCAdkwEgYJKwYBBAGCNxUBBAUCAwEAATAjBgkrBgEEAYI3FQIEFgQUKqdS/mTE +# mr6CkTxGNSnPEP8vBO4wHQYDVR0OBBYEFJ+nFV0AXmJdg/Tl0mWnG1M1GelyMFwG +# A1UdIARVMFMwUQYMKwYBBAGCN0yDfQEBMEEwPwYIKwYBBQUHAgEWM2h0dHA6Ly93 +# d3cubWljcm9zb2Z0LmNvbS9wa2lvcHMvRG9jcy9SZXBvc2l0b3J5Lmh0bTATBgNV +# HSUEDDAKBggrBgEFBQcDCDAZBgkrBgEEAYI3FAIEDB4KAFMAdQBiAEMAQTALBgNV +# HQ8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAfBgNVHSMEGDAWgBTV9lbLj+iiXGJo +# 0T2UkFvXzpoYxDBWBgNVHR8ETzBNMEugSaBHhkVodHRwOi8vY3JsLm1pY3Jvc29m +# dC5jb20vcGtpL2NybC9wcm9kdWN0cy9NaWNSb29DZXJBdXRfMjAxMC0wNi0yMy5j +# cmwwWgYIKwYBBQUHAQEETjBMMEoGCCsGAQUFBzAChj5odHRwOi8vd3d3Lm1pY3Jv +# c29mdC5jb20vcGtpL2NlcnRzL01pY1Jvb0NlckF1dF8yMDEwLTA2LTIzLmNydDAN +# BgkqhkiG9w0BAQsFAAOCAgEAnVV9/Cqt4SwfZwExJFvhnnJL/Klv6lwUtj5OR2R4 +# sQaTlz0xM7U518JxNj/aZGx80HU5bbsPMeTCj/ts0aGUGCLu6WZnOlNN3Zi6th54 +# 2DYunKmCVgADsAW+iehp4LoJ7nvfam++Kctu2D9IdQHZGN5tggz1bSNU5HhTdSRX +# ud2f8449xvNo32X2pFaq95W2KFUn0CS9QKC/GbYSEhFdPSfgQJY4rPf5KYnDvBew +# VIVCs/wMnosZiefwC2qBwoEZQhlSdYo2wh3DYXMuLGt7bj8sCXgU6ZGyqVvfSaN0 +# DLzskYDSPeZKPmY7T7uG+jIa2Zb0j/aRAfbOxnT99kxybxCrdTDFNLB62FD+Cljd +# QDzHVG2dY3RILLFORy3BFARxv2T5JL5zbcqOCb2zAVdJVGTZc9d/HltEAY5aGZFr +# DZ+kKNxnGSgkujhLmm77IVRrakURR6nxt67I6IleT53S0Ex2tVdUCbFpAUR+fKFh +# bHP+CrvsQWY9af3LwUFJfn6Tvsv4O+S3Fb+0zj6lMVGEvL8CwYKiexcdFYmNcP7n +# tdAoGokLjzbaukz5m/8K6TT4JDVnK+ANuOaMmdbhIurwJ0I9JZTmdHRbatGePu1+ +# oDEzfbzL6Xu/OHBE0ZDxyKs6ijoIYn/ZcGNTTY3ugm2lBRDBcQZqELQdVTNYs6Fw +# ZvKhggLXMIICQAIBATCCAQChgdikgdUwgdIxCzAJBgNVBAYTAlVTMRMwEQYDVQQI +# EwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdSZWRtb25kMR4wHAYDVQQKExVNaWNyb3Nv +# ZnQgQ29ycG9yYXRpb24xLTArBgNVBAsTJE1pY3Jvc29mdCBJcmVsYW5kIE9wZXJh +# dGlvbnMgTGltaXRlZDEmMCQGA1UECxMdVGhhbGVzIFRTUyBFU046RkM0MS00QkQ0 +# LUQyMjAxJTAjBgNVBAMTHE1pY3Jvc29mdCBUaW1lLVN0YW1wIFNlcnZpY2WiIwoB +# ATAHBgUrDgMCGgMVAD1iK+pPThHqgpa5xsPmiYruWVuMoIGDMIGApH4wfDELMAkG +# A1UEBhMCVVMxEzARBgNVBAgTCldhc2hpbmd0b24xEDAOBgNVBAcTB1JlZG1vbmQx +# HjAcBgNVBAoTFU1pY3Jvc29mdCBDb3Jwb3JhdGlvbjEmMCQGA1UEAxMdTWljcm9z +# b2Z0IFRpbWUtU3RhbXAgUENBIDIwMTAwDQYJKoZIhvcNAQEFBQACBQDl75AOMCIY +# DzIwMjIwMzMxMTAyNzI2WhgPMjAyMjA0MDExMDI3MjZaMHcwPQYKKwYBBAGEWQoE +# ATEvMC0wCgIFAOXvkA4CAQAwCgIBAAICAYUCAf8wBwIBAAICEiowCgIFAOXw4Y4C +# AQAwNgYKKwYBBAGEWQoEAjEoMCYwDAYKKwYBBAGEWQoDAqAKMAgCAQACAwehIKEK +# MAgCAQACAwGGoDANBgkqhkiG9w0BAQUFAAOBgQCCQ+gyinUAzBfQG0tdRLTKoWAz +# 1F9XL8HUl1+DL/nO5fnfNT2fIwdNtkcnjXkY7J89nDVJ5orczCc/Jjd8FWrGsZYF +# R7jTDpEnctly2mdeOC54DPn8NfB2rKnTAZSMNZUA5+qwXYtBJ9/L+zBcWbLJGn17 +# Xdsy6ogPG2mqiNeJETGCBA0wggQJAgEBMIGTMHwxCzAJBgNVBAYTAlVTMRMwEQYD +# VQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdSZWRtb25kMR4wHAYDVQQKExVNaWNy +# b3NvZnQgQ29ycG9yYXRpb24xJjAkBgNVBAMTHU1pY3Jvc29mdCBUaW1lLVN0YW1w +# IFBDQSAyMDEwAhMzAAABjlnbRgCoEJTMAAEAAAGOMA0GCWCGSAFlAwQCAQUAoIIB +# SjAaBgkqhkiG9w0BCQMxDQYLKoZIhvcNAQkQAQQwLwYJKoZIhvcNAQkEMSIEIBdm +# /Yr/algho7Se4sS1u0RA1CsQ3avLfVkP9cSuIl4vMIH6BgsqhkiG9w0BCRACLzGB +# 6jCB5zCB5DCBvQQgvQWPITvigaUuV5+f/lWs3BXZwJ/l1mf+yelu5nXmxCUwgZgw +# gYCkfjB8MQswCQYDVQQGEwJVUzETMBEGA1UECBMKV2FzaGluZ3RvbjEQMA4GA1UE +# BxMHUmVkbW9uZDEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMSYwJAYD +# VQQDEx1NaWNyb3NvZnQgVGltZS1TdGFtcCBQQ0EgMjAxMAITMwAAAY5Z20YAqBCU +# zAABAAABjjAiBCDFYh4a5uyi794y1CHlKx3P8nxZO/8fomUMsnns7kvKmzANBgkq +# hkiG9w0BAQsFAASCAgCphAx90HI/vzWSwneRSNg3gV826YqxCNSVkzMDcu1Rkayq +# 3FhK466ELhIxyI9EL3hLCS/BIQYKH8AiVU85P07pmaLls+bUM2CPt3II0oZYY5T8 +# BN/MyqZ0vUS6QvNX8ZT8A82R5/meSt8qS8+8ppG1XumAYmdqv7vriD8ENBrhIyus +# 3Wjwt0rS2kovNj+6g3xMJBU+LnP+qzNv72aEr2LvKkU8/abYiNXN1FGlJPqHYrF/ +# zumVFsNkJMjJrlgRFlo/EROGu3iUiI37hM7mTm77aYrWoMbKrl/4nKfMpjR4KQqL +# Mhi9Cb1c11cugxCFnoc1IA6kQ+Xg1fYUchz5UmgzDTpwic3FVGGRlTv4Wf9PMjjj +# heZyL7BFkHZCpr5qpwpu/ZvpCSQpsP4Aa07qY5ffgRu/te0ip3gkzL3Ur7zNqf60 +# Dw9If1ECZOcx+GMgIHd0t+48+hsE4RrmvMvWrEBz2B/BJEOfrIQEClhFczLjDd4G +# nhh4y/vSlqbUUupH+/oJRtpla+ZQbAxsg8jTPsiGG7hmvSaNfV7+SgwCjO1HB/On +# DkzS+edyqivrfkuwjFYecbLcl9e9Pr3SPFvelW5kXiQw2KyWFrD0aznq7YT0x/Na +# /XaZDuLepRVe7YnvH4Ky7yk58zG3QYNy5EJ6Pf3ClNsX4BBAJsUrWMxicmpUDg== +# SIG # End signature block diff --git a/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/AzSharedAlcAssemblies/Azure.Core.dll b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/AzSharedAlcAssemblies/Azure.Core.dll new file mode 100644 index 000000000000..32652d6de4d0 Binary files /dev/null and b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/AzSharedAlcAssemblies/Azure.Core.dll differ diff --git a/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/AzSharedAlcAssemblies/Azure.Identity.dll b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/AzSharedAlcAssemblies/Azure.Identity.dll new file mode 100644 index 000000000000..0d214db71cad Binary files /dev/null and b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/AzSharedAlcAssemblies/Azure.Identity.dll differ diff --git a/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/AzSharedAlcAssemblies/Microsoft.Bcl.AsyncInterfaces.dll b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/AzSharedAlcAssemblies/Microsoft.Bcl.AsyncInterfaces.dll new file mode 100644 index 000000000000..f2955edfecb7 Binary files /dev/null and b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/AzSharedAlcAssemblies/Microsoft.Bcl.AsyncInterfaces.dll differ diff --git a/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/AzSharedAlcAssemblies/Microsoft.Identity.Client.Extensions.Msal.dll b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/AzSharedAlcAssemblies/Microsoft.Identity.Client.Extensions.Msal.dll new file mode 100644 index 000000000000..81b736cc09da Binary files /dev/null and b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/AzSharedAlcAssemblies/Microsoft.Identity.Client.Extensions.Msal.dll differ diff --git a/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/AzSharedAlcAssemblies/Microsoft.Identity.Client.dll b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/AzSharedAlcAssemblies/Microsoft.Identity.Client.dll new file mode 100644 index 000000000000..f656e5e42360 Binary files /dev/null and b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/AzSharedAlcAssemblies/Microsoft.Identity.Client.dll differ diff --git a/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/AzSharedAlcAssemblies/System.Memory.Data.dll b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/AzSharedAlcAssemblies/System.Memory.Data.dll new file mode 100644 index 000000000000..6f2a3e0ad07f Binary files /dev/null and b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/AzSharedAlcAssemblies/System.Memory.Data.dll differ diff --git a/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/AzSharedAlcAssemblies/System.Text.Json.dll b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/AzSharedAlcAssemblies/System.Text.Json.dll new file mode 100644 index 000000000000..fe2154a3bf3a Binary files /dev/null and b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/AzSharedAlcAssemblies/System.Text.Json.dll differ diff --git a/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Hyak.Common.dll b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Hyak.Common.dll new file mode 100644 index 000000000000..18a53248894f Binary files /dev/null and b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Hyak.Common.dll differ diff --git a/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Microsoft.ApplicationInsights.dll b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Microsoft.ApplicationInsights.dll new file mode 100644 index 000000000000..92d06762d6a5 Binary files /dev/null and b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Microsoft.ApplicationInsights.dll differ diff --git a/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Microsoft.Azure.Common.dll b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Microsoft.Azure.Common.dll new file mode 100644 index 000000000000..1c9d8e2a0ef5 Binary files /dev/null and b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Microsoft.Azure.Common.dll differ diff --git a/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Authentication.Abstractions.dll b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Authentication.Abstractions.dll new file mode 100644 index 000000000000..8e791611cc1a Binary files /dev/null and b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Authentication.Abstractions.dll differ diff --git a/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Authentication.ResourceManager.deps.json b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Authentication.ResourceManager.deps.json new file mode 100644 index 000000000000..dde9337e5748 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Authentication.ResourceManager.deps.json @@ -0,0 +1,2309 @@ +{ + "runtimeTarget": { + "name": ".NETStandard,Version=v2.0/", + "signature": "" + }, + "compilationOptions": {}, + "targets": { + ".NETStandard,Version=v2.0": {}, + ".NETStandard,Version=v2.0/": { + "Microsoft.Azure.PowerShell.Authentication.ResourceManager/1.0.0": { + "dependencies": { + "Azure.Core": "1.22.0", + "Hyak.Common": "1.2.2", + "Microsoft.ApplicationInsights": "2.12.0", + "Microsoft.Azure.Common": "2.2.1", + "Microsoft.Azure.PowerShell.Authentication": "1.0.0", + "Microsoft.Azure.PowerShell.Authentication.Abstractions": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Clients.Aks": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Clients.Authorization": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Clients.Compute": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Clients.Graph.Rbac": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Clients.KeyVault": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Clients.Monitor": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Clients.Network": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Clients.PolicyInsights": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Clients.ResourceManager": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Clients.Storage.Management": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Clients.Websites": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Common": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Common.Share": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Storage": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Strategies": "1.3.57-preview", + "Microsoft.Rest.ClientRuntime": "2.3.23", + "Microsoft.Rest.ClientRuntime.Azure": "3.3.19", + "NETStandard.Library": "2.0.3", + "Newtonsoft.Json": "10.0.3", + "PowerShellStandard.Library": "5.1.0" + }, + "runtime": { + "Microsoft.Azure.PowerShell.Authentication.ResourceManager.dll": {} + } + }, + "Azure.Core/1.22.0": { + "dependencies": { + "Microsoft.Bcl.AsyncInterfaces": "1.1.1", + "System.Diagnostics.DiagnosticSource": "4.6.0", + "System.Memory.Data": "1.0.2", + "System.Numerics.Vectors": "4.5.0", + "System.Text.Encodings.Web": "4.7.2", + "System.Text.Json": "4.7.2", + "System.Threading.Tasks.Extensions": "4.5.4" + }, + "runtime": { + "lib/netstandard2.0/Azure.Core.dll": { + "assemblyVersion": "1.22.0.0", + "fileVersion": "1.2200.22.6212" + } + } + }, + "Azure.Identity/1.5.0": { + "dependencies": { + "Azure.Core": "1.22.0", + "Microsoft.Identity.Client": "4.30.1", + "Microsoft.Identity.Client.Extensions.Msal": "2.18.4", + "System.Memory": "4.5.4", + "System.Security.Cryptography.ProtectedData": "4.5.0", + "System.Text.Json": "4.7.2", + "System.Threading.Tasks.Extensions": "4.5.4" + }, + "runtime": { + "lib/netstandard2.0/Azure.Identity.dll": { + "assemblyVersion": "1.5.0.0", + "fileVersion": "1.500.21.51401" + } + } + }, + "Hyak.Common/1.2.2": { + "dependencies": { + "NETStandard.Library": "2.0.3", + "Newtonsoft.Json": "10.0.3", + "System.Reflection": "4.3.0", + "System.Threading": "4.3.0" + }, + "runtime": { + "lib/netstandard1.4/Hyak.Common.dll": { + "assemblyVersion": "1.0.0.0", + "fileVersion": "1.2.2.0" + } + } + }, + "Microsoft.ApplicationInsights/2.12.0": { + "dependencies": { + "System.Diagnostics.DiagnosticSource": "4.6.0", + "System.Runtime.InteropServices": "4.3.0" + }, + "runtime": { + "lib/netstandard2.0/Microsoft.ApplicationInsights.dll": { + "assemblyVersion": "2.12.0.21496", + "fileVersion": "2.12.0.21496" + } + } + }, + "Microsoft.Azure.Common/2.2.1": { + "dependencies": { + "Hyak.Common": "1.2.2", + "NETStandard.Library": "2.0.3" + }, + "runtime": { + "lib/netstandard1.4/Microsoft.Azure.Common.dll": { + "assemblyVersion": "2.0.0.0", + "fileVersion": "2.2.1.0" + } + } + }, + "Microsoft.Azure.PowerShell.Authentication.Abstractions/1.3.57-preview": { + "dependencies": { + "Hyak.Common": "1.2.2", + "Microsoft.Azure.Common": "2.2.1", + "Microsoft.Rest.ClientRuntime": "2.3.23", + "Newtonsoft.Json": "10.0.3" + }, + "runtime": { + "lib/netstandard2.0/Microsoft.Azure.PowerShell.Authentication.Abstractions.dll": { + "assemblyVersion": "1.0.0.0", + "fileVersion": "1.3.57.0" + } + } + }, + "Microsoft.Azure.PowerShell.Clients.Aks/1.3.57-preview": { + "dependencies": { + "Microsoft.Rest.ClientRuntime": "2.3.23", + "Microsoft.Rest.ClientRuntime.Azure": "3.3.19", + "Newtonsoft.Json": "10.0.3" + }, + "runtime": { + "lib/netstandard2.0/Microsoft.Azure.PowerShell.Clients.Aks.dll": { + "assemblyVersion": "1.0.0.0", + "fileVersion": "1.3.57.0" + } + } + }, + "Microsoft.Azure.PowerShell.Clients.Authorization/1.3.57-preview": { + "dependencies": { + "Microsoft.Rest.ClientRuntime": "2.3.23", + "Microsoft.Rest.ClientRuntime.Azure": "3.3.19", + "Newtonsoft.Json": "10.0.3" + }, + "runtime": { + "lib/netstandard2.0/Microsoft.Azure.PowerShell.Clients.Authorization.dll": { + "assemblyVersion": "1.0.0.0", + "fileVersion": "1.3.57.0" + } + } + }, + "Microsoft.Azure.PowerShell.Clients.Compute/1.3.57-preview": { + "dependencies": { + "Microsoft.Rest.ClientRuntime": "2.3.23", + "Microsoft.Rest.ClientRuntime.Azure": "3.3.19", + "Newtonsoft.Json": "10.0.3" + }, + "runtime": { + "lib/netstandard2.0/Microsoft.Azure.PowerShell.Clients.Compute.dll": { + "assemblyVersion": "1.0.0.0", + "fileVersion": "1.3.57.0" + } + } + }, + "Microsoft.Azure.PowerShell.Clients.Graph.Rbac/1.3.57-preview": { + "dependencies": { + "Microsoft.Azure.PowerShell.Authentication.Abstractions": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Clients.ResourceManager": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Common": "1.3.57-preview", + "Microsoft.Rest.ClientRuntime": "2.3.23", + "Microsoft.Rest.ClientRuntime.Azure": "3.3.19", + "Newtonsoft.Json": "10.0.3" + }, + "runtime": { + "lib/netstandard2.0/Microsoft.Azure.PowerShell.Clients.Graph.Rbac.dll": { + "assemblyVersion": "1.0.0.0", + "fileVersion": "1.3.57.0" + } + } + }, + "Microsoft.Azure.PowerShell.Clients.KeyVault/1.3.57-preview": { + "dependencies": { + "Microsoft.Rest.ClientRuntime": "2.3.23", + "Microsoft.Rest.ClientRuntime.Azure": "3.3.19", + "Newtonsoft.Json": "10.0.3", + "System.Collections.NonGeneric": "4.3.0", + "System.Collections.Specialized": "4.3.0", + "System.Reflection": "4.3.0", + "System.Security.SecureString": "4.3.0", + "System.Xml.XmlDocument": "4.3.0", + "System.Xml.XmlSerializer": "4.3.0" + }, + "runtime": { + "lib/netstandard2.0/Microsoft.Azure.PowerShell.Clients.KeyVault.dll": { + "assemblyVersion": "1.0.0.0", + "fileVersion": "1.3.57.0" + } + } + }, + "Microsoft.Azure.PowerShell.Clients.Monitor/1.3.57-preview": { + "dependencies": { + "Microsoft.Rest.ClientRuntime": "2.3.23", + "Microsoft.Rest.ClientRuntime.Azure": "3.3.19", + "Newtonsoft.Json": "10.0.3", + "System.Collections.Specialized": "4.3.0", + "System.Reflection": "4.3.0", + "System.Security.SecureString": "4.3.0", + "System.Xml.XmlDocument": "4.3.0", + "System.Xml.XmlSerializer": "4.3.0" + }, + "runtime": { + "lib/netstandard2.0/Microsoft.Azure.PowerShell.Clients.Monitor.dll": { + "assemblyVersion": "1.0.0.0", + "fileVersion": "1.3.57.0" + } + } + }, + "Microsoft.Azure.PowerShell.Clients.Network/1.3.57-preview": { + "dependencies": { + "Microsoft.Azure.PowerShell.Authentication.Abstractions": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Common": "1.3.57-preview", + "Microsoft.Rest.ClientRuntime": "2.3.23", + "Microsoft.Rest.ClientRuntime.Azure": "3.3.19", + "Newtonsoft.Json": "10.0.3" + }, + "runtime": { + "lib/netstandard2.0/Microsoft.Azure.PowerShell.Clients.Network.dll": { + "assemblyVersion": "1.0.0.0", + "fileVersion": "1.3.57.0" + } + } + }, + "Microsoft.Azure.PowerShell.Clients.PolicyInsights/1.3.57-preview": { + "dependencies": { + "Microsoft.Rest.ClientRuntime": "2.3.23", + "Microsoft.Rest.ClientRuntime.Azure": "3.3.19", + "Newtonsoft.Json": "10.0.3" + }, + "runtime": { + "lib/netstandard2.0/Microsoft.Azure.PowerShell.Clients.PolicyInsights.dll": { + "assemblyVersion": "1.0.0.0", + "fileVersion": "1.3.57.0" + } + } + }, + "Microsoft.Azure.PowerShell.Clients.ResourceManager/1.3.57-preview": { + "dependencies": { + "Microsoft.Azure.PowerShell.Authentication.Abstractions": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Common": "1.3.57-preview", + "Microsoft.Rest.ClientRuntime": "2.3.23", + "Microsoft.Rest.ClientRuntime.Azure": "3.3.19", + "Newtonsoft.Json": "10.0.3" + }, + "runtime": { + "lib/netstandard2.0/Microsoft.Azure.PowerShell.Clients.ResourceManager.dll": { + "assemblyVersion": "1.0.0.0", + "fileVersion": "1.3.57.0" + } + } + }, + "Microsoft.Azure.PowerShell.Clients.Storage.Management/1.3.57-preview": { + "dependencies": { + "Microsoft.Rest.ClientRuntime": "2.3.23", + "Microsoft.Rest.ClientRuntime.Azure": "3.3.19", + "System.Collections.NonGeneric": "4.3.0" + }, + "runtime": { + "lib/netstandard2.0/Microsoft.Azure.PowerShell.Clients.Storage.Management.dll": { + "assemblyVersion": "1.0.0.0", + "fileVersion": "1.3.57.0" + } + } + }, + "Microsoft.Azure.PowerShell.Clients.Websites/1.3.57-preview": { + "dependencies": { + "Microsoft.Rest.ClientRuntime": "2.3.23", + "Microsoft.Rest.ClientRuntime.Azure": "3.3.19", + "Newtonsoft.Json": "10.0.3", + "System.Collections.Specialized": "4.3.0", + "System.Reflection": "4.3.0", + "System.Security.SecureString": "4.3.0", + "System.Xml.XmlDocument": "4.3.0", + "System.Xml.XmlSerializer": "4.3.0" + }, + "runtime": { + "lib/netstandard2.0/Microsoft.Azure.PowerShell.Clients.Websites.dll": { + "assemblyVersion": "1.0.0.0", + "fileVersion": "1.3.57.0" + } + } + }, + "Microsoft.Azure.PowerShell.Common/1.3.57-preview": { + "dependencies": { + "Hyak.Common": "1.2.2", + "Microsoft.ApplicationInsights": "2.12.0", + "Microsoft.Azure.Common": "2.2.1", + "Microsoft.Azure.PowerShell.Authentication.Abstractions": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Common.Share": "1.3.57-preview", + "Microsoft.Rest.ClientRuntime": "2.3.23", + "Microsoft.Rest.ClientRuntime.Azure": "3.3.19", + "Newtonsoft.Json": "10.0.3" + }, + "runtime": { + "lib/netstandard2.0/Microsoft.Azure.PowerShell.Common.dll": { + "assemblyVersion": "1.0.0.0", + "fileVersion": "1.3.57.0" + } + } + }, + "Microsoft.Azure.PowerShell.Common.Share/1.3.57-preview": { + "dependencies": { + "Hyak.Common": "1.2.2", + "Microsoft.Azure.Common": "2.2.1", + "Microsoft.Rest.ClientRuntime": "2.3.23", + "Microsoft.Rest.ClientRuntime.Azure": "3.3.19", + "Newtonsoft.Json": "10.0.3" + }, + "runtime": { + "lib/netstandard2.0/Microsoft.Azure.PowerShell.Common.Share.dll": { + "assemblyVersion": "1.0.0.0", + "fileVersion": "1.3.57.0" + } + } + }, + "Microsoft.Azure.PowerShell.Storage/1.3.57-preview": { + "dependencies": { + "Microsoft.Azure.PowerShell.Authentication.Abstractions": "1.3.57-preview", + "Microsoft.Rest.ClientRuntime": "2.3.23" + }, + "runtime": { + "lib/netstandard2.0/Microsoft.Azure.PowerShell.Storage.dll": { + "assemblyVersion": "1.0.0.0", + "fileVersion": "1.3.57.0" + } + } + }, + "Microsoft.Azure.PowerShell.Strategies/1.3.57-preview": { + "dependencies": { + "Microsoft.Rest.ClientRuntime": "2.3.23", + "Microsoft.Rest.ClientRuntime.Azure": "3.3.19", + "Newtonsoft.Json": "10.0.3" + }, + "runtime": { + "lib/netstandard2.0/Microsoft.Azure.PowerShell.Strategies.dll": { + "assemblyVersion": "1.0.0.0", + "fileVersion": "1.3.57.0" + } + } + }, + "Microsoft.Bcl.AsyncInterfaces/1.1.1": { + "dependencies": { + "System.Threading.Tasks.Extensions": "4.5.4" + }, + "runtime": { + "lib/netstandard2.0/Microsoft.Bcl.AsyncInterfaces.dll": { + "assemblyVersion": "1.0.0.0", + "fileVersion": "4.700.20.21406" + } + } + }, + "Microsoft.CSharp/4.5.0": { + "runtime": { + "lib/netstandard2.0/Microsoft.CSharp.dll": { + "assemblyVersion": "4.0.4.0", + "fileVersion": "4.6.26515.6" + } + } + }, + "Microsoft.Identity.Client/4.30.1": { + "dependencies": { + "Microsoft.CSharp": "4.5.0", + "NETStandard.Library": "2.0.3", + "System.ComponentModel.TypeConverter": "4.3.0", + "System.Diagnostics.Process": "4.3.0", + "System.Dynamic.Runtime": "4.3.0", + "System.Private.Uri": "4.3.2", + "System.Runtime.Serialization.Formatters": "4.3.0", + "System.Runtime.Serialization.Json": "4.3.0", + "System.Runtime.Serialization.Primitives": "4.3.0", + "System.Security.Cryptography.X509Certificates": "4.3.0", + "System.Security.SecureString": "4.3.0", + "System.Xml.XDocument": "4.3.0", + "System.Xml.XmlDocument": "4.3.0" + }, + "runtime": { + "lib/netstandard1.3/Microsoft.Identity.Client.dll": { + "assemblyVersion": "4.30.1.0", + "fileVersion": "4.30.1.0" + } + } + }, + "Microsoft.Identity.Client.Extensions.Msal/2.18.4": { + "dependencies": { + "Microsoft.Identity.Client": "4.30.1", + "System.Security.Cryptography.ProtectedData": "4.5.0" + }, + "runtime": { + "lib/netstandard2.0/Microsoft.Identity.Client.Extensions.Msal.dll": { + "assemblyVersion": "2.18.4.0", + "fileVersion": "2.18.4.0" + } + } + }, + "Microsoft.NETCore.Platforms/1.1.1": {}, + "Microsoft.NETCore.Targets/1.1.3": {}, + "Microsoft.Rest.ClientRuntime/2.3.23": { + "dependencies": { + "Newtonsoft.Json": "10.0.3" + }, + "runtime": { + "lib/netstandard2.0/Microsoft.Rest.ClientRuntime.dll": { + "assemblyVersion": "2.0.0.0", + "fileVersion": "2.3.23.0" + } + } + }, + "Microsoft.Rest.ClientRuntime.Azure/3.3.19": { + "dependencies": { + "Microsoft.Rest.ClientRuntime": "2.3.23", + "Newtonsoft.Json": "10.0.3" + }, + "runtime": { + "lib/netstandard2.0/Microsoft.Rest.ClientRuntime.Azure.dll": { + "assemblyVersion": "3.0.0.0", + "fileVersion": "3.3.18.0" + } + } + }, + "Microsoft.Win32.Primitives/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.1", + "Microsoft.NETCore.Targets": "1.1.3", + "System.Runtime": "4.3.0" + } + }, + "Microsoft.Win32.Registry/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.1", + "System.Collections": "4.3.0", + "System.Globalization": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Extensions": "4.3.0", + "System.Runtime.Handles": "4.3.0", + "System.Runtime.InteropServices": "4.3.0" + } + }, + "NETStandard.Library/2.0.3": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.1" + } + }, + "Newtonsoft.Json/10.0.3": { + "dependencies": { + "Microsoft.CSharp": "4.5.0", + "NETStandard.Library": "2.0.3", + "System.ComponentModel.TypeConverter": "4.3.0", + "System.Runtime.Serialization.Formatters": "4.3.0", + "System.Runtime.Serialization.Primitives": "4.3.0", + "System.Xml.XmlDocument": "4.3.0" + }, + "runtime": { + "lib/netstandard1.3/Newtonsoft.Json.dll": { + "assemblyVersion": "10.0.0.0", + "fileVersion": "10.0.3.21018" + } + } + }, + "PowerShellStandard.Library/5.1.0": {}, + "runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": {}, + "runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": {}, + "runtime.fedora.24-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": {}, + "runtime.native.System/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.1", + "Microsoft.NETCore.Targets": "1.1.3" + } + }, + "runtime.native.System.Net.Http/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.1", + "Microsoft.NETCore.Targets": "1.1.3" + } + }, + "runtime.native.System.Security.Cryptography.Apple/4.3.0": { + "dependencies": { + "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.Apple": "4.3.0" + } + }, + "runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { + "dependencies": { + "runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", + "runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", + "runtime.fedora.24-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", + "runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", + "runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", + "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", + "runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", + "runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", + "runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", + "runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0" + } + }, + "runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": {}, + "runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": {}, + "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.Apple/4.3.0": {}, + "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": {}, + "runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": {}, + "runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": {}, + "runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": {}, + "runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": {}, + "System.Buffers/4.5.1": { + "runtime": { + "lib/netstandard2.0/System.Buffers.dll": { + "assemblyVersion": "4.0.3.0", + "fileVersion": "4.6.28619.1" + } + } + }, + "System.Collections/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.1", + "Microsoft.NETCore.Targets": "1.1.3", + "System.Runtime": "4.3.0" + } + }, + "System.Collections.Concurrent/4.3.0": { + "dependencies": { + "System.Collections": "4.3.0", + "System.Diagnostics.Debug": "4.3.0", + "System.Diagnostics.Tracing": "4.3.0", + "System.Globalization": "4.3.0", + "System.Reflection": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Extensions": "4.3.0", + "System.Threading": "4.3.0", + "System.Threading.Tasks": "4.3.0" + }, + "runtime": { + "lib/netstandard1.3/System.Collections.Concurrent.dll": { + "assemblyVersion": "4.0.13.0", + "fileVersion": "4.6.24705.1" + } + } + }, + "System.Collections.NonGeneric/4.3.0": { + "dependencies": { + "System.Diagnostics.Debug": "4.3.0", + "System.Globalization": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Extensions": "4.3.0", + "System.Threading": "4.3.0" + }, + "runtime": { + "lib/netstandard1.3/System.Collections.NonGeneric.dll": { + "assemblyVersion": "4.0.2.0", + "fileVersion": "4.6.24705.1" + } + } + }, + "System.Collections.Specialized/4.3.0": { + "dependencies": { + "System.Collections.NonGeneric": "4.3.0", + "System.Globalization": "4.3.0", + "System.Globalization.Extensions": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Extensions": "4.3.0", + "System.Threading": "4.3.0" + }, + "runtime": { + "lib/netstandard1.3/System.Collections.Specialized.dll": { + "assemblyVersion": "4.0.2.0", + "fileVersion": "4.6.24705.1" + } + } + }, + "System.ComponentModel/4.3.0": { + "dependencies": { + "System.Runtime": "4.3.0" + }, + "runtime": { + "lib/netstandard1.3/System.ComponentModel.dll": { + "assemblyVersion": "4.0.2.0", + "fileVersion": "4.6.24705.1" + } + } + }, + "System.ComponentModel.Primitives/4.3.0": { + "dependencies": { + "System.ComponentModel": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0" + }, + "runtime": { + "lib/netstandard1.0/System.ComponentModel.Primitives.dll": { + "assemblyVersion": "4.1.1.0", + "fileVersion": "4.6.24705.1" + } + } + }, + "System.ComponentModel.TypeConverter/4.3.0": { + "dependencies": { + "System.Collections": "4.3.0", + "System.Collections.NonGeneric": "4.3.0", + "System.Collections.Specialized": "4.3.0", + "System.ComponentModel": "4.3.0", + "System.ComponentModel.Primitives": "4.3.0", + "System.Globalization": "4.3.0", + "System.Linq": "4.3.0", + "System.Reflection": "4.3.0", + "System.Reflection.Extensions": "4.3.0", + "System.Reflection.Primitives": "4.3.0", + "System.Reflection.TypeExtensions": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Extensions": "4.3.0", + "System.Threading": "4.3.0" + }, + "runtime": { + "lib/netstandard1.5/System.ComponentModel.TypeConverter.dll": { + "assemblyVersion": "4.1.1.0", + "fileVersion": "4.6.24705.1" + } + } + }, + "System.Diagnostics.Debug/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.1", + "Microsoft.NETCore.Targets": "1.1.3", + "System.Runtime": "4.3.0" + } + }, + "System.Diagnostics.DiagnosticSource/4.6.0": { + "dependencies": { + "System.Memory": "4.5.4" + }, + "runtime": { + "lib/netstandard1.3/System.Diagnostics.DiagnosticSource.dll": { + "assemblyVersion": "4.0.4.0", + "fileVersion": "4.700.19.46214" + } + } + }, + "System.Diagnostics.Process/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.1", + "Microsoft.Win32.Primitives": "4.3.0", + "Microsoft.Win32.Registry": "4.3.0", + "System.Collections": "4.3.0", + "System.Diagnostics.Debug": "4.3.0", + "System.Globalization": "4.3.0", + "System.IO": "4.3.0", + "System.IO.FileSystem": "4.3.0", + "System.IO.FileSystem.Primitives": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Extensions": "4.3.0", + "System.Runtime.Handles": "4.3.0", + "System.Runtime.InteropServices": "4.3.0", + "System.Text.Encoding": "4.3.0", + "System.Text.Encoding.Extensions": "4.3.0", + "System.Threading": "4.3.0", + "System.Threading.Tasks": "4.3.0", + "System.Threading.Thread": "4.3.0", + "System.Threading.ThreadPool": "4.3.0", + "runtime.native.System": "4.3.0" + } + }, + "System.Diagnostics.Tools/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.1", + "Microsoft.NETCore.Targets": "1.1.3", + "System.Runtime": "4.3.0" + } + }, + "System.Diagnostics.Tracing/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.1", + "Microsoft.NETCore.Targets": "1.1.3", + "System.Runtime": "4.3.0" + } + }, + "System.Dynamic.Runtime/4.3.0": { + "dependencies": { + "System.Collections": "4.3.0", + "System.Diagnostics.Debug": "4.3.0", + "System.Linq": "4.3.0", + "System.Linq.Expressions": "4.3.0", + "System.ObjectModel": "4.3.0", + "System.Reflection": "4.3.0", + "System.Reflection.Emit": "4.3.0", + "System.Reflection.Emit.ILGeneration": "4.3.0", + "System.Reflection.Primitives": "4.3.0", + "System.Reflection.TypeExtensions": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Extensions": "4.3.0", + "System.Threading": "4.3.0" + }, + "runtime": { + "lib/netstandard1.3/System.Dynamic.Runtime.dll": { + "assemblyVersion": "4.0.12.0", + "fileVersion": "4.6.24705.1" + } + } + }, + "System.Globalization/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.1", + "Microsoft.NETCore.Targets": "1.1.3", + "System.Runtime": "4.3.0" + } + }, + "System.Globalization.Calendars/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.1", + "Microsoft.NETCore.Targets": "1.1.3", + "System.Globalization": "4.3.0", + "System.Runtime": "4.3.0" + } + }, + "System.Globalization.Extensions/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.1", + "System.Globalization": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Extensions": "4.3.0", + "System.Runtime.InteropServices": "4.3.0" + } + }, + "System.IO/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.1", + "Microsoft.NETCore.Targets": "1.1.3", + "System.Runtime": "4.3.0", + "System.Text.Encoding": "4.3.0", + "System.Threading.Tasks": "4.3.0" + } + }, + "System.IO.FileSystem/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.1", + "Microsoft.NETCore.Targets": "1.1.3", + "System.IO": "4.3.0", + "System.IO.FileSystem.Primitives": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Handles": "4.3.0", + "System.Text.Encoding": "4.3.0", + "System.Threading.Tasks": "4.3.0" + } + }, + "System.IO.FileSystem.Primitives/4.3.0": { + "dependencies": { + "System.Runtime": "4.3.0" + }, + "runtime": { + "lib/netstandard1.3/System.IO.FileSystem.Primitives.dll": { + "assemblyVersion": "4.0.2.0", + "fileVersion": "4.6.24705.1" + } + } + }, + "System.Linq/4.3.0": { + "dependencies": { + "System.Collections": "4.3.0", + "System.Diagnostics.Debug": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Extensions": "4.3.0" + }, + "runtime": { + "lib/netstandard1.6/System.Linq.dll": { + "assemblyVersion": "4.1.1.0", + "fileVersion": "4.6.24705.1" + } + } + }, + "System.Linq.Expressions/4.3.0": { + "dependencies": { + "System.Collections": "4.3.0", + "System.Diagnostics.Debug": "4.3.0", + "System.Globalization": "4.3.0", + "System.IO": "4.3.0", + "System.Linq": "4.3.0", + "System.ObjectModel": "4.3.0", + "System.Reflection": "4.3.0", + "System.Reflection.Emit": "4.3.0", + "System.Reflection.Emit.ILGeneration": "4.3.0", + "System.Reflection.Emit.Lightweight": "4.3.0", + "System.Reflection.Extensions": "4.3.0", + "System.Reflection.Primitives": "4.3.0", + "System.Reflection.TypeExtensions": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Extensions": "4.3.0", + "System.Threading": "4.3.0" + }, + "runtime": { + "lib/netstandard1.6/System.Linq.Expressions.dll": { + "assemblyVersion": "4.1.1.0", + "fileVersion": "4.6.24705.1" + } + } + }, + "System.Memory/4.5.4": { + "dependencies": { + "System.Buffers": "4.5.1", + "System.Numerics.Vectors": "4.5.0", + "System.Runtime.CompilerServices.Unsafe": "4.7.1" + }, + "runtime": { + "lib/netstandard2.0/System.Memory.dll": { + "assemblyVersion": "4.0.1.1", + "fileVersion": "4.6.28619.1" + } + } + }, + "System.Memory.Data/1.0.2": { + "dependencies": { + "System.Text.Encodings.Web": "4.7.2", + "System.Text.Json": "4.7.2" + }, + "runtime": { + "lib/netstandard2.0/System.Memory.Data.dll": { + "assemblyVersion": "1.0.2.0", + "fileVersion": "1.0.221.20802" + } + } + }, + "System.Numerics.Vectors/4.5.0": { + "runtime": { + "lib/netstandard2.0/System.Numerics.Vectors.dll": { + "assemblyVersion": "4.1.4.0", + "fileVersion": "4.6.26515.6" + } + } + }, + "System.ObjectModel/4.3.0": { + "dependencies": { + "System.Collections": "4.3.0", + "System.Diagnostics.Debug": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Threading": "4.3.0" + }, + "runtime": { + "lib/netstandard1.3/System.ObjectModel.dll": { + "assemblyVersion": "4.0.13.0", + "fileVersion": "4.6.24705.1" + } + } + }, + "System.Private.DataContractSerialization/4.3.0": { + "dependencies": { + "System.Collections": "4.3.0", + "System.Collections.Concurrent": "4.3.0", + "System.Diagnostics.Debug": "4.3.0", + "System.Globalization": "4.3.0", + "System.IO": "4.3.0", + "System.Linq": "4.3.0", + "System.Reflection": "4.3.0", + "System.Reflection.Emit.ILGeneration": "4.3.0", + "System.Reflection.Emit.Lightweight": "4.3.0", + "System.Reflection.Extensions": "4.3.0", + "System.Reflection.Primitives": "4.3.0", + "System.Reflection.TypeExtensions": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Extensions": "4.3.0", + "System.Runtime.Serialization.Primitives": "4.3.0", + "System.Text.Encoding": "4.3.0", + "System.Text.Encoding.Extensions": "4.3.0", + "System.Text.RegularExpressions": "4.3.0", + "System.Threading": "4.3.0", + "System.Threading.Tasks": "4.3.0", + "System.Xml.ReaderWriter": "4.3.0", + "System.Xml.XDocument": "4.3.0", + "System.Xml.XmlDocument": "4.3.0", + "System.Xml.XmlSerializer": "4.3.0" + }, + "runtime": { + "lib/netstandard1.3/System.Private.DataContractSerialization.dll": { + "assemblyVersion": "4.1.2.0", + "fileVersion": "4.6.24705.1" + } + } + }, + "System.Private.Uri/4.3.2": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.1", + "Microsoft.NETCore.Targets": "1.1.3" + } + }, + "System.Reflection/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.1", + "Microsoft.NETCore.Targets": "1.1.3", + "System.IO": "4.3.0", + "System.Reflection.Primitives": "4.3.0", + "System.Runtime": "4.3.0" + } + }, + "System.Reflection.Emit/4.3.0": { + "dependencies": { + "System.IO": "4.3.0", + "System.Reflection": "4.3.0", + "System.Reflection.Emit.ILGeneration": "4.3.0", + "System.Reflection.Primitives": "4.3.0", + "System.Runtime": "4.3.0" + }, + "runtime": { + "lib/netstandard1.3/System.Reflection.Emit.dll": { + "assemblyVersion": "4.0.2.0", + "fileVersion": "4.6.24705.1" + } + } + }, + "System.Reflection.Emit.ILGeneration/4.3.0": { + "dependencies": { + "System.Reflection": "4.3.0", + "System.Reflection.Primitives": "4.3.0", + "System.Runtime": "4.3.0" + }, + "runtime": { + "lib/netstandard1.3/System.Reflection.Emit.ILGeneration.dll": { + "assemblyVersion": "4.0.2.0", + "fileVersion": "4.6.24705.1" + } + } + }, + "System.Reflection.Emit.Lightweight/4.3.0": { + "dependencies": { + "System.Reflection": "4.3.0", + "System.Reflection.Emit.ILGeneration": "4.3.0", + "System.Reflection.Primitives": "4.3.0", + "System.Runtime": "4.3.0" + }, + "runtime": { + "lib/netstandard1.3/System.Reflection.Emit.Lightweight.dll": { + "assemblyVersion": "4.0.2.0", + "fileVersion": "4.6.24705.1" + } + } + }, + "System.Reflection.Extensions/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.1", + "Microsoft.NETCore.Targets": "1.1.3", + "System.Reflection": "4.3.0", + "System.Runtime": "4.3.0" + } + }, + "System.Reflection.Primitives/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.1", + "Microsoft.NETCore.Targets": "1.1.3", + "System.Runtime": "4.3.0" + } + }, + "System.Reflection.TypeExtensions/4.3.0": { + "dependencies": { + "System.Reflection": "4.3.0", + "System.Runtime": "4.3.0" + }, + "runtime": { + "lib/netstandard1.5/System.Reflection.TypeExtensions.dll": { + "assemblyVersion": "4.1.1.0", + "fileVersion": "4.6.24705.1" + } + } + }, + "System.Resources.ResourceManager/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.1", + "Microsoft.NETCore.Targets": "1.1.3", + "System.Globalization": "4.3.0", + "System.Reflection": "4.3.0", + "System.Runtime": "4.3.0" + } + }, + "System.Runtime/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.1", + "Microsoft.NETCore.Targets": "1.1.3" + } + }, + "System.Runtime.CompilerServices.Unsafe/4.7.1": { + "runtime": { + "lib/netstandard2.0/System.Runtime.CompilerServices.Unsafe.dll": { + "assemblyVersion": "4.0.6.0", + "fileVersion": "4.700.20.12001" + } + } + }, + "System.Runtime.Extensions/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.1", + "Microsoft.NETCore.Targets": "1.1.3", + "System.Runtime": "4.3.0" + } + }, + "System.Runtime.Handles/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.1", + "Microsoft.NETCore.Targets": "1.1.3", + "System.Runtime": "4.3.0" + } + }, + "System.Runtime.InteropServices/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.1", + "Microsoft.NETCore.Targets": "1.1.3", + "System.Reflection": "4.3.0", + "System.Reflection.Primitives": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Handles": "4.3.0" + } + }, + "System.Runtime.Numerics/4.3.0": { + "dependencies": { + "System.Globalization": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Extensions": "4.3.0" + }, + "runtime": { + "lib/netstandard1.3/System.Runtime.Numerics.dll": { + "assemblyVersion": "4.0.2.0", + "fileVersion": "4.6.24705.1" + } + } + }, + "System.Runtime.Serialization.Formatters/4.3.0": { + "dependencies": { + "System.Collections": "4.3.0", + "System.Reflection": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Serialization.Primitives": "4.3.0" + }, + "runtime": { + "lib/netstandard1.4/System.Runtime.Serialization.Formatters.dll": { + "assemblyVersion": "4.0.1.0", + "fileVersion": "4.6.24705.1" + } + } + }, + "System.Runtime.Serialization.Json/4.3.0": { + "dependencies": { + "System.IO": "4.3.0", + "System.Private.DataContractSerialization": "4.3.0", + "System.Runtime": "4.3.0" + }, + "runtime": { + "lib/netstandard1.3/System.Runtime.Serialization.Json.dll": { + "assemblyVersion": "4.0.3.0", + "fileVersion": "4.6.24705.1" + } + } + }, + "System.Runtime.Serialization.Primitives/4.3.0": { + "dependencies": { + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0" + }, + "runtime": { + "lib/netstandard1.3/System.Runtime.Serialization.Primitives.dll": { + "assemblyVersion": "4.1.2.0", + "fileVersion": "4.6.24705.1" + } + } + }, + "System.Security.Cryptography.Algorithms/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.1", + "System.Collections": "4.3.0", + "System.IO": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Extensions": "4.3.0", + "System.Runtime.Handles": "4.3.0", + "System.Runtime.InteropServices": "4.3.0", + "System.Runtime.Numerics": "4.3.0", + "System.Security.Cryptography.Encoding": "4.3.0", + "System.Security.Cryptography.Primitives": "4.3.0", + "System.Text.Encoding": "4.3.0", + "runtime.native.System.Security.Cryptography.Apple": "4.3.0", + "runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0" + } + }, + "System.Security.Cryptography.Cng/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.1", + "System.IO": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Extensions": "4.3.0", + "System.Runtime.Handles": "4.3.0", + "System.Runtime.InteropServices": "4.3.0", + "System.Security.Cryptography.Algorithms": "4.3.0", + "System.Security.Cryptography.Encoding": "4.3.0", + "System.Security.Cryptography.Primitives": "4.3.0", + "System.Text.Encoding": "4.3.0" + } + }, + "System.Security.Cryptography.Csp/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.1", + "System.IO": "4.3.0", + "System.Reflection": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Extensions": "4.3.0", + "System.Runtime.Handles": "4.3.0", + "System.Runtime.InteropServices": "4.3.0", + "System.Security.Cryptography.Algorithms": "4.3.0", + "System.Security.Cryptography.Encoding": "4.3.0", + "System.Security.Cryptography.Primitives": "4.3.0", + "System.Text.Encoding": "4.3.0", + "System.Threading": "4.3.0" + } + }, + "System.Security.Cryptography.Encoding/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.1", + "System.Collections": "4.3.0", + "System.Collections.Concurrent": "4.3.0", + "System.Linq": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Extensions": "4.3.0", + "System.Runtime.Handles": "4.3.0", + "System.Runtime.InteropServices": "4.3.0", + "System.Security.Cryptography.Primitives": "4.3.0", + "System.Text.Encoding": "4.3.0", + "runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0" + } + }, + "System.Security.Cryptography.OpenSsl/4.3.0": { + "dependencies": { + "System.Collections": "4.3.0", + "System.IO": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Extensions": "4.3.0", + "System.Runtime.Handles": "4.3.0", + "System.Runtime.InteropServices": "4.3.0", + "System.Runtime.Numerics": "4.3.0", + "System.Security.Cryptography.Algorithms": "4.3.0", + "System.Security.Cryptography.Encoding": "4.3.0", + "System.Security.Cryptography.Primitives": "4.3.0", + "System.Text.Encoding": "4.3.0", + "runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0" + }, + "runtime": { + "lib/netstandard1.6/System.Security.Cryptography.OpenSsl.dll": { + "assemblyVersion": "4.0.0.0", + "fileVersion": "1.0.24212.1" + } + } + }, + "System.Security.Cryptography.Primitives/4.3.0": { + "dependencies": { + "System.Diagnostics.Debug": "4.3.0", + "System.Globalization": "4.3.0", + "System.IO": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Threading": "4.3.0", + "System.Threading.Tasks": "4.3.0" + }, + "runtime": { + "lib/netstandard1.3/System.Security.Cryptography.Primitives.dll": { + "assemblyVersion": "4.0.1.0", + "fileVersion": "4.6.24705.1" + } + } + }, + "System.Security.Cryptography.ProtectedData/4.5.0": { + "dependencies": { + "System.Memory": "4.5.4" + }, + "runtime": { + "lib/netstandard2.0/System.Security.Cryptography.ProtectedData.dll": { + "assemblyVersion": "4.0.3.0", + "fileVersion": "4.6.26515.6" + } + } + }, + "System.Security.Cryptography.X509Certificates/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.1", + "System.Collections": "4.3.0", + "System.Diagnostics.Debug": "4.3.0", + "System.Globalization": "4.3.0", + "System.Globalization.Calendars": "4.3.0", + "System.IO": "4.3.0", + "System.IO.FileSystem": "4.3.0", + "System.IO.FileSystem.Primitives": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Extensions": "4.3.0", + "System.Runtime.Handles": "4.3.0", + "System.Runtime.InteropServices": "4.3.0", + "System.Runtime.Numerics": "4.3.0", + "System.Security.Cryptography.Algorithms": "4.3.0", + "System.Security.Cryptography.Cng": "4.3.0", + "System.Security.Cryptography.Csp": "4.3.0", + "System.Security.Cryptography.Encoding": "4.3.0", + "System.Security.Cryptography.OpenSsl": "4.3.0", + "System.Security.Cryptography.Primitives": "4.3.0", + "System.Text.Encoding": "4.3.0", + "System.Threading": "4.3.0", + "runtime.native.System": "4.3.0", + "runtime.native.System.Net.Http": "4.3.0", + "runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0" + } + }, + "System.Security.SecureString/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.1", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Handles": "4.3.0", + "System.Runtime.InteropServices": "4.3.0", + "System.Security.Cryptography.Primitives": "4.3.0", + "System.Text.Encoding": "4.3.0", + "System.Threading": "4.3.0" + } + }, + "System.Text.Encoding/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.1", + "Microsoft.NETCore.Targets": "1.1.3", + "System.Runtime": "4.3.0" + } + }, + "System.Text.Encoding.Extensions/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.1", + "Microsoft.NETCore.Targets": "1.1.3", + "System.Runtime": "4.3.0", + "System.Text.Encoding": "4.3.0" + } + }, + "System.Text.Encodings.Web/4.7.2": { + "dependencies": { + "System.Buffers": "4.5.1", + "System.Memory": "4.5.4" + }, + "runtime": { + "lib/netstandard2.0/System.Text.Encodings.Web.dll": { + "assemblyVersion": "4.0.5.1", + "fileVersion": "4.700.21.11602" + } + } + }, + "System.Text.Json/4.7.2": { + "dependencies": { + "Microsoft.Bcl.AsyncInterfaces": "1.1.1", + "System.Buffers": "4.5.1", + "System.Memory": "4.5.4", + "System.Numerics.Vectors": "4.5.0", + "System.Runtime.CompilerServices.Unsafe": "4.7.1", + "System.Text.Encodings.Web": "4.7.2", + "System.Threading.Tasks.Extensions": "4.5.4" + }, + "runtime": { + "lib/netstandard2.0/System.Text.Json.dll": { + "assemblyVersion": "4.0.1.2", + "fileVersion": "4.700.20.21406" + } + } + }, + "System.Text.RegularExpressions/4.3.0": { + "dependencies": { + "System.Collections": "4.3.0", + "System.Globalization": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Extensions": "4.3.0", + "System.Threading": "4.3.0" + }, + "runtime": { + "lib/netstandard1.6/System.Text.RegularExpressions.dll": { + "assemblyVersion": "4.1.1.0", + "fileVersion": "4.6.24705.1" + } + } + }, + "System.Threading/4.3.0": { + "dependencies": { + "System.Runtime": "4.3.0", + "System.Threading.Tasks": "4.3.0" + }, + "runtime": { + "lib/netstandard1.3/System.Threading.dll": { + "assemblyVersion": "4.0.12.0", + "fileVersion": "4.6.24705.1" + } + } + }, + "System.Threading.Tasks/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.1", + "Microsoft.NETCore.Targets": "1.1.3", + "System.Runtime": "4.3.0" + } + }, + "System.Threading.Tasks.Extensions/4.5.4": { + "dependencies": { + "System.Runtime.CompilerServices.Unsafe": "4.7.1" + }, + "runtime": { + "lib/netstandard2.0/System.Threading.Tasks.Extensions.dll": { + "assemblyVersion": "4.2.0.1", + "fileVersion": "4.6.28619.1" + } + } + }, + "System.Threading.Thread/4.3.0": { + "dependencies": { + "System.Runtime": "4.3.0" + }, + "runtime": { + "lib/netstandard1.3/System.Threading.Thread.dll": { + "assemblyVersion": "4.0.1.0", + "fileVersion": "4.6.24705.1" + } + } + }, + "System.Threading.ThreadPool/4.3.0": { + "dependencies": { + "System.Runtime": "4.3.0", + "System.Runtime.Handles": "4.3.0" + }, + "runtime": { + "lib/netstandard1.3/System.Threading.ThreadPool.dll": { + "assemblyVersion": "4.0.11.0", + "fileVersion": "4.6.24705.1" + } + } + }, + "System.Xml.ReaderWriter/4.3.0": { + "dependencies": { + "System.Collections": "4.3.0", + "System.Diagnostics.Debug": "4.3.0", + "System.Globalization": "4.3.0", + "System.IO": "4.3.0", + "System.IO.FileSystem": "4.3.0", + "System.IO.FileSystem.Primitives": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Extensions": "4.3.0", + "System.Runtime.InteropServices": "4.3.0", + "System.Text.Encoding": "4.3.0", + "System.Text.Encoding.Extensions": "4.3.0", + "System.Text.RegularExpressions": "4.3.0", + "System.Threading.Tasks": "4.3.0", + "System.Threading.Tasks.Extensions": "4.5.4" + }, + "runtime": { + "lib/netstandard1.3/System.Xml.ReaderWriter.dll": { + "assemblyVersion": "4.1.0.0", + "fileVersion": "4.6.24705.1" + } + } + }, + "System.Xml.XDocument/4.3.0": { + "dependencies": { + "System.Collections": "4.3.0", + "System.Diagnostics.Debug": "4.3.0", + "System.Diagnostics.Tools": "4.3.0", + "System.Globalization": "4.3.0", + "System.IO": "4.3.0", + "System.Reflection": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Extensions": "4.3.0", + "System.Text.Encoding": "4.3.0", + "System.Threading": "4.3.0", + "System.Xml.ReaderWriter": "4.3.0" + }, + "runtime": { + "lib/netstandard1.3/System.Xml.XDocument.dll": { + "assemblyVersion": "4.0.12.0", + "fileVersion": "4.6.24705.1" + } + } + }, + "System.Xml.XmlDocument/4.3.0": { + "dependencies": { + "System.Collections": "4.3.0", + "System.Diagnostics.Debug": "4.3.0", + "System.Globalization": "4.3.0", + "System.IO": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Extensions": "4.3.0", + "System.Text.Encoding": "4.3.0", + "System.Threading": "4.3.0", + "System.Xml.ReaderWriter": "4.3.0" + }, + "runtime": { + "lib/netstandard1.3/System.Xml.XmlDocument.dll": { + "assemblyVersion": "4.0.2.0", + "fileVersion": "4.6.24705.1" + } + } + }, + "System.Xml.XmlSerializer/4.3.0": { + "dependencies": { + "System.Collections": "4.3.0", + "System.Globalization": "4.3.0", + "System.IO": "4.3.0", + "System.Linq": "4.3.0", + "System.Reflection": "4.3.0", + "System.Reflection.Emit": "4.3.0", + "System.Reflection.Emit.ILGeneration": "4.3.0", + "System.Reflection.Extensions": "4.3.0", + "System.Reflection.Primitives": "4.3.0", + "System.Reflection.TypeExtensions": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Extensions": "4.3.0", + "System.Text.RegularExpressions": "4.3.0", + "System.Threading": "4.3.0", + "System.Xml.ReaderWriter": "4.3.0", + "System.Xml.XmlDocument": "4.3.0" + }, + "runtime": { + "lib/netstandard1.3/System.Xml.XmlSerializer.dll": { + "assemblyVersion": "4.0.12.0", + "fileVersion": "4.6.24705.1" + } + } + }, + "Microsoft.Azure.PowerShell.Authentication/1.0.0": { + "dependencies": { + "Azure.Core": "1.22.0", + "Azure.Identity": "1.5.0", + "Hyak.Common": "1.2.2", + "Microsoft.ApplicationInsights": "2.12.0", + "Microsoft.Azure.Common": "2.2.1", + "Microsoft.Azure.PowerShell.Authentication.Abstractions": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Clients.Aks": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Clients.Authorization": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Clients.Compute": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Clients.Graph.Rbac": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Clients.KeyVault": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Clients.Monitor": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Clients.Network": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Clients.PolicyInsights": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Clients.ResourceManager": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Clients.Storage.Management": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Clients.Websites": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Common": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Common.Share": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Storage": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Strategies": "1.3.57-preview", + "Microsoft.Rest.ClientRuntime": "2.3.23", + "Microsoft.Rest.ClientRuntime.Azure": "3.3.19", + "Newtonsoft.Json": "10.0.3" + }, + "runtime": { + "Microsoft.Azure.PowerShell.Authentication.dll": {} + } + } + } + }, + "libraries": { + "Microsoft.Azure.PowerShell.Authentication.ResourceManager/1.0.0": { + "type": "project", + "serviceable": false, + "sha512": "" + }, + "Azure.Core/1.22.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-ze/xRCHSSDe5TIk5vBDbVrauW1EN7UIbnBvIBfMH8KSt/I9+/7yPAjTBDgNBk0IwG6WBV+BBHp4IUtS/PGAQwQ==", + "path": "azure.core/1.22.0", + "hashPath": "azure.core.1.22.0.nupkg.sha512" + }, + "Azure.Identity/1.5.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-VfF88dqrgKXZNOS/y4XrX/jmIfP3pkY+hBUzBNpoKml1nR+QshX6XlXWyToLtWV80TDQ1CmUVCJksktDg5+j1w==", + "path": "azure.identity/1.5.0", + "hashPath": "azure.identity.1.5.0.nupkg.sha512" + }, + "Hyak.Common/1.2.2": { + "type": "package", + "serviceable": true, + "sha512": "sha512-uZpnFn48nSQwHcO0/GSBZ7ExaO0sTXKv8KariXXEWLaB4Q3AeQoprYG4WpKsCT0ByW3YffETivgc5rcH5RRDvQ==", + "path": "hyak.common/1.2.2", + "hashPath": "hyak.common.1.2.2.nupkg.sha512" + }, + "Microsoft.ApplicationInsights/2.12.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-4vZcVaxywAzfLm5mAc2/llaZQTzbCqu9KirxxI/t49AkZH5Qxf7JxuAMUuv2/6JEdOOkGDzpvdrrIlf6LkFGcg==", + "path": "microsoft.applicationinsights/2.12.0", + "hashPath": "microsoft.applicationinsights.2.12.0.nupkg.sha512" + }, + "Microsoft.Azure.Common/2.2.1": { + "type": "package", + "serviceable": true, + "sha512": "sha512-abzRooh4ACKjzAKxRB6r+SHKW3d+IrLcgtVG81D+3kQU/OMjAZS1oDp9CDalhSbmxa84u0MHM5N+AKeTtKPoiw==", + "path": "microsoft.azure.common/2.2.1", + "hashPath": "microsoft.azure.common.2.2.1.nupkg.sha512" + }, + "Microsoft.Azure.PowerShell.Authentication.Abstractions/1.3.57-preview": { + "type": "package", + "serviceable": true, + "sha512": "sha512-bKDPidNeqBpTDikPnIuoMoGd26pD2PNE41cut0ASwL5exJwLNggYO55U+f/cJkgjCUMR8i5nqnlfpGHSS1I0vw==", + "path": "microsoft.azure.powershell.authentication.abstractions/1.3.57-preview", + "hashPath": "microsoft.azure.powershell.authentication.abstractions.1.3.57-preview.nupkg.sha512" + }, + "Microsoft.Azure.PowerShell.Clients.Aks/1.3.57-preview": { + "type": "package", + "serviceable": true, + "sha512": "sha512-sUGkvOvpqlEK5zdZ7HWaou3GY5bnlNrE0LuZ137+TsNfgx2E3+0Ika3a02i/9+niDDf60xj4LaNOYDSuK5zdJA==", + "path": "microsoft.azure.powershell.clients.aks/1.3.57-preview", + "hashPath": "microsoft.azure.powershell.clients.aks.1.3.57-preview.nupkg.sha512" + }, + "Microsoft.Azure.PowerShell.Clients.Authorization/1.3.57-preview": { + "type": "package", + "serviceable": true, + "sha512": "sha512-Q760F40/qfas2Al+GQhhE4gJt768pQPxlCjqrjjkukgVsq+X/M8IqpCeBzbRTiiyerhcjJoyNxqlGuZpUhqGxw==", + "path": "microsoft.azure.powershell.clients.authorization/1.3.57-preview", + "hashPath": "microsoft.azure.powershell.clients.authorization.1.3.57-preview.nupkg.sha512" + }, + "Microsoft.Azure.PowerShell.Clients.Compute/1.3.57-preview": { + "type": "package", + "serviceable": true, + "sha512": "sha512-1fcsBdYMmEJPMPN8EAgJkaJ2WxxTKH3VcLECYdL2cfg2bgN8CKbbjSvarrXEezhyduE+LdYnL0e8Pigsnaj55Q==", + "path": "microsoft.azure.powershell.clients.compute/1.3.57-preview", + "hashPath": "microsoft.azure.powershell.clients.compute.1.3.57-preview.nupkg.sha512" + }, + "Microsoft.Azure.PowerShell.Clients.Graph.Rbac/1.3.57-preview": { + "type": "package", + "serviceable": true, + "sha512": "sha512-BIMthJ1x2vQAN3iWChnNj8BfgrXvKXn+n06E0/h2MNurMXbAOn5eiPIfE8bnj2BO99uSh1ns09yEgOTPJIvZBQ==", + "path": "microsoft.azure.powershell.clients.graph.rbac/1.3.57-preview", + "hashPath": "microsoft.azure.powershell.clients.graph.rbac.1.3.57-preview.nupkg.sha512" + }, + "Microsoft.Azure.PowerShell.Clients.KeyVault/1.3.57-preview": { + "type": "package", + "serviceable": true, + "sha512": "sha512-MfvwM8ABj/EswmYu0Bf/8kyAO6kUv2zYSihVn384SVmypomVKUu69GN0VXKbmGaovPI8v3H41Ldp7DqbPRun5A==", + "path": "microsoft.azure.powershell.clients.keyvault/1.3.57-preview", + "hashPath": "microsoft.azure.powershell.clients.keyvault.1.3.57-preview.nupkg.sha512" + }, + "Microsoft.Azure.PowerShell.Clients.Monitor/1.3.57-preview": { + "type": "package", + "serviceable": true, + "sha512": "sha512-UyCKG5BWVjYFRtH2JNx6f4KdccaSqww2y0OE2PYgib8VhLqkoPr/BQg6vKzaGsghLIerZ/egQ7ntPPw3PCtS3w==", + "path": "microsoft.azure.powershell.clients.monitor/1.3.57-preview", + "hashPath": "microsoft.azure.powershell.clients.monitor.1.3.57-preview.nupkg.sha512" + }, + "Microsoft.Azure.PowerShell.Clients.Network/1.3.57-preview": { + "type": "package", + "serviceable": true, + "sha512": "sha512-YAAHxw+zzvkGNWAi668NSoTR+V/7vf+gRhu1oFa1O1/f2NGpz5XuqPrQyAPrri64hKqB/k3OMrM7sjlIv16dAg==", + "path": "microsoft.azure.powershell.clients.network/1.3.57-preview", + "hashPath": "microsoft.azure.powershell.clients.network.1.3.57-preview.nupkg.sha512" + }, + "Microsoft.Azure.PowerShell.Clients.PolicyInsights/1.3.57-preview": { + "type": "package", + "serviceable": true, + "sha512": "sha512-urRIwRVzzOwpk8HhKq/b785DiL/arnmGUHbN4HvRN6ZsBkE1PU431YwgUlofb9pfB3buLcl0XJFRPLBJ0yZJUw==", + "path": "microsoft.azure.powershell.clients.policyinsights/1.3.57-preview", + "hashPath": "microsoft.azure.powershell.clients.policyinsights.1.3.57-preview.nupkg.sha512" + }, + "Microsoft.Azure.PowerShell.Clients.ResourceManager/1.3.57-preview": { + "type": "package", + "serviceable": true, + "sha512": "sha512-juWnd63Z2Sp+6bvtOPOF0Gj1v2AfpxXcuyodd9+U7euBro2G7Yfo2UHmHo/uaYyQUbM3HaXJPvse7BLDKjhe6w==", + "path": "microsoft.azure.powershell.clients.resourcemanager/1.3.57-preview", + "hashPath": "microsoft.azure.powershell.clients.resourcemanager.1.3.57-preview.nupkg.sha512" + }, + "Microsoft.Azure.PowerShell.Clients.Storage.Management/1.3.57-preview": { + "type": "package", + "serviceable": true, + "sha512": "sha512-HPpTWIlN+5ALqJssL7+6BD/vYrWi3eWKQ3QpWYjCFk5c9HVLTNpP+M2dq9jbsxLsZj+5Pt6gC4FIS22Q13Uhag==", + "path": "microsoft.azure.powershell.clients.storage.management/1.3.57-preview", + "hashPath": "microsoft.azure.powershell.clients.storage.management.1.3.57-preview.nupkg.sha512" + }, + "Microsoft.Azure.PowerShell.Clients.Websites/1.3.57-preview": { + "type": "package", + "serviceable": true, + "sha512": "sha512-b5yBD9FrY02r0kdNNgZ+uU0/QsW3AtmnCE/x1mUG5j8ka/V04AYUo+sDokQBzu+vnK6Y6OrVDtyWjmnKTDHpWA==", + "path": "microsoft.azure.powershell.clients.websites/1.3.57-preview", + "hashPath": "microsoft.azure.powershell.clients.websites.1.3.57-preview.nupkg.sha512" + }, + "Microsoft.Azure.PowerShell.Common/1.3.57-preview": { + "type": "package", + "serviceable": true, + "sha512": "sha512-9jZYZ9LKbx16r69y7cO9d7bDjpE0/HgeBU386Y/O6q05VRaq2wAsB2rbQ9AjxcPGHfwS0+2US/RImSSqjVABRQ==", + "path": "microsoft.azure.powershell.common/1.3.57-preview", + "hashPath": "microsoft.azure.powershell.common.1.3.57-preview.nupkg.sha512" + }, + "Microsoft.Azure.PowerShell.Common.Share/1.3.57-preview": { + "type": "package", + "serviceable": true, + "sha512": "sha512-4mJSjnwZVLQYWhP47eDzdt0yaLIf2I4pqaEIqcfAjkjdbKpnCXCnJUEFRId061yuKpq1LtfBZkHDRi68I5CJxg==", + "path": "microsoft.azure.powershell.common.share/1.3.57-preview", + "hashPath": "microsoft.azure.powershell.common.share.1.3.57-preview.nupkg.sha512" + }, + "Microsoft.Azure.PowerShell.Storage/1.3.57-preview": { + "type": "package", + "serviceable": true, + "sha512": "sha512-fObXEcuhk1JUoQ0fiCV4nK4NJWqvsfsKCzapF7SFEQ87X6AasL6m5KGT8JQSnHmc849xxxaixPTxyWaf9BBlpw==", + "path": "microsoft.azure.powershell.storage/1.3.57-preview", + "hashPath": "microsoft.azure.powershell.storage.1.3.57-preview.nupkg.sha512" + }, + "Microsoft.Azure.PowerShell.Strategies/1.3.57-preview": { + "type": "package", + "serviceable": true, + "sha512": "sha512-HwyxUwDHCmY6Zdxg2xpFC9Gqmu92Xr0cAr4ElWYwz8Z7PE9uYVkTpKMIKd7oIJJgsIANTfqEU1HKoeI3FXPLqw==", + "path": "microsoft.azure.powershell.strategies/1.3.57-preview", + "hashPath": "microsoft.azure.powershell.strategies.1.3.57-preview.nupkg.sha512" + }, + "Microsoft.Bcl.AsyncInterfaces/1.1.1": { + "type": "package", + "serviceable": true, + "sha512": "sha512-yuvf07qFWFqtK3P/MRkEKLhn5r2UbSpVueRziSqj0yJQIKFwG1pq9mOayK3zE5qZCTs0CbrwL9M6R8VwqyGy2w==", + "path": "microsoft.bcl.asyncinterfaces/1.1.1", + "hashPath": "microsoft.bcl.asyncinterfaces.1.1.1.nupkg.sha512" + }, + "Microsoft.CSharp/4.5.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-kaj6Wb4qoMuH3HySFJhxwQfe8R/sJsNJnANrvv8WdFPMoNbKY5htfNscv+LHCu5ipz+49m2e+WQXpLXr9XYemQ==", + "path": "microsoft.csharp/4.5.0", + "hashPath": "microsoft.csharp.4.5.0.nupkg.sha512" + }, + "Microsoft.Identity.Client/4.30.1": { + "type": "package", + "serviceable": true, + "sha512": "sha512-xk8tJeGfB2yD3+d7a0DXyV7/HYyEG10IofUHYHoPYKmDbroi/j9t1BqSHgbq1nARDjg7m8Ki6e21AyNU7e/R4Q==", + "path": "microsoft.identity.client/4.30.1", + "hashPath": "microsoft.identity.client.4.30.1.nupkg.sha512" + }, + "Microsoft.Identity.Client.Extensions.Msal/2.18.4": { + "type": "package", + "serviceable": true, + "sha512": "sha512-HpG4oLwhQsy0ce7OWq9iDdLtJKOvKRStIKoSEOeBMKuohfuOWNDyhg8fMAJkpG/kFeoe4J329fiMHcJmmB+FPw==", + "path": "microsoft.identity.client.extensions.msal/2.18.4", + "hashPath": "microsoft.identity.client.extensions.msal.2.18.4.nupkg.sha512" + }, + "Microsoft.NETCore.Platforms/1.1.1": { + "type": "package", + "serviceable": true, + "sha512": "sha512-TMBuzAHpTenGbGgk0SMTwyEkyijY/Eae4ZGsFNYJvAr/LDn1ku3Etp3FPxChmDp5HHF3kzJuoaa08N0xjqAJfQ==", + "path": "microsoft.netcore.platforms/1.1.1", + "hashPath": "microsoft.netcore.platforms.1.1.1.nupkg.sha512" + }, + "Microsoft.NETCore.Targets/1.1.3": { + "type": "package", + "serviceable": true, + "sha512": "sha512-3Wrmi0kJDzClwAC+iBdUBpEKmEle8FQNsCs77fkiOIw/9oYA07bL1EZNX0kQ2OMN3xpwvl0vAtOCYY3ndDNlhQ==", + "path": "microsoft.netcore.targets/1.1.3", + "hashPath": "microsoft.netcore.targets.1.1.3.nupkg.sha512" + }, + "Microsoft.Rest.ClientRuntime/2.3.23": { + "type": "package", + "serviceable": true, + "sha512": "sha512-92kNTi1N7zI5wwI2ZXswBRnk61OUYnuYJXrlgOhes5IsAqGmgw9DPGmhUzeY8OaZ8TTrQdDzvgXFnbCHwLzSVA==", + "path": "microsoft.rest.clientruntime/2.3.23", + "hashPath": "microsoft.rest.clientruntime.2.3.23.nupkg.sha512" + }, + "Microsoft.Rest.ClientRuntime.Azure/3.3.19": { + "type": "package", + "serviceable": true, + "sha512": "sha512-+NVBWvRXNwaAPTZUxjUlQggsrf3X0GbiRoxYfgc3kG9E55ZxZxvZPT3nIfC4DNqzGSXUEvmLbckdXgBBzGdUaA==", + "path": "microsoft.rest.clientruntime.azure/3.3.19", + "hashPath": "microsoft.rest.clientruntime.azure.3.3.19.nupkg.sha512" + }, + "Microsoft.Win32.Primitives/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-9ZQKCWxH7Ijp9BfahvL2Zyf1cJIk8XYLF6Yjzr2yi0b2cOut/HQ31qf1ThHAgCc3WiZMdnWcfJCgN82/0UunxA==", + "path": "microsoft.win32.primitives/4.3.0", + "hashPath": "microsoft.win32.primitives.4.3.0.nupkg.sha512" + }, + "Microsoft.Win32.Registry/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-Lw1/VwLH1yxz6SfFEjVRCN0pnflLEsWgnV4qsdJ512/HhTwnKXUG+zDQ4yTO3K/EJQemGoNaBHX5InISNKTzUQ==", + "path": "microsoft.win32.registry/4.3.0", + "hashPath": "microsoft.win32.registry.4.3.0.nupkg.sha512" + }, + "NETStandard.Library/2.0.3": { + "type": "package", + "serviceable": true, + "sha512": "sha512-st47PosZSHrjECdjeIzZQbzivYBJFv6P2nv4cj2ypdI204DO+vZ7l5raGMiX4eXMJ53RfOIg+/s4DHVZ54Nu2A==", + "path": "netstandard.library/2.0.3", + "hashPath": "netstandard.library.2.0.3.nupkg.sha512" + }, + "Newtonsoft.Json/10.0.3": { + "type": "package", + "serviceable": true, + "sha512": "sha512-hSXaFmh7hNCuEoC4XNY5DrRkLDzYHqPx/Ik23R4J86Z7PE/Y6YidhG602dFVdLBRSdG6xp9NabH3dXpcoxWvww==", + "path": "newtonsoft.json/10.0.3", + "hashPath": "newtonsoft.json.10.0.3.nupkg.sha512" + }, + "PowerShellStandard.Library/5.1.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-iYaRvQsM1fow9h3uEmio+2m2VXfulgI16AYHaTZ8Sf7erGe27Qc8w/h6QL5UPuwv1aXR40QfzMEwcCeiYJp2cw==", + "path": "powershellstandard.library/5.1.0", + "hashPath": "powershellstandard.library.5.1.0.nupkg.sha512" + }, + "runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-HdSSp5MnJSsg08KMfZThpuLPJpPwE5hBXvHwoKWosyHHfe8Mh5WKT0ylEOf6yNzX6Ngjxe4Whkafh5q7Ymac4Q==", + "path": "runtime.debian.8-x64.runtime.native.system.security.cryptography.openssl/4.3.0", + "hashPath": "runtime.debian.8-x64.runtime.native.system.security.cryptography.openssl.4.3.0.nupkg.sha512" + }, + "runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-+yH1a49wJMy8Zt4yx5RhJrxO/DBDByAiCzNwiETI+1S4mPdCu0OY4djdciC7Vssk0l22wQaDLrXxXkp+3+7bVA==", + "path": "runtime.fedora.23-x64.runtime.native.system.security.cryptography.openssl/4.3.0", + "hashPath": "runtime.fedora.23-x64.runtime.native.system.security.cryptography.openssl.4.3.0.nupkg.sha512" + }, + "runtime.fedora.24-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-c3YNH1GQJbfIPJeCnr4avseugSqPrxwIqzthYyZDN6EuOyNOzq+y2KSUfRcXauya1sF4foESTgwM5e1A8arAKw==", + "path": "runtime.fedora.24-x64.runtime.native.system.security.cryptography.openssl/4.3.0", + "hashPath": "runtime.fedora.24-x64.runtime.native.system.security.cryptography.openssl.4.3.0.nupkg.sha512" + }, + "runtime.native.System/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-c/qWt2LieNZIj1jGnVNsE2Kl23Ya2aSTBuXMD6V7k9KWr6l16Tqdwq+hJScEpWER9753NWC8h96PaVNY5Ld7Jw==", + "path": "runtime.native.system/4.3.0", + "hashPath": "runtime.native.system.4.3.0.nupkg.sha512" + }, + "runtime.native.System.Net.Http/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-ZVuZJqnnegJhd2k/PtAbbIcZ3aZeITq3sj06oKfMBSfphW3HDmk/t4ObvbOk/JA/swGR0LNqMksAh/f7gpTROg==", + "path": "runtime.native.system.net.http/4.3.0", + "hashPath": "runtime.native.system.net.http.4.3.0.nupkg.sha512" + }, + "runtime.native.System.Security.Cryptography.Apple/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-DloMk88juo0OuOWr56QG7MNchmafTLYWvABy36izkrLI5VledI0rq28KGs1i9wbpeT9NPQrx/wTf8U2vazqQ3Q==", + "path": "runtime.native.system.security.cryptography.apple/4.3.0", + "hashPath": "runtime.native.system.security.cryptography.apple.4.3.0.nupkg.sha512" + }, + "runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-NS1U+700m4KFRHR5o4vo9DSlTmlCKu/u7dtE5sUHVIPB+xpXxYQvgBgA6wEIeCz6Yfn0Z52/72WYsToCEPJnrw==", + "path": "runtime.native.system.security.cryptography.openssl/4.3.0", + "hashPath": "runtime.native.system.security.cryptography.openssl.4.3.0.nupkg.sha512" + }, + "runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-b3pthNgxxFcD+Pc0WSEoC0+md3MyhRS6aCEeenvNE3Fdw1HyJ18ZhRFVJJzIeR/O/jpxPboB805Ho0T3Ul7w8A==", + "path": "runtime.opensuse.13.2-x64.runtime.native.system.security.cryptography.openssl/4.3.0", + "hashPath": "runtime.opensuse.13.2-x64.runtime.native.system.security.cryptography.openssl.4.3.0.nupkg.sha512" + }, + "runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-KeLz4HClKf+nFS7p/6Fi/CqyLXh81FpiGzcmuS8DGi9lUqSnZ6Es23/gv2O+1XVGfrbNmviF7CckBpavkBoIFQ==", + "path": "runtime.opensuse.42.1-x64.runtime.native.system.security.cryptography.openssl/4.3.0", + "hashPath": "runtime.opensuse.42.1-x64.runtime.native.system.security.cryptography.openssl.4.3.0.nupkg.sha512" + }, + "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.Apple/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-kVXCuMTrTlxq4XOOMAysuNwsXWpYeboGddNGpIgNSZmv1b6r/s/DPk0fYMB7Q5Qo4bY68o48jt4T4y5BVecbCQ==", + "path": "runtime.osx.10.10-x64.runtime.native.system.security.cryptography.apple/4.3.0", + "hashPath": "runtime.osx.10.10-x64.runtime.native.system.security.cryptography.apple.4.3.0.nupkg.sha512" + }, + "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-X7IdhILzr4ROXd8mI1BUCQMSHSQwelUlBjF1JyTKCjXaOGn2fB4EKBxQbCK2VjO3WaWIdlXZL3W6TiIVnrhX4g==", + "path": "runtime.osx.10.10-x64.runtime.native.system.security.cryptography.openssl/4.3.0", + "hashPath": "runtime.osx.10.10-x64.runtime.native.system.security.cryptography.openssl.4.3.0.nupkg.sha512" + }, + "runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-nyFNiCk/r+VOiIqreLix8yN+q3Wga9+SE8BCgkf+2BwEKiNx6DyvFjCgkfV743/grxv8jHJ8gUK4XEQw7yzRYg==", + "path": "runtime.rhel.7-x64.runtime.native.system.security.cryptography.openssl/4.3.0", + "hashPath": "runtime.rhel.7-x64.runtime.native.system.security.cryptography.openssl.4.3.0.nupkg.sha512" + }, + "runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-ytoewC6wGorL7KoCAvRfsgoJPJbNq+64k2SqW6JcOAebWsFUvCCYgfzQMrnpvPiEl4OrblUlhF2ji+Q1+SVLrQ==", + "path": "runtime.ubuntu.14.04-x64.runtime.native.system.security.cryptography.openssl/4.3.0", + "hashPath": "runtime.ubuntu.14.04-x64.runtime.native.system.security.cryptography.openssl.4.3.0.nupkg.sha512" + }, + "runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-I8bKw2I8k58Wx7fMKQJn2R8lamboCAiHfHeV/pS65ScKWMMI0+wJkLYlEKvgW1D/XvSl/221clBoR2q9QNNM7A==", + "path": "runtime.ubuntu.16.04-x64.runtime.native.system.security.cryptography.openssl/4.3.0", + "hashPath": "runtime.ubuntu.16.04-x64.runtime.native.system.security.cryptography.openssl.4.3.0.nupkg.sha512" + }, + "runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-VB5cn/7OzUfzdnC8tqAIMQciVLiq2epm2NrAm1E9OjNRyG4lVhfR61SMcLizejzQP8R8Uf/0l5qOIbUEi+RdEg==", + "path": "runtime.ubuntu.16.10-x64.runtime.native.system.security.cryptography.openssl/4.3.0", + "hashPath": "runtime.ubuntu.16.10-x64.runtime.native.system.security.cryptography.openssl.4.3.0.nupkg.sha512" + }, + "System.Buffers/4.5.1": { + "type": "package", + "serviceable": true, + "sha512": "sha512-Rw7ijyl1qqRS0YQD/WycNst8hUUMgrMH4FCn1nNm27M4VxchZ1js3fVjQaANHO5f3sN4isvP4a+Met9Y4YomAg==", + "path": "system.buffers/4.5.1", + "hashPath": "system.buffers.4.5.1.nupkg.sha512" + }, + "System.Collections/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-3Dcj85/TBdVpL5Zr+gEEBUuFe2icOnLalmEh9hfck1PTYbbyWuZgh4fmm2ysCLTrqLQw6t3TgTyJ+VLp+Qb+Lw==", + "path": "system.collections/4.3.0", + "hashPath": "system.collections.4.3.0.nupkg.sha512" + }, + "System.Collections.Concurrent/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-ztl69Xp0Y/UXCL+3v3tEU+lIy+bvjKNUmopn1wep/a291pVPK7dxBd6T7WnlQqRog+d1a/hSsgRsmFnIBKTPLQ==", + "path": "system.collections.concurrent/4.3.0", + "hashPath": "system.collections.concurrent.4.3.0.nupkg.sha512" + }, + "System.Collections.NonGeneric/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-prtjIEMhGUnQq6RnPEYLpFt8AtLbp9yq2zxOSrY7KJJZrw25Fi97IzBqY7iqssbM61Ek5b8f3MG/sG1N2sN5KA==", + "path": "system.collections.nongeneric/4.3.0", + "hashPath": "system.collections.nongeneric.4.3.0.nupkg.sha512" + }, + "System.Collections.Specialized/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-Epx8PoVZR0iuOnJJDzp7pWvdfMMOAvpUo95pC4ScH2mJuXkKA2Y4aR3cG9qt2klHgSons1WFh4kcGW7cSXvrxg==", + "path": "system.collections.specialized/4.3.0", + "hashPath": "system.collections.specialized.4.3.0.nupkg.sha512" + }, + "System.ComponentModel/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-VyGn1jGRZVfxnh8EdvDCi71v3bMXrsu8aYJOwoV7SNDLVhiEqwP86pPMyRGsDsxhXAm2b3o9OIqeETfN5qfezw==", + "path": "system.componentmodel/4.3.0", + "hashPath": "system.componentmodel.4.3.0.nupkg.sha512" + }, + "System.ComponentModel.Primitives/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-j8GUkCpM8V4d4vhLIIoBLGey2Z5bCkMVNjEZseyAlm4n5arcsJOeI3zkUP+zvZgzsbLTYh4lYeP/ZD/gdIAPrw==", + "path": "system.componentmodel.primitives/4.3.0", + "hashPath": "system.componentmodel.primitives.4.3.0.nupkg.sha512" + }, + "System.ComponentModel.TypeConverter/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-16pQ6P+EdhcXzPiEK4kbA953Fu0MNG2ovxTZU81/qsCd1zPRsKc3uif5NgvllCY598k6bI0KUyKW8fanlfaDQg==", + "path": "system.componentmodel.typeconverter/4.3.0", + "hashPath": "system.componentmodel.typeconverter.4.3.0.nupkg.sha512" + }, + "System.Diagnostics.Debug/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-ZUhUOdqmaG5Jk3Xdb8xi5kIyQYAA4PnTNlHx1mu9ZY3qv4ELIdKbnL/akbGaKi2RnNUWaZsAs31rvzFdewTj2g==", + "path": "system.diagnostics.debug/4.3.0", + "hashPath": "system.diagnostics.debug.4.3.0.nupkg.sha512" + }, + "System.Diagnostics.DiagnosticSource/4.6.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-mbBgoR0rRfl2uimsZ2avZY8g7Xnh1Mza0rJZLPcxqiMWlkGukjmRkuMJ/er+AhQuiRIh80CR/Hpeztr80seV5g==", + "path": "system.diagnostics.diagnosticsource/4.6.0", + "hashPath": "system.diagnostics.diagnosticsource.4.6.0.nupkg.sha512" + }, + "System.Diagnostics.Process/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-J0wOX07+QASQblsfxmIMFc9Iq7KTXYL3zs2G/Xc704Ylv3NpuVdo6gij6V3PGiptTxqsK0K7CdXenRvKUnkA2g==", + "path": "system.diagnostics.process/4.3.0", + "hashPath": "system.diagnostics.process.4.3.0.nupkg.sha512" + }, + "System.Diagnostics.Tools/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-UUvkJfSYJMM6x527dJg2VyWPSRqIVB0Z7dbjHst1zmwTXz5CcXSYJFWRpuigfbO1Lf7yfZiIaEUesfnl/g5EyA==", + "path": "system.diagnostics.tools/4.3.0", + "hashPath": "system.diagnostics.tools.4.3.0.nupkg.sha512" + }, + "System.Diagnostics.Tracing/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-rswfv0f/Cqkh78rA5S8eN8Neocz234+emGCtTF3lxPY96F+mmmUen6tbn0glN6PMvlKQb9bPAY5e9u7fgPTkKw==", + "path": "system.diagnostics.tracing/4.3.0", + "hashPath": "system.diagnostics.tracing.4.3.0.nupkg.sha512" + }, + "System.Dynamic.Runtime/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-SNVi1E/vfWUAs/WYKhE9+qlS6KqK0YVhnlT0HQtr8pMIA8YX3lwy3uPMownDwdYISBdmAF/2holEIldVp85Wag==", + "path": "system.dynamic.runtime/4.3.0", + "hashPath": "system.dynamic.runtime.4.3.0.nupkg.sha512" + }, + "System.Globalization/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-kYdVd2f2PAdFGblzFswE4hkNANJBKRmsfa2X5LG2AcWE1c7/4t0pYae1L8vfZ5xvE2nK/R9JprtToA61OSHWIg==", + "path": "system.globalization/4.3.0", + "hashPath": "system.globalization.4.3.0.nupkg.sha512" + }, + "System.Globalization.Calendars/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-GUlBtdOWT4LTV3I+9/PJW+56AnnChTaOqqTLFtdmype/L500M2LIyXgmtd9X2P2VOkmJd5c67H5SaC2QcL1bFA==", + "path": "system.globalization.calendars/4.3.0", + "hashPath": "system.globalization.calendars.4.3.0.nupkg.sha512" + }, + "System.Globalization.Extensions/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-FhKmdR6MPG+pxow6wGtNAWdZh7noIOpdD5TwQ3CprzgIE1bBBoim0vbR1+AWsWjQmU7zXHgQo4TWSP6lCeiWcQ==", + "path": "system.globalization.extensions/4.3.0", + "hashPath": "system.globalization.extensions.4.3.0.nupkg.sha512" + }, + "System.IO/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-3qjaHvxQPDpSOYICjUoTsmoq5u6QJAFRUITgeT/4gqkF1bajbSmb1kwSxEA8AHlofqgcKJcM8udgieRNhaJ5Cg==", + "path": "system.io/4.3.0", + "hashPath": "system.io.4.3.0.nupkg.sha512" + }, + "System.IO.FileSystem/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-3wEMARTnuio+ulnvi+hkRNROYwa1kylvYahhcLk4HSoVdl+xxTFVeVlYOfLwrDPImGls0mDqbMhrza8qnWPTdA==", + "path": "system.io.filesystem/4.3.0", + "hashPath": "system.io.filesystem.4.3.0.nupkg.sha512" + }, + "System.IO.FileSystem.Primitives/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-6QOb2XFLch7bEc4lIcJH49nJN2HV+OC3fHDgsLVsBVBk3Y4hFAnOBGzJ2lUu7CyDDFo9IBWkSsnbkT6IBwwiMw==", + "path": "system.io.filesystem.primitives/4.3.0", + "hashPath": "system.io.filesystem.primitives.4.3.0.nupkg.sha512" + }, + "System.Linq/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-5DbqIUpsDp0dFftytzuMmc0oeMdQwjcP/EWxsksIz/w1TcFRkZ3yKKz0PqiYFMmEwPSWw+qNVqD7PJ889JzHbw==", + "path": "system.linq/4.3.0", + "hashPath": "system.linq.4.3.0.nupkg.sha512" + }, + "System.Linq.Expressions/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-PGKkrd2khG4CnlyJwxwwaWWiSiWFNBGlgXvJpeO0xCXrZ89ODrQ6tjEWS/kOqZ8GwEOUATtKtzp1eRgmYNfclg==", + "path": "system.linq.expressions/4.3.0", + "hashPath": "system.linq.expressions.4.3.0.nupkg.sha512" + }, + "System.Memory/4.5.4": { + "type": "package", + "serviceable": true, + "sha512": "sha512-1MbJTHS1lZ4bS4FmsJjnuGJOu88ZzTT2rLvrhW7Ygic+pC0NWA+3hgAen0HRdsocuQXCkUTdFn9yHJJhsijDXw==", + "path": "system.memory/4.5.4", + "hashPath": "system.memory.4.5.4.nupkg.sha512" + }, + "System.Memory.Data/1.0.2": { + "type": "package", + "serviceable": true, + "sha512": "sha512-JGkzeqgBsiZwKJZ1IxPNsDFZDhUvuEdX8L8BDC8N3KOj+6zMcNU28CNN59TpZE/VJYy9cP+5M+sbxtWJx3/xtw==", + "path": "system.memory.data/1.0.2", + "hashPath": "system.memory.data.1.0.2.nupkg.sha512" + }, + "System.Numerics.Vectors/4.5.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-QQTlPTl06J/iiDbJCiepZ4H//BVraReU4O4EoRw1U02H5TLUIT7xn3GnDp9AXPSlJUDyFs4uWjWafNX6WrAojQ==", + "path": "system.numerics.vectors/4.5.0", + "hashPath": "system.numerics.vectors.4.5.0.nupkg.sha512" + }, + "System.ObjectModel/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-bdX+80eKv9bN6K4N+d77OankKHGn6CH711a6fcOpMQu2Fckp/Ft4L/kW9WznHpyR0NRAvJutzOMHNNlBGvxQzQ==", + "path": "system.objectmodel/4.3.0", + "hashPath": "system.objectmodel.4.3.0.nupkg.sha512" + }, + "System.Private.DataContractSerialization/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-yDaJ2x3mMmjdZEDB4IbezSnCsnjQ4BxinKhRAaP6kEgL6Bb6jANWphs5SzyD8imqeC/3FxgsuXT6ykkiH1uUmA==", + "path": "system.private.datacontractserialization/4.3.0", + "hashPath": "system.private.datacontractserialization.4.3.0.nupkg.sha512" + }, + "System.Private.Uri/4.3.2": { + "type": "package", + "serviceable": true, + "sha512": "sha512-o1+7RJnu3Ik3PazR7Z7tJhjPdE000Eq2KGLLWhqJJKXj04wrS8lwb1OFtDF9jzXXADhUuZNJZlPc98uwwqmpFA==", + "path": "system.private.uri/4.3.2", + "hashPath": "system.private.uri.4.3.2.nupkg.sha512" + }, + "System.Reflection/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-KMiAFoW7MfJGa9nDFNcfu+FpEdiHpWgTcS2HdMpDvt9saK3y/G4GwprPyzqjFH9NTaGPQeWNHU+iDlDILj96aQ==", + "path": "system.reflection/4.3.0", + "hashPath": "system.reflection.4.3.0.nupkg.sha512" + }, + "System.Reflection.Emit/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-228FG0jLcIwTVJyz8CLFKueVqQK36ANazUManGaJHkO0icjiIypKW7YLWLIWahyIkdh5M7mV2dJepllLyA1SKg==", + "path": "system.reflection.emit/4.3.0", + "hashPath": "system.reflection.emit.4.3.0.nupkg.sha512" + }, + "System.Reflection.Emit.ILGeneration/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-59tBslAk9733NXLrUJrwNZEzbMAcu8k344OYo+wfSVygcgZ9lgBdGIzH/nrg3LYhXceynyvTc8t5/GD4Ri0/ng==", + "path": "system.reflection.emit.ilgeneration/4.3.0", + "hashPath": "system.reflection.emit.ilgeneration.4.3.0.nupkg.sha512" + }, + "System.Reflection.Emit.Lightweight/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-oadVHGSMsTmZsAF864QYN1t1QzZjIcuKU3l2S9cZOwDdDueNTrqq1yRj7koFfIGEnKpt6NjpL3rOzRhs4ryOgA==", + "path": "system.reflection.emit.lightweight/4.3.0", + "hashPath": "system.reflection.emit.lightweight.4.3.0.nupkg.sha512" + }, + "System.Reflection.Extensions/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-rJkrJD3kBI5B712aRu4DpSIiHRtr6QlfZSQsb0hYHrDCZORXCFjQfoipo2LaMUHoT9i1B7j7MnfaEKWDFmFQNQ==", + "path": "system.reflection.extensions/4.3.0", + "hashPath": "system.reflection.extensions.4.3.0.nupkg.sha512" + }, + "System.Reflection.Primitives/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-5RXItQz5As4xN2/YUDxdpsEkMhvw3e6aNveFXUn4Hl/udNTCNhnKp8lT9fnc3MhvGKh1baak5CovpuQUXHAlIA==", + "path": "system.reflection.primitives/4.3.0", + "hashPath": "system.reflection.primitives.4.3.0.nupkg.sha512" + }, + "System.Reflection.TypeExtensions/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-7u6ulLcZbyxB5Gq0nMkQttcdBTx57ibzw+4IOXEfR+sXYQoHvjW5LTLyNr8O22UIMrqYbchJQJnos4eooYzYJA==", + "path": "system.reflection.typeextensions/4.3.0", + "hashPath": "system.reflection.typeextensions.4.3.0.nupkg.sha512" + }, + "System.Resources.ResourceManager/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-/zrcPkkWdZmI4F92gL/TPumP98AVDu/Wxr3CSJGQQ+XN6wbRZcyfSKVoPo17ilb3iOr0cCRqJInGwNMolqhS8A==", + "path": "system.resources.resourcemanager/4.3.0", + "hashPath": "system.resources.resourcemanager.4.3.0.nupkg.sha512" + }, + "System.Runtime/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-JufQi0vPQ0xGnAczR13AUFglDyVYt4Kqnz1AZaiKZ5+GICq0/1MH/mO/eAJHt/mHW1zjKBJd7kV26SrxddAhiw==", + "path": "system.runtime/4.3.0", + "hashPath": "system.runtime.4.3.0.nupkg.sha512" + }, + "System.Runtime.CompilerServices.Unsafe/4.7.1": { + "type": "package", + "serviceable": true, + "sha512": "sha512-zOHkQmzPCn5zm/BH+cxC1XbUS3P4Yoi3xzW7eRgVpDR2tPGSzyMZ17Ig1iRkfJuY0nhxkQQde8pgePNiA7z7TQ==", + "path": "system.runtime.compilerservices.unsafe/4.7.1", + "hashPath": "system.runtime.compilerservices.unsafe.4.7.1.nupkg.sha512" + }, + "System.Runtime.Extensions/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-guW0uK0fn5fcJJ1tJVXYd7/1h5F+pea1r7FLSOz/f8vPEqbR2ZAknuRDvTQ8PzAilDveOxNjSfr0CHfIQfFk8g==", + "path": "system.runtime.extensions/4.3.0", + "hashPath": "system.runtime.extensions.4.3.0.nupkg.sha512" + }, + "System.Runtime.Handles/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-OKiSUN7DmTWeYb3l51A7EYaeNMnvxwE249YtZz7yooT4gOZhmTjIn48KgSsw2k2lYdLgTKNJw/ZIfSElwDRVgg==", + "path": "system.runtime.handles/4.3.0", + "hashPath": "system.runtime.handles.4.3.0.nupkg.sha512" + }, + "System.Runtime.InteropServices/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-uv1ynXqiMK8mp1GM3jDqPCFN66eJ5w5XNomaK2XD+TuCroNTLFGeZ+WCmBMcBDyTFKou3P6cR6J/QsaqDp7fGQ==", + "path": "system.runtime.interopservices/4.3.0", + "hashPath": "system.runtime.interopservices.4.3.0.nupkg.sha512" + }, + "System.Runtime.Numerics/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-yMH+MfdzHjy17l2KESnPiF2dwq7T+xLnSJar7slyimAkUh/gTrS9/UQOtv7xarskJ2/XDSNvfLGOBQPjL7PaHQ==", + "path": "system.runtime.numerics/4.3.0", + "hashPath": "system.runtime.numerics.4.3.0.nupkg.sha512" + }, + "System.Runtime.Serialization.Formatters/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-KT591AkTNFOTbhZlaeMVvfax3RqhH1EJlcwF50Wm7sfnBLuHiOeZRRKrr1ns3NESkM20KPZ5Ol/ueMq5vg4QoQ==", + "path": "system.runtime.serialization.formatters/4.3.0", + "hashPath": "system.runtime.serialization.formatters.4.3.0.nupkg.sha512" + }, + "System.Runtime.Serialization.Json/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-CpVfOH0M/uZ5PH+M9+Gu56K0j9lJw3M+PKRegTkcrY/stOIvRUeonggxNrfBYLA5WOHL2j15KNJuTuld3x4o9w==", + "path": "system.runtime.serialization.json/4.3.0", + "hashPath": "system.runtime.serialization.json.4.3.0.nupkg.sha512" + }, + "System.Runtime.Serialization.Primitives/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-Wz+0KOukJGAlXjtKr+5Xpuxf8+c8739RI1C+A2BoQZT+wMCCoMDDdO8/4IRHfaVINqL78GO8dW8G2lW/e45Mcw==", + "path": "system.runtime.serialization.primitives/4.3.0", + "hashPath": "system.runtime.serialization.primitives.4.3.0.nupkg.sha512" + }, + "System.Security.Cryptography.Algorithms/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-W1kd2Y8mYSCgc3ULTAZ0hOP2dSdG5YauTb1089T0/kRcN2MpSAW1izOFROrJgxSlMn3ArsgHXagigyi+ibhevg==", + "path": "system.security.cryptography.algorithms/4.3.0", + "hashPath": "system.security.cryptography.algorithms.4.3.0.nupkg.sha512" + }, + "System.Security.Cryptography.Cng/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-03idZOqFlsKRL4W+LuCpJ6dBYDUWReug6lZjBa3uJWnk5sPCUXckocevTaUA8iT/MFSrY/2HXkOt753xQ/cf8g==", + "path": "system.security.cryptography.cng/4.3.0", + "hashPath": "system.security.cryptography.cng.4.3.0.nupkg.sha512" + }, + "System.Security.Cryptography.Csp/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-X4s/FCkEUnRGnwR3aSfVIkldBmtURMhmexALNTwpjklzxWU7yjMk7GHLKOZTNkgnWnE0q7+BCf9N2LVRWxewaA==", + "path": "system.security.cryptography.csp/4.3.0", + "hashPath": "system.security.cryptography.csp.4.3.0.nupkg.sha512" + }, + "System.Security.Cryptography.Encoding/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-1DEWjZZly9ae9C79vFwqaO5kaOlI5q+3/55ohmq/7dpDyDfc8lYe7YVxJUZ5MF/NtbkRjwFRo14yM4OEo9EmDw==", + "path": "system.security.cryptography.encoding/4.3.0", + "hashPath": "system.security.cryptography.encoding.4.3.0.nupkg.sha512" + }, + "System.Security.Cryptography.OpenSsl/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-h4CEgOgv5PKVF/HwaHzJRiVboL2THYCou97zpmhjghx5frc7fIvlkY1jL+lnIQyChrJDMNEXS6r7byGif8Cy4w==", + "path": "system.security.cryptography.openssl/4.3.0", + "hashPath": "system.security.cryptography.openssl.4.3.0.nupkg.sha512" + }, + "System.Security.Cryptography.Primitives/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-7bDIyVFNL/xKeFHjhobUAQqSpJq9YTOpbEs6mR233Et01STBMXNAc/V+BM6dwYGc95gVh/Zf+iVXWzj3mE8DWg==", + "path": "system.security.cryptography.primitives/4.3.0", + "hashPath": "system.security.cryptography.primitives.4.3.0.nupkg.sha512" + }, + "System.Security.Cryptography.ProtectedData/4.5.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-wLBKzFnDCxP12VL9ANydSYhk59fC4cvOr9ypYQLPnAj48NQIhqnjdD2yhP8yEKyBJEjERWS9DisKL7rX5eU25Q==", + "path": "system.security.cryptography.protecteddata/4.5.0", + "hashPath": "system.security.cryptography.protecteddata.4.5.0.nupkg.sha512" + }, + "System.Security.Cryptography.X509Certificates/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-t2Tmu6Y2NtJ2um0RtcuhP7ZdNNxXEgUm2JeoA/0NvlMjAhKCnM1NX07TDl3244mVp3QU6LPEhT3HTtH1uF7IYw==", + "path": "system.security.cryptography.x509certificates/4.3.0", + "hashPath": "system.security.cryptography.x509certificates.4.3.0.nupkg.sha512" + }, + "System.Security.SecureString/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-PnXp38O9q/2Oe4iZHMH60kinScv6QiiL2XH54Pj2t0Y6c2zKPEiAZsM/M3wBOHLNTBDFP0zfy13WN2M0qFz5jg==", + "path": "system.security.securestring/4.3.0", + "hashPath": "system.security.securestring.4.3.0.nupkg.sha512" + }, + "System.Text.Encoding/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-BiIg+KWaSDOITze6jGQynxg64naAPtqGHBwDrLaCtixsa5bKiR8dpPOHA7ge3C0JJQizJE+sfkz1wV+BAKAYZw==", + "path": "system.text.encoding/4.3.0", + "hashPath": "system.text.encoding.4.3.0.nupkg.sha512" + }, + "System.Text.Encoding.Extensions/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-YVMK0Bt/A43RmwizJoZ22ei2nmrhobgeiYwFzC4YAN+nue8RF6djXDMog0UCn+brerQoYVyaS+ghy9P/MUVcmw==", + "path": "system.text.encoding.extensions/4.3.0", + "hashPath": "system.text.encoding.extensions.4.3.0.nupkg.sha512" + }, + "System.Text.Encodings.Web/4.7.2": { + "type": "package", + "serviceable": true, + "sha512": "sha512-iTUgB/WtrZ1sWZs84F2hwyQhiRH6QNjQv2DkwrH+WP6RoFga2Q1m3f9/Q7FG8cck8AdHitQkmkXSY8qylcDmuA==", + "path": "system.text.encodings.web/4.7.2", + "hashPath": "system.text.encodings.web.4.7.2.nupkg.sha512" + }, + "System.Text.Json/4.7.2": { + "type": "package", + "serviceable": true, + "sha512": "sha512-TcMd95wcrubm9nHvJEQs70rC0H/8omiSGGpU4FQ/ZA1URIqD4pjmFJh2Mfv1yH1eHgJDWTi2hMDXwTET+zOOyg==", + "path": "system.text.json/4.7.2", + "hashPath": "system.text.json.4.7.2.nupkg.sha512" + }, + "System.Text.RegularExpressions/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-RpT2DA+L660cBt1FssIE9CAGpLFdFPuheB7pLpKpn6ZXNby7jDERe8Ua/Ne2xGiwLVG2JOqziiaVCGDon5sKFA==", + "path": "system.text.regularexpressions/4.3.0", + "hashPath": "system.text.regularexpressions.4.3.0.nupkg.sha512" + }, + "System.Threading/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-VkUS0kOBcUf3Wwm0TSbrevDDZ6BlM+b/HRiapRFWjM5O0NS0LviG0glKmFK+hhPDd1XFeSdU1GmlLhb2CoVpIw==", + "path": "system.threading/4.3.0", + "hashPath": "system.threading.4.3.0.nupkg.sha512" + }, + "System.Threading.Tasks/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-LbSxKEdOUhVe8BezB/9uOGGppt+nZf6e1VFyw6v3DN6lqitm0OSn2uXMOdtP0M3W4iMcqcivm2J6UgqiwwnXiA==", + "path": "system.threading.tasks/4.3.0", + "hashPath": "system.threading.tasks.4.3.0.nupkg.sha512" + }, + "System.Threading.Tasks.Extensions/4.5.4": { + "type": "package", + "serviceable": true, + "sha512": "sha512-zteT+G8xuGu6mS+mzDzYXbzS7rd3K6Fjb9RiZlYlJPam2/hU7JCBZBVEcywNuR+oZ1ncTvc/cq0faRr3P01OVg==", + "path": "system.threading.tasks.extensions/4.5.4", + "hashPath": "system.threading.tasks.extensions.4.5.4.nupkg.sha512" + }, + "System.Threading.Thread/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-OHmbT+Zz065NKII/ZHcH9XO1dEuLGI1L2k7uYss+9C1jLxTC9kTZZuzUOyXHayRk+dft9CiDf3I/QZ0t8JKyBQ==", + "path": "system.threading.thread/4.3.0", + "hashPath": "system.threading.thread.4.3.0.nupkg.sha512" + }, + "System.Threading.ThreadPool/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-k/+g4b7vjdd4aix83sTgC9VG6oXYKAktSfNIJUNGxPEj7ryEOfzHHhfnmsZvjxawwcD9HyWXKCXmPjX8U4zeSw==", + "path": "system.threading.threadpool/4.3.0", + "hashPath": "system.threading.threadpool.4.3.0.nupkg.sha512" + }, + "System.Xml.ReaderWriter/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-GrprA+Z0RUXaR4N7/eW71j1rgMnEnEVlgii49GZyAjTH7uliMnrOU3HNFBr6fEDBCJCIdlVNq9hHbaDR621XBA==", + "path": "system.xml.readerwriter/4.3.0", + "hashPath": "system.xml.readerwriter.4.3.0.nupkg.sha512" + }, + "System.Xml.XDocument/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-5zJ0XDxAIg8iy+t4aMnQAu0MqVbqyvfoUVl1yDV61xdo3Vth45oA2FoY4pPkxYAH5f8ixpmTqXeEIya95x0aCQ==", + "path": "system.xml.xdocument/4.3.0", + "hashPath": "system.xml.xdocument.4.3.0.nupkg.sha512" + }, + "System.Xml.XmlDocument/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-lJ8AxvkX7GQxpC6GFCeBj8ThYVyQczx2+f/cWHJU8tjS7YfI6Cv6bon70jVEgs2CiFbmmM8b9j1oZVx0dSI2Ww==", + "path": "system.xml.xmldocument/4.3.0", + "hashPath": "system.xml.xmldocument.4.3.0.nupkg.sha512" + }, + "System.Xml.XmlSerializer/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-MYoTCP7EZ98RrANESW05J5ZwskKDoN0AuZ06ZflnowE50LTpbR5yRg3tHckTVm5j/m47stuGgCrCHWePyHS70Q==", + "path": "system.xml.xmlserializer/4.3.0", + "hashPath": "system.xml.xmlserializer.4.3.0.nupkg.sha512" + }, + "Microsoft.Azure.PowerShell.Authentication/1.0.0": { + "type": "project", + "serviceable": false, + "sha512": "" + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Authentication.ResourceManager.dll b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Authentication.ResourceManager.dll new file mode 100644 index 000000000000..fcc5eb26eb20 Binary files /dev/null and b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Authentication.ResourceManager.dll differ diff --git a/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Authentication.deps.json b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Authentication.deps.json new file mode 100644 index 000000000000..7828816a6777 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Authentication.deps.json @@ -0,0 +1,2273 @@ +{ + "runtimeTarget": { + "name": ".NETStandard,Version=v2.0/", + "signature": "" + }, + "compilationOptions": {}, + "targets": { + ".NETStandard,Version=v2.0": {}, + ".NETStandard,Version=v2.0/": { + "Microsoft.Azure.PowerShell.Authentication/1.0.0": { + "dependencies": { + "Azure.Core": "1.22.0", + "Azure.Identity": "1.5.0", + "Hyak.Common": "1.2.2", + "Microsoft.ApplicationInsights": "2.12.0", + "Microsoft.Azure.Common": "2.2.1", + "Microsoft.Azure.PowerShell.Authentication.Abstractions": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Clients.Aks": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Clients.Authorization": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Clients.Compute": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Clients.Graph.Rbac": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Clients.KeyVault": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Clients.Monitor": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Clients.Network": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Clients.PolicyInsights": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Clients.ResourceManager": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Clients.Storage.Management": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Clients.Websites": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Common": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Common.Share": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Storage": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Strategies": "1.3.57-preview", + "Microsoft.Rest.ClientRuntime": "2.3.23", + "Microsoft.Rest.ClientRuntime.Azure": "3.3.19", + "NETStandard.Library": "2.0.3", + "Newtonsoft.Json": "10.0.3", + "PowerShellStandard.Library": "5.1.0" + }, + "runtime": { + "Microsoft.Azure.PowerShell.Authentication.dll": {} + } + }, + "Azure.Core/1.22.0": { + "dependencies": { + "Microsoft.Bcl.AsyncInterfaces": "1.1.1", + "System.Diagnostics.DiagnosticSource": "4.6.0", + "System.Memory.Data": "1.0.2", + "System.Numerics.Vectors": "4.5.0", + "System.Text.Encodings.Web": "4.7.2", + "System.Text.Json": "4.7.2", + "System.Threading.Tasks.Extensions": "4.5.4" + }, + "runtime": { + "lib/netstandard2.0/Azure.Core.dll": { + "assemblyVersion": "1.22.0.0", + "fileVersion": "1.2200.22.6212" + } + } + }, + "Azure.Identity/1.5.0": { + "dependencies": { + "Azure.Core": "1.22.0", + "Microsoft.Identity.Client": "4.30.1", + "Microsoft.Identity.Client.Extensions.Msal": "2.18.4", + "System.Memory": "4.5.4", + "System.Security.Cryptography.ProtectedData": "4.5.0", + "System.Text.Json": "4.7.2", + "System.Threading.Tasks.Extensions": "4.5.4" + }, + "runtime": { + "lib/netstandard2.0/Azure.Identity.dll": { + "assemblyVersion": "1.5.0.0", + "fileVersion": "1.500.21.51401" + } + } + }, + "Hyak.Common/1.2.2": { + "dependencies": { + "NETStandard.Library": "2.0.3", + "Newtonsoft.Json": "10.0.3", + "System.Reflection": "4.3.0", + "System.Threading": "4.3.0" + }, + "runtime": { + "lib/netstandard1.4/Hyak.Common.dll": { + "assemblyVersion": "1.0.0.0", + "fileVersion": "1.2.2.0" + } + } + }, + "Microsoft.ApplicationInsights/2.12.0": { + "dependencies": { + "System.Diagnostics.DiagnosticSource": "4.6.0", + "System.Runtime.InteropServices": "4.3.0" + }, + "runtime": { + "lib/netstandard2.0/Microsoft.ApplicationInsights.dll": { + "assemblyVersion": "2.12.0.21496", + "fileVersion": "2.12.0.21496" + } + } + }, + "Microsoft.Azure.Common/2.2.1": { + "dependencies": { + "Hyak.Common": "1.2.2", + "NETStandard.Library": "2.0.3" + }, + "runtime": { + "lib/netstandard1.4/Microsoft.Azure.Common.dll": { + "assemblyVersion": "2.0.0.0", + "fileVersion": "2.2.1.0" + } + } + }, + "Microsoft.Azure.PowerShell.Authentication.Abstractions/1.3.57-preview": { + "dependencies": { + "Hyak.Common": "1.2.2", + "Microsoft.Azure.Common": "2.2.1", + "Microsoft.Rest.ClientRuntime": "2.3.23", + "Newtonsoft.Json": "10.0.3" + }, + "runtime": { + "lib/netstandard2.0/Microsoft.Azure.PowerShell.Authentication.Abstractions.dll": { + "assemblyVersion": "1.0.0.0", + "fileVersion": "1.3.57.0" + } + } + }, + "Microsoft.Azure.PowerShell.Clients.Aks/1.3.57-preview": { + "dependencies": { + "Microsoft.Rest.ClientRuntime": "2.3.23", + "Microsoft.Rest.ClientRuntime.Azure": "3.3.19", + "Newtonsoft.Json": "10.0.3" + }, + "runtime": { + "lib/netstandard2.0/Microsoft.Azure.PowerShell.Clients.Aks.dll": { + "assemblyVersion": "1.0.0.0", + "fileVersion": "1.3.57.0" + } + } + }, + "Microsoft.Azure.PowerShell.Clients.Authorization/1.3.57-preview": { + "dependencies": { + "Microsoft.Rest.ClientRuntime": "2.3.23", + "Microsoft.Rest.ClientRuntime.Azure": "3.3.19", + "Newtonsoft.Json": "10.0.3" + }, + "runtime": { + "lib/netstandard2.0/Microsoft.Azure.PowerShell.Clients.Authorization.dll": { + "assemblyVersion": "1.0.0.0", + "fileVersion": "1.3.57.0" + } + } + }, + "Microsoft.Azure.PowerShell.Clients.Compute/1.3.57-preview": { + "dependencies": { + "Microsoft.Rest.ClientRuntime": "2.3.23", + "Microsoft.Rest.ClientRuntime.Azure": "3.3.19", + "Newtonsoft.Json": "10.0.3" + }, + "runtime": { + "lib/netstandard2.0/Microsoft.Azure.PowerShell.Clients.Compute.dll": { + "assemblyVersion": "1.0.0.0", + "fileVersion": "1.3.57.0" + } + } + }, + "Microsoft.Azure.PowerShell.Clients.Graph.Rbac/1.3.57-preview": { + "dependencies": { + "Microsoft.Azure.PowerShell.Authentication.Abstractions": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Clients.ResourceManager": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Common": "1.3.57-preview", + "Microsoft.Rest.ClientRuntime": "2.3.23", + "Microsoft.Rest.ClientRuntime.Azure": "3.3.19", + "Newtonsoft.Json": "10.0.3" + }, + "runtime": { + "lib/netstandard2.0/Microsoft.Azure.PowerShell.Clients.Graph.Rbac.dll": { + "assemblyVersion": "1.0.0.0", + "fileVersion": "1.3.57.0" + } + } + }, + "Microsoft.Azure.PowerShell.Clients.KeyVault/1.3.57-preview": { + "dependencies": { + "Microsoft.Rest.ClientRuntime": "2.3.23", + "Microsoft.Rest.ClientRuntime.Azure": "3.3.19", + "Newtonsoft.Json": "10.0.3", + "System.Collections.NonGeneric": "4.3.0", + "System.Collections.Specialized": "4.3.0", + "System.Reflection": "4.3.0", + "System.Security.SecureString": "4.3.0", + "System.Xml.XmlDocument": "4.3.0", + "System.Xml.XmlSerializer": "4.3.0" + }, + "runtime": { + "lib/netstandard2.0/Microsoft.Azure.PowerShell.Clients.KeyVault.dll": { + "assemblyVersion": "1.0.0.0", + "fileVersion": "1.3.57.0" + } + } + }, + "Microsoft.Azure.PowerShell.Clients.Monitor/1.3.57-preview": { + "dependencies": { + "Microsoft.Rest.ClientRuntime": "2.3.23", + "Microsoft.Rest.ClientRuntime.Azure": "3.3.19", + "Newtonsoft.Json": "10.0.3", + "System.Collections.Specialized": "4.3.0", + "System.Reflection": "4.3.0", + "System.Security.SecureString": "4.3.0", + "System.Xml.XmlDocument": "4.3.0", + "System.Xml.XmlSerializer": "4.3.0" + }, + "runtime": { + "lib/netstandard2.0/Microsoft.Azure.PowerShell.Clients.Monitor.dll": { + "assemblyVersion": "1.0.0.0", + "fileVersion": "1.3.57.0" + } + } + }, + "Microsoft.Azure.PowerShell.Clients.Network/1.3.57-preview": { + "dependencies": { + "Microsoft.Azure.PowerShell.Authentication.Abstractions": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Common": "1.3.57-preview", + "Microsoft.Rest.ClientRuntime": "2.3.23", + "Microsoft.Rest.ClientRuntime.Azure": "3.3.19", + "Newtonsoft.Json": "10.0.3" + }, + "runtime": { + "lib/netstandard2.0/Microsoft.Azure.PowerShell.Clients.Network.dll": { + "assemblyVersion": "1.0.0.0", + "fileVersion": "1.3.57.0" + } + } + }, + "Microsoft.Azure.PowerShell.Clients.PolicyInsights/1.3.57-preview": { + "dependencies": { + "Microsoft.Rest.ClientRuntime": "2.3.23", + "Microsoft.Rest.ClientRuntime.Azure": "3.3.19", + "Newtonsoft.Json": "10.0.3" + }, + "runtime": { + "lib/netstandard2.0/Microsoft.Azure.PowerShell.Clients.PolicyInsights.dll": { + "assemblyVersion": "1.0.0.0", + "fileVersion": "1.3.57.0" + } + } + }, + "Microsoft.Azure.PowerShell.Clients.ResourceManager/1.3.57-preview": { + "dependencies": { + "Microsoft.Azure.PowerShell.Authentication.Abstractions": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Common": "1.3.57-preview", + "Microsoft.Rest.ClientRuntime": "2.3.23", + "Microsoft.Rest.ClientRuntime.Azure": "3.3.19", + "Newtonsoft.Json": "10.0.3" + }, + "runtime": { + "lib/netstandard2.0/Microsoft.Azure.PowerShell.Clients.ResourceManager.dll": { + "assemblyVersion": "1.0.0.0", + "fileVersion": "1.3.57.0" + } + } + }, + "Microsoft.Azure.PowerShell.Clients.Storage.Management/1.3.57-preview": { + "dependencies": { + "Microsoft.Rest.ClientRuntime": "2.3.23", + "Microsoft.Rest.ClientRuntime.Azure": "3.3.19", + "System.Collections.NonGeneric": "4.3.0" + }, + "runtime": { + "lib/netstandard2.0/Microsoft.Azure.PowerShell.Clients.Storage.Management.dll": { + "assemblyVersion": "1.0.0.0", + "fileVersion": "1.3.57.0" + } + } + }, + "Microsoft.Azure.PowerShell.Clients.Websites/1.3.57-preview": { + "dependencies": { + "Microsoft.Rest.ClientRuntime": "2.3.23", + "Microsoft.Rest.ClientRuntime.Azure": "3.3.19", + "Newtonsoft.Json": "10.0.3", + "System.Collections.Specialized": "4.3.0", + "System.Reflection": "4.3.0", + "System.Security.SecureString": "4.3.0", + "System.Xml.XmlDocument": "4.3.0", + "System.Xml.XmlSerializer": "4.3.0" + }, + "runtime": { + "lib/netstandard2.0/Microsoft.Azure.PowerShell.Clients.Websites.dll": { + "assemblyVersion": "1.0.0.0", + "fileVersion": "1.3.57.0" + } + } + }, + "Microsoft.Azure.PowerShell.Common/1.3.57-preview": { + "dependencies": { + "Hyak.Common": "1.2.2", + "Microsoft.ApplicationInsights": "2.12.0", + "Microsoft.Azure.Common": "2.2.1", + "Microsoft.Azure.PowerShell.Authentication.Abstractions": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Common.Share": "1.3.57-preview", + "Microsoft.Rest.ClientRuntime": "2.3.23", + "Microsoft.Rest.ClientRuntime.Azure": "3.3.19", + "Newtonsoft.Json": "10.0.3" + }, + "runtime": { + "lib/netstandard2.0/Microsoft.Azure.PowerShell.Common.dll": { + "assemblyVersion": "1.0.0.0", + "fileVersion": "1.3.57.0" + } + } + }, + "Microsoft.Azure.PowerShell.Common.Share/1.3.57-preview": { + "dependencies": { + "Hyak.Common": "1.2.2", + "Microsoft.Azure.Common": "2.2.1", + "Microsoft.Rest.ClientRuntime": "2.3.23", + "Microsoft.Rest.ClientRuntime.Azure": "3.3.19", + "Newtonsoft.Json": "10.0.3" + }, + "runtime": { + "lib/netstandard2.0/Microsoft.Azure.PowerShell.Common.Share.dll": { + "assemblyVersion": "1.0.0.0", + "fileVersion": "1.3.57.0" + } + } + }, + "Microsoft.Azure.PowerShell.Storage/1.3.57-preview": { + "dependencies": { + "Microsoft.Azure.PowerShell.Authentication.Abstractions": "1.3.57-preview", + "Microsoft.Rest.ClientRuntime": "2.3.23" + }, + "runtime": { + "lib/netstandard2.0/Microsoft.Azure.PowerShell.Storage.dll": { + "assemblyVersion": "1.0.0.0", + "fileVersion": "1.3.57.0" + } + } + }, + "Microsoft.Azure.PowerShell.Strategies/1.3.57-preview": { + "dependencies": { + "Microsoft.Rest.ClientRuntime": "2.3.23", + "Microsoft.Rest.ClientRuntime.Azure": "3.3.19", + "Newtonsoft.Json": "10.0.3" + }, + "runtime": { + "lib/netstandard2.0/Microsoft.Azure.PowerShell.Strategies.dll": { + "assemblyVersion": "1.0.0.0", + "fileVersion": "1.3.57.0" + } + } + }, + "Microsoft.Bcl.AsyncInterfaces/1.1.1": { + "dependencies": { + "System.Threading.Tasks.Extensions": "4.5.4" + }, + "runtime": { + "lib/netstandard2.0/Microsoft.Bcl.AsyncInterfaces.dll": { + "assemblyVersion": "1.0.0.0", + "fileVersion": "4.700.20.21406" + } + } + }, + "Microsoft.CSharp/4.5.0": { + "runtime": { + "lib/netstandard2.0/Microsoft.CSharp.dll": { + "assemblyVersion": "4.0.4.0", + "fileVersion": "4.6.26515.6" + } + } + }, + "Microsoft.Identity.Client/4.30.1": { + "dependencies": { + "Microsoft.CSharp": "4.5.0", + "NETStandard.Library": "2.0.3", + "System.ComponentModel.TypeConverter": "4.3.0", + "System.Diagnostics.Process": "4.3.0", + "System.Dynamic.Runtime": "4.3.0", + "System.Private.Uri": "4.3.2", + "System.Runtime.Serialization.Formatters": "4.3.0", + "System.Runtime.Serialization.Json": "4.3.0", + "System.Runtime.Serialization.Primitives": "4.3.0", + "System.Security.Cryptography.X509Certificates": "4.3.0", + "System.Security.SecureString": "4.3.0", + "System.Xml.XDocument": "4.3.0", + "System.Xml.XmlDocument": "4.3.0" + }, + "runtime": { + "lib/netstandard1.3/Microsoft.Identity.Client.dll": { + "assemblyVersion": "4.30.1.0", + "fileVersion": "4.30.1.0" + } + } + }, + "Microsoft.Identity.Client.Extensions.Msal/2.18.4": { + "dependencies": { + "Microsoft.Identity.Client": "4.30.1", + "System.Security.Cryptography.ProtectedData": "4.5.0" + }, + "runtime": { + "lib/netstandard2.0/Microsoft.Identity.Client.Extensions.Msal.dll": { + "assemblyVersion": "2.18.4.0", + "fileVersion": "2.18.4.0" + } + } + }, + "Microsoft.NETCore.Platforms/1.1.1": {}, + "Microsoft.NETCore.Targets/1.1.3": {}, + "Microsoft.Rest.ClientRuntime/2.3.23": { + "dependencies": { + "Newtonsoft.Json": "10.0.3" + }, + "runtime": { + "lib/netstandard2.0/Microsoft.Rest.ClientRuntime.dll": { + "assemblyVersion": "2.0.0.0", + "fileVersion": "2.3.23.0" + } + } + }, + "Microsoft.Rest.ClientRuntime.Azure/3.3.19": { + "dependencies": { + "Microsoft.Rest.ClientRuntime": "2.3.23", + "Newtonsoft.Json": "10.0.3" + }, + "runtime": { + "lib/netstandard2.0/Microsoft.Rest.ClientRuntime.Azure.dll": { + "assemblyVersion": "3.0.0.0", + "fileVersion": "3.3.18.0" + } + } + }, + "Microsoft.Win32.Primitives/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.1", + "Microsoft.NETCore.Targets": "1.1.3", + "System.Runtime": "4.3.0" + } + }, + "Microsoft.Win32.Registry/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.1", + "System.Collections": "4.3.0", + "System.Globalization": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Extensions": "4.3.0", + "System.Runtime.Handles": "4.3.0", + "System.Runtime.InteropServices": "4.3.0" + } + }, + "NETStandard.Library/2.0.3": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.1" + } + }, + "Newtonsoft.Json/10.0.3": { + "dependencies": { + "Microsoft.CSharp": "4.5.0", + "NETStandard.Library": "2.0.3", + "System.ComponentModel.TypeConverter": "4.3.0", + "System.Runtime.Serialization.Formatters": "4.3.0", + "System.Runtime.Serialization.Primitives": "4.3.0", + "System.Xml.XmlDocument": "4.3.0" + }, + "runtime": { + "lib/netstandard1.3/Newtonsoft.Json.dll": { + "assemblyVersion": "10.0.0.0", + "fileVersion": "10.0.3.21018" + } + } + }, + "PowerShellStandard.Library/5.1.0": {}, + "runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": {}, + "runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": {}, + "runtime.fedora.24-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": {}, + "runtime.native.System/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.1", + "Microsoft.NETCore.Targets": "1.1.3" + } + }, + "runtime.native.System.Net.Http/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.1", + "Microsoft.NETCore.Targets": "1.1.3" + } + }, + "runtime.native.System.Security.Cryptography.Apple/4.3.0": { + "dependencies": { + "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.Apple": "4.3.0" + } + }, + "runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { + "dependencies": { + "runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", + "runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", + "runtime.fedora.24-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", + "runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", + "runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", + "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", + "runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", + "runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", + "runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", + "runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0" + } + }, + "runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": {}, + "runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": {}, + "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.Apple/4.3.0": {}, + "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": {}, + "runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": {}, + "runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": {}, + "runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": {}, + "runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": {}, + "System.Buffers/4.5.1": { + "runtime": { + "lib/netstandard2.0/System.Buffers.dll": { + "assemblyVersion": "4.0.3.0", + "fileVersion": "4.6.28619.1" + } + } + }, + "System.Collections/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.1", + "Microsoft.NETCore.Targets": "1.1.3", + "System.Runtime": "4.3.0" + } + }, + "System.Collections.Concurrent/4.3.0": { + "dependencies": { + "System.Collections": "4.3.0", + "System.Diagnostics.Debug": "4.3.0", + "System.Diagnostics.Tracing": "4.3.0", + "System.Globalization": "4.3.0", + "System.Reflection": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Extensions": "4.3.0", + "System.Threading": "4.3.0", + "System.Threading.Tasks": "4.3.0" + }, + "runtime": { + "lib/netstandard1.3/System.Collections.Concurrent.dll": { + "assemblyVersion": "4.0.13.0", + "fileVersion": "4.6.24705.1" + } + } + }, + "System.Collections.NonGeneric/4.3.0": { + "dependencies": { + "System.Diagnostics.Debug": "4.3.0", + "System.Globalization": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Extensions": "4.3.0", + "System.Threading": "4.3.0" + }, + "runtime": { + "lib/netstandard1.3/System.Collections.NonGeneric.dll": { + "assemblyVersion": "4.0.2.0", + "fileVersion": "4.6.24705.1" + } + } + }, + "System.Collections.Specialized/4.3.0": { + "dependencies": { + "System.Collections.NonGeneric": "4.3.0", + "System.Globalization": "4.3.0", + "System.Globalization.Extensions": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Extensions": "4.3.0", + "System.Threading": "4.3.0" + }, + "runtime": { + "lib/netstandard1.3/System.Collections.Specialized.dll": { + "assemblyVersion": "4.0.2.0", + "fileVersion": "4.6.24705.1" + } + } + }, + "System.ComponentModel/4.3.0": { + "dependencies": { + "System.Runtime": "4.3.0" + }, + "runtime": { + "lib/netstandard1.3/System.ComponentModel.dll": { + "assemblyVersion": "4.0.2.0", + "fileVersion": "4.6.24705.1" + } + } + }, + "System.ComponentModel.Primitives/4.3.0": { + "dependencies": { + "System.ComponentModel": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0" + }, + "runtime": { + "lib/netstandard1.0/System.ComponentModel.Primitives.dll": { + "assemblyVersion": "4.1.1.0", + "fileVersion": "4.6.24705.1" + } + } + }, + "System.ComponentModel.TypeConverter/4.3.0": { + "dependencies": { + "System.Collections": "4.3.0", + "System.Collections.NonGeneric": "4.3.0", + "System.Collections.Specialized": "4.3.0", + "System.ComponentModel": "4.3.0", + "System.ComponentModel.Primitives": "4.3.0", + "System.Globalization": "4.3.0", + "System.Linq": "4.3.0", + "System.Reflection": "4.3.0", + "System.Reflection.Extensions": "4.3.0", + "System.Reflection.Primitives": "4.3.0", + "System.Reflection.TypeExtensions": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Extensions": "4.3.0", + "System.Threading": "4.3.0" + }, + "runtime": { + "lib/netstandard1.5/System.ComponentModel.TypeConverter.dll": { + "assemblyVersion": "4.1.1.0", + "fileVersion": "4.6.24705.1" + } + } + }, + "System.Diagnostics.Debug/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.1", + "Microsoft.NETCore.Targets": "1.1.3", + "System.Runtime": "4.3.0" + } + }, + "System.Diagnostics.DiagnosticSource/4.6.0": { + "dependencies": { + "System.Memory": "4.5.4" + }, + "runtime": { + "lib/netstandard1.3/System.Diagnostics.DiagnosticSource.dll": { + "assemblyVersion": "4.0.4.0", + "fileVersion": "4.700.19.46214" + } + } + }, + "System.Diagnostics.Process/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.1", + "Microsoft.Win32.Primitives": "4.3.0", + "Microsoft.Win32.Registry": "4.3.0", + "System.Collections": "4.3.0", + "System.Diagnostics.Debug": "4.3.0", + "System.Globalization": "4.3.0", + "System.IO": "4.3.0", + "System.IO.FileSystem": "4.3.0", + "System.IO.FileSystem.Primitives": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Extensions": "4.3.0", + "System.Runtime.Handles": "4.3.0", + "System.Runtime.InteropServices": "4.3.0", + "System.Text.Encoding": "4.3.0", + "System.Text.Encoding.Extensions": "4.3.0", + "System.Threading": "4.3.0", + "System.Threading.Tasks": "4.3.0", + "System.Threading.Thread": "4.3.0", + "System.Threading.ThreadPool": "4.3.0", + "runtime.native.System": "4.3.0" + } + }, + "System.Diagnostics.Tools/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.1", + "Microsoft.NETCore.Targets": "1.1.3", + "System.Runtime": "4.3.0" + } + }, + "System.Diagnostics.Tracing/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.1", + "Microsoft.NETCore.Targets": "1.1.3", + "System.Runtime": "4.3.0" + } + }, + "System.Dynamic.Runtime/4.3.0": { + "dependencies": { + "System.Collections": "4.3.0", + "System.Diagnostics.Debug": "4.3.0", + "System.Linq": "4.3.0", + "System.Linq.Expressions": "4.3.0", + "System.ObjectModel": "4.3.0", + "System.Reflection": "4.3.0", + "System.Reflection.Emit": "4.3.0", + "System.Reflection.Emit.ILGeneration": "4.3.0", + "System.Reflection.Primitives": "4.3.0", + "System.Reflection.TypeExtensions": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Extensions": "4.3.0", + "System.Threading": "4.3.0" + }, + "runtime": { + "lib/netstandard1.3/System.Dynamic.Runtime.dll": { + "assemblyVersion": "4.0.12.0", + "fileVersion": "4.6.24705.1" + } + } + }, + "System.Globalization/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.1", + "Microsoft.NETCore.Targets": "1.1.3", + "System.Runtime": "4.3.0" + } + }, + "System.Globalization.Calendars/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.1", + "Microsoft.NETCore.Targets": "1.1.3", + "System.Globalization": "4.3.0", + "System.Runtime": "4.3.0" + } + }, + "System.Globalization.Extensions/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.1", + "System.Globalization": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Extensions": "4.3.0", + "System.Runtime.InteropServices": "4.3.0" + } + }, + "System.IO/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.1", + "Microsoft.NETCore.Targets": "1.1.3", + "System.Runtime": "4.3.0", + "System.Text.Encoding": "4.3.0", + "System.Threading.Tasks": "4.3.0" + } + }, + "System.IO.FileSystem/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.1", + "Microsoft.NETCore.Targets": "1.1.3", + "System.IO": "4.3.0", + "System.IO.FileSystem.Primitives": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Handles": "4.3.0", + "System.Text.Encoding": "4.3.0", + "System.Threading.Tasks": "4.3.0" + } + }, + "System.IO.FileSystem.Primitives/4.3.0": { + "dependencies": { + "System.Runtime": "4.3.0" + }, + "runtime": { + "lib/netstandard1.3/System.IO.FileSystem.Primitives.dll": { + "assemblyVersion": "4.0.2.0", + "fileVersion": "4.6.24705.1" + } + } + }, + "System.Linq/4.3.0": { + "dependencies": { + "System.Collections": "4.3.0", + "System.Diagnostics.Debug": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Extensions": "4.3.0" + }, + "runtime": { + "lib/netstandard1.6/System.Linq.dll": { + "assemblyVersion": "4.1.1.0", + "fileVersion": "4.6.24705.1" + } + } + }, + "System.Linq.Expressions/4.3.0": { + "dependencies": { + "System.Collections": "4.3.0", + "System.Diagnostics.Debug": "4.3.0", + "System.Globalization": "4.3.0", + "System.IO": "4.3.0", + "System.Linq": "4.3.0", + "System.ObjectModel": "4.3.0", + "System.Reflection": "4.3.0", + "System.Reflection.Emit": "4.3.0", + "System.Reflection.Emit.ILGeneration": "4.3.0", + "System.Reflection.Emit.Lightweight": "4.3.0", + "System.Reflection.Extensions": "4.3.0", + "System.Reflection.Primitives": "4.3.0", + "System.Reflection.TypeExtensions": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Extensions": "4.3.0", + "System.Threading": "4.3.0" + }, + "runtime": { + "lib/netstandard1.6/System.Linq.Expressions.dll": { + "assemblyVersion": "4.1.1.0", + "fileVersion": "4.6.24705.1" + } + } + }, + "System.Memory/4.5.4": { + "dependencies": { + "System.Buffers": "4.5.1", + "System.Numerics.Vectors": "4.5.0", + "System.Runtime.CompilerServices.Unsafe": "4.7.1" + }, + "runtime": { + "lib/netstandard2.0/System.Memory.dll": { + "assemblyVersion": "4.0.1.1", + "fileVersion": "4.6.28619.1" + } + } + }, + "System.Memory.Data/1.0.2": { + "dependencies": { + "System.Text.Encodings.Web": "4.7.2", + "System.Text.Json": "4.7.2" + }, + "runtime": { + "lib/netstandard2.0/System.Memory.Data.dll": { + "assemblyVersion": "1.0.2.0", + "fileVersion": "1.0.221.20802" + } + } + }, + "System.Numerics.Vectors/4.5.0": { + "runtime": { + "lib/netstandard2.0/System.Numerics.Vectors.dll": { + "assemblyVersion": "4.1.4.0", + "fileVersion": "4.6.26515.6" + } + } + }, + "System.ObjectModel/4.3.0": { + "dependencies": { + "System.Collections": "4.3.0", + "System.Diagnostics.Debug": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Threading": "4.3.0" + }, + "runtime": { + "lib/netstandard1.3/System.ObjectModel.dll": { + "assemblyVersion": "4.0.13.0", + "fileVersion": "4.6.24705.1" + } + } + }, + "System.Private.DataContractSerialization/4.3.0": { + "dependencies": { + "System.Collections": "4.3.0", + "System.Collections.Concurrent": "4.3.0", + "System.Diagnostics.Debug": "4.3.0", + "System.Globalization": "4.3.0", + "System.IO": "4.3.0", + "System.Linq": "4.3.0", + "System.Reflection": "4.3.0", + "System.Reflection.Emit.ILGeneration": "4.3.0", + "System.Reflection.Emit.Lightweight": "4.3.0", + "System.Reflection.Extensions": "4.3.0", + "System.Reflection.Primitives": "4.3.0", + "System.Reflection.TypeExtensions": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Extensions": "4.3.0", + "System.Runtime.Serialization.Primitives": "4.3.0", + "System.Text.Encoding": "4.3.0", + "System.Text.Encoding.Extensions": "4.3.0", + "System.Text.RegularExpressions": "4.3.0", + "System.Threading": "4.3.0", + "System.Threading.Tasks": "4.3.0", + "System.Xml.ReaderWriter": "4.3.0", + "System.Xml.XDocument": "4.3.0", + "System.Xml.XmlDocument": "4.3.0", + "System.Xml.XmlSerializer": "4.3.0" + }, + "runtime": { + "lib/netstandard1.3/System.Private.DataContractSerialization.dll": { + "assemblyVersion": "4.1.2.0", + "fileVersion": "4.6.24705.1" + } + } + }, + "System.Private.Uri/4.3.2": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.1", + "Microsoft.NETCore.Targets": "1.1.3" + } + }, + "System.Reflection/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.1", + "Microsoft.NETCore.Targets": "1.1.3", + "System.IO": "4.3.0", + "System.Reflection.Primitives": "4.3.0", + "System.Runtime": "4.3.0" + } + }, + "System.Reflection.Emit/4.3.0": { + "dependencies": { + "System.IO": "4.3.0", + "System.Reflection": "4.3.0", + "System.Reflection.Emit.ILGeneration": "4.3.0", + "System.Reflection.Primitives": "4.3.0", + "System.Runtime": "4.3.0" + }, + "runtime": { + "lib/netstandard1.3/System.Reflection.Emit.dll": { + "assemblyVersion": "4.0.2.0", + "fileVersion": "4.6.24705.1" + } + } + }, + "System.Reflection.Emit.ILGeneration/4.3.0": { + "dependencies": { + "System.Reflection": "4.3.0", + "System.Reflection.Primitives": "4.3.0", + "System.Runtime": "4.3.0" + }, + "runtime": { + "lib/netstandard1.3/System.Reflection.Emit.ILGeneration.dll": { + "assemblyVersion": "4.0.2.0", + "fileVersion": "4.6.24705.1" + } + } + }, + "System.Reflection.Emit.Lightweight/4.3.0": { + "dependencies": { + "System.Reflection": "4.3.0", + "System.Reflection.Emit.ILGeneration": "4.3.0", + "System.Reflection.Primitives": "4.3.0", + "System.Runtime": "4.3.0" + }, + "runtime": { + "lib/netstandard1.3/System.Reflection.Emit.Lightweight.dll": { + "assemblyVersion": "4.0.2.0", + "fileVersion": "4.6.24705.1" + } + } + }, + "System.Reflection.Extensions/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.1", + "Microsoft.NETCore.Targets": "1.1.3", + "System.Reflection": "4.3.0", + "System.Runtime": "4.3.0" + } + }, + "System.Reflection.Primitives/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.1", + "Microsoft.NETCore.Targets": "1.1.3", + "System.Runtime": "4.3.0" + } + }, + "System.Reflection.TypeExtensions/4.3.0": { + "dependencies": { + "System.Reflection": "4.3.0", + "System.Runtime": "4.3.0" + }, + "runtime": { + "lib/netstandard1.5/System.Reflection.TypeExtensions.dll": { + "assemblyVersion": "4.1.1.0", + "fileVersion": "4.6.24705.1" + } + } + }, + "System.Resources.ResourceManager/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.1", + "Microsoft.NETCore.Targets": "1.1.3", + "System.Globalization": "4.3.0", + "System.Reflection": "4.3.0", + "System.Runtime": "4.3.0" + } + }, + "System.Runtime/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.1", + "Microsoft.NETCore.Targets": "1.1.3" + } + }, + "System.Runtime.CompilerServices.Unsafe/4.7.1": { + "runtime": { + "lib/netstandard2.0/System.Runtime.CompilerServices.Unsafe.dll": { + "assemblyVersion": "4.0.6.0", + "fileVersion": "4.700.20.12001" + } + } + }, + "System.Runtime.Extensions/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.1", + "Microsoft.NETCore.Targets": "1.1.3", + "System.Runtime": "4.3.0" + } + }, + "System.Runtime.Handles/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.1", + "Microsoft.NETCore.Targets": "1.1.3", + "System.Runtime": "4.3.0" + } + }, + "System.Runtime.InteropServices/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.1", + "Microsoft.NETCore.Targets": "1.1.3", + "System.Reflection": "4.3.0", + "System.Reflection.Primitives": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Handles": "4.3.0" + } + }, + "System.Runtime.Numerics/4.3.0": { + "dependencies": { + "System.Globalization": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Extensions": "4.3.0" + }, + "runtime": { + "lib/netstandard1.3/System.Runtime.Numerics.dll": { + "assemblyVersion": "4.0.2.0", + "fileVersion": "4.6.24705.1" + } + } + }, + "System.Runtime.Serialization.Formatters/4.3.0": { + "dependencies": { + "System.Collections": "4.3.0", + "System.Reflection": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Serialization.Primitives": "4.3.0" + }, + "runtime": { + "lib/netstandard1.4/System.Runtime.Serialization.Formatters.dll": { + "assemblyVersion": "4.0.1.0", + "fileVersion": "4.6.24705.1" + } + } + }, + "System.Runtime.Serialization.Json/4.3.0": { + "dependencies": { + "System.IO": "4.3.0", + "System.Private.DataContractSerialization": "4.3.0", + "System.Runtime": "4.3.0" + }, + "runtime": { + "lib/netstandard1.3/System.Runtime.Serialization.Json.dll": { + "assemblyVersion": "4.0.3.0", + "fileVersion": "4.6.24705.1" + } + } + }, + "System.Runtime.Serialization.Primitives/4.3.0": { + "dependencies": { + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0" + }, + "runtime": { + "lib/netstandard1.3/System.Runtime.Serialization.Primitives.dll": { + "assemblyVersion": "4.1.2.0", + "fileVersion": "4.6.24705.1" + } + } + }, + "System.Security.Cryptography.Algorithms/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.1", + "System.Collections": "4.3.0", + "System.IO": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Extensions": "4.3.0", + "System.Runtime.Handles": "4.3.0", + "System.Runtime.InteropServices": "4.3.0", + "System.Runtime.Numerics": "4.3.0", + "System.Security.Cryptography.Encoding": "4.3.0", + "System.Security.Cryptography.Primitives": "4.3.0", + "System.Text.Encoding": "4.3.0", + "runtime.native.System.Security.Cryptography.Apple": "4.3.0", + "runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0" + } + }, + "System.Security.Cryptography.Cng/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.1", + "System.IO": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Extensions": "4.3.0", + "System.Runtime.Handles": "4.3.0", + "System.Runtime.InteropServices": "4.3.0", + "System.Security.Cryptography.Algorithms": "4.3.0", + "System.Security.Cryptography.Encoding": "4.3.0", + "System.Security.Cryptography.Primitives": "4.3.0", + "System.Text.Encoding": "4.3.0" + } + }, + "System.Security.Cryptography.Csp/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.1", + "System.IO": "4.3.0", + "System.Reflection": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Extensions": "4.3.0", + "System.Runtime.Handles": "4.3.0", + "System.Runtime.InteropServices": "4.3.0", + "System.Security.Cryptography.Algorithms": "4.3.0", + "System.Security.Cryptography.Encoding": "4.3.0", + "System.Security.Cryptography.Primitives": "4.3.0", + "System.Text.Encoding": "4.3.0", + "System.Threading": "4.3.0" + } + }, + "System.Security.Cryptography.Encoding/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.1", + "System.Collections": "4.3.0", + "System.Collections.Concurrent": "4.3.0", + "System.Linq": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Extensions": "4.3.0", + "System.Runtime.Handles": "4.3.0", + "System.Runtime.InteropServices": "4.3.0", + "System.Security.Cryptography.Primitives": "4.3.0", + "System.Text.Encoding": "4.3.0", + "runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0" + } + }, + "System.Security.Cryptography.OpenSsl/4.3.0": { + "dependencies": { + "System.Collections": "4.3.0", + "System.IO": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Extensions": "4.3.0", + "System.Runtime.Handles": "4.3.0", + "System.Runtime.InteropServices": "4.3.0", + "System.Runtime.Numerics": "4.3.0", + "System.Security.Cryptography.Algorithms": "4.3.0", + "System.Security.Cryptography.Encoding": "4.3.0", + "System.Security.Cryptography.Primitives": "4.3.0", + "System.Text.Encoding": "4.3.0", + "runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0" + }, + "runtime": { + "lib/netstandard1.6/System.Security.Cryptography.OpenSsl.dll": { + "assemblyVersion": "4.0.0.0", + "fileVersion": "1.0.24212.1" + } + } + }, + "System.Security.Cryptography.Primitives/4.3.0": { + "dependencies": { + "System.Diagnostics.Debug": "4.3.0", + "System.Globalization": "4.3.0", + "System.IO": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Threading": "4.3.0", + "System.Threading.Tasks": "4.3.0" + }, + "runtime": { + "lib/netstandard1.3/System.Security.Cryptography.Primitives.dll": { + "assemblyVersion": "4.0.1.0", + "fileVersion": "4.6.24705.1" + } + } + }, + "System.Security.Cryptography.ProtectedData/4.5.0": { + "dependencies": { + "System.Memory": "4.5.4" + }, + "runtime": { + "lib/netstandard2.0/System.Security.Cryptography.ProtectedData.dll": { + "assemblyVersion": "4.0.3.0", + "fileVersion": "4.6.26515.6" + } + } + }, + "System.Security.Cryptography.X509Certificates/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.1", + "System.Collections": "4.3.0", + "System.Diagnostics.Debug": "4.3.0", + "System.Globalization": "4.3.0", + "System.Globalization.Calendars": "4.3.0", + "System.IO": "4.3.0", + "System.IO.FileSystem": "4.3.0", + "System.IO.FileSystem.Primitives": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Extensions": "4.3.0", + "System.Runtime.Handles": "4.3.0", + "System.Runtime.InteropServices": "4.3.0", + "System.Runtime.Numerics": "4.3.0", + "System.Security.Cryptography.Algorithms": "4.3.0", + "System.Security.Cryptography.Cng": "4.3.0", + "System.Security.Cryptography.Csp": "4.3.0", + "System.Security.Cryptography.Encoding": "4.3.0", + "System.Security.Cryptography.OpenSsl": "4.3.0", + "System.Security.Cryptography.Primitives": "4.3.0", + "System.Text.Encoding": "4.3.0", + "System.Threading": "4.3.0", + "runtime.native.System": "4.3.0", + "runtime.native.System.Net.Http": "4.3.0", + "runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0" + } + }, + "System.Security.SecureString/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.1", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Handles": "4.3.0", + "System.Runtime.InteropServices": "4.3.0", + "System.Security.Cryptography.Primitives": "4.3.0", + "System.Text.Encoding": "4.3.0", + "System.Threading": "4.3.0" + } + }, + "System.Text.Encoding/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.1", + "Microsoft.NETCore.Targets": "1.1.3", + "System.Runtime": "4.3.0" + } + }, + "System.Text.Encoding.Extensions/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.1", + "Microsoft.NETCore.Targets": "1.1.3", + "System.Runtime": "4.3.0", + "System.Text.Encoding": "4.3.0" + } + }, + "System.Text.Encodings.Web/4.7.2": { + "dependencies": { + "System.Buffers": "4.5.1", + "System.Memory": "4.5.4" + }, + "runtime": { + "lib/netstandard2.0/System.Text.Encodings.Web.dll": { + "assemblyVersion": "4.0.5.1", + "fileVersion": "4.700.21.11602" + } + } + }, + "System.Text.Json/4.7.2": { + "dependencies": { + "Microsoft.Bcl.AsyncInterfaces": "1.1.1", + "System.Buffers": "4.5.1", + "System.Memory": "4.5.4", + "System.Numerics.Vectors": "4.5.0", + "System.Runtime.CompilerServices.Unsafe": "4.7.1", + "System.Text.Encodings.Web": "4.7.2", + "System.Threading.Tasks.Extensions": "4.5.4" + }, + "runtime": { + "lib/netstandard2.0/System.Text.Json.dll": { + "assemblyVersion": "4.0.1.2", + "fileVersion": "4.700.20.21406" + } + } + }, + "System.Text.RegularExpressions/4.3.0": { + "dependencies": { + "System.Collections": "4.3.0", + "System.Globalization": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Extensions": "4.3.0", + "System.Threading": "4.3.0" + }, + "runtime": { + "lib/netstandard1.6/System.Text.RegularExpressions.dll": { + "assemblyVersion": "4.1.1.0", + "fileVersion": "4.6.24705.1" + } + } + }, + "System.Threading/4.3.0": { + "dependencies": { + "System.Runtime": "4.3.0", + "System.Threading.Tasks": "4.3.0" + }, + "runtime": { + "lib/netstandard1.3/System.Threading.dll": { + "assemblyVersion": "4.0.12.0", + "fileVersion": "4.6.24705.1" + } + } + }, + "System.Threading.Tasks/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.1", + "Microsoft.NETCore.Targets": "1.1.3", + "System.Runtime": "4.3.0" + } + }, + "System.Threading.Tasks.Extensions/4.5.4": { + "dependencies": { + "System.Runtime.CompilerServices.Unsafe": "4.7.1" + }, + "runtime": { + "lib/netstandard2.0/System.Threading.Tasks.Extensions.dll": { + "assemblyVersion": "4.2.0.1", + "fileVersion": "4.6.28619.1" + } + } + }, + "System.Threading.Thread/4.3.0": { + "dependencies": { + "System.Runtime": "4.3.0" + }, + "runtime": { + "lib/netstandard1.3/System.Threading.Thread.dll": { + "assemblyVersion": "4.0.1.0", + "fileVersion": "4.6.24705.1" + } + } + }, + "System.Threading.ThreadPool/4.3.0": { + "dependencies": { + "System.Runtime": "4.3.0", + "System.Runtime.Handles": "4.3.0" + }, + "runtime": { + "lib/netstandard1.3/System.Threading.ThreadPool.dll": { + "assemblyVersion": "4.0.11.0", + "fileVersion": "4.6.24705.1" + } + } + }, + "System.Xml.ReaderWriter/4.3.0": { + "dependencies": { + "System.Collections": "4.3.0", + "System.Diagnostics.Debug": "4.3.0", + "System.Globalization": "4.3.0", + "System.IO": "4.3.0", + "System.IO.FileSystem": "4.3.0", + "System.IO.FileSystem.Primitives": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Extensions": "4.3.0", + "System.Runtime.InteropServices": "4.3.0", + "System.Text.Encoding": "4.3.0", + "System.Text.Encoding.Extensions": "4.3.0", + "System.Text.RegularExpressions": "4.3.0", + "System.Threading.Tasks": "4.3.0", + "System.Threading.Tasks.Extensions": "4.5.4" + }, + "runtime": { + "lib/netstandard1.3/System.Xml.ReaderWriter.dll": { + "assemblyVersion": "4.1.0.0", + "fileVersion": "4.6.24705.1" + } + } + }, + "System.Xml.XDocument/4.3.0": { + "dependencies": { + "System.Collections": "4.3.0", + "System.Diagnostics.Debug": "4.3.0", + "System.Diagnostics.Tools": "4.3.0", + "System.Globalization": "4.3.0", + "System.IO": "4.3.0", + "System.Reflection": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Extensions": "4.3.0", + "System.Text.Encoding": "4.3.0", + "System.Threading": "4.3.0", + "System.Xml.ReaderWriter": "4.3.0" + }, + "runtime": { + "lib/netstandard1.3/System.Xml.XDocument.dll": { + "assemblyVersion": "4.0.12.0", + "fileVersion": "4.6.24705.1" + } + } + }, + "System.Xml.XmlDocument/4.3.0": { + "dependencies": { + "System.Collections": "4.3.0", + "System.Diagnostics.Debug": "4.3.0", + "System.Globalization": "4.3.0", + "System.IO": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Extensions": "4.3.0", + "System.Text.Encoding": "4.3.0", + "System.Threading": "4.3.0", + "System.Xml.ReaderWriter": "4.3.0" + }, + "runtime": { + "lib/netstandard1.3/System.Xml.XmlDocument.dll": { + "assemblyVersion": "4.0.2.0", + "fileVersion": "4.6.24705.1" + } + } + }, + "System.Xml.XmlSerializer/4.3.0": { + "dependencies": { + "System.Collections": "4.3.0", + "System.Globalization": "4.3.0", + "System.IO": "4.3.0", + "System.Linq": "4.3.0", + "System.Reflection": "4.3.0", + "System.Reflection.Emit": "4.3.0", + "System.Reflection.Emit.ILGeneration": "4.3.0", + "System.Reflection.Extensions": "4.3.0", + "System.Reflection.Primitives": "4.3.0", + "System.Reflection.TypeExtensions": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Extensions": "4.3.0", + "System.Text.RegularExpressions": "4.3.0", + "System.Threading": "4.3.0", + "System.Xml.ReaderWriter": "4.3.0", + "System.Xml.XmlDocument": "4.3.0" + }, + "runtime": { + "lib/netstandard1.3/System.Xml.XmlSerializer.dll": { + "assemblyVersion": "4.0.12.0", + "fileVersion": "4.6.24705.1" + } + } + } + } + }, + "libraries": { + "Microsoft.Azure.PowerShell.Authentication/1.0.0": { + "type": "project", + "serviceable": false, + "sha512": "" + }, + "Azure.Core/1.22.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-ze/xRCHSSDe5TIk5vBDbVrauW1EN7UIbnBvIBfMH8KSt/I9+/7yPAjTBDgNBk0IwG6WBV+BBHp4IUtS/PGAQwQ==", + "path": "azure.core/1.22.0", + "hashPath": "azure.core.1.22.0.nupkg.sha512" + }, + "Azure.Identity/1.5.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-VfF88dqrgKXZNOS/y4XrX/jmIfP3pkY+hBUzBNpoKml1nR+QshX6XlXWyToLtWV80TDQ1CmUVCJksktDg5+j1w==", + "path": "azure.identity/1.5.0", + "hashPath": "azure.identity.1.5.0.nupkg.sha512" + }, + "Hyak.Common/1.2.2": { + "type": "package", + "serviceable": true, + "sha512": "sha512-uZpnFn48nSQwHcO0/GSBZ7ExaO0sTXKv8KariXXEWLaB4Q3AeQoprYG4WpKsCT0ByW3YffETivgc5rcH5RRDvQ==", + "path": "hyak.common/1.2.2", + "hashPath": "hyak.common.1.2.2.nupkg.sha512" + }, + "Microsoft.ApplicationInsights/2.12.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-4vZcVaxywAzfLm5mAc2/llaZQTzbCqu9KirxxI/t49AkZH5Qxf7JxuAMUuv2/6JEdOOkGDzpvdrrIlf6LkFGcg==", + "path": "microsoft.applicationinsights/2.12.0", + "hashPath": "microsoft.applicationinsights.2.12.0.nupkg.sha512" + }, + "Microsoft.Azure.Common/2.2.1": { + "type": "package", + "serviceable": true, + "sha512": "sha512-abzRooh4ACKjzAKxRB6r+SHKW3d+IrLcgtVG81D+3kQU/OMjAZS1oDp9CDalhSbmxa84u0MHM5N+AKeTtKPoiw==", + "path": "microsoft.azure.common/2.2.1", + "hashPath": "microsoft.azure.common.2.2.1.nupkg.sha512" + }, + "Microsoft.Azure.PowerShell.Authentication.Abstractions/1.3.57-preview": { + "type": "package", + "serviceable": true, + "sha512": "sha512-bKDPidNeqBpTDikPnIuoMoGd26pD2PNE41cut0ASwL5exJwLNggYO55U+f/cJkgjCUMR8i5nqnlfpGHSS1I0vw==", + "path": "microsoft.azure.powershell.authentication.abstractions/1.3.57-preview", + "hashPath": "microsoft.azure.powershell.authentication.abstractions.1.3.57-preview.nupkg.sha512" + }, + "Microsoft.Azure.PowerShell.Clients.Aks/1.3.57-preview": { + "type": "package", + "serviceable": true, + "sha512": "sha512-sUGkvOvpqlEK5zdZ7HWaou3GY5bnlNrE0LuZ137+TsNfgx2E3+0Ika3a02i/9+niDDf60xj4LaNOYDSuK5zdJA==", + "path": "microsoft.azure.powershell.clients.aks/1.3.57-preview", + "hashPath": "microsoft.azure.powershell.clients.aks.1.3.57-preview.nupkg.sha512" + }, + "Microsoft.Azure.PowerShell.Clients.Authorization/1.3.57-preview": { + "type": "package", + "serviceable": true, + "sha512": "sha512-Q760F40/qfas2Al+GQhhE4gJt768pQPxlCjqrjjkukgVsq+X/M8IqpCeBzbRTiiyerhcjJoyNxqlGuZpUhqGxw==", + "path": "microsoft.azure.powershell.clients.authorization/1.3.57-preview", + "hashPath": "microsoft.azure.powershell.clients.authorization.1.3.57-preview.nupkg.sha512" + }, + "Microsoft.Azure.PowerShell.Clients.Compute/1.3.57-preview": { + "type": "package", + "serviceable": true, + "sha512": "sha512-1fcsBdYMmEJPMPN8EAgJkaJ2WxxTKH3VcLECYdL2cfg2bgN8CKbbjSvarrXEezhyduE+LdYnL0e8Pigsnaj55Q==", + "path": "microsoft.azure.powershell.clients.compute/1.3.57-preview", + "hashPath": "microsoft.azure.powershell.clients.compute.1.3.57-preview.nupkg.sha512" + }, + "Microsoft.Azure.PowerShell.Clients.Graph.Rbac/1.3.57-preview": { + "type": "package", + "serviceable": true, + "sha512": "sha512-BIMthJ1x2vQAN3iWChnNj8BfgrXvKXn+n06E0/h2MNurMXbAOn5eiPIfE8bnj2BO99uSh1ns09yEgOTPJIvZBQ==", + "path": "microsoft.azure.powershell.clients.graph.rbac/1.3.57-preview", + "hashPath": "microsoft.azure.powershell.clients.graph.rbac.1.3.57-preview.nupkg.sha512" + }, + "Microsoft.Azure.PowerShell.Clients.KeyVault/1.3.57-preview": { + "type": "package", + "serviceable": true, + "sha512": "sha512-MfvwM8ABj/EswmYu0Bf/8kyAO6kUv2zYSihVn384SVmypomVKUu69GN0VXKbmGaovPI8v3H41Ldp7DqbPRun5A==", + "path": "microsoft.azure.powershell.clients.keyvault/1.3.57-preview", + "hashPath": "microsoft.azure.powershell.clients.keyvault.1.3.57-preview.nupkg.sha512" + }, + "Microsoft.Azure.PowerShell.Clients.Monitor/1.3.57-preview": { + "type": "package", + "serviceable": true, + "sha512": "sha512-UyCKG5BWVjYFRtH2JNx6f4KdccaSqww2y0OE2PYgib8VhLqkoPr/BQg6vKzaGsghLIerZ/egQ7ntPPw3PCtS3w==", + "path": "microsoft.azure.powershell.clients.monitor/1.3.57-preview", + "hashPath": "microsoft.azure.powershell.clients.monitor.1.3.57-preview.nupkg.sha512" + }, + "Microsoft.Azure.PowerShell.Clients.Network/1.3.57-preview": { + "type": "package", + "serviceable": true, + "sha512": "sha512-YAAHxw+zzvkGNWAi668NSoTR+V/7vf+gRhu1oFa1O1/f2NGpz5XuqPrQyAPrri64hKqB/k3OMrM7sjlIv16dAg==", + "path": "microsoft.azure.powershell.clients.network/1.3.57-preview", + "hashPath": "microsoft.azure.powershell.clients.network.1.3.57-preview.nupkg.sha512" + }, + "Microsoft.Azure.PowerShell.Clients.PolicyInsights/1.3.57-preview": { + "type": "package", + "serviceable": true, + "sha512": "sha512-urRIwRVzzOwpk8HhKq/b785DiL/arnmGUHbN4HvRN6ZsBkE1PU431YwgUlofb9pfB3buLcl0XJFRPLBJ0yZJUw==", + "path": "microsoft.azure.powershell.clients.policyinsights/1.3.57-preview", + "hashPath": "microsoft.azure.powershell.clients.policyinsights.1.3.57-preview.nupkg.sha512" + }, + "Microsoft.Azure.PowerShell.Clients.ResourceManager/1.3.57-preview": { + "type": "package", + "serviceable": true, + "sha512": "sha512-juWnd63Z2Sp+6bvtOPOF0Gj1v2AfpxXcuyodd9+U7euBro2G7Yfo2UHmHo/uaYyQUbM3HaXJPvse7BLDKjhe6w==", + "path": "microsoft.azure.powershell.clients.resourcemanager/1.3.57-preview", + "hashPath": "microsoft.azure.powershell.clients.resourcemanager.1.3.57-preview.nupkg.sha512" + }, + "Microsoft.Azure.PowerShell.Clients.Storage.Management/1.3.57-preview": { + "type": "package", + "serviceable": true, + "sha512": "sha512-HPpTWIlN+5ALqJssL7+6BD/vYrWi3eWKQ3QpWYjCFk5c9HVLTNpP+M2dq9jbsxLsZj+5Pt6gC4FIS22Q13Uhag==", + "path": "microsoft.azure.powershell.clients.storage.management/1.3.57-preview", + "hashPath": "microsoft.azure.powershell.clients.storage.management.1.3.57-preview.nupkg.sha512" + }, + "Microsoft.Azure.PowerShell.Clients.Websites/1.3.57-preview": { + "type": "package", + "serviceable": true, + "sha512": "sha512-b5yBD9FrY02r0kdNNgZ+uU0/QsW3AtmnCE/x1mUG5j8ka/V04AYUo+sDokQBzu+vnK6Y6OrVDtyWjmnKTDHpWA==", + "path": "microsoft.azure.powershell.clients.websites/1.3.57-preview", + "hashPath": "microsoft.azure.powershell.clients.websites.1.3.57-preview.nupkg.sha512" + }, + "Microsoft.Azure.PowerShell.Common/1.3.57-preview": { + "type": "package", + "serviceable": true, + "sha512": "sha512-9jZYZ9LKbx16r69y7cO9d7bDjpE0/HgeBU386Y/O6q05VRaq2wAsB2rbQ9AjxcPGHfwS0+2US/RImSSqjVABRQ==", + "path": "microsoft.azure.powershell.common/1.3.57-preview", + "hashPath": "microsoft.azure.powershell.common.1.3.57-preview.nupkg.sha512" + }, + "Microsoft.Azure.PowerShell.Common.Share/1.3.57-preview": { + "type": "package", + "serviceable": true, + "sha512": "sha512-4mJSjnwZVLQYWhP47eDzdt0yaLIf2I4pqaEIqcfAjkjdbKpnCXCnJUEFRId061yuKpq1LtfBZkHDRi68I5CJxg==", + "path": "microsoft.azure.powershell.common.share/1.3.57-preview", + "hashPath": "microsoft.azure.powershell.common.share.1.3.57-preview.nupkg.sha512" + }, + "Microsoft.Azure.PowerShell.Storage/1.3.57-preview": { + "type": "package", + "serviceable": true, + "sha512": "sha512-fObXEcuhk1JUoQ0fiCV4nK4NJWqvsfsKCzapF7SFEQ87X6AasL6m5KGT8JQSnHmc849xxxaixPTxyWaf9BBlpw==", + "path": "microsoft.azure.powershell.storage/1.3.57-preview", + "hashPath": "microsoft.azure.powershell.storage.1.3.57-preview.nupkg.sha512" + }, + "Microsoft.Azure.PowerShell.Strategies/1.3.57-preview": { + "type": "package", + "serviceable": true, + "sha512": "sha512-HwyxUwDHCmY6Zdxg2xpFC9Gqmu92Xr0cAr4ElWYwz8Z7PE9uYVkTpKMIKd7oIJJgsIANTfqEU1HKoeI3FXPLqw==", + "path": "microsoft.azure.powershell.strategies/1.3.57-preview", + "hashPath": "microsoft.azure.powershell.strategies.1.3.57-preview.nupkg.sha512" + }, + "Microsoft.Bcl.AsyncInterfaces/1.1.1": { + "type": "package", + "serviceable": true, + "sha512": "sha512-yuvf07qFWFqtK3P/MRkEKLhn5r2UbSpVueRziSqj0yJQIKFwG1pq9mOayK3zE5qZCTs0CbrwL9M6R8VwqyGy2w==", + "path": "microsoft.bcl.asyncinterfaces/1.1.1", + "hashPath": "microsoft.bcl.asyncinterfaces.1.1.1.nupkg.sha512" + }, + "Microsoft.CSharp/4.5.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-kaj6Wb4qoMuH3HySFJhxwQfe8R/sJsNJnANrvv8WdFPMoNbKY5htfNscv+LHCu5ipz+49m2e+WQXpLXr9XYemQ==", + "path": "microsoft.csharp/4.5.0", + "hashPath": "microsoft.csharp.4.5.0.nupkg.sha512" + }, + "Microsoft.Identity.Client/4.30.1": { + "type": "package", + "serviceable": true, + "sha512": "sha512-xk8tJeGfB2yD3+d7a0DXyV7/HYyEG10IofUHYHoPYKmDbroi/j9t1BqSHgbq1nARDjg7m8Ki6e21AyNU7e/R4Q==", + "path": "microsoft.identity.client/4.30.1", + "hashPath": "microsoft.identity.client.4.30.1.nupkg.sha512" + }, + "Microsoft.Identity.Client.Extensions.Msal/2.18.4": { + "type": "package", + "serviceable": true, + "sha512": "sha512-HpG4oLwhQsy0ce7OWq9iDdLtJKOvKRStIKoSEOeBMKuohfuOWNDyhg8fMAJkpG/kFeoe4J329fiMHcJmmB+FPw==", + "path": "microsoft.identity.client.extensions.msal/2.18.4", + "hashPath": "microsoft.identity.client.extensions.msal.2.18.4.nupkg.sha512" + }, + "Microsoft.NETCore.Platforms/1.1.1": { + "type": "package", + "serviceable": true, + "sha512": "sha512-TMBuzAHpTenGbGgk0SMTwyEkyijY/Eae4ZGsFNYJvAr/LDn1ku3Etp3FPxChmDp5HHF3kzJuoaa08N0xjqAJfQ==", + "path": "microsoft.netcore.platforms/1.1.1", + "hashPath": "microsoft.netcore.platforms.1.1.1.nupkg.sha512" + }, + "Microsoft.NETCore.Targets/1.1.3": { + "type": "package", + "serviceable": true, + "sha512": "sha512-3Wrmi0kJDzClwAC+iBdUBpEKmEle8FQNsCs77fkiOIw/9oYA07bL1EZNX0kQ2OMN3xpwvl0vAtOCYY3ndDNlhQ==", + "path": "microsoft.netcore.targets/1.1.3", + "hashPath": "microsoft.netcore.targets.1.1.3.nupkg.sha512" + }, + "Microsoft.Rest.ClientRuntime/2.3.23": { + "type": "package", + "serviceable": true, + "sha512": "sha512-92kNTi1N7zI5wwI2ZXswBRnk61OUYnuYJXrlgOhes5IsAqGmgw9DPGmhUzeY8OaZ8TTrQdDzvgXFnbCHwLzSVA==", + "path": "microsoft.rest.clientruntime/2.3.23", + "hashPath": "microsoft.rest.clientruntime.2.3.23.nupkg.sha512" + }, + "Microsoft.Rest.ClientRuntime.Azure/3.3.19": { + "type": "package", + "serviceable": true, + "sha512": "sha512-+NVBWvRXNwaAPTZUxjUlQggsrf3X0GbiRoxYfgc3kG9E55ZxZxvZPT3nIfC4DNqzGSXUEvmLbckdXgBBzGdUaA==", + "path": "microsoft.rest.clientruntime.azure/3.3.19", + "hashPath": "microsoft.rest.clientruntime.azure.3.3.19.nupkg.sha512" + }, + "Microsoft.Win32.Primitives/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-9ZQKCWxH7Ijp9BfahvL2Zyf1cJIk8XYLF6Yjzr2yi0b2cOut/HQ31qf1ThHAgCc3WiZMdnWcfJCgN82/0UunxA==", + "path": "microsoft.win32.primitives/4.3.0", + "hashPath": "microsoft.win32.primitives.4.3.0.nupkg.sha512" + }, + "Microsoft.Win32.Registry/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-Lw1/VwLH1yxz6SfFEjVRCN0pnflLEsWgnV4qsdJ512/HhTwnKXUG+zDQ4yTO3K/EJQemGoNaBHX5InISNKTzUQ==", + "path": "microsoft.win32.registry/4.3.0", + "hashPath": "microsoft.win32.registry.4.3.0.nupkg.sha512" + }, + "NETStandard.Library/2.0.3": { + "type": "package", + "serviceable": true, + "sha512": "sha512-st47PosZSHrjECdjeIzZQbzivYBJFv6P2nv4cj2ypdI204DO+vZ7l5raGMiX4eXMJ53RfOIg+/s4DHVZ54Nu2A==", + "path": "netstandard.library/2.0.3", + "hashPath": "netstandard.library.2.0.3.nupkg.sha512" + }, + "Newtonsoft.Json/10.0.3": { + "type": "package", + "serviceable": true, + "sha512": "sha512-hSXaFmh7hNCuEoC4XNY5DrRkLDzYHqPx/Ik23R4J86Z7PE/Y6YidhG602dFVdLBRSdG6xp9NabH3dXpcoxWvww==", + "path": "newtonsoft.json/10.0.3", + "hashPath": "newtonsoft.json.10.0.3.nupkg.sha512" + }, + "PowerShellStandard.Library/5.1.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-iYaRvQsM1fow9h3uEmio+2m2VXfulgI16AYHaTZ8Sf7erGe27Qc8w/h6QL5UPuwv1aXR40QfzMEwcCeiYJp2cw==", + "path": "powershellstandard.library/5.1.0", + "hashPath": "powershellstandard.library.5.1.0.nupkg.sha512" + }, + "runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-HdSSp5MnJSsg08KMfZThpuLPJpPwE5hBXvHwoKWosyHHfe8Mh5WKT0ylEOf6yNzX6Ngjxe4Whkafh5q7Ymac4Q==", + "path": "runtime.debian.8-x64.runtime.native.system.security.cryptography.openssl/4.3.0", + "hashPath": "runtime.debian.8-x64.runtime.native.system.security.cryptography.openssl.4.3.0.nupkg.sha512" + }, + "runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-+yH1a49wJMy8Zt4yx5RhJrxO/DBDByAiCzNwiETI+1S4mPdCu0OY4djdciC7Vssk0l22wQaDLrXxXkp+3+7bVA==", + "path": "runtime.fedora.23-x64.runtime.native.system.security.cryptography.openssl/4.3.0", + "hashPath": "runtime.fedora.23-x64.runtime.native.system.security.cryptography.openssl.4.3.0.nupkg.sha512" + }, + "runtime.fedora.24-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-c3YNH1GQJbfIPJeCnr4avseugSqPrxwIqzthYyZDN6EuOyNOzq+y2KSUfRcXauya1sF4foESTgwM5e1A8arAKw==", + "path": "runtime.fedora.24-x64.runtime.native.system.security.cryptography.openssl/4.3.0", + "hashPath": "runtime.fedora.24-x64.runtime.native.system.security.cryptography.openssl.4.3.0.nupkg.sha512" + }, + "runtime.native.System/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-c/qWt2LieNZIj1jGnVNsE2Kl23Ya2aSTBuXMD6V7k9KWr6l16Tqdwq+hJScEpWER9753NWC8h96PaVNY5Ld7Jw==", + "path": "runtime.native.system/4.3.0", + "hashPath": "runtime.native.system.4.3.0.nupkg.sha512" + }, + "runtime.native.System.Net.Http/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-ZVuZJqnnegJhd2k/PtAbbIcZ3aZeITq3sj06oKfMBSfphW3HDmk/t4ObvbOk/JA/swGR0LNqMksAh/f7gpTROg==", + "path": "runtime.native.system.net.http/4.3.0", + "hashPath": "runtime.native.system.net.http.4.3.0.nupkg.sha512" + }, + "runtime.native.System.Security.Cryptography.Apple/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-DloMk88juo0OuOWr56QG7MNchmafTLYWvABy36izkrLI5VledI0rq28KGs1i9wbpeT9NPQrx/wTf8U2vazqQ3Q==", + "path": "runtime.native.system.security.cryptography.apple/4.3.0", + "hashPath": "runtime.native.system.security.cryptography.apple.4.3.0.nupkg.sha512" + }, + "runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-NS1U+700m4KFRHR5o4vo9DSlTmlCKu/u7dtE5sUHVIPB+xpXxYQvgBgA6wEIeCz6Yfn0Z52/72WYsToCEPJnrw==", + "path": "runtime.native.system.security.cryptography.openssl/4.3.0", + "hashPath": "runtime.native.system.security.cryptography.openssl.4.3.0.nupkg.sha512" + }, + "runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-b3pthNgxxFcD+Pc0WSEoC0+md3MyhRS6aCEeenvNE3Fdw1HyJ18ZhRFVJJzIeR/O/jpxPboB805Ho0T3Ul7w8A==", + "path": "runtime.opensuse.13.2-x64.runtime.native.system.security.cryptography.openssl/4.3.0", + "hashPath": "runtime.opensuse.13.2-x64.runtime.native.system.security.cryptography.openssl.4.3.0.nupkg.sha512" + }, + "runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-KeLz4HClKf+nFS7p/6Fi/CqyLXh81FpiGzcmuS8DGi9lUqSnZ6Es23/gv2O+1XVGfrbNmviF7CckBpavkBoIFQ==", + "path": "runtime.opensuse.42.1-x64.runtime.native.system.security.cryptography.openssl/4.3.0", + "hashPath": "runtime.opensuse.42.1-x64.runtime.native.system.security.cryptography.openssl.4.3.0.nupkg.sha512" + }, + "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.Apple/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-kVXCuMTrTlxq4XOOMAysuNwsXWpYeboGddNGpIgNSZmv1b6r/s/DPk0fYMB7Q5Qo4bY68o48jt4T4y5BVecbCQ==", + "path": "runtime.osx.10.10-x64.runtime.native.system.security.cryptography.apple/4.3.0", + "hashPath": "runtime.osx.10.10-x64.runtime.native.system.security.cryptography.apple.4.3.0.nupkg.sha512" + }, + "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-X7IdhILzr4ROXd8mI1BUCQMSHSQwelUlBjF1JyTKCjXaOGn2fB4EKBxQbCK2VjO3WaWIdlXZL3W6TiIVnrhX4g==", + "path": "runtime.osx.10.10-x64.runtime.native.system.security.cryptography.openssl/4.3.0", + "hashPath": "runtime.osx.10.10-x64.runtime.native.system.security.cryptography.openssl.4.3.0.nupkg.sha512" + }, + "runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-nyFNiCk/r+VOiIqreLix8yN+q3Wga9+SE8BCgkf+2BwEKiNx6DyvFjCgkfV743/grxv8jHJ8gUK4XEQw7yzRYg==", + "path": "runtime.rhel.7-x64.runtime.native.system.security.cryptography.openssl/4.3.0", + "hashPath": "runtime.rhel.7-x64.runtime.native.system.security.cryptography.openssl.4.3.0.nupkg.sha512" + }, + "runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-ytoewC6wGorL7KoCAvRfsgoJPJbNq+64k2SqW6JcOAebWsFUvCCYgfzQMrnpvPiEl4OrblUlhF2ji+Q1+SVLrQ==", + "path": "runtime.ubuntu.14.04-x64.runtime.native.system.security.cryptography.openssl/4.3.0", + "hashPath": "runtime.ubuntu.14.04-x64.runtime.native.system.security.cryptography.openssl.4.3.0.nupkg.sha512" + }, + "runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-I8bKw2I8k58Wx7fMKQJn2R8lamboCAiHfHeV/pS65ScKWMMI0+wJkLYlEKvgW1D/XvSl/221clBoR2q9QNNM7A==", + "path": "runtime.ubuntu.16.04-x64.runtime.native.system.security.cryptography.openssl/4.3.0", + "hashPath": "runtime.ubuntu.16.04-x64.runtime.native.system.security.cryptography.openssl.4.3.0.nupkg.sha512" + }, + "runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-VB5cn/7OzUfzdnC8tqAIMQciVLiq2epm2NrAm1E9OjNRyG4lVhfR61SMcLizejzQP8R8Uf/0l5qOIbUEi+RdEg==", + "path": "runtime.ubuntu.16.10-x64.runtime.native.system.security.cryptography.openssl/4.3.0", + "hashPath": "runtime.ubuntu.16.10-x64.runtime.native.system.security.cryptography.openssl.4.3.0.nupkg.sha512" + }, + "System.Buffers/4.5.1": { + "type": "package", + "serviceable": true, + "sha512": "sha512-Rw7ijyl1qqRS0YQD/WycNst8hUUMgrMH4FCn1nNm27M4VxchZ1js3fVjQaANHO5f3sN4isvP4a+Met9Y4YomAg==", + "path": "system.buffers/4.5.1", + "hashPath": "system.buffers.4.5.1.nupkg.sha512" + }, + "System.Collections/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-3Dcj85/TBdVpL5Zr+gEEBUuFe2icOnLalmEh9hfck1PTYbbyWuZgh4fmm2ysCLTrqLQw6t3TgTyJ+VLp+Qb+Lw==", + "path": "system.collections/4.3.0", + "hashPath": "system.collections.4.3.0.nupkg.sha512" + }, + "System.Collections.Concurrent/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-ztl69Xp0Y/UXCL+3v3tEU+lIy+bvjKNUmopn1wep/a291pVPK7dxBd6T7WnlQqRog+d1a/hSsgRsmFnIBKTPLQ==", + "path": "system.collections.concurrent/4.3.0", + "hashPath": "system.collections.concurrent.4.3.0.nupkg.sha512" + }, + "System.Collections.NonGeneric/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-prtjIEMhGUnQq6RnPEYLpFt8AtLbp9yq2zxOSrY7KJJZrw25Fi97IzBqY7iqssbM61Ek5b8f3MG/sG1N2sN5KA==", + "path": "system.collections.nongeneric/4.3.0", + "hashPath": "system.collections.nongeneric.4.3.0.nupkg.sha512" + }, + "System.Collections.Specialized/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-Epx8PoVZR0iuOnJJDzp7pWvdfMMOAvpUo95pC4ScH2mJuXkKA2Y4aR3cG9qt2klHgSons1WFh4kcGW7cSXvrxg==", + "path": "system.collections.specialized/4.3.0", + "hashPath": "system.collections.specialized.4.3.0.nupkg.sha512" + }, + "System.ComponentModel/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-VyGn1jGRZVfxnh8EdvDCi71v3bMXrsu8aYJOwoV7SNDLVhiEqwP86pPMyRGsDsxhXAm2b3o9OIqeETfN5qfezw==", + "path": "system.componentmodel/4.3.0", + "hashPath": "system.componentmodel.4.3.0.nupkg.sha512" + }, + "System.ComponentModel.Primitives/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-j8GUkCpM8V4d4vhLIIoBLGey2Z5bCkMVNjEZseyAlm4n5arcsJOeI3zkUP+zvZgzsbLTYh4lYeP/ZD/gdIAPrw==", + "path": "system.componentmodel.primitives/4.3.0", + "hashPath": "system.componentmodel.primitives.4.3.0.nupkg.sha512" + }, + "System.ComponentModel.TypeConverter/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-16pQ6P+EdhcXzPiEK4kbA953Fu0MNG2ovxTZU81/qsCd1zPRsKc3uif5NgvllCY598k6bI0KUyKW8fanlfaDQg==", + "path": "system.componentmodel.typeconverter/4.3.0", + "hashPath": "system.componentmodel.typeconverter.4.3.0.nupkg.sha512" + }, + "System.Diagnostics.Debug/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-ZUhUOdqmaG5Jk3Xdb8xi5kIyQYAA4PnTNlHx1mu9ZY3qv4ELIdKbnL/akbGaKi2RnNUWaZsAs31rvzFdewTj2g==", + "path": "system.diagnostics.debug/4.3.0", + "hashPath": "system.diagnostics.debug.4.3.0.nupkg.sha512" + }, + "System.Diagnostics.DiagnosticSource/4.6.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-mbBgoR0rRfl2uimsZ2avZY8g7Xnh1Mza0rJZLPcxqiMWlkGukjmRkuMJ/er+AhQuiRIh80CR/Hpeztr80seV5g==", + "path": "system.diagnostics.diagnosticsource/4.6.0", + "hashPath": "system.diagnostics.diagnosticsource.4.6.0.nupkg.sha512" + }, + "System.Diagnostics.Process/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-J0wOX07+QASQblsfxmIMFc9Iq7KTXYL3zs2G/Xc704Ylv3NpuVdo6gij6V3PGiptTxqsK0K7CdXenRvKUnkA2g==", + "path": "system.diagnostics.process/4.3.0", + "hashPath": "system.diagnostics.process.4.3.0.nupkg.sha512" + }, + "System.Diagnostics.Tools/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-UUvkJfSYJMM6x527dJg2VyWPSRqIVB0Z7dbjHst1zmwTXz5CcXSYJFWRpuigfbO1Lf7yfZiIaEUesfnl/g5EyA==", + "path": "system.diagnostics.tools/4.3.0", + "hashPath": "system.diagnostics.tools.4.3.0.nupkg.sha512" + }, + "System.Diagnostics.Tracing/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-rswfv0f/Cqkh78rA5S8eN8Neocz234+emGCtTF3lxPY96F+mmmUen6tbn0glN6PMvlKQb9bPAY5e9u7fgPTkKw==", + "path": "system.diagnostics.tracing/4.3.0", + "hashPath": "system.diagnostics.tracing.4.3.0.nupkg.sha512" + }, + "System.Dynamic.Runtime/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-SNVi1E/vfWUAs/WYKhE9+qlS6KqK0YVhnlT0HQtr8pMIA8YX3lwy3uPMownDwdYISBdmAF/2holEIldVp85Wag==", + "path": "system.dynamic.runtime/4.3.0", + "hashPath": "system.dynamic.runtime.4.3.0.nupkg.sha512" + }, + "System.Globalization/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-kYdVd2f2PAdFGblzFswE4hkNANJBKRmsfa2X5LG2AcWE1c7/4t0pYae1L8vfZ5xvE2nK/R9JprtToA61OSHWIg==", + "path": "system.globalization/4.3.0", + "hashPath": "system.globalization.4.3.0.nupkg.sha512" + }, + "System.Globalization.Calendars/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-GUlBtdOWT4LTV3I+9/PJW+56AnnChTaOqqTLFtdmype/L500M2LIyXgmtd9X2P2VOkmJd5c67H5SaC2QcL1bFA==", + "path": "system.globalization.calendars/4.3.0", + "hashPath": "system.globalization.calendars.4.3.0.nupkg.sha512" + }, + "System.Globalization.Extensions/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-FhKmdR6MPG+pxow6wGtNAWdZh7noIOpdD5TwQ3CprzgIE1bBBoim0vbR1+AWsWjQmU7zXHgQo4TWSP6lCeiWcQ==", + "path": "system.globalization.extensions/4.3.0", + "hashPath": "system.globalization.extensions.4.3.0.nupkg.sha512" + }, + "System.IO/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-3qjaHvxQPDpSOYICjUoTsmoq5u6QJAFRUITgeT/4gqkF1bajbSmb1kwSxEA8AHlofqgcKJcM8udgieRNhaJ5Cg==", + "path": "system.io/4.3.0", + "hashPath": "system.io.4.3.0.nupkg.sha512" + }, + "System.IO.FileSystem/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-3wEMARTnuio+ulnvi+hkRNROYwa1kylvYahhcLk4HSoVdl+xxTFVeVlYOfLwrDPImGls0mDqbMhrza8qnWPTdA==", + "path": "system.io.filesystem/4.3.0", + "hashPath": "system.io.filesystem.4.3.0.nupkg.sha512" + }, + "System.IO.FileSystem.Primitives/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-6QOb2XFLch7bEc4lIcJH49nJN2HV+OC3fHDgsLVsBVBk3Y4hFAnOBGzJ2lUu7CyDDFo9IBWkSsnbkT6IBwwiMw==", + "path": "system.io.filesystem.primitives/4.3.0", + "hashPath": "system.io.filesystem.primitives.4.3.0.nupkg.sha512" + }, + "System.Linq/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-5DbqIUpsDp0dFftytzuMmc0oeMdQwjcP/EWxsksIz/w1TcFRkZ3yKKz0PqiYFMmEwPSWw+qNVqD7PJ889JzHbw==", + "path": "system.linq/4.3.0", + "hashPath": "system.linq.4.3.0.nupkg.sha512" + }, + "System.Linq.Expressions/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-PGKkrd2khG4CnlyJwxwwaWWiSiWFNBGlgXvJpeO0xCXrZ89ODrQ6tjEWS/kOqZ8GwEOUATtKtzp1eRgmYNfclg==", + "path": "system.linq.expressions/4.3.0", + "hashPath": "system.linq.expressions.4.3.0.nupkg.sha512" + }, + "System.Memory/4.5.4": { + "type": "package", + "serviceable": true, + "sha512": "sha512-1MbJTHS1lZ4bS4FmsJjnuGJOu88ZzTT2rLvrhW7Ygic+pC0NWA+3hgAen0HRdsocuQXCkUTdFn9yHJJhsijDXw==", + "path": "system.memory/4.5.4", + "hashPath": "system.memory.4.5.4.nupkg.sha512" + }, + "System.Memory.Data/1.0.2": { + "type": "package", + "serviceable": true, + "sha512": "sha512-JGkzeqgBsiZwKJZ1IxPNsDFZDhUvuEdX8L8BDC8N3KOj+6zMcNU28CNN59TpZE/VJYy9cP+5M+sbxtWJx3/xtw==", + "path": "system.memory.data/1.0.2", + "hashPath": "system.memory.data.1.0.2.nupkg.sha512" + }, + "System.Numerics.Vectors/4.5.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-QQTlPTl06J/iiDbJCiepZ4H//BVraReU4O4EoRw1U02H5TLUIT7xn3GnDp9AXPSlJUDyFs4uWjWafNX6WrAojQ==", + "path": "system.numerics.vectors/4.5.0", + "hashPath": "system.numerics.vectors.4.5.0.nupkg.sha512" + }, + "System.ObjectModel/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-bdX+80eKv9bN6K4N+d77OankKHGn6CH711a6fcOpMQu2Fckp/Ft4L/kW9WznHpyR0NRAvJutzOMHNNlBGvxQzQ==", + "path": "system.objectmodel/4.3.0", + "hashPath": "system.objectmodel.4.3.0.nupkg.sha512" + }, + "System.Private.DataContractSerialization/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-yDaJ2x3mMmjdZEDB4IbezSnCsnjQ4BxinKhRAaP6kEgL6Bb6jANWphs5SzyD8imqeC/3FxgsuXT6ykkiH1uUmA==", + "path": "system.private.datacontractserialization/4.3.0", + "hashPath": "system.private.datacontractserialization.4.3.0.nupkg.sha512" + }, + "System.Private.Uri/4.3.2": { + "type": "package", + "serviceable": true, + "sha512": "sha512-o1+7RJnu3Ik3PazR7Z7tJhjPdE000Eq2KGLLWhqJJKXj04wrS8lwb1OFtDF9jzXXADhUuZNJZlPc98uwwqmpFA==", + "path": "system.private.uri/4.3.2", + "hashPath": "system.private.uri.4.3.2.nupkg.sha512" + }, + "System.Reflection/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-KMiAFoW7MfJGa9nDFNcfu+FpEdiHpWgTcS2HdMpDvt9saK3y/G4GwprPyzqjFH9NTaGPQeWNHU+iDlDILj96aQ==", + "path": "system.reflection/4.3.0", + "hashPath": "system.reflection.4.3.0.nupkg.sha512" + }, + "System.Reflection.Emit/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-228FG0jLcIwTVJyz8CLFKueVqQK36ANazUManGaJHkO0icjiIypKW7YLWLIWahyIkdh5M7mV2dJepllLyA1SKg==", + "path": "system.reflection.emit/4.3.0", + "hashPath": "system.reflection.emit.4.3.0.nupkg.sha512" + }, + "System.Reflection.Emit.ILGeneration/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-59tBslAk9733NXLrUJrwNZEzbMAcu8k344OYo+wfSVygcgZ9lgBdGIzH/nrg3LYhXceynyvTc8t5/GD4Ri0/ng==", + "path": "system.reflection.emit.ilgeneration/4.3.0", + "hashPath": "system.reflection.emit.ilgeneration.4.3.0.nupkg.sha512" + }, + "System.Reflection.Emit.Lightweight/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-oadVHGSMsTmZsAF864QYN1t1QzZjIcuKU3l2S9cZOwDdDueNTrqq1yRj7koFfIGEnKpt6NjpL3rOzRhs4ryOgA==", + "path": "system.reflection.emit.lightweight/4.3.0", + "hashPath": "system.reflection.emit.lightweight.4.3.0.nupkg.sha512" + }, + "System.Reflection.Extensions/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-rJkrJD3kBI5B712aRu4DpSIiHRtr6QlfZSQsb0hYHrDCZORXCFjQfoipo2LaMUHoT9i1B7j7MnfaEKWDFmFQNQ==", + "path": "system.reflection.extensions/4.3.0", + "hashPath": "system.reflection.extensions.4.3.0.nupkg.sha512" + }, + "System.Reflection.Primitives/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-5RXItQz5As4xN2/YUDxdpsEkMhvw3e6aNveFXUn4Hl/udNTCNhnKp8lT9fnc3MhvGKh1baak5CovpuQUXHAlIA==", + "path": "system.reflection.primitives/4.3.0", + "hashPath": "system.reflection.primitives.4.3.0.nupkg.sha512" + }, + "System.Reflection.TypeExtensions/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-7u6ulLcZbyxB5Gq0nMkQttcdBTx57ibzw+4IOXEfR+sXYQoHvjW5LTLyNr8O22UIMrqYbchJQJnos4eooYzYJA==", + "path": "system.reflection.typeextensions/4.3.0", + "hashPath": "system.reflection.typeextensions.4.3.0.nupkg.sha512" + }, + "System.Resources.ResourceManager/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-/zrcPkkWdZmI4F92gL/TPumP98AVDu/Wxr3CSJGQQ+XN6wbRZcyfSKVoPo17ilb3iOr0cCRqJInGwNMolqhS8A==", + "path": "system.resources.resourcemanager/4.3.0", + "hashPath": "system.resources.resourcemanager.4.3.0.nupkg.sha512" + }, + "System.Runtime/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-JufQi0vPQ0xGnAczR13AUFglDyVYt4Kqnz1AZaiKZ5+GICq0/1MH/mO/eAJHt/mHW1zjKBJd7kV26SrxddAhiw==", + "path": "system.runtime/4.3.0", + "hashPath": "system.runtime.4.3.0.nupkg.sha512" + }, + "System.Runtime.CompilerServices.Unsafe/4.7.1": { + "type": "package", + "serviceable": true, + "sha512": "sha512-zOHkQmzPCn5zm/BH+cxC1XbUS3P4Yoi3xzW7eRgVpDR2tPGSzyMZ17Ig1iRkfJuY0nhxkQQde8pgePNiA7z7TQ==", + "path": "system.runtime.compilerservices.unsafe/4.7.1", + "hashPath": "system.runtime.compilerservices.unsafe.4.7.1.nupkg.sha512" + }, + "System.Runtime.Extensions/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-guW0uK0fn5fcJJ1tJVXYd7/1h5F+pea1r7FLSOz/f8vPEqbR2ZAknuRDvTQ8PzAilDveOxNjSfr0CHfIQfFk8g==", + "path": "system.runtime.extensions/4.3.0", + "hashPath": "system.runtime.extensions.4.3.0.nupkg.sha512" + }, + "System.Runtime.Handles/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-OKiSUN7DmTWeYb3l51A7EYaeNMnvxwE249YtZz7yooT4gOZhmTjIn48KgSsw2k2lYdLgTKNJw/ZIfSElwDRVgg==", + "path": "system.runtime.handles/4.3.0", + "hashPath": "system.runtime.handles.4.3.0.nupkg.sha512" + }, + "System.Runtime.InteropServices/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-uv1ynXqiMK8mp1GM3jDqPCFN66eJ5w5XNomaK2XD+TuCroNTLFGeZ+WCmBMcBDyTFKou3P6cR6J/QsaqDp7fGQ==", + "path": "system.runtime.interopservices/4.3.0", + "hashPath": "system.runtime.interopservices.4.3.0.nupkg.sha512" + }, + "System.Runtime.Numerics/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-yMH+MfdzHjy17l2KESnPiF2dwq7T+xLnSJar7slyimAkUh/gTrS9/UQOtv7xarskJ2/XDSNvfLGOBQPjL7PaHQ==", + "path": "system.runtime.numerics/4.3.0", + "hashPath": "system.runtime.numerics.4.3.0.nupkg.sha512" + }, + "System.Runtime.Serialization.Formatters/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-KT591AkTNFOTbhZlaeMVvfax3RqhH1EJlcwF50Wm7sfnBLuHiOeZRRKrr1ns3NESkM20KPZ5Ol/ueMq5vg4QoQ==", + "path": "system.runtime.serialization.formatters/4.3.0", + "hashPath": "system.runtime.serialization.formatters.4.3.0.nupkg.sha512" + }, + "System.Runtime.Serialization.Json/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-CpVfOH0M/uZ5PH+M9+Gu56K0j9lJw3M+PKRegTkcrY/stOIvRUeonggxNrfBYLA5WOHL2j15KNJuTuld3x4o9w==", + "path": "system.runtime.serialization.json/4.3.0", + "hashPath": "system.runtime.serialization.json.4.3.0.nupkg.sha512" + }, + "System.Runtime.Serialization.Primitives/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-Wz+0KOukJGAlXjtKr+5Xpuxf8+c8739RI1C+A2BoQZT+wMCCoMDDdO8/4IRHfaVINqL78GO8dW8G2lW/e45Mcw==", + "path": "system.runtime.serialization.primitives/4.3.0", + "hashPath": "system.runtime.serialization.primitives.4.3.0.nupkg.sha512" + }, + "System.Security.Cryptography.Algorithms/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-W1kd2Y8mYSCgc3ULTAZ0hOP2dSdG5YauTb1089T0/kRcN2MpSAW1izOFROrJgxSlMn3ArsgHXagigyi+ibhevg==", + "path": "system.security.cryptography.algorithms/4.3.0", + "hashPath": "system.security.cryptography.algorithms.4.3.0.nupkg.sha512" + }, + "System.Security.Cryptography.Cng/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-03idZOqFlsKRL4W+LuCpJ6dBYDUWReug6lZjBa3uJWnk5sPCUXckocevTaUA8iT/MFSrY/2HXkOt753xQ/cf8g==", + "path": "system.security.cryptography.cng/4.3.0", + "hashPath": "system.security.cryptography.cng.4.3.0.nupkg.sha512" + }, + "System.Security.Cryptography.Csp/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-X4s/FCkEUnRGnwR3aSfVIkldBmtURMhmexALNTwpjklzxWU7yjMk7GHLKOZTNkgnWnE0q7+BCf9N2LVRWxewaA==", + "path": "system.security.cryptography.csp/4.3.0", + "hashPath": "system.security.cryptography.csp.4.3.0.nupkg.sha512" + }, + "System.Security.Cryptography.Encoding/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-1DEWjZZly9ae9C79vFwqaO5kaOlI5q+3/55ohmq/7dpDyDfc8lYe7YVxJUZ5MF/NtbkRjwFRo14yM4OEo9EmDw==", + "path": "system.security.cryptography.encoding/4.3.0", + "hashPath": "system.security.cryptography.encoding.4.3.0.nupkg.sha512" + }, + "System.Security.Cryptography.OpenSsl/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-h4CEgOgv5PKVF/HwaHzJRiVboL2THYCou97zpmhjghx5frc7fIvlkY1jL+lnIQyChrJDMNEXS6r7byGif8Cy4w==", + "path": "system.security.cryptography.openssl/4.3.0", + "hashPath": "system.security.cryptography.openssl.4.3.0.nupkg.sha512" + }, + "System.Security.Cryptography.Primitives/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-7bDIyVFNL/xKeFHjhobUAQqSpJq9YTOpbEs6mR233Et01STBMXNAc/V+BM6dwYGc95gVh/Zf+iVXWzj3mE8DWg==", + "path": "system.security.cryptography.primitives/4.3.0", + "hashPath": "system.security.cryptography.primitives.4.3.0.nupkg.sha512" + }, + "System.Security.Cryptography.ProtectedData/4.5.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-wLBKzFnDCxP12VL9ANydSYhk59fC4cvOr9ypYQLPnAj48NQIhqnjdD2yhP8yEKyBJEjERWS9DisKL7rX5eU25Q==", + "path": "system.security.cryptography.protecteddata/4.5.0", + "hashPath": "system.security.cryptography.protecteddata.4.5.0.nupkg.sha512" + }, + "System.Security.Cryptography.X509Certificates/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-t2Tmu6Y2NtJ2um0RtcuhP7ZdNNxXEgUm2JeoA/0NvlMjAhKCnM1NX07TDl3244mVp3QU6LPEhT3HTtH1uF7IYw==", + "path": "system.security.cryptography.x509certificates/4.3.0", + "hashPath": "system.security.cryptography.x509certificates.4.3.0.nupkg.sha512" + }, + "System.Security.SecureString/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-PnXp38O9q/2Oe4iZHMH60kinScv6QiiL2XH54Pj2t0Y6c2zKPEiAZsM/M3wBOHLNTBDFP0zfy13WN2M0qFz5jg==", + "path": "system.security.securestring/4.3.0", + "hashPath": "system.security.securestring.4.3.0.nupkg.sha512" + }, + "System.Text.Encoding/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-BiIg+KWaSDOITze6jGQynxg64naAPtqGHBwDrLaCtixsa5bKiR8dpPOHA7ge3C0JJQizJE+sfkz1wV+BAKAYZw==", + "path": "system.text.encoding/4.3.0", + "hashPath": "system.text.encoding.4.3.0.nupkg.sha512" + }, + "System.Text.Encoding.Extensions/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-YVMK0Bt/A43RmwizJoZ22ei2nmrhobgeiYwFzC4YAN+nue8RF6djXDMog0UCn+brerQoYVyaS+ghy9P/MUVcmw==", + "path": "system.text.encoding.extensions/4.3.0", + "hashPath": "system.text.encoding.extensions.4.3.0.nupkg.sha512" + }, + "System.Text.Encodings.Web/4.7.2": { + "type": "package", + "serviceable": true, + "sha512": "sha512-iTUgB/WtrZ1sWZs84F2hwyQhiRH6QNjQv2DkwrH+WP6RoFga2Q1m3f9/Q7FG8cck8AdHitQkmkXSY8qylcDmuA==", + "path": "system.text.encodings.web/4.7.2", + "hashPath": "system.text.encodings.web.4.7.2.nupkg.sha512" + }, + "System.Text.Json/4.7.2": { + "type": "package", + "serviceable": true, + "sha512": "sha512-TcMd95wcrubm9nHvJEQs70rC0H/8omiSGGpU4FQ/ZA1URIqD4pjmFJh2Mfv1yH1eHgJDWTi2hMDXwTET+zOOyg==", + "path": "system.text.json/4.7.2", + "hashPath": "system.text.json.4.7.2.nupkg.sha512" + }, + "System.Text.RegularExpressions/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-RpT2DA+L660cBt1FssIE9CAGpLFdFPuheB7pLpKpn6ZXNby7jDERe8Ua/Ne2xGiwLVG2JOqziiaVCGDon5sKFA==", + "path": "system.text.regularexpressions/4.3.0", + "hashPath": "system.text.regularexpressions.4.3.0.nupkg.sha512" + }, + "System.Threading/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-VkUS0kOBcUf3Wwm0TSbrevDDZ6BlM+b/HRiapRFWjM5O0NS0LviG0glKmFK+hhPDd1XFeSdU1GmlLhb2CoVpIw==", + "path": "system.threading/4.3.0", + "hashPath": "system.threading.4.3.0.nupkg.sha512" + }, + "System.Threading.Tasks/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-LbSxKEdOUhVe8BezB/9uOGGppt+nZf6e1VFyw6v3DN6lqitm0OSn2uXMOdtP0M3W4iMcqcivm2J6UgqiwwnXiA==", + "path": "system.threading.tasks/4.3.0", + "hashPath": "system.threading.tasks.4.3.0.nupkg.sha512" + }, + "System.Threading.Tasks.Extensions/4.5.4": { + "type": "package", + "serviceable": true, + "sha512": "sha512-zteT+G8xuGu6mS+mzDzYXbzS7rd3K6Fjb9RiZlYlJPam2/hU7JCBZBVEcywNuR+oZ1ncTvc/cq0faRr3P01OVg==", + "path": "system.threading.tasks.extensions/4.5.4", + "hashPath": "system.threading.tasks.extensions.4.5.4.nupkg.sha512" + }, + "System.Threading.Thread/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-OHmbT+Zz065NKII/ZHcH9XO1dEuLGI1L2k7uYss+9C1jLxTC9kTZZuzUOyXHayRk+dft9CiDf3I/QZ0t8JKyBQ==", + "path": "system.threading.thread/4.3.0", + "hashPath": "system.threading.thread.4.3.0.nupkg.sha512" + }, + "System.Threading.ThreadPool/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-k/+g4b7vjdd4aix83sTgC9VG6oXYKAktSfNIJUNGxPEj7ryEOfzHHhfnmsZvjxawwcD9HyWXKCXmPjX8U4zeSw==", + "path": "system.threading.threadpool/4.3.0", + "hashPath": "system.threading.threadpool.4.3.0.nupkg.sha512" + }, + "System.Xml.ReaderWriter/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-GrprA+Z0RUXaR4N7/eW71j1rgMnEnEVlgii49GZyAjTH7uliMnrOU3HNFBr6fEDBCJCIdlVNq9hHbaDR621XBA==", + "path": "system.xml.readerwriter/4.3.0", + "hashPath": "system.xml.readerwriter.4.3.0.nupkg.sha512" + }, + "System.Xml.XDocument/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-5zJ0XDxAIg8iy+t4aMnQAu0MqVbqyvfoUVl1yDV61xdo3Vth45oA2FoY4pPkxYAH5f8ixpmTqXeEIya95x0aCQ==", + "path": "system.xml.xdocument/4.3.0", + "hashPath": "system.xml.xdocument.4.3.0.nupkg.sha512" + }, + "System.Xml.XmlDocument/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-lJ8AxvkX7GQxpC6GFCeBj8ThYVyQczx2+f/cWHJU8tjS7YfI6Cv6bon70jVEgs2CiFbmmM8b9j1oZVx0dSI2Ww==", + "path": "system.xml.xmldocument/4.3.0", + "hashPath": "system.xml.xmldocument.4.3.0.nupkg.sha512" + }, + "System.Xml.XmlSerializer/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-MYoTCP7EZ98RrANESW05J5ZwskKDoN0AuZ06ZflnowE50LTpbR5yRg3tHckTVm5j/m47stuGgCrCHWePyHS70Q==", + "path": "system.xml.xmlserializer/4.3.0", + "hashPath": "system.xml.xmlserializer.4.3.0.nupkg.sha512" + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Authentication.dll b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Authentication.dll new file mode 100644 index 000000000000..511cf6f6e630 Binary files /dev/null and b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Authentication.dll differ diff --git a/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.AuthenticationAssemblyLoadContext.deps.json b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.AuthenticationAssemblyLoadContext.deps.json new file mode 100644 index 000000000000..ce563dfdebbe --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.AuthenticationAssemblyLoadContext.deps.json @@ -0,0 +1,1316 @@ +{ + "runtimeTarget": { + "name": ".NETCoreApp,Version=v2.1", + "signature": "" + }, + "compilationOptions": {}, + "targets": { + ".NETCoreApp,Version=v2.1": { + "Microsoft.Azure.PowerShell.AuthenticationAssemblyLoadContext/1.0.0": { + "dependencies": { + "Azure.Core": "1.22.0", + "Hyak.Common": "1.2.2", + "Microsoft.ApplicationInsights": "2.12.0", + "Microsoft.Azure.Common": "2.2.1", + "Microsoft.Azure.PowerShell.Authentication.Abstractions": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Clients.Aks": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Clients.Authorization": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Clients.Compute": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Clients.Graph.Rbac": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Clients.KeyVault": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Clients.Monitor": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Clients.Network": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Clients.PolicyInsights": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Clients.ResourceManager": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Clients.Storage.Management": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Clients.Websites": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Common": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Common.Share": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Storage": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Strategies": "1.3.57-preview", + "Microsoft.Rest.ClientRuntime": "2.3.23", + "Microsoft.Rest.ClientRuntime.Azure": "3.3.19", + "Newtonsoft.Json": "10.0.3", + "PowerShellStandard.Library": "5.1.0" + }, + "runtime": { + "Microsoft.Azure.PowerShell.AuthenticationAssemblyLoadContext.dll": {} + } + }, + "Azure.Core/1.22.0": { + "dependencies": { + "Microsoft.Bcl.AsyncInterfaces": "1.1.1", + "System.Diagnostics.DiagnosticSource": "4.6.0", + "System.Memory.Data": "1.0.2", + "System.Numerics.Vectors": "4.5.0", + "System.Text.Encodings.Web": "4.7.2", + "System.Text.Json": "4.7.2", + "System.Threading.Tasks.Extensions": "4.5.4" + }, + "runtime": { + "lib/netcoreapp2.1/Azure.Core.dll": { + "assemblyVersion": "1.22.0.0", + "fileVersion": "1.2200.22.6212" + } + } + }, + "Hyak.Common/1.2.2": { + "dependencies": { + "Newtonsoft.Json": "10.0.3", + "System.Reflection": "4.3.0", + "System.Threading": "4.3.0" + }, + "runtime": { + "lib/netstandard1.4/Hyak.Common.dll": { + "assemblyVersion": "1.0.0.0", + "fileVersion": "1.2.2.0" + } + } + }, + "Microsoft.ApplicationInsights/2.12.0": { + "dependencies": { + "System.Diagnostics.DiagnosticSource": "4.6.0", + "System.Runtime.InteropServices": "4.3.0" + }, + "runtime": { + "lib/netstandard2.0/Microsoft.ApplicationInsights.dll": { + "assemblyVersion": "2.12.0.21496", + "fileVersion": "2.12.0.21496" + } + } + }, + "Microsoft.Azure.Common/2.2.1": { + "dependencies": { + "Hyak.Common": "1.2.2" + }, + "runtime": { + "lib/netstandard1.4/Microsoft.Azure.Common.dll": { + "assemblyVersion": "2.0.0.0", + "fileVersion": "2.2.1.0" + } + } + }, + "Microsoft.Azure.PowerShell.Authentication.Abstractions/1.3.57-preview": { + "dependencies": { + "Hyak.Common": "1.2.2", + "Microsoft.Azure.Common": "2.2.1", + "Microsoft.Rest.ClientRuntime": "2.3.23", + "Newtonsoft.Json": "10.0.3" + }, + "runtime": { + "lib/netstandard2.0/Microsoft.Azure.PowerShell.Authentication.Abstractions.dll": { + "assemblyVersion": "1.0.0.0", + "fileVersion": "1.3.57.0" + } + } + }, + "Microsoft.Azure.PowerShell.Clients.Aks/1.3.57-preview": { + "dependencies": { + "Microsoft.Rest.ClientRuntime": "2.3.23", + "Microsoft.Rest.ClientRuntime.Azure": "3.3.19", + "Newtonsoft.Json": "10.0.3" + }, + "runtime": { + "lib/netstandard2.0/Microsoft.Azure.PowerShell.Clients.Aks.dll": { + "assemblyVersion": "1.0.0.0", + "fileVersion": "1.3.57.0" + } + } + }, + "Microsoft.Azure.PowerShell.Clients.Authorization/1.3.57-preview": { + "dependencies": { + "Microsoft.Rest.ClientRuntime": "2.3.23", + "Microsoft.Rest.ClientRuntime.Azure": "3.3.19", + "Newtonsoft.Json": "10.0.3" + }, + "runtime": { + "lib/netstandard2.0/Microsoft.Azure.PowerShell.Clients.Authorization.dll": { + "assemblyVersion": "1.0.0.0", + "fileVersion": "1.3.57.0" + } + } + }, + "Microsoft.Azure.PowerShell.Clients.Compute/1.3.57-preview": { + "dependencies": { + "Microsoft.Rest.ClientRuntime": "2.3.23", + "Microsoft.Rest.ClientRuntime.Azure": "3.3.19", + "Newtonsoft.Json": "10.0.3" + }, + "runtime": { + "lib/netstandard2.0/Microsoft.Azure.PowerShell.Clients.Compute.dll": { + "assemblyVersion": "1.0.0.0", + "fileVersion": "1.3.57.0" + } + } + }, + "Microsoft.Azure.PowerShell.Clients.Graph.Rbac/1.3.57-preview": { + "dependencies": { + "Microsoft.Azure.PowerShell.Authentication.Abstractions": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Clients.ResourceManager": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Common": "1.3.57-preview", + "Microsoft.Rest.ClientRuntime": "2.3.23", + "Microsoft.Rest.ClientRuntime.Azure": "3.3.19", + "Newtonsoft.Json": "10.0.3" + }, + "runtime": { + "lib/netstandard2.0/Microsoft.Azure.PowerShell.Clients.Graph.Rbac.dll": { + "assemblyVersion": "1.0.0.0", + "fileVersion": "1.3.57.0" + } + } + }, + "Microsoft.Azure.PowerShell.Clients.KeyVault/1.3.57-preview": { + "dependencies": { + "Microsoft.Rest.ClientRuntime": "2.3.23", + "Microsoft.Rest.ClientRuntime.Azure": "3.3.19", + "Newtonsoft.Json": "10.0.3", + "System.Collections.NonGeneric": "4.3.0", + "System.Collections.Specialized": "4.3.0", + "System.Reflection": "4.3.0", + "System.Security.SecureString": "4.3.0", + "System.Xml.XmlDocument": "4.3.0", + "System.Xml.XmlSerializer": "4.3.0" + }, + "runtime": { + "lib/netstandard2.0/Microsoft.Azure.PowerShell.Clients.KeyVault.dll": { + "assemblyVersion": "1.0.0.0", + "fileVersion": "1.3.57.0" + } + } + }, + "Microsoft.Azure.PowerShell.Clients.Monitor/1.3.57-preview": { + "dependencies": { + "Microsoft.Rest.ClientRuntime": "2.3.23", + "Microsoft.Rest.ClientRuntime.Azure": "3.3.19", + "Newtonsoft.Json": "10.0.3", + "System.Collections.Specialized": "4.3.0", + "System.Reflection": "4.3.0", + "System.Security.SecureString": "4.3.0", + "System.Xml.XmlDocument": "4.3.0", + "System.Xml.XmlSerializer": "4.3.0" + }, + "runtime": { + "lib/netstandard2.0/Microsoft.Azure.PowerShell.Clients.Monitor.dll": { + "assemblyVersion": "1.0.0.0", + "fileVersion": "1.3.57.0" + } + } + }, + "Microsoft.Azure.PowerShell.Clients.Network/1.3.57-preview": { + "dependencies": { + "Microsoft.Azure.PowerShell.Authentication.Abstractions": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Common": "1.3.57-preview", + "Microsoft.Rest.ClientRuntime": "2.3.23", + "Microsoft.Rest.ClientRuntime.Azure": "3.3.19", + "Newtonsoft.Json": "10.0.3" + }, + "runtime": { + "lib/netstandard2.0/Microsoft.Azure.PowerShell.Clients.Network.dll": { + "assemblyVersion": "1.0.0.0", + "fileVersion": "1.3.57.0" + } + } + }, + "Microsoft.Azure.PowerShell.Clients.PolicyInsights/1.3.57-preview": { + "dependencies": { + "Microsoft.Rest.ClientRuntime": "2.3.23", + "Microsoft.Rest.ClientRuntime.Azure": "3.3.19", + "Newtonsoft.Json": "10.0.3" + }, + "runtime": { + "lib/netstandard2.0/Microsoft.Azure.PowerShell.Clients.PolicyInsights.dll": { + "assemblyVersion": "1.0.0.0", + "fileVersion": "1.3.57.0" + } + } + }, + "Microsoft.Azure.PowerShell.Clients.ResourceManager/1.3.57-preview": { + "dependencies": { + "Microsoft.Azure.PowerShell.Authentication.Abstractions": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Common": "1.3.57-preview", + "Microsoft.Rest.ClientRuntime": "2.3.23", + "Microsoft.Rest.ClientRuntime.Azure": "3.3.19", + "Newtonsoft.Json": "10.0.3" + }, + "runtime": { + "lib/netstandard2.0/Microsoft.Azure.PowerShell.Clients.ResourceManager.dll": { + "assemblyVersion": "1.0.0.0", + "fileVersion": "1.3.57.0" + } + } + }, + "Microsoft.Azure.PowerShell.Clients.Storage.Management/1.3.57-preview": { + "dependencies": { + "Microsoft.Rest.ClientRuntime": "2.3.23", + "Microsoft.Rest.ClientRuntime.Azure": "3.3.19", + "System.Collections.NonGeneric": "4.3.0" + }, + "runtime": { + "lib/netstandard2.0/Microsoft.Azure.PowerShell.Clients.Storage.Management.dll": { + "assemblyVersion": "1.0.0.0", + "fileVersion": "1.3.57.0" + } + } + }, + "Microsoft.Azure.PowerShell.Clients.Websites/1.3.57-preview": { + "dependencies": { + "Microsoft.Rest.ClientRuntime": "2.3.23", + "Microsoft.Rest.ClientRuntime.Azure": "3.3.19", + "Newtonsoft.Json": "10.0.3", + "System.Collections.Specialized": "4.3.0", + "System.Reflection": "4.3.0", + "System.Security.SecureString": "4.3.0", + "System.Xml.XmlDocument": "4.3.0", + "System.Xml.XmlSerializer": "4.3.0" + }, + "runtime": { + "lib/netstandard2.0/Microsoft.Azure.PowerShell.Clients.Websites.dll": { + "assemblyVersion": "1.0.0.0", + "fileVersion": "1.3.57.0" + } + } + }, + "Microsoft.Azure.PowerShell.Common/1.3.57-preview": { + "dependencies": { + "Hyak.Common": "1.2.2", + "Microsoft.ApplicationInsights": "2.12.0", + "Microsoft.Azure.Common": "2.2.1", + "Microsoft.Azure.PowerShell.Authentication.Abstractions": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Common.Share": "1.3.57-preview", + "Microsoft.Rest.ClientRuntime": "2.3.23", + "Microsoft.Rest.ClientRuntime.Azure": "3.3.19", + "Newtonsoft.Json": "10.0.3" + }, + "runtime": { + "lib/netstandard2.0/Microsoft.Azure.PowerShell.Common.dll": { + "assemblyVersion": "1.0.0.0", + "fileVersion": "1.3.57.0" + } + } + }, + "Microsoft.Azure.PowerShell.Common.Share/1.3.57-preview": { + "dependencies": { + "Hyak.Common": "1.2.2", + "Microsoft.Azure.Common": "2.2.1", + "Microsoft.Rest.ClientRuntime": "2.3.23", + "Microsoft.Rest.ClientRuntime.Azure": "3.3.19", + "Newtonsoft.Json": "10.0.3" + }, + "runtime": { + "lib/netstandard2.0/Microsoft.Azure.PowerShell.Common.Share.dll": { + "assemblyVersion": "1.0.0.0", + "fileVersion": "1.3.57.0" + } + } + }, + "Microsoft.Azure.PowerShell.Storage/1.3.57-preview": { + "dependencies": { + "Microsoft.Azure.PowerShell.Authentication.Abstractions": "1.3.57-preview", + "Microsoft.Rest.ClientRuntime": "2.3.23" + }, + "runtime": { + "lib/netstandard2.0/Microsoft.Azure.PowerShell.Storage.dll": { + "assemblyVersion": "1.0.0.0", + "fileVersion": "1.3.57.0" + } + } + }, + "Microsoft.Azure.PowerShell.Strategies/1.3.57-preview": { + "dependencies": { + "Microsoft.Rest.ClientRuntime": "2.3.23", + "Microsoft.Rest.ClientRuntime.Azure": "3.3.19", + "Newtonsoft.Json": "10.0.3" + }, + "runtime": { + "lib/netstandard2.0/Microsoft.Azure.PowerShell.Strategies.dll": { + "assemblyVersion": "1.0.0.0", + "fileVersion": "1.3.57.0" + } + } + }, + "Microsoft.Bcl.AsyncInterfaces/1.1.1": { + "runtime": { + "lib/netstandard2.0/Microsoft.Bcl.AsyncInterfaces.dll": { + "assemblyVersion": "1.0.0.0", + "fileVersion": "4.700.20.21406" + } + } + }, + "Microsoft.CSharp/4.3.0": { + "dependencies": { + "System.Collections": "4.3.0", + "System.Diagnostics.Debug": "4.3.0", + "System.Dynamic.Runtime": "4.3.0", + "System.Globalization": "4.3.0", + "System.Linq": "4.3.0", + "System.Linq.Expressions": "4.3.0", + "System.ObjectModel": "4.3.0", + "System.Reflection": "4.3.0", + "System.Reflection.Extensions": "4.3.0", + "System.Reflection.Primitives": "4.3.0", + "System.Reflection.TypeExtensions": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Extensions": "4.3.0", + "System.Runtime.InteropServices": "4.3.0", + "System.Threading": "4.3.0" + } + }, + "Microsoft.Rest.ClientRuntime/2.3.23": { + "dependencies": { + "Newtonsoft.Json": "10.0.3" + }, + "runtime": { + "lib/netstandard2.0/Microsoft.Rest.ClientRuntime.dll": { + "assemblyVersion": "2.0.0.0", + "fileVersion": "2.3.23.0" + } + } + }, + "Microsoft.Rest.ClientRuntime.Azure/3.3.19": { + "dependencies": { + "Microsoft.Rest.ClientRuntime": "2.3.23", + "Newtonsoft.Json": "10.0.3" + }, + "runtime": { + "lib/netstandard2.0/Microsoft.Rest.ClientRuntime.Azure.dll": { + "assemblyVersion": "3.0.0.0", + "fileVersion": "3.3.18.0" + } + } + }, + "Newtonsoft.Json/10.0.3": { + "dependencies": { + "Microsoft.CSharp": "4.3.0", + "System.ComponentModel.TypeConverter": "4.3.0", + "System.Runtime.Serialization.Formatters": "4.3.0", + "System.Runtime.Serialization.Primitives": "4.3.0", + "System.Xml.XmlDocument": "4.3.0" + }, + "runtime": { + "lib/netstandard1.3/Newtonsoft.Json.dll": { + "assemblyVersion": "10.0.0.0", + "fileVersion": "10.0.3.21018" + } + } + }, + "PowerShellStandard.Library/5.1.0": {}, + "System.Collections/4.3.0": { + "dependencies": { + "System.Runtime": "4.3.0" + } + }, + "System.Collections.NonGeneric/4.3.0": { + "dependencies": { + "System.Diagnostics.Debug": "4.3.0", + "System.Globalization": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Extensions": "4.3.0", + "System.Threading": "4.3.0" + } + }, + "System.Collections.Specialized/4.3.0": { + "dependencies": { + "System.Collections.NonGeneric": "4.3.0", + "System.Globalization": "4.3.0", + "System.Globalization.Extensions": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Extensions": "4.3.0", + "System.Threading": "4.3.0" + } + }, + "System.ComponentModel/4.3.0": { + "dependencies": { + "System.Runtime": "4.3.0" + } + }, + "System.ComponentModel.Primitives/4.3.0": { + "dependencies": { + "System.ComponentModel": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0" + } + }, + "System.ComponentModel.TypeConverter/4.3.0": { + "dependencies": { + "System.Collections": "4.3.0", + "System.Collections.NonGeneric": "4.3.0", + "System.Collections.Specialized": "4.3.0", + "System.ComponentModel": "4.3.0", + "System.ComponentModel.Primitives": "4.3.0", + "System.Globalization": "4.3.0", + "System.Linq": "4.3.0", + "System.Reflection": "4.3.0", + "System.Reflection.Extensions": "4.3.0", + "System.Reflection.Primitives": "4.3.0", + "System.Reflection.TypeExtensions": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Extensions": "4.3.0", + "System.Threading": "4.3.0" + } + }, + "System.Diagnostics.Debug/4.3.0": { + "dependencies": { + "System.Runtime": "4.3.0" + } + }, + "System.Diagnostics.DiagnosticSource/4.6.0": { + "runtime": { + "lib/netstandard1.3/System.Diagnostics.DiagnosticSource.dll": { + "assemblyVersion": "4.0.4.0", + "fileVersion": "4.700.19.46214" + } + } + }, + "System.Dynamic.Runtime/4.3.0": { + "dependencies": { + "System.Collections": "4.3.0", + "System.Diagnostics.Debug": "4.3.0", + "System.Linq": "4.3.0", + "System.Linq.Expressions": "4.3.0", + "System.ObjectModel": "4.3.0", + "System.Reflection": "4.3.0", + "System.Reflection.Emit": "4.3.0", + "System.Reflection.Emit.ILGeneration": "4.3.0", + "System.Reflection.Primitives": "4.3.0", + "System.Reflection.TypeExtensions": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Extensions": "4.3.0", + "System.Threading": "4.3.0" + } + }, + "System.Globalization/4.3.0": { + "dependencies": { + "System.Runtime": "4.3.0" + } + }, + "System.Globalization.Extensions/4.3.0": { + "dependencies": { + "System.Globalization": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Extensions": "4.3.0", + "System.Runtime.InteropServices": "4.3.0" + } + }, + "System.IO/4.3.0": { + "dependencies": { + "System.Runtime": "4.3.0", + "System.Text.Encoding": "4.3.0", + "System.Threading.Tasks": "4.3.0" + } + }, + "System.IO.FileSystem/4.3.0": { + "dependencies": { + "System.IO": "4.3.0", + "System.IO.FileSystem.Primitives": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Handles": "4.3.0", + "System.Text.Encoding": "4.3.0", + "System.Threading.Tasks": "4.3.0" + } + }, + "System.IO.FileSystem.Primitives/4.3.0": { + "dependencies": { + "System.Runtime": "4.3.0" + } + }, + "System.Linq/4.3.0": { + "dependencies": { + "System.Collections": "4.3.0", + "System.Diagnostics.Debug": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Extensions": "4.3.0" + } + }, + "System.Linq.Expressions/4.3.0": { + "dependencies": { + "System.Collections": "4.3.0", + "System.Diagnostics.Debug": "4.3.0", + "System.Globalization": "4.3.0", + "System.IO": "4.3.0", + "System.Linq": "4.3.0", + "System.ObjectModel": "4.3.0", + "System.Reflection": "4.3.0", + "System.Reflection.Emit": "4.3.0", + "System.Reflection.Emit.ILGeneration": "4.3.0", + "System.Reflection.Emit.Lightweight": "4.3.0", + "System.Reflection.Extensions": "4.3.0", + "System.Reflection.Primitives": "4.3.0", + "System.Reflection.TypeExtensions": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Extensions": "4.3.0", + "System.Threading": "4.3.0" + } + }, + "System.Memory.Data/1.0.2": { + "dependencies": { + "System.Text.Encodings.Web": "4.7.2", + "System.Text.Json": "4.7.2" + }, + "runtime": { + "lib/netstandard2.0/System.Memory.Data.dll": { + "assemblyVersion": "1.0.2.0", + "fileVersion": "1.0.221.20802" + } + } + }, + "System.Numerics.Vectors/4.5.0": {}, + "System.ObjectModel/4.3.0": { + "dependencies": { + "System.Collections": "4.3.0", + "System.Diagnostics.Debug": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Threading": "4.3.0" + } + }, + "System.Reflection/4.3.0": { + "dependencies": { + "System.IO": "4.3.0", + "System.Reflection.Primitives": "4.3.0", + "System.Runtime": "4.3.0" + } + }, + "System.Reflection.Emit/4.3.0": { + "dependencies": { + "System.IO": "4.3.0", + "System.Reflection": "4.3.0", + "System.Reflection.Emit.ILGeneration": "4.3.0", + "System.Reflection.Primitives": "4.3.0", + "System.Runtime": "4.3.0" + } + }, + "System.Reflection.Emit.ILGeneration/4.3.0": { + "dependencies": { + "System.Reflection": "4.3.0", + "System.Reflection.Primitives": "4.3.0", + "System.Runtime": "4.3.0" + } + }, + "System.Reflection.Emit.Lightweight/4.3.0": { + "dependencies": { + "System.Reflection": "4.3.0", + "System.Reflection.Emit.ILGeneration": "4.3.0", + "System.Reflection.Primitives": "4.3.0", + "System.Runtime": "4.3.0" + } + }, + "System.Reflection.Extensions/4.3.0": { + "dependencies": { + "System.Reflection": "4.3.0", + "System.Runtime": "4.3.0" + } + }, + "System.Reflection.Primitives/4.3.0": { + "dependencies": { + "System.Runtime": "4.3.0" + } + }, + "System.Reflection.TypeExtensions/4.3.0": { + "dependencies": { + "System.Reflection": "4.3.0", + "System.Runtime": "4.3.0" + } + }, + "System.Resources.ResourceManager/4.3.0": { + "dependencies": { + "System.Globalization": "4.3.0", + "System.Reflection": "4.3.0", + "System.Runtime": "4.3.0" + } + }, + "System.Runtime/4.3.0": {}, + "System.Runtime.CompilerServices.Unsafe/4.7.1": { + "runtime": { + "lib/netcoreapp2.0/System.Runtime.CompilerServices.Unsafe.dll": { + "assemblyVersion": "4.0.6.0", + "fileVersion": "4.700.20.12001" + } + } + }, + "System.Runtime.Extensions/4.3.0": { + "dependencies": { + "System.Runtime": "4.3.0" + } + }, + "System.Runtime.Handles/4.3.0": { + "dependencies": { + "System.Runtime": "4.3.0" + } + }, + "System.Runtime.InteropServices/4.3.0": { + "dependencies": { + "System.Reflection": "4.3.0", + "System.Reflection.Primitives": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Handles": "4.3.0" + } + }, + "System.Runtime.Serialization.Formatters/4.3.0": { + "dependencies": { + "System.Collections": "4.3.0", + "System.Reflection": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Serialization.Primitives": "4.3.0" + } + }, + "System.Runtime.Serialization.Primitives/4.3.0": { + "dependencies": { + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0" + } + }, + "System.Security.Cryptography.Primitives/4.3.0": { + "dependencies": { + "System.Diagnostics.Debug": "4.3.0", + "System.Globalization": "4.3.0", + "System.IO": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Threading": "4.3.0", + "System.Threading.Tasks": "4.3.0" + } + }, + "System.Security.SecureString/4.3.0": { + "dependencies": { + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Handles": "4.3.0", + "System.Runtime.InteropServices": "4.3.0", + "System.Security.Cryptography.Primitives": "4.3.0", + "System.Text.Encoding": "4.3.0", + "System.Threading": "4.3.0" + } + }, + "System.Text.Encoding/4.3.0": { + "dependencies": { + "System.Runtime": "4.3.0" + } + }, + "System.Text.Encoding.Extensions/4.3.0": { + "dependencies": { + "System.Runtime": "4.3.0", + "System.Text.Encoding": "4.3.0" + } + }, + "System.Text.Encodings.Web/4.7.2": { + "runtime": { + "lib/netstandard2.0/System.Text.Encodings.Web.dll": { + "assemblyVersion": "4.0.5.1", + "fileVersion": "4.700.21.11602" + } + } + }, + "System.Text.Json/4.7.2": { + "dependencies": { + "Microsoft.Bcl.AsyncInterfaces": "1.1.1", + "System.Runtime.CompilerServices.Unsafe": "4.7.1", + "System.Text.Encodings.Web": "4.7.2" + }, + "runtime": { + "lib/netstandard2.0/System.Text.Json.dll": { + "assemblyVersion": "4.0.1.2", + "fileVersion": "4.700.20.21406" + } + } + }, + "System.Text.RegularExpressions/4.3.0": { + "dependencies": { + "System.Runtime": "4.3.0" + } + }, + "System.Threading/4.3.0": { + "dependencies": { + "System.Runtime": "4.3.0", + "System.Threading.Tasks": "4.3.0" + } + }, + "System.Threading.Tasks/4.3.0": { + "dependencies": { + "System.Runtime": "4.3.0" + } + }, + "System.Threading.Tasks.Extensions/4.5.4": {}, + "System.Xml.ReaderWriter/4.3.0": { + "dependencies": { + "System.Collections": "4.3.0", + "System.Diagnostics.Debug": "4.3.0", + "System.Globalization": "4.3.0", + "System.IO": "4.3.0", + "System.IO.FileSystem": "4.3.0", + "System.IO.FileSystem.Primitives": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Extensions": "4.3.0", + "System.Runtime.InteropServices": "4.3.0", + "System.Text.Encoding": "4.3.0", + "System.Text.Encoding.Extensions": "4.3.0", + "System.Text.RegularExpressions": "4.3.0", + "System.Threading.Tasks": "4.3.0", + "System.Threading.Tasks.Extensions": "4.5.4" + } + }, + "System.Xml.XmlDocument/4.3.0": { + "dependencies": { + "System.Collections": "4.3.0", + "System.Diagnostics.Debug": "4.3.0", + "System.Globalization": "4.3.0", + "System.IO": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Extensions": "4.3.0", + "System.Text.Encoding": "4.3.0", + "System.Threading": "4.3.0", + "System.Xml.ReaderWriter": "4.3.0" + } + }, + "System.Xml.XmlSerializer/4.3.0": { + "dependencies": { + "System.Collections": "4.3.0", + "System.Globalization": "4.3.0", + "System.IO": "4.3.0", + "System.Linq": "4.3.0", + "System.Reflection": "4.3.0", + "System.Reflection.Emit": "4.3.0", + "System.Reflection.Emit.ILGeneration": "4.3.0", + "System.Reflection.Extensions": "4.3.0", + "System.Reflection.Primitives": "4.3.0", + "System.Reflection.TypeExtensions": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Extensions": "4.3.0", + "System.Text.RegularExpressions": "4.3.0", + "System.Threading": "4.3.0", + "System.Xml.ReaderWriter": "4.3.0", + "System.Xml.XmlDocument": "4.3.0" + } + } + } + }, + "libraries": { + "Microsoft.Azure.PowerShell.AuthenticationAssemblyLoadContext/1.0.0": { + "type": "project", + "serviceable": false, + "sha512": "" + }, + "Azure.Core/1.22.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-ze/xRCHSSDe5TIk5vBDbVrauW1EN7UIbnBvIBfMH8KSt/I9+/7yPAjTBDgNBk0IwG6WBV+BBHp4IUtS/PGAQwQ==", + "path": "azure.core/1.22.0", + "hashPath": "azure.core.1.22.0.nupkg.sha512" + }, + "Hyak.Common/1.2.2": { + "type": "package", + "serviceable": true, + "sha512": "sha512-uZpnFn48nSQwHcO0/GSBZ7ExaO0sTXKv8KariXXEWLaB4Q3AeQoprYG4WpKsCT0ByW3YffETivgc5rcH5RRDvQ==", + "path": "hyak.common/1.2.2", + "hashPath": "hyak.common.1.2.2.nupkg.sha512" + }, + "Microsoft.ApplicationInsights/2.12.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-4vZcVaxywAzfLm5mAc2/llaZQTzbCqu9KirxxI/t49AkZH5Qxf7JxuAMUuv2/6JEdOOkGDzpvdrrIlf6LkFGcg==", + "path": "microsoft.applicationinsights/2.12.0", + "hashPath": "microsoft.applicationinsights.2.12.0.nupkg.sha512" + }, + "Microsoft.Azure.Common/2.2.1": { + "type": "package", + "serviceable": true, + "sha512": "sha512-abzRooh4ACKjzAKxRB6r+SHKW3d+IrLcgtVG81D+3kQU/OMjAZS1oDp9CDalhSbmxa84u0MHM5N+AKeTtKPoiw==", + "path": "microsoft.azure.common/2.2.1", + "hashPath": "microsoft.azure.common.2.2.1.nupkg.sha512" + }, + "Microsoft.Azure.PowerShell.Authentication.Abstractions/1.3.57-preview": { + "type": "package", + "serviceable": true, + "sha512": "sha512-bKDPidNeqBpTDikPnIuoMoGd26pD2PNE41cut0ASwL5exJwLNggYO55U+f/cJkgjCUMR8i5nqnlfpGHSS1I0vw==", + "path": "microsoft.azure.powershell.authentication.abstractions/1.3.57-preview", + "hashPath": "microsoft.azure.powershell.authentication.abstractions.1.3.57-preview.nupkg.sha512" + }, + "Microsoft.Azure.PowerShell.Clients.Aks/1.3.57-preview": { + "type": "package", + "serviceable": true, + "sha512": "sha512-sUGkvOvpqlEK5zdZ7HWaou3GY5bnlNrE0LuZ137+TsNfgx2E3+0Ika3a02i/9+niDDf60xj4LaNOYDSuK5zdJA==", + "path": "microsoft.azure.powershell.clients.aks/1.3.57-preview", + "hashPath": "microsoft.azure.powershell.clients.aks.1.3.57-preview.nupkg.sha512" + }, + "Microsoft.Azure.PowerShell.Clients.Authorization/1.3.57-preview": { + "type": "package", + "serviceable": true, + "sha512": "sha512-Q760F40/qfas2Al+GQhhE4gJt768pQPxlCjqrjjkukgVsq+X/M8IqpCeBzbRTiiyerhcjJoyNxqlGuZpUhqGxw==", + "path": "microsoft.azure.powershell.clients.authorization/1.3.57-preview", + "hashPath": "microsoft.azure.powershell.clients.authorization.1.3.57-preview.nupkg.sha512" + }, + "Microsoft.Azure.PowerShell.Clients.Compute/1.3.57-preview": { + "type": "package", + "serviceable": true, + "sha512": "sha512-1fcsBdYMmEJPMPN8EAgJkaJ2WxxTKH3VcLECYdL2cfg2bgN8CKbbjSvarrXEezhyduE+LdYnL0e8Pigsnaj55Q==", + "path": "microsoft.azure.powershell.clients.compute/1.3.57-preview", + "hashPath": "microsoft.azure.powershell.clients.compute.1.3.57-preview.nupkg.sha512" + }, + "Microsoft.Azure.PowerShell.Clients.Graph.Rbac/1.3.57-preview": { + "type": "package", + "serviceable": true, + "sha512": "sha512-BIMthJ1x2vQAN3iWChnNj8BfgrXvKXn+n06E0/h2MNurMXbAOn5eiPIfE8bnj2BO99uSh1ns09yEgOTPJIvZBQ==", + "path": "microsoft.azure.powershell.clients.graph.rbac/1.3.57-preview", + "hashPath": "microsoft.azure.powershell.clients.graph.rbac.1.3.57-preview.nupkg.sha512" + }, + "Microsoft.Azure.PowerShell.Clients.KeyVault/1.3.57-preview": { + "type": "package", + "serviceable": true, + "sha512": "sha512-MfvwM8ABj/EswmYu0Bf/8kyAO6kUv2zYSihVn384SVmypomVKUu69GN0VXKbmGaovPI8v3H41Ldp7DqbPRun5A==", + "path": "microsoft.azure.powershell.clients.keyvault/1.3.57-preview", + "hashPath": "microsoft.azure.powershell.clients.keyvault.1.3.57-preview.nupkg.sha512" + }, + "Microsoft.Azure.PowerShell.Clients.Monitor/1.3.57-preview": { + "type": "package", + "serviceable": true, + "sha512": "sha512-UyCKG5BWVjYFRtH2JNx6f4KdccaSqww2y0OE2PYgib8VhLqkoPr/BQg6vKzaGsghLIerZ/egQ7ntPPw3PCtS3w==", + "path": "microsoft.azure.powershell.clients.monitor/1.3.57-preview", + "hashPath": "microsoft.azure.powershell.clients.monitor.1.3.57-preview.nupkg.sha512" + }, + "Microsoft.Azure.PowerShell.Clients.Network/1.3.57-preview": { + "type": "package", + "serviceable": true, + "sha512": "sha512-YAAHxw+zzvkGNWAi668NSoTR+V/7vf+gRhu1oFa1O1/f2NGpz5XuqPrQyAPrri64hKqB/k3OMrM7sjlIv16dAg==", + "path": "microsoft.azure.powershell.clients.network/1.3.57-preview", + "hashPath": "microsoft.azure.powershell.clients.network.1.3.57-preview.nupkg.sha512" + }, + "Microsoft.Azure.PowerShell.Clients.PolicyInsights/1.3.57-preview": { + "type": "package", + "serviceable": true, + "sha512": "sha512-urRIwRVzzOwpk8HhKq/b785DiL/arnmGUHbN4HvRN6ZsBkE1PU431YwgUlofb9pfB3buLcl0XJFRPLBJ0yZJUw==", + "path": "microsoft.azure.powershell.clients.policyinsights/1.3.57-preview", + "hashPath": "microsoft.azure.powershell.clients.policyinsights.1.3.57-preview.nupkg.sha512" + }, + "Microsoft.Azure.PowerShell.Clients.ResourceManager/1.3.57-preview": { + "type": "package", + "serviceable": true, + "sha512": "sha512-juWnd63Z2Sp+6bvtOPOF0Gj1v2AfpxXcuyodd9+U7euBro2G7Yfo2UHmHo/uaYyQUbM3HaXJPvse7BLDKjhe6w==", + "path": "microsoft.azure.powershell.clients.resourcemanager/1.3.57-preview", + "hashPath": "microsoft.azure.powershell.clients.resourcemanager.1.3.57-preview.nupkg.sha512" + }, + "Microsoft.Azure.PowerShell.Clients.Storage.Management/1.3.57-preview": { + "type": "package", + "serviceable": true, + "sha512": "sha512-HPpTWIlN+5ALqJssL7+6BD/vYrWi3eWKQ3QpWYjCFk5c9HVLTNpP+M2dq9jbsxLsZj+5Pt6gC4FIS22Q13Uhag==", + "path": "microsoft.azure.powershell.clients.storage.management/1.3.57-preview", + "hashPath": "microsoft.azure.powershell.clients.storage.management.1.3.57-preview.nupkg.sha512" + }, + "Microsoft.Azure.PowerShell.Clients.Websites/1.3.57-preview": { + "type": "package", + "serviceable": true, + "sha512": "sha512-b5yBD9FrY02r0kdNNgZ+uU0/QsW3AtmnCE/x1mUG5j8ka/V04AYUo+sDokQBzu+vnK6Y6OrVDtyWjmnKTDHpWA==", + "path": "microsoft.azure.powershell.clients.websites/1.3.57-preview", + "hashPath": "microsoft.azure.powershell.clients.websites.1.3.57-preview.nupkg.sha512" + }, + "Microsoft.Azure.PowerShell.Common/1.3.57-preview": { + "type": "package", + "serviceable": true, + "sha512": "sha512-9jZYZ9LKbx16r69y7cO9d7bDjpE0/HgeBU386Y/O6q05VRaq2wAsB2rbQ9AjxcPGHfwS0+2US/RImSSqjVABRQ==", + "path": "microsoft.azure.powershell.common/1.3.57-preview", + "hashPath": "microsoft.azure.powershell.common.1.3.57-preview.nupkg.sha512" + }, + "Microsoft.Azure.PowerShell.Common.Share/1.3.57-preview": { + "type": "package", + "serviceable": true, + "sha512": "sha512-4mJSjnwZVLQYWhP47eDzdt0yaLIf2I4pqaEIqcfAjkjdbKpnCXCnJUEFRId061yuKpq1LtfBZkHDRi68I5CJxg==", + "path": "microsoft.azure.powershell.common.share/1.3.57-preview", + "hashPath": "microsoft.azure.powershell.common.share.1.3.57-preview.nupkg.sha512" + }, + "Microsoft.Azure.PowerShell.Storage/1.3.57-preview": { + "type": "package", + "serviceable": true, + "sha512": "sha512-fObXEcuhk1JUoQ0fiCV4nK4NJWqvsfsKCzapF7SFEQ87X6AasL6m5KGT8JQSnHmc849xxxaixPTxyWaf9BBlpw==", + "path": "microsoft.azure.powershell.storage/1.3.57-preview", + "hashPath": "microsoft.azure.powershell.storage.1.3.57-preview.nupkg.sha512" + }, + "Microsoft.Azure.PowerShell.Strategies/1.3.57-preview": { + "type": "package", + "serviceable": true, + "sha512": "sha512-HwyxUwDHCmY6Zdxg2xpFC9Gqmu92Xr0cAr4ElWYwz8Z7PE9uYVkTpKMIKd7oIJJgsIANTfqEU1HKoeI3FXPLqw==", + "path": "microsoft.azure.powershell.strategies/1.3.57-preview", + "hashPath": "microsoft.azure.powershell.strategies.1.3.57-preview.nupkg.sha512" + }, + "Microsoft.Bcl.AsyncInterfaces/1.1.1": { + "type": "package", + "serviceable": true, + "sha512": "sha512-yuvf07qFWFqtK3P/MRkEKLhn5r2UbSpVueRziSqj0yJQIKFwG1pq9mOayK3zE5qZCTs0CbrwL9M6R8VwqyGy2w==", + "path": "microsoft.bcl.asyncinterfaces/1.1.1", + "hashPath": "microsoft.bcl.asyncinterfaces.1.1.1.nupkg.sha512" + }, + "Microsoft.CSharp/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-P+MBhIM0YX+JqROuf7i306ZLJEjQYA9uUyRDE+OqwUI5sh41e2ZbPQV3LfAPh+29cmceE1pUffXsGfR4eMY3KA==", + "path": "microsoft.csharp/4.3.0", + "hashPath": "microsoft.csharp.4.3.0.nupkg.sha512" + }, + "Microsoft.Rest.ClientRuntime/2.3.23": { + "type": "package", + "serviceable": true, + "sha512": "sha512-92kNTi1N7zI5wwI2ZXswBRnk61OUYnuYJXrlgOhes5IsAqGmgw9DPGmhUzeY8OaZ8TTrQdDzvgXFnbCHwLzSVA==", + "path": "microsoft.rest.clientruntime/2.3.23", + "hashPath": "microsoft.rest.clientruntime.2.3.23.nupkg.sha512" + }, + "Microsoft.Rest.ClientRuntime.Azure/3.3.19": { + "type": "package", + "serviceable": true, + "sha512": "sha512-+NVBWvRXNwaAPTZUxjUlQggsrf3X0GbiRoxYfgc3kG9E55ZxZxvZPT3nIfC4DNqzGSXUEvmLbckdXgBBzGdUaA==", + "path": "microsoft.rest.clientruntime.azure/3.3.19", + "hashPath": "microsoft.rest.clientruntime.azure.3.3.19.nupkg.sha512" + }, + "Newtonsoft.Json/10.0.3": { + "type": "package", + "serviceable": true, + "sha512": "sha512-hSXaFmh7hNCuEoC4XNY5DrRkLDzYHqPx/Ik23R4J86Z7PE/Y6YidhG602dFVdLBRSdG6xp9NabH3dXpcoxWvww==", + "path": "newtonsoft.json/10.0.3", + "hashPath": "newtonsoft.json.10.0.3.nupkg.sha512" + }, + "PowerShellStandard.Library/5.1.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-iYaRvQsM1fow9h3uEmio+2m2VXfulgI16AYHaTZ8Sf7erGe27Qc8w/h6QL5UPuwv1aXR40QfzMEwcCeiYJp2cw==", + "path": "powershellstandard.library/5.1.0", + "hashPath": "powershellstandard.library.5.1.0.nupkg.sha512" + }, + "System.Collections/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-3Dcj85/TBdVpL5Zr+gEEBUuFe2icOnLalmEh9hfck1PTYbbyWuZgh4fmm2ysCLTrqLQw6t3TgTyJ+VLp+Qb+Lw==", + "path": "system.collections/4.3.0", + "hashPath": "system.collections.4.3.0.nupkg.sha512" + }, + "System.Collections.NonGeneric/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-prtjIEMhGUnQq6RnPEYLpFt8AtLbp9yq2zxOSrY7KJJZrw25Fi97IzBqY7iqssbM61Ek5b8f3MG/sG1N2sN5KA==", + "path": "system.collections.nongeneric/4.3.0", + "hashPath": "system.collections.nongeneric.4.3.0.nupkg.sha512" + }, + "System.Collections.Specialized/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-Epx8PoVZR0iuOnJJDzp7pWvdfMMOAvpUo95pC4ScH2mJuXkKA2Y4aR3cG9qt2klHgSons1WFh4kcGW7cSXvrxg==", + "path": "system.collections.specialized/4.3.0", + "hashPath": "system.collections.specialized.4.3.0.nupkg.sha512" + }, + "System.ComponentModel/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-VyGn1jGRZVfxnh8EdvDCi71v3bMXrsu8aYJOwoV7SNDLVhiEqwP86pPMyRGsDsxhXAm2b3o9OIqeETfN5qfezw==", + "path": "system.componentmodel/4.3.0", + "hashPath": "system.componentmodel.4.3.0.nupkg.sha512" + }, + "System.ComponentModel.Primitives/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-j8GUkCpM8V4d4vhLIIoBLGey2Z5bCkMVNjEZseyAlm4n5arcsJOeI3zkUP+zvZgzsbLTYh4lYeP/ZD/gdIAPrw==", + "path": "system.componentmodel.primitives/4.3.0", + "hashPath": "system.componentmodel.primitives.4.3.0.nupkg.sha512" + }, + "System.ComponentModel.TypeConverter/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-16pQ6P+EdhcXzPiEK4kbA953Fu0MNG2ovxTZU81/qsCd1zPRsKc3uif5NgvllCY598k6bI0KUyKW8fanlfaDQg==", + "path": "system.componentmodel.typeconverter/4.3.0", + "hashPath": "system.componentmodel.typeconverter.4.3.0.nupkg.sha512" + }, + "System.Diagnostics.Debug/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-ZUhUOdqmaG5Jk3Xdb8xi5kIyQYAA4PnTNlHx1mu9ZY3qv4ELIdKbnL/akbGaKi2RnNUWaZsAs31rvzFdewTj2g==", + "path": "system.diagnostics.debug/4.3.0", + "hashPath": "system.diagnostics.debug.4.3.0.nupkg.sha512" + }, + "System.Diagnostics.DiagnosticSource/4.6.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-mbBgoR0rRfl2uimsZ2avZY8g7Xnh1Mza0rJZLPcxqiMWlkGukjmRkuMJ/er+AhQuiRIh80CR/Hpeztr80seV5g==", + "path": "system.diagnostics.diagnosticsource/4.6.0", + "hashPath": "system.diagnostics.diagnosticsource.4.6.0.nupkg.sha512" + }, + "System.Dynamic.Runtime/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-SNVi1E/vfWUAs/WYKhE9+qlS6KqK0YVhnlT0HQtr8pMIA8YX3lwy3uPMownDwdYISBdmAF/2holEIldVp85Wag==", + "path": "system.dynamic.runtime/4.3.0", + "hashPath": "system.dynamic.runtime.4.3.0.nupkg.sha512" + }, + "System.Globalization/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-kYdVd2f2PAdFGblzFswE4hkNANJBKRmsfa2X5LG2AcWE1c7/4t0pYae1L8vfZ5xvE2nK/R9JprtToA61OSHWIg==", + "path": "system.globalization/4.3.0", + "hashPath": "system.globalization.4.3.0.nupkg.sha512" + }, + "System.Globalization.Extensions/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-FhKmdR6MPG+pxow6wGtNAWdZh7noIOpdD5TwQ3CprzgIE1bBBoim0vbR1+AWsWjQmU7zXHgQo4TWSP6lCeiWcQ==", + "path": "system.globalization.extensions/4.3.0", + "hashPath": "system.globalization.extensions.4.3.0.nupkg.sha512" + }, + "System.IO/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-3qjaHvxQPDpSOYICjUoTsmoq5u6QJAFRUITgeT/4gqkF1bajbSmb1kwSxEA8AHlofqgcKJcM8udgieRNhaJ5Cg==", + "path": "system.io/4.3.0", + "hashPath": "system.io.4.3.0.nupkg.sha512" + }, + "System.IO.FileSystem/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-3wEMARTnuio+ulnvi+hkRNROYwa1kylvYahhcLk4HSoVdl+xxTFVeVlYOfLwrDPImGls0mDqbMhrza8qnWPTdA==", + "path": "system.io.filesystem/4.3.0", + "hashPath": "system.io.filesystem.4.3.0.nupkg.sha512" + }, + "System.IO.FileSystem.Primitives/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-6QOb2XFLch7bEc4lIcJH49nJN2HV+OC3fHDgsLVsBVBk3Y4hFAnOBGzJ2lUu7CyDDFo9IBWkSsnbkT6IBwwiMw==", + "path": "system.io.filesystem.primitives/4.3.0", + "hashPath": "system.io.filesystem.primitives.4.3.0.nupkg.sha512" + }, + "System.Linq/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-5DbqIUpsDp0dFftytzuMmc0oeMdQwjcP/EWxsksIz/w1TcFRkZ3yKKz0PqiYFMmEwPSWw+qNVqD7PJ889JzHbw==", + "path": "system.linq/4.3.0", + "hashPath": "system.linq.4.3.0.nupkg.sha512" + }, + "System.Linq.Expressions/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-PGKkrd2khG4CnlyJwxwwaWWiSiWFNBGlgXvJpeO0xCXrZ89ODrQ6tjEWS/kOqZ8GwEOUATtKtzp1eRgmYNfclg==", + "path": "system.linq.expressions/4.3.0", + "hashPath": "system.linq.expressions.4.3.0.nupkg.sha512" + }, + "System.Memory.Data/1.0.2": { + "type": "package", + "serviceable": true, + "sha512": "sha512-JGkzeqgBsiZwKJZ1IxPNsDFZDhUvuEdX8L8BDC8N3KOj+6zMcNU28CNN59TpZE/VJYy9cP+5M+sbxtWJx3/xtw==", + "path": "system.memory.data/1.0.2", + "hashPath": "system.memory.data.1.0.2.nupkg.sha512" + }, + "System.Numerics.Vectors/4.5.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-QQTlPTl06J/iiDbJCiepZ4H//BVraReU4O4EoRw1U02H5TLUIT7xn3GnDp9AXPSlJUDyFs4uWjWafNX6WrAojQ==", + "path": "system.numerics.vectors/4.5.0", + "hashPath": "system.numerics.vectors.4.5.0.nupkg.sha512" + }, + "System.ObjectModel/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-bdX+80eKv9bN6K4N+d77OankKHGn6CH711a6fcOpMQu2Fckp/Ft4L/kW9WznHpyR0NRAvJutzOMHNNlBGvxQzQ==", + "path": "system.objectmodel/4.3.0", + "hashPath": "system.objectmodel.4.3.0.nupkg.sha512" + }, + "System.Reflection/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-KMiAFoW7MfJGa9nDFNcfu+FpEdiHpWgTcS2HdMpDvt9saK3y/G4GwprPyzqjFH9NTaGPQeWNHU+iDlDILj96aQ==", + "path": "system.reflection/4.3.0", + "hashPath": "system.reflection.4.3.0.nupkg.sha512" + }, + "System.Reflection.Emit/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-228FG0jLcIwTVJyz8CLFKueVqQK36ANazUManGaJHkO0icjiIypKW7YLWLIWahyIkdh5M7mV2dJepllLyA1SKg==", + "path": "system.reflection.emit/4.3.0", + "hashPath": "system.reflection.emit.4.3.0.nupkg.sha512" + }, + "System.Reflection.Emit.ILGeneration/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-59tBslAk9733NXLrUJrwNZEzbMAcu8k344OYo+wfSVygcgZ9lgBdGIzH/nrg3LYhXceynyvTc8t5/GD4Ri0/ng==", + "path": "system.reflection.emit.ilgeneration/4.3.0", + "hashPath": "system.reflection.emit.ilgeneration.4.3.0.nupkg.sha512" + }, + "System.Reflection.Emit.Lightweight/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-oadVHGSMsTmZsAF864QYN1t1QzZjIcuKU3l2S9cZOwDdDueNTrqq1yRj7koFfIGEnKpt6NjpL3rOzRhs4ryOgA==", + "path": "system.reflection.emit.lightweight/4.3.0", + "hashPath": "system.reflection.emit.lightweight.4.3.0.nupkg.sha512" + }, + "System.Reflection.Extensions/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-rJkrJD3kBI5B712aRu4DpSIiHRtr6QlfZSQsb0hYHrDCZORXCFjQfoipo2LaMUHoT9i1B7j7MnfaEKWDFmFQNQ==", + "path": "system.reflection.extensions/4.3.0", + "hashPath": "system.reflection.extensions.4.3.0.nupkg.sha512" + }, + "System.Reflection.Primitives/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-5RXItQz5As4xN2/YUDxdpsEkMhvw3e6aNveFXUn4Hl/udNTCNhnKp8lT9fnc3MhvGKh1baak5CovpuQUXHAlIA==", + "path": "system.reflection.primitives/4.3.0", + "hashPath": "system.reflection.primitives.4.3.0.nupkg.sha512" + }, + "System.Reflection.TypeExtensions/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-7u6ulLcZbyxB5Gq0nMkQttcdBTx57ibzw+4IOXEfR+sXYQoHvjW5LTLyNr8O22UIMrqYbchJQJnos4eooYzYJA==", + "path": "system.reflection.typeextensions/4.3.0", + "hashPath": "system.reflection.typeextensions.4.3.0.nupkg.sha512" + }, + "System.Resources.ResourceManager/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-/zrcPkkWdZmI4F92gL/TPumP98AVDu/Wxr3CSJGQQ+XN6wbRZcyfSKVoPo17ilb3iOr0cCRqJInGwNMolqhS8A==", + "path": "system.resources.resourcemanager/4.3.0", + "hashPath": "system.resources.resourcemanager.4.3.0.nupkg.sha512" + }, + "System.Runtime/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-JufQi0vPQ0xGnAczR13AUFglDyVYt4Kqnz1AZaiKZ5+GICq0/1MH/mO/eAJHt/mHW1zjKBJd7kV26SrxddAhiw==", + "path": "system.runtime/4.3.0", + "hashPath": "system.runtime.4.3.0.nupkg.sha512" + }, + "System.Runtime.CompilerServices.Unsafe/4.7.1": { + "type": "package", + "serviceable": true, + "sha512": "sha512-zOHkQmzPCn5zm/BH+cxC1XbUS3P4Yoi3xzW7eRgVpDR2tPGSzyMZ17Ig1iRkfJuY0nhxkQQde8pgePNiA7z7TQ==", + "path": "system.runtime.compilerservices.unsafe/4.7.1", + "hashPath": "system.runtime.compilerservices.unsafe.4.7.1.nupkg.sha512" + }, + "System.Runtime.Extensions/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-guW0uK0fn5fcJJ1tJVXYd7/1h5F+pea1r7FLSOz/f8vPEqbR2ZAknuRDvTQ8PzAilDveOxNjSfr0CHfIQfFk8g==", + "path": "system.runtime.extensions/4.3.0", + "hashPath": "system.runtime.extensions.4.3.0.nupkg.sha512" + }, + "System.Runtime.Handles/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-OKiSUN7DmTWeYb3l51A7EYaeNMnvxwE249YtZz7yooT4gOZhmTjIn48KgSsw2k2lYdLgTKNJw/ZIfSElwDRVgg==", + "path": "system.runtime.handles/4.3.0", + "hashPath": "system.runtime.handles.4.3.0.nupkg.sha512" + }, + "System.Runtime.InteropServices/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-uv1ynXqiMK8mp1GM3jDqPCFN66eJ5w5XNomaK2XD+TuCroNTLFGeZ+WCmBMcBDyTFKou3P6cR6J/QsaqDp7fGQ==", + "path": "system.runtime.interopservices/4.3.0", + "hashPath": "system.runtime.interopservices.4.3.0.nupkg.sha512" + }, + "System.Runtime.Serialization.Formatters/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-KT591AkTNFOTbhZlaeMVvfax3RqhH1EJlcwF50Wm7sfnBLuHiOeZRRKrr1ns3NESkM20KPZ5Ol/ueMq5vg4QoQ==", + "path": "system.runtime.serialization.formatters/4.3.0", + "hashPath": "system.runtime.serialization.formatters.4.3.0.nupkg.sha512" + }, + "System.Runtime.Serialization.Primitives/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-Wz+0KOukJGAlXjtKr+5Xpuxf8+c8739RI1C+A2BoQZT+wMCCoMDDdO8/4IRHfaVINqL78GO8dW8G2lW/e45Mcw==", + "path": "system.runtime.serialization.primitives/4.3.0", + "hashPath": "system.runtime.serialization.primitives.4.3.0.nupkg.sha512" + }, + "System.Security.Cryptography.Primitives/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-7bDIyVFNL/xKeFHjhobUAQqSpJq9YTOpbEs6mR233Et01STBMXNAc/V+BM6dwYGc95gVh/Zf+iVXWzj3mE8DWg==", + "path": "system.security.cryptography.primitives/4.3.0", + "hashPath": "system.security.cryptography.primitives.4.3.0.nupkg.sha512" + }, + "System.Security.SecureString/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-PnXp38O9q/2Oe4iZHMH60kinScv6QiiL2XH54Pj2t0Y6c2zKPEiAZsM/M3wBOHLNTBDFP0zfy13WN2M0qFz5jg==", + "path": "system.security.securestring/4.3.0", + "hashPath": "system.security.securestring.4.3.0.nupkg.sha512" + }, + "System.Text.Encoding/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-BiIg+KWaSDOITze6jGQynxg64naAPtqGHBwDrLaCtixsa5bKiR8dpPOHA7ge3C0JJQizJE+sfkz1wV+BAKAYZw==", + "path": "system.text.encoding/4.3.0", + "hashPath": "system.text.encoding.4.3.0.nupkg.sha512" + }, + "System.Text.Encoding.Extensions/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-YVMK0Bt/A43RmwizJoZ22ei2nmrhobgeiYwFzC4YAN+nue8RF6djXDMog0UCn+brerQoYVyaS+ghy9P/MUVcmw==", + "path": "system.text.encoding.extensions/4.3.0", + "hashPath": "system.text.encoding.extensions.4.3.0.nupkg.sha512" + }, + "System.Text.Encodings.Web/4.7.2": { + "type": "package", + "serviceable": true, + "sha512": "sha512-iTUgB/WtrZ1sWZs84F2hwyQhiRH6QNjQv2DkwrH+WP6RoFga2Q1m3f9/Q7FG8cck8AdHitQkmkXSY8qylcDmuA==", + "path": "system.text.encodings.web/4.7.2", + "hashPath": "system.text.encodings.web.4.7.2.nupkg.sha512" + }, + "System.Text.Json/4.7.2": { + "type": "package", + "serviceable": true, + "sha512": "sha512-TcMd95wcrubm9nHvJEQs70rC0H/8omiSGGpU4FQ/ZA1URIqD4pjmFJh2Mfv1yH1eHgJDWTi2hMDXwTET+zOOyg==", + "path": "system.text.json/4.7.2", + "hashPath": "system.text.json.4.7.2.nupkg.sha512" + }, + "System.Text.RegularExpressions/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-RpT2DA+L660cBt1FssIE9CAGpLFdFPuheB7pLpKpn6ZXNby7jDERe8Ua/Ne2xGiwLVG2JOqziiaVCGDon5sKFA==", + "path": "system.text.regularexpressions/4.3.0", + "hashPath": "system.text.regularexpressions.4.3.0.nupkg.sha512" + }, + "System.Threading/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-VkUS0kOBcUf3Wwm0TSbrevDDZ6BlM+b/HRiapRFWjM5O0NS0LviG0glKmFK+hhPDd1XFeSdU1GmlLhb2CoVpIw==", + "path": "system.threading/4.3.0", + "hashPath": "system.threading.4.3.0.nupkg.sha512" + }, + "System.Threading.Tasks/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-LbSxKEdOUhVe8BezB/9uOGGppt+nZf6e1VFyw6v3DN6lqitm0OSn2uXMOdtP0M3W4iMcqcivm2J6UgqiwwnXiA==", + "path": "system.threading.tasks/4.3.0", + "hashPath": "system.threading.tasks.4.3.0.nupkg.sha512" + }, + "System.Threading.Tasks.Extensions/4.5.4": { + "type": "package", + "serviceable": true, + "sha512": "sha512-zteT+G8xuGu6mS+mzDzYXbzS7rd3K6Fjb9RiZlYlJPam2/hU7JCBZBVEcywNuR+oZ1ncTvc/cq0faRr3P01OVg==", + "path": "system.threading.tasks.extensions/4.5.4", + "hashPath": "system.threading.tasks.extensions.4.5.4.nupkg.sha512" + }, + "System.Xml.ReaderWriter/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-GrprA+Z0RUXaR4N7/eW71j1rgMnEnEVlgii49GZyAjTH7uliMnrOU3HNFBr6fEDBCJCIdlVNq9hHbaDR621XBA==", + "path": "system.xml.readerwriter/4.3.0", + "hashPath": "system.xml.readerwriter.4.3.0.nupkg.sha512" + }, + "System.Xml.XmlDocument/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-lJ8AxvkX7GQxpC6GFCeBj8ThYVyQczx2+f/cWHJU8tjS7YfI6Cv6bon70jVEgs2CiFbmmM8b9j1oZVx0dSI2Ww==", + "path": "system.xml.xmldocument/4.3.0", + "hashPath": "system.xml.xmldocument.4.3.0.nupkg.sha512" + }, + "System.Xml.XmlSerializer/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-MYoTCP7EZ98RrANESW05J5ZwskKDoN0AuZ06ZflnowE50LTpbR5yRg3tHckTVm5j/m47stuGgCrCHWePyHS70Q==", + "path": "system.xml.xmlserializer/4.3.0", + "hashPath": "system.xml.xmlserializer.4.3.0.nupkg.sha512" + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.AuthenticationAssemblyLoadContext.dll b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.AuthenticationAssemblyLoadContext.dll new file mode 100644 index 000000000000..239999aa2f3c Binary files /dev/null and b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.AuthenticationAssemblyLoadContext.dll differ diff --git a/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Authenticators.dll b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Authenticators.dll new file mode 100644 index 000000000000..2b2e59f4a657 Binary files /dev/null and b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Authenticators.dll differ diff --git a/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Clients.Aks.dll b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Clients.Aks.dll new file mode 100644 index 000000000000..d966f6c302c5 Binary files /dev/null and b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Clients.Aks.dll differ diff --git a/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Clients.Authorization.dll b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Clients.Authorization.dll new file mode 100644 index 000000000000..2667669dd3f4 Binary files /dev/null and b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Clients.Authorization.dll differ diff --git a/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Clients.Compute.dll b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Clients.Compute.dll new file mode 100644 index 000000000000..a11687928f60 Binary files /dev/null and b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Clients.Compute.dll differ diff --git a/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Clients.Graph.Rbac.dll b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Clients.Graph.Rbac.dll new file mode 100644 index 000000000000..78fd60ad7aeb Binary files /dev/null and b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Clients.Graph.Rbac.dll differ diff --git a/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Clients.KeyVault.dll b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Clients.KeyVault.dll new file mode 100644 index 000000000000..b33058d94c53 Binary files /dev/null and b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Clients.KeyVault.dll differ diff --git a/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Clients.Monitor.dll b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Clients.Monitor.dll new file mode 100644 index 000000000000..e07270d24805 Binary files /dev/null and b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Clients.Monitor.dll differ diff --git a/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Clients.Network.dll b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Clients.Network.dll new file mode 100644 index 000000000000..6f489252bcac Binary files /dev/null and b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Clients.Network.dll differ diff --git a/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Clients.PolicyInsights.dll b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Clients.PolicyInsights.dll new file mode 100644 index 000000000000..c19efdb8e00b Binary files /dev/null and b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Clients.PolicyInsights.dll differ diff --git a/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Clients.ResourceManager.dll b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Clients.ResourceManager.dll new file mode 100644 index 000000000000..0d443a2ecaaa Binary files /dev/null and b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Clients.ResourceManager.dll differ diff --git a/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Clients.Storage.Management.dll b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Clients.Storage.Management.dll new file mode 100644 index 000000000000..482ccf22b352 Binary files /dev/null and b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Clients.Storage.Management.dll differ diff --git a/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Clients.Websites.dll b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Clients.Websites.dll new file mode 100644 index 000000000000..4bf3ee9bd78d Binary files /dev/null and b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Clients.Websites.dll differ diff --git a/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Cmdlets.Accounts.deps.json b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Cmdlets.Accounts.deps.json new file mode 100644 index 000000000000..54274e52ee76 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Cmdlets.Accounts.deps.json @@ -0,0 +1,2413 @@ +{ + "runtimeTarget": { + "name": ".NETStandard,Version=v2.0/", + "signature": "" + }, + "compilationOptions": {}, + "targets": { + ".NETStandard,Version=v2.0": {}, + ".NETStandard,Version=v2.0/": { + "Microsoft.Azure.PowerShell.Cmdlets.Accounts/1.0.0": { + "dependencies": { + "Azure.Core": "1.22.0", + "Hyak.Common": "1.2.2", + "Microsoft.ApplicationInsights": "2.12.0", + "Microsoft.Azure.Common": "2.2.1", + "Microsoft.Azure.PowerShell.Authentication": "1.0.0", + "Microsoft.Azure.PowerShell.Authentication.Abstractions": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Authentication.ResourceManager": "1.0.0", + "Microsoft.Azure.PowerShell.Authenticators": "1.0.0", + "Microsoft.Azure.PowerShell.Clients.Aks": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Clients.Authorization": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Clients.Compute": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Clients.Graph.Rbac": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Clients.KeyVault": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Clients.Monitor": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Clients.Network": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Clients.PolicyInsights": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Clients.ResourceManager": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Clients.Storage.Management": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Clients.Websites": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Common": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Common.Share": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Storage": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Strategies": "1.3.57-preview", + "Microsoft.Rest.ClientRuntime": "2.3.23", + "Microsoft.Rest.ClientRuntime.Azure": "3.3.19", + "NETStandard.Library": "2.0.3", + "Newtonsoft.Json": "10.0.3", + "PowerShellStandard.Library": "5.1.0", + "System.Security.Permissions": "4.5.0" + }, + "runtime": { + "Microsoft.Azure.PowerShell.Cmdlets.Accounts.dll": {} + } + }, + "Azure.Core/1.22.0": { + "dependencies": { + "Microsoft.Bcl.AsyncInterfaces": "1.1.1", + "System.Diagnostics.DiagnosticSource": "4.6.0", + "System.Memory.Data": "1.0.2", + "System.Numerics.Vectors": "4.5.0", + "System.Text.Encodings.Web": "4.7.2", + "System.Text.Json": "4.7.2", + "System.Threading.Tasks.Extensions": "4.5.4" + }, + "runtime": { + "lib/netstandard2.0/Azure.Core.dll": { + "assemblyVersion": "1.22.0.0", + "fileVersion": "1.2200.22.6212" + } + } + }, + "Azure.Identity/1.5.0": { + "dependencies": { + "Azure.Core": "1.22.0", + "Microsoft.Identity.Client": "4.30.1", + "Microsoft.Identity.Client.Extensions.Msal": "2.18.4", + "System.Memory": "4.5.4", + "System.Security.Cryptography.ProtectedData": "4.5.0", + "System.Text.Json": "4.7.2", + "System.Threading.Tasks.Extensions": "4.5.4" + }, + "runtime": { + "lib/netstandard2.0/Azure.Identity.dll": { + "assemblyVersion": "1.5.0.0", + "fileVersion": "1.500.21.51401" + } + } + }, + "Hyak.Common/1.2.2": { + "dependencies": { + "NETStandard.Library": "2.0.3", + "Newtonsoft.Json": "10.0.3", + "System.Reflection": "4.3.0", + "System.Threading": "4.3.0" + }, + "runtime": { + "lib/netstandard1.4/Hyak.Common.dll": { + "assemblyVersion": "1.0.0.0", + "fileVersion": "1.2.2.0" + } + } + }, + "Microsoft.ApplicationInsights/2.12.0": { + "dependencies": { + "System.Diagnostics.DiagnosticSource": "4.6.0", + "System.Runtime.InteropServices": "4.3.0" + }, + "runtime": { + "lib/netstandard2.0/Microsoft.ApplicationInsights.dll": { + "assemblyVersion": "2.12.0.21496", + "fileVersion": "2.12.0.21496" + } + } + }, + "Microsoft.Azure.Common/2.2.1": { + "dependencies": { + "Hyak.Common": "1.2.2", + "NETStandard.Library": "2.0.3" + }, + "runtime": { + "lib/netstandard1.4/Microsoft.Azure.Common.dll": { + "assemblyVersion": "2.0.0.0", + "fileVersion": "2.2.1.0" + } + } + }, + "Microsoft.Azure.PowerShell.Authentication.Abstractions/1.3.57-preview": { + "dependencies": { + "Hyak.Common": "1.2.2", + "Microsoft.Azure.Common": "2.2.1", + "Microsoft.Rest.ClientRuntime": "2.3.23", + "Newtonsoft.Json": "10.0.3" + }, + "runtime": { + "lib/netstandard2.0/Microsoft.Azure.PowerShell.Authentication.Abstractions.dll": { + "assemblyVersion": "1.0.0.0", + "fileVersion": "1.3.57.0" + } + } + }, + "Microsoft.Azure.PowerShell.Clients.Aks/1.3.57-preview": { + "dependencies": { + "Microsoft.Rest.ClientRuntime": "2.3.23", + "Microsoft.Rest.ClientRuntime.Azure": "3.3.19", + "Newtonsoft.Json": "10.0.3" + }, + "runtime": { + "lib/netstandard2.0/Microsoft.Azure.PowerShell.Clients.Aks.dll": { + "assemblyVersion": "1.0.0.0", + "fileVersion": "1.3.57.0" + } + } + }, + "Microsoft.Azure.PowerShell.Clients.Authorization/1.3.57-preview": { + "dependencies": { + "Microsoft.Rest.ClientRuntime": "2.3.23", + "Microsoft.Rest.ClientRuntime.Azure": "3.3.19", + "Newtonsoft.Json": "10.0.3" + }, + "runtime": { + "lib/netstandard2.0/Microsoft.Azure.PowerShell.Clients.Authorization.dll": { + "assemblyVersion": "1.0.0.0", + "fileVersion": "1.3.57.0" + } + } + }, + "Microsoft.Azure.PowerShell.Clients.Compute/1.3.57-preview": { + "dependencies": { + "Microsoft.Rest.ClientRuntime": "2.3.23", + "Microsoft.Rest.ClientRuntime.Azure": "3.3.19", + "Newtonsoft.Json": "10.0.3" + }, + "runtime": { + "lib/netstandard2.0/Microsoft.Azure.PowerShell.Clients.Compute.dll": { + "assemblyVersion": "1.0.0.0", + "fileVersion": "1.3.57.0" + } + } + }, + "Microsoft.Azure.PowerShell.Clients.Graph.Rbac/1.3.57-preview": { + "dependencies": { + "Microsoft.Azure.PowerShell.Authentication.Abstractions": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Clients.ResourceManager": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Common": "1.3.57-preview", + "Microsoft.Rest.ClientRuntime": "2.3.23", + "Microsoft.Rest.ClientRuntime.Azure": "3.3.19", + "Newtonsoft.Json": "10.0.3" + }, + "runtime": { + "lib/netstandard2.0/Microsoft.Azure.PowerShell.Clients.Graph.Rbac.dll": { + "assemblyVersion": "1.0.0.0", + "fileVersion": "1.3.57.0" + } + } + }, + "Microsoft.Azure.PowerShell.Clients.KeyVault/1.3.57-preview": { + "dependencies": { + "Microsoft.Rest.ClientRuntime": "2.3.23", + "Microsoft.Rest.ClientRuntime.Azure": "3.3.19", + "Newtonsoft.Json": "10.0.3", + "System.Collections.NonGeneric": "4.3.0", + "System.Collections.Specialized": "4.3.0", + "System.Reflection": "4.3.0", + "System.Security.SecureString": "4.3.0", + "System.Xml.XmlDocument": "4.3.0", + "System.Xml.XmlSerializer": "4.3.0" + }, + "runtime": { + "lib/netstandard2.0/Microsoft.Azure.PowerShell.Clients.KeyVault.dll": { + "assemblyVersion": "1.0.0.0", + "fileVersion": "1.3.57.0" + } + } + }, + "Microsoft.Azure.PowerShell.Clients.Monitor/1.3.57-preview": { + "dependencies": { + "Microsoft.Rest.ClientRuntime": "2.3.23", + "Microsoft.Rest.ClientRuntime.Azure": "3.3.19", + "Newtonsoft.Json": "10.0.3", + "System.Collections.Specialized": "4.3.0", + "System.Reflection": "4.3.0", + "System.Security.SecureString": "4.3.0", + "System.Xml.XmlDocument": "4.3.0", + "System.Xml.XmlSerializer": "4.3.0" + }, + "runtime": { + "lib/netstandard2.0/Microsoft.Azure.PowerShell.Clients.Monitor.dll": { + "assemblyVersion": "1.0.0.0", + "fileVersion": "1.3.57.0" + } + } + }, + "Microsoft.Azure.PowerShell.Clients.Network/1.3.57-preview": { + "dependencies": { + "Microsoft.Azure.PowerShell.Authentication.Abstractions": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Common": "1.3.57-preview", + "Microsoft.Rest.ClientRuntime": "2.3.23", + "Microsoft.Rest.ClientRuntime.Azure": "3.3.19", + "Newtonsoft.Json": "10.0.3" + }, + "runtime": { + "lib/netstandard2.0/Microsoft.Azure.PowerShell.Clients.Network.dll": { + "assemblyVersion": "1.0.0.0", + "fileVersion": "1.3.57.0" + } + } + }, + "Microsoft.Azure.PowerShell.Clients.PolicyInsights/1.3.57-preview": { + "dependencies": { + "Microsoft.Rest.ClientRuntime": "2.3.23", + "Microsoft.Rest.ClientRuntime.Azure": "3.3.19", + "Newtonsoft.Json": "10.0.3" + }, + "runtime": { + "lib/netstandard2.0/Microsoft.Azure.PowerShell.Clients.PolicyInsights.dll": { + "assemblyVersion": "1.0.0.0", + "fileVersion": "1.3.57.0" + } + } + }, + "Microsoft.Azure.PowerShell.Clients.ResourceManager/1.3.57-preview": { + "dependencies": { + "Microsoft.Azure.PowerShell.Authentication.Abstractions": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Common": "1.3.57-preview", + "Microsoft.Rest.ClientRuntime": "2.3.23", + "Microsoft.Rest.ClientRuntime.Azure": "3.3.19", + "Newtonsoft.Json": "10.0.3" + }, + "runtime": { + "lib/netstandard2.0/Microsoft.Azure.PowerShell.Clients.ResourceManager.dll": { + "assemblyVersion": "1.0.0.0", + "fileVersion": "1.3.57.0" + } + } + }, + "Microsoft.Azure.PowerShell.Clients.Storage.Management/1.3.57-preview": { + "dependencies": { + "Microsoft.Rest.ClientRuntime": "2.3.23", + "Microsoft.Rest.ClientRuntime.Azure": "3.3.19", + "System.Collections.NonGeneric": "4.3.0" + }, + "runtime": { + "lib/netstandard2.0/Microsoft.Azure.PowerShell.Clients.Storage.Management.dll": { + "assemblyVersion": "1.0.0.0", + "fileVersion": "1.3.57.0" + } + } + }, + "Microsoft.Azure.PowerShell.Clients.Websites/1.3.57-preview": { + "dependencies": { + "Microsoft.Rest.ClientRuntime": "2.3.23", + "Microsoft.Rest.ClientRuntime.Azure": "3.3.19", + "Newtonsoft.Json": "10.0.3", + "System.Collections.Specialized": "4.3.0", + "System.Reflection": "4.3.0", + "System.Security.SecureString": "4.3.0", + "System.Xml.XmlDocument": "4.3.0", + "System.Xml.XmlSerializer": "4.3.0" + }, + "runtime": { + "lib/netstandard2.0/Microsoft.Azure.PowerShell.Clients.Websites.dll": { + "assemblyVersion": "1.0.0.0", + "fileVersion": "1.3.57.0" + } + } + }, + "Microsoft.Azure.PowerShell.Common/1.3.57-preview": { + "dependencies": { + "Hyak.Common": "1.2.2", + "Microsoft.ApplicationInsights": "2.12.0", + "Microsoft.Azure.Common": "2.2.1", + "Microsoft.Azure.PowerShell.Authentication.Abstractions": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Common.Share": "1.3.57-preview", + "Microsoft.Rest.ClientRuntime": "2.3.23", + "Microsoft.Rest.ClientRuntime.Azure": "3.3.19", + "Newtonsoft.Json": "10.0.3" + }, + "runtime": { + "lib/netstandard2.0/Microsoft.Azure.PowerShell.Common.dll": { + "assemblyVersion": "1.0.0.0", + "fileVersion": "1.3.57.0" + } + } + }, + "Microsoft.Azure.PowerShell.Common.Share/1.3.57-preview": { + "dependencies": { + "Hyak.Common": "1.2.2", + "Microsoft.Azure.Common": "2.2.1", + "Microsoft.Rest.ClientRuntime": "2.3.23", + "Microsoft.Rest.ClientRuntime.Azure": "3.3.19", + "Newtonsoft.Json": "10.0.3" + }, + "runtime": { + "lib/netstandard2.0/Microsoft.Azure.PowerShell.Common.Share.dll": { + "assemblyVersion": "1.0.0.0", + "fileVersion": "1.3.57.0" + } + } + }, + "Microsoft.Azure.PowerShell.Storage/1.3.57-preview": { + "dependencies": { + "Microsoft.Azure.PowerShell.Authentication.Abstractions": "1.3.57-preview", + "Microsoft.Rest.ClientRuntime": "2.3.23" + }, + "runtime": { + "lib/netstandard2.0/Microsoft.Azure.PowerShell.Storage.dll": { + "assemblyVersion": "1.0.0.0", + "fileVersion": "1.3.57.0" + } + } + }, + "Microsoft.Azure.PowerShell.Strategies/1.3.57-preview": { + "dependencies": { + "Microsoft.Rest.ClientRuntime": "2.3.23", + "Microsoft.Rest.ClientRuntime.Azure": "3.3.19", + "Newtonsoft.Json": "10.0.3" + }, + "runtime": { + "lib/netstandard2.0/Microsoft.Azure.PowerShell.Strategies.dll": { + "assemblyVersion": "1.0.0.0", + "fileVersion": "1.3.57.0" + } + } + }, + "Microsoft.Bcl.AsyncInterfaces/1.1.1": { + "dependencies": { + "System.Threading.Tasks.Extensions": "4.5.4" + }, + "runtime": { + "lib/netstandard2.0/Microsoft.Bcl.AsyncInterfaces.dll": { + "assemblyVersion": "1.0.0.0", + "fileVersion": "4.700.20.21406" + } + } + }, + "Microsoft.CSharp/4.5.0": { + "runtime": { + "lib/netstandard2.0/Microsoft.CSharp.dll": { + "assemblyVersion": "4.0.4.0", + "fileVersion": "4.6.26515.6" + } + } + }, + "Microsoft.Identity.Client/4.30.1": { + "dependencies": { + "Microsoft.CSharp": "4.5.0", + "NETStandard.Library": "2.0.3", + "System.ComponentModel.TypeConverter": "4.3.0", + "System.Diagnostics.Process": "4.3.0", + "System.Dynamic.Runtime": "4.3.0", + "System.Private.Uri": "4.3.2", + "System.Runtime.Serialization.Formatters": "4.3.0", + "System.Runtime.Serialization.Json": "4.3.0", + "System.Runtime.Serialization.Primitives": "4.3.0", + "System.Security.Cryptography.X509Certificates": "4.3.0", + "System.Security.SecureString": "4.3.0", + "System.Xml.XDocument": "4.3.0", + "System.Xml.XmlDocument": "4.3.0" + }, + "runtime": { + "lib/netstandard1.3/Microsoft.Identity.Client.dll": { + "assemblyVersion": "4.30.1.0", + "fileVersion": "4.30.1.0" + } + } + }, + "Microsoft.Identity.Client.Extensions.Msal/2.18.4": { + "dependencies": { + "Microsoft.Identity.Client": "4.30.1", + "System.Security.Cryptography.ProtectedData": "4.5.0" + }, + "runtime": { + "lib/netstandard2.0/Microsoft.Identity.Client.Extensions.Msal.dll": { + "assemblyVersion": "2.18.4.0", + "fileVersion": "2.18.4.0" + } + } + }, + "Microsoft.NETCore.Platforms/1.1.1": {}, + "Microsoft.NETCore.Targets/1.1.3": {}, + "Microsoft.Rest.ClientRuntime/2.3.23": { + "dependencies": { + "Newtonsoft.Json": "10.0.3" + }, + "runtime": { + "lib/netstandard2.0/Microsoft.Rest.ClientRuntime.dll": { + "assemblyVersion": "2.0.0.0", + "fileVersion": "2.3.23.0" + } + } + }, + "Microsoft.Rest.ClientRuntime.Azure/3.3.19": { + "dependencies": { + "Microsoft.Rest.ClientRuntime": "2.3.23", + "Newtonsoft.Json": "10.0.3" + }, + "runtime": { + "lib/netstandard2.0/Microsoft.Rest.ClientRuntime.Azure.dll": { + "assemblyVersion": "3.0.0.0", + "fileVersion": "3.3.18.0" + } + } + }, + "Microsoft.Win32.Primitives/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.1", + "Microsoft.NETCore.Targets": "1.1.3", + "System.Runtime": "4.3.0" + } + }, + "Microsoft.Win32.Registry/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.1", + "System.Collections": "4.3.0", + "System.Globalization": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Extensions": "4.3.0", + "System.Runtime.Handles": "4.3.0", + "System.Runtime.InteropServices": "4.3.0" + } + }, + "NETStandard.Library/2.0.3": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.1" + } + }, + "Newtonsoft.Json/10.0.3": { + "dependencies": { + "Microsoft.CSharp": "4.5.0", + "NETStandard.Library": "2.0.3", + "System.ComponentModel.TypeConverter": "4.3.0", + "System.Runtime.Serialization.Formatters": "4.3.0", + "System.Runtime.Serialization.Primitives": "4.3.0", + "System.Xml.XmlDocument": "4.3.0" + }, + "runtime": { + "lib/netstandard1.3/Newtonsoft.Json.dll": { + "assemblyVersion": "10.0.0.0", + "fileVersion": "10.0.3.21018" + } + } + }, + "PowerShellStandard.Library/5.1.0": {}, + "runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": {}, + "runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": {}, + "runtime.fedora.24-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": {}, + "runtime.native.System/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.1", + "Microsoft.NETCore.Targets": "1.1.3" + } + }, + "runtime.native.System.Net.Http/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.1", + "Microsoft.NETCore.Targets": "1.1.3" + } + }, + "runtime.native.System.Security.Cryptography.Apple/4.3.0": { + "dependencies": { + "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.Apple": "4.3.0" + } + }, + "runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { + "dependencies": { + "runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", + "runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", + "runtime.fedora.24-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", + "runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", + "runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", + "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", + "runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", + "runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", + "runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", + "runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0" + } + }, + "runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": {}, + "runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": {}, + "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.Apple/4.3.0": {}, + "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": {}, + "runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": {}, + "runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": {}, + "runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": {}, + "runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": {}, + "System.Buffers/4.5.1": { + "runtime": { + "lib/netstandard2.0/System.Buffers.dll": { + "assemblyVersion": "4.0.3.0", + "fileVersion": "4.6.28619.1" + } + } + }, + "System.Collections/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.1", + "Microsoft.NETCore.Targets": "1.1.3", + "System.Runtime": "4.3.0" + } + }, + "System.Collections.Concurrent/4.3.0": { + "dependencies": { + "System.Collections": "4.3.0", + "System.Diagnostics.Debug": "4.3.0", + "System.Diagnostics.Tracing": "4.3.0", + "System.Globalization": "4.3.0", + "System.Reflection": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Extensions": "4.3.0", + "System.Threading": "4.3.0", + "System.Threading.Tasks": "4.3.0" + }, + "runtime": { + "lib/netstandard1.3/System.Collections.Concurrent.dll": { + "assemblyVersion": "4.0.13.0", + "fileVersion": "4.6.24705.1" + } + } + }, + "System.Collections.NonGeneric/4.3.0": { + "dependencies": { + "System.Diagnostics.Debug": "4.3.0", + "System.Globalization": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Extensions": "4.3.0", + "System.Threading": "4.3.0" + }, + "runtime": { + "lib/netstandard1.3/System.Collections.NonGeneric.dll": { + "assemblyVersion": "4.0.2.0", + "fileVersion": "4.6.24705.1" + } + } + }, + "System.Collections.Specialized/4.3.0": { + "dependencies": { + "System.Collections.NonGeneric": "4.3.0", + "System.Globalization": "4.3.0", + "System.Globalization.Extensions": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Extensions": "4.3.0", + "System.Threading": "4.3.0" + }, + "runtime": { + "lib/netstandard1.3/System.Collections.Specialized.dll": { + "assemblyVersion": "4.0.2.0", + "fileVersion": "4.6.24705.1" + } + } + }, + "System.ComponentModel/4.3.0": { + "dependencies": { + "System.Runtime": "4.3.0" + }, + "runtime": { + "lib/netstandard1.3/System.ComponentModel.dll": { + "assemblyVersion": "4.0.2.0", + "fileVersion": "4.6.24705.1" + } + } + }, + "System.ComponentModel.Primitives/4.3.0": { + "dependencies": { + "System.ComponentModel": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0" + }, + "runtime": { + "lib/netstandard1.0/System.ComponentModel.Primitives.dll": { + "assemblyVersion": "4.1.1.0", + "fileVersion": "4.6.24705.1" + } + } + }, + "System.ComponentModel.TypeConverter/4.3.0": { + "dependencies": { + "System.Collections": "4.3.0", + "System.Collections.NonGeneric": "4.3.0", + "System.Collections.Specialized": "4.3.0", + "System.ComponentModel": "4.3.0", + "System.ComponentModel.Primitives": "4.3.0", + "System.Globalization": "4.3.0", + "System.Linq": "4.3.0", + "System.Reflection": "4.3.0", + "System.Reflection.Extensions": "4.3.0", + "System.Reflection.Primitives": "4.3.0", + "System.Reflection.TypeExtensions": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Extensions": "4.3.0", + "System.Threading": "4.3.0" + }, + "runtime": { + "lib/netstandard1.5/System.ComponentModel.TypeConverter.dll": { + "assemblyVersion": "4.1.1.0", + "fileVersion": "4.6.24705.1" + } + } + }, + "System.Diagnostics.Debug/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.1", + "Microsoft.NETCore.Targets": "1.1.3", + "System.Runtime": "4.3.0" + } + }, + "System.Diagnostics.DiagnosticSource/4.6.0": { + "dependencies": { + "System.Memory": "4.5.4" + }, + "runtime": { + "lib/netstandard1.3/System.Diagnostics.DiagnosticSource.dll": { + "assemblyVersion": "4.0.4.0", + "fileVersion": "4.700.19.46214" + } + } + }, + "System.Diagnostics.Process/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.1", + "Microsoft.Win32.Primitives": "4.3.0", + "Microsoft.Win32.Registry": "4.3.0", + "System.Collections": "4.3.0", + "System.Diagnostics.Debug": "4.3.0", + "System.Globalization": "4.3.0", + "System.IO": "4.3.0", + "System.IO.FileSystem": "4.3.0", + "System.IO.FileSystem.Primitives": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Extensions": "4.3.0", + "System.Runtime.Handles": "4.3.0", + "System.Runtime.InteropServices": "4.3.0", + "System.Text.Encoding": "4.3.0", + "System.Text.Encoding.Extensions": "4.3.0", + "System.Threading": "4.3.0", + "System.Threading.Tasks": "4.3.0", + "System.Threading.Thread": "4.3.0", + "System.Threading.ThreadPool": "4.3.0", + "runtime.native.System": "4.3.0" + } + }, + "System.Diagnostics.Tools/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.1", + "Microsoft.NETCore.Targets": "1.1.3", + "System.Runtime": "4.3.0" + } + }, + "System.Diagnostics.Tracing/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.1", + "Microsoft.NETCore.Targets": "1.1.3", + "System.Runtime": "4.3.0" + } + }, + "System.Dynamic.Runtime/4.3.0": { + "dependencies": { + "System.Collections": "4.3.0", + "System.Diagnostics.Debug": "4.3.0", + "System.Linq": "4.3.0", + "System.Linq.Expressions": "4.3.0", + "System.ObjectModel": "4.3.0", + "System.Reflection": "4.3.0", + "System.Reflection.Emit": "4.3.0", + "System.Reflection.Emit.ILGeneration": "4.3.0", + "System.Reflection.Primitives": "4.3.0", + "System.Reflection.TypeExtensions": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Extensions": "4.3.0", + "System.Threading": "4.3.0" + }, + "runtime": { + "lib/netstandard1.3/System.Dynamic.Runtime.dll": { + "assemblyVersion": "4.0.12.0", + "fileVersion": "4.6.24705.1" + } + } + }, + "System.Globalization/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.1", + "Microsoft.NETCore.Targets": "1.1.3", + "System.Runtime": "4.3.0" + } + }, + "System.Globalization.Calendars/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.1", + "Microsoft.NETCore.Targets": "1.1.3", + "System.Globalization": "4.3.0", + "System.Runtime": "4.3.0" + } + }, + "System.Globalization.Extensions/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.1", + "System.Globalization": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Extensions": "4.3.0", + "System.Runtime.InteropServices": "4.3.0" + } + }, + "System.IO/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.1", + "Microsoft.NETCore.Targets": "1.1.3", + "System.Runtime": "4.3.0", + "System.Text.Encoding": "4.3.0", + "System.Threading.Tasks": "4.3.0" + } + }, + "System.IO.FileSystem/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.1", + "Microsoft.NETCore.Targets": "1.1.3", + "System.IO": "4.3.0", + "System.IO.FileSystem.Primitives": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Handles": "4.3.0", + "System.Text.Encoding": "4.3.0", + "System.Threading.Tasks": "4.3.0" + } + }, + "System.IO.FileSystem.Primitives/4.3.0": { + "dependencies": { + "System.Runtime": "4.3.0" + }, + "runtime": { + "lib/netstandard1.3/System.IO.FileSystem.Primitives.dll": { + "assemblyVersion": "4.0.2.0", + "fileVersion": "4.6.24705.1" + } + } + }, + "System.Linq/4.3.0": { + "dependencies": { + "System.Collections": "4.3.0", + "System.Diagnostics.Debug": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Extensions": "4.3.0" + }, + "runtime": { + "lib/netstandard1.6/System.Linq.dll": { + "assemblyVersion": "4.1.1.0", + "fileVersion": "4.6.24705.1" + } + } + }, + "System.Linq.Expressions/4.3.0": { + "dependencies": { + "System.Collections": "4.3.0", + "System.Diagnostics.Debug": "4.3.0", + "System.Globalization": "4.3.0", + "System.IO": "4.3.0", + "System.Linq": "4.3.0", + "System.ObjectModel": "4.3.0", + "System.Reflection": "4.3.0", + "System.Reflection.Emit": "4.3.0", + "System.Reflection.Emit.ILGeneration": "4.3.0", + "System.Reflection.Emit.Lightweight": "4.3.0", + "System.Reflection.Extensions": "4.3.0", + "System.Reflection.Primitives": "4.3.0", + "System.Reflection.TypeExtensions": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Extensions": "4.3.0", + "System.Threading": "4.3.0" + }, + "runtime": { + "lib/netstandard1.6/System.Linq.Expressions.dll": { + "assemblyVersion": "4.1.1.0", + "fileVersion": "4.6.24705.1" + } + } + }, + "System.Memory/4.5.4": { + "dependencies": { + "System.Buffers": "4.5.1", + "System.Numerics.Vectors": "4.5.0", + "System.Runtime.CompilerServices.Unsafe": "4.7.1" + }, + "runtime": { + "lib/netstandard2.0/System.Memory.dll": { + "assemblyVersion": "4.0.1.1", + "fileVersion": "4.6.28619.1" + } + } + }, + "System.Memory.Data/1.0.2": { + "dependencies": { + "System.Text.Encodings.Web": "4.7.2", + "System.Text.Json": "4.7.2" + }, + "runtime": { + "lib/netstandard2.0/System.Memory.Data.dll": { + "assemblyVersion": "1.0.2.0", + "fileVersion": "1.0.221.20802" + } + } + }, + "System.Numerics.Vectors/4.5.0": { + "runtime": { + "lib/netstandard2.0/System.Numerics.Vectors.dll": { + "assemblyVersion": "4.1.4.0", + "fileVersion": "4.6.26515.6" + } + } + }, + "System.ObjectModel/4.3.0": { + "dependencies": { + "System.Collections": "4.3.0", + "System.Diagnostics.Debug": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Threading": "4.3.0" + }, + "runtime": { + "lib/netstandard1.3/System.ObjectModel.dll": { + "assemblyVersion": "4.0.13.0", + "fileVersion": "4.6.24705.1" + } + } + }, + "System.Private.DataContractSerialization/4.3.0": { + "dependencies": { + "System.Collections": "4.3.0", + "System.Collections.Concurrent": "4.3.0", + "System.Diagnostics.Debug": "4.3.0", + "System.Globalization": "4.3.0", + "System.IO": "4.3.0", + "System.Linq": "4.3.0", + "System.Reflection": "4.3.0", + "System.Reflection.Emit.ILGeneration": "4.3.0", + "System.Reflection.Emit.Lightweight": "4.3.0", + "System.Reflection.Extensions": "4.3.0", + "System.Reflection.Primitives": "4.3.0", + "System.Reflection.TypeExtensions": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Extensions": "4.3.0", + "System.Runtime.Serialization.Primitives": "4.3.0", + "System.Text.Encoding": "4.3.0", + "System.Text.Encoding.Extensions": "4.3.0", + "System.Text.RegularExpressions": "4.3.0", + "System.Threading": "4.3.0", + "System.Threading.Tasks": "4.3.0", + "System.Xml.ReaderWriter": "4.3.0", + "System.Xml.XDocument": "4.3.0", + "System.Xml.XmlDocument": "4.3.0", + "System.Xml.XmlSerializer": "4.3.0" + }, + "runtime": { + "lib/netstandard1.3/System.Private.DataContractSerialization.dll": { + "assemblyVersion": "4.1.2.0", + "fileVersion": "4.6.24705.1" + } + } + }, + "System.Private.Uri/4.3.2": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.1", + "Microsoft.NETCore.Targets": "1.1.3" + } + }, + "System.Reflection/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.1", + "Microsoft.NETCore.Targets": "1.1.3", + "System.IO": "4.3.0", + "System.Reflection.Primitives": "4.3.0", + "System.Runtime": "4.3.0" + } + }, + "System.Reflection.Emit/4.3.0": { + "dependencies": { + "System.IO": "4.3.0", + "System.Reflection": "4.3.0", + "System.Reflection.Emit.ILGeneration": "4.3.0", + "System.Reflection.Primitives": "4.3.0", + "System.Runtime": "4.3.0" + }, + "runtime": { + "lib/netstandard1.3/System.Reflection.Emit.dll": { + "assemblyVersion": "4.0.2.0", + "fileVersion": "4.6.24705.1" + } + } + }, + "System.Reflection.Emit.ILGeneration/4.3.0": { + "dependencies": { + "System.Reflection": "4.3.0", + "System.Reflection.Primitives": "4.3.0", + "System.Runtime": "4.3.0" + }, + "runtime": { + "lib/netstandard1.3/System.Reflection.Emit.ILGeneration.dll": { + "assemblyVersion": "4.0.2.0", + "fileVersion": "4.6.24705.1" + } + } + }, + "System.Reflection.Emit.Lightweight/4.3.0": { + "dependencies": { + "System.Reflection": "4.3.0", + "System.Reflection.Emit.ILGeneration": "4.3.0", + "System.Reflection.Primitives": "4.3.0", + "System.Runtime": "4.3.0" + }, + "runtime": { + "lib/netstandard1.3/System.Reflection.Emit.Lightweight.dll": { + "assemblyVersion": "4.0.2.0", + "fileVersion": "4.6.24705.1" + } + } + }, + "System.Reflection.Extensions/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.1", + "Microsoft.NETCore.Targets": "1.1.3", + "System.Reflection": "4.3.0", + "System.Runtime": "4.3.0" + } + }, + "System.Reflection.Primitives/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.1", + "Microsoft.NETCore.Targets": "1.1.3", + "System.Runtime": "4.3.0" + } + }, + "System.Reflection.TypeExtensions/4.3.0": { + "dependencies": { + "System.Reflection": "4.3.0", + "System.Runtime": "4.3.0" + }, + "runtime": { + "lib/netstandard1.5/System.Reflection.TypeExtensions.dll": { + "assemblyVersion": "4.1.1.0", + "fileVersion": "4.6.24705.1" + } + } + }, + "System.Resources.ResourceManager/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.1", + "Microsoft.NETCore.Targets": "1.1.3", + "System.Globalization": "4.3.0", + "System.Reflection": "4.3.0", + "System.Runtime": "4.3.0" + } + }, + "System.Runtime/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.1", + "Microsoft.NETCore.Targets": "1.1.3" + } + }, + "System.Runtime.CompilerServices.Unsafe/4.7.1": { + "runtime": { + "lib/netstandard2.0/System.Runtime.CompilerServices.Unsafe.dll": { + "assemblyVersion": "4.0.6.0", + "fileVersion": "4.700.20.12001" + } + } + }, + "System.Runtime.Extensions/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.1", + "Microsoft.NETCore.Targets": "1.1.3", + "System.Runtime": "4.3.0" + } + }, + "System.Runtime.Handles/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.1", + "Microsoft.NETCore.Targets": "1.1.3", + "System.Runtime": "4.3.0" + } + }, + "System.Runtime.InteropServices/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.1", + "Microsoft.NETCore.Targets": "1.1.3", + "System.Reflection": "4.3.0", + "System.Reflection.Primitives": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Handles": "4.3.0" + } + }, + "System.Runtime.Numerics/4.3.0": { + "dependencies": { + "System.Globalization": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Extensions": "4.3.0" + }, + "runtime": { + "lib/netstandard1.3/System.Runtime.Numerics.dll": { + "assemblyVersion": "4.0.2.0", + "fileVersion": "4.6.24705.1" + } + } + }, + "System.Runtime.Serialization.Formatters/4.3.0": { + "dependencies": { + "System.Collections": "4.3.0", + "System.Reflection": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Serialization.Primitives": "4.3.0" + }, + "runtime": { + "lib/netstandard1.4/System.Runtime.Serialization.Formatters.dll": { + "assemblyVersion": "4.0.1.0", + "fileVersion": "4.6.24705.1" + } + } + }, + "System.Runtime.Serialization.Json/4.3.0": { + "dependencies": { + "System.IO": "4.3.0", + "System.Private.DataContractSerialization": "4.3.0", + "System.Runtime": "4.3.0" + }, + "runtime": { + "lib/netstandard1.3/System.Runtime.Serialization.Json.dll": { + "assemblyVersion": "4.0.3.0", + "fileVersion": "4.6.24705.1" + } + } + }, + "System.Runtime.Serialization.Primitives/4.3.0": { + "dependencies": { + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0" + }, + "runtime": { + "lib/netstandard1.3/System.Runtime.Serialization.Primitives.dll": { + "assemblyVersion": "4.1.2.0", + "fileVersion": "4.6.24705.1" + } + } + }, + "System.Security.AccessControl/4.5.0": { + "dependencies": { + "System.Security.Principal.Windows": "4.5.0" + }, + "runtime": { + "lib/netstandard2.0/System.Security.AccessControl.dll": { + "assemblyVersion": "4.1.1.0", + "fileVersion": "4.6.26515.6" + } + } + }, + "System.Security.Cryptography.Algorithms/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.1", + "System.Collections": "4.3.0", + "System.IO": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Extensions": "4.3.0", + "System.Runtime.Handles": "4.3.0", + "System.Runtime.InteropServices": "4.3.0", + "System.Runtime.Numerics": "4.3.0", + "System.Security.Cryptography.Encoding": "4.3.0", + "System.Security.Cryptography.Primitives": "4.3.0", + "System.Text.Encoding": "4.3.0", + "runtime.native.System.Security.Cryptography.Apple": "4.3.0", + "runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0" + } + }, + "System.Security.Cryptography.Cng/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.1", + "System.IO": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Extensions": "4.3.0", + "System.Runtime.Handles": "4.3.0", + "System.Runtime.InteropServices": "4.3.0", + "System.Security.Cryptography.Algorithms": "4.3.0", + "System.Security.Cryptography.Encoding": "4.3.0", + "System.Security.Cryptography.Primitives": "4.3.0", + "System.Text.Encoding": "4.3.0" + } + }, + "System.Security.Cryptography.Csp/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.1", + "System.IO": "4.3.0", + "System.Reflection": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Extensions": "4.3.0", + "System.Runtime.Handles": "4.3.0", + "System.Runtime.InteropServices": "4.3.0", + "System.Security.Cryptography.Algorithms": "4.3.0", + "System.Security.Cryptography.Encoding": "4.3.0", + "System.Security.Cryptography.Primitives": "4.3.0", + "System.Text.Encoding": "4.3.0", + "System.Threading": "4.3.0" + } + }, + "System.Security.Cryptography.Encoding/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.1", + "System.Collections": "4.3.0", + "System.Collections.Concurrent": "4.3.0", + "System.Linq": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Extensions": "4.3.0", + "System.Runtime.Handles": "4.3.0", + "System.Runtime.InteropServices": "4.3.0", + "System.Security.Cryptography.Primitives": "4.3.0", + "System.Text.Encoding": "4.3.0", + "runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0" + } + }, + "System.Security.Cryptography.OpenSsl/4.3.0": { + "dependencies": { + "System.Collections": "4.3.0", + "System.IO": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Extensions": "4.3.0", + "System.Runtime.Handles": "4.3.0", + "System.Runtime.InteropServices": "4.3.0", + "System.Runtime.Numerics": "4.3.0", + "System.Security.Cryptography.Algorithms": "4.3.0", + "System.Security.Cryptography.Encoding": "4.3.0", + "System.Security.Cryptography.Primitives": "4.3.0", + "System.Text.Encoding": "4.3.0", + "runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0" + }, + "runtime": { + "lib/netstandard1.6/System.Security.Cryptography.OpenSsl.dll": { + "assemblyVersion": "4.0.0.0", + "fileVersion": "1.0.24212.1" + } + } + }, + "System.Security.Cryptography.Primitives/4.3.0": { + "dependencies": { + "System.Diagnostics.Debug": "4.3.0", + "System.Globalization": "4.3.0", + "System.IO": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Threading": "4.3.0", + "System.Threading.Tasks": "4.3.0" + }, + "runtime": { + "lib/netstandard1.3/System.Security.Cryptography.Primitives.dll": { + "assemblyVersion": "4.0.1.0", + "fileVersion": "4.6.24705.1" + } + } + }, + "System.Security.Cryptography.ProtectedData/4.5.0": { + "dependencies": { + "System.Memory": "4.5.4" + }, + "runtime": { + "lib/netstandard2.0/System.Security.Cryptography.ProtectedData.dll": { + "assemblyVersion": "4.0.3.0", + "fileVersion": "4.6.26515.6" + } + } + }, + "System.Security.Cryptography.X509Certificates/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.1", + "System.Collections": "4.3.0", + "System.Diagnostics.Debug": "4.3.0", + "System.Globalization": "4.3.0", + "System.Globalization.Calendars": "4.3.0", + "System.IO": "4.3.0", + "System.IO.FileSystem": "4.3.0", + "System.IO.FileSystem.Primitives": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Extensions": "4.3.0", + "System.Runtime.Handles": "4.3.0", + "System.Runtime.InteropServices": "4.3.0", + "System.Runtime.Numerics": "4.3.0", + "System.Security.Cryptography.Algorithms": "4.3.0", + "System.Security.Cryptography.Cng": "4.3.0", + "System.Security.Cryptography.Csp": "4.3.0", + "System.Security.Cryptography.Encoding": "4.3.0", + "System.Security.Cryptography.OpenSsl": "4.3.0", + "System.Security.Cryptography.Primitives": "4.3.0", + "System.Text.Encoding": "4.3.0", + "System.Threading": "4.3.0", + "runtime.native.System": "4.3.0", + "runtime.native.System.Net.Http": "4.3.0", + "runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0" + } + }, + "System.Security.Permissions/4.5.0": { + "dependencies": { + "System.Security.AccessControl": "4.5.0" + }, + "runtime": { + "lib/netstandard2.0/System.Security.Permissions.dll": { + "assemblyVersion": "4.0.1.0", + "fileVersion": "4.6.26515.6" + } + } + }, + "System.Security.Principal.Windows/4.5.0": { + "runtime": { + "lib/netstandard2.0/System.Security.Principal.Windows.dll": { + "assemblyVersion": "4.1.1.0", + "fileVersion": "4.6.26515.6" + } + } + }, + "System.Security.SecureString/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.1", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Handles": "4.3.0", + "System.Runtime.InteropServices": "4.3.0", + "System.Security.Cryptography.Primitives": "4.3.0", + "System.Text.Encoding": "4.3.0", + "System.Threading": "4.3.0" + } + }, + "System.Text.Encoding/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.1", + "Microsoft.NETCore.Targets": "1.1.3", + "System.Runtime": "4.3.0" + } + }, + "System.Text.Encoding.Extensions/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.1", + "Microsoft.NETCore.Targets": "1.1.3", + "System.Runtime": "4.3.0", + "System.Text.Encoding": "4.3.0" + } + }, + "System.Text.Encodings.Web/4.7.2": { + "dependencies": { + "System.Buffers": "4.5.1", + "System.Memory": "4.5.4" + }, + "runtime": { + "lib/netstandard2.0/System.Text.Encodings.Web.dll": { + "assemblyVersion": "4.0.5.1", + "fileVersion": "4.700.21.11602" + } + } + }, + "System.Text.Json/4.7.2": { + "dependencies": { + "Microsoft.Bcl.AsyncInterfaces": "1.1.1", + "System.Buffers": "4.5.1", + "System.Memory": "4.5.4", + "System.Numerics.Vectors": "4.5.0", + "System.Runtime.CompilerServices.Unsafe": "4.7.1", + "System.Text.Encodings.Web": "4.7.2", + "System.Threading.Tasks.Extensions": "4.5.4" + }, + "runtime": { + "lib/netstandard2.0/System.Text.Json.dll": { + "assemblyVersion": "4.0.1.2", + "fileVersion": "4.700.20.21406" + } + } + }, + "System.Text.RegularExpressions/4.3.0": { + "dependencies": { + "System.Collections": "4.3.0", + "System.Globalization": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Extensions": "4.3.0", + "System.Threading": "4.3.0" + }, + "runtime": { + "lib/netstandard1.6/System.Text.RegularExpressions.dll": { + "assemblyVersion": "4.1.1.0", + "fileVersion": "4.6.24705.1" + } + } + }, + "System.Threading/4.3.0": { + "dependencies": { + "System.Runtime": "4.3.0", + "System.Threading.Tasks": "4.3.0" + }, + "runtime": { + "lib/netstandard1.3/System.Threading.dll": { + "assemblyVersion": "4.0.12.0", + "fileVersion": "4.6.24705.1" + } + } + }, + "System.Threading.Tasks/4.3.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.1", + "Microsoft.NETCore.Targets": "1.1.3", + "System.Runtime": "4.3.0" + } + }, + "System.Threading.Tasks.Extensions/4.5.4": { + "dependencies": { + "System.Runtime.CompilerServices.Unsafe": "4.7.1" + }, + "runtime": { + "lib/netstandard2.0/System.Threading.Tasks.Extensions.dll": { + "assemblyVersion": "4.2.0.1", + "fileVersion": "4.6.28619.1" + } + } + }, + "System.Threading.Thread/4.3.0": { + "dependencies": { + "System.Runtime": "4.3.0" + }, + "runtime": { + "lib/netstandard1.3/System.Threading.Thread.dll": { + "assemblyVersion": "4.0.1.0", + "fileVersion": "4.6.24705.1" + } + } + }, + "System.Threading.ThreadPool/4.3.0": { + "dependencies": { + "System.Runtime": "4.3.0", + "System.Runtime.Handles": "4.3.0" + }, + "runtime": { + "lib/netstandard1.3/System.Threading.ThreadPool.dll": { + "assemblyVersion": "4.0.11.0", + "fileVersion": "4.6.24705.1" + } + } + }, + "System.Xml.ReaderWriter/4.3.0": { + "dependencies": { + "System.Collections": "4.3.0", + "System.Diagnostics.Debug": "4.3.0", + "System.Globalization": "4.3.0", + "System.IO": "4.3.0", + "System.IO.FileSystem": "4.3.0", + "System.IO.FileSystem.Primitives": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Extensions": "4.3.0", + "System.Runtime.InteropServices": "4.3.0", + "System.Text.Encoding": "4.3.0", + "System.Text.Encoding.Extensions": "4.3.0", + "System.Text.RegularExpressions": "4.3.0", + "System.Threading.Tasks": "4.3.0", + "System.Threading.Tasks.Extensions": "4.5.4" + }, + "runtime": { + "lib/netstandard1.3/System.Xml.ReaderWriter.dll": { + "assemblyVersion": "4.1.0.0", + "fileVersion": "4.6.24705.1" + } + } + }, + "System.Xml.XDocument/4.3.0": { + "dependencies": { + "System.Collections": "4.3.0", + "System.Diagnostics.Debug": "4.3.0", + "System.Diagnostics.Tools": "4.3.0", + "System.Globalization": "4.3.0", + "System.IO": "4.3.0", + "System.Reflection": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Extensions": "4.3.0", + "System.Text.Encoding": "4.3.0", + "System.Threading": "4.3.0", + "System.Xml.ReaderWriter": "4.3.0" + }, + "runtime": { + "lib/netstandard1.3/System.Xml.XDocument.dll": { + "assemblyVersion": "4.0.12.0", + "fileVersion": "4.6.24705.1" + } + } + }, + "System.Xml.XmlDocument/4.3.0": { + "dependencies": { + "System.Collections": "4.3.0", + "System.Diagnostics.Debug": "4.3.0", + "System.Globalization": "4.3.0", + "System.IO": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Extensions": "4.3.0", + "System.Text.Encoding": "4.3.0", + "System.Threading": "4.3.0", + "System.Xml.ReaderWriter": "4.3.0" + }, + "runtime": { + "lib/netstandard1.3/System.Xml.XmlDocument.dll": { + "assemblyVersion": "4.0.2.0", + "fileVersion": "4.6.24705.1" + } + } + }, + "System.Xml.XmlSerializer/4.3.0": { + "dependencies": { + "System.Collections": "4.3.0", + "System.Globalization": "4.3.0", + "System.IO": "4.3.0", + "System.Linq": "4.3.0", + "System.Reflection": "4.3.0", + "System.Reflection.Emit": "4.3.0", + "System.Reflection.Emit.ILGeneration": "4.3.0", + "System.Reflection.Extensions": "4.3.0", + "System.Reflection.Primitives": "4.3.0", + "System.Reflection.TypeExtensions": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Extensions": "4.3.0", + "System.Text.RegularExpressions": "4.3.0", + "System.Threading": "4.3.0", + "System.Xml.ReaderWriter": "4.3.0", + "System.Xml.XmlDocument": "4.3.0" + }, + "runtime": { + "lib/netstandard1.3/System.Xml.XmlSerializer.dll": { + "assemblyVersion": "4.0.12.0", + "fileVersion": "4.6.24705.1" + } + } + }, + "Microsoft.Azure.PowerShell.Authentication/1.0.0": { + "dependencies": { + "Azure.Core": "1.22.0", + "Azure.Identity": "1.5.0", + "Hyak.Common": "1.2.2", + "Microsoft.ApplicationInsights": "2.12.0", + "Microsoft.Azure.Common": "2.2.1", + "Microsoft.Azure.PowerShell.Authentication.Abstractions": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Clients.Aks": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Clients.Authorization": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Clients.Compute": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Clients.Graph.Rbac": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Clients.KeyVault": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Clients.Monitor": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Clients.Network": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Clients.PolicyInsights": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Clients.ResourceManager": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Clients.Storage.Management": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Clients.Websites": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Common": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Common.Share": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Storage": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Strategies": "1.3.57-preview", + "Microsoft.Rest.ClientRuntime": "2.3.23", + "Microsoft.Rest.ClientRuntime.Azure": "3.3.19", + "Newtonsoft.Json": "10.0.3" + }, + "runtime": { + "Microsoft.Azure.PowerShell.Authentication.dll": {} + } + }, + "Microsoft.Azure.PowerShell.Authentication.ResourceManager/1.0.0": { + "dependencies": { + "Azure.Core": "1.22.0", + "Hyak.Common": "1.2.2", + "Microsoft.ApplicationInsights": "2.12.0", + "Microsoft.Azure.Common": "2.2.1", + "Microsoft.Azure.PowerShell.Authentication": "1.0.0", + "Microsoft.Azure.PowerShell.Authentication.Abstractions": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Clients.Aks": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Clients.Authorization": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Clients.Compute": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Clients.Graph.Rbac": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Clients.KeyVault": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Clients.Monitor": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Clients.Network": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Clients.PolicyInsights": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Clients.ResourceManager": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Clients.Storage.Management": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Clients.Websites": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Common": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Common.Share": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Storage": "1.3.57-preview", + "Microsoft.Azure.PowerShell.Strategies": "1.3.57-preview", + "Microsoft.Rest.ClientRuntime": "2.3.23", + "Microsoft.Rest.ClientRuntime.Azure": "3.3.19", + "Newtonsoft.Json": "10.0.3" + }, + "runtime": { + "Microsoft.Azure.PowerShell.Authentication.ResourceManager.dll": {} + } + }, + "Microsoft.Azure.PowerShell.Authenticators/1.0.0": { + "dependencies": { + "Azure.Identity": "1.5.0", + "Microsoft.Azure.PowerShell.Authentication": "1.0.0" + }, + "runtime": { + "Microsoft.Azure.PowerShell.Authenticators.dll": {} + } + } + } + }, + "libraries": { + "Microsoft.Azure.PowerShell.Cmdlets.Accounts/1.0.0": { + "type": "project", + "serviceable": false, + "sha512": "" + }, + "Azure.Core/1.22.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-ze/xRCHSSDe5TIk5vBDbVrauW1EN7UIbnBvIBfMH8KSt/I9+/7yPAjTBDgNBk0IwG6WBV+BBHp4IUtS/PGAQwQ==", + "path": "azure.core/1.22.0", + "hashPath": "azure.core.1.22.0.nupkg.sha512" + }, + "Azure.Identity/1.5.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-VfF88dqrgKXZNOS/y4XrX/jmIfP3pkY+hBUzBNpoKml1nR+QshX6XlXWyToLtWV80TDQ1CmUVCJksktDg5+j1w==", + "path": "azure.identity/1.5.0", + "hashPath": "azure.identity.1.5.0.nupkg.sha512" + }, + "Hyak.Common/1.2.2": { + "type": "package", + "serviceable": true, + "sha512": "sha512-uZpnFn48nSQwHcO0/GSBZ7ExaO0sTXKv8KariXXEWLaB4Q3AeQoprYG4WpKsCT0ByW3YffETivgc5rcH5RRDvQ==", + "path": "hyak.common/1.2.2", + "hashPath": "hyak.common.1.2.2.nupkg.sha512" + }, + "Microsoft.ApplicationInsights/2.12.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-4vZcVaxywAzfLm5mAc2/llaZQTzbCqu9KirxxI/t49AkZH5Qxf7JxuAMUuv2/6JEdOOkGDzpvdrrIlf6LkFGcg==", + "path": "microsoft.applicationinsights/2.12.0", + "hashPath": "microsoft.applicationinsights.2.12.0.nupkg.sha512" + }, + "Microsoft.Azure.Common/2.2.1": { + "type": "package", + "serviceable": true, + "sha512": "sha512-abzRooh4ACKjzAKxRB6r+SHKW3d+IrLcgtVG81D+3kQU/OMjAZS1oDp9CDalhSbmxa84u0MHM5N+AKeTtKPoiw==", + "path": "microsoft.azure.common/2.2.1", + "hashPath": "microsoft.azure.common.2.2.1.nupkg.sha512" + }, + "Microsoft.Azure.PowerShell.Authentication.Abstractions/1.3.57-preview": { + "type": "package", + "serviceable": true, + "sha512": "sha512-bKDPidNeqBpTDikPnIuoMoGd26pD2PNE41cut0ASwL5exJwLNggYO55U+f/cJkgjCUMR8i5nqnlfpGHSS1I0vw==", + "path": "microsoft.azure.powershell.authentication.abstractions/1.3.57-preview", + "hashPath": "microsoft.azure.powershell.authentication.abstractions.1.3.57-preview.nupkg.sha512" + }, + "Microsoft.Azure.PowerShell.Clients.Aks/1.3.57-preview": { + "type": "package", + "serviceable": true, + "sha512": "sha512-sUGkvOvpqlEK5zdZ7HWaou3GY5bnlNrE0LuZ137+TsNfgx2E3+0Ika3a02i/9+niDDf60xj4LaNOYDSuK5zdJA==", + "path": "microsoft.azure.powershell.clients.aks/1.3.57-preview", + "hashPath": "microsoft.azure.powershell.clients.aks.1.3.57-preview.nupkg.sha512" + }, + "Microsoft.Azure.PowerShell.Clients.Authorization/1.3.57-preview": { + "type": "package", + "serviceable": true, + "sha512": "sha512-Q760F40/qfas2Al+GQhhE4gJt768pQPxlCjqrjjkukgVsq+X/M8IqpCeBzbRTiiyerhcjJoyNxqlGuZpUhqGxw==", + "path": "microsoft.azure.powershell.clients.authorization/1.3.57-preview", + "hashPath": "microsoft.azure.powershell.clients.authorization.1.3.57-preview.nupkg.sha512" + }, + "Microsoft.Azure.PowerShell.Clients.Compute/1.3.57-preview": { + "type": "package", + "serviceable": true, + "sha512": "sha512-1fcsBdYMmEJPMPN8EAgJkaJ2WxxTKH3VcLECYdL2cfg2bgN8CKbbjSvarrXEezhyduE+LdYnL0e8Pigsnaj55Q==", + "path": "microsoft.azure.powershell.clients.compute/1.3.57-preview", + "hashPath": "microsoft.azure.powershell.clients.compute.1.3.57-preview.nupkg.sha512" + }, + "Microsoft.Azure.PowerShell.Clients.Graph.Rbac/1.3.57-preview": { + "type": "package", + "serviceable": true, + "sha512": "sha512-BIMthJ1x2vQAN3iWChnNj8BfgrXvKXn+n06E0/h2MNurMXbAOn5eiPIfE8bnj2BO99uSh1ns09yEgOTPJIvZBQ==", + "path": "microsoft.azure.powershell.clients.graph.rbac/1.3.57-preview", + "hashPath": "microsoft.azure.powershell.clients.graph.rbac.1.3.57-preview.nupkg.sha512" + }, + "Microsoft.Azure.PowerShell.Clients.KeyVault/1.3.57-preview": { + "type": "package", + "serviceable": true, + "sha512": "sha512-MfvwM8ABj/EswmYu0Bf/8kyAO6kUv2zYSihVn384SVmypomVKUu69GN0VXKbmGaovPI8v3H41Ldp7DqbPRun5A==", + "path": "microsoft.azure.powershell.clients.keyvault/1.3.57-preview", + "hashPath": "microsoft.azure.powershell.clients.keyvault.1.3.57-preview.nupkg.sha512" + }, + "Microsoft.Azure.PowerShell.Clients.Monitor/1.3.57-preview": { + "type": "package", + "serviceable": true, + "sha512": "sha512-UyCKG5BWVjYFRtH2JNx6f4KdccaSqww2y0OE2PYgib8VhLqkoPr/BQg6vKzaGsghLIerZ/egQ7ntPPw3PCtS3w==", + "path": "microsoft.azure.powershell.clients.monitor/1.3.57-preview", + "hashPath": "microsoft.azure.powershell.clients.monitor.1.3.57-preview.nupkg.sha512" + }, + "Microsoft.Azure.PowerShell.Clients.Network/1.3.57-preview": { + "type": "package", + "serviceable": true, + "sha512": "sha512-YAAHxw+zzvkGNWAi668NSoTR+V/7vf+gRhu1oFa1O1/f2NGpz5XuqPrQyAPrri64hKqB/k3OMrM7sjlIv16dAg==", + "path": "microsoft.azure.powershell.clients.network/1.3.57-preview", + "hashPath": "microsoft.azure.powershell.clients.network.1.3.57-preview.nupkg.sha512" + }, + "Microsoft.Azure.PowerShell.Clients.PolicyInsights/1.3.57-preview": { + "type": "package", + "serviceable": true, + "sha512": "sha512-urRIwRVzzOwpk8HhKq/b785DiL/arnmGUHbN4HvRN6ZsBkE1PU431YwgUlofb9pfB3buLcl0XJFRPLBJ0yZJUw==", + "path": "microsoft.azure.powershell.clients.policyinsights/1.3.57-preview", + "hashPath": "microsoft.azure.powershell.clients.policyinsights.1.3.57-preview.nupkg.sha512" + }, + "Microsoft.Azure.PowerShell.Clients.ResourceManager/1.3.57-preview": { + "type": "package", + "serviceable": true, + "sha512": "sha512-juWnd63Z2Sp+6bvtOPOF0Gj1v2AfpxXcuyodd9+U7euBro2G7Yfo2UHmHo/uaYyQUbM3HaXJPvse7BLDKjhe6w==", + "path": "microsoft.azure.powershell.clients.resourcemanager/1.3.57-preview", + "hashPath": "microsoft.azure.powershell.clients.resourcemanager.1.3.57-preview.nupkg.sha512" + }, + "Microsoft.Azure.PowerShell.Clients.Storage.Management/1.3.57-preview": { + "type": "package", + "serviceable": true, + "sha512": "sha512-HPpTWIlN+5ALqJssL7+6BD/vYrWi3eWKQ3QpWYjCFk5c9HVLTNpP+M2dq9jbsxLsZj+5Pt6gC4FIS22Q13Uhag==", + "path": "microsoft.azure.powershell.clients.storage.management/1.3.57-preview", + "hashPath": "microsoft.azure.powershell.clients.storage.management.1.3.57-preview.nupkg.sha512" + }, + "Microsoft.Azure.PowerShell.Clients.Websites/1.3.57-preview": { + "type": "package", + "serviceable": true, + "sha512": "sha512-b5yBD9FrY02r0kdNNgZ+uU0/QsW3AtmnCE/x1mUG5j8ka/V04AYUo+sDokQBzu+vnK6Y6OrVDtyWjmnKTDHpWA==", + "path": "microsoft.azure.powershell.clients.websites/1.3.57-preview", + "hashPath": "microsoft.azure.powershell.clients.websites.1.3.57-preview.nupkg.sha512" + }, + "Microsoft.Azure.PowerShell.Common/1.3.57-preview": { + "type": "package", + "serviceable": true, + "sha512": "sha512-9jZYZ9LKbx16r69y7cO9d7bDjpE0/HgeBU386Y/O6q05VRaq2wAsB2rbQ9AjxcPGHfwS0+2US/RImSSqjVABRQ==", + "path": "microsoft.azure.powershell.common/1.3.57-preview", + "hashPath": "microsoft.azure.powershell.common.1.3.57-preview.nupkg.sha512" + }, + "Microsoft.Azure.PowerShell.Common.Share/1.3.57-preview": { + "type": "package", + "serviceable": true, + "sha512": "sha512-4mJSjnwZVLQYWhP47eDzdt0yaLIf2I4pqaEIqcfAjkjdbKpnCXCnJUEFRId061yuKpq1LtfBZkHDRi68I5CJxg==", + "path": "microsoft.azure.powershell.common.share/1.3.57-preview", + "hashPath": "microsoft.azure.powershell.common.share.1.3.57-preview.nupkg.sha512" + }, + "Microsoft.Azure.PowerShell.Storage/1.3.57-preview": { + "type": "package", + "serviceable": true, + "sha512": "sha512-fObXEcuhk1JUoQ0fiCV4nK4NJWqvsfsKCzapF7SFEQ87X6AasL6m5KGT8JQSnHmc849xxxaixPTxyWaf9BBlpw==", + "path": "microsoft.azure.powershell.storage/1.3.57-preview", + "hashPath": "microsoft.azure.powershell.storage.1.3.57-preview.nupkg.sha512" + }, + "Microsoft.Azure.PowerShell.Strategies/1.3.57-preview": { + "type": "package", + "serviceable": true, + "sha512": "sha512-HwyxUwDHCmY6Zdxg2xpFC9Gqmu92Xr0cAr4ElWYwz8Z7PE9uYVkTpKMIKd7oIJJgsIANTfqEU1HKoeI3FXPLqw==", + "path": "microsoft.azure.powershell.strategies/1.3.57-preview", + "hashPath": "microsoft.azure.powershell.strategies.1.3.57-preview.nupkg.sha512" + }, + "Microsoft.Bcl.AsyncInterfaces/1.1.1": { + "type": "package", + "serviceable": true, + "sha512": "sha512-yuvf07qFWFqtK3P/MRkEKLhn5r2UbSpVueRziSqj0yJQIKFwG1pq9mOayK3zE5qZCTs0CbrwL9M6R8VwqyGy2w==", + "path": "microsoft.bcl.asyncinterfaces/1.1.1", + "hashPath": "microsoft.bcl.asyncinterfaces.1.1.1.nupkg.sha512" + }, + "Microsoft.CSharp/4.5.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-kaj6Wb4qoMuH3HySFJhxwQfe8R/sJsNJnANrvv8WdFPMoNbKY5htfNscv+LHCu5ipz+49m2e+WQXpLXr9XYemQ==", + "path": "microsoft.csharp/4.5.0", + "hashPath": "microsoft.csharp.4.5.0.nupkg.sha512" + }, + "Microsoft.Identity.Client/4.30.1": { + "type": "package", + "serviceable": true, + "sha512": "sha512-xk8tJeGfB2yD3+d7a0DXyV7/HYyEG10IofUHYHoPYKmDbroi/j9t1BqSHgbq1nARDjg7m8Ki6e21AyNU7e/R4Q==", + "path": "microsoft.identity.client/4.30.1", + "hashPath": "microsoft.identity.client.4.30.1.nupkg.sha512" + }, + "Microsoft.Identity.Client.Extensions.Msal/2.18.4": { + "type": "package", + "serviceable": true, + "sha512": "sha512-HpG4oLwhQsy0ce7OWq9iDdLtJKOvKRStIKoSEOeBMKuohfuOWNDyhg8fMAJkpG/kFeoe4J329fiMHcJmmB+FPw==", + "path": "microsoft.identity.client.extensions.msal/2.18.4", + "hashPath": "microsoft.identity.client.extensions.msal.2.18.4.nupkg.sha512" + }, + "Microsoft.NETCore.Platforms/1.1.1": { + "type": "package", + "serviceable": true, + "sha512": "sha512-TMBuzAHpTenGbGgk0SMTwyEkyijY/Eae4ZGsFNYJvAr/LDn1ku3Etp3FPxChmDp5HHF3kzJuoaa08N0xjqAJfQ==", + "path": "microsoft.netcore.platforms/1.1.1", + "hashPath": "microsoft.netcore.platforms.1.1.1.nupkg.sha512" + }, + "Microsoft.NETCore.Targets/1.1.3": { + "type": "package", + "serviceable": true, + "sha512": "sha512-3Wrmi0kJDzClwAC+iBdUBpEKmEle8FQNsCs77fkiOIw/9oYA07bL1EZNX0kQ2OMN3xpwvl0vAtOCYY3ndDNlhQ==", + "path": "microsoft.netcore.targets/1.1.3", + "hashPath": "microsoft.netcore.targets.1.1.3.nupkg.sha512" + }, + "Microsoft.Rest.ClientRuntime/2.3.23": { + "type": "package", + "serviceable": true, + "sha512": "sha512-92kNTi1N7zI5wwI2ZXswBRnk61OUYnuYJXrlgOhes5IsAqGmgw9DPGmhUzeY8OaZ8TTrQdDzvgXFnbCHwLzSVA==", + "path": "microsoft.rest.clientruntime/2.3.23", + "hashPath": "microsoft.rest.clientruntime.2.3.23.nupkg.sha512" + }, + "Microsoft.Rest.ClientRuntime.Azure/3.3.19": { + "type": "package", + "serviceable": true, + "sha512": "sha512-+NVBWvRXNwaAPTZUxjUlQggsrf3X0GbiRoxYfgc3kG9E55ZxZxvZPT3nIfC4DNqzGSXUEvmLbckdXgBBzGdUaA==", + "path": "microsoft.rest.clientruntime.azure/3.3.19", + "hashPath": "microsoft.rest.clientruntime.azure.3.3.19.nupkg.sha512" + }, + "Microsoft.Win32.Primitives/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-9ZQKCWxH7Ijp9BfahvL2Zyf1cJIk8XYLF6Yjzr2yi0b2cOut/HQ31qf1ThHAgCc3WiZMdnWcfJCgN82/0UunxA==", + "path": "microsoft.win32.primitives/4.3.0", + "hashPath": "microsoft.win32.primitives.4.3.0.nupkg.sha512" + }, + "Microsoft.Win32.Registry/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-Lw1/VwLH1yxz6SfFEjVRCN0pnflLEsWgnV4qsdJ512/HhTwnKXUG+zDQ4yTO3K/EJQemGoNaBHX5InISNKTzUQ==", + "path": "microsoft.win32.registry/4.3.0", + "hashPath": "microsoft.win32.registry.4.3.0.nupkg.sha512" + }, + "NETStandard.Library/2.0.3": { + "type": "package", + "serviceable": true, + "sha512": "sha512-st47PosZSHrjECdjeIzZQbzivYBJFv6P2nv4cj2ypdI204DO+vZ7l5raGMiX4eXMJ53RfOIg+/s4DHVZ54Nu2A==", + "path": "netstandard.library/2.0.3", + "hashPath": "netstandard.library.2.0.3.nupkg.sha512" + }, + "Newtonsoft.Json/10.0.3": { + "type": "package", + "serviceable": true, + "sha512": "sha512-hSXaFmh7hNCuEoC4XNY5DrRkLDzYHqPx/Ik23R4J86Z7PE/Y6YidhG602dFVdLBRSdG6xp9NabH3dXpcoxWvww==", + "path": "newtonsoft.json/10.0.3", + "hashPath": "newtonsoft.json.10.0.3.nupkg.sha512" + }, + "PowerShellStandard.Library/5.1.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-iYaRvQsM1fow9h3uEmio+2m2VXfulgI16AYHaTZ8Sf7erGe27Qc8w/h6QL5UPuwv1aXR40QfzMEwcCeiYJp2cw==", + "path": "powershellstandard.library/5.1.0", + "hashPath": "powershellstandard.library.5.1.0.nupkg.sha512" + }, + "runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-HdSSp5MnJSsg08KMfZThpuLPJpPwE5hBXvHwoKWosyHHfe8Mh5WKT0ylEOf6yNzX6Ngjxe4Whkafh5q7Ymac4Q==", + "path": "runtime.debian.8-x64.runtime.native.system.security.cryptography.openssl/4.3.0", + "hashPath": "runtime.debian.8-x64.runtime.native.system.security.cryptography.openssl.4.3.0.nupkg.sha512" + }, + "runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-+yH1a49wJMy8Zt4yx5RhJrxO/DBDByAiCzNwiETI+1S4mPdCu0OY4djdciC7Vssk0l22wQaDLrXxXkp+3+7bVA==", + "path": "runtime.fedora.23-x64.runtime.native.system.security.cryptography.openssl/4.3.0", + "hashPath": "runtime.fedora.23-x64.runtime.native.system.security.cryptography.openssl.4.3.0.nupkg.sha512" + }, + "runtime.fedora.24-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-c3YNH1GQJbfIPJeCnr4avseugSqPrxwIqzthYyZDN6EuOyNOzq+y2KSUfRcXauya1sF4foESTgwM5e1A8arAKw==", + "path": "runtime.fedora.24-x64.runtime.native.system.security.cryptography.openssl/4.3.0", + "hashPath": "runtime.fedora.24-x64.runtime.native.system.security.cryptography.openssl.4.3.0.nupkg.sha512" + }, + "runtime.native.System/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-c/qWt2LieNZIj1jGnVNsE2Kl23Ya2aSTBuXMD6V7k9KWr6l16Tqdwq+hJScEpWER9753NWC8h96PaVNY5Ld7Jw==", + "path": "runtime.native.system/4.3.0", + "hashPath": "runtime.native.system.4.3.0.nupkg.sha512" + }, + "runtime.native.System.Net.Http/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-ZVuZJqnnegJhd2k/PtAbbIcZ3aZeITq3sj06oKfMBSfphW3HDmk/t4ObvbOk/JA/swGR0LNqMksAh/f7gpTROg==", + "path": "runtime.native.system.net.http/4.3.0", + "hashPath": "runtime.native.system.net.http.4.3.0.nupkg.sha512" + }, + "runtime.native.System.Security.Cryptography.Apple/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-DloMk88juo0OuOWr56QG7MNchmafTLYWvABy36izkrLI5VledI0rq28KGs1i9wbpeT9NPQrx/wTf8U2vazqQ3Q==", + "path": "runtime.native.system.security.cryptography.apple/4.3.0", + "hashPath": "runtime.native.system.security.cryptography.apple.4.3.0.nupkg.sha512" + }, + "runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-NS1U+700m4KFRHR5o4vo9DSlTmlCKu/u7dtE5sUHVIPB+xpXxYQvgBgA6wEIeCz6Yfn0Z52/72WYsToCEPJnrw==", + "path": "runtime.native.system.security.cryptography.openssl/4.3.0", + "hashPath": "runtime.native.system.security.cryptography.openssl.4.3.0.nupkg.sha512" + }, + "runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-b3pthNgxxFcD+Pc0WSEoC0+md3MyhRS6aCEeenvNE3Fdw1HyJ18ZhRFVJJzIeR/O/jpxPboB805Ho0T3Ul7w8A==", + "path": "runtime.opensuse.13.2-x64.runtime.native.system.security.cryptography.openssl/4.3.0", + "hashPath": "runtime.opensuse.13.2-x64.runtime.native.system.security.cryptography.openssl.4.3.0.nupkg.sha512" + }, + "runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-KeLz4HClKf+nFS7p/6Fi/CqyLXh81FpiGzcmuS8DGi9lUqSnZ6Es23/gv2O+1XVGfrbNmviF7CckBpavkBoIFQ==", + "path": "runtime.opensuse.42.1-x64.runtime.native.system.security.cryptography.openssl/4.3.0", + "hashPath": "runtime.opensuse.42.1-x64.runtime.native.system.security.cryptography.openssl.4.3.0.nupkg.sha512" + }, + "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.Apple/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-kVXCuMTrTlxq4XOOMAysuNwsXWpYeboGddNGpIgNSZmv1b6r/s/DPk0fYMB7Q5Qo4bY68o48jt4T4y5BVecbCQ==", + "path": "runtime.osx.10.10-x64.runtime.native.system.security.cryptography.apple/4.3.0", + "hashPath": "runtime.osx.10.10-x64.runtime.native.system.security.cryptography.apple.4.3.0.nupkg.sha512" + }, + "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-X7IdhILzr4ROXd8mI1BUCQMSHSQwelUlBjF1JyTKCjXaOGn2fB4EKBxQbCK2VjO3WaWIdlXZL3W6TiIVnrhX4g==", + "path": "runtime.osx.10.10-x64.runtime.native.system.security.cryptography.openssl/4.3.0", + "hashPath": "runtime.osx.10.10-x64.runtime.native.system.security.cryptography.openssl.4.3.0.nupkg.sha512" + }, + "runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-nyFNiCk/r+VOiIqreLix8yN+q3Wga9+SE8BCgkf+2BwEKiNx6DyvFjCgkfV743/grxv8jHJ8gUK4XEQw7yzRYg==", + "path": "runtime.rhel.7-x64.runtime.native.system.security.cryptography.openssl/4.3.0", + "hashPath": "runtime.rhel.7-x64.runtime.native.system.security.cryptography.openssl.4.3.0.nupkg.sha512" + }, + "runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-ytoewC6wGorL7KoCAvRfsgoJPJbNq+64k2SqW6JcOAebWsFUvCCYgfzQMrnpvPiEl4OrblUlhF2ji+Q1+SVLrQ==", + "path": "runtime.ubuntu.14.04-x64.runtime.native.system.security.cryptography.openssl/4.3.0", + "hashPath": "runtime.ubuntu.14.04-x64.runtime.native.system.security.cryptography.openssl.4.3.0.nupkg.sha512" + }, + "runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-I8bKw2I8k58Wx7fMKQJn2R8lamboCAiHfHeV/pS65ScKWMMI0+wJkLYlEKvgW1D/XvSl/221clBoR2q9QNNM7A==", + "path": "runtime.ubuntu.16.04-x64.runtime.native.system.security.cryptography.openssl/4.3.0", + "hashPath": "runtime.ubuntu.16.04-x64.runtime.native.system.security.cryptography.openssl.4.3.0.nupkg.sha512" + }, + "runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-VB5cn/7OzUfzdnC8tqAIMQciVLiq2epm2NrAm1E9OjNRyG4lVhfR61SMcLizejzQP8R8Uf/0l5qOIbUEi+RdEg==", + "path": "runtime.ubuntu.16.10-x64.runtime.native.system.security.cryptography.openssl/4.3.0", + "hashPath": "runtime.ubuntu.16.10-x64.runtime.native.system.security.cryptography.openssl.4.3.0.nupkg.sha512" + }, + "System.Buffers/4.5.1": { + "type": "package", + "serviceable": true, + "sha512": "sha512-Rw7ijyl1qqRS0YQD/WycNst8hUUMgrMH4FCn1nNm27M4VxchZ1js3fVjQaANHO5f3sN4isvP4a+Met9Y4YomAg==", + "path": "system.buffers/4.5.1", + "hashPath": "system.buffers.4.5.1.nupkg.sha512" + }, + "System.Collections/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-3Dcj85/TBdVpL5Zr+gEEBUuFe2icOnLalmEh9hfck1PTYbbyWuZgh4fmm2ysCLTrqLQw6t3TgTyJ+VLp+Qb+Lw==", + "path": "system.collections/4.3.0", + "hashPath": "system.collections.4.3.0.nupkg.sha512" + }, + "System.Collections.Concurrent/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-ztl69Xp0Y/UXCL+3v3tEU+lIy+bvjKNUmopn1wep/a291pVPK7dxBd6T7WnlQqRog+d1a/hSsgRsmFnIBKTPLQ==", + "path": "system.collections.concurrent/4.3.0", + "hashPath": "system.collections.concurrent.4.3.0.nupkg.sha512" + }, + "System.Collections.NonGeneric/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-prtjIEMhGUnQq6RnPEYLpFt8AtLbp9yq2zxOSrY7KJJZrw25Fi97IzBqY7iqssbM61Ek5b8f3MG/sG1N2sN5KA==", + "path": "system.collections.nongeneric/4.3.0", + "hashPath": "system.collections.nongeneric.4.3.0.nupkg.sha512" + }, + "System.Collections.Specialized/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-Epx8PoVZR0iuOnJJDzp7pWvdfMMOAvpUo95pC4ScH2mJuXkKA2Y4aR3cG9qt2klHgSons1WFh4kcGW7cSXvrxg==", + "path": "system.collections.specialized/4.3.0", + "hashPath": "system.collections.specialized.4.3.0.nupkg.sha512" + }, + "System.ComponentModel/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-VyGn1jGRZVfxnh8EdvDCi71v3bMXrsu8aYJOwoV7SNDLVhiEqwP86pPMyRGsDsxhXAm2b3o9OIqeETfN5qfezw==", + "path": "system.componentmodel/4.3.0", + "hashPath": "system.componentmodel.4.3.0.nupkg.sha512" + }, + "System.ComponentModel.Primitives/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-j8GUkCpM8V4d4vhLIIoBLGey2Z5bCkMVNjEZseyAlm4n5arcsJOeI3zkUP+zvZgzsbLTYh4lYeP/ZD/gdIAPrw==", + "path": "system.componentmodel.primitives/4.3.0", + "hashPath": "system.componentmodel.primitives.4.3.0.nupkg.sha512" + }, + "System.ComponentModel.TypeConverter/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-16pQ6P+EdhcXzPiEK4kbA953Fu0MNG2ovxTZU81/qsCd1zPRsKc3uif5NgvllCY598k6bI0KUyKW8fanlfaDQg==", + "path": "system.componentmodel.typeconverter/4.3.0", + "hashPath": "system.componentmodel.typeconverter.4.3.0.nupkg.sha512" + }, + "System.Diagnostics.Debug/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-ZUhUOdqmaG5Jk3Xdb8xi5kIyQYAA4PnTNlHx1mu9ZY3qv4ELIdKbnL/akbGaKi2RnNUWaZsAs31rvzFdewTj2g==", + "path": "system.diagnostics.debug/4.3.0", + "hashPath": "system.diagnostics.debug.4.3.0.nupkg.sha512" + }, + "System.Diagnostics.DiagnosticSource/4.6.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-mbBgoR0rRfl2uimsZ2avZY8g7Xnh1Mza0rJZLPcxqiMWlkGukjmRkuMJ/er+AhQuiRIh80CR/Hpeztr80seV5g==", + "path": "system.diagnostics.diagnosticsource/4.6.0", + "hashPath": "system.diagnostics.diagnosticsource.4.6.0.nupkg.sha512" + }, + "System.Diagnostics.Process/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-J0wOX07+QASQblsfxmIMFc9Iq7KTXYL3zs2G/Xc704Ylv3NpuVdo6gij6V3PGiptTxqsK0K7CdXenRvKUnkA2g==", + "path": "system.diagnostics.process/4.3.0", + "hashPath": "system.diagnostics.process.4.3.0.nupkg.sha512" + }, + "System.Diagnostics.Tools/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-UUvkJfSYJMM6x527dJg2VyWPSRqIVB0Z7dbjHst1zmwTXz5CcXSYJFWRpuigfbO1Lf7yfZiIaEUesfnl/g5EyA==", + "path": "system.diagnostics.tools/4.3.0", + "hashPath": "system.diagnostics.tools.4.3.0.nupkg.sha512" + }, + "System.Diagnostics.Tracing/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-rswfv0f/Cqkh78rA5S8eN8Neocz234+emGCtTF3lxPY96F+mmmUen6tbn0glN6PMvlKQb9bPAY5e9u7fgPTkKw==", + "path": "system.diagnostics.tracing/4.3.0", + "hashPath": "system.diagnostics.tracing.4.3.0.nupkg.sha512" + }, + "System.Dynamic.Runtime/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-SNVi1E/vfWUAs/WYKhE9+qlS6KqK0YVhnlT0HQtr8pMIA8YX3lwy3uPMownDwdYISBdmAF/2holEIldVp85Wag==", + "path": "system.dynamic.runtime/4.3.0", + "hashPath": "system.dynamic.runtime.4.3.0.nupkg.sha512" + }, + "System.Globalization/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-kYdVd2f2PAdFGblzFswE4hkNANJBKRmsfa2X5LG2AcWE1c7/4t0pYae1L8vfZ5xvE2nK/R9JprtToA61OSHWIg==", + "path": "system.globalization/4.3.0", + "hashPath": "system.globalization.4.3.0.nupkg.sha512" + }, + "System.Globalization.Calendars/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-GUlBtdOWT4LTV3I+9/PJW+56AnnChTaOqqTLFtdmype/L500M2LIyXgmtd9X2P2VOkmJd5c67H5SaC2QcL1bFA==", + "path": "system.globalization.calendars/4.3.0", + "hashPath": "system.globalization.calendars.4.3.0.nupkg.sha512" + }, + "System.Globalization.Extensions/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-FhKmdR6MPG+pxow6wGtNAWdZh7noIOpdD5TwQ3CprzgIE1bBBoim0vbR1+AWsWjQmU7zXHgQo4TWSP6lCeiWcQ==", + "path": "system.globalization.extensions/4.3.0", + "hashPath": "system.globalization.extensions.4.3.0.nupkg.sha512" + }, + "System.IO/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-3qjaHvxQPDpSOYICjUoTsmoq5u6QJAFRUITgeT/4gqkF1bajbSmb1kwSxEA8AHlofqgcKJcM8udgieRNhaJ5Cg==", + "path": "system.io/4.3.0", + "hashPath": "system.io.4.3.0.nupkg.sha512" + }, + "System.IO.FileSystem/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-3wEMARTnuio+ulnvi+hkRNROYwa1kylvYahhcLk4HSoVdl+xxTFVeVlYOfLwrDPImGls0mDqbMhrza8qnWPTdA==", + "path": "system.io.filesystem/4.3.0", + "hashPath": "system.io.filesystem.4.3.0.nupkg.sha512" + }, + "System.IO.FileSystem.Primitives/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-6QOb2XFLch7bEc4lIcJH49nJN2HV+OC3fHDgsLVsBVBk3Y4hFAnOBGzJ2lUu7CyDDFo9IBWkSsnbkT6IBwwiMw==", + "path": "system.io.filesystem.primitives/4.3.0", + "hashPath": "system.io.filesystem.primitives.4.3.0.nupkg.sha512" + }, + "System.Linq/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-5DbqIUpsDp0dFftytzuMmc0oeMdQwjcP/EWxsksIz/w1TcFRkZ3yKKz0PqiYFMmEwPSWw+qNVqD7PJ889JzHbw==", + "path": "system.linq/4.3.0", + "hashPath": "system.linq.4.3.0.nupkg.sha512" + }, + "System.Linq.Expressions/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-PGKkrd2khG4CnlyJwxwwaWWiSiWFNBGlgXvJpeO0xCXrZ89ODrQ6tjEWS/kOqZ8GwEOUATtKtzp1eRgmYNfclg==", + "path": "system.linq.expressions/4.3.0", + "hashPath": "system.linq.expressions.4.3.0.nupkg.sha512" + }, + "System.Memory/4.5.4": { + "type": "package", + "serviceable": true, + "sha512": "sha512-1MbJTHS1lZ4bS4FmsJjnuGJOu88ZzTT2rLvrhW7Ygic+pC0NWA+3hgAen0HRdsocuQXCkUTdFn9yHJJhsijDXw==", + "path": "system.memory/4.5.4", + "hashPath": "system.memory.4.5.4.nupkg.sha512" + }, + "System.Memory.Data/1.0.2": { + "type": "package", + "serviceable": true, + "sha512": "sha512-JGkzeqgBsiZwKJZ1IxPNsDFZDhUvuEdX8L8BDC8N3KOj+6zMcNU28CNN59TpZE/VJYy9cP+5M+sbxtWJx3/xtw==", + "path": "system.memory.data/1.0.2", + "hashPath": "system.memory.data.1.0.2.nupkg.sha512" + }, + "System.Numerics.Vectors/4.5.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-QQTlPTl06J/iiDbJCiepZ4H//BVraReU4O4EoRw1U02H5TLUIT7xn3GnDp9AXPSlJUDyFs4uWjWafNX6WrAojQ==", + "path": "system.numerics.vectors/4.5.0", + "hashPath": "system.numerics.vectors.4.5.0.nupkg.sha512" + }, + "System.ObjectModel/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-bdX+80eKv9bN6K4N+d77OankKHGn6CH711a6fcOpMQu2Fckp/Ft4L/kW9WznHpyR0NRAvJutzOMHNNlBGvxQzQ==", + "path": "system.objectmodel/4.3.0", + "hashPath": "system.objectmodel.4.3.0.nupkg.sha512" + }, + "System.Private.DataContractSerialization/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-yDaJ2x3mMmjdZEDB4IbezSnCsnjQ4BxinKhRAaP6kEgL6Bb6jANWphs5SzyD8imqeC/3FxgsuXT6ykkiH1uUmA==", + "path": "system.private.datacontractserialization/4.3.0", + "hashPath": "system.private.datacontractserialization.4.3.0.nupkg.sha512" + }, + "System.Private.Uri/4.3.2": { + "type": "package", + "serviceable": true, + "sha512": "sha512-o1+7RJnu3Ik3PazR7Z7tJhjPdE000Eq2KGLLWhqJJKXj04wrS8lwb1OFtDF9jzXXADhUuZNJZlPc98uwwqmpFA==", + "path": "system.private.uri/4.3.2", + "hashPath": "system.private.uri.4.3.2.nupkg.sha512" + }, + "System.Reflection/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-KMiAFoW7MfJGa9nDFNcfu+FpEdiHpWgTcS2HdMpDvt9saK3y/G4GwprPyzqjFH9NTaGPQeWNHU+iDlDILj96aQ==", + "path": "system.reflection/4.3.0", + "hashPath": "system.reflection.4.3.0.nupkg.sha512" + }, + "System.Reflection.Emit/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-228FG0jLcIwTVJyz8CLFKueVqQK36ANazUManGaJHkO0icjiIypKW7YLWLIWahyIkdh5M7mV2dJepllLyA1SKg==", + "path": "system.reflection.emit/4.3.0", + "hashPath": "system.reflection.emit.4.3.0.nupkg.sha512" + }, + "System.Reflection.Emit.ILGeneration/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-59tBslAk9733NXLrUJrwNZEzbMAcu8k344OYo+wfSVygcgZ9lgBdGIzH/nrg3LYhXceynyvTc8t5/GD4Ri0/ng==", + "path": "system.reflection.emit.ilgeneration/4.3.0", + "hashPath": "system.reflection.emit.ilgeneration.4.3.0.nupkg.sha512" + }, + "System.Reflection.Emit.Lightweight/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-oadVHGSMsTmZsAF864QYN1t1QzZjIcuKU3l2S9cZOwDdDueNTrqq1yRj7koFfIGEnKpt6NjpL3rOzRhs4ryOgA==", + "path": "system.reflection.emit.lightweight/4.3.0", + "hashPath": "system.reflection.emit.lightweight.4.3.0.nupkg.sha512" + }, + "System.Reflection.Extensions/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-rJkrJD3kBI5B712aRu4DpSIiHRtr6QlfZSQsb0hYHrDCZORXCFjQfoipo2LaMUHoT9i1B7j7MnfaEKWDFmFQNQ==", + "path": "system.reflection.extensions/4.3.0", + "hashPath": "system.reflection.extensions.4.3.0.nupkg.sha512" + }, + "System.Reflection.Primitives/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-5RXItQz5As4xN2/YUDxdpsEkMhvw3e6aNveFXUn4Hl/udNTCNhnKp8lT9fnc3MhvGKh1baak5CovpuQUXHAlIA==", + "path": "system.reflection.primitives/4.3.0", + "hashPath": "system.reflection.primitives.4.3.0.nupkg.sha512" + }, + "System.Reflection.TypeExtensions/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-7u6ulLcZbyxB5Gq0nMkQttcdBTx57ibzw+4IOXEfR+sXYQoHvjW5LTLyNr8O22UIMrqYbchJQJnos4eooYzYJA==", + "path": "system.reflection.typeextensions/4.3.0", + "hashPath": "system.reflection.typeextensions.4.3.0.nupkg.sha512" + }, + "System.Resources.ResourceManager/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-/zrcPkkWdZmI4F92gL/TPumP98AVDu/Wxr3CSJGQQ+XN6wbRZcyfSKVoPo17ilb3iOr0cCRqJInGwNMolqhS8A==", + "path": "system.resources.resourcemanager/4.3.0", + "hashPath": "system.resources.resourcemanager.4.3.0.nupkg.sha512" + }, + "System.Runtime/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-JufQi0vPQ0xGnAczR13AUFglDyVYt4Kqnz1AZaiKZ5+GICq0/1MH/mO/eAJHt/mHW1zjKBJd7kV26SrxddAhiw==", + "path": "system.runtime/4.3.0", + "hashPath": "system.runtime.4.3.0.nupkg.sha512" + }, + "System.Runtime.CompilerServices.Unsafe/4.7.1": { + "type": "package", + "serviceable": true, + "sha512": "sha512-zOHkQmzPCn5zm/BH+cxC1XbUS3P4Yoi3xzW7eRgVpDR2tPGSzyMZ17Ig1iRkfJuY0nhxkQQde8pgePNiA7z7TQ==", + "path": "system.runtime.compilerservices.unsafe/4.7.1", + "hashPath": "system.runtime.compilerservices.unsafe.4.7.1.nupkg.sha512" + }, + "System.Runtime.Extensions/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-guW0uK0fn5fcJJ1tJVXYd7/1h5F+pea1r7FLSOz/f8vPEqbR2ZAknuRDvTQ8PzAilDveOxNjSfr0CHfIQfFk8g==", + "path": "system.runtime.extensions/4.3.0", + "hashPath": "system.runtime.extensions.4.3.0.nupkg.sha512" + }, + "System.Runtime.Handles/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-OKiSUN7DmTWeYb3l51A7EYaeNMnvxwE249YtZz7yooT4gOZhmTjIn48KgSsw2k2lYdLgTKNJw/ZIfSElwDRVgg==", + "path": "system.runtime.handles/4.3.0", + "hashPath": "system.runtime.handles.4.3.0.nupkg.sha512" + }, + "System.Runtime.InteropServices/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-uv1ynXqiMK8mp1GM3jDqPCFN66eJ5w5XNomaK2XD+TuCroNTLFGeZ+WCmBMcBDyTFKou3P6cR6J/QsaqDp7fGQ==", + "path": "system.runtime.interopservices/4.3.0", + "hashPath": "system.runtime.interopservices.4.3.0.nupkg.sha512" + }, + "System.Runtime.Numerics/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-yMH+MfdzHjy17l2KESnPiF2dwq7T+xLnSJar7slyimAkUh/gTrS9/UQOtv7xarskJ2/XDSNvfLGOBQPjL7PaHQ==", + "path": "system.runtime.numerics/4.3.0", + "hashPath": "system.runtime.numerics.4.3.0.nupkg.sha512" + }, + "System.Runtime.Serialization.Formatters/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-KT591AkTNFOTbhZlaeMVvfax3RqhH1EJlcwF50Wm7sfnBLuHiOeZRRKrr1ns3NESkM20KPZ5Ol/ueMq5vg4QoQ==", + "path": "system.runtime.serialization.formatters/4.3.0", + "hashPath": "system.runtime.serialization.formatters.4.3.0.nupkg.sha512" + }, + "System.Runtime.Serialization.Json/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-CpVfOH0M/uZ5PH+M9+Gu56K0j9lJw3M+PKRegTkcrY/stOIvRUeonggxNrfBYLA5WOHL2j15KNJuTuld3x4o9w==", + "path": "system.runtime.serialization.json/4.3.0", + "hashPath": "system.runtime.serialization.json.4.3.0.nupkg.sha512" + }, + "System.Runtime.Serialization.Primitives/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-Wz+0KOukJGAlXjtKr+5Xpuxf8+c8739RI1C+A2BoQZT+wMCCoMDDdO8/4IRHfaVINqL78GO8dW8G2lW/e45Mcw==", + "path": "system.runtime.serialization.primitives/4.3.0", + "hashPath": "system.runtime.serialization.primitives.4.3.0.nupkg.sha512" + }, + "System.Security.AccessControl/4.5.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-vW8Eoq0TMyz5vAG/6ce483x/CP83fgm4SJe5P8Tb1tZaobcvPrbMEL7rhH1DRdrYbbb6F0vq3OlzmK0Pkwks5A==", + "path": "system.security.accesscontrol/4.5.0", + "hashPath": "system.security.accesscontrol.4.5.0.nupkg.sha512" + }, + "System.Security.Cryptography.Algorithms/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-W1kd2Y8mYSCgc3ULTAZ0hOP2dSdG5YauTb1089T0/kRcN2MpSAW1izOFROrJgxSlMn3ArsgHXagigyi+ibhevg==", + "path": "system.security.cryptography.algorithms/4.3.0", + "hashPath": "system.security.cryptography.algorithms.4.3.0.nupkg.sha512" + }, + "System.Security.Cryptography.Cng/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-03idZOqFlsKRL4W+LuCpJ6dBYDUWReug6lZjBa3uJWnk5sPCUXckocevTaUA8iT/MFSrY/2HXkOt753xQ/cf8g==", + "path": "system.security.cryptography.cng/4.3.0", + "hashPath": "system.security.cryptography.cng.4.3.0.nupkg.sha512" + }, + "System.Security.Cryptography.Csp/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-X4s/FCkEUnRGnwR3aSfVIkldBmtURMhmexALNTwpjklzxWU7yjMk7GHLKOZTNkgnWnE0q7+BCf9N2LVRWxewaA==", + "path": "system.security.cryptography.csp/4.3.0", + "hashPath": "system.security.cryptography.csp.4.3.0.nupkg.sha512" + }, + "System.Security.Cryptography.Encoding/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-1DEWjZZly9ae9C79vFwqaO5kaOlI5q+3/55ohmq/7dpDyDfc8lYe7YVxJUZ5MF/NtbkRjwFRo14yM4OEo9EmDw==", + "path": "system.security.cryptography.encoding/4.3.0", + "hashPath": "system.security.cryptography.encoding.4.3.0.nupkg.sha512" + }, + "System.Security.Cryptography.OpenSsl/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-h4CEgOgv5PKVF/HwaHzJRiVboL2THYCou97zpmhjghx5frc7fIvlkY1jL+lnIQyChrJDMNEXS6r7byGif8Cy4w==", + "path": "system.security.cryptography.openssl/4.3.0", + "hashPath": "system.security.cryptography.openssl.4.3.0.nupkg.sha512" + }, + "System.Security.Cryptography.Primitives/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-7bDIyVFNL/xKeFHjhobUAQqSpJq9YTOpbEs6mR233Et01STBMXNAc/V+BM6dwYGc95gVh/Zf+iVXWzj3mE8DWg==", + "path": "system.security.cryptography.primitives/4.3.0", + "hashPath": "system.security.cryptography.primitives.4.3.0.nupkg.sha512" + }, + "System.Security.Cryptography.ProtectedData/4.5.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-wLBKzFnDCxP12VL9ANydSYhk59fC4cvOr9ypYQLPnAj48NQIhqnjdD2yhP8yEKyBJEjERWS9DisKL7rX5eU25Q==", + "path": "system.security.cryptography.protecteddata/4.5.0", + "hashPath": "system.security.cryptography.protecteddata.4.5.0.nupkg.sha512" + }, + "System.Security.Cryptography.X509Certificates/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-t2Tmu6Y2NtJ2um0RtcuhP7ZdNNxXEgUm2JeoA/0NvlMjAhKCnM1NX07TDl3244mVp3QU6LPEhT3HTtH1uF7IYw==", + "path": "system.security.cryptography.x509certificates/4.3.0", + "hashPath": "system.security.cryptography.x509certificates.4.3.0.nupkg.sha512" + }, + "System.Security.Permissions/4.5.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-9gdyuARhUR7H+p5CjyUB/zPk7/Xut3wUSP8NJQB6iZr8L3XUXTMdoLeVAg9N4rqF8oIpE7MpdqHdDHQ7XgJe0g==", + "path": "system.security.permissions/4.5.0", + "hashPath": "system.security.permissions.4.5.0.nupkg.sha512" + }, + "System.Security.Principal.Windows/4.5.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-U77HfRXlZlOeIXd//Yoj6Jnk8AXlbeisf1oq1os+hxOGVnuG+lGSfGqTwTZBoORFF6j/0q7HXIl8cqwQ9aUGqQ==", + "path": "system.security.principal.windows/4.5.0", + "hashPath": "system.security.principal.windows.4.5.0.nupkg.sha512" + }, + "System.Security.SecureString/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-PnXp38O9q/2Oe4iZHMH60kinScv6QiiL2XH54Pj2t0Y6c2zKPEiAZsM/M3wBOHLNTBDFP0zfy13WN2M0qFz5jg==", + "path": "system.security.securestring/4.3.0", + "hashPath": "system.security.securestring.4.3.0.nupkg.sha512" + }, + "System.Text.Encoding/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-BiIg+KWaSDOITze6jGQynxg64naAPtqGHBwDrLaCtixsa5bKiR8dpPOHA7ge3C0JJQizJE+sfkz1wV+BAKAYZw==", + "path": "system.text.encoding/4.3.0", + "hashPath": "system.text.encoding.4.3.0.nupkg.sha512" + }, + "System.Text.Encoding.Extensions/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-YVMK0Bt/A43RmwizJoZ22ei2nmrhobgeiYwFzC4YAN+nue8RF6djXDMog0UCn+brerQoYVyaS+ghy9P/MUVcmw==", + "path": "system.text.encoding.extensions/4.3.0", + "hashPath": "system.text.encoding.extensions.4.3.0.nupkg.sha512" + }, + "System.Text.Encodings.Web/4.7.2": { + "type": "package", + "serviceable": true, + "sha512": "sha512-iTUgB/WtrZ1sWZs84F2hwyQhiRH6QNjQv2DkwrH+WP6RoFga2Q1m3f9/Q7FG8cck8AdHitQkmkXSY8qylcDmuA==", + "path": "system.text.encodings.web/4.7.2", + "hashPath": "system.text.encodings.web.4.7.2.nupkg.sha512" + }, + "System.Text.Json/4.7.2": { + "type": "package", + "serviceable": true, + "sha512": "sha512-TcMd95wcrubm9nHvJEQs70rC0H/8omiSGGpU4FQ/ZA1URIqD4pjmFJh2Mfv1yH1eHgJDWTi2hMDXwTET+zOOyg==", + "path": "system.text.json/4.7.2", + "hashPath": "system.text.json.4.7.2.nupkg.sha512" + }, + "System.Text.RegularExpressions/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-RpT2DA+L660cBt1FssIE9CAGpLFdFPuheB7pLpKpn6ZXNby7jDERe8Ua/Ne2xGiwLVG2JOqziiaVCGDon5sKFA==", + "path": "system.text.regularexpressions/4.3.0", + "hashPath": "system.text.regularexpressions.4.3.0.nupkg.sha512" + }, + "System.Threading/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-VkUS0kOBcUf3Wwm0TSbrevDDZ6BlM+b/HRiapRFWjM5O0NS0LviG0glKmFK+hhPDd1XFeSdU1GmlLhb2CoVpIw==", + "path": "system.threading/4.3.0", + "hashPath": "system.threading.4.3.0.nupkg.sha512" + }, + "System.Threading.Tasks/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-LbSxKEdOUhVe8BezB/9uOGGppt+nZf6e1VFyw6v3DN6lqitm0OSn2uXMOdtP0M3W4iMcqcivm2J6UgqiwwnXiA==", + "path": "system.threading.tasks/4.3.0", + "hashPath": "system.threading.tasks.4.3.0.nupkg.sha512" + }, + "System.Threading.Tasks.Extensions/4.5.4": { + "type": "package", + "serviceable": true, + "sha512": "sha512-zteT+G8xuGu6mS+mzDzYXbzS7rd3K6Fjb9RiZlYlJPam2/hU7JCBZBVEcywNuR+oZ1ncTvc/cq0faRr3P01OVg==", + "path": "system.threading.tasks.extensions/4.5.4", + "hashPath": "system.threading.tasks.extensions.4.5.4.nupkg.sha512" + }, + "System.Threading.Thread/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-OHmbT+Zz065NKII/ZHcH9XO1dEuLGI1L2k7uYss+9C1jLxTC9kTZZuzUOyXHayRk+dft9CiDf3I/QZ0t8JKyBQ==", + "path": "system.threading.thread/4.3.0", + "hashPath": "system.threading.thread.4.3.0.nupkg.sha512" + }, + "System.Threading.ThreadPool/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-k/+g4b7vjdd4aix83sTgC9VG6oXYKAktSfNIJUNGxPEj7ryEOfzHHhfnmsZvjxawwcD9HyWXKCXmPjX8U4zeSw==", + "path": "system.threading.threadpool/4.3.0", + "hashPath": "system.threading.threadpool.4.3.0.nupkg.sha512" + }, + "System.Xml.ReaderWriter/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-GrprA+Z0RUXaR4N7/eW71j1rgMnEnEVlgii49GZyAjTH7uliMnrOU3HNFBr6fEDBCJCIdlVNq9hHbaDR621XBA==", + "path": "system.xml.readerwriter/4.3.0", + "hashPath": "system.xml.readerwriter.4.3.0.nupkg.sha512" + }, + "System.Xml.XDocument/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-5zJ0XDxAIg8iy+t4aMnQAu0MqVbqyvfoUVl1yDV61xdo3Vth45oA2FoY4pPkxYAH5f8ixpmTqXeEIya95x0aCQ==", + "path": "system.xml.xdocument/4.3.0", + "hashPath": "system.xml.xdocument.4.3.0.nupkg.sha512" + }, + "System.Xml.XmlDocument/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-lJ8AxvkX7GQxpC6GFCeBj8ThYVyQczx2+f/cWHJU8tjS7YfI6Cv6bon70jVEgs2CiFbmmM8b9j1oZVx0dSI2Ww==", + "path": "system.xml.xmldocument/4.3.0", + "hashPath": "system.xml.xmldocument.4.3.0.nupkg.sha512" + }, + "System.Xml.XmlSerializer/4.3.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-MYoTCP7EZ98RrANESW05J5ZwskKDoN0AuZ06ZflnowE50LTpbR5yRg3tHckTVm5j/m47stuGgCrCHWePyHS70Q==", + "path": "system.xml.xmlserializer/4.3.0", + "hashPath": "system.xml.xmlserializer.4.3.0.nupkg.sha512" + }, + "Microsoft.Azure.PowerShell.Authentication/1.0.0": { + "type": "project", + "serviceable": false, + "sha512": "" + }, + "Microsoft.Azure.PowerShell.Authentication.ResourceManager/1.0.0": { + "type": "project", + "serviceable": false, + "sha512": "" + }, + "Microsoft.Azure.PowerShell.Authenticators/1.0.0": { + "type": "project", + "serviceable": false, + "sha512": "" + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Cmdlets.Accounts.dll b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Cmdlets.Accounts.dll new file mode 100644 index 000000000000..2eff02a0138e Binary files /dev/null and b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Cmdlets.Accounts.dll differ diff --git a/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Cmdlets.Accounts.dll-Help.xml b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Cmdlets.Accounts.dll-Help.xml new file mode 100644 index 000000000000..43d9895e237e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Cmdlets.Accounts.dll-Help.xml @@ -0,0 +1,11900 @@ + + + + + Add-AzEnvironment + Add + AzEnvironment + + Adds endpoints and metadata for an instance of Azure Resource Manager. + + + + The Add-AzEnvironment cmdlet adds endpoints and metadata to enable Azure Resource Manager cmdlets to connect with a new instance of Azure Resource Manager. The built-in environments AzureCloud and AzureChinaCloud target existing public instances of Azure Resource Manager. + + + + Add-AzEnvironment + + Name + + Specifies the name of the environment to add. + + System.String + + System.String + + + None + + + PublishSettingsFileUrl + + Specifies the URL from which .publishsettings files can be downloaded. + + System.String + + System.String + + + None + + + AzureKeyVaultDnsSuffix + + Dns suffix of Azure Key Vault service. Example is vault-int.azure-int.net + + System.String + + System.String + + + None + + + AzureKeyVaultServiceEndpointResourceId + + Resource identifier of Azure Key Vault data service that is the recipient of the requested token. + + System.String + + System.String + + + None + + + TrafficManagerDnsSuffix + + Specifies the domain-name suffix for Azure Traffic Manager services. + + System.String + + System.String + + + None + + + SqlDatabaseDnsSuffix + + Specifies the domain-name suffix for Azure SQL Database servers. + + System.String + + System.String + + + None + + + AzureDataLakeStoreFileSystemEndpointSuffix + + Dns Suffix of Azure Data Lake Store FileSystem. Example: azuredatalake.net + + System.String + + System.String + + + None + + + AzureDataLakeAnalyticsCatalogAndJobEndpointSuffix + + Dns Suffix of Azure Data Lake Analytics job and catalog services + + System.String + + System.String + + + None + + + EnableAdfsAuthentication + + Indicates that Active Directory Federation Services (ADFS) on-premise authentication is allowed. + + + System.Management.Automation.SwitchParameter + + + False + + + AdTenant + + Specifies the default Active Directory tenant. + + System.String + + System.String + + + None + + + GraphAudience + + The audience for tokens authenticating with the AD Graph Endpoint. + + System.String + + System.String + + + None + + + DataLakeAudience + + The audience for tokens authenticating with the AD Data Lake services Endpoint. + + System.String + + System.String + + + None + + + ServiceEndpoint + + Specifies the endpoint for Service Management (RDFE) requests. + + System.String + + System.String + + + None + + + BatchEndpointResourceId + + The resource identifier of the Azure Batch service that is the recipient of the requested token + + System.String + + System.String + + + None + + + AzureOperationalInsightsEndpointResourceId + + The audience for tokens authenticating with the Azure Log Analytics API. + + System.String + + System.String + + + None + + + AzureOperationalInsightsEndpoint + + The endpoint to use when communicating with the Azure Log Analytics API. + + System.String + + System.String + + + None + + + ManagementPortalUrl + + Specifies the URL for the Management Portal. + + System.String + + System.String + + + None + + + StorageEndpoint + + Specifies the endpoint for storage (blob, table, queue, and file) access. + + System.String + + System.String + + + None + + + ActiveDirectoryEndpoint + + Specifies the base authority for Azure Active Directory authentication. + + System.String + + System.String + + + None + + + ResourceManagerEndpoint + + Specifies the URL for Azure Resource Manager requests. + + System.String + + System.String + + + None + + + GalleryEndpoint + + Specifies the endpoint for the Azure Resource Manager gallery of deployment templates. + + System.String + + System.String + + + None + + + ActiveDirectoryServiceEndpointResourceId + + Specifies the audience for tokens that authenticate requests to Azure Resource Manager or Service Management (RDFE) endpoints. + + System.String + + System.String + + + None + + + GraphEndpoint + + Specifies the URL for Graph (Active Directory metadata) requests. + + System.String + + System.String + + + None + + + AzureAnalysisServicesEndpointResourceId + + The resource identifier of the Azure Analysis Services resource. + + System.String + + System.String + + + None + + + AzureAnalysisServicesEndpointSuffix + + The endpoint to use when communicating with the Azure Log Analytics API. + + System.String + + System.String + + + None + + + AzureAttestationServiceEndpointResourceId + + The The resource identifier of the Azure Attestation service that is the recipient of the requested token. + + System.String + + System.String + + + None + + + AzureAttestationServiceEndpointSuffix + + Dns suffix of Azure Attestation service. + + System.String + + System.String + + + None + + + AzureSynapseAnalyticsEndpointResourceId + + The The resource identifier of the Azure Synapse Analytics that is the recipient of the requested token. + + System.String + + System.String + + + None + + + AzureSynapseAnalyticsEndpointSuffix + + Dns suffix of Azure Synapse Analytics. + + System.String + + System.String + + + None + + + ContainerRegistryEndpointSuffix + + Suffix of Azure Container Registry. + + System.String + + System.String + + + None + + + DefaultProfile + + The credentials, tenant and subscription used for communication with azure + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + + None + + + MicrosoftGraphEndpointResourceId + + The resource identifier of Microsoft Graph + + System.String + + System.String + + + None + + + MicrosoftGraphUrl + + Microsoft Graph Url + + System.String + + System.String + + + None + + + Scope + + Determines the scope of context changes, for example, whether changes apply only to the current process, or to all sessions started by this user. + + + Process + CurrentUser + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + + None + + + Confirm + + Prompts you for confirmation before running the cmdlet. + + + System.Management.Automation.SwitchParameter + + + False + + + WhatIf + + Shows what would happen if the cmdlet runs. The cmdlet is not run. + + + System.Management.Automation.SwitchParameter + + + False + + + + Add-AzEnvironment + + Name + + Specifies the name of the environment to add. + + System.String + + System.String + + + None + + + ARMEndpoint + + The Azure Resource Manager endpoint + + System.String + + System.String + + + None + + + AzureKeyVaultDnsSuffix + + Dns suffix of Azure Key Vault service. Example is vault-int.azure-int.net + + System.String + + System.String + + + None + + + AzureKeyVaultServiceEndpointResourceId + + Resource identifier of Azure Key Vault data service that is the recipient of the requested token. + + System.String + + System.String + + + None + + + DataLakeAudience + + The audience for tokens authenticating with the AD Data Lake services Endpoint. + + System.String + + System.String + + + None + + + BatchEndpointResourceId + + The resource identifier of the Azure Batch service that is the recipient of the requested token + + System.String + + System.String + + + None + + + AzureOperationalInsightsEndpointResourceId + + The audience for tokens authenticating with the Azure Log Analytics API. + + System.String + + System.String + + + None + + + AzureOperationalInsightsEndpoint + + The endpoint to use when communicating with the Azure Log Analytics API. + + System.String + + System.String + + + None + + + StorageEndpoint + + Specifies the endpoint for storage (blob, table, queue, and file) access. + + System.String + + System.String + + + None + + + AzureAnalysisServicesEndpointResourceId + + The resource identifier of the Azure Analysis Services resource. + + System.String + + System.String + + + None + + + AzureAnalysisServicesEndpointSuffix + + The endpoint to use when communicating with the Azure Log Analytics API. + + System.String + + System.String + + + None + + + AzureAttestationServiceEndpointResourceId + + The The resource identifier of the Azure Attestation service that is the recipient of the requested token. + + System.String + + System.String + + + None + + + AzureAttestationServiceEndpointSuffix + + Dns suffix of Azure Attestation service. + + System.String + + System.String + + + None + + + AzureSynapseAnalyticsEndpointResourceId + + The The resource identifier of the Azure Synapse Analytics that is the recipient of the requested token. + + System.String + + System.String + + + None + + + AzureSynapseAnalyticsEndpointSuffix + + Dns suffix of Azure Synapse Analytics. + + System.String + + System.String + + + None + + + ContainerRegistryEndpointSuffix + + Suffix of Azure Container Registry. + + System.String + + System.String + + + None + + + DefaultProfile + + The credentials, tenant and subscription used for communication with azure + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + + None + + + Scope + + Determines the scope of context changes, for example, whether changes apply only to the current process, or to all sessions started by this user. + + + Process + CurrentUser + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + + None + + + Confirm + + Prompts you for confirmation before running the cmdlet. + + + System.Management.Automation.SwitchParameter + + + False + + + WhatIf + + Shows what would happen if the cmdlet runs. The cmdlet is not run. + + + System.Management.Automation.SwitchParameter + + + False + + + + Add-AzEnvironment + + AutoDiscover + + Discovers environments via default or configured endpoint. + + + System.Management.Automation.SwitchParameter + + + False + + + DefaultProfile + + The credentials, tenant and subscription used for communication with azure + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + + None + + + Scope + + Determines the scope of context changes, for example, whether changes apply only to the current process, or to all sessions started by this user. + + + Process + CurrentUser + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + + None + + + Uri + + Specifies URI of the internet resource to fetch environments. + + System.Uri + + System.Uri + + + None + + + Confirm + + Prompts you for confirmation before running the cmdlet. + + + System.Management.Automation.SwitchParameter + + + False + + + WhatIf + + Shows what would happen if the cmdlet runs. The cmdlet is not run. + + + System.Management.Automation.SwitchParameter + + + False + + + + + + ActiveDirectoryEndpoint + + Specifies the base authority for Azure Active Directory authentication. + + System.String + + System.String + + + None + + + ActiveDirectoryServiceEndpointResourceId + + Specifies the audience for tokens that authenticate requests to Azure Resource Manager or Service Management (RDFE) endpoints. + + System.String + + System.String + + + None + + + AdTenant + + Specifies the default Active Directory tenant. + + System.String + + System.String + + + None + + + ARMEndpoint + + The Azure Resource Manager endpoint + + System.String + + System.String + + + None + + + AutoDiscover + + Discovers environments via default or configured endpoint. + + System.Management.Automation.SwitchParameter + + System.Management.Automation.SwitchParameter + + + False + + + AzureAnalysisServicesEndpointResourceId + + The resource identifier of the Azure Analysis Services resource. + + System.String + + System.String + + + None + + + AzureAnalysisServicesEndpointSuffix + + The endpoint to use when communicating with the Azure Log Analytics API. + + System.String + + System.String + + + None + + + AzureAttestationServiceEndpointResourceId + + The The resource identifier of the Azure Attestation service that is the recipient of the requested token. + + System.String + + System.String + + + None + + + AzureAttestationServiceEndpointSuffix + + Dns suffix of Azure Attestation service. + + System.String + + System.String + + + None + + + AzureDataLakeAnalyticsCatalogAndJobEndpointSuffix + + Dns Suffix of Azure Data Lake Analytics job and catalog services + + System.String + + System.String + + + None + + + AzureDataLakeStoreFileSystemEndpointSuffix + + Dns Suffix of Azure Data Lake Store FileSystem. Example: azuredatalake.net + + System.String + + System.String + + + None + + + AzureKeyVaultDnsSuffix + + Dns suffix of Azure Key Vault service. Example is vault-int.azure-int.net + + System.String + + System.String + + + None + + + AzureKeyVaultServiceEndpointResourceId + + Resource identifier of Azure Key Vault data service that is the recipient of the requested token. + + System.String + + System.String + + + None + + + AzureOperationalInsightsEndpoint + + The endpoint to use when communicating with the Azure Log Analytics API. + + System.String + + System.String + + + None + + + AzureOperationalInsightsEndpointResourceId + + The audience for tokens authenticating with the Azure Log Analytics API. + + System.String + + System.String + + + None + + + AzureSynapseAnalyticsEndpointResourceId + + The The resource identifier of the Azure Synapse Analytics that is the recipient of the requested token. + + System.String + + System.String + + + None + + + AzureSynapseAnalyticsEndpointSuffix + + Dns suffix of Azure Synapse Analytics. + + System.String + + System.String + + + None + + + BatchEndpointResourceId + + The resource identifier of the Azure Batch service that is the recipient of the requested token + + System.String + + System.String + + + None + + + ContainerRegistryEndpointSuffix + + Suffix of Azure Container Registry. + + System.String + + System.String + + + None + + + DataLakeAudience + + The audience for tokens authenticating with the AD Data Lake services Endpoint. + + System.String + + System.String + + + None + + + DefaultProfile + + The credentials, tenant and subscription used for communication with azure + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + + None + + + EnableAdfsAuthentication + + Indicates that Active Directory Federation Services (ADFS) on-premise authentication is allowed. + + System.Management.Automation.SwitchParameter + + System.Management.Automation.SwitchParameter + + + False + + + GalleryEndpoint + + Specifies the endpoint for the Azure Resource Manager gallery of deployment templates. + + System.String + + System.String + + + None + + + GraphAudience + + The audience for tokens authenticating with the AD Graph Endpoint. + + System.String + + System.String + + + None + + + GraphEndpoint + + Specifies the URL for Graph (Active Directory metadata) requests. + + System.String + + System.String + + + None + + + ManagementPortalUrl + + Specifies the URL for the Management Portal. + + System.String + + System.String + + + None + + + MicrosoftGraphEndpointResourceId + + The resource identifier of Microsoft Graph + + System.String + + System.String + + + None + + + MicrosoftGraphUrl + + Microsoft Graph Url + + System.String + + System.String + + + None + + + Name + + Specifies the name of the environment to add. + + System.String + + System.String + + + None + + + PublishSettingsFileUrl + + Specifies the URL from which .publishsettings files can be downloaded. + + System.String + + System.String + + + None + + + ResourceManagerEndpoint + + Specifies the URL for Azure Resource Manager requests. + + System.String + + System.String + + + None + + + Scope + + Determines the scope of context changes, for example, whether changes apply only to the current process, or to all sessions started by this user. + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + + None + + + ServiceEndpoint + + Specifies the endpoint for Service Management (RDFE) requests. + + System.String + + System.String + + + None + + + SqlDatabaseDnsSuffix + + Specifies the domain-name suffix for Azure SQL Database servers. + + System.String + + System.String + + + None + + + StorageEndpoint + + Specifies the endpoint for storage (blob, table, queue, and file) access. + + System.String + + System.String + + + None + + + TrafficManagerDnsSuffix + + Specifies the domain-name suffix for Azure Traffic Manager services. + + System.String + + System.String + + + None + + + Uri + + Specifies URI of the internet resource to fetch environments. + + System.Uri + + System.Uri + + + None + + + Confirm + + Prompts you for confirmation before running the cmdlet. + + System.Management.Automation.SwitchParameter + + System.Management.Automation.SwitchParameter + + + False + + + WhatIf + + Shows what would happen if the cmdlet runs. The cmdlet is not run. + + System.Management.Automation.SwitchParameter + + System.Management.Automation.SwitchParameter + + + False + + + + + + System.String + + + + + + + + System.Management.Automation.SwitchParameter + + + + + + + + + + Microsoft.Azure.Commands.Profile.Models.PSAzureEnvironment + + + + + + + + + + + + + + ----- Example 1: Creating and modifying a new environment ----- + Add-AzEnvironment -Name TestEnvironment ` + -ActiveDirectoryEndpoint TestADEndpoint ` + -ActiveDirectoryServiceEndpointResourceId TestADApplicationId ` + -ResourceManagerEndpoint TestRMEndpoint ` + -GalleryEndpoint TestGalleryEndpoint ` + -GraphEndpoint TestGraphEndpoint + +Name Resource Manager Url ActiveDirectory Authority +---- -------------------- ------------------------- +TestEnvironment TestRMEndpoint TestADEndpoint/ + +Set-AzEnvironment -Name TestEnvironment ` + -ActiveDirectoryEndpoint NewTestADEndpoint ` + -GraphEndpoint NewTestGraphEndpoint | Format-List + +Name : TestEnvironment +EnableAdfsAuthentication : False +OnPremise : False +ActiveDirectoryServiceEndpointResourceId : TestADApplicationId +AdTenant : +GalleryUrl : TestGalleryEndpoint +ManagementPortalUrl : +ServiceManagementUrl : +PublishSettingsFileUrl : +ResourceManagerUrl : TestRMEndpoint +SqlDatabaseDnsSuffix : +StorageEndpointSuffix : +ActiveDirectoryAuthority : NewTestADEndpoint +GraphUrl : NewTestGraphEndpoint +GraphEndpointResourceId : +TrafficManagerDnsSuffix : +AzureKeyVaultDnsSuffix : +DataLakeEndpointResourceId : +AzureDataLakeStoreFileSystemEndpointSuffix : +AzureDataLakeAnalyticsCatalogAndJobEndpointSuffix : +AzureKeyVaultServiceEndpointResourceId : +AzureOperationalInsightsEndpointResourceId : +AzureOperationalInsightsEndpoint : +AzureAnalysisServicesEndpointSuffix : +AzureAttestationServiceEndpointSuffix : +AzureAttestationServiceEndpointResourceId : +AzureSynapseAnalyticsEndpointSuffix : +AzureSynapseAnalyticsEndpointResourceId : +VersionProfiles : {} +ExtendedProperties : {} +BatchEndpointResourceId : + + In this example we are creating a new Azure environment with sample endpoints using Add-AzEnvironment, and then we are changing the value of the ActiveDirectoryEndpoint and GraphEndpoint attributes of the created environment using the cmdlet Set-AzEnvironment. + + + + + + ------- Example 2: Discovering a new environment via Uri ------- + <# +Uri https://configuredmetadata.net returns an array of environment metadata. The following example contains a payload for the AzureCloud default environment. + +[ + { + "portal": "https://portal.azure.com", + "authentication": { + "loginEndpoint": "https://login.microsoftonline.com/", + "audiences": [ + "https://management.core.windows.net/" + ], + "tenant": "common", + "identityProvider": "AAD" + }, + "media": "https://rest.media.azure.net", + "graphAudience": "https://graph.windows.net/", + "graph": "https://graph.windows.net/", + "name": "AzureCloud", + "suffixes": { + "azureDataLakeStoreFileSystem": "azuredatalakestore.net", + "acrLoginServer": "azurecr.io", + "sqlServerHostname": ".database.windows.net", + "azureDataLakeAnalyticsCatalogAndJob": "azuredatalakeanalytics.net", + "keyVaultDns": "vault.azure.net", + "storage": "core.windows.net", + "azureFrontDoorEndpointSuffix": "azurefd.net" + }, + "batch": "https://batch.core.windows.net/", + "resourceManager": "https://management.azure.com/", + "vmImageAliasDoc": "https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/arm-compute/quickstart-templates/aliases.json", + "activeDirectoryDataLake": "https://datalake.azure.net/", + "sqlManagement": "https://management.core.windows.net:8443/", + "gallery": "https://gallery.azure.com/" + }, +…… +] +#> + +Add-AzEnvironment -AutoDiscover -Uri https://configuredmetadata.net + +Name Resource Manager Url ActiveDirectory Authority +---- -------------------- ------------------------- +TestEnvironment TestRMEndpoint TestADEndpoint/ + + In this example, we are discovering a new Azure environment from the `https://configuredmetadata.net` Uri. + + + + + + + + Online Version: + https://learn.microsoft.com/powershell/module/az.accounts/add-azenvironment + + + Get-AzEnvironment + + + + Remove-AzEnvironment + + + + Set-AzEnvironment + + + + + + + Clear-AzContext + Clear + AzContext + + Remove all Azure credentials, account, and subscription information. + + + + Remove all Azure Credentials, account, and subscription information. + + + + Clear-AzContext + + DefaultProfile + + The credentials, tenant and subscription used for communication with azure + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + + None + + + Force + + Delete all users and groups from the global scope without prompting + + + System.Management.Automation.SwitchParameter + + + False + + + PassThru + + Return a value indicating success or failure + + + System.Management.Automation.SwitchParameter + + + False + + + Scope + + Clear the context only for the current PowerShell session, or for all sessions. + + + Process + CurrentUser + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + + None + + + Confirm + + Prompts you for confirmation before running the cmdlet. + + + System.Management.Automation.SwitchParameter + + + False + + + WhatIf + + Shows what would happen if the cmdlet runs. The cmdlet is not run. + + + System.Management.Automation.SwitchParameter + + + False + + + + + + DefaultProfile + + The credentials, tenant and subscription used for communication with azure + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + + None + + + Force + + Delete all users and groups from the global scope without prompting + + System.Management.Automation.SwitchParameter + + System.Management.Automation.SwitchParameter + + + False + + + PassThru + + Return a value indicating success or failure + + System.Management.Automation.SwitchParameter + + System.Management.Automation.SwitchParameter + + + False + + + Scope + + Clear the context only for the current PowerShell session, or for all sessions. + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + + None + + + Confirm + + Prompts you for confirmation before running the cmdlet. + + System.Management.Automation.SwitchParameter + + System.Management.Automation.SwitchParameter + + + False + + + WhatIf + + Shows what would happen if the cmdlet runs. The cmdlet is not run. + + System.Management.Automation.SwitchParameter + + System.Management.Automation.SwitchParameter + + + False + + + + + + None + + + + + + + + + + System.Boolean + + + + + + + + + + + + + + --------------- Example 1: Clear global context --------------- + Clear-AzContext -Scope CurrentUser + + Remove all account, subscription, and credential information for any powershell session. + + + + + + + + Online Version: + https://learn.microsoft.com/powershell/module/az.accounts/clear-azcontext + + + + + + Clear-AzDefault + Clear + AzDefault + + Clears the defaults set by the user in the current context. + + + + The Clear-AzDefault cmdlet removes the defaults set by the user depending on the switch parameters specified by the user. + + + + Clear-AzDefault + + DefaultProfile + + The credentials, account, tenant, and subscription used for communication with azure. + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + + None + + + Force + + Remove all defaults if no default is specified + + + System.Management.Automation.SwitchParameter + + + False + + + PassThru + + {{Fill PassThru Description}} + + + System.Management.Automation.SwitchParameter + + + False + + + ResourceGroup + + Clear Default Resource Group + + + System.Management.Automation.SwitchParameter + + + False + + + Scope + + Determines the scope of context changes, for example, whether changes apply only to the current process, or to all sessions started by this user. + + + Process + CurrentUser + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + + None + + + Confirm + + Prompts you for confirmation before running the cmdlet. + + + System.Management.Automation.SwitchParameter + + + False + + + WhatIf + + Shows what would happen if the cmdlet runs. The cmdlet is not run. + + + System.Management.Automation.SwitchParameter + + + False + + + + + + DefaultProfile + + The credentials, account, tenant, and subscription used for communication with azure. + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + + None + + + Force + + Remove all defaults if no default is specified + + System.Management.Automation.SwitchParameter + + System.Management.Automation.SwitchParameter + + + False + + + PassThru + + {{Fill PassThru Description}} + + System.Management.Automation.SwitchParameter + + System.Management.Automation.SwitchParameter + + + False + + + ResourceGroup + + Clear Default Resource Group + + System.Management.Automation.SwitchParameter + + System.Management.Automation.SwitchParameter + + + False + + + Scope + + Determines the scope of context changes, for example, whether changes apply only to the current process, or to all sessions started by this user. + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + + None + + + Confirm + + Prompts you for confirmation before running the cmdlet. + + System.Management.Automation.SwitchParameter + + System.Management.Automation.SwitchParameter + + + False + + + WhatIf + + Shows what would happen if the cmdlet runs. The cmdlet is not run. + + System.Management.Automation.SwitchParameter + + System.Management.Automation.SwitchParameter + + + False + + + + + + System.Management.Automation.SwitchParameter + + + + + + + + + + System.Boolean + + + + + + + + + + + + + + -------------------------- Example 1 -------------------------- + Clear-AzDefault + + This command removes all the defaults set by the user in the current context. + + + + + + -------------------------- Example 2 -------------------------- + Clear-AzDefault -ResourceGroup + + This command removes the default resource group set by the user in the current context. + + + + + + + + Online Version: + https://learn.microsoft.com/powershell/module/az.accounts/clear-azdefault + + + + + + Connect-AzAccount + Connect + AzAccount + + Connect to Azure with an authenticated account for use with cmdlets from the Az PowerShell modules. + + + + The `Connect-AzAccount` cmdlet connects to Azure with an authenticated account for use with cmdlets from the Az PowerShell modules. You can use this authenticated account only with Azure Resource Manager requests. To add an authenticated account for use with Service Management, use the `Add-AzureAccount` cmdlet from the Azure PowerShell module. If no context is found for the current user, the user's context list is populated with a context for each of their first 25 subscriptions. The list of contexts created for the user can be found by running `Get-AzContext -ListAvailable`. To skip this context population, specify the SkipContextPopulation switch parameter. After executing this cmdlet, you can disconnect from an Azure account using `Disconnect-AzAccount`. + + + + Connect-AzAccount + + AccessToken + + Specifies an access token. + > [!CAUTION] > Access tokens are a type of credential. You should take the appropriate security precautions to > keep them confidential. Access tokens also timeout and may prevent long running tasks from > completing. + + System.String + + System.String + + + None + + + AccountId + + Account Id / User Id / User Name to login with in Default (UserWithSubscriptionId) parameter set; Account ID for access token in AccessToken parameter set; Account ID for managed service in ManagedService parameter set. Can be a managed service resource ID, or the associated client ID. To use the system assigned identity, leave this field blank. + + System.String + + System.String + + + None + + + ContextName + + Name of the default Azure context for this login. For more information about Azure contexts, see Azure PowerShell context objects (/powershell/azure/context-persistence). + + System.String + + System.String + + + None + + + DefaultProfile + + The credentials, account, tenant, and subscription used for communication with Azure. + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + + None + + + Environment + + Environment containing the Azure account. + + System.String + + System.String + + + None + + + Force + + Overwrite the existing context with the same name without prompting. + + + System.Management.Automation.SwitchParameter + + + False + + + GraphAccessToken + + AccessToken for Graph Service. + + System.String + + System.String + + + None + + + KeyVaultAccessToken + + AccessToken for KeyVault Service. + + System.String + + System.String + + + None + + + MaxContextPopulation + + Max subscription number to populate contexts after login. Default is 25. To populate all subscriptions to contexts, set to -1. + + System.Int32 + + System.Int32 + + + None + + + MicrosoftGraphAccessToken + + Access token to Microsoft Graph + + System.String + + System.String + + + None + + + Scope + + Determines the scope of context changes, for example, whether changes apply only to the current process, or to all sessions started by this user. + + + Process + CurrentUser + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + + None + + + SkipContextPopulation + + Skips context population if no contexts are found. + + + System.Management.Automation.SwitchParameter + + + False + + + SkipValidation + + Skip validation for access token. + + + System.Management.Automation.SwitchParameter + + + False + + + Subscription + + Subscription Name or ID. + + System.String + + System.String + + + None + + + Tenant + + Optional tenant name or ID. + > [!NOTE] > Due to limitations of the current API, you must use a tenant ID instead of a tenant name when > connecting with a business-to-business (B2B) account. + + System.String + + System.String + + + None + + + Confirm + + Prompts you for confirmation before running the cmdlet. + + + System.Management.Automation.SwitchParameter + + + False + + + WhatIf + + Shows what would happen if the cmdlet runs. The cmdlet is not run. + + + System.Management.Automation.SwitchParameter + + + False + + + + Connect-AzAccount + + AccountId + + Account Id / User Id / User Name to login with in Default (UserWithSubscriptionId) parameter set; Account ID for access token in AccessToken parameter set; Account ID for managed service in ManagedService parameter set. Can be a managed service resource ID, or the associated client ID. To use the system assigned identity, leave this field blank. + + System.String + + System.String + + + None + + + AuthScope + + Optional OAuth scope for login, supported pre-defined values: AadGraph, AnalysisServices, Attestation, Batch, DataLake, KeyVault, OperationalInsights, Storage, Synapse. It also supports resource id like `https://storage.azure.com/`. + + System.String + + System.String + + + None + + + ContextName + + Name of the default Azure context for this login. For more information about Azure contexts, see Azure PowerShell context objects (/powershell/azure/context-persistence). + + System.String + + System.String + + + None + + + DefaultProfile + + The credentials, account, tenant, and subscription used for communication with Azure. + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + + None + + + Environment + + Environment containing the Azure account. + + System.String + + System.String + + + None + + + Force + + Overwrite the existing context with the same name without prompting. + + + System.Management.Automation.SwitchParameter + + + False + + + MaxContextPopulation + + Max subscription number to populate contexts after login. Default is 25. To populate all subscriptions to contexts, set to -1. + + System.Int32 + + System.Int32 + + + None + + + Scope + + Determines the scope of context changes, for example, whether changes apply only to the current process, or to all sessions started by this user. + + + Process + CurrentUser + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + + None + + + SkipContextPopulation + + Skips context population if no contexts are found. + + + System.Management.Automation.SwitchParameter + + + False + + + Subscription + + Subscription Name or ID. + + System.String + + System.String + + + None + + + Tenant + + Optional tenant name or ID. + > [!NOTE] > Due to limitations of the current API, you must use a tenant ID instead of a tenant name when > connecting with a business-to-business (B2B) account. + + System.String + + System.String + + + None + + + UseDeviceAuthentication + + Use device code authentication instead of a browser control. + + + System.Management.Automation.SwitchParameter + + + False + + + Confirm + + Prompts you for confirmation before running the cmdlet. + + + System.Management.Automation.SwitchParameter + + + False + + + WhatIf + + Shows what would happen if the cmdlet runs. The cmdlet is not run. + + + System.Management.Automation.SwitchParameter + + + False + + + + Connect-AzAccount + + AccountId + + Account Id / User Id / User Name to login with in Default (UserWithSubscriptionId) parameter set; Account ID for access token in AccessToken parameter set; Account ID for managed service in ManagedService parameter set. Can be a managed service resource ID, or the associated client ID. To use the system assigned identity, leave this field blank. + + System.String + + System.String + + + None + + + AuthScope + + Optional OAuth scope for login, supported pre-defined values: AadGraph, AnalysisServices, Attestation, Batch, DataLake, KeyVault, OperationalInsights, Storage, Synapse. It also supports resource id like `https://storage.azure.com/`. + + System.String + + System.String + + + None + + + ContextName + + Name of the default Azure context for this login. For more information about Azure contexts, see Azure PowerShell context objects (/powershell/azure/context-persistence). + + System.String + + System.String + + + None + + + DefaultProfile + + The credentials, account, tenant, and subscription used for communication with Azure. + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + + None + + + Environment + + Environment containing the Azure account. + + System.String + + System.String + + + None + + + Force + + Overwrite the existing context with the same name without prompting. + + + System.Management.Automation.SwitchParameter + + + False + + + Identity + + Login using a Managed Service Identity. + + + System.Management.Automation.SwitchParameter + + + False + + + MaxContextPopulation + + Max subscription number to populate contexts after login. Default is 25. To populate all subscriptions to contexts, set to -1. + + System.Int32 + + System.Int32 + + + None + + + Scope + + Determines the scope of context changes, for example, whether changes apply only to the current process, or to all sessions started by this user. + + + Process + CurrentUser + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + + None + + + SkipContextPopulation + + Skips context population if no contexts are found. + + + System.Management.Automation.SwitchParameter + + + False + + + Subscription + + Subscription Name or ID. + + System.String + + System.String + + + None + + + Tenant + + Optional tenant name or ID. + > [!NOTE] > Due to limitations of the current API, you must use a tenant ID instead of a tenant name when > connecting with a business-to-business (B2B) account. + + System.String + + System.String + + + None + + + Confirm + + Prompts you for confirmation before running the cmdlet. + + + System.Management.Automation.SwitchParameter + + + False + + + WhatIf + + Shows what would happen if the cmdlet runs. The cmdlet is not run. + + + System.Management.Automation.SwitchParameter + + + False + + + + Connect-AzAccount + + ApplicationId + + Application ID of the service principal. + + System.String + + System.String + + + None + + + AuthScope + + Optional OAuth scope for login, supported pre-defined values: AadGraph, AnalysisServices, Attestation, Batch, DataLake, KeyVault, OperationalInsights, Storage, Synapse. It also supports resource id like `https://storage.azure.com/`. + + System.String + + System.String + + + None + + + CertificateThumbprint + + Certificate Hash or Thumbprint. + + System.String + + System.String + + + None + + + ContextName + + Name of the default Azure context for this login. For more information about Azure contexts, see Azure PowerShell context objects (/powershell/azure/context-persistence). + + System.String + + System.String + + + None + + + DefaultProfile + + The credentials, account, tenant, and subscription used for communication with Azure. + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + + None + + + Environment + + Environment containing the Azure account. + + System.String + + System.String + + + None + + + Force + + Overwrite the existing context with the same name without prompting. + + + System.Management.Automation.SwitchParameter + + + False + + + MaxContextPopulation + + Max subscription number to populate contexts after login. Default is 25. To populate all subscriptions to contexts, set to -1. + + System.Int32 + + System.Int32 + + + None + + + Scope + + Determines the scope of context changes, for example, whether changes apply only to the current process, or to all sessions started by this user. + + + Process + CurrentUser + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + + None + + + SendCertificateChain + + Specifies if the x5c claim (public key of the certificate) should be sent to the STS to achieve easy certificate rollover in Azure AD. + + + System.Management.Automation.SwitchParameter + + + False + + + ServicePrincipal + + Indicates that this account authenticates by providing service principal credentials. + + + System.Management.Automation.SwitchParameter + + + False + + + SkipContextPopulation + + Skips context population if no contexts are found. + + + System.Management.Automation.SwitchParameter + + + False + + + Subscription + + Subscription Name or ID. + + System.String + + System.String + + + None + + + Tenant + + Optional tenant name or ID. + > [!NOTE] > Due to limitations of the current API, you must use a tenant ID instead of a tenant name when > connecting with a business-to-business (B2B) account. + + System.String + + System.String + + + None + + + Confirm + + Prompts you for confirmation before running the cmdlet. + + + System.Management.Automation.SwitchParameter + + + False + + + WhatIf + + Shows what would happen if the cmdlet runs. The cmdlet is not run. + + + System.Management.Automation.SwitchParameter + + + False + + + + Connect-AzAccount + + ApplicationId + + Application ID of the service principal. + + System.String + + System.String + + + None + + + ContextName + + Name of the default Azure context for this login. For more information about Azure contexts, see Azure PowerShell context objects (/powershell/azure/context-persistence). + + System.String + + System.String + + + None + + + DefaultProfile + + The credentials, account, tenant, and subscription used for communication with Azure. + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + + None + + + Environment + + Environment containing the Azure account. + + System.String + + System.String + + + None + + + FederatedToken + + Specifies a token provided by another identity provider. The issuer and subject in this token must be first configured to be trusted by the ApplicationId. + > [!CAUTION] > Federated tokens are a type of credential. You should take the appropriate security precautions to keep them confidential. Federated tokens also timeout and may prevent long running tasks from completing. + + System.String + + System.String + + + None + + + Force + + Overwrite the existing context with the same name without prompting. + + + System.Management.Automation.SwitchParameter + + + False + + + MaxContextPopulation + + Max subscription number to populate contexts after login. Default is 25. To populate all subscriptions to contexts, set to -1. + + System.Int32 + + System.Int32 + + + None + + + Scope + + Determines the scope of context changes, for example, whether changes apply only to the current process, or to all sessions started by this user. + + + Process + CurrentUser + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + + None + + + ServicePrincipal + + Indicates that this account authenticates by providing service principal credentials. + + + System.Management.Automation.SwitchParameter + + + False + + + SkipContextPopulation + + Skips context population if no contexts are found. + + + System.Management.Automation.SwitchParameter + + + False + + + Subscription + + Subscription Name or ID. + + System.String + + System.String + + + None + + + Tenant + + Optional tenant name or ID. + > [!NOTE] > Due to limitations of the current API, you must use a tenant ID instead of a tenant name when > connecting with a business-to-business (B2B) account. + + System.String + + System.String + + + None + + + Confirm + + Prompts you for confirmation before running the cmdlet. + + + System.Management.Automation.SwitchParameter + + + False + + + WhatIf + + Shows what would happen if the cmdlet runs. The cmdlet is not run. + + + System.Management.Automation.SwitchParameter + + + False + + + + Connect-AzAccount + + ApplicationId + + Application ID of the service principal. + + System.String + + System.String + + + None + + + CertificatePassword + + The password required to access the pkcs#12 certificate file. + + System.Security.SecureString + + System.Security.SecureString + + + None + + + CertificatePath + + The path of certficate file in pkcs#12 format. + + System.String + + System.String + + + None + + + ContextName + + Name of the default Azure context for this login. For more information about Azure contexts, see Azure PowerShell context objects (/powershell/azure/context-persistence). + + System.String + + System.String + + + None + + + DefaultProfile + + The credentials, account, tenant, and subscription used for communication with Azure. + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + + None + + + Environment + + Environment containing the Azure account. + + System.String + + System.String + + + None + + + Force + + Overwrite the existing context with the same name without prompting. + + + System.Management.Automation.SwitchParameter + + + False + + + MaxContextPopulation + + Max subscription number to populate contexts after login. Default is 25. To populate all subscriptions to contexts, set to -1. + + System.Int32 + + System.Int32 + + + None + + + Scope + + Determines the scope of context changes, for example, whether changes apply only to the current process, or to all sessions started by this user. + + + Process + CurrentUser + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + + None + + + SendCertificateChain + + Specifies if the x5c claim (public key of the certificate) should be sent to the STS to achieve easy certificate rollover in Azure AD. + + + System.Management.Automation.SwitchParameter + + + False + + + ServicePrincipal + + Indicates that this account authenticates by providing service principal credentials. + + + System.Management.Automation.SwitchParameter + + + False + + + SkipContextPopulation + + Skips context population if no contexts are found. + + + System.Management.Automation.SwitchParameter + + + False + + + Subscription + + Subscription Name or ID. + + System.String + + System.String + + + None + + + Tenant + + Optional tenant name or ID. + > [!NOTE] > Due to limitations of the current API, you must use a tenant ID instead of a tenant name when > connecting with a business-to-business (B2B) account. + + System.String + + System.String + + + None + + + Confirm + + Prompts you for confirmation before running the cmdlet. + + + System.Management.Automation.SwitchParameter + + + False + + + WhatIf + + Shows what would happen if the cmdlet runs. The cmdlet is not run. + + + System.Management.Automation.SwitchParameter + + + False + + + + Connect-AzAccount + + AuthScope + + Optional OAuth scope for login, supported pre-defined values: AadGraph, AnalysisServices, Attestation, Batch, DataLake, KeyVault, OperationalInsights, Storage, Synapse. It also supports resource id like `https://storage.azure.com/`. + + System.String + + System.String + + + None + + + ContextName + + Name of the default Azure context for this login. For more information about Azure contexts, see Azure PowerShell context objects (/powershell/azure/context-persistence). + + System.String + + System.String + + + None + + + Credential + + Specifies a PSCredential object. For more information about the PSCredential object, type `Get-Help Get-Credential`. The PSCredential object provides the user ID and password for organizational ID credentials, or the application ID and secret for service principal credentials. + + System.Management.Automation.PSCredential + + System.Management.Automation.PSCredential + + + None + + + DefaultProfile + + The credentials, account, tenant, and subscription used for communication with Azure. + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + + None + + + Environment + + Environment containing the Azure account. + + System.String + + System.String + + + None + + + Force + + Overwrite the existing context with the same name without prompting. + + + System.Management.Automation.SwitchParameter + + + False + + + MaxContextPopulation + + Max subscription number to populate contexts after login. Default is 25. To populate all subscriptions to contexts, set to -1. + + System.Int32 + + System.Int32 + + + None + + + Scope + + Determines the scope of context changes, for example, whether changes apply only to the current process, or to all sessions started by this user. + + + Process + CurrentUser + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + + None + + + ServicePrincipal + + Indicates that this account authenticates by providing service principal credentials. + + + System.Management.Automation.SwitchParameter + + + False + + + SkipContextPopulation + + Skips context population if no contexts are found. + + + System.Management.Automation.SwitchParameter + + + False + + + Subscription + + Subscription Name or ID. + + System.String + + System.String + + + None + + + Tenant + + Optional tenant name or ID. + > [!NOTE] > Due to limitations of the current API, you must use a tenant ID instead of a tenant name when > connecting with a business-to-business (B2B) account. + + System.String + + System.String + + + None + + + Confirm + + Prompts you for confirmation before running the cmdlet. + + + System.Management.Automation.SwitchParameter + + + False + + + WhatIf + + Shows what would happen if the cmdlet runs. The cmdlet is not run. + + + System.Management.Automation.SwitchParameter + + + False + + + + Connect-AzAccount + + AuthScope + + Optional OAuth scope for login, supported pre-defined values: AadGraph, AnalysisServices, Attestation, Batch, DataLake, KeyVault, OperationalInsights, Storage, Synapse. It also supports resource id like `https://storage.azure.com/`. + + System.String + + System.String + + + None + + + ContextName + + Name of the default Azure context for this login. For more information about Azure contexts, see Azure PowerShell context objects (/powershell/azure/context-persistence). + + System.String + + System.String + + + None + + + Credential + + Specifies a PSCredential object. For more information about the PSCredential object, type `Get-Help Get-Credential`. The PSCredential object provides the user ID and password for organizational ID credentials, or the application ID and secret for service principal credentials. + + System.Management.Automation.PSCredential + + System.Management.Automation.PSCredential + + + None + + + DefaultProfile + + The credentials, account, tenant, and subscription used for communication with Azure. + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + + None + + + Environment + + Environment containing the Azure account. + + System.String + + System.String + + + None + + + Force + + Overwrite the existing context with the same name without prompting. + + + System.Management.Automation.SwitchParameter + + + False + + + MaxContextPopulation + + Max subscription number to populate contexts after login. Default is 25. To populate all subscriptions to contexts, set to -1. + + System.Int32 + + System.Int32 + + + None + + + Scope + + Determines the scope of context changes, for example, whether changes apply only to the current process, or to all sessions started by this user. + + + Process + CurrentUser + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + + None + + + SkipContextPopulation + + Skips context population if no contexts are found. + + + System.Management.Automation.SwitchParameter + + + False + + + Subscription + + Subscription Name or ID. + + System.String + + System.String + + + None + + + Tenant + + Optional tenant name or ID. + > [!NOTE] > Due to limitations of the current API, you must use a tenant ID instead of a tenant name when > connecting with a business-to-business (B2B) account. + + System.String + + System.String + + + None + + + Confirm + + Prompts you for confirmation before running the cmdlet. + + + System.Management.Automation.SwitchParameter + + + False + + + WhatIf + + Shows what would happen if the cmdlet runs. The cmdlet is not run. + + + System.Management.Automation.SwitchParameter + + + False + + + + + + AccessToken + + Specifies an access token. + > [!CAUTION] > Access tokens are a type of credential. You should take the appropriate security precautions to > keep them confidential. Access tokens also timeout and may prevent long running tasks from > completing. + + System.String + + System.String + + + None + + + AccountId + + Account Id / User Id / User Name to login with in Default (UserWithSubscriptionId) parameter set; Account ID for access token in AccessToken parameter set; Account ID for managed service in ManagedService parameter set. Can be a managed service resource ID, or the associated client ID. To use the system assigned identity, leave this field blank. + + System.String + + System.String + + + None + + + ApplicationId + + Application ID of the service principal. + + System.String + + System.String + + + None + + + AuthScope + + Optional OAuth scope for login, supported pre-defined values: AadGraph, AnalysisServices, Attestation, Batch, DataLake, KeyVault, OperationalInsights, Storage, Synapse. It also supports resource id like `https://storage.azure.com/`. + + System.String + + System.String + + + None + + + CertificatePassword + + The password required to access the pkcs#12 certificate file. + + System.Security.SecureString + + System.Security.SecureString + + + None + + + CertificatePath + + The path of certficate file in pkcs#12 format. + + System.String + + System.String + + + None + + + CertificateThumbprint + + Certificate Hash or Thumbprint. + + System.String + + System.String + + + None + + + ContextName + + Name of the default Azure context for this login. For more information about Azure contexts, see Azure PowerShell context objects (/powershell/azure/context-persistence). + + System.String + + System.String + + + None + + + Credential + + Specifies a PSCredential object. For more information about the PSCredential object, type `Get-Help Get-Credential`. The PSCredential object provides the user ID and password for organizational ID credentials, or the application ID and secret for service principal credentials. + + System.Management.Automation.PSCredential + + System.Management.Automation.PSCredential + + + None + + + DefaultProfile + + The credentials, account, tenant, and subscription used for communication with Azure. + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + + None + + + Environment + + Environment containing the Azure account. + + System.String + + System.String + + + None + + + FederatedToken + + Specifies a token provided by another identity provider. The issuer and subject in this token must be first configured to be trusted by the ApplicationId. + > [!CAUTION] > Federated tokens are a type of credential. You should take the appropriate security precautions to keep them confidential. Federated tokens also timeout and may prevent long running tasks from completing. + + System.String + + System.String + + + None + + + Force + + Overwrite the existing context with the same name without prompting. + + System.Management.Automation.SwitchParameter + + System.Management.Automation.SwitchParameter + + + False + + + GraphAccessToken + + AccessToken for Graph Service. + + System.String + + System.String + + + None + + + Identity + + Login using a Managed Service Identity. + + System.Management.Automation.SwitchParameter + + System.Management.Automation.SwitchParameter + + + False + + + KeyVaultAccessToken + + AccessToken for KeyVault Service. + + System.String + + System.String + + + None + + + MaxContextPopulation + + Max subscription number to populate contexts after login. Default is 25. To populate all subscriptions to contexts, set to -1. + + System.Int32 + + System.Int32 + + + None + + + MicrosoftGraphAccessToken + + Access token to Microsoft Graph + + System.String + + System.String + + + None + + + Scope + + Determines the scope of context changes, for example, whether changes apply only to the current process, or to all sessions started by this user. + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + + None + + + SendCertificateChain + + Specifies if the x5c claim (public key of the certificate) should be sent to the STS to achieve easy certificate rollover in Azure AD. + + System.Management.Automation.SwitchParameter + + System.Management.Automation.SwitchParameter + + + False + + + ServicePrincipal + + Indicates that this account authenticates by providing service principal credentials. + + System.Management.Automation.SwitchParameter + + System.Management.Automation.SwitchParameter + + + False + + + SkipContextPopulation + + Skips context population if no contexts are found. + + System.Management.Automation.SwitchParameter + + System.Management.Automation.SwitchParameter + + + False + + + SkipValidation + + Skip validation for access token. + + System.Management.Automation.SwitchParameter + + System.Management.Automation.SwitchParameter + + + False + + + Subscription + + Subscription Name or ID. + + System.String + + System.String + + + None + + + Tenant + + Optional tenant name or ID. + > [!NOTE] > Due to limitations of the current API, you must use a tenant ID instead of a tenant name when > connecting with a business-to-business (B2B) account. + + System.String + + System.String + + + None + + + UseDeviceAuthentication + + Use device code authentication instead of a browser control. + + System.Management.Automation.SwitchParameter + + System.Management.Automation.SwitchParameter + + + False + + + Confirm + + Prompts you for confirmation before running the cmdlet. + + System.Management.Automation.SwitchParameter + + System.Management.Automation.SwitchParameter + + + False + + + WhatIf + + Shows what would happen if the cmdlet runs. The cmdlet is not run. + + System.Management.Automation.SwitchParameter + + System.Management.Automation.SwitchParameter + + + False + + + + + + System.String + + + + + + + + + + Microsoft.Azure.Commands.Profile.Models.Core.PSAzureProfile + + + + + + + + + + + + + + ------------ Example 1: Connect to an Azure account ------------ + Connect-AzAccount + +Account SubscriptionName TenantId Environment +------- ---------------- -------- ----------- +azureuser@contoso.com Subscription1 xxxx-xxxx-xxxx-xxxx AzureCloud + + + + + + + + Example 2: Connect to Azure using organizational ID credentials + $Credential = Get-Credential +Connect-AzAccount -Credential $Credential + +Account SubscriptionName TenantId Environment +------- ---------------- -------- ----------- +azureuser@contoso.com Subscription1 xxxx-xxxx-xxxx-xxxx AzureCloud + + + + + + + + Example 3: Connect to Azure using a service principal account + $Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $ApplicationId, $SecuredPassword +Connect-AzAccount -ServicePrincipal -TenantId $TenantId -Credential $Credential + +Account SubscriptionName TenantId Environment +------- ---------------- -------- ----------- +xxxx-xxxx-xxxx-xxxx Subscription1 xxxx-xxxx-xxxx-xxxx AzureCloud + + + + + + + + Example 4: Use an interactive login to connect to a specific tenant and subscription + Connect-AzAccount -Tenant 'xxxx-xxxx-xxxx-xxxx' -SubscriptionId 'yyyy-yyyy-yyyy-yyyy' + +Account SubscriptionName TenantId Environment +------- ---------------- -------- ----------- +azureuser@contoso.com Subscription1 xxxx-xxxx-xxxx-xxxx AzureCloud + + + + + + + + ----- Example 5: Connect using a Managed Service Identity ----- + Connect-AzAccount -Identity + +Account SubscriptionName TenantId Environment +------- ---------------- -------- ----------- +MSI@50342 Subscription1 xxxx-xxxx-xxxx-xxxx AzureCloud + + + + + + + + Example 6: Connect using Managed Service Identity login and ClientId + $identity = Get-AzUserAssignedIdentity -ResourceGroupName 'myResourceGroup' -Name 'myUserAssignedIdentity' +Get-AzVM -ResourceGroupName contoso -Name testvm | Update-AzVM -IdentityType UserAssigned -IdentityId $identity.Id +Connect-AzAccount -Identity -AccountId $identity.ClientId # Run on the virtual machine + +Account SubscriptionName TenantId Environment +------- ---------------- -------- ----------- +yyyy-yyyy-yyyy-yyyy Subscription1 xxxx-xxxx-xxxx-xxxx AzureCloud + + + + + + + + ------------ Example 7: Connect using certificates ------------ + $Thumbprint = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' +$TenantId = 'yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyy' +$ApplicationId = '00000000-0000-0000-0000-00000000' +Connect-AzAccount -CertificateThumbprint $Thumbprint -ApplicationId $ApplicationId -Tenant $TenantId -ServicePrincipal + +Account SubscriptionName TenantId Environment +------- ---------------- -------- ----------- +xxxxxxxx-xxxx-xxxx-xxxxxxxxx Subscription1 yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyy AzureCloud + +Account : xxxxxxxx-xxxx-xxxx-xxxxxxxx +SubscriptionName : MyTestSubscription +SubscriptionId : zzzzzzzz-zzzz-zzzz-zzzz-zzzzzzzz +TenantId : yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyy +Environment : AzureCloud + + + + + + + + -------------- Example 8: Connect with AuthScope -------------- + Connect-AzAccount -AuthScope Storage + +Account SubscriptionName TenantId Environment +------- ---------------- -------- ----------- +yyyy-yyyy-yyyy-yyyy Subscription1 xxxx-xxxx-xxxx-xxxx AzureCloud + + + + + + + + ---------- Example 9: Connect using certificate file ---------- + $securePassword = $plainPassword | ConvertTo-SecureString -AsPlainText -Force +$TenantId = 'yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyy' +$ApplicationId = 'zzzzzzzz-zzzz-zzzz-zzzz-zzzzzzzz' +Connect-AzAccount -ServicePrincipal -ApplicationId $ApplicationId -TenantId $TenantId -CertificatePath './certificatefortest.pfx' -CertificatePassword $securePassword + +Account SubscriptionName TenantId Environment +------- ---------------- -------- ----------- +xxxxxxxx-xxxx-xxxx-xxxxxxxx Subscription1 yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyy AzureCloud + + + + + + + + + + Online Version: + https://learn.microsoft.com/powershell/module/az.accounts/connect-azaccount + + + + + + Disable-AzContextAutosave + Disable + AzContextAutosave + + Turn off autosaving Azure credentials. Your login information will be forgotten the next time you open a PowerShell window + + + + Turn off autosaving Azure credentials. Your login information will be forgotten the next time you open a PowerShell window + + + + Disable-AzContextAutosave + + DefaultProfile + + The credentials, tenant and subscription used for communication with azure + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + + None + + + Scope + + Determines the scope of context changes, for example, whether changes apply only to the current process, or to all sessions started by this user + + + Process + CurrentUser + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + + None + + + Confirm + + Prompts you for confirmation before running the cmdlet. + + + System.Management.Automation.SwitchParameter + + + False + + + WhatIf + + Shows what would happen if the cmdlet runs. The cmdlet is not run. + + + System.Management.Automation.SwitchParameter + + + False + + + + + + DefaultProfile + + The credentials, tenant and subscription used for communication with azure + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + + None + + + Scope + + Determines the scope of context changes, for example, whether changes apply only to the current process, or to all sessions started by this user + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + + None + + + Confirm + + Prompts you for confirmation before running the cmdlet. + + System.Management.Automation.SwitchParameter + + System.Management.Automation.SwitchParameter + + + False + + + WhatIf + + Shows what would happen if the cmdlet runs. The cmdlet is not run. + + System.Management.Automation.SwitchParameter + + System.Management.Automation.SwitchParameter + + + False + + + + + + None + + + + + + + + + + Microsoft.Azure.Commands.Common.Authentication.ContextAutosaveSettings + + + + + + + + + + + + + + ---------- Example 1: Disable autosaving the context ---------- + Disable-AzContextAutosave + + Disable autosave for the current user. + + + + + + -------------------------- Example 2 -------------------------- + <!-- Aladdin Generated Example --> +Disable-AzContextAutosave -Scope Process + + + + + + + + + + Online Version: + https://learn.microsoft.com/powershell/module/az.accounts/disable-azcontextautosave + + + + + + Disable-AzDataCollection + Disable + AzDataCollection + + Opts out of collecting data to improve the Azure PowerShell cmdlets. Data is collected by default unless you explicitly opt out. + + + + The `Disable-AzDataCollection` cmdlet is used to opt out of data collection. Azure PowerShell automatically collects telemetry data by default. To disable data collection, you must explicitly opt-out. Microsoft aggregates collected data to identify patterns of usage, to identify common issues, and to improve the experience of Azure PowerShell. Microsoft Azure PowerShell doesn't collect any private or personal data. If you've previously opted out, run the `Enable-AzDataCollection` cmdlet to re-enable data collection for the current user on the current machine. + + + + Disable-AzDataCollection + + DefaultProfile + + The credentials, account, tenant, and subscription used for communication with Azure. + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + + None + + + Confirm + + Prompts you for confirmation before running the cmdlet. + + + System.Management.Automation.SwitchParameter + + + False + + + WhatIf + + Shows what would happen if the cmdlet runs. The cmdlet is not run. + + + System.Management.Automation.SwitchParameter + + + False + + + + + + DefaultProfile + + The credentials, account, tenant, and subscription used for communication with Azure. + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + + None + + + Confirm + + Prompts you for confirmation before running the cmdlet. + + System.Management.Automation.SwitchParameter + + System.Management.Automation.SwitchParameter + + + False + + + WhatIf + + Shows what would happen if the cmdlet runs. The cmdlet is not run. + + System.Management.Automation.SwitchParameter + + System.Management.Automation.SwitchParameter + + + False + + + + + + None + + + + + + + + + + System.Void + + + + + + + + + + + + + + -- Example 1: Disabling data collection for the current user -- + Disable-AzDataCollection + + + + + + + + + + Online Version: + https://learn.microsoft.com/powershell/module/az.accounts/disable-azdatacollection + + + Enable-AzDataCollection + + + + + + + Disable-AzureRmAlias + Disable + AzureRmAlias + + Disables AzureRm prefix aliases for Az modules. + + + + Disables AzureRm prefix aliases for Az modules. If -Module is specified, only modules listed will have aliases disabled. Otherwise all AzureRm aliases are disabled. + + + + Disable-AzureRmAlias + + DefaultProfile + + The credentials, account, tenant, and subscription used for communication with Azure. + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + + None + + + Module + + Indicates which modules to disable aliases for. If none are specified, default is all enabled modules. + + System.String[] + + System.String[] + + + None + + + PassThru + + If specified, cmdlet will return all disabled aliases + + + System.Management.Automation.SwitchParameter + + + False + + + Scope + + Indicates what scope aliases should be disabled for. Default is 'Process' + + + Process + CurrentUser + LocalMachine + + System.String + + System.String + + + None + + + Confirm + + Prompts you for confirmation before running the cmdlet. + + + System.Management.Automation.SwitchParameter + + + False + + + WhatIf + + Shows what would happen if the cmdlet runs. The cmdlet is not run. + + + System.Management.Automation.SwitchParameter + + + False + + + + + + DefaultProfile + + The credentials, account, tenant, and subscription used for communication with Azure. + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + + None + + + Module + + Indicates which modules to disable aliases for. If none are specified, default is all enabled modules. + + System.String[] + + System.String[] + + + None + + + PassThru + + If specified, cmdlet will return all disabled aliases + + System.Management.Automation.SwitchParameter + + System.Management.Automation.SwitchParameter + + + False + + + Scope + + Indicates what scope aliases should be disabled for. Default is 'Process' + + System.String + + System.String + + + None + + + Confirm + + Prompts you for confirmation before running the cmdlet. + + System.Management.Automation.SwitchParameter + + System.Management.Automation.SwitchParameter + + + False + + + WhatIf + + Shows what would happen if the cmdlet runs. The cmdlet is not run. + + System.Management.Automation.SwitchParameter + + System.Management.Automation.SwitchParameter + + + False + + + + + + None + + + + + + + + + + System.String + + + + + + + + + + + + + + -------------------------- Example 1 -------------------------- + Disable-AzureRmAlias + + Disables all AzureRm prefixes for the current PowerShell session. + + + + + + -------------------------- Example 2 -------------------------- + Disable-AzureRmAlias -Module Az.Accounts -Scope CurrentUser + + Disables AzureRm aliases for the Az.Accounts module for both the current process and for the current user. + + + + + + + + Online Version: + https://learn.microsoft.com/powershell/module/az.accounts/disable-azurermalias + + + + + + Disconnect-AzAccount + Disconnect + AzAccount + + Disconnects a connected Azure account and removes all credentials and contexts associated with that account. + + + + The Disconnect-AzAccount cmdlet disconnects a connected Azure account and removes all credentials and contexts (subscription and tenant information) associated with that account. After executing this cmdlet, you will need to login again using Connect-AzAccount. + + + + Disconnect-AzAccount + + ApplicationId + + ServicePrincipal id (globally unique id) + + System.String + + System.String + + + None + + + DefaultProfile + + The credentials, tenant and subscription used for communication with azure + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + + None + + + Scope + + Determines the scope of context changes, for example, whether changes apply only to the current process, or to all sessions started by this user. + + + Process + CurrentUser + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + + None + + + TenantId + + Tenant id (globally unique id) + + System.String + + System.String + + + None + + + Confirm + + Prompts you for confirmation before running the cmdlet. + + + System.Management.Automation.SwitchParameter + + + False + + + WhatIf + + Shows what would happen if the cmdlet runs. The cmdlet is not executed. + + + System.Management.Automation.SwitchParameter + + + False + + + + Disconnect-AzAccount + + AzureContext + + Context + + Microsoft.Azure.Commands.Profile.Models.Core.PSAzureContext + + Microsoft.Azure.Commands.Profile.Models.Core.PSAzureContext + + + None + + + DefaultProfile + + The credentials, tenant and subscription used for communication with azure + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + + None + + + Scope + + Determines the scope of context changes, for example, whether changes apply only to the current process, or to all sessions started by this user. + + + Process + CurrentUser + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + + None + + + Confirm + + Prompts you for confirmation before running the cmdlet. + + + System.Management.Automation.SwitchParameter + + + False + + + WhatIf + + Shows what would happen if the cmdlet runs. The cmdlet is not executed. + + + System.Management.Automation.SwitchParameter + + + False + + + + Disconnect-AzAccount + + ContextName + + Name of the context to log out of + + System.String + + System.String + + + None + + + DefaultProfile + + The credentials, tenant and subscription used for communication with azure + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + + None + + + Scope + + Determines the scope of context changes, for example, whether changes apply only to the current process, or to all sessions started by this user. + + + Process + CurrentUser + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + + None + + + Confirm + + Prompts you for confirmation before running the cmdlet. + + + System.Management.Automation.SwitchParameter + + + False + + + WhatIf + + Shows what would happen if the cmdlet runs. The cmdlet is not executed. + + + System.Management.Automation.SwitchParameter + + + False + + + + Disconnect-AzAccount + + InputObject + + The account object to remove + + Microsoft.Azure.Commands.Profile.Models.PSAzureRmAccount + + Microsoft.Azure.Commands.Profile.Models.PSAzureRmAccount + + + None + + + DefaultProfile + + The credentials, tenant and subscription used for communication with azure + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + + None + + + Scope + + Determines the scope of context changes, for example, whether changes apply only to the current process, or to all sessions started by this user. + + + Process + CurrentUser + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + + None + + + Confirm + + Prompts you for confirmation before running the cmdlet. + + + System.Management.Automation.SwitchParameter + + + False + + + WhatIf + + Shows what would happen if the cmdlet runs. The cmdlet is not executed. + + + System.Management.Automation.SwitchParameter + + + False + + + + Disconnect-AzAccount + + Username + + User name of the form 'user@contoso.org' + + System.String + + System.String + + + None + + + DefaultProfile + + The credentials, tenant and subscription used for communication with azure + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + + None + + + Scope + + Determines the scope of context changes, for example, whether changes apply only to the current process, or to all sessions started by this user. + + + Process + CurrentUser + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + + None + + + Confirm + + Prompts you for confirmation before running the cmdlet. + + + System.Management.Automation.SwitchParameter + + + False + + + WhatIf + + Shows what would happen if the cmdlet runs. The cmdlet is not executed. + + + System.Management.Automation.SwitchParameter + + + False + + + + + + ApplicationId + + ServicePrincipal id (globally unique id) + + System.String + + System.String + + + None + + + AzureContext + + Context + + Microsoft.Azure.Commands.Profile.Models.Core.PSAzureContext + + Microsoft.Azure.Commands.Profile.Models.Core.PSAzureContext + + + None + + + ContextName + + Name of the context to log out of + + System.String + + System.String + + + None + + + DefaultProfile + + The credentials, tenant and subscription used for communication with azure + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + + None + + + InputObject + + The account object to remove + + Microsoft.Azure.Commands.Profile.Models.PSAzureRmAccount + + Microsoft.Azure.Commands.Profile.Models.PSAzureRmAccount + + + None + + + Scope + + Determines the scope of context changes, for example, whether changes apply only to the current process, or to all sessions started by this user. + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + + None + + + TenantId + + Tenant id (globally unique id) + + System.String + + System.String + + + None + + + Username + + User name of the form 'user@contoso.org' + + System.String + + System.String + + + None + + + Confirm + + Prompts you for confirmation before running the cmdlet. + + System.Management.Automation.SwitchParameter + + System.Management.Automation.SwitchParameter + + + False + + + WhatIf + + Shows what would happen if the cmdlet runs. The cmdlet is not executed. + + System.Management.Automation.SwitchParameter + + System.Management.Automation.SwitchParameter + + + False + + + + + + Microsoft.Azure.Commands.Profile.Models.PSAzureRmAccount + + + + + + + + Microsoft.Azure.Commands.Profile.Models.Core.PSAzureContext + + + + + + + + + + Microsoft.Azure.Commands.Profile.Models.PSAzureRmAccount + + + + + + + + + + + + + + ----------- Example 1: Logout of the current account ----------- + Disconnect-AzAccount + + Logs out of the Azure account associated with the current context. + + + + + + Example 2: Logout of the account associated with a particular context + Get-AzContext "Work" | Disconnect-AzAccount -Scope CurrentUser + + Logs out the account associated with the given context (named 'Work'). Because this uses the 'CurrentUser' scope, all credentials and contexts will be permanently deleted. + + + + + + ------------- Example 3: Log out a particular user ------------- + Disconnect-AzAccount -Username 'user1@contoso.org' + + Logs out the 'user1@contoso.org' user - all credentials and all contexts associated with this user will be removed. + + + + + + + + Online Version: + https://learn.microsoft.com/powershell/module/az.accounts/disconnect-azaccount + + + + + + Enable-AzContextAutosave + Enable + AzContextAutosave + + Azure contexts are PowerShell objects representing your active subscription to run commands against, and the authentication information needed to connect to an Azure cloud. With Azure contexts, Azure PowerShell doesn't need to reauthenticate your account each time you switch subscriptions. For more information, see Azure PowerShell context objects (https://learn.microsoft.com/powershell/azure/context-persistence). + This cmdlet allows the Azure context information to be saved and automatically loaded when you start a PowerShell process. For example, when opening a new window. + + + + Allows the Azure context information to be saved and automatically loaded when a PowerShell process starts. The context is saved at the end of the execution of any cmdlet that affects the context. For example, any profile cmdlet. If you're using user authentication, then tokens can be updated during the course of running any cmdlet. + + + + Enable-AzContextAutosave + + DefaultProfile + + The credentials, tenant, and subscription used for communication with Azure + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + + None + + + Scope + + Determines the scope of context changes. For example, whether changes apply only to the current process, or to all sessions started by this user. Changes made with the scope `CurrentUser` will affect all PowerShell sessions started by the user. If a particular session needs to have different settings, use the scope `Process`. + + + Process + CurrentUser + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + + CurrentUser + + + Confirm + + Prompts you for confirmation before running the cmdlet. + + + System.Management.Automation.SwitchParameter + + + False + + + WhatIf + + Shows what would happen if the cmdlet runs. The cmdlet isn't run. + + + System.Management.Automation.SwitchParameter + + + False + + + + + + DefaultProfile + + The credentials, tenant, and subscription used for communication with Azure + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + + None + + + Scope + + Determines the scope of context changes. For example, whether changes apply only to the current process, or to all sessions started by this user. Changes made with the scope `CurrentUser` will affect all PowerShell sessions started by the user. If a particular session needs to have different settings, use the scope `Process`. + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + + CurrentUser + + + Confirm + + Prompts you for confirmation before running the cmdlet. + + System.Management.Automation.SwitchParameter + + System.Management.Automation.SwitchParameter + + + False + + + WhatIf + + Shows what would happen if the cmdlet runs. The cmdlet isn't run. + + System.Management.Automation.SwitchParameter + + System.Management.Automation.SwitchParameter + + + False + + + + + + None + + + + + + + + + + Microsoft.Azure.Commands.Common.Authentication.ContextAutosaveSettings + + + + + + + + + + + + + + Example 1: Enable autosaving credentials for the current user + Enable-AzContextAutosave + + + + + + + + -------------------------- Example 2 -------------------------- + <!-- Aladdin Generated Example --> +Enable-AzContextAutosave -Scope Process + + + + + + + + + + Online Version: + https://learn.microsoft.com/powershell/module/az.accounts/enable-azcontextautosave + + + + + + Enable-AzDataCollection + Enable + AzDataCollection + + Enables Azure PowerShell to collect data to improve the user experience with the Azure PowerShell cmdlets. Executing this cmdlet opts in to data collection for the current user on the current machine. Data is collected by default unless you explicitly opt out. + + + + The `Enable-AzDataCollection` cmdlet is used to opt in to data collection. Azure PowerShell automatically collects telemetry data by default. Microsoft aggregates collected data to identify patterns of usage, to identify common issues, and to improve the experience of Azure PowerShell. Microsoft Azure PowerShell doesn't collect any private or personal data. To disable data collection, you must explicitly opt out by executing `Disable-AzDataCollection`. + + + + Enable-AzDataCollection + + DefaultProfile + + The credentials, account, tenant, and subscription used for communication with Azure. + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + + None + + + Confirm + + Prompts you for confirmation before running the cmdlet. + + + System.Management.Automation.SwitchParameter + + + False + + + WhatIf + + Shows what would happen if the cmdlet runs. The cmdlet is not run. + + + System.Management.Automation.SwitchParameter + + + False + + + + + + DefaultProfile + + The credentials, account, tenant, and subscription used for communication with Azure. + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + + None + + + Confirm + + Prompts you for confirmation before running the cmdlet. + + System.Management.Automation.SwitchParameter + + System.Management.Automation.SwitchParameter + + + False + + + WhatIf + + Shows what would happen if the cmdlet runs. The cmdlet is not run. + + System.Management.Automation.SwitchParameter + + System.Management.Automation.SwitchParameter + + + False + + + + + + None + + + + + + + + + + System.Void + + + + + + + + + + + + + + --- Example 1: Enabling data collection for the current user --- + Enable-AzDataCollection + + + + + + + + + + Online Version: + https://learn.microsoft.com/powershell/module/az.accounts/enable-azdatacollection + + + Disable-AzDataCollection + + + + + + + Enable-AzureRmAlias + Enable + AzureRmAlias + + Enables AzureRm prefix aliases for Az modules. + + + + Enables AzureRm prefix aliases for Az modules. If -Module is specified, only modules listed will have aliases enabled. Otherwise all AzureRm aliases are enabled. + + + + Enable-AzureRmAlias + + DefaultProfile + + The credentials, account, tenant, and subscription used for communication with Azure. + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + + None + + + Module + + Indicates which modules to enable aliases for. If none are specified, default is all modules. + + System.String[] + + System.String[] + + + None + + + PassThru + + If specified, cmdlet will return all aliases enabled + + + System.Management.Automation.SwitchParameter + + + False + + + Scope + + Indicates what scope aliases should be enabled for. Default is 'Local' + + + Local + Process + CurrentUser + LocalMachine + + System.String + + System.String + + + None + + + Confirm + + Prompts you for confirmation before running the cmdlet. + + + System.Management.Automation.SwitchParameter + + + False + + + WhatIf + + Shows what would happen if the cmdlet runs. The cmdlet is not run. + + + System.Management.Automation.SwitchParameter + + + False + + + + + + DefaultProfile + + The credentials, account, tenant, and subscription used for communication with Azure. + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + + None + + + Module + + Indicates which modules to enable aliases for. If none are specified, default is all modules. + + System.String[] + + System.String[] + + + None + + + PassThru + + If specified, cmdlet will return all aliases enabled + + System.Management.Automation.SwitchParameter + + System.Management.Automation.SwitchParameter + + + False + + + Scope + + Indicates what scope aliases should be enabled for. Default is 'Local' + + System.String + + System.String + + + None + + + Confirm + + Prompts you for confirmation before running the cmdlet. + + System.Management.Automation.SwitchParameter + + System.Management.Automation.SwitchParameter + + + False + + + WhatIf + + Shows what would happen if the cmdlet runs. The cmdlet is not run. + + System.Management.Automation.SwitchParameter + + System.Management.Automation.SwitchParameter + + + False + + + + + + None + + + + + + + + + + System.String + + + + + + + + + + + + + + -------------------------- Example 1 -------------------------- + Enable-AzureRmAlias + + Enables all AzureRm prefixes for the current PowerShell session. + + + + + + -------------------------- Example 2 -------------------------- + Enable-AzureRmAlias -Module Az.Accounts -Scope CurrentUser + + Enables AzureRm aliases for the Az.Accounts module for both the current process and for the current user. + + + + + + + + Online Version: + https://learn.microsoft.com/powershell/module/az.accounts/enable-azurermalias + + + + + + Get-AzAccessToken + Get + AzAccessToken + + Get raw access token. When using -ResourceUrl, please make sure the value does match current Azure environment. You may refer to the value of `(Get-AzContext).Environment`. + + + + Get access token + + + + Get-AzAccessToken + + DefaultProfile + + The credentials, account, tenant, and subscription used for communication with Azure. + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + + None + + + ResourceTypeName + + Optional resource type name, supported values: AadGraph, AnalysisServices, Arm, Attestation, Batch, DataLake, KeyVault, MSGraph, OperationalInsights, ResourceManager, Storage, Synapse. Default value is Arm if not specified. + + System.String + + System.String + + + None + + + TenantId + + Optional Tenant Id. Use tenant id of default context if not specified. + + System.String + + System.String + + + None + + + + Get-AzAccessToken + + DefaultProfile + + The credentials, account, tenant, and subscription used for communication with Azure. + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + + None + + + ResourceUrl + + Resource url for that you're requesting token, e.g. 'https://graph.microsoft.com/'. + + System.String + + System.String + + + None + + + TenantId + + Optional Tenant Id. Use tenant id of default context if not specified. + + System.String + + System.String + + + None + + + + + + DefaultProfile + + The credentials, account, tenant, and subscription used for communication with Azure. + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + + None + + + ResourceTypeName + + Optional resource type name, supported values: AadGraph, AnalysisServices, Arm, Attestation, Batch, DataLake, KeyVault, MSGraph, OperationalInsights, ResourceManager, Storage, Synapse. Default value is Arm if not specified. + + System.String + + System.String + + + None + + + ResourceUrl + + Resource url for that you're requesting token, e.g. 'https://graph.microsoft.com/'. + + System.String + + System.String + + + None + + + TenantId + + Optional Tenant Id. Use tenant id of default context if not specified. + + System.String + + System.String + + + None + + + + + + None + + + + + + + + + + Microsoft.Azure.Commands.Profile.Models.PSAccessToken + + + + + + + + + + + + + + ------- Example 1 Get the access token for ARM endpoint ------- + Get-AzAccessToken + + Get access token of current account for ResourceManager endpoint + + + + + + - Example 2 Get the access token for Microsoft Graph endpoint - + Get-AzAccessToken -ResourceTypeName MSGraph + + Get access token of Microsoft Graph endpoint for current account + + + + + + - Example 3 Get the access token for Microsoft Graph endpoint - + Get-AzAccessToken -ResourceUrl "https://graph.microsoft.com/" + + Get access token of Microsoft Graph endpoint for current account + + + + + + + + Online Version: + https://learn.microsoft.com/powershell/module/az.accounts/get-azaccesstoken + + + + + + Get-AzContext + Get + AzContext + + Gets the metadata used to authenticate Azure Resource Manager requests. + + + + The Get-AzContext cmdlet gets the current metadata used to authenticate Azure Resource Manager requests. This cmdlet gets the Active Directory account, Active Directory tenant, Azure subscription, and the targeted Azure environment. Azure Resource Manager cmdlets use these settings by default when making Azure Resource Manager requests. When the available amount of subscription exceeds the default limit of 25, some subscriptions may not show up in the results of `Get-AzContext -ListAvailable`. Please run `Connect-AzAccount -MaxContextPopulation <int>` to get more contexts. + + + + Get-AzContext + + DefaultProfile + + The credentials, account, tenant and subscription used for communication with azure + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + + None + + + ListAvailable + + List all available contexts in the current session. + + + System.Management.Automation.SwitchParameter + + + False + + + RefreshContextFromTokenCache + + Refresh contexts from token cache + + + System.Management.Automation.SwitchParameter + + + False + + + + Get-AzContext + + Name + + The name of the context + + System.String + + System.String + + + None + + + DefaultProfile + + The credentials, account, tenant and subscription used for communication with azure + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + + None + + + + + + DefaultProfile + + The credentials, account, tenant and subscription used for communication with azure + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + + None + + + ListAvailable + + List all available contexts in the current session. + + System.Management.Automation.SwitchParameter + + System.Management.Automation.SwitchParameter + + + False + + + Name + + The name of the context + + System.String + + System.String + + + None + + + RefreshContextFromTokenCache + + Refresh contexts from token cache + + System.Management.Automation.SwitchParameter + + System.Management.Automation.SwitchParameter + + + False + + + + + + None + + + + + + + + + + Microsoft.Azure.Commands.Profile.Models.Core.PSAzureContext + + + + + + + + + + + + + + ------------ Example 1: Getting the current context ------------ + Connect-AzAccount +Get-AzContext + +Name Account SubscriptionName Environment TenantId +---- ------- ---------------- ----------- -------- +Subscription1 (xxxxxxxx-xxxx-xxxx-xxx... test@outlook.com Subscription1 AzureCloud xxxxxxxx-x... + + In this example we are logging into our account with an Azure subscription using Connect-AzAccount, and then we are getting the context of the current session by calling Get-AzContext. + + + + + + ---------- Example 2: Listing all available contexts ---------- + Get-AzContext -ListAvailable + +Name Account SubscriptionName Environment TenantId +---- ------- ---------------- ----------- -------- +Subscription1 (xxxxxxxx-xxxx-xxxx-xxx... test@outlook.com Subscription1 AzureCloud xxxxxxxx-x... +Subscription2 (xxxxxxxx-xxxx-xxxx-xxx... test@outlook.com Subscription2 AzureCloud xxxxxxxx-x... +Subscription3 (xxxxxxxx-xxxx-xxxx-xxx... test@outlook.com Subscription3 AzureCloud xxxxxxxx-x... + + In this example, all currently available contexts are displayed. The user may select one of these contexts using Select-AzContext. + + + + + + + + Online Version: + https://learn.microsoft.com/powershell/module/az.accounts/get-azcontext + + + Set-AzContext + + + + Connect-AzAccount + + + + + + + Get-AzContextAutosaveSetting + Get + AzContextAutosaveSetting + + Display metadata about the context autosave feature, including whether the context is automatically saved, and where saved context and credential information can be found. + + + + Display metadata about the context autosave feature, including whether the context is automatically saved, and where saved context and credential information can be found. + + + + Get-AzContextAutosaveSetting + + DefaultProfile + + The credentials, account, tenant and subscription used for communication with azure + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + + None + + + Scope + + Determines the scope of context changes, for example, whether changes apply only to the current process, or to all sessions started by this user. + + + Process + CurrentUser + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + + None + + + + + + DefaultProfile + + The credentials, account, tenant and subscription used for communication with azure + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + + None + + + Scope + + Determines the scope of context changes, for example, whether changes apply only to the current process, or to all sessions started by this user. + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + + None + + + + + + None + + + + + + + + + + Microsoft.Azure.Commands.Common.Authentication.ContextAutosaveSettings + + + + + + + + + + + + + + ------ Get context save metadata for the current session ------ + Get-AzContextAutosaveSetting + +Mode : Process +ContextDirectory : None +ContextFile : None +CacheDirectory : None +CacheFile : None +Settings : {} + + Get details about whether and where the context is saved. In the above example, the autosave feature has been disabled. + + + + + + -------- Get context save metadata for the current user -------- + Get-AzContextAutosaveSetting -Scope CurrentUser + +Mode : CurrentUser +ContextDirectory : C:\Users\contoso\AppData\Roaming\Windows Azure Powershell +ContextFile : AzureRmContext.json +CacheDirectory : C:\Users\contoso\AppData\Roaming\Windows Azure Powershell +CacheFile : TokenCache.dat +Settings : {} + + Get details about whether and where the context is saved by default for the current user. Note that this may be different than the settings that are active in the current session. In the above example, the autosave feature has been enabled, and data is saved to the default location. + + + + + + + + Online Version: + https://learn.microsoft.com/powershell/module/az.accounts/get-azcontextautosavesetting + + + + + + Get-AzDefault + Get + AzDefault + + Get the defaults set by the user in the current context. + + + + The Get-AzDefault cmdlet gets the Resource Group that the user has set as default in the current context. + + + + Get-AzDefault + + DefaultProfile + + The credentials, account, tenant, and subscription used for communication with azure. + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + + None + + + ResourceGroup + + Display Default Resource Group + + + System.Management.Automation.SwitchParameter + + + False + + + + + + DefaultProfile + + The credentials, account, tenant, and subscription used for communication with azure. + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + + None + + + ResourceGroup + + Display Default Resource Group + + System.Management.Automation.SwitchParameter + + System.Management.Automation.SwitchParameter + + + False + + + + + + System.Management.Automation.SwitchParameter + + + + + + + + + + Microsoft.Azure.Commands.Profile.Models.PSResourceGroup + + + + + + + + + + + + + + -------------------------- Example 1 -------------------------- + Get-AzDefault + +Id : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup +Name : myResourceGroup +Properties : Microsoft.Azure.Management.Internal.Resources.Models.ResourceGroupProperties +Location : eastus +ManagedBy : +Tags : + + This command returns the current defaults if there are defaults set, or returns nothing if no default is set. + + + + + + -------------------------- Example 2 -------------------------- + Get-AzDefault -ResourceGroup + +Id : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup +Name : myResourceGroup +Properties : Microsoft.Azure.Management.Internal.Resources.Models.ResourceGroupProperties +Location : eastus +ManagedBy : +Tags : + + This command returns the current default Resource Group if there is a default set, or returns nothing if no default is set. + + + + + + + + Online Version: + https://learn.microsoft.com/powershell/module/az.accounts/get-azdefault + + + + + + Get-AzEnvironment + Get + AzEnvironment + + Get endpoints and metadata for an instance of Azure services. + + + + The Get-AzEnvironment cmdlet gets endpoints and metadata for an instance of Azure services. + + + + Get-AzEnvironment + + Name + + Specifies the name of the Azure instance to get. + + System.String + + System.String + + + None + + + DefaultProfile + + The credentials, account, tenant and subscription used for communication with azure. + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + + None + + + + + + DefaultProfile + + The credentials, account, tenant and subscription used for communication with azure. + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + + None + + + Name + + Specifies the name of the Azure instance to get. + + System.String + + System.String + + + None + + + + + + System.String + + + + + + + + + + Microsoft.Azure.Commands.Profile.Models.PSAzureEnvironment + + + + + + + + + + + + + + ---------- Example 1: Getting all Azure environments ---------- + Get-AzEnvironment + +Name Resource Manager Url ActiveDirectory Authority Type +---- -------------------- ------------------------- ---- +AzureUSGovernment https://management.usgovcloudapi.net/ https://login.microsoftonline.us/ Built-in +AzureGermanCloud https://management.microsoftazure.de/ https://login.microsoftonline.de/ Built-in +AzureCloud https://management.azure.com/ https://login.microsoftonline.com/ Built-in +AzureChinaCloud https://management.chinacloudapi.cn/ https://login.chinacloudapi.cn/ Built-in + + This example shows how to get the endpoints and metadata for the AzureCloud (default) environment. + + + + + + -------- Example 2: Getting the AzureCloud environment -------- + Get-AzEnvironment -Name AzureCloud + +Name Resource Manager Url ActiveDirectory Authority Type +---- -------------------- ------------------------- ---- +AzureCloud https://management.azure.com/ https://login.microsoftonline.com/ Built-in + + This example shows how to get the endpoints and metadata for the AzureCloud (default) environment. + + + + + + ------ Example 3: Getting the AzureChinaCloud environment ------ + Get-AzEnvironment -Name AzureChinaCloud | Format-List + +Name : AzureChinaCloud +Type : Built-in +EnableAdfsAuthentication : False +OnPremise : False +ActiveDirectoryServiceEndpointResourceId : https://management.core.chinacloudapi.cn/ +AdTenant : Common +GalleryUrl : https://gallery.azure.com/ +ManagementPortalUrl : https://go.microsoft.com/fwlink/?LinkId=301902 +ServiceManagementUrl : https://management.core.chinacloudapi.cn/ +PublishSettingsFileUrl : https://go.microsoft.com/fwlink/?LinkID=301776 +ResourceManagerUrl : https://management.chinacloudapi.cn/ +SqlDatabaseDnsSuffix : .database.chinacloudapi.cn +StorageEndpointSuffix : core.chinacloudapi.cn +ActiveDirectoryAuthority : https://login.chinacloudapi.cn/ +GraphUrl : https://graph.chinacloudapi.cn/ +GraphEndpointResourceId : https://graph.chinacloudapi.cn/ +TrafficManagerDnsSuffix : trafficmanager.cn +AzureKeyVaultDnsSuffix : vault.azure.cn +DataLakeEndpointResourceId : +AzureDataLakeStoreFileSystemEndpointSuffix : +AzureDataLakeAnalyticsCatalogAndJobEndpointSuffix : +AzureKeyVaultServiceEndpointResourceId : https://vault.azure.cn +ContainerRegistryEndpointSuffix : azurecr.cn +AzureOperationalInsightsEndpointResourceId : +AzureOperationalInsightsEndpoint : +AzureAnalysisServicesEndpointSuffix : asazure.chinacloudapi.cn +AnalysisServicesEndpointResourceId : https://region.asazure.chinacloudapi.cn +AzureAttestationServiceEndpointSuffix : +AzureAttestationServiceEndpointResourceId : +AzureSynapseAnalyticsEndpointSuffix : dev.azuresynapse.azure.cn +AzureSynapseAnalyticsEndpointResourceId : https://dev.azuresynapse.azure.cn + + This example shows how to get the endpoints and metadata for the AzureChinaCloud environment. + + + + + + ----- Example 4: Getting the AzureUSGovernment environment ----- + Get-AzEnvironment -Name AzureUSGovernment + +Name Resource Manager Url ActiveDirectory Authority Type +---- -------------------- ------------------------- ---- +AzureUSGovernment https://management.usgovcloudapi.net/ https://login.microsoftonline.us/ Built-in + + This example shows how to get the endpoints and metadata for the AzureUSGovernment environment. + + + + + + + + Online Version: + https://learn.microsoft.com/powershell/module/az.accounts/get-azenvironment + + + Add-AzEnvironment + + + + Remove-AzEnvironment + + + + Set-AzEnvironment + + + + + + + Get-AzSubscription + Get + AzSubscription + + Get subscriptions that the current account can access. + + + + The Get-AzSubscription cmdlet gets the subscription ID, subscription name, and home tenant for subscriptions that the current account can access. + + + + Get-AzSubscription + + AsJob + + Run cmdlet in the background and return a Job to track progress. + + + System.Management.Automation.SwitchParameter + + + False + + + DefaultProfile + + The credentials, tenant and subscription used for communication with azure + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + + None + + + SubscriptionId + + Specifies the ID of the subscription to get. + + System.String + + System.String + + + None + + + TenantId + + Specifies the ID of the tenant that contains subscriptions to get. + + System.String + + System.String + + + None + + + + Get-AzSubscription + + AsJob + + Run cmdlet in the background and return a Job to track progress. + + + System.Management.Automation.SwitchParameter + + + False + + + DefaultProfile + + The credentials, tenant and subscription used for communication with azure + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + + None + + + SubscriptionName + + Specifies the name of the subscription to get. + + System.String + + System.String + + + None + + + TenantId + + Specifies the ID of the tenant that contains subscriptions to get. + + System.String + + System.String + + + None + + + + + + AsJob + + Run cmdlet in the background and return a Job to track progress. + + System.Management.Automation.SwitchParameter + + System.Management.Automation.SwitchParameter + + + False + + + DefaultProfile + + The credentials, tenant and subscription used for communication with azure + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + + None + + + SubscriptionId + + Specifies the ID of the subscription to get. + + System.String + + System.String + + + None + + + SubscriptionName + + Specifies the name of the subscription to get. + + System.String + + System.String + + + None + + + TenantId + + Specifies the ID of the tenant that contains subscriptions to get. + + System.String + + System.String + + + None + + + + + + System.String + + + + + + + + + + Microsoft.Azure.Commands.Profile.Models.PSAzureSubscription + + + + + + + + + + + + + + ------- Example 1: Get all subscriptions in all tenants ------- + Get-AzSubscription + +Name Id TenantId State +---- -- -------- ----- +Subscription1 yyyy-yyyy-yyyy-yyyy aaaa-aaaa-aaaa-aaaa Enabled +Subscription2 xxxx-xxxx-xxxx-xxxx aaaa-aaaa-aaaa-aaaa Enabled +Subscription3 zzzz-zzzz-zzzz-zzzz bbbb-bbbb-bbbb-bbbb Enabled + + This command gets all subscriptions in all tenants that are authorized for the current account. + + + + + + ---- Example 2: Get all subscriptions for a specific tenant ---- + Get-AzSubscription -TenantId "aaaa-aaaa-aaaa-aaaa" + +Name Id TenantId State +---- -- -------- ----- +Subscription1 yyyy-yyyy-yyyy-yyyy aaaa-aaaa-aaaa-aaaa Enabled +Subscription2 xxxx-xxxx-xxxx-xxxx aaaa-aaaa-aaaa-aaaa Enabled + + List all subscriptions in the given tenant that are authorized for the current account. + + + + + + ---- Example 3: Get all subscriptions in the current tenant ---- + Get-AzSubscription + +Name Id TenantId State +---- -- -------- ----- +Subscription1 yyyy-yyyy-yyyy-yyyy aaaa-aaaa-aaaa-aaaa Enabled +Subscription2 xxxx-xxxx-xxxx-xxxx aaaa-aaaa-aaaa-aaaa Enabled + + This command gets all subscriptions in the current tenant that are authorized for the current user. + + + + + + Example 4: Change the current context to use a specific subscription + Get-AzSubscription -SubscriptionId "xxxx-xxxx-xxxx-xxxx" -TenantId "yyyy-yyyy-yyyy-yyyy" | Set-AzContext + +Name Account SubscriptionName Environment TenantId +---- ------- ---------------- ----------- -------- +Subscription1 (xxxx-xxxx-xxxx-xxxx) azureuser@micros... Subscription1 AzureCloud yyyy-yyyy-yyyy-yyyy + + This command gets the specified subscription, and then sets the current context to use it. All subsequent cmdlets in this session use the new subscription (Contoso Subscription 1) by default. + + + + + + + + Online Version: + https://learn.microsoft.com/powershell/module/az.accounts/get-azsubscription + + + + + + Get-AzTenant + Get + AzTenant + + Gets tenants that are authorized for the current user. + + + + The Get-AzTenant cmdlet gets tenants authorized for the current user. + + + + Get-AzTenant + + TenantId + + Specifies the ID of the tenant that this cmdlet gets. + + System.String + + System.String + + + None + + + DefaultProfile + + The credentials, tenant and subscription used for communication with azure + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + + None + + + + + + DefaultProfile + + The credentials, tenant and subscription used for communication with azure + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + + None + + + TenantId + + Specifies the ID of the tenant that this cmdlet gets. + + System.String + + System.String + + + None + + + + + + System.String + + + + + + + + + + Microsoft.Azure.Commands.Profile.Models.PSAzureTenant + + + + + + + + + + + + + + ---------------- Example 1: Getting all tenants ---------------- + Connect-AzAccount +Get-AzTenant + +Id Name Category Domains +-- ----------- -------- ------- +xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx Microsoft Home {test0.com, test1.com, test2.microsoft.com, test3.microsoft.com...} +yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy Testhost Home testhost.onmicrosoft.com + + This example shows how to get all of the authorized tenants of an Azure account. + + + + + + ------------- Example 2: Getting a specific tenant ------------- + Connect-AzAccount +Get-AzTenant -TenantId xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx + +Id Name Category Domains +-- ----------- -------- ------- +xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx Microsoft Home {test0.com, test1.com, test2.microsoft.com, test3.microsoft.com...} + + This example shows how to get a specific authorized tenant of an Azure account. + + + + + + + + Online Version: + https://learn.microsoft.com/powershell/module/az.accounts/get-aztenant + + + + + + Import-AzContext + Import + AzContext + + Loads Azure authentication information from a file. + + + + The Import-AzContext cmdlet loads authentication information from a file to set the Azure environment and context. Cmdlets that you run in the current session use this information to authenticate requests to Azure Resource Manager. + + + + Import-AzContext + + AzureContext + + {{Fill AzureContext Description}} + + Microsoft.Azure.Commands.Common.Authentication.Models.AzureRmProfile + + Microsoft.Azure.Commands.Common.Authentication.Models.AzureRmProfile + + + None + + + DefaultProfile + + The credentials, tenant, and subscription used for communication with azure + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + + None + + + Scope + + Determines the scope of context changes, for example, whether changes apply only to the current process, or to all sessions started by this user. + + + Process + CurrentUser + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + + None + + + Confirm + + Prompts you for confirmation before running the cmdlet. + + + System.Management.Automation.SwitchParameter + + + False + + + WhatIf + + Shows what would happen if the cmdlet runs. The cmdlet is not run. + + + System.Management.Automation.SwitchParameter + + + False + + + + Import-AzContext + + Path + + Specifies the path to context information saved by using Save-AzContext. + + System.String + + System.String + + + None + + + DefaultProfile + + The credentials, tenant, and subscription used for communication with azure + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + + None + + + Scope + + Determines the scope of context changes, for example, whether changes apply only to the current process, or to all sessions started by this user. + + + Process + CurrentUser + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + + None + + + Confirm + + Prompts you for confirmation before running the cmdlet. + + + System.Management.Automation.SwitchParameter + + + False + + + WhatIf + + Shows what would happen if the cmdlet runs. The cmdlet is not run. + + + System.Management.Automation.SwitchParameter + + + False + + + + + + AzureContext + + {{Fill AzureContext Description}} + + Microsoft.Azure.Commands.Common.Authentication.Models.AzureRmProfile + + Microsoft.Azure.Commands.Common.Authentication.Models.AzureRmProfile + + + None + + + DefaultProfile + + The credentials, tenant, and subscription used for communication with azure + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + + None + + + Path + + Specifies the path to context information saved by using Save-AzContext. + + System.String + + System.String + + + None + + + Scope + + Determines the scope of context changes, for example, whether changes apply only to the current process, or to all sessions started by this user. + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + + None + + + Confirm + + Prompts you for confirmation before running the cmdlet. + + System.Management.Automation.SwitchParameter + + System.Management.Automation.SwitchParameter + + + False + + + WhatIf + + Shows what would happen if the cmdlet runs. The cmdlet is not run. + + System.Management.Automation.SwitchParameter + + System.Management.Automation.SwitchParameter + + + False + + + + + + Microsoft.Azure.Commands.Common.Authentication.Models.AzureRmProfile + + + + + + + + System.String + + + + + + + + + + Microsoft.Azure.Commands.Profile.Models.Core.PSAzureProfile + + + + + + + + + + + + + + ----- Example 1: Importing a context from a AzureRmProfile ----- + Import-AzContext -AzContext (Connect-AzAccount) + +Account SubscriptionName TenantId Environment +------- ---------------- -------- ----------- +azureuser@contoso.com Subscription1 xxxx-xxxx-xxxx-xxxx AzureCloud + + This example imports a context from a PSAzureProfile that is passed through to the cmdlet. + + + + + + ------- Example 2: Importing a context from a JSON file ------- + Import-AzContext -Path C:\test.json + +Account SubscriptionName TenantId Environment +------- ---------------- -------- ----------- +azureuser@contoso.com Subscription1 xxxx-xxxx-xxxx-xxxx AzureCloud + + This example selects a context from a JSON file that is passed through to the cmdlet. This JSON file can be created from Save-AzContext. + + + + + + + + Online Version: + https://learn.microsoft.com/powershell/module/az.accounts/import-azcontext + + + + + + Invoke-AzRestMethod + Invoke + AzRestMethod + + Construct and perform HTTP request to Azure resource management endpoint only + + + + Construct and perform HTTP request to Azure resource management endpoint only + + + + Invoke-AzRestMethod + + ApiVersion + + Api Version + + System.String + + System.String + + + None + + + AsJob + + Run cmdlet in the background + + + System.Management.Automation.SwitchParameter + + + False + + + DefaultProfile + + The credentials, account, tenant, and subscription used for communication with Azure. + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + + None + + + Method + + Http Method + + + GET + POST + PUT + PATCH + DELETE + + System.String + + System.String + + + None + + + Name + + list of Target Resource Name + + System.String[] + + System.String[] + + + None + + + Payload + + JSON format payload + + System.String + + System.String + + + None + + + ResourceGroupName + + Target Resource Group Name + + System.String + + System.String + + + None + + + ResourceProviderName + + Target Resource Provider Name + + System.String + + System.String + + + None + + + ResourceType + + List of Target Resource Type + + System.String[] + + System.String[] + + + None + + + SubscriptionId + + Target Subscription Id + + System.String + + System.String + + + None + + + Confirm + + Prompts you for confirmation before running the cmdlet. + + + System.Management.Automation.SwitchParameter + + + False + + + WhatIf + + Shows what would happen if the cmdlet runs. The cmdlet is not run. + + + System.Management.Automation.SwitchParameter + + + False + + + + Invoke-AzRestMethod + + AsJob + + Run cmdlet in the background + + + System.Management.Automation.SwitchParameter + + + False + + + DefaultProfile + + The credentials, account, tenant, and subscription used for communication with Azure. + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + + None + + + Method + + Http Method + + + GET + POST + PUT + PATCH + DELETE + + System.String + + System.String + + + None + + + Path + + Path of target resource URL. Hostname of Resource Manager should not be added. + + System.String + + System.String + + + None + + + Payload + + JSON format payload + + System.String + + System.String + + + None + + + Confirm + + Prompts you for confirmation before running the cmdlet. + + + System.Management.Automation.SwitchParameter + + + False + + + WhatIf + + Shows what would happen if the cmdlet runs. The cmdlet is not run. + + + System.Management.Automation.SwitchParameter + + + False + + + + Invoke-AzRestMethod + + Uri + + Uniform Resource Identifier of the Azure resources. The target resource needs to support Azure AD authentication and the access token is derived according to resource id. If resource id is not set, its value is derived according to built-in service suffixes in current Azure Environment. + + System.Uri + + System.Uri + + + None + + + AsJob + + Run cmdlet in the background + + + System.Management.Automation.SwitchParameter + + + False + + + DefaultProfile + + The credentials, account, tenant, and subscription used for communication with Azure. + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + + None + + + Method + + Http Method + + + GET + POST + PUT + PATCH + DELETE + + System.String + + System.String + + + None + + + Payload + + JSON format payload + + System.String + + System.String + + + None + + + ResourceId + + Identifier URI specified by the REST API you are calling. It shouldn't be the resource id of Azure Resource Manager. + + System.Uri + + System.Uri + + + None + + + Confirm + + Prompts you for confirmation before running the cmdlet. + + + System.Management.Automation.SwitchParameter + + + False + + + WhatIf + + Shows what would happen if the cmdlet runs. The cmdlet is not run. + + + System.Management.Automation.SwitchParameter + + + False + + + + + + ApiVersion + + Api Version + + System.String + + System.String + + + None + + + AsJob + + Run cmdlet in the background + + System.Management.Automation.SwitchParameter + + System.Management.Automation.SwitchParameter + + + False + + + DefaultProfile + + The credentials, account, tenant, and subscription used for communication with Azure. + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + + None + + + Method + + Http Method + + System.String + + System.String + + + None + + + Name + + list of Target Resource Name + + System.String[] + + System.String[] + + + None + + + Path + + Path of target resource URL. Hostname of Resource Manager should not be added. + + System.String + + System.String + + + None + + + Payload + + JSON format payload + + System.String + + System.String + + + None + + + ResourceGroupName + + Target Resource Group Name + + System.String + + System.String + + + None + + + ResourceId + + Identifier URI specified by the REST API you are calling. It shouldn't be the resource id of Azure Resource Manager. + + System.Uri + + System.Uri + + + None + + + ResourceProviderName + + Target Resource Provider Name + + System.String + + System.String + + + None + + + ResourceType + + List of Target Resource Type + + System.String[] + + System.String[] + + + None + + + SubscriptionId + + Target Subscription Id + + System.String + + System.String + + + None + + + Uri + + Uniform Resource Identifier of the Azure resources. The target resource needs to support Azure AD authentication and the access token is derived according to resource id. If resource id is not set, its value is derived according to built-in service suffixes in current Azure Environment. + + System.Uri + + System.Uri + + + None + + + Confirm + + Prompts you for confirmation before running the cmdlet. + + System.Management.Automation.SwitchParameter + + System.Management.Automation.SwitchParameter + + + False + + + WhatIf + + Shows what would happen if the cmdlet runs. The cmdlet is not run. + + System.Management.Automation.SwitchParameter + + System.Management.Automation.SwitchParameter + + + False + + + + + + System.string + + + + + + + + + + Microsoft.Azure.Commands.Profile.Models.PSHttpResponse + + + + + + + + + + + + + + -------------------------- Example 1 -------------------------- + Invoke-AzRestMethod -Path "/subscriptions/{subscription}/resourcegroups/{resourcegroup}/providers/microsoft.operationalinsights/workspaces/{workspace}?api-version={API}" -Method GET + +Headers : {[Cache-Control, System.String[]], [Pragma, System.String[]], [x-ms-request-id, System.String[]], [Strict-Transport-Security, System.String[]]…} +Version : 1.1 +StatusCode : 200 +Method : GET +Content : { + "properties": { + "source": "Azure", + "customerId": "{customerId}", + "provisioningState": "Succeeded", + "sku": { + "name": "pergb2018", + "maxCapacityReservationLevel": 3000, + "lastSkuUpdate": "Mon, 25 May 2020 11:10:01 GMT" + }, + "retentionInDays": 30, + "features": { + "legacy": 0, + "searchVersion": 1, + "enableLogAccessUsingOnlyResourcePermissions": true + }, + "workspaceCapping": { + "dailyQuotaGb": -1.0, + "quotaNextResetTime": "Thu, 18 Jun 2020 05:00:00 GMT", + "dataIngestionStatus": "RespectQuota" + }, + "enableFailover": false, + "publicNetworkAccessForIngestion": "Enabled", + "publicNetworkAccessForQuery": "Enabled", + "createdDate": "Mon, 25 May 2020 11:10:01 GMT", + "modifiedDate": "Mon, 25 May 2020 11:10:02 GMT" + }, + "id": "/subscriptions/{subscription}/resourcegroups/{resourcegroup}/providers/microsoft.operationalinsights/workspaces/{workspace}", + "name": "{workspace}", + "type": "Microsoft.OperationalInsights/workspaces", + "location": "eastasia", + "tags": {} + } + + Get log analytics workspace by path. It only supports management plane API and Hostname of Azure Resource Manager is added according to Azure environment setting. + + + + + + + -------------------------- Example 2 -------------------------- + Invoke-AzRestMethod https://graph.microsoft.com/v1.0/me + +Headers : {[Date, System.String[]], [Cache-Control, System.String[]], [Transfer-Encoding, System.String[]], [Strict-Transport-Security, System.String[]]…} +Version : 1.1 +StatusCode : 200 +Method : GET +Content : {"@odata.context":"https://graph.microsoft.com/v1.0/$metadata#users/$entity","businessPhones":["......} + + Get current signed in user via MicrosoftGraph API. This example is equivalent to `Get-AzADUser -SignedIn`. + + + + + + + + Online Version: + https://learn.microsoft.com/powershell/module/az.accounts/invoke-azrestmethod + + + + + + Open-AzSurveyLink + Open + AzSurveyLink + + Open survey link in default browser. + + + + Open survey link in default browser. + + + + Open-AzSurveyLink + + + + + + + None + + + + + + + + + + + + + + + -------------------------- Example 1 -------------------------- + Open-AzSurveyLink + +Opening the default browser to https://aka.ms/azpssurvey?Q_CHL=INTERCEPT + + + + + + + + + + Online Version: + https://learn.microsoft.com/powershell/module/az.accounts/open-azsurveylink + + + + + + Register-AzModule + Register + AzModule + + FOR INTERNAL USE ONLY - Provide Runtime Support for AutoRest Generated cmdlets + + + + FOR INTERNAL USE ONLY - Provide Runtime Support for AutoRest Generated cmdlets + + + + Register-AzModule + + Confirm + + Prompts you for confirmation before running the cmdlet. + + + System.Management.Automation.SwitchParameter + + + False + + + WhatIf + + Shows what would happen if the cmdlet runs. The cmdlet is not run. + + + System.Management.Automation.SwitchParameter + + + False + + + + + + Confirm + + Prompts you for confirmation before running the cmdlet. + + System.Management.Automation.SwitchParameter + + System.Management.Automation.SwitchParameter + + + False + + + WhatIf + + Shows what would happen if the cmdlet runs. The cmdlet is not run. + + System.Management.Automation.SwitchParameter + + System.Management.Automation.SwitchParameter + + + False + + + + + + None + + + + + + + + + + System.Object + + + + + + + + + + + + + + -------------------------- Example 1 -------------------------- + Register-AzModule + + Used Internally by AutoRest-generated cmdlets + + + + + + + + Online Version: + https://learn.microsoft.com/powershell/module/az.accounts/register-azmodule + + + + + + Remove-AzContext + Remove + AzContext + + Remove a context from the set of available contexts + + + + Remove an azure context from the set of contexts + + + + Remove-AzContext + + DefaultProfile + + The credentials, tenant and subscription used for communication with azure. + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + + None + + + Force + + Remove context even if it is the default + + + System.Management.Automation.SwitchParameter + + + False + + + InputObject + + A context object, normally passed through the pipeline. + + Microsoft.Azure.Commands.Profile.Models.Core.PSAzureContext + + Microsoft.Azure.Commands.Profile.Models.Core.PSAzureContext + + + None + + + PassThru + + Return the removed context + + + System.Management.Automation.SwitchParameter + + + False + + + Scope + + Determines the scope of context changes, for example, whether changes apply only to the current process, or to all sessions started by this user + + + Process + CurrentUser + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + + None + + + Confirm + + Prompts you for confirmation before running the cmdlet. + + + System.Management.Automation.SwitchParameter + + + False + + + WhatIf + + Shows what would happen if the cmdlet runs. The cmdlet is not run. + + + System.Management.Automation.SwitchParameter + + + False + + + + Remove-AzContext + + Name + + The name of the context + + System.String + + System.String + + + None + + + DefaultProfile + + The credentials, tenant and subscription used for communication with azure. + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + + None + + + Force + + Remove context even if it is the default + + + System.Management.Automation.SwitchParameter + + + False + + + PassThru + + Return the removed context + + + System.Management.Automation.SwitchParameter + + + False + + + Scope + + Determines the scope of context changes, for example, whether changes apply only to the current process, or to all sessions started by this user + + + Process + CurrentUser + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + + None + + + Confirm + + Prompts you for confirmation before running the cmdlet. + + + System.Management.Automation.SwitchParameter + + + False + + + WhatIf + + Shows what would happen if the cmdlet runs. The cmdlet is not run. + + + System.Management.Automation.SwitchParameter + + + False + + + + + + DefaultProfile + + The credentials, tenant and subscription used for communication with azure. + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + + None + + + Force + + Remove context even if it is the default + + System.Management.Automation.SwitchParameter + + System.Management.Automation.SwitchParameter + + + False + + + InputObject + + A context object, normally passed through the pipeline. + + Microsoft.Azure.Commands.Profile.Models.Core.PSAzureContext + + Microsoft.Azure.Commands.Profile.Models.Core.PSAzureContext + + + None + + + Name + + The name of the context + + System.String + + System.String + + + None + + + PassThru + + Return the removed context + + System.Management.Automation.SwitchParameter + + System.Management.Automation.SwitchParameter + + + False + + + Scope + + Determines the scope of context changes, for example, whether changes apply only to the current process, or to all sessions started by this user + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + + None + + + Confirm + + Prompts you for confirmation before running the cmdlet. + + System.Management.Automation.SwitchParameter + + System.Management.Automation.SwitchParameter + + + False + + + WhatIf + + Shows what would happen if the cmdlet runs. The cmdlet is not run. + + System.Management.Automation.SwitchParameter + + System.Management.Automation.SwitchParameter + + + False + + + + + + Microsoft.Azure.Commands.Profile.Models.Core.PSAzureContext + + + + + + + + + + Microsoft.Azure.Commands.Profile.Models.Core.PSAzureContext + + + + + + + + + + + + + + -------------------------- Example 1 -------------------------- + Remove-AzContext -Name Default + + Remove the context named default + + + + + + + + Online Version: + https://learn.microsoft.com/powershell/module/az.accounts/remove-azcontext + + + + + + Remove-AzEnvironment + Remove + AzEnvironment + + Removes endpoints and metadata for connecting to a given Azure instance. + + + + The Remove-AzEnvironment cmdlet removes endpoints and metadata information for connecting to a given Azure instance. + + + + Remove-AzEnvironment + + Name + + Specifies the name of the environment to remove. + + System.String + + System.String + + + None + + + DefaultProfile + + The credentials, tenant and subscription used for communication with azure. + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + + None + + + Scope + + Determines the scope of context changes, for example, whether changes apply only to the current process, or to all sessions started by this user. + + + Process + CurrentUser + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + + None + + + Confirm + + Prompts you for confirmation before running the cmdlet. + + + System.Management.Automation.SwitchParameter + + + False + + + WhatIf + + Shows what would happen if the cmdlet runs. The cmdlet is not run. + + + System.Management.Automation.SwitchParameter + + + False + + + + + + DefaultProfile + + The credentials, tenant and subscription used for communication with azure. + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + + None + + + Name + + Specifies the name of the environment to remove. + + System.String + + System.String + + + None + + + Scope + + Determines the scope of context changes, for example, whether changes apply only to the current process, or to all sessions started by this user. + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + + None + + + Confirm + + Prompts you for confirmation before running the cmdlet. + + System.Management.Automation.SwitchParameter + + System.Management.Automation.SwitchParameter + + + False + + + WhatIf + + Shows what would happen if the cmdlet runs. The cmdlet is not run. + + System.Management.Automation.SwitchParameter + + System.Management.Automation.SwitchParameter + + + False + + + + + + System.String + + + + + + + + + + Microsoft.Azure.Commands.Profile.Models.PSAzureEnvironment + + + + + + + + + + + + + + ----- Example 1: Creating and removing a test environment ----- + Add-AzEnvironment -Name TestEnvironment ` + -ActiveDirectoryEndpoint TestADEndpoint ` + -ActiveDirectoryServiceEndpointResourceId TestADApplicationId ` + -ResourceManagerEndpoint TestRMEndpoint ` + -GalleryEndpoint TestGalleryEndpoint ` + -GraphEndpoint TestGraphEndpoint + +Name Resource Manager Url ActiveDirectory Authority +---- -------------------- ------------------------- +TestEnvironment TestRMEndpoint TestADEndpoint/ + +Remove-AzEnvironment -Name TestEnvironment + +Name Resource Manager Url ActiveDirectory Authority +---- -------------------- ------------------------- +TestEnvironment TestRMEndpoint TestADEndpoint/ + + This example shows how to create an environment using Add-AzEnvironment, and then how to delete the environment using Remove-AzEnvironment. + + + + + + + + Online Version: + https://learn.microsoft.com/powershell/module/az.accounts/remove-azenvironment + + + Add-AzEnvironment + + + + Get-AzEnvironment + + + + Set-AzEnvironment + + + + + + + Rename-AzContext + Rename + AzContext + + Rename an Azure context. By default contexts are named by user account and subscription. + + + + Rename an Azure context. By default contexts are named by user account and subscription. + + + + Rename-AzContext + + TargetName + + The new name of the context + + System.String + + System.String + + + None + + + DefaultProfile + + The credentials, tenant and subscription used for communication with azure + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + + None + + + Force + + Rename the context even if the target context already exists + + + System.Management.Automation.SwitchParameter + + + False + + + InputObject + + A context object, normally passed through the pipeline. + + Microsoft.Azure.Commands.Profile.Models.Core.PSAzureContext + + Microsoft.Azure.Commands.Profile.Models.Core.PSAzureContext + + + None + + + PassThru + + Return the renamed context. + + + System.Management.Automation.SwitchParameter + + + False + + + Scope + + Determines the scope of context changes, for example, whether changes apply only to the current process, or to all sessions started by this user + + + Process + CurrentUser + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + + None + + + Confirm + + Prompts you for confirmation before running the cmdlet. + + + System.Management.Automation.SwitchParameter + + + False + + + WhatIf + + Shows what would happen if the cmdlet runs. The cmdlet is not run. + + + System.Management.Automation.SwitchParameter + + + False + + + + Rename-AzContext + + SourceName + + The name of the context + + System.String + + System.String + + + None + + + TargetName + + The new name of the context + + System.String + + System.String + + + None + + + DefaultProfile + + The credentials, tenant and subscription used for communication with azure + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + + None + + + Force + + Rename the context even if the target context already exists + + + System.Management.Automation.SwitchParameter + + + False + + + PassThru + + Return the renamed context. + + + System.Management.Automation.SwitchParameter + + + False + + + Scope + + Determines the scope of context changes, for example, whether changes apply only to the current process, or to all sessions started by this user + + + Process + CurrentUser + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + + None + + + Confirm + + Prompts you for confirmation before running the cmdlet. + + + System.Management.Automation.SwitchParameter + + + False + + + WhatIf + + Shows what would happen if the cmdlet runs. The cmdlet is not run. + + + System.Management.Automation.SwitchParameter + + + False + + + + + + DefaultProfile + + The credentials, tenant and subscription used for communication with azure + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + + None + + + Force + + Rename the context even if the target context already exists + + System.Management.Automation.SwitchParameter + + System.Management.Automation.SwitchParameter + + + False + + + InputObject + + A context object, normally passed through the pipeline. + + Microsoft.Azure.Commands.Profile.Models.Core.PSAzureContext + + Microsoft.Azure.Commands.Profile.Models.Core.PSAzureContext + + + None + + + PassThru + + Return the renamed context. + + System.Management.Automation.SwitchParameter + + System.Management.Automation.SwitchParameter + + + False + + + Scope + + Determines the scope of context changes, for example, whether changes apply only to the current process, or to all sessions started by this user + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + + None + + + SourceName + + The name of the context + + System.String + + System.String + + + None + + + TargetName + + The new name of the context + + System.String + + System.String + + + None + + + Confirm + + Prompts you for confirmation before running the cmdlet. + + System.Management.Automation.SwitchParameter + + System.Management.Automation.SwitchParameter + + + False + + + WhatIf + + Shows what would happen if the cmdlet runs. The cmdlet is not run. + + System.Management.Automation.SwitchParameter + + System.Management.Automation.SwitchParameter + + + False + + + + + + Microsoft.Azure.Commands.Profile.Models.Core.PSAzureContext + + + + + + + + + + Microsoft.Azure.Commands.Profile.Models.Core.PSAzureContext + + + + + + + + + + + + + + ------ Example 1: Rename a context using named parameters ------ + Rename-AzContext -SourceName "[user1@contoso.org; 12345-6789-2345-3567890]" -TargetName "Work" + + Rename the context for 'user1@contoso.org' with subscription '12345-6789-2345-3567890' to 'Work'. After this command, you will be able to target the context using 'Select-AzContext Work'. Note that you can tab through the values for 'SourceName' using tab completion. + + + + + + --- Example 2: Rename a context using positional parameters --- + Rename-AzContext "My context" "Work" + + Rename the context named "My context" to "Work". After this command, you will be able to target the context using Select-AzContext Work + + + + + + + + Online Version: + https://learn.microsoft.com/powershell/module/az.accounts/rename-azcontext + + + + + + Resolve-AzError + Resolve + AzError + + Display detailed information about PowerShell errors, with extended details for Azure PowerShell errors. + + + + Resolves and displays detailed information about errors in the current PowerShell session, including where the error occurred in script, stack trace, and all inner and aggregate exceptions. For Azure PowerShell errors provides additional detail in debugging service issues, including complete detail about the request and server response that caused the error. + + + + Resolve-AzError + + Error + + One or more error records to resolve. If no parameters are specified, all errors in the session are resolved. + + System.Management.Automation.ErrorRecord[] + + System.Management.Automation.ErrorRecord[] + + + None + + + DefaultProfile + + The credentials, tenant and subscription used for communication with azure + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + + None + + + + Resolve-AzError + + DefaultProfile + + The credentials, tenant and subscription used for communication with azure + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + + None + + + Last + + Resolve only the last error that occurred in the session. + + + System.Management.Automation.SwitchParameter + + + False + + + + + + DefaultProfile + + The credentials, tenant and subscription used for communication with azure + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + + None + + + Error + + One or more error records to resolve. If no parameters are specified, all errors in the session are resolved. + + System.Management.Automation.ErrorRecord[] + + System.Management.Automation.ErrorRecord[] + + + None + + + Last + + Resolve only the last error that occurred in the session. + + System.Management.Automation.SwitchParameter + + System.Management.Automation.SwitchParameter + + + False + + + + + + System.Management.Automation.ErrorRecord[] + + + + + + + + + + Microsoft.Azure.Commands.Profile.Errors.AzureErrorRecord + + + + + + + + Microsoft.Azure.Commands.Profile.Errors.AzureExceptionRecord + + + + + + + + Microsoft.Azure.Commands.Profile.Errors.AzureRestExceptionRecord + + + + + + + + + + + + + + -------------- Example 1: Resolve the Last Error -------------- + Resolve-AzError -Last + +HistoryId: 3 + + +Message : Run Connect-AzAccount to login. +StackTrace : at Microsoft.Azure.Commands.ResourceManager.Common.AzureRMCmdlet.get_DefaultContext() in AzureRmCmdlet.cs:line 85 + at Microsoft.Azure.Commands.ResourceManager.Common.AzureRMCmdlet.LogCmdletStartInvocationInfo() in AzureRmCmdlet.cs:line 269 + at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.BeginProcessing() inAzurePSCmdlet.cs:line 299 + at Microsoft.Azure.Commands.ResourceManager.Common.AzureRMCmdlet.BeginProcessing() in AzureRmCmdlet.cs:line 320 + at Microsoft.Azure.Commands.Profile.GetAzureRMSubscriptionCommand.BeginProcessing() in GetAzureRMSubscription.cs:line 49 + at System.Management.Automation.Cmdlet.DoBeginProcessing() + at System.Management.Automation.CommandProcessorBase.DoBegin() +Exception : System.Management.Automation.PSInvalidOperationException +InvocationInfo : {Get-AzSubscription} +Line : Get-AzSubscription +Position : At line:1 char:1 + + Get-AzSubscription + + ~~~~~~~~~~~~~~~~~~~~~~~ +HistoryId : 3 + + Get details of the last error. + + + + + + --------- Example 2: Resolve all Errors in the Session --------- + Resolve-AzError + +HistoryId: 8 + + +RequestId : b61309e8-09c9-4f0d-ba56-08a6b28c731d +Message : Resource group 'contoso' could not be found. +ServerMessage : ResourceGroupNotFound: Resource group 'contoso' could not be found. + (System.Collections.Generic.List`1[Microsoft.Rest.Azure.CloudError]) +ServerResponse : {NotFound} +RequestMessage : {GET https://management.azure.com/subscriptions/00977cdb-163f-435f-9c32-39ec8ae61f4d/resourceGroups/co + ntoso/providers/Microsoft.Storage/storageAccounts/contoso?api-version=2016-12-01} +InvocationInfo : {Get-AzStorageAccount} +Line : Get-AzStorageAccount -ResourceGroupName contoso -Name contoso +Position : At line:1 char:1 + + Get-AzStorageAccount -ResourceGroupName contoso -Name contoso + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +StackTrace : at Microsoft.Azure.Management.Storage.StorageAccountsOperations.<GetPropertiesWithHttpMessagesAsync + >d__8.MoveNext() + --- End of stack trace from previous location where exception was thrown --- + at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() + at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) + at Microsoft.Azure.Management.Storage.StorageAccountsOperationsExtensions.<GetPropertiesAsync>d__7. + MoveNext() + --- End of stack trace from previous location where exception was thrown --- + at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() + at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) + at Microsoft.Azure.Management.Storage.StorageAccountsOperationsExtensions.GetProperties(IStorageAcc + ountsOperations operations, String resourceGroupName, String accountName) + at Microsoft.Azure.Commands.Management.Storage.GetAzureStorageAccountCommand.ExecuteCmdlet() in C:\ + zd\azure-powershell\src\ResourceManager\Storage\Commands.Management.Storage\StorageAccount\GetAzureSto + rageAccount.cs:line 70 + at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord() in + C:\zd\azure-powershell\src\Common\Commands.Common\AzurePSCmdlet.cs:line 642 +HistoryId : 8 + + + HistoryId: 5 + + +Message : Run Connect-AzAccount to login. +StackTrace : at Microsoft.Azure.Commands.ResourceManager.Common.AzureRMCmdlet.get_DefaultContext() in C:\zd\azur + e-powershell\src\ResourceManager\Common\Commands.ResourceManager.Common\AzureRmCmdlet.cs:line 85 + at Microsoft.Azure.Commands.ResourceManager.Common.AzureRMCmdlet.LogCmdletStartInvocationInfo() in + C:\zd\azure-powershell\src\ResourceManager\Common\Commands.ResourceManager.Common\AzureRmCmdlet.cs:lin + e 269 + at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.BeginProcessing() in + C:\zd\azure-powershell\src\Common\Commands.Common\AzurePSCmdlet.cs:line 299 + at Microsoft.Azure.Commands.ResourceManager.Common.AzureRMCmdlet.BeginProcessing() in C:\zd\azure-p + owershell\src\ResourceManager\Common\Commands.ResourceManager.Common\AzureRmCmdlet.cs:line 320 + at Microsoft.Azure.Commands.Profile.GetAzureRMSubscriptionCommand.BeginProcessing() in C:\zd\azure- + powershell\src\ResourceManager\Profile\Commands.Profile\Subscription\GetAzureRMSubscription.cs:line 49 + at System.Management.Automation.Cmdlet.DoBeginProcessing() + at System.Management.Automation.CommandProcessorBase.DoBegin() +Exception : System.Management.Automation.PSInvalidOperationException +InvocationInfo : {Get-AzSubscription} +Line : Get-AzSubscription +Position : At line:1 char:1 + + Get-AzSubscription + + ~~~~~~~~~~~~~~~~~~~~~~~ +HistoryId : 5 + + Get details of all errors that have occurred in the current session. + + + + + + ------------- Example 3: Resolve a Specific Error ------------- + Resolve-AzError $Error[0] + +HistoryId: 8 + + +RequestId : b61309e8-09c9-4f0d-ba56-08a6b28c731d +Message : Resource group 'contoso' could not be found. +ServerMessage : ResourceGroupNotFound: Resource group 'contoso' could not be found. + (System.Collections.Generic.List`1[Microsoft.Rest.Azure.CloudError]) +ServerResponse : {NotFound} +RequestMessage : {GET https://management.azure.com/subscriptions/00977cdb-163f-435f-9c32-39ec8ae61f4d/resourceGroups/co + ntoso/providers/Microsoft.Storage/storageAccounts/contoso?api-version=2016-12-01} +InvocationInfo : {Get-AzStorageAccount} +Line : Get-AzStorageAccount -ResourceGroupName contoso -Name contoso +Position : At line:1 char:1 + + Get-AzStorageAccount -ResourceGroupName contoso -Name contoso + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +StackTrace : at Microsoft.Azure.Management.Storage.StorageAccountsOperations.<GetPropertiesWithHttpMessagesAsync + >d__8.MoveNext() + --- End of stack trace from previous location where exception was thrown --- + at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() + at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) + at Microsoft.Azure.Management.Storage.StorageAccountsOperationsExtensions.<GetPropertiesAsync>d__7. + MoveNext() + --- End of stack trace from previous location where exception was thrown --- + at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() + at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) + at Microsoft.Azure.Management.Storage.StorageAccountsOperationsExtensions.GetProperties(IStorageAcc + ountsOperations operations, String resourceGroupName, String accountName) + at Microsoft.Azure.Commands.Management.Storage.GetAzureStorageAccountCommand.ExecuteCmdlet() in C:\ + zd\azure-powershell\src\ResourceManager\Storage\Commands.Management.Storage\StorageAccount\GetAzureSto + rageAccount.cs:line 70 + at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord() in + C:\zd\azure-powershell\src\Common\Commands.Common\AzurePSCmdlet.cs:line 642 +HistoryId : 8 + + Get details of the specified error. + + + + + + + + Online Version: + https://learn.microsoft.com/powershell/module/az.accounts/resolve-azerror + + + + + + Save-AzContext + Save + AzContext + + Saves the current authentication information for use in other PowerShell sessions. + + + + The Save-AzContext cmdlet saves the current authentication information for use in other PowerShell sessions. + + + + Save-AzContext + + Profile + + Specifies the Azure context from which this cmdlet reads. If you do not specify a context, this cmdlet reads from the local default context. + + Microsoft.Azure.Commands.Common.Authentication.Models.AzureRmProfile + + Microsoft.Azure.Commands.Common.Authentication.Models.AzureRmProfile + + + None + + + Path + + Specifies the path of the file to which to save authentication information. + + System.String + + System.String + + + None + + + DefaultProfile + + The credentials, tenant, and subscription used for communication with azure. + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + + None + + + Force + + Overwrite the given file if it exists + + + System.Management.Automation.SwitchParameter + + + False + + + Confirm + + Prompts you for confirmation before running the cmdlet. + + + System.Management.Automation.SwitchParameter + + + False + + + WhatIf + + Shows what would happen if the cmdlet runs. The cmdlet is not run. + + + System.Management.Automation.SwitchParameter + + + False + + + + + + DefaultProfile + + The credentials, tenant, and subscription used for communication with azure. + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + + None + + + Force + + Overwrite the given file if it exists + + System.Management.Automation.SwitchParameter + + System.Management.Automation.SwitchParameter + + + False + + + Path + + Specifies the path of the file to which to save authentication information. + + System.String + + System.String + + + None + + + Profile + + Specifies the Azure context from which this cmdlet reads. If you do not specify a context, this cmdlet reads from the local default context. + + Microsoft.Azure.Commands.Common.Authentication.Models.AzureRmProfile + + Microsoft.Azure.Commands.Common.Authentication.Models.AzureRmProfile + + + None + + + Confirm + + Prompts you for confirmation before running the cmdlet. + + System.Management.Automation.SwitchParameter + + System.Management.Automation.SwitchParameter + + + False + + + WhatIf + + Shows what would happen if the cmdlet runs. The cmdlet is not run. + + System.Management.Automation.SwitchParameter + + System.Management.Automation.SwitchParameter + + + False + + + + + + Microsoft.Azure.Commands.Common.Authentication.Models.AzureRmProfile + + + + + + + + + + Microsoft.Azure.Commands.Profile.Models.Core.PSAzureProfile + + + + + + + + + + + + + + ------- Example 1: Saving the current session's context ------- + Connect-AzAccount +Save-AzContext -Path C:\test.json + + This example saves the current session's Azure context to the JSON file provided. + + + + + + -------------- Example 2: Saving a given context -------------- + Save-AzContext -Profile (Connect-AzAccount) -Path C:\test.json + + This example saves the Azure context that is passed through to the cmdlet to the JSON file provided. + + + + + + + + Online Version: + https://learn.microsoft.com/powershell/module/az.accounts/save-azcontext + + + + + + Select-AzContext + Select + AzContext + + Select a subscription and account to target in Azure PowerShell cmdlets + + + + Select a subscription to target (or account or tenant) in Azure PowerShell cmdlets. After this cmdlet, future cmdlets will target the selected context. + + + + Select-AzContext + + DefaultProfile + + The credentials, tenant and subscription used for communication with azure + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + + None + + + InputObject + + A context object, normally passed through the pipeline. + + Microsoft.Azure.Commands.Profile.Models.Core.PSAzureContext + + Microsoft.Azure.Commands.Profile.Models.Core.PSAzureContext + + + None + + + Scope + + Determines the scope of context changes, for example, whether changes apply only to the current process, or to all sessions started by this user + + + Process + CurrentUser + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + + None + + + Confirm + + Prompts you for confirmation before running the cmdlet. + + + System.Management.Automation.SwitchParameter + + + False + + + WhatIf + + Shows what would happen if the cmdlet runs. The cmdlet is not run. + + + System.Management.Automation.SwitchParameter + + + False + + + + Select-AzContext + + Name + + The name of the context + + System.String + + System.String + + + None + + + DefaultProfile + + The credentials, tenant and subscription used for communication with azure + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + + None + + + Scope + + Determines the scope of context changes, for example, whether changes apply only to the current process, or to all sessions started by this user + + + Process + CurrentUser + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + + None + + + Confirm + + Prompts you for confirmation before running the cmdlet. + + + System.Management.Automation.SwitchParameter + + + False + + + WhatIf + + Shows what would happen if the cmdlet runs. The cmdlet is not run. + + + System.Management.Automation.SwitchParameter + + + False + + + + + + DefaultProfile + + The credentials, tenant and subscription used for communication with azure + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + + None + + + InputObject + + A context object, normally passed through the pipeline. + + Microsoft.Azure.Commands.Profile.Models.Core.PSAzureContext + + Microsoft.Azure.Commands.Profile.Models.Core.PSAzureContext + + + None + + + Name + + The name of the context + + System.String + + System.String + + + None + + + Scope + + Determines the scope of context changes, for example, whether changes apply only to the current process, or to all sessions started by this user + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + + None + + + Confirm + + Prompts you for confirmation before running the cmdlet. + + System.Management.Automation.SwitchParameter + + System.Management.Automation.SwitchParameter + + + False + + + WhatIf + + Shows what would happen if the cmdlet runs. The cmdlet is not run. + + System.Management.Automation.SwitchParameter + + System.Management.Automation.SwitchParameter + + + False + + + + + + Microsoft.Azure.Commands.Profile.Models.Core.PSAzureContext + + + + + + + + + + Microsoft.Azure.Commands.Profile.Models.Core.PSAzureContext + + + + + + + + + + + + + + -------------- Example 1: Target a named context -------------- + Select-AzContext "Work" + +Name Account SubscriptionName Environment TenantId +---- ------- ---------------- ----------- -------- +Work test@outlook.com Subscription1 AzureCloud xxxxxxxx-x... + + Target future Azure PowerShell cmdlets at the account, tenant, and subscription in the 'Work' context. + + + + + + -------------------------- Example 2 -------------------------- + <!-- Aladdin Generated Example --> +Select-AzContext -Name TestEnvironment -Scope Process + + + + + + + + + + Online Version: + https://learn.microsoft.com/powershell/module/az.accounts/select-azcontext + + + + + + Send-Feedback + Send + Feedback + + Sends feedback to the Azure PowerShell team via a set of guided prompts. + + + + The Send-Feedback cmdlet sends feedback to the Azure PowerShell team. + + + + Send-Feedback + + DefaultProfile + + The credentials, tenant, and subscription used for communication with azure. + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + + None + + + + + + DefaultProfile + + The credentials, tenant, and subscription used for communication with azure. + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + + None + + + + + + None + + + + + + + + + + System.Void + + + + + + + + + + + + + + -------------------------- Example 1: -------------------------- + Send-Feedback + +With zero (0) being the least and ten (10) being the most, how likely are you to recommend Azure PowerShell to a friend or colleague? + +10 + +What does Azure PowerShell do well? + +Response. + +Upon what could Azure PowerShell improve? + +Response. + +Please enter your email if you are interested in providing follow up information: + +your@email.com + + + + + + + + + + Online Version: + https://learn.microsoft.com/powershell/module/az.accounts/send-feedback + + + + + + Set-AzContext + Set + AzContext + + Sets the tenant, subscription, and environment for cmdlets to use in the current session. + + + + The Set-AzContext cmdlet sets authentication information for cmdlets that you run in the current session. The context includes tenant, subscription, and environment information. + + + + Set-AzContext + + Context + + Specifies the context for the current session. + + Microsoft.Azure.Commands.Profile.Models.Core.PSAzureContext + + Microsoft.Azure.Commands.Profile.Models.Core.PSAzureContext + + + None + + + DefaultProfile + + The credentials, tenant, and subscription used for communication with azure. + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + + None + + + ExtendedProperty + + Additional context properties + + System.Collections.Generic.IDictionary`2[System.String,System.String] + + System.Collections.Generic.IDictionary`2[System.String,System.String] + + + None + + + Force + + Overwrite the existing context with the same name, if any. + + + System.Management.Automation.SwitchParameter + + + False + + + Name + + Name of the context + + System.String + + System.String + + + None + + + Scope + + Determines the scope of context changes, for example, whether changes apply only to the current process, or to all sessions started by this user. + + + Process + CurrentUser + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + + None + + + Confirm + + Prompts you for confirmation before running the cmdlet. + + + System.Management.Automation.SwitchParameter + + + False + + + WhatIf + + Shows what would happen if the cmdlet runs. The cmdlet is not run. + + + System.Management.Automation.SwitchParameter + + + False + + + + Set-AzContext + + Subscription + + The name or id of the subscription that the context should be set to. This parameter has aliases to -SubscriptionName and -SubscriptionId, so, for clarity, either of these can be used instead of -Subscription when specifying name and id, respectively. + + System.String + + System.String + + + None + + + DefaultProfile + + The credentials, tenant, and subscription used for communication with azure. + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + + None + + + ExtendedProperty + + Additional context properties + + System.Collections.Generic.IDictionary`2[System.String,System.String] + + System.Collections.Generic.IDictionary`2[System.String,System.String] + + + None + + + Force + + Overwrite the existing context with the same name, if any. + + + System.Management.Automation.SwitchParameter + + + False + + + Name + + Name of the context + + System.String + + System.String + + + None + + + Scope + + Determines the scope of context changes, for example, whether changes apply only to the current process, or to all sessions started by this user. + + + Process + CurrentUser + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + + None + + + Tenant + + Tenant domain name or ID + + System.String + + System.String + + + None + + + Confirm + + Prompts you for confirmation before running the cmdlet. + + + System.Management.Automation.SwitchParameter + + + False + + + WhatIf + + Shows what would happen if the cmdlet runs. The cmdlet is not run. + + + System.Management.Automation.SwitchParameter + + + False + + + + Set-AzContext + + SubscriptionObject + + A subscription object + + Microsoft.Azure.Commands.Profile.Models.PSAzureSubscription + + Microsoft.Azure.Commands.Profile.Models.PSAzureSubscription + + + None + + + DefaultProfile + + The credentials, tenant, and subscription used for communication with azure. + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + + None + + + ExtendedProperty + + Additional context properties + + System.Collections.Generic.IDictionary`2[System.String,System.String] + + System.Collections.Generic.IDictionary`2[System.String,System.String] + + + None + + + Force + + Overwrite the existing context with the same name, if any. + + + System.Management.Automation.SwitchParameter + + + False + + + Name + + Name of the context + + System.String + + System.String + + + None + + + Scope + + Determines the scope of context changes, for example, whether changes apply only to the current process, or to all sessions started by this user. + + + Process + CurrentUser + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + + None + + + Confirm + + Prompts you for confirmation before running the cmdlet. + + + System.Management.Automation.SwitchParameter + + + False + + + WhatIf + + Shows what would happen if the cmdlet runs. The cmdlet is not run. + + + System.Management.Automation.SwitchParameter + + + False + + + + Set-AzContext + + DefaultProfile + + The credentials, tenant, and subscription used for communication with azure. + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + + None + + + ExtendedProperty + + Additional context properties + + System.Collections.Generic.IDictionary`2[System.String,System.String] + + System.Collections.Generic.IDictionary`2[System.String,System.String] + + + None + + + Force + + Overwrite the existing context with the same name, if any. + + + System.Management.Automation.SwitchParameter + + + False + + + Name + + Name of the context + + System.String + + System.String + + + None + + + Scope + + Determines the scope of context changes, for example, whether changes apply only to the current process, or to all sessions started by this user. + + + Process + CurrentUser + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + + None + + + Tenant + + Tenant domain name or ID + + System.String + + System.String + + + None + + + Confirm + + Prompts you for confirmation before running the cmdlet. + + + System.Management.Automation.SwitchParameter + + + False + + + WhatIf + + Shows what would happen if the cmdlet runs. The cmdlet is not run. + + + System.Management.Automation.SwitchParameter + + + False + + + + Set-AzContext + + TenantObject + + A Tenant Object + + Microsoft.Azure.Commands.Profile.Models.PSAzureTenant + + Microsoft.Azure.Commands.Profile.Models.PSAzureTenant + + + None + + + DefaultProfile + + The credentials, tenant, and subscription used for communication with azure. + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + + None + + + ExtendedProperty + + Additional context properties + + System.Collections.Generic.IDictionary`2[System.String,System.String] + + System.Collections.Generic.IDictionary`2[System.String,System.String] + + + None + + + Force + + Overwrite the existing context with the same name, if any. + + + System.Management.Automation.SwitchParameter + + + False + + + Name + + Name of the context + + System.String + + System.String + + + None + + + Scope + + Determines the scope of context changes, for example, whether changes apply only to the current process, or to all sessions started by this user. + + + Process + CurrentUser + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + + None + + + Confirm + + Prompts you for confirmation before running the cmdlet. + + + System.Management.Automation.SwitchParameter + + + False + + + WhatIf + + Shows what would happen if the cmdlet runs. The cmdlet is not run. + + + System.Management.Automation.SwitchParameter + + + False + + + + + + Context + + Specifies the context for the current session. + + Microsoft.Azure.Commands.Profile.Models.Core.PSAzureContext + + Microsoft.Azure.Commands.Profile.Models.Core.PSAzureContext + + + None + + + DefaultProfile + + The credentials, tenant, and subscription used for communication with azure. + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + + None + + + ExtendedProperty + + Additional context properties + + System.Collections.Generic.IDictionary`2[System.String,System.String] + + System.Collections.Generic.IDictionary`2[System.String,System.String] + + + None + + + Force + + Overwrite the existing context with the same name, if any. + + System.Management.Automation.SwitchParameter + + System.Management.Automation.SwitchParameter + + + False + + + Name + + Name of the context + + System.String + + System.String + + + None + + + Scope + + Determines the scope of context changes, for example, whether changes apply only to the current process, or to all sessions started by this user. + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + + None + + + Subscription + + The name or id of the subscription that the context should be set to. This parameter has aliases to -SubscriptionName and -SubscriptionId, so, for clarity, either of these can be used instead of -Subscription when specifying name and id, respectively. + + System.String + + System.String + + + None + + + SubscriptionObject + + A subscription object + + Microsoft.Azure.Commands.Profile.Models.PSAzureSubscription + + Microsoft.Azure.Commands.Profile.Models.PSAzureSubscription + + + None + + + Tenant + + Tenant domain name or ID + + System.String + + System.String + + + None + + + TenantObject + + A Tenant Object + + Microsoft.Azure.Commands.Profile.Models.PSAzureTenant + + Microsoft.Azure.Commands.Profile.Models.PSAzureTenant + + + None + + + Confirm + + Prompts you for confirmation before running the cmdlet. + + System.Management.Automation.SwitchParameter + + System.Management.Automation.SwitchParameter + + + False + + + WhatIf + + Shows what would happen if the cmdlet runs. The cmdlet is not run. + + System.Management.Automation.SwitchParameter + + System.Management.Automation.SwitchParameter + + + False + + + + + + Microsoft.Azure.Commands.Profile.Models.Core.PSAzureContext + + + + + + + + Microsoft.Azure.Commands.Profile.Models.PSAzureTenant + + + + + + + + Microsoft.Azure.Commands.Profile.Models.PSAzureSubscription + + + + + + + + + + Microsoft.Azure.Commands.Profile.Models.Core.PSAzureContext + + + + + + + + + + + + + + ----------- Example 1: Set the subscription context ----------- + Set-AzContext -Subscription "xxxx-xxxx-xxxx-xxxx" + +Name Account SubscriptionName Environment TenantId +---- ------- ---------------- ----------- -------- +Work test@outlook.com Subscription1 AzureCloud xxxxxxxx-x... + + This command sets the context to use the specified subscription. + + + + + + + + Online Version: + https://learn.microsoft.com/powershell/module/az.accounts/set-azcontext + + + Get-AzContext + + + + + + + Set-AzDefault + Set + AzDefault + + Sets a default in the current context + + + + The Set-AzDefault cmdlet adds or changes the defaults in the current context. + + + + Set-AzDefault + + DefaultProfile + + The credentials, account, tenant, and subscription used for communication with azure. + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + + None + + + Force + + Create a new resource group if specified default does not exist + + + System.Management.Automation.SwitchParameter + + + False + + + ResourceGroupName + + Name of the resource group being set as default + + System.String + + System.String + + + None + + + Scope + + Determines the scope of context changes, for example, whether changes apply only to the current process, or to all sessions started by this user. + + + Process + CurrentUser + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + + None + + + Confirm + + Prompts you for confirmation before running the cmdlet. + + + System.Management.Automation.SwitchParameter + + + False + + + WhatIf + + Shows what would happen if the cmdlet runs. The cmdlet is not run. + + + System.Management.Automation.SwitchParameter + + + False + + + + + + DefaultProfile + + The credentials, account, tenant, and subscription used for communication with azure. + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + + None + + + Force + + Create a new resource group if specified default does not exist + + System.Management.Automation.SwitchParameter + + System.Management.Automation.SwitchParameter + + + False + + + ResourceGroupName + + Name of the resource group being set as default + + System.String + + System.String + + + None + + + Scope + + Determines the scope of context changes, for example, whether changes apply only to the current process, or to all sessions started by this user. + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + + None + + + Confirm + + Prompts you for confirmation before running the cmdlet. + + System.Management.Automation.SwitchParameter + + System.Management.Automation.SwitchParameter + + + False + + + WhatIf + + Shows what would happen if the cmdlet runs. The cmdlet is not run. + + System.Management.Automation.SwitchParameter + + System.Management.Automation.SwitchParameter + + + False + + + + + + System.String + + + + + + + + + + Microsoft.Azure.Commands.Profile.Models.PSResourceGroup + + + + + + + + + + + + + + -------------------------- Example 1 -------------------------- + Set-AzDefault -ResourceGroupName myResourceGroup + +Id : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup +Name : myResourceGroup +Properties : Microsoft.Azure.Management.Internal.Resources.Models.ResourceGroupProperties +Location : eastus +ManagedBy : +Tags : + + This command sets the default resource group to the resource group specified by the user. + + + + + + + + Online Version: + https://learn.microsoft.com/powershell/module/az.accounts/set-azdefault + + + + + + Set-AzEnvironment + Set + AzEnvironment + + Sets properties for an Azure environment. + + + + The Set-AzEnvironment cmdlet sets endpoints and metadata for connecting to an instance of Azure. + + + + Set-AzEnvironment + + Name + + Specifies the name of the environment to modify. + + System.String + + System.String + + + None + + + PublishSettingsFileUrl + + Specifies the URL from which .publishsettings files can be downloaded. + + System.String + + System.String + + + None + + + AzureKeyVaultDnsSuffix + + Dns suffix of Azure Key Vault service. Example is vault-int.azure-int.net + + System.String + + System.String + + + None + + + AzureKeyVaultServiceEndpointResourceId + + Resource identifier of Azure Key Vault data service that is the recipient of the requested token. + + System.String + + System.String + + + None + + + TrafficManagerDnsSuffix + + Specifies the domain-name suffix for Azure Traffic Manager services. + + System.String + + System.String + + + None + + + SqlDatabaseDnsSuffix + + Specifies the domain-name suffix for Azure SQL Database servers. + + System.String + + System.String + + + None + + + AzureDataLakeStoreFileSystemEndpointSuffix + + Dns Suffix of Azure Data Lake Store FileSystem. Example: azuredatalake.net + + System.String + + System.String + + + None + + + AzureDataLakeAnalyticsCatalogAndJobEndpointSuffix + + Dns Suffix of Azure Data Lake Analytics job and catalog services + + System.String + + System.String + + + None + + + EnableAdfsAuthentication + + Indicates that Active Directory Federation Services (ADFS) on-premise authentication is allowed. + + + System.Management.Automation.SwitchParameter + + + False + + + AdTenant + + Specifies the default Active Directory tenant. + + System.String + + System.String + + + None + + + GraphAudience + + The audience for tokens authenticating with the AD Graph Endpoint. + + System.String + + System.String + + + None + + + DataLakeAudience + + The audience for tokens authenticating with the AD Data Lake services Endpoint. + + System.String + + System.String + + + None + + + ServiceEndpoint + + Specifies the endpoint for Service Management (RDFE) requests. + + System.String + + System.String + + + None + + + BatchEndpointResourceId + + The resource identifier of the Azure Batch service that is the recipient of the requested token + + System.String + + System.String + + + None + + + AzureOperationalInsightsEndpointResourceId + + The audience for tokens authenticating with the Azure Log Analytics API. + + System.String + + System.String + + + None + + + AzureOperationalInsightsEndpoint + + The endpoint to use when communicating with the Azure Log Analytics API. + + System.String + + System.String + + + None + + + ManagementPortalUrl + + Specifies the URL for the Management Portal. + + System.String + + System.String + + + None + + + StorageEndpoint + + Specifies the endpoint for storage (blob, table, queue, and file) access. + + System.String + + System.String + + + None + + + ActiveDirectoryEndpoint + + Specifies the base authority for Azure Active Directory authentication. + + System.String + + System.String + + + None + + + ResourceManagerEndpoint + + Specifies the URL for Azure Resource Manager requests. + + System.String + + System.String + + + None + + + GalleryEndpoint + + Specifies the endpoint for the Azure Resource Manager gallery of deployment templates. + + System.String + + System.String + + + None + + + ActiveDirectoryServiceEndpointResourceId + + Specifies the audience for tokens that authenticate requests to Azure Resource Manager or Service Management (RDFE) endpoints. + + System.String + + System.String + + + None + + + GraphEndpoint + + Specifies the URL for Graph (Active Directory metadata) requests. + + System.String + + System.String + + + None + + + AzureAnalysisServicesEndpointResourceId + + The resource identifier of the Azure Analysis Services resource. + + System.String + + System.String + + + None + + + AzureAnalysisServicesEndpointSuffix + + The endpoint to use when communicating with the Azure Log Analytics API. + + System.String + + System.String + + + None + + + AzureAttestationServiceEndpointResourceId + + The The resource identifier of the Azure Attestation service that is the recipient of the requested token. + + System.String + + System.String + + + None + + + AzureAttestationServiceEndpointSuffix + + Dns suffix of Azure Attestation service. + + System.String + + System.String + + + None + + + AzureSynapseAnalyticsEndpointResourceId + + The The resource identifier of the Azure Synapse Analytics that is the recipient of the requested token. + + System.String + + System.String + + + None + + + AzureSynapseAnalyticsEndpointSuffix + + Dns suffix of Azure Synapse Analytics. + + System.String + + System.String + + + None + + + ContainerRegistryEndpointSuffix + + Suffix of Azure Container Registry. + + System.String + + System.String + + + None + + + DefaultProfile + + The credentials, account, tenant and subscription used for communication with azure. + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + + None + + + MicrosoftGraphEndpointResourceId + + The resource identifier of Microsoft Graph + + System.String + + System.String + + + None + + + MicrosoftGraphUrl + + Microsoft Graph Url + + System.String + + System.String + + + None + + + Scope + + Determines the scope of context changes, for example, whether changes apply only to the current process, or to all sessions started by this user. + + + Process + CurrentUser + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + + None + + + Confirm + + Prompts you for confirmation before running the cmdlet. + + + System.Management.Automation.SwitchParameter + + + False + + + WhatIf + + Shows what would happen if the cmdlet runs. The cmdlet is not run. + + + System.Management.Automation.SwitchParameter + + + False + + + + Set-AzEnvironment + + Name + + Specifies the name of the environment to modify. + + System.String + + System.String + + + None + + + ARMEndpoint + + The Azure Resource Manager endpoint. + + System.String + + System.String + + + None + + + AzureKeyVaultDnsSuffix + + Dns suffix of Azure Key Vault service. Example is vault-int.azure-int.net + + System.String + + System.String + + + None + + + AzureKeyVaultServiceEndpointResourceId + + Resource identifier of Azure Key Vault data service that is the recipient of the requested token. + + System.String + + System.String + + + None + + + DataLakeAudience + + The audience for tokens authenticating with the AD Data Lake services Endpoint. + + System.String + + System.String + + + None + + + BatchEndpointResourceId + + The resource identifier of the Azure Batch service that is the recipient of the requested token + + System.String + + System.String + + + None + + + AzureOperationalInsightsEndpointResourceId + + The audience for tokens authenticating with the Azure Log Analytics API. + + System.String + + System.String + + + None + + + AzureOperationalInsightsEndpoint + + The endpoint to use when communicating with the Azure Log Analytics API. + + System.String + + System.String + + + None + + + StorageEndpoint + + Specifies the endpoint for storage (blob, table, queue, and file) access. + + System.String + + System.String + + + None + + + AzureAnalysisServicesEndpointResourceId + + The resource identifier of the Azure Analysis Services resource. + + System.String + + System.String + + + None + + + AzureAnalysisServicesEndpointSuffix + + The endpoint to use when communicating with the Azure Log Analytics API. + + System.String + + System.String + + + None + + + AzureAttestationServiceEndpointResourceId + + The The resource identifier of the Azure Attestation service that is the recipient of the requested token. + + System.String + + System.String + + + None + + + AzureAttestationServiceEndpointSuffix + + Dns suffix of Azure Attestation service. + + System.String + + System.String + + + None + + + AzureSynapseAnalyticsEndpointResourceId + + The The resource identifier of the Azure Synapse Analytics that is the recipient of the requested token. + + System.String + + System.String + + + None + + + AzureSynapseAnalyticsEndpointSuffix + + Dns suffix of Azure Synapse Analytics. + + System.String + + System.String + + + None + + + ContainerRegistryEndpointSuffix + + Suffix of Azure Container Registry. + + System.String + + System.String + + + None + + + DefaultProfile + + The credentials, account, tenant and subscription used for communication with azure. + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + + None + + + Scope + + Determines the scope of context changes, for example, whether changes apply only to the current process, or to all sessions started by this user. + + + Process + CurrentUser + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + + None + + + Confirm + + Prompts you for confirmation before running the cmdlet. + + + System.Management.Automation.SwitchParameter + + + False + + + WhatIf + + Shows what would happen if the cmdlet runs. The cmdlet is not run. + + + System.Management.Automation.SwitchParameter + + + False + + + + + + ActiveDirectoryEndpoint + + Specifies the base authority for Azure Active Directory authentication. + + System.String + + System.String + + + None + + + ActiveDirectoryServiceEndpointResourceId + + Specifies the audience for tokens that authenticate requests to Azure Resource Manager or Service Management (RDFE) endpoints. + + System.String + + System.String + + + None + + + AdTenant + + Specifies the default Active Directory tenant. + + System.String + + System.String + + + None + + + ARMEndpoint + + The Azure Resource Manager endpoint. + + System.String + + System.String + + + None + + + AzureAnalysisServicesEndpointResourceId + + The resource identifier of the Azure Analysis Services resource. + + System.String + + System.String + + + None + + + AzureAnalysisServicesEndpointSuffix + + The endpoint to use when communicating with the Azure Log Analytics API. + + System.String + + System.String + + + None + + + AzureAttestationServiceEndpointResourceId + + The The resource identifier of the Azure Attestation service that is the recipient of the requested token. + + System.String + + System.String + + + None + + + AzureAttestationServiceEndpointSuffix + + Dns suffix of Azure Attestation service. + + System.String + + System.String + + + None + + + AzureDataLakeAnalyticsCatalogAndJobEndpointSuffix + + Dns Suffix of Azure Data Lake Analytics job and catalog services + + System.String + + System.String + + + None + + + AzureDataLakeStoreFileSystemEndpointSuffix + + Dns Suffix of Azure Data Lake Store FileSystem. Example: azuredatalake.net + + System.String + + System.String + + + None + + + AzureKeyVaultDnsSuffix + + Dns suffix of Azure Key Vault service. Example is vault-int.azure-int.net + + System.String + + System.String + + + None + + + AzureKeyVaultServiceEndpointResourceId + + Resource identifier of Azure Key Vault data service that is the recipient of the requested token. + + System.String + + System.String + + + None + + + AzureOperationalInsightsEndpoint + + The endpoint to use when communicating with the Azure Log Analytics API. + + System.String + + System.String + + + None + + + AzureOperationalInsightsEndpointResourceId + + The audience for tokens authenticating with the Azure Log Analytics API. + + System.String + + System.String + + + None + + + AzureSynapseAnalyticsEndpointResourceId + + The The resource identifier of the Azure Synapse Analytics that is the recipient of the requested token. + + System.String + + System.String + + + None + + + AzureSynapseAnalyticsEndpointSuffix + + Dns suffix of Azure Synapse Analytics. + + System.String + + System.String + + + None + + + BatchEndpointResourceId + + The resource identifier of the Azure Batch service that is the recipient of the requested token + + System.String + + System.String + + + None + + + ContainerRegistryEndpointSuffix + + Suffix of Azure Container Registry. + + System.String + + System.String + + + None + + + DataLakeAudience + + The audience for tokens authenticating with the AD Data Lake services Endpoint. + + System.String + + System.String + + + None + + + DefaultProfile + + The credentials, account, tenant and subscription used for communication with azure. + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + + None + + + EnableAdfsAuthentication + + Indicates that Active Directory Federation Services (ADFS) on-premise authentication is allowed. + + System.Management.Automation.SwitchParameter + + System.Management.Automation.SwitchParameter + + + False + + + GalleryEndpoint + + Specifies the endpoint for the Azure Resource Manager gallery of deployment templates. + + System.String + + System.String + + + None + + + GraphAudience + + The audience for tokens authenticating with the AD Graph Endpoint. + + System.String + + System.String + + + None + + + GraphEndpoint + + Specifies the URL for Graph (Active Directory metadata) requests. + + System.String + + System.String + + + None + + + ManagementPortalUrl + + Specifies the URL for the Management Portal. + + System.String + + System.String + + + None + + + MicrosoftGraphEndpointResourceId + + The resource identifier of Microsoft Graph + + System.String + + System.String + + + None + + + MicrosoftGraphUrl + + Microsoft Graph Url + + System.String + + System.String + + + None + + + Name + + Specifies the name of the environment to modify. + + System.String + + System.String + + + None + + + PublishSettingsFileUrl + + Specifies the URL from which .publishsettings files can be downloaded. + + System.String + + System.String + + + None + + + ResourceManagerEndpoint + + Specifies the URL for Azure Resource Manager requests. + + System.String + + System.String + + + None + + + Scope + + Determines the scope of context changes, for example, whether changes apply only to the current process, or to all sessions started by this user. + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + Microsoft.Azure.Commands.Profile.Common.ContextModificationScope + + + None + + + ServiceEndpoint + + Specifies the endpoint for Service Management (RDFE) requests. + + System.String + + System.String + + + None + + + SqlDatabaseDnsSuffix + + Specifies the domain-name suffix for Azure SQL Database servers. + + System.String + + System.String + + + None + + + StorageEndpoint + + Specifies the endpoint for storage (blob, table, queue, and file) access. + + System.String + + System.String + + + None + + + TrafficManagerDnsSuffix + + Specifies the domain-name suffix for Azure Traffic Manager services. + + System.String + + System.String + + + None + + + Confirm + + Prompts you for confirmation before running the cmdlet. + + System.Management.Automation.SwitchParameter + + System.Management.Automation.SwitchParameter + + + False + + + WhatIf + + Shows what would happen if the cmdlet runs. The cmdlet is not run. + + System.Management.Automation.SwitchParameter + + System.Management.Automation.SwitchParameter + + + False + + + + + + System.String + + + + + + + + System.Management.Automation.SwitchParameter + + + + + + + + + + Microsoft.Azure.Commands.Profile.Models.PSAzureEnvironment + + + + + + + + + + + + + + ----- Example 1: Creating and modifying a new environment ----- + Add-AzEnvironment -Name TestEnvironment ` + -ActiveDirectoryEndpoint TestADEndpoint ` + -ActiveDirectoryServiceEndpointResourceId TestADApplicationId ` + -ResourceManagerEndpoint TestRMEndpoint ` + -GalleryEndpoint TestGalleryEndpoint ` + -GraphEndpoint TestGraphEndpoint + +Name Resource Manager Url ActiveDirectory Authority +---- -------------------- ------------------------- +TestEnvironment TestRMEndpoint TestADEndpoint/ + +Set-AzEnvironment -Name TestEnvironment ` + -ActiveDirectoryEndpoint NewTestADEndpoint ` + -GraphEndpoint NewTestGraphEndpoint | Format-List + +Name : TestEnvironment +EnableAdfsAuthentication : False +ActiveDirectoryServiceEndpointResourceId : TestADApplicationId +AdTenant : +GalleryUrl : TestGalleryEndpoint +ManagementPortalUrl : +ServiceManagementUrl : +PublishSettingsFileUrl : +ResourceManagerUrl : TestRMEndpoint +SqlDatabaseDnsSuffix : +StorageEndpointSuffix : +ActiveDirectoryAuthority : NewTestADEndpoint +GraphUrl : NewTestGraphEndpoint +GraphEndpointResourceId : +TrafficManagerDnsSuffix : +AzureKeyVaultDnsSuffix : +AzureDataLakeStoreFileSystemEndpointSuffix : +AzureDataLakeAnalyticsCatalogAndJobEndpointSuffix : +AzureKeyVaultServiceEndpointResourceId : +BatchEndpointResourceId : +AzureOperationalInsightsEndpoint : +AzureOperationalInsightsEndpointResourceId : +AzureAttestationServiceEndpointSuffix : +AzureAttestationServiceEndpointResourceId : +AzureSynapseAnalyticsEndpointSuffix : +AzureSynapseAnalyticsEndpointResourceId : + + In this example we are creating a new Azure environment with sample endpoints using Add-AzEnvironment, and then we are changing the value of the ActiveDirectoryEndpoint and GraphEndpoint attributes of the created environment using the cmdlet Set-AzEnvironment. + + + + + + + + Online Version: + https://learn.microsoft.com/powershell/module/az.accounts/set-azenvironment + + + Add-AzEnvironment + + + + Get-AzEnvironment + + + + Remove-AzEnvironment + + + + + + + Uninstall-AzureRm + Uninstall + AzureRm + + Removes all AzureRm modules from a machine. + + + + Removes all AzureRm modules from a machine. + + + + Uninstall-AzureRm + + DefaultProfile + + The credentials, account, tenant, and subscription used for communication with Azure. + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + + None + + + PassThru + + Return list of Modules removed if specified. + + + System.Management.Automation.SwitchParameter + + + False + + + Confirm + + Prompts you for confirmation before running the cmdlet. + + + System.Management.Automation.SwitchParameter + + + False + + + WhatIf + + Shows what would happen if the cmdlet runs. The cmdlet is not run. + + + System.Management.Automation.SwitchParameter + + + False + + + + + + DefaultProfile + + The credentials, account, tenant, and subscription used for communication with Azure. + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer + + + None + + + PassThru + + Return list of Modules removed if specified. + + System.Management.Automation.SwitchParameter + + System.Management.Automation.SwitchParameter + + + False + + + Confirm + + Prompts you for confirmation before running the cmdlet. + + System.Management.Automation.SwitchParameter + + System.Management.Automation.SwitchParameter + + + False + + + WhatIf + + Shows what would happen if the cmdlet runs. The cmdlet is not run. + + System.Management.Automation.SwitchParameter + + System.Management.Automation.SwitchParameter + + + False + + + + + + None + + + + + + + + + + System.String + + + + + + + + + + + + + + -------------------------- Example 1 -------------------------- + Uninstall-AzureRm + + Running this command will remove all AzureRm modules from the machine for the version of PowerShell in which the cmdlet is run. + + + + + + + + Online Version: + https://learn.microsoft.com/powershell/module/az.accounts/uninstall-azurerm + + + + \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Common.Share.dll b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Common.Share.dll new file mode 100644 index 000000000000..e45ac91a1264 Binary files /dev/null and b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Common.Share.dll differ diff --git a/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Common.dll b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Common.dll new file mode 100644 index 000000000000..a705c3fd25a8 Binary files /dev/null and b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Common.dll differ diff --git a/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Storage.dll b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Storage.dll new file mode 100644 index 000000000000..f15127c61779 Binary files /dev/null and b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Storage.dll differ diff --git a/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Strategies.dll b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Strategies.dll new file mode 100644 index 000000000000..f82770a9ceed Binary files /dev/null and b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Strategies.dll differ diff --git a/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Microsoft.Rest.ClientRuntime.Azure.dll b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Microsoft.Rest.ClientRuntime.Azure.dll new file mode 100644 index 000000000000..1d99c7015912 Binary files /dev/null and b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Microsoft.Rest.ClientRuntime.Azure.dll differ diff --git a/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Microsoft.Rest.ClientRuntime.dll b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Microsoft.Rest.ClientRuntime.dll new file mode 100644 index 000000000000..4b4be00999a4 Binary files /dev/null and b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Microsoft.Rest.ClientRuntime.dll differ diff --git a/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Microsoft.WindowsAzure.Storage.DataMovement.dll b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Microsoft.WindowsAzure.Storage.DataMovement.dll new file mode 100644 index 000000000000..6ac672abd486 Binary files /dev/null and b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Microsoft.WindowsAzure.Storage.DataMovement.dll differ diff --git a/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Microsoft.WindowsAzure.Storage.dll b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Microsoft.WindowsAzure.Storage.dll new file mode 100644 index 000000000000..70c5ed6806c6 Binary files /dev/null and b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/Microsoft.WindowsAzure.Storage.dll differ diff --git a/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/PostImportScripts/LoadAuthenticators.ps1 b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/PostImportScripts/LoadAuthenticators.ps1 new file mode 100644 index 000000000000..bb0bc9e63f5d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/PostImportScripts/LoadAuthenticators.ps1 @@ -0,0 +1,219 @@ +if ($PSEdition -eq 'Desktop') { + try { + [Microsoft.Azure.Commands.Profile.Utilities.CustomAssemblyResolver]::Initialize() + } catch {} +} +# SIG # Begin signature block +# MIInugYJKoZIhvcNAQcCoIInqzCCJ6cCAQExDzANBglghkgBZQMEAgEFADB5Bgor +# BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG +# KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCBn8ROze2QLH/c6 +# GtPhR/BPLgOtmjkNhcq+fFmu16VcrqCCDYEwggX/MIID56ADAgECAhMzAAACUosz +# qviV8znbAAAAAAJSMA0GCSqGSIb3DQEBCwUAMH4xCzAJBgNVBAYTAlVTMRMwEQYD +# VQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdSZWRtb25kMR4wHAYDVQQKExVNaWNy +# b3NvZnQgQ29ycG9yYXRpb24xKDAmBgNVBAMTH01pY3Jvc29mdCBDb2RlIFNpZ25p +# bmcgUENBIDIwMTEwHhcNMjEwOTAyMTgzMjU5WhcNMjIwOTAxMTgzMjU5WjB0MQsw +# CQYDVQQGEwJVUzETMBEGA1UECBMKV2FzaGluZ3RvbjEQMA4GA1UEBxMHUmVkbW9u +# ZDEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMR4wHAYDVQQDExVNaWNy +# b3NvZnQgQ29ycG9yYXRpb24wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIB +# AQDQ5M+Ps/X7BNuv5B/0I6uoDwj0NJOo1KrVQqO7ggRXccklyTrWL4xMShjIou2I +# sbYnF67wXzVAq5Om4oe+LfzSDOzjcb6ms00gBo0OQaqwQ1BijyJ7NvDf80I1fW9O +# L76Kt0Wpc2zrGhzcHdb7upPrvxvSNNUvxK3sgw7YTt31410vpEp8yfBEl/hd8ZzA +# v47DCgJ5j1zm295s1RVZHNp6MoiQFVOECm4AwK2l28i+YER1JO4IplTH44uvzX9o +# RnJHaMvWzZEpozPy4jNO2DDqbcNs4zh7AWMhE1PWFVA+CHI/En5nASvCvLmuR/t8 +# q4bc8XR8QIZJQSp+2U6m2ldNAgMBAAGjggF+MIIBejAfBgNVHSUEGDAWBgorBgEE +# AYI3TAgBBggrBgEFBQcDAzAdBgNVHQ4EFgQUNZJaEUGL2Guwt7ZOAu4efEYXedEw +# UAYDVR0RBEkwR6RFMEMxKTAnBgNVBAsTIE1pY3Jvc29mdCBPcGVyYXRpb25zIFB1 +# ZXJ0byBSaWNvMRYwFAYDVQQFEw0yMzAwMTIrNDY3NTk3MB8GA1UdIwQYMBaAFEhu +# ZOVQBdOCqhc3NyK1bajKdQKVMFQGA1UdHwRNMEswSaBHoEWGQ2h0dHA6Ly93d3cu +# bWljcm9zb2Z0LmNvbS9wa2lvcHMvY3JsL01pY0NvZFNpZ1BDQTIwMTFfMjAxMS0w +# Ny0wOC5jcmwwYQYIKwYBBQUHAQEEVTBTMFEGCCsGAQUFBzAChkVodHRwOi8vd3d3 +# Lm1pY3Jvc29mdC5jb20vcGtpb3BzL2NlcnRzL01pY0NvZFNpZ1BDQTIwMTFfMjAx +# MS0wNy0wOC5jcnQwDAYDVR0TAQH/BAIwADANBgkqhkiG9w0BAQsFAAOCAgEAFkk3 +# uSxkTEBh1NtAl7BivIEsAWdgX1qZ+EdZMYbQKasY6IhSLXRMxF1B3OKdR9K/kccp +# kvNcGl8D7YyYS4mhCUMBR+VLrg3f8PUj38A9V5aiY2/Jok7WZFOAmjPRNNGnyeg7 +# l0lTiThFqE+2aOs6+heegqAdelGgNJKRHLWRuhGKuLIw5lkgx9Ky+QvZrn/Ddi8u +# TIgWKp+MGG8xY6PBvvjgt9jQShlnPrZ3UY8Bvwy6rynhXBaV0V0TTL0gEx7eh/K1 +# o8Miaru6s/7FyqOLeUS4vTHh9TgBL5DtxCYurXbSBVtL1Fj44+Od/6cmC9mmvrti +# yG709Y3Rd3YdJj2f3GJq7Y7KdWq0QYhatKhBeg4fxjhg0yut2g6aM1mxjNPrE48z +# 6HWCNGu9gMK5ZudldRw4a45Z06Aoktof0CqOyTErvq0YjoE4Xpa0+87T/PVUXNqf +# 7Y+qSU7+9LtLQuMYR4w3cSPjuNusvLf9gBnch5RqM7kaDtYWDgLyB42EfsxeMqwK +# WwA+TVi0HrWRqfSx2olbE56hJcEkMjOSKz3sRuupFCX3UroyYf52L+2iVTrda8XW +# esPG62Mnn3T8AuLfzeJFuAbfOSERx7IFZO92UPoXE1uEjL5skl1yTZB3MubgOA4F +# 8KoRNhviFAEST+nG8c8uIsbZeb08SeYQMqjVEmkwggd6MIIFYqADAgECAgphDpDS +# AAAAAAADMA0GCSqGSIb3DQEBCwUAMIGIMQswCQYDVQQGEwJVUzETMBEGA1UECBMK +# V2FzaGluZ3RvbjEQMA4GA1UEBxMHUmVkbW9uZDEeMBwGA1UEChMVTWljcm9zb2Z0 +# IENvcnBvcmF0aW9uMTIwMAYDVQQDEylNaWNyb3NvZnQgUm9vdCBDZXJ0aWZpY2F0 +# ZSBBdXRob3JpdHkgMjAxMTAeFw0xMTA3MDgyMDU5MDlaFw0yNjA3MDgyMTA5MDla +# MH4xCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdS +# ZWRtb25kMR4wHAYDVQQKExVNaWNyb3NvZnQgQ29ycG9yYXRpb24xKDAmBgNVBAMT +# H01pY3Jvc29mdCBDb2RlIFNpZ25pbmcgUENBIDIwMTEwggIiMA0GCSqGSIb3DQEB +# AQUAA4ICDwAwggIKAoICAQCr8PpyEBwurdhuqoIQTTS68rZYIZ9CGypr6VpQqrgG +# OBoESbp/wwwe3TdrxhLYC/A4wpkGsMg51QEUMULTiQ15ZId+lGAkbK+eSZzpaF7S +# 35tTsgosw6/ZqSuuegmv15ZZymAaBelmdugyUiYSL+erCFDPs0S3XdjELgN1q2jz +# y23zOlyhFvRGuuA4ZKxuZDV4pqBjDy3TQJP4494HDdVceaVJKecNvqATd76UPe/7 +# 4ytaEB9NViiienLgEjq3SV7Y7e1DkYPZe7J7hhvZPrGMXeiJT4Qa8qEvWeSQOy2u +# M1jFtz7+MtOzAz2xsq+SOH7SnYAs9U5WkSE1JcM5bmR/U7qcD60ZI4TL9LoDho33 +# X/DQUr+MlIe8wCF0JV8YKLbMJyg4JZg5SjbPfLGSrhwjp6lm7GEfauEoSZ1fiOIl +# XdMhSz5SxLVXPyQD8NF6Wy/VI+NwXQ9RRnez+ADhvKwCgl/bwBWzvRvUVUvnOaEP +# 6SNJvBi4RHxF5MHDcnrgcuck379GmcXvwhxX24ON7E1JMKerjt/sW5+v/N2wZuLB +# l4F77dbtS+dJKacTKKanfWeA5opieF+yL4TXV5xcv3coKPHtbcMojyyPQDdPweGF +# RInECUzF1KVDL3SV9274eCBYLBNdYJWaPk8zhNqwiBfenk70lrC8RqBsmNLg1oiM +# CwIDAQABo4IB7TCCAekwEAYJKwYBBAGCNxUBBAMCAQAwHQYDVR0OBBYEFEhuZOVQ +# BdOCqhc3NyK1bajKdQKVMBkGCSsGAQQBgjcUAgQMHgoAUwB1AGIAQwBBMAsGA1Ud +# DwQEAwIBhjAPBgNVHRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFHItOgIxkEO5FAVO +# 4eqnxzHRI4k0MFoGA1UdHwRTMFEwT6BNoEuGSWh0dHA6Ly9jcmwubWljcm9zb2Z0 +# LmNvbS9wa2kvY3JsL3Byb2R1Y3RzL01pY1Jvb0NlckF1dDIwMTFfMjAxMV8wM18y +# Mi5jcmwwXgYIKwYBBQUHAQEEUjBQME4GCCsGAQUFBzAChkJodHRwOi8vd3d3Lm1p +# Y3Jvc29mdC5jb20vcGtpL2NlcnRzL01pY1Jvb0NlckF1dDIwMTFfMjAxMV8wM18y +# Mi5jcnQwgZ8GA1UdIASBlzCBlDCBkQYJKwYBBAGCNy4DMIGDMD8GCCsGAQUFBwIB +# FjNodHRwOi8vd3d3Lm1pY3Jvc29mdC5jb20vcGtpb3BzL2RvY3MvcHJpbWFyeWNw +# cy5odG0wQAYIKwYBBQUHAgIwNB4yIB0ATABlAGcAYQBsAF8AcABvAGwAaQBjAHkA +# XwBzAHQAYQB0AGUAbQBlAG4AdAAuIB0wDQYJKoZIhvcNAQELBQADggIBAGfyhqWY +# 4FR5Gi7T2HRnIpsLlhHhY5KZQpZ90nkMkMFlXy4sPvjDctFtg/6+P+gKyju/R6mj +# 82nbY78iNaWXXWWEkH2LRlBV2AySfNIaSxzzPEKLUtCw/WvjPgcuKZvmPRul1LUd +# d5Q54ulkyUQ9eHoj8xN9ppB0g430yyYCRirCihC7pKkFDJvtaPpoLpWgKj8qa1hJ +# Yx8JaW5amJbkg/TAj/NGK978O9C9Ne9uJa7lryft0N3zDq+ZKJeYTQ49C/IIidYf +# wzIY4vDFLc5bnrRJOQrGCsLGra7lstnbFYhRRVg4MnEnGn+x9Cf43iw6IGmYslmJ +# aG5vp7d0w0AFBqYBKig+gj8TTWYLwLNN9eGPfxxvFX1Fp3blQCplo8NdUmKGwx1j +# NpeG39rz+PIWoZon4c2ll9DuXWNB41sHnIc+BncG0QaxdR8UvmFhtfDcxhsEvt9B +# xw4o7t5lL+yX9qFcltgA1qFGvVnzl6UJS0gQmYAf0AApxbGbpT9Fdx41xtKiop96 +# eiL6SJUfq/tHI4D1nvi/a7dLl+LrdXga7Oo3mXkYS//WsyNodeav+vyL6wuA6mk7 +# r/ww7QRMjt/fdW1jkT3RnVZOT7+AVyKheBEyIXrvQQqxP/uozKRdwaGIm1dxVk5I +# RcBCyZt2WwqASGv9eZ/BvW1taslScxMNelDNMYIZjzCCGYsCAQEwgZUwfjELMAkG +# A1UEBhMCVVMxEzARBgNVBAgTCldhc2hpbmd0b24xEDAOBgNVBAcTB1JlZG1vbmQx +# HjAcBgNVBAoTFU1pY3Jvc29mdCBDb3Jwb3JhdGlvbjEoMCYGA1UEAxMfTWljcm9z +# b2Z0IENvZGUgU2lnbmluZyBQQ0EgMjAxMQITMwAAAlKLM6r4lfM52wAAAAACUjAN +# BglghkgBZQMEAgEFAKCBrjAZBgkqhkiG9w0BCQMxDAYKKwYBBAGCNwIBBDAcBgor +# BgEEAYI3AgELMQ4wDAYKKwYBBAGCNwIBFTAvBgkqhkiG9w0BCQQxIgQgLwxfLTEa +# f5cZ43nGFJSGxV1AZMu24c5Ln5TdSBDWTncwQgYKKwYBBAGCNwIBDDE0MDKgFIAS +# AE0AaQBjAHIAbwBzAG8AZgB0oRqAGGh0dHA6Ly93d3cubWljcm9zb2Z0LmNvbTAN +# BgkqhkiG9w0BAQEFAASCAQCH+MB7uS3RlpbV8q8Nvg9aa0UmWWYCFOT/3n7V09Q6 +# p3v/uFdZ8AXCe8zdAeWFwLOQg9974QcDbIbvXm1V96+Z7zEEimU/Zr1ou5Cv0knI +# riaKdejplgnDt1EnBE9JlSyVsV7aOYr4EueMCb1Xn1dfGabKcgVlJUlP0JyZPQfs +# YqsyxEznkgNE769m8ozUwCx33jJN1Llcs3FYEe5irzu8UthSkFQ8vpG3YABhlk6M +# 4jPeb38LKbkEE0jclq6sfdmT+JL8j7Z05KfgaD076LnpSaqkcu9+2RH3TARosqhq +# I/N3nhDQclKIl1kYSXFG1E4/6ea3rAa98adIaR0YNcpFoYIXGTCCFxUGCisGAQQB +# gjcDAwExghcFMIIXAQYJKoZIhvcNAQcCoIIW8jCCFu4CAQMxDzANBglghkgBZQME +# AgEFADCCAVkGCyqGSIb3DQEJEAEEoIIBSASCAUQwggFAAgEBBgorBgEEAYRZCgMB +# MDEwDQYJYIZIAWUDBAIBBQAEIDsI/xX4lqk74CTV97lUQ0iyAOiIu4ggTwVzbGvl +# +HKeAgZiMTFcH0UYEzIwMjIwMzMxMTAwMDA5LjQ1OVowBIACAfSggdikgdUwgdIx +# CzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdSZWRt +# b25kMR4wHAYDVQQKExVNaWNyb3NvZnQgQ29ycG9yYXRpb24xLTArBgNVBAsTJE1p +# Y3Jvc29mdCBJcmVsYW5kIE9wZXJhdGlvbnMgTGltaXRlZDEmMCQGA1UECxMdVGhh +# bGVzIFRTUyBFU046QTI0MC00QjgyLTEzMEUxJTAjBgNVBAMTHE1pY3Jvc29mdCBU +# aW1lLVN0YW1wIFNlcnZpY2WgghFoMIIHFDCCBPygAwIBAgITMwAAAY16VS54dJkq +# twABAAABjTANBgkqhkiG9w0BAQsFADB8MQswCQYDVQQGEwJVUzETMBEGA1UECBMK +# V2FzaGluZ3RvbjEQMA4GA1UEBxMHUmVkbW9uZDEeMBwGA1UEChMVTWljcm9zb2Z0 +# IENvcnBvcmF0aW9uMSYwJAYDVQQDEx1NaWNyb3NvZnQgVGltZS1TdGFtcCBQQ0Eg +# MjAxMDAeFw0yMTEwMjgxOTI3NDVaFw0yMzAxMjYxOTI3NDVaMIHSMQswCQYDVQQG +# EwJVUzETMBEGA1UECBMKV2FzaGluZ3RvbjEQMA4GA1UEBxMHUmVkbW9uZDEeMBwG +# A1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMS0wKwYDVQQLEyRNaWNyb3NvZnQg +# SXJlbGFuZCBPcGVyYXRpb25zIExpbWl0ZWQxJjAkBgNVBAsTHVRoYWxlcyBUU1Mg +# RVNOOkEyNDAtNEI4Mi0xMzBFMSUwIwYDVQQDExxNaWNyb3NvZnQgVGltZS1TdGFt +# cCBTZXJ2aWNlMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA2jRILZg+ +# O6U7dLcuwBPMB+0tJUz0wHLqJ5f7KJXQsTzWToADUMYV4xVZnp9mPTWojUJ/l3O4 +# XqegLDNduFAObcitrLyY5HDsxAfUG1/2YilcSkSP6CcMqWfsSwULGX5zlsVKHJ7t +# vwg26y6eLklUdFMpiq294T4uJQdXd5O7mFy0vVkaGPGxNWLbZxKNzqKtFnWQ7jMt +# Z05XvafkIWZrNTFv8GGpAlHtRsZ1A8KDo6IDSGVNZZXbQs+fOwMOGp/Bzod8f1YI +# 8Gb2oN/mx2ccvdGr9la55QZeVsM7LfTaEPQxbgAcLgWDlIPcmTzcBksEzLOQsSpB +# zsqPaWI9ykVw5ofmrkFKMbpQT5EMki2suJoVM5xGgdZWnt/tz00xubPSKFi4B4IM +# FUB9mcANUq9cHaLsHbDJ+AUsVO0qnVjwzXPYJeR7C/B8X0Ul6UkIdplZmncQZSBK +# 3yZQy+oGsuJKXFAq3BlxT6kDuhYYvO7itLrPeY0knut1rKkxom+ui6vCdthCfnAi +# yknyRC2lknqzz8x1mDkQ5Q6Ox9p6/lduFupSJMtgsCPN9fIvrfppMDFIvRoULsHO +# dLJjrRli8co5M+vZmf20oTxYuXzM0tbRurEJycB5ZMbwznsFHymOkgyx8OeFnXV3 +# car45uejI1B1iqUDbeSNxnvczuOhcpzwackCAwEAAaOCATYwggEyMB0GA1UdDgQW +# BBR4zJFuh59GwpTuSju4STcflihmkzAfBgNVHSMEGDAWgBSfpxVdAF5iXYP05dJl +# pxtTNRnpcjBfBgNVHR8EWDBWMFSgUqBQhk5odHRwOi8vd3d3Lm1pY3Jvc29mdC5j +# b20vcGtpb3BzL2NybC9NaWNyb3NvZnQlMjBUaW1lLVN0YW1wJTIwUENBJTIwMjAx +# MCgxKS5jcmwwbAYIKwYBBQUHAQEEYDBeMFwGCCsGAQUFBzAChlBodHRwOi8vd3d3 +# Lm1pY3Jvc29mdC5jb20vcGtpb3BzL2NlcnRzL01pY3Jvc29mdCUyMFRpbWUtU3Rh +# bXAlMjBQQ0ElMjAyMDEwKDEpLmNydDAMBgNVHRMBAf8EAjAAMBMGA1UdJQQMMAoG +# CCsGAQUFBwMIMA0GCSqGSIb3DQEBCwUAA4ICAQA1r3Oz0lEq3VvpdFlh3YBxc4hn +# YkALyYPDa9FO4XgqwkBm8Lsb+lK3tbGGgpi6QJbK3iM3BK0ObBcwRaJVCxGLGtr6 +# Jz9hRumRyF8o4n2y3YiKv4olBxNjFShSGc9E29JmVjBmLgmfjRqPc/2rD25q4ow4 +# uA3rc9ekiaufgGhcSAdek/l+kASbzohOt/5z2+IlgT4e3auSUzt2GAKfKZB02ZDG +# WKKeCY3pELj1tuh6yfrOJPPInO4ZZLW3vgKavtL8e6FJZyJoDFMewJ59oEL+AK3e +# 2M2I4IFE9n6LVS8bS9UbMUMvrAlXN5ZM2I8GdHB9TbfI17Wm/9Uf4qu588PJN7vC +# Jj9s+KxZqXc5sGScLgqiPqIbbNTE+/AEZ/eTixc9YLgTyMqakZI59wGqjrONQSY7 +# u0VEDkEE6ikz+FSFRKKzpySb0WTgMvWxsLvbnN8ACmISPnBHYZoGssPAL7foGGKF +# LdABTQC2PX19WjrfyrshHdiqSlCspqIGBTxRaHtyPMro3B/26gPfCl3MC3rC3NGq +# 4xGnIHDZGSizUmGg8TkQAloVdU5dJ1v910gjxaxaUraGhP8IttE0RWnU5XRp/sGa +# NmDcMwbyHuSpaFsn3Q21OzitP4BnN5tprHangAC7joe4zmLnmRnAiUc9sRqQ2bms +# MAvUpsO8nlOFmiM1LzCCB3EwggVZoAMCAQICEzMAAAAVxedrngKbSZkAAAAAABUw +# DQYJKoZIhvcNAQELBQAwgYgxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpXYXNoaW5n +# dG9uMRAwDgYDVQQHEwdSZWRtb25kMR4wHAYDVQQKExVNaWNyb3NvZnQgQ29ycG9y +# YXRpb24xMjAwBgNVBAMTKU1pY3Jvc29mdCBSb290IENlcnRpZmljYXRlIEF1dGhv +# cml0eSAyMDEwMB4XDTIxMDkzMDE4MjIyNVoXDTMwMDkzMDE4MzIyNVowfDELMAkG +# A1UEBhMCVVMxEzARBgNVBAgTCldhc2hpbmd0b24xEDAOBgNVBAcTB1JlZG1vbmQx +# HjAcBgNVBAoTFU1pY3Jvc29mdCBDb3Jwb3JhdGlvbjEmMCQGA1UEAxMdTWljcm9z +# b2Z0IFRpbWUtU3RhbXAgUENBIDIwMTAwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAw +# ggIKAoICAQDk4aZM57RyIQt5osvXJHm9DtWC0/3unAcH0qlsTnXIyjVX9gF/bErg +# 4r25PhdgM/9cT8dm95VTcVrifkpa/rg2Z4VGIwy1jRPPdzLAEBjoYH1qUoNEt6aO +# RmsHFPPFdvWGUNzBRMhxXFExN6AKOG6N7dcP2CZTfDlhAnrEqv1yaa8dq6z2Nr41 +# JmTamDu6GnszrYBbfowQHJ1S/rboYiXcag/PXfT+jlPP1uyFVk3v3byNpOORj7I5 +# LFGc6XBpDco2LXCOMcg1KL3jtIckw+DJj361VI/c+gVVmG1oO5pGve2krnopN6zL +# 64NF50ZuyjLVwIYwXE8s4mKyzbnijYjklqwBSru+cakXW2dg3viSkR4dPf0gz3N9 +# QZpGdc3EXzTdEonW/aUgfX782Z5F37ZyL9t9X4C626p+Nuw2TPYrbqgSUei/BQOj +# 0XOmTTd0lBw0gg/wEPK3Rxjtp+iZfD9M269ewvPV2HM9Q07BMzlMjgK8QmguEOqE +# UUbi0b1qGFphAXPKZ6Je1yh2AuIzGHLXpyDwwvoSCtdjbwzJNmSLW6CmgyFdXzB0 +# kZSU2LlQ+QuJYfM2BjUYhEfb3BvR/bLUHMVr9lxSUV0S2yW6r1AFemzFER1y7435 +# UsSFF5PAPBXbGjfHCBUYP3irRbb1Hode2o+eFnJpxq57t7c+auIurQIDAQABo4IB +# 3TCCAdkwEgYJKwYBBAGCNxUBBAUCAwEAATAjBgkrBgEEAYI3FQIEFgQUKqdS/mTE +# mr6CkTxGNSnPEP8vBO4wHQYDVR0OBBYEFJ+nFV0AXmJdg/Tl0mWnG1M1GelyMFwG +# A1UdIARVMFMwUQYMKwYBBAGCN0yDfQEBMEEwPwYIKwYBBQUHAgEWM2h0dHA6Ly93 +# d3cubWljcm9zb2Z0LmNvbS9wa2lvcHMvRG9jcy9SZXBvc2l0b3J5Lmh0bTATBgNV +# HSUEDDAKBggrBgEFBQcDCDAZBgkrBgEEAYI3FAIEDB4KAFMAdQBiAEMAQTALBgNV +# HQ8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAfBgNVHSMEGDAWgBTV9lbLj+iiXGJo +# 0T2UkFvXzpoYxDBWBgNVHR8ETzBNMEugSaBHhkVodHRwOi8vY3JsLm1pY3Jvc29m +# dC5jb20vcGtpL2NybC9wcm9kdWN0cy9NaWNSb29DZXJBdXRfMjAxMC0wNi0yMy5j +# cmwwWgYIKwYBBQUHAQEETjBMMEoGCCsGAQUFBzAChj5odHRwOi8vd3d3Lm1pY3Jv +# c29mdC5jb20vcGtpL2NlcnRzL01pY1Jvb0NlckF1dF8yMDEwLTA2LTIzLmNydDAN +# BgkqhkiG9w0BAQsFAAOCAgEAnVV9/Cqt4SwfZwExJFvhnnJL/Klv6lwUtj5OR2R4 +# sQaTlz0xM7U518JxNj/aZGx80HU5bbsPMeTCj/ts0aGUGCLu6WZnOlNN3Zi6th54 +# 2DYunKmCVgADsAW+iehp4LoJ7nvfam++Kctu2D9IdQHZGN5tggz1bSNU5HhTdSRX +# ud2f8449xvNo32X2pFaq95W2KFUn0CS9QKC/GbYSEhFdPSfgQJY4rPf5KYnDvBew +# VIVCs/wMnosZiefwC2qBwoEZQhlSdYo2wh3DYXMuLGt7bj8sCXgU6ZGyqVvfSaN0 +# DLzskYDSPeZKPmY7T7uG+jIa2Zb0j/aRAfbOxnT99kxybxCrdTDFNLB62FD+Cljd +# QDzHVG2dY3RILLFORy3BFARxv2T5JL5zbcqOCb2zAVdJVGTZc9d/HltEAY5aGZFr +# DZ+kKNxnGSgkujhLmm77IVRrakURR6nxt67I6IleT53S0Ex2tVdUCbFpAUR+fKFh +# bHP+CrvsQWY9af3LwUFJfn6Tvsv4O+S3Fb+0zj6lMVGEvL8CwYKiexcdFYmNcP7n +# tdAoGokLjzbaukz5m/8K6TT4JDVnK+ANuOaMmdbhIurwJ0I9JZTmdHRbatGePu1+ +# oDEzfbzL6Xu/OHBE0ZDxyKs6ijoIYn/ZcGNTTY3ugm2lBRDBcQZqELQdVTNYs6Fw +# ZvKhggLXMIICQAIBATCCAQChgdikgdUwgdIxCzAJBgNVBAYTAlVTMRMwEQYDVQQI +# EwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdSZWRtb25kMR4wHAYDVQQKExVNaWNyb3Nv +# ZnQgQ29ycG9yYXRpb24xLTArBgNVBAsTJE1pY3Jvc29mdCBJcmVsYW5kIE9wZXJh +# dGlvbnMgTGltaXRlZDEmMCQGA1UECxMdVGhhbGVzIFRTUyBFU046QTI0MC00Qjgy +# LTEzMEUxJTAjBgNVBAMTHE1pY3Jvc29mdCBUaW1lLVN0YW1wIFNlcnZpY2WiIwoB +# ATAHBgUrDgMCGgMVAIBzlZM9TRND4PgtpLWQZkSPYVcJoIGDMIGApH4wfDELMAkG +# A1UEBhMCVVMxEzARBgNVBAgTCldhc2hpbmd0b24xEDAOBgNVBAcTB1JlZG1vbmQx +# HjAcBgNVBAoTFU1pY3Jvc29mdCBDb3Jwb3JhdGlvbjEmMCQGA1UEAxMdTWljcm9z +# b2Z0IFRpbWUtU3RhbXAgUENBIDIwMTAwDQYJKoZIhvcNAQEFBQACBQDl73XWMCIY +# DzIwMjIwMzMxMDgzNTM0WhgPMjAyMjA0MDEwODM1MzRaMHcwPQYKKwYBBAGEWQoE +# ATEvMC0wCgIFAOXvddYCAQAwCgIBAAICF6kCAf8wBwIBAAICER8wCgIFAOXwx1YC +# AQAwNgYKKwYBBAGEWQoEAjEoMCYwDAYKKwYBBAGEWQoDAqAKMAgCAQACAwehIKEK +# MAgCAQACAwGGoDANBgkqhkiG9w0BAQUFAAOBgQAY60kde7HWABLbM75dgVqLPwu2 +# UX3qQDaoStTqkS7953pYHKc6GEqRd/nLCCeYBqC+XJRMTMNbd4ZDkkCzsxlr5HFi +# GE6eT7+KvwqQf+djK59ZAts0no9RPZcdCJwQfvqU3RK91gp/Sg2bCMvAfTN4LRGp +# qQ4tYYP2GrJJNqVbkDGCBA0wggQJAgEBMIGTMHwxCzAJBgNVBAYTAlVTMRMwEQYD +# VQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdSZWRtb25kMR4wHAYDVQQKExVNaWNy +# b3NvZnQgQ29ycG9yYXRpb24xJjAkBgNVBAMTHU1pY3Jvc29mdCBUaW1lLVN0YW1w +# IFBDQSAyMDEwAhMzAAABjXpVLnh0mSq3AAEAAAGNMA0GCWCGSAFlAwQCAQUAoIIB +# SjAaBgkqhkiG9w0BCQMxDQYLKoZIhvcNAQkQAQQwLwYJKoZIhvcNAQkEMSIEIOQz +# W64DlGXuO2zRgqB/n+gyoReL9ldfVdiKRVTSCDK+MIH6BgsqhkiG9w0BCRACLzGB +# 6jCB5zCB5DCBvQQgnpYRM/odXkDAnzf2udL569W8cfGTgwVuenQ8ttIYzX8wgZgw +# gYCkfjB8MQswCQYDVQQGEwJVUzETMBEGA1UECBMKV2FzaGluZ3RvbjEQMA4GA1UE +# BxMHUmVkbW9uZDEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMSYwJAYD +# VQQDEx1NaWNyb3NvZnQgVGltZS1TdGFtcCBQQ0EgMjAxMAITMwAAAY16VS54dJkq +# twABAAABjTAiBCCgvCueU3dRfCsOKSpG5oksOx2/8SHFEjSLBygedl9oUzANBgkq +# hkiG9w0BAQsFAASCAgASDKu2OAv74hH075B2jN90FtXMtuST3zF61GC5OXm38b4j +# NSjLjbMslJJqeXiyODEQFNxmdE9AgPguQK13CeNnqsx2krlMfIC4o+M2pN7lqWCk +# gWfp5QemsmucuotA2dXLF98jGlQ1JShvFVOvUyxs0QKejf323B/mYdoUzvKurP1M +# k+FUjq/w3mgN9oj5oHoCIkdg1gDWNh80zEa0/YxEE7YYzg8bPLsGpK+f7B75Q51Y +# Sz7Gp/LGpQiG/LjytNQmsHwy/bl3FCr5/2WxBkAs8BneisPIfNLW0gfEo5Azkjo9 +# KEm5l8ILkJ3/4Qx9HiGjqwrdto8kGWAlGoIELtsO0BGT4onF4ynlKQgw82JK+4RD +# tWXCnPqjojkl+/4tfbeEdUoPvNgYpvS6ZRRYJIWg5s7XViroohZCCSkqt8aMjTZF +# HJBsKzmdHvVvAGELQ7TKaN3mOMUXb/o4vIK0TYrYN6FUn5iVnA7X2LIbJj0j3Mef +# BwEeOFhSjxz2Ob1oihNBoR1v5y+XfkbT7igIVQqwM27ujcOooOsDkpgizs0FajJV +# jeRsqEsXgfpaKCAq5czpOTutrvvwEn/cINrR3JW1TRSGt3VUvSWkmBs1T+7Oj6H6 +# ewWQaQIDYdEiDUL8OJhl+GzebujxPo//NXTY0MZCxK3DXhXi5okwsImzh5010w== +# SIG # End signature block diff --git a/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/PreloadAssemblies/Azure.Core.dll b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/PreloadAssemblies/Azure.Core.dll new file mode 100644 index 000000000000..67edb79248ca Binary files /dev/null and b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/PreloadAssemblies/Azure.Core.dll differ diff --git a/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/PreloadAssemblies/Azure.Identity.dll b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/PreloadAssemblies/Azure.Identity.dll new file mode 100644 index 000000000000..0d214db71cad Binary files /dev/null and b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/PreloadAssemblies/Azure.Identity.dll differ diff --git a/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/PreloadAssemblies/Microsoft.Azure.PowerShell.Authenticators.dll b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/PreloadAssemblies/Microsoft.Azure.PowerShell.Authenticators.dll new file mode 100644 index 000000000000..2b2e59f4a657 Binary files /dev/null and b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/PreloadAssemblies/Microsoft.Azure.PowerShell.Authenticators.dll differ diff --git a/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/PreloadAssemblies/Microsoft.Bcl.AsyncInterfaces.dll b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/PreloadAssemblies/Microsoft.Bcl.AsyncInterfaces.dll new file mode 100644 index 000000000000..869ac1b86c57 Binary files /dev/null and b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/PreloadAssemblies/Microsoft.Bcl.AsyncInterfaces.dll differ diff --git a/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/PreloadAssemblies/Microsoft.Identity.Client.Extensions.Msal.dll b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/PreloadAssemblies/Microsoft.Identity.Client.Extensions.Msal.dll new file mode 100644 index 000000000000..d22ddefa2339 Binary files /dev/null and b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/PreloadAssemblies/Microsoft.Identity.Client.Extensions.Msal.dll differ diff --git a/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/PreloadAssemblies/Microsoft.Identity.Client.dll b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/PreloadAssemblies/Microsoft.Identity.Client.dll new file mode 100644 index 000000000000..7f392562319f Binary files /dev/null and b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/PreloadAssemblies/Microsoft.Identity.Client.dll differ diff --git a/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/PreloadAssemblies/Newtonsoft.Json.12.0.3.dll b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/PreloadAssemblies/Newtonsoft.Json.12.0.3.dll new file mode 100644 index 000000000000..6344999edbb3 Binary files /dev/null and b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/PreloadAssemblies/Newtonsoft.Json.12.0.3.dll differ diff --git a/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/PreloadAssemblies/Newtonsoft.Json.dll b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/PreloadAssemblies/Newtonsoft.Json.dll new file mode 100644 index 000000000000..9b0ae142146e Binary files /dev/null and b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/PreloadAssemblies/Newtonsoft.Json.dll differ diff --git a/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Buffers.dll b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Buffers.dll new file mode 100644 index 000000000000..c517a3b62cc7 Binary files /dev/null and b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Buffers.dll differ diff --git a/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Diagnostics.DiagnosticSource.dll b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Diagnostics.DiagnosticSource.dll new file mode 100644 index 000000000000..a2b54fb042de Binary files /dev/null and b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Diagnostics.DiagnosticSource.dll differ diff --git a/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Memory.Data.dll b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Memory.Data.dll new file mode 100644 index 000000000000..5aa381018c00 Binary files /dev/null and b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Memory.Data.dll differ diff --git a/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Memory.dll b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Memory.dll new file mode 100644 index 000000000000..bdfc501e9647 Binary files /dev/null and b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Memory.dll differ diff --git a/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Net.Http.WinHttpHandler.dll b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Net.Http.WinHttpHandler.dll new file mode 100644 index 000000000000..8bd471e74c6e Binary files /dev/null and b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Net.Http.WinHttpHandler.dll differ diff --git a/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Numerics.Vectors.dll b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Numerics.Vectors.dll new file mode 100644 index 000000000000..08659724d4f8 Binary files /dev/null and b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Numerics.Vectors.dll differ diff --git a/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Private.ServiceModel.dll b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Private.ServiceModel.dll new file mode 100644 index 000000000000..3f9f84edf0ed Binary files /dev/null and b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Private.ServiceModel.dll differ diff --git a/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Reflection.DispatchProxy.dll b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Reflection.DispatchProxy.dll new file mode 100644 index 000000000000..64a57cbbecce Binary files /dev/null and b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Reflection.DispatchProxy.dll differ diff --git a/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Runtime.CompilerServices.Unsafe.dll b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Runtime.CompilerServices.Unsafe.dll new file mode 100644 index 000000000000..0c27a0e21c7e Binary files /dev/null and b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Runtime.CompilerServices.Unsafe.dll differ diff --git a/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Security.AccessControl.dll b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Security.AccessControl.dll new file mode 100644 index 000000000000..e8074324cd13 Binary files /dev/null and b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Security.AccessControl.dll differ diff --git a/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Security.Cryptography.Cng.dll b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Security.Cryptography.Cng.dll new file mode 100644 index 000000000000..4f4c30e080bd Binary files /dev/null and b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Security.Cryptography.Cng.dll differ diff --git a/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Security.Permissions.dll b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Security.Permissions.dll new file mode 100644 index 000000000000..d1af38f0f8b7 Binary files /dev/null and b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Security.Permissions.dll differ diff --git a/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Security.Principal.Windows.dll b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Security.Principal.Windows.dll new file mode 100644 index 000000000000..afd187c14918 Binary files /dev/null and b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Security.Principal.Windows.dll differ diff --git a/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.ServiceModel.Primitives.dll b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.ServiceModel.Primitives.dll new file mode 100644 index 000000000000..c1aa0a64f8f9 Binary files /dev/null and b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.ServiceModel.Primitives.dll differ diff --git a/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Text.Encodings.Web.dll b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Text.Encodings.Web.dll new file mode 100644 index 000000000000..6d2b207854ac Binary files /dev/null and b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Text.Encodings.Web.dll differ diff --git a/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Text.Json.dll b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Text.Json.dll new file mode 100644 index 000000000000..a3a85c2b7255 Binary files /dev/null and b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Text.Json.dll differ diff --git a/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Threading.Tasks.Extensions.dll b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Threading.Tasks.Extensions.dll new file mode 100644 index 000000000000..dfab23478ab4 Binary files /dev/null and b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Threading.Tasks.Extensions.dll differ diff --git a/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Xml.ReaderWriter.dll b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Xml.ReaderWriter.dll new file mode 100644 index 000000000000..022e63a21a86 Binary files /dev/null and b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Xml.ReaderWriter.dll differ diff --git a/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/StartupScripts/AzError.ps1 b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/StartupScripts/AzError.ps1 new file mode 100644 index 000000000000..f234bd2dd7e5 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/StartupScripts/AzError.ps1 @@ -0,0 +1,278 @@ +function Write-InstallationCheckToFile +{ + Param($installationchecks) + if (Get-Module AzureRM.Profile -ListAvailable -ErrorAction Ignore) + { + Write-Warning ("Both Az and AzureRM modules were detected on this machine. Az and AzureRM modules cannot be imported in the same session or used in the same script or runbook. If you are running PowerShell in an environment you control you can use the 'Uninstall-AzureRm' cmdlet to remove all AzureRm modules from your machine. " + + "If you are running in Azure Automation, take care that none of your runbooks import both Az and AzureRM modules. More information can be found here: https://aka.ms/azps-migration-guide") + } + + $installationchecks.Add("AzSideBySideCheck","true") + try + { + if (Test-Path $pathToInstallationChecks -ErrorAction Ignore) + { + Remove-Item -Path $pathToInstallationChecks -ErrorAction Stop + } + + $pathToInstallDir = Split-Path -Path $pathToInstallationChecks -Parent -ErrorAction Stop + if (Test-Path $pathToInstallDir -ErrorAction Ignore) + { + New-Item -Path $pathToInstallationChecks -ErrorAction Stop -ItemType File -Value ($installationchecks | ConvertTo-Json -ErrorAction Stop) + } + } + catch + { + Write-Verbose "Installation checks failed to write to file." + } +} + +if (!($env:SkipAzInstallationChecks -eq "true")) +{ + $pathToInstallationChecks = Join-Path (Join-Path $HOME ".Azure") "AzInstallationChecks.json" + $installationchecks = @{} + if (!(Test-Path $pathToInstallationChecks -ErrorAction Ignore)) + { + Write-InstallationCheckToFile $installationchecks + } + else + { + try + { + ((Get-Content $pathToInstallationChecks -ErrorAction Stop) | ConvertFrom-Json -ErrorAction Stop).PSObject.Properties | Foreach { $installationchecks[$_.Name] = $_.Value } + } + catch + { + Write-InstallationCheckToFile $installationchecks + } + + if (!$installationchecks.ContainsKey("AzSideBySideCheck")) + { + Write-InstallationCheckToFile $installationchecks + } + } +} + +if (Get-Module AzureRM.profile -ErrorAction Ignore) +{ + Write-Warning ("AzureRM.Profile already loaded. Az and AzureRM modules cannot be imported in the same session or used in the same script or runbook. If you are running PowerShell in an environment you control you can use the 'Uninstall-AzureRm' cmdlet to remove all AzureRm modules from your machine. " + + "If you are running in Azure Automation, take care that none of your runbooks import both Az and AzureRM modules. More information can be found here: https://aka.ms/azps-migration-guide.") + throw ("AzureRM.Profile already loaded. Az and AzureRM modules cannot be imported in the same session or used in the same script or runbook. If you are running PowerShell in an environment you control you can use the 'Uninstall-AzureRm' cmdlet to remove all AzureRm modules from your machine. " + + "If you are running in Azure Automation, take care that none of your runbooks import both Az and AzureRM modules. More information can be found here: https://aka.ms/azps-migration-guide.") +} + +Update-TypeData -AppendPath (Join-Path (Get-Item $PSScriptRoot).Parent.FullName Accounts.types.ps1xml) -ErrorAction Ignore +# SIG # Begin signature block +# MIInuQYJKoZIhvcNAQcCoIInqjCCJ6YCAQExDzANBglghkgBZQMEAgEFADB5Bgor +# BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG +# KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCDT3s8rOGw0kP8l +# AbYXJ7G9hr2fOKBRtW5xO6fWVEOZvqCCDYEwggX/MIID56ADAgECAhMzAAACUosz +# qviV8znbAAAAAAJSMA0GCSqGSIb3DQEBCwUAMH4xCzAJBgNVBAYTAlVTMRMwEQYD +# VQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdSZWRtb25kMR4wHAYDVQQKExVNaWNy +# b3NvZnQgQ29ycG9yYXRpb24xKDAmBgNVBAMTH01pY3Jvc29mdCBDb2RlIFNpZ25p +# bmcgUENBIDIwMTEwHhcNMjEwOTAyMTgzMjU5WhcNMjIwOTAxMTgzMjU5WjB0MQsw +# CQYDVQQGEwJVUzETMBEGA1UECBMKV2FzaGluZ3RvbjEQMA4GA1UEBxMHUmVkbW9u +# ZDEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMR4wHAYDVQQDExVNaWNy +# b3NvZnQgQ29ycG9yYXRpb24wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIB +# AQDQ5M+Ps/X7BNuv5B/0I6uoDwj0NJOo1KrVQqO7ggRXccklyTrWL4xMShjIou2I +# sbYnF67wXzVAq5Om4oe+LfzSDOzjcb6ms00gBo0OQaqwQ1BijyJ7NvDf80I1fW9O +# L76Kt0Wpc2zrGhzcHdb7upPrvxvSNNUvxK3sgw7YTt31410vpEp8yfBEl/hd8ZzA +# v47DCgJ5j1zm295s1RVZHNp6MoiQFVOECm4AwK2l28i+YER1JO4IplTH44uvzX9o +# RnJHaMvWzZEpozPy4jNO2DDqbcNs4zh7AWMhE1PWFVA+CHI/En5nASvCvLmuR/t8 +# q4bc8XR8QIZJQSp+2U6m2ldNAgMBAAGjggF+MIIBejAfBgNVHSUEGDAWBgorBgEE +# AYI3TAgBBggrBgEFBQcDAzAdBgNVHQ4EFgQUNZJaEUGL2Guwt7ZOAu4efEYXedEw +# UAYDVR0RBEkwR6RFMEMxKTAnBgNVBAsTIE1pY3Jvc29mdCBPcGVyYXRpb25zIFB1 +# ZXJ0byBSaWNvMRYwFAYDVQQFEw0yMzAwMTIrNDY3NTk3MB8GA1UdIwQYMBaAFEhu +# ZOVQBdOCqhc3NyK1bajKdQKVMFQGA1UdHwRNMEswSaBHoEWGQ2h0dHA6Ly93d3cu +# bWljcm9zb2Z0LmNvbS9wa2lvcHMvY3JsL01pY0NvZFNpZ1BDQTIwMTFfMjAxMS0w +# Ny0wOC5jcmwwYQYIKwYBBQUHAQEEVTBTMFEGCCsGAQUFBzAChkVodHRwOi8vd3d3 +# Lm1pY3Jvc29mdC5jb20vcGtpb3BzL2NlcnRzL01pY0NvZFNpZ1BDQTIwMTFfMjAx +# MS0wNy0wOC5jcnQwDAYDVR0TAQH/BAIwADANBgkqhkiG9w0BAQsFAAOCAgEAFkk3 +# uSxkTEBh1NtAl7BivIEsAWdgX1qZ+EdZMYbQKasY6IhSLXRMxF1B3OKdR9K/kccp +# kvNcGl8D7YyYS4mhCUMBR+VLrg3f8PUj38A9V5aiY2/Jok7WZFOAmjPRNNGnyeg7 +# l0lTiThFqE+2aOs6+heegqAdelGgNJKRHLWRuhGKuLIw5lkgx9Ky+QvZrn/Ddi8u +# TIgWKp+MGG8xY6PBvvjgt9jQShlnPrZ3UY8Bvwy6rynhXBaV0V0TTL0gEx7eh/K1 +# o8Miaru6s/7FyqOLeUS4vTHh9TgBL5DtxCYurXbSBVtL1Fj44+Od/6cmC9mmvrti +# yG709Y3Rd3YdJj2f3GJq7Y7KdWq0QYhatKhBeg4fxjhg0yut2g6aM1mxjNPrE48z +# 6HWCNGu9gMK5ZudldRw4a45Z06Aoktof0CqOyTErvq0YjoE4Xpa0+87T/PVUXNqf +# 7Y+qSU7+9LtLQuMYR4w3cSPjuNusvLf9gBnch5RqM7kaDtYWDgLyB42EfsxeMqwK +# WwA+TVi0HrWRqfSx2olbE56hJcEkMjOSKz3sRuupFCX3UroyYf52L+2iVTrda8XW +# esPG62Mnn3T8AuLfzeJFuAbfOSERx7IFZO92UPoXE1uEjL5skl1yTZB3MubgOA4F +# 8KoRNhviFAEST+nG8c8uIsbZeb08SeYQMqjVEmkwggd6MIIFYqADAgECAgphDpDS +# AAAAAAADMA0GCSqGSIb3DQEBCwUAMIGIMQswCQYDVQQGEwJVUzETMBEGA1UECBMK +# V2FzaGluZ3RvbjEQMA4GA1UEBxMHUmVkbW9uZDEeMBwGA1UEChMVTWljcm9zb2Z0 +# IENvcnBvcmF0aW9uMTIwMAYDVQQDEylNaWNyb3NvZnQgUm9vdCBDZXJ0aWZpY2F0 +# ZSBBdXRob3JpdHkgMjAxMTAeFw0xMTA3MDgyMDU5MDlaFw0yNjA3MDgyMTA5MDla +# MH4xCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdS +# ZWRtb25kMR4wHAYDVQQKExVNaWNyb3NvZnQgQ29ycG9yYXRpb24xKDAmBgNVBAMT +# H01pY3Jvc29mdCBDb2RlIFNpZ25pbmcgUENBIDIwMTEwggIiMA0GCSqGSIb3DQEB +# AQUAA4ICDwAwggIKAoICAQCr8PpyEBwurdhuqoIQTTS68rZYIZ9CGypr6VpQqrgG +# OBoESbp/wwwe3TdrxhLYC/A4wpkGsMg51QEUMULTiQ15ZId+lGAkbK+eSZzpaF7S +# 35tTsgosw6/ZqSuuegmv15ZZymAaBelmdugyUiYSL+erCFDPs0S3XdjELgN1q2jz +# y23zOlyhFvRGuuA4ZKxuZDV4pqBjDy3TQJP4494HDdVceaVJKecNvqATd76UPe/7 +# 4ytaEB9NViiienLgEjq3SV7Y7e1DkYPZe7J7hhvZPrGMXeiJT4Qa8qEvWeSQOy2u +# M1jFtz7+MtOzAz2xsq+SOH7SnYAs9U5WkSE1JcM5bmR/U7qcD60ZI4TL9LoDho33 +# X/DQUr+MlIe8wCF0JV8YKLbMJyg4JZg5SjbPfLGSrhwjp6lm7GEfauEoSZ1fiOIl +# XdMhSz5SxLVXPyQD8NF6Wy/VI+NwXQ9RRnez+ADhvKwCgl/bwBWzvRvUVUvnOaEP +# 6SNJvBi4RHxF5MHDcnrgcuck379GmcXvwhxX24ON7E1JMKerjt/sW5+v/N2wZuLB +# l4F77dbtS+dJKacTKKanfWeA5opieF+yL4TXV5xcv3coKPHtbcMojyyPQDdPweGF +# RInECUzF1KVDL3SV9274eCBYLBNdYJWaPk8zhNqwiBfenk70lrC8RqBsmNLg1oiM +# CwIDAQABo4IB7TCCAekwEAYJKwYBBAGCNxUBBAMCAQAwHQYDVR0OBBYEFEhuZOVQ +# BdOCqhc3NyK1bajKdQKVMBkGCSsGAQQBgjcUAgQMHgoAUwB1AGIAQwBBMAsGA1Ud +# DwQEAwIBhjAPBgNVHRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFHItOgIxkEO5FAVO +# 4eqnxzHRI4k0MFoGA1UdHwRTMFEwT6BNoEuGSWh0dHA6Ly9jcmwubWljcm9zb2Z0 +# LmNvbS9wa2kvY3JsL3Byb2R1Y3RzL01pY1Jvb0NlckF1dDIwMTFfMjAxMV8wM18y +# Mi5jcmwwXgYIKwYBBQUHAQEEUjBQME4GCCsGAQUFBzAChkJodHRwOi8vd3d3Lm1p +# Y3Jvc29mdC5jb20vcGtpL2NlcnRzL01pY1Jvb0NlckF1dDIwMTFfMjAxMV8wM18y +# Mi5jcnQwgZ8GA1UdIASBlzCBlDCBkQYJKwYBBAGCNy4DMIGDMD8GCCsGAQUFBwIB +# FjNodHRwOi8vd3d3Lm1pY3Jvc29mdC5jb20vcGtpb3BzL2RvY3MvcHJpbWFyeWNw +# cy5odG0wQAYIKwYBBQUHAgIwNB4yIB0ATABlAGcAYQBsAF8AcABvAGwAaQBjAHkA +# XwBzAHQAYQB0AGUAbQBlAG4AdAAuIB0wDQYJKoZIhvcNAQELBQADggIBAGfyhqWY +# 4FR5Gi7T2HRnIpsLlhHhY5KZQpZ90nkMkMFlXy4sPvjDctFtg/6+P+gKyju/R6mj +# 82nbY78iNaWXXWWEkH2LRlBV2AySfNIaSxzzPEKLUtCw/WvjPgcuKZvmPRul1LUd +# d5Q54ulkyUQ9eHoj8xN9ppB0g430yyYCRirCihC7pKkFDJvtaPpoLpWgKj8qa1hJ +# Yx8JaW5amJbkg/TAj/NGK978O9C9Ne9uJa7lryft0N3zDq+ZKJeYTQ49C/IIidYf +# wzIY4vDFLc5bnrRJOQrGCsLGra7lstnbFYhRRVg4MnEnGn+x9Cf43iw6IGmYslmJ +# aG5vp7d0w0AFBqYBKig+gj8TTWYLwLNN9eGPfxxvFX1Fp3blQCplo8NdUmKGwx1j +# NpeG39rz+PIWoZon4c2ll9DuXWNB41sHnIc+BncG0QaxdR8UvmFhtfDcxhsEvt9B +# xw4o7t5lL+yX9qFcltgA1qFGvVnzl6UJS0gQmYAf0AApxbGbpT9Fdx41xtKiop96 +# eiL6SJUfq/tHI4D1nvi/a7dLl+LrdXga7Oo3mXkYS//WsyNodeav+vyL6wuA6mk7 +# r/ww7QRMjt/fdW1jkT3RnVZOT7+AVyKheBEyIXrvQQqxP/uozKRdwaGIm1dxVk5I +# RcBCyZt2WwqASGv9eZ/BvW1taslScxMNelDNMYIZjjCCGYoCAQEwgZUwfjELMAkG +# A1UEBhMCVVMxEzARBgNVBAgTCldhc2hpbmd0b24xEDAOBgNVBAcTB1JlZG1vbmQx +# HjAcBgNVBAoTFU1pY3Jvc29mdCBDb3Jwb3JhdGlvbjEoMCYGA1UEAxMfTWljcm9z +# b2Z0IENvZGUgU2lnbmluZyBQQ0EgMjAxMQITMwAAAlKLM6r4lfM52wAAAAACUjAN +# BglghkgBZQMEAgEFAKCBrjAZBgkqhkiG9w0BCQMxDAYKKwYBBAGCNwIBBDAcBgor +# BgEEAYI3AgELMQ4wDAYKKwYBBAGCNwIBFTAvBgkqhkiG9w0BCQQxIgQgpH7D8Not +# WnytrY9dBBVdkjoPJbp/Jb5/OaJtNH+9PHMwQgYKKwYBBAGCNwIBDDE0MDKgFIAS +# AE0AaQBjAHIAbwBzAG8AZgB0oRqAGGh0dHA6Ly93d3cubWljcm9zb2Z0LmNvbTAN +# BgkqhkiG9w0BAQEFAASCAQBeESsu04jkAEIOu00+XAL5Cw3b4lPK1+Y/A63nt7uC +# g0IvVE66lSl52+b6CVBX/G72fi7HlOIYoCyVKEIasUVN+dqAtdM2ib0RLRPrWxH9 +# 2axBlgxQg9nBAZkklffNIZjmkC+gZN37i3g0DHSwmb1ej9OwHDD0MYQpF8oIa81e +# oj07j6dAzRwVM0TaHEJj9kPXA81HN6CAYBJ/V3p0wYRbp3c2L9j2R9MtVVvnx/7z +# sbKvHJV+l3b/xCT5T0/J5l5QoLzzNyfWB7Zvaz0DbKX1bln/rcb8uPYKVEz4wsKW +# 5zAm12WLQ87vxiIGLA6tv4lXxggEAUm68Nwjfw6vqkHRoYIXGDCCFxQGCisGAQQB +# gjcDAwExghcEMIIXAAYJKoZIhvcNAQcCoIIW8TCCFu0CAQMxDzANBglghkgBZQME +# AgEFADCCAVgGCyqGSIb3DQEJEAEEoIIBRwSCAUMwggE/AgEBBgorBgEEAYRZCgMB +# MDEwDQYJYIZIAWUDBAIBBQAEIEbwTnYvqLH2wAcLSr8ZwikKunQnLTH8PEiqd0Vr +# sTtWAgZiMTFcHxoYEjIwMjIwMzMxMTAwMDA4Ljg4WjAEgAIB9KCB2KSB1TCB0jEL +# MAkGA1UEBhMCVVMxEzARBgNVBAgTCldhc2hpbmd0b24xEDAOBgNVBAcTB1JlZG1v +# bmQxHjAcBgNVBAoTFU1pY3Jvc29mdCBDb3Jwb3JhdGlvbjEtMCsGA1UECxMkTWlj +# cm9zb2Z0IElyZWxhbmQgT3BlcmF0aW9ucyBMaW1pdGVkMSYwJAYDVQQLEx1UaGFs +# ZXMgVFNTIEVTTjpBMjQwLTRCODItMTMwRTElMCMGA1UEAxMcTWljcm9zb2Z0IFRp +# bWUtU3RhbXAgU2VydmljZaCCEWgwggcUMIIE/KADAgECAhMzAAABjXpVLnh0mSq3 +# AAEAAAGNMA0GCSqGSIb3DQEBCwUAMHwxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpX +# YXNoaW5ndG9uMRAwDgYDVQQHEwdSZWRtb25kMR4wHAYDVQQKExVNaWNyb3NvZnQg +# Q29ycG9yYXRpb24xJjAkBgNVBAMTHU1pY3Jvc29mdCBUaW1lLVN0YW1wIFBDQSAy +# MDEwMB4XDTIxMTAyODE5Mjc0NVoXDTIzMDEyNjE5Mjc0NVowgdIxCzAJBgNVBAYT +# AlVTMRMwEQYDVQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdSZWRtb25kMR4wHAYD +# VQQKExVNaWNyb3NvZnQgQ29ycG9yYXRpb24xLTArBgNVBAsTJE1pY3Jvc29mdCBJ +# cmVsYW5kIE9wZXJhdGlvbnMgTGltaXRlZDEmMCQGA1UECxMdVGhhbGVzIFRTUyBF +# U046QTI0MC00QjgyLTEzMEUxJTAjBgNVBAMTHE1pY3Jvc29mdCBUaW1lLVN0YW1w +# IFNlcnZpY2UwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDaNEgtmD47 +# pTt0ty7AE8wH7S0lTPTAcuonl/soldCxPNZOgANQxhXjFVmen2Y9NaiNQn+Xc7he +# p6AsM124UA5tyK2svJjkcOzEB9QbX/ZiKVxKRI/oJwypZ+xLBQsZfnOWxUocnu2/ +# CDbrLp4uSVR0UymKrb3hPi4lB1d3k7uYXLS9WRoY8bE1YttnEo3Ooq0WdZDuMy1n +# Tle9p+QhZms1MW/wYakCUe1GxnUDwoOjogNIZU1lldtCz587Aw4an8HOh3x/Vgjw +# Zvag3+bHZxy90av2VrnlBl5Wwzst9NoQ9DFuABwuBYOUg9yZPNwGSwTMs5CxKkHO +# yo9pYj3KRXDmh+auQUoxulBPkQySLay4mhUznEaB1lae3+3PTTG5s9IoWLgHggwV +# QH2ZwA1Sr1wdouwdsMn4BSxU7SqdWPDNc9gl5HsL8HxfRSXpSQh2mVmadxBlIErf +# JlDL6gay4kpcUCrcGXFPqQO6Fhi87uK0us95jSSe63WsqTGib66Lq8J22EJ+cCLK +# SfJELaWSerPPzHWYORDlDo7H2nr+V24W6lIky2CwI8318i+t+mkwMUi9GhQuwc50 +# smOtGWLxyjkz69mZ/bShPFi5fMzS1tG6sQnJwHlkxvDOewUfKY6SDLHw54WddXdx +# qvjm56MjUHWKpQNt5I3Ge9zO46FynPBpyQIDAQABo4IBNjCCATIwHQYDVR0OBBYE +# FHjMkW6Hn0bClO5KO7hJNx+WKGaTMB8GA1UdIwQYMBaAFJ+nFV0AXmJdg/Tl0mWn +# G1M1GelyMF8GA1UdHwRYMFYwVKBSoFCGTmh0dHA6Ly93d3cubWljcm9zb2Z0LmNv +# bS9wa2lvcHMvY3JsL01pY3Jvc29mdCUyMFRpbWUtU3RhbXAlMjBQQ0ElMjAyMDEw +# KDEpLmNybDBsBggrBgEFBQcBAQRgMF4wXAYIKwYBBQUHMAKGUGh0dHA6Ly93d3cu +# bWljcm9zb2Z0LmNvbS9wa2lvcHMvY2VydHMvTWljcm9zb2Z0JTIwVGltZS1TdGFt +# cCUyMFBDQSUyMDIwMTAoMSkuY3J0MAwGA1UdEwEB/wQCMAAwEwYDVR0lBAwwCgYI +# KwYBBQUHAwgwDQYJKoZIhvcNAQELBQADggIBADWvc7PSUSrdW+l0WWHdgHFziGdi +# QAvJg8Nr0U7heCrCQGbwuxv6Ure1sYaCmLpAlsreIzcErQ5sFzBFolULEYsa2von +# P2FG6ZHIXyjifbLdiIq/iiUHE2MVKFIZz0Tb0mZWMGYuCZ+NGo9z/asPbmrijDi4 +# Detz16SJq5+AaFxIB16T+X6QBJvOiE63/nPb4iWBPh7dq5JTO3YYAp8pkHTZkMZY +# op4JjekQuPW26HrJ+s4k88ic7hlktbe+Apq+0vx7oUlnImgMUx7Ann2gQv4Ard7Y +# zYjggUT2fotVLxtL1RsxQy+sCVc3lkzYjwZ0cH1Nt8jXtab/1R/iq7nzw8k3u8Im +# P2z4rFmpdzmwZJwuCqI+ohts1MT78ARn95OLFz1guBPIypqRkjn3AaqOs41BJju7 +# RUQOQQTqKTP4VIVEorOnJJvRZOAy9bGwu9uc3wAKYhI+cEdhmgayw8Avt+gYYoUt +# 0AFNALY9fX1aOt/KuyEd2KpKUKymogYFPFFoe3I8yujcH/bqA98KXcwLesLc0arj +# EacgcNkZKLNSYaDxORACWhV1Tl0nW/3XSCPFrFpStoaE/wi20TRFadTldGn+wZo2 +# YNwzBvIe5KloWyfdDbU7OK0/gGc3m2msdqeAALuOh7jOYueZGcCJRz2xGpDZuaww +# C9Smw7yeU4WaIzUvMIIHcTCCBVmgAwIBAgITMwAAABXF52ueAptJmQAAAAAAFTAN +# BgkqhkiG9w0BAQsFADCBiDELMAkGA1UEBhMCVVMxEzARBgNVBAgTCldhc2hpbmd0 +# b24xEDAOBgNVBAcTB1JlZG1vbmQxHjAcBgNVBAoTFU1pY3Jvc29mdCBDb3Jwb3Jh +# dGlvbjEyMDAGA1UEAxMpTWljcm9zb2Z0IFJvb3QgQ2VydGlmaWNhdGUgQXV0aG9y +# aXR5IDIwMTAwHhcNMjEwOTMwMTgyMjI1WhcNMzAwOTMwMTgzMjI1WjB8MQswCQYD +# VQQGEwJVUzETMBEGA1UECBMKV2FzaGluZ3RvbjEQMA4GA1UEBxMHUmVkbW9uZDEe +# MBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMSYwJAYDVQQDEx1NaWNyb3Nv +# ZnQgVGltZS1TdGFtcCBQQ0EgMjAxMDCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCC +# AgoCggIBAOThpkzntHIhC3miy9ckeb0O1YLT/e6cBwfSqWxOdcjKNVf2AX9sSuDi +# vbk+F2Az/1xPx2b3lVNxWuJ+Slr+uDZnhUYjDLWNE893MsAQGOhgfWpSg0S3po5G +# awcU88V29YZQ3MFEyHFcUTE3oAo4bo3t1w/YJlN8OWECesSq/XJprx2rrPY2vjUm +# ZNqYO7oaezOtgFt+jBAcnVL+tuhiJdxqD89d9P6OU8/W7IVWTe/dvI2k45GPsjks +# UZzpcGkNyjYtcI4xyDUoveO0hyTD4MmPfrVUj9z6BVWYbWg7mka97aSueik3rMvr +# g0XnRm7KMtXAhjBcTyziYrLNueKNiOSWrAFKu75xqRdbZ2De+JKRHh09/SDPc31B +# mkZ1zcRfNN0Sidb9pSB9fvzZnkXftnIv231fgLrbqn427DZM9ituqBJR6L8FA6PR +# c6ZNN3SUHDSCD/AQ8rdHGO2n6Jl8P0zbr17C89XYcz1DTsEzOUyOArxCaC4Q6oRR +# RuLRvWoYWmEBc8pnol7XKHYC4jMYctenIPDC+hIK12NvDMk2ZItboKaDIV1fMHSR +# lJTYuVD5C4lh8zYGNRiER9vcG9H9stQcxWv2XFJRXRLbJbqvUAV6bMURHXLvjflS +# xIUXk8A8FdsaN8cIFRg/eKtFtvUeh17aj54WcmnGrnu3tz5q4i6tAgMBAAGjggHd +# MIIB2TASBgkrBgEEAYI3FQEEBQIDAQABMCMGCSsGAQQBgjcVAgQWBBQqp1L+ZMSa +# voKRPEY1Kc8Q/y8E7jAdBgNVHQ4EFgQUn6cVXQBeYl2D9OXSZacbUzUZ6XIwXAYD +# VR0gBFUwUzBRBgwrBgEEAYI3TIN9AQEwQTA/BggrBgEFBQcCARYzaHR0cDovL3d3 +# dy5taWNyb3NvZnQuY29tL3BraW9wcy9Eb2NzL1JlcG9zaXRvcnkuaHRtMBMGA1Ud +# JQQMMAoGCCsGAQUFBwMIMBkGCSsGAQQBgjcUAgQMHgoAUwB1AGIAQwBBMAsGA1Ud +# DwQEAwIBhjAPBgNVHRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFNX2VsuP6KJcYmjR +# PZSQW9fOmhjEMFYGA1UdHwRPME0wS6BJoEeGRWh0dHA6Ly9jcmwubWljcm9zb2Z0 +# LmNvbS9wa2kvY3JsL3Byb2R1Y3RzL01pY1Jvb0NlckF1dF8yMDEwLTA2LTIzLmNy +# bDBaBggrBgEFBQcBAQROMEwwSgYIKwYBBQUHMAKGPmh0dHA6Ly93d3cubWljcm9z +# b2Z0LmNvbS9wa2kvY2VydHMvTWljUm9vQ2VyQXV0XzIwMTAtMDYtMjMuY3J0MA0G +# CSqGSIb3DQEBCwUAA4ICAQCdVX38Kq3hLB9nATEkW+Geckv8qW/qXBS2Pk5HZHix +# BpOXPTEztTnXwnE2P9pkbHzQdTltuw8x5MKP+2zRoZQYIu7pZmc6U03dmLq2HnjY +# Ni6cqYJWAAOwBb6J6Gngugnue99qb74py27YP0h1AdkY3m2CDPVtI1TkeFN1JFe5 +# 3Z/zjj3G82jfZfakVqr3lbYoVSfQJL1AoL8ZthISEV09J+BAljis9/kpicO8F7BU +# hUKz/AyeixmJ5/ALaoHCgRlCGVJ1ijbCHcNhcy4sa3tuPywJeBTpkbKpW99Jo3QM +# vOyRgNI95ko+ZjtPu4b6MhrZlvSP9pEB9s7GdP32THJvEKt1MMU0sHrYUP4KWN1A +# PMdUbZ1jdEgssU5HLcEUBHG/ZPkkvnNtyo4JvbMBV0lUZNlz138eW0QBjloZkWsN +# n6Qo3GcZKCS6OEuabvshVGtqRRFHqfG3rsjoiV5PndLQTHa1V1QJsWkBRH58oWFs +# c/4Ku+xBZj1p/cvBQUl+fpO+y/g75LcVv7TOPqUxUYS8vwLBgqJ7Fx0ViY1w/ue1 +# 0CgaiQuPNtq6TPmb/wrpNPgkNWcr4A245oyZ1uEi6vAnQj0llOZ0dFtq0Z4+7X6g +# MTN9vMvpe784cETRkPHIqzqKOghif9lwY1NNje6CbaUFEMFxBmoQtB1VM1izoXBm +# 8qGCAtcwggJAAgEBMIIBAKGB2KSB1TCB0jELMAkGA1UEBhMCVVMxEzARBgNVBAgT +# Cldhc2hpbmd0b24xEDAOBgNVBAcTB1JlZG1vbmQxHjAcBgNVBAoTFU1pY3Jvc29m +# dCBDb3Jwb3JhdGlvbjEtMCsGA1UECxMkTWljcm9zb2Z0IElyZWxhbmQgT3BlcmF0 +# aW9ucyBMaW1pdGVkMSYwJAYDVQQLEx1UaGFsZXMgVFNTIEVTTjpBMjQwLTRCODIt +# MTMwRTElMCMGA1UEAxMcTWljcm9zb2Z0IFRpbWUtU3RhbXAgU2VydmljZaIjCgEB +# MAcGBSsOAwIaAxUAgHOVkz1NE0Pg+C2ktZBmRI9hVwmggYMwgYCkfjB8MQswCQYD +# VQQGEwJVUzETMBEGA1UECBMKV2FzaGluZ3RvbjEQMA4GA1UEBxMHUmVkbW9uZDEe +# MBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMSYwJAYDVQQDEx1NaWNyb3Nv +# ZnQgVGltZS1TdGFtcCBQQ0EgMjAxMDANBgkqhkiG9w0BAQUFAAIFAOXvddYwIhgP +# MjAyMjAzMzEwODM1MzRaGA8yMDIyMDQwMTA4MzUzNFowdzA9BgorBgEEAYRZCgQB +# MS8wLTAKAgUA5e911gIBADAKAgEAAgIXqQIB/zAHAgEAAgIRHzAKAgUA5fDHVgIB +# ADA2BgorBgEEAYRZCgQCMSgwJjAMBgorBgEEAYRZCgMCoAowCAIBAAIDB6EgoQow +# CAIBAAIDAYagMA0GCSqGSIb3DQEBBQUAA4GBABjrSR17sdYAEtszvl2BWos/C7ZR +# fepANqhK1OqRLv3nelgcpzoYSpF3+csIJ5gGoL5clExMw1t3hkOSQLOzGWvkcWIY +# Tp5Pv4q/CpB/52Mrn1kC2zSej1E9lx0InBB++pTdEr3WCn9KDZsIy8B9M3gtEamp +# Di1hg/Yaskk2pVuQMYIEDTCCBAkCAQEwgZMwfDELMAkGA1UEBhMCVVMxEzARBgNV +# BAgTCldhc2hpbmd0b24xEDAOBgNVBAcTB1JlZG1vbmQxHjAcBgNVBAoTFU1pY3Jv +# c29mdCBDb3Jwb3JhdGlvbjEmMCQGA1UEAxMdTWljcm9zb2Z0IFRpbWUtU3RhbXAg +# UENBIDIwMTACEzMAAAGNelUueHSZKrcAAQAAAY0wDQYJYIZIAWUDBAIBBQCgggFK +# MBoGCSqGSIb3DQEJAzENBgsqhkiG9w0BCRABBDAvBgkqhkiG9w0BCQQxIgQgv72G +# 0X2zWUJuJvjSqtgMZ02BVYmEgLTkIUsRp8UHvXIwgfoGCyqGSIb3DQEJEAIvMYHq +# MIHnMIHkMIG9BCCelhEz+h1eQMCfN/a50vnr1bxx8ZODBW56dDy20hjNfzCBmDCB +# gKR+MHwxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQH +# EwdSZWRtb25kMR4wHAYDVQQKExVNaWNyb3NvZnQgQ29ycG9yYXRpb24xJjAkBgNV +# BAMTHU1pY3Jvc29mdCBUaW1lLVN0YW1wIFBDQSAyMDEwAhMzAAABjXpVLnh0mSq3 +# AAEAAAGNMCIEIKC8K55Td1F8Kw4pKkbmiSw7Hb/xIcUSNIsHKB52X2hTMA0GCSqG +# SIb3DQEBCwUABIICAMsOXK3vJQX7Jt2lDwVppNTdiboPDVwXRfezsK8NLGK7wZhp +# e/fEsGp3kFdqmeiDT/QGZV+ixnGjOTyJSaq6+wtvZyqKLUoEkhD9g+hFk23Hn3ui +# RiAp6LSf263zzgNQ9SbNssjiOChkILaTpt+GeV+lHAH6N412gYM7pbVyw9v7jvx+ +# Mp+iFKUVQAqZZDGm55MyTqfVdPeb8YpN9pqPSYG4ruCTwZBYGI+p7LFuKgQqF+FB +# 2KTqsTuxoHI6HAV3OibJcIFKQLFxaHjD0/YjYeZSoMUMD/ojZpdEoFrLtTXmIZ2e +# yOFKcX1LMzwwHhEpOpc9m9g4/B2kYTHUl1hFupXEu9PZnNa0IweqtM/GdX/Ji/// +# JRcDe8vtLNQz7z8ZQF28k1ufRDGfm5YIQDHu9Zx33gbpsWIyGZMmlbU4UMJDvAbM +# +sCYtGGLcMEObyiurnDOF4dix7QAdLWqGG2YiyZ9u0T/hRLi3THXhLGK5Xt4dgBk +# aeyJv7T3ZPfsbu8a10lgFkyVbmJt6up2OZbaqW1PjmvgtcsNmRyhD9oSZzOXdTiW +# iIGeLtHEkiSvZnWbaDqpx7ahcaHsmS5QvwWkYGGx1uHMOwJHuFq7jKPo3SYMxAwq +# GQW+QTZroDYL+UTfaUobfPyrS3bDw3L7xVqOOBwGidlOwx3ZYU4mNlSbfCN3 +# SIG # End signature block diff --git a/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/StartupScripts/InitializeAssemblyResolver.ps1 b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/StartupScripts/InitializeAssemblyResolver.ps1 new file mode 100644 index 000000000000..4e557723dc33 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/StartupScripts/InitializeAssemblyResolver.ps1 @@ -0,0 +1,234 @@ +if ($PSEdition -eq 'Desktop') { + try { + [Microsoft.Azure.Commands.Profile.Utilities.CustomAssemblyResolver]::Initialize() + } + catch { + Write-Warning $_ + } +} +else { + try { + Add-Type -Path ([System.IO.Path]::Combine($PSScriptRoot, "..", "Microsoft.Azure.PowerShell.AuthenticationAssemblyLoadContext.dll")) | Out-Null + $assemblyLoadContextFolder = [System.IO.Path]::Combine($PSScriptRoot, "..", "AzSharedAlcAssemblies") + Write-Debug "Registering Az shared AssemblyLoadContext for path: '$assemblyLoadContextFolder'." + [Microsoft.Azure.PowerShell.AuthenticationAssemblyLoadContext.AzAssemblyLoadContextInitializer]::RegisterAzSharedAssemblyLoadContext($assemblyLoadContextFolder) + Write-Debug "AssemblyLoadContext registered." + } + catch { + Write-Warning $_ + } +} +# SIG # Begin signature block +# MIInrQYJKoZIhvcNAQcCoIInnjCCJ5oCAQExDzANBglghkgBZQMEAgEFADB5Bgor +# BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG +# KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCCfno9x0LEd5gPe +# 4cvAg6ULJtMLR6g+Xis+I4rbSZlHZqCCDYEwggX/MIID56ADAgECAhMzAAACUosz +# qviV8znbAAAAAAJSMA0GCSqGSIb3DQEBCwUAMH4xCzAJBgNVBAYTAlVTMRMwEQYD +# VQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdSZWRtb25kMR4wHAYDVQQKExVNaWNy +# b3NvZnQgQ29ycG9yYXRpb24xKDAmBgNVBAMTH01pY3Jvc29mdCBDb2RlIFNpZ25p +# bmcgUENBIDIwMTEwHhcNMjEwOTAyMTgzMjU5WhcNMjIwOTAxMTgzMjU5WjB0MQsw +# CQYDVQQGEwJVUzETMBEGA1UECBMKV2FzaGluZ3RvbjEQMA4GA1UEBxMHUmVkbW9u +# ZDEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMR4wHAYDVQQDExVNaWNy +# b3NvZnQgQ29ycG9yYXRpb24wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIB +# AQDQ5M+Ps/X7BNuv5B/0I6uoDwj0NJOo1KrVQqO7ggRXccklyTrWL4xMShjIou2I +# sbYnF67wXzVAq5Om4oe+LfzSDOzjcb6ms00gBo0OQaqwQ1BijyJ7NvDf80I1fW9O +# L76Kt0Wpc2zrGhzcHdb7upPrvxvSNNUvxK3sgw7YTt31410vpEp8yfBEl/hd8ZzA +# v47DCgJ5j1zm295s1RVZHNp6MoiQFVOECm4AwK2l28i+YER1JO4IplTH44uvzX9o +# RnJHaMvWzZEpozPy4jNO2DDqbcNs4zh7AWMhE1PWFVA+CHI/En5nASvCvLmuR/t8 +# q4bc8XR8QIZJQSp+2U6m2ldNAgMBAAGjggF+MIIBejAfBgNVHSUEGDAWBgorBgEE +# AYI3TAgBBggrBgEFBQcDAzAdBgNVHQ4EFgQUNZJaEUGL2Guwt7ZOAu4efEYXedEw +# UAYDVR0RBEkwR6RFMEMxKTAnBgNVBAsTIE1pY3Jvc29mdCBPcGVyYXRpb25zIFB1 +# ZXJ0byBSaWNvMRYwFAYDVQQFEw0yMzAwMTIrNDY3NTk3MB8GA1UdIwQYMBaAFEhu +# ZOVQBdOCqhc3NyK1bajKdQKVMFQGA1UdHwRNMEswSaBHoEWGQ2h0dHA6Ly93d3cu +# bWljcm9zb2Z0LmNvbS9wa2lvcHMvY3JsL01pY0NvZFNpZ1BDQTIwMTFfMjAxMS0w +# Ny0wOC5jcmwwYQYIKwYBBQUHAQEEVTBTMFEGCCsGAQUFBzAChkVodHRwOi8vd3d3 +# Lm1pY3Jvc29mdC5jb20vcGtpb3BzL2NlcnRzL01pY0NvZFNpZ1BDQTIwMTFfMjAx +# MS0wNy0wOC5jcnQwDAYDVR0TAQH/BAIwADANBgkqhkiG9w0BAQsFAAOCAgEAFkk3 +# uSxkTEBh1NtAl7BivIEsAWdgX1qZ+EdZMYbQKasY6IhSLXRMxF1B3OKdR9K/kccp +# kvNcGl8D7YyYS4mhCUMBR+VLrg3f8PUj38A9V5aiY2/Jok7WZFOAmjPRNNGnyeg7 +# l0lTiThFqE+2aOs6+heegqAdelGgNJKRHLWRuhGKuLIw5lkgx9Ky+QvZrn/Ddi8u +# TIgWKp+MGG8xY6PBvvjgt9jQShlnPrZ3UY8Bvwy6rynhXBaV0V0TTL0gEx7eh/K1 +# o8Miaru6s/7FyqOLeUS4vTHh9TgBL5DtxCYurXbSBVtL1Fj44+Od/6cmC9mmvrti +# yG709Y3Rd3YdJj2f3GJq7Y7KdWq0QYhatKhBeg4fxjhg0yut2g6aM1mxjNPrE48z +# 6HWCNGu9gMK5ZudldRw4a45Z06Aoktof0CqOyTErvq0YjoE4Xpa0+87T/PVUXNqf +# 7Y+qSU7+9LtLQuMYR4w3cSPjuNusvLf9gBnch5RqM7kaDtYWDgLyB42EfsxeMqwK +# WwA+TVi0HrWRqfSx2olbE56hJcEkMjOSKz3sRuupFCX3UroyYf52L+2iVTrda8XW +# esPG62Mnn3T8AuLfzeJFuAbfOSERx7IFZO92UPoXE1uEjL5skl1yTZB3MubgOA4F +# 8KoRNhviFAEST+nG8c8uIsbZeb08SeYQMqjVEmkwggd6MIIFYqADAgECAgphDpDS +# AAAAAAADMA0GCSqGSIb3DQEBCwUAMIGIMQswCQYDVQQGEwJVUzETMBEGA1UECBMK +# V2FzaGluZ3RvbjEQMA4GA1UEBxMHUmVkbW9uZDEeMBwGA1UEChMVTWljcm9zb2Z0 +# IENvcnBvcmF0aW9uMTIwMAYDVQQDEylNaWNyb3NvZnQgUm9vdCBDZXJ0aWZpY2F0 +# ZSBBdXRob3JpdHkgMjAxMTAeFw0xMTA3MDgyMDU5MDlaFw0yNjA3MDgyMTA5MDla +# MH4xCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdS +# ZWRtb25kMR4wHAYDVQQKExVNaWNyb3NvZnQgQ29ycG9yYXRpb24xKDAmBgNVBAMT +# H01pY3Jvc29mdCBDb2RlIFNpZ25pbmcgUENBIDIwMTEwggIiMA0GCSqGSIb3DQEB +# AQUAA4ICDwAwggIKAoICAQCr8PpyEBwurdhuqoIQTTS68rZYIZ9CGypr6VpQqrgG +# OBoESbp/wwwe3TdrxhLYC/A4wpkGsMg51QEUMULTiQ15ZId+lGAkbK+eSZzpaF7S +# 35tTsgosw6/ZqSuuegmv15ZZymAaBelmdugyUiYSL+erCFDPs0S3XdjELgN1q2jz +# y23zOlyhFvRGuuA4ZKxuZDV4pqBjDy3TQJP4494HDdVceaVJKecNvqATd76UPe/7 +# 4ytaEB9NViiienLgEjq3SV7Y7e1DkYPZe7J7hhvZPrGMXeiJT4Qa8qEvWeSQOy2u +# M1jFtz7+MtOzAz2xsq+SOH7SnYAs9U5WkSE1JcM5bmR/U7qcD60ZI4TL9LoDho33 +# X/DQUr+MlIe8wCF0JV8YKLbMJyg4JZg5SjbPfLGSrhwjp6lm7GEfauEoSZ1fiOIl +# XdMhSz5SxLVXPyQD8NF6Wy/VI+NwXQ9RRnez+ADhvKwCgl/bwBWzvRvUVUvnOaEP +# 6SNJvBi4RHxF5MHDcnrgcuck379GmcXvwhxX24ON7E1JMKerjt/sW5+v/N2wZuLB +# l4F77dbtS+dJKacTKKanfWeA5opieF+yL4TXV5xcv3coKPHtbcMojyyPQDdPweGF +# RInECUzF1KVDL3SV9274eCBYLBNdYJWaPk8zhNqwiBfenk70lrC8RqBsmNLg1oiM +# CwIDAQABo4IB7TCCAekwEAYJKwYBBAGCNxUBBAMCAQAwHQYDVR0OBBYEFEhuZOVQ +# BdOCqhc3NyK1bajKdQKVMBkGCSsGAQQBgjcUAgQMHgoAUwB1AGIAQwBBMAsGA1Ud +# DwQEAwIBhjAPBgNVHRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFHItOgIxkEO5FAVO +# 4eqnxzHRI4k0MFoGA1UdHwRTMFEwT6BNoEuGSWh0dHA6Ly9jcmwubWljcm9zb2Z0 +# LmNvbS9wa2kvY3JsL3Byb2R1Y3RzL01pY1Jvb0NlckF1dDIwMTFfMjAxMV8wM18y +# Mi5jcmwwXgYIKwYBBQUHAQEEUjBQME4GCCsGAQUFBzAChkJodHRwOi8vd3d3Lm1p +# Y3Jvc29mdC5jb20vcGtpL2NlcnRzL01pY1Jvb0NlckF1dDIwMTFfMjAxMV8wM18y +# Mi5jcnQwgZ8GA1UdIASBlzCBlDCBkQYJKwYBBAGCNy4DMIGDMD8GCCsGAQUFBwIB +# FjNodHRwOi8vd3d3Lm1pY3Jvc29mdC5jb20vcGtpb3BzL2RvY3MvcHJpbWFyeWNw +# cy5odG0wQAYIKwYBBQUHAgIwNB4yIB0ATABlAGcAYQBsAF8AcABvAGwAaQBjAHkA +# XwBzAHQAYQB0AGUAbQBlAG4AdAAuIB0wDQYJKoZIhvcNAQELBQADggIBAGfyhqWY +# 4FR5Gi7T2HRnIpsLlhHhY5KZQpZ90nkMkMFlXy4sPvjDctFtg/6+P+gKyju/R6mj +# 82nbY78iNaWXXWWEkH2LRlBV2AySfNIaSxzzPEKLUtCw/WvjPgcuKZvmPRul1LUd +# d5Q54ulkyUQ9eHoj8xN9ppB0g430yyYCRirCihC7pKkFDJvtaPpoLpWgKj8qa1hJ +# Yx8JaW5amJbkg/TAj/NGK978O9C9Ne9uJa7lryft0N3zDq+ZKJeYTQ49C/IIidYf +# wzIY4vDFLc5bnrRJOQrGCsLGra7lstnbFYhRRVg4MnEnGn+x9Cf43iw6IGmYslmJ +# aG5vp7d0w0AFBqYBKig+gj8TTWYLwLNN9eGPfxxvFX1Fp3blQCplo8NdUmKGwx1j +# NpeG39rz+PIWoZon4c2ll9DuXWNB41sHnIc+BncG0QaxdR8UvmFhtfDcxhsEvt9B +# xw4o7t5lL+yX9qFcltgA1qFGvVnzl6UJS0gQmYAf0AApxbGbpT9Fdx41xtKiop96 +# eiL6SJUfq/tHI4D1nvi/a7dLl+LrdXga7Oo3mXkYS//WsyNodeav+vyL6wuA6mk7 +# r/ww7QRMjt/fdW1jkT3RnVZOT7+AVyKheBEyIXrvQQqxP/uozKRdwaGIm1dxVk5I +# RcBCyZt2WwqASGv9eZ/BvW1taslScxMNelDNMYIZgjCCGX4CAQEwgZUwfjELMAkG +# A1UEBhMCVVMxEzARBgNVBAgTCldhc2hpbmd0b24xEDAOBgNVBAcTB1JlZG1vbmQx +# HjAcBgNVBAoTFU1pY3Jvc29mdCBDb3Jwb3JhdGlvbjEoMCYGA1UEAxMfTWljcm9z +# b2Z0IENvZGUgU2lnbmluZyBQQ0EgMjAxMQITMwAAAlKLM6r4lfM52wAAAAACUjAN +# BglghkgBZQMEAgEFAKCBrjAZBgkqhkiG9w0BCQMxDAYKKwYBBAGCNwIBBDAcBgor +# BgEEAYI3AgELMQ4wDAYKKwYBBAGCNwIBFTAvBgkqhkiG9w0BCQQxIgQgyFkgUqEG +# ohT1KbDw544Hgmj3zWoOXkAlMHIwAyFcowAwQgYKKwYBBAGCNwIBDDE0MDKgFIAS +# AE0AaQBjAHIAbwBzAG8AZgB0oRqAGGh0dHA6Ly93d3cubWljcm9zb2Z0LmNvbTAN +# BgkqhkiG9w0BAQEFAASCAQCa0t0uHrS1Z8rXJEETxc2oe78Dv4Qo198ub5+3zLvP +# Uwb+RkVmouToXjo3dapicrrP8ELcphopBonxGcVJFdu9HT8uuwL9KEp0yDpjUxKA +# 0yPVc1pc+f5vmlLY1kyUHMb9Deahzp5oJnL6NLyupJ8w6DLb21SCiIWl71l5vf2B +# i8Nx+jIjxGEC5Emqk6GLFAjR4TR6KO1j6gkHutOu3k0Q/+CgvgEwPbwtBXjcE9jV +# u7AZ6Iu5mE8q7NQ01GwWUMs13xpWLxE8HgvWtu3ozXjFeFaG3u9NEyx/zlkEB1cS +# Ntqh/F34ovkTvJxnIBPSRZfGubCV0fp9Qm0gXxrz3y/roYIXDDCCFwgGCisGAQQB +# gjcDAwExghb4MIIW9AYJKoZIhvcNAQcCoIIW5TCCFuECAQMxDzANBglghkgBZQME +# AgEFADCCAVUGCyqGSIb3DQEJEAEEoIIBRASCAUAwggE8AgEBBgorBgEEAYRZCgMB +# MDEwDQYJYIZIAWUDBAIBBQAEIBvIyrpwHucEdb9YUkDCNmUPQk1ErTyZteMy3AB+ +# P++VAgZiL7Y+PNcYEzIwMjIwMzMxMTAwMDA5LjE3NlowBIACAfSggdSkgdEwgc4x +# CzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdSZWRt +# b25kMR4wHAYDVQQKExVNaWNyb3NvZnQgQ29ycG9yYXRpb24xKTAnBgNVBAsTIE1p +# Y3Jvc29mdCBPcGVyYXRpb25zIFB1ZXJ0byBSaWNvMSYwJAYDVQQLEx1UaGFsZXMg +# VFNTIEVTTjo2MEJDLUUzODMtMjYzNTElMCMGA1UEAxMcTWljcm9zb2Z0IFRpbWUt +# U3RhbXAgU2VydmljZaCCEV8wggcQMIIE+KADAgECAhMzAAABpllFgzlNnutLAAEA +# AAGmMA0GCSqGSIb3DQEBCwUAMHwxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpXYXNo +# aW5ndG9uMRAwDgYDVQQHEwdSZWRtb25kMR4wHAYDVQQKExVNaWNyb3NvZnQgQ29y +# cG9yYXRpb24xJjAkBgNVBAMTHU1pY3Jvc29mdCBUaW1lLVN0YW1wIFBDQSAyMDEw +# MB4XDTIyMDMwMjE4NTEyMVoXDTIzMDUxMTE4NTEyMVowgc4xCzAJBgNVBAYTAlVT +# MRMwEQYDVQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdSZWRtb25kMR4wHAYDVQQK +# ExVNaWNyb3NvZnQgQ29ycG9yYXRpb24xKTAnBgNVBAsTIE1pY3Jvc29mdCBPcGVy +# YXRpb25zIFB1ZXJ0byBSaWNvMSYwJAYDVQQLEx1UaGFsZXMgVFNTIEVTTjo2MEJD +# LUUzODMtMjYzNTElMCMGA1UEAxMcTWljcm9zb2Z0IFRpbWUtU3RhbXAgU2Vydmlj +# ZTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANmYv3tSI+fJ/NQJnjz7 +# JvCnc+Xm0rKoe9YKD4MvMYCul7egdrT/zv5vFbQgjNQ74672fNweaztkR65V8y29 +# u5PL2sf01p+uche0Zu4tSig+GsQ6ZQl9tjPRAY/3ITBHDeIYyvq8Wne9+7NoPLhx +# DSO6dtX7YCuQ4zcTP3SE6MvB4b5NighdtvoZVaYk1lXpjUTfdmKoX1ABq1sJbULS +# nSi0Qd4vvl3mZ9jxwv9dR/nlZP62lrZYZq7LPtHD6BlmclB5PT89DnSm1sjaZnFH +# rKzOsmq5GlmL5SFugCCZOoKz133FJeQaFMcXBZSCQjNABWBbHIRCE1ysHHG83Ddo +# nRmnC8EOlYeRwTWz/QCz6q0riOIbYyC/A2BgUEpu9/9EymrTsyMr2/zS8GdEybQ5 +# W7f0WrcrmKB/Y62+g6TmfOS8NtU+L1jGoKNG6Q5RlfJwZu8J/Q9dl4OxyHKuy78+ +# wm6HsF7uAizpsWh63UUaoK/OGQiBG3NJ+kef5eWpnva4ZJfhAnqYTAZD1uHgf8Vf +# Qjnl0BB2YXzK9WaTqde8d+8qCxVKr5hJYvbO+X3+2k5PCirUK/SboreX+xUhVaQE +# hVDYqlatyPttI7Z2IrkhMzwFvc+p0QeyMiNmo2cBZejx8icDOcUidwymDUYqGPE7 +# MA8vtKW3feeSSYJsCEkuUO/vAgMBAAGjggE2MIIBMjAdBgNVHQ4EFgQUOlQhO/zG +# lqK99UkNL/Gu/AryN9gwHwYDVR0jBBgwFoAUn6cVXQBeYl2D9OXSZacbUzUZ6XIw +# XwYDVR0fBFgwVjBUoFKgUIZOaHR0cDovL3d3dy5taWNyb3NvZnQuY29tL3BraW9w +# cy9jcmwvTWljcm9zb2Z0JTIwVGltZS1TdGFtcCUyMFBDQSUyMDIwMTAoMSkuY3Js +# MGwGCCsGAQUFBwEBBGAwXjBcBggrBgEFBQcwAoZQaHR0cDovL3d3dy5taWNyb3Nv +# ZnQuY29tL3BraW9wcy9jZXJ0cy9NaWNyb3NvZnQlMjBUaW1lLVN0YW1wJTIwUENB +# JTIwMjAxMCgxKS5jcnQwDAYDVR0TAQH/BAIwADATBgNVHSUEDDAKBggrBgEFBQcD +# CDANBgkqhkiG9w0BAQsFAAOCAgEAgMDxWDTpGqLnFoPhm/iDfwHGF8xr2NbrJl8e +# gEg2ThTJsTf0wBE+ZQsnYfrRmXBbe6sCXLVN70qPuI+OEbN5MOai7Bue1/4j5VTk +# WquH5GZeVat2N+dD7lSUWp0dU8j+uBhBL5GFSmoDVVm+zW2GR2juPI1v254AJTb2 +# l458anlkJjGvmYn2BtRS13h/wDR7hrQaI7BgdyHWAV5+HEj5UhrIrrvtwJiivSaU +# EA3qK6ZK/rZIQv/uORDkONw+2pHHIE1SXm/WIlhrVS2HIogfr3JjqvZion6LJSD7 +# 41j8xVDLiClwAbspHoVFjxtxBcMjqPx6aWCJS8vjSoTnhkV4PO55mqsM7Q8XQRGQ +# hA7w4zNQOJu9kD4xFdYpPUmLN/daIcEElofBjGz+sEd1B4yqqIk3u2G4VygTXFmt +# hL8chSo7r+GIvTqWKhSA/sanS4N3jCgCCe3FTSJsp4g5nwavLvWAtzcOIvSRorGm +# AeN0m2wgzBK95T/qgrGGDXSos1JNDWRVBnP0qsw1Qoq5G0D8hxvQPs3X43KBv1GJ +# l0wo5rcC+9OMWxJlB63gtToQsA1CErYoYLMZtUzJL74jwZk/grpHEQhIhB3sneC8 +# wzGKJuft7YO/HWCpuwdChIjynTnBh+yFGMdg3wRrIbOcw/iKmXZopMTQMOcmIeIw +# JAezA7AwggdxMIIFWaADAgECAhMzAAAAFcXna54Cm0mZAAAAAAAVMA0GCSqGSIb3 +# DQEBCwUAMIGIMQswCQYDVQQGEwJVUzETMBEGA1UECBMKV2FzaGluZ3RvbjEQMA4G +# A1UEBxMHUmVkbW9uZDEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMTIw +# MAYDVQQDEylNaWNyb3NvZnQgUm9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkgMjAx +# MDAeFw0yMTA5MzAxODIyMjVaFw0zMDA5MzAxODMyMjVaMHwxCzAJBgNVBAYTAlVT +# MRMwEQYDVQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdSZWRtb25kMR4wHAYDVQQK +# ExVNaWNyb3NvZnQgQ29ycG9yYXRpb24xJjAkBgNVBAMTHU1pY3Jvc29mdCBUaW1l +# LVN0YW1wIFBDQSAyMDEwMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA +# 5OGmTOe0ciELeaLL1yR5vQ7VgtP97pwHB9KpbE51yMo1V/YBf2xK4OK9uT4XYDP/ +# XE/HZveVU3Fa4n5KWv64NmeFRiMMtY0Tz3cywBAY6GB9alKDRLemjkZrBxTzxXb1 +# hlDcwUTIcVxRMTegCjhuje3XD9gmU3w5YQJ6xKr9cmmvHaus9ja+NSZk2pg7uhp7 +# M62AW36MEBydUv626GIl3GoPz130/o5Tz9bshVZN7928jaTjkY+yOSxRnOlwaQ3K +# Ni1wjjHINSi947SHJMPgyY9+tVSP3PoFVZhtaDuaRr3tpK56KTesy+uDRedGbsoy +# 1cCGMFxPLOJiss254o2I5JasAUq7vnGpF1tnYN74kpEeHT39IM9zfUGaRnXNxF80 +# 3RKJ1v2lIH1+/NmeRd+2ci/bfV+AutuqfjbsNkz2K26oElHovwUDo9Fzpk03dJQc +# NIIP8BDyt0cY7afomXw/TNuvXsLz1dhzPUNOwTM5TI4CvEJoLhDqhFFG4tG9ahha +# YQFzymeiXtcodgLiMxhy16cg8ML6EgrXY28MyTZki1ugpoMhXV8wdJGUlNi5UPkL +# iWHzNgY1GIRH29wb0f2y1BzFa/ZcUlFdEtsluq9QBXpsxREdcu+N+VLEhReTwDwV +# 2xo3xwgVGD94q0W29R6HXtqPnhZyacaue7e3PmriLq0CAwEAAaOCAd0wggHZMBIG +# CSsGAQQBgjcVAQQFAgMBAAEwIwYJKwYBBAGCNxUCBBYEFCqnUv5kxJq+gpE8RjUp +# zxD/LwTuMB0GA1UdDgQWBBSfpxVdAF5iXYP05dJlpxtTNRnpcjBcBgNVHSAEVTBT +# MFEGDCsGAQQBgjdMg30BATBBMD8GCCsGAQUFBwIBFjNodHRwOi8vd3d3Lm1pY3Jv +# c29mdC5jb20vcGtpb3BzL0RvY3MvUmVwb3NpdG9yeS5odG0wEwYDVR0lBAwwCgYI +# KwYBBQUHAwgwGQYJKwYBBAGCNxQCBAweCgBTAHUAYgBDAEEwCwYDVR0PBAQDAgGG +# MA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAU1fZWy4/oolxiaNE9lJBb186a +# GMQwVgYDVR0fBE8wTTBLoEmgR4ZFaHR0cDovL2NybC5taWNyb3NvZnQuY29tL3Br +# aS9jcmwvcHJvZHVjdHMvTWljUm9vQ2VyQXV0XzIwMTAtMDYtMjMuY3JsMFoGCCsG +# AQUFBwEBBE4wTDBKBggrBgEFBQcwAoY+aHR0cDovL3d3dy5taWNyb3NvZnQuY29t +# L3BraS9jZXJ0cy9NaWNSb29DZXJBdXRfMjAxMC0wNi0yMy5jcnQwDQYJKoZIhvcN +# AQELBQADggIBAJ1VffwqreEsH2cBMSRb4Z5yS/ypb+pcFLY+TkdkeLEGk5c9MTO1 +# OdfCcTY/2mRsfNB1OW27DzHkwo/7bNGhlBgi7ulmZzpTTd2YurYeeNg2LpypglYA +# A7AFvonoaeC6Ce5732pvvinLbtg/SHUB2RjebYIM9W0jVOR4U3UkV7ndn/OOPcbz +# aN9l9qRWqveVtihVJ9AkvUCgvxm2EhIRXT0n4ECWOKz3+SmJw7wXsFSFQrP8DJ6L +# GYnn8AtqgcKBGUIZUnWKNsIdw2FzLixre24/LAl4FOmRsqlb30mjdAy87JGA0j3m +# Sj5mO0+7hvoyGtmW9I/2kQH2zsZ0/fZMcm8Qq3UwxTSwethQ/gpY3UA8x1RtnWN0 +# SCyxTkctwRQEcb9k+SS+c23Kjgm9swFXSVRk2XPXfx5bRAGOWhmRaw2fpCjcZxko +# JLo4S5pu+yFUa2pFEUep8beuyOiJXk+d0tBMdrVXVAmxaQFEfnyhYWxz/gq77EFm +# PWn9y8FBSX5+k77L+DvktxW/tM4+pTFRhLy/AsGConsXHRWJjXD+57XQKBqJC482 +# 2rpM+Zv/Cuk0+CQ1ZyvgDbjmjJnW4SLq8CdCPSWU5nR0W2rRnj7tfqAxM328y+l7 +# vzhwRNGQ8cirOoo6CGJ/2XBjU02N7oJtpQUQwXEGahC0HVUzWLOhcGbyoYIC0jCC +# AjsCAQEwgfyhgdSkgdEwgc4xCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpXYXNoaW5n +# dG9uMRAwDgYDVQQHEwdSZWRtb25kMR4wHAYDVQQKExVNaWNyb3NvZnQgQ29ycG9y +# YXRpb24xKTAnBgNVBAsTIE1pY3Jvc29mdCBPcGVyYXRpb25zIFB1ZXJ0byBSaWNv +# MSYwJAYDVQQLEx1UaGFsZXMgVFNTIEVTTjo2MEJDLUUzODMtMjYzNTElMCMGA1UE +# AxMcTWljcm9zb2Z0IFRpbWUtU3RhbXAgU2VydmljZaIjCgEBMAcGBSsOAwIaAxUA +# anQzrZW9TB93Ve7Pa4UPao2ffK2ggYMwgYCkfjB8MQswCQYDVQQGEwJVUzETMBEG +# A1UECBMKV2FzaGluZ3RvbjEQMA4GA1UEBxMHUmVkbW9uZDEeMBwGA1UEChMVTWlj +# cm9zb2Z0IENvcnBvcmF0aW9uMSYwJAYDVQQDEx1NaWNyb3NvZnQgVGltZS1TdGFt +# cCBQQ0EgMjAxMDANBgkqhkiG9w0BAQUFAAIFAOXv9TcwIhgPMjAyMjAzMzExMzM5 +# MDNaGA8yMDIyMDQwMTEzMzkwM1owdzA9BgorBgEEAYRZCgQBMS8wLTAKAgUA5e/1 +# NwIBADAKAgEAAgIlMAIB/zAHAgEAAgIRCDAKAgUA5fFGtwIBADA2BgorBgEEAYRZ +# CgQCMSgwJjAMBgorBgEEAYRZCgMCoAowCAIBAAIDB6EgoQowCAIBAAIDAYagMA0G +# CSqGSIb3DQEBBQUAA4GBALD1RzDUwq+H9m0MSYjCz5wQ1OtK2kysUfWmpMU4m/5I +# had8kbNZdJ3KIrx0YGBUzNZ+Lq0oh2bND8oZcOvd2Hp24j+V7qoE3si8uVWGudxS +# modF1/mMXXk9ekKyQlZEjz3BMuu37KSyigsrBtFsCP8HOYXKBGcDbc6qn5XH4yKD +# MYIEDTCCBAkCAQEwgZMwfDELMAkGA1UEBhMCVVMxEzARBgNVBAgTCldhc2hpbmd0 +# b24xEDAOBgNVBAcTB1JlZG1vbmQxHjAcBgNVBAoTFU1pY3Jvc29mdCBDb3Jwb3Jh +# dGlvbjEmMCQGA1UEAxMdTWljcm9zb2Z0IFRpbWUtU3RhbXAgUENBIDIwMTACEzMA +# AAGmWUWDOU2e60sAAQAAAaYwDQYJYIZIAWUDBAIBBQCgggFKMBoGCSqGSIb3DQEJ +# AzENBgsqhkiG9w0BCRABBDAvBgkqhkiG9w0BCQQxIgQgBSF4kR8GItz8rwRGC1l8 +# k8ybbSy8clYGHzCOxkaX3MUwgfoGCyqGSIb3DQEJEAIvMYHqMIHnMIHkMIG9BCCD +# CxmLwz90fWvhMKbJTAQaKt3DoXeiAhfp8TD9tgSrDTCBmDCBgKR+MHwxCzAJBgNV +# BAYTAlVTMRMwEQYDVQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdSZWRtb25kMR4w +# HAYDVQQKExVNaWNyb3NvZnQgQ29ycG9yYXRpb24xJjAkBgNVBAMTHU1pY3Jvc29m +# dCBUaW1lLVN0YW1wIFBDQSAyMDEwAhMzAAABpllFgzlNnutLAAEAAAGmMCIEIBah +# XRJ2u8MV3DcxWnj3RsKu1063lhZi+mCg8CTJsOXVMA0GCSqGSIb3DQEBCwUABIIC +# AKwjzxsDe/9a9+S3w9P62SVFf6qdfGVu9TFSVozXaesncRAk2r5PYVIzQBLXEctH +# uMjKgizzU+OOxm1sxXQFxUa56d7W+W0Jg7ULtoKBKPQtEUN5uAo4j2bxZGMLqPMd +# DR5oFeKvtuIUk4DiXx02gUT6GITVUnFkkHt4y9j9PwZb7TNlan8/wTeTHO0kH2QZ +# xSt9oLx0jSb5/nBUCAE7G38h6P29oMvljU4xleVaSon0n73QlTg/hMAedxBVDol7 +# ZFh6Q93jDq/8l4XsA4y1UIObDo/8NxDvISc2tYeybT++wrtwkOLw6jpWXezk4uA3 +# cPi5rfOQhiBPG8dLCT9SWelaQWFq6wDL/wWQWWohrMVGaRoIp+p7TrRTUl3eoGIW +# lvUbTuUotQzzmQY1Zf8S4g430lulVYqdenhq6E3mzdU9VjueouAji4yYyJ8jeZmz +# c2e2W3goWOO5UWBujRETmFekpuj1cPiQ1en4QlRDeDHIgUa8OQcFbhof3cXZ0+CM +# mFYy5NofggR5oWN1IO6TAGc5w4tn+6i5RrR+C464W7R39A8peRCPXpZHMX5Nfinl +# McxNzvCRdwxdwMcfAl5fbvKiHAMFVaJlU8YkDHxtshVTBTAdB5scvBwEfVBqTRgN +# Y3evpxNmLhQ49mbUo+IsGdgKb4wU3AOkvXBDIVg0/Ll+ +# SIG # End signature block diff --git a/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/[Content_Types].xml b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/[Content_Types].xml new file mode 100644 index 000000000000..95d6227f2ef8 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/[Content_Types].xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/_rels/.rels b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/_rels/.rels new file mode 100644 index 000000000000..95479a0e6d24 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/_rels/.rels @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/en-US/about_az.help.txt b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/en-US/about_az.help.txt new file mode 100644 index 000000000000..fb4a5e9becd1 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/en-US/about_az.help.txt @@ -0,0 +1,50 @@ +About topic for Azure PowerShell - about_az + +TOPIC + +about_Az + +SHORT DESCRIPTION + +The Azure Az PowerShell module is a set of cmdlets for managing Azure +resources directly from the PowerShell command line and in PowerShell +scripts. + +LONG DESCRIPTION + +Azure PowerShell provides cross-platform cmdlets for managing Azure +services. All Azure PowerShell cmdlets work on Windows PowerShell 5.1 and +supported versions of PowerShell 7. + +The Azure PowerShell cmdlets follow the naming convention {verb}-Az{noun}. + +- {verb} is an approved PowerShell verb reflecting the corresponding HTTP + operation. + +- {noun} matches or has a close equivalent to the name of the resource. + +The cmdlets produce .NET objects that can be piped between commands +simplifying the sequencing of commands making Azure PowerShell a powerful +solution for scripting and automation purposes. + +A PowerShell module is available for each Azure service. For convenience, +we provide a wrapper module named "Az" that comprises the stable modules. +Modules in preview must be installed independently or via the "AzPreview" +wrapper module. + +Azure PowerShell is frequently updated to include bug fixes and service +updates. It is recommended to plan to update to the most recent version +regularly (a minimum of twice a year). + +GETTING STARTED + +1. Connect to Azure using Connect-AzAccount + +2. Run your first command. For example, create a resource group in the + east US region. + + New-AzResourceGroup -Name "MyResoureGroup" -location "eastus" + +SEE ALSO + +Azure PowerShell documentation: https://learn.microsoft.com/powershell/azure diff --git a/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/package/services/metadata/core-properties/1aa0749a068a4238881858013f1a5b7f.psmdcp b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/package/services/metadata/core-properties/1aa0749a068a4238881858013f1a5b7f.psmdcp new file mode 100644 index 000000000000..73712c19344e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/modules/Az.Accounts/2.7.5/package/services/metadata/core-properties/1aa0749a068a4238881858013f1a5b7f.psmdcp @@ -0,0 +1,11 @@ + + + Microsoft Corporation + Microsoft Azure PowerShell - Accounts credential management cmdlets for Azure Resource Manager in Windows PowerShell and PowerShell Core. + +For more information on account credential management, please visit the following: https://learn.microsoft.com/powershell/azure/authenticate-azureps + Az.Accounts + 2.7.5 + Azure ResourceManager ARM Accounts Authentication Environment Subscription PSModule PSIncludes_Cmdlet PSCmdlet_Disable-AzDataCollection PSCmdlet_Disable-AzContextAutosave PSCmdlet_Enable-AzDataCollection PSCmdlet_Enable-AzContextAutosave PSCmdlet_Remove-AzEnvironment PSCmdlet_Get-AzEnvironment PSCmdlet_Set-AzEnvironment PSCmdlet_Add-AzEnvironment PSCmdlet_Get-AzSubscription PSCmdlet_Connect-AzAccount PSCmdlet_Get-AzContext PSCmdlet_Set-AzContext PSCmdlet_Import-AzContext PSCmdlet_Save-AzContext PSCmdlet_Get-AzTenant PSCmdlet_Send-Feedback PSCmdlet_Resolve-AzError PSCmdlet_Select-AzContext PSCmdlet_Rename-AzContext PSCmdlet_Remove-AzContext PSCmdlet_Clear-AzContext PSCmdlet_Disconnect-AzAccount PSCmdlet_Get-AzContextAutosaveSetting PSCmdlet_Set-AzDefault PSCmdlet_Get-AzDefault PSCmdlet_Clear-AzDefault PSCmdlet_Register-AzModule PSCmdlet_Enable-AzureRmAlias PSCmdlet_Disable-AzureRmAlias PSCmdlet_Uninstall-AzureRm PSCmdlet_Invoke-AzRestMethod PSCmdlet_Get-AzAccessToken PSCmdlet_Open-AzSurveyLink PSCommand_Disable-AzDataCollection PSCommand_Disable-AzContextAutosave PSCommand_Enable-AzDataCollection PSCommand_Enable-AzContextAutosave PSCommand_Remove-AzEnvironment PSCommand_Get-AzEnvironment PSCommand_Set-AzEnvironment PSCommand_Add-AzEnvironment PSCommand_Get-AzSubscription PSCommand_Connect-AzAccount PSCommand_Get-AzContext PSCommand_Set-AzContext PSCommand_Import-AzContext PSCommand_Save-AzContext PSCommand_Get-AzTenant PSCommand_Send-Feedback PSCommand_Resolve-AzError PSCommand_Select-AzContext PSCommand_Rename-AzContext PSCommand_Remove-AzContext PSCommand_Clear-AzContext PSCommand_Disconnect-AzAccount PSCommand_Get-AzContextAutosaveSetting PSCommand_Set-AzDefault PSCommand_Get-AzDefault PSCommand_Clear-AzDefault PSCommand_Register-AzModule PSCommand_Enable-AzureRmAlias PSCommand_Disable-AzureRmAlias PSCommand_Uninstall-AzureRm PSCommand_Invoke-AzRestMethod PSCommand_Get-AzAccessToken PSCommand_Open-AzSurveyLink PSCommand_Add-AzAccount PSCommand_Login-AzAccount PSCommand_Remove-AzAccount PSCommand_Logout-AzAccount PSCommand_Select-AzSubscription PSCommand_Resolve-Error PSCommand_Save-AzProfile PSCommand_Get-AzDomain PSCommand_Invoke-AzRest + NuGet, Version=3.4.4.1321, Culture=neutral, PublicKeyToken=31bf3856ad364e35;Microsoft Windows NT 6.2.9200.0;.NET Framework 4.5 + \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/AsyncCommandRuntime.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/AsyncCommandRuntime.cs new file mode 100644 index 000000000000..ebcec9e85b88 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/AsyncCommandRuntime.cs @@ -0,0 +1,832 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell +{ + using System.Management.Automation; + using System.Management.Automation.Host; + using System.Threading; + using System.Linq; + + internal interface IAsyncCommandRuntimeExtensions + { + Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep Wrap(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep func); + System.Collections.Generic.IEnumerable Wrap(System.Collections.Generic.IEnumerable funcs); + + T ExecuteSync(System.Func step); + } + + public class AsyncCommandRuntime : System.Management.Automation.ICommandRuntime2, IAsyncCommandRuntimeExtensions, System.IDisposable + { + private ICommandRuntime2 originalCommandRuntime; + private System.Threading.Thread originalThread; + public bool AllowInteractive { get; set; } = false; + + public CancellationToken cancellationToken; + SemaphoreSlim semaphore = new SemaphoreSlim(1, 1); + ManualResetEventSlim readyToRun = new ManualResetEventSlim(false); + ManualResetEventSlim completed = new ManualResetEventSlim(false); + + System.Action runOnMainThread; + + private System.Management.Automation.PSCmdlet cmdlet; + + internal AsyncCommandRuntime(System.Management.Automation.PSCmdlet cmdlet, CancellationToken cancellationToken) + { + this.originalCommandRuntime = cmdlet.CommandRuntime as ICommandRuntime2; + this.originalThread = System.Threading.Thread.CurrentThread; + this.cancellationToken = cancellationToken; + this.cmdlet = cmdlet; + if (cmdlet.PagingParameters != null) + { + WriteDebug("Client side pagination is enabled for this cmdlet"); + } + cmdlet.CommandRuntime = this; + } + + public PSHost Host => this.originalCommandRuntime.Host; + + public PSTransactionContext CurrentPSTransaction => this.originalCommandRuntime.CurrentPSTransaction; + + private void CheckForInteractive() + { + // This is an interactive call -- if we are not on the original thread, this will only work if this was done at ACR creation time; + if (!AllowInteractive) + { + throw new System.Exception("AsyncCommandRuntime is not configured for interactive calls"); + } + } + private void WaitOurTurn() + { + // wait for our turn to play + semaphore?.Wait(cancellationToken); + + // ensure that completed is not set + completed.Reset(); + } + + private void WaitForCompletion() + { + // wait for the result (or cancellation!) + WaitHandle.WaitAny(new[] { cancellationToken.WaitHandle, completed?.WaitHandle }); + + // let go of the semaphore + semaphore?.Release(); + + } + + public bool ShouldContinue(string query, string caption, bool hasSecurityImpact, ref bool yesToAll, ref bool noToAll) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + return originalCommandRuntime.ShouldContinue(query, caption, hasSecurityImpact, ref yesToAll, ref noToAll); + } + + CheckForInteractive(); + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + bool yta = yesToAll; + bool nta = noToAll; + bool result = false; + + // set the function to run + runOnMainThread = () => result = originalCommandRuntime.ShouldContinue(query, caption, hasSecurityImpact, ref yta, ref nta); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // set the output variables + yesToAll = yta; + noToAll = nta; + return result; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public bool ShouldContinue(string query, string caption) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + return originalCommandRuntime.ShouldContinue(query, caption); + } + + CheckForInteractive(); + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + bool result = false; + + // set the function to run + runOnMainThread = () => result = originalCommandRuntime.ShouldContinue(query, caption); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // set the output variables + return result; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public bool ShouldContinue(string query, string caption, ref bool yesToAll, ref bool noToAll) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + return originalCommandRuntime.ShouldContinue(query, caption, ref yesToAll, ref noToAll); + } + + CheckForInteractive(); + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + bool yta = yesToAll; + bool nta = noToAll; + bool result = false; + + // set the function to run + runOnMainThread = () => result = originalCommandRuntime.ShouldContinue(query, caption, ref yta, ref nta); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // set the output variables + yesToAll = yta; + noToAll = nta; + return result; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public bool ShouldProcess(string target) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + return originalCommandRuntime.ShouldProcess(target); + } + + CheckForInteractive(); + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + bool result = false; + + // set the function to run + runOnMainThread = () => result = originalCommandRuntime.ShouldProcess(target); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // set the output variables + return result; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public bool ShouldProcess(string target, string action) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + return originalCommandRuntime.ShouldProcess(target, action); + } + + CheckForInteractive(); + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + bool result = false; + + // set the function to run + runOnMainThread = () => result = originalCommandRuntime.ShouldProcess(target, action); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // set the output variables + return result; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public bool ShouldProcess(string verboseDescription, string verboseWarning, string caption) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + return originalCommandRuntime.ShouldProcess(verboseDescription, verboseWarning, caption); + } + + CheckForInteractive(); + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + bool result = false; + + // set the function to run + runOnMainThread = () => result = originalCommandRuntime.ShouldProcess(verboseDescription, verboseWarning, caption); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // set the output variables + return result; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public bool ShouldProcess(string verboseDescription, string verboseWarning, string caption, out ShouldProcessReason shouldProcessReason) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + return originalCommandRuntime.ShouldProcess(verboseDescription, verboseWarning, caption, out shouldProcessReason); + } + + CheckForInteractive(); + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + bool result = false; + ShouldProcessReason reason = ShouldProcessReason.None; + + // set the function to run + runOnMainThread = () => result = originalCommandRuntime.ShouldProcess(verboseDescription, verboseWarning, caption, out reason); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // set the output variables + shouldProcessReason = reason; + return result; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void ThrowTerminatingError(ErrorRecord errorRecord) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + originalCommandRuntime.ThrowTerminatingError(errorRecord); + return; + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + // set the function to run + runOnMainThread = () => originalCommandRuntime.ThrowTerminatingError(errorRecord); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // return + return; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public bool TransactionAvailable() + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + return originalCommandRuntime.TransactionAvailable(); + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + bool result = false; + + // set the function to run + runOnMainThread = () => result = originalCommandRuntime.TransactionAvailable(); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // set the output variables + return result; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void WriteCommandDetail(string text) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + originalCommandRuntime.WriteCommandDetail(text); + return; + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + // set the function to run + runOnMainThread = () => originalCommandRuntime.WriteCommandDetail(text); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // return + return; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void WriteDebug(string text) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + originalCommandRuntime.WriteDebug(text); + return; + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + // set the function to run + runOnMainThread = () => originalCommandRuntime.WriteDebug(text); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // return + return; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void WriteError(ErrorRecord errorRecord) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + originalCommandRuntime.WriteError(errorRecord); + return; + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + // set the function to run + runOnMainThread = () => originalCommandRuntime.WriteError(errorRecord); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // return + return; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void WriteInformation(InformationRecord informationRecord) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + originalCommandRuntime.WriteInformation(informationRecord); + return; + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + // set the function to run + runOnMainThread = () => originalCommandRuntime.WriteInformation(informationRecord); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // return + return; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void WriteObject(object sendToPipeline) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + originalCommandRuntime.WriteObject(sendToPipeline); + return; + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + // set the function to run + runOnMainThread = () => originalCommandRuntime.WriteObject(sendToPipeline); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // return + return; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void WriteObject(object sendToPipeline, bool enumerateCollection) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + originalCommandRuntime.WriteObject(sendToPipeline, enumerateCollection); + return; + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + // set the function to run + runOnMainThread = () => originalCommandRuntime.WriteObject(sendToPipeline, enumerateCollection); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // return + return; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void WriteProgress(ProgressRecord progressRecord) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + originalCommandRuntime.WriteProgress(progressRecord); + return; + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + // set the function to run + runOnMainThread = () => originalCommandRuntime.WriteProgress(progressRecord); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // return + return; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void WriteProgress(long sourceId, ProgressRecord progressRecord) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + originalCommandRuntime.WriteProgress(sourceId, progressRecord); + return; + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + // set the function to run + runOnMainThread = () => originalCommandRuntime.WriteProgress(sourceId, progressRecord); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // return + return; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void WriteVerbose(string text) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + originalCommandRuntime.WriteVerbose(text); + return; + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + // set the function to run + runOnMainThread = () => originalCommandRuntime.WriteVerbose(text); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // return + return; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void WriteWarning(string text) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + originalCommandRuntime.WriteWarning(text); + return; + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + // set the function to run + runOnMainThread = () => originalCommandRuntime.WriteWarning(text); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // return + return; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void Wait(System.Threading.Tasks.Task ProcessRecordAsyncTask, System.Threading.CancellationToken cancellationToken) + { + do + { + WaitHandle.WaitAny(new[] { readyToRun.WaitHandle, ((System.IAsyncResult)ProcessRecordAsyncTask).AsyncWaitHandle }); + if (readyToRun.IsSet) + { + // reset the request for the next time + readyToRun.Reset(); + + // run the delegate on this thread + runOnMainThread(); + + // tell the originator everything is complete + completed.Set(); + } + } + while (!ProcessRecordAsyncTask.IsCompleted); + if (ProcessRecordAsyncTask.IsFaulted) + { + // don't unwrap a Aggregate Exception -- we'll lose the stack trace of the actual exception. + // if( ProcessRecordAsyncTask.Exception is System.AggregateException aggregate ) { + // throw aggregate.InnerException; + // } + throw ProcessRecordAsyncTask.Exception; + } + } + public Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep Wrap(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep func) => func.Target.GetType().Name != "Closure" ? func : (p1, p2, p3) => ExecuteSync>(() => func(p1, p2, p3)); + public System.Collections.Generic.IEnumerable Wrap(System.Collections.Generic.IEnumerable funcs) => funcs?.Select(Wrap); + + public T ExecuteSync(System.Func step) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + return step(); + } + + T result = default(T); + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + // set the function to run + runOnMainThread = () => { result = step(); }; + // tell the main thread to go ahead + readyToRun.Set(); + // wait for the result (or cancellation!) + WaitForCompletion(); + // return + return result; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void Dispose() + { + if (cmdlet != null) + { + cmdlet.CommandRuntime = this.originalCommandRuntime; + cmdlet = null; + } + + semaphore?.Dispose(); + semaphore = null; + readyToRun?.Dispose(); + readyToRun = null; + completed?.Dispose(); + completed = null; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/AsyncJob.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/AsyncJob.cs new file mode 100644 index 000000000000..309796a36670 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/AsyncJob.cs @@ -0,0 +1,270 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell +{ + using System.Management.Automation; + using System.Management.Automation.Host; + using System.Threading; + + using System.Threading.Tasks; + + public class LongRunningJobCancelledException : System.Exception + { + public LongRunningJobCancelledException(string message) : base(message) + { + + } + } + + public class AsyncJob : Job, System.Management.Automation.ICommandRuntime2 + { + const int MaxRecords = 1000; + + private string _statusMessage = string.Empty; + + public override string StatusMessage => _statusMessage; + + public override bool HasMoreData => Output.Count > 0 || Progress.Count > 0 || Error.Count > 0 || Warning.Count > 0 || Verbose.Count > 0 || Debug.Count > 0; + + public override string Location => "localhost"; + + public PSHost Host => originalCommandRuntime.Host; + + public PSTransactionContext CurrentPSTransaction => originalCommandRuntime.CurrentPSTransaction; + + public override void StopJob() + { + Cancel(); + } + + private readonly PSCmdlet cmdlet; + private readonly ICommandRuntime2 originalCommandRuntime; + private readonly System.Threading.Thread originalThread; + + private void CheckForInteractive() + { + // This is an interactive call -- We should never allow interactivity in AsnycJob cmdlets. + throw new System.Exception("Cmdlets in AsyncJob; interactive calls are not permitted."); + } + private bool IsJobDone => CancellationToken.IsCancellationRequested || this.JobStateInfo.State == JobState.Failed || this.JobStateInfo.State == JobState.Stopped || this.JobStateInfo.State == JobState.Stopping || this.JobStateInfo.State == JobState.Completed; + + private readonly System.Action Cancel; + private readonly CancellationToken CancellationToken; + + internal AsyncJob(PSCmdlet cmdlet, string line, string name, CancellationToken cancellationToken, System.Action cancelMethod) : base(line, name) + { + SetJobState(JobState.NotStarted); + // know how to cancel/check for cancelation + this.CancellationToken = cancellationToken; + this.Cancel = cancelMethod; + + // we might need these. + this.originalCommandRuntime = cmdlet.CommandRuntime as ICommandRuntime2; + this.originalThread = System.Threading.Thread.CurrentThread; + + // the instance of the cmdlet we're going to run + this.cmdlet = cmdlet; + + // set the command runtime to the AsyncJob + cmdlet.CommandRuntime = this; + } + + /// + /// Monitors the task (which should be ProcessRecordAsync) to control + /// the lifetime of the job itself + /// + /// + public void Monitor(Task task) + { + SetJobState(JobState.Running); + task.ContinueWith(antecedent => + { + if (antecedent.IsCanceled) + { + // if the task was canceled, we're just going to call it completed. + SetJobState(JobState.Completed); + } + else if (antecedent.IsFaulted) + { + foreach (var innerException in antecedent.Exception.Flatten().InnerExceptions) + { + WriteError(new System.Management.Automation.ErrorRecord(innerException, string.Empty, System.Management.Automation.ErrorCategory.NotSpecified, null)); + } + + // a fault indicates an actual failure + SetJobState(JobState.Failed); + } + else + { + // otherwiser it's a completed state. + SetJobState(JobState.Completed); + } + }, CancellationToken); + } + + private void CheckForCancellation() + { + if (IsJobDone) + { + throw new LongRunningJobCancelledException("Long running job is canceled or stopping, continuation of the cmdlet is not permitted."); + } + } + + public void WriteInformation(InformationRecord informationRecord) + { + CheckForCancellation(); + + this.Information.Add(informationRecord); + } + + public bool ShouldContinue(string query, string caption, bool hasSecurityImpact, ref bool yesToAll, ref bool noToAll) + { + CheckForInteractive(); + return false; + } + + public void WriteDebug(string text) + { + _statusMessage = text; + CheckForCancellation(); + + if (Debug.IsOpen && Debug.Count < MaxRecords) + { + Debug.Add(new DebugRecord(text)); + } + } + + public void WriteError(ErrorRecord errorRecord) + { + if (Error.IsOpen) + { + Error.Add(errorRecord); + } + } + + public void WriteObject(object sendToPipeline) + { + CheckForCancellation(); + + if (Output.IsOpen) + { + Output.Add(new PSObject(sendToPipeline)); + } + } + + public void WriteObject(object sendToPipeline, bool enumerateCollection) + { + CheckForCancellation(); + + if (enumerateCollection && sendToPipeline is System.Collections.IEnumerable enumerable) + { + foreach (var item in enumerable) + { + WriteObject(item); + } + } + else + { + WriteObject(sendToPipeline); + } + } + + public void WriteProgress(ProgressRecord progressRecord) + { + CheckForCancellation(); + + if (Progress.IsOpen && Progress.Count < MaxRecords) + { + Progress.Add(progressRecord); + } + } + + public void WriteProgress(long sourceId, ProgressRecord progressRecord) + { + CheckForCancellation(); + + if (Progress.IsOpen && Progress.Count < MaxRecords) + { + Progress.Add(progressRecord); + } + } + + public void WriteVerbose(string text) + { + CheckForCancellation(); + + if (Verbose.IsOpen && Verbose.Count < MaxRecords) + { + Verbose.Add(new VerboseRecord(text)); + } + } + + public void WriteWarning(string text) + { + CheckForCancellation(); + + if (Warning.IsOpen && Warning.Count < MaxRecords) + { + Warning.Add(new WarningRecord(text)); + } + } + + public void WriteCommandDetail(string text) + { + WriteVerbose(text); + } + + public bool ShouldProcess(string target) + { + CheckForInteractive(); + return false; + } + + public bool ShouldProcess(string target, string action) + { + CheckForInteractive(); + return false; + } + + public bool ShouldProcess(string verboseDescription, string verboseWarning, string caption) + { + CheckForInteractive(); + return false; + } + + public bool ShouldProcess(string verboseDescription, string verboseWarning, string caption, out ShouldProcessReason shouldProcessReason) + { + CheckForInteractive(); + shouldProcessReason = ShouldProcessReason.None; + return false; + } + + public bool ShouldContinue(string query, string caption) + { + CheckForInteractive(); + return false; + } + + public bool ShouldContinue(string query, string caption, ref bool yesToAll, ref bool noToAll) + { + CheckForInteractive(); + return false; + } + + public bool TransactionAvailable() + { + // interactivity required? + return false; + } + + public void ThrowTerminatingError(ErrorRecord errorRecord) + { + if (Error.IsOpen) + { + Error.Add(errorRecord); + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/AsyncOperationResponse.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/AsyncOperationResponse.cs new file mode 100644 index 000000000000..3ab9ed8d694a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/AsyncOperationResponse.cs @@ -0,0 +1,176 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell +{ + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + [System.ComponentModel.TypeConverter(typeof(AsyncOperationResponseTypeConverter))] + public class AsyncOperationResponse + { + private string _target; + public string Target { get => _target; set => _target = value; } + public AsyncOperationResponse() + { + } + internal AsyncOperationResponse(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json) + { + // pull target + { Target = If(json?.PropertyT("target"), out var _v) ? (string)_v : (string)Target; } + } + public string ToJsonString() + { + return $"{{ \"target\" : \"{this.Target}\" }}"; + } + + public static AsyncOperationResponse FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject json ? new AsyncOperationResponse(json) : null; + } + + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static AsyncOperationResponse FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(jsonText)); + + } + + public partial class AsyncOperationResponseTypeConverter : System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to a type + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static object ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(AsyncOperationResponse).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return AsyncOperationResponse.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString()); ; + } + catch + { + // Unable to use JSON pattern + } + + if (typeof(System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return new AsyncOperationResponse { Target = (sourceValue as System.Management.Automation.PSObject).GetValueForProperty("target", "", global::System.Convert.ToString) }; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return new AsyncOperationResponse { Target = (sourceValue as global::System.Collections.IDictionary).GetValueForProperty("target", "", global::System.Convert.ToString) }; + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/BuildTime/Cmdlets/ExportCmdletSurface.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/BuildTime/Cmdlets/ExportCmdletSurface.cs new file mode 100644 index 000000000000..db4cc1c7c262 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/BuildTime/Cmdlets/ExportCmdletSurface.cs @@ -0,0 +1,113 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Management.Automation; +using System.Text; +using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.PsHelpers; + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell +{ + [Cmdlet(VerbsData.Export, "CmdletSurface")] + [DoNotExport] + public class ExportCmdletSurface : PSCmdlet + { + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string ModuleName { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string CmdletFolder { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string OutputFolder { get; set; } + + [Parameter] + public bool IncludeGeneralParameters { get; set; } + + [Parameter] + public bool UseExpandedFormat { get; set; } + + protected override void ProcessRecord() + { + try + { + var variants = GetScriptCmdlets(this, CmdletFolder) + .SelectMany(fi => fi.ToVariants()) + .Where(v => !v.IsDoNotExport) + .ToArray(); + var allProfiles = variants.SelectMany(v => v.Profiles).Distinct().ToArray(); + var profileGroups = allProfiles.Any() + ? variants + .SelectMany(v => (v.Profiles.Any() ? v.Profiles : allProfiles).Select(p => (profile: p, variant: v))) + .GroupBy(pv => pv.profile) + .Select(pvg => new ProfileGroup(pvg.Select(pv => pv.variant).ToArray(), pvg.Key)) + : new[] { new ProfileGroup(variants) }; + foreach (var profileGroup in profileGroups) + { + var variantGroups = profileGroup.Variants + .GroupBy(v => new { v.CmdletName }) + .Select(vg => new VariantGroup(ModuleName, vg.Key.CmdletName, vg.Select(v => v).ToArray(), String.Empty, profileGroup.ProfileName)); + var sb = UseExpandedFormat ? ExpandedFormat(variantGroups) : CondensedFormat(variantGroups); + Directory.CreateDirectory(OutputFolder); + File.WriteAllText(Path.Combine(OutputFolder, $"CmdletSurface-{profileGroup.ProfileName}.md"), sb.ToString()); + } + } + catch (Exception ee) + { + Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}"); + throw ee; + } + } + + private StringBuilder ExpandedFormat(IEnumerable variantGroups) + { + var sb = new StringBuilder(); + foreach (var variantGroup in variantGroups.OrderBy(vg => vg.CmdletName)) + { + sb.Append($"### {variantGroup.CmdletName}{Environment.NewLine}"); + var parameterGroups = variantGroup.ParameterGroups + .Where(pg => !pg.DontShow && (IncludeGeneralParameters || (pg.OrderCategory != ParameterCategory.Azure && pg.OrderCategory != ParameterCategory.Runtime))); + foreach (var parameterGroup in parameterGroups) + { + sb.Append($" - {parameterGroup.ParameterName} `{parameterGroup.ParameterType.ToSyntaxTypeName()}`{Environment.NewLine}"); + } + sb.AppendLine(); + } + + return sb; + } + + private StringBuilder CondensedFormat(IEnumerable variantGroups) + { + var sb = new StringBuilder(); + var condensedGroups = variantGroups + .GroupBy(vg => vg.CmdletNoun) + .Select(vgg => ( + CmdletNoun: vgg.Key, + CmdletVerbs: vgg.Select(vg => vg.CmdletVerb).OrderBy(cv => cv).ToArray(), + ParameterGroups: vgg.SelectMany(vg => vg.ParameterGroups).DistinctBy(p => p.ParameterName).ToArray(), + OutputTypes: vgg.SelectMany(vg => vg.OutputTypes).Select(ot => ot.Type).DistinctBy(t => t.Name).Select(t => t.ToSyntaxTypeName()).ToArray())) + .OrderBy(vg => vg.CmdletNoun); + foreach (var condensedGroup in condensedGroups) + { + sb.Append($"### {condensedGroup.CmdletNoun} [{String.Join(", ", condensedGroup.CmdletVerbs)}] `{String.Join(", ", condensedGroup.OutputTypes)}`{Environment.NewLine}"); + var parameterGroups = condensedGroup.ParameterGroups + .Where(pg => !pg.DontShow && (IncludeGeneralParameters || (pg.OrderCategory != ParameterCategory.Azure && pg.OrderCategory != ParameterCategory.Runtime))); + foreach (var parameterGroup in parameterGroups) + { + sb.Append($" - {parameterGroup.ParameterName} `{parameterGroup.ParameterType.ToSyntaxTypeName()}`{Environment.NewLine}"); + } + sb.AppendLine(); + } + + return sb; + } + } +} diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/BuildTime/Cmdlets/ExportExampleStub.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/BuildTime/Cmdlets/ExportExampleStub.cs new file mode 100644 index 000000000000..68a723360528 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/BuildTime/Cmdlets/ExportExampleStub.cs @@ -0,0 +1,74 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.IO; +using System.Linq; +using System.Management.Automation; +using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.MarkdownTypesExtensions; +using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.PsHelpers; + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell +{ + [Cmdlet(VerbsData.Export, "ExampleStub")] + [DoNotExport] + public class ExportExampleStub : PSCmdlet + { + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string ExportsFolder { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string OutputFolder { get; set; } + + protected override void ProcessRecord() + { + try + { + if (!Directory.Exists(ExportsFolder)) + { + throw new ArgumentException($"Exports folder '{ExportsFolder}' does not exist"); + } + + var exportDirectories = Directory.GetDirectories(ExportsFolder); + if (!exportDirectories.Any()) + { + exportDirectories = new[] { ExportsFolder }; + } + + var exampleText = String.Join(String.Empty, DefaultExampleHelpInfos.Select(ehi => ehi.ToHelpExampleOutput())); + foreach (var exportDirectory in exportDirectories) + { + var outputFolder = OutputFolder; + if (exportDirectory != ExportsFolder) + { + outputFolder = Path.Combine(OutputFolder, Path.GetFileName(exportDirectory)); + Directory.CreateDirectory(outputFolder); + } + + var cmdletFilePaths = GetScriptCmdlets(exportDirectory).Select(fi => Path.Combine(outputFolder, $"{fi.Name}.md")).ToArray(); + var currentExamplesFilePaths = Directory.GetFiles(outputFolder).ToArray(); + // Remove examples of non-existing cmdlets + var removedCmdletFilePaths = currentExamplesFilePaths.Except(cmdletFilePaths); + foreach (var removedCmdletFilePath in removedCmdletFilePaths) + { + File.Delete(removedCmdletFilePath); + } + + // Only create example stubs if they don't exist + foreach (var cmdletFilePath in cmdletFilePaths.Except(currentExamplesFilePaths)) + { + File.WriteAllText(cmdletFilePath, exampleText); + } + } + } + catch (Exception ee) + { + Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}"); + throw ee; + } + } + } +} diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/BuildTime/Cmdlets/ExportFormatPs1xml.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/BuildTime/Cmdlets/ExportFormatPs1xml.cs new file mode 100644 index 000000000000..e93b3906506d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/BuildTime/Cmdlets/ExportFormatPs1xml.cs @@ -0,0 +1,101 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Management.Automation; +using System.Reflection; + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell +{ + [Cmdlet(VerbsData.Export, "FormatPs1xml")] + [DoNotExport] + public class ExportFormatPs1xml : PSCmdlet + { + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string FilePath { get; set; } + + private const string ModelNamespace = @"Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models"; + private const string SupportNamespace = @"Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support"; + private const string PropertiesExcludedForTableview = @""; + + private static readonly bool IsAzure = Convert.ToBoolean(@"true"); + + protected override void ProcessRecord() + { + try + { + var viewModels = GetFilteredViewParameters().Select(CreateViewModel).ToList(); + var ps1xml = new Configuration + { + ViewDefinitions = new ViewDefinitions + { + Views = viewModels + } + }; + File.WriteAllText(FilePath, ps1xml.ToXmlString()); + } + catch (Exception ee) + { + Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}"); + throw ee; + } + } + + private static IEnumerable GetFilteredViewParameters() + { + //https://stackoverflow.com/a/79738/294804 + //https://stackoverflow.com/a/949285/294804 + var types = Assembly.GetExecutingAssembly().GetExportedTypes() + .Where(t => t.IsClass + && (t.Namespace.StartsWith(ModelNamespace) || t.Namespace.StartsWith(SupportNamespace)) + && !t.GetCustomAttributes().Any()); + return types.Select(t => new ViewParameters(t, t.GetProperties() + .Select(p => new PropertyFormat(p)) + .Where(pf => !pf.Property.GetCustomAttributes().Any() + && (!PropertiesExcludedForTableview.Split(',').Contains(pf.Property.Name)) + && (pf.FormatTable != null || (pf.Origin != PropertyOrigin.Inlined && pf.Property.PropertyType.IsPsSimple()))) + .OrderByDescending(pf => pf.Index.HasValue) + .ThenBy(pf => pf.Index) + .ThenByDescending(pf => pf.Origin.HasValue) + .ThenBy(pf => pf.Origin))).Where(vp => vp.Properties.Any()); + } + + private static View CreateViewModel(ViewParameters viewParameters) + { + var entries = viewParameters.Properties.Select(pf => + (TableColumnHeader: new TableColumnHeader { Label = pf.Label, Width = pf.Width }, + TableColumnItem: new TableColumnItem { PropertyName = pf.Property.Name })).ToArray(); + + return new View + { + Name = viewParameters.Type.FullName, + ViewSelectedBy = new ViewSelectedBy + { + TypeName = viewParameters.Type.FullName + }, + TableControl = new TableControl + { + TableHeaders = new TableHeaders + { + TableColumnHeaders = entries.Select(e => e.TableColumnHeader).ToList() + }, + TableRowEntries = new TableRowEntries + { + TableRowEntry = new TableRowEntry + { + TableColumnItems = new TableColumnItems + { + TableItems = entries.Select(e => e.TableColumnItem).ToList() + } + } + } + } + }; + } + } +} diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/BuildTime/Cmdlets/ExportHelpMarkdown.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/BuildTime/Cmdlets/ExportHelpMarkdown.cs new file mode 100644 index 000000000000..0d4ef95823e5 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/BuildTime/Cmdlets/ExportHelpMarkdown.cs @@ -0,0 +1,53 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Linq; +using System.Management.Automation; +using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.MarkdownRenderer; + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell +{ + [Cmdlet(VerbsData.Export, "HelpMarkdown")] + [DoNotExport] + public class ExportHelpMarkdown : PSCmdlet + { + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public PSModuleInfo ModuleInfo { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public PSObject[] FunctionInfo { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public PSObject[] HelpInfo { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string DocsFolder { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string ExamplesFolder { get; set; } + + protected override void ProcessRecord() + { + try + { + var helpInfos = HelpInfo.Select(hi => hi.ToPsHelpInfo()); + var variantGroups = FunctionInfo.Select(fi => fi.BaseObject).Cast() + .Join(helpInfos, fi => fi.Name, phi => phi.CmdletName, (fi, phi) => fi.ToVariants(phi)) + .Select(va => new VariantGroup(ModuleInfo.Name, va.First().CmdletName, va, String.Empty)); + WriteMarkdowns(variantGroups, ModuleInfo.ToModuleInfo(), DocsFolder, ExamplesFolder); + } + catch (Exception ee) + { + Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}"); + throw ee; + } + } + } +} diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/BuildTime/Cmdlets/ExportModelSurface.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/BuildTime/Cmdlets/ExportModelSurface.cs new file mode 100644 index 000000000000..81120a2e05c4 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/BuildTime/Cmdlets/ExportModelSurface.cs @@ -0,0 +1,117 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Management.Automation; +using System.Reflection; +using System.Text; + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell +{ + [Cmdlet(VerbsData.Export, "ModelSurface")] + [DoNotExport] + public class ExportModelSurface : PSCmdlet + { + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string OutputFolder { get; set; } + + [Parameter] + public bool UseExpandedFormat { get; set; } + + private const string ModelNamespace = @"Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models"; + private const string SupportNamespace = @"Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Support"; + + protected override void ProcessRecord() + { + try + { + var types = Assembly.GetExecutingAssembly().GetExportedTypes() + .Where(t => t.IsClass && (t.Namespace.StartsWith(ModelNamespace) || t.Namespace.StartsWith(SupportNamespace))); + var typeInfos = types.Select(t => new ModelTypeInfo + { + Type = t, + TypeName = t.Name, + Properties = t.GetProperties(BindingFlags.Public | BindingFlags.Instance).Where(p => !p.GetIndexParameters().Any()).OrderBy(p => p.Name).ToArray(), + NamespaceGroup = t.Namespace.Split('.').LastOrDefault().EmptyIfNull() + }).Where(mti => mti.Properties.Any()); + var sb = UseExpandedFormat ? ExpandedFormat(typeInfos) : CondensedFormat(typeInfos); + Directory.CreateDirectory(OutputFolder); + File.WriteAllText(Path.Combine(OutputFolder, "ModelSurface.md"), sb.ToString()); + } + catch (Exception ee) + { + Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}"); + throw ee; + } + } + + private static StringBuilder ExpandedFormat(IEnumerable typeInfos) + { + var sb = new StringBuilder(); + foreach (var typeInfo in typeInfos.OrderBy(mti => mti.TypeName).ThenBy(mti => mti.NamespaceGroup)) + { + sb.Append($"### {typeInfo.TypeName} [{typeInfo.NamespaceGroup}]{Environment.NewLine}"); + foreach (var property in typeInfo.Properties) + { + sb.Append($" - {property.Name} `{property.PropertyType.ToSyntaxTypeName()}`{Environment.NewLine}"); + } + sb.AppendLine(); + } + + return sb; + } + + private static StringBuilder CondensedFormat(IEnumerable typeInfos) + { + var sb = new StringBuilder(); + var typeGroups = typeInfos + .GroupBy(mti => mti.TypeName) + .Select(tig => ( + Types: tig.Select(mti => mti.Type).ToArray(), + TypeName: tig.Key, + Properties: tig.SelectMany(mti => mti.Properties).DistinctBy(p => p.Name).OrderBy(p => p.Name).ToArray(), + NamespaceGroups: tig.Select(mti => mti.NamespaceGroup).OrderBy(ng => ng).ToArray() + )) + .OrderBy(tg => tg.TypeName); + foreach (var typeGroup in typeGroups) + { + var aType = typeGroup.Types.Select(GetAssociativeType).FirstOrDefault(t => t != null); + var aText = aType != null ? $@" \<{aType.ToSyntaxTypeName()}\>" : String.Empty; + sb.Append($"### {typeGroup.TypeName}{aText} [{String.Join(", ", typeGroup.NamespaceGroups)}]{Environment.NewLine}"); + foreach (var property in typeGroup.Properties) + { + var propertyAType = GetAssociativeType(property.PropertyType); + var propertyAText = propertyAType != null ? $" <{propertyAType.ToSyntaxTypeName()}>" : String.Empty; + var enumNames = GetEnumFieldNames(property.PropertyType.Unwrap()); + var enumNamesText = enumNames.Any() ? $" **{{{String.Join(", ", enumNames)}}}**" : String.Empty; + sb.Append($" - {property.Name} `{property.PropertyType.ToSyntaxTypeName()}{propertyAText}`{enumNamesText}{Environment.NewLine}"); + } + sb.AppendLine(); + } + + return sb; + } + + //https://stackoverflow.com/a/4963190/294804 + private static Type GetAssociativeType(Type type) => + type.GetInterfaces().FirstOrDefault(i => i.IsGenericType && i.GetGenericTypeDefinition() == typeof(IAssociativeArray<>))?.GetGenericArguments().First(); + + private static string[] GetEnumFieldNames(Type type) => + type.IsValueType && !type.IsPrimitive && type != typeof(decimal) && type != typeof(DateTime) + ? type.GetFields(BindingFlags.Public | BindingFlags.Static).Where(f => f.FieldType == type).Select(p => p.Name).ToArray() + : new string[] { }; + + private class ModelTypeInfo + { + public Type Type { get; set; } + public string TypeName { get; set; } + public PropertyInfo[] Properties { get; set; } + public string NamespaceGroup { get; set; } + } + } +} diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/BuildTime/Cmdlets/ExportProxyCmdlet.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/BuildTime/Cmdlets/ExportProxyCmdlet.cs new file mode 100644 index 000000000000..f9c43dc31cde --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/BuildTime/Cmdlets/ExportProxyCmdlet.cs @@ -0,0 +1,169 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.IO; +using System.Linq; +using System.Management.Automation; +using System.Text; +using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.PsHelpers; +using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.MarkdownRenderer; +using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.PsProxyTypeExtensions; +using System.Collections.Generic; + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell +{ + [Cmdlet(VerbsData.Export, "ProxyCmdlet", DefaultParameterSetName = "Docs")] + [DoNotExport] + public class ExportProxyCmdlet : PSCmdlet + { + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string ModuleName { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string[] ModulePath { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string ExportsFolder { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string InternalFolder { get; set; } + + [Parameter(Mandatory = true, ParameterSetName = "Docs")] + [AllowEmptyString] + public string ModuleDescription { get; set; } + + [Parameter(Mandatory = true, ParameterSetName = "Docs")] + [ValidateNotNullOrEmpty] + public string DocsFolder { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string ExamplesFolder { get; set; } + + [Parameter(Mandatory = true, ParameterSetName = "Docs")] + public Guid ModuleGuid { get; set; } + + [Parameter(Mandatory = true, ParameterSetName = "NoDocs")] + public SwitchParameter ExcludeDocs { get; set; } + + protected override void ProcessRecord() + { + try + { + var variants = GetModuleCmdletsAndHelpInfo(this, ModulePath).SelectMany(ci => ci.ToVariants()).Where(v => !v.IsDoNotExport).ToArray(); + var allProfiles = variants.SelectMany(v => v.Profiles).Distinct().ToArray(); + var profileGroups = allProfiles.Any() + ? variants + .SelectMany(v => (v.Profiles.Any() ? v.Profiles : allProfiles).Select(p => (profile: p, variant: v))) + .GroupBy(pv => pv.profile) + .Select(pvg => new ProfileGroup(pvg.Select(pv => pv.variant).ToArray(), pvg.Key)) + : new[] { new ProfileGroup(variants) }; + var variantGroups = profileGroups.SelectMany(pg => pg.Variants + .GroupBy(v => new { v.CmdletName, v.IsInternal }) + .Select(vg => new VariantGroup(ModuleName, vg.Key.CmdletName, vg.Select(v => v).ToArray(), + Path.Combine(vg.Key.IsInternal ? InternalFolder : ExportsFolder, pg.ProfileFolder), pg.ProfileName, isInternal: vg.Key.IsInternal))) + .ToArray(); + + var license = new StringBuilder(); + license.Append(@" +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- +"); + HashSet LicenseSet = new HashSet(); + foreach (var variantGroup in variantGroups) + { + var parameterGroups = variantGroup.ParameterGroups.ToList(); + var isValidProfile = !String.IsNullOrEmpty(variantGroup.ProfileName) && variantGroup.ProfileName != NoProfiles; + var examplesFolder = isValidProfile ? Path.Combine(ExamplesFolder, variantGroup.ProfileName) : ExamplesFolder; + var markdownInfo = new MarkdownHelpInfo(variantGroup, examplesFolder); + List examples = new List(); + foreach (var it in markdownInfo.Examples) + { + examples.Add(it); + } + variantGroup.HelpInfo.Examples = examples.ToArray(); + var sb = new StringBuilder(); + sb.Append($"{Environment.NewLine}"); + sb.Append(variantGroup.ToHelpCommentOutput()); + sb.Append($"function {variantGroup.CmdletName} {{{Environment.NewLine}"); + sb.Append(variantGroup.Aliases.ToAliasOutput()); + sb.Append(variantGroup.OutputTypes.ToOutputTypeOutput()); + sb.Append(variantGroup.ToCmdletBindingOutput()); + sb.Append(variantGroup.ProfileName.ToProfileOutput()); + + sb.Append("param("); + sb.Append($"{(parameterGroups.Any() ? Environment.NewLine : String.Empty)}"); + foreach (var parameterGroup in parameterGroups) + { + var parameters = parameterGroup.HasAllVariants ? parameterGroup.Parameters.Take(1) : parameterGroup.Parameters; + parameters = parameters.Where(p => !p.IsHidden()); + if (!parameters.Any()) + { + continue; + } + foreach (var parameter in parameters) + { + sb.Append(parameter.ToParameterOutput(variantGroup.HasMultipleVariants, parameterGroup.HasAllVariants)); + } + sb.Append(parameterGroup.Aliases.ToAliasOutput(true)); + sb.Append(parameterGroup.HasValidateNotNull.ToValidateNotNullOutput()); + sb.Append(parameterGroup.HasAllowEmptyArray.ToAllowEmptyArray()); + sb.Append(parameterGroup.CompleterInfo.ToArgumentCompleterOutput()); + sb.Append(parameterGroup.OrderCategory.ToParameterCategoryOutput()); + sb.Append(parameterGroup.InfoAttribute.ToInfoOutput(parameterGroup.ParameterType)); + sb.Append(parameterGroup.ToDefaultInfoOutput()); + sb.Append(parameterGroup.ParameterType.ToParameterTypeOutput()); + sb.Append(parameterGroup.Description.ToParameterDescriptionOutput()); + sb.Append(parameterGroup.ParameterName.ToParameterNameOutput(parameterGroups.IndexOf(parameterGroup) == parameterGroups.Count - 1)); + } + sb.Append($"){Environment.NewLine}{Environment.NewLine}"); + + sb.Append(variantGroup.ToBeginOutput()); + sb.Append(variantGroup.ToProcessOutput()); + sb.Append(variantGroup.ToEndOutput()); + + sb.Append($"}}{Environment.NewLine}"); + + Directory.CreateDirectory(variantGroup.OutputFolder); + File.WriteAllText(variantGroup.FilePath, license.ToString()); + File.AppendAllText(variantGroup.FilePath, sb.ToString()); + if (!LicenseSet.Contains(Path.Combine(variantGroup.OutputFolder, "ProxyCmdletDefinitions.ps1"))) + { + // only add license in the header + File.AppendAllText(Path.Combine(variantGroup.OutputFolder, "ProxyCmdletDefinitions.ps1"), license.ToString()); + LicenseSet.Add(Path.Combine(variantGroup.OutputFolder, "ProxyCmdletDefinitions.ps1")); + } + File.AppendAllText(Path.Combine(variantGroup.OutputFolder, "ProxyCmdletDefinitions.ps1"), sb.ToString()); + } + + if (!ExcludeDocs) + { + var moduleInfo = new PsModuleHelpInfo(ModuleName, ModuleGuid, ModuleDescription); + foreach (var variantGroupsByProfile in variantGroups.GroupBy(vg => vg.ProfileName)) + { + var profileName = variantGroupsByProfile.Key; + var isValidProfile = !String.IsNullOrEmpty(profileName) && profileName != NoProfiles; + var docsFolder = isValidProfile ? Path.Combine(DocsFolder, profileName) : DocsFolder; + var examplesFolder = isValidProfile ? Path.Combine(ExamplesFolder, profileName) : ExamplesFolder; + WriteMarkdowns(variantGroupsByProfile, moduleInfo, docsFolder, examplesFolder); + } + } + } + catch (Exception ee) + { + Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}"); + throw ee; + } + } + } +} diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/BuildTime/Cmdlets/ExportPsd1.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/BuildTime/Cmdlets/ExportPsd1.cs new file mode 100644 index 000000000000..1a75ab21c0ad --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/BuildTime/Cmdlets/ExportPsd1.cs @@ -0,0 +1,191 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.IO; +using System.Linq; +using System.Management.Automation; +using System.Text; +using System.Text.RegularExpressions; +using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.PsHelpers; + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell +{ + [Cmdlet(VerbsData.Export, "Psd1")] + [DoNotExport] + public class ExportPsd1 : PSCmdlet + { + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string ExportsFolder { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string CustomFolder { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string Psd1Path { get; set; } + + [Parameter(Mandatory = true)] + public Guid ModuleGuid { get; set; } + + private static readonly bool IsAzure = Convert.ToBoolean(@"true"); + private const string CustomFolderRelative = "./custom"; + private const string Indent = Psd1Indent; + private const string Undefined = "undefined"; + private bool IsUndefined(string value) => string.Equals(Undefined, value, StringComparison.OrdinalIgnoreCase); + + protected override void ProcessRecord() + { + try + { + if (!Directory.Exists(ExportsFolder)) + { + throw new ArgumentException($"Exports folder '{ExportsFolder}' does not exist"); + } + + if (!Directory.Exists(CustomFolder)) + { + throw new ArgumentException($"Custom folder '{CustomFolder}' does not exist"); + } + + string version = Convert.ToString(@"0.1.0"); + // Validate the module version should be semantic version + // Following regex is official from https://semver.org/ + Regex rx = new Regex(@"^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$", RegexOptions.Compiled); + if (rx.Matches(version).Count != 1) + { + throw new ArgumentException("Module-version is not a valid Semantic Version"); + } + + string previewVersion = null; + if (version.Contains('-')) + { + string[] versions = version.Split("-".ToCharArray(), 2); + version = versions[0]; + previewVersion = versions[1]; + } + + var sb = new StringBuilder(); + sb.AppendLine("@{"); + sb.AppendLine($@"{GuidStart} = '{ModuleGuid}'"); + sb.AppendLine($@"{Indent}RootModule = '{"./Az.SiteRecovery.psm1"}'"); + sb.AppendLine($@"{Indent}ModuleVersion = '{version}'"); + sb.AppendLine($@"{Indent}CompatiblePSEditions = 'Core', 'Desktop'"); + sb.AppendLine($@"{Indent}Author = '{"Microsoft Corporation"}'"); + sb.AppendLine($@"{Indent}CompanyName = '{"Microsoft Corporation"}'"); + sb.AppendLine($@"{Indent}Copyright = '{"Microsoft Corporation. All rights reserved."}'"); + sb.AppendLine($@"{Indent}Description = '{"Microsoft Azure PowerShell: SiteRecovery cmdlets"}'"); + sb.AppendLine($@"{Indent}PowerShellVersion = '5.1'"); + sb.AppendLine($@"{Indent}DotNetFrameworkVersion = '4.7.2'"); + + // RequiredModules + if (!IsUndefined("undefined")) + { + sb.AppendLine($@"{Indent}RequiredModules = @({"undefined"})"); + } + + // RequiredAssemblies + if (!IsUndefined("undefined")) + { + sb.AppendLine($@"{Indent}RequiredAssemblies = @({"undefined"})"); + } + else + { + sb.AppendLine($@"{Indent}RequiredAssemblies = '{"./bin/Az.SiteRecovery.private.dll"}'"); + } + + // NestedModules + if (!IsUndefined("undefined")) + { + sb.AppendLine($@"{Indent}NestedModules = @({"undefined"})"); + } + + // FormatsToProcess + if (!IsUndefined("undefined")) + { + sb.AppendLine($@"{Indent}FormatsToProcess = @({"undefined"})"); + } + else + { + var customFormatPs1xmlFiles = Directory.GetFiles(CustomFolder) + .Where(f => f.EndsWith(".format.ps1xml")) + .Select(f => $"{CustomFolderRelative}/{Path.GetFileName(f)}"); + var formatList = customFormatPs1xmlFiles.Prepend("./Az.SiteRecovery.format.ps1xml").ToPsList(); + sb.AppendLine($@"{Indent}FormatsToProcess = {formatList}"); + } + + // TypesToProcess + if (!IsUndefined("undefined")) + { + sb.AppendLine($@"{Indent}TypesToProcess = @({"undefined"})"); + } + + // ScriptsToProcess + if (!IsUndefined("undefined")) + { + sb.AppendLine($@"{Indent}ScriptsToProcess = @({"undefined"})"); + } + + var functionInfos = GetScriptCmdlets(ExportsFolder).ToArray(); + // FunctionsToExport + if (!IsUndefined("undefined")) + { + sb.AppendLine($@"{Indent}FunctionsToExport = @({"undefined"})"); + } + else + { + var cmdletsList = functionInfos.Select(fi => fi.Name).Distinct().Append("*").ToPsList(); + sb.AppendLine($@"{Indent}FunctionsToExport = {cmdletsList}"); + } + + // AliasesToExport + if (!IsUndefined("undefined")) + { + sb.AppendLine($@"{Indent}AliasesToExport = @({"undefined"})"); + } + else + { + var aliasesList = functionInfos.SelectMany(fi => fi.ScriptBlock.Attributes).ToAliasNames().Append("*").ToPsList(); + sb.AppendLine($@"{Indent}AliasesToExport = {aliasesList}"); + } + + // CmdletsToExport + if (!IsUndefined("undefined")) + { + sb.AppendLine($@"{Indent}CmdletsToExport = @({"undefined"})"); + } + + sb.AppendLine($@"{Indent}PrivateData = @{{"); + sb.AppendLine($@"{Indent}{Indent}PSData = @{{"); + + if (previewVersion != null) + { + sb.AppendLine($@"{Indent}{Indent}{Indent}Prerelease = '{previewVersion}'"); + } + sb.AppendLine($@"{Indent}{Indent}{Indent}Tags = {"Azure ResourceManager ARM PSModule SiteRecovery".Split(' ').ToPsList().NullIfEmpty() ?? "''"}"); + sb.AppendLine($@"{Indent}{Indent}{Indent}LicenseUri = '{"https://aka.ms/azps-license"}'"); + sb.AppendLine($@"{Indent}{Indent}{Indent}ProjectUri = '{"https://github.com/Azure/azure-powershell"}'"); + sb.AppendLine($@"{Indent}{Indent}{Indent}ReleaseNotes = ''"); + var profilesList = ""; + if (IsAzure && !String.IsNullOrEmpty(profilesList)) + { + sb.AppendLine($@"{Indent}{Indent}{Indent}Profiles = {profilesList}"); + } + + sb.AppendLine($@"{Indent}{Indent}}}"); + sb.AppendLine($@"{Indent}}}"); + sb.AppendLine(@"}"); + + File.WriteAllText(Psd1Path, sb.ToString()); + } + catch (Exception ee) + { + Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}"); + throw ee; + } + } + } +} diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/BuildTime/Cmdlets/ExportTestStub.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/BuildTime/Cmdlets/ExportTestStub.cs new file mode 100644 index 000000000000..9862ed221e1a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/BuildTime/Cmdlets/ExportTestStub.cs @@ -0,0 +1,148 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.IO; +using System.Linq; +using System.Management.Automation; +using System.Text; +using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.PsProxyOutputExtensions; +using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.PsHelpers; + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell +{ + [Cmdlet(VerbsData.Export, "TestStub")] + [DoNotExport] + public class ExportTestStub : PSCmdlet + { + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string ModuleName { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string ExportsFolder { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string OutputFolder { get; set; } + + [Parameter] + public SwitchParameter IncludeGenerated { get; set; } + + protected override void ProcessRecord() + { + try + { + if (!Directory.Exists(ExportsFolder)) + { + throw new ArgumentException($"Exports folder '{ExportsFolder}' does not exist"); + } + + var exportDirectories = Directory.GetDirectories(ExportsFolder); + if (!exportDirectories.Any()) + { + exportDirectories = new[] { ExportsFolder }; + } + var utilFile = Path.Combine(OutputFolder, "utils.ps1"); + if (!File.Exists(utilFile)) + { + var sc = new StringBuilder(); + sc.AppendLine(@"function RandomString([bool]$allChars, [int32]$len) { + if ($allChars) { + return -join ((33..126) | Get-Random -Count $len | % {[char]$_}) + } else { + return -join ((48..57) + (97..122) | Get-Random -Count $len | % {[char]$_}) + } +} +$env = @{} +if ($UsePreviousConfigForRecord) { + $previousEnv = Get-Content (Join-Path $PSScriptRoot 'env.json') | ConvertFrom-Json + $previousEnv.psobject.properties | Foreach-Object { $env[$_.Name] = $_.Value } +} +# Add script method called AddWithCache to $env, when useCache is set true, it will try to get the value from the $env first. +# example: $val = $env.AddWithCache('key', $val, $true) +$env | Add-Member -Type ScriptMethod -Value { param( [string]$key, [object]$val, [bool]$useCache) if ($this.Contains($key) -and $useCache) { return $this[$key] } else { $this[$key] = $val; return $val } } -Name 'AddWithCache' +function setupEnv() { + # Preload subscriptionId and tenant from context, which will be used in test + # as default. You could change them if needed. + $env.SubscriptionId = (Get-AzContext).Subscription.Id + $env.Tenant = (Get-AzContext).Tenant.Id + # For any resources you created for test, you should add it to $env here. + $envFile = 'env.json' + if ($TestMode -eq 'live') { + $envFile = 'localEnv.json' + } + set-content -Path (Join-Path $PSScriptRoot $envFile) -Value (ConvertTo-Json $env) +} +function cleanupEnv() { + # Clean resources you create for testing +} +"); + File.WriteAllText(utilFile, sc.ToString()); + } + foreach (var exportDirectory in exportDirectories) + { + var outputFolder = OutputFolder; + if (exportDirectory != ExportsFolder) + { + outputFolder = Path.Combine(OutputFolder, Path.GetFileName(exportDirectory)); + Directory.CreateDirectory(outputFolder); + } + + var variantGroups = GetScriptCmdlets(exportDirectory) + .SelectMany(fi => fi.ToVariants()) + .Where(v => !v.IsDoNotExport) + .GroupBy(v => v.CmdletName) + .Select(vg => new VariantGroup(ModuleName, vg.Key, vg.Select(v => v).ToArray(), outputFolder, isTest: true)) + .Where(vtg => !File.Exists(vtg.FilePath) && (IncludeGenerated || !vtg.IsGenerated)); + + foreach (var variantGroup in variantGroups) + { + var sb = new StringBuilder(); + sb.AppendLine($"if(($null -eq $TestName) -or ($TestName -contains '{variantGroup.CmdletName}'))"); + sb.AppendLine(@"{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath)" +); + sb.AppendLine($@" $TestRecordingFile = Join-Path $PSScriptRoot '{variantGroup.CmdletName}.Recording.json'"); + sb.AppendLine(@" $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} +"); + + + sb.AppendLine($"Describe '{variantGroup.CmdletName}' {{"); + var variants = variantGroup.Variants + .Where(v => IncludeGenerated || !v.Attributes.OfType().Any()) + .ToList(); + + foreach (var variant in variants) + { + sb.AppendLine($"{Indent}It '{variant.VariantName}' -skip {{"); + sb.AppendLine($"{Indent}{Indent}{{ throw [System.NotImplementedException] }} | Should -Not -Throw"); + var variantSeparator = variants.IndexOf(variant) == variants.Count - 1 ? String.Empty : Environment.NewLine; + sb.AppendLine($"{Indent}}}{variantSeparator}"); + } + sb.AppendLine("}"); + + File.WriteAllText(variantGroup.FilePath, sb.ToString()); + } + } + } + catch (Exception ee) + { + Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}"); + throw ee; + } + } + } +} diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/BuildTime/Cmdlets/GetCommonParameter.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/BuildTime/Cmdlets/GetCommonParameter.cs new file mode 100644 index 000000000000..31705dca4e65 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/BuildTime/Cmdlets/GetCommonParameter.cs @@ -0,0 +1,52 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System.Collections.Generic; +using System.Linq; +using System.Management.Automation; + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell +{ + [Cmdlet(VerbsCommon.Get, "CommonParameter")] + [OutputType(typeof(Dictionary))] + [DoNotExport] + public class GetCommonParameter : PSCmdlet + { + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public PSCmdlet PSCmdlet { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public Dictionary PSBoundParameter { get; set; } + + protected override void ProcessRecord() + { + try + { + var variants = PSCmdlet.MyInvocation.MyCommand.ToVariants(); + var commonParameterNames = variants.ToParameterGroups() + .Where(pg => pg.OrderCategory == ParameterCategory.Azure || pg.OrderCategory == ParameterCategory.Runtime) + .Select(pg => pg.ParameterName); + if (variants.Any(v => v.SupportsShouldProcess)) + { + commonParameterNames = commonParameterNames.Append("Confirm").Append("WhatIf"); + } + if (variants.Any(v => v.SupportsPaging)) + { + commonParameterNames = commonParameterNames.Append("First").Append("Skip").Append("IncludeTotalCount"); + } + + var names = commonParameterNames.ToArray(); + var keys = PSBoundParameter.Keys.Where(k => names.Contains(k)); + WriteObject(keys.ToDictionary(key => key, key => PSBoundParameter[key]), true); + } + catch (System.Exception ee) + { + System.Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}"); + throw ee; + } + } + } +} diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/BuildTime/Cmdlets/GetModuleGuid.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/BuildTime/Cmdlets/GetModuleGuid.cs new file mode 100644 index 000000000000..35a0c150b51a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/BuildTime/Cmdlets/GetModuleGuid.cs @@ -0,0 +1,31 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System.Management.Automation; +using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.PsHelpers; + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell +{ + [Cmdlet(VerbsCommon.Get, "ModuleGuid")] + [DoNotExport] + public class GetModuleGuid : PSCmdlet + { + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string Psd1Path { get; set; } + + protected override void ProcessRecord() + { + try + { + WriteObject(ReadGuidFromPsd1(Psd1Path)); + } + catch (System.Exception ee) + { + System.Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}"); + throw ee; + } + } + } +} diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/BuildTime/Cmdlets/GetScriptCmdlet.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/BuildTime/Cmdlets/GetScriptCmdlet.cs new file mode 100644 index 000000000000..0839c3537bc1 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/BuildTime/Cmdlets/GetScriptCmdlet.cs @@ -0,0 +1,54 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System.Linq; +using System.Management.Automation; +using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.PsHelpers; + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell +{ + [Cmdlet(VerbsCommon.Get, "ScriptCmdlet")] + [OutputType(typeof(string[]))] + [DoNotExport] + public class GetScriptCmdlet : PSCmdlet + { + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string ScriptFolder { get; set; } + + [Parameter] + public SwitchParameter IncludeDoNotExport { get; set; } + + [Parameter] + public SwitchParameter AsAlias { get; set; } + + [Parameter] + public SwitchParameter AsFunctionInfo { get; set; } + + protected override void ProcessRecord() + { + try + { + var functionInfos = GetScriptCmdlets(this, ScriptFolder) + .Where(fi => IncludeDoNotExport || !fi.ScriptBlock.Attributes.OfType().Any()) + .ToArray(); + if (AsFunctionInfo) + { + WriteObject(functionInfos, true); + return; + } + var aliases = functionInfos.SelectMany(i => i.ScriptBlock.Attributes).ToAliasNames(); + var names = functionInfos.Select(fi => fi.Name).Distinct(); + var output = (AsAlias ? aliases : names).DefaultIfEmpty("''").ToArray(); + WriteObject(output, true); + } + catch (System.Exception ee) + { + System.Console.Error.WriteLine($"{ee.GetType().Name}: {ee.Message}"); + System.Console.Error.WriteLine(ee.StackTrace); + throw ee; + } + } + } +} diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/BuildTime/CollectionExtensions.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/BuildTime/CollectionExtensions.cs new file mode 100644 index 000000000000..2f30be0a071c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/BuildTime/CollectionExtensions.cs @@ -0,0 +1,20 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell +{ + internal static class CollectionExtensions + { + public static T[] NullIfEmpty(this T[] collection) => (collection?.Any() ?? false) ? collection : null; + public static IEnumerable EmptyIfNull(this IEnumerable collection) => collection ?? Enumerable.Empty(); + + // https://stackoverflow.com/a/4158364/294804 + public static IEnumerable DistinctBy(this IEnumerable collection, Func selector) => + collection.GroupBy(selector).Select(group => group.First()); + } +} diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/BuildTime/MarkdownRenderer.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/BuildTime/MarkdownRenderer.cs new file mode 100644 index 000000000000..c38207d8f2f2 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/BuildTime/MarkdownRenderer.cs @@ -0,0 +1,114 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.MarkdownTypesExtensions; +using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.PsProxyOutputExtensions; + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell +{ + internal static class MarkdownRenderer + { + public static void WriteMarkdowns(IEnumerable variantGroups, PsModuleHelpInfo moduleHelpInfo, string docsFolder, string examplesFolder) + { + Directory.CreateDirectory(docsFolder); + var markdownInfos = variantGroups.Where(vg => !vg.IsInternal).Select(vg => new MarkdownHelpInfo(vg, examplesFolder)).OrderBy(mhi => mhi.CmdletName).ToArray(); + + foreach (var markdownInfo in markdownInfos) + { + var sb = new StringBuilder(); + sb.Append(markdownInfo.ToHelpMetadataOutput()); + sb.Append($"# {markdownInfo.CmdletName}{Environment.NewLine}{Environment.NewLine}"); + sb.Append($"## SYNOPSIS{Environment.NewLine}{markdownInfo.Synopsis.ToDescriptionFormat()}{Environment.NewLine}{Environment.NewLine}"); + + sb.Append($"## SYNTAX{Environment.NewLine}{Environment.NewLine}"); + var hasMultipleParameterSets = markdownInfo.SyntaxInfos.Length > 1; + foreach (var syntaxInfo in markdownInfo.SyntaxInfos) + { + sb.Append(syntaxInfo.ToHelpSyntaxOutput(hasMultipleParameterSets)); + } + + sb.Append($"## DESCRIPTION{Environment.NewLine}{markdownInfo.Description.ToDescriptionFormat()}{Environment.NewLine}{Environment.NewLine}"); + + sb.Append($"## EXAMPLES{Environment.NewLine}{Environment.NewLine}"); + foreach (var exampleInfo in markdownInfo.Examples) + { + sb.Append(exampleInfo.ToHelpExampleOutput()); + } + + sb.Append($"## PARAMETERS{Environment.NewLine}{Environment.NewLine}"); + foreach (var parameter in markdownInfo.Parameters) + { + sb.Append(parameter.ToHelpParameterOutput()); + } + if (markdownInfo.SupportsShouldProcess) + { + foreach (var parameter in SupportsShouldProcessParameters) + { + sb.Append(parameter.ToHelpParameterOutput()); + } + } + + sb.Append($"### CommonParameters{Environment.NewLine}This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).{Environment.NewLine}{Environment.NewLine}"); + + sb.Append($"## INPUTS{Environment.NewLine}{Environment.NewLine}"); + foreach (var input in markdownInfo.Inputs) + { + sb.Append($"### {input}{Environment.NewLine}{Environment.NewLine}"); + } + + sb.Append($"## OUTPUTS{Environment.NewLine}{Environment.NewLine}"); + foreach (var output in markdownInfo.Outputs) + { + sb.Append($"### {output}{Environment.NewLine}{Environment.NewLine}"); + } + + sb.Append($"## NOTES{Environment.NewLine}{Environment.NewLine}"); + sb.Append($"ALIASES{Environment.NewLine}{Environment.NewLine}"); + foreach (var alias in markdownInfo.Aliases) + { + sb.Append($"{alias}{Environment.NewLine}{Environment.NewLine}"); + } + if (markdownInfo.ComplexInterfaceInfos.Any()) + { + sb.Append($"{ComplexParameterHeader}{Environment.NewLine}"); + } + foreach (var complexInterfaceInfo in markdownInfo.ComplexInterfaceInfos) + { + sb.Append($"{complexInterfaceInfo.ToNoteOutput(includeDashes: true, includeBackticks: true)}{Environment.NewLine}{Environment.NewLine}"); + } + + sb.Append($"## RELATED LINKS{Environment.NewLine}{Environment.NewLine}"); + foreach (var relatedLink in markdownInfo.RelatedLinks) + { + sb.Append($"{relatedLink}{Environment.NewLine}{Environment.NewLine}"); + } + + File.WriteAllText(Path.Combine(docsFolder, $"{markdownInfo.CmdletName}.md"), sb.ToString()); + } + + WriteModulePage(moduleHelpInfo, markdownInfos, docsFolder); + } + + private static void WriteModulePage(PsModuleHelpInfo moduleInfo, MarkdownHelpInfo[] markdownInfos, string docsFolder) + { + var sb = new StringBuilder(); + sb.Append(moduleInfo.ToModulePageMetadataOutput()); + sb.Append($"# {moduleInfo.Name} Module{Environment.NewLine}"); + sb.Append($"## Description{Environment.NewLine}{moduleInfo.Description.ToDescriptionFormat()}{Environment.NewLine}{Environment.NewLine}"); + + sb.Append($"## {moduleInfo.Name} Cmdlets{Environment.NewLine}"); + foreach (var markdownInfo in markdownInfos) + { + sb.Append(markdownInfo.ToModulePageCmdletOutput()); + } + + File.WriteAllText(Path.Combine(docsFolder, $"{moduleInfo.Name}.md"), sb.ToString()); + } + } +} diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/BuildTime/Models/PsFormatTypes.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/BuildTime/Models/PsFormatTypes.cs new file mode 100644 index 000000000000..faacb702d791 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/BuildTime/Models/PsFormatTypes.cs @@ -0,0 +1,138 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Xml.Serialization; + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell +{ + internal class ViewParameters + { + public Type Type { get; } + public IEnumerable Properties { get; } + + public ViewParameters(Type type, IEnumerable properties) + { + Type = type; + Properties = properties; + } + } + + internal class PropertyFormat + { + public PropertyInfo Property { get; } + public FormatTableAttribute FormatTable { get; } + + public int? Index { get; } + public string Label { get; } + public int? Width { get; } + public PropertyOrigin? Origin { get; } + + public PropertyFormat(PropertyInfo propertyInfo) + { + Property = propertyInfo; + FormatTable = Property.GetCustomAttributes().FirstOrDefault(); + var origin = Property.GetCustomAttributes().FirstOrDefault(); + + Index = FormatTable?.HasIndex ?? false ? (int?)FormatTable.Index : null; + Label = FormatTable?.Label ?? propertyInfo.Name; + Width = FormatTable?.HasWidth ?? false ? (int?)FormatTable.Width : null; + // If we have an index, we don't want to use Origin. + Origin = FormatTable?.HasIndex ?? false ? null : origin?.Origin; + } + } + + [Serializable] + [XmlRoot(nameof(Configuration))] + public class Configuration + { + [XmlElement("ViewDefinitions")] + public ViewDefinitions ViewDefinitions { get; set; } + } + + [Serializable] + public class ViewDefinitions + { + //https://stackoverflow.com/a/10518657/294804 + [XmlElement("View")] + public List Views { get; set; } + } + + [Serializable] + public class View + { + [XmlElement(nameof(Name))] + public string Name { get; set; } + [XmlElement(nameof(ViewSelectedBy))] + public ViewSelectedBy ViewSelectedBy { get; set; } + [XmlElement(nameof(TableControl))] + public TableControl TableControl { get; set; } + } + + [Serializable] + public class ViewSelectedBy + { + [XmlElement(nameof(TypeName))] + public string TypeName { get; set; } + } + + [Serializable] + public class TableControl + { + [XmlElement(nameof(TableHeaders))] + public TableHeaders TableHeaders { get; set; } + [XmlElement(nameof(TableRowEntries))] + public TableRowEntries TableRowEntries { get; set; } + } + + [Serializable] + public class TableHeaders + { + [XmlElement("TableColumnHeader")] + public List TableColumnHeaders { get; set; } + } + + [Serializable] + public class TableColumnHeader + { + [XmlElement(nameof(Label))] + public string Label { get; set; } + [XmlElement(nameof(Width))] + public int? Width { get; set; } + + //https://stackoverflow.com/a/4095225/294804 + public bool ShouldSerializeWidth() => Width.HasValue; + } + + [Serializable] + public class TableRowEntries + { + [XmlElement(nameof(TableRowEntry))] + public TableRowEntry TableRowEntry { get; set; } + } + + [Serializable] + public class TableRowEntry + { + [XmlElement(nameof(TableColumnItems))] + public TableColumnItems TableColumnItems { get; set; } + } + + [Serializable] + public class TableColumnItems + { + [XmlElement("TableColumnItem")] + public List TableItems { get; set; } + } + + [Serializable] + public class TableColumnItem + { + [XmlElement(nameof(PropertyName))] + public string PropertyName { get; set; } + } +} diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/BuildTime/Models/PsHelpMarkdownOutputs.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/BuildTime/Models/PsHelpMarkdownOutputs.cs new file mode 100644 index 000000000000..291df206a59c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/BuildTime/Models/PsHelpMarkdownOutputs.cs @@ -0,0 +1,199 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Linq; +using System.Management.Automation; +using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.PsHelpOutputExtensions; + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell +{ + internal class HelpMetadataOutput + { + public MarkdownHelpInfo HelpInfo { get; } + + public HelpMetadataOutput(MarkdownHelpInfo helpInfo) + { + HelpInfo = helpInfo; + } + + public override string ToString() => $@"--- +external help file:{(!String.IsNullOrEmpty(HelpInfo.ExternalHelpFilename) ? $" {HelpInfo.ExternalHelpFilename}" : String.Empty)} +Module Name: {HelpInfo.ModuleName} +online version: {HelpInfo.OnlineVersion} +schema: {HelpInfo.Schema.ToString(3)} +--- + +"; + } + + internal class HelpSyntaxOutput + { + public MarkdownSyntaxHelpInfo SyntaxInfo { get; } + public bool HasMultipleParameterSets { get; } + + public HelpSyntaxOutput(MarkdownSyntaxHelpInfo syntaxInfo, bool hasMultipleParameterSets) + { + SyntaxInfo = syntaxInfo; + HasMultipleParameterSets = hasMultipleParameterSets; + } + + public override string ToString() + { + var psnText = HasMultipleParameterSets ? $"### {SyntaxInfo.ParameterSetName}{(SyntaxInfo.IsDefault ? " (Default)" : String.Empty)}{Environment.NewLine}" : String.Empty; + return $@"{psnText}``` +{SyntaxInfo.SyntaxText} +``` + +"; + } + } + + internal class HelpExampleOutput + { + private string ExampleTemplate = + "{0}{1}" + Environment.NewLine + + "{2}" + Environment.NewLine + "{3}" + Environment.NewLine + "{4}" + Environment.NewLine + Environment.NewLine + + "{5}" + Environment.NewLine + Environment.NewLine; + + private string ExampleTemplateWithOutput = + "{0}{1}" + Environment.NewLine + + "{2}" + Environment.NewLine + "{3}" + Environment.NewLine + "{4}" + Environment.NewLine + Environment.NewLine + + "{5}" + Environment.NewLine + "{6}" + Environment.NewLine + "{7}" + Environment.NewLine + Environment.NewLine + + "{8}" + Environment.NewLine + Environment.NewLine; + + public MarkdownExampleHelpInfo ExampleInfo { get; } + + public HelpExampleOutput(MarkdownExampleHelpInfo exampleInfo) + { + ExampleInfo = exampleInfo; + } + + public override string ToString() + { + if (string.IsNullOrEmpty(ExampleInfo.Output)) + { + return string.Format(ExampleTemplate, + ExampleNameHeader, ExampleInfo.Name, + ExampleCodeHeader, ExampleInfo.Code, ExampleCodeFooter, + ExampleInfo.Description.ToDescriptionFormat()); + } + else + { + return string.Format(ExampleTemplateWithOutput, + ExampleNameHeader, ExampleInfo.Name, + ExampleCodeHeader, ExampleInfo.Code, ExampleCodeFooter, + ExampleOutputHeader, ExampleInfo.Output, ExampleOutputFooter, + ExampleInfo.Description.ToDescriptionFormat()); ; + } + } + } + + internal class HelpParameterOutput + { + public MarkdownParameterHelpInfo ParameterInfo { get; } + + public HelpParameterOutput(MarkdownParameterHelpInfo parameterInfo) + { + ParameterInfo = parameterInfo; + } + + public override string ToString() + { + var pipelineInputTypes = new[] + { + ParameterInfo.AcceptsPipelineByValue ? "ByValue" : String.Empty, + ParameterInfo.AcceptsPipelineByPropertyName ? "ByPropertyName" : String.Empty + }.JoinIgnoreEmpty(", "); + var pipelineInput = ParameterInfo.AcceptsPipelineByValue || ParameterInfo.AcceptsPipelineByPropertyName + ? $@"{true} ({pipelineInputTypes})" + : false.ToString(); + + return $@"### -{ParameterInfo.Name} +{ParameterInfo.Description.ToDescriptionFormat()} + +```yaml +Type: {ParameterInfo.Type.FullName} +Parameter Sets: {(ParameterInfo.HasAllParameterSets ? "(All)" : ParameterInfo.ParameterSetNames.JoinIgnoreEmpty(", "))} +Aliases:{(ParameterInfo.Aliases.Any() ? $" {ParameterInfo.Aliases.JoinIgnoreEmpty(", ")}" : String.Empty)} + +Required: {ParameterInfo.IsRequired} +Position: {ParameterInfo.Position} +Default value: {ParameterInfo.DefaultValue} +Accept pipeline input: {pipelineInput} +Accept wildcard characters: {ParameterInfo.AcceptsWildcardCharacters} +``` + +"; + } + } + + internal class ModulePageMetadataOutput + { + public PsModuleHelpInfo ModuleInfo { get; } + + private static string HelpLinkPrefix { get; } = @"https://learn.microsoft.com/powershell/module/"; + + public ModulePageMetadataOutput(PsModuleHelpInfo moduleInfo) + { + ModuleInfo = moduleInfo; + } + + public override string ToString() => $@"--- +Module Name: {ModuleInfo.Name} +Module Guid: {ModuleInfo.Guid} +Download Help Link: {HelpLinkPrefix}{ModuleInfo.Name.ToLowerInvariant()} +Help Version: 1.0.0.0 +Locale: en-US +--- + +"; + } + + internal class ModulePageCmdletOutput + { + public MarkdownHelpInfo HelpInfo { get; } + + public ModulePageCmdletOutput(MarkdownHelpInfo helpInfo) + { + HelpInfo = helpInfo; + } + + public override string ToString() => $@"### [{HelpInfo.CmdletName}]({HelpInfo.CmdletName}.md) +{HelpInfo.Synopsis.ToDescriptionFormat()} + +"; + } + + internal static class PsHelpOutputExtensions + { + public static string EscapeAngleBrackets(this string text) => text?.Replace("<", @"\<").Replace(">", @"\>"); + public static string ReplaceSentenceEndWithNewline(this string text) => text?.Replace(". ", $".{Environment.NewLine}").Replace(". ", $".{Environment.NewLine}"); + public static string ReplaceBrWithNewline(this string text) => text?.Replace("
", $"{Environment.NewLine}"); + public static string ToDescriptionFormat(this string text, bool escapeAngleBrackets = true) + { + var description = text?.ReplaceBrWithNewline(); + description = escapeAngleBrackets ? description?.EscapeAngleBrackets() : description; + return description?.ReplaceSentenceEndWithNewline().Trim(); + } + + public const string ExampleNameHeader = "### "; + public const string ExampleCodeHeader = "```powershell"; + public const string ExampleCodeFooter = "```"; + public const string ExampleOutputHeader = "```output"; + public const string ExampleOutputFooter = "```"; + + public static HelpMetadataOutput ToHelpMetadataOutput(this MarkdownHelpInfo helpInfo) => new HelpMetadataOutput(helpInfo); + + public static HelpSyntaxOutput ToHelpSyntaxOutput(this MarkdownSyntaxHelpInfo syntaxInfo, bool hasMultipleParameterSets) => new HelpSyntaxOutput(syntaxInfo, hasMultipleParameterSets); + + public static HelpExampleOutput ToHelpExampleOutput(this MarkdownExampleHelpInfo exampleInfo) => new HelpExampleOutput(exampleInfo); + + public static HelpParameterOutput ToHelpParameterOutput(this MarkdownParameterHelpInfo parameterInfo) => new HelpParameterOutput(parameterInfo); + + public static ModulePageMetadataOutput ToModulePageMetadataOutput(this PsModuleHelpInfo moduleInfo) => new ModulePageMetadataOutput(moduleInfo); + + public static ModulePageCmdletOutput ToModulePageCmdletOutput(this MarkdownHelpInfo helpInfo) => new ModulePageCmdletOutput(helpInfo); + } +} diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/BuildTime/Models/PsHelpTypes.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/BuildTime/Models/PsHelpTypes.cs new file mode 100644 index 000000000000..45aee10c3bc3 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/BuildTime/Models/PsHelpTypes.cs @@ -0,0 +1,202 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Management.Automation; + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell +{ + internal class PsHelpInfo + { + public string CmdletName { get; } + public string ModuleName { get; } + public string Synopsis { get; } + public string Description { get; } + public string AlertText { get; } + public string Category { get; } + public PsHelpLinkInfo OnlineVersion { get; } + public PsHelpLinkInfo[] RelatedLinks { get; } + public bool? HasCommonParameters { get; } + public bool? HasWorkflowCommonParameters { get; } + + public PsHelpTypeInfo[] InputTypes { get; } + public PsHelpTypeInfo[] OutputTypes { get; } + public PsHelpExampleInfo[] Examples { get; set; } + public string[] Aliases { get; } + + public PsParameterHelpInfo[] Parameters { get; } + public PsHelpSyntaxInfo[] Syntax { get; } + + public object Component { get; } + public object Functionality { get; } + public object PsSnapIn { get; } + public object Role { get; } + public string NonTerminatingErrors { get; } + + public PsHelpInfo(PSObject helpObject = null) + { + helpObject = helpObject ?? new PSObject(); + CmdletName = helpObject.GetProperty("Name").NullIfEmpty() ?? helpObject.GetNestedProperty("details", "name"); + ModuleName = helpObject.GetProperty("ModuleName"); + Synopsis = helpObject.GetProperty("Synopsis"); + Description = helpObject.GetProperty("description").EmptyIfNull().ToDescriptionText().NullIfEmpty() ?? + helpObject.GetNestedProperty("details", "description").EmptyIfNull().ToDescriptionText(); + AlertText = helpObject.GetNestedProperty("alertSet", "alert").EmptyIfNull().ToDescriptionText(); + Category = helpObject.GetProperty("Category"); + HasCommonParameters = helpObject.GetProperty("CommonParameters").ToNullableBool(); + HasWorkflowCommonParameters = helpObject.GetProperty("WorkflowCommonParameters").ToNullableBool(); + + var links = helpObject.GetNestedProperty("relatedLinks", "navigationLink").EmptyIfNull().Select(nl => nl.ToLinkInfo()).ToArray(); + OnlineVersion = links.FirstOrDefault(l => l.Text?.ToLowerInvariant().StartsWith("online version:") ?? links.Length == 1); + RelatedLinks = links.Where(l => !l.Text?.ToLowerInvariant().StartsWith("online version:") ?? links.Length != 1).ToArray(); + + InputTypes = helpObject.GetNestedProperty("inputTypes", "inputType").EmptyIfNull().Select(it => it.ToTypeInfo()).ToArray(); + OutputTypes = helpObject.GetNestedProperty("returnValues", "returnValue").EmptyIfNull().Select(rv => rv.ToTypeInfo()).ToArray(); + Examples = helpObject.GetNestedProperty("examples", "example").EmptyIfNull().Select(e => e.ToExampleInfo()).ToArray(); + Aliases = helpObject.GetProperty("aliases").EmptyIfNull().Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries); + + Parameters = helpObject.GetNestedProperty("parameters", "parameter").EmptyIfNull().Select(p => p.ToPsParameterHelpInfo()).ToArray(); + Syntax = helpObject.GetNestedProperty("syntax", "syntaxItem").EmptyIfNull().Select(si => si.ToSyntaxInfo()).ToArray(); + + Component = helpObject.GetProperty("Component"); + Functionality = helpObject.GetProperty("Functionality"); + PsSnapIn = helpObject.GetProperty("PSSnapIn"); + Role = helpObject.GetProperty("Role"); + NonTerminatingErrors = helpObject.GetProperty("nonTerminatingErrors"); + } + } + + internal class PsHelpTypeInfo + { + public string Name { get; } + public string Description { get; } + + public PsHelpTypeInfo(PSObject typeObject) + { + Name = typeObject.GetNestedProperty("type", "name").EmptyIfNull().Trim(); + Description = typeObject.GetProperty("description").EmptyIfNull().ToDescriptionText(); + } + } + + internal class PsHelpLinkInfo + { + public string Uri { get; } + public string Text { get; } + + public PsHelpLinkInfo(PSObject linkObject) + { + Uri = linkObject.GetProperty("uri"); + Text = linkObject.GetProperty("linkText"); + } + } + + internal class PsHelpSyntaxInfo + { + public string CmdletName { get; } + public PsParameterHelpInfo[] Parameters { get; } + + public PsHelpSyntaxInfo(PSObject syntaxObject) + { + CmdletName = syntaxObject.GetProperty("name"); + Parameters = syntaxObject.GetProperty("parameter").EmptyIfNull().Select(p => p.ToPsParameterHelpInfo()).ToArray(); + } + } + + internal class PsHelpExampleInfo + { + public string Title { get; } + public string Code { get; } + public string Output { get; } + public string Remarks { get; } + + public PsHelpExampleInfo(PSObject exampleObject) + { + Title = exampleObject.GetProperty("title"); + Code = exampleObject.GetProperty("code"); + Output = exampleObject.GetProperty("output"); + Remarks = exampleObject.GetProperty("remarks").EmptyIfNull().ToDescriptionText(); + } + public PsHelpExampleInfo(MarkdownExampleHelpInfo markdownExample) + { + Title = markdownExample.Name; + Code = markdownExample.Code; + Output = markdownExample.Output; + Remarks = markdownExample.Description; + } + + public static implicit operator PsHelpExampleInfo(MarkdownExampleHelpInfo markdownExample) => new PsHelpExampleInfo(markdownExample); + } + + internal class PsParameterHelpInfo + { + public string DefaultValueAsString { get; } + + public string Name { get; } + public string TypeName { get; } + public string Description { get; } + public string SupportsPipelineInput { get; } + public string PositionText { get; } + public string[] ParameterSetNames { get; } + public string[] Aliases { get; } + + public bool? SupportsGlobbing { get; } + public bool? IsRequired { get; } + public bool? IsVariableLength { get; } + public bool? IsDynamic { get; } + + public PsParameterHelpInfo(PSObject parameterHelpObject = null) + { + parameterHelpObject = parameterHelpObject ?? new PSObject(); + DefaultValueAsString = parameterHelpObject.GetProperty("defaultValue"); + Name = parameterHelpObject.GetProperty("name"); + TypeName = parameterHelpObject.GetProperty("parameterValue").NullIfEmpty() ?? parameterHelpObject.GetNestedProperty("type", "name"); + Description = parameterHelpObject.GetProperty("Description").EmptyIfNull().ToDescriptionText(); + SupportsPipelineInput = parameterHelpObject.GetProperty("pipelineInput"); + PositionText = parameterHelpObject.GetProperty("position"); + ParameterSetNames = parameterHelpObject.GetProperty("parameterSetName").EmptyIfNull().Split(new[] { ", " }, StringSplitOptions.RemoveEmptyEntries); + Aliases = parameterHelpObject.GetProperty("aliases").EmptyIfNull().Split(new[] { ", " }, StringSplitOptions.RemoveEmptyEntries); + + SupportsGlobbing = parameterHelpObject.GetProperty("globbing").ToNullableBool(); + IsRequired = parameterHelpObject.GetProperty("required").ToNullableBool(); + IsVariableLength = parameterHelpObject.GetProperty("variableLength").ToNullableBool(); + IsDynamic = parameterHelpObject.GetProperty("isDynamic").ToNullableBool(); + } + } + + internal class PsModuleHelpInfo + { + public string Name { get; } + public Guid Guid { get; } + public string Description { get; } + + public PsModuleHelpInfo(PSModuleInfo moduleInfo) + : this(moduleInfo?.Name ?? String.Empty, moduleInfo?.Guid ?? Guid.NewGuid(), moduleInfo?.Description ?? String.Empty) + { + } + + public PsModuleHelpInfo(string name, Guid guid, string description) + { + Name = name; + Guid = guid; + Description = description; + } + } + + internal static class HelpTypesExtensions + { + public static PsHelpInfo ToPsHelpInfo(this PSObject helpObject) => new PsHelpInfo(helpObject); + public static PsParameterHelpInfo ToPsParameterHelpInfo(this PSObject parameterHelpObject) => new PsParameterHelpInfo(parameterHelpObject); + + public static string ToDescriptionText(this IEnumerable descriptionObject) => descriptionObject != null + ? String.Join(Environment.NewLine, descriptionObject.Select(dl => dl.GetProperty("Text").EmptyIfNull())).NullIfWhiteSpace() + : null; + public static PsHelpTypeInfo ToTypeInfo(this PSObject typeObject) => new PsHelpTypeInfo(typeObject); + public static PsHelpExampleInfo ToExampleInfo(this PSObject exampleObject) => new PsHelpExampleInfo(exampleObject); + public static PsHelpLinkInfo ToLinkInfo(this PSObject linkObject) => new PsHelpLinkInfo(linkObject); + public static PsHelpSyntaxInfo ToSyntaxInfo(this PSObject syntaxObject) => new PsHelpSyntaxInfo(syntaxObject); + public static PsModuleHelpInfo ToModuleInfo(this PSModuleInfo moduleInfo) => new PsModuleHelpInfo(moduleInfo); + } +} diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/BuildTime/Models/PsMarkdownTypes.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/BuildTime/Models/PsMarkdownTypes.cs new file mode 100644 index 000000000000..e993a396e7d1 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/BuildTime/Models/PsMarkdownTypes.cs @@ -0,0 +1,294 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Management.Automation; +using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.MarkdownTypesExtensions; +using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.PsHelpOutputExtensions; + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell +{ + internal class MarkdownHelpInfo + { + public string ExternalHelpFilename { get; } + public string ModuleName { get; } + public string OnlineVersion { get; } + public Version Schema { get; } + + public string CmdletName { get; } + public string[] Aliases { get; } + public string Synopsis { get; } + public string Description { get; } + + public MarkdownSyntaxHelpInfo[] SyntaxInfos { get; } + public MarkdownExampleHelpInfo[] Examples { get; } + public MarkdownParameterHelpInfo[] Parameters { get; } + + public string[] Inputs { get; } + public string[] Outputs { get; } + public ComplexInterfaceInfo[] ComplexInterfaceInfos { get; } + public string[] RelatedLinks { get; } + + public bool SupportsShouldProcess { get; } + public bool SupportsPaging { get; } + + public MarkdownHelpInfo(VariantGroup variantGroup, string examplesFolder, string externalHelpFilename = "") + { + ExternalHelpFilename = externalHelpFilename; + ModuleName = variantGroup.RootModuleName != "" ? variantGroup.RootModuleName : variantGroup.ModuleName; + var helpInfo = variantGroup.HelpInfo; + var commentInfo = variantGroup.CommentInfo; + Schema = Version.Parse("2.0.0"); + + CmdletName = variantGroup.CmdletName; + Aliases = (variantGroup.Aliases.NullIfEmpty() ?? helpInfo.Aliases).Where(a => a != "None").ToArray(); + Synopsis = commentInfo.Synopsis; + Description = commentInfo.Description; + + SyntaxInfos = variantGroup.Variants + .Select(v => new MarkdownSyntaxHelpInfo(v, variantGroup.ParameterGroups, v.VariantName == variantGroup.DefaultParameterSetName)) + .OrderByDescending(v => v.IsDefault).ThenBy(v => v.ParameterSetName).ToArray(); + Examples = GetExamplesFromMarkdown(examplesFolder).NullIfEmpty() + ?? helpInfo.Examples.Select(e => e.ToExampleHelpInfo()).ToArray().NullIfEmpty() + ?? DefaultExampleHelpInfos; + + Parameters = variantGroup.ParameterGroups + .Where(pg => !pg.DontShow && !pg.Parameters.All(p => p.IsHidden())) + .Select(pg => new MarkdownParameterHelpInfo( + variantGroup.Variants.SelectMany(v => v.HelpInfo.Parameters).Where(phi => phi.Name == pg.ParameterName).ToArray(), pg)) + .OrderBy(phi => phi.Name).ToArray(); + + Inputs = commentInfo.Inputs; + Outputs = commentInfo.Outputs; + + ComplexInterfaceInfos = variantGroup.ComplexInterfaceInfos; + OnlineVersion = commentInfo.OnlineVersion; + RelatedLinks = commentInfo.RelatedLinks; + + SupportsShouldProcess = variantGroup.SupportsShouldProcess; + SupportsPaging = variantGroup.SupportsPaging; + } + + private MarkdownExampleHelpInfo[] GetExamplesFromMarkdown(string examplesFolder) + { + var filePath = Path.Combine(examplesFolder, $"{CmdletName}.md"); + if (!Directory.Exists(examplesFolder) || !File.Exists(filePath)) return null; + + var lines = File.ReadAllLines(filePath); + var nameIndices = lines.Select((l, i) => l.StartsWith(ExampleNameHeader) ? i : -1).Where(i => i != -1).ToArray(); + //https://codereview.stackexchange.com/a/187148/68772 + var indexCountGroups = nameIndices.Skip(1).Append(lines.Length).Zip(nameIndices, (next, current) => (NameIndex: current, LineCount: next - current)); + var exampleGroups = indexCountGroups.Select(icg => lines.Skip(icg.NameIndex).Take(icg.LineCount).ToArray()); + return exampleGroups.Select(eg => + { + var name = eg.First().Replace(ExampleNameHeader, String.Empty); + var codeStartIndex = eg.Select((l, i) => l.StartsWith(ExampleCodeHeader) ? (int?)i : null).FirstOrDefault(i => i.HasValue); + var codeEndIndex = eg.Select((l, i) => l.StartsWith(ExampleCodeFooter) ? (int?)i : null).FirstOrDefault(i => i.HasValue && i != codeStartIndex); + var code = codeStartIndex.HasValue && codeEndIndex.HasValue + ? String.Join(Environment.NewLine, eg.Skip(codeStartIndex.Value + 1).Take(codeEndIndex.Value - (codeStartIndex.Value + 1))) + : String.Empty; + var outputStartIndex = eg.Select((l, i) => l.StartsWith(ExampleOutputHeader) ? (int?)i : null).FirstOrDefault(i => i.HasValue); + var outputEndIndex = eg.Select((l, i) => l.StartsWith(ExampleOutputFooter) ? (int?)i : null).FirstOrDefault(i => i.HasValue && i > outputStartIndex); + var output = outputStartIndex.HasValue && outputEndIndex.HasValue + ? String.Join(Environment.NewLine, eg.Skip(outputStartIndex.Value + 1).Take(outputEndIndex.Value - (outputStartIndex.Value + 1))) + : String.Empty; + var descriptionStartIndex = (outputEndIndex ?? (codeEndIndex ?? 0)) + 1; + descriptionStartIndex = String.IsNullOrWhiteSpace(eg[descriptionStartIndex]) ? descriptionStartIndex + 1 : descriptionStartIndex; + var descriptionEndIndex = eg.Length - 1; + descriptionEndIndex = String.IsNullOrWhiteSpace(eg[descriptionEndIndex]) ? descriptionEndIndex - 1 : descriptionEndIndex; + var description = String.Join(Environment.NewLine, eg.Skip(descriptionStartIndex).Take((descriptionEndIndex + 1) - descriptionStartIndex)); + return new MarkdownExampleHelpInfo(name, code, output, description); + }).ToArray(); + } + } + + internal class MarkdownSyntaxHelpInfo + { + public Variant Variant { get; } + public bool IsDefault { get; } + public string ParameterSetName { get; } + public Parameter[] Parameters { get; } + public string SyntaxText { get; } + + public MarkdownSyntaxHelpInfo(Variant variant, ParameterGroup[] parameterGroups, bool isDefault) + { + Variant = variant; + IsDefault = isDefault; + ParameterSetName = Variant.VariantName; + Parameters = Variant.Parameters + .Where(p => !p.DontShow && !p.IsHidden()).OrderByDescending(p => p.IsMandatory) + //https://stackoverflow.com/a/6461526/294804 + .ThenByDescending(p => p.Position.HasValue).ThenBy(p => p.Position) + // Use the OrderCategory of the parameter group because the final order category is the highest of the group, and not the order category of the individual parameters from the variants. + .ThenBy(p => parameterGroups.First(pg => pg.ParameterName == p.ParameterName).OrderCategory).ThenBy(p => p.ParameterName).ToArray(); + SyntaxText = CreateSyntaxFormat(); + } + + //https://github.com/PowerShell/platyPS/blob/a607a926bfffe1e1a1e53c19e0057eddd0c07611/src/Markdown.MAML/Renderer/Markdownv2Renderer.cs#L29-L32 + private const int SyntaxLineWidth = 110; + private string CreateSyntaxFormat() + { + var parameterStrings = Parameters.Select(p => p.ToPropertySyntaxOutput().ToString()); + if (Variant.SupportsShouldProcess) + { + parameterStrings = parameterStrings.Append(" [-Confirm]").Append(" [-WhatIf]"); + } + parameterStrings = parameterStrings.Append(" []"); + + var lines = new List(20); + return parameterStrings.Aggregate(Variant.CmdletName, (current, ps) => + { + var combined = current + ps; + if (combined.Length <= SyntaxLineWidth) return combined; + + lines.Add(current); + return ps; + }, last => + { + lines.Add(last); + return String.Join(Environment.NewLine, lines); + }); + } + } + + internal class MarkdownExampleHelpInfo + { + public string Name { get; } + public string Code { get; } + public string Output { get; } + public string Description { get; } + + public MarkdownExampleHelpInfo(string name, string code, string output, string description) + { + Name = name; + Code = code; + Output = output; + Description = description; + } + } + + internal class MarkdownParameterHelpInfo + { + public string Name { get; set; } + public string Description { get; set; } + public Type Type { get; set; } + public string Position { get; set; } + public string DefaultValue { get; set; } + + public bool HasAllParameterSets { get; set; } + public string[] ParameterSetNames { get; set; } + public string[] Aliases { get; set; } + + public bool IsRequired { get; set; } + public bool IsDynamic { get; set; } + public bool AcceptsPipelineByValue { get; set; } + public bool AcceptsPipelineByPropertyName { get; set; } + public bool AcceptsWildcardCharacters { get; set; } + + // For use by common parameters that have no backing data in the objects themselves. + public MarkdownParameterHelpInfo() { } + + public MarkdownParameterHelpInfo(PsParameterHelpInfo[] parameterHelpInfos, ParameterGroup parameterGroup) + { + Name = parameterGroup.ParameterName; + Description = parameterGroup.Description.NullIfEmpty() + ?? parameterHelpInfos.Select(phi => phi.Description).FirstOrDefault(d => !String.IsNullOrEmpty(d)).EmptyIfNull(); + Type = parameterGroup.ParameterType; + Position = parameterGroup.FirstPosition?.ToString() + ?? parameterHelpInfos.Select(phi => phi.PositionText).FirstOrDefault(d => !String.IsNullOrEmpty(d)).ToUpperFirstCharacter().NullIfEmpty() + ?? "Named"; + // This no longer uses firstHelpInfo.DefaultValueAsString since it seems to be broken. For example, it has a value of 0 for Int32, but no default value was declared. + DefaultValue = parameterGroup.DefaultInfo?.Script ?? "None"; + + HasAllParameterSets = parameterGroup.HasAllVariants; + ParameterSetNames = (parameterGroup.Parameters.Select(p => p.VariantName).ToArray().NullIfEmpty() + ?? parameterHelpInfos.SelectMany(phi => phi.ParameterSetNames).Distinct()) + .OrderBy(psn => psn).ToArray(); + Aliases = parameterGroup.Aliases.NullIfEmpty() ?? parameterHelpInfos.SelectMany(phi => phi.Aliases).ToArray(); + + IsRequired = parameterHelpInfos.Select(phi => phi.IsRequired).FirstOrDefault(r => r == true) ?? parameterGroup.Parameters.Any(p => p.IsMandatory); + IsDynamic = parameterHelpInfos.Select(phi => phi.IsDynamic).FirstOrDefault(d => d == true) ?? false; + AcceptsPipelineByValue = parameterHelpInfos.Select(phi => phi.SupportsPipelineInput?.Contains("ByValue")).FirstOrDefault(bv => bv == true) ?? parameterGroup.ValueFromPipeline; + AcceptsPipelineByPropertyName = parameterHelpInfos.Select(phi => phi.SupportsPipelineInput?.Contains("ByPropertyName")).FirstOrDefault(bv => bv == true) ?? parameterGroup.ValueFromPipelineByPropertyName; + AcceptsWildcardCharacters = parameterGroup.SupportsWildcards; + } + } + + internal static class MarkdownTypesExtensions + { + public static MarkdownExampleHelpInfo ToExampleHelpInfo(this PsHelpExampleInfo exampleInfo) => new MarkdownExampleHelpInfo(exampleInfo.Title, exampleInfo.Code, exampleInfo.Output, exampleInfo.Remarks); + + public static MarkdownExampleHelpInfo[] DefaultExampleHelpInfos = + { + new MarkdownExampleHelpInfo("Example 1: {{ Add title here }}", $@"{{{{ Add code here }}}}", $@"{{{{ Add output here }}}}", @"{{ Add description here }}"), + new MarkdownExampleHelpInfo("Example 2: {{ Add title here }}", $@"{{{{ Add code here }}}}", $@"{{{{ Add output here }}}}", @"{{ Add description here }}"), + }; + + public static MarkdownParameterHelpInfo[] SupportsShouldProcessParameters = + { + new MarkdownParameterHelpInfo + { + Name = "Confirm", + Description ="Prompts you for confirmation before running the cmdlet.", + Type = typeof(SwitchParameter), + Position = "Named", + DefaultValue = "None", + HasAllParameterSets = true, + ParameterSetNames = new [] { "(All)" }, + Aliases = new [] { "cf" } + }, + new MarkdownParameterHelpInfo + { + Name = "WhatIf", + Description ="Shows what would happen if the cmdlet runs. The cmdlet is not run.", + Type = typeof(SwitchParameter), + Position = "Named", + DefaultValue = "None", + HasAllParameterSets = true, + ParameterSetNames = new [] { "(All)" }, + Aliases = new [] { "wi" } + } + }; + + public static MarkdownParameterHelpInfo[] SupportsPagingParameters = + { + new MarkdownParameterHelpInfo + { + Name = "First", + Description ="Gets only the first 'n' objects.", + Type = typeof(ulong), + Position = "Named", + DefaultValue = "None", + HasAllParameterSets = true, + ParameterSetNames = new [] { "(All)" }, + Aliases = new string[0] + }, + new MarkdownParameterHelpInfo + { + Name = "IncludeTotalCount", + Description ="Reports the number of objects in the data set (an integer) followed by the objects. If the cmdlet cannot determine the total count, it returns \"Unknown total count\".", + Type = typeof(SwitchParameter), + Position = "Named", + DefaultValue = "None", + HasAllParameterSets = true, + ParameterSetNames = new [] { "(All)" }, + Aliases = new string[0] + }, + new MarkdownParameterHelpInfo + { + Name = "Skip", + Description ="Ignores the first 'n' objects and then gets the remaining objects.", + Type = typeof(ulong), + Position = "Named", + DefaultValue = "None", + HasAllParameterSets = true, + ParameterSetNames = new [] { "(All)" }, + Aliases = new string[0] + } + }; + } +} diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/BuildTime/Models/PsProxyOutputs.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/BuildTime/Models/PsProxyOutputs.cs new file mode 100644 index 000000000000..11f85b92b34b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/BuildTime/Models/PsProxyOutputs.cs @@ -0,0 +1,611 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Management.Automation; +using System.Text; +using System.Text.RegularExpressions; +using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.PsProxyOutputExtensions; +using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.PsProxyTypeExtensions; + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell +{ + internal class OutputTypeOutput + { + public PSTypeName[] OutputTypes { get; } + + public OutputTypeOutput(IEnumerable outputTypes) + { + OutputTypes = outputTypes.ToArray(); + } + + public override string ToString() => OutputTypes != null && OutputTypes.Any() ? $"[OutputType({OutputTypes.Select(ot => $"[{ot}]").JoinIgnoreEmpty(ItemSeparator)})]{Environment.NewLine}" : String.Empty; + } + + internal class CmdletBindingOutput + { + public VariantGroup VariantGroup { get; } + + public CmdletBindingOutput(VariantGroup variantGroup) + { + VariantGroup = variantGroup; + } + + public override string ToString() + { + var dpsText = VariantGroup.DefaultParameterSetName.IsValidDefaultParameterSetName() ? $"DefaultParameterSetName='{VariantGroup.DefaultParameterSetName}'" : String.Empty; + var sspText = VariantGroup.SupportsShouldProcess ? $"SupportsShouldProcess{ItemSeparator}ConfirmImpact='Medium'" : String.Empty; + var pbText = $"PositionalBinding={false.ToPsBool()}"; + var propertyText = new[] { dpsText, pbText, sspText }.JoinIgnoreEmpty(ItemSeparator); + return $"[CmdletBinding({propertyText})]{Environment.NewLine}"; + } + } + + internal class ParameterOutput + { + public Parameter Parameter { get; } + public bool HasMultipleVariantsInVariantGroup { get; } + public bool HasAllVariantsInParameterGroup { get; } + + public ParameterOutput(Parameter parameter, bool hasMultipleVariantsInVariantGroup, bool hasAllVariantsInParameterGroup) + { + Parameter = parameter; + HasMultipleVariantsInVariantGroup = hasMultipleVariantsInVariantGroup; + HasAllVariantsInParameterGroup = hasAllVariantsInParameterGroup; + } + + public override string ToString() + { + var psnText = HasMultipleVariantsInVariantGroup && !HasAllVariantsInParameterGroup ? $"ParameterSetName='{Parameter.VariantName}'" : String.Empty; + var positionText = Parameter.Position != null ? $"Position={Parameter.Position}" : String.Empty; + var mandatoryText = Parameter.IsMandatory ? "Mandatory" : String.Empty; + var dontShowText = Parameter.DontShow ? "DontShow" : String.Empty; + var vfpText = Parameter.ValueFromPipeline ? "ValueFromPipeline" : String.Empty; + var vfpbpnText = Parameter.ValueFromPipelineByPropertyName ? "ValueFromPipelineByPropertyName" : String.Empty; + var propertyText = new[] { psnText, positionText, mandatoryText, dontShowText, vfpText, vfpbpnText }.JoinIgnoreEmpty(ItemSeparator); + return $"{Indent}[Parameter({propertyText})]{Environment.NewLine}"; + } + } + + internal class AliasOutput + { + public string[] Aliases { get; } + public bool IncludeIndent { get; } + + public AliasOutput(string[] aliases, bool includeIndent = false) + { + Aliases = aliases; + IncludeIndent = includeIndent; + } + + public override string ToString() => Aliases?.Any() ?? false ? $"{(IncludeIndent ? Indent : String.Empty)}[Alias({Aliases.Select(an => $"'{an}'").JoinIgnoreEmpty(ItemSeparator)})]{Environment.NewLine}" : String.Empty; + } + + internal class ValidateNotNullOutput + { + public bool HasValidateNotNull { get; } + + public ValidateNotNullOutput(bool hasValidateNotNull) + { + HasValidateNotNull = hasValidateNotNull; + } + + public override string ToString() => HasValidateNotNull ? $"{Indent}[ValidateNotNull()]{Environment.NewLine}" : String.Empty; + } + + internal class AllowEmptyArrayOutput + { + public bool HasAllowEmptyArray { get; } + + public AllowEmptyArrayOutput(bool hasAllowEmptyArray) + { + HasAllowEmptyArray = hasAllowEmptyArray; + } + + public override string ToString() => HasAllowEmptyArray ? $"{Indent}[AllowEmptyCollection()]{Environment.NewLine}" : String.Empty; + } + internal class ArgumentCompleterOutput + { + public CompleterInfo CompleterInfo { get; } + + public ArgumentCompleterOutput(CompleterInfo completerInfo) + { + CompleterInfo = completerInfo; + } + + public override string ToString() => CompleterInfo != null + ? $"{Indent}[ArgumentCompleter({(CompleterInfo.IsTypeCompleter ? $"[{CompleterInfo.Type.Unwrap().ToPsType()}]" : $"{{{CompleterInfo.Script.ToPsSingleLine("; ")}}}")})]{Environment.NewLine}" + : String.Empty; + } + + internal class DefaultInfoOutput + { + public bool HasDefaultInfo { get; } + public DefaultInfo DefaultInfo { get; } + + public DefaultInfoOutput(ParameterGroup parameterGroup) + { + HasDefaultInfo = parameterGroup.HasDefaultInfo; + DefaultInfo = parameterGroup.DefaultInfo; + } + + public override string ToString() + { + var nameText = !String.IsNullOrEmpty(DefaultInfo?.Name) ? $"Name='{DefaultInfo?.Name}'" : String.Empty; + var descriptionText = !String.IsNullOrEmpty(DefaultInfo?.Description) ? $"Description='{DefaultInfo?.Description.ToPsStringLiteral()}'" : String.Empty; + var scriptText = !String.IsNullOrEmpty(DefaultInfo?.Script) ? $"Script='{DefaultInfo?.Script.ToPsSingleLine("; ")}'" : String.Empty; + var propertyText = new[] { nameText, descriptionText, scriptText }.JoinIgnoreEmpty(ItemSeparator); + return HasDefaultInfo ? $"{Indent}[{typeof(DefaultInfoAttribute).ToPsAttributeType()}({propertyText})]{Environment.NewLine}" : String.Empty; + } + } + + internal class ParameterTypeOutput + { + public Type ParameterType { get; } + + public ParameterTypeOutput(Type parameterType) + { + ParameterType = parameterType; + } + + public override string ToString() => $"{Indent}[{ParameterType.ToPsType()}]{Environment.NewLine}"; + } + + internal class ParameterNameOutput + { + public string ParameterName { get; } + public bool IsLast { get; } + + public ParameterNameOutput(string parameterName, bool isLast) + { + ParameterName = parameterName; + IsLast = isLast; + } + + public override string ToString() => $"{Indent}${{{ParameterName}}}{(IsLast ? String.Empty : $",{Environment.NewLine}")}{Environment.NewLine}"; + } + + internal class BaseOutput + { + public VariantGroup VariantGroup { get; } + + protected static readonly bool IsAzure = Convert.ToBoolean(@"true"); + public BaseOutput(VariantGroup variantGroup) + { + VariantGroup = variantGroup; + } + public string ClearTelemetryContext() + { + return (!VariantGroup.IsInternal && IsAzure) ? $@"{Indent}{Indent}[Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext()" : ""; + } + } + + internal class BeginOutput : BaseOutput + { + public BeginOutput(VariantGroup variantGroup) : base(variantGroup) + { + } + + public string GetProcessCustomAttributesAtRuntime() + { + return VariantGroup.IsInternal ? "" : $@"{Indent}{Indent}$cmdInfo = Get-Command -Name $mapping[$parameterSet]{Environment.NewLine}{Indent}{Indent}[Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)"; + } + private string GetTelemetry() + { + if (!VariantGroup.IsInternal && IsAzure) + { + return $@" +{Indent}{Indent}if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) {{ +{Indent}{Indent}{Indent}[Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString() +{Indent}{Indent}}} +{Indent}{Indent}$preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId +{Indent}{Indent}if ($preTelemetryId -eq '') {{ +{Indent}{Indent}{Indent}[Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() +{Indent}{Indent}{Indent}[Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) +{Indent}{Indent}}} else {{ +{Indent}{Indent}{Indent}$internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets +{Indent}{Indent}{Indent}if ($internalCalledCmdlets -eq '') {{ +{Indent}{Indent}{Indent}{Indent}[Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name +{Indent}{Indent}{Indent}}} else {{ +{Indent}{Indent}{Indent}{Indent}[Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name +{Indent}{Indent}{Indent}}} +{Indent}{Indent}{Indent}[Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' +{Indent}{Indent}}} +"; + } + return ""; + } + public override string ToString() => $@"begin {{ +{Indent}try {{ +{Indent}{Indent}$outBuffer = $null +{Indent}{Indent}if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) {{ +{Indent}{Indent}{Indent}$PSBoundParameters['OutBuffer'] = 1 +{Indent}{Indent}}} +{Indent}{Indent}$parameterSet = $PSCmdlet.ParameterSetName +{GetTelemetry()} +{GetParameterSetToCmdletMapping()}{GetDefaultValuesStatements()} +{GetProcessCustomAttributesAtRuntime()} +{Indent}{Indent}$wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) +{Indent}{Indent}$scriptCmd = {{& $wrappedCmd @PSBoundParameters}} +{Indent}{Indent}$steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) +{Indent}{Indent}$steppablePipeline.Begin($PSCmdlet) +{Indent}}} catch {{ +{ClearTelemetryContext()} +{Indent}{Indent}throw +{Indent}}} +}} + +"; + + private string GetParameterSetToCmdletMapping() + { + var sb = new StringBuilder(); + sb.AppendLine($"{Indent}{Indent}$mapping = @{{"); + foreach (var variant in VariantGroup.Variants) + { + sb.AppendLine($@"{Indent}{Indent}{Indent}{variant.VariantName} = '{variant.PrivateModuleName}\{variant.PrivateCmdletName}';"); + } + sb.Append($"{Indent}{Indent}}}"); + return sb.ToString(); + } + + private string GetDefaultValuesStatements() + { + var defaultInfos = VariantGroup.ParameterGroups.Where(pg => pg.HasDefaultInfo).Select(pg => pg.DefaultInfo).ToArray(); + var sb = new StringBuilder(); + + foreach (var defaultInfo in defaultInfos) + { + var variantListString = defaultInfo.ParameterGroup.VariantNames.ToPsList(); + var parameterName = defaultInfo.ParameterGroup.ParameterName; + sb.AppendLine(); + sb.AppendLine($"{Indent}{Indent}if (({variantListString}) -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('{parameterName}')) {{"); + sb.AppendLine($"{Indent}{Indent}{Indent}$PSBoundParameters['{parameterName}'] = {defaultInfo.Script}"); + sb.Append($"{Indent}{Indent}}}"); + } + return sb.ToString(); + } + } + + internal class ProcessOutput : BaseOutput + { + public ProcessOutput(VariantGroup variantGroup) : base(variantGroup) + { + } + + private string GetFinally() + { + if (IsAzure && !VariantGroup.IsInternal) + { + return $@" +{Indent}finally {{ +{Indent}{Indent}$backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId +{Indent}{Indent}$backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets +{Indent}{Indent}[Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() +{Indent}}} +"; + } + return ""; + } + public override string ToString() => $@"process {{ +{Indent}try {{ +{Indent}{Indent}$steppablePipeline.Process($_) +{Indent}}} catch {{ +{ClearTelemetryContext()} +{Indent}{Indent}throw +{Indent}}} +{GetFinally()} +}} +"; + } + + internal class EndOutput : BaseOutput + { + public EndOutput(VariantGroup variantGroup) : base(variantGroup) + { + } + + private string GetTelemetry() + { + if (!VariantGroup.IsInternal && IsAzure) + { + return $@" +{Indent}{Indent}[Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId +{Indent}{Indent}[Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets +{Indent}{Indent}if ($preTelemetryId -eq '') {{ +{Indent}{Indent}{Indent}[Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) +{Indent}{Indent}{Indent}[Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() +{Indent}{Indent}}} +{Indent}{Indent}[Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId +"; + } + return ""; + } + public override string ToString() => $@"end {{ +{Indent}try {{ +{Indent}{Indent}$steppablePipeline.End() +{GetTelemetry()} +{Indent}}} catch {{ +{ClearTelemetryContext()} +{Indent}{Indent}throw +{Indent}}} +}} +"; + } + + internal class HelpCommentOutput + { + public VariantGroup VariantGroup { get; } + public CommentInfo CommentInfo { get; } + + public HelpCommentOutput(VariantGroup variantGroup) + { + VariantGroup = variantGroup; + CommentInfo = variantGroup.CommentInfo; + } + + public override string ToString() + { + var inputs = String.Join(Environment.NewLine, CommentInfo.Inputs.Select(i => $".Inputs{Environment.NewLine}{i}")); + var inputsText = !String.IsNullOrEmpty(inputs) ? $"{Environment.NewLine}{inputs}" : String.Empty; + var outputs = String.Join(Environment.NewLine, CommentInfo.Outputs.Select(o => $".Outputs{Environment.NewLine}{o}")); + var outputsText = !String.IsNullOrEmpty(outputs) ? $"{Environment.NewLine}{outputs}" : String.Empty; + var notes = String.Join($"{Environment.NewLine}{Environment.NewLine}", VariantGroup.ComplexInterfaceInfos.Select(cii => cii.ToNoteOutput())); + var notesText = !String.IsNullOrEmpty(notes) ? $"{Environment.NewLine}.Notes{Environment.NewLine}{ComplexParameterHeader}{notes}" : String.Empty; + var relatedLinks = String.Join(Environment.NewLine, CommentInfo.RelatedLinks.Select(l => $".Link{Environment.NewLine}{l}")); + var relatedLinksText = !String.IsNullOrEmpty(relatedLinks) ? $"{Environment.NewLine}{relatedLinks}" : String.Empty; + var examples = ""; + foreach (var example in VariantGroup.HelpInfo.Examples) + { + examples = examples + ".Example" + "\r\n" + example.Code + "\r\n"; + } + return $@"<# +.Synopsis +{CommentInfo.Synopsis.ToDescriptionFormat(false)} +.Description +{CommentInfo.Description.ToDescriptionFormat(false)} +{examples}{inputsText}{outputsText}{notesText} +.Link +{CommentInfo.OnlineVersion}{relatedLinksText} +#> +"; + } + } + + internal class ParameterDescriptionOutput + { + public string Description { get; } + + public ParameterDescriptionOutput(string description) + { + Description = description; + } + + public override string ToString() => !String.IsNullOrEmpty(Description) + ? Description.ToDescriptionFormat(false).NormalizeNewLines() + .Split(new[] { Environment.NewLine }, StringSplitOptions.None) + .Aggregate(String.Empty, (c, n) => c + $"{Indent}# {n}{Environment.NewLine}") + : String.Empty; + } + + internal class ProfileOutput + { + public string ProfileName { get; } + + public ProfileOutput(string profileName) + { + ProfileName = profileName; + } + + public override string ToString() => ProfileName != NoProfiles ? $"[{typeof(ProfileAttribute).ToPsAttributeType()}('{ProfileName}')]{Environment.NewLine}" : String.Empty; + } + + internal class DescriptionOutput + { + public string Description { get; } + + public DescriptionOutput(string description) + { + Description = description; + } + + public override string ToString() => !String.IsNullOrEmpty(Description) ? $"[{typeof(DescriptionAttribute).ToPsAttributeType()}('{Description.ToPsStringLiteral()}')]{Environment.NewLine}" : String.Empty; + } + + internal class ParameterCategoryOutput + { + public ParameterCategory Category { get; } + + public ParameterCategoryOutput(ParameterCategory category) + { + Category = category; + } + + public override string ToString() => $"{Indent}[{typeof(CategoryAttribute).ToPsAttributeType()}('{Category}')]{Environment.NewLine}"; + } + + internal class InfoOutput + { + public InfoAttribute Info { get; } + public Type ParameterType { get; } + + public InfoOutput(InfoAttribute info, Type parameterType) + { + Info = info; + ParameterType = parameterType; + } + + public override string ToString() + { + // Rendering of InfoAttribute members that are not used currently + /*var serializedNameText = Info.SerializedName != null ? $"SerializedName='{Info.SerializedName}'" : String.Empty; + var readOnlyText = Info.ReadOnly ? "ReadOnly" : String.Empty; + var descriptionText = !String.IsNullOrEmpty(Info.Description) ? $"Description='{Info.Description.ToPsStringLiteral()}'" : String.Empty;*/ + + var requiredText = Info.Required ? "Required" : String.Empty; + var unwrappedType = ParameterType.Unwrap(); + var hasValidPossibleTypes = Info.PossibleTypes.Any(pt => pt != unwrappedType); + var possibleTypesText = hasValidPossibleTypes + ? $"PossibleTypes=({Info.PossibleTypes.Select(pt => $"[{pt.ToPsType()}]").JoinIgnoreEmpty(ItemSeparator)})" + : String.Empty; + var propertyText = new[] { /*serializedNameText, */requiredText,/* readOnlyText,*/ possibleTypesText/*, descriptionText*/ }.JoinIgnoreEmpty(ItemSeparator); + return hasValidPossibleTypes ? $"{Indent}[{typeof(InfoAttribute).ToPsAttributeType()}({propertyText})]{Environment.NewLine}" : String.Empty; + } + } + + internal class PropertySyntaxOutput + { + public string ParameterName { get; } + public Type ParameterType { get; } + public bool IsMandatory { get; } + public int? Position { get; } + + public bool IncludeSpace { get; } + public bool IncludeDash { get; } + + public PropertySyntaxOutput(Parameter parameter) + { + ParameterName = parameter.ParameterName; + ParameterType = parameter.ParameterType; + IsMandatory = parameter.IsMandatory; + Position = parameter.Position; + IncludeSpace = true; + IncludeDash = true; + } + + public PropertySyntaxOutput(ComplexInterfaceInfo complexInterfaceInfo) + { + ParameterName = complexInterfaceInfo.Name; + ParameterType = complexInterfaceInfo.Type; + IsMandatory = complexInterfaceInfo.Required; + Position = null; + IncludeSpace = false; + IncludeDash = false; + } + + public override string ToString() + { + var leftOptional = !IsMandatory ? "[" : String.Empty; + var leftPositional = Position != null ? "[" : String.Empty; + var rightPositional = Position != null ? "]" : String.Empty; + var type = ParameterType != typeof(SwitchParameter) ? $" <{ParameterType.ToSyntaxTypeName()}>" : String.Empty; + var rightOptional = !IsMandatory ? "]" : String.Empty; + var space = IncludeSpace ? " " : String.Empty; + var dash = IncludeDash ? "-" : String.Empty; + return $"{space}{leftOptional}{leftPositional}{dash}{ParameterName}{rightPositional}{type}{rightOptional}"; + } + } + + internal static class PsProxyOutputExtensions + { + public const string NoParameters = "__NoParameters"; + + public const string AllParameterSets = "__AllParameterSets"; + + public const string HalfIndent = " "; + + public const string Indent = HalfIndent + HalfIndent; + + public const string ItemSeparator = ", "; + + public static readonly string ComplexParameterHeader = $"COMPLEX PARAMETER PROPERTIES{Environment.NewLine}{Environment.NewLine}To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables.{Environment.NewLine}{Environment.NewLine}"; + + public static string ToPsBool(this bool value) => $"${value.ToString().ToLowerInvariant()}"; + + public static string ToPsType(this Type type) + { + var regex = new Regex(@"^(.*)`{1}\d+(.*)$"); + var typeText = type.ToString(); + var match = regex.Match(typeText); + return match.Success ? $"{match.Groups[1]}{match.Groups[2]}" : typeText; + } + + public static string ToPsAttributeType(this Type type) => type.ToPsType().RemoveEnd("Attribute"); + + // https://stackoverflow.com/a/5284606/294804 + private static string RemoveEnd(this string text, string suffix) => text.EndsWith(suffix) ? text.Substring(0, text.Length - suffix.Length) : text; + + public static string ToPsSingleLine(this string value, string replacer = " ") => value.ReplaceNewLines(replacer, new[] { "
", "\r\n", "\n" }); + + public static string ToPsStringLiteral(this string value) => value?.Replace("'", "''").Replace("‘", "''").Replace("’", "''").ToPsSingleLine().Trim() ?? String.Empty; + + public static string JoinIgnoreEmpty(this IEnumerable values, string separator) => String.Join(separator, values?.Where(v => !String.IsNullOrEmpty(v))); + + // https://stackoverflow.com/a/41961738/294804 + public static string ToSyntaxTypeName(this Type type) + { + if (type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>)) + { + return $"{type.GetGenericArguments().First().ToSyntaxTypeName()}?"; + } + + if (type.IsGenericType) + { + var genericTypes = String.Join(ItemSeparator, type.GetGenericArguments().Select(ToSyntaxTypeName)); + return $"{type.Name.Split('`').First()}<{genericTypes}>"; + } + + return type.Name; + } + + public static OutputTypeOutput ToOutputTypeOutput(this IEnumerable outputTypes) => new OutputTypeOutput(outputTypes); + + public static CmdletBindingOutput ToCmdletBindingOutput(this VariantGroup variantGroup) => new CmdletBindingOutput(variantGroup); + + public static ParameterOutput ToParameterOutput(this Parameter parameter, bool hasMultipleVariantsInVariantGroup, bool hasAllVariantsInParameterGroup) => new ParameterOutput(parameter, hasMultipleVariantsInVariantGroup, hasAllVariantsInParameterGroup); + + public static AliasOutput ToAliasOutput(this string[] aliases, bool includeIndent = false) => new AliasOutput(aliases, includeIndent); + + public static ValidateNotNullOutput ToValidateNotNullOutput(this bool hasValidateNotNull) => new ValidateNotNullOutput(hasValidateNotNull); + + public static AllowEmptyArrayOutput ToAllowEmptyArray(this bool hasAllowEmptyArray) => new AllowEmptyArrayOutput(hasAllowEmptyArray); + + public static ArgumentCompleterOutput ToArgumentCompleterOutput(this CompleterInfo completerInfo) => new ArgumentCompleterOutput(completerInfo); + + public static DefaultInfoOutput ToDefaultInfoOutput(this ParameterGroup parameterGroup) => new DefaultInfoOutput(parameterGroup); + + public static ParameterTypeOutput ToParameterTypeOutput(this Type parameterType) => new ParameterTypeOutput(parameterType); + + public static ParameterNameOutput ToParameterNameOutput(this string parameterName, bool isLast) => new ParameterNameOutput(parameterName, isLast); + + public static BeginOutput ToBeginOutput(this VariantGroup variantGroup) => new BeginOutput(variantGroup); + + public static ProcessOutput ToProcessOutput(this VariantGroup variantGroup) => new ProcessOutput(variantGroup); + + public static EndOutput ToEndOutput(this VariantGroup variantGroup) => new EndOutput(variantGroup); + + public static HelpCommentOutput ToHelpCommentOutput(this VariantGroup variantGroup) => new HelpCommentOutput(variantGroup); + + public static ParameterDescriptionOutput ToParameterDescriptionOutput(this string description) => new ParameterDescriptionOutput(description); + + public static ProfileOutput ToProfileOutput(this string profileName) => new ProfileOutput(profileName); + + public static DescriptionOutput ToDescriptionOutput(this string description) => new DescriptionOutput(description); + + public static ParameterCategoryOutput ToParameterCategoryOutput(this ParameterCategory category) => new ParameterCategoryOutput(category); + + public static PropertySyntaxOutput ToPropertySyntaxOutput(this Parameter parameter) => new PropertySyntaxOutput(parameter); + + public static PropertySyntaxOutput ToPropertySyntaxOutput(this ComplexInterfaceInfo complexInterfaceInfo) => new PropertySyntaxOutput(complexInterfaceInfo); + + public static InfoOutput ToInfoOutput(this InfoAttribute info, Type parameterType) => new InfoOutput(info, parameterType); + + public static string ToNoteOutput(this ComplexInterfaceInfo complexInterfaceInfo, string currentIndent = "", bool includeDashes = false, bool includeBackticks = false, bool isFirst = true) + { + string RenderProperty(ComplexInterfaceInfo info, string indent, bool dash, bool backtick) => + $"{indent}{(dash ? "- " : String.Empty)}{(backtick ? "`" : String.Empty)}{info.ToPropertySyntaxOutput()}{(backtick ? "`" : String.Empty)}: {info.Description}"; + + var nested = complexInterfaceInfo.NestedInfos.Select(ni => + { + var nestedIndent = $"{currentIndent}{HalfIndent}"; + return ni.IsComplexInterface + ? ni.ToNoteOutput(nestedIndent, includeDashes, includeBackticks, false) + : RenderProperty(ni, nestedIndent, includeDashes, includeBackticks); + }).Prepend(RenderProperty(complexInterfaceInfo, currentIndent, !isFirst && includeDashes, includeBackticks)); + return String.Join(Environment.NewLine, nested); + } + } +} diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/BuildTime/Models/PsProxyTypes.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/BuildTime/Models/PsProxyTypes.cs new file mode 100644 index 000000000000..e975cce6e3cf --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/BuildTime/Models/PsProxyTypes.cs @@ -0,0 +1,514 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Management.Automation; +using System.Reflection; +using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.PsProxyOutputExtensions; +using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell.PsProxyTypeExtensions; + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell +{ + internal class ProfileGroup + { + public string ProfileName { get; } + public Variant[] Variants { get; } + public string ProfileFolder { get; } + + public ProfileGroup(Variant[] variants, string profileName = NoProfiles) + { + ProfileName = profileName; + Variants = variants; + ProfileFolder = ProfileName != NoProfiles ? ProfileName : String.Empty; + } + } + + internal class VariantGroup + { + public string ModuleName { get; } + + public string RootModuleName {get => @"";} + public string CmdletName { get; } + public string CmdletVerb { get; } + public string CmdletNoun { get; } + public string ProfileName { get; } + public Variant[] Variants { get; } + public ParameterGroup[] ParameterGroups { get; } + public ComplexInterfaceInfo[] ComplexInterfaceInfos { get; } + + public string[] Aliases { get; } + public PSTypeName[] OutputTypes { get; } + public bool SupportsShouldProcess { get; } + public bool SupportsPaging { get; } + public string DefaultParameterSetName { get; } + public bool HasMultipleVariants { get; } + public PsHelpInfo HelpInfo { get; } + public bool IsGenerated { get; } + public bool IsInternal { get; } + + public string OutputFolder { get; } + public string FileName { get; } + public string FilePath { get; } + + public CommentInfo CommentInfo { get; } + + public VariantGroup(string moduleName, string cmdletName, Variant[] variants, string outputFolder, string profileName = NoProfiles, bool isTest = false, bool isInternal = false) + { + ModuleName = moduleName; + CmdletName = cmdletName; + var cmdletNameParts = CmdletName.Split('-'); + CmdletVerb = cmdletNameParts.First(); + CmdletNoun = cmdletNameParts.Last(); + ProfileName = profileName; + Variants = variants; + ParameterGroups = Variants.ToParameterGroups().OrderBy(pg => pg.OrderCategory).ThenByDescending(pg => pg.IsMandatory).ToArray(); + var aliasDuplicates = ParameterGroups.SelectMany(pg => pg.Aliases) + //https://stackoverflow.com/a/18547390/294804 + .GroupBy(a => a).Where(g => g.Count() > 1).Select(g => g.Key).ToArray(); + if (aliasDuplicates.Any()) + { + throw new ParsingMetadataException($"The alias(es) [{String.Join(", ", aliasDuplicates)}] are defined on multiple parameters for cmdlet '{CmdletName}', which is not supported."); + } + ComplexInterfaceInfos = ParameterGroups.Where(pg => !pg.DontShow && pg.IsComplexInterface).OrderBy(pg => pg.ParameterName).Select(pg => pg.ComplexInterfaceInfo).ToArray(); + + Aliases = Variants.SelectMany(v => v.Attributes).ToAliasNames().ToArray(); + OutputTypes = Variants.SelectMany(v => v.Info.OutputType).Where(ot => ot.Type != null).GroupBy(ot => ot.Type).Select(otg => otg.First()).ToArray(); + SupportsShouldProcess = Variants.Any(v => v.SupportsShouldProcess); + SupportsPaging = Variants.Any(v => v.SupportsPaging); + DefaultParameterSetName = DetermineDefaultParameterSetName(); + HasMultipleVariants = Variants.Length > 1; + HelpInfo = Variants.Select(v => v.HelpInfo).FirstOrDefault() ?? new PsHelpInfo(); + IsGenerated = Variants.All(v => v.Attributes.OfType().Any()); + IsInternal = isInternal; + + OutputFolder = outputFolder; + FileName = $"{CmdletName}{(isTest ? ".Tests" : String.Empty)}.ps1"; + FilePath = Path.Combine(OutputFolder, FileName); + + CommentInfo = new CommentInfo(this); + } + + private string DetermineDefaultParameterSetName() + { + var defaultParameterSet = Variants + .Select(v => v.Metadata.DefaultParameterSetName) + .LastOrDefault(dpsn => dpsn.IsValidDefaultParameterSetName()); + + if (String.IsNullOrEmpty(defaultParameterSet)) + { + var variantParamCountGroups = Variants + .Select(v => ( + variant: v.VariantName, + paramCount: v.CmdletOnlyParameters.Count(p => p.IsMandatory), + isSimple: v.CmdletOnlyParameters.Where(p => p.IsMandatory).All(p => p.ParameterType.IsPsSimple()))) + .GroupBy(vpc => vpc.isSimple) + .ToArray(); + var variantParameterCounts = (variantParamCountGroups.Any(g => g.Key) ? variantParamCountGroups.Where(g => g.Key) : variantParamCountGroups).SelectMany(g => g).ToArray(); + var smallestParameterCount = variantParameterCounts.Min(vpc => vpc.paramCount); + defaultParameterSet = variantParameterCounts.First(vpc => vpc.paramCount == smallestParameterCount).variant; + } + + return defaultParameterSet; + } + } + + internal class Variant + { + public string CmdletName { get; } + public string VariantName { get; } + public CommandInfo Info { get; } + public CommandMetadata Metadata { get; } + public PsHelpInfo HelpInfo { get; } + public bool HasParameterSets { get; } + public bool IsFunction { get; } + public string PrivateModuleName { get; } + public string PrivateCmdletName { get; } + public bool SupportsShouldProcess { get; } + public bool SupportsPaging { get; } + + public Attribute[] Attributes { get; } + public Parameter[] Parameters { get; } + public Parameter[] CmdletOnlyParameters { get; } + public bool IsInternal { get; } + public bool IsDoNotExport { get; } + public string[] Profiles { get; } + + public Variant(string cmdletName, string variantName, CommandInfo info, CommandMetadata metadata, bool hasParameterSets = false, PsHelpInfo helpInfo = null) + { + CmdletName = cmdletName; + VariantName = variantName; + Info = info; + HelpInfo = helpInfo ?? new PsHelpInfo(); + Metadata = metadata; + HasParameterSets = hasParameterSets; + IsFunction = Info.CommandType == CommandTypes.Function; + PrivateModuleName = Info.Source; + PrivateCmdletName = Metadata.Name; + SupportsShouldProcess = Metadata.SupportsShouldProcess; + SupportsPaging = Metadata.SupportsPaging; + + Attributes = this.ToAttributes(); + Parameters = this.ToParameters().OrderBy(p => p.OrderCategory).ThenByDescending(p => p.IsMandatory).ToArray(); + IsInternal = Attributes.OfType().Any(); + IsDoNotExport = Attributes.OfType().Any(); + CmdletOnlyParameters = Parameters.Where(p => !p.Categories.Any(c => c == ParameterCategory.Azure || c == ParameterCategory.Runtime)).ToArray(); + Profiles = Attributes.OfType().SelectMany(pa => pa.Profiles).ToArray(); + } + } + + internal class ParameterGroup + { + public string ParameterName { get; } + public Parameter[] Parameters { get; } + + public string[] VariantNames { get; } + public string[] AllVariantNames { get; } + public bool HasAllVariants { get; } + public Type ParameterType { get; } + public string Description { get; } + + public string[] Aliases { get; } + public bool HasValidateNotNull { get; } + public bool HasAllowEmptyArray { get; } + public CompleterInfo CompleterInfo { get; } + public DefaultInfo DefaultInfo { get; } + public bool HasDefaultInfo { get; } + public ParameterCategory OrderCategory { get; } + public bool DontShow { get; } + public bool IsMandatory { get; } + public bool SupportsWildcards { get; } + public bool IsComplexInterface { get; } + public ComplexInterfaceInfo ComplexInterfaceInfo { get; } + public InfoAttribute InfoAttribute { get; } + + public int? FirstPosition { get; } + public bool ValueFromPipeline { get; } + public bool ValueFromPipelineByPropertyName { get; } + public bool IsInputType { get; } + + public ParameterGroup(string parameterName, Parameter[] parameters, string[] allVariantNames) + { + ParameterName = parameterName; + Parameters = parameters; + + VariantNames = Parameters.Select(p => p.VariantName).ToArray(); + AllVariantNames = allVariantNames; + HasAllVariants = VariantNames.Any(vn => vn == AllParameterSets) || !AllVariantNames.Except(VariantNames).Any(); + var types = Parameters.Select(p => p.ParameterType).Distinct().ToArray(); + if (types.Length > 1) + { + throw new ParsingMetadataException($"The parameter '{ParameterName}' has multiple parameter types [{String.Join(", ", types.Select(t => t.Name))}] defined, which is not supported."); + } + ParameterType = types.First(); + Description = Parameters.Select(p => p.Description).FirstOrDefault(d => !String.IsNullOrEmpty(d)).EmptyIfNull(); + + Aliases = Parameters.SelectMany(p => p.Attributes).ToAliasNames().ToArray(); + HasValidateNotNull = Parameters.SelectMany(p => p.Attributes.OfType()).Any(); + HasAllowEmptyArray = Parameters.SelectMany(p => p.Attributes.OfType()).Any(); + CompleterInfo = Parameters.Select(p => p.CompleterInfoAttribute).FirstOrDefault()?.ToCompleterInfo() + ?? Parameters.Select(p => p.ArgumentCompleterAttribute).FirstOrDefault()?.ToCompleterInfo(); + DefaultInfo = Parameters.Select(p => p.DefaultInfoAttribute).FirstOrDefault()?.ToDefaultInfo(this) + ?? Parameters.Select(p => p.DefaultValueAttribute).FirstOrDefault(dv => dv != null)?.ToDefaultInfo(this); + HasDefaultInfo = DefaultInfo != null && !String.IsNullOrEmpty(DefaultInfo.Script); + // When DefaultInfo is present, force all parameters from this group to be optional. + if (HasDefaultInfo) + { + foreach (var parameter in Parameters) + { + parameter.IsMandatory = false; + } + } + OrderCategory = Parameters.Select(p => p.OrderCategory).Distinct().DefaultIfEmpty(ParameterCategory.Body).Min(); + DontShow = Parameters.All(p => p.DontShow); + IsMandatory = HasAllVariants && Parameters.Any(p => p.IsMandatory); + SupportsWildcards = Parameters.Any(p => p.SupportsWildcards); + IsComplexInterface = Parameters.Any(p => p.IsComplexInterface); + ComplexInterfaceInfo = Parameters.Where(p => p.IsComplexInterface).Select(p => p.ComplexInterfaceInfo).FirstOrDefault(); + InfoAttribute = Parameters.Select(p => p.InfoAttribute).First(); + + FirstPosition = Parameters.Select(p => p.Position).FirstOrDefault(p => p != null); + ValueFromPipeline = Parameters.Any(p => p.ValueFromPipeline); + ValueFromPipelineByPropertyName = Parameters.Any(p => p.ValueFromPipelineByPropertyName); + IsInputType = ValueFromPipeline || ValueFromPipelineByPropertyName; + } + } + + internal class Parameter + { + public string VariantName { get; } + public string ParameterName { get; } + public ParameterMetadata Metadata { get; } + public PsParameterHelpInfo HelpInfo { get; } + public Type ParameterType { get; } + + public Attribute[] Attributes { get; } + public ParameterCategory[] Categories { get; } + public ParameterCategory OrderCategory { get; } + public PSDefaultValueAttribute DefaultValueAttribute { get; } + public DefaultInfoAttribute DefaultInfoAttribute { get; } + public ParameterAttribute ParameterAttribute { get; } + public bool SupportsWildcards { get; } + public CompleterInfoAttribute CompleterInfoAttribute { get; } + public ArgumentCompleterAttribute ArgumentCompleterAttribute { get; } + + public bool ValueFromPipeline { get; } + public bool ValueFromPipelineByPropertyName { get; } + public int? Position { get; } + public bool DontShow { get; } + public bool IsMandatory { get; set; } + + public InfoAttribute InfoAttribute { get; } + public ComplexInterfaceInfo ComplexInterfaceInfo { get; } + public bool IsComplexInterface { get; } + public string Description { get; } + + public Parameter(string variantName, string parameterName, ParameterMetadata metadata, PsParameterHelpInfo helpInfo = null) + { + VariantName = variantName; + ParameterName = parameterName; + Metadata = metadata; + HelpInfo = helpInfo ?? new PsParameterHelpInfo(); + + Attributes = Metadata.Attributes.ToArray(); + ParameterType = Attributes.OfType().FirstOrDefault()?.Type ?? Metadata.ParameterType; + Categories = Attributes.OfType().SelectMany(ca => ca.Categories).Distinct().ToArray(); + OrderCategory = Categories.DefaultIfEmpty(ParameterCategory.Body).Min(); + DefaultValueAttribute = Attributes.OfType().FirstOrDefault(); + DefaultInfoAttribute = Attributes.OfType().FirstOrDefault(); + ParameterAttribute = Attributes.OfType().FirstOrDefault(pa => pa.ParameterSetName == VariantName || pa.ParameterSetName == AllParameterSets); + if (ParameterAttribute == null) + { + throw new ParsingMetadataException($"The variant '{VariantName}' has multiple parameter sets defined, which is not supported."); + } + SupportsWildcards = Attributes.OfType().Any(); + CompleterInfoAttribute = Attributes.OfType().FirstOrDefault(); + ArgumentCompleterAttribute = Attributes.OfType().FirstOrDefault(); + + ValueFromPipeline = ParameterAttribute.ValueFromPipeline; + ValueFromPipelineByPropertyName = ParameterAttribute.ValueFromPipelineByPropertyName; + Position = ParameterAttribute.Position == Int32.MinValue ? (int?)null : ParameterAttribute.Position; + DontShow = ParameterAttribute.DontShow; + IsMandatory = ParameterAttribute.Mandatory; + + var complexParameterName = ParameterName.ToUpperInvariant(); + var complexMessage = $"{Environment.NewLine}To construct, see NOTES section for {complexParameterName} properties and create a hash table."; + var description = ParameterAttribute.HelpMessage.NullIfEmpty() ?? HelpInfo.Description.NullIfEmpty() ?? InfoAttribute?.Description.NullIfEmpty() ?? String.Empty; + // Remove the complex type message as it will be reinserted if this is a complex type + description = description.NormalizeNewLines().Replace(complexMessage, String.Empty).Replace(complexMessage.ToPsSingleLine(), String.Empty); + // Make an InfoAttribute for processing only if one isn't provided + InfoAttribute = Attributes.OfType().FirstOrDefault() ?? new InfoAttribute { PossibleTypes = new[] { ParameterType.Unwrap() }, Required = IsMandatory }; + // Set the description if the InfoAttribute does not have one since they are exported without a description + InfoAttribute.Description = String.IsNullOrEmpty(InfoAttribute.Description) ? description : InfoAttribute.Description; + ComplexInterfaceInfo = InfoAttribute.ToComplexInterfaceInfo(complexParameterName, ParameterType, true); + IsComplexInterface = ComplexInterfaceInfo.IsComplexInterface; + Description = $"{description}{(IsComplexInterface ? complexMessage : String.Empty)}"; + } + } + + internal class ComplexInterfaceInfo + { + public InfoAttribute InfoAttribute { get; } + + public string Name { get; } + public Type Type { get; } + public bool Required { get; } + public bool ReadOnly { get; } + public string Description { get; } + + public ComplexInterfaceInfo[] NestedInfos { get; } + public bool IsComplexInterface { get; } + + public ComplexInterfaceInfo(string name, Type type, InfoAttribute infoAttribute, bool? required, List seenTypes) + { + Name = name; + Type = type; + InfoAttribute = infoAttribute; + + Required = required ?? InfoAttribute.Required; + ReadOnly = InfoAttribute.ReadOnly; + Description = InfoAttribute.Description.ToPsSingleLine(); + + var unwrappedType = Type.Unwrap(); + var hasBeenSeen = seenTypes?.Contains(unwrappedType) ?? false; + (seenTypes ?? (seenTypes = new List())).Add(unwrappedType); + NestedInfos = hasBeenSeen ? new ComplexInterfaceInfo[]{} : + unwrappedType.GetInterfaces() + .Concat(InfoAttribute.PossibleTypes) + .SelectMany(pt => pt.GetProperties() + .SelectMany(pi => pi.GetCustomAttributes(true).OfType() + .Select(ia => ia.ToComplexInterfaceInfo(pi.Name, pi.PropertyType, seenTypes: seenTypes)))) + .Where(cii => !cii.ReadOnly).OrderByDescending(cii => cii.Required).ToArray(); + // https://stackoverflow.com/a/503359/294804 + var associativeArrayInnerType = Type.GetInterfaces() + .FirstOrDefault(i => i.IsGenericType && i.GetGenericTypeDefinition() == typeof(IAssociativeArray<>)) + ?.GetTypeInfo().GetGenericArguments().First(); + if (!hasBeenSeen && associativeArrayInnerType != null) + { + var anyInfo = new InfoAttribute { Description = "This indicates any property can be added to this object." }; + NestedInfos = NestedInfos.Prepend(anyInfo.ToComplexInterfaceInfo("(Any)", associativeArrayInnerType)).ToArray(); + } + IsComplexInterface = NestedInfos.Any(); + } + } + + internal class CommentInfo + { + public string Description { get; } + public string Synopsis { get; } + + public string[] Examples { get; } + public string[] Inputs { get; } + public string[] Outputs { get; } + + public string OnlineVersion { get; } + public string[] RelatedLinks { get; } + + private const string HelpLinkPrefix = @"https://learn.microsoft.com/powershell/module/"; + + public CommentInfo(VariantGroup variantGroup) + { + var helpInfo = variantGroup.HelpInfo; + Description = variantGroup.Variants.SelectMany(v => v.Attributes).OfType().FirstOrDefault()?.Description.NullIfEmpty() + ?? helpInfo.Description.EmptyIfNull(); + // If there is no Synopsis, PowerShell may put in the Syntax string as the Synopsis. This seems unintended, so we remove the Synopsis in this situation. + var synopsis = helpInfo.Synopsis.EmptyIfNull().Trim().StartsWith(variantGroup.CmdletName) ? String.Empty : helpInfo.Synopsis; + Synopsis = synopsis.NullIfEmpty() ?? Description; + + Examples = helpInfo.Examples.Select(rl => rl.Code).ToArray(); + + Inputs = (variantGroup.ParameterGroups.Where(pg => pg.IsInputType).Select(pg => pg.ParameterType.FullName).ToArray().NullIfEmpty() ?? + helpInfo.InputTypes.Where(it => it.Name.NullIfWhiteSpace() != null).Select(it => it.Name).ToArray()) + .Where(i => i != "None").Distinct().OrderBy(i => i).ToArray(); + Outputs = (variantGroup.OutputTypes.Select(ot => ot.Type.FullName).ToArray().NullIfEmpty() ?? + helpInfo.OutputTypes.Where(it => it.Name.NullIfWhiteSpace() != null).Select(ot => ot.Name).ToArray()) + .Where(o => o != "None").Distinct().OrderBy(o => o).ToArray(); + + // Use root module name in the help link + var moduleName = variantGroup.RootModuleName == "" ? variantGroup.ModuleName.ToLowerInvariant() : variantGroup.RootModuleName.ToLowerInvariant(); + OnlineVersion = helpInfo.OnlineVersion?.Uri.NullIfEmpty() ?? $@"{HelpLinkPrefix}{moduleName}/{variantGroup.CmdletName.ToLowerInvariant()}"; + RelatedLinks = helpInfo.RelatedLinks.Select(rl => rl.Text).ToArray(); + } + } + + internal class CompleterInfo + { + public string Name { get; } + public string Description { get; } + public string Script { get; } + public Type Type { get; } + public bool IsTypeCompleter { get; } + + public CompleterInfo(CompleterInfoAttribute infoAttribute) + { + Name = infoAttribute.Name; + Description = infoAttribute.Description; + Script = infoAttribute.Script; + } + + public CompleterInfo(ArgumentCompleterAttribute completerAttribute) + { + Script = completerAttribute.ScriptBlock?.ToString(); + if (completerAttribute.Type != null) + { + Type = completerAttribute.Type; + IsTypeCompleter = true; + } + } + } + + internal class DefaultInfo + { + public string Name { get; } + public string Description { get; } + public string Script { get; } + public ParameterGroup ParameterGroup { get; } + + public DefaultInfo(DefaultInfoAttribute infoAttribute, ParameterGroup parameterGroup) + { + Name = infoAttribute.Name; + Description = infoAttribute.Description; + Script = infoAttribute.Script; + ParameterGroup = parameterGroup; + } + + public DefaultInfo(PSDefaultValueAttribute defaultValueAttribute, ParameterGroup parameterGroup) + { + Description = defaultValueAttribute.Help; + ParameterGroup = parameterGroup; + if (defaultValueAttribute.Value != null) + { + Script = defaultValueAttribute.Value.ToString(); + } + } + } + + internal static class PsProxyTypeExtensions + { + public const string NoProfiles = "__NoProfiles"; + + public static bool IsValidDefaultParameterSetName(this string parameterSetName) => + !String.IsNullOrEmpty(parameterSetName) && parameterSetName != AllParameterSets; + + public static Variant[] ToVariants(this CommandInfo info, PsHelpInfo helpInfo) + { + var metadata = new CommandMetadata(info); + var privateCmdletName = metadata.Name.Split('!').First(); + var parts = privateCmdletName.Split('_'); + return parts.Length > 1 + ? new[] { new Variant(parts[0], parts[1], info, metadata, helpInfo: helpInfo) } + // Process multiple parameter sets, so we declare a variant per parameter set. + : info.ParameterSets.Select(ps => new Variant(privateCmdletName, ps.Name, info, metadata, true, helpInfo)).ToArray(); + } + + public static Variant[] ToVariants(this CmdletAndHelpInfo info) => info.CommandInfo.ToVariants(info.HelpInfo); + + public static Variant[] ToVariants(this CommandInfo info, PSObject helpInfo = null) => info.ToVariants(helpInfo?.ToPsHelpInfo()); + + public static Parameter[] ToParameters(this Variant variant) + { + var parameters = variant.Metadata.Parameters.AsEnumerable(); + var parameterHelp = variant.HelpInfo.Parameters.AsEnumerable(); + + if (variant.HasParameterSets) + { + parameters = parameters.Where(p => p.Value.ParameterSets.Keys.Any(k => k == variant.VariantName || k == AllParameterSets)); + parameterHelp = parameterHelp.Where(ph => (!ph.ParameterSetNames.Any() || ph.ParameterSetNames.Any(psn => psn == variant.VariantName || psn == AllParameterSets)) && ph.Name != "IncludeTotalCount"); + } + var result = parameters.Select(p => new Parameter(variant.VariantName, p.Key, p.Value, parameterHelp.FirstOrDefault(ph => ph.Name == p.Key))); + if (variant.SupportsPaging) { + // If supportsPaging is set, we will need to add First and Skip parameters since they are treated as common parameters which as not contained on Metadata>parameters + variant.Info.Parameters["First"].Attributes.OfType().FirstOrDefault(pa => pa.ParameterSetName == variant.VariantName || pa.ParameterSetName == AllParameterSets).HelpMessage = "Gets only the first 'n' objects."; + variant.Info.Parameters["Skip"].Attributes.OfType().FirstOrDefault(pa => pa.ParameterSetName == variant.VariantName || pa.ParameterSetName == AllParameterSets).HelpMessage = "Ignores the first 'n' objects and then gets the remaining objects."; + result = result.Append(new Parameter(variant.VariantName, "First", variant.Info.Parameters["First"], parameterHelp.FirstOrDefault(ph => ph.Name == "First"))); + result = result.Append(new Parameter(variant.VariantName, "Skip", variant.Info.Parameters["Skip"], parameterHelp.FirstOrDefault(ph => ph.Name == "Skip"))); + } + return result.ToArray(); + } + + public static Attribute[] ToAttributes(this Variant variant) => variant.IsFunction + ? ((FunctionInfo)variant.Info).ScriptBlock.Attributes.ToArray() + : variant.Metadata.CommandType.GetCustomAttributes(false).Cast().ToArray(); + + public static IEnumerable ToParameterGroups(this Variant[] variants) + { + var allVariantNames = variants.Select(vg => vg.VariantName).ToArray(); + return variants + .SelectMany(v => v.Parameters) + .GroupBy(p => p.ParameterName, StringComparer.InvariantCultureIgnoreCase) + .Select(pg => new ParameterGroup(pg.Key, pg.Select(p => p).ToArray(), allVariantNames)); + } + + public static ComplexInterfaceInfo ToComplexInterfaceInfo(this InfoAttribute infoAttribute, string name, Type type, bool? required = null, List seenTypes = null) + => new ComplexInterfaceInfo(name, type, infoAttribute, required, seenTypes); + + public static CompleterInfo ToCompleterInfo(this CompleterInfoAttribute infoAttribute) => new CompleterInfo(infoAttribute); + public static CompleterInfo ToCompleterInfo(this ArgumentCompleterAttribute completerAttribute) => new CompleterInfo(completerAttribute); + + public static DefaultInfo ToDefaultInfo(this DefaultInfoAttribute infoAttribute, ParameterGroup parameterGroup) => new DefaultInfo(infoAttribute, parameterGroup); + public static DefaultInfo ToDefaultInfo(this PSDefaultValueAttribute defaultValueAttribute, ParameterGroup parameterGroup) => new DefaultInfo(defaultValueAttribute, parameterGroup); + } +} diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/BuildTime/PsAttributes.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/BuildTime/PsAttributes.cs new file mode 100644 index 000000000000..476ed230b812 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/BuildTime/PsAttributes.cs @@ -0,0 +1,114 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery +{ + [AttributeUsage(AttributeTargets.Class)] + public class DescriptionAttribute : Attribute + { + public string Description { get; } + + public DescriptionAttribute(string description) + { + Description = description; + } + } + + [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property)] + public class DoNotExportAttribute : Attribute + { + } + + [AttributeUsage(AttributeTargets.Class)] + public class InternalExportAttribute : Attribute + { + } + + [AttributeUsage(AttributeTargets.Class)] + public class GeneratedAttribute : Attribute + { + } + + [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property)] + public class DoNotFormatAttribute : Attribute + { + } + + [AttributeUsage(AttributeTargets.Class)] + public class ProfileAttribute : Attribute + { + public string[] Profiles { get; } + + public ProfileAttribute(params string[] profiles) + { + Profiles = profiles; + } + } + + [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)] + public class CategoryAttribute : Attribute + { + public ParameterCategory[] Categories { get; } + + public CategoryAttribute(params ParameterCategory[] categories) + { + Categories = categories; + } + } + + [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)] + public class ExportAsAttribute : Attribute + { + public Type Type { get; set; } + + public ExportAsAttribute(Type type) + { + Type = type; + } + } + + public enum ParameterCategory + { + // Note: Order is significant + Uri = 0, + Path, + Query, + Header, + Cookie, + Body, + Azure, + Runtime + } + + [AttributeUsage(AttributeTargets.Property)] + public class OriginAttribute : Attribute + { + public PropertyOrigin Origin { get; } + + public OriginAttribute(PropertyOrigin origin) + { + Origin = origin; + } + } + + public enum PropertyOrigin + { + // Note: Order is significant + Inherited = 0, + Owned, + Inlined + } + + [AttributeUsage(AttributeTargets.Property)] + public class FormatTableAttribute : Attribute + { + public int Index { get; set; } = -1; + public bool HasIndex => Index != -1; + public string Label { get; set; } + public int Width { get; set; } = -1; + public bool HasWidth => Width != -1; + } +} diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/BuildTime/PsExtensions.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/BuildTime/PsExtensions.cs new file mode 100644 index 000000000000..567e5c967a60 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/BuildTime/PsExtensions.cs @@ -0,0 +1,169 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Management.Automation; +using System.Reflection; + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell +{ + internal static class PsExtensions + { + // https://stackoverflow.com/a/863944/294804 + // https://stackoverflow.com/a/4452598/294804 + // https://stackoverflow.com/a/28701974/294804 + // Note: This will unwrap nested collections, but we don't generate nested collections. + public static Type Unwrap(this Type type) + { + if (type.IsArray) + { + return type.GetElementType().Unwrap(); + } + + var typeInfo = type.GetTypeInfo(); + if (typeInfo.IsGenericType + && (typeInfo.GetGenericTypeDefinition() == typeof(Nullable<>) || typeof(IEnumerable<>).IsAssignableFrom(type))) + { + return typeInfo.GetGenericArguments().First().Unwrap(); + } + + return type; + } + + // https://stackoverflow.com/a/863944/294804 + private static bool IsSimple(this Type type) + { + var typeInfo = type.GetTypeInfo(); + return typeInfo.IsPrimitive + || typeInfo.IsEnum + || type == typeof(string) + || type == typeof(decimal); + } + + // https://stackoverflow.com/a/32025393/294804 + private static bool HasImplicitConversion(this Type baseType, Type targetType) => + baseType.GetMethods(BindingFlags.Public | BindingFlags.Static) + .Where(mi => mi.Name == "op_Implicit" && mi.ReturnType == targetType) + .Any(mi => mi.GetParameters().FirstOrDefault()?.ParameterType == baseType); + + public static bool IsPsSimple(this Type type) + { + var unwrappedType = type.Unwrap(); + return unwrappedType.IsSimple() + || unwrappedType == typeof(SwitchParameter) + || unwrappedType == typeof(Hashtable) + || unwrappedType == typeof(PSCredential) + || unwrappedType == typeof(ScriptBlock) + || unwrappedType == typeof(DateTime) + || unwrappedType == typeof(Uri) + || unwrappedType.HasImplicitConversion(typeof(string)); + } + + public static string ToPsList(this IEnumerable items) => String.Join(", ", items.Select(i => $"'{i}'")); + + public static IEnumerable ToAliasNames(this IEnumerable attributes) => attributes.OfType().SelectMany(aa => aa.AliasNames).Distinct(); + + public static bool IsArrayAndElementTypeIsT(this object item) + { + var itemType = item.GetType(); + var tType = typeof(T); + return itemType.IsArray && !tType.IsArray && tType.IsAssignableFrom(itemType.GetElementType()); + } + + public static bool IsTArrayAndElementTypeIsItem(this object item) + { + var itemType = item.GetType(); + var tType = typeof(T); + return !itemType.IsArray && tType.IsArray && (tType.GetElementType()?.IsAssignableFrom(itemType) ?? false); + } + + public static bool IsTypeOrArrayOfType(this object item) => item is T || item.IsArrayAndElementTypeIsT() || item.IsTArrayAndElementTypeIsItem(); + + public static T NormalizeArrayType(this object item) + { + if (item is T result) + { + return result; + } + + if (item.IsArrayAndElementTypeIsT()) + { + var array = (T[])Convert.ChangeType(item, typeof(T[])); + return array.FirstOrDefault(); + } + + if (item.IsTArrayAndElementTypeIsItem()) + { + var tType = typeof(T); + var array = Array.CreateInstance(tType.GetElementType(), 1); + array.SetValue(item, 0); + return (T)Convert.ChangeType(array, tType); + } + + return default(T); + } + + public static T GetNestedProperty(this PSObject psObject, params string[] names) => psObject.Properties.GetNestedProperty(names); + + public static T GetNestedProperty(this PSMemberInfoCollection properties, params string[] names) + { + var lastName = names.Last(); + var nestedProperties = names.Take(names.Length - 1).Aggregate(properties, (p, n) => p?.GetProperty(n)?.Properties); + return nestedProperties != null ? nestedProperties.GetProperty(lastName) : default(T); + } + + public static T GetProperty(this PSObject psObject, string name) => psObject.Properties.GetProperty(name); + + public static T GetProperty(this PSMemberInfoCollection properties, string name) + { + switch (properties[name]?.Value) + { + case PSObject psObject when psObject.BaseObject is PSCustomObject && psObject.ImmediateBaseObject.IsTypeOrArrayOfType(): + return psObject.ImmediateBaseObject.NormalizeArrayType(); + case PSObject psObject when psObject.BaseObject.IsTypeOrArrayOfType(): + return psObject.BaseObject.NormalizeArrayType(); + case object value when value.IsTypeOrArrayOfType(): + return value.NormalizeArrayType(); + default: + return default(T); + } + } + + public static IEnumerable RunScript(this PSCmdlet cmdlet, string script) + => PsHelpers.RunScript(cmdlet.InvokeCommand, script); + + public static void RunScript(this PSCmdlet cmdlet, string script) + => cmdlet.RunScript(script); + + public static IEnumerable RunScript(this EngineIntrinsics engineIntrinsics, string script) + => PsHelpers.RunScript(engineIntrinsics.InvokeCommand, script); + + public static void RunScript(this EngineIntrinsics engineIntrinsics, string script) + => engineIntrinsics.RunScript(script); + + public static IEnumerable RunScript(this PSCmdlet cmdlet, ScriptBlock block) + => PsHelpers.RunScript(cmdlet.InvokeCommand, block.ToString()); + + public static void RunScript(this PSCmdlet cmdlet, ScriptBlock block) + => cmdlet.RunScript(block.ToString()); + + public static IEnumerable RunScript(this EngineIntrinsics engineIntrinsics, ScriptBlock block) + => PsHelpers.RunScript(engineIntrinsics.InvokeCommand, block.ToString()); + + public static void RunScript(this EngineIntrinsics engineIntrinsics, ScriptBlock block) + => engineIntrinsics.RunScript(block.ToString()); + + /// + /// Returns if a parameter should be hidden by checking for . + /// + /// A PowerShell parameter. + public static bool IsHidden(this Parameter parameter) + { + return parameter.Attributes.Any(attr => attr is DoNotExportAttribute); + } + } +} diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/BuildTime/PsHelpers.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/BuildTime/PsHelpers.cs new file mode 100644 index 000000000000..e4a07b89f28d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/BuildTime/PsHelpers.cs @@ -0,0 +1,105 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Management.Automation; +using Pwsh = System.Management.Automation.PowerShell; + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell +{ + internal static class PsHelpers + { + public static IEnumerable RunScript(string script) + => Pwsh.Create().AddScript(script).Invoke(); + + public static void RunScript(string script) + => RunScript(script); + + public static IEnumerable RunScript(CommandInvocationIntrinsics cii, string script) + => cii.InvokeScript(script).Select(o => o?.BaseObject).Where(o => o != null).OfType(); + + public static void RunScript(CommandInvocationIntrinsics cii, string script) + => RunScript(cii, script); + + public static IEnumerable GetModuleCmdlets(PSCmdlet cmdlet, params string[] modulePaths) + { + var getCmdletsCommand = String.Join(" + ", modulePaths.Select(mp => $"(Get-Command -Module (Import-Module '{mp}' -PassThru))")); + return (cmdlet?.RunScript(getCmdletsCommand) ?? RunScript(getCmdletsCommand)) + .Where(ci => ci.CommandType != CommandTypes.Alias); + } + + public static IEnumerable GetModuleCmdlets(params string[] modulePaths) + => GetModuleCmdlets(null, modulePaths); + + public static IEnumerable GetScriptCmdlets(PSCmdlet cmdlet, string scriptFolder) + { + // https://stackoverflow.com/a/40969712/294804 + var wrappedFolder = scriptFolder.Contains("'") ? $@"""{scriptFolder}""" : $@"'{scriptFolder}'"; + var getCmdletsCommand = $@" +$currentFunctions = Get-ChildItem function: +Get-ChildItem -Path {wrappedFolder} -Recurse -Include '*.ps1' -File | ForEach-Object {{ . $_.FullName }} +Get-ChildItem function: | Where-Object {{ ($currentFunctions -notcontains $_) -and $_.CmdletBinding }} +"; + return cmdlet?.RunScript(getCmdletsCommand) ?? RunScript(getCmdletsCommand); + } + + public static IEnumerable GetScriptCmdlets(string scriptFolder) + => GetScriptCmdlets(null, scriptFolder); + + public static IEnumerable GetScriptHelpInfo(PSCmdlet cmdlet, params string[] modulePaths) + { + var importModules = String.Join(Environment.NewLine, modulePaths.Select(mp => $"Import-Module '{mp}'")); + var getHelpCommand = $@" +$currentFunctions = Get-ChildItem function: +{importModules} +Get-ChildItem function: | Where-Object {{ ($currentFunctions -notcontains $_) -and $_.CmdletBinding }} | ForEach-Object {{ Get-Help -Name $_.Name -Full }} +"; + return cmdlet?.RunScript(getHelpCommand) ?? RunScript(getHelpCommand); + } + + public static IEnumerable GetScriptHelpInfo(params string[] modulePaths) + => GetScriptHelpInfo(null, modulePaths); + + public static IEnumerable GetModuleCmdletsAndHelpInfo(PSCmdlet cmdlet, params string[] modulePaths) + { + var getCmdletAndHelp = String.Join(" + ", modulePaths.Select(mp => + $@"(Get-Command -Module (Import-Module '{mp}' -PassThru) | Where-Object {{ $_.CommandType -ne 'Alias' }} | ForEach-Object {{ @{{ CommandInfo = $_; HelpInfo = ( invoke-command {{ try {{ Get-Help -Name $_.Name -Full }} catch{{ '' }} }} ) }} }})" + )); + return (cmdlet?.RunScript(getCmdletAndHelp) ?? RunScript(getCmdletAndHelp)) + .Select(h => new CmdletAndHelpInfo { CommandInfo = (h["CommandInfo"] as PSObject)?.BaseObject as CommandInfo, HelpInfo = h["HelpInfo"] as PSObject }); + } + + public static IEnumerable GetModuleCmdletsAndHelpInfo(params string[] modulePaths) + => GetModuleCmdletsAndHelpInfo(null, modulePaths); + + public static CmdletAndHelpInfo ToCmdletAndHelpInfo(this CommandInfo commandInfo, PSObject helpInfo) => new CmdletAndHelpInfo { CommandInfo = commandInfo, HelpInfo = helpInfo }; + + public const string Psd1Indent = " "; + public const string GuidStart = Psd1Indent + "GUID"; + + public static Guid ReadGuidFromPsd1(string psd1Path) + { + var guid = Guid.NewGuid(); + if (File.Exists(psd1Path)) + { + var currentGuid = File.ReadAllLines(psd1Path) + .FirstOrDefault(l => l.StartsWith(GuidStart))?.Split(new[] { " = " }, StringSplitOptions.RemoveEmptyEntries) + .LastOrDefault()?.Replace("'", String.Empty); + guid = currentGuid != null ? Guid.Parse(currentGuid) : guid; + } + + return guid; + } + } + + internal class CmdletAndHelpInfo + { + public CommandInfo CommandInfo { get; set; } + public PSObject HelpInfo { get; set; } + } +} diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/BuildTime/StringExtensions.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/BuildTime/StringExtensions.cs new file mode 100644 index 000000000000..c4ba069b9a65 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/BuildTime/StringExtensions.cs @@ -0,0 +1,24 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Linq; + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell +{ + internal static class StringExtensions + { + public static string NullIfEmpty(this string text) => String.IsNullOrEmpty(text) ? null : text; + public static string NullIfWhiteSpace(this string text) => String.IsNullOrWhiteSpace(text) ? null : text; + public static string EmptyIfNull(this string text) => text ?? String.Empty; + + public static bool? ToNullableBool(this string text) => String.IsNullOrEmpty(text) ? (bool?)null : Convert.ToBoolean(text.ToLowerInvariant()); + + public static string ToUpperFirstCharacter(this string text) => String.IsNullOrEmpty(text) ? text : $"{text[0].ToString().ToUpperInvariant()}{text.Remove(0, 1)}"; + + public static string ReplaceNewLines(this string value, string replacer = " ", string[] newLineSymbols = null) + => (newLineSymbols ?? new []{ "\r\n", "\n" }).Aggregate(value.EmptyIfNull(), (current, symbol) => current.Replace(symbol, replacer)); + public static string NormalizeNewLines(this string value) => value.ReplaceNewLines("\u00A0").Replace("\u00A0", Environment.NewLine); + } +} diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/BuildTime/XmlExtensions.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/BuildTime/XmlExtensions.cs new file mode 100644 index 000000000000..502bceffaa02 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/BuildTime/XmlExtensions.cs @@ -0,0 +1,28 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System.IO; +using System.Xml; +using System.Xml.Serialization; + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell +{ + internal static class XmlExtensions + { + public static string ToXmlString(this T inputObject, bool excludeDeclaration = false) + { + var serializer = new XmlSerializer(typeof(T)); + //https://stackoverflow.com/a/760290/294804 + //https://stackoverflow.com/a/3732234/294804 + var namespaces = new XmlSerializerNamespaces(new[] { XmlQualifiedName.Empty }); + var xmlSettings = new XmlWriterSettings { OmitXmlDeclaration = excludeDeclaration, Indent = true }; + using (var stringWriter = new StringWriter()) + using (var xmlWriter = XmlWriter.Create(stringWriter, xmlSettings)) + { + serializer.Serialize(xmlWriter, inputObject, namespaces); + return stringWriter.ToString(); + } + } + } +} diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/CmdInfoHandler.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/CmdInfoHandler.cs new file mode 100644 index 000000000000..86c1e45cdc0e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/CmdInfoHandler.cs @@ -0,0 +1,40 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Management.Automation; +using System.Net.Http; +using System.Threading; +using System.Threading.Tasks; + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime +{ + using NextDelegate = Func, Task>, Task>; + using SignalDelegate = Func, Task>; + + public class CmdInfoHandler + { + private readonly string processRecordId; + private readonly string parameterSetName; + private readonly InvocationInfo invocationInfo; + + public CmdInfoHandler(string processRecordId, InvocationInfo invocationInfo, string parameterSetName) + { + this.processRecordId = processRecordId; + this.parameterSetName = parameterSetName; + this.invocationInfo = invocationInfo; + } + + public Task SendAsync(HttpRequestMessage request, CancellationToken token, Action cancel, SignalDelegate signal, NextDelegate next) + { + request.Headers.Add("x-ms-client-request-id", processRecordId); + request.Headers.Add("CommandName", invocationInfo?.InvocationName); + request.Headers.Add("FullCommandName", invocationInfo?.MyCommand?.Name); + request.Headers.Add("ParameterSetName", parameterSetName); + + // continue with pipeline. + return next(request, token, cancel, signal); + } + } +} diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/Conversions/ConversionException.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/Conversions/ConversionException.cs new file mode 100644 index 000000000000..d9a80b2b8dde --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/Conversions/ConversionException.cs @@ -0,0 +1,17 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json +{ + internal class ConversionException : Exception + { + internal ConversionException(string message) + : base(message) { } + + internal ConversionException(JsonNode node, Type targetType) + : base($"Cannot convert '{node.Type}' to a {targetType.Name}") { } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/Conversions/IJsonConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/Conversions/IJsonConverter.cs new file mode 100644 index 000000000000..54eda916b535 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/Conversions/IJsonConverter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json +{ + internal interface IJsonConverter + { + JsonNode ToJson(object value); + + object FromJson(JsonNode node); + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/Conversions/Instances/BinaryConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/Conversions/Instances/BinaryConverter.cs new file mode 100644 index 000000000000..45c740b74295 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/Conversions/Instances/BinaryConverter.cs @@ -0,0 +1,24 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json +{ + public sealed class BinaryConverter : JsonConverter + { + internal override JsonNode ToJson(byte[] value) => new XBinary(value); + + internal override byte[] FromJson(JsonNode node) + { + switch (node.Type) + { + case JsonType.String : return Convert.FromBase64String(node.ToString()); // Base64 Encoded + case JsonType.Binary : return ((XBinary)node).Value; + } + + throw new ConversionException(node, typeof(byte[])); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/Conversions/Instances/BooleanConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/Conversions/Instances/BooleanConverter.cs new file mode 100644 index 000000000000..b669983ac214 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/Conversions/Instances/BooleanConverter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json +{ + public sealed class BooleanConverter : JsonConverter + { + internal override JsonNode ToJson(bool value) => new JsonBoolean(value); + + internal override bool FromJson(JsonNode node) => (bool)node; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/Conversions/Instances/DateTimeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/Conversions/Instances/DateTimeConverter.cs new file mode 100644 index 000000000000..76bbe182aeb8 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/Conversions/Instances/DateTimeConverter.cs @@ -0,0 +1,18 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json +{ + public sealed class DateTimeConverter : JsonConverter + { + internal override JsonNode ToJson(DateTime value) + { + return new JsonDate(value); + } + + internal override DateTime FromJson(JsonNode node) => (DateTime)node; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/Conversions/Instances/DateTimeOffsetConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/Conversions/Instances/DateTimeOffsetConverter.cs new file mode 100644 index 000000000000..c36f04a442b0 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/Conversions/Instances/DateTimeOffsetConverter.cs @@ -0,0 +1,15 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json +{ + public sealed class DateTimeOffsetConverter : JsonConverter + { + internal override JsonNode ToJson(DateTimeOffset value) => new JsonDate(value); + + internal override DateTimeOffset FromJson(JsonNode node) => (DateTimeOffset)node; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/Conversions/Instances/DecimalConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/Conversions/Instances/DecimalConverter.cs new file mode 100644 index 000000000000..80a3ee3a648b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/Conversions/Instances/DecimalConverter.cs @@ -0,0 +1,16 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json +{ + public sealed class DecimalConverter : JsonConverter + { + internal override JsonNode ToJson(decimal value) => new JsonNumber(value.ToString()); + + internal override decimal FromJson(JsonNode node) + { + return (decimal)node; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/Conversions/Instances/DoubleConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/Conversions/Instances/DoubleConverter.cs new file mode 100644 index 000000000000..ee7640c09cc4 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/Conversions/Instances/DoubleConverter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json +{ + public sealed class DoubleConverter : JsonConverter + { + internal override JsonNode ToJson(double value) => new JsonNumber(value); + + internal override double FromJson(JsonNode node) => (double)node; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/Conversions/Instances/EnumConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/Conversions/Instances/EnumConverter.cs new file mode 100644 index 000000000000..7ab89b3737d2 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/Conversions/Instances/EnumConverter.cs @@ -0,0 +1,30 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json +{ + public sealed class EnumConverter : IJsonConverter + { + private readonly Type type; + + internal EnumConverter(Type type) + { + this.type = type ?? throw new ArgumentNullException(nameof(type)); + } + + public JsonNode ToJson(object value) => new JsonString(value.ToString()); + + public object FromJson(JsonNode node) + { + if (node.Type == JsonType.Number) + { + return Enum.ToObject(type, (int)node); + } + + return Enum.Parse(type, node.ToString(), ignoreCase: true); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/Conversions/Instances/GuidConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/Conversions/Instances/GuidConverter.cs new file mode 100644 index 000000000000..4be407e1a742 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/Conversions/Instances/GuidConverter.cs @@ -0,0 +1,15 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json +{ + public sealed class GuidConverter : JsonConverter + { + internal override JsonNode ToJson(Guid value) => new JsonString(value.ToString()); + + internal override Guid FromJson(JsonNode node) => (Guid)node; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/Conversions/Instances/HashSet'1Converter.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/Conversions/Instances/HashSet'1Converter.cs new file mode 100644 index 000000000000..aa6c4ab41ee4 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/Conversions/Instances/HashSet'1Converter.cs @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System.Collections.Generic; +using System.Linq; + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json +{ + public sealed class HashSetConverter : JsonConverter> + { + internal override JsonNode ToJson(HashSet value) + { + return new XSet(value); + } + + internal override HashSet FromJson(JsonNode node) + { + var collection = node as ICollection; + + if (collection.Count == 0) return null; + + // TODO: Remove Linq depedency + return new HashSet(collection.Cast()); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/Conversions/Instances/Int16Converter.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/Conversions/Instances/Int16Converter.cs new file mode 100644 index 000000000000..689b0b47ccb9 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/Conversions/Instances/Int16Converter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json +{ + public sealed class Int16Converter : JsonConverter + { + internal override JsonNode ToJson(short value) => new JsonNumber(value); + + internal override short FromJson(JsonNode node) => (short)node; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/Conversions/Instances/Int32Converter.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/Conversions/Instances/Int32Converter.cs new file mode 100644 index 000000000000..b9036b5f911a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/Conversions/Instances/Int32Converter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json +{ + public sealed class Int32Converter : JsonConverter + { + internal override JsonNode ToJson(int value) => new JsonNumber(value); + + internal override int FromJson(JsonNode node) => (int)node; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/Conversions/Instances/Int64Converter.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/Conversions/Instances/Int64Converter.cs new file mode 100644 index 000000000000..5e69d0e1e079 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/Conversions/Instances/Int64Converter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json +{ + public sealed class Int64Converter : JsonConverter + { + internal override JsonNode ToJson(long value) => new JsonNumber(value); + + internal override long FromJson(JsonNode node) => (long)node; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/Conversions/Instances/JsonArrayConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/Conversions/Instances/JsonArrayConverter.cs new file mode 100644 index 000000000000..fc71e3fc8a55 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/Conversions/Instances/JsonArrayConverter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json +{ + public sealed class JsonArrayConverter : JsonConverter + { + internal override JsonNode ToJson(JsonArray value) => value; + + internal override JsonArray FromJson(JsonNode node) => (JsonArray)node; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/Conversions/Instances/JsonObjectConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/Conversions/Instances/JsonObjectConverter.cs new file mode 100644 index 000000000000..ef3910168dde --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/Conversions/Instances/JsonObjectConverter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json +{ + public sealed class JsonObjectConverter : JsonConverter + { + internal override JsonNode ToJson(JsonObject value) => value; + + internal override JsonObject FromJson(JsonNode node) => (JsonObject)node; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/Conversions/Instances/SingleConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/Conversions/Instances/SingleConverter.cs new file mode 100644 index 000000000000..c9e076f4aa42 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/Conversions/Instances/SingleConverter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json +{ + public sealed class SingleConverter : JsonConverter + { + internal override JsonNode ToJson(float value) => new JsonNumber(value.ToString()); + + internal override float FromJson(JsonNode node) => (float)node; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/Conversions/Instances/StringConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/Conversions/Instances/StringConverter.cs new file mode 100644 index 000000000000..ba9e289d3275 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/Conversions/Instances/StringConverter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json +{ + public sealed class StringConverter : JsonConverter + { + internal override JsonNode ToJson(string value) => new JsonString(value); + + internal override string FromJson(JsonNode node) => node.ToString(); + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/Conversions/Instances/TimeSpanConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/Conversions/Instances/TimeSpanConverter.cs new file mode 100644 index 000000000000..ee10ba5739d4 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/Conversions/Instances/TimeSpanConverter.cs @@ -0,0 +1,15 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json +{ + public sealed class TimeSpanConverter : JsonConverter + { + internal override JsonNode ToJson(TimeSpan value) => new JsonString(value.ToString()); + + internal override TimeSpan FromJson(JsonNode node) => (TimeSpan)node; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/Conversions/Instances/UInt16Converter.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/Conversions/Instances/UInt16Converter.cs new file mode 100644 index 000000000000..856d8ddb7cdd --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/Conversions/Instances/UInt16Converter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json +{ + public sealed class UInt16Converter : JsonConverter + { + internal override JsonNode ToJson(ushort value) => new JsonNumber(value); + + internal override ushort FromJson(JsonNode node) => (ushort)node; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/Conversions/Instances/UInt32Converter.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/Conversions/Instances/UInt32Converter.cs new file mode 100644 index 000000000000..451f3f2d5565 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/Conversions/Instances/UInt32Converter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json +{ + public sealed class UInt32Converter : JsonConverter + { + internal override JsonNode ToJson(uint value) => new JsonNumber(value); + + internal override uint FromJson(JsonNode node) => (uint)node; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/Conversions/Instances/UInt64Converter.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/Conversions/Instances/UInt64Converter.cs new file mode 100644 index 000000000000..60e47b321b01 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/Conversions/Instances/UInt64Converter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json +{ + public sealed class UInt64Converter : JsonConverter + { + internal override JsonNode ToJson(ulong value) => new JsonNumber(value.ToString()); + + internal override ulong FromJson(JsonNode node) => (ulong)node; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/Conversions/Instances/UriConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/Conversions/Instances/UriConverter.cs new file mode 100644 index 000000000000..cda4aeb13f28 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/Conversions/Instances/UriConverter.cs @@ -0,0 +1,15 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json +{ + public sealed class UriConverter : JsonConverter + { + internal override JsonNode ToJson(Uri value) => new JsonString(value.AbsoluteUri); + + internal override Uri FromJson(JsonNode node) => (Uri)node; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/Conversions/JsonConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/Conversions/JsonConverter.cs new file mode 100644 index 000000000000..0b8a80025033 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/Conversions/JsonConverter.cs @@ -0,0 +1,21 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json +{ + public abstract class JsonConverter : IJsonConverter + { + internal abstract T FromJson(JsonNode node); + + internal abstract JsonNode ToJson(T value); + + #region IConverter + + object IJsonConverter.FromJson(JsonNode node) => FromJson(node); + + JsonNode IJsonConverter.ToJson(object value) => ToJson((T)value); + + #endregion + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/Conversions/JsonConverterAttribute.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/Conversions/JsonConverterAttribute.cs new file mode 100644 index 000000000000..0d34310e1fd1 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/Conversions/JsonConverterAttribute.cs @@ -0,0 +1,18 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json +{ + public sealed class JsonConverterAttribute : Attribute + { + internal JsonConverterAttribute(Type type) + { + Converter = (IJsonConverter)Activator.CreateInstance(type); + } + + internal IJsonConverter Converter { get; } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/Conversions/JsonConverterFactory.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/Conversions/JsonConverterFactory.cs new file mode 100644 index 000000000000..069ca6eb4477 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/Conversions/JsonConverterFactory.cs @@ -0,0 +1,91 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json +{ + public sealed class JsonConverterFactory + { + private static readonly Dictionary converters = new Dictionary(); + + static JsonConverterFactory() + { + AddInternal(new BooleanConverter()); + AddInternal(new DateTimeConverter()); + AddInternal(new DateTimeOffsetConverter()); + AddInternal(new BinaryConverter()); + AddInternal(new DecimalConverter()); + AddInternal(new DoubleConverter()); + AddInternal(new GuidConverter()); + AddInternal(new Int16Converter()); + AddInternal(new Int32Converter()); + AddInternal(new Int64Converter()); + AddInternal(new SingleConverter()); + AddInternal(new StringConverter()); + AddInternal(new TimeSpanConverter()); + AddInternal(new UInt16Converter()); + AddInternal(new UInt32Converter()); + AddInternal(new UInt64Converter()); + AddInternal(new UriConverter()); + + // Hash sets + AddInternal(new HashSetConverter()); + AddInternal(new HashSetConverter()); + AddInternal(new HashSetConverter()); + AddInternal(new HashSetConverter()); + AddInternal(new HashSetConverter()); + AddInternal(new HashSetConverter()); + + // JSON + + AddInternal(new JsonObjectConverter()); + AddInternal(new JsonArrayConverter()); + } + + internal static Dictionary Instances => converters; + + internal static IJsonConverter Get(Type type) + { + var details = TypeDetails.Get(type); + + if (details.JsonConverter == null) + { + throw new ConversionException($"No converter found for '{type.Name}'."); + } + + return details.JsonConverter; + } + + internal static bool TryGet(Type type, out IJsonConverter converter) + { + var typeDetails = TypeDetails.Get(type); + + converter = typeDetails.JsonConverter; + + return converter != null; + } + + private static void AddInternal(JsonConverter converter) + => converters.Add(typeof(T), converter); + + private static void AddInternal(IJsonConverter converter) + => converters.Add(typeof(T), converter); + + internal static void Add(JsonConverter converter) + { + if (converter == null) + { + throw new ArgumentNullException(nameof(converter)); + } + + AddInternal(converter); + + var type = TypeDetails.Get(); + + type.JsonConverter = converter; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/Conversions/StringLikeConverter.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/Conversions/StringLikeConverter.cs new file mode 100644 index 000000000000..c58808b198f7 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/Conversions/StringLikeConverter.cs @@ -0,0 +1,45 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Reflection; + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json +{ + public sealed class StringLikeConverter : IJsonConverter + { + private readonly Type type; + private readonly MethodInfo parseMethod; + + internal StringLikeConverter(Type type) + { + this.type = type ?? throw new ArgumentNullException(nameof(type)); + this.parseMethod = StringLikeHelper.GetParseMethod(type); + } + + public object FromJson(JsonNode node) => + parseMethod.Invoke(null, new[] { node.ToString() }); + + public JsonNode ToJson(object value) => new JsonString(value.ToString()); + } + + internal static class StringLikeHelper + { + private static readonly Type[] parseMethodParamaterTypes = new[] { typeof(string) }; + + internal static bool IsStringLike(Type type) + { + return GetParseMethod(type) != null; + } + + internal static MethodInfo GetParseMethod(Type type) + { + MethodInfo method = type.GetMethod("Parse", parseMethodParamaterTypes); + + if (method?.IsPublic != true) return null; + + return method; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/Customizations/IJsonSerializable.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/Customizations/IJsonSerializable.cs new file mode 100644 index 000000000000..064974a0ce81 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/Customizations/IJsonSerializable.cs @@ -0,0 +1,263 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json; +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime +{ + public interface IJsonSerializable + { + JsonNode ToJson(JsonObject container = null, SerializationMode serializationMode = SerializationMode.None); + } + internal static class JsonSerializable + { + /// + /// Serializes an enumerable and returns a JsonNode. + /// + /// an IEnumerable collection of items + /// A JsonNode that contains the collection of items serialized. + private static JsonNode ToJsonValue(System.Collections.IEnumerable enumerable) + { + if (enumerable != null) + { + // is it a byte array of some kind? + if (enumerable is System.Collections.Generic.IEnumerable byteEnumerable) + { + return new XBinary(System.Linq.Enumerable.ToArray(byteEnumerable)); + } + + var hasValues = false; + // just create an array of value nodes. + var result = new XNodeArray(); + foreach (var each in enumerable) + { + // we had at least one value. + hasValues = true; + + // try to serialize it. + var node = ToJsonValue(each); + if (null != node) + { + result.Add(node); + } + } + + // if we were able to add values, (or it was just empty), return it. + if (result.Count > 0 || !hasValues) + { + return result; + } + } + + // we couldn't serialize the values. Sorry. + return null; + } + + /// + /// Serializes a valuetype to a JsonNode. + /// + /// a ValueType (ie, a primitive, enum or struct) to be serialized + /// a JsonNode with the serialized value + private static JsonNode ToJsonValue(ValueType vValue) + { + // numeric type + if (vValue is SByte || vValue is Int16 || vValue is Int32 || vValue is Int64 || vValue is Byte || vValue is UInt16 || vValue is UInt32 || vValue is UInt64 || vValue is decimal || vValue is float || vValue is double) + { + return new JsonNumber(vValue.ToString()); + } + + // boolean type + if (vValue is bool bValue) + { + return new JsonBoolean(bValue); + } + + // dates + if (vValue is DateTime dtValue) + { + return new JsonDate(dtValue); + } + + // DictionaryEntity struct type + if (vValue is System.Collections.DictionaryEntry deValue) + { + return new JsonObject { { deValue.Key.ToString(), ToJsonValue(deValue.Value) } }; + } + + // sorry, no idea. + return null; + } + /// + /// Attempts to serialize an object by using ToJson() or ToJsonString() if they exist. + /// + /// the object to be serialized. + /// the serialized JsonNode (if successful), otherwise, null + private static JsonNode TryToJsonValue(dynamic oValue) + { + object jsonValue = null; + dynamic v = oValue; + try + { + jsonValue = v.ToJson().ToString(); + } + catch + { + // no harm... + try + { + jsonValue = v.ToJsonString().ToString(); + } + catch + { + // no worries here either. + } + } + + // if we got something out, let's use it. + if (null != jsonValue) + { + // JsonNumber is really a literal json value. Just don't try to cast that back to an actual number, ok? + return new JsonNumber(jsonValue.ToString()); + } + + return null; + } + + /// + /// Serialize an object by using a variety of methods. + /// + /// the object to be serialized. + /// the serialized JsonNode (if successful), otherwise, null + internal static JsonNode ToJsonValue(object value) + { + // things that implement our interface are preferred. + if (value is Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IJsonSerializable jsonSerializable) + { + return jsonSerializable.ToJson(); + } + + // strings are easy. + if (value is string || value is char) + { + return new JsonString(value.ToString()); + } + + // value types are fairly straightforward (fallback to ToJson()/ToJsonString() or literal JsonString ) + if (value is System.ValueType vValue) + { + return ToJsonValue(vValue) ?? TryToJsonValue(vValue) ?? new JsonString(vValue.ToString()); + } + + // dictionaries are objects that should be able to serialize + if (value is System.Collections.Generic.IDictionary dictionary) + { + return Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.JsonSerializable.ToJson(dictionary, null); + } + + // hashtables are converted to dictionaries for serialization + if (value is System.Collections.Hashtable hashtable) + { + var dict = new System.Collections.Generic.Dictionary(); + DictionaryExtensions.HashTableToDictionary(hashtable, dict); + return Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.JsonSerializable.ToJson(dict, null); + } + + // enumerable collections are handled like arrays (again, fallback to ToJson()/ToJsonString() or literal JsonString) + if (value is System.Collections.IEnumerable enumerableValue) + { + // some kind of enumerable value + return ToJsonValue(enumerableValue) ?? TryToJsonValue(value) ?? new JsonString(value.ToString()); + } + + // at this point, we're going to fallback to a string literal here, since we really have no idea what it is. + return new JsonString(value.ToString()); + } + + internal static JsonObject ToJson(System.Collections.Generic.Dictionary dictionary, JsonObject container) => ToJson((System.Collections.Generic.IDictionary)dictionary, container); + + /// + /// Serializes a dictionary into a JsonObject container. + /// + /// The dictionary to serailize + /// the container to serialize the dictionary into + /// the container + internal static JsonObject ToJson(System.Collections.Generic.IDictionary dictionary, JsonObject container) + { + container = container ?? new JsonObject(); + if (dictionary != null && dictionary.Count > 0) + { + foreach (var key in dictionary) + { + // currently, we don't serialize null values. + if (null != key.Value) + { + container.Add(key.Key, ToJsonValue(key.Value)); + continue; + } + } + } + return container; + } + + internal static Func> DeserializeDictionary(Func> dictionaryFactory) + { + return (node) => FromJson(node, dictionaryFactory(), (object)(DeserializeDictionary(dictionaryFactory)) as Func); + } + + internal static System.Collections.Generic.IDictionary FromJson(JsonObject json, System.Collections.Generic.Dictionary container, System.Func objectFactory, System.Collections.Generic.HashSet excludes = null) => FromJson(json, (System.Collections.Generic.IDictionary)container, objectFactory, excludes); + + + internal static System.Collections.Generic.IDictionary FromJson(JsonObject json, System.Collections.Generic.IDictionary container, System.Func objectFactory, System.Collections.Generic.HashSet excludes = null) + { + if (null == json) + { + return container; + } + + foreach (var key in json.Keys) + { + if (true == excludes?.Contains(key)) + { + continue; + } + + var value = json[key]; + try + { + switch (value.Type) + { + case JsonType.Null: + // skip null values. + continue; + + case JsonType.Array: + case JsonType.Boolean: + case JsonType.Date: + case JsonType.Binary: + case JsonType.Number: + case JsonType.String: + container.Add(key, (V)value.ToValue()); + break; + case JsonType.Object: + if (objectFactory != null) + { + var v = objectFactory(value as JsonObject); + if (null != v) + { + container.Add(key, v); + } + } + break; + } + } + catch + { + } + } + return container; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/Customizations/JsonArray.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/Customizations/JsonArray.cs new file mode 100644 index 000000000000..2faf26f0e063 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/Customizations/JsonArray.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json +{ + public partial class JsonArray + { + internal override object ToValue() => Count == 0 ? new object[0] : System.Linq.Enumerable.ToArray(System.Linq.Enumerable.Select(this, each => each.ToValue())); + } + + +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/Customizations/JsonBoolean.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/Customizations/JsonBoolean.cs new file mode 100644 index 000000000000..9b1a67c76bf9 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/Customizations/JsonBoolean.cs @@ -0,0 +1,16 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json +{ + internal partial class JsonBoolean + { + internal static JsonBoolean Create(bool? value) => value is bool b ? new JsonBoolean(b) : null; + internal bool ToBoolean() => Value; + + internal override object ToValue() => Value; + } + + +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/Customizations/JsonNode.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/Customizations/JsonNode.cs new file mode 100644 index 000000000000..e46de1892c18 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/Customizations/JsonNode.cs @@ -0,0 +1,21 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json +{ + using System; + using System.Collections.Generic; + + public partial class JsonNode + { + /// + /// Returns the content of this node as the underlying value. + /// Will default to the string representation if not overridden in child classes. + /// + /// an object with the underlying value of the node. + internal virtual object ToValue() { + return this.ToString(); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/Customizations/JsonNumber.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/Customizations/JsonNumber.cs new file mode 100644 index 000000000000..d9b6383781a3 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/Customizations/JsonNumber.cs @@ -0,0 +1,78 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json +{ + using System; + + public partial class JsonNumber + { + internal static readonly DateTime EpochDate = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); + private static long ToUnixTime(DateTime dateTime) + { + return (long)dateTime.Subtract(EpochDate).TotalSeconds; + } + private static DateTime FromUnixTime(long totalSeconds) + { + return EpochDate.AddSeconds(totalSeconds); + } + internal byte ToByte() => this; + internal int ToInt() => this; + internal long ToLong() => this; + internal short ToShort() => this; + internal UInt16 ToUInt16() => this; + internal UInt32 ToUInt32() => this; + internal UInt64 ToUInt64() => this; + internal decimal ToDecimal() => this; + internal double ToDouble() => this; + internal float ToFloat() => this; + + internal static JsonNumber Create(int? value) => value is int n ? new JsonNumber(n) : null; + internal static JsonNumber Create(long? value) => value is long n ? new JsonNumber(n) : null; + internal static JsonNumber Create(float? value) => value is float n ? new JsonNumber(n) : null; + internal static JsonNumber Create(double? value) => value is double n ? new JsonNumber(n) : null; + internal static JsonNumber Create(decimal? value) => value is decimal n ? new JsonNumber(n) : null; + internal static JsonNumber Create(DateTime? value) => value is DateTime date ? new JsonNumber(ToUnixTime(date)) : null; + + public static implicit operator DateTime(JsonNumber number) => FromUnixTime(number); + internal DateTime ToDateTime() => this; + + internal JsonNumber(decimal value) + { + this.value = value.ToString(); + } + internal override object ToValue() + { + if (IsInteger) + { + if (int.TryParse(this.value, out int iValue)) + { + return iValue; + } + if (long.TryParse(this.value, out long lValue)) + { + return lValue; + } + } + else + { + if (float.TryParse(this.value, out float fValue)) + { + return fValue; + } + if (double.TryParse(this.value, out double dValue)) + { + return dValue; + } + if (decimal.TryParse(this.value, out decimal dcValue)) + { + return dcValue; + } + } + return null; + } + } + + +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/Customizations/JsonObject.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/Customizations/JsonObject.cs new file mode 100644 index 000000000000..782515da0ba0 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/Customizations/JsonObject.cs @@ -0,0 +1,183 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json +{ + using System; + using System.Collections.Generic; + + public partial class JsonObject + { + internal override object ToValue() => Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.JsonSerializable.FromJson(this, new System.Collections.Generic.Dictionary(), (obj) => obj.ToValue()); + + internal void SafeAdd(string name, Func valueFn) + { + if (valueFn != null) + { + var value = valueFn(); + if (null != value) + { + items.Add(name, value); + } + } + } + + internal void SafeAdd(string name, JsonNode value) + { + if (null != value) + { + items.Add(name, value); + } + } + + internal T NullableProperty(string propertyName) where T : JsonNode + { + if (this.TryGetValue(propertyName, out JsonNode value)) + { + if (value.IsNull) + { + return null; + } + if (value is T tval) + { + return tval; + } + /* it's present, but not the correct type... */ + //throw new Exception($"Property {propertyName} in object expected type {typeof(T).Name} but value of type {value.Type.ToString()} was found."); + } + return null; + } + + internal JsonObject Property(string propertyName) + { + return PropertyT(propertyName); + } + + internal T PropertyT(string propertyName) where T : JsonNode + { + if (this.TryGetValue(propertyName, out JsonNode value)) + { + if (value.IsNull) + { + return null; // we're going to assume that the consumer knows what to do if null is explicity returned? + } + + if (value is T tval) + { + return tval; + } + /* it's present, but not the correct type... */ + // throw new Exception($"Property {propertyName} in object expected type {typeof(T).Name} but value of type {value.Type.ToString()} was found."); + } + return null; + } + + internal int NumberProperty(string propertyName, ref int output) => output = this.PropertyT(propertyName)?.ToInt() ?? output; + internal float NumberProperty(string propertyName, ref float output) => output = this.PropertyT(propertyName)?.ToFloat() ?? output; + internal byte NumberProperty(string propertyName, ref byte output) => output = this.PropertyT(propertyName)?.ToByte() ?? output; + internal long NumberProperty(string propertyName, ref long output) => output = this.PropertyT(propertyName)?.ToLong() ?? output; + internal double NumberProperty(string propertyName, ref double output) => output = this.PropertyT(propertyName)?.ToDouble() ?? output; + internal decimal NumberProperty(string propertyName, ref decimal output) => output = this.PropertyT(propertyName)?.ToDecimal() ?? output; + internal short NumberProperty(string propertyName, ref short output) => output = this.PropertyT(propertyName)?.ToShort() ?? output; + internal DateTime NumberProperty(string propertyName, ref DateTime output) => output = this.PropertyT(propertyName)?.ToDateTime() ?? output; + + internal int? NumberProperty(string propertyName, ref int? output) => output = this.NullableProperty(propertyName)?.ToInt() ?? null; + internal float? NumberProperty(string propertyName, ref float? output) => output = this.NullableProperty(propertyName)?.ToFloat() ?? null; + internal byte? NumberProperty(string propertyName, ref byte? output) => output = this.NullableProperty(propertyName)?.ToByte() ?? null; + internal long? NumberProperty(string propertyName, ref long? output) => output = this.NullableProperty(propertyName)?.ToLong() ?? null; + internal double? NumberProperty(string propertyName, ref double? output) => output = this.NullableProperty(propertyName)?.ToDouble() ?? null; + internal decimal? NumberProperty(string propertyName, ref decimal? output) => output = this.NullableProperty(propertyName)?.ToDecimal() ?? null; + internal short? NumberProperty(string propertyName, ref short? output) => output = this.NullableProperty(propertyName)?.ToShort() ?? null; + + internal DateTime? NumberProperty(string propertyName, ref DateTime? output) => output = this.NullableProperty(propertyName)?.ToDateTime() ?? null; + + + internal string StringProperty(string propertyName) => this.PropertyT(propertyName)?.ToString(); + internal string StringProperty(string propertyName, ref string output) => output = this.PropertyT(propertyName)?.ToString() ?? output; + internal char StringProperty(string propertyName, ref char output) => output = this.PropertyT(propertyName)?.ToChar() ?? output; + internal char? StringProperty(string propertyName, ref char? output) => output = this.PropertyT(propertyName)?.ToChar() ?? null; + + internal DateTime StringProperty(string propertyName, ref DateTime output) => DateTime.TryParse(this.PropertyT(propertyName)?.ToString(), out output) ? output : output; + internal DateTime? StringProperty(string propertyName, ref DateTime? output) => output = DateTime.TryParse(this.PropertyT(propertyName)?.ToString(), out var o) ? o : output; + + + internal bool BooleanProperty(string propertyName, ref bool output) => output = this.PropertyT(propertyName)?.ToBoolean() ?? output; + internal bool? BooleanProperty(string propertyName, ref bool? output) => output = this.PropertyT(propertyName)?.ToBoolean() ?? null; + + internal T[] ArrayProperty(string propertyName, ref T[] output, Func deserializer) + { + var array = this.PropertyT(propertyName); + if (array != null) + { + output = new T[array.Count]; + for (var i = 0; i < output.Length; i++) + { + output[i] = deserializer(array[i]); + } + } + return output; + } + internal T[] ArrayProperty(string propertyName, Func deserializer) + { + var array = this.PropertyT(propertyName); + if (array != null) + { + var output = new T[array.Count]; + for (var i = 0; i < output.Length; i++) + { + output[i] = deserializer(array[i]); + } + return output; + } + return new T[0]; + } + internal void IterateArrayProperty(string propertyName, Action deserializer) + { + var array = this.PropertyT(propertyName); + if (array != null) + { + for (var i = 0; i < array.Count; i++) + { + deserializer(array[i]); + } + } + } + + internal Dictionary DictionaryProperty(string propertyName, ref Dictionary output, Func deserializer) + { + var dictionary = this.PropertyT(propertyName); + if (output == null) + { + output = new Dictionary(); + } + else + { + output.Clear(); + } + if (dictionary != null) + { + foreach (var key in dictionary.Keys) + { + output[key] = deserializer(dictionary[key]); + } + } + return output; + } + + internal static JsonObject Create(IDictionary source, Func selector) + { + if (source == null || selector == null) + { + return null; + } + var result = new JsonObject(); + + foreach (var key in source.Keys) + { + result.SafeAdd(key, selector(source[key])); + } + return result; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/Customizations/JsonString.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/Customizations/JsonString.cs new file mode 100644 index 000000000000..5529aaa69772 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/Customizations/JsonString.cs @@ -0,0 +1,34 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json +{ + using System; + using System.Globalization; + using System.Linq; + + public partial class JsonString + { + internal static string DateFormat = "yyyy-MM-dd"; + internal static string DateTimeFormat = "yyyy'-'MM'-'dd'T'HH':'mm':'ss.FFFFFFFK"; + internal static string DateTimeRfc1123Format = "R"; + + internal static JsonString Create(string value) => value == null ? null : new JsonString(value); + internal static JsonString Create(char? value) => value is char c ? new JsonString(c.ToString()) : null; + + internal static JsonString CreateDate(DateTime? value) => value is DateTime date ? new JsonString(date.ToString(DateFormat, CultureInfo.CurrentCulture)) : null; + internal static JsonString CreateDateTime(DateTime? value) => value is DateTime date ? new JsonString(date.ToString(DateTimeFormat, CultureInfo.CurrentCulture)) : null; + internal static JsonString CreateDateTimeRfc1123(DateTime? value) => value is DateTime date ? new JsonString(date.ToString(DateTimeRfc1123Format, CultureInfo.CurrentCulture)) : null; + + internal char ToChar() => this.Value?.ToString()?.FirstOrDefault() ?? default(char); + public static implicit operator char(JsonString value) => value?.ToString()?.FirstOrDefault() ?? default(char); + public static implicit operator char? (JsonString value) => value?.ToString()?.FirstOrDefault(); + + public static implicit operator DateTime(JsonString value) => DateTime.TryParse(value, out var output) ? output : default(DateTime); + public static implicit operator DateTime? (JsonString value) => DateTime.TryParse(value, out var output) ? output : default(DateTime?); + + } + + +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/Customizations/XNodeArray.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/Customizations/XNodeArray.cs new file mode 100644 index 000000000000..5237adf81bf3 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/Customizations/XNodeArray.cs @@ -0,0 +1,44 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json +{ + using System; + using System.Linq; + + public partial class XNodeArray + { + internal static XNodeArray Create(T[] source, Func selector) + { + if (source == null || selector == null) + { + return null; + } + var result = new XNodeArray(); + foreach (var item in source.Select(selector)) + { + result.SafeAdd(item); + } + return result; + } + internal void SafeAdd(JsonNode item) + { + if (item != null) + { + items.Add(item); + } + } + internal void SafeAdd(Func itemFn) + { + if (itemFn != null) + { + var item = itemFn(); + if (item != null) + { + items.Add(item); + } + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/Debugging.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/Debugging.cs new file mode 100644 index 000000000000..e6e7536e4d72 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/Debugging.cs @@ -0,0 +1,28 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime +{ + internal static class AttachDebugger + { + internal static void Break() + { + while (!System.Diagnostics.Debugger.IsAttached) + { + System.Console.Error.WriteLine($"Waiting for debugger to attach to process {System.Diagnostics.Process.GetCurrentProcess().Id}"); + for (int i = 0; i < 50; i++) + { + if (System.Diagnostics.Debugger.IsAttached) + { + break; + } + System.Threading.Thread.Sleep(100); + System.Console.Error.Write("."); + } + System.Console.Error.WriteLine(); + } + System.Diagnostics.Debugger.Break(); + } + } +} diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/DictionaryExtensions.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/DictionaryExtensions.cs new file mode 100644 index 000000000000..3619862eee81 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/DictionaryExtensions.cs @@ -0,0 +1,33 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime +{ + internal static class DictionaryExtensions + { + internal static void HashTableToDictionary(System.Collections.Hashtable hashtable, System.Collections.Generic.IDictionary dictionary) + { + if (null == hashtable) + { + return; + } + foreach (var each in hashtable.Keys) + { + var key = each.ToString(); + var value = hashtable[key]; + if (null != value) + { + try + { + dictionary[key] = (V)value; + } + catch + { + // Values getting dropped; not compatible with target dictionary. Not sure what to do here. + } + } + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/EventData.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/EventData.cs new file mode 100644 index 000000000000..718998d4af1b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/EventData.cs @@ -0,0 +1,78 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime +{ + + using System; + using System.Threading; + + ///Represents the data in signaled event. + public partial class EventData + { + /// + /// The type of the event being signaled + /// + public string Id; + + /// + /// The user-ready message from the event. + /// + public string Message; + + /// + /// When the event is about a parameter, this is the parameter name. + /// Used in Validation Events + /// + public string Parameter; + + /// + /// This represents a numeric value associated with the event. + /// Use for progress-style events + /// + public double Value; + + /// + /// Any extended data for an event should be serialized and stored here. + /// + public string ExtendedData; + + /// + /// If the event triggers after the request message has been created, this will contain the Request Message (which in HTTP calls would be HttpRequestMessage) + /// + /// Typically you'd cast this to the expected type to use it: + /// + /// if(eventData.RequestMessgae is HttpRequestMessage httpRequest) + /// { + /// httpRequest.Headers.Add("x-request-flavor", "vanilla"); + /// } + /// + /// + public object RequestMessage; + + /// + /// If the event triggers after the response is back, this will contain the Response Message (which in HTTP calls would be HttpResponseMessage) + /// + /// Typically you'd cast this to the expected type to use it: + /// + /// if(eventData.ResponseMessage is HttpResponseMessage httpResponse){ + /// var flavor = httpResponse.Headers.GetValue("x-request-flavor"); + /// } + /// + /// + public object ResponseMessage; + + /// + /// Cancellation method for this event. + /// + /// If the event consumer wishes to cancel the request that initiated this event, call Cancel() + /// + /// + /// The original initiator of the request must provide the implementation of this. + /// + public System.Action Cancel; + } + +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/EventDataExtensions.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/EventDataExtensions.cs new file mode 100644 index 000000000000..914a8109d265 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/EventDataExtensions.cs @@ -0,0 +1,94 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime +{ + using System; + + /// + /// PowerShell-specific data on top of the llc# EventData + /// + /// + /// In PowerShell, we add on the EventDataConverter to support sending events between modules. + /// Obviously, this code would need to be duplcated on both modules. + /// This is preferable to sharing a common library, as versioning makes that problematic. + /// + [System.ComponentModel.TypeConverter(typeof(EventDataConverter))] + public partial class EventData : EventArgs + { + } + + /// + /// A PowerShell PSTypeConverter to adapt an EventData object that has been passed. + /// Usually used between modules. + /// + public class EventDataConverter : System.Management.Automation.PSTypeConverter + { + public override bool CanConvertTo(object sourceValue, Type destinationType) => false; + public override object ConvertTo(object sourceValue, Type destinationType, IFormatProvider formatProvider, bool ignoreCase) => null; + public override bool CanConvertFrom(dynamic sourceValue, Type destinationType) => destinationType == typeof(EventData) && CanConvertFrom(sourceValue); + public override object ConvertFrom(dynamic sourceValue, Type destinationType, IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Verifies that a given object has the required members to convert it to the target type (EventData) + /// + /// Uses a dynamic type so that it is able to use the simplest code without excessive checking. + /// + /// The instance to verify + /// True, if the object has all the required parameters. + public static bool CanConvertFrom(dynamic sourceValue) + { + try + { + // check if this has *required* parameters... + sourceValue?.Id?.GetType(); + sourceValue?.Message?.GetType(); + sourceValue?.Cancel?.GetType(); + + // remaining parameters are not *required*, + // and if they have values, it will copy them at conversion time. + } + catch + { + // if anything throws an exception (because it's null, or doesn't have that member) + return false; + } + return true; + } + + /// + /// Returns result of the delegate as the expected type, or default(T) + /// + /// This isolates any exceptions from the consumer. + /// + /// A delegate that returns a value + /// The desired output type + /// The value from the function if the type is correct + private static T To(Func srcValue) + { + try { return srcValue(); } + catch { return default(T); } + } + + /// + /// Converts an incoming object to the expected type by treating the incoming object as a dynamic, and coping the expected values. + /// + /// the incoming object + /// EventData + public static EventData ConvertFrom(dynamic sourceValue) + { + return new EventData + { + Id = To(() => sourceValue.Id), + Message = To(() => sourceValue.Message), + Parameter = To(() => sourceValue.Parameter), + Value = To(() => sourceValue.Value), + RequestMessage = To(() => sourceValue.RequestMessage), + ResponseMessage = To(() => sourceValue.ResponseMessage), + Cancel = To(() => sourceValue.Cancel) + }; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/EventListener.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/EventListener.cs new file mode 100644 index 000000000000..8393ab77276b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/EventListener.cs @@ -0,0 +1,247 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime +{ + + using System; + using System.Linq; + using System.Collections; + using System.Collections.Generic; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + using GetEventData = System.Func; + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + public interface IValidates + { + Task Validate(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IEventListener listener); + } + + /// + /// The IEventListener Interface defines the communication mechanism for Signaling events during a remote call. + /// + /// + /// The interface is designed to be as minimal as possible, allow for quick peeking of the event type (id) + /// and the cancellation status and provides a delegate for retrieving the event details themselves. + /// + public interface IEventListener + { + Task Signal(string id, CancellationToken token, GetEventData createMessage); + CancellationToken Token { get; } + System.Action Cancel { get; } + } + + internal static partial class Extensions + { + public static Task Signal(this IEventListener instance, string id, CancellationToken token, Func createMessage) => instance.Signal(id, token, createMessage); + public static Task Signal(this IEventListener instance, string id, CancellationToken token) => instance.Signal(id, token, () => new EventData { Id = id, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, CancellationToken token, string messageText) => instance.Signal(id, token, () => new EventData { Id = id, Message = messageText, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, CancellationToken token, string messageText, HttpRequestMessage request) => instance.Signal(id, token, () => new EventData { Id = id, Message = messageText, RequestMessage = request, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, CancellationToken token, string messageText, HttpResponseMessage response) => instance.Signal(id, token, () => new EventData { Id = id, Message = messageText, RequestMessage = response.RequestMessage, ResponseMessage = response, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, CancellationToken token, string messageText, double magnitude) => instance.Signal(id, token, () => new EventData { Id = id, Message = messageText, Value = magnitude, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, CancellationToken token, string messageText, double magnitude, HttpRequestMessage request) => instance.Signal(id, token, () => new EventData { Id = id, Message = messageText, RequestMessage = request, Value = magnitude, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, CancellationToken token, string messageText, double magnitude, HttpResponseMessage response) => instance.Signal(id, token, () => new EventData { Id = id, Message = messageText, RequestMessage = response.RequestMessage, ResponseMessage = response, Value = magnitude, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, CancellationToken token, HttpRequestMessage request) => instance.Signal(id, token, () => new EventData { Id = id, RequestMessage = request, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, CancellationToken token, HttpRequestMessage request, HttpResponseMessage response) => instance.Signal(id, token, () => new EventData { Id = id, RequestMessage = request, ResponseMessage = response, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, CancellationToken token, HttpResponseMessage response) => instance.Signal(id, token, () => new EventData { Id = id, RequestMessage = response.RequestMessage, ResponseMessage = response, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, CancellationToken token, EventData message) => instance.Signal(id, token, () => { message.Id = id; message.Cancel = instance.Cancel; return message; }); + + public static Task Signal(this IEventListener instance, string id, Func createMessage) => instance.Signal(id, instance.Token, createMessage); + public static Task Signal(this IEventListener instance, string id) => instance.Signal(id, instance.Token, () => new EventData { Id = id, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, string messageText) => instance.Signal(id, instance.Token, () => new EventData { Id = id, Message = messageText, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, string messageText, HttpRequestMessage request) => instance.Signal(id, instance.Token, () => new EventData { Id = id, Message = messageText, RequestMessage = request, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, string messageText, HttpResponseMessage response) => instance.Signal(id, instance.Token, () => new EventData { Id = id, Message = messageText, RequestMessage = response.RequestMessage, ResponseMessage = response, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, string messageText, double magnitude) => instance.Signal(id, instance.Token, () => new EventData { Id = id, Message = messageText, Value = magnitude, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, string messageText, double magnitude, HttpRequestMessage request) => instance.Signal(id, instance.Token, () => new EventData { Id = id, Message = messageText, RequestMessage = request, Value = magnitude, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, string messageText, double magnitude, HttpResponseMessage response) => instance.Signal(id, instance.Token, () => new EventData { Id = id, Message = messageText, RequestMessage = response.RequestMessage, ResponseMessage = response, Value = magnitude, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, HttpRequestMessage request) => instance.Signal(id, instance.Token, () => new EventData { Id = id, RequestMessage = request, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, HttpRequestMessage request, HttpResponseMessage response) => instance.Signal(id, instance.Token, () => new EventData { Id = id, RequestMessage = request, ResponseMessage = response, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, HttpResponseMessage response) => instance.Signal(id, instance.Token, () => new EventData { Id = id, RequestMessage = response.RequestMessage, ResponseMessage = response, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, EventData message) => instance.Signal(id, instance.Token, () => { message.Id = id; message.Cancel = instance.Cancel; return message; }); + + public static Task Signal(this IEventListener instance, string id, System.Uri uri) => instance.Signal(id, instance.Token, () => new EventData { Id = id, Message = uri.ToString(), Cancel = instance.Cancel }); + + public static async Task AssertNotNull(this IEventListener instance, string parameterName, object value) + { + if (value == null) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ValidationWarning, Message = $"'{parameterName}' should not be null", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + public static async Task AssertMinimumLength(this IEventListener instance, string parameterName, string value, int length) + { + if (value != null && value.Length < length) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ValidationWarning, Message = $"Length of '{parameterName}' is less than {length}", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + public static async Task AssertMaximumLength(this IEventListener instance, string parameterName, string value, int length) + { + if (value != null && value.Length > length) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ValidationWarning, Message = $"Length of '{parameterName}' is greater than {length}", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + + public static async Task AssertRegEx(this IEventListener instance, string parameterName, string value, string regularExpression) + { + if (value != null && !System.Text.RegularExpressions.Regex.Match(value, regularExpression).Success) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ValidationWarning, Message = $"'{parameterName}' does not validate against pattern /{regularExpression}/", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + public static async Task AssertEnum(this IEventListener instance, string parameterName, string value, params string[] values) + { + if (!values.Any(each => each.Equals(value))) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ValidationWarning, Message = $"'{parameterName}' is not one of ({values.Aggregate((c, e) => $"'{e}',{c}")}", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + public static async Task AssertObjectIsValid(this IEventListener instance, string parameterName, object inst) + { + await (inst as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.IValidates)?.Validate(instance); + } + + public static async Task AssertIsLessThan(this IEventListener instance, string parameterName, T? value, T max) where T : struct, System.IComparable + { + if (null != value && ((T)value).CompareTo(max) >= 0) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ValidationWarning, Message = $"Value of '{parameterName}' must be less than {max} (value is {value})", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + public static async Task AssertIsGreaterThan(this IEventListener instance, string parameterName, T? value, T max) where T : struct, System.IComparable + { + if (null != value && ((T)value).CompareTo(max) <= 0) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ValidationWarning, Message = $"Value of '{parameterName}' must be greater than {max} (value is {value})", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + public static async Task AssertIsLessThanOrEqual(this IEventListener instance, string parameterName, T? value, T max) where T : struct, System.IComparable + { + if (null != value && ((T)value).CompareTo(max) > 0) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ValidationWarning, Message = $"Value of '{parameterName}' must be less than or equal to {max} (value is {value})", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + public static async Task AssertIsGreaterThanOrEqual(this IEventListener instance, string parameterName, T? value, T max) where T : struct, System.IComparable + { + if (null != value && ((T)value).CompareTo(max) < 0) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ValidationWarning, Message = $"Value of '{parameterName}' must be greater than or equal to {max} (value is {value})", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + public static async Task AssertIsMultipleOf(this IEventListener instance, string parameterName, Int64? value, Int64 multiple) + { + if (null != value && value % multiple != 0) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ValidationWarning, Message = $"Value of '{parameterName}' must be multiple of {multiple} (value is {value})", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + public static async Task AssertIsMultipleOf(this IEventListener instance, string parameterName, double? value, double multiple) + { + if (null != value) + { + var i = (Int64)(value / multiple); + if (i != value / multiple) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ValidationWarning, Message = $"Value of '{parameterName}' must be multiple of {multiple} (value is {value})", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + } + public static async Task AssertIsMultipleOf(this IEventListener instance, string parameterName, decimal? value, decimal multiple) + { + if (null != value) + { + var i = (Int64)(value / multiple); + if (i != value / multiple) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Events.ValidationWarning, Message = $"Value of '{parameterName}' must be multiple of {multiple} (value is {value})", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + } + } + + /// + /// An Implementation of the IEventListener that supports subscribing to events and dispatching them + /// (used for manually using the lowlevel interface) + /// + public class EventListener : CancellationTokenSource, IEnumerable>, IEventListener + { + private Dictionary calls = new Dictionary(); + public IEnumerator> GetEnumerator() => calls.GetEnumerator(); + IEnumerator IEnumerable.GetEnumerator() => calls.GetEnumerator(); + public EventListener() + { + } + + public new Action Cancel => base.Cancel; + private Event tracer; + + public EventListener(params (string name, Event callback)[] initializer) + { + foreach (var each in initializer) + { + Add(each.name, each.callback); + } + } + + public void Add(string name, SynchEvent callback) + { + Add(name, (message) => { callback(message); return Task.CompletedTask; }); + } + + public void Add(string name, Event callback) + { + if (callback != null) + { + if (string.IsNullOrEmpty(name)) + { + if (calls.ContainsKey(name)) + { + tracer += callback; + } + else + { + tracer = callback; + } + } + else + { + if (calls.ContainsKey(name)) + { + calls[name ?? System.String.Empty] += callback; + } + else + { + calls[name ?? System.String.Empty] = callback; + } + } + } + } + + + public async Task Signal(string id, CancellationToken token, GetEventData createMessage) + { + using (NoSynchronizationContext) + { + if (!string.IsNullOrEmpty(id) && (calls.TryGetValue(id, out Event listener) || tracer != null)) + { + var message = createMessage(); + message.Id = id; + + await listener?.Invoke(message); + await tracer?.Invoke(message); + + if (token.IsCancellationRequested) + { + throw new OperationCanceledException($"Canceled by event {id} ", this.Token); + } + } + } + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/Events.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/Events.cs new file mode 100644 index 000000000000..990f9481dfd1 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/Events.cs @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime +{ + public static partial class Events + { + public const string Log = nameof(Log); + public const string Validation = nameof(Validation); + public const string ValidationWarning = nameof(ValidationWarning); + public const string AfterValidation = nameof(AfterValidation); + public const string RequestCreated = nameof(RequestCreated); + public const string ResponseCreated = nameof(ResponseCreated); + public const string URLCreated = nameof(URLCreated); + public const string Finally = nameof(Finally); + public const string HeaderParametersAdded = nameof(HeaderParametersAdded); + public const string BodyContentSet = nameof(BodyContentSet); + public const string BeforeCall = nameof(BeforeCall); + public const string BeforeResponseDispatch = nameof(BeforeResponseDispatch); + public const string FollowingNextLink = nameof(FollowingNextLink); + public const string DelayBeforePolling = nameof(DelayBeforePolling); + public const string Polling = nameof(Polling); + + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/EventsExtensions.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/EventsExtensions.cs new file mode 100644 index 000000000000..ee5f50035b94 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/EventsExtensions.cs @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime +{ + public static partial class Events + { + public const string CmdletProcessRecordStart = nameof(CmdletProcessRecordStart); + public const string CmdletProcessRecordAsyncStart = nameof(CmdletProcessRecordAsyncStart); + public const string CmdletException = nameof(CmdletException); + public const string CmdletGetPipeline = nameof(CmdletGetPipeline); + public const string CmdletBeforeAPICall = nameof(CmdletBeforeAPICall); + public const string CmdletBeginProcessing = nameof(CmdletBeginProcessing); + public const string CmdletEndProcessing = nameof(CmdletEndProcessing); + public const string CmdletProcessRecordEnd = nameof(CmdletProcessRecordEnd); + public const string CmdletProcessRecordAsyncEnd = nameof(CmdletProcessRecordAsyncEnd); + public const string CmdletAfterAPICall = nameof(CmdletAfterAPICall); + + public const string Verbose = nameof(Verbose); + public const string Debug = nameof(Debug); + public const string Information = nameof(Information); + public const string Error = nameof(Error); + public const string Warning = nameof(Warning); + } + +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/Extensions.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/Extensions.cs new file mode 100644 index 000000000000..c73dc5dbeccd --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/Extensions.cs @@ -0,0 +1,117 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime +{ + using System.Linq; + using System; + + internal static partial class Extensions + { + public static T[] SubArray(this T[] array, int offset, int length) + { + return new ArraySegment(array, offset, length) + .ToArray(); + } + + public static T ReadHeaders(this T instance, global::System.Net.Http.Headers.HttpResponseHeaders headers) where T : class + { + (instance as IHeaderSerializable)?.ReadHeaders(headers); + return instance; + } + + internal static bool If(T input, out T output) + { + if (null == input) + { + output = default(T); + return false; + } + output = input; + return true; + } + + internal static void AddIf(T value, System.Action addMethod) + { + // if value is present (and it's not just an empty JSON Object) + if (null != value && (value as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject)?.Keys.Count != 0) + { + addMethod(value); + } + } + + internal static void AddIf(T value, string serializedName, System.Action addMethod) + { + // if value is present (and it's not just an empty JSON Object) + if (null != value && (value as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject)?.Keys.Count != 0) + { + addMethod(serializedName, value); + } + } + + /// + /// Returns the first header value as a string from an HttpReponseMessage. + /// + /// the HttpResponseMessage to fetch a header from + /// the header name + /// the first header value as a string from an HttpReponseMessage. string.empty if there is no header value matching + internal static string GetFirstHeader(this System.Net.Http.HttpResponseMessage response, string headerName) => response.Headers.FirstOrDefault(each => string.Equals(headerName, each.Key, System.StringComparison.OrdinalIgnoreCase)).Value?.FirstOrDefault() ?? string.Empty; + + /// + /// Sets the Synchronization Context to null, and returns an IDisposable that when disposed, + /// will restore the synchonization context to the original value. + /// + /// This is used a less-invasive means to ensure that code in the library that doesn't + /// need to be continued in the original context doesn't have to have ConfigureAwait(false) + /// on every single await + /// + /// If the SynchronizationContext is null when this is used, the resulting IDisposable + /// will not do anything (this prevents excessive re-setting of the SynchronizationContext) + /// + /// Usage: + /// + /// using(NoSynchronizationContext) { + /// await SomeAsyncOperation(); + /// await SomeOtherOperation(); + /// } + /// + /// + /// + /// An IDisposable that will return the SynchronizationContext to original state + internal static System.IDisposable NoSynchronizationContext => System.Threading.SynchronizationContext.Current == null ? Dummy : new NoSyncContext(); + + /// + /// An instance of the Dummy IDispoable. + /// + /// + internal static System.IDisposable Dummy = new DummyDisposable(); + + /// + /// An IDisposable that does absolutely nothing. + /// + internal class DummyDisposable : System.IDisposable + { + public void Dispose() + { + } + } + /// + /// An IDisposable that saves the SynchronizationContext,sets it to null and + /// restores it to the original upon Dispose(). + /// + /// NOTE: This is designed to be less invasive than using .ConfigureAwait(false) + /// on every single await in library code (ie, places where we know we don't need + /// to continue in the same context as we went async) + /// + internal class NoSyncContext : System.IDisposable + { + private System.Threading.SynchronizationContext original = System.Threading.SynchronizationContext.Current; + internal NoSyncContext() + { + System.Threading.SynchronizationContext.SetSynchronizationContext(null); + } + public void Dispose() => System.Threading.SynchronizationContext.SetSynchronizationContext(original); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/Helpers/Extensions/StringBuilderExtensions.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/Helpers/Extensions/StringBuilderExtensions.cs new file mode 100644 index 000000000000..83e95d5433b4 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/Helpers/Extensions/StringBuilderExtensions.cs @@ -0,0 +1,23 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System.Text; + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json +{ + internal static class StringBuilderExtensions + { + /// + /// Extracts the buffered value and resets the buffer + /// + internal static string Extract(this StringBuilder builder) + { + var text = builder.ToString(); + + builder.Clear(); + + return text; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/Helpers/Extensions/TypeExtensions.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/Helpers/Extensions/TypeExtensions.cs new file mode 100644 index 000000000000..217a49c4d4a7 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/Helpers/Extensions/TypeExtensions.cs @@ -0,0 +1,61 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json +{ + internal static class TypeExtensions + { + internal static bool IsNullable(this Type type) => + type.IsGenericType && type.GetGenericTypeDefinition().Equals(typeof(Nullable<>)); + + internal static Type GetOpenGenericInterface(this Type candidateType, Type openGenericInterfaceType) + { + + if (candidateType.IsGenericType && candidateType.GetGenericTypeDefinition() == openGenericInterfaceType) + { + return candidateType; + } + + // Check if it references it's own converter.... + + foreach (Type interfaceType in candidateType.GetInterfaces()) + { + if (interfaceType.IsGenericType + && interfaceType.GetGenericTypeDefinition().Equals(openGenericInterfaceType)) + { + return interfaceType; + } + } + + return null; + } + + // Author: Sebastian Good + // http://stackoverflow.com/questions/503263/how-to-determine-if-a-type-implements-a-specific-generic-interface-type + internal static bool ImplementsOpenGenericInterface(this Type candidateType, Type openGenericInterfaceType) + { + if (candidateType.Equals(openGenericInterfaceType)) + { + return true; + } + + if (candidateType.IsGenericType && candidateType.GetGenericTypeDefinition().Equals(openGenericInterfaceType)) + { + return true; + } + + foreach (Type i in candidateType.GetInterfaces()) + { + if (i.IsGenericType && i.ImplementsOpenGenericInterface(openGenericInterfaceType)) + { + return true; + } + } + + return false; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/Helpers/Seperator.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/Helpers/Seperator.cs new file mode 100644 index 000000000000..67755578495b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/Helpers/Seperator.cs @@ -0,0 +1,11 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json +{ + internal static class Seperator + { + internal static readonly char[] Dash = { '-' }; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/Helpers/TypeDetails.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/Helpers/TypeDetails.cs new file mode 100644 index 000000000000..4ce1276b626b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/Helpers/TypeDetails.cs @@ -0,0 +1,116 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections; +using System.Collections.Concurrent; +using System.Collections.Generic; +using System.Reflection; + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json +{ + + + + internal class TypeDetails + { + private readonly Type info; + + internal TypeDetails(Type info) + { + this.info = info ?? throw new ArgumentNullException(nameof(info)); + } + + internal Type NonNullType { get; set; } + + internal object DefaultValue { get; set; } + + internal bool IsNullable { get; set; } + + internal bool IsList { get; set; } + + internal bool IsStringLike { get; set; } + + internal bool IsEnum => info.IsEnum; + + internal bool IsArray => info.IsArray; + + internal bool IsValueType => info.IsValueType; + + internal Type ElementType { get; set; } + + internal IJsonConverter JsonConverter { get; set; } + + #region Creation + + private static readonly ConcurrentDictionary cache = new ConcurrentDictionary(); + + internal static TypeDetails Get() => Get(typeof(T)); + + internal static TypeDetails Get(Type type) => cache.GetOrAdd(type, Create); + + private static TypeDetails Create(Type type) + { + var isGenericList = !type.IsPrimitive && type.ImplementsOpenGenericInterface(typeof(IList<>)); + var isList = !type.IsPrimitive && (isGenericList || typeof(IList).IsAssignableFrom(type)); + + var isNullable = type.IsNullable(); + + Type elementType; + + if (type.IsArray) + { + elementType = type.GetElementType(); + } + else if (isGenericList) + { + var iList = type.GetOpenGenericInterface(typeof(IList<>)); + + elementType = iList.GetGenericArguments()[0]; + } + else + { + elementType = null; + } + + var nonNullType = isNullable ? type.GetGenericArguments()[0] : type; + + var isStringLike = false; + + IJsonConverter converter; + + var jsonConverterAttribute = type.GetCustomAttribute(); + + if (jsonConverterAttribute != null) + { + converter = jsonConverterAttribute.Converter; + } + else if (nonNullType.IsEnum) + { + converter = new EnumConverter(nonNullType); + } + else if (JsonConverterFactory.Instances.TryGetValue(nonNullType, out converter)) + { + } + else if (StringLikeHelper.IsStringLike(nonNullType)) + { + isStringLike = true; + + converter = new StringLikeConverter(nonNullType); + } + + return new TypeDetails(nonNullType) { + NonNullType = nonNullType, + DefaultValue = type.IsValueType ? Activator.CreateInstance(type) : null, + IsNullable = isNullable, + IsList = isList, + IsStringLike = isStringLike, + ElementType = elementType, + JsonConverter = converter + }; + } + + #endregion + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/Helpers/XHelper.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/Helpers/XHelper.cs new file mode 100644 index 000000000000..f05c6783a2ac --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/Helpers/XHelper.cs @@ -0,0 +1,75 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json +{ + internal static class XHelper + { + internal static JsonNode Create(JsonType type, TypeCode code, object value) + { + switch (type) + { + case JsonType.Binary : return new XBinary((byte[])value); + case JsonType.Boolean : return new JsonBoolean((bool)value); + case JsonType.Number : return new JsonNumber(value.ToString()); + case JsonType.String : return new JsonString((string)value); + } + + throw new Exception($"JsonType '{type}' does not have a fast conversion"); + } + + internal static bool TryGetElementType(TypeCode code, out JsonType type) + { + switch (code) + { + case TypeCode.Boolean : type = JsonType.Boolean; return true; + case TypeCode.Byte : type = JsonType.Number; return true; + case TypeCode.DateTime : type = JsonType.Date; return true; + case TypeCode.Decimal : type = JsonType.Number; return true; + case TypeCode.Double : type = JsonType.Number; return true; + case TypeCode.Empty : type = JsonType.Null; return true; + case TypeCode.Int16 : type = JsonType.Number; return true; + case TypeCode.Int32 : type = JsonType.Number; return true; + case TypeCode.Int64 : type = JsonType.Number; return true; + case TypeCode.SByte : type = JsonType.Number; return true; + case TypeCode.Single : type = JsonType.Number; return true; + case TypeCode.String : type = JsonType.String; return true; + case TypeCode.UInt16 : type = JsonType.Number; return true; + case TypeCode.UInt32 : type = JsonType.Number; return true; + case TypeCode.UInt64 : type = JsonType.Number; return true; + } + + type = default; + + return false; + } + + internal static JsonType GetElementType(TypeCode code) + { + switch (code) + { + case TypeCode.Boolean : return JsonType.Boolean; + case TypeCode.Byte : return JsonType.Number; + case TypeCode.DateTime : return JsonType.Date; + case TypeCode.Decimal : return JsonType.Number; + case TypeCode.Double : return JsonType.Number; + case TypeCode.Empty : return JsonType.Null; + case TypeCode.Int16 : return JsonType.Number; + case TypeCode.Int32 : return JsonType.Number; + case TypeCode.Int64 : return JsonType.Number; + case TypeCode.SByte : return JsonType.Number; + case TypeCode.Single : return JsonType.Number; + case TypeCode.String : return JsonType.String; + case TypeCode.UInt16 : return JsonType.Number; + case TypeCode.UInt32 : return JsonType.Number; + case TypeCode.UInt64 : return JsonType.Number; + default : return JsonType.Object; + } + + throw new Exception($"TypeCode '{code}' does not have a fast converter"); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/HttpPipeline.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/HttpPipeline.cs new file mode 100644 index 000000000000..dd651e3c5398 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/HttpPipeline.cs @@ -0,0 +1,88 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime +{ + using System.Net.Http; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + using System.Collections; + using System.Linq; + + using GetEventData = System.Func; + using NextDelegate = System.Func, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>; + + using SignalDelegate = System.Func, System.Threading.Tasks.Task>; + using GetParameterDelegate = System.Func, string, object>; + using SendAsyncStepDelegate = System.Func, System.Threading.Tasks.Task>, System.Func, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>; + using PipelineChangeDelegate = System.Action, System.Threading.Tasks.Task>, System.Func, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>>; + using ModuleLoadPipelineDelegate = System.Action, System.Threading.Tasks.Task>, System.Func, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>>, System.Action, System.Threading.Tasks.Task>, System.Func, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>>>; + using NewRequestPipelineDelegate = System.Action, System.Action, System.Threading.Tasks.Task>, System.Func, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>>, System.Action, System.Threading.Tasks.Task>, System.Func, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>>>; + +/* + public class DelegateBasedEventListener : IEventListener + { + private EventListenerDelegate _listener; + public DelegateBasedEventListener(EventListenerDelegate listener) + { + _listener = listener; + } + public CancellationToken Token => CancellationToken.None; + public System.Action Cancel => () => { }; + + + public Task Signal(string id, CancellationToken token, GetEventData createMessage) + { + return _listener(id, token, () => createMessage()); + } + } +*/ + /// + /// This is a necessary extension to the SendAsyncFactory to support the 'generic' delegate format. + /// + public partial class SendAsyncFactory + { + /// + /// This translates a generic-defined delegate for a listener into one that fits our ISendAsync pattern. + /// (Provided to support out-of-module delegation for Azure Cmdlets) + /// + /// The Pipeline Step as a delegate + public SendAsyncFactory(SendAsyncStepDelegate step) => this.implementation = (request, listener, next) => + step( + request, + listener.Token, + listener.Cancel, + (id, token, getEventData) => listener.Signal(id, token, () => { + var data = EventDataConverter.ConvertFrom( getEventData() ) as EventData; + data.Id = id; + data.Cancel = listener.Cancel; + data.RequestMessage = request; + return data; + }), + (req, token, cancel, listenerDelegate) => next.SendAsync(req, listener)); + } + + public partial class HttpPipeline : ISendAsync + { + public HttpPipeline Append(SendAsyncStepDelegate item) + { + if (item != null) + { + Append(new SendAsyncFactory(item)); + } + return this; + } + + public HttpPipeline Prepend(SendAsyncStepDelegate item) + { + if (item != null) + { + Prepend(new SendAsyncFactory(item)); + } + return this; + } + } +} diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/HttpPipelineMocking.ps1 b/swaggerci/recoveryservicessiterecovery/generated/runtime/HttpPipelineMocking.ps1 new file mode 100644 index 000000000000..98680d032f6c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/HttpPipelineMocking.ps1 @@ -0,0 +1,110 @@ +$ErrorActionPreference = "Stop" + +# get the recording path +if (-not $TestRecordingFile) { + $TestRecordingFile = Join-Path $PSScriptRoot 'recording.json' +} + +# create the Http Pipeline Recorder +$Mock = New-Object -Type Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PipelineMock $TestRecordingFile + +# set the recorder to the appropriate mode (default to 'live') +Write-Host -ForegroundColor Green "Running '$TestMode' mode..." +switch ($TestMode) { + 'record' { + Write-Host -ForegroundColor Green "Recording to $TestRecordingFile" + $Mock.SetRecord() + $null = erase -ea 0 $TestRecordingFile + } + 'playback' { + if (-not (Test-Path $TestRecordingFile)) { + Write-Host -fore:yellow "Recording file '$TestRecordingFile' is not present. Tests expecting recorded responses will fail" + } else { + Write-Host -ForegroundColor Green "Using recording $TestRecordingFile" + } + $Mock.SetPlayback() + $Mock.ForceResponseHeaders["Retry-After"] = "0"; + } + default: { + $Mock.SetLive() + } +} + +# overrides for Pester Describe/Context/It + +function Describe( + [Parameter(Mandatory = $true, Position = 0)] + [string] $Name, + + [Alias('Tags')] + [string[]] $Tag = @(), + + [Parameter(Position = 1)] + [ValidateNotNull()] + [ScriptBlock] $Fixture = $(Throw "No test script block is provided. (Have you put the open curly brace on the next line?)") +) { + $Mock.PushDescription($Name) + try { + return pester\Describe -Name $Name -Tag $Tag -Fixture $fixture + } + finally { + $Mock.PopDescription() + } +} + +function Context( + [Parameter(Mandatory = $true, Position = 0)] + [string] $Name, + + [Alias('Tags')] + [string[]] $Tag = @(), + + [Parameter(Position = 1)] + [ValidateNotNull()] + [ScriptBlock] $Fixture = $(Throw "No test script block is provided. (Have you put the open curly brace on the next line?)") +) { + $Mock.PushContext($Name) + try { + return pester\Context -Name $Name -Tag $Tag -Fixture $fixture + } + finally { + $Mock.PopContext() + } +} + +function It { + [CmdletBinding(DefaultParameterSetName = 'Normal')] + param( + [Parameter(Mandatory = $true, Position = 0)] + [string]$Name, + + [Parameter(Position = 1)] + [ScriptBlock] $Test = { }, + + [System.Collections.IDictionary[]] $TestCases, + + [Parameter(ParameterSetName = 'Pending')] + [Switch] $Pending, + + [Parameter(ParameterSetName = 'Skip')] + [Alias('Ignore')] + [Switch] $Skip + ) + $Mock.PushScenario($Name) + + try { + if ($skip) { + return pester\It -Name $Name -Test $Test -TestCases $TestCases -Skip + } + if ($pending) { + return pester\It -Name $Name -Test $Test -TestCases $TestCases -Pending + } + return pester\It -Name $Name -Test $Test -TestCases $TestCases + } + finally { + $null = $Mock.PopScenario() + } +} + +# set the HttpPipelineAppend for all the cmdlets +$PSDefaultParameterValues["*:HttpPipelinePrepend"] = $Mock diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/IAssociativeArray.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/IAssociativeArray.cs new file mode 100644 index 000000000000..f44292a5a2c4 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/IAssociativeArray.cs @@ -0,0 +1,24 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +#define DICT_PROPERTIES +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime +{ + /// A subset of IDictionary that doesn't implement IEnumerable or IDictionary to work around PowerShell's aggressive formatter + public interface IAssociativeArray + { +#if DICT_PROPERTIES + System.Collections.Generic.IEnumerable Keys { get; } + System.Collections.Generic.IEnumerable Values { get; } + int Count { get; } +#endif + System.Collections.Generic.IDictionary AdditionalProperties { get; } + T this[string index] { get; set; } + void Add(string key, T value); + bool ContainsKey(string key); + bool Remove(string key); + bool TryGetValue(string key, out T value); + void Clear(); + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/IHeaderSerializable.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/IHeaderSerializable.cs new file mode 100644 index 000000000000..84a1798ae9da --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/IHeaderSerializable.cs @@ -0,0 +1,14 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime +{ + public interface IHeaderSerializable + { + void ReadHeaders(global::System.Net.Http.Headers.HttpResponseHeaders headers); + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/ISendAsync.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/ISendAsync.cs new file mode 100644 index 000000000000..b843ddab216e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/ISendAsync.cs @@ -0,0 +1,300 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime +{ + using System.Net.Http; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + using System.Collections; + using System.Linq; + + /// + /// The interface for sending an HTTP request across the wire. + /// + public interface ISendAsync + { + Task SendAsync(HttpRequestMessage request, IEventListener callback); + } + + public class SendAsyncTerminalFactory : ISendAsyncTerminalFactory, ISendAsync + { + SendAsync implementation; + + public SendAsyncTerminalFactory(SendAsync implementation) => this.implementation = implementation; + public SendAsyncTerminalFactory(ISendAsync implementation) => this.implementation = implementation.SendAsync; + public ISendAsync Create() => this; + public Task SendAsync(HttpRequestMessage request, IEventListener callback) => implementation(request, callback); + } + + public partial class SendAsyncFactory : ISendAsyncFactory + { + public class Sender : ISendAsync + { + internal ISendAsync next; + internal SendAsyncStep implementation; + + public Task SendAsync(HttpRequestMessage request, IEventListener callback) => implementation(request, callback, next); + } + SendAsyncStep implementation; + + public SendAsyncFactory(SendAsyncStep implementation) => this.implementation = implementation; + public ISendAsync Create(ISendAsync next) => new Sender { next = next, implementation = implementation }; + + } + + public class HttpClientFactory : ISendAsyncTerminalFactory, ISendAsync + { + HttpClient client; + public HttpClientFactory() : this(new HttpClient()) + { + } + public HttpClientFactory(HttpClient client) => this.client = client; + public ISendAsync Create() => this; + + public Task SendAsync(HttpRequestMessage request, IEventListener callback) => client.SendAsync(request, HttpCompletionOption.ResponseHeadersRead, callback.Token); + } + + public interface ISendAsyncFactory + { + ISendAsync Create(ISendAsync next); + } + + public interface ISendAsyncTerminalFactory + { + ISendAsync Create(); + } + + public partial class HttpPipeline : ISendAsync + { + private ISendAsync pipeline; + private ISendAsyncTerminalFactory terminal; + private List steps = new List(); + + public HttpPipeline() : this(new HttpClientFactory()) + { + } + + public HttpPipeline(ISendAsyncTerminalFactory terminalStep) + { + if (terminalStep == null) + { + throw new System.ArgumentNullException(nameof(terminalStep), "Terminal Step Factory in HttpPipeline may not be null"); + } + TerminalFactory = terminalStep; + } + + /// + /// Returns an HttpPipeline with the current state of this pipeline. + /// + public HttpPipeline Clone() => new HttpPipeline(terminal) { steps = this.steps.ToList(), pipeline = this.pipeline }; + + public ISendAsyncTerminalFactory TerminalFactory + { + get => terminal; + set + { + if (value == null) + { + throw new System.ArgumentNullException("TerminalFactory in HttpPipeline may not be null"); + } + terminal = value; + } + } + + public ISendAsync Pipeline + { + get + { + // if the pipeline has been created and not invalidated, return it. + if (this.pipeline != null) + { + return this.pipeline; + } + + // create the pipeline from scratch. + var next = terminal.Create(); + foreach (var factory in steps) + { + // skip factories that return null. + next = factory.Create(next) ?? next; + } + return this.pipeline = next; + } + } + + public int Count => steps.Count; + + public HttpPipeline Prepend(ISendAsyncFactory item) + { + if (item != null) + { + steps.Add(item); + pipeline = null; + } + return this; + } + + public HttpPipeline Append(SendAsyncStep item) + { + if (item != null) + { + Append(new SendAsyncFactory(item)); + } + return this; + } + + public HttpPipeline Prepend(SendAsyncStep item) + { + if (item != null) + { + Prepend(new SendAsyncFactory(item)); + } + return this; + } + public HttpPipeline Append(IEnumerable items) + { + if (items != null) + { + foreach (var item in items) + { + Append(new SendAsyncFactory(item)); + } + } + return this; + } + + public HttpPipeline Prepend(IEnumerable items) + { + if (items != null) + { + foreach (var item in items) + { + Prepend(new SendAsyncFactory(item)); + } + } + return this; + } + + public HttpPipeline Append(ISendAsyncFactory item) + { + if (item != null) + { + steps.Insert(0, item); + pipeline = null; + } + return this; + } + public HttpPipeline Prepend(IEnumerable items) + { + if (items != null) + { + foreach (var item in items) + { + Prepend(item); + } + } + return this; + } + + public HttpPipeline Append(IEnumerable items) + { + if (items != null) + { + foreach (var item in items) + { + Append(item); + } + } + return this; + } + + // you can use this as the ISendAsync Implementation + public Task SendAsync(HttpRequestMessage request, IEventListener callback) => Pipeline.SendAsync(request, callback); + } + + internal static partial class Extensions + { + internal static HttpRequestMessage CloneAndDispose(this HttpRequestMessage original, System.Uri requestUri = null, System.Net.Http.HttpMethod method = null) + { + using (original) + { + return original.Clone(requestUri, method); + } + } + + internal static Task CloneWithContentAndDispose(this HttpRequestMessage original, System.Uri requestUri = null, System.Net.Http.HttpMethod method = null) + { + using (original) + { + return original.CloneWithContent(requestUri, method); + } + } + + /// + /// Clones an HttpRequestMessage (without the content) + /// + /// Original HttpRequestMessage (Will be diposed before returning) + /// + /// + /// A clone of the HttpRequestMessage + internal static HttpRequestMessage Clone(this HttpRequestMessage original, System.Uri requestUri = null, System.Net.Http.HttpMethod method = null) + { + var clone = new HttpRequestMessage + { + Method = method ?? original.Method, + RequestUri = requestUri ?? original.RequestUri, + Version = original.Version, + }; + + foreach (KeyValuePair prop in original.Properties) + { + clone.Properties.Add(prop); + } + + foreach (KeyValuePair> header in original.Headers) + { + /* + **temporarily skip cloning telemetry related headers** + clone.Headers.TryAddWithoutValidation(header.Key, header.Value); + */ + if (!"x-ms-unique-id".Equals(header.Key) && !"x-ms-client-request-id".Equals(header.Key) && !"CommandName".Equals(header.Key) && !"FullCommandName".Equals(header.Key) && !"ParameterSetName".Equals(header.Key) && !"User-Agent".Equals(header.Key)) + { + clone.Headers.TryAddWithoutValidation(header.Key, header.Value); + } + } + + return clone; + } + + /// + /// Clones an HttpRequestMessage (including the content stream and content headers) + /// + /// Original HttpRequestMessage (Will be diposed before returning) + /// + /// + /// A clone of the HttpRequestMessage + internal static async Task CloneWithContent(this HttpRequestMessage original, System.Uri requestUri = null, System.Net.Http.HttpMethod method = null) + { + var clone = original.Clone(requestUri, method); + var stream = new System.IO.MemoryStream(); + if (original.Content != null) + { + await original.Content.CopyToAsync(stream).ConfigureAwait(false); + stream.Position = 0; + clone.Content = new StreamContent(stream); + if (original.Content.Headers != null) + { + foreach (var h in original.Content.Headers) + { + clone.Content.Headers.Add(h.Key, h.Value); + } + } + } + return clone; + } + } +} diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/InfoAttribute.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/InfoAttribute.cs new file mode 100644 index 000000000000..e59496b98468 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/InfoAttribute.cs @@ -0,0 +1,34 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime +{ + using System; + + [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Class)] + public class InfoAttribute : Attribute + { + public bool Required { get; set; } = false; + public bool ReadOnly { get; set; } = false; + public Type[] PossibleTypes { get; set; } = new Type[0]; + public string Description { get; set; } = ""; + public string SerializedName { get; set; } = ""; + } + + [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)] + public class CompleterInfoAttribute : Attribute + { + public string Script { get; set; } = ""; + public string Name { get; set; } = ""; + public string Description { get; set; } = ""; + } + + [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)] + public class DefaultInfoAttribute : Attribute + { + public string Script { get; set; } = ""; + public string Name { get; set; } = ""; + public string Description { get; set; } = ""; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/Iso/IsoDate.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/Iso/IsoDate.cs new file mode 100644 index 000000000000..de54cfe51775 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/Iso/IsoDate.cs @@ -0,0 +1,214 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Text; + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json +{ + internal struct IsoDate + { + internal int Year { get; set; } // 0-3000 + + internal int Month { get; set; } // 1-12 + + internal int Day { get; set; } // 1-31 + + internal int Hour { get; set; } // 0-24 + + internal int Minute { get; set; } // 0-60 (60 is a special case) + + internal int Second { get; set; } // 0-60 (60 is used for leap seconds) + + internal double Millisecond { get; set; } // 0-999.9... + + internal TimeSpan Offset { get; set; } + + internal DateTimeKind Kind { get; set; } + + internal TimeSpan TimeOfDay => new TimeSpan(Hour, Minute, Second); + + internal DateTime ToDateTime() + { + if (Kind == DateTimeKind.Utc || Offset == TimeSpan.Zero) + { + return new DateTime(Year, Month, Day, Hour, Minute, Second, (int)Millisecond, DateTimeKind.Utc); + } + + return ToDateTimeOffset().DateTime; + } + + internal DateTimeOffset ToDateTimeOffset() + { + return new DateTimeOffset( + Year, + Month, + Day, + Hour, + Minute, + Second, + (int)Millisecond, + Offset + ); + } + + internal DateTime ToUtcDateTime() + { + return ToDateTimeOffset().UtcDateTime; + } + + public override string ToString() + { + var sb = new StringBuilder(); + + // yyyy-MM-dd + sb.Append($"{Year}-{Month:00}-{Day:00}"); + + if (TimeOfDay > new TimeSpan(0)) + { + sb.Append($"T{Hour:00}:{Minute:00}"); + + if (TimeOfDay.Seconds > 0) + { + sb.Append($":{Second:00}"); + } + } + + if (Offset.Ticks == 0) + { + sb.Append('Z'); // UTC + } + else + { + if (Offset.Ticks >= 0) + { + sb.Append('+'); + } + + sb.Append($"{Offset.Hours:00}:{Offset.Minutes:00}"); + } + + return sb.ToString(); + } + + internal static IsoDate FromDateTimeOffset(DateTimeOffset date) + { + return new IsoDate { + Year = date.Year, + Month = date.Month, + Day = date.Day, + Hour = date.Hour, + Minute = date.Minute, + Second = date.Second, + Offset = date.Offset, + Kind = date.Offset == TimeSpan.Zero ? DateTimeKind.Utc : DateTimeKind.Unspecified + }; + } + + private static readonly char[] timeSeperators = { ':', '.' }; + + internal static IsoDate Parse(string text) + { + var tzIndex = -1; + var timeIndex = text.IndexOf('T'); + + var builder = new IsoDate { Day = 1, Month = 1 }; + + // TODO: strip the time zone offset off the end + string dateTime = text; + string timeZone = null; + + if (dateTime.IndexOf('Z') > -1) + { + tzIndex = dateTime.LastIndexOf('Z'); + + builder.Kind = DateTimeKind.Utc; + } + else if (dateTime.LastIndexOf('+') > 10) + { + tzIndex = dateTime.LastIndexOf('+'); + } + else if (dateTime.LastIndexOf('-') > 10) + { + tzIndex = dateTime.LastIndexOf('-'); + } + + if (tzIndex > -1) + { + timeZone = dateTime.Substring(tzIndex); + dateTime = dateTime.Substring(0, tzIndex); + } + + string date = (timeIndex == -1) ? dateTime : dateTime.Substring(0, timeIndex); + + var dateParts = date.Split(Seperator.Dash); // '-' + + for (int i = 0; i < dateParts.Length; i++) + { + var part = dateParts[i]; + + switch (i) + { + case 0: builder.Year = int.Parse(part); break; + case 1: builder.Month = int.Parse(part); break; + case 2: builder.Day = int.Parse(part); break; + } + } + + if (timeIndex > -1) + { + string[] timeParts = dateTime.Substring(timeIndex + 1).Split(timeSeperators); + + for (int i = 0; i < timeParts.Length; i++) + { + var part = timeParts[i]; + + switch (i) + { + case 0: builder.Hour = int.Parse(part); break; + case 1: builder.Minute = int.Parse(part); break; + case 2: builder.Second = int.Parse(part); break; + case 3: builder.Millisecond = double.Parse("0." + part) * 1000; break; + } + } + } + + if (timeZone != null && timeZone != "Z") + { + var hours = int.Parse(timeZone.Substring(1, 2)); + var minutes = int.Parse(timeZone.Substring(4, 2)); + + if (timeZone[0] == '-') + { + hours = -hours; + minutes = -minutes; + } + + builder.Offset = new TimeSpan(hours, minutes, 0); + } + + return builder; + } + } + + /* + YYYY # eg 1997 + YYYY-MM # eg 1997-07 + YYYY-MM-DD # eg 1997-07-16 + YYYY-MM-DDThh:mmTZD # eg 1997-07-16T19:20+01:00 + YYYY-MM-DDThh:mm:ssTZD # eg 1997-07-16T19:20:30+01:00 + YYYY-MM-DDThh:mm:ss.sTZD # eg 1997-07-16T19:20:30.45+01:00 + + where: + + YYYY = four-digit year + MM = two-digit month (01=January, etc.) + DD = two-digit day of month (01 through 31) + hh = two digits of hour (00 through 23) (am/pm NOT allowed) + mm = two digits of minute (00 through 59) + ss = two digits of second (00 through 59) + s = one or more digits representing a decimal fraction of a second + TZD = time zone designator (Z or +hh:mm or -hh:mm) + */ +} diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/JsonType.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/JsonType.cs new file mode 100644 index 000000000000..81c6051f1338 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/JsonType.cs @@ -0,0 +1,18 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json +{ + internal enum JsonType + { + Null = 0, + Object = 1, + Array = 2, + Binary = 3, + Boolean = 4, + Date = 5, + Number = 6, + String = 7 + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/MessageAttribute.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/MessageAttribute.cs new file mode 100644 index 000000000000..deee7c1fe356 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/MessageAttribute.cs @@ -0,0 +1,360 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.generated.runtime.Properties; + using System; + using System.Collections.Generic; + using System.Globalization; + using System.Linq; + using System.Management.Automation; + using System.Text; + + [AttributeUsage(AttributeTargets.All)] + public class GenericBreakingChangeAttribute : Attribute + { + private string _message; + //A dexcription of what the change is about, non mandatory + public string ChangeDescription { get; set; } = null; + + //The version the change is effective from, non mandatory + public string DeprecateByVersion { get; } + public bool DeprecateByVersionSet { get; } = false; + + //The date on which the change comes in effect + public DateTime ChangeInEfectByDate { get; } + public bool ChangeInEfectByDateSet { get; } = false; + + //Old way of calling the cmdlet + public string OldWay { get; set; } + //New way fo calling the cmdlet + public string NewWay { get; set; } + + public GenericBreakingChangeAttribute(string message) + { + _message = message; + } + + public GenericBreakingChangeAttribute(string message, string deprecateByVersion) + { + _message = message; + this.DeprecateByVersion = deprecateByVersion; + this.DeprecateByVersionSet = true; + } + + public GenericBreakingChangeAttribute(string message, string deprecateByVersion, string changeInEfectByDate) + { + _message = message; + this.DeprecateByVersion = deprecateByVersion; + this.DeprecateByVersionSet = true; + + if (DateTime.TryParse(changeInEfectByDate, new CultureInfo("en-US"), DateTimeStyles.None, out DateTime result)) + { + this.ChangeInEfectByDate = result; + this.ChangeInEfectByDateSet = true; + } + } + + public DateTime getInEffectByDate() + { + return this.ChangeInEfectByDate.Date; + } + + + /** + * This function prints out the breaking change message for the attribute on the cmdline + * */ + public void PrintCustomAttributeInfo(Action writeOutput) + { + + if (!GetAttributeSpecificMessage().StartsWith(Environment.NewLine)) + { + writeOutput(Environment.NewLine); + } + writeOutput(string.Format(Resources.BreakingChangesAttributesDeclarationMessage, GetAttributeSpecificMessage())); + + + if (!string.IsNullOrWhiteSpace(ChangeDescription)) + { + writeOutput(string.Format(Resources.BreakingChangesAttributesChangeDescriptionMessage, this.ChangeDescription)); + } + + if (ChangeInEfectByDateSet) + { + writeOutput(string.Format(Resources.BreakingChangesAttributesInEffectByDateMessage, this.ChangeInEfectByDate.ToString("d"))); + } + + if (DeprecateByVersionSet) + { + writeOutput(string.Format(Resources.BreakingChangesAttributesInEffectByVersion, this.DeprecateByVersion)); + } + + if (OldWay != null && NewWay != null) + { + writeOutput(string.Format(Resources.BreakingChangesAttributesUsageChangeMessageConsole, OldWay, NewWay)); + } + } + + public virtual bool IsApplicableToInvocation(InvocationInfo invocation) + { + return true; + } + + protected virtual string GetAttributeSpecificMessage() + { + return _message; + } + } + + [AttributeUsage(AttributeTargets.All)] + public class CmdletBreakingChangeAttribute : GenericBreakingChangeAttribute + { + + public string ReplacementCmdletName { get; set; } + + public CmdletBreakingChangeAttribute() : + base(string.Empty) + { + } + + public CmdletBreakingChangeAttribute(string deprecateByVersione) : + base(string.Empty, deprecateByVersione) + { + } + + public CmdletBreakingChangeAttribute(string deprecateByVersion, string changeInEfectByDate) : + base(string.Empty, deprecateByVersion, changeInEfectByDate) + { + } + + protected override string GetAttributeSpecificMessage() + { + if (string.IsNullOrWhiteSpace(ReplacementCmdletName)) + { + return Resources.BreakingChangesAttributesCmdLetDeprecationMessageNoReplacement; + } + else + { + return string.Format(Resources.BreakingChangesAttributesCmdLetDeprecationMessageWithReplacement, ReplacementCmdletName); + } + } + } + + [AttributeUsage(AttributeTargets.All)] + public class ParameterSetBreakingChangeAttribute : GenericBreakingChangeAttribute + { + public string[] ChangedParameterSet { set; get; } + public ParameterSetBreakingChangeAttribute(string[] changedParameterSet) : + base(string.Empty) + { + ChangedParameterSet = changedParameterSet; + } + + public ParameterSetBreakingChangeAttribute(string[] changedParameterSet, string deprecateByVersione) : + base(string.Empty, deprecateByVersione) + { + ChangedParameterSet = changedParameterSet; + } + + public ParameterSetBreakingChangeAttribute(string[] changedParameterSet, string deprecateByVersion, string changeInEfectByDate) : + base(string.Empty, deprecateByVersion, changeInEfectByDate) + { + ChangedParameterSet = changedParameterSet; + } + + protected override string GetAttributeSpecificMessage() + { + + return Resources.BreakingChangesAttributesParameterSetDeprecationMessageNoReplacement; + + } + + public bool IsApplicableToInvocation(InvocationInfo invocation, string parameterSetName) + { + if (ChangedParameterSet != null) + return ChangedParameterSet.Contains(parameterSetName); + return false; + } + + } + + [AttributeUsage(AttributeTargets.All)] + public class PreviewMessageAttribute : Attribute + { + public string _message; + + public PreviewMessageAttribute() + { + this._message = Resources.PreviewCmdletMessage; + } + + public PreviewMessageAttribute(string message) + { + this._message = message; + } + + public void PrintCustomAttributeInfo(System.Management.Automation.PSCmdlet psCmdlet) + { + psCmdlet.WriteWarning(this._message); + } + + public virtual bool IsApplicableToInvocation(InvocationInfo invocation) + { + return true; + } + } + + [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)] + public class ParameterBreakingChangeAttribute : GenericBreakingChangeAttribute + { + public string NameOfParameterChanging { get; } + + public string ReplaceMentCmdletParameterName { get; set; } = null; + + public bool IsBecomingMandatory { get; set; } = false; + + public String OldParamaterType { get; set; } + + public String NewParameterType { get; set; } + + public ParameterBreakingChangeAttribute(string nameOfParameterChanging) : + base(string.Empty) + { + this.NameOfParameterChanging = nameOfParameterChanging; + } + + public ParameterBreakingChangeAttribute(string nameOfParameterChanging, string deprecateByVersion) : + base(string.Empty, deprecateByVersion) + { + this.NameOfParameterChanging = nameOfParameterChanging; + } + + public ParameterBreakingChangeAttribute(string nameOfParameterChanging, string deprecateByVersion, string changeInEfectByDate) : + base(string.Empty, deprecateByVersion, changeInEfectByDate) + { + this.NameOfParameterChanging = nameOfParameterChanging; + } + + protected override string GetAttributeSpecificMessage() + { + StringBuilder message = new StringBuilder(); + if (!string.IsNullOrWhiteSpace(ReplaceMentCmdletParameterName)) + { + if (IsBecomingMandatory) + { + message.Append(string.Format(Resources.BreakingChangeAttributeParameterReplacedMandatory, NameOfParameterChanging, ReplaceMentCmdletParameterName)); + } + else + { + message.Append(string.Format(Resources.BreakingChangeAttributeParameterReplaced, NameOfParameterChanging, ReplaceMentCmdletParameterName)); + } + } + else + { + if (IsBecomingMandatory) + { + message.Append(string.Format(Resources.BreakingChangeAttributeParameterMandatoryNow, NameOfParameterChanging)); + } + else + { + message.Append(string.Format(Resources.BreakingChangeAttributeParameterChanging, NameOfParameterChanging)); + } + } + + //See if the type of the param is changing + if (OldParamaterType != null && !string.IsNullOrWhiteSpace(NewParameterType)) + { + message.Append(string.Format(Resources.BreakingChangeAttributeParameterTypeChange, OldParamaterType, NewParameterType)); + } + return message.ToString(); + } + + /// + /// See if the bound parameters contain the current parameter, if they do + /// then the attribbute is applicable + /// If the invocationInfo is null we return true + /// + /// + /// bool + public override bool IsApplicableToInvocation(InvocationInfo invocationInfo) + { + bool? applicable = invocationInfo == null ? true : invocationInfo.BoundParameters?.Keys?.Contains(this.NameOfParameterChanging); + return applicable.HasValue ? applicable.Value : false; + } + } + + [AttributeUsage(AttributeTargets.All)] + public class OutputBreakingChangeAttribute : GenericBreakingChangeAttribute + { + public string DeprecatedCmdLetOutputType { get; } + + //This is still a String instead of a Type as this + //might be undefined at the time of adding the attribute + public string ReplacementCmdletOutputType { get; set; } + + public string[] DeprecatedOutputProperties { get; set; } + + public string[] NewOutputProperties { get; set; } + + public OutputBreakingChangeAttribute(string deprecatedCmdletOutputType) : + base(string.Empty) + { + this.DeprecatedCmdLetOutputType = deprecatedCmdletOutputType; + } + + public OutputBreakingChangeAttribute(string deprecatedCmdletOutputType, string deprecateByVersion) : + base(string.Empty, deprecateByVersion) + { + this.DeprecatedCmdLetOutputType = deprecatedCmdletOutputType; + } + + public OutputBreakingChangeAttribute(string deprecatedCmdletOutputType, string deprecateByVersion, string changeInEfectByDate) : + base(string.Empty, deprecateByVersion, changeInEfectByDate) + { + this.DeprecatedCmdLetOutputType = deprecatedCmdletOutputType; + } + + protected override string GetAttributeSpecificMessage() + { + StringBuilder message = new StringBuilder(); + + //check for the deprecation scenario + if (string.IsNullOrWhiteSpace(ReplacementCmdletOutputType) && NewOutputProperties == null && DeprecatedOutputProperties == null && string.IsNullOrWhiteSpace(ChangeDescription)) + { + message.Append(string.Format(Resources.BreakingChangesAttributesCmdLetOutputTypeDeprecated, DeprecatedCmdLetOutputType)); + } + else + { + if (!string.IsNullOrWhiteSpace(ReplacementCmdletOutputType)) + { + message.Append(string.Format(Resources.BreakingChangesAttributesCmdLetOutputChange1, DeprecatedCmdLetOutputType, ReplacementCmdletOutputType)); + } + else + { + message.Append(string.Format(Resources.BreakingChangesAttributesCmdLetOutputChange2, DeprecatedCmdLetOutputType)); + } + + if (DeprecatedOutputProperties != null && DeprecatedOutputProperties.Length > 0) + { + message.Append(Resources.BreakingChangesAttributesCmdLetOutputPropertiesRemoved); + foreach (string property in DeprecatedOutputProperties) + { + message.Append(" '" + property + "'"); + } + } + + if (NewOutputProperties != null && NewOutputProperties.Length > 0) + { + message.Append(Resources.BreakingChangesAttributesCmdLetOutputPropertiesAdded); + foreach (string property in NewOutputProperties) + { + message.Append(" '" + property + "'"); + } + } + } + return message.ToString(); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/MessageAttributeHelper.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/MessageAttributeHelper.cs new file mode 100644 index 000000000000..bbf50a950b8b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/MessageAttributeHelper.cs @@ -0,0 +1,161 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime +{ + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.generated.runtime.Properties; + using System; + using System.Collections.Generic; + using System.Linq; + using System.Management.Automation; + using System.Reflection; + using System.Text; + using System.Threading.Tasks; + public class MessageAttributeHelper + { + public const string BREAKING_CHANGE_ATTRIBUTE_INFORMATION_LINK = "https://aka.ms/azps-changewarnings"; + public const string SUPPRESS_ERROR_OR_WARNING_MESSAGE_ENV_VARIABLE_NAME = "SuppressAzurePowerShellBreakingChangeWarnings"; + + /** + * This function takes in a CommandInfo (CmdletInfo or FunctionInfo) + * And reads all the deprecation attributes attached to it + * Prints a message on the cmdline For each of the attribute found + * + * the boundParameterNames is a list of parameters bound to the cmdlet at runtime, + * We only process the Parameter beaking change attributes attached only params listed in this list (if present) + * */ + public static void ProcessCustomAttributesAtRuntime(CommandInfo commandInfo, InvocationInfo invocationInfo, String parameterSet, System.Management.Automation.PSCmdlet psCmdlet) + { + bool supressWarningOrError = false; + + try + { + supressWarningOrError = bool.Parse(System.Environment.GetEnvironmentVariable(SUPPRESS_ERROR_OR_WARNING_MESSAGE_ENV_VARIABLE_NAME)); + } + catch (Exception) + { + //no action + } + + if (supressWarningOrError) + { + //Do not process the attributes at runtime... The env variable to override the warning messages is set + return; + } + + List attributes = new List(GetAllBreakingChangeAttributesInType(commandInfo, invocationInfo, parameterSet)); + StringBuilder sb = new StringBuilder(); + Action appendBreakingChangeInfo = (string s) => sb.Append(s); + + if (attributes != null && attributes.Count > 0) + { + appendBreakingChangeInfo(string.Format(Resources.BreakingChangesAttributesHeaderMessage, commandInfo.Name.Split('_')[0])); + + foreach (GenericBreakingChangeAttribute attribute in attributes) + { + attribute.PrintCustomAttributeInfo(appendBreakingChangeInfo); + } + + appendBreakingChangeInfo(string.Format(Resources.BreakingChangesAttributesFooterMessage, BREAKING_CHANGE_ATTRIBUTE_INFORMATION_LINK)); + + psCmdlet.WriteWarning(sb.ToString()); + } + + List previewAttributes = new List(GetAllPreviewAttributesInType(commandInfo, invocationInfo)); + + if (previewAttributes != null && previewAttributes.Count > 0) + { + foreach (PreviewMessageAttribute attribute in previewAttributes) + { + attribute.PrintCustomAttributeInfo(psCmdlet); + } + } + } + + + /** + * This function takes in a CommandInfo (CmdletInfo or FunctionInfo) + * And returns all the deprecation attributes attached to it + * + * the boundParameterNames is a list of parameters bound to the cmdlet at runtime, + * We only process the Parameter beaking change attributes attached only params listed in this list (if present) + **/ + private static IEnumerable GetAllBreakingChangeAttributesInType(CommandInfo commandInfo, InvocationInfo invocationInfo, String parameterSet) + { + List attributeList = new List(); + + if (commandInfo.GetType() == typeof(CmdletInfo)) + { + var type = ((CmdletInfo)commandInfo).ImplementingType; + attributeList.AddRange(type.GetCustomAttributes(typeof(GenericBreakingChangeAttribute), false).Cast()); + + foreach (MethodInfo m in type.GetRuntimeMethods()) + { + attributeList.AddRange((m.GetCustomAttributes(typeof(GenericBreakingChangeAttribute), false).Cast())); + } + + foreach (FieldInfo f in type.GetRuntimeFields()) + { + attributeList.AddRange(f.GetCustomAttributes(typeof(GenericBreakingChangeAttribute), false).Cast()); + } + + foreach (PropertyInfo p in type.GetRuntimeProperties()) + { + attributeList.AddRange(p.GetCustomAttributes(typeof(GenericBreakingChangeAttribute), false).Cast()); + } + } + else if (commandInfo.GetType() == typeof(FunctionInfo)) + { + attributeList.AddRange(((FunctionInfo)commandInfo).ScriptBlock.Attributes.Where(e => typeof(GenericBreakingChangeAttribute).IsAssignableFrom(e.GetType())).Cast()); + foreach (var parameter in ((FunctionInfo)commandInfo).Parameters) + { + attributeList.AddRange(parameter.Value.Attributes.Where(e => typeof(GenericBreakingChangeAttribute).IsAssignableFrom(e.GetType())).Cast()); + } + } + return invocationInfo == null ? attributeList : attributeList.Where(e => e.GetType() == typeof(ParameterSetBreakingChangeAttribute) ? ((ParameterSetBreakingChangeAttribute)e).IsApplicableToInvocation(invocationInfo, parameterSet) : e.IsApplicableToInvocation(invocationInfo)); + } + private static IEnumerable GetAllPreviewAttributesInType(CommandInfo commandInfo, InvocationInfo invocationInfo) + { + List attributeList = new List(); + if (commandInfo.GetType() == typeof(CmdletInfo)) + { + var type = ((CmdletInfo)commandInfo).ImplementingType; + attributeList.AddRange(type.GetCustomAttributes(typeof(PreviewMessageAttribute), false).Cast()); + + foreach (MethodInfo m in type.GetRuntimeMethods()) + { + attributeList.AddRange((m.GetCustomAttributes(typeof(PreviewMessageAttribute), false).Cast())); + } + + foreach (FieldInfo f in type.GetRuntimeFields()) + { + attributeList.AddRange(f.GetCustomAttributes(typeof(PreviewMessageAttribute), false).Cast()); + } + + foreach (PropertyInfo p in type.GetRuntimeProperties()) + { + attributeList.AddRange(p.GetCustomAttributes(typeof(PreviewMessageAttribute), false).Cast()); + } + } + else if (commandInfo.GetType() == typeof(FunctionInfo)) + { + attributeList.AddRange(((FunctionInfo)commandInfo).ScriptBlock.Attributes.Where(e => typeof(PreviewMessageAttribute).IsAssignableFrom(e.GetType())).Cast()); + foreach (var parameter in ((FunctionInfo)commandInfo).Parameters) + { + attributeList.AddRange(parameter.Value.Attributes.Where(e => typeof(PreviewMessageAttribute).IsAssignableFrom(e.GetType())).Cast()); + } + } + return invocationInfo == null ? attributeList : attributeList.Where(e => e.IsApplicableToInvocation(invocationInfo)); + } + } +} diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/Method.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/Method.cs new file mode 100644 index 000000000000..616a1a94f8cb --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/Method.cs @@ -0,0 +1,19 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime +{ + internal static class Method + { + internal static System.Net.Http.HttpMethod Get = System.Net.Http.HttpMethod.Get; + internal static System.Net.Http.HttpMethod Put = System.Net.Http.HttpMethod.Put; + internal static System.Net.Http.HttpMethod Head = System.Net.Http.HttpMethod.Head; + internal static System.Net.Http.HttpMethod Post = System.Net.Http.HttpMethod.Post; + internal static System.Net.Http.HttpMethod Delete = System.Net.Http.HttpMethod.Delete; + internal static System.Net.Http.HttpMethod Options = System.Net.Http.HttpMethod.Options; + internal static System.Net.Http.HttpMethod Trace = System.Net.Http.HttpMethod.Trace; + internal static System.Net.Http.HttpMethod Patch = new System.Net.Http.HttpMethod("PATCH"); + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/Models/JsonMember.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/Models/JsonMember.cs new file mode 100644 index 000000000000..f38542409ab0 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/Models/JsonMember.cs @@ -0,0 +1,83 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Reflection; +using System.Runtime.Serialization; + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json +{ + + + internal sealed class JsonMember + { + private readonly TypeDetails type; + + private readonly Func getter; + private readonly Action setter; + + internal JsonMember(PropertyInfo property, int defaultOrder) + { + getter = property.GetValue; + setter = property.SetValue; + + var dataMember = property.GetCustomAttribute(); + + Name = dataMember?.Name ?? property.Name; + Order = dataMember?.Order ?? defaultOrder; + EmitDefaultValue = dataMember?.EmitDefaultValue ?? true; + + this.type = TypeDetails.Get(property.PropertyType); + + CanRead = property.CanRead; + } + + internal JsonMember(FieldInfo field, int defaultOrder) + { + getter = field.GetValue; + setter = field.SetValue; + + var dataMember = field.GetCustomAttribute(); + + Name = dataMember?.Name ?? field.Name; + Order = dataMember?.Order ?? defaultOrder; + EmitDefaultValue = dataMember?.EmitDefaultValue ?? true; + + this.type = TypeDetails.Get(field.FieldType); + + CanRead = true; + } + + internal string Name { get; } + + internal int Order { get; } + + internal TypeDetails TypeDetails => type; + + internal Type Type => type.NonNullType; + + internal bool IsList => type.IsList; + + // Arrays, Sets, ... + internal Type ElementType => type.ElementType; + + internal IJsonConverter Converter => type.JsonConverter; + + internal bool EmitDefaultValue { get; } + + internal bool IsStringLike => type.IsStringLike; + + internal object DefaultValue => type.DefaultValue; + + internal bool CanRead { get; } + + #region Helpers + + internal object GetValue(object instance) => getter(instance); + + internal void SetValue(object instance, object value) => setter(instance, value); + + #endregion + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/Models/JsonModel.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/Models/JsonModel.cs new file mode 100644 index 000000000000..02f717c3b1a3 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/Models/JsonModel.cs @@ -0,0 +1,89 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.Runtime.Serialization; +using System.Reflection; + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json +{ + internal class JsonModel + { + private Dictionary map; + private readonly object _sync = new object(); + + private JsonModel(Type type, List members) + { + Type = type ?? throw new ArgumentNullException(nameof(type)); + Members = members ?? throw new ArgumentNullException(nameof(members)); + } + + internal string Name => Type.Name; + + internal Type Type { get; } + + internal List Members { get; } + + internal JsonMember this[string name] + { + get + { + if (map == null) + { + lock (_sync) + { + if (map == null) + { + map = new Dictionary(); + + foreach (JsonMember m in Members) + { + map[m.Name.ToLower()] = m; + } + } + } + } + + + map.TryGetValue(name.ToLower(), out JsonMember member); + + return member; + } + } + + internal static JsonModel FromType(Type type) + { + var members = new List(); + + int i = 0; + + // BindingFlags.Instance | BindingFlags.Public + + foreach (var member in type.GetFields()) + { + if (member.IsStatic) continue; + + if (member.IsDefined(typeof(IgnoreDataMemberAttribute))) continue; + + members.Add(new JsonMember(member, i)); + + i++; + } + + foreach (var member in type.GetProperties(BindingFlags.Public | BindingFlags.Instance)) + { + if (member.IsDefined(typeof(IgnoreDataMemberAttribute))) continue; + + members.Add(new JsonMember(member, i)); + + i++; + } + + members.Sort((a, b) => a.Order.CompareTo(b.Order)); // inline sort + + return new JsonModel(type, members); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/Models/JsonModelCache.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/Models/JsonModelCache.cs new file mode 100644 index 000000000000..3bceef974a61 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/Models/JsonModelCache.cs @@ -0,0 +1,19 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Runtime.CompilerServices; + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json +{ + internal static class JsonModelCache + { + private static readonly ConditionalWeakTable cache + = new ConditionalWeakTable(); + + internal static JsonModel Get(Type type) => cache.GetValue(type, Create); + + private static JsonModel Create(Type type) => JsonModel.FromType(type); + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/Nodes/Collections/JsonArray.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/Nodes/Collections/JsonArray.cs new file mode 100644 index 000000000000..a7f97526354a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/Nodes/Collections/JsonArray.cs @@ -0,0 +1,65 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json +{ + public abstract partial class JsonArray : JsonNode, IEnumerable + { + internal override JsonType Type => JsonType.Array; + + internal abstract JsonType? ElementType { get; } + + public abstract int Count { get; } + + internal virtual bool IsSet => false; + + internal bool IsEmpty => Count == 0; + + #region IEnumerable + + IEnumerator IEnumerable.GetEnumerator() + { + throw new NotImplementedException(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + throw new NotImplementedException(); + } + + #endregion + + #region Static Helpers + + internal static JsonArray Create(short[] values) + => new XImmutableArray(values); + + internal static JsonArray Create(int[] values) + => new XImmutableArray(values); + + internal static JsonArray Create(long[] values) + => new XImmutableArray(values); + + internal static JsonArray Create(decimal[] values) + => new XImmutableArray(values); + + internal static JsonArray Create(float[] values) + => new XImmutableArray(values); + + internal static JsonArray Create(string[] values) + => new XImmutableArray(values); + + internal static JsonArray Create(XBinary[] values) + => new XImmutableArray(values); + + #endregion + + internal static new JsonArray Parse(string text) + => (JsonArray)JsonNode.Parse(text); + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/Nodes/Collections/XImmutableArray.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/Nodes/Collections/XImmutableArray.cs new file mode 100644 index 000000000000..aa536b9c2a09 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/Nodes/Collections/XImmutableArray.cs @@ -0,0 +1,62 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json +{ + internal sealed class XImmutableArray : JsonArray, IEnumerable + { + private readonly T[] values; + private readonly JsonType elementType; + private readonly TypeCode elementCode; + + internal XImmutableArray(T[] values) + { + this.values = values ?? throw new ArgumentNullException(nameof(values)); + this.elementCode = System.Type.GetTypeCode(typeof(T)); + this.elementType = XHelper.GetElementType(this.elementCode); + } + + public override JsonNode this[int index] => + XHelper.Create(elementType, elementCode, values[index]); + + internal override JsonType? ElementType => elementType; + + public override int Count => values.Length; + + public bool IsReadOnly => true; + + #region IEnumerable Members + + IEnumerator IEnumerable.GetEnumerator() + { + foreach (T value in values) + { + yield return XHelper.Create(elementType, elementCode, value); + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + foreach (T value in values) + { + yield return XHelper.Create(elementType, elementCode, value); + } + } + + #endregion + + #region Static Constructor + + internal XImmutableArray Create(T[] items) + { + return new XImmutableArray(items); + } + + #endregion + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/Nodes/Collections/XList.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/Nodes/Collections/XList.cs new file mode 100644 index 000000000000..ae5ff5fc141e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/Nodes/Collections/XList.cs @@ -0,0 +1,64 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json +{ + internal sealed class XList : JsonArray, IEnumerable + { + private readonly IList values; + private readonly JsonType elementType; + private readonly TypeCode elementCode; + + internal XList(IList values) + { + this.values = values ?? throw new ArgumentNullException(nameof(values)); + this.elementCode = System.Type.GetTypeCode(typeof(T)); + this.elementType = XHelper.GetElementType(this.elementCode); + } + + public override JsonNode this[int index] => + XHelper.Create(elementType, elementCode, values[index]); + + internal override JsonType? ElementType => elementType; + + public override int Count => values.Count; + + public bool IsReadOnly => values.IsReadOnly; + + #region IList + + public void Add(T value) + { + values.Add(value); + } + + public bool Contains(T value) => values.Contains(value); + + #endregion + + #region IEnumerable Members + + IEnumerator IEnumerable.GetEnumerator() + { + foreach (var value in values) + { + yield return XHelper.Create(elementType, elementCode, value); + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + foreach (var value in values) + { + yield return XHelper.Create(elementType, elementCode, value); + } + } + + #endregion + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/Nodes/Collections/XNodeArray.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/Nodes/Collections/XNodeArray.cs new file mode 100644 index 000000000000..78f7d1a827f1 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/Nodes/Collections/XNodeArray.cs @@ -0,0 +1,68 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System.Collections; +using System.Collections.Generic; + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json +{ + public sealed partial class XNodeArray : JsonArray, ICollection + { + private readonly List items; + + internal XNodeArray() + { + items = new List(); + } + + internal XNodeArray(params JsonNode[] values) + { + items = new List(values); + } + + public override JsonNode this[int index] => items[index]; + + internal override JsonType? ElementType => null; + + public bool IsReadOnly => false; + + public override int Count => items.Count; + + #region ICollection Members + + public void Add(JsonNode item) + { + items.Add(item); + } + + void ICollection.Clear() + { + items.Clear(); + } + + public bool Contains(JsonNode item) => items.Contains(item); + + void ICollection.CopyTo(JsonNode[] array, int arrayIndex) + { + items.CopyTo(array, arrayIndex); + } + + public bool Remove(JsonNode item) + { + return items.Remove(item); + } + + #endregion + + #region IEnumerable Members + + IEnumerator IEnumerable.GetEnumerator() + => items.GetEnumerator(); + + IEnumerator IEnumerable.GetEnumerator() + => items.GetEnumerator(); + + #endregion + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/Nodes/Collections/XSet.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/Nodes/Collections/XSet.cs new file mode 100644 index 000000000000..e275a9e51dad --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/Nodes/Collections/XSet.cs @@ -0,0 +1,60 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json +{ + internal sealed class XSet : JsonArray, IEnumerable + { + private readonly HashSet values; + private readonly JsonType elementType; + private readonly TypeCode elementCode; + + internal XSet(IEnumerable values) + : this(new HashSet(values)) + { } + + internal XSet(HashSet values) + { + this.values = values ?? throw new ArgumentNullException(nameof(values)); + this.elementCode = System.Type.GetTypeCode(typeof(T)); + this.elementType = XHelper.GetElementType(this.elementCode); + } + + internal override JsonType Type => JsonType.Array; + + internal override JsonType? ElementType => elementType; + + public bool IsReadOnly => true; + + public override int Count => values.Count; + + internal override bool IsSet => true; + + #region IEnumerable Members + + IEnumerator IEnumerable.GetEnumerator() + { + foreach (var value in values) + { + yield return XHelper.Create(elementType, elementCode, value); + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + foreach (var value in values) + { + yield return XHelper.Create(elementType, elementCode, value); + } + } + + #endregion + + internal HashSet AsHashSet() => values; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/Nodes/JsonBoolean.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/Nodes/JsonBoolean.cs new file mode 100644 index 000000000000..95b0c95ab1cd --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/Nodes/JsonBoolean.cs @@ -0,0 +1,42 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json +{ + internal sealed partial class JsonBoolean : JsonNode + { + internal static readonly JsonBoolean True = new JsonBoolean(true); + internal static readonly JsonBoolean False = new JsonBoolean(false); + + internal JsonBoolean(bool value) + { + Value = value; + } + + internal bool Value { get; } + + internal override JsonType Type => JsonType.Boolean; + + internal static new JsonBoolean Parse(string text) + { + switch (text) + { + case "false": return False; + case "true": return True; + + default: throw new ArgumentException($"Expected true or false. Was {text}."); + } + } + + #region Implicit Casts + + public static implicit operator bool(JsonBoolean data) => data.Value; + + public static implicit operator JsonBoolean(bool data) => new JsonBoolean(data); + + #endregion + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/Nodes/JsonDate.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/Nodes/JsonDate.cs new file mode 100644 index 000000000000..af510b71ad9d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/Nodes/JsonDate.cs @@ -0,0 +1,173 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json +{ + + + internal sealed partial class JsonDate : JsonNode, IEquatable, IComparable + { + internal static bool AssumeUtcWhenKindIsUnspecified = true; + + private readonly DateTimeOffset value; + + internal JsonDate(DateTime value) + { + if (value.Kind == DateTimeKind.Unspecified && AssumeUtcWhenKindIsUnspecified) + { + value = DateTime.SpecifyKind(value, DateTimeKind.Utc); + } + + this.value = value; + } + + internal JsonDate(DateTimeOffset value) + { + this.value = value; + } + + internal override JsonType Type => JsonType.Date; + + #region Helpers + + internal DateTimeOffset ToDateTimeOffset() + { + return value; + } + + internal DateTime ToDateTime() + { + if (value.Offset == TimeSpan.Zero) + { + return value.UtcDateTime; + } + + return value.DateTime; + } + + internal DateTime ToUtcDateTime() => value.UtcDateTime; + + internal int ToUnixTimeSeconds() + { + return (int)value.ToUnixTimeSeconds(); + } + + internal long ToUnixTimeMilliseconds() + { + return (int)value.ToUnixTimeMilliseconds(); + } + + internal string ToIsoString() + { + return IsoDate.FromDateTimeOffset(value).ToString(); + } + + #endregion + + public override string ToString() + { + return ToIsoString(); + } + + internal static new JsonDate Parse(string text) + { + if (text == null) throw new ArgumentNullException(nameof(text)); + + // TODO support: unixtimeseconds.partialseconds + + if (text.Length > 4 && _IsNumber(text)) // UnixTime + { + var date = DateTimeOffset.FromUnixTimeSeconds(long.Parse(text)); + + return new JsonDate(date); + } + else if (text.Length <= 4 || text[4] == '-') // ISO: 2012- + { + return new JsonDate(IsoDate.Parse(text).ToDateTimeOffset()); + } + else + { + // NOT ISO ENCODED + // "Thu, 5 Apr 2012 16:59:01 +0200", + return new JsonDate(DateTimeOffset.Parse(text)); + } + } + + private static bool _IsNumber(string text) + { + foreach (var c in text) + { + if (!char.IsDigit(c)) return false; + } + + return true; + } + + internal static JsonDate FromUnixTime(int seconds) + { + return new JsonDate(DateTimeOffset.FromUnixTimeSeconds(seconds)); + } + + internal static JsonDate FromUnixTime(double seconds) + { + var milliseconds = (long)(seconds * 1000d); + + return new JsonDate(DateTimeOffset.FromUnixTimeMilliseconds(milliseconds)); + } + + #region Implicit Casts + + public static implicit operator DateTimeOffset(JsonDate value) + => value.ToDateTimeOffset(); + + public static implicit operator DateTime(JsonDate value) + => value.ToDateTime(); + + // From Date + public static implicit operator JsonDate(DateTimeOffset value) + { + return new JsonDate(value); + } + + public static implicit operator JsonDate(DateTime value) + { + return new JsonDate(value); + } + + // From String + public static implicit operator JsonDate(string value) + { + return Parse(value); + } + + #endregion + + #region Equality + + public override bool Equals(object obj) + { + return obj is JsonDate date && date.value == this.value; + } + + public bool Equals(JsonDate other) + { + return this.value == other.value; + } + + public override int GetHashCode() => value.GetHashCode(); + + #endregion + + #region IComparable Members + + int IComparable.CompareTo(JsonDate other) + { + return value.CompareTo(other.value); + } + + #endregion + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/Nodes/JsonNode.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/Nodes/JsonNode.cs new file mode 100644 index 000000000000..2e12282a3d9e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/Nodes/JsonNode.cs @@ -0,0 +1,250 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.IO; +using System.Text; + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json +{ + + + public abstract partial class JsonNode + { + internal abstract JsonType Type { get; } + + public virtual JsonNode this[int index] => throw new NotImplementedException(); + + public virtual JsonNode this[string name] + { + get => throw new NotImplementedException(); + set => throw new NotImplementedException(); + } + + #region Type Helpers + + internal bool IsArray => Type == JsonType.Array; + + internal bool IsDate => Type == JsonType.Date; + + internal bool IsObject => Type == JsonType.Object; + + internal bool IsNumber => Type == JsonType.Number; + + internal bool IsNull => Type == JsonType.Null; + + #endregion + + internal void WriteTo(TextWriter textWriter, bool pretty = true) + { + var writer = new JsonWriter(textWriter, pretty); + + writer.WriteNode(this); + } + + internal T As() + where T : new() + => new JsonSerializer().Deseralize((JsonObject)this); + + internal T[] ToArrayOf() + { + return (T[])new JsonSerializer().DeserializeArray(typeof(T[]), (JsonArray)this); + } + + #region ToString Overrides + + public override string ToString() => ToString(pretty: true); + + internal string ToString(bool pretty) + { + var sb = new StringBuilder(); + + using (var writer = new StringWriter(sb)) + { + WriteTo(writer, pretty); + + return sb.ToString(); + } + } + + #endregion + + #region Static Constructors + + internal static JsonNode Parse(string text) + { + return Parse(new SourceReader(new StringReader(text))); + } + + internal static JsonNode Parse(TextReader textReader) + => Parse(new SourceReader(textReader)); + + private static JsonNode Parse(SourceReader sourceReader) + { + using (var parser = new JsonParser(sourceReader)) + { + return parser.ReadNode(); + } + } + + internal static JsonNode FromObject(object instance) + => new JsonSerializer().Serialize(instance); + + #endregion + + #region Implict Casts + + public static implicit operator string(JsonNode node) => node.ToString(); + + #endregion + + #region Explict Casts + + public static explicit operator DateTime(JsonNode node) + { + switch (node.Type) + { + case JsonType.Date: + return ((JsonDate)node).ToDateTime(); + + case JsonType.String: + return JsonDate.Parse(node.ToString()).ToDateTime(); + + case JsonType.Number: + var num = (JsonNumber)node; + + if (num.IsInteger) + { + return DateTimeOffset.FromUnixTimeSeconds(num).UtcDateTime; + } + else + { + return DateTimeOffset.FromUnixTimeMilliseconds((long)((double)num * 1000)).UtcDateTime; + } + } + + throw new ConversionException(node, typeof(DateTime)); + } + + public static explicit operator DateTimeOffset(JsonNode node) + { + switch (node.Type) + { + case JsonType.Date : return ((JsonDate)node).ToDateTimeOffset(); + case JsonType.String : return JsonDate.Parse(node.ToString()).ToDateTimeOffset(); + + case JsonType.Number: + var num = (JsonNumber)node; + + if (num.IsInteger) + { + return DateTimeOffset.FromUnixTimeSeconds(num); + } + else + { + return DateTimeOffset.FromUnixTimeMilliseconds((long)((double)num * 1000)); + } + + } + + throw new ConversionException(node, typeof(DateTimeOffset)); + } + + public static explicit operator float(JsonNode node) + { + switch (node.Type) + { + case JsonType.Number : return (JsonNumber)node; + case JsonType.String : return float.Parse(node.ToString()); + } + + throw new ConversionException(node, typeof(float)); + } + + public static explicit operator double(JsonNode node) + { + switch (node.Type) + { + case JsonType.Number : return (JsonNumber)node; + case JsonType.String : return double.Parse(node.ToString()); + } + + throw new ConversionException(node, typeof(double)); + } + + public static explicit operator decimal(JsonNode node) + { + switch (node.Type) + { + case JsonType.Number: return (JsonNumber)node; + case JsonType.String: return decimal.Parse(node.ToString()); + } + + throw new ConversionException(node, typeof(decimal)); + } + + public static explicit operator Guid(JsonNode node) + => new Guid(node.ToString()); + + public static explicit operator short(JsonNode node) + { + switch (node.Type) + { + case JsonType.Number : return (JsonNumber)node; + case JsonType.String : return short.Parse(node.ToString()); + } + + throw new ConversionException(node, typeof(short)); + } + + public static explicit operator int(JsonNode node) + { + switch (node.Type) + { + case JsonType.Number : return (JsonNumber)node; + case JsonType.String : return int.Parse(node.ToString()); + } + + throw new ConversionException(node, typeof(int)); + } + + public static explicit operator long(JsonNode node) + { + switch (node.Type) + { + case JsonType.Number: return (JsonNumber)node; + case JsonType.String: return long.Parse(node.ToString()); + } + + throw new ConversionException(node, typeof(long)); + } + + public static explicit operator bool(JsonNode node) + => ((JsonBoolean)node).Value; + + public static explicit operator ushort(JsonNode node) + => (JsonNumber)node; + + public static explicit operator uint(JsonNode node) + => (JsonNumber)node; + + public static explicit operator ulong(JsonNode node) + => (JsonNumber)node; + + public static explicit operator TimeSpan(JsonNode node) + => TimeSpan.Parse(node.ToString()); + + public static explicit operator Uri(JsonNode node) + { + if (node.Type == JsonType.String) + { + return new Uri(node.ToString()); + } + + throw new ConversionException(node, typeof(Uri)); + } + + #endregion + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/Nodes/JsonNumber.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/Nodes/JsonNumber.cs new file mode 100644 index 000000000000..354ff5992cf2 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/Nodes/JsonNumber.cs @@ -0,0 +1,109 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json +{ + public sealed partial class JsonNumber : JsonNode + { + private readonly string value; + private readonly bool overflows = false; + + internal JsonNumber(string value) + { + this.value = value ?? throw new ArgumentNullException(nameof(value)); + } + + internal JsonNumber(int value) + { + this.value = value.ToString(); + } + + internal JsonNumber(long value) + { + this.value = value.ToString(); + + if (value > 9007199254740991) + { + overflows = true; + } + } + + internal JsonNumber(float value) + { + this.value = value.ToString(System.Globalization.CultureInfo.InvariantCulture); + } + + internal JsonNumber(double value) + { + this.value = value.ToString(System.Globalization.CultureInfo.InvariantCulture); + } + + internal override JsonType Type => JsonType.Number; + + internal string Value => value; + + #region Helpers + + internal bool Overflows => overflows; + + internal bool IsInteger => !value.Contains("."); + + internal bool IsFloat => value.Contains("."); + + #endregion + + #region Casting + + public static implicit operator byte(JsonNumber number) + => byte.Parse(number.Value); + + public static implicit operator short(JsonNumber number) + => short.Parse(number.Value); + + public static implicit operator int(JsonNumber number) + => int.Parse(number.Value); + + public static implicit operator long(JsonNumber number) + => long.Parse(number.value); + + public static implicit operator UInt16(JsonNumber number) + => ushort.Parse(number.Value); + + public static implicit operator UInt32(JsonNumber number) + => uint.Parse(number.Value); + + public static implicit operator UInt64(JsonNumber number) + => ulong.Parse(number.Value); + + public static implicit operator decimal(JsonNumber number) + => decimal.Parse(number.Value, System.Globalization.CultureInfo.InvariantCulture); + + public static implicit operator Double(JsonNumber number) + => double.Parse(number.value, System.Globalization.CultureInfo.InvariantCulture); + + public static implicit operator float(JsonNumber number) + => float.Parse(number.value, System.Globalization.CultureInfo.InvariantCulture); + + public static implicit operator JsonNumber(short data) + => new JsonNumber(data.ToString()); + + public static implicit operator JsonNumber(int data) + => new JsonNumber(data); + + public static implicit operator JsonNumber(long data) + => new JsonNumber(data); + + public static implicit operator JsonNumber(Single data) + => new JsonNumber(data.ToString()); + + public static implicit operator JsonNumber(double data) + => new JsonNumber(data.ToString()); + + #endregion + + public override string ToString() => value; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/Nodes/JsonObject.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/Nodes/JsonObject.cs new file mode 100644 index 000000000000..d4e4004c9cde --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/Nodes/JsonObject.cs @@ -0,0 +1,172 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections; +using System.Collections.Generic; +using System.IO; + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json +{ + public partial class JsonObject : JsonNode, IDictionary + { + private readonly Dictionary items; + + internal JsonObject() + { + items = new Dictionary(); + } + + internal JsonObject(IEnumerable> properties) + { + if (properties == null) throw new ArgumentNullException(nameof(properties)); + + items = new Dictionary(); + + foreach (var field in properties) + { + items.Add(field.Key, field.Value); + } + } + + #region IDictionary Constructors + + internal JsonObject(IDictionary dic) + { + items = new Dictionary(dic.Count); + + foreach (var pair in dic) + { + Add(pair.Key, pair.Value); + } + } + + #endregion + + internal override JsonType Type => JsonType.Object; + + #region Add Overloads + + public void Add(string name, JsonNode value) => + items.Add(name, value); + + public void Add(string name, byte[] value) => + items.Add(name, new XBinary(value)); + + public void Add(string name, DateTime value) => + items.Add(name, new JsonDate(value)); + + public void Add(string name, int value) => + items.Add(name, new JsonNumber(value.ToString())); + + public void Add(string name, long value) => + items.Add(name, new JsonNumber(value.ToString())); + + public void Add(string name, float value) => + items.Add(name, new JsonNumber(value.ToString())); + + public void Add(string name, double value) => + items.Add(name, new JsonNumber(value.ToString())); + + public void Add(string name, string value) => + items.Add(name, new JsonString(value)); + + public void Add(string name, bool value) => + items.Add(name, new JsonBoolean(value)); + + public void Add(string name, Uri url) => + items.Add(name, new JsonString(url.AbsoluteUri)); + + public void Add(string name, string[] values) => + items.Add(name, new XImmutableArray(values)); + + public void Add(string name, int[] values) => + items.Add(name, new XImmutableArray(values)); + + #endregion + + #region ICollection> Members + + void ICollection>.Add(KeyValuePair item) + { + items.Add(item.Key, item.Value); + } + + void ICollection>.Clear() + { + items.Clear(); + } + + bool ICollection>.Contains(KeyValuePair item) => + throw new NotImplementedException(); + + void ICollection>.CopyTo(KeyValuePair[] array, int arrayIndex) => + throw new NotImplementedException(); + + + int ICollection>.Count => items.Count; + + bool ICollection>.IsReadOnly => false; + + bool ICollection>.Remove(KeyValuePair item) => + throw new NotImplementedException(); + + #endregion + + #region IDictionary Members + + public bool ContainsKey(string key) => items.ContainsKey(key); + + public ICollection Keys => items.Keys; + + public bool Remove(string key) => items.Remove(key); + + public bool TryGetValue(string key, out JsonNode value) => + items.TryGetValue(key, out value); + + public ICollection Values => items.Values; + + public override JsonNode this[string key] + { + get => items[key]; + set => items[key] = value; + } + + #endregion + + #region IEnumerable + + IEnumerator> IEnumerable>.GetEnumerator() + => items.GetEnumerator(); + + IEnumerator IEnumerable.GetEnumerator() + => items.GetEnumerator(); + + #endregion + + #region Helpers + + internal static new JsonObject FromObject(object instance) => + (JsonObject)new JsonSerializer().Serialize(instance); + + #endregion + + #region Static Constructors + + internal static JsonObject FromStream(Stream stream) + { + using (var tr = new StreamReader(stream)) + { + return (JsonObject)Parse(tr); + } + } + + internal static new JsonObject Parse(string text) + { + return (JsonObject)JsonNode.Parse(text); + } + + #endregion + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/Nodes/JsonString.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/Nodes/JsonString.cs new file mode 100644 index 000000000000..2bb9508110af --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/Nodes/JsonString.cs @@ -0,0 +1,42 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json +{ + public sealed partial class JsonString : JsonNode, IEquatable + { + private readonly string value; + + internal JsonString(string value) + { + this.value = value ?? throw new ArgumentNullException(nameof(value)); + } + + internal override JsonType Type => JsonType.String; + + internal string Value => value; + + internal int Length => value.Length; + + #region #region Implicit Casts + + public static implicit operator string(JsonString data) => data.Value; + + public static implicit operator JsonString(string value) => new JsonString(value); + + #endregion + + public override int GetHashCode() => value.GetHashCode(); + + public override string ToString() => value; + + #region IEquatable + + bool IEquatable.Equals(JsonString other) => this.Value == other.Value; + + #endregion + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/Nodes/XBinary.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/Nodes/XBinary.cs new file mode 100644 index 000000000000..03a827f1bdfc --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/Nodes/XBinary.cs @@ -0,0 +1,40 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json +{ + internal sealed class XBinary : JsonNode + { + private readonly byte[] _value; + private readonly string _base64; + + internal XBinary(byte[] value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + internal XBinary(string base64EncodedString) + { + _base64 = base64EncodedString ?? throw new ArgumentNullException(nameof(base64EncodedString)); + } + + internal override JsonType Type => JsonType.Binary; + + internal byte[] Value => _value ?? Convert.FromBase64String(_base64); + + #region #region Implicit Casts + + public static implicit operator byte[] (XBinary data) => data.Value; + + public static implicit operator XBinary(byte[] data) => new XBinary(data); + + #endregion + + public override int GetHashCode() => Value.GetHashCode(); + + public override string ToString() => _base64 ?? Convert.ToBase64String(_value); + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/Nodes/XNull.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/Nodes/XNull.cs new file mode 100644 index 000000000000..64ff6b3b18ae --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/Nodes/XNull.cs @@ -0,0 +1,15 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json +{ + internal sealed class XNull : JsonNode + { + internal static readonly XNull Instance = new XNull(); + + private XNull() { } + + internal override JsonType Type => JsonType.Null; + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/Parser/Exceptions/ParseException.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/Parser/Exceptions/ParseException.cs new file mode 100644 index 000000000000..10bca881efbf --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/Parser/Exceptions/ParseException.cs @@ -0,0 +1,24 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json +{ + internal class ParserException : Exception + { + internal ParserException(string message) + : base(message) + { } + + internal ParserException(string message, SourceLocation location) + : base(message) + { + + Location = location; + } + + internal SourceLocation Location { get; } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/Parser/JsonParser.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/Parser/JsonParser.cs new file mode 100644 index 000000000000..5e46688f0d67 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/Parser/JsonParser.cs @@ -0,0 +1,180 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.IO; + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json +{ + public class JsonParser : IDisposable + { + private readonly TokenReader reader; + + internal JsonParser(TextReader reader) + : this(new SourceReader(reader)) { } + + internal JsonParser(SourceReader sourceReader) + { + if (sourceReader == null) + throw new ArgumentNullException(nameof(sourceReader)); + + this.reader = new TokenReader(new JsonTokenizer(sourceReader)); + + this.reader.Next(); // Start with the first token + } + + internal IEnumerable ReadNodes() + { + JsonNode node; + + while ((node = ReadNode()) != null) yield return node; + } + + internal JsonNode ReadNode() + { + if (reader.Current.Kind == TokenKind.Eof || reader.Current.IsTerminator) + { + return null; + } + + switch (reader.Current.Kind) + { + case TokenKind.LeftBrace : return ReadObject(); // { + case TokenKind.LeftBracket : return ReadArray(); // [ + + default: throw new ParserException($"Expected '{{' or '['. Was {reader.Current}."); + } + } + + private JsonNode ReadFieldValue() + { + // Boolean, Date, Null, Number, String, Uri + if (reader.Current.IsLiteral) + { + return ReadLiteral(); + } + else + { + switch (reader.Current.Kind) + { + case TokenKind.LeftBracket: return ReadArray(); + case TokenKind.LeftBrace : return ReadObject(); + + default: throw new ParserException($"Unexpected token reading field value. Was {reader.Current}."); + } + } + } + + private JsonNode ReadLiteral() + { + var literal = reader.Current; + + reader.Next(); // Read the literal token + + switch (literal.Kind) + { + case TokenKind.Boolean : return JsonBoolean.Parse(literal.Value); + case TokenKind.Null : return XNull.Instance; + case TokenKind.Number : return new JsonNumber(literal.Value); + case TokenKind.String : return new JsonString(literal.Value); + + default: throw new ParserException($"Unexpected token reading literal. Was {literal}."); + } + } + + internal JsonObject ReadObject() + { + reader.Ensure(TokenKind.LeftBrace, "object"); + + reader.Next(); // Read '{' (Object start) + + var jsonObject = new JsonObject(); + + // Read the object's fields until we reach the end of the object ('}') + while (reader.Current.Kind != TokenKind.RightBrace) + { + if (reader.Current.Kind == TokenKind.Comma) + { + reader.Next(); // Read ',' (Seperator) + } + + // Ensure we have a field name + reader.Ensure(TokenKind.String, "Expected field name"); + + var field = ReadField(); + + jsonObject.Add(field.Key, field.Value); + } + + reader.Next(); // Read '}' (Object end) + + return jsonObject; + } + + + // TODO: Use ValueTuple in C#7 + private KeyValuePair ReadField() + { + var fieldName = reader.Current.Value; + + reader.Next(); // Read the field name + + reader.Ensure(TokenKind.Colon, "field"); + + reader.Next(); // Read ':' (Field value indicator) + + return new KeyValuePair(fieldName, ReadFieldValue()); + } + + + internal JsonArray ReadArray() + { + reader.Ensure(TokenKind.LeftBracket, "array"); + + var array = new XNodeArray(); + + reader.Next(); // Read the '[' (Array start) + + // Read the array's items + while (reader.Current.Kind != TokenKind.RightBracket) + { + if (reader.Current.Kind == TokenKind.Comma) + { + reader.Next(); // Read the ',' (Seperator) + } + + if (reader.Current.IsLiteral) + { + array.Add(ReadLiteral()); // Boolean, Date, Number, Null, String, Uri + } + else if (reader.Current.Kind == TokenKind.LeftBracket) + { + array.Add(ReadArray()); // Array + } + else if (reader.Current.Kind == TokenKind.LeftBrace) + { + array.Add(ReadObject()); // Object + } + else + { + throw new ParserException($"Expected comma, literal, or object. Was {reader.Current}."); + } + } + + reader.Next(); // Read the ']' (Array end) + + return array; + } + + #region IDisposable + + public void Dispose() + { + reader.Dispose(); + } + + #endregion + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/Parser/JsonToken.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/Parser/JsonToken.cs new file mode 100644 index 000000000000..df35164ce336 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/Parser/JsonToken.cs @@ -0,0 +1,66 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json +{ + internal enum TokenKind + { + LeftBrace, // { Object start + RightBrace, // } Object end + + LeftBracket, // [ Array start + RightBracket, // ] Array end + + Comma, // , Comma + Colon, // : Value indicator + Dot, // . Access field indicator + Terminator, // \0 Stream terminator + + Boolean = 31, // true or false + Null = 33, // null + Number = 34, // i.e. -1.93, -1, 0, 1, 1.1 + String = 35, // i.e. "text" + + Eof = 50 + } + + internal /* readonly */ struct JsonToken + { + internal static readonly JsonToken BraceOpen = new JsonToken(TokenKind.LeftBrace, "{"); + internal static readonly JsonToken BraceClose = new JsonToken(TokenKind.RightBrace, "}"); + + internal static readonly JsonToken BracketOpen = new JsonToken(TokenKind.LeftBracket, "["); + internal static readonly JsonToken BracketClose = new JsonToken(TokenKind.RightBracket, "]"); + + internal static readonly JsonToken Colon = new JsonToken(TokenKind.Colon, ":"); + internal static readonly JsonToken Comma = new JsonToken(TokenKind.Comma, ","); + internal static readonly JsonToken Terminator = new JsonToken(TokenKind.Terminator, "\0"); + + internal static readonly JsonToken True = new JsonToken(TokenKind.Boolean, "true"); + internal static readonly JsonToken False = new JsonToken(TokenKind.Boolean, "false"); + internal static readonly JsonToken Null = new JsonToken(TokenKind.Null, "null"); + + internal static readonly JsonToken Eof = new JsonToken(TokenKind.Eof, null); + + internal JsonToken(TokenKind kind, string value) + { + Kind = kind; + Value = value; + } + + internal readonly TokenKind Kind; + + internal readonly string Value; + + public override string ToString() => Kind + ": " + Value; + + #region Helpers + + internal bool IsLiteral => (byte)Kind > 30 && (byte)Kind < 40; + + internal bool IsTerminator => Kind == TokenKind.Terminator; + + #endregion + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/Parser/JsonTokenizer.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/Parser/JsonTokenizer.cs new file mode 100644 index 000000000000..4fffd2d5839b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/Parser/JsonTokenizer.cs @@ -0,0 +1,177 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Text; + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json +{ + using System.IO; + + + public class JsonTokenizer : IDisposable + { + private readonly StringBuilder sb = new StringBuilder(); + + private readonly SourceReader reader; + + internal JsonTokenizer(TextReader reader) + : this(new SourceReader(reader)) { } + + internal JsonTokenizer(SourceReader reader) + { + this.reader = reader; + + reader.Next(); // Start with the first char + } + + internal JsonToken ReadNext() + { + reader.SkipWhitespace(); + + if (reader.IsEof) return JsonToken.Eof; + + switch (reader.Current) + { + case '"': return ReadQuotedString(); + + // Symbols + case '[' : reader.Next(); return JsonToken.BracketOpen; // Array start + case ']' : reader.Next(); return JsonToken.BracketClose; // Array end + case ',' : reader.Next(); return JsonToken.Comma; // Value seperator + case ':' : reader.Next(); return JsonToken.Colon; // Field value indicator + case '{' : reader.Next(); return JsonToken.BraceOpen; // Object start + case '}' : reader.Next(); return JsonToken.BraceClose; // Object end + case '\0' : reader.Next(); return JsonToken.Terminator; // Stream terminiator + + default: return ReadLiteral(); + } + } + + private JsonToken ReadQuotedString() + { + Expect('"', "quoted string indicator"); + + reader.Next(); // Read '"' (Starting quote) + + // Read until we reach an unescaped quote char + while (reader.Current != '"') + { + EnsureNotEof("quoted string"); + + if (reader.Current == '\\') + { + char escapedCharacter = reader.ReadEscapeCode(); + + sb.Append(escapedCharacter); + + continue; + } + + StoreCurrentCharacterAndReadNext(); + } + + reader.Next(); // Read '"' (Ending quote) + + return new JsonToken(TokenKind.String, value: sb.Extract()); + } + + private JsonToken ReadLiteral() + { + if (char.IsDigit(reader.Current) || + reader.Current == '-' || + reader.Current == '+') + { + return ReadNumber(); + } + + return ReadIdentifer(); + } + + private JsonToken ReadNumber() + { + // Read until we hit a non-numeric character + // -6.247737e-06 + // E + + while (char.IsDigit(reader.Current) + || reader.Current == '.' + || reader.Current == 'e' + || reader.Current == 'E' + || reader.Current == '-' + || reader.Current == '+') + { + StoreCurrentCharacterAndReadNext(); + } + + return new JsonToken(TokenKind.Number, value: sb.Extract()); + } + + int count = 0; + + private JsonToken ReadIdentifer() + { + count++; + + if (!char.IsLetter(reader.Current)) + { + throw new ParserException( + message : $"Expected literal (number, boolean, or null). Was '{reader.Current}'.", + location : reader.Location + ); + } + + // Read letters, numbers, and underscores '_' + while (char.IsLetterOrDigit(reader.Current) || reader.Current == '_') + { + StoreCurrentCharacterAndReadNext(); + } + + string text = sb.Extract(); + + switch (text) + { + case "true": return JsonToken.True; + case "false": return JsonToken.False; + case "null": return JsonToken.Null; + + default: return new JsonToken(TokenKind.String, text); + } + } + + private void Expect(char character, string description) + { + if (reader.Current != character) + { + throw new ParserException( + message: $"Expected {description} ('{character}'). Was '{reader.Current}'.", + location: reader.Location + ); + } + } + + private void EnsureNotEof(string tokenType) + { + if (reader.IsEof) + { + throw new ParserException( + message: $"Unexpected EOF while reading {tokenType}.", + location: reader.Location + ); + } + } + + private void StoreCurrentCharacterAndReadNext() + { + sb.Append(reader.Current); + + reader.Next(); + } + + public void Dispose() + { + reader.Dispose(); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/Parser/Location.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/Parser/Location.cs new file mode 100644 index 000000000000..00a415fdd3cf --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/Parser/Location.cs @@ -0,0 +1,43 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json +{ + internal struct SourceLocation + { + private int line; + private int column; + private int position; + + internal SourceLocation(int line = 0, int column = 0, int position = 0) + { + this.line = line; + this.column = column; + this.position = position; + } + + internal int Line => line; + + internal int Column => column; + + internal int Position => position; + + internal void Advance() + { + this.column++; + this.position++; + } + + internal void MarkNewLine() + { + this.line++; + this.column = 0; + } + + internal SourceLocation Clone() + { + return new SourceLocation(line, column, position); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/Parser/Readers/SourceReader.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/Parser/Readers/SourceReader.cs new file mode 100644 index 000000000000..407a86705666 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/Parser/Readers/SourceReader.cs @@ -0,0 +1,130 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Globalization; +using System.IO; + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json +{ + public sealed class SourceReader : IDisposable + { + private readonly TextReader source; + + private char current; + + private readonly SourceLocation location = new SourceLocation(); + + private bool isEof = false; + + internal SourceReader(TextReader textReader) + { + this.source = textReader ?? throw new ArgumentNullException(nameof(textReader)); + } + + /// + /// Advances to the next character + /// + internal void Next() + { + // Advance to the new line when we see a new line '\n'. + // A new line may be prefixed by a carriage return '\r'. + + if (current == '\n') + { + location.MarkNewLine(); + } + + int charCode = source.Read(); // -1 for end + + if (charCode >= 0) + { + current = (char)charCode; + } + else + { + // If we've already marked this as the EOF, throw an exception + if (isEof) + { + throw new EndOfStreamException("Cannot advance past end of stream."); + } + + isEof = true; + + current = '\0'; + } + + location.Advance(); + } + + internal void SkipWhitespace() + { + while (char.IsWhiteSpace(current)) + { + Next(); + } + } + + internal char ReadEscapeCode() + { + Next(); + + char escapedChar = current; + + Next(); // Consume escaped character + + switch (escapedChar) + { + // Special escape codes + case '"': return '"'; // " (Quotation mark) U+0022 + case '/': return '/'; // / (Solidus) U+002F + case '\\': return '\\'; // \ (Reverse solidus) U+005C + + // Control Characters + case '0': return '\0'; // Nul (0) U+0000 + case 'a': return '\a'; // Alert (7) + case 'b': return '\b'; // Backspace (8) U+0008 + case 'f': return '\f'; // Form feed (12) U+000C + case 'n': return '\n'; // Line feed (10) U+000A + case 'r': return '\r'; // Carriage return (13) U+000D + case 't': return '\t'; // Horizontal tab (9) U+0009 + case 'v': return '\v'; // Vertical tab + + // Unicode escape sequence + case 'u': return ReadUnicodeEscapeSequence(); // U+XXXX + + default: throw new Exception($"Unrecognized escape sequence '\\{escapedChar}'"); + } + } + + private readonly char[] hexCode = new char[4]; + + private char ReadUnicodeEscapeSequence() + { + hexCode[0] = current; Next(); + hexCode[1] = current; Next(); + hexCode[2] = current; Next(); + hexCode[3] = current; Next(); + + return Convert.ToChar(int.Parse( + s : new string(hexCode), + style : NumberStyles.HexNumber, + provider: NumberFormatInfo.InvariantInfo + )); + } + + internal char Current => current; + + internal bool IsEof => isEof; + + internal char Peek() => (char)source.Peek(); + + internal SourceLocation Location => location; + + public void Dispose() + { + source.Dispose(); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/Parser/TokenReader.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/Parser/TokenReader.cs new file mode 100644 index 000000000000..269ee2d1071d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/Parser/TokenReader.cs @@ -0,0 +1,39 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json +{ + public class TokenReader : IDisposable + { + private readonly JsonTokenizer tokenizer; + private JsonToken current; + + internal TokenReader(JsonTokenizer tokenizer) + { + this.tokenizer = tokenizer ?? throw new ArgumentNullException(nameof(tokenizer)); + } + + internal void Next() + { + current = tokenizer.ReadNext(); + } + + internal JsonToken Current => current; + + internal void Ensure(TokenKind kind, string readerName) + { + if (current.Kind != kind) + { + throw new ParserException($"Expected {kind} while reading {readerName}). Was {current}."); + } + } + + public void Dispose() + { + tokenizer.Dispose(); + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/PipelineMocking.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/PipelineMocking.cs new file mode 100644 index 000000000000..8d5500ead520 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/PipelineMocking.cs @@ -0,0 +1,262 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime +{ + using System.Threading.Tasks; + using System.Collections.Generic; + using System.Net.Http; + using System.Linq; + using System.Net; + using Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json; + + public enum MockMode + { + Live, + Record, + Playback, + + } + + public class PipelineMock + { + + private System.Collections.Generic.Stack scenario = new System.Collections.Generic.Stack(); + private System.Collections.Generic.Stack context = new System.Collections.Generic.Stack(); + private System.Collections.Generic.Stack description = new System.Collections.Generic.Stack(); + + private readonly string recordingPath; + private int counter = 0; + + public static implicit operator Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep(PipelineMock instance) => instance.SendAsync; + + public MockMode Mode { get; set; } = MockMode.Live; + public PipelineMock(string recordingPath) + { + this.recordingPath = recordingPath; + } + + public void PushContext(string text) => context.Push(text); + + public void PushDescription(string text) => description.Push(text); + + + public void PushScenario(string it) + { + // reset counter too + counter = 0; + + scenario.Push(it); + } + + public void PopContext() => context.Pop(); + + public void PopDescription() => description.Pop(); + + public void PopScenario() => scenario.Pop(); + + public void SetRecord() => Mode = MockMode.Record; + + public void SetPlayback() => Mode = MockMode.Playback; + + public void SetLive() => Mode = MockMode.Live; + + public string Scenario => (scenario.Count > 0 ? scenario.Peek() : "[NoScenario]"); + public string Description => (description.Count > 0 ? description.Peek() : "[NoDescription]"); + public string Context => (context.Count > 0 ? context.Peek() : "[NoContext]"); + + /// + /// Headers that we substitute out blank values for in the recordings + /// Add additional headers as necessary + /// + public static HashSet Blacklist = new HashSet(System.StringComparer.CurrentCultureIgnoreCase) { + "Authorization", + }; + + public Dictionary ForceResponseHeaders = new Dictionary(); + + internal static XImmutableArray Removed = new XImmutableArray(new string[] { "[Filtered]" }); + + internal static IEnumerable> FilterHeaders(IEnumerable>> headers) => headers.Select(header => new KeyValuePair(header.Key, Blacklist.Contains(header.Key) ? Removed : new XImmutableArray(header.Value.ToArray()))); + + internal static JsonNode SerializeContent(HttpContent content, ref bool isBase64) => content == null ? XNull.Instance : SerializeContent(content.ReadAsByteArrayAsync().Result, ref isBase64); + + internal static JsonNode SerializeContent(byte[] content, ref bool isBase64) + { + if (null == content || content.Length == 0) + { + return XNull.Instance; + } + var first = content[0]; + var last = content[content.Length - 1]; + + // plaintext for JSON/SGML/XML/HTML/STRINGS/ARRAYS + if ((first == '{' && last == '}') || (first == '<' && last == '>') || (first == '[' && last == ']') || (first == '"' && last == '"')) + { + return new JsonString(System.Text.Encoding.UTF8.GetString(content)); + } + + // base64 for everyone else + return new JsonString(System.Convert.ToBase64String(content)); + } + + internal static byte[] DeserializeContent(string content, bool isBase64) + { + if (string.IsNullOrWhiteSpace(content)) + { + return new byte[0]; + } + + if (isBase64) + { + try + { + return System.Convert.FromBase64String(content); + } + catch + { + // hmm. didn't work, return it as a string I guess. + } + } + return System.Text.Encoding.UTF8.GetBytes(content); + } + + public void SaveMessage(string rqKey, HttpRequestMessage request, HttpResponseMessage response) + { + var messages = System.IO.File.Exists(this.recordingPath) ? Load() : new JsonObject() ?? new JsonObject(); + bool isBase64Request = false; + bool isBase64Response = false; + messages[rqKey] = new JsonObject { + { "Request",new JsonObject { + { "Method", request.Method.Method }, + { "RequestUri", request.RequestUri }, + { "Content", SerializeContent( request.Content, ref isBase64Request) }, + { "isContentBase64", isBase64Request }, + { "Headers", new JsonObject(FilterHeaders(request.Headers)) }, + { "ContentHeaders", request.Content == null ? new JsonObject() : new JsonObject(FilterHeaders(request.Content.Headers))} + } }, + {"Response", new JsonObject { + { "StatusCode", (int)response.StatusCode}, + { "Headers", new JsonObject(FilterHeaders(response.Headers))}, + { "ContentHeaders", new JsonObject(FilterHeaders(response.Content.Headers))}, + { "Content", SerializeContent(response.Content, ref isBase64Response) }, + { "isContentBase64", isBase64Response }, + }} + }; + System.IO.File.WriteAllText(this.recordingPath, messages.ToString()); + } + + private JsonObject Load() + { + if (System.IO.File.Exists(this.recordingPath)) + { + try + { + return JsonObject.FromStream(System.IO.File.OpenRead(this.recordingPath)); + } + catch + { + throw new System.Exception($"Invalid recording file: '{recordingPath}'"); + } + } + + throw new System.ArgumentException($"Missing recording file: '{recordingPath}'", nameof(recordingPath)); + } + + public HttpResponseMessage LoadMessage(string rqKey) + { + var responses = Load(); + var message = responses.Property(rqKey); + + if (null == message) + { + throw new System.ArgumentException($"Missing Request '{rqKey}' in recording file", nameof(rqKey)); + } + + var sc = 0; + var reqMessage = message.Property("Request"); + var respMessage = message.Property("Response"); + + // --------------------------- deserialize response ---------------------------------------------------------------- + bool isBase64Response = false; + respMessage.BooleanProperty("isContentBase64", ref isBase64Response); + var response = new HttpResponseMessage + { + StatusCode = (HttpStatusCode)respMessage.NumberProperty("StatusCode", ref sc), + Content = new System.Net.Http.ByteArrayContent(DeserializeContent(respMessage.StringProperty("Content"), isBase64Response)) + }; + + foreach (var each in respMessage.Property("Headers")) + { + response.Headers.TryAddWithoutValidation(each.Key, each.Value.ToArrayOf()); + } + + foreach (var frh in ForceResponseHeaders) + { + response.Headers.Remove(frh.Key); + response.Headers.TryAddWithoutValidation(frh.Key, frh.Value); + } + + foreach (var each in respMessage.Property("ContentHeaders")) + { + response.Content.Headers.TryAddWithoutValidation(each.Key, each.Value.ToArrayOf()); + } + + // --------------------------- deserialize request ---------------------------------------------------------------- + bool isBase64Request = false; + reqMessage.BooleanProperty("isContentBase64", ref isBase64Request); + response.RequestMessage = new HttpRequestMessage + { + Method = new HttpMethod(reqMessage.StringProperty("Method")), + RequestUri = new System.Uri(reqMessage.StringProperty("RequestUri")), + Content = new System.Net.Http.ByteArrayContent(DeserializeContent(reqMessage.StringProperty("Content"), isBase64Request)) + }; + + foreach (var each in reqMessage.Property("Headers")) + { + response.RequestMessage.Headers.TryAddWithoutValidation(each.Key, each.Value.ToArrayOf()); + } + foreach (var each in reqMessage.Property("ContentHeaders")) + { + response.RequestMessage.Content.Headers.TryAddWithoutValidation(each.Key, each.Value.ToArrayOf()); + } + + return response; + } + + public async Task SendAsync(HttpRequestMessage request, IEventListener callback, ISendAsync next) + { + counter++; + var rqkey = $"{Description}+{Context}+{Scenario}+${request.Method.Method}+{request.RequestUri}+{counter}"; + + switch (Mode) + { + case MockMode.Record: + //Add following code since the request.Content will be released after sendAsync + var requestClone = request; + if (requestClone.Content != null) + { + requestClone = await request.CloneWithContent(request.RequestUri, request.Method); + } + // make the call + var response = await next.SendAsync(request, callback); + + // save the message to the recording file + SaveMessage(rqkey, requestClone, response); + + // return the response. + return response; + + case MockMode.Playback: + // load and return the response. + return LoadMessage(rqkey); + + default: + // pass-thru, do nothing + return await next.SendAsync(request, callback); + } + } + } +} diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/Properties/Resources.Designer.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/Properties/Resources.Designer.cs new file mode 100644 index 000000000000..41b9162381c9 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/Properties/Resources.Designer.cs @@ -0,0 +1,5633 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.generated.runtime.Properties +{ + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + public class Resources + { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() + { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + public static global::System.Resources.ResourceManager ResourceManager + { + get + { + if (object.ReferenceEquals(resourceMan, null)) + { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.generated.runtime.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + public static global::System.Globalization.CultureInfo Culture + { + get + { + return resourceCulture; + } + set + { + resourceCulture = value; + } + } + + /// + /// Looks up a localized string similar to The remote server returned an error: (401) Unauthorized.. + /// + public static string AccessDeniedExceptionMessage + { + get + { + return ResourceManager.GetString("AccessDeniedExceptionMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Account id doesn't match one in subscription.. + /// + public static string AccountIdDoesntMatchSubscription + { + get + { + return ResourceManager.GetString("AccountIdDoesntMatchSubscription", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Account needs to be specified. + /// + public static string AccountNeedsToBeSpecified + { + get + { + return ResourceManager.GetString("AccountNeedsToBeSpecified", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Account "{0}" has been added.. + /// + public static string AddAccountAdded + { + get + { + return ResourceManager.GetString("AddAccountAdded", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to To switch to a different subscription, please use Select-AzureSubscription.. + /// + public static string AddAccountChangeSubscription + { + get + { + return ResourceManager.GetString("AddAccountChangeSubscription", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Skipping external tenant {0}, because you are using a guest or a foreign principal object identity. In order to access this tenant, please run Add-AzureAccount without "-Credential".. + /// + public static string AddAccountNonInteractiveGuestOrFpo + { + get + { + return ResourceManager.GetString("AddAccountNonInteractiveGuestOrFpo", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Subscription "{0}" is selected as the default subscription.. + /// + public static string AddAccountShowDefaultSubscription + { + get + { + return ResourceManager.GetString("AddAccountShowDefaultSubscription", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to To view all the subscriptions, please use Get-AzureSubscription.. + /// + public static string AddAccountViewSubscriptions + { + get + { + return ResourceManager.GetString("AddAccountViewSubscriptions", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Add-On {0} is created successfully.. + /// + public static string AddOnCreatedMessage + { + get + { + return ResourceManager.GetString("AddOnCreatedMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Add-on name {0} is already used.. + /// + public static string AddOnNameAlreadyUsed + { + get + { + return ResourceManager.GetString("AddOnNameAlreadyUsed", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Add-On {0} not found.. + /// + public static string AddOnNotFound + { + get + { + return ResourceManager.GetString("AddOnNotFound", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Add-on {0} is removed successfully.. + /// + public static string AddOnRemovedMessage + { + get + { + return ResourceManager.GetString("AddOnRemovedMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Add-On {0} is updated successfully.. + /// + public static string AddOnUpdatedMessage + { + get + { + return ResourceManager.GetString("AddOnUpdatedMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Role has been created at {0}\{1}.. + /// + public static string AddRoleMessageCreate + { + get + { + return ResourceManager.GetString("AddRoleMessageCreate", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Role has been created at {0}\{1}. For easy access to Microsoft Azure services from your application code, install the Microsoft Azure client library for Node.js by running ‘npm install azure’.. + /// + public static string AddRoleMessageCreateNode + { + get + { + return ResourceManager.GetString("AddRoleMessageCreateNode", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Role has been created at {0}\{1}. For easy access to Microsoft Azure services from your application code, install the Microsoft Azure client library for PHP by running "pear WindowsAzure/WindowsAzure".. + /// + public static string AddRoleMessageCreatePHP + { + get + { + return ResourceManager.GetString("AddRoleMessageCreatePHP", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Unable to set role permissions. Please give the 'Network Service' user 'Read & execute' and 'Modify' permissions to the role folder, or run PowerShell as an Administrator. + /// + public static string AddRoleMessageInsufficientPermissions + { + get + { + return ResourceManager.GetString("AddRoleMessageInsufficientPermissions", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to A role name '{0}' already exists. + /// + public static string AddRoleMessageRoleExists + { + get + { + return ResourceManager.GetString("AddRoleMessageRoleExists", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Profile {0} already has an endpoint with name {1}. + /// + public static string AddTrafficManagerEndpointFailed + { + get + { + return ResourceManager.GetString("AddTrafficManagerEndpointFailed", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Azure PowerShell collects usage data in order to improve your experience. + ///The data is anonymous and does not include commandline argument values. + ///The data is collected by Microsoft. + /// + ///Use the Disable-AzDataCollection cmdlet to turn the feature Off. The cmdlet can be found in the Az.Accounts module. To disable data collection: PS > Disable-AzDataCollection. + ///Use the Enable-AzDataCollection cmdlet to turn the feature On. The cmdlet can be found in the Az.Accounts module. To enable [rest of string was truncated]";. + /// + public static string ARMDataCollectionMessage + { + get + { + return ResourceManager.GetString("ARMDataCollectionMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to [Common.Authentication]: Authenticating for account {0} with single tenant {1}.. + /// + public static string AuthenticatingForSingleTenant + { + get + { + return ResourceManager.GetString("AuthenticatingForSingleTenant", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Windows Azure Powershell\. + /// + public static string AzureDirectory + { + get + { + return ResourceManager.GetString("AzureDirectory", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to https://manage.windowsazure.com. + /// + public static string AzurePortalUrl + { + get + { + return ResourceManager.GetString("AzurePortalUrl", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to AZURE_PORTAL_URL. + /// + public static string AzurePortalUrlEnv + { + get + { + return ResourceManager.GetString("AzurePortalUrlEnv", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Selected profile must not be null.. + /// + public static string AzureProfileMustNotBeNull + { + get + { + return ResourceManager.GetString("AzureProfileMustNotBeNull", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Azure SDK\{0}\. + /// + public static string AzureSdkDirectory + { + get + { + return ResourceManager.GetString("AzureSdkDirectory", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to File '{0}' already exists. Use the -Force parameter to overwrite it.. + /// + public static string AzureVMDscArchiveAlreadyExists + { + get + { + return ResourceManager.GetString("AzureVMDscArchiveAlreadyExists", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Cannot find configuration data file: {0}. + /// + public static string AzureVMDscCannotFindConfigurationDataFile + { + get + { + return ResourceManager.GetString("AzureVMDscCannotFindConfigurationDataFile", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Create Archive. + /// + public static string AzureVMDscCreateArchiveAction + { + get + { + return ResourceManager.GetString("AzureVMDscCreateArchiveAction", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The configuration data must be a .psd1 file. + /// + public static string AzureVMDscInvalidConfigurationDataFile + { + get + { + return ResourceManager.GetString("AzureVMDscInvalidConfigurationDataFile", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Parsing configuration script: {0}. + /// + public static string AzureVMDscParsingConfiguration + { + get + { + return ResourceManager.GetString("AzureVMDscParsingConfiguration", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Storage Blob '{0}' already exists. Use the -Force parameter to overwrite it.. + /// + public static string AzureVMDscStorageBlobAlreadyExists + { + get + { + return ResourceManager.GetString("AzureVMDscStorageBlobAlreadyExists", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Upload '{0}'. + /// + public static string AzureVMDscUploadToBlobStorageAction + { + get + { + return ResourceManager.GetString("AzureVMDscUploadToBlobStorageAction", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Execution failed because a background thread could not prompt the user.. + /// + public static string BaseShouldMethodFailureReason + { + get + { + return ResourceManager.GetString("BaseShouldMethodFailureReason", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Base Uri was empty.. + /// + public static string BaseUriEmpty + { + get + { + return ResourceManager.GetString("BaseUriEmpty", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {0} begin processing without ParameterSet.. + /// + public static string BeginProcessingWithoutParameterSetLog + { + get + { + return ResourceManager.GetString("BeginProcessingWithoutParameterSetLog", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {0} begin processing with ParameterSet '{1}'.. + /// + public static string BeginProcessingWithParameterSetLog + { + get + { + return ResourceManager.GetString("BeginProcessingWithParameterSetLog", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Blob with the name {0} already exists in the account.. + /// + public static string BlobAlreadyExistsInTheAccount + { + get + { + return ResourceManager.GetString("BlobAlreadyExistsInTheAccount", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to https://{0}.blob.core.windows.net/. + /// + public static string BlobEndpointUri + { + get + { + return ResourceManager.GetString("BlobEndpointUri", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to AZURE_BLOBSTORAGE_TEMPLATE. + /// + public static string BlobEndpointUriEnv + { + get + { + return ResourceManager.GetString("BlobEndpointUriEnv", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The parameter : '{0}' is changing.. + /// + public static string BreakingChangeAttributeParameterChanging + { + get + { + return ResourceManager.GetString("BreakingChangeAttributeParameterChanging", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The parameter : '{0}' is becoming mandatory.. + /// + public static string BreakingChangeAttributeParameterMandatoryNow + { + get + { + return ResourceManager.GetString("BreakingChangeAttributeParameterMandatoryNow", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The parameter : '{0}' is being replaced by parameter : '{1}'.. + /// + public static string BreakingChangeAttributeParameterReplaced + { + get + { + return ResourceManager.GetString("BreakingChangeAttributeParameterReplaced", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The parameter : '{0}' is being replaced by mandatory parameter : '{1}'.. + /// + public static string BreakingChangeAttributeParameterReplacedMandatory + { + get + { + return ResourceManager.GetString("BreakingChangeAttributeParameterReplacedMandatory", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The type of the parameter is changing from '{0}' to '{1}'.. + /// + public static string BreakingChangeAttributeParameterTypeChange + { + get + { + return ResourceManager.GetString("BreakingChangeAttributeParameterTypeChange", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Change description : {0} + ///. + /// + public static string BreakingChangesAttributesChangeDescriptionMessage + { + get + { + return ResourceManager.GetString("BreakingChangesAttributesChangeDescriptionMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The cmdlet is being deprecated. There will be no replacement for it.. + /// + public static string BreakingChangesAttributesCmdLetDeprecationMessageNoReplacement + { + get + { + return ResourceManager.GetString("BreakingChangesAttributesCmdLetDeprecationMessageNoReplacement", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The cmdlet is being deprecated. There will be no replacement for it.. + /// + public static string BreakingChangesAttributesParameterSetDeprecationMessageNoReplacement + { + get + { + return ResourceManager.GetString("BreakingChangesAttributesParameterSetDeprecationMessageNoReplacement", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The cmdlet '{0}' is replacing this cmdlet.. + /// + public static string BreakingChangesAttributesCmdLetDeprecationMessageWithReplacement + { + get + { + return ResourceManager.GetString("BreakingChangesAttributesCmdLetDeprecationMessageWithReplacement", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The output type is changing from the existing type :'{0}' to the new type :'{1}'. + /// + public static string BreakingChangesAttributesCmdLetOutputChange1 + { + get + { + return ResourceManager.GetString("BreakingChangesAttributesCmdLetOutputChange1", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to "The output type '{0}' is changing". + /// + public static string BreakingChangesAttributesCmdLetOutputChange2 + { + get + { + return ResourceManager.GetString("BreakingChangesAttributesCmdLetOutputChange2", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to + ///- The following properties are being added to the output type : + ///. + /// + public static string BreakingChangesAttributesCmdLetOutputPropertiesAdded + { + get + { + return ResourceManager.GetString("BreakingChangesAttributesCmdLetOutputPropertiesAdded", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to + /// - The following properties in the output type are being deprecated : + ///. + /// + public static string BreakingChangesAttributesCmdLetOutputPropertiesRemoved + { + get + { + return ResourceManager.GetString("BreakingChangesAttributesCmdLetOutputPropertiesRemoved", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The output type '{0}' is being deprecated without a replacement.. + /// + public static string BreakingChangesAttributesCmdLetOutputTypeDeprecated + { + get + { + return ResourceManager.GetString("BreakingChangesAttributesCmdLetOutputTypeDeprecated", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to - {0} + /// + ///. + /// + public static string BreakingChangesAttributesDeclarationMessage + { + get + { + return ResourceManager.GetString("BreakingChangesAttributesDeclarationMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to - Cmdlet : '{0}' + /// - {1} + ///. + /// + public static string BreakingChangesAttributesDeclarationMessageWithCmdletName + { + get + { + return ResourceManager.GetString("BreakingChangesAttributesDeclarationMessageWithCmdletName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to NOTE : Go to {0} for steps to suppress (and other related information on) the breaking change messages.. + /// + public static string BreakingChangesAttributesFooterMessage + { + get + { + return ResourceManager.GetString("BreakingChangesAttributesFooterMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Breaking changes in the cmdlet '{0}' :. + /// + public static string BreakingChangesAttributesHeaderMessage + { + get + { + return ResourceManager.GetString("BreakingChangesAttributesHeaderMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Note : This change will take effect on '{0}' + ///. + /// + public static string BreakingChangesAttributesInEffectByDateMessage + { + get + { + return ResourceManager.GetString("BreakingChangesAttributesInEffectByDateMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Note :The change is expected to take effect from the version : '{0}' + /// + ///. + /// + public static string BreakingChangesAttributesInEffectByVersion + { + get + { + return ResourceManager.GetString("BreakingChangesAttributesInEffectByVersion", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to ```powershell + ///# Old + ///{0} + /// + ///# New + ///{1} + ///``` + /// + ///. + /// + public static string BreakingChangesAttributesUsageChangeMessage + { + get + { + return ResourceManager.GetString("BreakingChangesAttributesUsageChangeMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Cmdlet invocation changes : + /// Old Way : {0} + /// New Way : {1}. + /// + public static string BreakingChangesAttributesUsageChangeMessageConsole + { + get + { + return ResourceManager.GetString("BreakingChangesAttributesUsageChangeMessageConsole", resourceCulture); + } + } + + /// + /// The cmdlet is in experimental stage. The function may not be enabled in current subscription. + /// + public static string ExperimentalCmdletMessage + { + get + { + return ResourceManager.GetString("ExperimentalCmdletMessage", resourceCulture); + } + } + + + + /// + /// Looks up a localized string similar to CACHERUNTIMEURL. + /// + public static string CacheRuntimeUrl + { + get + { + return ResourceManager.GetString("CacheRuntimeUrl", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to cache. + /// + public static string CacheRuntimeValue + { + get + { + return ResourceManager.GetString("CacheRuntimeValue", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to CacheRuntimeVersion. + /// + public static string CacheRuntimeVersionKey + { + get + { + return ResourceManager.GetString("CacheRuntimeVersionKey", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Installing caching version {0} for Role '{1}' (the caching version locally installed is: {2}). + /// + public static string CacheVersionWarningText + { + get + { + return ResourceManager.GetString("CacheVersionWarningText", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Cannot change built-in environment {0}.. + /// + public static string CannotChangeBuiltinEnvironment + { + get + { + return ResourceManager.GetString("CannotChangeBuiltinEnvironment", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Cannot find {0} with name {1}.. + /// + public static string CannotFind + { + get + { + return ResourceManager.GetString("CannotFind", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Deployment for service {0} with {1} slot doesn't exist. + /// + public static string CannotFindDeployment + { + get + { + return ResourceManager.GetString("CannotFindDeployment", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Can't find valid Microsoft Azure role in current directory {0}. + /// + public static string CannotFindRole + { + get + { + return ResourceManager.GetString("CannotFindRole", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to service {0} configuration file (ServiceConfiguration.Cloud.cscfg) is either null or doesn't exist. + /// + public static string CannotFindServiceConfigurationFile + { + get + { + return ResourceManager.GetString("CannotFindServiceConfigurationFile", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Invalid service path! Cannot locate ServiceDefinition.csdef in current folder or parent folders.. + /// + public static string CannotFindServiceRoot + { + get + { + return ResourceManager.GetString("CannotFindServiceRoot", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The subscription named {0} with id {1} is not currently imported. You must import this subscription before it can be updated.. + /// + public static string CannotUpdateUnknownSubscription + { + get + { + return ResourceManager.GetString("CannotUpdateUnknownSubscription", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to ManagementCertificate. + /// + public static string CertificateElementName + { + get + { + return ResourceManager.GetString("CertificateElementName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to certificate.pfx. + /// + public static string CertificateFileName + { + get + { + return ResourceManager.GetString("CertificateFileName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Certificate imported into CurrentUser\My\{0}. + /// + public static string CertificateImportedMessage + { + get + { + return ResourceManager.GetString("CertificateImportedMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to No certificate was found in the certificate store with thumbprint {0}. + /// + public static string CertificateNotFoundInStore + { + get + { + return ResourceManager.GetString("CertificateNotFoundInStore", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Your account does not have access to the private key for certificate {0}. + /// + public static string CertificatePrivateKeyAccessError + { + get + { + return ResourceManager.GetString("CertificatePrivateKeyAccessError", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {0} {1} deployment for {2} service. + /// + public static string ChangeDeploymentStateWaitMessage + { + get + { + return ResourceManager.GetString("ChangeDeploymentStateWaitMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Cloud service {0} is in {1} state.. + /// + public static string ChangeDeploymentStatusCompleteMessage + { + get + { + return ResourceManager.GetString("ChangeDeploymentStatusCompleteMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Changing/Removing public environment '{0}' is not allowed.. + /// + public static string ChangePublicEnvironmentMessage + { + get + { + return ResourceManager.GetString("ChangePublicEnvironmentMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Service {0} is set to value {1}. + /// + public static string ChangeSettingsElementMessage + { + get + { + return ResourceManager.GetString("ChangeSettingsElementMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Changing public environment is not supported.. + /// + public static string ChangingDefaultEnvironmentNotSupported + { + get + { + return ResourceManager.GetString("ChangingDefaultEnvironmentNotSupported", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Choose which publish settings file to use:. + /// + public static string ChoosePublishSettingsFile + { + get + { + return ResourceManager.GetString("ChoosePublishSettingsFile", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Microsoft.WindowsAzure.Plugins.Caching.ClientDiagnosticLevel. + /// + public static string ClientDiagnosticLevelName + { + get + { + return ResourceManager.GetString("ClientDiagnosticLevelName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to 1. + /// + public static string ClientDiagnosticLevelValue + { + get + { + return ResourceManager.GetString("ClientDiagnosticLevelValue", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to cloud_package.cspkg. + /// + public static string CloudPackageFileName + { + get + { + return ResourceManager.GetString("CloudPackageFileName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to ServiceConfiguration.Cloud.cscfg. + /// + public static string CloudServiceConfigurationFileName + { + get + { + return ResourceManager.GetString("CloudServiceConfigurationFileName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Add-ons for {0}. + /// + public static string CloudServiceDescription + { + get + { + return ResourceManager.GetString("CloudServiceDescription", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Communication could not be established. This could be due to an invalid subscription ID. Note that subscription IDs are case sensitive.. + /// + public static string CommunicationCouldNotBeEstablished + { + get + { + return ResourceManager.GetString("CommunicationCouldNotBeEstablished", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Complete. + /// + public static string CompleteMessage + { + get + { + return ResourceManager.GetString("CompleteMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to OperationID : '{0}'. + /// + public static string ComputeCloudExceptionOperationIdMessage + { + get + { + return ResourceManager.GetString("ComputeCloudExceptionOperationIdMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to config.json. + /// + public static string ConfigurationFileName + { + get + { + return ResourceManager.GetString("ConfigurationFileName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to VirtualMachine creation failed.. + /// + public static string CreateFailedErrorMessage + { + get + { + return ResourceManager.GetString("CreateFailedErrorMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Creating the website failed. If this is the first website for this subscription, please create it using the management portal instead.. + /// + public static string CreateWebsiteFailed + { + get + { + return ResourceManager.GetString("CreateWebsiteFailed", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Microsoft.ApplicationServer.Caching.DataCacheClientsSection, Microsoft.ApplicationServer.Caching.Core. + /// + public static string DataCacheClientsType + { + get + { + return ResourceManager.GetString("DataCacheClientsType", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to //blobcontainer[@datacenter='{0}']. + /// + public static string DatacenterBlobQuery + { + get + { + return ResourceManager.GetString("DatacenterBlobQuery", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Microsoft Azure PowerShell Data Collection Confirmation. + /// + public static string DataCollectionActivity + { + get + { + return ResourceManager.GetString("DataCollectionActivity", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to You choose not to participate in Microsoft Azure PowerShell data collection.. + /// + public static string DataCollectionConfirmNo + { + get + { + return ResourceManager.GetString("DataCollectionConfirmNo", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to This confirmation message will be dismissed in '{0}' second(s).... + /// + public static string DataCollectionConfirmTime + { + get + { + return ResourceManager.GetString("DataCollectionConfirmTime", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to You choose to participate in Microsoft Azure PowerShell data collection.. + /// + public static string DataCollectionConfirmYes + { + get + { + return ResourceManager.GetString("DataCollectionConfirmYes", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The setting profile has been saved to the following path '{0}'.. + /// + public static string DataCollectionSaveFileInformation + { + get + { + return ResourceManager.GetString("DataCollectionSaveFileInformation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Setting: {0} as the default and current subscription. To view other subscriptions use Get-AzureSubscription. + /// + public static string DefaultAndCurrentSubscription + { + get + { + return ResourceManager.GetString("DefaultAndCurrentSubscription", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to none. + /// + public static string DefaultFileVersion + { + get + { + return ResourceManager.GetString("DefaultFileVersion", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to There are no hostnames which could be used for validation.. + /// + public static string DefaultHostnamesValidation + { + get + { + return ResourceManager.GetString("DefaultHostnamesValidation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to 8080. + /// + public static string DefaultPort + { + get + { + return ResourceManager.GetString("DefaultPort", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to 1000. + /// + public static string DefaultRoleCachingInMB + { + get + { + return ResourceManager.GetString("DefaultRoleCachingInMB", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Auto. + /// + public static string DefaultUpgradeMode + { + get + { + return ResourceManager.GetString("DefaultUpgradeMode", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to 80. + /// + public static string DefaultWebPort + { + get + { + return ResourceManager.GetString("DefaultWebPort", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Delete. + /// + public static string Delete + { + get + { + return ResourceManager.GetString("Delete", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The {0} slot for service {1} is already in {2} state. + /// + public static string DeploymentAlreadyInState + { + get + { + return ResourceManager.GetString("DeploymentAlreadyInState", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The deployment in {0} slot for service {1} is removed. + /// + public static string DeploymentRemovedMessage + { + get + { + return ResourceManager.GetString("DeploymentRemovedMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Microsoft.WindowsAzure.Plugins.Caching.DiagnosticLevel. + /// + public static string DiagnosticLevelName + { + get + { + return ResourceManager.GetString("DiagnosticLevelName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to 1. + /// + public static string DiagnosticLevelValue + { + get + { + return ResourceManager.GetString("DiagnosticLevelValue", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The key to add already exists in the dictionary.. + /// + public static string DictionaryAddAlreadyContainsKey + { + get + { + return ResourceManager.GetString("DictionaryAddAlreadyContainsKey", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The array index cannot be less than zero.. + /// + public static string DictionaryCopyToArrayIndexLessThanZero + { + get + { + return ResourceManager.GetString("DictionaryCopyToArrayIndexLessThanZero", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The supplied array does not have enough room to contain the copied elements.. + /// + public static string DictionaryCopyToArrayTooShort + { + get + { + return ResourceManager.GetString("DictionaryCopyToArrayTooShort", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The provided dns {0} doesn't exist. + /// + public static string DnsDoesNotExist + { + get + { + return ResourceManager.GetString("DnsDoesNotExist", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Microsoft Azure Certificate. + /// + public static string EnableRemoteDesktop_FriendlyCertificateName + { + get + { + return ResourceManager.GetString("EnableRemoteDesktop_FriendlyCertificateName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Endpoint can't be retrieved for storage account. + /// + public static string EndPointNotFoundForBlobStorage + { + get + { + return ResourceManager.GetString("EndPointNotFoundForBlobStorage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {0} end processing.. + /// + public static string EndProcessingLog + { + get + { + return ResourceManager.GetString("EndProcessingLog", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to To use Active Directory authentication, you must configure the ActiveDirectoryEndpoint, ActiveDirectoryTenantId, and ActiveDirectorServiceEndpointResourceId for environment of '{0}'. You can configure these properties for this environment using the Set-AzureEnvironment cmdlet.. + /// + public static string EnvironmentDoesNotSupportActiveDirectory + { + get + { + return ResourceManager.GetString("EnvironmentDoesNotSupportActiveDirectory", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The environment '{0}' already exists.. + /// + public static string EnvironmentExists + { + get + { + return ResourceManager.GetString("EnvironmentExists", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Environment name doesn't match one in subscription.. + /// + public static string EnvironmentNameDoesntMatchSubscription + { + get + { + return ResourceManager.GetString("EnvironmentNameDoesntMatchSubscription", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Environment name needs to be specified.. + /// + public static string EnvironmentNameNeedsToBeSpecified + { + get + { + return ResourceManager.GetString("EnvironmentNameNeedsToBeSpecified", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Environment needs to be specified.. + /// + public static string EnvironmentNeedsToBeSpecified + { + get + { + return ResourceManager.GetString("EnvironmentNeedsToBeSpecified", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The environment name '{0}' is not found.. + /// + public static string EnvironmentNotFound + { + get + { + return ResourceManager.GetString("EnvironmentNotFound", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to environments.xml. + /// + public static string EnvironmentsFileName + { + get + { + return ResourceManager.GetString("EnvironmentsFileName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Error creating VirtualMachine. + /// + public static string ErrorCreatingVirtualMachine + { + get + { + return ResourceManager.GetString("ErrorCreatingVirtualMachine", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Unable to download available runtimes for location '{0}'. + /// + public static string ErrorRetrievingRuntimesForLocation + { + get + { + return ResourceManager.GetString("ErrorRetrievingRuntimesForLocation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Error updating VirtualMachine. + /// + public static string ErrorUpdatingVirtualMachine + { + get + { + return ResourceManager.GetString("ErrorUpdatingVirtualMachine", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Job Id {0} failed. Error: {1}, ExceptionDetails: {2}. + /// + public static string FailedJobErrorMessage + { + get + { + return ResourceManager.GetString("FailedJobErrorMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to File path is not valid.. + /// + public static string FilePathIsNotValid + { + get + { + return ResourceManager.GetString("FilePathIsNotValid", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The HTTP request was forbidden with client authentication scheme 'Anonymous'.. + /// + public static string FirstPurchaseErrorMessage + { + get + { + return ResourceManager.GetString("FirstPurchaseErrorMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to This add-on requires you to purchase the first instance through the Microsoft Azure Portal. Subsequent purchases can be performed through PowerShell.. + /// + public static string FirstPurchaseMessage + { + get + { + return ResourceManager.GetString("FirstPurchaseMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Operation Status:. + /// + public static string GatewayOperationStatus + { + get + { + return ResourceManager.GetString("GatewayOperationStatus", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Resources\Scaffolding\General. + /// + public static string GeneralScaffolding + { + get + { + return ResourceManager.GetString("GeneralScaffolding", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Getting all available Microsoft Azure Add-Ons, this may take few minutes.... + /// + public static string GetAllAddOnsWaitMessage + { + get + { + return ResourceManager.GetString("GetAllAddOnsWaitMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Name{0}Primary Key{0}Seconday Key. + /// + public static string GetStorageKeysHeader + { + get + { + return ResourceManager.GetString("GetStorageKeysHeader", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Git not found. Please install git and place it in your command line path.. + /// + public static string GitNotFound + { + get + { + return ResourceManager.GetString("GitNotFound", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Could not find publish settings. Please run Import-AzurePublishSettingsFile.. + /// + public static string GlobalSettingsManager_Load_PublishSettingsNotFound + { + get + { + return ResourceManager.GetString("GlobalSettingsManager_Load_PublishSettingsNotFound", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Cannot find the WadCfg end element in the config.. + /// + public static string IaasDiagnosticsBadConfigNoEndWadCfg + { + get + { + return ResourceManager.GetString("IaasDiagnosticsBadConfigNoEndWadCfg", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to WadCfg start element in the config is not matching the end element.. + /// + public static string IaasDiagnosticsBadConfigNoMatchingWadCfg + { + get + { + return ResourceManager.GetString("IaasDiagnosticsBadConfigNoMatchingWadCfg", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Cannot find the WadCfg element in the config.. + /// + public static string IaasDiagnosticsBadConfigNoWadCfg + { + get + { + return ResourceManager.GetString("IaasDiagnosticsBadConfigNoWadCfg", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to iisnode.dll. + /// + public static string IISNodeDll + { + get + { + return ResourceManager.GetString("IISNodeDll", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to iisnode. + /// + public static string IISNodeEngineKey + { + get + { + return ResourceManager.GetString("IISNodeEngineKey", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to iisnode-dev\\release\\x64. + /// + public static string IISNodePath + { + get + { + return ResourceManager.GetString("IISNodePath", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to iisnode. + /// + public static string IISNodeRuntimeValue + { + get + { + return ResourceManager.GetString("IISNodeRuntimeValue", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Installing IISNode version {0} in Azure for WebRole '{1}' (the version locally installed is: {2}). + /// + public static string IISNodeVersionWarningText + { + get + { + return ResourceManager.GetString("IISNodeVersionWarningText", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Illegal characters in path.. + /// + public static string IllegalPath + { + get + { + return ResourceManager.GetString("IllegalPath", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Internal Server Error. + /// + public static string InternalServerErrorMessage + { + get + { + return ResourceManager.GetString("InternalServerErrorMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Cannot enable memcach protocol on a cache worker role {0}.. + /// + public static string InvalidCacheRoleName + { + get + { + return ResourceManager.GetString("InvalidCacheRoleName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Invalid certificate format. Publish settings may be corrupted. Use Get-AzurePublishSettingsFile to download updated settings. + /// + public static string InvalidCertificate + { + get + { + return ResourceManager.GetString("InvalidCertificate", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Invalid certificate format.. + /// + public static string InvalidCertificateSingle + { + get + { + return ResourceManager.GetString("InvalidCertificateSingle", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The provided configuration path is invalid or doesn't exist. + /// + public static string InvalidConfigPath + { + get + { + return ResourceManager.GetString("InvalidConfigPath", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The country name is invalid, please use a valid two character country code, as described in ISO 3166-1 alpha-2.. + /// + public static string InvalidCountryNameMessage + { + get + { + return ResourceManager.GetString("InvalidCountryNameMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to No default subscription has been designated. Use Select-AzureSubscription -Default <subscriptionName> to set the default subscription.. + /// + public static string InvalidDefaultSubscription + { + get + { + return ResourceManager.GetString("InvalidDefaultSubscription", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Deployment with {0} does not exist. + /// + public static string InvalidDeployment + { + get + { + return ResourceManager.GetString("InvalidDeployment", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The deployment slot name {0} is invalid. Slot name must be either "Staging" or "Production".. + /// + public static string InvalidDeploymentSlot + { + get + { + return ResourceManager.GetString("InvalidDeploymentSlot", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to "{0}" is an invalid DNS name for {1}. + /// + public static string InvalidDnsName + { + get + { + return ResourceManager.GetString("InvalidDnsName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Invalid service endpoint.. + /// + public static string InvalidEndpoint + { + get + { + return ResourceManager.GetString("InvalidEndpoint", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The provided file in {0} must be have {1} extension. + /// + public static string InvalidFileExtension + { + get + { + return ResourceManager.GetString("InvalidFileExtension", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to File {0} has invalid characters. + /// + public static string InvalidFileName + { + get + { + return ResourceManager.GetString("InvalidFileName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to You must create your git publishing credentials using the Microsoft Azure portal. + ///Please follow these steps in the portal: + ///1. On the left side open "Web Sites" + ///2. Click on any website + ///3. Choose "Setup Git Publishing" or "Reset deployment credentials" + ///4. Back in the PowerShell window, rerun this command by typing "New-AzureWebSite {site name} -Git -PublishingUsername {username}. + /// + public static string InvalidGitCredentials + { + get + { + return ResourceManager.GetString("InvalidGitCredentials", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The value {0} provided is not a valid GUID. Please provide a valid GUID.. + /// + public static string InvalidGuid + { + get + { + return ResourceManager.GetString("InvalidGuid", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The specified hostname does not exist. Please specify a valid hostname for the site.. + /// + public static string InvalidHostnameValidation + { + get + { + return ResourceManager.GetString("InvalidHostnameValidation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Role {0} instances must be greater than or equal 0 and less than or equal 20. + /// + public static string InvalidInstancesCount + { + get + { + return ResourceManager.GetString("InvalidInstancesCount", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to There was an error creating your webjob. Please make sure that the script is in the root folder of the zip file.. + /// + public static string InvalidJobFile + { + get + { + return ResourceManager.GetString("InvalidJobFile", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Could not download a valid runtime manifest, Please check your internet connection and try again.. + /// + public static string InvalidManifestError + { + get + { + return ResourceManager.GetString("InvalidManifestError", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The account {0} was not found. Please specify a valid account name.. + /// + public static string InvalidMediaServicesAccount + { + get + { + return ResourceManager.GetString("InvalidMediaServicesAccount", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The provided name "{0}" does not match the service bus namespace naming rules.. + /// + public static string InvalidNamespaceName + { + get + { + return ResourceManager.GetString("InvalidNamespaceName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Path must specify a valid path to an Azure profile.. + /// + public static string InvalidNewProfilePath + { + get + { + return ResourceManager.GetString("InvalidNewProfilePath", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Value cannot be null. Parameter name: '{0}'. + /// + public static string InvalidNullArgument + { + get + { + return ResourceManager.GetString("InvalidNullArgument", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {0} is invalid or empty. + /// + public static string InvalidOrEmptyArgumentMessage + { + get + { + return ResourceManager.GetString("InvalidOrEmptyArgumentMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The provided package path is invalid or doesn't exist. + /// + public static string InvalidPackagePath + { + get + { + return ResourceManager.GetString("InvalidPackagePath", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to '{0}' is an invalid parameter set name.. + /// + public static string InvalidParameterSetName + { + get + { + return ResourceManager.GetString("InvalidParameterSetName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {0} doesn't exist in {1} or you've not passed valid value for it. + /// + public static string InvalidPath + { + get + { + return ResourceManager.GetString("InvalidPath", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Path {0} has invalid characters. + /// + public static string InvalidPathName + { + get + { + return ResourceManager.GetString("InvalidPathName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Property bag Hashtable must contain one of the following sets of properties: {SubscriptionId, Certificate}, {SubscriptionId, Username, Password}, {SubscriptionId, ServicePrincipal, Password, Tenant}, {SubscriptionId, AccountId, Token}. + /// + public static string InvalidProfileProperties + { + get + { + return ResourceManager.GetString("InvalidProfileProperties", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The provided publish settings file {0} has invalid content. Please get valid by running cmdlet Get-AzurePublishSettingsFile. + /// + public static string InvalidPublishSettingsSchema + { + get + { + return ResourceManager.GetString("InvalidPublishSettingsSchema", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The provided role name "{0}" has invalid characters. + /// + public static string InvalidRoleNameMessage + { + get + { + return ResourceManager.GetString("InvalidRoleNameMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to A valid name for the service root folder is required. + /// + public static string InvalidRootNameMessage + { + get + { + return ResourceManager.GetString("InvalidRootNameMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {0} is not a recognized runtime type. + /// + public static string InvalidRuntimeError + { + get + { + return ResourceManager.GetString("InvalidRuntimeError", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to A valid language is required. + /// + public static string InvalidScaffoldingLanguageArg + { + get + { + return ResourceManager.GetString("InvalidScaffoldingLanguageArg", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to No subscription is currently selected. Use Select-Subscription to activate a subscription.. + /// + public static string InvalidSelectedSubscription + { + get + { + return ResourceManager.GetString("InvalidSelectedSubscription", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The provided location "{0}" does not exist in the available locations use Get-AzureSBLocation for listing available locations.. + /// + public static string InvalidServiceBusLocation + { + get + { + return ResourceManager.GetString("InvalidServiceBusLocation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Please provide a service name or run this command from inside a service project directory.. + /// + public static string InvalidServiceName + { + get + { + return ResourceManager.GetString("InvalidServiceName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to You must provide valid value for {0}. + /// + public static string InvalidServiceSettingElement + { + get + { + return ResourceManager.GetString("InvalidServiceSettingElement", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to settings.json is invalid or doesn't exist. + /// + public static string InvalidServiceSettingMessage + { + get + { + return ResourceManager.GetString("InvalidServiceSettingMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The subscription named '{0}' cannot be found. Use Set-AzureSubscription to initialize the subscription data.. + /// + public static string InvalidSubscription + { + get + { + return ResourceManager.GetString("InvalidSubscription", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The provided subscription id {0} is not valid. + /// + public static string InvalidSubscriptionId + { + get + { + return ResourceManager.GetString("InvalidSubscriptionId", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Must specify a non-null subscription name.. + /// + public static string InvalidSubscriptionName + { + get + { + return ResourceManager.GetString("InvalidSubscriptionName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to A valid subscription name is required. This can be provided using the -Subscription parameter or by setting the subscription via the Set-AzureSubscription cmdlet. + /// + public static string InvalidSubscriptionNameMessage + { + get + { + return ResourceManager.GetString("InvalidSubscriptionNameMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The provided subscriptions file {0} has invalid content.. + /// + public static string InvalidSubscriptionsDataSchema + { + get + { + return ResourceManager.GetString("InvalidSubscriptionsDataSchema", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Role {0} VM size should be ExtraSmall, Small, Medium, Large or ExtraLarge.. + /// + public static string InvalidVMSize + { + get + { + return ResourceManager.GetString("InvalidVMSize", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The web job file must have *.zip extension. + /// + public static string InvalidWebJobFile + { + get + { + return ResourceManager.GetString("InvalidWebJobFile", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Singleton option works for continuous jobs only.. + /// + public static string InvalidWebJobSingleton + { + get + { + return ResourceManager.GetString("InvalidWebJobSingleton", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The website {0} was not found. Please specify a valid website name.. + /// + public static string InvalidWebsite + { + get + { + return ResourceManager.GetString("InvalidWebsite", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to No job for id: {0} was found.. + /// + public static string JobNotFound + { + get + { + return ResourceManager.GetString("JobNotFound", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to engines. + /// + public static string JsonEnginesSectionName + { + get + { + return ResourceManager.GetString("JsonEnginesSectionName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Scaffolding for this language is not yet supported. + /// + public static string LanguageScaffoldingIsNotSupported + { + get + { + return ResourceManager.GetString("LanguageScaffoldingIsNotSupported", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Link already established. + /// + public static string LinkAlreadyEstablished + { + get + { + return ResourceManager.GetString("LinkAlreadyEstablished", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to local_package.csx. + /// + public static string LocalPackageFileName + { + get + { + return ResourceManager.GetString("LocalPackageFileName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to ServiceConfiguration.Local.cscfg. + /// + public static string LocalServiceConfigurationFileName + { + get + { + return ResourceManager.GetString("LocalServiceConfigurationFileName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Looking for {0} deployment for {1} cloud service.... + /// + public static string LookingForDeploymentMessage + { + get + { + return ResourceManager.GetString("LookingForDeploymentMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Looking for cloud service {0}.... + /// + public static string LookingForServiceMessage + { + get + { + return ResourceManager.GetString("LookingForServiceMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Azure Long-Running Job. + /// + public static string LROJobName + { + get + { + return ResourceManager.GetString("LROJobName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The cmdlet failed in background execution. The returned error was '{0}'. Please execute the cmdlet again. You may need to execute this cmdlet synchronously, by omitting the '-AsJob' parameter.. + /// + public static string LROTaskExceptionMessage + { + get + { + return ResourceManager.GetString("LROTaskExceptionMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to managementCertificate.pem. + /// + public static string ManagementCertificateFileName + { + get + { + return ResourceManager.GetString("ManagementCertificateFileName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to ?whr={0}. + /// + public static string ManagementPortalRealmFormat + { + get + { + return ResourceManager.GetString("ManagementPortalRealmFormat", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to //baseuri. + /// + public static string ManifestBaseUriQuery + { + get + { + return ResourceManager.GetString("ManifestBaseUriQuery", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to uri. + /// + public static string ManifestBlobUriKey + { + get + { + return ResourceManager.GetString("ManifestBlobUriKey", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to http://az413943.vo.msecnd.net/node/runtimemanifest_0.7.5.2.xml. + /// + public static string ManifestUri + { + get + { + return ResourceManager.GetString("ManifestUri", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Property bag Hashtable must contain a 'Certificate' of type 'X509Certificate2'.. + /// + public static string MissingCertificateInProfileProperties + { + get + { + return ResourceManager.GetString("MissingCertificateInProfileProperties", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Property bag Hashtable must contain a 'Password' with an associated 'Username' or 'ServicePrincipal'.. + /// + public static string MissingPasswordInProfileProperties + { + get + { + return ResourceManager.GetString("MissingPasswordInProfileProperties", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Property bag Hashtable must contain a 'SubscriptionId'.. + /// + public static string MissingSubscriptionInProfileProperties + { + get + { + return ResourceManager.GetString("MissingSubscriptionInProfileProperties", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Multiple Add-Ons found holding name {0}. + /// + public static string MultipleAddOnsFoundMessage + { + get + { + return ResourceManager.GetString("MultipleAddOnsFoundMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Multiple possible publishing users. Please go to the Portal and use the listed deployment user, or click 'set/reset deployment credentials' to set up a new user account, then reurn this cmdlet and specify PublishingUsername.. + /// + public static string MultiplePublishingUsernames + { + get + { + return ResourceManager.GetString("MultiplePublishingUsernames", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The first publish settings file "{0}" is used. If you want to use another file specify the file name.. + /// + public static string MultiplePublishSettingsFilesFoundMessage + { + get + { + return ResourceManager.GetString("MultiplePublishSettingsFilesFoundMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Microsoft.WindowsAzure.Plugins.Caching.NamedCaches. + /// + public static string NamedCacheSettingName + { + get + { + return ResourceManager.GetString("NamedCacheSettingName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {"caches":[{"name":"default","policy":{"eviction":{"type":0},"expiration":{"defaultTTL":10,"isExpirable":true,"type":1},"serverNotification":{"isEnabled":false}},"secondaries":0}]}. + /// + public static string NamedCacheSettingValue + { + get + { + return ResourceManager.GetString("NamedCacheSettingValue", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to A publishing username is required. Please specify one using the argument PublishingUsername.. + /// + public static string NeedPublishingUsernames + { + get + { + return ResourceManager.GetString("NeedPublishingUsernames", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to New Add-On Confirmation. + /// + public static string NewAddOnConformation + { + get + { + return ResourceManager.GetString("NewAddOnConformation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to By typing "Yes", I (a) authorize Microsoft to charge my current payment method on a monthly basis + ///for the amount indicated at {0} for {1} until my service is cancelled or terminated, and (b) + ///agree to the {2}'s terms of user and privacy statement at {0} and (c) agree to sharing my + ///contact information with {2}.. + /// + public static string NewMicrosoftAddOnMessage + { + get + { + return ResourceManager.GetString("NewMicrosoftAddOnMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Internal Server Error. This could happen because the namespace name is already used or due to an incorrect location name. Use Get-AzureSBLocation cmdlet to list valid names.. + /// + public static string NewNamespaceErrorMessage + { + get + { + return ResourceManager.GetString("NewNamespaceErrorMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to By typing "Yes", I (a) authorize Microsoft to charge my current payment method on a monthly basis + ///for the amount indicated at {0} for {1} until my service is cancelled or terminated, and (b) + ///acknowledge the offering is provided by {2}, not Microsoft, and agree to {2}'s terms of + ///use and privacy statement at {0} and (c) agree to sharing my contact information with {2}.. + /// + public static string NewNonMicrosoftAddOnMessage + { + get + { + return ResourceManager.GetString("NewNonMicrosoftAddOnMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Service has been created at {0}. + /// + public static string NewServiceCreatedMessage + { + get + { + return ResourceManager.GetString("NewServiceCreatedMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to No. + /// + public static string No + { + get + { + return ResourceManager.GetString("No", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to There is no access token cached for subscription {0}, user id {1}. Use the Add-AzureAccount cmdlet to log in again and get a token for this subscription.. + /// + public static string NoCachedToken + { + get + { + return ResourceManager.GetString("NoCachedToken", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The service does not have any cache worker roles, add one first by running cmdlet Add-AzureCacheWorkerRole.. + /// + public static string NoCacheWorkerRoles + { + get + { + return ResourceManager.GetString("NoCacheWorkerRoles", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to No clouds available. + /// + public static string NoCloudsAvailable + { + get + { + return ResourceManager.GetString("NoCloudsAvailable", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to "There is no current context, please log in using Connect-AzAccount.". + /// + public static string NoCurrentContextForDataCmdlet + { + get + { + return ResourceManager.GetString("NoCurrentContextForDataCmdlet", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to nodejs. + /// + public static string NodeDirectory + { + get + { + return ResourceManager.GetString("NodeDirectory", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to node. + /// + public static string NodeEngineKey + { + get + { + return ResourceManager.GetString("NodeEngineKey", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to node.exe. + /// + public static string NodeExe + { + get + { + return ResourceManager.GetString("NodeExe", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to There is no default subscription set, please set a default subscription by running Set-AzureSubscription -Default <subscription name>. + /// + public static string NoDefaultSubscriptionMessage + { + get + { + return ResourceManager.GetString("NoDefaultSubscriptionMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Microsoft SDKs\Azure\Nodejs\Nov2011. + /// + public static string NodeModulesPath + { + get + { + return ResourceManager.GetString("NodeModulesPath", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to nodejs. + /// + public static string NodeProgramFilesFolderName + { + get + { + return ResourceManager.GetString("NodeProgramFilesFolderName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to node. + /// + public static string NodeRuntimeValue + { + get + { + return ResourceManager.GetString("NodeRuntimeValue", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Resources\Scaffolding\Node. + /// + public static string NodeScaffolding + { + get + { + return ResourceManager.GetString("NodeScaffolding", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Microsoft.WindowsAzure.Commands.CloudService.ScaffoldingResources.Node. + /// + public static string NodeScaffoldingResources + { + get + { + return ResourceManager.GetString("NodeScaffoldingResources", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Installing Node version {0} in Azure for Role '{1}' (the Node version locally installed is: {2}). + /// + public static string NodeVersionWarningText + { + get + { + return ResourceManager.GetString("NodeVersionWarningText", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to No, I do not agree. + /// + public static string NoHint + { + get + { + return ResourceManager.GetString("NoHint", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Please connect to internet before executing this cmdlet. + /// + public static string NoInternetConnection + { + get + { + return ResourceManager.GetString("NoInternetConnection", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to <NONE>. + /// + public static string None + { + get + { + return ResourceManager.GetString("None", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to No publish settings files with extension *.publishsettings are found in the directory "{0}".. + /// + public static string NoPublishSettingsFilesFoundMessage + { + get + { + return ResourceManager.GetString("NoPublishSettingsFilesFoundMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to There is no subscription associated with account {0}.. + /// + public static string NoSubscriptionAddedMessage + { + get + { + return ResourceManager.GetString("NoSubscriptionAddedMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to No subscriptions are associated with the logged in account in Azure Service Management (RDFE). This means that the logged in user is not an administrator or co-administrator for any account.\r\nDid you mean to execute Connect-AzAccount?. + /// + public static string NoSubscriptionFoundForTenant + { + get + { + return ResourceManager.GetString("NoSubscriptionFoundForTenant", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to '{0}' must be a cache worker role. Verify that it has proper cache worker role configuration.. + /// + public static string NotCacheWorkerRole + { + get + { + return ResourceManager.GetString("NotCacheWorkerRole", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Certificate can't be null.. + /// + public static string NullCertificateMessage + { + get + { + return ResourceManager.GetString("NullCertificateMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {0} could not be null or empty. + /// + public static string NullObjectMessage + { + get + { + return ResourceManager.GetString("NullObjectMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Unable to add a null RoleSettings to {0}. + /// + public static string NullRoleSettingsMessage + { + get + { + return ResourceManager.GetString("NullRoleSettingsMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Unable to add new role to null service definition. + /// + public static string NullServiceDefinitionMessage + { + get + { + return ResourceManager.GetString("NullServiceDefinitionMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The request offer '{0}' is not found.. + /// + public static string OfferNotFoundMessage + { + get + { + return ResourceManager.GetString("OfferNotFoundMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Operation "{0}" failed on VM with ID: {1}. + /// + public static string OperationFailedErrorMessage + { + get + { + return ResourceManager.GetString("OperationFailedErrorMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The REST operation failed with message '{0}' and error code '{1}'. + /// + public static string OperationFailedMessage + { + get + { + return ResourceManager.GetString("OperationFailedMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Job Id {0} did not complete within expected time or it is in Failed/Canceled/Invalid state.. + /// + public static string OperationTimedOutOrError + { + get + { + return ResourceManager.GetString("OperationTimedOutOrError", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to package. + /// + public static string Package + { + get + { + return ResourceManager.GetString("Package", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Package is created at service root path {0}.. + /// + public static string PackageCreated + { + get + { + return ResourceManager.GetString("PackageCreated", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {{ + /// "author": "", + /// + /// "name": "{0}", + /// "version": "0.0.0", + /// "dependencies":{{}}, + /// "devDependencies":{{}}, + /// "optionalDependencies": {{}}, + /// "engines": {{ + /// "node": "*", + /// "iisnode": "*" + /// }} + /// + ///}} + ///. + /// + public static string PackageJsonDefaultFile + { + get + { + return ResourceManager.GetString("PackageJsonDefaultFile", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to package.json. + /// + public static string PackageJsonFileName + { + get + { + return ResourceManager.GetString("PackageJsonFileName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Path {0} doesn't exist.. + /// + public static string PathDoesNotExist + { + get + { + return ResourceManager.GetString("PathDoesNotExist", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Path for {0} doesn't exist in {1}.. + /// + public static string PathDoesNotExistForElement + { + get + { + return ResourceManager.GetString("PathDoesNotExistForElement", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to A value for the Peer Asn has to be provided.. + /// + public static string PeerAsnRequired + { + get + { + return ResourceManager.GetString("PeerAsnRequired", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to 5.4.0. + /// + public static string PHPDefaultRuntimeVersion + { + get + { + return ResourceManager.GetString("PHPDefaultRuntimeVersion", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to php. + /// + public static string PhpRuntimeValue + { + get + { + return ResourceManager.GetString("PhpRuntimeValue", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Resources\Scaffolding\PHP. + /// + public static string PHPScaffolding + { + get + { + return ResourceManager.GetString("PHPScaffolding", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Microsoft.WindowsAzure.Commands.CloudService.ScaffoldingResources.PHP. + /// + public static string PHPScaffoldingResources + { + get + { + return ResourceManager.GetString("PHPScaffoldingResources", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Installing PHP version {0} for Role '{1}' (the PHP version locally installed is: {2}). + /// + public static string PHPVersionWarningText + { + get + { + return ResourceManager.GetString("PHPVersionWarningText", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to You must create your first web site using the Microsoft Azure portal. + ///Please follow these steps in the portal: + ///1. At the bottom of the page, click on New > Web Site > Quick Create + ///2. Type {0} in the URL field + ///3. Click on "Create Web Site" + ///4. Once the site has been created, click on the site name + ///5. Click on "Set up Git publishing" or "Reset deployment credentials" and setup a publishing username and password. Use those credentials for all new websites you create.. + /// + public static string PortalInstructions + { + get + { + return ResourceManager.GetString("PortalInstructions", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to 6. Back in the console window, rerun this command by typing "New-AzureWebsite <site name> -Git". + /// + public static string PortalInstructionsGit + { + get + { + return ResourceManager.GetString("PortalInstructionsGit", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to This cmdlet is in preview. The functionality may not be available in the selected subscription. + /// + public static string PreviewCmdletMessage + { + get + { + return ResourceManager.GetString("PreviewCmdletMessage", resourceCulture); + } + } + + + /// + /// Looks up a localized string similar to A value for the Primary Peer Subnet has to be provided.. + /// + public static string PrimaryPeerSubnetRequired + { + get + { + return ResourceManager.GetString("PrimaryPeerSubnetRequired", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Promotion code can be used only when updating to a new plan.. + /// + public static string PromotionCodeWithCurrentPlanMessage + { + get + { + return ResourceManager.GetString("PromotionCodeWithCurrentPlanMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Service not published at user request.. + /// + public static string PublishAbortedAtUserRequest + { + get + { + return ResourceManager.GetString("PublishAbortedAtUserRequest", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Complete.. + /// + public static string PublishCompleteMessage + { + get + { + return ResourceManager.GetString("PublishCompleteMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Connecting.... + /// + public static string PublishConnectingMessage + { + get + { + return ResourceManager.GetString("PublishConnectingMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Created Deployment ID: {0}.. + /// + public static string PublishCreatedDeploymentMessage + { + get + { + return ResourceManager.GetString("PublishCreatedDeploymentMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Created hosted service '{0}'.. + /// + public static string PublishCreatedServiceMessage + { + get + { + return ResourceManager.GetString("PublishCreatedServiceMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Created Website URL: {0}.. + /// + public static string PublishCreatedWebsiteMessage + { + get + { + return ResourceManager.GetString("PublishCreatedWebsiteMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Creating.... + /// + public static string PublishCreatingServiceMessage + { + get + { + return ResourceManager.GetString("PublishCreatingServiceMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Initializing.... + /// + public static string PublishInitializingMessage + { + get + { + return ResourceManager.GetString("PublishInitializingMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to busy. + /// + public static string PublishInstanceStatusBusy + { + get + { + return ResourceManager.GetString("PublishInstanceStatusBusy", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to creating the virtual machine. + /// + public static string PublishInstanceStatusCreating + { + get + { + return ResourceManager.GetString("PublishInstanceStatusCreating", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Instance {0} of role {1} is {2}.. + /// + public static string PublishInstanceStatusMessage + { + get + { + return ResourceManager.GetString("PublishInstanceStatusMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to ready. + /// + public static string PublishInstanceStatusReady + { + get + { + return ResourceManager.GetString("PublishInstanceStatusReady", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Preparing deployment for {0} with Subscription ID: {1}.... + /// + public static string PublishPreparingDeploymentMessage + { + get + { + return ResourceManager.GetString("PublishPreparingDeploymentMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Publishing {0} to Microsoft Azure. This may take several minutes.... + /// + public static string PublishServiceStartMessage + { + get + { + return ResourceManager.GetString("PublishServiceStartMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to publish settings. + /// + public static string PublishSettings + { + get + { + return ResourceManager.GetString("PublishSettings", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Azure. + /// + public static string PublishSettingsElementName + { + get + { + return ResourceManager.GetString("PublishSettingsElementName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to .PublishSettings. + /// + public static string PublishSettingsFileExtention + { + get + { + return ResourceManager.GetString("PublishSettingsFileExtention", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to publishSettings.xml. + /// + public static string PublishSettingsFileName + { + get + { + return ResourceManager.GetString("PublishSettingsFileName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to &whr={0}. + /// + public static string PublishSettingsFileRealmFormat + { + get + { + return ResourceManager.GetString("PublishSettingsFileRealmFormat", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Publish settings imported. + /// + public static string PublishSettingsSetSuccessfully + { + get + { + return ResourceManager.GetString("PublishSettingsSetSuccessfully", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to AZURE_PUBLISHINGPROFILE_URL. + /// + public static string PublishSettingsUrlEnv + { + get + { + return ResourceManager.GetString("PublishSettingsUrlEnv", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Starting.... + /// + public static string PublishStartingMessage + { + get + { + return ResourceManager.GetString("PublishStartingMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Upgrading.... + /// + public static string PublishUpgradingMessage + { + get + { + return ResourceManager.GetString("PublishUpgradingMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Uploading Package to storage service {0}.... + /// + public static string PublishUploadingPackageMessage + { + get + { + return ResourceManager.GetString("PublishUploadingPackageMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Verifying storage account '{0}'.... + /// + public static string PublishVerifyingStorageMessage + { + get + { + return ResourceManager.GetString("PublishVerifyingStorageMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Path '{0}' not found.. + /// + public static string PublishVMDscExtensionAdditionalContentPathNotExist + { + get + { + return ResourceManager.GetString("PublishVMDscExtensionAdditionalContentPathNotExist", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Configuration published to {0}. + /// + public static string PublishVMDscExtensionArchiveUploadedMessage + { + get + { + return ResourceManager.GetString("PublishVMDscExtensionArchiveUploadedMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Copy '{0}' to '{1}'.. + /// + public static string PublishVMDscExtensionCopyFileVerbose + { + get + { + return ResourceManager.GetString("PublishVMDscExtensionCopyFileVerbose", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Copy the module '{0}' to '{1}'.. + /// + public static string PublishVMDscExtensionCopyModuleVerbose + { + get + { + return ResourceManager.GetString("PublishVMDscExtensionCopyModuleVerbose", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Invalid configuration file: {0}. + ///The file needs to be a PowerShell script (.ps1 or .psm1).. + /// + public static string PublishVMDscExtensionCreateArchiveConfigFileInvalidExtension + { + get + { + return ResourceManager.GetString("PublishVMDscExtensionCreateArchiveConfigFileInvalidExtension", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Deleted '{0}'. + /// + public static string PublishVMDscExtensionDeletedFileMessage + { + get + { + return ResourceManager.GetString("PublishVMDscExtensionDeletedFileMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Cannot delete '{0}': {1}. + /// + public static string PublishVMDscExtensionDeleteErrorMessage + { + get + { + return ResourceManager.GetString("PublishVMDscExtensionDeleteErrorMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Path '{0}' not found.. + /// + public static string PublishVMDscExtensionDirectoryNotExist + { + get + { + return ResourceManager.GetString("PublishVMDscExtensionDirectoryNotExist", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Cannot get module for DscResource '{0}'. Possible solutions: + ///1) Specify -ModuleName for Import-DscResource in your configuration. + ///2) Unblock module that contains resource. + ///3) Move Import-DscResource inside Node block. + ///. + /// + public static string PublishVMDscExtensionGetDscResourceFailed + { + get + { + return ResourceManager.GetString("PublishVMDscExtensionGetDscResourceFailed", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to List of required modules: [{0}].. + /// + public static string PublishVMDscExtensionRequiredModulesVerbose + { + get + { + return ResourceManager.GetString("PublishVMDscExtensionRequiredModulesVerbose", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Your current PowerShell version {1} is less then required by this cmdlet {0}. Consider download and install latest PowerShell version.. + /// + public static string PublishVMDscExtensionRequiredPsVersion + { + get + { + return ResourceManager.GetString("PublishVMDscExtensionRequiredPsVersion", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Configuration script '{0}' contained parse errors: + ///{1}. + /// + public static string PublishVMDscExtensionStorageParserErrors + { + get + { + return ResourceManager.GetString("PublishVMDscExtensionStorageParserErrors", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Temp folder '{0}' created.. + /// + public static string PublishVMDscExtensionTempFolderVerbose + { + get + { + return ResourceManager.GetString("PublishVMDscExtensionTempFolderVerbose", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Invalid configuration file: {0}. + ///The file needs to be a PowerShell script (.ps1 or .psm1) or a ZIP archive (.zip).. + /// + public static string PublishVMDscExtensionUploadArchiveConfigFileInvalidExtension + { + get + { + return ResourceManager.GetString("PublishVMDscExtensionUploadArchiveConfigFileInvalidExtension", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Configuration file '{0}' not found.. + /// + public static string PublishVMDscExtensionUploadArchiveConfigFileNotExist + { + get + { + return ResourceManager.GetString("PublishVMDscExtensionUploadArchiveConfigFileNotExist", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Azure PowerShell collects usage data in order to improve your experience. + ///The data is anonymous and does not include commandline argument values. + ///The data is collected by Microsoft. + /// + ///Use the Disable-AzureDataCollection cmdlet to turn the feature Off. The cmdlet can be found in the Azure module. To disable data collection: PS > Disable-AzureDataCollection. + ///Use the Enable-AzureDataCollection cmdlet to turn the feature On. The cmdlet can be found in the Azure module. To enable data collection: PS > Enab [rest of string was truncated]";. + /// + public static string RDFEDataCollectionMessage + { + get + { + return ResourceManager.GetString("RDFEDataCollectionMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Replace current deployment with '{0}' Id ?. + /// + public static string RedeployCommit + { + get + { + return ResourceManager.GetString("RedeployCommit", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Are you sure you want to regenerate key?. + /// + public static string RegenerateKeyWarning + { + get + { + return ResourceManager.GetString("RegenerateKeyWarning", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Generate new key.. + /// + public static string RegenerateKeyWhatIfMessage + { + get + { + return ResourceManager.GetString("RegenerateKeyWhatIfMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Are you sure you want to remove account '{0}'?. + /// + public static string RemoveAccountConfirmation + { + get + { + return ResourceManager.GetString("RemoveAccountConfirmation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing account. + /// + public static string RemoveAccountMessage + { + get + { + return ResourceManager.GetString("RemoveAccountMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Remove Add-On Confirmation. + /// + public static string RemoveAddOnConformation + { + get + { + return ResourceManager.GetString("RemoveAddOnConformation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to If you delete this add-on, your data may be deleted and the operation may not be undone. You may have to purchase it again from the Microsoft Azure Store to use it. The price of the add-on may not be refunded. Are you sure you want to delete this add-on? Enter “Yes” to confirm.. + /// + public static string RemoveAddOnMessage + { + get + { + return ResourceManager.GetString("RemoveAddOnMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Remove-AzureBGPPeering Operation failed.. + /// + public static string RemoveAzureBGPPeeringFailed + { + get + { + return ResourceManager.GetString("RemoveAzureBGPPeeringFailed", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing Bgp Peering. + /// + public static string RemoveAzureBGPPeeringMessage + { + get + { + return ResourceManager.GetString("RemoveAzureBGPPeeringMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Successfully removed Azure Bgp Peering with Service Key {0}.. + /// + public static string RemoveAzureBGPPeeringSucceeded + { + get + { + return ResourceManager.GetString("RemoveAzureBGPPeeringSucceeded", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Are you sure you want to remove the Bgp Peering with service key '{0}'?. + /// + public static string RemoveAzureBGPPeeringWarning + { + get + { + return ResourceManager.GetString("RemoveAzureBGPPeeringWarning", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Are you sure you want to remove the Dedicated Circuit with service key '{0}'?. + /// + public static string RemoveAzureDedicatdCircuitWarning + { + get + { + return ResourceManager.GetString("RemoveAzureDedicatdCircuitWarning", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Remove-AzureDedicatedCircuit Operation failed.. + /// + public static string RemoveAzureDedicatedCircuitFailed + { + get + { + return ResourceManager.GetString("RemoveAzureDedicatedCircuitFailed", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Remove-AzureDedicatedCircuitLink Operation failed.. + /// + public static string RemoveAzureDedicatedCircuitLinkFailed + { + get + { + return ResourceManager.GetString("RemoveAzureDedicatedCircuitLinkFailed", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing Dedicated Circui Link. + /// + public static string RemoveAzureDedicatedCircuitLinkMessage + { + get + { + return ResourceManager.GetString("RemoveAzureDedicatedCircuitLinkMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Successfully removed Azure Dedicated Circuit Link with Service Key {0} and Vnet Name {1}. + /// + public static string RemoveAzureDedicatedCircuitLinkSucceeded + { + get + { + return ResourceManager.GetString("RemoveAzureDedicatedCircuitLinkSucceeded", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Are you sure you want to remove the Dedicated Circuit Link with service key '{0}' and virtual network name '{1}'?. + /// + public static string RemoveAzureDedicatedCircuitLinkWarning + { + get + { + return ResourceManager.GetString("RemoveAzureDedicatedCircuitLinkWarning", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing Dedicated Circuit. + /// + public static string RemoveAzureDedicatedCircuitMessage + { + get + { + return ResourceManager.GetString("RemoveAzureDedicatedCircuitMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Successfully removed Azure Dedicated Circuit with Service Key {0}.. + /// + public static string RemoveAzureDedicatedCircuitSucceeded + { + get + { + return ResourceManager.GetString("RemoveAzureDedicatedCircuitSucceeded", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing cloud service {0}.... + /// + public static string RemoveAzureServiceWaitMessage + { + get + { + return ResourceManager.GetString("RemoveAzureServiceWaitMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The default subscription is being removed. Use Select-AzureSubscription -Default <subscriptionName> to select a new default subscription.. + /// + public static string RemoveDefaultSubscription + { + get + { + return ResourceManager.GetString("RemoveDefaultSubscription", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing {0} deployment for {1} service. + /// + public static string RemoveDeploymentWaitMessage + { + get + { + return ResourceManager.GetString("RemoveDeploymentWaitMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing an environment will remove all associated subscriptions and accounts. Are you sure you want to remove an environment '{0}'?. + /// + public static string RemoveEnvironmentConfirmation + { + get + { + return ResourceManager.GetString("RemoveEnvironmentConfirmation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing environment. + /// + public static string RemoveEnvironmentMessage + { + get + { + return ResourceManager.GetString("RemoveEnvironmentMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing job collection. + /// + public static string RemoveJobCollectionMessage + { + get + { + return ResourceManager.GetString("RemoveJobCollectionMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Are you sure you want to remove the job collection "{0}". + /// + public static string RemoveJobCollectionWarning + { + get + { + return ResourceManager.GetString("RemoveJobCollectionWarning", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing job. + /// + public static string RemoveJobMessage + { + get + { + return ResourceManager.GetString("RemoveJobMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Are you sure you want to remove the job "{0}". + /// + public static string RemoveJobWarning + { + get + { + return ResourceManager.GetString("RemoveJobWarning", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Are you sure you want to remove the account?. + /// + public static string RemoveMediaAccountWarning + { + get + { + return ResourceManager.GetString("RemoveMediaAccountWarning", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Account removed.. + /// + public static string RemoveMediaAccountWhatIfMessage + { + get + { + return ResourceManager.GetString("RemoveMediaAccountWhatIfMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Internal Server Error. This could happen because the namespace does not exist or it does not exist under your subscription.. + /// + public static string RemoveNamespaceErrorMessage + { + get + { + return ResourceManager.GetString("RemoveNamespaceErrorMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing old package {0}.... + /// + public static string RemovePackage + { + get + { + return ResourceManager.GetString("RemovePackage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing the Azure profile will remove all associated environments, subscriptions, and accounts. Are you sure you want to remove the Azure profile?. + /// + public static string RemoveProfileConfirmation + { + get + { + return ResourceManager.GetString("RemoveProfileConfirmation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing the Azure profile. + /// + public static string RemoveProfileMessage + { + get + { + return ResourceManager.GetString("RemoveProfileMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Are you sure you want to delete the namespace '{0}'?. + /// + public static string RemoveServiceBusNamespaceConfirmation + { + get + { + return ResourceManager.GetString("RemoveServiceBusNamespaceConfirmation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Are you sure you want to remove cloud service?. + /// + public static string RemoveServiceWarning + { + get + { + return ResourceManager.GetString("RemoveServiceWarning", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Remove cloud service and all it's deployments. + /// + public static string RemoveServiceWhatIfMessage + { + get + { + return ResourceManager.GetString("RemoveServiceWhatIfMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Are you sure you want to remove subscription '{0}'?. + /// + public static string RemoveSubscriptionConfirmation + { + get + { + return ResourceManager.GetString("RemoveSubscriptionConfirmation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing subscription. + /// + public static string RemoveSubscriptionMessage + { + get + { + return ResourceManager.GetString("RemoveSubscriptionMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The endpoint {0} cannot be removed from profile {1} because it's not in the profile.. + /// + public static string RemoveTrafficManagerEndpointMissing + { + get + { + return ResourceManager.GetString("RemoveTrafficManagerEndpointMissing", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Remove-AzureTrafficManagerProfile Operation failed.. + /// + public static string RemoveTrafficManagerProfileFailed + { + get + { + return ResourceManager.GetString("RemoveTrafficManagerProfileFailed", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Successfully removed Traffic Manager profile with name {0}.. + /// + public static string RemoveTrafficManagerProfileSucceeded + { + get + { + return ResourceManager.GetString("RemoveTrafficManagerProfileSucceeded", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Are you sure you want to remove the Traffic Manager profile "{0}"?. + /// + public static string RemoveTrafficManagerProfileWarning + { + get + { + return ResourceManager.GetString("RemoveTrafficManagerProfileWarning", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Are you sure you want to delete the VM '{0}'?. + /// + public static string RemoveVMConfirmationMessage + { + get + { + return ResourceManager.GetString("RemoveVMConfirmationMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Deleting VM.. + /// + public static string RemoveVMMessage + { + get + { + return ResourceManager.GetString("RemoveVMMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing WebJob.... + /// + public static string RemoveWebJobMessage + { + get + { + return ResourceManager.GetString("RemoveWebJobMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Are you sure you want to remove job '{0}'?. + /// + public static string RemoveWebJobWarning + { + get + { + return ResourceManager.GetString("RemoveWebJobWarning", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing website. + /// + public static string RemoveWebsiteMessage + { + get + { + return ResourceManager.GetString("RemoveWebsiteMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Are you sure you want to remove the website "{0}". + /// + public static string RemoveWebsiteWarning + { + get + { + return ResourceManager.GetString("RemoveWebsiteWarning", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing public environment is not supported.. + /// + public static string RemovingDefaultEnvironmentsNotSupported + { + get + { + return ResourceManager.GetString("RemovingDefaultEnvironmentsNotSupported", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Deleting namespace. + /// + public static string RemovingNamespaceMessage + { + get + { + return ResourceManager.GetString("RemovingNamespaceMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Repository is not setup. You need to pass a valid site name.. + /// + public static string RepositoryNotSetup + { + get + { + return ResourceManager.GetString("RepositoryNotSetup", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Reserved IP with the Name:'{0}' will no longer be in use after the deployment is deleted, and it is still reserved for later use.. + /// + public static string ReservedIPNameNoLongerInUseButStillBeingReserved + { + get + { + return ResourceManager.GetString("ReservedIPNameNoLongerInUseButStillBeingReserved", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Resource with ID : {0} does not exist.. + /// + public static string ResourceNotFound + { + get + { + return ResourceManager.GetString("ResourceNotFound", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Restart. + /// + public static string Restart + { + get + { + return ResourceManager.GetString("Restart", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Resume. + /// + public static string Resume + { + get + { + return ResourceManager.GetString("Resume", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to /role:{0};"{1}/{0}" . + /// + public static string RoleArgTemplate + { + get + { + return ResourceManager.GetString("RoleArgTemplate", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to bin. + /// + public static string RoleBinFolderName + { + get + { + return ResourceManager.GetString("RoleBinFolderName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Role {0} is {1}. + /// + public static string RoleInstanceWaitMsg + { + get + { + return ResourceManager.GetString("RoleInstanceWaitMsg", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to 20. + /// + public static string RoleMaxInstances + { + get + { + return ResourceManager.GetString("RoleMaxInstances", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to role name. + /// + public static string RoleName + { + get + { + return ResourceManager.GetString("RoleName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The provided role name {0} doesn't exist. + /// + public static string RoleNotFoundMessage + { + get + { + return ResourceManager.GetString("RoleNotFoundMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to RoleSettings.xml. + /// + public static string RoleSettingsTemplateFileName + { + get + { + return ResourceManager.GetString("RoleSettingsTemplateFileName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Role type {0} doesn't exist. + /// + public static string RoleTypeDoesNotExist + { + get + { + return ResourceManager.GetString("RoleTypeDoesNotExist", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to public static Dictionary<string, Location> ReverseLocations { get; private set; }. + /// + public static string RuntimeDeploymentLocationError + { + get + { + return ResourceManager.GetString("RuntimeDeploymentLocationError", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Preparing runtime deployment for service '{0}'. + /// + public static string RuntimeDeploymentStart + { + get + { + return ResourceManager.GetString("RuntimeDeploymentStart", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to WARNING Runtime Mismatch: Are you sure that you want to publish service '{0}' using an Azure runtime version that does not match your local runtime version?. + /// + public static string RuntimeMismatchWarning + { + get + { + return ResourceManager.GetString("RuntimeMismatchWarning", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to RUNTIMEOVERRIDEURL. + /// + public static string RuntimeOverrideKey + { + get + { + return ResourceManager.GetString("RuntimeOverrideKey", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to /runtimemanifest/runtimes/runtime. + /// + public static string RuntimeQuery + { + get + { + return ResourceManager.GetString("RuntimeQuery", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to RUNTIMEID. + /// + public static string RuntimeTypeKey + { + get + { + return ResourceManager.GetString("RuntimeTypeKey", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to RUNTIMEURL. + /// + public static string RuntimeUrlKey + { + get + { + return ResourceManager.GetString("RuntimeUrlKey", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to RUNTIMEVERSIONPRIMARYKEY. + /// + public static string RuntimeVersionPrimaryKey + { + get + { + return ResourceManager.GetString("RuntimeVersionPrimaryKey", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to scaffold.xml. + /// + public static string ScaffoldXml + { + get + { + return ResourceManager.GetString("ScaffoldXml", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Invalid location entered. Pick one of the locations from Get-AzureSchedulerLocation. + /// + public static string SchedulerInvalidLocation + { + get + { + return ResourceManager.GetString("SchedulerInvalidLocation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to A value for the Secondary Peer Subnet has to be provided.. + /// + public static string SecondaryPeerSubnetRequired + { + get + { + return ResourceManager.GetString("SecondaryPeerSubnetRequired", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Service {0} already exists on disk in location {1}. + /// + public static string ServiceAlreadyExistsOnDisk + { + get + { + return ResourceManager.GetString("ServiceAlreadyExistsOnDisk", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to No ServiceBus authorization rule with the given characteristics was found. + /// + public static string ServiceBusAuthorizationRuleNotFound + { + get + { + return ResourceManager.GetString("ServiceBusAuthorizationRuleNotFound", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The service bus entity '{0}' is not found.. + /// + public static string ServiceBusEntityTypeNotFound + { + get + { + return ResourceManager.GetString("ServiceBusEntityTypeNotFound", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Internal Server Error. This could happen due to an incorrect/missing namespace. + /// + public static string ServiceBusNamespaceMissingMessage + { + get + { + return ResourceManager.GetString("ServiceBusNamespaceMissingMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to service configuration. + /// + public static string ServiceConfiguration + { + get + { + return ResourceManager.GetString("ServiceConfiguration", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to service definition. + /// + public static string ServiceDefinition + { + get + { + return ResourceManager.GetString("ServiceDefinition", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to ServiceDefinition.csdef. + /// + public static string ServiceDefinitionFileName + { + get + { + return ResourceManager.GetString("ServiceDefinitionFileName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {0}Deploy. + /// + public static string ServiceDeploymentName + { + get + { + return ResourceManager.GetString("ServiceDeploymentName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The specified cloud service "{0}" does not exist.. + /// + public static string ServiceDoesNotExist + { + get + { + return ResourceManager.GetString("ServiceDoesNotExist", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {0} slot for service {1} is in {2} state, please wait until it finish and update it's status. + /// + public static string ServiceIsInTransitionState + { + get + { + return ResourceManager.GetString("ServiceIsInTransitionState", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to "An exception occurred when calling the ServiceManagement API. HTTP Status Code: {0}. Service Management Error Code: {1}. Message: {2}. Operation Tracking ID: {3}.". + /// + public static string ServiceManagementClientExceptionStringFormat + { + get + { + return ResourceManager.GetString("ServiceManagementClientExceptionStringFormat", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Begin Operation: {0}. + /// + public static string ServiceManagementExecuteClientActionBeginOperation + { + get + { + return ResourceManager.GetString("ServiceManagementExecuteClientActionBeginOperation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Completed Operation: {0}. + /// + public static string ServiceManagementExecuteClientActionCompletedOperation + { + get + { + return ResourceManager.GetString("ServiceManagementExecuteClientActionCompletedOperation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Begin Operation: {0}. + /// + public static string ServiceManagementExecuteClientActionInOCSBeginOperation + { + get + { + return ResourceManager.GetString("ServiceManagementExecuteClientActionInOCSBeginOperation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Completed Operation: {0}. + /// + public static string ServiceManagementExecuteClientActionInOCSCompletedOperation + { + get + { + return ResourceManager.GetString("ServiceManagementExecuteClientActionInOCSCompletedOperation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to service name. + /// + public static string ServiceName + { + get + { + return ResourceManager.GetString("ServiceName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The provided service name {0} already exists, please pick another name. + /// + public static string ServiceNameExists + { + get + { + return ResourceManager.GetString("ServiceNameExists", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Please provide name for the hosted service. + /// + public static string ServiceNameMissingMessage + { + get + { + return ResourceManager.GetString("ServiceNameMissingMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to service parent directory. + /// + public static string ServiceParentDirectory + { + get + { + return ResourceManager.GetString("ServiceParentDirectory", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Service {0} removed successfully. + /// + public static string ServiceRemovedMessage + { + get + { + return ResourceManager.GetString("ServiceRemovedMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to service directory. + /// + public static string ServiceRoot + { + get + { + return ResourceManager.GetString("ServiceRoot", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to service settings. + /// + public static string ServiceSettings + { + get + { + return ResourceManager.GetString("ServiceSettings", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The storage account name '{0}' is invalid. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only.. + /// + public static string ServiceSettings_ValidateStorageAccountName_InvalidName + { + get + { + return ResourceManager.GetString("ServiceSettings_ValidateStorageAccountName_InvalidName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The {0} slot for cloud service {1} doesn't exist.. + /// + public static string ServiceSlotDoesNotExist + { + get + { + return ResourceManager.GetString("ServiceSlotDoesNotExist", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {0} slot for service {1} is {2}. + /// + public static string ServiceStatusChanged + { + get + { + return ResourceManager.GetString("ServiceStatusChanged", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Set Add-On Confirmation. + /// + public static string SetAddOnConformation + { + get + { + return ResourceManager.GetString("SetAddOnConformation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Profile {0} does not contain endpoint {1}. Adding it.. + /// + public static string SetInexistentTrafficManagerEndpointMessage + { + get + { + return ResourceManager.GetString("SetInexistentTrafficManagerEndpointMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Note - You will be charged the amount for the new plan, without being refunded for time remaining + ///in the existing plan. + ///By typing "Yes", I (a) authorize Microsoft to charge my current payment method on a monthly basis + ///for the amount indicated at {0} for {1} until my service is cancelled or terminated, and (b) + ///agree to the {2}'s terms of user and privacy statement at {0} and (c) agree to sharing my + ///contact information with {2}.. + /// + public static string SetMicrosoftAddOnMessage + { + get + { + return ResourceManager.GetString("SetMicrosoftAddOnMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Note - You will be charged the amount for the new plan, without being refunded for time remaining + ///in the existing plan. + ///By typing "Yes", I (a) authorize Microsoft to charge my current payment method on a monthly basis + ///for the amount indicated at {0} for {1} until my service is cancelled or terminated, and (b) + ///acknowledge the offering is provided by {2}, not Microsoft, and agree to {2}'s terms of + ///use and privacy statement at <url> and (c) agree to sharing my contact information with {2}.. + /// + public static string SetNonMicrosoftAddOnMessage + { + get + { + return ResourceManager.GetString("SetNonMicrosoftAddOnMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Role {0} instances are set to {1}. + /// + public static string SetRoleInstancesMessage + { + get + { + return ResourceManager.GetString("SetRoleInstancesMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {"Slot":"","Location":"","Subscription":"","StorageAccountName":""}. + /// + public static string SettingsFileEmptyContent + { + get + { + return ResourceManager.GetString("SettingsFileEmptyContent", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to deploymentSettings.json. + /// + public static string SettingsFileName + { + get + { + return ResourceManager.GetString("SettingsFileName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Insufficient parameters passed to create a new endpoint.. + /// + public static string SetTrafficManagerEndpointNeedsParameters + { + get + { + return ResourceManager.GetString("SetTrafficManagerEndpointNeedsParameters", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Ambiguous operation: the profile name specified doesn't match the name of the profile object.. + /// + public static string SetTrafficManagerProfileAmbiguous + { + get + { + return ResourceManager.GetString("SetTrafficManagerProfileAmbiguous", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Please execute the cmdlet again and include the 'Force' parameter, if available, to avoid unnecessary prompts.. + /// + public static string ShouldContinueFail + { + get + { + return ResourceManager.GetString("ShouldContinueFail", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Confirm. + /// + public static string ShouldProcessCaption + { + get + { + return ResourceManager.GetString("ShouldProcessCaption", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Please execute the cmdlet again and omit the 'Confirm' parameter when using the 'AsJob' parameter.. + /// + public static string ShouldProcessFailConfirm + { + get + { + return ResourceManager.GetString("ShouldProcessFailConfirm", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Please increase the user $ConfirmPreference setting, or include turn off confirmation using '-Confirm:$false' when using the 'AsJob' parameter and execute the cmdet again.. + /// + public static string ShouldProcessFailImpact + { + get + { + return ResourceManager.GetString("ShouldProcessFailImpact", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Please execute the cmdlet again and omit the 'WhatIf' parameter when using the 'AsJob' parameter.. + /// + public static string ShouldProcessFailWhatIf + { + get + { + return ResourceManager.GetString("ShouldProcessFailWhatIf", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Shutdown. + /// + public static string Shutdown + { + get + { + return ResourceManager.GetString("Shutdown", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to /sites:{0};{1};"{2}/{0}" . + /// + public static string SitesArgTemplate + { + get + { + return ResourceManager.GetString("SitesArgTemplate", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to 1000. + /// + public static string StandardRetryDelayInMs + { + get + { + return ResourceManager.GetString("StandardRetryDelayInMs", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Start. + /// + public static string Start + { + get + { + return ResourceManager.GetString("Start", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Started. + /// + public static string StartedEmulator + { + get + { + return ResourceManager.GetString("StartedEmulator", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Starting Emulator.... + /// + public static string StartingEmulator + { + get + { + return ResourceManager.GetString("StartingEmulator", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to start. + /// + public static string StartStorageEmulatorCommandArgument + { + get + { + return ResourceManager.GetString("StartStorageEmulatorCommandArgument", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Stop. + /// + public static string Stop + { + get + { + return ResourceManager.GetString("Stop", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Stopping emulator.... + /// + public static string StopEmulatorMessage + { + get + { + return ResourceManager.GetString("StopEmulatorMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Stopped. + /// + public static string StoppedEmulatorMessage + { + get + { + return ResourceManager.GetString("StoppedEmulatorMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to stop. + /// + public static string StopStorageEmulatorCommandArgument + { + get + { + return ResourceManager.GetString("StopStorageEmulatorCommandArgument", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Account Name:. + /// + public static string StorageAccountName + { + get + { + return ResourceManager.GetString("StorageAccountName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Cannot find storage account '{0}' please type the name of an existing storage account.. + /// + public static string StorageAccountNotFound + { + get + { + return ResourceManager.GetString("StorageAccountNotFound", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to AzureStorageEmulator.exe. + /// + public static string StorageEmulatorExe + { + get + { + return ResourceManager.GetString("StorageEmulatorExe", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to InstallPath. + /// + public static string StorageEmulatorInstallPathRegistryKeyValue + { + get + { + return ResourceManager.GetString("StorageEmulatorInstallPathRegistryKeyValue", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to SOFTWARE\Microsoft\Windows Azure Storage Emulator. + /// + public static string StorageEmulatorRegistryKey + { + get + { + return ResourceManager.GetString("StorageEmulatorRegistryKey", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Primary Key:. + /// + public static string StoragePrimaryKey + { + get + { + return ResourceManager.GetString("StoragePrimaryKey", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Secondary Key:. + /// + public static string StorageSecondaryKey + { + get + { + return ResourceManager.GetString("StorageSecondaryKey", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The subscription named {0} already exists.. + /// + public static string SubscriptionAlreadyExists + { + get + { + return ResourceManager.GetString("SubscriptionAlreadyExists", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The SubscriptionDataFile parameter is deprecated. This parameter will be removed in a future release. See https://github.com/Azure/azure-powershell/wiki/Proposed-Design-Stateless-Azure-Profile for a description of the upcoming mechanism for providing alternate sources of subscription information.. + /// + public static string SubscriptionDataFileDeprecated + { + get + { + return ResourceManager.GetString("SubscriptionDataFileDeprecated", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to DefaultSubscriptionData.xml. + /// + public static string SubscriptionDataFileName + { + get + { + return ResourceManager.GetString("SubscriptionDataFileName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The subscription data file {0} does not exist.. + /// + public static string SubscriptionDataFileNotFound + { + get + { + return ResourceManager.GetString("SubscriptionDataFileNotFound", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The subscription id {0} doesn't exist.. + /// + public static string SubscriptionIdNotFoundMessage + { + get + { + return ResourceManager.GetString("SubscriptionIdNotFoundMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Subscription must not be null. + /// + public static string SubscriptionMustNotBeNull + { + get + { + return ResourceManager.GetString("SubscriptionMustNotBeNull", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Subscription name needs to be specified.. + /// + public static string SubscriptionNameNeedsToBeSpecified + { + get + { + return ResourceManager.GetString("SubscriptionNameNeedsToBeSpecified", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The subscription name {0} doesn't exist.. + /// + public static string SubscriptionNameNotFoundMessage + { + get + { + return ResourceManager.GetString("SubscriptionNameNotFoundMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Subscription needs to be specified.. + /// + public static string SubscriptionNeedsToBeSpecified + { + get + { + return ResourceManager.GetString("SubscriptionNeedsToBeSpecified", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Suspend. + /// + public static string Suspend + { + get + { + return ResourceManager.GetString("Suspend", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Swapping website production slot .... + /// + public static string SwappingWebsite + { + get + { + return ResourceManager.GetString("SwappingWebsite", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Are you sure you want to swap the website '{0}' production slot with slot '{1}'?. + /// + public static string SwapWebsiteSlotWarning + { + get + { + return ResourceManager.GetString("SwapWebsiteSlotWarning", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The Switch-AzureMode cmdlet is deprecated and will be removed in a future release.. + /// + public static string SwitchAzureModeDeprecated + { + get + { + return ResourceManager.GetString("SwitchAzureModeDeprecated", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to [AzureLongRunningJob]: Starting cmdlet execution, setting for cmdlet confirmation required: '{0}'. + /// + public static string TraceBeginLROJob + { + get + { + return ResourceManager.GetString("TraceBeginLROJob", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to [AzureLongRunningJob]: Blocking job for ShouldMethod '{0}'. + /// + public static string TraceBlockLROThread + { + get + { + return ResourceManager.GetString("TraceBlockLROThread", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to [AzureLongRunningJob]: Completing cmdlet execution in RunJob. + /// + public static string TraceEndLROJob + { + get + { + return ResourceManager.GetString("TraceEndLROJob", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to [AzureLongRunningJob]: State change from '{0}' to '{1}' because '{2}'. + /// + public static string TraceHandleLROStateChange + { + get + { + return ResourceManager.GetString("TraceHandleLROStateChange", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to [AzureLongRunningJob]: Unblocking job due to stoppage or failure. + /// + public static string TraceHandlerCancelJob + { + get + { + return ResourceManager.GetString("TraceHandlerCancelJob", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to [AzureLongRunningJob]: Unblocking job that was previously blocked.. + /// + public static string TraceHandlerUnblockJob + { + get + { + return ResourceManager.GetString("TraceHandlerUnblockJob", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to [AzureLongRunningJob]: Error in cmdlet execution. + /// + public static string TraceLROJobException + { + get + { + return ResourceManager.GetString("TraceLROJobException", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to [AzureLongRunningJob]: Removing state changed event handler, exception '{0}'. + /// + public static string TraceRemoveLROEventHandler + { + get + { + return ResourceManager.GetString("TraceRemoveLROEventHandler", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to [AzureLongRunningJob]: ShouldMethod '{0}' unblocked.. + /// + public static string TraceUnblockLROThread + { + get + { + return ResourceManager.GetString("TraceUnblockLROThread", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Unable to decode string from base 64. Please make sure the string is correctly encoded: {0}.. + /// + public static string UnableToDecodeBase64String + { + get + { + return ResourceManager.GetString("UnableToDecodeBase64String", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Unable to update mismatching Json structured: {0} {1}.. + /// + public static string UnableToPatchJson + { + get + { + return ResourceManager.GetString("UnableToPatchJson", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The provider {0} is unknown.. + /// + public static string UnknownProviderMessage + { + get + { + return ResourceManager.GetString("UnknownProviderMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Update. + /// + public static string Update + { + get + { + return ResourceManager.GetString("Update", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Updated settings for subscription '{0}'. Current subscription is '{1}'.. + /// + public static string UpdatedSettings + { + get + { + return ResourceManager.GetString("UpdatedSettings", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to User name is not valid.. + /// + public static string UserNameIsNotValid + { + get + { + return ResourceManager.GetString("UserNameIsNotValid", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to User name needs to be specified.. + /// + public static string UserNameNeedsToBeSpecified + { + get + { + return ResourceManager.GetString("UserNameNeedsToBeSpecified", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to A value for the VLan Id has to be provided.. + /// + public static string VlanIdRequired + { + get + { + return ResourceManager.GetString("VlanIdRequired", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Please wait.... + /// + public static string WaitMessage + { + get + { + return ResourceManager.GetString("WaitMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The azure storage emulator is not installed, skip launching.... + /// + public static string WarningWhenStorageEmulatorIsMissing + { + get + { + return ResourceManager.GetString("WarningWhenStorageEmulatorIsMissing", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Web.cloud.config. + /// + public static string WebCloudConfig + { + get + { + return ResourceManager.GetString("WebCloudConfig", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to web.config. + /// + public static string WebConfigTemplateFileName + { + get + { + return ResourceManager.GetString("WebConfigTemplateFileName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to MSDeploy. + /// + public static string WebDeployKeywordInWebSitePublishProfile + { + get + { + return ResourceManager.GetString("WebDeployKeywordInWebSitePublishProfile", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Cannot build the project successfully. Please see logs in {0}.. + /// + public static string WebProjectBuildFailTemplate + { + get + { + return ResourceManager.GetString("WebProjectBuildFailTemplate", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to WebRole. + /// + public static string WebRole + { + get + { + return ResourceManager.GetString("WebRole", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to setup_web.cmd > log.txt. + /// + public static string WebRoleStartupTaskCommandLine + { + get + { + return ResourceManager.GetString("WebRoleStartupTaskCommandLine", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to WebRole.xml. + /// + public static string WebRoleTemplateFileName + { + get + { + return ResourceManager.GetString("WebRoleTemplateFileName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to WebSite with given name {0} already exists in the specified Subscription and Webspace.. + /// + public static string WebsiteAlreadyExists + { + get + { + return ResourceManager.GetString("WebsiteAlreadyExists", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to WebSite with given name {0} already exists in the specified Subscription and Location.. + /// + public static string WebsiteAlreadyExistsReplacement + { + get + { + return ResourceManager.GetString("WebsiteAlreadyExistsReplacement", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Site {0} already has repository created for it.. + /// + public static string WebsiteRepositoryAlreadyExists + { + get + { + return ResourceManager.GetString("WebsiteRepositoryAlreadyExists", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Workspaces/WebsiteExtension/Website/{0}/dashboard/. + /// + public static string WebsiteSufixUrl + { + get + { + return ResourceManager.GetString("WebsiteSufixUrl", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to https://{0}/msdeploy.axd?site={1}. + /// + public static string WebSiteWebDeployUriTemplate + { + get + { + return ResourceManager.GetString("WebSiteWebDeployUriTemplate", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to WorkerRole. + /// + public static string WorkerRole + { + get + { + return ResourceManager.GetString("WorkerRole", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to setup_worker.cmd > log.txt. + /// + public static string WorkerRoleStartupTaskCommandLine + { + get + { + return ResourceManager.GetString("WorkerRoleStartupTaskCommandLine", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to WorkerRole.xml. + /// + public static string WorkerRoleTemplateFileName + { + get + { + return ResourceManager.GetString("WorkerRoleTemplateFileName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to (x86). + /// + public static string x86InProgramFiles + { + get + { + return ResourceManager.GetString("x86InProgramFiles", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Yes. + /// + public static string Yes + { + get + { + return ResourceManager.GetString("Yes", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Yes, I agree. + /// + public static string YesHint + { + get + { + return ResourceManager.GetString("YesHint", resourceCulture); + } + } + } +} diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/Properties/Resources.resx b/swaggerci/recoveryservicessiterecovery/generated/runtime/Properties/Resources.resx new file mode 100644 index 000000000000..598cd53e958a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/Properties/Resources.resx @@ -0,0 +1,1741 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + The remote server returned an error: (401) Unauthorized. + + + Account "{0}" has been added. + + + To switch to a different subscription, please use Select-AzureSubscription. + + + Subscription "{0}" is selected as the default subscription. + + + To view all the subscriptions, please use Get-AzureSubscription. + + + Add-On {0} is created successfully. + + + Add-on name {0} is already used. + + + Add-On {0} not found. + + + Add-on {0} is removed successfully. + + + Add-On {0} is updated successfully. + + + Role has been created at {0}\{1}. + + + Role has been created at {0}\{1}. For easy access to Microsoft Azure services from your application code, install the Microsoft Azure client library for Node.js by running ‘npm install azure’. + + + Role has been created at {0}\{1}. For easy access to Microsoft Azure services from your application code, install the Microsoft Azure client library for PHP by running "pear WindowsAzure/WindowsAzure". + + + Unable to set role permissions. Please give the 'Network Service' user 'Read & execute' and 'Modify' permissions to the role folder, or run PowerShell as an Administrator + + + A role name '{0}' already exists + + + Windows Azure Powershell\ + + + https://manage.windowsazure.com + + + AZURE_PORTAL_URL + + + Azure SDK\{0}\ + + + Base Uri was empty. + WAPackIaaS + + + {0} begin processing without ParameterSet. + + + {0} begin processing with ParameterSet '{1}'. + + + Blob with the name {0} already exists in the account. + + + https://{0}.blob.core.windows.net/ + + + AZURE_BLOBSTORAGE_TEMPLATE + + + CACHERUNTIMEURL + + + cache + + + CacheRuntimeVersion + + + Installing caching version {0} for Role '{1}' (the caching version locally installed is: {2}) + + + Cannot find {0} with name {1}. + + + Deployment for service {0} with {1} slot doesn't exist + + + Can't find valid Microsoft Azure role in current directory {0} + + + service {0} configuration file (ServiceConfiguration.Cloud.cscfg) is either null or doesn't exist + + + Invalid service path! Cannot locate ServiceDefinition.csdef in current folder or parent folders. + + + The subscription named {0} with id {1} is not currently imported. You must import this subscription before it can be updated. + + + ManagementCertificate + + + certificate.pfx + + + Certificate imported into CurrentUser\My\{0} + + + Your account does not have access to the private key for certificate {0} + + + {0} {1} deployment for {2} service + + + Cloud service {0} is in {1} state. + + + Changing/Removing public environment '{0}' is not allowed. + + + Service {0} is set to value {1} + + + Choose which publish settings file to use: + + + Microsoft.WindowsAzure.Plugins.Caching.ClientDiagnosticLevel + + + 1 + + + cloud_package.cspkg + + + ServiceConfiguration.Cloud.cscfg + + + Add-ons for {0} + + + Communication could not be established. This could be due to an invalid subscription ID. Note that subscription IDs are case sensitive. + + + Complete + + + config.json + + + VirtualMachine creation failed. + WAPackIaaS + + + Creating the website failed. If this is the first website for this subscription, please create it using the management portal instead. + + + Microsoft.ApplicationServer.Caching.DataCacheClientsSection, Microsoft.ApplicationServer.Caching.Core + + + //blobcontainer[@datacenter='{0}'] + + + Setting: {0} as the default and current subscription. To view other subscriptions use Get-AzureSubscription + + + none + + + There are no hostnames which could be used for validation. + + + 8080 + + + 1000 + + + Auto + + + 80 + + + Delete + WAPackIaaS + + + The {0} slot for service {1} is already in {2} state + + + The deployment in {0} slot for service {1} is removed + + + Microsoft.WindowsAzure.Plugins.Caching.DiagnosticLevel + + + 1 + + + The key to add already exists in the dictionary. + + + The array index cannot be less than zero. + + + The supplied array does not have enough room to contain the copied elements. + + + The provided dns {0} doesn't exist + + + Microsoft Azure Certificate + + + Endpoint can't be retrieved for storage account + + + {0} end processing. + + + To use Active Directory authentication, you must configure the ActiveDirectoryEndpoint, ActiveDirectoryTenantId, and ActiveDirectorServiceEndpointResourceId for environment of '{0}'. You can configure these properties for this environment using the Set-AzureEnvironment cmdlet. + + + The environment '{0}' already exists. + + + environments.xml + + + Error creating VirtualMachine + WAPackIaaS + + + Unable to download available runtimes for location '{0}' + + + Error updating VirtualMachine + WAPackIaaS + + + Job Id {0} failed. Error: {1}, ExceptionDetails: {2} + WAPackIaaS + + + The HTTP request was forbidden with client authentication scheme 'Anonymous'. + + + This add-on requires you to purchase the first instance through the Microsoft Azure Portal. Subsequent purchases can be performed through PowerShell. + + + Operation Status: + + + Resources\Scaffolding\General + + + Getting all available Microsoft Azure Add-Ons, this may take few minutes... + + + Name{0}Primary Key{0}Seconday Key + + + Git not found. Please install git and place it in your command line path. + + + Could not find publish settings. Please run Import-AzurePublishSettingsFile. + + + iisnode.dll + + + iisnode + + + iisnode-dev\\release\\x64 + + + iisnode + + + Installing IISNode version {0} in Azure for WebRole '{1}' (the version locally installed is: {2}) + + + Internal Server Error + + + Cannot enable memcach protocol on a cache worker role {0}. + + + Invalid certificate format. + + + The provided configuration path is invalid or doesn't exist + + + The country name is invalid, please use a valid two character country code, as described in ISO 3166-1 alpha-2. + + + Deployment with {0} does not exist + + + The deployment slot name {0} is invalid. Slot name must be either "Staging" or "Production". + + + Invalid service endpoint. + + + File {0} has invalid characters + + + You must create your git publishing credentials using the Microsoft Azure portal. +Please follow these steps in the portal: +1. On the left side open "Web Sites" +2. Click on any website +3. Choose "Setup Git Publishing" or "Reset deployment credentials" +4. Back in the PowerShell window, rerun this command by typing "New-AzureWebSite {site name} -Git -PublishingUsername {username} + + + The value {0} provided is not a valid GUID. Please provide a valid GUID. + + + The specified hostname does not exist. Please specify a valid hostname for the site. + + + Role {0} instances must be greater than or equal 0 and less than or equal 20 + + + There was an error creating your webjob. Please make sure that the script is in the root folder of the zip file. + + + Could not download a valid runtime manifest, Please check your internet connection and try again. + + + The account {0} was not found. Please specify a valid account name. + + + The provided name "{0}" does not match the service bus namespace naming rules. + + + Value cannot be null. Parameter name: '{0}' + + + The provided package path is invalid or doesn't exist + + + '{0}' is an invalid parameter set name. + + + {0} doesn't exist in {1} or you've not passed valid value for it + + + Path {0} has invalid characters + + + The provided publish settings file {0} has invalid content. Please get valid by running cmdlet Get-AzurePublishSettingsFile + + + The provided role name "{0}" has invalid characters + + + A valid name for the service root folder is required + + + {0} is not a recognized runtime type + + + A valid language is required + + + No subscription is currently selected. Use Select-Subscription to activate a subscription. + + + The provided location "{0}" does not exist in the available locations use Get-AzureSBLocation for listing available locations. + + + Please provide a service name or run this command from inside a service project directory. + + + You must provide valid value for {0} + + + settings.json is invalid or doesn't exist + + + The subscription named '{0}' cannot be found. Use Set-AzureSubscription to initialize the subscription data. + + + The provided subscription id {0} is not valid + + + A valid subscription name is required. This can be provided using the -Subscription parameter or by setting the subscription via the Set-AzureSubscription cmdlet + + + The provided subscriptions file {0} has invalid content. + + + Role {0} VM size should be ExtraSmall, Small, Medium, Large or ExtraLarge. + + + The web job file must have *.zip extension + + + Singleton option works for continuous jobs only. + + + The website {0} was not found. Please specify a valid website name. + + + No job for id: {0} was found. + WAPackIaaS + + + engines + + + Scaffolding for this language is not yet supported + + + Link already established + + + local_package.csx + + + ServiceConfiguration.Local.cscfg + + + Looking for {0} deployment for {1} cloud service... + + + Looking for cloud service {0}... + + + managementCertificate.pem + + + ?whr={0} + + + //baseuri + + + uri + + + http://az413943.vo.msecnd.net/node/runtimemanifest_0.7.5.2.xml + + + Multiple Add-Ons found holding name {0} + + + Multiple possible publishing users. Please go to the Portal and use the listed deployment user, or click 'set/reset deployment credentials' to set up a new user account, then reurn this cmdlet and specify PublishingUsername. + + + The first publish settings file "{0}" is used. If you want to use another file specify the file name. + + + Microsoft.WindowsAzure.Plugins.Caching.NamedCaches + + + {"caches":[{"name":"default","policy":{"eviction":{"type":0},"expiration":{"defaultTTL":10,"isExpirable":true,"type":1},"serverNotification":{"isEnabled":false}},"secondaries":0}]} + + + A publishing username is required. Please specify one using the argument PublishingUsername. + + + New Add-On Confirmation + + + By typing "Yes", I (a) authorize Microsoft to charge my current payment method on a monthly basis +for the amount indicated at {0} for {1} until my service is cancelled or terminated, and (b) +agree to the {2}'s terms of user and privacy statement at {0} and (c) agree to sharing my +contact information with {2}. + + + Internal Server Error. This could happen because the namespace name is already used or due to an incorrect location name. Use Get-AzureSBLocation cmdlet to list valid names. + + + By typing "Yes", I (a) authorize Microsoft to charge my current payment method on a monthly basis +for the amount indicated at {0} for {1} until my service is cancelled or terminated, and (b) +acknowledge the offering is provided by {2}, not Microsoft, and agree to {2}'s terms of +use and privacy statement at {0} and (c) agree to sharing my contact information with {2}. + + + Service has been created at {0} + + + No + + + There is no access token cached for subscription {0}, user id {1}. Use the Add-AzureAccount cmdlet to log in again and get a token for this subscription. + + + The service does not have any cache worker roles, add one first by running cmdlet Add-AzureCacheWorkerRole. + + + No clouds available + WAPackIaaS + + + nodejs + + + node + + + node.exe + + + There is no default subscription set, please set a default subscription by running Set-AzureSubscription -Default <subscription name> + + + Microsoft SDKs\Azure\Nodejs\Nov2011 + + + nodejs + + + node + + + Resources\Scaffolding\Node + + + Microsoft.WindowsAzure.Commands.CloudService.ScaffoldingResources.Node + + + Installing Node version {0} in Azure for Role '{1}' (the Node version locally installed is: {2}) + + + No, I do not agree + + + No publish settings files with extension *.publishsettings are found in the directory "{0}". + + + '{0}' must be a cache worker role. Verify that it has proper cache worker role configuration. + + + Certificate can't be null. + + + {0} could not be null or empty + + + Unable to add a null RoleSettings to {0} + + + Unable to add new role to null service definition + + + The request offer '{0}' is not found. + + + Operation "{0}" failed on VM with ID: {1} + WAPackIaaS + + + The REST operation failed with message '{0}' and error code '{1}' + + + Job Id {0} did not complete within expected time or it is in Failed/Canceled/Invalid state. + WAPackIaaS + + + package + + + Package is created at service root path {0}. + + + {{ + "author": "", + + "name": "{0}", + "version": "0.0.0", + "dependencies":{{}}, + "devDependencies":{{}}, + "optionalDependencies": {{}}, + "engines": {{ + "node": "*", + "iisnode": "*" + }} + +}} + + + + package.json + + + A value for the Peer Asn has to be provided. + + + 5.4.0 + + + php + + + Resources\Scaffolding\PHP + + + Microsoft.WindowsAzure.Commands.CloudService.ScaffoldingResources.PHP + + + Installing PHP version {0} for Role '{1}' (the PHP version locally installed is: {2}) + + + You must create your first web site using the Microsoft Azure portal. +Please follow these steps in the portal: +1. At the bottom of the page, click on New > Web Site > Quick Create +2. Type {0} in the URL field +3. Click on "Create Web Site" +4. Once the site has been created, click on the site name +5. Click on "Set up Git publishing" or "Reset deployment credentials" and setup a publishing username and password. Use those credentials for all new websites you create. + + + 6. Back in the console window, rerun this command by typing "New-AzureWebsite <site name> -Git" + + + A value for the Primary Peer Subnet has to be provided. + + + Promotion code can be used only when updating to a new plan. + + + Service not published at user request. + + + Complete. + + + Connecting... + + + Created Deployment ID: {0}. + + + Created hosted service '{0}'. + + + Created Website URL: {0}. + + + Creating... + + + Initializing... + + + busy + + + creating the virtual machine + + + Instance {0} of role {1} is {2}. + + + ready + + + Preparing deployment for {0} with Subscription ID: {1}... + + + Publishing {0} to Microsoft Azure. This may take several minutes... + + + publish settings + + + Azure + + + .PublishSettings + + + publishSettings.xml + + + Publish settings imported + + + AZURE_PUBLISHINGPROFILE_URL + + + Starting... + + + Upgrading... + + + Uploading Package to storage service {0}... + + + Verifying storage account '{0}'... + + + Replace current deployment with '{0}' Id ? + + + Are you sure you want to regenerate key? + + + Generate new key. + + + Are you sure you want to remove account '{0}'? + + + Removing account + + + Remove Add-On Confirmation + + + If you delete this add-on, your data may be deleted and the operation may not be undone. You may have to purchase it again from the Microsoft Azure Store to use it. The price of the add-on may not be refunded. Are you sure you want to delete this add-on? Enter “Yes” to confirm. + + + Remove-AzureBGPPeering Operation failed. + + + Removing Bgp Peering + + + Successfully removed Azure Bgp Peering with Service Key {0}. + + + Are you sure you want to remove the Bgp Peering with service key '{0}'? + + + Are you sure you want to remove the Dedicated Circuit with service key '{0}'? + + + Remove-AzureDedicatedCircuit Operation failed. + + + Remove-AzureDedicatedCircuitLink Operation failed. + + + Removing Dedicated Circui Link + + + Successfully removed Azure Dedicated Circuit Link with Service Key {0} and Vnet Name {1} + + + Are you sure you want to remove the Dedicated Circuit Link with service key '{0}' and virtual network name '{1}'? + + + Removing Dedicated Circuit + + + Successfully removed Azure Dedicated Circuit with Service Key {0}. + + + Removing cloud service {0}... + + + Removing {0} deployment for {1} service + + + Removing job collection + + + Are you sure you want to remove the job collection "{0}" + + + Removing job + + + Are you sure you want to remove the job "{0}" + + + Are you sure you want to remove the account? + + + Account removed. + + + Internal Server Error. This could happen because the namespace does not exist or it does not exist under your subscription. + + + Removing old package {0}... + + + Are you sure you want to delete the namespace '{0}'? + + + Are you sure you want to remove cloud service? + + + Remove cloud service and all it's deployments + + + Are you sure you want to remove subscription '{0}'? + + + Removing subscription + + + Are you sure you want to delete the VM '{0}'? + + + Deleting VM. + + + Removing WebJob... + + + Are you sure you want to remove job '{0}'? + + + Removing website + + + Are you sure you want to remove the website "{0}" + + + Deleting namespace + + + Repository is not setup. You need to pass a valid site name. + + + Reserved IP with the Name:'{0}' will no longer be in use after the deployment is deleted, and it is still reserved for later use. + + + Resource with ID : {0} does not exist. + WAPackIaaS + + + Restart + WAPackIaaS + + + Resume + WAPackIaaS + + + /role:{0};"{1}/{0}" + + + bin + + + Role {0} is {1} + + + 20 + + + role name + + + The provided role name {0} doesn't exist + + + RoleSettings.xml + + + Role type {0} doesn't exist + + + public static Dictionary<string, Location> ReverseLocations { get; private set; } + + + Preparing runtime deployment for service '{0}' + + + WARNING Runtime Mismatch: Are you sure that you want to publish service '{0}' using an Azure runtime version that does not match your local runtime version? + + + RUNTIMEOVERRIDEURL + + + /runtimemanifest/runtimes/runtime + + + RUNTIMEID + + + RUNTIMEURL + + + RUNTIMEVERSIONPRIMARYKEY + + + scaffold.xml + + + Invalid location entered. Pick one of the locations from Get-AzureSchedulerLocation + + + A value for the Secondary Peer Subnet has to be provided. + + + Service {0} already exists on disk in location {1} + + + No ServiceBus authorization rule with the given characteristics was found + + + The service bus entity '{0}' is not found. + + + Internal Server Error. This could happen due to an incorrect/missing namespace + + + service configuration + + + service definition + + + ServiceDefinition.csdef + + + {0}Deploy + + + The specified cloud service "{0}" does not exist. + + + {0} slot for service {1} is in {2} state, please wait until it finish and update it's status + + + Begin Operation: {0} + + + Completed Operation: {0} + + + Begin Operation: {0} + + + Completed Operation: {0} + + + service name + + + Please provide name for the hosted service + + + service parent directory + + + Service {0} removed successfully + + + service directory + + + service settings + + + The storage account name '{0}' is invalid. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + + + The {0} slot for cloud service {1} doesn't exist. + + + {0} slot for service {1} is {2} + + + Set Add-On Confirmation + + + Note - You will be charged the amount for the new plan, without being refunded for time remaining +in the existing plan. +By typing "Yes", I (a) authorize Microsoft to charge my current payment method on a monthly basis +for the amount indicated at {0} for {1} until my service is cancelled or terminated, and (b) +agree to the {2}'s terms of user and privacy statement at {0} and (c) agree to sharing my +contact information with {2}. + + + Note - You will be charged the amount for the new plan, without being refunded for time remaining +in the existing plan. +By typing "Yes", I (a) authorize Microsoft to charge my current payment method on a monthly basis +for the amount indicated at {0} for {1} until my service is cancelled or terminated, and (b) +acknowledge the offering is provided by {2}, not Microsoft, and agree to {2}'s terms of +use and privacy statement at <url> and (c) agree to sharing my contact information with {2}. + + + Role {0} instances are set to {1} + + + {"Slot":"","Location":"","Subscription":"","StorageAccountName":""} + + + deploymentSettings.json + + + Confirm + + + Shutdown + WAPackIaaS + + + /sites:{0};{1};"{2}/{0}" + + + 1000 + + + Start + WAPackIaaS + + + Started + + + Starting Emulator... + + + start + + + Stop + WAPackIaaS + + + Stopping emulator... + + + Stopped + + + stop + + + Account Name: + + + Cannot find storage account '{0}' please type the name of an existing storage account. + + + AzureStorageEmulator.exe + + + InstallPath + + + SOFTWARE\Microsoft\Windows Azure Storage Emulator + + + Primary Key: + + + Secondary Key: + + + The subscription named {0} already exists. + + + DefaultSubscriptionData.xml + + + The subscription data file {0} does not exist. + + + Subscription must not be null + WAPackIaaS + + + Suspend + WAPackIaaS + + + Swapping website production slot ... + + + Are you sure you want to swap the website '{0}' production slot with slot '{1}'? + + + The provider {0} is unknown. + + + Update + WAPackIaaS + + + Updated settings for subscription '{0}'. Current subscription is '{1}'. + + + A value for the VLan Id has to be provided. + + + Please wait... + + + The azure storage emulator is not installed, skip launching... + + + Web.cloud.config + + + web.config + + + MSDeploy + + + Cannot build the project successfully. Please see logs in {0}. + + + WebRole + + + setup_web.cmd > log.txt + + + WebRole.xml + + + WebSite with given name {0} already exists in the specified Subscription and Webspace. + + + WebSite with given name {0} already exists in the specified Subscription and Location. + + + Site {0} already has repository created for it. + + + Workspaces/WebsiteExtension/Website/{0}/dashboard/ + + + https://{0}/msdeploy.axd?site={1} + + + WorkerRole + + + setup_worker.cmd > log.txt + + + WorkerRole.xml + + + Yes + + + Yes, I agree + + + Remove-AzureTrafficManagerProfile Operation failed. + + + Successfully removed Traffic Manager profile with name {0}. + + + Are you sure you want to remove the Traffic Manager profile "{0}"? + + + Profile {0} already has an endpoint with name {1} + + + Profile {0} does not contain endpoint {1}. Adding it. + + + The endpoint {0} cannot be removed from profile {1} because it's not in the profile. + + + Insufficient parameters passed to create a new endpoint. + + + Ambiguous operation: the profile name specified doesn't match the name of the profile object. + + + <NONE> + + + "An exception occurred when calling the ServiceManagement API. HTTP Status Code: {0}. Service Management Error Code: {1}. Message: {2}. Operation Tracking ID: {3}." + {0} is the HTTP status code. {1} is the Service Management Error Code. {2} is the Service Management Error message. {3} is the operation tracking ID. + + + Unable to decode string from base 64. Please make sure the string is correctly encoded: {0}. + {0} is the string that is not in a valid base 64 format. + + + Skipping external tenant {0}, because you are using a guest or a foreign principal object identity. In order to access this tenant, please run Add-AzureAccount without "-Credential". + + + Removing an environment will remove all associated subscriptions and accounts. Are you sure you want to remove an environment '{0}'? + + + Removing environment + + + There is no subscription associated with account {0}. + + + Account id doesn't match one in subscription. + + + Environment name doesn't match one in subscription. + + + Removing the Azure profile will remove all associated environments, subscriptions, and accounts. Are you sure you want to remove the Azure profile? + + + Removing the Azure profile + + + The SubscriptionDataFile parameter is deprecated. This parameter will be removed in a future release. See https://github.com/Azure/azure-powershell/wiki/Proposed-Design-Stateless-Azure-Profile for a description of the upcoming mechanism for providing alternate sources of subscription information. + + + Account needs to be specified + + + No default subscription has been designated. Use Select-AzureSubscription -Default <subscriptionName> to set the default subscription. + + + Path must specify a valid path to an Azure profile. + + + Property bag Hashtable must contain one of the following sets of properties: {SubscriptionId, Certificate}, {SubscriptionId, Username, Password}, {SubscriptionId, ServicePrincipal, Password, Tenant}, {SubscriptionId, AccountId, Token} + + + Property bag Hashtable must contain a 'Certificate' of type 'X509Certificate2'. + + + Property bag Hashtable must contain a 'Password' with an associated 'Username' or 'ServicePrincipal'. + + + Property bag Hashtable must contain a 'SubscriptionId'. + + + Selected profile must not be null. + + + The Switch-AzureMode cmdlet is deprecated and will be removed in a future release. + + + OperationID : '{0}' + + + Cannot get module for DscResource '{0}'. Possible solutions: +1) Specify -ModuleName for Import-DscResource in your configuration. +2) Unblock module that contains resource. +3) Move Import-DscResource inside Node block. + + 0 = name of DscResource + + + Your current PowerShell version {1} is less then required by this cmdlet {0}. Consider download and install latest PowerShell version. + {0} = minimal required PS version, {1} = current PS version + + + Parsing configuration script: {0} + {0} is the path to a script file + + + Configuration script '{0}' contained parse errors: +{1} + 0 = path to the configuration script, 1 = parser errors + + + List of required modules: [{0}]. + {0} = list of modules + + + Temp folder '{0}' created. + {0} = temp folder path + + + Copy '{0}' to '{1}'. + {0} = source, {1} = destination + + + Copy the module '{0}' to '{1}'. + {0} = source, {1} = destination + + + File '{0}' already exists. Use the -Force parameter to overwrite it. + {0} is the path to a file + + + Configuration file '{0}' not found. + 0 = path to the configuration file + + + Path '{0}' not found. + 0 = path to the additional content file/directory + + + Path '{0}' not found. + 0 = path to the additional content file/directory + + + Invalid configuration file: {0}. +The file needs to be a PowerShell script (.ps1 or .psm1) or a ZIP archive (.zip). + 0 = path to the configuration file + + + Invalid configuration file: {0}. +The file needs to be a PowerShell script (.ps1 or .psm1). + 0 = path to the configuration file + + + Create Archive + + + Upload '{0}' + {0} is the name of an storage blob + + + Storage Blob '{0}' already exists. Use the -Force parameter to overwrite it. + {0} is the name of an storage blob + + + Configuration published to {0} + {0} is an URI + + + Deleted '{0}' + {0} is the path of a file + + + Cannot delete '{0}': {1} + {0} is the path of a file, {1} is an error message + + + Cannot find the WadCfg end element in the config. + + + WadCfg start element in the config is not matching the end element. + + + Cannot find the WadCfg element in the config. + + + Cannot find configuration data file: {0} + + + The configuration data must be a .psd1 file + + + Cannot change built-in environment {0}. + + + Azure PowerShell collects usage data in order to improve your experience. +The data is anonymous and does not include commandline argument values. +The data is collected by Microsoft. + +Use the Disable-AzDataCollection cmdlet to turn the feature Off. The cmdlet can be found in the Az.Accounts module. To disable data collection: PS > Disable-AzDataCollection. +Use the Enable-AzDataCollection cmdlet to turn the feature On. The cmdlet can be found in the Az.Accounts module. To enable data collection: PS > Enable-AzDataCollection. + + + Microsoft Azure PowerShell Data Collection Confirmation + + + You choose not to participate in Microsoft Azure PowerShell data collection. + + + This confirmation message will be dismissed in '{0}' second(s)... + + + You choose to participate in Microsoft Azure PowerShell data collection. + + + The setting profile has been saved to the following path '{0}'. + + + [Common.Authentication]: Authenticating for account {0} with single tenant {1}. + + + Changing public environment is not supported. + + + Environment name needs to be specified. + + + Environment needs to be specified. + + + The environment name '{0}' is not found. + + + File path is not valid. + + + Must specify a non-null subscription name. + + + The default subscription is being removed. Use Select-AzureSubscription -Default <subscriptionName> to select a new default subscription. + + + Removing public environment is not supported. + + + The subscription id {0} doesn't exist. + + + Subscription name needs to be specified. + + + The subscription name {0} doesn't exist. + + + Subscription needs to be specified. + + + User name is not valid. + + + User name needs to be specified. + + + "There is no current context, please log in using Connect-AzAccount." + + + No subscriptions are associated with the logged in account in Azure Service Management (RDFE). This means that the logged in user is not an administrator or co-administrator for any account.\r\nDid you mean to execute Connect-AzAccount? + + + No certificate was found in the certificate store with thumbprint {0} + + + Illegal characters in path. + + + Invalid certificate format. Publish settings may be corrupted. Use Get-AzurePublishSettingsFile to download updated settings + + + "{0}" is an invalid DNS name for {1} + + + The provided file in {0} must be have {1} extension + + + {0} is invalid or empty + + + Please connect to internet before executing this cmdlet + + + Path {0} doesn't exist. + + + Path for {0} doesn't exist in {1}. + + + &whr={0} + + + The provided service name {0} already exists, please pick another name + + + Unable to update mismatching Json structured: {0} {1}. + + + (x86) + + + Azure PowerShell collects usage data in order to improve your experience. +The data is anonymous and does not include commandline argument values. +The data is collected by Microsoft. + +Use the Disable-AzureDataCollection cmdlet to turn the feature Off. The cmdlet can be found in the Azure module. To disable data collection: PS > Disable-AzureDataCollection. +Use the Enable-AzureDataCollection cmdlet to turn the feature On. The cmdlet can be found in the Azure module. To enable data collection: PS > Enable-AzureDataCollection. + + + Execution failed because a background thread could not prompt the user. + + + Azure Long-Running Job + + + The cmdlet failed in background execution. The returned error was '{0}'. Please execute the cmdlet again. You may need to execute this cmdlet synchronously, by omitting the '-AsJob' parameter. + 0(string): exception message in background task + + + Please execute the cmdlet again and include the 'Force' parameter, if available, to avoid unnecessary prompts. + + + Please execute the cmdlet again and omit the 'Confirm' parameter when using the 'AsJob' parameter. + + + Please increase the user $ConfirmPreference setting, or include turn off confirmation using '-Confirm:$false' when using the 'AsJob' parameter and execute the cmdet again. + + + Please execute the cmdlet again and omit the 'WhatIf' parameter when using the 'AsJob' parameter. + + + [AzureLongRunningJob]: Starting cmdlet execution, setting for cmdlet confirmation required: '{0}' + 0(bool): whether cmdlet confirmation is required + + + [AzureLongRunningJob]: Blocking job for ShouldMethod '{0}' + 0(string): method type + + + [AzureLongRunningJob]: Completing cmdlet execution in RunJob + + + [AzureLongRunningJob]: State change from '{0}' to '{1}' because '{2}' + 0(string): last state, 1(string): new state, 2(string): state change reason + + + [AzureLongRunningJob]: Unblocking job due to stoppage or failure + + + [AzureLongRunningJob]: Unblocking job that was previously blocked. + + + [AzureLongRunningJob]: Error in cmdlet execution + + + [AzureLongRunningJob]: Removing state changed event handler, exception '{0}' + 0(string): exception message + + + [AzureLongRunningJob]: ShouldMethod '{0}' unblocked. + 0(string): methodType + + + +- The parameter : '{0}' is changing. + + + +- The parameter : '{0}' is becoming mandatory. + + + +- The parameter : '{0}' is being replaced by parameter : '{1}'. + + + +- The parameter : '{0}' is being replaced by mandatory parameter : '{1}'. + + + +- Change description : {0} + + + The cmdlet is being deprecated. There will be no replacement for it. + + + The cmdlet parameter set is being deprecated. There will be no replacement for it. + + + The cmdlet '{0}' is replacing this cmdlet. + + + +- The output type is changing from the existing type :'{0}' to the new type :'{1}' + + + +- The output type '{0}' is changing + + + +- The following properties are being added to the output type : + + + +- The following properties in the output type are being deprecated : + + + {0} + + + +- Cmdlet : '{0}' + - {1} + + + Upcoming breaking changes in the cmdlet '{0}' : + + + +- This change will take effect on '{0}' + + + +- The change is expected to take effect from the version : '{0}' + + + ```powershell +# Old +{0} + +# New +{1} +``` + + + + +Cmdlet invocation changes : + Old Way : {0} + New Way : {1} + + + +The output type '{0}' is being deprecated without a replacement. + + + +The type of the parameter is changing from '{0}' to '{1}'. + + + +Note : Go to {0} for steps to suppress this breaking change warning, and other information on breaking changes in Azure PowerShell. + + + This cmdlet is in preview. The functionality may not be available in the selected subscription. + + \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/Response.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/Response.cs new file mode 100644 index 000000000000..09dd6d925803 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/Response.cs @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime +{ + using System; + using System.Threading.Tasks; + public class Response : EventData + { + public Response() : base() + { + } + } + + public class Response : Response + { + private Func> _resultDelegate; + private Task _resultValue; + + public Response(T value) : base() => _resultValue = Task.FromResult(value); + public Response(Func value) : base() => _resultDelegate = () => Task.FromResult(value()); + public Response(Func> value) : base() => _resultDelegate = value; + public Task Result => _resultValue ?? (_resultValue = this._resultDelegate()); + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/Serialization/JsonSerializer.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/Serialization/JsonSerializer.cs new file mode 100644 index 000000000000..44bdf52dad89 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/Serialization/JsonSerializer.cs @@ -0,0 +1,350 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json +{ + internal class JsonSerializer + { + private int depth = 0; + + private SerializationOptions options = new SerializationOptions(); + + #region Deserialization + + internal T Deseralize(JsonObject json) + where T : new() + { + var contract = JsonModelCache.Get(typeof(T)); + + return (T)DeserializeObject(contract, json); + } + + internal object DeserializeObject(JsonModel contract, JsonObject json) + { + var instance = Activator.CreateInstance(contract.Type); + + depth++; + + // Ensure we don't recurse forever + if (depth > 5) throw new Exception("Depth greater than 5"); + + foreach (var field in json) + { + var member = contract[field.Key]; + + if (member != null) + { + var value = DeserializeValue(member, field.Value); + + member.SetValue(instance, value); + } + } + + depth--; + + return instance; + } + + private object DeserializeValue(JsonMember member, JsonNode value) + { + if (value.Type == JsonType.Null) return null; + + var type = member.Type; + + if (member.IsStringLike && value.Type != JsonType.String) + { + // Take the long path... + return DeserializeObject(JsonModelCache.Get(type), (JsonObject)value); + } + else if (member.Converter != null) + { + return member.Converter.FromJson(value); + } + else if (type.IsArray) + { + return DeserializeArray(type, (JsonArray)value); + } + else if (member.IsList) + { + return DeserializeList(type, (JsonArray)value); + } + else + { + var contract = JsonModelCache.Get(type); + + return DeserializeObject(contract, (JsonObject)value); + } + } + + private object DeserializeValue(Type type, JsonNode value) + { + if (type == null) throw new ArgumentNullException(nameof(type)); + + if (value.Type == JsonType.Null) return null; + + var typeDetails = TypeDetails.Get(type); + + if (typeDetails.JsonConverter != null) + { + return typeDetails.JsonConverter.FromJson(value); + } + else if (typeDetails.IsEnum) + { + return Enum.Parse(type, value.ToString(), ignoreCase: true); + } + else if (type.IsArray) + { + return DeserializeArray(type, (JsonArray)value); + } + else if (typeDetails.IsList) + { + return DeserializeList(type, (JsonArray)value); + } + else + { + var contract = JsonModelCache.Get(type); + + return DeserializeObject(contract, (JsonObject)value); + } + } + + internal Array DeserializeArray(Type type, JsonArray elements) + { + var elementType = type.GetElementType(); + + var elementTypeDetails = TypeDetails.Get(elementType); + + var array = Array.CreateInstance(elementType, elements.Count); + + int i = 0; + + if (elementTypeDetails.JsonConverter != null) + { + foreach (var value in elements) + { + array.SetValue(elementTypeDetails.JsonConverter.FromJson(value), i); + + i++; + } + } + else + { + foreach (var value in elements) + { + array.SetValue(DeserializeValue(elementType, value), i); + + i++; + } + } + + return array; + } + + internal IList DeserializeList(Type type, JsonArray jsonArray) + { + // TODO: Handle non-generic types + if (!type.IsGenericType) + throw new ArgumentException("Must be a generic type", nameof(type)); + + var elementType = type.GetGenericArguments()[0]; + + IList list; + + if (type.IsInterface) + { + // Create a concrete generic list + list = (IList)Activator.CreateInstance(typeof(List<>).MakeGenericType(elementType)); + } + else + { + list = (IList)Activator.CreateInstance(type); + } + + foreach (var value in jsonArray) + { + list.Add(DeserializeValue(elementType, value)); + } + + return list; + } + + #endregion + + #region Serialization + + internal JsonNode Serialize(object instance) => + Serialize(instance, SerializationOptions.Default); + + internal JsonNode Serialize(object instance, string[] include) => + Serialize(instance, new SerializationOptions { Include = include }); + + internal JsonNode Serialize(object instance, SerializationOptions options) + { + this.options = options; + + if (instance == null) + { + return XNull.Instance; + } + + return ReadValue(instance.GetType(), instance); + } + + #region Readers + + internal JsonArray ReadArray(IEnumerable collection) + { + var array = new XNodeArray(); + + foreach (var item in collection) + { + array.Add(ReadValue(item.GetType(), item)); + } + + return array; + } + + internal IEnumerable> ReadProperties(object instance) + { + var contract = JsonModelCache.Get(instance.GetType()); + + foreach (var member in contract.Members) + { + string name = member.Name; + + if (options.PropertyNameTransformer != null) + { + name = options.PropertyNameTransformer.Invoke(name); + } + + // Skip the field if it's not included + if ((depth == 1 && !options.IsIncluded(name))) + { + continue; + } + + var value = member.GetValue(instance); + + if (!member.EmitDefaultValue && (value == null || (member.IsList && ((IList)value).Count == 0) || value.Equals(member.DefaultValue))) + { + continue; + } + else if (options.IgnoreNullValues && value == null) // Ignore null values + { + continue; + } + + // Transform the value if there is one + if (options.Transformations != null) + { + var transform = options.GetTransformation(name); + + if (transform != null) + { + value = transform.Transformer(value); + } + } + + yield return new KeyValuePair(name, ReadValue(member.TypeDetails, value)); + } + } + + private JsonObject ReadObject(object instance) + { + depth++; + + // TODO: Guard against a self referencing graph + if (depth > options.MaxDepth) + { + depth--; + + return new JsonObject(); + } + + var node = new JsonObject(ReadProperties(instance)); + + depth--; + + return node; + } + + private JsonNode ReadValue(Type type, object value) + { + if (value == null) + { + return XNull.Instance; + } + + var member = TypeDetails.Get(type); + + return ReadValue(member, value); + } + + private JsonNode ReadValue(TypeDetails type, object value) + { + if (value == null) + { + return XNull.Instance; + } + + if (type.JsonConverter != null) + { + return type.JsonConverter.ToJson(value); + } + else if (type.IsArray) + { + switch (Type.GetTypeCode(type.ElementType)) + { + case TypeCode.String: return CreateArray((string[])value); + case TypeCode.UInt16: return CreateArray((ushort[])value); + case TypeCode.UInt32: return CreateArray((uint[])value); + case TypeCode.UInt64: return CreateArray((ulong[])value); + case TypeCode.Int16: return CreateArray((short[])value); + case TypeCode.Int32: return CreateArray((int[])value); + case TypeCode.Int64: return CreateArray((long[])value); + case TypeCode.Single: return CreateArray((float[])value); + case TypeCode.Double: return CreateArray((double[])value); + default: return ReadArray((IEnumerable)value); + } + } + else if (value is IEnumerable) + { + if (type.IsList && type.ElementType != null) + { + switch (Type.GetTypeCode(type.ElementType)) + { + case TypeCode.String: return CreateList(value); + case TypeCode.UInt16: return CreateList(value); + case TypeCode.UInt32: return CreateList(value); + case TypeCode.UInt64: return CreateList(value); + case TypeCode.Int16: return CreateList(value); + case TypeCode.Int32: return CreateList(value); + case TypeCode.Int64: return CreateList(value); + case TypeCode.Single: return CreateList(value); + case TypeCode.Double: return CreateList(value); + } + } + + return ReadArray((IEnumerable)value); + } + else + { + // Complex object + return ReadObject(value); + } + } + + private XList CreateList(object value) => new XList((IList)value); + + private XImmutableArray CreateArray(T[] array) => new XImmutableArray(array); + + #endregion + + #endregion + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/Serialization/PropertyTransformation.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/Serialization/PropertyTransformation.cs new file mode 100644 index 000000000000..da4062a43ef0 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/Serialization/PropertyTransformation.cs @@ -0,0 +1,21 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json +{ + internal class PropertyTransformation + { + internal PropertyTransformation(string name, Func transformer) + { + Name = name ?? throw new ArgumentNullException(nameof(name)); + Transformer = transformer ?? throw new ArgumentNullException(nameof(transformer)); + } + + internal string Name { get; } + + internal Func Transformer { get; } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/Serialization/SerializationOptions.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/Serialization/SerializationOptions.cs new file mode 100644 index 000000000000..e0d94edc6027 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/Serialization/SerializationOptions.cs @@ -0,0 +1,65 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Linq; + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json +{ + internal class SerializationOptions + { + internal static readonly SerializationOptions Default = new SerializationOptions(); + + internal SerializationOptions() { } + + internal SerializationOptions( + string[] include = null, + bool ingoreNullValues = false) + { + Include = include; + IgnoreNullValues = ingoreNullValues; + } + + internal string[] Include { get; set; } + + internal string[] Exclude { get; set; } + + internal bool IgnoreNullValues { get; set; } + + internal PropertyTransformation[] Transformations { get; set; } + + internal Func PropertyNameTransformer { get; set; } + + internal int MaxDepth { get; set; } = 5; + + internal bool IsIncluded(string name) + { + if (Exclude != null) + { + return !Exclude.Any(exclude => exclude.Equals(name, StringComparison.OrdinalIgnoreCase)); + } + else if (Include != null) + { + return Include.Any(exclude => exclude.Equals(name, StringComparison.OrdinalIgnoreCase)); + } + + return true; + } + + internal PropertyTransformation GetTransformation(string propertyName) + { + if (Transformations == null) return null; + + foreach (var t in Transformations) + { + if (t.Name.Equals(propertyName, StringComparison.OrdinalIgnoreCase)) + { + return t; + } + } + + return null; + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/SerializationMode.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/SerializationMode.cs new file mode 100644 index 000000000000..472751916b38 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/SerializationMode.cs @@ -0,0 +1,16 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime +{ + [System.Flags] + public enum SerializationMode + { + None = 0, + IncludeHeaders = 1 << 0, + IncludeReadOnly = 1 << 1, + + IncludeAll = IncludeHeaders | IncludeReadOnly + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/TypeConverterExtensions.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/TypeConverterExtensions.cs new file mode 100644 index 000000000000..019a38c47e44 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/TypeConverterExtensions.cs @@ -0,0 +1,211 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System.IO; +using System.Linq; +using System.Xml; +using System.Xml.Serialization; + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.PowerShell +{ + internal static class TypeConverterExtensions + { + internal static T[] SelectToArray(object source, System.Func converter) + { + // null begets null + if (source == null) + { + return null; + } + + // single values and strings are just encapsulated in the array. + if (source is string || !(source is System.Collections.IEnumerable)) + { + try + { + return new T[] { (T)converter(source) }; + } +#if DEBUG + catch (System.Exception E) + { + System.Console.Error.WriteLine($"{E.GetType().Name}/{E.Message}/{E.StackTrace}"); + } +#else + catch + { + // silent conversion fail + } +#endif + return new T[0]; // empty result if couldn't convert. + } + + var result = new System.Collections.Generic.List(); + foreach (var each in (System.Collections.IEnumerable)source) + { + try + { + result.Add((T)converter(each)); + } +#if DEBUG + catch (System.Exception E) + { + System.Console.Error.WriteLine($"{E.GetType().Name}/{E.Message}/{E.StackTrace}"); + } +#else + catch + { + // silent conversion fail + } +#endif + } + return result.ToArray(); + } + + internal static System.Collections.Generic.IEnumerable GetPropertyKeys(this System.Collections.Generic.IDictionary dictionary) + { + if (null != dictionary) + { + foreach (var each in dictionary.Keys) + { + yield return each; + } + } + } + internal static System.Collections.Generic.IEnumerable GetPropertyKeys(this System.Collections.IDictionary dictionary) + { + if (null != dictionary) + { + foreach (var each in dictionary.Keys) + { + yield return each; + } + } + } + internal static System.Collections.Generic.IEnumerable GetPropertyKeys(this System.Management.Automation.PSObject instance) + { + if (null != instance) + { + foreach (var each in instance.Properties) + { + yield return each; + } + } + } + + internal static System.Collections.Generic.IEnumerable> GetFilteredProperties(this System.Collections.Generic.IDictionary instance, global::System.Collections.Generic.HashSet exclusions = null, global::System.Collections.Generic.HashSet inclusions = null) + { + return (null == instance || instance.Count == 0) ? + Enumerable.Empty>() : + instance.Keys + .Where(key => + !(true == exclusions?.Contains(key?.ToString())) + && (false != inclusions?.Contains(key?.ToString()))) + .Select(key => new System.Collections.Generic.KeyValuePair(key, instance[key])); + } + + internal static System.Collections.Generic.IEnumerable> GetFilteredProperties(this System.Collections.IDictionary instance, global::System.Collections.Generic.HashSet exclusions = null, global::System.Collections.Generic.HashSet inclusions = null) + { + return (null == instance || instance.Count == 0) ? + Enumerable.Empty>() : + instance.Keys.OfType() + .Where(key => + !(true == exclusions?.Contains(key?.ToString())) + && (false != inclusions?.Contains(key?.ToString()))) + .Select(key => new System.Collections.Generic.KeyValuePair(key, instance[key])); + } + + internal static System.Collections.Generic.IEnumerable> GetFilteredProperties(this System.Management.Automation.PSObject instance, global::System.Collections.Generic.HashSet exclusions = null, global::System.Collections.Generic.HashSet inclusions = null) + { + // new global::System.Collections.Generic.HashSet(System.StringComparer.InvariantCultureIgnoreCase) + return (null == instance || !instance.Properties.Any()) ? + Enumerable.Empty>() : + instance.Properties + .Where(property => + !(true == exclusions?.Contains(property.Name)) + && (false != inclusions?.Contains(property.Name))) + .Select(property => new System.Collections.Generic.KeyValuePair(property.Name, property.Value)); + } + + + internal static T GetValueForProperty(this System.Collections.Generic.IDictionary dictionary, string propertyName, T defaultValue, System.Func converter) + { + try + { + var key = System.Linq.Enumerable.FirstOrDefault(dictionary.Keys, each => System.String.Equals(each.ToString(), propertyName, System.StringComparison.CurrentCultureIgnoreCase)); + return key == null ? defaultValue : (T)converter(dictionary[key]); + } +#if DEBUG + catch (System.Exception E) + { + System.Console.Error.WriteLine($"{E.GetType().Name}/{E.Message}/{E.StackTrace}"); + } +#else + catch + { + } +#endif + return defaultValue; + } + internal static T GetValueForProperty(this System.Collections.IDictionary dictionary, string propertyName, T defaultValue, System.Func converter) + { + try + { + var key = System.Linq.Enumerable.FirstOrDefault(dictionary.Keys.OfType(), each => System.String.Equals(each.ToString(), propertyName, System.StringComparison.CurrentCultureIgnoreCase)); + return key == null ? defaultValue : (T)converter(dictionary[key]); + } +#if DEBUG + catch (System.Exception E) + { + System.Console.Error.WriteLine($"{E.GetType().Name}/{E.Message}/{E.StackTrace}"); + } +#else + catch + { + } +#endif + return defaultValue; + } + + internal static T GetValueForProperty(this System.Management.Automation.PSObject psObject, string propertyName, T defaultValue, System.Func converter) + { + try + { + var property = System.Linq.Enumerable.FirstOrDefault(psObject.Properties, each => System.String.Equals(each.Name.ToString(), propertyName, System.StringComparison.CurrentCultureIgnoreCase)); + return property == null ? defaultValue : (T)converter(property.Value); + } +#if DEBUG + catch (System.Exception E) + { + System.Console.Error.WriteLine($"{E.GetType().Name}/{E.Message}/{E.StackTrace}"); + } +#else + catch + { + } +#endif + return defaultValue; + } + + internal static bool Contains(this System.Management.Automation.PSObject psObject, string propertyName) + { + bool result = false; + try + { + var property = System.Linq.Enumerable.FirstOrDefault(psObject.Properties, each => System.String.Equals(each.Name.ToString(), propertyName, System.StringComparison.CurrentCultureIgnoreCase)); + result = property == null ? false : true; + } +#if DEBUG + catch (System.Exception E) + { + System.Console.Error.WriteLine($"{E.GetType().Name}/{E.Message}/{E.StackTrace}"); + } +#else + catch + { + } +#endif + return result; + } + } +} diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/UndeclaredResponseException.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/UndeclaredResponseException.cs new file mode 100644 index 000000000000..deb5170791dc --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/UndeclaredResponseException.cs @@ -0,0 +1,112 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime +{ + using System; + using System.Net.Http; + using System.Net.Http.Headers; + using static Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Extensions; + + public class RestException : Exception, IDisposable + { + public System.Net.HttpStatusCode StatusCode { get; set; } + public string Code { get; protected set; } + protected string message; + public HttpRequestMessage RequestMessage { get; protected set; } + public HttpResponseHeaders ResponseHeaders { get; protected set; } + + public string ResponseBody { get; protected set; } + public string ClientRequestId { get; protected set; } + public string RequestId { get; protected set; } + + public override string Message => message; + public string Action { get; protected set; } + + public RestException(System.Net.Http.HttpResponseMessage response) + { + StatusCode = response.StatusCode; + //CloneWithContent will not work here since the content is disposed after sendAsync + //Besides, it seems there is no need for the request content cloned here. + RequestMessage = response.RequestMessage.Clone(); + ResponseBody = response.Content.ReadAsStringAsync().Result; + ResponseHeaders = response.Headers; + + RequestId = response.GetFirstHeader("x-ms-request-id"); + ClientRequestId = response.GetFirstHeader("x-ms-client-request-id"); + + try + { + // try to parse the body as JSON, and see if a code and message are in there. + var json = Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonNode.Parse(ResponseBody) as Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json.JsonObject; + + // error message could be in properties.statusMessage + { message = If(json?.Property("properties"), out var p) + && If(p?.PropertyT("statusMessage"), out var sm) + ? (string)sm : (string)Message; } + + // see if there is an error block in the body + json = json?.Property("error") ?? json; + + { Code = If(json?.PropertyT("code"), out var c) ? (string)c : (string)StatusCode.ToString(); } + { message = If(json?.PropertyT("message"), out var m) ? (string)m : (string)Message; } + { Action = If(json?.PropertyT("action"), out var a) ? (string)a : (string)Action; } + } +#if DEBUG + catch (System.Exception E) + { + System.Console.Error.WriteLine($"{E.GetType().Name}/{E.Message}/{E.StackTrace}"); + } +#else + catch + { + // couldn't get the code/message from the body response. + // In this case, we will assume the response is the expected error message + if(!string.IsNullOrEmpty(ResponseBody)) { + message = ResponseBody; + } + } +#endif + if (string.IsNullOrEmpty(message)) + { + if (StatusCode >= System.Net.HttpStatusCode.BadRequest && StatusCode < System.Net.HttpStatusCode.InternalServerError) + { + message = $"The server responded with a Request Error, Status: {StatusCode}"; + } + else if (StatusCode >= System.Net.HttpStatusCode.InternalServerError) + { + message = $"The server responded with a Server Error, Status: {StatusCode}"; + } + else + { + message = $"The server responded with an unrecognized response, Status: {StatusCode}"; + } + } + } + + public void Dispose() + { + ((IDisposable)RequestMessage).Dispose(); + } + } + + public class RestException : RestException + { + public T Error { get; protected set; } + public RestException(System.Net.Http.HttpResponseMessage response, T error) : base(response) + { + Error = error; + } + } + + + public class UndeclaredResponseException : RestException + { + public UndeclaredResponseException(System.Net.Http.HttpResponseMessage response) : base(response) + { + + } + } +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/Writers/JsonWriter.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/Writers/JsonWriter.cs new file mode 100644 index 000000000000..011e7f05dfb5 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/Writers/JsonWriter.cs @@ -0,0 +1,223 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.IO; +using System.Web; + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.Json +{ + internal class JsonWriter + { + const string indentation = " "; // 2 spaces + + private readonly bool pretty; + private readonly TextWriter writer; + + protected int currentLevel = 0; + + internal JsonWriter(TextWriter writer, bool pretty = true) + { + this.writer = writer ?? throw new ArgumentNullException(nameof(writer)); + this.pretty = pretty; + } + + internal void WriteNode(JsonNode node) + { + switch (node.Type) + { + case JsonType.Array: WriteArray((IEnumerable)node); break; + case JsonType.Object: WriteObject((JsonObject)node); break; + + // Primitives + case JsonType.Binary: WriteBinary((XBinary)node); break; + case JsonType.Boolean: WriteBoolean((bool)node); break; + case JsonType.Date: WriteDate((JsonDate)node); break; + case JsonType.Null: WriteNull(); break; + case JsonType.Number: WriteNumber((JsonNumber)node); break; + case JsonType.String: WriteString(node); break; + } + } + + internal void WriteArray(IEnumerable array) + { + currentLevel++; + + writer.Write('['); + + bool doIndentation = false; + + if (pretty) + { + foreach (var node in array) + { + if (node.Type == JsonType.Object || node.Type == JsonType.Array) + { + doIndentation = true; + + break; + } + } + } + + bool isFirst = true; + + foreach (JsonNode node in array) + { + if (!isFirst) writer.Write(','); + + if (doIndentation) + { + WriteIndent(); + } + else if (pretty) + { + writer.Write(' '); + } + + WriteNode(node); + + isFirst = false; + } + + currentLevel--; + + if (doIndentation) + { + WriteIndent(); + } + else if (pretty) + { + writer.Write(' '); + } + + writer.Write(']'); + } + + internal void WriteIndent() + { + if (pretty) + { + writer.Write(Environment.NewLine); + + for (int level = 0; level < currentLevel; level++) + { + writer.Write(indentation); + } + } + } + + internal void WriteObject(JsonObject obj) + { + currentLevel++; + + writer.Write('{'); + + bool isFirst = true; + + foreach (var field in obj) + { + if (!isFirst) writer.Write(','); + + WriteIndent(); + + WriteFieldName(field.Key); + + writer.Write(':'); + + if (pretty) + { + writer.Write(' '); + } + + // Write the field value + WriteNode(field.Value); + + isFirst = false; + } + + currentLevel--; + + WriteIndent(); + + writer.Write('}'); + } + + internal void WriteFieldName(string fieldName) + { + writer.Write('"'); + writer.Write(HttpUtility.JavaScriptStringEncode(fieldName)); + writer.Write('"'); + } + + #region Primitives + + internal void WriteBinary(XBinary value) + { + writer.Write('"'); + writer.Write(value.ToString()); + writer.Write('"'); + } + + internal void WriteBoolean(bool value) + { + writer.Write(value ? "true" : "false"); + } + + internal void WriteDate(JsonDate date) + { + if (date.ToDateTime().Year == 1) + { + WriteNull(); + } + else + { + writer.Write('"'); + writer.Write(date.ToIsoString()); + writer.Write('"'); + } + } + + internal void WriteNull() + { + writer.Write("null"); + } + + internal void WriteNumber(JsonNumber number) + { + if (number.Overflows) + { + writer.Write('"'); + writer.Write(number.Value); + writer.Write('"'); + } + else + { + writer.Write(number.Value); + } + } + + internal void WriteString(string text) + { + if (text == null) + { + WriteNull(); + } + else + { + writer.Write('"'); + + writer.Write(HttpUtility.JavaScriptStringEncode(text)); + + writer.Write('"'); + } + } + + #endregion + } +} + + +// TODO: Replace with System.Text.Json when available diff --git a/swaggerci/recoveryservicessiterecovery/generated/runtime/delegates.cs b/swaggerci/recoveryservicessiterecovery/generated/runtime/delegates.cs new file mode 100644 index 000000000000..81228afe841e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/generated/runtime/delegates.cs @@ -0,0 +1,23 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +namespace Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime +{ + using System; + using System.Collections; + using System.Collections.Generic; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + using GetEventData=System.Func; + + public delegate Task SendAsync(HttpRequestMessage request, IEventListener callback); + public delegate Task SendAsyncStep(HttpRequestMessage request, IEventListener callback, ISendAsync next); + public delegate Task SignalEvent(string id, CancellationToken token, GetEventData getEventData); + public delegate Task Event(EventData message); + public delegate void SynchEvent(EventData message); + public delegate Task OnResponse(Response message); + public delegate Task OnResponse(Response message); +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/how-to.md b/swaggerci/recoveryservicessiterecovery/how-to.md new file mode 100644 index 000000000000..d49582d88320 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/how-to.md @@ -0,0 +1,58 @@ +# How-To +This document describes how to develop for `Az.SiteRecovery`. + +## Building `Az.SiteRecovery` +To build, run the `build-module.ps1` at the root of the module directory. This will generate the proxy script cmdlets that are the cmdlets being exported by this module. After the build completes, the proxy script cmdlets will be output to the `exports` folder. To read more about the proxy script cmdlets, look at the [README.md](exports/README.md) in the `exports` folder. + +## Creating custom cmdlets +To add cmdlets that were not generated by the REST specification, use the `custom` folder. This folder allows you to add handwritten `.ps1` and `.cs` files. Currently, we support using `.ps1` scripts as new cmdlets or as additional low-level variants (via `ParameterSet`), and `.cs` files as low-level (variants) cmdlets that the exported script cmdlets call. We do not support exporting any `.cs` (dll) cmdlets directly. To read more about custom cmdlets, look at the [README.md](custom/README.md) in the `custom` folder. + +## Generating documentation +To generate documentation, the process is now integrated into the `build-module.ps1` script. If you don't want to run this process as part of `build-module.ps1`, you can provide the `-NoDocs` switch. If you want to run documentation generation after the build process, you may still run the `generate-help.ps1` script. Overall, the process will look at the documentation comments in the generated and custom cmdlets and types, and create `.md` files into the `docs` folder. Additionally, this pulls in any examples from the `examples` folder and adds them to the generated help markdown documents. To read more about examples, look at the [README.md](examples/README.md) in the `examples` folder. To read more about documentation, look at the [README.md](docs/README.md) in the `docs` folder. + +## Testing `Az.SiteRecovery` +To test the cmdlets, we use [Pester](https://github.com/pester/Pester). Tests scripts (`.ps1`) should be added to the `test` folder. To execute the Pester tests, run the `test-module.ps1` script. This will run all tests in `playback` mode within the `test` folder. To read more about testing cmdlets, look at the [README.md](examples/README.md) in the `examples` folder. + +## Packing `Az.SiteRecovery` +To pack `Az.SiteRecovery` for distribution, run the `pack-module.ps1` script. This will take the contents of multiple directories and certain root-folder files to create a `.nupkg`. The structure of the `.nupkg` is created so it can be loaded part of a [PSRepository](https://learn.microsoft.com/powershell/module/powershellget/register-psrepository). Additionally, this package is in a format for distribution to the [PSGallery](https://www.powershellgallery.com/). For signing an Azure module, please contact the [Azure PowerShell](https://github.com/Azure/azure-powershell) team. + +## Module Script Details +There are multiple scripts created for performing different actions for developing `Az.SiteRecovery`. +- `build-module.ps1` + - Builds the module DLL (`./bin/Az.SiteRecovery.private.dll`), creates the exported cmdlets and documentation, generates custom cmdlet test stubs and exported cmdlet example stubs, and updates `./Az.SiteRecovery.psd1` with Azure profile information. + - **Parameters**: [`Switch` parameters] + - `-Run`: After building, creates an isolated PowerShell session and loads `Az.SiteRecovery`. + - `-Test`: After building, runs the `Pester` tests defined in the `test` folder. + - `-Docs`: After building, generates the Markdown documents for the modules into the `docs` folder. + - `-Pack`: After building, packages the module into a `.nupkg`. + - `-Code`: After building, opens a VSCode window with the module's directory and runs (see `-Run`) the module. + - `-Release`: Builds the module in `Release` configuration (as opposed to `Debug` configuration). + - `-NoDocs`: Supresses writing the documentation markdown files as part of the cmdlet exporting process. + - `-Debugger`: Used when attaching the debugger in Visual Studio to the PowerShell session, and running the build process without recompiling the DLL. This suppresses running the script as an isolated process. +- `run-module.ps1` + - Creates an isolated PowerShell session and loads `Az.SiteRecovery` into the session. + - Same as `-Run` in `build-module.ps1`. + - **Parameters**: [`Switch` parameters] + - `-Code`: Opens a VSCode window with the module's directory. + - Same as `-Code` in `build-module.ps1`. +- `generate-help.ps1` + - Generates the Markdown documents for the modules into the `docs` folder. + - Same as `-Docs` in `build-module.ps1`. +- `test-module.ps1` + - Runs the `Pester` tests defined in the `test` folder. + - Same as `-Test` in `build-module.ps1`. +- `pack-module.ps1` + - Packages the module into a `.nupkg` for distribution. + - Same as `-Pack` in `build-module.ps1`. +- `generate-help.ps1` + - Generates the Markdown documents for the modules into the `docs` folder. + - Same as `-Docs` in `build-module.ps1`. + - This process is now integrated into `build-module.ps1` automatically. To disable, use `-NoDocs` when running `build-module.ps1`. +- `export-surface.ps1` + - Generates Markdown documents for both the cmdlet surface and the model (class) surface of the module. + - These files are placed into the `resources` folder. + - Used for investigating the surface of your module. These are *not* documentation for distribution. +- `check-dependencies.ps1` + - Used in `run-module.ps1` and `test-module.ps1` to verify dependent modules are available to run those tasks. + - It will download local (within the module's directory structure) versions of those modules as needed. + - This script *does not* need to be ran by-hand. \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/internal/Az.SiteRecovery.internal.psm1 b/swaggerci/recoveryservicessiterecovery/internal/Az.SiteRecovery.internal.psm1 new file mode 100644 index 000000000000..7e46c3457d0c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/internal/Az.SiteRecovery.internal.psm1 @@ -0,0 +1,38 @@ +# region Generated + # Load the private module dll + $null = Import-Module -PassThru -Name (Join-Path $PSScriptRoot '../bin/Az.SiteRecovery.private.dll') + + # Get the private module's instance + $instance = [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Module]::Instance + + # Export nothing to clear implicit exports + Export-ModuleMember + + # Export proxy cmdlet scripts + $exportsPath = $PSScriptRoot + $directories = Get-ChildItem -Directory -Path $exportsPath + $profileDirectory = $null + if($instance.ProfileName) { + if(($directories | ForEach-Object { $_.Name }) -contains $instance.ProfileName) { + $profileDirectory = $directories | Where-Object { $_.Name -eq $instance.ProfileName } + } else { + # Don't export anything if the profile doesn't exist for the module + $exportsPath = $null + Write-Warning "Selected Azure profile '$($instance.ProfileName)' does not exist for module '$($instance.Name)'. No cmdlets were loaded." + } + } elseif(($directories | Measure-Object).Count -gt 0) { + # Load the last folder if no profile is selected + $profileDirectory = $directories | Select-Object -Last 1 + } + + if($profileDirectory) { + Write-Information "Loaded Azure profile '$($profileDirectory.Name)' for module '$($instance.Name)'" + $exportsPath = $profileDirectory.FullName + } + + if($exportsPath) { + Get-ChildItem -Path $exportsPath -Recurse -Include '*.ps1' -File | ForEach-Object { . $_.FullName } + $cmdletNames = Get-ScriptCmdlet -ScriptFolder $exportsPath + Export-ModuleMember -Function $cmdletNames -Alias (Get-ScriptCmdlet -ScriptFolder $exportsPath -AsAlias) + } +# endregion diff --git a/swaggerci/recoveryservicessiterecovery/internal/Get-AzSiteRecoveryOperation.ps1 b/swaggerci/recoveryservicessiterecovery/internal/Get-AzSiteRecoveryOperation.ps1 new file mode 100644 index 000000000000..0ed434137e1a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/internal/Get-AzSiteRecoveryOperation.ps1 @@ -0,0 +1,132 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Operation to return the list of available operations. +.Description +Operation to return the list of available operations. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOperationsDiscovery +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/get-azsiterecoveryoperation +#> +function Get-AzSiteRecoveryOperation { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOperationsDiscovery])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The subscription Id. + ${SubscriptionId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + List = 'Az.SiteRecovery.private\Get-AzSiteRecoveryOperation_List'; + } + if (('List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/internal/ProxyCmdletDefinitions.ps1 b/swaggerci/recoveryservicessiterecovery/internal/ProxyCmdletDefinitions.ps1 new file mode 100644 index 000000000000..0ed434137e1a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/internal/ProxyCmdletDefinitions.ps1 @@ -0,0 +1,132 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Operation to return the list of available operations. +.Description +Operation to return the list of available operations. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOperationsDiscovery +.Link +https://learn.microsoft.com/powershell/module/az.siterecovery/get-azsiterecoveryoperation +#> +function Get-AzSiteRecoveryOperation { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Models.Api202301.IOperationsDiscovery])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The subscription Id. + ${SubscriptionId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.SiteRecovery.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + $mapping = @{ + List = 'Az.SiteRecovery.private\Get-AzSiteRecoveryOperation_List'; + } + if (('List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + + throw + } + +} +end { + try { + $steppablePipeline.End() + + } catch { + + throw + } +} +} diff --git a/swaggerci/recoveryservicessiterecovery/internal/README.md b/swaggerci/recoveryservicessiterecovery/internal/README.md new file mode 100644 index 000000000000..975484c4af06 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/internal/README.md @@ -0,0 +1,14 @@ +# Internal +This directory contains a module to handle *internal only* cmdlets. Cmdlets that you **hide** in configuration are created here. For more information on hiding, see [cmdlet hiding](https://github.com/Azure/autorest.powershell/blob/main/docs/directives.md#cmdlet-hiding-exportation-suppression). The cmdlets in this directory are generated at **build-time**. Do not put any custom code, files, cmdlets, etc. into this directory. Please use `../custom` for all custom implementation. + +## Info +- Modifiable: no +- Generated: all +- Committed: no +- Packaged: yes + +## Details +The `Az.SiteRecovery.internal.psm1` file is generated to this folder. This module file handles the hidden cmdlets. These cmdlets will not be exported by `Az.SiteRecovery`. Instead, this sub-module is imported by the `../custom/Az.SiteRecovery.custom.psm1` module, allowing you to use hidden cmdlets in your custom, exposed cmdlets. To call these cmdlets in your custom scripts, simply use [module-qualified calls](https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_command_precedence?view=powershell-6#qualified-names). For example, `Az.SiteRecovery.internal\Get-Example` would call an internal cmdlet named `Get-Example`. + +## Purpose +This allows you to include REST specifications for services that you *do not wish to expose from your module*, but simply want to call within custom cmdlets. For example, if you want to make a custom cmdlet that uses `Storage` services, you could include a simplified `Storage` REST specification that has only the operations you need. When you run the generator and build this module, note the generated `Storage` cmdlets. Then, in your readme configuration, use [cmdlet hiding](https://github.com/Azure/autorest/blob/master/docs/powershell/options.md#cmdlet-hiding-exportation-suppression) on the `Storage` cmdlets and they will *only be exposed to the custom cmdlets* you want to write, and not be exported as part of `Az.SiteRecovery`. diff --git a/swaggerci/recoveryservicessiterecovery/license.txt b/swaggerci/recoveryservicessiterecovery/license.txt new file mode 100644 index 000000000000..b9f3180fb9af --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/license.txt @@ -0,0 +1,227 @@ +MICROSOFT SOFTWARE LICENSE TERMS + +MICROSOFT AZURE POWERSHELL + +These license terms are an agreement between Microsoft Corporation (or based on where you live, one of its affiliates) and you. Please read them. They apply to the software named above, which includes the media on which you received it, if any. + +BY USING THE SOFTWARE, YOU ACCEPT THESE TERMS. IF YOU DO NOT ACCEPT THEM, DO NOT USE THE SOFTWARE. + + +-----------------START OF LICENSE-------------------------- + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +-------------------END OF LICENSE------------------------------------------ + + +----------------START OF THIRD PARTY NOTICE-------------------------------- + + +The software includes the AutoMapper library ("AutoMapper"). The MIT License set out below is provided for informational purposes only. It is not the license that governs any part of the software. + +Provided for Informational Purposes Only + +AutoMapper + +The MIT License (MIT) +Copyright (c) 2010 Jimmy Bogard + + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + + + + + +*************** + +The software includes Newtonsoft.Json. The MIT License set out below is provided for informational purposes only. It is not the license that governs any part of the software. + +Newtonsoft.Json + +The MIT License (MIT) +Copyright (c) 2007 James Newton-King +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +-------------END OF THIRD PARTY NOTICE---------------------------------------- + diff --git a/swaggerci/recoveryservicessiterecovery/pack-module.ps1 b/swaggerci/recoveryservicessiterecovery/pack-module.ps1 new file mode 100644 index 000000000000..8ed48957e579 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/pack-module.ps1 @@ -0,0 +1,9 @@ +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- +Write-Host -ForegroundColor Green 'Packing module...' +dotnet pack $PSScriptRoot --no-build /nologo +Write-Host -ForegroundColor Green '-------------Done-------------' \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/readme.md b/swaggerci/recoveryservicessiterecovery/readme.md new file mode 100644 index 000000000000..9e06084fb6d0 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/readme.md @@ -0,0 +1,10 @@ +### AutoRest Configuration +> see https://aka.ms/autorest + +``` yaml +require: + - $(this-folder)/../../tools/SwaggerCI/readme.azure.noprofile.md + - $(this-folder)/../../../azure-rest-api-specs/specification/recoveryservicessiterecovery/resource-manager/readme.md +try-require: + - $(this-folder)/../../../azure-rest-api-specs/specification/recoveryservicessiterecovery/resource-manager/readme.powershell.md +``` diff --git a/swaggerci/recoveryservicessiterecovery/resources/README.md b/swaggerci/recoveryservicessiterecovery/resources/README.md new file mode 100644 index 000000000000..736492341e3d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/resources/README.md @@ -0,0 +1,11 @@ +# Resources +This directory can contain any additional resources for module that are not required at runtime. This directory **does not** get packaged with the module. If you have assets for custom implementation, place them into the `../custom` folder. + +## Info +- Modifiable: yes +- Generated: no +- Committed: yes +- Packaged: no + +## Purpose +Use this folder to put anything you want to keep around as part of the repository for the module, but is not something that is required for the module. For example, development files, packaged builds, or additional information. This is only intended to be used in repositories where the module's output directory is cleaned, but tangential resources for the module want to remain intact. \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/run-module.ps1 b/swaggerci/recoveryservicessiterecovery/run-module.ps1 new file mode 100644 index 000000000000..a01d90126ece --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/run-module.ps1 @@ -0,0 +1,54 @@ +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- +param([switch]$Isolated, [switch]$Code) +$ErrorActionPreference = 'Stop' + +if(-not $Isolated) { + Write-Host -ForegroundColor Green 'Creating isolated process...' + $pwsh = [System.Diagnostics.Process]::GetCurrentProcess().Path + & "$pwsh" -NoExit -NoLogo -NoProfile -File $MyInvocation.MyCommand.Path @PSBoundParameters -Isolated + return +} + +$isAzure = $true +if($isAzure) { + . (Join-Path $PSScriptRoot 'check-dependencies.ps1') -Isolated -Accounts + # Load the latest version of Az.Accounts installed + Import-Module -Name Az.Accounts -RequiredVersion (Get-Module -Name Az.Accounts -ListAvailable | Sort-Object -Property Version -Descending)[0].Version +} + +$localModulesPath = Join-Path $PSScriptRoot 'generated/modules' +if(Test-Path -Path $localModulesPath) { + $env:PSModulePath = "$localModulesPath$([IO.Path]::PathSeparator)$env:PSModulePath" +} + +$modulePsd1 = Get-Item -Path (Join-Path $PSScriptRoot './Az.SiteRecovery.psd1') +$modulePath = $modulePsd1.FullName +$moduleName = $modulePsd1.BaseName + +function Prompt { + Write-Host -NoNewline -ForegroundColor Green "PS $(Get-Location)" + Write-Host -NoNewline -ForegroundColor Gray ' [' + Write-Host -NoNewline -ForegroundColor White -BackgroundColor DarkCyan $moduleName + ']> ' +} + +# where we would find the launch.json file +$vscodeDirectory = New-Item -ItemType Directory -Force -Path (Join-Path $PSScriptRoot '.vscode') +$launchJson = Join-Path $vscodeDirectory 'launch.json' + +# if there is a launch.json file, let's just assume -Code, and update the file +if(($Code) -or (test-Path $launchJson) ) { + $launchContent = '{ "version": "0.2.0", "configurations":[{ "name":"Attach to PowerShell", "type":"coreclr", "request":"attach", "processId":"' + ([System.Diagnostics.Process]::GetCurrentProcess().Id) + '", "justMyCode":false }] }' + Set-Content -Path $launchJson -Value $launchContent + if($Code) { + # only launch vscode if they say -code + code $PSScriptRoot + } +} + +Import-Module -Name $modulePath \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/test-module.ps1 b/swaggerci/recoveryservicessiterecovery/test-module.ps1 new file mode 100644 index 000000000000..424ae461de43 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test-module.ps1 @@ -0,0 +1,86 @@ +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- +param([switch]$Isolated, [switch]$Live, [switch]$Record, [switch]$Playback, [switch]$RegenerateSupportModule, [switch]$UsePreviousConfigForRecord, [string[]]$TestName) +$ErrorActionPreference = 'Stop' + +if(-not $Isolated) +{ + Write-Host -ForegroundColor Green 'Creating isolated process...' + if ($PSBoundParameters.ContainsKey("TestName")) { + $PSBoundParameters["TestName"] = $PSBoundParameters["TestName"] -join "," + } + $pwsh = [System.Diagnostics.Process]::GetCurrentProcess().Path + & "$pwsh" -NonInteractive -NoLogo -NoProfile -File $MyInvocation.MyCommand.Path @PSBoundParameters -Isolated + return +} + +# This is a workaround, since for string array parameter, pwsh -File will only take the first element +if ($PSBoundParameters.ContainsKey("TestName") -and ($TestName.count -eq 1) -and ($TestName[0].Contains(','))) { + $TestName = $TestName[0].Split(",") +} + +$ProgressPreference = 'SilentlyContinue' +$baseName = $PSScriptRoot.BaseName +$requireResourceModule = (($baseName -ne "Resources") -and ($Record.IsPresent -or $Live.IsPresent)) +. (Join-Path $PSScriptRoot 'check-dependencies.ps1') -Isolated -Accounts:$false -Pester -Resources:$requireResourceModule -RegenerateSupportModule:$RegenerateSupportModule +. ("$PSScriptRoot\test\utils.ps1") + +if ($requireResourceModule) +{ + # Load the latest Az.Accounts installed + Import-Module -Name Az.Accounts -RequiredVersion (Get-Module -Name Az.Accounts -ListAvailable | Sort-Object -Property Version -Descending)[0].Version + $resourceModulePSD = Get-Item -Path (Join-Path $HOME '.PSSharedModules\Resources\Az.Resources.TestSupport.psd1') + Import-Module -Name $resourceModulePSD.FullName +} + +$localModulesPath = Join-Path $PSScriptRoot 'generated/modules' +if(Test-Path -Path $localModulesPath) +{ + $env:PSModulePath = "$localModulesPath$([IO.Path]::PathSeparator)$env:PSModulePath" +} + +$modulePsd1 = Get-Item -Path (Join-Path $PSScriptRoot './Az.SiteRecovery.psd1') +$modulePath = $modulePsd1.FullName +$moduleName = $modulePsd1.BaseName + +Import-Module -Name Pester +Import-Module -Name $modulePath + +$TestMode = 'playback' +$ExcludeTag = @("LiveOnly") +if($Live) +{ + $TestMode = 'live' + $ExcludeTag = @() +} +if($Record) +{ + $TestMode = 'record' +} +try +{ + if ($TestMode -ne 'playback') + { + setupEnv + } + $testFolder = Join-Path $PSScriptRoot 'test' + if ($null -ne $TestName) + { + Invoke-Pester -Script @{ Path = $testFolder } -TestName $TestName -ExcludeTag $ExcludeTag -EnableExit -OutputFile (Join-Path $testFolder "$moduleName-TestResults.xml") + } else + { + Invoke-Pester -Script @{ Path = $testFolder } -ExcludeTag $ExcludeTag -EnableExit -OutputFile (Join-Path $testFolder "$moduleName-TestResults.xml") + } +} Finally +{ + if ($TestMode -ne 'playback') + { + cleanupEnv + } +} + +Write-Host -ForegroundColor Green '-------------Done-------------' \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/test/Add-AzSiteRecoveryReplicationProtectedItemDisk.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/Add-AzSiteRecoveryReplicationProtectedItemDisk.Tests.ps1 new file mode 100644 index 000000000000..cdcecc84d764 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/Add-AzSiteRecoveryReplicationProtectedItemDisk.Tests.ps1 @@ -0,0 +1,33 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Add-AzSiteRecoveryReplicationProtectedItemDisk')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Add-AzSiteRecoveryReplicationProtectedItemDisk.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Add-AzSiteRecoveryReplicationProtectedItemDisk' { + It 'AddExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'Add' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'AddViaIdentityExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'AddViaIdentity' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/Add-AzSiteRecoveryReplicationProtectedItemRecoveryPoint.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/Add-AzSiteRecoveryReplicationProtectedItemRecoveryPoint.Tests.ps1 new file mode 100644 index 000000000000..6b07df990e4d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/Add-AzSiteRecoveryReplicationProtectedItemRecoveryPoint.Tests.ps1 @@ -0,0 +1,33 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Add-AzSiteRecoveryReplicationProtectedItemRecoveryPoint')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Add-AzSiteRecoveryReplicationProtectedItemRecoveryPoint.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Add-AzSiteRecoveryReplicationProtectedItemRecoveryPoint' { + It 'ApplyExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'Apply' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'ApplyViaIdentityExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'ApplyViaIdentity' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/Clear-AzSiteRecoveryReplicationFabric.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/Clear-AzSiteRecoveryReplicationFabric.Tests.ps1 new file mode 100644 index 000000000000..1db20bed2237 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/Clear-AzSiteRecoveryReplicationFabric.Tests.ps1 @@ -0,0 +1,25 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Clear-AzSiteRecoveryReplicationFabric')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Clear-AzSiteRecoveryReplicationFabric.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Clear-AzSiteRecoveryReplicationFabric' { + It 'Purge' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'PurgeViaIdentity' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/Clear-AzSiteRecoveryReplicationProtectedItem.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/Clear-AzSiteRecoveryReplicationProtectedItem.Tests.ps1 new file mode 100644 index 000000000000..325a35b56cc8 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/Clear-AzSiteRecoveryReplicationProtectedItem.Tests.ps1 @@ -0,0 +1,25 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Clear-AzSiteRecoveryReplicationProtectedItem')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Clear-AzSiteRecoveryReplicationProtectedItem.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Clear-AzSiteRecoveryReplicationProtectedItem' { + It 'Purge' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'PurgeViaIdentity' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/Clear-AzSiteRecoveryReplicationProtectionContainerMapping.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/Clear-AzSiteRecoveryReplicationProtectionContainerMapping.Tests.ps1 new file mode 100644 index 000000000000..7b66130caa52 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/Clear-AzSiteRecoveryReplicationProtectionContainerMapping.Tests.ps1 @@ -0,0 +1,25 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Clear-AzSiteRecoveryReplicationProtectionContainerMapping')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Clear-AzSiteRecoveryReplicationProtectionContainerMapping.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Clear-AzSiteRecoveryReplicationProtectionContainerMapping' { + It 'Purge' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'PurgeViaIdentity' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/Clear-AzSiteRecoveryReplicationRecoveryServicesProvider.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/Clear-AzSiteRecoveryReplicationRecoveryServicesProvider.Tests.ps1 new file mode 100644 index 000000000000..c1938a5d5dca --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/Clear-AzSiteRecoveryReplicationRecoveryServicesProvider.Tests.ps1 @@ -0,0 +1,25 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Clear-AzSiteRecoveryReplicationRecoveryServicesProvider')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Clear-AzSiteRecoveryReplicationRecoveryServicesProvider.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Clear-AzSiteRecoveryReplicationRecoveryServicesProvider' { + It 'Purge' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'PurgeViaIdentity' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/Export-AzSiteRecoveryReplicationJob.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/Export-AzSiteRecoveryReplicationJob.Tests.ps1 new file mode 100644 index 000000000000..fe30de89f606 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/Export-AzSiteRecoveryReplicationJob.Tests.ps1 @@ -0,0 +1,33 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Export-AzSiteRecoveryReplicationJob')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Export-AzSiteRecoveryReplicationJob.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Export-AzSiteRecoveryReplicationJob' { + It 'ExportExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'Export' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'ExportViaIdentityExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'ExportViaIdentity' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/Find-AzSiteRecoveryReplicationProtectionContainerProtectableItem.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/Find-AzSiteRecoveryReplicationProtectionContainerProtectableItem.Tests.ps1 new file mode 100644 index 000000000000..5a88a8b6cbad --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/Find-AzSiteRecoveryReplicationProtectionContainerProtectableItem.Tests.ps1 @@ -0,0 +1,33 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Find-AzSiteRecoveryReplicationProtectionContainerProtectableItem')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Find-AzSiteRecoveryReplicationProtectionContainerProtectableItem.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Find-AzSiteRecoveryReplicationProtectionContainerProtectableItem' { + It 'DiscoverExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'Discover' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'DiscoverViaIdentityExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'DiscoverViaIdentity' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/Get-AzSiteRecoveryMigrationRecoveryPoint.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/Get-AzSiteRecoveryMigrationRecoveryPoint.Tests.ps1 new file mode 100644 index 000000000000..9ca03665e96e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/Get-AzSiteRecoveryMigrationRecoveryPoint.Tests.ps1 @@ -0,0 +1,29 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Get-AzSiteRecoveryMigrationRecoveryPoint')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzSiteRecoveryMigrationRecoveryPoint.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Get-AzSiteRecoveryMigrationRecoveryPoint' { + It 'List' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'Get' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'GetViaIdentity' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/Get-AzSiteRecoveryPoint.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/Get-AzSiteRecoveryPoint.Tests.ps1 new file mode 100644 index 000000000000..bce67a57ee10 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/Get-AzSiteRecoveryPoint.Tests.ps1 @@ -0,0 +1,29 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Get-AzSiteRecoveryPoint')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzSiteRecoveryPoint.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Get-AzSiteRecoveryPoint' { + It 'List' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'Get' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'GetViaIdentity' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/Get-AzSiteRecoveryReplicationAlertSetting.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/Get-AzSiteRecoveryReplicationAlertSetting.Tests.ps1 new file mode 100644 index 000000000000..747d42d332f8 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/Get-AzSiteRecoveryReplicationAlertSetting.Tests.ps1 @@ -0,0 +1,29 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Get-AzSiteRecoveryReplicationAlertSetting')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzSiteRecoveryReplicationAlertSetting.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Get-AzSiteRecoveryReplicationAlertSetting' { + It 'List' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'Get' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'GetViaIdentity' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/Get-AzSiteRecoveryReplicationAppliance.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/Get-AzSiteRecoveryReplicationAppliance.Tests.ps1 new file mode 100644 index 000000000000..a456933d2c73 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/Get-AzSiteRecoveryReplicationAppliance.Tests.ps1 @@ -0,0 +1,21 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Get-AzSiteRecoveryReplicationAppliance')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzSiteRecoveryReplicationAppliance.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Get-AzSiteRecoveryReplicationAppliance' { + It 'List' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/Get-AzSiteRecoveryReplicationEligibilityResult.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/Get-AzSiteRecoveryReplicationEligibilityResult.Tests.ps1 new file mode 100644 index 000000000000..c4cda6750002 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/Get-AzSiteRecoveryReplicationEligibilityResult.Tests.ps1 @@ -0,0 +1,29 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Get-AzSiteRecoveryReplicationEligibilityResult')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzSiteRecoveryReplicationEligibilityResult.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Get-AzSiteRecoveryReplicationEligibilityResult' { + It 'Get' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'List' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'GetViaIdentity' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/Get-AzSiteRecoveryReplicationEvent.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/Get-AzSiteRecoveryReplicationEvent.Tests.ps1 new file mode 100644 index 000000000000..b7a7f5e3a48d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/Get-AzSiteRecoveryReplicationEvent.Tests.ps1 @@ -0,0 +1,29 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Get-AzSiteRecoveryReplicationEvent')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzSiteRecoveryReplicationEvent.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Get-AzSiteRecoveryReplicationEvent' { + It 'List' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'Get' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'GetViaIdentity' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/Get-AzSiteRecoveryReplicationFabric.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/Get-AzSiteRecoveryReplicationFabric.Tests.ps1 new file mode 100644 index 000000000000..ef750698ed28 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/Get-AzSiteRecoveryReplicationFabric.Tests.ps1 @@ -0,0 +1,29 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Get-AzSiteRecoveryReplicationFabric')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzSiteRecoveryReplicationFabric.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Get-AzSiteRecoveryReplicationFabric' { + It 'List' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'Get' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'GetViaIdentity' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/Get-AzSiteRecoveryReplicationJob.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/Get-AzSiteRecoveryReplicationJob.Tests.ps1 new file mode 100644 index 000000000000..c362e47a20ea --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/Get-AzSiteRecoveryReplicationJob.Tests.ps1 @@ -0,0 +1,29 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Get-AzSiteRecoveryReplicationJob')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzSiteRecoveryReplicationJob.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Get-AzSiteRecoveryReplicationJob' { + It 'List' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'Get' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'GetViaIdentity' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/Get-AzSiteRecoveryReplicationLogicalNetwork.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/Get-AzSiteRecoveryReplicationLogicalNetwork.Tests.ps1 new file mode 100644 index 000000000000..ac4b77b4c9b8 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/Get-AzSiteRecoveryReplicationLogicalNetwork.Tests.ps1 @@ -0,0 +1,29 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Get-AzSiteRecoveryReplicationLogicalNetwork')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzSiteRecoveryReplicationLogicalNetwork.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Get-AzSiteRecoveryReplicationLogicalNetwork' { + It 'List' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'Get' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'GetViaIdentity' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/Get-AzSiteRecoveryReplicationMigrationItem.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/Get-AzSiteRecoveryReplicationMigrationItem.Tests.ps1 new file mode 100644 index 000000000000..20dfbc0edbd2 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/Get-AzSiteRecoveryReplicationMigrationItem.Tests.ps1 @@ -0,0 +1,33 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Get-AzSiteRecoveryReplicationMigrationItem')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzSiteRecoveryReplicationMigrationItem.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Get-AzSiteRecoveryReplicationMigrationItem' { + It 'List1' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'List' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'Get' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'GetViaIdentity' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/Get-AzSiteRecoveryReplicationNetwork.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/Get-AzSiteRecoveryReplicationNetwork.Tests.ps1 new file mode 100644 index 000000000000..918bfc5fa52d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/Get-AzSiteRecoveryReplicationNetwork.Tests.ps1 @@ -0,0 +1,33 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Get-AzSiteRecoveryReplicationNetwork')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzSiteRecoveryReplicationNetwork.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Get-AzSiteRecoveryReplicationNetwork' { + It 'List1' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'List' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'Get' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'GetViaIdentity' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/Get-AzSiteRecoveryReplicationNetworkMapping.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/Get-AzSiteRecoveryReplicationNetworkMapping.Tests.ps1 new file mode 100644 index 000000000000..84ff0c4e03ff --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/Get-AzSiteRecoveryReplicationNetworkMapping.Tests.ps1 @@ -0,0 +1,33 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Get-AzSiteRecoveryReplicationNetworkMapping')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzSiteRecoveryReplicationNetworkMapping.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Get-AzSiteRecoveryReplicationNetworkMapping' { + It 'List1' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'List' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'Get' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'GetViaIdentity' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/Get-AzSiteRecoveryReplicationPolicy.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/Get-AzSiteRecoveryReplicationPolicy.Tests.ps1 new file mode 100644 index 000000000000..999f0ee15cc9 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/Get-AzSiteRecoveryReplicationPolicy.Tests.ps1 @@ -0,0 +1,29 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Get-AzSiteRecoveryReplicationPolicy')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzSiteRecoveryReplicationPolicy.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Get-AzSiteRecoveryReplicationPolicy' { + It 'List' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'Get' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'GetViaIdentity' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/Get-AzSiteRecoveryReplicationProtectableItem.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/Get-AzSiteRecoveryReplicationProtectableItem.Tests.ps1 new file mode 100644 index 000000000000..ea4a0fc21b93 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/Get-AzSiteRecoveryReplicationProtectableItem.Tests.ps1 @@ -0,0 +1,29 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Get-AzSiteRecoveryReplicationProtectableItem')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzSiteRecoveryReplicationProtectableItem.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Get-AzSiteRecoveryReplicationProtectableItem' { + It 'List' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'Get' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'GetViaIdentity' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/Get-AzSiteRecoveryReplicationProtectedItem.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/Get-AzSiteRecoveryReplicationProtectedItem.Tests.ps1 new file mode 100644 index 000000000000..f17576ee75de --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/Get-AzSiteRecoveryReplicationProtectedItem.Tests.ps1 @@ -0,0 +1,33 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Get-AzSiteRecoveryReplicationProtectedItem')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzSiteRecoveryReplicationProtectedItem.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Get-AzSiteRecoveryReplicationProtectedItem' { + It 'List1' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'List' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'Get' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'GetViaIdentity' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/Get-AzSiteRecoveryReplicationProtectionContainer.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/Get-AzSiteRecoveryReplicationProtectionContainer.Tests.ps1 new file mode 100644 index 000000000000..92acda4c785e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/Get-AzSiteRecoveryReplicationProtectionContainer.Tests.ps1 @@ -0,0 +1,33 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Get-AzSiteRecoveryReplicationProtectionContainer')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzSiteRecoveryReplicationProtectionContainer.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Get-AzSiteRecoveryReplicationProtectionContainer' { + It 'List1' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'List' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'Get' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'GetViaIdentity' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/Get-AzSiteRecoveryReplicationProtectionContainerMapping.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/Get-AzSiteRecoveryReplicationProtectionContainerMapping.Tests.ps1 new file mode 100644 index 000000000000..4aca17755e9a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/Get-AzSiteRecoveryReplicationProtectionContainerMapping.Tests.ps1 @@ -0,0 +1,33 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Get-AzSiteRecoveryReplicationProtectionContainerMapping')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzSiteRecoveryReplicationProtectionContainerMapping.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Get-AzSiteRecoveryReplicationProtectionContainerMapping' { + It 'List1' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'List' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'Get' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'GetViaIdentity' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/Get-AzSiteRecoveryReplicationProtectionIntent.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/Get-AzSiteRecoveryReplicationProtectionIntent.Tests.ps1 new file mode 100644 index 000000000000..a7a51241092f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/Get-AzSiteRecoveryReplicationProtectionIntent.Tests.ps1 @@ -0,0 +1,29 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Get-AzSiteRecoveryReplicationProtectionIntent')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzSiteRecoveryReplicationProtectionIntent.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Get-AzSiteRecoveryReplicationProtectionIntent' { + It 'List' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'Get' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'GetViaIdentity' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/Get-AzSiteRecoveryReplicationRecoveryPlan.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/Get-AzSiteRecoveryReplicationRecoveryPlan.Tests.ps1 new file mode 100644 index 000000000000..7f1c1dc02f60 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/Get-AzSiteRecoveryReplicationRecoveryPlan.Tests.ps1 @@ -0,0 +1,29 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Get-AzSiteRecoveryReplicationRecoveryPlan')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzSiteRecoveryReplicationRecoveryPlan.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Get-AzSiteRecoveryReplicationRecoveryPlan' { + It 'List' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'Get' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'GetViaIdentity' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/Get-AzSiteRecoveryReplicationRecoveryServiceProvider.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/Get-AzSiteRecoveryReplicationRecoveryServiceProvider.Tests.ps1 new file mode 100644 index 000000000000..3922d76e2e28 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/Get-AzSiteRecoveryReplicationRecoveryServiceProvider.Tests.ps1 @@ -0,0 +1,21 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Get-AzSiteRecoveryReplicationRecoveryServiceProvider')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzSiteRecoveryReplicationRecoveryServiceProvider.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Get-AzSiteRecoveryReplicationRecoveryServiceProvider' { + It 'List' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/Get-AzSiteRecoveryReplicationRecoveryServicesProvider.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/Get-AzSiteRecoveryReplicationRecoveryServicesProvider.Tests.ps1 new file mode 100644 index 000000000000..0ae4f970e5c1 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/Get-AzSiteRecoveryReplicationRecoveryServicesProvider.Tests.ps1 @@ -0,0 +1,29 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Get-AzSiteRecoveryReplicationRecoveryServicesProvider')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzSiteRecoveryReplicationRecoveryServicesProvider.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Get-AzSiteRecoveryReplicationRecoveryServicesProvider' { + It 'List' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'Get' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'GetViaIdentity' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/Get-AzSiteRecoveryReplicationStorageClassification.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/Get-AzSiteRecoveryReplicationStorageClassification.Tests.ps1 new file mode 100644 index 000000000000..00fb167c17c6 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/Get-AzSiteRecoveryReplicationStorageClassification.Tests.ps1 @@ -0,0 +1,33 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Get-AzSiteRecoveryReplicationStorageClassification')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzSiteRecoveryReplicationStorageClassification.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Get-AzSiteRecoveryReplicationStorageClassification' { + It 'List1' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'List' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'Get' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'GetViaIdentity' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/Get-AzSiteRecoveryReplicationStorageClassificationMapping.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/Get-AzSiteRecoveryReplicationStorageClassificationMapping.Tests.ps1 new file mode 100644 index 000000000000..f59fbb64f015 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/Get-AzSiteRecoveryReplicationStorageClassificationMapping.Tests.ps1 @@ -0,0 +1,33 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Get-AzSiteRecoveryReplicationStorageClassificationMapping')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzSiteRecoveryReplicationStorageClassificationMapping.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Get-AzSiteRecoveryReplicationStorageClassificationMapping' { + It 'List1' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'List' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'Get' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'GetViaIdentity' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/Get-AzSiteRecoveryReplicationVaultHealth.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/Get-AzSiteRecoveryReplicationVaultHealth.Tests.ps1 new file mode 100644 index 000000000000..e2d4d8a14520 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/Get-AzSiteRecoveryReplicationVaultHealth.Tests.ps1 @@ -0,0 +1,25 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Get-AzSiteRecoveryReplicationVaultHealth')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzSiteRecoveryReplicationVaultHealth.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Get-AzSiteRecoveryReplicationVaultHealth' { + It 'Get' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'GetViaIdentity' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/Get-AzSiteRecoveryReplicationVaultSetting.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/Get-AzSiteRecoveryReplicationVaultSetting.Tests.ps1 new file mode 100644 index 000000000000..5f56102a5366 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/Get-AzSiteRecoveryReplicationVaultSetting.Tests.ps1 @@ -0,0 +1,29 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Get-AzSiteRecoveryReplicationVaultSetting')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzSiteRecoveryReplicationVaultSetting.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Get-AzSiteRecoveryReplicationVaultSetting' { + It 'List' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'Get' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'GetViaIdentity' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/Get-AzSiteRecoveryReplicationvCenter.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/Get-AzSiteRecoveryReplicationvCenter.Tests.ps1 new file mode 100644 index 000000000000..c9d48bb54b76 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/Get-AzSiteRecoveryReplicationvCenter.Tests.ps1 @@ -0,0 +1,33 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Get-AzSiteRecoveryReplicationvCenter')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzSiteRecoveryReplicationvCenter.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Get-AzSiteRecoveryReplicationvCenter' { + It 'List1' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'List' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'Get' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'GetViaIdentity' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/Get-AzSiteRecoverySupportedOperatingSystem.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/Get-AzSiteRecoverySupportedOperatingSystem.Tests.ps1 new file mode 100644 index 000000000000..d77e2d18935f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/Get-AzSiteRecoverySupportedOperatingSystem.Tests.ps1 @@ -0,0 +1,25 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Get-AzSiteRecoverySupportedOperatingSystem')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzSiteRecoverySupportedOperatingSystem.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Get-AzSiteRecoverySupportedOperatingSystem' { + It 'Get' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'GetViaIdentity' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/Get-AzSiteRecoveryTargetComputeSize.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/Get-AzSiteRecoveryTargetComputeSize.Tests.ps1 new file mode 100644 index 000000000000..81d5642d6351 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/Get-AzSiteRecoveryTargetComputeSize.Tests.ps1 @@ -0,0 +1,21 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Get-AzSiteRecoveryTargetComputeSize')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzSiteRecoveryTargetComputeSize.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Get-AzSiteRecoveryTargetComputeSize' { + It 'List' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/Invoke-AzSiteRecoveryCommitReplicationProtectedItemFailover.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/Invoke-AzSiteRecoveryCommitReplicationProtectedItemFailover.Tests.ps1 new file mode 100644 index 000000000000..d4c9d8be34bf --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/Invoke-AzSiteRecoveryCommitReplicationProtectedItemFailover.Tests.ps1 @@ -0,0 +1,25 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Invoke-AzSiteRecoveryCommitReplicationProtectedItemFailover')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Invoke-AzSiteRecoveryCommitReplicationProtectedItemFailover.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Invoke-AzSiteRecoveryCommitReplicationProtectedItemFailover' { + It 'Commit' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'CommitViaIdentity' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/Invoke-AzSiteRecoveryCommitReplicationRecoveryPlanFailover.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/Invoke-AzSiteRecoveryCommitReplicationRecoveryPlanFailover.Tests.ps1 new file mode 100644 index 000000000000..c8d67f33cfa1 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/Invoke-AzSiteRecoveryCommitReplicationRecoveryPlanFailover.Tests.ps1 @@ -0,0 +1,25 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Invoke-AzSiteRecoveryCommitReplicationRecoveryPlanFailover')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Invoke-AzSiteRecoveryCommitReplicationRecoveryPlanFailover.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Invoke-AzSiteRecoveryCommitReplicationRecoveryPlanFailover' { + It 'Commit' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'CommitViaIdentity' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/Invoke-AzSiteRecoveryPlannedReplicationProtectedItemFailover.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/Invoke-AzSiteRecoveryPlannedReplicationProtectedItemFailover.Tests.ps1 new file mode 100644 index 000000000000..eabaec278395 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/Invoke-AzSiteRecoveryPlannedReplicationProtectedItemFailover.Tests.ps1 @@ -0,0 +1,33 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Invoke-AzSiteRecoveryPlannedReplicationProtectedItemFailover')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Invoke-AzSiteRecoveryPlannedReplicationProtectedItemFailover.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Invoke-AzSiteRecoveryPlannedReplicationProtectedItemFailover' { + It 'PlannedExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'Planned' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'PlannedViaIdentityExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'PlannedViaIdentity' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/Invoke-AzSiteRecoveryPlannedReplicationRecoveryPlanFailover.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/Invoke-AzSiteRecoveryPlannedReplicationRecoveryPlanFailover.Tests.ps1 new file mode 100644 index 000000000000..5737a8044d88 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/Invoke-AzSiteRecoveryPlannedReplicationRecoveryPlanFailover.Tests.ps1 @@ -0,0 +1,33 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Invoke-AzSiteRecoveryPlannedReplicationRecoveryPlanFailover')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Invoke-AzSiteRecoveryPlannedReplicationRecoveryPlanFailover.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Invoke-AzSiteRecoveryPlannedReplicationRecoveryPlanFailover' { + It 'PlannedExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'Planned' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'PlannedViaIdentityExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'PlannedViaIdentity' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/Invoke-AzSiteRecoveryRenewReplicationFabricCertificate.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/Invoke-AzSiteRecoveryRenewReplicationFabricCertificate.Tests.ps1 new file mode 100644 index 000000000000..60d74e173951 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/Invoke-AzSiteRecoveryRenewReplicationFabricCertificate.Tests.ps1 @@ -0,0 +1,33 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Invoke-AzSiteRecoveryRenewReplicationFabricCertificate')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Invoke-AzSiteRecoveryRenewReplicationFabricCertificate.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Invoke-AzSiteRecoveryRenewReplicationFabricCertificate' { + It 'RenewExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'Renew' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'RenewViaIdentityExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'RenewViaIdentity' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/Invoke-AzSiteRecoveryReprotectReplicationProtectedItem.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/Invoke-AzSiteRecoveryReprotectReplicationProtectedItem.Tests.ps1 new file mode 100644 index 000000000000..24c6b75b5db5 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/Invoke-AzSiteRecoveryReprotectReplicationProtectedItem.Tests.ps1 @@ -0,0 +1,33 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Invoke-AzSiteRecoveryReprotectReplicationProtectedItem')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Invoke-AzSiteRecoveryReprotectReplicationProtectedItem.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Invoke-AzSiteRecoveryReprotectReplicationProtectedItem' { + It 'ReprotectExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'Reprotect' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'ReprotectViaIdentityExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'ReprotectViaIdentity' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/Invoke-AzSiteRecoveryReprotectReplicationRecoveryPlan.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/Invoke-AzSiteRecoveryReprotectReplicationRecoveryPlan.Tests.ps1 new file mode 100644 index 000000000000..2cae1a9648b1 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/Invoke-AzSiteRecoveryReprotectReplicationRecoveryPlan.Tests.ps1 @@ -0,0 +1,25 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Invoke-AzSiteRecoveryReprotectReplicationRecoveryPlan')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Invoke-AzSiteRecoveryReprotectReplicationRecoveryPlan.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Invoke-AzSiteRecoveryReprotectReplicationRecoveryPlan' { + It 'Reprotect' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'ReprotectViaIdentity' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/Invoke-AzSiteRecoveryResyncReplicationMigrationItem.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/Invoke-AzSiteRecoveryResyncReplicationMigrationItem.Tests.ps1 new file mode 100644 index 000000000000..b41119eccfc9 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/Invoke-AzSiteRecoveryResyncReplicationMigrationItem.Tests.ps1 @@ -0,0 +1,33 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Invoke-AzSiteRecoveryResyncReplicationMigrationItem')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Invoke-AzSiteRecoveryResyncReplicationMigrationItem.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Invoke-AzSiteRecoveryResyncReplicationMigrationItem' { + It 'ResyncExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'Resync' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'ResyncViaIdentityExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'ResyncViaIdentity' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/Invoke-AzSiteRecoveryUnplannedReplicationProtectedItemFailover.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/Invoke-AzSiteRecoveryUnplannedReplicationProtectedItemFailover.Tests.ps1 new file mode 100644 index 000000000000..0d6d2ba25a91 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/Invoke-AzSiteRecoveryUnplannedReplicationProtectedItemFailover.Tests.ps1 @@ -0,0 +1,33 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Invoke-AzSiteRecoveryUnplannedReplicationProtectedItemFailover')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Invoke-AzSiteRecoveryUnplannedReplicationProtectedItemFailover.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Invoke-AzSiteRecoveryUnplannedReplicationProtectedItemFailover' { + It 'UnplannedExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'Unplanned' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'UnplannedViaIdentityExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'UnplannedViaIdentity' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/Invoke-AzSiteRecoveryUnplannedReplicationRecoveryPlanFailover.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/Invoke-AzSiteRecoveryUnplannedReplicationRecoveryPlanFailover.Tests.ps1 new file mode 100644 index 000000000000..1eaaffd4f26b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/Invoke-AzSiteRecoveryUnplannedReplicationRecoveryPlanFailover.Tests.ps1 @@ -0,0 +1,33 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Invoke-AzSiteRecoveryUnplannedReplicationRecoveryPlanFailover')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Invoke-AzSiteRecoveryUnplannedReplicationRecoveryPlanFailover.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Invoke-AzSiteRecoveryUnplannedReplicationRecoveryPlanFailover' { + It 'UnplannedExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'Unplanned' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'UnplannedViaIdentityExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'UnplannedViaIdentity' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/Move-AzSiteRecoveryReplicationFabricGateway.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/Move-AzSiteRecoveryReplicationFabricGateway.Tests.ps1 new file mode 100644 index 000000000000..de52a1b546ba --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/Move-AzSiteRecoveryReplicationFabricGateway.Tests.ps1 @@ -0,0 +1,33 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Move-AzSiteRecoveryReplicationFabricGateway')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Move-AzSiteRecoveryReplicationFabricGateway.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Move-AzSiteRecoveryReplicationFabricGateway' { + It 'ReassociateExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'Reassociate' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'ReassociateViaIdentityExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'ReassociateViaIdentity' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/Move-AzSiteRecoveryReplicationFabricToAad.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/Move-AzSiteRecoveryReplicationFabricToAad.Tests.ps1 new file mode 100644 index 000000000000..1951a73be485 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/Move-AzSiteRecoveryReplicationFabricToAad.Tests.ps1 @@ -0,0 +1,25 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Move-AzSiteRecoveryReplicationFabricToAad')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Move-AzSiteRecoveryReplicationFabricToAad.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Move-AzSiteRecoveryReplicationFabricToAad' { + It 'Migrate' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'MigrateViaIdentity' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/Move-AzSiteRecoveryReplicationMigrationItem.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/Move-AzSiteRecoveryReplicationMigrationItem.Tests.ps1 new file mode 100644 index 000000000000..853c2ccae015 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/Move-AzSiteRecoveryReplicationMigrationItem.Tests.ps1 @@ -0,0 +1,33 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Move-AzSiteRecoveryReplicationMigrationItem')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Move-AzSiteRecoveryReplicationMigrationItem.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Move-AzSiteRecoveryReplicationMigrationItem' { + It 'MigrateExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'Migrate' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'MigrateViaIdentityExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'MigrateViaIdentity' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/New-AzSiteRecoveryReplicationAlertSetting.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/New-AzSiteRecoveryReplicationAlertSetting.Tests.ps1 new file mode 100644 index 000000000000..da240694a1e3 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/New-AzSiteRecoveryReplicationAlertSetting.Tests.ps1 @@ -0,0 +1,21 @@ +if(($null -eq $TestName) -or ($TestName -contains 'New-AzSiteRecoveryReplicationAlertSetting')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'New-AzSiteRecoveryReplicationAlertSetting.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'New-AzSiteRecoveryReplicationAlertSetting' { + It 'CreateExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/New-AzSiteRecoveryReplicationFabric.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/New-AzSiteRecoveryReplicationFabric.Tests.ps1 new file mode 100644 index 000000000000..daf59e735327 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/New-AzSiteRecoveryReplicationFabric.Tests.ps1 @@ -0,0 +1,21 @@ +if(($null -eq $TestName) -or ($TestName -contains 'New-AzSiteRecoveryReplicationFabric')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'New-AzSiteRecoveryReplicationFabric.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'New-AzSiteRecoveryReplicationFabric' { + It 'CreateExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/New-AzSiteRecoveryReplicationMigrationItem.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/New-AzSiteRecoveryReplicationMigrationItem.Tests.ps1 new file mode 100644 index 000000000000..bd775cca1c5e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/New-AzSiteRecoveryReplicationMigrationItem.Tests.ps1 @@ -0,0 +1,21 @@ +if(($null -eq $TestName) -or ($TestName -contains 'New-AzSiteRecoveryReplicationMigrationItem')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'New-AzSiteRecoveryReplicationMigrationItem.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'New-AzSiteRecoveryReplicationMigrationItem' { + It 'CreateExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/New-AzSiteRecoveryReplicationNetworkMapping.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/New-AzSiteRecoveryReplicationNetworkMapping.Tests.ps1 new file mode 100644 index 000000000000..86e112cd0e31 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/New-AzSiteRecoveryReplicationNetworkMapping.Tests.ps1 @@ -0,0 +1,21 @@ +if(($null -eq $TestName) -or ($TestName -contains 'New-AzSiteRecoveryReplicationNetworkMapping')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'New-AzSiteRecoveryReplicationNetworkMapping.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'New-AzSiteRecoveryReplicationNetworkMapping' { + It 'CreateExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/New-AzSiteRecoveryReplicationPolicy.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/New-AzSiteRecoveryReplicationPolicy.Tests.ps1 new file mode 100644 index 000000000000..23b8869d49b9 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/New-AzSiteRecoveryReplicationPolicy.Tests.ps1 @@ -0,0 +1,21 @@ +if(($null -eq $TestName) -or ($TestName -contains 'New-AzSiteRecoveryReplicationPolicy')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'New-AzSiteRecoveryReplicationPolicy.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'New-AzSiteRecoveryReplicationPolicy' { + It 'CreateExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/New-AzSiteRecoveryReplicationProtectedItem.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/New-AzSiteRecoveryReplicationProtectedItem.Tests.ps1 new file mode 100644 index 000000000000..205dc872abda --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/New-AzSiteRecoveryReplicationProtectedItem.Tests.ps1 @@ -0,0 +1,21 @@ +if(($null -eq $TestName) -or ($TestName -contains 'New-AzSiteRecoveryReplicationProtectedItem')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'New-AzSiteRecoveryReplicationProtectedItem.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'New-AzSiteRecoveryReplicationProtectedItem' { + It 'CreateExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/New-AzSiteRecoveryReplicationProtectionContainer.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/New-AzSiteRecoveryReplicationProtectionContainer.Tests.ps1 new file mode 100644 index 000000000000..0a9912f50b49 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/New-AzSiteRecoveryReplicationProtectionContainer.Tests.ps1 @@ -0,0 +1,21 @@ +if(($null -eq $TestName) -or ($TestName -contains 'New-AzSiteRecoveryReplicationProtectionContainer')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'New-AzSiteRecoveryReplicationProtectionContainer.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'New-AzSiteRecoveryReplicationProtectionContainer' { + It 'CreateExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/New-AzSiteRecoveryReplicationProtectionContainerMapping.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/New-AzSiteRecoveryReplicationProtectionContainerMapping.Tests.ps1 new file mode 100644 index 000000000000..3a3b5f26770b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/New-AzSiteRecoveryReplicationProtectionContainerMapping.Tests.ps1 @@ -0,0 +1,21 @@ +if(($null -eq $TestName) -or ($TestName -contains 'New-AzSiteRecoveryReplicationProtectionContainerMapping')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'New-AzSiteRecoveryReplicationProtectionContainerMapping.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'New-AzSiteRecoveryReplicationProtectionContainerMapping' { + It 'CreateExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/New-AzSiteRecoveryReplicationProtectionIntent.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/New-AzSiteRecoveryReplicationProtectionIntent.Tests.ps1 new file mode 100644 index 000000000000..30f6318a3578 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/New-AzSiteRecoveryReplicationProtectionIntent.Tests.ps1 @@ -0,0 +1,21 @@ +if(($null -eq $TestName) -or ($TestName -contains 'New-AzSiteRecoveryReplicationProtectionIntent')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'New-AzSiteRecoveryReplicationProtectionIntent.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'New-AzSiteRecoveryReplicationProtectionIntent' { + It 'CreateExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/New-AzSiteRecoveryReplicationRecoveryPlan.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/New-AzSiteRecoveryReplicationRecoveryPlan.Tests.ps1 new file mode 100644 index 000000000000..d2dc5d42b772 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/New-AzSiteRecoveryReplicationRecoveryPlan.Tests.ps1 @@ -0,0 +1,21 @@ +if(($null -eq $TestName) -or ($TestName -contains 'New-AzSiteRecoveryReplicationRecoveryPlan')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'New-AzSiteRecoveryReplicationRecoveryPlan.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'New-AzSiteRecoveryReplicationRecoveryPlan' { + It 'CreateExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/New-AzSiteRecoveryReplicationRecoveryServicesProvider.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/New-AzSiteRecoveryReplicationRecoveryServicesProvider.Tests.ps1 new file mode 100644 index 000000000000..d79f8779747f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/New-AzSiteRecoveryReplicationRecoveryServicesProvider.Tests.ps1 @@ -0,0 +1,21 @@ +if(($null -eq $TestName) -or ($TestName -contains 'New-AzSiteRecoveryReplicationRecoveryServicesProvider')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'New-AzSiteRecoveryReplicationRecoveryServicesProvider.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'New-AzSiteRecoveryReplicationRecoveryServicesProvider' { + It 'CreateExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/New-AzSiteRecoveryReplicationStorageClassificationMapping.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/New-AzSiteRecoveryReplicationStorageClassificationMapping.Tests.ps1 new file mode 100644 index 000000000000..8534d0ae75f0 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/New-AzSiteRecoveryReplicationStorageClassificationMapping.Tests.ps1 @@ -0,0 +1,21 @@ +if(($null -eq $TestName) -or ($TestName -contains 'New-AzSiteRecoveryReplicationStorageClassificationMapping')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'New-AzSiteRecoveryReplicationStorageClassificationMapping.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'New-AzSiteRecoveryReplicationStorageClassificationMapping' { + It 'CreateExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/New-AzSiteRecoveryReplicationVaultSetting.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/New-AzSiteRecoveryReplicationVaultSetting.Tests.ps1 new file mode 100644 index 000000000000..5b60f7886588 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/New-AzSiteRecoveryReplicationVaultSetting.Tests.ps1 @@ -0,0 +1,21 @@ +if(($null -eq $TestName) -or ($TestName -contains 'New-AzSiteRecoveryReplicationVaultSetting')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'New-AzSiteRecoveryReplicationVaultSetting.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'New-AzSiteRecoveryReplicationVaultSetting' { + It 'CreateExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/New-AzSiteRecoveryReplicationvCenter.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/New-AzSiteRecoveryReplicationvCenter.Tests.ps1 new file mode 100644 index 000000000000..bf8a8c593d42 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/New-AzSiteRecoveryReplicationvCenter.Tests.ps1 @@ -0,0 +1,21 @@ +if(($null -eq $TestName) -or ($TestName -contains 'New-AzSiteRecoveryReplicationvCenter')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'New-AzSiteRecoveryReplicationvCenter.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'New-AzSiteRecoveryReplicationvCenter' { + It 'CreateExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/README.md b/swaggerci/recoveryservicessiterecovery/test/README.md new file mode 100644 index 000000000000..1969200c6a09 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/README.md @@ -0,0 +1,17 @@ +# Test +This directory contains the [Pester](https://www.powershellgallery.com/packages/Pester) tests to run for the module. We use Pester as it is the unofficial standard for PowerShell unit testing. Test stubs for custom cmdlets (created in `../custom`) will be generated into this folder when `build-module.ps1` is ran. These test stubs will fail automatically, to indicate that tests should be written for custom cmdlets. + +## Info +- Modifiable: yes +- Generated: partial +- Committed: yes +- Packaged: no + +## Details +We allow three testing modes: *live*, *record*, and *playback*. These can be selected using the `-Live`, `-Record`, and `-Playback` switches respectively on the `test-module.ps1` script. This script will run through any `.Tests.ps1` scripts in the `test` folder. If you choose the *record* mode, it will create a `.Recording.json` file of the REST calls between the client and server. Then, when you choose *playback* mode, it will use the `.Recording.json` file to mock the communication between server and client. The *live* mode runs the same as the *record* mode; however, it doesn't create the `.Recording.json` file. + +## Purpose +Custom cmdlets generally encompass additional functionality not described in the REST specification, or combines functionality generated from the REST spec. To validate this functionality continues to operate as intended, creating tests that can be ran and re-ran against custom cmdlets is part of the framework. + +## Usage +To execute tests, run the `test-module.ps1`. To write tests, [this example](https://github.com/pester/Pester/blob/8b9cf4248315e44f1ac6673be149f7e0d7f10466/Examples/Planets/Get-Planet.Tests.ps1#L1) from the Pester repository is very useful for getting started. \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/test/Remove-AzSiteRecoveryReplicationFabric.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/Remove-AzSiteRecoveryReplicationFabric.Tests.ps1 new file mode 100644 index 000000000000..f69f9743cbb2 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/Remove-AzSiteRecoveryReplicationFabric.Tests.ps1 @@ -0,0 +1,25 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Remove-AzSiteRecoveryReplicationFabric')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Remove-AzSiteRecoveryReplicationFabric.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Remove-AzSiteRecoveryReplicationFabric' { + It 'Delete' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'DeleteViaIdentity' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/Remove-AzSiteRecoveryReplicationMigrationItem.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/Remove-AzSiteRecoveryReplicationMigrationItem.Tests.ps1 new file mode 100644 index 000000000000..541b83d94604 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/Remove-AzSiteRecoveryReplicationMigrationItem.Tests.ps1 @@ -0,0 +1,25 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Remove-AzSiteRecoveryReplicationMigrationItem')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Remove-AzSiteRecoveryReplicationMigrationItem.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Remove-AzSiteRecoveryReplicationMigrationItem' { + It 'Delete' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'DeleteViaIdentity' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/Remove-AzSiteRecoveryReplicationNetworkMapping.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/Remove-AzSiteRecoveryReplicationNetworkMapping.Tests.ps1 new file mode 100644 index 000000000000..6fea22bfd585 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/Remove-AzSiteRecoveryReplicationNetworkMapping.Tests.ps1 @@ -0,0 +1,25 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Remove-AzSiteRecoveryReplicationNetworkMapping')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Remove-AzSiteRecoveryReplicationNetworkMapping.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Remove-AzSiteRecoveryReplicationNetworkMapping' { + It 'Delete' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'DeleteViaIdentity' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/Remove-AzSiteRecoveryReplicationPolicy.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/Remove-AzSiteRecoveryReplicationPolicy.Tests.ps1 new file mode 100644 index 000000000000..caa8782ba1fb --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/Remove-AzSiteRecoveryReplicationPolicy.Tests.ps1 @@ -0,0 +1,25 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Remove-AzSiteRecoveryReplicationPolicy')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Remove-AzSiteRecoveryReplicationPolicy.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Remove-AzSiteRecoveryReplicationPolicy' { + It 'Delete' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'DeleteViaIdentity' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/Remove-AzSiteRecoveryReplicationProtectedItem.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/Remove-AzSiteRecoveryReplicationProtectedItem.Tests.ps1 new file mode 100644 index 000000000000..e05e031ebd4a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/Remove-AzSiteRecoveryReplicationProtectedItem.Tests.ps1 @@ -0,0 +1,33 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Remove-AzSiteRecoveryReplicationProtectedItem')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Remove-AzSiteRecoveryReplicationProtectedItem.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Remove-AzSiteRecoveryReplicationProtectedItem' { + It 'DeleteExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'Delete' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'DeleteViaIdentityExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'DeleteViaIdentity' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/Remove-AzSiteRecoveryReplicationProtectedItemDisk.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/Remove-AzSiteRecoveryReplicationProtectedItemDisk.Tests.ps1 new file mode 100644 index 000000000000..b9f0483592bd --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/Remove-AzSiteRecoveryReplicationProtectedItemDisk.Tests.ps1 @@ -0,0 +1,33 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Remove-AzSiteRecoveryReplicationProtectedItemDisk')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Remove-AzSiteRecoveryReplicationProtectedItemDisk.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Remove-AzSiteRecoveryReplicationProtectedItemDisk' { + It 'RemoveExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'Remove' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'RemoveViaIdentityExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'RemoveViaIdentity' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/Remove-AzSiteRecoveryReplicationProtectionContainer.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/Remove-AzSiteRecoveryReplicationProtectionContainer.Tests.ps1 new file mode 100644 index 000000000000..4bcaa991bac5 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/Remove-AzSiteRecoveryReplicationProtectionContainer.Tests.ps1 @@ -0,0 +1,25 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Remove-AzSiteRecoveryReplicationProtectionContainer')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Remove-AzSiteRecoveryReplicationProtectionContainer.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Remove-AzSiteRecoveryReplicationProtectionContainer' { + It 'Delete' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'DeleteViaIdentity' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/Remove-AzSiteRecoveryReplicationProtectionContainerMapping.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/Remove-AzSiteRecoveryReplicationProtectionContainerMapping.Tests.ps1 new file mode 100644 index 000000000000..9e50d8f07153 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/Remove-AzSiteRecoveryReplicationProtectionContainerMapping.Tests.ps1 @@ -0,0 +1,33 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Remove-AzSiteRecoveryReplicationProtectionContainerMapping')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Remove-AzSiteRecoveryReplicationProtectionContainerMapping.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Remove-AzSiteRecoveryReplicationProtectionContainerMapping' { + It 'DeleteExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'Delete' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'DeleteViaIdentityExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'DeleteViaIdentity' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/Remove-AzSiteRecoveryReplicationRecoveryPlan.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/Remove-AzSiteRecoveryReplicationRecoveryPlan.Tests.ps1 new file mode 100644 index 000000000000..fec369196249 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/Remove-AzSiteRecoveryReplicationRecoveryPlan.Tests.ps1 @@ -0,0 +1,25 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Remove-AzSiteRecoveryReplicationRecoveryPlan')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Remove-AzSiteRecoveryReplicationRecoveryPlan.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Remove-AzSiteRecoveryReplicationRecoveryPlan' { + It 'Delete' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'DeleteViaIdentity' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/Remove-AzSiteRecoveryReplicationRecoveryServicesProvider.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/Remove-AzSiteRecoveryReplicationRecoveryServicesProvider.Tests.ps1 new file mode 100644 index 000000000000..a762ddace201 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/Remove-AzSiteRecoveryReplicationRecoveryServicesProvider.Tests.ps1 @@ -0,0 +1,25 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Remove-AzSiteRecoveryReplicationRecoveryServicesProvider')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Remove-AzSiteRecoveryReplicationRecoveryServicesProvider.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Remove-AzSiteRecoveryReplicationRecoveryServicesProvider' { + It 'Delete' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'DeleteViaIdentity' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/Remove-AzSiteRecoveryReplicationStorageClassificationMapping.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/Remove-AzSiteRecoveryReplicationStorageClassificationMapping.Tests.ps1 new file mode 100644 index 000000000000..de06a1b0065d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/Remove-AzSiteRecoveryReplicationStorageClassificationMapping.Tests.ps1 @@ -0,0 +1,25 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Remove-AzSiteRecoveryReplicationStorageClassificationMapping')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Remove-AzSiteRecoveryReplicationStorageClassificationMapping.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Remove-AzSiteRecoveryReplicationStorageClassificationMapping' { + It 'Delete' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'DeleteViaIdentity' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/Remove-AzSiteRecoveryReplicationvCenter.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/Remove-AzSiteRecoveryReplicationvCenter.Tests.ps1 new file mode 100644 index 000000000000..8ac62ebe20fc --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/Remove-AzSiteRecoveryReplicationvCenter.Tests.ps1 @@ -0,0 +1,25 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Remove-AzSiteRecoveryReplicationvCenter')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Remove-AzSiteRecoveryReplicationvCenter.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Remove-AzSiteRecoveryReplicationvCenter' { + It 'Delete' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'DeleteViaIdentity' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/Repair-AzSiteRecoveryReplicationProtectedItemReplication.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/Repair-AzSiteRecoveryReplicationProtectedItemReplication.Tests.ps1 new file mode 100644 index 000000000000..508cb6227d9b --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/Repair-AzSiteRecoveryReplicationProtectedItemReplication.Tests.ps1 @@ -0,0 +1,25 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Repair-AzSiteRecoveryReplicationProtectedItemReplication')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Repair-AzSiteRecoveryReplicationProtectedItemReplication.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Repair-AzSiteRecoveryReplicationProtectedItemReplication' { + It 'Repair' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'RepairViaIdentity' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/Resolve-AzSiteRecoveryReplicationProtectedItemHealthError.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/Resolve-AzSiteRecoveryReplicationProtectedItemHealthError.Tests.ps1 new file mode 100644 index 000000000000..4f1058201089 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/Resolve-AzSiteRecoveryReplicationProtectedItemHealthError.Tests.ps1 @@ -0,0 +1,33 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Resolve-AzSiteRecoveryReplicationProtectedItemHealthError')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Resolve-AzSiteRecoveryReplicationProtectedItemHealthError.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Resolve-AzSiteRecoveryReplicationProtectedItemHealthError' { + It 'ResolveExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'Resolve' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'ResolveViaIdentityExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'ResolveViaIdentity' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/Restart-AzSiteRecoveryReplicationJob.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/Restart-AzSiteRecoveryReplicationJob.Tests.ps1 new file mode 100644 index 000000000000..f89c2826b93c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/Restart-AzSiteRecoveryReplicationJob.Tests.ps1 @@ -0,0 +1,25 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Restart-AzSiteRecoveryReplicationJob')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Restart-AzSiteRecoveryReplicationJob.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Restart-AzSiteRecoveryReplicationJob' { + It 'Restart' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'RestartViaIdentity' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/Resume-AzSiteRecoveryReplicationJob.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/Resume-AzSiteRecoveryReplicationJob.Tests.ps1 new file mode 100644 index 000000000000..bdea3a4ff534 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/Resume-AzSiteRecoveryReplicationJob.Tests.ps1 @@ -0,0 +1,33 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Resume-AzSiteRecoveryReplicationJob')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Resume-AzSiteRecoveryReplicationJob.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Resume-AzSiteRecoveryReplicationJob' { + It 'ResumeExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'Resume' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'ResumeViaIdentityExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'ResumeViaIdentity' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/Resume-AzSiteRecoveryReplicationMigrationItemReplication.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/Resume-AzSiteRecoveryReplicationMigrationItemReplication.Tests.ps1 new file mode 100644 index 000000000000..480d59e7739c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/Resume-AzSiteRecoveryReplicationMigrationItemReplication.Tests.ps1 @@ -0,0 +1,33 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Resume-AzSiteRecoveryReplicationMigrationItemReplication')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Resume-AzSiteRecoveryReplicationMigrationItemReplication.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Resume-AzSiteRecoveryReplicationMigrationItemReplication' { + It 'ResumeExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'Resume' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'ResumeViaIdentityExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'ResumeViaIdentity' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/Stop-AzSiteRecoveryReplicationJob.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/Stop-AzSiteRecoveryReplicationJob.Tests.ps1 new file mode 100644 index 000000000000..8f1fc117a211 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/Stop-AzSiteRecoveryReplicationJob.Tests.ps1 @@ -0,0 +1,25 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Stop-AzSiteRecoveryReplicationJob')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Stop-AzSiteRecoveryReplicationJob.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Stop-AzSiteRecoveryReplicationJob' { + It 'Cancel' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'CancelViaIdentity' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/Stop-AzSiteRecoveryReplicationProtectedItemFailover.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/Stop-AzSiteRecoveryReplicationProtectedItemFailover.Tests.ps1 new file mode 100644 index 000000000000..cba3ba3b74b9 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/Stop-AzSiteRecoveryReplicationProtectedItemFailover.Tests.ps1 @@ -0,0 +1,25 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Stop-AzSiteRecoveryReplicationProtectedItemFailover')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Stop-AzSiteRecoveryReplicationProtectedItemFailover.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Stop-AzSiteRecoveryReplicationProtectedItemFailover' { + It 'Cancel' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'CancelViaIdentity' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/Stop-AzSiteRecoveryReplicationRecoveryPlanFailover.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/Stop-AzSiteRecoveryReplicationRecoveryPlanFailover.Tests.ps1 new file mode 100644 index 000000000000..3cae74a984c3 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/Stop-AzSiteRecoveryReplicationRecoveryPlanFailover.Tests.ps1 @@ -0,0 +1,25 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Stop-AzSiteRecoveryReplicationRecoveryPlanFailover')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Stop-AzSiteRecoveryReplicationRecoveryPlanFailover.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Stop-AzSiteRecoveryReplicationRecoveryPlanFailover' { + It 'Cancel' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'CancelViaIdentity' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/Suspend-AzSiteRecoveryReplicationMigrationItemReplication.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/Suspend-AzSiteRecoveryReplicationMigrationItemReplication.Tests.ps1 new file mode 100644 index 000000000000..30ea0910b661 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/Suspend-AzSiteRecoveryReplicationMigrationItemReplication.Tests.ps1 @@ -0,0 +1,33 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Suspend-AzSiteRecoveryReplicationMigrationItemReplication')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Suspend-AzSiteRecoveryReplicationMigrationItemReplication.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Suspend-AzSiteRecoveryReplicationMigrationItemReplication' { + It 'PauseExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'Pause' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'PauseViaIdentityExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'PauseViaIdentity' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/Switch-AzSiteRecoveryReplicationProtectedItemProvider.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/Switch-AzSiteRecoveryReplicationProtectedItemProvider.Tests.ps1 new file mode 100644 index 000000000000..3c32f89ff813 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/Switch-AzSiteRecoveryReplicationProtectedItemProvider.Tests.ps1 @@ -0,0 +1,33 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Switch-AzSiteRecoveryReplicationProtectedItemProvider')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Switch-AzSiteRecoveryReplicationProtectedItemProvider.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Switch-AzSiteRecoveryReplicationProtectedItemProvider' { + It 'SwitchExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'Switch' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'SwitchViaIdentityExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'SwitchViaIdentity' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/Switch-AzSiteRecoveryReplicationProtectionContainerProtection.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/Switch-AzSiteRecoveryReplicationProtectionContainerProtection.Tests.ps1 new file mode 100644 index 000000000000..f71c546c24ee --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/Switch-AzSiteRecoveryReplicationProtectionContainerProtection.Tests.ps1 @@ -0,0 +1,33 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Switch-AzSiteRecoveryReplicationProtectionContainerProtection')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Switch-AzSiteRecoveryReplicationProtectionContainerProtection.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Switch-AzSiteRecoveryReplicationProtectionContainerProtection' { + It 'SwitchExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'Switch' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'SwitchViaIdentityExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'SwitchViaIdentity' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/Test-AzSiteRecoveryReplicationFabricConsistency.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/Test-AzSiteRecoveryReplicationFabricConsistency.Tests.ps1 new file mode 100644 index 000000000000..b0caadb3e6d6 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/Test-AzSiteRecoveryReplicationFabricConsistency.Tests.ps1 @@ -0,0 +1,25 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Test-AzSiteRecoveryReplicationFabricConsistency')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Test-AzSiteRecoveryReplicationFabricConsistency.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Test-AzSiteRecoveryReplicationFabricConsistency' { + It 'Check' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'CheckViaIdentity' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/Test-AzSiteRecoveryReplicationMigrationItemMigrate.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/Test-AzSiteRecoveryReplicationMigrationItemMigrate.Tests.ps1 new file mode 100644 index 000000000000..e13a4c5c5e36 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/Test-AzSiteRecoveryReplicationMigrationItemMigrate.Tests.ps1 @@ -0,0 +1,33 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Test-AzSiteRecoveryReplicationMigrationItemMigrate')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Test-AzSiteRecoveryReplicationMigrationItemMigrate.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Test-AzSiteRecoveryReplicationMigrationItemMigrate' { + It 'TestExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'Test' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'TestViaIdentityExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'TestViaIdentity' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/Test-AzSiteRecoveryReplicationMigrationItemMigrateCleanup.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/Test-AzSiteRecoveryReplicationMigrationItemMigrateCleanup.Tests.ps1 new file mode 100644 index 000000000000..0f6b968c6e1a --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/Test-AzSiteRecoveryReplicationMigrationItemMigrateCleanup.Tests.ps1 @@ -0,0 +1,33 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Test-AzSiteRecoveryReplicationMigrationItemMigrateCleanup')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Test-AzSiteRecoveryReplicationMigrationItemMigrateCleanup.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Test-AzSiteRecoveryReplicationMigrationItemMigrateCleanup' { + It 'TestExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'Test' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'TestViaIdentityExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'TestViaIdentity' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/Test-AzSiteRecoveryReplicationProtectedItemFailover.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/Test-AzSiteRecoveryReplicationProtectedItemFailover.Tests.ps1 new file mode 100644 index 000000000000..48057e2620ac --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/Test-AzSiteRecoveryReplicationProtectedItemFailover.Tests.ps1 @@ -0,0 +1,33 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Test-AzSiteRecoveryReplicationProtectedItemFailover')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Test-AzSiteRecoveryReplicationProtectedItemFailover.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Test-AzSiteRecoveryReplicationProtectedItemFailover' { + It 'TestExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'Test' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'TestViaIdentityExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'TestViaIdentity' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/Test-AzSiteRecoveryReplicationProtectedItemFailoverCleanup.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/Test-AzSiteRecoveryReplicationProtectedItemFailoverCleanup.Tests.ps1 new file mode 100644 index 000000000000..ea300ecba65c --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/Test-AzSiteRecoveryReplicationProtectedItemFailoverCleanup.Tests.ps1 @@ -0,0 +1,33 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Test-AzSiteRecoveryReplicationProtectedItemFailoverCleanup')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Test-AzSiteRecoveryReplicationProtectedItemFailoverCleanup.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Test-AzSiteRecoveryReplicationProtectedItemFailoverCleanup' { + It 'TestExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'Test' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'TestViaIdentityExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'TestViaIdentity' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/Test-AzSiteRecoveryReplicationRecoveryPlanFailover.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/Test-AzSiteRecoveryReplicationRecoveryPlanFailover.Tests.ps1 new file mode 100644 index 000000000000..4be110256fc3 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/Test-AzSiteRecoveryReplicationRecoveryPlanFailover.Tests.ps1 @@ -0,0 +1,33 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Test-AzSiteRecoveryReplicationRecoveryPlanFailover')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Test-AzSiteRecoveryReplicationRecoveryPlanFailover.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Test-AzSiteRecoveryReplicationRecoveryPlanFailover' { + It 'TestExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'Test' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'TestViaIdentityExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'TestViaIdentity' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/Test-AzSiteRecoveryReplicationRecoveryPlanFailoverCleanup.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/Test-AzSiteRecoveryReplicationRecoveryPlanFailoverCleanup.Tests.ps1 new file mode 100644 index 000000000000..b14bb0e00917 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/Test-AzSiteRecoveryReplicationRecoveryPlanFailoverCleanup.Tests.ps1 @@ -0,0 +1,33 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Test-AzSiteRecoveryReplicationRecoveryPlanFailoverCleanup')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Test-AzSiteRecoveryReplicationRecoveryPlanFailoverCleanup.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Test-AzSiteRecoveryReplicationRecoveryPlanFailoverCleanup' { + It 'TestExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'Test' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'TestViaIdentityExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'TestViaIdentity' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/Update-AzSiteRecoveryReplicationMigrationItem.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/Update-AzSiteRecoveryReplicationMigrationItem.Tests.ps1 new file mode 100644 index 000000000000..4e37644df757 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/Update-AzSiteRecoveryReplicationMigrationItem.Tests.ps1 @@ -0,0 +1,25 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Update-AzSiteRecoveryReplicationMigrationItem')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Update-AzSiteRecoveryReplicationMigrationItem.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Update-AzSiteRecoveryReplicationMigrationItem' { + It 'UpdateExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'UpdateViaIdentityExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/Update-AzSiteRecoveryReplicationNetworkMapping.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/Update-AzSiteRecoveryReplicationNetworkMapping.Tests.ps1 new file mode 100644 index 000000000000..20c2c41ba30d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/Update-AzSiteRecoveryReplicationNetworkMapping.Tests.ps1 @@ -0,0 +1,25 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Update-AzSiteRecoveryReplicationNetworkMapping')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Update-AzSiteRecoveryReplicationNetworkMapping.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Update-AzSiteRecoveryReplicationNetworkMapping' { + It 'UpdateExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'UpdateViaIdentityExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/Update-AzSiteRecoveryReplicationPolicy.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/Update-AzSiteRecoveryReplicationPolicy.Tests.ps1 new file mode 100644 index 000000000000..8d9bb2c75308 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/Update-AzSiteRecoveryReplicationPolicy.Tests.ps1 @@ -0,0 +1,25 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Update-AzSiteRecoveryReplicationPolicy')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Update-AzSiteRecoveryReplicationPolicy.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Update-AzSiteRecoveryReplicationPolicy' { + It 'UpdateExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'UpdateViaIdentityExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/Update-AzSiteRecoveryReplicationProtectedItem.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/Update-AzSiteRecoveryReplicationProtectedItem.Tests.ps1 new file mode 100644 index 000000000000..2afdb2dc3199 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/Update-AzSiteRecoveryReplicationProtectedItem.Tests.ps1 @@ -0,0 +1,25 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Update-AzSiteRecoveryReplicationProtectedItem')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Update-AzSiteRecoveryReplicationProtectedItem.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Update-AzSiteRecoveryReplicationProtectedItem' { + It 'UpdateExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'UpdateViaIdentityExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/Update-AzSiteRecoveryReplicationProtectedItemAppliance.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/Update-AzSiteRecoveryReplicationProtectedItemAppliance.Tests.ps1 new file mode 100644 index 000000000000..8998948bd28f --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/Update-AzSiteRecoveryReplicationProtectedItemAppliance.Tests.ps1 @@ -0,0 +1,25 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Update-AzSiteRecoveryReplicationProtectedItemAppliance')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Update-AzSiteRecoveryReplicationProtectedItemAppliance.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Update-AzSiteRecoveryReplicationProtectedItemAppliance' { + It 'UpdateExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'UpdateViaIdentityExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/Update-AzSiteRecoveryReplicationProtectedItemMobilityService.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/Update-AzSiteRecoveryReplicationProtectedItemMobilityService.Tests.ps1 new file mode 100644 index 000000000000..a8580acee54d --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/Update-AzSiteRecoveryReplicationProtectedItemMobilityService.Tests.ps1 @@ -0,0 +1,25 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Update-AzSiteRecoveryReplicationProtectedItemMobilityService')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Update-AzSiteRecoveryReplicationProtectedItemMobilityService.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Update-AzSiteRecoveryReplicationProtectedItemMobilityService' { + It 'UpdateExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'UpdateViaIdentityExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/Update-AzSiteRecoveryReplicationProtectionContainerMapping.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/Update-AzSiteRecoveryReplicationProtectionContainerMapping.Tests.ps1 new file mode 100644 index 000000000000..be48124322a8 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/Update-AzSiteRecoveryReplicationProtectionContainerMapping.Tests.ps1 @@ -0,0 +1,25 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Update-AzSiteRecoveryReplicationProtectionContainerMapping')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Update-AzSiteRecoveryReplicationProtectionContainerMapping.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Update-AzSiteRecoveryReplicationProtectionContainerMapping' { + It 'UpdateExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'UpdateViaIdentityExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/Update-AzSiteRecoveryReplicationRecoveryPlan.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/Update-AzSiteRecoveryReplicationRecoveryPlan.Tests.ps1 new file mode 100644 index 000000000000..2b9c2ff37e98 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/Update-AzSiteRecoveryReplicationRecoveryPlan.Tests.ps1 @@ -0,0 +1,25 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Update-AzSiteRecoveryReplicationRecoveryPlan')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Update-AzSiteRecoveryReplicationRecoveryPlan.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Update-AzSiteRecoveryReplicationRecoveryPlan' { + It 'UpdateExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'UpdateViaIdentityExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/Update-AzSiteRecoveryReplicationRecoveryServiceProvider.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/Update-AzSiteRecoveryReplicationRecoveryServiceProvider.Tests.ps1 new file mode 100644 index 000000000000..4a27555e4a09 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/Update-AzSiteRecoveryReplicationRecoveryServiceProvider.Tests.ps1 @@ -0,0 +1,25 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Update-AzSiteRecoveryReplicationRecoveryServiceProvider')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Update-AzSiteRecoveryReplicationRecoveryServiceProvider.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Update-AzSiteRecoveryReplicationRecoveryServiceProvider' { + It 'Refresh' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'RefreshViaIdentity' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/Update-AzSiteRecoveryReplicationVaultHealth.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/Update-AzSiteRecoveryReplicationVaultHealth.Tests.ps1 new file mode 100644 index 000000000000..c2ba46bc041e --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/Update-AzSiteRecoveryReplicationVaultHealth.Tests.ps1 @@ -0,0 +1,25 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Update-AzSiteRecoveryReplicationVaultHealth')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Update-AzSiteRecoveryReplicationVaultHealth.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Update-AzSiteRecoveryReplicationVaultHealth' { + It 'Refresh' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'RefreshViaIdentity' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/Update-AzSiteRecoveryReplicationvCenter.Tests.ps1 b/swaggerci/recoveryservicessiterecovery/test/Update-AzSiteRecoveryReplicationvCenter.Tests.ps1 new file mode 100644 index 000000000000..c1fede73d160 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/Update-AzSiteRecoveryReplicationvCenter.Tests.ps1 @@ -0,0 +1,25 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Update-AzSiteRecoveryReplicationvCenter')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Update-AzSiteRecoveryReplicationvCenter.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Update-AzSiteRecoveryReplicationvCenter' { + It 'UpdateExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'UpdateViaIdentityExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/swaggerci/recoveryservicessiterecovery/test/loadEnv.ps1 b/swaggerci/recoveryservicessiterecovery/test/loadEnv.ps1 new file mode 100644 index 000000000000..0ea394729062 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/loadEnv.ps1 @@ -0,0 +1,21 @@ +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights 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. +# ---------------------------------------------------------------------------------- +$envFile = 'env.json' +if ($TestMode -eq 'live') { + $envFile = 'localEnv.json' +} + +if (Test-Path -Path (Join-Path $PSScriptRoot $envFile)) { + $envFilePath = Join-Path $PSScriptRoot $envFile +} else { + $envFilePath = Join-Path $PSScriptRoot '..\$envFile' +} +$env = @{} +if (Test-Path -Path $envFilePath) { + $env = Get-Content (Join-Path $PSScriptRoot $envFile) | ConvertFrom-Json + $PSDefaultParameterValues=@{"*:SubscriptionId"=$env.SubscriptionId; "*:Tenant"=$env.Tenant} +} \ No newline at end of file diff --git a/swaggerci/recoveryservicessiterecovery/test/utils.ps1 b/swaggerci/recoveryservicessiterecovery/test/utils.ps1 new file mode 100644 index 000000000000..1990edd45299 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/test/utils.ps1 @@ -0,0 +1,31 @@ +function RandomString([bool]$allChars, [int32]$len) { + if ($allChars) { + return -join ((33..126) | Get-Random -Count $len | % {[char]$_}) + } else { + return -join ((48..57) + (97..122) | Get-Random -Count $len | % {[char]$_}) + } +} +$env = @{} +if ($UsePreviousConfigForRecord) { + $previousEnv = Get-Content (Join-Path $PSScriptRoot 'env.json') | ConvertFrom-Json + $previousEnv.psobject.properties | Foreach-Object { $env[$_.Name] = $_.Value } +} +# Add script method called AddWithCache to $env, when useCache is set true, it will try to get the value from the $env first. +# example: $val = $env.AddWithCache('key', $val, $true) +$env | Add-Member -Type ScriptMethod -Value { param( [string]$key, [object]$val, [bool]$useCache) if ($this.Contains($key) -and $useCache) { return $this[$key] } else { $this[$key] = $val; return $val } } -Name 'AddWithCache' +function setupEnv() { + # Preload subscriptionId and tenant from context, which will be used in test + # as default. You could change them if needed. + $env.SubscriptionId = (Get-AzContext).Subscription.Id + $env.Tenant = (Get-AzContext).Tenant.Id + # For any resources you created for test, you should add it to $env here. + $envFile = 'env.json' + if ($TestMode -eq 'live') { + $envFile = 'localEnv.json' + } + set-content -Path (Join-Path $PSScriptRoot $envFile) -Value (ConvertTo-Json $env) +} +function cleanupEnv() { + # Clean resources you create for testing +} + diff --git a/swaggerci/recoveryservicessiterecovery/utils/Unprotect-SecureString.ps1 b/swaggerci/recoveryservicessiterecovery/utils/Unprotect-SecureString.ps1 new file mode 100644 index 000000000000..cb05b51a6220 --- /dev/null +++ b/swaggerci/recoveryservicessiterecovery/utils/Unprotect-SecureString.ps1 @@ -0,0 +1,16 @@ +#This script converts securestring to plaintext + +param( + [Parameter(Mandatory, ValueFromPipeline)] + [System.Security.SecureString] + ${SecureString} +) + +$ssPtr = [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($SecureString) +try { + $plaintext = [System.Runtime.InteropServices.Marshal]::PtrToStringBSTR($ssPtr) +} finally { + [System.Runtime.InteropServices.Marshal]::ZeroFreeBSTR($ssPtr) +} + +return $plaintext \ No newline at end of file